Ticket #6865: 6865_3.patch
File 6865_3.patch, 6.0 KB (added by , 13 years ago) |
---|
-
_source/core/tools.js
727 727 genKey : function() 728 728 { 729 729 return Array.prototype.slice.call( arguments ).join( '-' ); 730 }, 731 732 /** 733 * Turn piece of inline style text properties into one hash. 734 * @param styleText 735 */ 736 parseStyleText : function( styleText ) 737 { 738 var retval = {}; 739 styleText 740 .replace( /"/g, '"' ) 741 .replace( /\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g, function( match, name, value ) 742 { 743 retval[ name ] = value; 744 } ); 745 return retval; 730 746 } 731 747 }; 732 748 })(); -
_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 return function( name, val ) 275 { 276 if ( !this.getDocument().equals( CKEDITOR.document ) ) 277 { 278 if ( name == ( isAttribute ? 'dir' : 'direction' ) && this.getDirection() != val ) 279 { 280 var retval = org.apply( this, arguments ); 281 this.getDocument().fire( 'dirChanged', this ); 282 return retval; 283 } 284 else if ( isAttribute && name == 'style' ) 285 this.setStyles( CKEDITOR.tools.parseStyleText( val ) ); 286 } 287 288 return org.apply( this, arguments ); 289 }; 290 } 291 292 var elementProto = CKEDITOR.dom.element.prototype; 293 elementProto.setStyle = CKEDITOR.tools.override( elementProto.setStyle, dirChangeNotifier ); 294 elementProto.setAttribute = CKEDITOR.tools.override( elementProto.setAttribute, dirChangeNotifier ); 295 267 296 })(); 268 297 269 298 /** -
_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 -
_source/plugins/styles/plugin.js
1462 1462 .toLowerCase(); 1463 1463 } 1464 1464 1465 // Turn inline style text properties into one hash.1466 function parseStyleText( styleText )1467 {1468 var retval = {};1469 styleText1470 .replace( /"/g, '"' )1471 .replace( /\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g, function( match, name, value )1472 {1473 retval[ name ] = value;1474 } );1475 return retval;1476 }1477 1478 1465 /** 1479 1466 * Compare two bunch of styles, with the speciality that value 'inherit' 1480 1467 * is treated as a wildcard which will match any value. … … 1483 1470 */ 1484 1471 function compareCssText( source, target ) 1485 1472 { 1486 typeof source == 'string' && ( source = parseStyleText( source ) );1487 typeof target == 'string' && ( target = parseStyleText( target ) );1473 typeof source == 'string' && ( source = CKEDITOR.tools.parseStyleText( source ) ); 1474 typeof target == 'string' && ( target = CKEDITOR.tools.parseStyleText( target ) ); 1488 1475 for( var name in source ) 1489 1476 { 1490 1477 if ( !( name in target &&