Ticket #4228: 4228.patch
File 4228.patch, 34.9 KB (added by , 14 years ago) |
---|
-
_source/plugins/maximize/plugin.js
91 91 { 92 92 init : function( editor ) 93 93 { 94 // We don't want maximize feature available on share toolbar mode 95 // at this moment. 96 if( CKEDITOR.config.sharedToolbar ) 97 return; 98 94 99 var lang = editor.lang; 95 100 var mainDocument = CKEDITOR.document; 96 101 var mainWindow = mainDocument.getWindow(); … … 225 230 this.toggleState(); 226 231 227 232 // Toggle button label. 228 var button = this.uiItems[ 0 ];233 var buttonUI = this.uiItems[ 0 ]; 229 234 var label = ( this.state == CKEDITOR.TRISTATE_OFF ) 230 235 ? lang.maximize : lang.minimize; 231 var buttonNode = editor.element.getDocument().getById( button._.id ); 232 buttonNode.getChild( 1 ).setHtml( label ); 233 buttonNode.setAttribute( 'title', label ); 234 buttonNode.setAttribute( 'href', 'javascript:void("' + label + '");' ); 236 buttonUI.setLabel( label ); 235 237 236 238 // Restore selection and scroll position in editing area. 237 239 if ( editor.mode == 'wysiwyg' ) -
_source/core/skins.js
23 23 var loadedPart = function( skinName, part, callback ) 24 24 { 25 25 // Get the skin definition. 26 var skinDefinition = loaded[ skinName ];26 var skinDefinition = CKEDITOR.skins[ skinName ] = loaded[ skinName ]; 27 27 28 28 var appendSkinPath = function( fileNames ) 29 29 { -
_source/plugins/elementspath/plugin.js
48 48 49 49 editor.on( 'themeSpace', function( event ) 50 50 { 51 if ( event.data.space == ' bottom' )52 event.data.html += '<div id="' + spaceId + '" class="cke_path">' + emptyHtml + '</div>';51 if ( event.data.space == 'elementspath' ) 52 event.data.html = '<div id="' + spaceId + '" class="cke_path">' + emptyHtml + '</div>'; 53 53 }); 54 54 55 55 editor.on( 'selectionChange', function( ev ) -
_source/plugins/richcombo/plugin.js
86 86 var id = 'cke_' + this.id; 87 87 var clickFn = CKEDITOR.tools.addFunction( function( $element ) 88 88 { 89 var _ = this._;89 var me = this, _ = me._; 90 90 91 91 if ( _.state == CKEDITOR.TRISTATE_DISABLED ) 92 92 return; 93 93 94 94 this.createPanel( editor ); 95 _.onOpen = function () 96 { 97 me.onOpen && me.onOpen( editor ); 98 }; 95 99 100 _.list.onClick = CKEDITOR.tools.bind( function( value, marked ) 101 { 102 // Move the focus to the main windows, otherwise it will stay 103 // into the floating panel, even if invisible, and Safari and 104 // Opera will go a bit crazy. 105 me.document.getWindow().focus(); 106 107 if ( me.onClick ) 108 me.onClick( editor, value, marked ); 109 110 if ( marked ) 111 me.setValue( value, me._.items[ value ] ); 112 else 113 me.setValue( '' ); 114 115 _.panel.hide(); 116 }, this ); 117 118 96 119 if ( _.on ) 97 120 { 98 121 _.panel.hide(); … … 120 143 combo : this, 121 144 focus : function() 122 145 { 123 var element = CKEDITOR.document.getById( id ).getChild( 1 ); 124 element.focus(); 146 this.combo.document.getById( id ).getChild( 1 ).focus(); 125 147 }, 148 setDocument : function( doc ) 149 { 150 this.combo.document = doc; 151 }, 152 alterScope : function( editorInstance ) 153 { 154 editor = editorInstance; 155 onRender(); 156 }, 126 157 execute : clickFn 127 158 }; 128 159 129 editor.on( 'mode', function() 130 { 131 this.setState( this.modes[ editor.mode ] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED ); 132 }, 133 this ); 160 var registered = {}; 161 var onRender = CKEDITOR.tools.bind( function() 162 { 163 if( registered[ editor.name ] ) 164 return; 165 166 editor.on( 'mode', function() 167 { 168 this.setState( this.modes[ editor.mode ] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED ); 169 }, 170 this ); 134 171 172 this.onRender && this.onRender( editor ); 173 registered[ editor.name ] = 1; 174 }, this ); 175 135 176 var keyDownFn = CKEDITOR.tools.addFunction( function( ev, element ) 136 177 { 137 178 ev = new CKEDITOR.dom.event( ev ); … … 195 236 '</span>' + 196 237 '</span>' ); 197 238 198 if ( this.onRender ) 199 this.onRender(); 239 onRender(); 200 240 201 241 return instance; 202 242 }, … … 223 263 224 264 me._.on = 1; 225 265 226 if ( me.onOpen ) 227 me.onOpen(); 266 me._.onOpen(); 228 267 }; 229 268 230 269 panel.onHide = function() … … 246 285 me.document.getById( 'cke_' + me.id ).getFirst().getNext().focus(); 247 286 }; 248 287 249 list.onClick = function( value, marked )250 {251 // Move the focus to the main windows, otherwise it will stay252 // into the floating panel, even if invisible, and Safari and253 // Opera will go a bit crazy.254 me.document.getWindow().focus();255 256 if ( me.onClick )257 me.onClick.call( me, value, marked );258 259 if ( marked )260 me.setValue( value, me._.items[ value ] );261 else262 me.setValue( '' );263 264 panel.hide();265 };266 267 288 this._.panel = panel; 268 289 this._.list = list; 269 290 -
_source/plugins/toolbar/plugin.js
16 16 this.focusCommandExecuted = false; 17 17 }; 18 18 19 toolbox.prototype .focus = function()19 toolbox.prototype = 20 20 { 21 for ( var t = 0, toolbar ; toolbar = this.toolbars[ t++ ] ; ) 22 { 23 for ( var i = 0, item ; item = toolbar.items[ i++ ] ; ) 24 { 25 if ( item.focus ) 26 { 27 item.focus(); 28 return; 29 } 30 } 31 } 21 focus : function() 22 { 23 for ( var t = 0, toolbar ; toolbar = this.toolbars[ t++ ] ; ) 24 { 25 for ( var i = 0, item ; item = toolbar.items[ i++ ] ; ) 26 { 27 if ( item.focus ) 28 { 29 item.focus(); 30 return; 31 } 32 } 33 } 34 }, 35 36 forEachItem : function( callback ) 37 { 38 var toolbar = this.toolbars, 39 toolgroup, 40 toolBarItem; 41 42 for ( var i = 0; i < toolbar.length; i++ ) 43 { 44 toolgroup = toolbar[ i ].items; 45 for ( var j = 0; j < toolgroup.length; j++ ) 46 { 47 toolBarItem = toolgroup[ j ]; 48 callback( toolBarItem ); 49 } 50 } 51 } 32 52 }; 33 53 34 54 var commands = … … 53 73 } 54 74 }; 55 75 76 77 // UI objects are subjected to be later used by multiple editors. 78 var sharedToolbar = CKEDITOR.config.sharedToolbar; 79 56 80 CKEDITOR.plugins.add( 'toolbar', 57 81 { 58 82 init : function( editor ) 59 83 { 84 editor.addCommand( 'toolbarFocus', commands.toolbarFocus ); 85 60 86 var itemKeystroke = function( item, keystroke ) 61 87 { 62 88 switch ( keystroke ) … … 105 131 } 106 132 return true; 107 133 }; 108 109 134 editor.on( 'themeSpace', function( event ) 110 135 { 111 if ( event.data.space == editor.config.toolbarLocation ) 136 var doc = CKEDITOR.document; 137 if ( event.data.space == 'toolbar' ) 112 138 { 113 editor.toolbox = new toolbox(); 139 if ( CKEDITOR.toolbox ) 140 { 141 editor.toolbox = CKEDITOR.toolbox; 142 return; 143 } 144 else 145 editor.toolbox = new toolbox(); 114 146 147 // Closure altering hack for cross-window toolbar to work. 148 editor.toolbox.setDocument = function( document ) 149 { 150 doc = document; 151 this.forEachItem( function( uiItem ) 152 { 153 uiItem.setDocument && uiItem.setDocument( doc ); 154 } ); 155 }; 156 157 if( sharedToolbar ) 158 { 159 var sharedToolbox = CKEDITOR.toolbox = editor.toolbox; 160 161 // Closure altering hack for shared toolbar acorss multi-editor. 162 sharedToolbox.alterScope = function( editorInstance ) 163 { 164 this.forEachItem( function( uiItem ) 165 { 166 uiItem.alterScope && uiItem.alterScope( editorInstance ); 167 } ); 168 }; 169 } 170 115 171 var output = [ '<div class="cke_toolbox"' ], 116 172 expanded = editor.config.toolbarStartupExpanded, 117 173 groupStarted; … … 241 297 { 242 298 exec : function( editor ) 243 299 { 244 var collapser = CKEDITOR.document.getById( collapserId ); 245 var toolbox = collapser.getPrevious(); 246 var contents = editor.getThemeSpace( 'contents' ); 247 var toolboxContainer = toolbox.getParent(); 248 var contentHeight = parseInt( contents.$.style.height, 10 ); 249 var previousHeight = toolboxContainer.$.offsetHeight; 300 var collapser = doc.getById( collapserId ), 301 toolbox = collapser.getPrevious(), 302 toolboxContainer = toolbox.getParent(), 303 contents = editor.getThemeSpace( 'contents' ), 304 // Is toolbar layout inside the editor chrome? 305 isTightToolbar = toolboxContainer.equals( editor.getThemeSpace( 'top' ) ); 306 307 if( isTightToolbar ) 308 { 309 var contentHeight = parseInt( contents.$.style.height, 10 ); 310 var previousHeight = toolboxContainer.$.offsetHeight; 311 } 250 312 251 313 if ( toolbox.isVisible() ) 252 314 { … … 259 321 collapser.removeClass( 'cke_toolbox_collapser_min' ); 260 322 } 261 323 262 var dy = toolboxContainer.$.offsetHeight - previousHeight; 263 contents.setStyle( 'height', ( contentHeight - dy ) + 'px' ); 324 if( isTightToolbar ) 325 { 326 var dy = toolboxContainer.$.offsetHeight - previousHeight; 327 contents.setStyle( 'height', ( contentHeight - dy ) + 'px' ); 328 } 264 329 }, 265 266 modes : { wysiwyg : 1, source : 1 }330 modes : { wysiwyg : 1, source : 1 }, 331 editorFocus : false 267 332 } ); 268 333 269 334 output.push( '<a id="' + collapserId + '" class="cke_toolbox_collapser' ); … … 274 339 output.push( '" onclick="CKEDITOR.tools.callFunction(' + collapserFn + ')"></a>' ); 275 340 } 276 341 277 event.data.html += output.join( '' );342 event.data.html = output.join( '' ); 278 343 } 279 }); 344 } ); 345 } 346 } ); 280 347 281 editor.addCommand( 'toolbarFocus', commands.toolbarFocus ); 282 } 283 }); 348 if ( sharedToolbar ) 349 { 350 CKEDITOR.on( 'currentInstance', function () 351 { 352 var activeEditor = CKEDITOR.currentInstance, 353 commands = activeEditor && activeEditor._.commands; 354 if( activeEditor ) 355 { 356 // Now that the current focused editor dominant the toolbox. 357 CKEDITOR.toolbox.alterScope( activeEditor ); 358 // Refresh selection status. 359 activeEditor.forceNextSelectionCheck(); 360 activeEditor.selectionChange(); 361 // Force sync status of buttons with commands. 362 for( i in commands ) 363 commands[ i ].fire( 'state' ); 364 } 365 366 } ); 367 } 368 284 369 })(); 285 370 286 371 /** … … 298 383 }; 299 384 300 385 /** 301 * The "theme space" to which rendering the toolbar. For the default theme,302 * the recommended options are "top" and "bottom".303 * @type String304 * @default 'top'305 * @see CKEDITOR.config.theme306 * @example307 * config.toolbarLocation = 'bottom';308 */309 CKEDITOR.config.toolbarLocation = 'top';310 311 /**312 386 * The toolbar definition. It is an array of toolbars (strips), 313 387 * each one being also an array, containing a list of UI items. 314 388 * Note that this setting is composed by "toolbar_" added by the toolbar name, -
_source/plugins/panelbutton/plugin.js
23 23 { 24 24 var clickFn = function( editor ) 25 25 { 26 var _ = this._;26 var me = this, _ = me._; 27 27 28 28 if ( _.state == CKEDITOR.TRISTATE_DISABLED ) 29 29 return; 30 30 31 _.onClick = function () 32 { 33 me.onClick && 34 me.onClick.apply( me, 35 [ editor ].concat( 36 Array.prototype.slice.call( arguments, 0 ) ) ); 37 }; 38 31 39 this.createPanel( editor ); 32 40 33 41 if ( _.on ) … … 35 43 _.panel.hide(); 36 44 return; 37 45 } 38 39 _.panel.showBlock( this._.id, this.document.getById( this._.id ), 4 ); 46 _.panel.showBlock( this._.id, this._.document.getById( this._.id ), 4 ); 40 47 }; 41 48 42 49 … … 52 59 53 60 this.base( definition ); 54 61 55 this. document = ( panelDefinition62 this._.document = ( panelDefinition 56 63 && panelDefinition.parent 57 64 && panelDefinition.parent.getDocument() ) 58 65 || CKEDITOR.document; … … 61 68 62 69 this.click = clickFn; 63 70 64 this._ = 65 { 66 panelDefinition : panelDefinition 67 }; 71 this._.panelDefinition = panelDefinition; 68 72 }, 69 73 70 74 statics : … … 122 126 panel.onEscape = function() 123 127 { 124 128 panel.hide(); 125 me. document.getById( _.id ).focus();129 me._.document.getById( _.id ).focus(); 126 130 }; 127 131 128 132 if ( this.onBlock ) -
_source/themes/default/theme.js
9 9 build : function( editor, themePath ) 10 10 { 11 11 var name = editor.name, 12 toolbarLocation = editor.config.toolbarLocation, 12 13 element = editor.element, 13 14 elementMode = editor.elementMode; 14 15 … … 19 20 element.hide(); 20 21 21 22 // Get the HTML for the predefined spaces. 22 var topHtml = editor.fire( 'themeSpace', { space : 'top', html : '' } ).html; 23 var contentsHtml = editor.fire( 'themeSpace', { space : 'contents', html : '' } ).html; 24 var bottomHtml = editor.fireOnce( 'themeSpace', { space : 'bottom', html : '' } ).html; 23 var toolbarHtml = editor.fire( 'themeSpace', { space : 'toolbar' } ).html; 24 var editingblockHtml = editor.fire( 'themeSpace', { space : 'editingblock' } ).html; 25 var elementspathHtml = editor.fire( 'themeSpace', { space : 'elementspath' } ).html; 26 var resizerHtml = editor.fire( 'themeSpace', { space : 'resizer' } ).html; 25 27 26 var height = contentsHtml && editor.config.height;28 var height = editingblockHtml && editor.config.height; 27 29 28 30 var tabIndex = editor.config.tabIndex || editor.element.getAttribute( 'tabindex' ) || 0; 29 31 30 32 // The editor height is considered only if the contents space got filled. 31 if ( ! contentsHtml )33 if ( !editingblockHtml ) 32 34 height = 'auto'; 33 35 else if ( !isNaN( height ) ) 34 36 height += 'px'; … … 44 46 style += "width: " + width + ";"; 45 47 } 46 48 47 var container = CKEDITOR.dom.element.createFromHtml( [ 48 '<span' + 49 ' id="cke_', name, '"' + 50 ' onmousedown="return false;"' + 51 ' class="', editor.skinClass, '"' + 52 ' dir="', editor.lang.dir, '"' + 53 ' title="', ( CKEDITOR.env.gecko ? ' ' : '' ), '"' + 54 ' lang="', editor.langCode, '"' + 55 ' tabindex="' + tabIndex + '"' + 56 ( style ? ' style="' + style + '"' : '' ) + 57 '>' + 58 '<span class="' , CKEDITOR.env.cssClass, '">' + 59 '<span class="cke_wrapper cke_', editor.lang.dir, '">' + 60 '<table class="cke_editor" border="0" cellspacing="0" cellpadding="0"><tbody>' + 61 '<tr', topHtml ? '' : ' style="display:none"', '><td id="cke_top_' , name, '" class="cke_top">' , topHtml , '</td></tr>' + 62 '<tr', contentsHtml ? '' : ' style="display:none"', '><td id="cke_contents_', name, '" class="cke_contents" style="height:', height, '">', contentsHtml, '</td></tr>' + 63 '<tr', bottomHtml ? '' : ' style="display:none"', '><td id="cke_bottom_' , name, '" class="cke_bottom">' , bottomHtml , '</td></tr>' + 64 '</tbody></table>' + 65 //Hide the container when loading skins, later restored by skin css. 66 '<style>.', editor.skinClass, '{visibility:hidden;}</style>' + 67 '</span>' + 68 '</span>' + 69 '</span>' ].join( '' ) ); 49 // Flexible toolbar locations. 50 if( toolbarLocation.nodeType ) 51 { 52 var outer = new CKEDITOR.dom.element( toolbarLocation ), 53 outerDoc = outer.getDocument(); 54 // Is cross frame? 55 if( !outerDoc.equals( CKEDITOR.document ) ) 56 { 57 // Bridge 'CKEDITOR' object. 58 outerDoc.getWindow().$.CKEDITOR = CKEDITOR; 59 60 // Loading editor skin part into destination window. 61 var part = CKEDITOR.skins[ editor.skinName ].editor; 62 for ( var c = 0 ; c < part.css.length ; c++ ) 63 outer.getDocument().appendStyleSheet( part.css[ c ] ); 64 65 // Update toolbox target document. 66 editor.toolbox.setDocument( outerDoc ); 67 } 68 outer.setHtml( this.buildChrome( editor, 69 [ 70 '<table class="cke_editor" border="0" cellspacing="0" cellpadding="0"><tbody>' + 71 '<tr><td id="cke_top_', name, '" class="cke_top">', toolbarHtml, '</td></tr>' + 72 '</tbody></table>' 73 ].join( '' ), {} ) ); 70 74 75 76 } 77 else 78 { 79 // Toolbar upside down with elementspath bar. 80 var topHtml = toolbarLocation == 'top' ? toolbarHtml : 81 toolbarLocation == 'bottom' ? elementspathHtml : ''; 82 } 83 84 var middleHtml = '' + editingblockHtml; 85 var bottomHtml = '' + ( toolbarLocation == 'bottom' ? toolbarHtml : elementspathHtml ); 86 87 var container = CKEDITOR.dom.element.createFromHtml( 88 this.buildChrome( editor, 89 [ '<table class="cke_editor" border="0" cellspacing="0" cellpadding="0"><tbody>' + 90 '<tr><td id="cke_top_', name, '" class="cke_top">', topHtml, '</td></tr>' + 91 '<tr', middleHtml ? '' : ' style="display:none"', '><td id="cke_contents_', name, '" class="cke_contents" style="height:', height, '">', middleHtml, '</td></tr>' + 92 '<tr', bottomHtml ? '' : ' style="display:none"', '><td id="cke_bottom_' , name, '" class="cke_bottom">' , bottomHtml , resizerHtml, '</td></tr>' + 93 '</tbody></table>' ].join( '' ), 94 { 95 id : 'cke_' + editor.name, 96 tabIndex : tabIndex, 97 style : style 98 } ) ); 99 71 100 container.getChild( [0, 0, 0, 0, 0] ).unselectable(); 72 101 container.getChild( [0, 0, 0, 0, 2] ).unselectable(); 73 102 … … 93 122 editor.fireOnce( 'uiReady' ); 94 123 }, 95 124 125 buildChrome : function( editor, contentsHtml, attrs ) 126 { 127 var result = 128 [ 129 '<span' + 130 ( attrs.id ? ' id="' + attrs.id + '"' : '' ) + 131 ' onmousedown="return false;"' + 132 ' class="', editor.skinClass, '"' + 133 ' dir="', editor.lang.dir, '"' + 134 ' title="', ( CKEDITOR.env.gecko ? ' ' : '' ), '"' + 135 ' lang="', editor.langCode, '"' + 136 ( ( typeof attrs.tabIndex != 'undefined' ) ? ' tabindex="' + attrs.tabIndex + '"' : '' ) + 137 ( attrs.style ? ' style="' + attrs.style + '"' : '' ) + 138 '>' + 139 '<span class="' , CKEDITOR.env.cssClass, '">' + 140 '<span class="cke_wrapper cke_', editor.lang.dir, '">' + 141 contentsHtml + 142 //Hide the container when loading skins, later restored by skin css. 143 '<style>.', editor.skinClass, '{visibility:hidden;}</style>' + 144 '</span>' + 145 '</span>' + 146 '</span>' 147 ].join( '' ); 148 return result; 149 }, 150 96 151 buildDialog : function( editor ) 97 152 { 98 153 var baseIdNumber = CKEDITOR.tools.getNextNumber(); -
_source/plugins/menubutton/plugin.js
23 23 { 24 24 var clickFn = function( editor ) 25 25 { 26 var _ = this._;26 var me = this, _ = me._; 27 27 28 28 // Do nothing if this button is disabled. 29 29 if ( _.state === CKEDITOR.TRISTATE_DISABLED ) … … 43 43 }, 44 44 this ); 45 45 46 // Initialize the menu items at this point. 47 if ( this.onMenu ) 46 menu.addListener( function() 48 47 { 49 menu.addListener( this.onMenu ); 50 } 51 } 48 // Initialize the menu items at this point. 49 return me.onMenu && me.onMenu( editor ); 50 } ); 51 } 52 52 53 53 if ( _.on ) 54 54 { … … 58 58 59 59 this.setState( CKEDITOR.TRISTATE_ON ); 60 60 61 menu.show( CKEDITOR.document.getById( this._.id ), 4 );61 menu.show( this._.document.getById( this._.id ), 4 ); 62 62 }; 63 63 64 64 -
_source/skins/kama/mainui.css
69 69 padding: 0 5px 5px; 70 70 } 71 71 72 .cke_skin_kama .cke_top 73 { 74 height : 5px; 75 } 76 72 77 .cke_skin_kama .cke_hc .cke_contents 73 78 { 74 79 border: 1px solid black; -
_source/plugins/stylescombo/plugin.js
89 89 } 90 90 91 91 combo.commit(); 92 93 combo.onOpen(); 92 combo._.onOpen(); 94 93 }); 95 94 }, 96 95 97 onClick : function( value )96 onClick : function( editor, value ) 98 97 { 99 98 editor.focus(); 100 99 editor.fire( 'saveSnapshot' ); … … 121 120 editor.fire( 'saveSnapshot' ); 122 121 }, 123 122 124 onRender : function( )123 onRender : function( editor ) 125 124 { 126 125 editor.on( 'selectionChange', function( ev ) 127 126 { … … 154 153 this); 155 154 }, 156 155 157 onOpen : function( )156 onOpen : function( editor ) 158 157 { 159 158 if ( CKEDITOR.env.ie ) 160 159 editor.focus(); -
_source/plugins/scayt/plugin.js
351 351 label : editor.lang.scayt.title, 352 352 title : editor.lang.scayt.title, 353 353 className : 'cke_button_scayt', 354 on Render: function()354 onMenu : function( editor ) 355 355 { 356 command.on( 'state', function() 357 { 358 this.setState( command.state ); 359 }, 360 this); 361 }, 362 onMenu : function() 363 { 364 var isEnabled = plugin.isScaytEnabled( editor ); 356 var isEnabled = plugin.isScaytEnabled( editor ); 365 357 366 editor.getMenuItem( 'scaytToggle' ).label = editor.lang.scayt[ isEnabled ? 'disable' : 'enable' ];358 editor.getMenuItem( 'scaytToggle' ).label = editor.lang.scayt[ isEnabled ? 'disable' : 'enable' ]; 367 359 368 360 return { 369 361 scaytToggle : CKEDITOR.TRISTATE_OFF, … … 372 364 scaytAbout : isEnabled ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED 373 365 }; 374 366 } 375 } );367 } ); 376 368 377 369 // If the "contextmenu" plugin is loaded, register the listeners. 378 370 if ( editor.contextMenu && editor.addMenuItems ) -
_source/core/config.js
282 282 * @example 283 283 * config.baseFloatZIndex = 2000 284 284 */ 285 baseFloatZIndex : 10000 285 baseFloatZIndex : 10000, 286 286 287 /** 288 * The position/container to which rendering the toolbar. For the default theme, 289 * the supported values are "top" and "bottom" or an exsited (empty) DOM element 290 * on the same page or from another frame of the same domain. 291 * 292 * @type String|HTMLElement 293 * @default 'top' 294 * @see CKEDITOR.config.theme 295 * @example 296 * config.toolbarLocation = 'bottom'; 297 * config.toolbarLocation = document.getElementById( 'MyToolbar' ) 298 */ 299 toolbarLocation : 'top', 300 301 /** 302 * Allow singleton toolbar to be shared among all subsequent editor instances, 303 * be commanded by the one which gain focus, the toolbar will take configration 304 * of the first created editor and will NOT be influenced by other editor instances. 305 * Note : 306 * This is an GLOBAL config opinion which should be applied at {@link CKEDITOR.config} 307 * object instead of on editor instance; 308 * The 'Maximize' and 'UIColor' feature will be unavailable when working in this mode; 309 * It's recommanded that all editors instances should be using the same skin and theme. 310 * 311 * @type Boolean 312 * @default false 313 * @example 314 * config.sharedToolbar = true; 315 */ 316 sharedToolbar : false 287 317 }; 288 318 289 319 // PACKAGER_RENAME( CKEDITOR.config ) -
_source/plugins/font/plugin.js
53 53 } 54 54 }, 55 55 56 onClick : function( value )56 onClick : function( editor, value ) 57 57 { 58 58 editor.focus(); 59 59 editor.fire( 'saveSnapshot' ); … … 68 68 editor.fire( 'saveSnapshot' ); 69 69 }, 70 70 71 onRender : function( )71 onRender : function( editor ) 72 72 { 73 73 editor.on( 'selectionChange', function( ev ) 74 74 { -
_source/plugins/editingblock/plugin.js
28 28 29 29 editor.on( 'themeSpace', function( event ) 30 30 { 31 if ( event.data.space == ' contents' )32 event.data.html += '<br>';31 if ( event.data.space == 'editingblock' ) 32 event.data.html = '<br>'; 33 33 }); 34 34 35 35 editor.on( 'themeLoaded', function() -
_source/plugins/button/plugin.js
39 39 } 40 40 }); 41 41 42 this._ = {}; 43 }; 42 this._ = 43 { 44 document : CKEDITOR.document 45 }; 46 }; 44 47 45 48 /** 46 49 * Transforms a button definition in a {@link CKEDITOR.ui.button} instance. … … 69 72 */ 70 73 render : function( editor, output ) 71 74 { 72 var env = CKEDITOR.env ;75 var env = CKEDITOR.env, _ = this._; 73 76 74 77 var id = this._.id = 'cke_' + CKEDITOR.tools.getNextNumber(); 75 this._.editor = editor;76 78 79 this.setState = function( state ) 80 { 81 if ( this._.state == state ) 82 return; 83 84 var element = _.document.getById( this._.id ); 85 86 if ( element ) 87 { 88 element.setState( state ); 89 90 var htmlTitle = this.title, 91 unavailable = editor.lang.common.unavailable, 92 labelElement = element.getChild( 1 ); 93 94 if ( state == CKEDITOR.TRISTATE_DISABLED ) 95 htmlTitle = unavailable.replace( '%1', this.title ); 96 97 labelElement.setHtml( htmlTitle ); 98 } 99 100 this._.state = state; 101 }; 102 103 this.setLabel = function( label ) 104 { 105 var element = _.document.getById( this._.id ), 106 labelElement = element && element.getChild( 1 ); 107 if( labelElement ) 108 { 109 labelElement.setHtml( label ); 110 element.setAttribute( 'title', label ); 111 element.setAttribute( 'href', 'javascript:void("' + label + '");' ); 112 } 113 }; 114 115 var registered = {}; 116 var onRender = CKEDITOR.tools.bind( function() 117 { 118 if( registered[ editor.name ] ) 119 return; 120 121 var commandName = this.command; 122 123 if ( this.modes ) 124 { 125 editor.on( 'mode', function() 126 { 127 this.setState( this.modes[ editor.mode ] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED ); 128 }, this); 129 } 130 if ( commandName ) 131 { 132 // Get the command instance. 133 var commandInstance = editor.getCommand( commandName ); 134 135 if ( commandInstance ) 136 { 137 commandInstance.on( 'state', function() 138 { 139 this.setState( commandInstance.state ); 140 }, this); 141 } 142 } 143 registered[ editor.name ] = 1; 144 }, this ) ; 145 77 146 var instance = 78 147 { 79 148 id : id, 80 149 button : this, 81 150 editor : editor, 151 alterScope : function( editorInstance ) 152 { 153 editor = editorInstance; 154 onRender(); 155 }, 156 setDocument : function( doc ) 157 { 158 _.document = doc; 159 }, 82 160 focus : function() 83 161 { 84 var element = CKEDITOR.document.getById( id );162 var element = _.document.getById( id ); 85 163 element.focus(); 86 164 }, 87 165 execute : function() … … 90 168 } 91 169 }; 92 170 93 var clickFn = CKEDITOR.tools.addFunction( instance.execute, instance);171 onRender(); 94 172 95 var index = CKEDITOR.ui.button._.instances.push( instance ) - 1; 173 var clickFn = CKEDITOR.tools.addFunction( instance.execute, instance ), 174 index = CKEDITOR.ui.button._.instances.push( instance ) - 1, 175 classes = ''; 96 176 97 var classes = '';98 99 177 // Get the command name. 100 178 var command = this.command; 101 102 if ( this.modes ) 103 { 104 editor.on( 'mode', function() 105 { 106 this.setState( this.modes[ editor.mode ] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED ); 107 }, this); 108 } 109 else if ( command ) 110 { 111 // Get the command instance. 112 command = editor.getCommand( command ); 113 114 if ( command ) 115 { 116 command.on( 'state', function() 117 { 118 this.setState( command.state ); 119 }, this); 120 121 classes += 'cke_' + ( 122 command.state == CKEDITOR.TRISTATE_ON ? 'on' : 123 command.state == CKEDITOR.TRISTATE_DISABLED ? 'disabled' : 124 'off' ); 125 } 126 } 127 128 if ( !command ) 179 // Get the command instance. 180 command = editor.getCommand( command ); 181 if ( command ) 182 { 183 classes += 'cke_' + ( 184 command.state == CKEDITOR.TRISTATE_ON ? 'on' : 185 command.state == CKEDITOR.TRISTATE_DISABLED ? 'disabled' : 186 'off' ); 187 } 188 else 129 189 classes += 'cke_off'; 130 190 131 191 if ( this.className ) … … 182 242 '</a>', 183 243 '</span>' ); 184 244 185 if ( this.onRender )186 this.onRender();187 188 245 return instance; 189 }, 190 191 setState : function( state ) 192 { 193 if ( this._.state == state ) 194 return; 195 196 var element = CKEDITOR.document.getById( this._.id ); 197 198 if ( element ) 199 { 200 element.setState( state ); 201 202 var htmlTitle = this.title, 203 unavailable = this._.editor.lang.common.unavailable, 204 labelElement = element.getChild( 1 ); 205 206 if ( state == CKEDITOR.TRISTATE_DISABLED ) 207 htmlTitle = unavailable.replace( '%1', this.title ); 208 209 labelElement.setHtml( htmlTitle ); 210 } 211 212 this._.state = state; 213 } 246 } 214 247 }; 215 248 216 249 /** -
_source/plugins/resize/plugin.js
57 57 58 58 editor.on( 'themeSpace', function( event ) 59 59 { 60 if ( event.data.space == ' bottom' )60 if ( event.data.space == 'resizer' ) 61 61 { 62 event.data.html += '<div class="cke_resizer"' +62 event.data.html = '<div class="cke_resizer"' + 63 63 ' title="' + CKEDITOR.tools.htmlEncode( editor.lang.resize ) + '"' + 64 64 ' onmousedown="CKEDITOR.tools.callFunction(' + mouseDownFn + ', event)"' + 65 65 '></div>'; -
_source/plugins/uicolor/plugin.js
10 10 11 11 init : function( editor ) 12 12 { 13 if ( CKEDITOR.env.ie6Compat ) 13 // We don't want uicolor feature available on share toolbar mode 14 // at this moment. 15 if ( CKEDITOR.env.ie6Compat || CKEDITOR.config.sharedToolbar ) 14 16 return; 15 17 16 18 editor.addCommand( 'uicolor', new CKEDITOR.dialogCommand( 'uicolor' ) ); -
_source/plugins/colorbutton/plugin.js
39 39 var block = panel.addBlock( blockName ); 40 40 block.autoSize = true; 41 41 block.element.addClass( 'cke_colorblock' ); 42 block.element.setHtml( renderColors( panel, type ) );42 block.element.setHtml( renderColors( this, panel, type ) ); 43 43 44 44 var keys = block.keys; 45 45 keys[ 39 ] = 'next'; // ARROW-RIGHT … … 47 47 keys[ 37 ] = 'prev'; // ARROW-LEFT 48 48 keys[ CKEDITOR.SHIFT + 9 ] = 'prev'; // SHIFT + TAB 49 49 keys[ 32 ] = 'click'; // SPACE 50 } 51 }); 52 } 50 }, 53 51 54 55 function renderColors( panel, type ) 56 { 57 var output = [], 58 colors = config.colorButton_colors.split( ',' ); 59 60 var clickFn = CKEDITOR.tools.addFunction( function( color, type ) 61 { 62 if ( color == '?' ) 63 { 64 // TODO : Implement the colors dialog. 65 // editor.openDialog( '' ); 66 return; 67 } 52 onClick : function( editor, color, type ) 53 { 54 if ( color == '?' ) 55 { 56 // TODO : Implement the colors dialog. 57 // editor.openDialog( '' ); 58 return; 59 } 68 60 69 editor.focus();61 editor.focus(); 70 62 71 panel.hide();63 this._.panel.hide(); 72 64 73 var style = new CKEDITOR.style( config['colorButton_' + type + 'Style'], color && { color : color } );65 var style = new CKEDITOR.style( config['colorButton_' + type + 'Style'], color && { color : color } ); 74 66 75 editor.fire( 'saveSnapshot' ); 76 if ( color ) 77 style.apply( editor.document ); 78 else 79 style.remove( editor.document ); 80 editor.fire( 'saveSnapshot' ); 67 editor.fire( 'saveSnapshot' ); 68 if ( color ) 69 style.apply( editor.document ); 70 else 71 style.remove( editor.document ); 72 editor.fire( 'saveSnapshot' ); 73 } 81 74 }); 75 } 82 76 77 78 function renderColors( panelbutton, panel, type ) 79 { 80 var output = [], 81 colors = config.colorButton_colors.split( ',' ); 82 83 var clickFn = CKEDITOR.tools.addFunction( function() 84 { 85 panelbutton._.onClick.apply( this, arguments ); 86 } ); 87 83 88 // Render the "Automatic" button. 84 89 output.push( 85 90 '<a class="cke_colorauto" _cke_focus=1 hidefocus=true' + -
_source/plugins/format/plugin.js
50 50 } 51 51 }, 52 52 53 onClick : function( value )53 onClick : function( editor, value ) 54 54 { 55 55 editor.focus(); 56 56 editor.fire( 'saveSnapshot' ); … … 60 60 editor.fire( 'saveSnapshot' ); 61 61 }, 62 62 63 onRender : function( )63 onRender : function( editor ) 64 64 { 65 65 editor.on( 'selectionChange', function( ev ) 66 66 {