X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fbidi%2Fplugin.js;h=72f1041b6f5be8d660cfc4acb8e7ebf3edce97a7;hb=2f22c0c38f17e75be5541089076885442aaa2377;hp=a1ae6c8179109ca5bf929d86103b5169662cb936;hpb=4e90e78dc97789709ee7404359a5517540c27553;p=ckeditor.git diff --git a/_source/plugins/bidi/plugin.js b/_source/plugins/bidi/plugin.js index a1ae6c8..72f1041 100644 --- a/_source/plugins/bidi/plugin.js +++ b/_source/plugins/bidi/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -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 ?