Ticket #2836: 2836_6.patch
File 2836_6.patch, 12.2 KB (added by , 15 years ago) |
---|
-
_source/core/command.js
5 5 6 6 CKEDITOR.command = function( editor, commandDefinition ) 7 7 { 8 this.state = ( 'state' in commandDefinition ) ? commandDefinition.state : CKEDITOR.TRISTATE_OFF;9 10 8 this.exec = function( data ) 11 9 { 12 10 if ( this.state == CKEDITOR.TRISTATE_DISABLED ) … … 15 13 return ( commandDefinition.exec.call( this, editor, data ) !== false ); 16 14 }; 17 15 18 CKEDITOR.tools.extend( this, commandDefinition ); 16 CKEDITOR.tools.extend( this, commandDefinition, 17 // Defaults 18 { 19 modes : { wysiwyg : 1 }, 20 state : CKEDITOR.TRISTATE_OFF 21 }); 19 22 20 23 // Call the CKEDITOR.event constructor to initialize this instance. 21 24 CKEDITOR.event.call( this ); -
_source/core/dom/element.js
1179 1179 var currentScroll = win.getScrollPosition().y; 1180 1180 if ( offset > 0 && ( offset > currentScroll || offset < currentScroll - winHeight ) ) 1181 1181 win.$.scrollTo( 0, offset ); 1182 }, 1183 1184 setState : function( state ) 1185 { 1186 switch ( state ) 1187 { 1188 case CKEDITOR.TRISTATE_ON : 1189 this.addClass( 'cke_on' ); 1190 this.removeClass( 'cke_off' ); 1191 this.removeClass( 'cke_disabled' ); 1192 break; 1193 case CKEDITOR.TRISTATE_DISABLED : 1194 this.addClass( 'cke_disabled' ); 1195 this.removeClass( 'cke_off' ); 1196 this.removeClass( 'cke_on' ); 1197 break; 1198 default : 1199 this.addClass( 'cke_off' ); 1200 this.removeClass( 'cke_on' ); 1201 this.removeClass( 'cke_disabled' ); 1202 break; 1203 } 1182 1204 } 1183 1205 }); -
_source/core/editor.js
272 272 } 273 273 }; 274 274 275 function updateCommandsMode() 276 { 277 var command, 278 commands = this._.commands, 279 mode = this.mode; 280 281 for ( var name in commands ) 282 { 283 command = commands[ name ]; 284 285 command.setState( command.modes[ mode ] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED ); 286 } 287 } 288 275 289 /** 276 290 * Initializes the editor instance. This function is called by the editor 277 291 * contructor (editor_basic.js). … … 346 360 347 361 CKEDITOR.fire( 'instanceCreated', null, this ); 348 362 363 this.on( 'mode', updateCommandsMode ); 364 349 365 initConfig( this, instanceConfig ); 350 366 }; 351 367 })(); -
_source/plugins/button/plugin.js
196 196 197 197 setState : function( state ) 198 198 { 199 var element = CKEDITOR.document.getById( this._.id ); 200 201 if ( this._.currentState == state ) 199 if ( this._.state == state ) 202 200 return; 203 201 204 switch ( state ) 205 { 206 case CKEDITOR.TRISTATE_ON : 207 element.addClass( 'cke_on' ); 208 element.removeClass( 'cke_off' ); 209 element.removeClass( 'cke_disabled' ); 210 break; 211 case CKEDITOR.TRISTATE_DISABLED : 212 element.addClass( 'cke_disabled' ); 213 element.removeClass( 'cke_off' ); 214 element.removeClass( 'cke_on' ); 215 break; 216 default : 217 element.addClass( 'cke_off' ); 218 element.removeClass( 'cke_on' ); 219 element.removeClass( 'cke_disabled' ); 220 break; 221 } 202 CKEDITOR.document.getById( this._.id ).setState( state ); 222 203 223 this._. currentState = state;204 this._.state = state; 224 205 } 225 206 }; 226 207 -
_source/plugins/newpage/plugin.js
14 14 { 15 15 editor.addCommand( 'newpage', 16 16 { 17 modes : { wysiwyg:1, source:1 }, 18 17 19 exec : function( editor ) 18 20 { 19 21 editor.setData( editor.config.newpage_html ); -
_source/plugins/panelbutton/plugin.js
27 27 CKEDITOR.tools.extend( this, definition, 28 28 // Set defaults. 29 29 { 30 title : definition.label 30 title : definition.label, 31 modes : { wysiwyg : 1 } 31 32 }); 32 33 33 34 // We don't want the panel definition in this object. … … 79 80 { 80 81 var _ = this._; 81 82 83 if ( _.state == CKEDITOR.TRISTATE_DISABLED ) 84 return; 85 82 86 this.createPanel( editor ); 83 87 84 88 if ( _.on ) … … 116 120 if ( this.className ) 117 121 classes += ' ' + this.className; 118 122 123 editor.on( 'mode', function() 124 { 125 this.setState( this.modes[ editor.mode ] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED ); 126 }, 127 this ); 128 119 129 output.push( 120 130 '<span class="cke_button">', 121 131 '<a id="', id, '"' + -
_source/plugins/preview/plugin.js
11 11 { 12 12 var previewCmd = 13 13 { 14 modes : { wysiwyg:1, source:1 }, 15 14 16 exec : function( editor ) 15 17 { 16 18 var sHTML, -
_source/plugins/richcombo/plugin.js
5 5 6 6 CKEDITOR.plugins.add( 'richcombo', 7 7 { 8 requires : [ 'floatpanel', 'listblock' ],8 requires : [ 'floatpanel', 'listblock', 'button' ], 9 9 10 10 beforeInit : function( editor ) 11 11 { … … 28 28 CKEDITOR.tools.extend( this, definition, 29 29 // Set defaults. 30 30 { 31 title : definition.label 31 title : definition.label, 32 modes : { wysiwyg : 1 } 32 33 }); 33 34 34 35 // We don't want the panel definition in this object. … … 47 48 this._ = 48 49 { 49 50 panelDefinition : panelDefinition, 50 items : {} 51 items : {}, 52 state : CKEDITOR.TRISTATE_OFF 51 53 }; 52 54 }, 53 55 … … 85 87 var clickFn = CKEDITOR.tools.addFunction( function( $element ) 86 88 { 87 89 var _ = this._; 90 91 if ( _.state == CKEDITOR.TRISTATE_DISABLED ) 92 return; 88 93 89 94 this.createPanel( editor ); 90 95 … … 109 114 _.panel.showBlock( this.id, new CKEDITOR.dom.element( $element ).getFirst(), 4 ); 110 115 }, 111 116 this ); 112 117 113 118 var instance = { 114 119 id : id, 115 120 combo : this, … … 120 125 }, 121 126 execute : clickFn 122 127 }; 128 129 editor.on( 'mode', function() 130 { 131 this.setState( this.modes[ editor.mode ] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED ); 132 }, 133 this ); 123 134 124 135 var keyDownFn = CKEDITOR.tools.addFunction( function( ev, element ){ 125 136 … … 146 157 '<span id=', id ); 147 158 148 159 if ( this.className ) 149 output.push( ' class="', this.className, ' "');160 output.push( ' class="', this.className, ' cke_off"'); 150 161 151 162 output.push( 152 163 '>' + … … 201 212 if ( me.className ) 202 213 this.element.getFirst().addClass( me.className + '_panel' ); 203 214 204 me. document.getById( 'cke_' + me.id ).addClass( 'cke_on');215 me.setState( CKEDITOR.TRISTATE_ON ); 205 216 206 217 me._.on = 1; 207 218 … … 214 225 if ( me.className ) 215 226 this.element.getFirst().removeClass( me.className + '_panel' ); 216 227 217 me. document.getById( 'cke_' + me.id ).removeClass( 'cke_on');228 me.setState( CKEDITOR.TRISTATE_OFF ); 218 229 219 230 me._.on = 0; 220 231 … … 299 310 commit : function() 300 311 { 301 312 this._.list.commit(); 313 }, 314 315 setState : function( state ) 316 { 317 if ( this._.state == state ) 318 return; 319 320 this.document.getById( 'cke_' + this.id ).setState( state ); 321 322 this._.state = state; 302 323 } 303 324 } 304 325 }); -
_source/plugins/save/plugin.js
11 11 { 12 12 var saveCmd = 13 13 { 14 modes : { wysiwyg:1, source:1 }, 15 14 16 exec : function( editor ) 15 17 { 16 18 var $form = editor.element.$.form; -
_source/plugins/sourcearea/plugin.js
140 140 { 141 141 source : 142 142 { 143 modes : { wysiwyg:1, source:1 }, 144 143 145 exec : function( editor ) 144 146 { 145 147 editor.setMode( editor.mode == 'source' ? 'wysiwyg' : 'source' ); -
_source/plugins/undo/plugin.js
66 66 // Make the undo manager available only in wysiwyg mode. 67 67 editor.on( 'mode', function() 68 68 { 69 if ( !undoManager.enabled &&editor.mode == 'wysiwyg' )69 if ( editor.mode == 'wysiwyg' ) 70 70 { 71 undoManager.enabled = true; 71 if ( !undoManager.enabled ) 72 { 73 undoManager.enabled = true; 72 74 73 editor.document.on( 'keydown', function( event )74 {75 // Do not capture CTRL hotkeys.76 if ( !event.data.$.ctrlKey && !event.data.$.metaKey )77 undoManager.type();78 });75 editor.document.on( 'keydown', function( event ) 76 { 77 // Do not capture CTRL hotkeys. 78 if ( !event.data.$.ctrlKey && !event.data.$.metaKey ) 79 undoManager.type(); 80 }); 79 81 80 // Being this the first call, let's get an undo snapshot. 81 if ( undoManager.index == -1 ) 82 undoManager.save(); 82 // Being this the first call, let's get an undo snapshot. 83 if ( undoManager.index == -1 ) 84 undoManager.save(); 85 } 83 86 } 87 else 88 undoManager.enabled = false; 84 89 85 90 undoManager.onChange(); 86 91 }); -
_source/skins/default/richcombo.css
91 91 width: 15px; 92 92 } 93 93 94 .cke_skin_default .cke_rcombo a:hover,95 .cke_skin_default .cke_rcombo a:focus,96 .cke_skin_default .cke_rcombo a:active,94 .cke_skin_default .cke_rcombo .cke_off a:hover, 95 .cke_skin_default .cke_rcombo .cke_off a:focus, 96 .cke_skin_default .cke_rcombo .cke_off a:active, 97 97 .cke_skin_default .cke_rcombo .cke_on a 98 98 { 99 99 filter: alpha(opacity=100); /* IE */ 100 100 opacity: 1; /* Safari, Opera and Mozilla */ 101 101 } 102 102 103 .cke_skin_default .cke_rcombo a:hover .cke_text,104 .cke_skin_default .cke_rcombo a:focus .cke_text,105 .cke_skin_default .cke_rcombo a:active .cke_text,103 .cke_skin_default .cke_rcombo .cke_off a:hover .cke_text, 104 .cke_skin_default .cke_rcombo .cke_off a:focus .cke_text, 105 .cke_skin_default .cke_rcombo .cke_off a:active .cke_text, 106 106 .cke_skin_default .cke_rcombo .cke_on .cke_text 107 107 { 108 108 border-color: #316ac5; 109 109 } 110 110 111 .cke_skin_default .cke_rcombo a:hover .cke_openbutton,112 .cke_skin_default .cke_rcombo a:focus .cke_openbutton,113 .cke_skin_default .cke_rcombo a:active .cke_openbutton,111 .cke_skin_default .cke_rcombo .cke_off a:hover .cke_openbutton, 112 .cke_skin_default .cke_rcombo .cke_off a:focus .cke_openbutton, 113 .cke_skin_default .cke_rcombo .cke_off a:active .cke_openbutton, 114 114 .cke_skin_default .cke_rcombo .cke_on .cke_openbutton 115 115 { 116 116 border-color: #316ac5; … … 130 130 -webkit-border-bottom-right-radius: 0px; 131 131 border-bottom-right-radius: 0px; 132 132 } 133 134 .cke_skin_default .cke_rcombo .cke_disabled .cke_label 135 { 136 filter: alpha(opacity=30); /* IE */ 137 opacity: 0.3; /* Safari, Opera and Mozilla */ 138 } 139 140 .cke_skin_default .cke_rcombo .cke_disabled .cke_text, 141 .cke_skin_default .cke_rcombo .cke_disabled .cke_openbutton 142 { 143 filter: alpha(opacity=50); /* IE */ 144 opacity: 0.5; /* Safari, Opera and Mozilla */ 145 } 146 147 .cke_skin_default .cke_rcombo .cke_disabled .cke_text 148 { 149 color: #fff; 150 }