Ticket #6865: 6865_5.patch
File 6865_5.patch, 4.7 KB (added by , 13 years ago) |
---|
-
_source/plugins/editingblock/plugin.js
195 195 */ 196 196 CKEDITOR.editor.prototype.focus = function() 197 197 { 198 this.forceNextSelectionCheck(); 198 199 var mode = getMode( this ); 199 200 if ( mode ) 200 201 mode.focus(); -
_source/plugins/bidi/plugin.js
76 76 77 77 function switchDir( element, dir, editor, database ) 78 78 { 79 if ( element.isReadOnly() ) 80 return; 81 79 82 // Mark this element as processed by switchDir. 80 83 CKEDITOR.dom.element.setMarker( database, element, 'bidi_processed', 1 ); 81 84 … … 101 104 if ( elementDir == dir ) 102 105 return null; 103 106 104 // Reuse computedState if we already have it.105 var dirBefore = useComputedState ? elementDir : element.getComputedStyle( 'direction' );106 107 107 // Clear direction on this element. 108 108 element.removeStyle( 'direction' ); 109 109 … … 119 119 // Set new direction for this element. 120 120 element.setAttribute( 'dir', dir ); 121 121 122 // If the element direction changed, we need to switch the margins of123 // the element and all its children, so it will get really reflected124 // like a mirror. (#5910)125 if ( dir != dirBefore )126 {127 editor.fire( 'dirChanged',128 {129 node : element,130 dir : dir131 } );132 }133 134 122 editor.forceNextSelectionCheck(); 135 123 136 124 return null; … … 191 179 ) 192 180 selectedElement = getFullySelected( range, guardElements, enterMode ); 193 181 194 if ( selectedElement && !selectedElement.isReadOnly() ) 195 switchDir( selectedElement, dir, editor, database ); 182 selectedElement && switchDir( selectedElement, dir, editor, database ); 196 183 197 184 var iterator, 198 185 block; … … 222 209 iterator.enlargeBr = enterMode != CKEDITOR.ENTER_BR; 223 210 224 211 while ( ( block = iterator.getNextParagraph( enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) ) ) 225 !block.isReadOnly() &&switchDir( block, dir, editor, database );212 switchDir( block, dir, editor, database ); 226 213 } 227 214 228 215 CKEDITOR.dom.element.clearAllMarkers( database ); … … 261 248 addButtonCommand( 'BidiRtl', lang.rtl, 'bidirtl', bidiCommand( 'rtl' ) ); 262 249 263 250 editor.on( 'selectionChange', onSelectionChange ); 251 editor.on( 'contentDom', function() 252 { 253 editor.document.on( 'dirChanged', function( evt ) 254 { 255 editor.fire( 'dirChanged', 256 { 257 node : evt.data, 258 dir : evt.data.getDirection( 1 ) 259 } ); 260 }) 261 }); 264 262 } 265 263 }); 266 264 265 // If the element direction changed, we need to switch the margins of 266 // the element and all its children, so it will get really reflected 267 // like a mirror. (#5910) 268 function dirChangeNotifier( org ) 269 { 270 var isAttribute = org == elementProto.setAttribute, 271 isRemoveAttribute = org == elementProto.removeAttribute, 272 dirStyleRegexp = /\bdirection\s*:\s*(.*?)\s*(:?$|;)/; 273 274 return function( name, val ) 275 { 276 if ( !this.getDocument().equals( CKEDITOR.document ) ) 277 { 278 var orgDir, dir; 279 if ( name == ( isAttribute || isRemoveAttribute ? 'dir' : 'direction' ) || 280 name == 'style' && ( isRemoveAttribute || dirStyleRegexp.test( val ) ) ) 281 { 282 orgDir = this.getDirection( 1 ); 283 var retval = org.apply( this, arguments ); 284 if ( orgDir != this.getDirection( 1 ) ) 285 { 286 this.getDocument().fire( 'dirChanged', this ); 287 return retval; 288 } 289 } 290 } 291 292 return org.apply( this, arguments ); 293 }; 294 } 295 296 var elementProto = CKEDITOR.dom.element.prototype, 297 methods = [ 'setStyle', 'removeStyle', 'setAttribute', 'removeAttribute' ]; 298 for ( var i = 0; i < methods.length; i++ ) 299 elementProto[ methods[ i ] ] = CKEDITOR.tools.override( elementProto[ methods [ i ] ], dirChangeNotifier ); 267 300 })(); 268 301 269 302 /** -
_source/plugins/dialogadvtab/plugin.js
36 36 var attrName = this.att, 37 37 value = this.getValue(); 38 38 39 // Broadcast Lang Dir change40 if ( attrName == 'dir' )41 {42 var dir = element.getAttribute( attrName );43 if ( dir != value && element.getParent() )44 this._.dialog._.editor.fire( 'dirChanged', { node : element, dir : value || element.getDirection( 1 ) } );45 }46 47 39 if ( value ) 48 40 element.setAttribute( attrName, value ); 49 41 else