Ticket #4228: 4228.patch

File 4228.patch, 34.9 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/maximize/plugin.js

     
    9191        {
    9292                init : function( editor )
    9393                {
     94                        // We don't want maximize feature available on share toolbar mode
     95                        // at this moment.
     96                        if( CKEDITOR.config.sharedToolbar )
     97                                return;
     98                       
    9499                        var lang = editor.lang;
    95100                        var mainDocument = CKEDITOR.document;
    96101                        var mainWindow = mainDocument.getWindow();
     
    225230                                                this.toggleState();
    226231
    227232                                                // Toggle button label.
    228                                                 var button = this.uiItems[ 0 ];
     233                                                var buttonUI = this.uiItems[ 0 ];
    229234                                                var label = ( this.state == CKEDITOR.TRISTATE_OFF )
    230235                                                        ? 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 );
    235237
    236238                                                // Restore selection and scroll position in editing area.
    237239                                                if ( editor.mode == 'wysiwyg' )
  • _source/core/skins.js

     
    2323        var loadedPart = function( skinName, part, callback )
    2424        {
    2525                // Get the skin definition.
    26                 var skinDefinition = loaded[ skinName ];
     26                var skinDefinition = CKEDITOR.skins[ skinName ] = loaded[ skinName ];
    2727
    2828                var appendSkinPath = function( fileNames )
    2929                {
  • _source/plugins/elementspath/plugin.js

     
    4848
    4949                        editor.on( 'themeSpace', function( event )
    5050                                {
    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>';
    5353                                });
    5454
    5555                        editor.on( 'selectionChange', function( ev )
  • _source/plugins/richcombo/plugin.js

     
    8686                        var id = 'cke_' + this.id;
    8787                        var clickFn = CKEDITOR.tools.addFunction( function( $element )
    8888                                {
    89                                         var _ = this._;
     89                                        var me = this, _ = me._;
    9090
    9191                                        if ( _.state == CKEDITOR.TRISTATE_DISABLED )
    9292                                                return;
    9393
    9494                                        this.createPanel( editor );
     95                                        _.onOpen = function ()
     96                                        {
     97                                                me.onOpen && me.onOpen( editor );
     98                                        };
    9599
     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
    96119                                        if ( _.on )
    97120                                        {
    98121                                                _.panel.hide();
     
    120143                                combo : this,
    121144                                focus : function()
    122145                                {
    123                                         var element = CKEDITOR.document.getById( id ).getChild( 1 );
    124                                         element.focus();
     146                                        this.combo.document.getById( id ).getChild( 1 ).focus();
    125147                                },
     148                                setDocument : function( doc )
     149                                {
     150                                        this.combo.document = doc;
     151                                },
     152                                alterScope : function( editorInstance )
     153                                {
     154                                        editor = editorInstance;
     155                                        onRender();
     156                                },
    126157                                execute : clickFn
    127158                        };
    128159
    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 );
    134171
     172                                this.onRender && this.onRender( editor );
     173                                registered[ editor.name ] = 1;
     174                        }, this );
     175
    135176                        var keyDownFn = CKEDITOR.tools.addFunction( function( ev, element )
    136177                                {
    137178                                        ev = new CKEDITOR.dom.event( ev );
     
    195236                                '</span>' +
    196237                                '</span>' );
    197238
    198                         if ( this.onRender )
    199                                 this.onRender();
     239                        onRender();
    200240
    201241                        return instance;
    202242                },
     
    223263
    224264                                        me._.on = 1;
    225265
    226                                         if ( me.onOpen )
    227                                                 me.onOpen();
     266                                        me._.onOpen();
    228267                                };
    229268
    230269                        panel.onHide = function()
     
    246285                                        me.document.getById( 'cke_' + me.id ).getFirst().getNext().focus();
    247286                                };
    248287
    249                         list.onClick = function( value, marked )
    250                                 {
    251                                         // Move the focus to the main windows, otherwise it will stay
    252                                         // into the floating panel, even if invisible, and Safari and
    253                                         // 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                                         else
    262                                                 me.setValue( '' );
    263 
    264                                         panel.hide();
    265                                 };
    266 
    267288                        this._.panel = panel;
    268289                        this._.list = list;
    269290
  • _source/plugins/toolbar/plugin.js

     
    1616                this.focusCommandExecuted = false;
    1717        };
    1818
    19         toolbox.prototype.focus = function()
     19        toolbox.prototype =
    2020        {
    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                }
    3252        };
    3353
    3454        var commands =
     
    5373                }
    5474        };
    5575
     76
     77        // UI objects are subjected to be later used by multiple editors.
     78        var sharedToolbar = CKEDITOR.config.sharedToolbar;
     79
    5680        CKEDITOR.plugins.add( 'toolbar',
    5781        {
    5882                init : function( editor )
    5983                {
     84                        editor.addCommand( 'toolbarFocus', commands.toolbarFocus );
     85
    6086                        var itemKeystroke = function( item, keystroke )
    6187                        {
    6288                                switch ( keystroke )
     
    105131                                }
    106132                                return true;
    107133                        };
    108 
    109134                        editor.on( 'themeSpace', function( event )
    110135                                {
    111                                         if ( event.data.space == editor.config.toolbarLocation )
     136                                        var doc = CKEDITOR.document;
     137                                        if ( event.data.space == 'toolbar' )
    112138                                        {
    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();
    114146
     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
    115171                                                var output = [ '<div class="cke_toolbox"' ],
    116172                                                        expanded =  editor.config.toolbarStartupExpanded,
    117173                                                        groupStarted;
     
    241297                                                                {
    242298                                                                        exec : function( editor )
    243299                                                                        {
    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                                                                                }
    250312
    251313                                                                                if ( toolbox.isVisible() )
    252314                                                                                {
     
    259321                                                                                        collapser.removeClass( 'cke_toolbox_collapser_min' );
    260322                                                                                }
    261323
    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                                                                                }
    264329                                                                        },
    265 
    266                                                                         modes : { wysiwyg : 1, source : 1 }
     330                                                                        modes : { wysiwyg : 1, source : 1 },
     331                                                                        editorFocus : false
    267332                                                                } );
    268333
    269334                                                        output.push( '<a id="' + collapserId + '" class="cke_toolbox_collapser' );
     
    274339                                                        output.push( '" onclick="CKEDITOR.tools.callFunction(' + collapserFn + ')"></a>' );
    275340                                                }
    276341
    277                                                 event.data.html += output.join( '' );
     342                                                event.data.html = output.join( '' );
    278343                                        }
    279                                 });
     344                                } );
     345                }
     346        } );
    280347
    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
    284369})();
    285370
    286371/**
     
    298383};
    299384
    300385/**
    301  * The "theme space" to which rendering the toolbar. For the default theme,
    302  * the recommended options are "top" and "bottom".
    303  * @type String
    304  * @default 'top'
    305  * @see CKEDITOR.config.theme
    306  * @example
    307  * config.toolbarLocation = 'bottom';
    308  */
    309 CKEDITOR.config.toolbarLocation = 'top';
    310 
    311 /**
    312386 * The toolbar definition. It is an array of toolbars (strips),
    313387 * each one being also an array, containing a list of UI items.
    314388 * Note that this setting is composed by "toolbar_" added by the toolbar name,
  • _source/plugins/panelbutton/plugin.js

     
    2323{
    2424        var clickFn = function( editor )
    2525        {
    26                 var _ = this._;
     26                var me = this, _ = me._;
    2727
    2828                if ( _.state == CKEDITOR.TRISTATE_DISABLED )
    2929                        return;
    3030
     31                _.onClick = function ()
     32                {
     33                        me.onClick &&
     34                         me.onClick.apply( me,
     35                                [ editor ].concat(
     36                                        Array.prototype.slice.call( arguments, 0 ) ) );
     37                };
     38
    3139                this.createPanel( editor );
    3240
    3341                if ( _.on )
     
    3543                        _.panel.hide();
    3644                        return;
    3745                }
    38 
    39                 _.panel.showBlock( this._.id, this.document.getById( this._.id ), 4 );
     46                _.panel.showBlock( this._.id, this._.document.getById( this._.id ), 4 );
    4047        };
    4148
    4249
     
    5259
    5360                        this.base( definition );
    5461
    55                         this.document = ( panelDefinition
     62                        this._.document = ( panelDefinition
    5663                                                                && panelDefinition.parent
    5764                                                                && panelDefinition.parent.getDocument() )
    5865                                                        || CKEDITOR.document;
     
    6168
    6269                        this.click = clickFn;
    6370
    64                         this._ =
    65                         {
    66                                 panelDefinition : panelDefinition
    67                         };
     71                        this._.panelDefinition = panelDefinition;
    6872                },
    6973
    7074                statics :
     
    122126                                panel.onEscape = function()
    123127                                        {
    124128                                                panel.hide();
    125                                                 me.document.getById( _.id ).focus();
     129                                                me._.document.getById( _.id ).focus();
    126130                                        };
    127131
    128132                                if ( this.onBlock )
  • _source/themes/default/theme.js

     
    99                build : function( editor, themePath )
    1010                {
    1111                        var name = editor.name,
     12                                toolbarLocation = editor.config.toolbarLocation,
    1213                                element = editor.element,
    1314                                elementMode = editor.elementMode;
    1415
     
    1920                                element.hide();
    2021
    2122                        // 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;
    2527
    26                         var height      = contentsHtml && editor.config.height;
     28                        var height      = editingblockHtml && editor.config.height;
    2729
    2830                        var tabIndex = editor.config.tabIndex || editor.element.getAttribute( 'tabindex' ) || 0;
    2931
    3032                        // The editor height is considered only if the contents space got filled.
    31                         if ( !contentsHtml )
     33                        if ( !editingblockHtml )
    3234                                height = 'auto';
    3335                        else if ( !isNaN( height ) )
    3436                                height += 'px';
     
    4446                                style += "width: " + width + ";";
    4547                        }
    4648
    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( '' ), {} ) );
    7074
     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
    71100                        container.getChild( [0, 0, 0, 0, 0] ).unselectable();
    72101                        container.getChild( [0, 0, 0, 0, 2] ).unselectable();
    73102
     
    93122                        editor.fireOnce( 'uiReady' );
    94123                },
    95124
     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
    96151                buildDialog : function( editor )
    97152                {
    98153                        var baseIdNumber = CKEDITOR.tools.getNextNumber();
  • _source/plugins/menubutton/plugin.js

     
    2323{
    2424        var clickFn = function( editor )
    2525        {
    26                 var _ = this._;
     26                var me = this, _ = me._;
    2727
    2828                // Do nothing if this button is disabled.
    2929                if ( _.state === CKEDITOR.TRISTATE_DISABLED )
     
    4343                                },
    4444                                this );
    4545
    46                         // Initialize the menu items at this point.
    47                         if ( this.onMenu )
     46                        menu.addListener( function()
    4847                        {
    49                                 menu.addListener( this.onMenu );
    50                         }
    51                 }
     48                                // Initialize the menu items at this point.
     49                                return me.onMenu && me.onMenu( editor );
     50                        } );
     51                }
    5252
    5353                if ( _.on )
    5454                {
     
    5858
    5959                this.setState( CKEDITOR.TRISTATE_ON );
    6060
    61                 menu.show( CKEDITOR.document.getById( this._.id ), 4 );
     61                menu.show( this._.document.getById( this._.id ), 4 );
    6262        };
    6363
    6464
  • _source/skins/kama/mainui.css

     
    6969        padding: 0 5px 5px;
    7070}
    7171
     72.cke_skin_kama .cke_top
     73{
     74        height : 5px;
     75}
     76
    7277.cke_skin_kama .cke_hc .cke_contents
    7378{
    7479        border: 1px solid black;
  • _source/plugins/stylescombo/plugin.js

     
    8989                                                                }
    9090
    9191                                                                combo.commit();
    92 
    93                                                                 combo.onOpen();
     92                                                                combo._.onOpen();
    9493                                                        });
    9594                                        },
    9695
    97                                         onClick : function( value )
     96                                        onClick : function( editor, value )
    9897                                        {
    9998                                                editor.focus();
    10099                                                editor.fire( 'saveSnapshot' );
     
    121120                                                editor.fire( 'saveSnapshot' );
    122121                                        },
    123122
    124                                         onRender : function()
     123                                        onRender : function( editor )
    125124                                        {
    126125                                                editor.on( 'selectionChange', function( ev )
    127126                                                        {
     
    154153                                                        this);
    155154                                        },
    156155
    157                                         onOpen : function()
     156                                        onOpen : function( editor )
    158157                                        {
    159158                                                if ( CKEDITOR.env.ie )
    160159                                                        editor.focus();
  • _source/plugins/scayt/plugin.js

     
    351351                                                label : editor.lang.scayt.title,
    352352                                                title : editor.lang.scayt.title,
    353353                                                className : 'cke_button_scayt',
    354                                                 onRender: function()
     354                                                onMenu : function( editor )
    355355                                                {
    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 );
    365357
    366                                                 editor.getMenuItem( 'scaytToggle' ).label = editor.lang.scayt[ isEnabled ? 'disable' : 'enable' ];
     358                                                        editor.getMenuItem( 'scaytToggle' ).label = editor.lang.scayt[ isEnabled ? 'disable' : 'enable' ];
    367359
    368360                                                        return {
    369361                                                                scaytToggle : CKEDITOR.TRISTATE_OFF,
     
    372364                                                                scaytAbout : isEnabled ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED
    373365                                                        };
    374366                                                }
    375                                         });
     367                                        } );
    376368
    377369                        // If the "contextmenu" plugin is loaded, register the listeners.
    378370                        if ( editor.contextMenu && editor.addMenuItems )
  • _source/core/config.js

     
    282282         * @example
    283283         * config.baseFloatZIndex = 2000
    284284         */
    285         baseFloatZIndex : 10000
     285        baseFloatZIndex : 10000,
    286286
     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
    287317};
    288318
    289319// PACKAGER_RENAME( CKEDITOR.config )
  • _source/plugins/font/plugin.js

     
    5353                                        }
    5454                                },
    5555
    56                                 onClick : function( value )
     56                                onClick : function( editor, value )
    5757                                {
    5858                                        editor.focus();
    5959                                        editor.fire( 'saveSnapshot' );
     
    6868                                        editor.fire( 'saveSnapshot' );
    6969                                },
    7070
    71                                 onRender : function()
     71                                onRender : function( editor )
    7272                                {
    7373                                        editor.on( 'selectionChange', function( ev )
    7474                                                {
  • _source/plugins/editingblock/plugin.js

     
    2828
    2929                        editor.on( 'themeSpace', function( event )
    3030                                {
    31                                         if ( event.data.space == 'contents' )
    32                                                 event.data.html += '<br>';
     31                                        if ( event.data.space == 'editingblock' )
     32                                                event.data.html = '<br>';
    3333                                });
    3434
    3535                        editor.on( 'themeLoaded', function()
  • _source/plugins/button/plugin.js

     
    3939                                }
    4040                });
    4141
    42         this._ = {};
    43 };
     42        this._ =
     43        {
     44                document : CKEDITOR.document
     45        };
     46};
    4447
    4548/**
    4649 * Transforms a button definition in a {@link CKEDITOR.ui.button} instance.
     
    6972         */
    7073        render : function( editor, output )
    7174        {
    72                 var env = CKEDITOR.env;
     75                var env = CKEDITOR.env, _ = this._;
    7376
    7477                var id = this._.id = 'cke_' + CKEDITOR.tools.getNextNumber();
    75                 this._.editor = editor;
    7678
     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
    77146                var instance =
    78147                {
    79148                        id : id,
    80149                        button : this,
    81150                        editor : editor,
     151                        alterScope : function( editorInstance )
     152                        {
     153                                editor = editorInstance;
     154                                onRender();
     155                        },
     156                        setDocument : function( doc )
     157                        {
     158                                _.document = doc;
     159                        },
    82160                        focus : function()
    83161                        {
    84                                 var element = CKEDITOR.document.getById( id );
     162                                var element = _.document.getById( id );
    85163                                element.focus();
    86164                        },
    87165                        execute : function()
     
    90168                        }
    91169                };
    92170
    93                 var clickFn = CKEDITOR.tools.addFunction( instance.execute, instance );
     171                onRender();
    94172
    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 = '';
    96176
    97                 var classes = '';
    98 
    99177                // Get the command name.
    100178                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
    129189                        classes += 'cke_off';
    130190
    131191                if ( this.className )
     
    182242                        '</a>',
    183243                        '</span>' );
    184244
    185                 if ( this.onRender )
    186                         this.onRender();
    187 
    188245                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        }
    214247};
    215248
    216249/**
  • _source/plugins/resize/plugin.js

     
    5757
    5858                        editor.on( 'themeSpace', function( event )
    5959                                {
    60                                         if ( event.data.space == 'bottom' )
     60                                        if ( event.data.space == 'resizer' )
    6161                                        {
    62                                                 event.data.html += '<div class="cke_resizer"' +
     62                                                event.data.html = '<div class="cke_resizer"' +
    6363                                                        ' title="' + CKEDITOR.tools.htmlEncode( editor.lang.resize ) + '"' +
    6464                                                        ' onmousedown="CKEDITOR.tools.callFunction(' + mouseDownFn + ', event)"' +
    6565                                                        '></div>';
  • _source/plugins/uicolor/plugin.js

     
    1010
    1111        init : function( editor )
    1212        {
    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 )
    1416                        return;
    1517
    1618                editor.addCommand( 'uicolor', new CKEDITOR.dialogCommand( 'uicolor' ) );
  • _source/plugins/colorbutton/plugin.js

     
    3939                                                var block = panel.addBlock( blockName );
    4040                                                block.autoSize = true;
    4141                                                block.element.addClass( 'cke_colorblock' );
    42                                                 block.element.setHtml( renderColors( panel, type ) );
     42                                                block.element.setHtml( renderColors( this, panel, type ) );
    4343
    4444                                                var keys = block.keys;
    4545                                                keys[ 39 ]      = 'next';                                       // ARROW-RIGHT
     
    4747                                                keys[ 37 ]      = 'prev';                                       // ARROW-LEFT
    4848                                                keys[ CKEDITOR.SHIFT + 9 ]      = 'prev';       // SHIFT + TAB
    4949                                                keys[ 32 ]      = 'click';                                      // SPACE
    50                                         }
    51                                 });
    52                 }
     50                                        },
    5351
    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                                                }
    6860
    69                                         editor.focus();
     61                                                editor.focus();
    7062
    71                                         panel.hide();
     63                                                this._.panel.hide();
    7264
    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 } );
    7466
    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                                        }
    8174                                });
     75                }
    8276
     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
    8388                        // Render the "Automatic" button.
    8489                        output.push(
    8590                                '<a class="cke_colorauto" _cke_focus=1 hidefocus=true' +
  • _source/plugins/format/plugin.js

     
    5050                                        }
    5151                                },
    5252
    53                                 onClick : function( value )
     53                                onClick : function( editor, value )
    5454                                {
    5555                                        editor.focus();
    5656                                        editor.fire( 'saveSnapshot' );
     
    6060                                        editor.fire( 'saveSnapshot' );
    6161                                },
    6262
    63                                 onRender : function()
     63                                onRender : function( editor )
    6464                                {
    6565                                        editor.on( 'selectionChange', function( ev )
    6666                                                {
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy