]> git.immae.eu Git - perso/Immae/Projets/packagist/ludivine-ckeditor-component.git/blobdiff - sources/plugins/dialog/plugin.js
Update to 4.7.3
[perso/Immae/Projets/packagist/ludivine-ckeditor-component.git] / sources / plugins / dialog / plugin.js
index d6af6a201c75cacca073938645c1b537ce2a1502..f26f9c9b9ac7667755bfeb247b54c4032b17957e 100644 (file)
@@ -177,10 +177,10 @@ CKEDITOR.DIALOG_STATE_BUSY = 2;
                        title = body.getChild( 0 ),\r
                        close = body.getChild( 1 );\r
 \r
-               // Don't allow dragging on dialog (#13184).\r
+               // Don't allow dragging on dialog (http://dev.ckeditor.com/ticket/13184).\r
                editor.plugins.clipboard && CKEDITOR.plugins.clipboard.preventDefaultDropOnElement( body );\r
 \r
-               // IFrame shim for dialog that masks activeX in IE. (#7619)\r
+               // IFrame shim for dialog that masks activeX in IE. (http://dev.ckeditor.com/ticket/7619)\r
                if ( CKEDITOR.env.ie && !CKEDITOR.env.quirks && !CKEDITOR.env.edge ) {\r
                        var src = 'javascript:void(function(){' + encodeURIComponent( 'document.open();(' + CKEDITOR.tools.fixDomain + ')();document.close();' ) + '}())', // jshint ignore:line\r
                                iframe = CKEDITOR.dom.element.createFromHtml( '<iframe' +\r
@@ -229,7 +229,7 @@ CKEDITOR.DIALOG_STATE_BUSY = 2;
                        tabsToRemove = {},\r
                        i, processed, stopPropagation;\r
 \r
-               if ( ( buttonsOrder == 'OS' && CKEDITOR.env.mac ) || // The buttons in MacOS Apps are in reverse order (#4750)\r
+               if ( ( buttonsOrder == 'OS' && CKEDITOR.env.mac ) || // The buttons in MacOS Apps are in reverse order (http://dev.ckeditor.com/ticket/4750)\r
                ( buttonsOrder == 'rtl' && dir == 'ltr' ) || ( buttonsOrder == 'ltr' && dir == 'rtl' ) )\r
                        defaultDefinition.buttons.reverse();\r
 \r
@@ -334,7 +334,7 @@ CKEDITOR.DIALOG_STATE_BUSY = 2;
 \r
                if ( definition.onOk ) {\r
                        this.on( 'ok', function( evt ) {\r
-                               // Dialog confirm might probably introduce content changes (#5415).\r
+                               // Dialog confirm might probably introduce content changes (http://dev.ckeditor.com/ticket/5415).\r
                                editor.fire( 'saveSnapshot' );\r
                                setTimeout( function() {\r
                                        editor.fire( 'saveSnapshot' );\r
@@ -451,7 +451,7 @@ CKEDITOR.DIALOG_STATE_BUSY = 2;
                                currentIndex = currentIndex + offset;\r
 \r
                                if ( hasTabs && !me._.tabBarMode && ( currentIndex == focusList.length || currentIndex == -1 ) ) {\r
-                                       // If the dialog was not in tab mode, then focus the first tab (#13027).\r
+                                       // If the dialog was not in tab mode, then focus the first tab (http://dev.ckeditor.com/ticket/13027).\r
                                        me._.tabBarMode = true;\r
                                        me._.tabs[ me._.currentTabId ][ 0 ].focus();\r
                                        me._.currentFocusIndex = -1;\r
@@ -528,7 +528,7 @@ CKEDITOR.DIALOG_STATE_BUSY = 2;
                                        button && CKEDITOR.tools.setTimeout( button.click, 0, button );\r
                                        processed = 1;\r
                                }\r
-                               stopPropagation = 1; // Always block the propagation (#4269)\r
+                               stopPropagation = 1; // Always block the propagation (http://dev.ckeditor.com/ticket/4269)\r
                        } else if ( keystroke == 27 /*ESC*/ ) {\r
                                button = this.getButton( 'cancel' );\r
 \r
@@ -539,7 +539,7 @@ CKEDITOR.DIALOG_STATE_BUSY = 2;
                                        if ( this.fire( 'cancel', { hide: true } ).hide !== false )\r
                                                this.hide();\r
                                }\r
-                               stopPropagation = 1; // Always block the propagation (#4269)\r
+                               stopPropagation = 1; // Always block the propagation (http://dev.ckeditor.com/ticket/4269)\r
                        } else {\r
                                return;\r
                        }\r
@@ -563,7 +563,7 @@ CKEDITOR.DIALOG_STATE_BUSY = 2;
                        dialogElement.on( 'keydown', keydownHandler, this );\r
 \r
                        // Some browsers instead, don't cancel key events in the keydown, but in the\r
-                       // keypress. So we must do a longer trip in those cases. (#4531,#8985)\r
+                       // keypress. So we must do a longer trip in those cases. (http://dev.ckeditor.com/ticket/4531,http://dev.ckeditor.com/ticket/8985)\r
                        if ( CKEDITOR.env.gecko )\r
                                dialogElement.on( 'keypress', keypressHandler, this );\r
 \r
@@ -612,7 +612,7 @@ CKEDITOR.DIALOG_STATE_BUSY = 2;
                        }\r
                }, this, null, 0xffffffff );\r
 \r
-               // IE6 BUG: Text fields and text areas are only half-rendered the first time the dialog appears in IE6 (#2661).\r
+               // IE6 BUG: Text fields and text areas are only half-rendered the first time the dialog appears in IE6 (http://dev.ckeditor.com/ticket/2661).\r
                // This is still needed after [2708] and [2709] because text fields in hidden TR tags are still broken.\r
                if ( CKEDITOR.env.ie6Compat ) {\r
                        this.on( 'load', function() {\r
@@ -788,7 +788,7 @@ CKEDITOR.DIALOG_STATE_BUSY = 2;
                        var element = this._.element.getFirst(), rtl = this._.editor.lang.dir == 'rtl';\r
                        var isFixed = element.getComputedStyle( 'position' ) == 'fixed';\r
 \r
-                       // (#8888) In some cases of a very small viewport, dialog is incorrectly\r
+                       // (http://dev.ckeditor.com/ticket/8888) In some cases of a very small viewport, dialog is incorrectly\r
                        // positioned in IE7. It also happens that it remains sticky and user cannot\r
                        // scroll down/up to reveal dialog's content below/above the viewport; this is\r
                        // cumbersome.\r
@@ -862,8 +862,10 @@ CKEDITOR.DIALOG_STATE_BUSY = 2;
                        // Reset all inputs back to their default value.\r
                        this.reset();\r
 \r
-                       // Select the first tab by default.\r
-                       this.selectPage( this.definition.contents[ 0 ].id );\r
+                       // Selects the first tab if no tab is already selected.\r
+                       if ( this._.currentTabId === null ) {\r
+                               this.selectPage( this.definition.contents[ 0 ].id );\r
+                       }\r
 \r
                        // Set z-index.\r
                        if ( CKEDITOR.dialog._.currentZIndex === null )\r
@@ -1038,7 +1040,7 @@ CKEDITOR.DIALOG_STATE_BUSY = 2;
                commitContent: function() {\r
                        var args = arguments;\r
                        this.foreach( function( widget ) {\r
-                               // Make sure IE triggers "change" event on last focused input before closing the dialog. (#7915)\r
+                               // Make sure IE triggers "change" event on last focused input before closing the dialog. (http://dev.ckeditor.com/ticket/7915)\r
                                if ( CKEDITOR.env.ie && this._.currentFocusIndex == widget.focusIndex )\r
                                        widget.getInputElement().$.blur();\r
 \r
@@ -1090,11 +1092,11 @@ CKEDITOR.DIALOG_STATE_BUSY = 2;
                                var editor = this._.editor;\r
                                editor.focus();\r
 \r
-                               // Give a while before unlock, waiting for focus to return to the editable. (#172)\r
+                               // Give a while before unlock, waiting for focus to return to the editable. (http://dev.ckeditor.com/ticket/172)\r
                                setTimeout( function() {\r
                                        editor.focusManager.unlock();\r
 \r
-                                       // Fixed iOS focus issue (#12381).\r
+                                       // Fixed iOS focus issue (http://dev.ckeditor.com/ticket/12381).\r
                                        // Keep in mind that editor.focus() does not work in this case.\r
                                        if ( CKEDITOR.env.iOS ) {\r
                                                editor.window.focus();\r
@@ -1111,7 +1113,7 @@ CKEDITOR.DIALOG_STATE_BUSY = 2;
                                contentObj.resetInitValue && contentObj.resetInitValue();\r
                        } );\r
 \r
-                       // Reset dialog state back to IDLE, if busy (#13213).\r
+                       // Reset dialog state back to IDLE, if busy (http://dev.ckeditor.com/ticket/13213).\r
                        this.setState( CKEDITOR.DIALOG_STATE_IDLE );\r
                },\r
 \r
@@ -1232,7 +1234,7 @@ CKEDITOR.DIALOG_STATE_BUSY = 2;
 \r
                        // [IE] an invisible input[type='text'] will enlarge it's width\r
                        // if it's value is long when it shows, so we clear it's value\r
-                       // before it shows and then recover it (#5649)\r
+                       // before it shows and then recover it (http://dev.ckeditor.com/ticket/5649)\r
                        if ( CKEDITOR.env.ie6Compat || CKEDITOR.env.ie7Compat ) {\r
                                clearOrRecoverTextInputValue( selected[ 1 ] );\r
                                selected[ 1 ].show();\r
@@ -2199,7 +2201,7 @@ CKEDITOR.DIALOG_STATE_BUSY = 2;
                resizeCover = resizeFunc;\r
                win.on( 'resize', resizeFunc );\r
                resizeFunc();\r
-               // Using Safari/Mac, focus must be kept where it is (#7027)\r
+               // Using Safari/Mac, focus must be kept where it is (http://dev.ckeditor.com/ticket/7027)\r
                if ( !( CKEDITOR.env.mac && CKEDITOR.env.webkit ) )\r
                        coverElement.focus();\r
 \r
@@ -2560,7 +2562,7 @@ CKEDITOR.DIALOG_STATE_BUSY = 2;
                                                        if ( elementDefinition && elementDefinition.padding !== undefined ) {\r
                                                                styles.push( 'padding:' + cssLength( elementDefinition.padding ) );\r
                                                        }\r
-                                                       // In IE Quirks alignment has to be done on table cells. (#7324)\r
+                                                       // In IE Quirks alignment has to be done on table cells. (http://dev.ckeditor.com/ticket/7324)\r
                                                        if ( CKEDITOR.env.ie && CKEDITOR.env.quirks && children[ i ].align ) {\r
                                                                styles.push( 'text-align:' + children[ i ].align );\r
                                                        }\r
@@ -2619,7 +2621,7 @@ CKEDITOR.DIALOG_STATE_BUSY = 2;
                                                        html.push( 'height:100%;' );\r
                                                html.push( 'width:' + cssLength( width || '100%' ), ';' );\r
 \r
-                                               // (#10123) Temp fix for dialog broken layout in latest webkit.\r
+                                               // (http://dev.ckeditor.com/ticket/10123) Temp fix for dialog broken layout in latest webkit.\r
                                                if ( CKEDITOR.env.webkit )\r
                                                        html.push( 'float:none;' );\r
 \r
@@ -2639,7 +2641,7 @@ CKEDITOR.DIALOG_STATE_BUSY = 2;
                                                                styles.push( 'height:' + Math.floor( 100 / childHtmlList.length ) + '%' );\r
                                                        if ( elementDefinition && elementDefinition.padding !== undefined )\r
                                                                styles.push( 'padding:' + cssLength( elementDefinition.padding ) );\r
-                                                       // In IE Quirks alignment has to be done on table cells. (#7324)\r
+                                                       // In IE Quirks alignment has to be done on table cells. (http://dev.ckeditor.com/ticket/7324)\r
                                                        if ( CKEDITOR.env.ie && CKEDITOR.env.quirks && children[ i ].align )\r
                                                                styles.push( 'text-align:' + children[ i ].align );\r
                                                        if ( styles.length > 0 )\r
@@ -2984,7 +2986,7 @@ CKEDITOR.DIALOG_STATE_BUSY = 2;
        /**\r
         * Generic dialog command. It opens a specific dialog when executed.\r
         *\r
-        *              // Register the "link" command, which opens the "link" dialog.\r
+        *              // Register the "link" command which opens the "link" dialog.\r
         *              editor.addCommand( 'link', new CKEDITOR.dialogCommand( 'link' ) );\r
         *\r
         * @class\r
@@ -2993,6 +2995,10 @@ CKEDITOR.DIALOG_STATE_BUSY = 2;
         * @param {String} dialogName The name of the dialog to open when executing\r
         * this command.\r
         * @param {Object} [ext] Additional command definition's properties.\r
+        * @param {String} [ext.tabId] You can provide additional property (`tabId`) if you wish to open the dialog on a specific tabId.\r
+        *\r
+        *              // Open the dialog on the 'keystroke' tabId.\r
+        *              editor.addCommand( 'keystroke', new CKEDITOR.dialogCommand( 'a11yHelp', { tabId: 'keystroke' } ) );\r
         */\r
        CKEDITOR.dialogCommand = function( dialogName, ext ) {\r
                this.dialogName = dialogName;\r
@@ -3001,7 +3007,13 @@ CKEDITOR.DIALOG_STATE_BUSY = 2;
 \r
        CKEDITOR.dialogCommand.prototype = {\r
                exec: function( editor ) {\r
-                       editor.openDialog( this.dialogName );\r
+                       var tabId = this.tabId;\r
+                       editor.openDialog( this.dialogName, function( dialog ) {\r
+                               // Select different tab if it's provided (#830).\r
+                               if ( tabId ) {\r
+                                       dialog.selectPage( tabId );\r
+                               }\r
+                       } );\r
                },\r
 \r
                // Dialog commands just open a dialog ui, thus require no undo logic,\r