Ticket #3235: 3235.patch

File 3235.patch, 3.3 KB (added by Artur Formella, 15 years ago)
  • _source/plugins/toolbar/plugin.js

     
    5050        {
    5151                init : function( editor )
    5252                {
     53                        if ( !( editor.config.toolbar instanceof Array ) )
     54                                editor.config.toolbar = CKEDITOR.toolbarSets.getSet( editor.config.toolbar );
     55
    5356                        var itemKeystroke = function( item, keystroke )
    5457                        {
    5558                                switch ( keystroke )
     
    184187                        editor.addCommand( 'toolbarFocus', commands.toolbarFocus );
    185188                }
    186189        });
     190
     191        var toolbarSets = function()
     192        {
     193                this._sets = [];
     194        };
     195
     196        toolbarSets.prototype =
     197        {
     198                addSet : function( toolbarName, toolbarDefinition )
     199                {
     200                        this._sets[ toolbarName ] = toolbarDefinition;
     201                },
     202
     203                getSet : function( toolbarName )
     204                {
     205                        return this._sets[ toolbarName ] || this._sets[ 'Default' ];
     206                }
     207        };
     208        CKEDITOR.toolbarSets = new toolbarSets();
     209
    187210})();
    188211
    189212/**
     
    211234 */
    212235CKEDITOR.config.toolbarLocation = 'top';
    213236
     237CKEDITOR.toolbarSets.addSet( "Default",
     238        [
     239                ['Source','-','Save','NewPage','Preview','-','Templates'],
     240                ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker'],
     241                ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
     242                ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'],
     243                '/',
     244                ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
     245                ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
     246                ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
     247                ['Link','Unlink','Anchor'],     ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
     248                '/',
     249                ['Styles','Format','Font','FontSize'],
     250                ['TextColor','BGColor'],
     251                ['ShowBlocks']
     252        ]);
     253
     254CKEDITOR.toolbarSets.addSet( "Basic",
     255        [
     256                ['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ]
     257        ]);
     258
    214259/**
    215260 * The toolbox (alias toolbar) definition. It is an array of toolbars (strips),
    216261 * each one being also an array, containing a list of UI items.
    217  * @type Array
     262 * @type Array or String
     263 * @default 'Default'
    218264 * @example
    219265 * // Defines a toolbar with only one strip containing the "Source" button, a
    220266 * // separator and the "Bold" and "Italic" buttons.
     
    222268 * [
    223269 *     [ 'Source', '-', 'Bold', 'Italic' ]
    224270 * ]</b>;
     271 * // Use Basic toolbar definition
     272 * <b>CKEDITOR.config.toolbar = 'Basic';
    225273 */
    226 CKEDITOR.config.toolbar =
    227 [
    228         ['Source','-','Save','NewPage','Preview','-','Templates'],
    229         ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker'],
    230         ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
    231         ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'],
    232         '/',
    233         ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
    234         ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
    235         ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
    236         ['Link','Unlink','Anchor'],     ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
    237         '/',
    238         ['Styles','Format','Font','FontSize'],
    239         ['TextColor','BGColor'],
    240         ['ShowBlocks']
    241 ];
     274
     275CKEDITOR.config.toolbar = 'Default';
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy