Ticket #3553: 3553_2.patch

File 3553_2.patch, 3.3 KB (added by Martin Kou, 15 years ago)
  • _source/plugins/keystrokes/plugin.js

     
    182182
    183183        [ CKEDITOR.CTRL + 66 /*B*/, 'bold' ],
    184184        [ CKEDITOR.CTRL + 73 /*I*/, 'italic' ],
    185         [ CKEDITOR.CTRL + 85 /*U*/, 'underline' ]
     185        [ CKEDITOR.CTRL + 85 /*U*/, 'underline' ],
     186
     187        [ CKEDITOR.ALT + 109 /*-*/, 'toolbarCollapse' ]
    186188];
  • _source/plugins/toolbar/plugin.js

     
    5555        {
    5656                init : function( editor )
    5757                {
    58                         var collapserFn = CKEDITOR.tools.addFunction(
    59                                 function( collapser )
    60                                 {
    61                                         var toolbox = collapser.getPrevious();
    62                                         var contents = editor.getThemeSpace( 'contents' );
    63                                         var toolboxContainer = toolbox.getParent();
    64                                         var contentHeight = parseInt( contents.$.style.height, 10 );
    65                                         var previousHeight = toolboxContainer.$.offsetHeight;
    66 
    67                                         if ( toolbox.isVisible() )
    68                                         {
    69                                                 toolbox.hide();
    70                                                 collapser.addClass( 'cke_toolbox_collapser_min' );
    71                                         }
    72                                         else
    73                                         {
    74                                                 toolbox.show();
    75                                                 collapser.removeClass( 'cke_toolbox_collapser_min' );
    76                                         }
    77 
    78                                         var dy = toolboxContainer.$.offsetHeight - previousHeight;
    79                                         contents.setStyle( 'height', ( contentHeight - dy ) + 'px' );
    80                                 } );
    81 
    8258                        var itemKeystroke = function( item, keystroke )
    8359                        {
    8460                                switch ( keystroke )
     
    215191
    216192                                                if ( editor.config.toolbarCanCollapse )
    217193                                                {
    218                                                         output.push( '<a class="cke_toolbox_collapser' );
     194                                                        var collapserFn = CKEDITOR.tools.addFunction(
     195                                                                function()
     196                                                                {
     197                                                                        editor.execCommand( 'toolbarCollapse' );
     198                                                                } );
    219199
     200                                                        var collapserId = 'cke_' + CKEDITOR.tools.getNextNumber();
     201
     202                                                        editor.addCommand( 'toolbarCollapse',
     203                                                                {
     204                                                                        exec : function( editor )
     205                                                                        {
     206                                                                                var collapser = CKEDITOR.document.getById( collapserId );
     207                                                                                var toolbox = collapser.getPrevious();
     208                                                                                var contents = editor.getThemeSpace( 'contents' );
     209                                                                                var toolboxContainer = toolbox.getParent();
     210                                                                                var contentHeight = parseInt( contents.$.style.height, 10 );
     211                                                                                var previousHeight = toolboxContainer.$.offsetHeight;
     212
     213                                                                                if ( toolbox.isVisible() )
     214                                                                                {
     215                                                                                        toolbox.hide();
     216                                                                                        collapser.addClass( 'cke_toolbox_collapser_min' );
     217                                                                                }
     218                                                                                else
     219                                                                                {
     220                                                                                        toolbox.show();
     221                                                                                        collapser.removeClass( 'cke_toolbox_collapser_min' );
     222                                                                                }
     223
     224                                                                                var dy = toolboxContainer.$.offsetHeight - previousHeight;
     225                                                                                contents.setStyle( 'height', ( contentHeight - dy ) + 'px' );
     226                                                                        }
     227                                                                } );
     228
     229                                                        output.push( '<a id="' + collapserId + '" class="cke_toolbox_collapser' );
     230
    220231                                                        if ( !expanded )
    221232                                                                output.push( ' cke_toolbox_collapser_min' );
    222233
    223                                                         output.push( '" onclick="CKEDITOR.tools.callFunction(' + collapserFn + ',new CKEDITOR.dom.element(this))"></a>' );
     234                                                        output.push( '" onclick="CKEDITOR.tools.callFunction(' + collapserFn + ')"></a>' );
    224235                                                }
    225236
    226237                                                event.data.html += output.join( '' );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy