Ticket #3113: 3113.patch

File 3113.patch, 12.5 KB (added by Artur Formella, 15 years ago)
  • _source/plugins/dialog/plugin.js

     
    290290                                                target = target.getParent();
    291291                                        }
    292292                                        id = target.$.id.substr( 0, target.$.id.lastIndexOf( '_' ) );
    293                                         this.selectPage( id );
     293                                        this.selectPage( id, true );
    294294                                }, this );
    295295
    296296                // Insert buttons.
     
    424424                        var viewSize = CKEDITOR.document.getWindow().getViewPaneSize();
    425425                        this.move( ( viewSize.width - this._.size.width ) / 2, ( viewSize.height - this._.size.height ) / 2 );
    426426
    427                         // Select the first tab by default.
    428                         this.selectPage( this.definition.contents[0].id );
     427                        // Select the startup tab.
     428                        var startupPage = ( this.definition.startupPage ) ? this.definition.startupPage : this.definition.contents[0].id;
     429                        this.selectPage( startupPage, false );
    429430
    430431                        // Reset all inputs back to their default value.
    431432                        this.reset();
     
    468469
    469470                        // Execute onLoad for the first show.
    470471                        this.fireOnce( 'load', {} );
     472
     473                        // Focus on startup element.
     474                        var content = this.definition.contents;
     475                        for ( var i in content )                // Get page index.
     476                        {
     477                                if ( content[i].id == startupPage )
     478                                {
     479                                        var element = content[i].startupFocus
     480                                        if ( element )
     481                                        {
     482                                                if ( this._.contents[ startupPage ][ element ] )
     483                                                        this._.contents[ startupPage ][ element ].focus();
     484                                                else
     485                                                {
     486                                                        var contentElement = CKEDITOR.document.getById( element );
     487                                                        if ( contentElement)
     488                                                                contentElement.focus();
     489                                                }
     490                                        }
     491                                        break;
     492                                }
     493                        }
     494
    471495                        this.fire( 'show', {} );
    472496
    473497                        // Save the initial values of the dialog.
     
    648672                 * @example
    649673                 * dialogObj.selectPage( 'tab_1' );
    650674                 */
    651                 selectPage : function( id )
     675                selectPage : function( id, setStartupFocus )
    652676                {
    653677                        // Hide the non-selected tabs and pages.
    654678                        for ( var i in this._.tabs )
     
    665689                        var selected = this._.tabs[id];
    666690                        selected[0].addClass( 'cke_dialog_tab_selected' );
    667691                        selected[1].show();
    668                         var me = this;
     692
     693                        if ( setStartupFocus )
     694                        {
     695                                // Focus on startup element.
     696                                var content = this.definition.contents;
     697                                for ( var i in content )                // Get page index.
     698                                {
     699                                        if ( content[i].id == id )
     700                                        {
     701                                                var element = content[i].startupFocus
     702                                                if ( element )
     703                                                {
     704                                                        if ( this._.contents[ id ][ element ] )
     705                                                                this._.contents[ id ][ element ].getInputElement().focus();
     706                                                        else
     707                                                        {
     708                                                                var contentElement = CKEDITOR.document.getById( element );
     709                                                                if ( contentElement)
     710                                                                        contentElement.focus();
     711                                                        }
     712                                                }
     713                                                break;
     714                                        }
     715                                }
     716                        }
    669717                },
    670718
    671719                /**
     
    16111659        var tabAccessKeyUp = function( dialog, key )
    16121660        {
    16131661                if ( dialog._.accessKeyMap[key] )
    1614                         dialog.selectPage( dialog._.accessKeyMap[key] );
     1662                        dialog.selectPage( dialog._.accessKeyMap[key], true );
    16151663        };
    16161664
    16171665        var tabAccessKeyDown = function( dialog, key )
     
    19932041
    19942042                        tabId = cursor.getAttribute( 'name' );
    19952043
    1996                         this._.dialog.selectPage( tabId );
     2044                        this._.dialog.selectPage( tabId, false );
    19972045                        return this;
    19982046                },
    19992047
  • _source/plugins/find/dialogs/find.js

     
    557557                        minWidth : 400,
    558558                        minHeight : 255,
    559559                        buttons : [ CKEDITOR.dialog.cancelButton ],             //Cancel button only.
     560                        startupPage : ( startupPage == 'replace' ) ? 'replace' : 'find',
    560561                        contents : [
    561562                                {
    562563                                        id : 'find',
    563564                                        label : editor.lang.findAndReplace.find,
    564565                                        title : editor.lang.findAndReplace.find,
     566                                        startupFocus : 'txtFindFind',
    565567                                        accessKey : '',
    566568                                        elements : [
    567569                                                {
     
    627629                                {
    628630                                        id : 'replace',
    629631                                        label : editor.lang.findAndReplace.replace,
     632                                        startupFocus : 'txtFindReplace',
    630633                                        accessKey : 'M',
    631634                                        elements : [
    632635                                                {
     
    754757                                        {
    755758                                                return function( pageId )
    756759                                                {
    757                                                         originalFunc.call( dialog, pageId );
     760                                                        originalFunc.call( dialog, pageId, true );
    758761                                                       
    759762                                                        var currPage = dialog._.tabs[ pageId ];
    760763                                                        var patternFieldInput, patternFieldId, wholeWordChkFieldId;
     
    785788                        {
    786789                                // Establish initial searching start position.
    787790                                finder.startCursor = getStartCursor.call( this );
    788                                
    789                                 if ( startupPage == 'replace' )
    790                                         this.getContentElement( 'replace', 'txtFindReplace' ).focus();
    791                                 else
    792                                         this.getContentElement( 'find', 'txtFindFind' ).focus();
    793791                        },
    794792                        onHide : function()
    795793                        {
  • _source/plugins/flash/dialogs/flash.js

     
    291291                                        id : 'info',
    292292                                        label : editor.lang.common.generalTab,
    293293                                        accessKey : 'I',
     294                                        startupFocus : 'src',
    294295                                        elements :
    295296                                        [
    296297                                                {
  • _source/plugins/forms/dialogs/button.js

     
    5050                                id : 'info',
    5151                                label : editor.lang.button.title,
    5252                                title : editor.lang.button.title,
     53                                startupFocus : 'txtName',
    5354                                elements : [
    5455                                        {
    5556                                                id : 'txtName',
     
    5960                                                setup : function( element )
    6061                                                {
    6162                                                        this.setValue( element.getAttribute( 'name' ) );
    62                                                         this.focus();
    6363                                                },
    6464                                                commit : function( element )
    6565                                                {
  • _source/plugins/forms/dialogs/checkbox.js

     
    6060                                                setup : function( element )
    6161                                                {
    6262                                                        this.setValue( element.getAttribute( 'name' ) );
    63                                                         this.focus();
    6463                                                },
    6564                                                commit : function( element )
    6665                                                {
  • _source/plugins/forms/dialogs/form.js

     
    4747                                id : 'info',
    4848                                label : editor.lang.form.title,
    4949                                title : editor.lang.form.title,
     50                                startupFocus : 'txtName',
    5051                                elements : [
    5152                                        {
    5253                                                id : 'txtName',
     
    5758                                                setup : function( element )
    5859                                                {
    5960                                                        this.setValue( element.getAttribute( 'name' ) );
    60                                                         this.focus();
    6161                                                },
    6262                                                commit : function( element )
    6363                                                {
  • _source/plugins/forms/dialogs/hiddenfield.js

     
    4747                                id : 'info',
    4848                                label : editor.lang.hidden.title,
    4949                                title : editor.lang.hidden.title,
     50                                startupFocus : 'txtName',
    5051                                elements : [
    5152                                        {
    5253                                                id : 'txtName',
     
    5758                                                setup : function( element )
    5859                                                {
    5960                                                        this.setValue( element.getAttribute( 'name' ) );
    60                                                         this.focus();
    6161                                                },
    6262                                                commit : function( element )
    6363                                                {
  • _source/plugins/forms/dialogs/radio.js

     
    4747                                id : 'info',
    4848                                label : editor.lang.checkboxAndRadio.radioTitle,
    4949                                title : editor.lang.checkboxAndRadio.radioTitle,
     50                                startupFocus : 'txtName',
    5051                                elements : [
    5152                                        {
    5253                                                id : 'txtName',
     
    5758                                                setup : function( element )
    5859                                                {
    5960                                                        this.setValue( element.getAttribute( 'name' ) );
    60                                                         this.focus();
    6161                                                },
    6262                                                commit : function( element )
    6363                                                {
  • _source/plugins/forms/dialogs/select.js

     
    173173                                id : 'info',
    174174                                label : editor.lang.select.selectInfo,
    175175                                title : editor.lang.select.selectInfo,
     176                                startupFocus : 'txtName',
    176177                                accessKey : '',
    177178                                elements : [
    178179                                        {
     
    188189                                                setup : function( name, element )
    189190                                                {
    190191                                                        if ( name == 'select' )
    191                                                         {
    192192                                                                this.setValue( element.getAttribute( 'name' ) );
    193                                                                 this.focus();
    194                                                         }
    195193                                                },
    196194                                                commit : function( element )
    197195                                                {
  • _source/plugins/forms/dialogs/textarea.js

     
    4646                                id : 'info',
    4747                                label : editor.lang.textarea.title,
    4848                                title : editor.lang.textarea.title,
     49                                startupFocus : 'txtName',
    4950                                elements : [
    5051                                        {
    5152                                                id : 'txtName',
     
    5657                                                setup : function( element )
    5758                                                {
    5859                                                        this.setValue( element.getAttribute( 'name' ) );
    59                                                         this.focus();
    6060                                                },
    6161                                                commit : function( element )
    6262                                                {
  • _source/plugins/forms/dialogs/textfield.js

     
    4747                                id : 'info',
    4848                                label : editor.lang.textfield.title,
    4949                                title : editor.lang.textfield.title,
     50                                startupFocus : 'txtName',
    5051                                elements : [
    5152                                        {
    5253                                                type : 'hbox',
     
    6263                                                                setup : function( element )
    6364                                                                {
    6465                                                                        this.setValue( element.getAttribute( 'name' ) );
    65                                                                         this.focus();
    6666                                                                },
    6767                                                                commit : function( element )
    6868                                                                {
  • _source/plugins/image/dialogs/image.js

     
    366366                                        id : 'info',
    367367                                        label : editor.lang.image.infoTab,
    368368                                        accessKey : 'I',
     369                                        startupFocus : 'txtUrl',
    369370                                        elements :
    370371                                        [
    371372                                                {
     
    423424                                                                                                                url = element.getAttribute( 'src' );
    424425                                                                                                        dialog.dontResetSize = true;
    425426                                                                                                        this.setValue( url );           // And call this.onChange()
    426                                                                                                         this.focus();
    427427                                                                                                }
    428428                                                                                        },
    429429                                                                                        commit : function( type, element )
     
    879879                                        id : 'Link',
    880880                                        label : editor.lang.link.title,
    881881                                        padding : 0,
     882                                        startupFocus : 'txtUrl',
    882883                                        elements :
    883884                                        [
    884885                                                {
  • _source/plugins/link/dialogs/anchor.js

     
    8282                                        this.saveSelection();
    8383                                }
    8484                        }
    85                         this.getContentElement( 'info', 'txtName' ).focus();
    8685                },
    8786                contents : [
    8887                        {
    8988                                id : 'info',
    9089                                label : editor.lang.anchor.title,
    9190                                accessKey : 'I',
     91                                startupFocus : 'txtName',
    9292                                elements :
    9393                                [
    9494                                        {
  • _source/plugins/pastetext/dialogs/pastetext.js

     
    1919                                {
    2020                                        // Reset the textarea value.
    2121                                        CKEDITOR.document.getById( textareaId ).setValue( '' );
     22                                        //CKEDITOR.document.getById( textareaId ).focus();
    2223                                },
    2324
    2425                                onOk : function()
     
    3839                                [
    3940                                        {
    4041                                                label : editor.lang.common.generalTab,
     42                                                startupFocus : textareaId,
    4143                                                elements :
    4244                                                [
    4345                                                        {
  • _source/plugins/table/dialogs/table.js

     
    259259                                        id : 'info',
    260260                                        label : editor.lang.table.title,
    261261                                        accessKey : 'I',
     262                                        startupFocus : 'txtRows',
    262263                                        elements :
    263264                                        [
    264265                                                {
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy