Ticket #6082: 6082.patch
File 6082.patch, 4.6 KB (added by , 14 years ago) |
---|
-
_source/core/config.js
330 330 baseFloatZIndex : 10000 331 331 }; 332 332 333 /** 334 * Indicates that some of the editor features, like alignement and text 335 * direction, should used the "computed value" of the feature to indicate it's 336 * on/off state, instead of using the "real value". 337 * 338 * If enabled, in a left to right written document, the "Left Justify" 339 * alignment button will show as active, even if the aligment style is not 340 * explicitly applied to the current paragraph in the editor. 341 * @name CKEDITOR.config.useComputedState 342 * @type Boolean 343 * @default true 344 * @example 345 * config.useComputedState = false; 346 */ 347 333 348 // PACKAGER_RENAME( CKEDITOR.config ) -
_source/plugins/bidi/plugin.js
17 17 18 18 function getState( editor, path, dir ) 19 19 { 20 var selection = editor.getSelection(),21 ranges = selection.getRanges();20 var useComputedState = editor.config.useComputedState, 21 selectedElement; 22 22 23 var selectedElement = ranges && ranges[ 0 ].getEnclosedNode();23 useComputedState = useComputedState === undefined || useComputedState; 24 24 25 // If this is not our element of interest, apply to fully selected elements from guardElements. 26 if ( !selectedElement || selectedElement 27 && !( selectedElement.type == CKEDITOR.NODE_ELEMENT && selectedElement.getName() in directSelectionGuardElements ) 28 ) 29 selectedElement = getFullySelected( selection, guardElements ); 25 if ( useComputedState ) 26 { 27 var selection = editor.getSelection(), 28 ranges = selection.getRanges(); 30 29 30 selectedElement = ranges && ranges[ 0 ].getEnclosedNode(); 31 32 // If this is not our element of interest, apply to fully selected elements from guardElements. 33 if ( !selectedElement || selectedElement 34 && !( selectedElement.type == CKEDITOR.NODE_ELEMENT && selectedElement.getName() in directSelectionGuardElements ) 35 ) 36 selectedElement = getFullySelected( selection, guardElements ); 37 } 38 31 39 selectedElement = selectedElement || path.block || path.blockLimit; 32 40 33 41 if ( !selectedElement || selectedElement.getName() == 'body' ) 34 42 return CKEDITOR.TRISTATE_OFF; 35 43 36 return ( selectedElement.getComputedStyle( 'direction' ) == dir ) ? 44 selectedElement = useComputedState ? 45 selectedElement.getComputedStyle( 'direction' ) : 46 selectedElement.getAttribute( 'dir' ); 47 48 return ( selectedElement == dir ) ? 37 49 CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF; 38 50 } 39 51 -
_source/plugins/justify/plugin.js
13 13 14 14 function getState( editor, path ) 15 15 { 16 var firstBlock = path.block || path.blockLimit; 16 var firstBlock = path.block || path.blockLimit, 17 useComputedState = editor.config.useComputedState, 18 currentAlign; 17 19 20 useComputedState = useComputedState === undefined || useComputedState; 21 18 22 if ( !firstBlock || firstBlock.getName() == 'body' ) 19 23 return CKEDITOR.TRISTATE_OFF; 20 24 21 var currentAlign = firstBlock.getComputedStyle( 'text-align' ).replace( alignRemoveRegex, '' ); 22 if ( ( !currentAlign && isDefaultAlign( this, firstBlock ) ) || currentAlign == this.value ) 25 currentAlign = useComputedState ? 26 firstBlock.getComputedStyle( 'text-align' ).replace( alignRemoveRegex, '' ) : 27 firstBlock.getStyle( 'text-align' ); 28 29 if ( ( !currentAlign && isDefaultAlign( this, firstBlock, editor ) ) || currentAlign == this.value ) 23 30 return CKEDITOR.TRISTATE_ON; 24 31 return CKEDITOR.TRISTATE_OFF; 25 32 } … … 31 38 command.fire( 'state' ); 32 39 } 33 40 34 function isDefaultAlign( command, element )41 function isDefaultAlign( command, element, editor ) 35 42 { 43 var useComputedState = editor.config.useComputedState; 44 45 if ( useComputedState !== undefined && !useComputedState ) 46 return 0; 47 36 48 var direction = element.getComputedStyle( 'direction' ), 37 49 val = command.value; 38 50 return ( direction == 'rtl' && val == 'right' ) || ( direction == 'ltr' && val == 'left' ); … … 92 104 { 93 105 block.removeAttribute( 'align' ); 94 106 95 var isDefault = isDefaultAlign( this, block );107 var isDefault = isDefaultAlign( this, block.getParent(), editor ); 96 108 97 109 if ( cssClassName ) 98 110 {