JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.2
[ckeditor.git] / _source / plugins / stylescombo / plugin.js
index c7e749b..2b4716a 100644 (file)
@@ -5,6 +5,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 \r
 (function()\r
 {\r
+       var stylesManager;\r
+\r
        CKEDITOR.plugins.add( 'stylescombo',\r
        {\r
                requires : [ 'richcombo', 'styles' ],\r
@@ -16,34 +18,39 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                pluginPath = this.path,\r
                                styles;\r
 \r
+                       if ( !stylesManager )\r
+                               stylesManager = CKEDITOR.stylesSet;\r
+\r
+                       var comboStylesSet = config.stylesCombo_stylesSet.split( ':' ),\r
+                               styleSetName = comboStylesSet[ 0 ],\r
+                               externalPath = comboStylesSet[ 1 ];\r
+\r
+                       stylesManager.addExternal( styleSetName,\r
+                                       externalPath ?\r
+                                               comboStylesSet.slice( 1 ).join( ':' ) :\r
+                                               pluginPath + 'styles/' + styleSetName + '.js', '' );\r
+\r
                        editor.ui.addRichCombo( 'Styles',\r
                                {\r
                                        label : lang.label,\r
                                        title : lang.panelTitle,\r
-                                       voiceLabel : lang.voiceLabel,\r
                                        className : 'cke_styles',\r
-                                       multiSelect : true,\r
 \r
                                        panel :\r
                                        {\r
                                                css : editor.skin.editor.css.concat( config.contentsCss ),\r
-                                               voiceLabel : lang.panelVoiceLabel\r
+                                               multiSelect : true,\r
+                                               attributes : { 'aria-label' : lang.panelTitle }\r
                                        },\r
 \r
                                        init : function()\r
                                        {\r
-                                               var combo = this,\r
-                                                       stylesSet = config.stylesCombo_stylesSet.split( ':' );\r
+                                               var combo = this;\r
 \r
-                                               var stylesSetPath = stylesSet[ 1 ] ?\r
-                                                               stylesSet.slice( 1 ).join( ':' ) :              // #4481\r
-                                                               CKEDITOR.getUrl( pluginPath + 'styles/' + stylesSet[ 0 ] + '.js' ) ;\r
-\r
-                                               stylesSet = stylesSet[ 0 ];\r
-\r
-                                               CKEDITOR.loadStylesSet( stylesSet, stylesSetPath, function( stylesDefinitions )\r
+                                               CKEDITOR.stylesSet.load( styleSetName, function( stylesSet )\r
                                                        {\r
-                                                               var style,\r
+                                                               var stylesDefinitions = stylesSet[ styleSetName ],\r
+                                                                       style,\r
                                                                        styleName,\r
                                                                        stylesList = [];\r
 \r
@@ -207,29 +214,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                }\r
        });\r
 \r
-       var stylesSets = {};\r
-\r
-       CKEDITOR.addStylesSet = function( name, styles )\r
-       {\r
-               stylesSets[ name ] = styles;\r
-       };\r
-\r
-       CKEDITOR.loadStylesSet = function( name, url, callback )\r
-       {\r
-               var stylesSet = stylesSets[ name ];\r
-\r
-               if ( stylesSet )\r
-               {\r
-                       callback( stylesSet );\r
-                       return ;\r
-               }\r
-\r
-               CKEDITOR.scriptLoader.load( url, function()\r
-                       {\r
-                               callback( stylesSets[ name ] );\r
-                       });\r
-       };\r
-\r
        function buildPreview( styleDefinition )\r
        {\r
                var html = [];\r