JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.3.2
[ckeditor.git] / _source / plugins / dialog / plugin.js
index 5615b11..917d2dd 100644 (file)
@@ -168,6 +168,9 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
                {\r
                        this.on( 'ok', function( evt )\r
                                {\r
+                                       // Dialog confirm might probably introduce content changes (#5415).\r
+                                       editor.fire( 'saveSnapshot' );\r
+                                       setTimeout( function () { editor.fire( 'saveSnapshot' ); }, 0 );\r
                                        if ( definition.onOk.call( this, evt ) === false )\r
                                                evt.data.hide = false;\r
                                });\r
@@ -404,7 +407,7 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
                                setupFocus();\r
 \r
                                if ( editor.config.dialog_startupFocusTab\r
-                                       && me._.tabIdList.length > 1 )\r
+                                       && me._.pageCount > 1 )\r
                                {\r
                                        me._.tabBarMode = true;\r
                                        me._.tabs[ me._.currentTabId ][ 0 ].focus();\r
@@ -938,6 +941,13 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
                 */\r
                selectPage : function( id )\r
                {\r
+                       if ( this._.currentTabId == id )\r
+                               return;\r
+\r
+                       // Returning true means that the event has been canceled\r
+                       if ( this.fire( 'selectPage', { page : id, currentPage : this._.currentTabId } ) === true )\r
+                               return;\r
+\r
                        // Hide the non-selected tabs and pages.\r
                        for ( var i in this._.tabs )\r
                        {\r
@@ -2948,3 +2958,11 @@ CKEDITOR.plugins.add( 'dialog',
  * @param {CKEDITOR.editor} editor The editor instance that will use the\r
  *             dialog.\r
  */\r
+\r
+/**\r
+ * Fired when a tab is going to be selected in a dialog\r
+ * @name dialog#selectPage\r
+ * @event\r
+ * @param String page The id of the page that it's gonna be selected.\r
+ * @param String currentPage The id of the current page.\r
+ */\r