Ticket #7280: 7280_maximize.patch
File 7280_maximize.patch, 8.2 KB (added by , 12 years ago) |
---|
-
_samples/replacebycode.html
60 60 61 61 // Replace the <textarea id="editor"> with an CKEditor 62 62 // instance, using default configurations. 63 CKEDITOR.replace( 'editor1' ); 63 var editor = CKEDITOR.replace( 'editor1', { 64 toolbar: 'Basic' 65 }); 66 67 editor.on( 'instanceReady', function(event){ 68 var myToolbar = 'Basic'; 69 70 event.editor.on( 'beforeMaximize', function(){ 71 if(event.editor.getCommand( 'maximize' ).state == CKEDITOR.TRISTATE_ON && myToolbar != 'Basic') {//no maximize == baic toolbar 72 editor.setToolbar('Basic'); 73 myToolbar = 'Basic'; 74 }else if(event.editor.getCommand( 'maximize' ).state == CKEDITOR.TRISTATE_OFF && myToolbar != 'Full') {//maximize is on == Full toolbar 75 editor.setToolbar('Full'); 76 myToolbar = 'Full'; 77 } 78 }); 79 }); 80 64 81 65 82 //]]> 66 83 </script> … … 84 101 </script> 85 102 </p> 86 103 <p> 87 <input type="submit" value="Submit" /> 104 <input type="submit" value="Submit" /> 88 105 </p> 89 106 </form> 90 107 <div id="footer"> -
_source/plugins/maximize/plugin.js
160 160 editorFocus : false, 161 161 exec : function() 162 162 { 163 editor.fire( 'beforeMaximize' ); 163 164 var container = editor.container.getChild( 1 ); 164 165 var contents = editor.getThemeSpace( 'contents' ); 165 166 -
_source/plugins/panelbutton/plugin.js
32 32 33 33 $ : function( definition ) 34 34 { 35 // Store/Restore a copy of the panel definition to allow switch toolbars 36 if ( definition.panel ) 37 definition.storedPanel = definition.panel; 38 else 39 definition.panel = definition.storedPanel; 40 35 41 // We don't want the panel definition in this object. 36 42 var panelDefinition = definition.panel; 37 43 delete definition.panel; -
_source/plugins/richcombo/plugin.js
128 128 clickFn : clickFn 129 129 }; 130 130 131 function updateState()131 instance.updateState = function() 132 132 { 133 133 var state = this.modes[ editor.mode ] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED; 134 134 this.setState( editor.readOnly && !this.readOnly ? CKEDITOR.TRISTATE_DISABLED : state ); 135 135 this.setValue( '' ); 136 136 } 137 137 138 editor.on( 'mode', updateState, this );138 editor.on( 'mode', instance.updateState, this ); 139 139 // If this combo is sensitive to readOnly state, update it accordingly. 140 !this.readOnly && editor.on( 'readOnly', updateState, this);140 !this.readOnly && editor.on( 'readOnly', instance.updateState, this); 141 141 142 142 var keyDownFn = CKEDITOR.tools.addFunction( function( ev, element ) 143 143 { -
_source/plugins/toolbar/plugin.js
169 169 { 170 170 if ( event.data.space == editor.config.toolbarLocation ) 171 171 { 172 event.data.html += generateToolbarHtml( editor ); 173 } 174 }); 175 176 var generateToolbarHtml = function ( editor ) 177 { 172 178 editor.toolbox = new toolbox(); 173 179 174 180 var labelId = CKEDITOR.tools.getNextId(); … … 377 383 '</a>' ); 378 384 } 379 385 380 event.data.html += output.join( '' ); 381 } 382 }); 386 return output.join( '' ); 387 }; 383 388 384 editor.on( 'destroy',function()389 var destroyToolbar = function() 385 390 { 386 391 var toolbars, index = 0, i, 387 392 items, instance; … … 394 399 instance = items[ i ]; 395 400 if ( instance.clickFn ) CKEDITOR.tools.removeFunction( instance.clickFn ); 396 401 if ( instance.keyDownFn ) CKEDITOR.tools.removeFunction( instance.keyDownFn ); 402 403 if ( instance.button && instance.button.command ) 404 { 405 var command = editor.getCommand( instance.button.command ); 406 command.uiItems = []; 407 } 408 409 if ( instance.updateState ) 410 { 411 this.removeListener( 'mode', instance.updateState ); 412 this.removeListener( 'readOnly', instance.updateState ); 413 } 397 414 } 398 415 } 399 } );416 }; 400 417 418 editor.on( 'destroy', destroyToolbar ); 419 420 // Method to switch the currently used toolbar 421 editor.setToolbar = function( toolbar ) 422 { 423 // Remove existing toolbar 424 destroyToolbar.call( this ); 425 426 // Set new one 427 this.config.toolbar = toolbar; 428 429 // Create it 430 var toolbarLocation = this.config.toolbarLocation, 431 space = document.getElementById( 'cke_' + toolbarLocation + '_' + this.name ); 432 433 space.innerHTML = generateToolbarHtml( this ); 434 435 // IE... 436 if ( CKEDITOR.env.ie ) 437 { 438 var table = space.parentNode.parentNode.parentNode; 439 table.style.display = 'none'; 440 // Force refresh 441 var h = table.scrollHeight; 442 table.style.display = ''; 443 } 444 }; 445 401 446 editor.addCommand( 'toolbarFocus', commands.toolbarFocus ); 402 447 403 448 editor.ui.add( '-', CKEDITOR.UI_SEPARATOR, {} ); -
config.js
8 8 // Define changes to default configuration here. For example: 9 9 // config.language = 'fr'; 10 10 // config.uiColor = '#AADC6E'; 11 12 13 config.toolbar_Full = 14 [ 15 { name: 'document', items : [ 'Source','-','Save','NewPage','DocProps','Preview','Print','-','Templates' ] }, 16 { name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] }, 17 { name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','SpellChecker', 'Scayt' ] }, 18 { name: 'forms', items : [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 19 'HiddenField' ] }, 20 '/', 21 { name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] }, 22 { name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv', 23 '-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl' ] }, 24 { name: 'links', items : [ 'Link','Unlink','Anchor' ] }, 25 { name: 'insert', items : [ 'Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe' ] }, 26 '/', 27 { name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] }, 28 { name: 'colors', items : [ 'TextColor','BGColor' ] }, 29 { name: 'tools', items : [ 'Maximize', 'ShowBlocks','-','About' ] } 30 ]; 31 32 config.toolbar_Basic = 33 [ 34 ['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink','-','Maximize','About'] 35 ]; 11 36 }; 37 38 39 // Set new Toolbar 40 CKEDITOR.editor.prototype.setToolbar = function( toolbar ) 41 { 42 // Destroy previous toolbar 43 var toolbars, index = 0, i, 44 items, instance; 45 toolbars = this.toolbox.toolbars; 46 for ( ; index < toolbars.length; index++ ) 47 { 48 items = toolbars[ index ].items; 49 for ( i = 0; i < items.length; i++ ) 50 { 51 instance = items[ i ]; 52 if ( instance.clickFn ) CKEDITOR.tools.removeFunction( instance.clickFn ); 53 if ( instance.keyDownFn ) CKEDITOR.tools.removeFunction( instance.keyDownFn ); 54 55 if ( instance.index ) CKEDITOR.ui.button._.instances[ instance.index ] = null; 56 } 57 } 58 59 // Set new one 60 this.config.toolbar = toolbar; 61 62 // create it 63 var toolbarLocation = this.config.toolbarLocation, 64 space = document.getElementById('cke_' + toolbarLocation + '_' + this.name), 65 html = this.fire( 'themeSpace', { space : toolbarLocation, html : '' } ).html; 66 67 space.innerHTML = html; 68 } 69 70