Ticket #6042: 6042.patch
File 6042.patch, 2.2 KB (added by , 13 years ago) |
---|
-
_source/plugins/justify/plugin.js
19 19 return CKEDITOR.TRISTATE_OFF; 20 20 21 21 var currentAlign = firstBlock.getComputedStyle( 'text-align' ).replace( alignRemoveRegex, '' ); 22 if ( ( !currentAlign && this.isDefaultAlign) || currentAlign == this.value )22 if ( ( !currentAlign && isDefaultAlign( this, firstBlock ) ) || currentAlign == this.value ) 23 23 return CKEDITOR.TRISTATE_ON; 24 24 return CKEDITOR.TRISTATE_OFF; 25 25 } … … 31 31 command.fire( 'state' ); 32 32 } 33 33 34 function isDefaultAlign( command, element ) 35 { 36 var direction = element.getComputedStyle( 'direction' ), 37 val = command.value; 38 return ( direction == 'rtl' && val == 'right' ) || ( direction == 'ltr' && val == 'left' ); 39 40 } 41 34 42 function justifyCommand( editor, name, value ) 35 43 { 36 44 this.name = name; 37 45 this.value = value; 38 46 39 var contentDir = editor.config.contentsLangDirection;40 this.isDefaultAlign = ( value == 'left' && contentDir == 'ltr' ) ||41 ( value == 'right' && contentDir == 'rtl' );42 43 47 var classes = editor.config.justifyClasses; 44 48 if ( classes ) 45 49 { … … 88 92 { 89 93 block.removeAttribute( 'align' ); 90 94 95 var isDefault = isDefaultAlign( this, block ); 96 91 97 if ( cssClassName ) 92 98 { 93 99 // Remove any of the alignment classes from the className. … … 95 101 CKEDITOR.tools.ltrim( block.$.className.replace( this.cssClassRegex, '' ) ); 96 102 97 103 // Append the desired class name. 98 if ( this.state == CKEDITOR.TRISTATE_OFF && ! this.isDefaultAlign)104 if ( this.state == CKEDITOR.TRISTATE_OFF && !isDefault ) 99 105 block.addClass( cssClassName ); 100 106 else if ( !className ) 101 107 block.removeAttribute( 'class' ); 102 108 } 103 109 else 104 110 { 105 if ( this.state == CKEDITOR.TRISTATE_OFF && ! this.isDefaultAlign)111 if ( this.state == CKEDITOR.TRISTATE_OFF && !isDefault ) 106 112 block.setStyle( 'text-align', this.value ); 107 113 else 108 114 block.removeStyle( 'text-align' );