Ticket #6865: 6865_4.patch
File 6865_4.patch, 4.3 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 … … 119 122 // Set new direction for this element. 120 123 element.setAttribute( 'dir', dir ); 121 124 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 125 editor.forceNextSelectionCheck(); 135 126 136 127 return null; … … 191 182 ) 192 183 selectedElement = getFullySelected( range, guardElements, enterMode ); 193 184 194 if ( selectedElement && !selectedElement.isReadOnly() ) 195 switchDir( selectedElement, dir, editor, database ); 185 selectedElement && switchDir( selectedElement, dir, editor, database ); 196 186 197 187 var iterator, 198 188 block; … … 222 212 iterator.enlargeBr = enterMode != CKEDITOR.ENTER_BR; 223 213 224 214 while ( ( block = iterator.getNextParagraph( enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) ) ) 225 !block.isReadOnly() &&switchDir( block, dir, editor, database );215 switchDir( block, dir, editor, database ); 226 216 } 227 217 228 218 CKEDITOR.dom.element.clearAllMarkers( database ); … … 261 251 addButtonCommand( 'BidiRtl', lang.rtl, 'bidirtl', bidiCommand( 'rtl' ) ); 262 252 263 253 editor.on( 'selectionChange', onSelectionChange ); 254 editor.on( 'contentDom', function() 255 { 256 editor.document.on( 'dirChanged', function( evt ) 257 { 258 editor.fire( 'dirChanged', 259 { 260 node : evt.data, 261 dir : evt.data.getDirection() 262 } ); 263 }) 264 }); 264 265 } 265 266 }); 266 267 268 // If the element direction changed, we need to switch the margins of 269 // the element and all its children, so it will get really reflected 270 // like a mirror. (#5910) 271 function dirChangeNotifier( org ) 272 { 273 var isAttribute = org == elementProto.setAttribute, 274 dirStyleRegexp = /\bdirection\s*:\s*(.*?)\s*(:?$|;)/; 275 276 return function( name, val ) 277 { 278 if ( !this.getDocument().equals( CKEDITOR.document ) ) 279 { 280 var dirStyleMatch, dir; 281 if ( name == ( isAttribute ? 'dir' : 'direction' ) || 282 isAttribute && name == 'style' && ( dirStyleMatch = val.match( dirStyleRegexp ) ) ) 283 { 284 dir = dirStyleMatch ? dirStyleMatch[ 1 ] : val; 285 286 if ( this.getDirection() != dir ) 287 { 288 var retval = org.apply( this, arguments ); 289 this.getDocument().fire( 'dirChanged', this ); 290 return retval; 291 } 292 } 293 } 294 295 return org.apply( this, arguments ); 296 }; 297 } 298 299 var elementProto = CKEDITOR.dom.element.prototype; 300 elementProto.setStyle = CKEDITOR.tools.override( elementProto.setStyle, dirChangeNotifier ); 301 elementProto.setAttribute = CKEDITOR.tools.override( elementProto.setAttribute, dirChangeNotifier ); 302 267 303 })(); 268 304 269 305 /** -
_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