X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fstylescombo%2Fplugin.js;h=2b4716aae8cdd185bc7918a1ac3ba74976b1fdcf;hp=c7e749bb928ddea0763a4ec7b5a7542151a4c679;hb=059b4c2fef02528bf1af189f7996e80652faddfb;hpb=c6e377a02b54abc07129d72b632763c727476a15 diff --git a/_source/plugins/stylescombo/plugin.js b/_source/plugins/stylescombo/plugin.js index c7e749b..2b4716a 100644 --- a/_source/plugins/stylescombo/plugin.js +++ b/_source/plugins/stylescombo/plugin.js @@ -5,6 +5,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license (function() { + var stylesManager; + CKEDITOR.plugins.add( 'stylescombo', { requires : [ 'richcombo', 'styles' ], @@ -16,34 +18,39 @@ For licensing, see LICENSE.html or http://ckeditor.com/license pluginPath = this.path, styles; + if ( !stylesManager ) + stylesManager = CKEDITOR.stylesSet; + + var comboStylesSet = config.stylesCombo_stylesSet.split( ':' ), + styleSetName = comboStylesSet[ 0 ], + externalPath = comboStylesSet[ 1 ]; + + stylesManager.addExternal( styleSetName, + externalPath ? + comboStylesSet.slice( 1 ).join( ':' ) : + pluginPath + 'styles/' + styleSetName + '.js', '' ); + editor.ui.addRichCombo( 'Styles', { label : lang.label, title : lang.panelTitle, - voiceLabel : lang.voiceLabel, className : 'cke_styles', - multiSelect : true, panel : { css : editor.skin.editor.css.concat( config.contentsCss ), - voiceLabel : lang.panelVoiceLabel + multiSelect : true, + attributes : { 'aria-label' : lang.panelTitle } }, init : function() { - var combo = this, - stylesSet = config.stylesCombo_stylesSet.split( ':' ); + var combo = this; - var stylesSetPath = stylesSet[ 1 ] ? - stylesSet.slice( 1 ).join( ':' ) : // #4481 - CKEDITOR.getUrl( pluginPath + 'styles/' + stylesSet[ 0 ] + '.js' ) ; - - stylesSet = stylesSet[ 0 ]; - - CKEDITOR.loadStylesSet( stylesSet, stylesSetPath, function( stylesDefinitions ) + CKEDITOR.stylesSet.load( styleSetName, function( stylesSet ) { - var style, + var stylesDefinitions = stylesSet[ styleSetName ], + style, styleName, stylesList = []; @@ -207,29 +214,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license } }); - var stylesSets = {}; - - CKEDITOR.addStylesSet = function( name, styles ) - { - stylesSets[ name ] = styles; - }; - - CKEDITOR.loadStylesSet = function( name, url, callback ) - { - var stylesSet = stylesSets[ name ]; - - if ( stylesSet ) - { - callback( stylesSet ); - return ; - } - - CKEDITOR.scriptLoader.load( url, function() - { - callback( stylesSets[ name ] ); - }); - }; - function buildPreview( styleDefinition ) { var html = [];