JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.2.1
[ckeditor.git] / _source / plugins / div / dialogs / div.js
index e3b39c3..c1bfb8f 100644 (file)
 \r
                                // Preparing for the 'elementStyle' field.\r
                                var dialog = this,\r
-                                        stylesField = this.getContentElement( 'info', 'elementStyle' ),\r
-                                        // Reuse the 'stylescombo' plugin's styles definition.\r
-                                        customStylesConfig =  editor.config.stylesCombo_stylesSet,\r
-                                        stylesSetName = customStylesConfig && customStylesConfig.split( ':' )[ 0 ];\r
+                                        stylesField = this.getContentElement( 'info', 'elementStyle' );\r
 \r
-                               if ( stylesSetName )\r
+                                // Reuse the 'stylescombo' plugin's styles definition.\r
+                               editor.getStylesSet( function( stylesDefinitions )\r
                                {\r
-                                       CKEDITOR.stylesSet.load( stylesSetName,\r
-                                               function( stylesSet )\r
-                                               {\r
-                                                       var stylesDefinitions = stylesSet[ stylesSetName ],\r
-                                                               styleName;\r
+                                       var styleName;\r
 \r
-                                                       if ( stylesDefinitions )\r
+                                       if ( stylesDefinitions )\r
+                                       {\r
+                                               // Digg only those styles that apply to 'div'.\r
+                                               for ( var i = 0 ; i < stylesDefinitions.length ; i++ )\r
+                                               {\r
+                                                       var styleDefinition = stylesDefinitions[ i ];\r
+                                                       if ( styleDefinition.element && styleDefinition.element == 'div' )\r
                                                        {\r
-                                                               // Digg only those styles that apply to 'div'.\r
-                                                               for ( var i = 0 ; i < stylesDefinitions.length ; i++ )\r
-                                                               {\r
-                                                                       var styleDefinition = stylesDefinitions[ i ];\r
-                                                                       if ( styleDefinition.element && styleDefinition.element == 'div' )\r
-                                                                       {\r
-                                                                               styleName = styleDefinition.name;\r
-                                                                               styles[ styleName ] = new CKEDITOR.style( styleDefinition );\r
+                                                               styleName = styleDefinition.name;\r
+                                                               styles[ styleName ] = new CKEDITOR.style( styleDefinition );\r
 \r
-                                                                               // Populate the styles field options with style name.\r
-                                                                               stylesField.items.push( [ styleName, styleName ] );\r
-                                                                               stylesField.add( styleName, styleName );\r
-                                                                       }\r
-                                                               }\r
+                                                               // Populate the styles field options with style name.\r
+                                                               stylesField.items.push( [ styleName, styleName ] );\r
+                                                               stylesField.add( styleName, styleName );\r
                                                        }\r
+                                               }\r
+                                       }\r
 \r
+                                       // We should disable the content element\r
+                                       // it if no options are available at all.\r
+                                       stylesField[ stylesField.items.length > 1 ? 'enable' : 'disable' ]();\r
 \r
-                                                       // We should disable the content element\r
-                                                       // it if no options are available at all.\r
-                                                       stylesField[ stylesField.items.length > 1 ? 'enable' : 'disable' ]();\r
-\r
-                                                       // Now setup the field value manually.\r
-                                                       setTimeout( function() { stylesField.setup( dialog._element ); }, 0 );\r
-                                               } );\r
-                               }\r
+                                       // Now setup the field value manually.\r
+                                       setTimeout( function() { stylesField.setup( dialog._element ); }, 0 );\r
+                               } );\r
                        },\r
                        onShow : function()\r
                        {\r
                        },\r
                        onOk : function()\r
                        {\r
+                               editor.fire( 'saveSnapshot' );\r
                                if ( command == 'editdiv' )\r
                                        containers = [ this._element ];\r
                                else\r
                                        // Remove empty 'style' attribute.\r
                                        !containers[ i ].getAttribute( 'style' ) && containers[ i ].removeAttribute( 'style' );\r
                                }\r
+                               editor.fire( 'saveSnapshot' );\r
 \r
                                this.hide();\r
                        },\r