X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fbidi%2Fplugin.js;h=2233ee1881a54d462bbfa7c0ec1b80f2351f8810;hb=e73319a12b56100b29ef456fd74114fe5519e01c;hp=a1ae6c8179109ca5bf929d86103b5169662cb936;hpb=4e90e78dc97789709ee7404359a5517540c27553;p=ckeditor.git diff --git a/_source/plugins/bidi/plugin.js b/_source/plugins/bidi/plugin.js index a1ae6c8..2233ee1 100644 --- a/_source/plugins/bidi/plugin.js +++ b/_source/plugins/bidi/plugin.js @@ -22,6 +22,10 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { var editor = evt.editor, path = evt.data.path; + + if ( editor.readOnly ) + return; + var useComputedState = editor.config.useComputedState, selectedElement; @@ -34,10 +38,13 @@ For licensing, see LICENSE.html or http://ckeditor.com/license selectedElement = selectedElement || path.block || path.blockLimit; // If we're having BODY here, user probably done CTRL+A, let's try to get the enclosed node, if any. - selectedElement.is( 'body' ) && - ( selectedElement = editor.getSelection().getRanges()[ 0 ].getEnclosedNode() ); + if ( selectedElement.is( 'body' ) ) + { + var enclosedNode = editor.getSelection().getRanges()[ 0 ].getEnclosedNode(); + enclosedNode && enclosedNode.type == CKEDITOR.NODE_ELEMENT && ( selectedElement = enclosedNode ); + } - if ( !selectedElement ) + if ( !selectedElement ) return; var selectionDir = useComputedState ?