Ticket #3060: 3060.patch
File 3060.patch, 3.7 KB (added by , 16 years ago) |
---|
-
_source/plugins/button/plugin.js
58 58 this.className = definition.className || ( definition.command && 'cke_button_' + definition.command ) || ''; 59 59 60 60 /** 61 * Button is disabled in editor mode which name doesn't exist on this list. 62 * Ingored if command name is defined. 63 * @name CKEDITOR.ui.button.prototype.activeInModes 64 * @type Array of Strings 65 * @example 66 */ 67 this.activeInModes = definition.activeInModes; 68 69 /** 61 70 * The function to be called when the user clicks the button. If not 62 71 * defined, the "command" property is required, and the command gets 63 72 * executed on click. … … 114 123 }, 115 124 execute : function() 116 125 { 117 this.button.click( editor ); 126 if ( this.button._.currentState != CKEDITOR.TRISTATE_DISABLED ) // Button isn't disabled. 127 this.button.click( editor ); 118 128 } 119 129 }; 120 130 … … 144 154 } 145 155 } 146 156 157 if ( !command ) // Buttons without command. 158 { 159 this._.currentState = this.stateInEditorMode( editor.mode ); 160 161 classes += ' cke_' + ( 162 this._.currentState == CKEDITOR.TRISTATE_ON ? 'on' : 163 this._.currentState == CKEDITOR.TRISTATE_DISABLED ? 'disabled' : 164 'off' ); 165 166 if ( this.activeInModes ) 167 { 168 editor.on( 'mode', function() 169 { 170 this.setState( this.stateInEditorMode( editor.mode ) ); 171 }, this ); 172 } 173 } 174 147 175 if ( this.className ) 148 176 classes += ' ' + this.className; 149 177 … … 209 237 } 210 238 211 239 this._.currentState = state; 240 }, 241 stateInEditorMode : function ( editorMode ) 242 { 243 if ( this.activeInModes ) 244 { 245 var index = CKEDITOR.tools.indexOf( this.activeInModes, editorMode ); 246 return ( index == -1 ) ? CKEDITOR.TRISTATE_DISABLED : CKEDITOR.TRISTATE_OFF; 247 } 248 249 return this._.currentState ? this._.currentState : CKEDITOR.TRISTATE_OFF; 212 250 } 213 251 }; 214 252 -
_source/plugins/colorbutton/plugin.js
25 25 label : lang.label, 26 26 title : lang.panelTitle, 27 27 className : 'cke_button_' + name.toLowerCase(), 28 activeInModes : [ 'wysiwyg' ], 28 29 29 30 panel : 30 31 { -
_source/plugins/panelbutton/plugin.js
79 79 { 80 80 var _ = this._; 81 81 82 if ( _.currentState == CKEDITOR.TRISTATE_DISABLED ) 83 return false; 84 82 85 this.createPanel(); 83 86 84 87 if ( _.on ) … … 93 96 94 97 var label = this.label || ''; 95 98 96 var classes = 'cke_button cke_off';99 var classes = 'cke_button'; 97 100 101 if ( this.activeInModes ) 102 { 103 this._.currentState = this.stateInEditorMode( editor.mode ); 104 classes += ' cke_' + ( ( this._.currentState == CKEDITOR.TRISTATE_DISABLED ) ? 'disabled' : 'off' ); 105 106 editor.on( 'mode', function() 107 { 108 this.setState( this.stateInEditorMode( editor.mode ) ); 109 }, this ); 110 } 111 else 112 { 113 classes += ' cke_off'; 114 this._.currentState = CKEDITOR.TRISTATE_OFF; 115 } 116 98 117 if ( this.className ) 99 118 classes += ' ' + this.className; 100 119 … … 178 197 this.onBlock( panel, _.id ); 179 198 }, 180 199 200 stateInEditorMode : CKEDITOR.ui.button.prototype.stateInEditorMode, 181 201 setState : CKEDITOR.ui.button.prototype.setState 182 202 } 183 203 });