Ticket #5307: 5307_2.patch

File 5307_2.patch, 2.2 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/dialog/plugin.js

     
    335335
    336336                                processed = 1;
    337337                        }
    338                         else if ( keystroke == CKEDITOR.ALT + 121 && !me._.tabBarMode )
     338                        else if ( keystroke == CKEDITOR.ALT + 121 && !me._.tabBarMode && me.getPageCount() > 1 )
    339339                        {
    340340                                // Alt-F10 puts focus into the current tab item in the tab bar.
    341341                                me._.tabBarMode = true;
     
    893893
    894894                        page.setAttribute( 'aria-labelledby', tabId );
    895895
    896                         // If only a single page exist, a different style is used in the central pane.
    897                         if ( this._.pageCount === 0 )
    898                                 this.parts.dialog.addClass( 'cke_single_page' );
    899                         else
    900                                 this.parts.dialog.removeClass( 'cke_single_page' );
    901 
    902896                        // Take records for the tabs and elements created.
    903897                        this._.tabs[ contents.id ] = [ tab, page ];
    904898                        this._.tabIdList.push( contents.id );
    905                         this._.pageCount++;
     899                        !contents.hidden && this._.pageCount++;
    906900                        this._.lastTab = tab;
     901                        this.updateStyle();
    907902
    908903                        var contentMap = this._.contents[ contents.id ] = {},
    909904                                cursor,
     
    961956                        this._.currentTabIndex = CKEDITOR.tools.indexOf( this._.tabIdList, id );
    962957                },
    963958
     959                // Dialog state-specific style updates.
     960                updateStyle : function()
     961                {
     962                        // If only a single page shown, a different style is used in the central pane.
     963                        this.parts.dialog[ ( this._.pageCount === 1 ? 'add' : 'remove' ) + 'Class' ]( 'cke_single_page' );
     964                },
     965
    964966                /**
    965967                 * Hides a page's tab away from the dialog.
    966968                 * @param {String} id The page's Id.
     
    970972                hidePage : function( id )
    971973                {
    972974                        var tab = this._.tabs[id] && this._.tabs[id][0];
    973                         if ( !tab )
     975                        if ( !tab || this._.pageCount == 1 )
    974976                                return;
     977                        // Switch to other tab first when we're hiding the active tab.
     978                        else if ( id == this._.currentTabId )
     979                                this.selectPage( getPreviousVisibleTab.call( this ) );
     980
    975981                        tab.hide();
     982                        this._.pageCount--;
     983                        this.updateStyle();
    976984                },
    977985
    978986                /**
     
    987995                        if ( !tab )
    988996                                return;
    989997                        tab.show();
     998                        this._.pageCount++;
     999                        this.updateStyle();
    9901000                },
    9911001
    9921002                /**
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy