JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.4b
[ckeditor.git] / _source / plugins / dialog / plugin.js
index 917d2dd..9927ebe 100644 (file)
@@ -472,7 +472,10 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
 \r
                // Insert the tabs and contents.\r
                for ( var i = 0 ; i < definition.contents.length ; i++ )\r
-                       this.addPage( definition.contents[i] );\r
+               {\r
+                       var page = definition.contents[i];\r
+                       page && this.addPage( page );\r
+               }\r
 \r
                this.parts['tabs'].on( 'click', function( evt )\r
                                {\r
@@ -480,8 +483,10 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
                                        // If we aren't inside a tab, bail out.\r
                                        if ( target.hasClass( 'cke_dialog_tab' ) )\r
                                        {\r
+                                               // Get the ID of the tab, without the 'cke_' prefix and the unique number suffix.\r
                                                var id = target.$.id;\r
-                                               this.selectPage( id.substr( 0, id.lastIndexOf( '_' ) ) );\r
+                                               this.selectPage( id.substring( 4, id.lastIndexOf( '_' ) ) );\r
+\r
                                                if ( this._.tabBarMode )\r
                                                {\r
                                                        this._.tabBarMode = false;\r
@@ -881,7 +886,7 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
                        page.setAttribute( 'role', 'tabpanel' );\r
 \r
                        var env = CKEDITOR.env;\r
-                       var tabId = contents.id + '_' + CKEDITOR.tools.getNextNumber(),\r
+                       var tabId = 'cke_' + contents.id + '_' + CKEDITOR.tools.getNextNumber(),\r
                                 tab = CKEDITOR.dom.element.createFromHtml( [\r
                                        '<a class="cke_dialog_tab"',\r
                                                ( this._.pageCount > 0 ? ' cke_last' : 'cke_first' ),\r
@@ -1386,7 +1391,7 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
                // Transform the contents entries in contentObjects.\r
                var contents = dialogDefinition.contents;\r
                for ( var i = 0, content ; ( content = contents[i] ) ; i++ )\r
-                       contents[ i ] = new contentObject( dialog, content );\r
+                       contents[ i ] = content && new contentObject( dialog, content );\r
 \r
                CKEDITOR.tools.extend( this, dialogDefinition );\r
        };\r
@@ -2051,7 +2056,7 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
                                        styles = ( stylesArg && stylesArg.call ? stylesArg( elementDefinition ) : stylesArg ) || {},\r
                                        attributes = ( attributesArg && attributesArg.call ? attributesArg( elementDefinition ) : attributesArg ) || {},\r
                                        innerHTML = ( contentsArg && contentsArg.call ? contentsArg.call( this, dialog, elementDefinition ) : contentsArg ) || '',\r
-                                       domId = this.domId = attributes.id || CKEDITOR.tools.getNextNumber() + '_uiElement',\r
+                                       domId = this.domId = attributes.id || CKEDITOR.tools.getNextId() + '_uiElement',\r
                                        id = this.id = elementDefinition.id,\r
                                        i;\r
 \r