X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Ffont%2Fplugin.js;h=6248e68b3aff04d81d92ad1ba462f20cd8ccfd83;hb=3fe9cac293e090ea459a3ee10d78cbe9e1dd0e03;hp=88aa38f1a72565272ccbd2224212accc229a673d;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91;p=ckeditor.git diff --git a/_source/plugins/font/plugin.js b/_source/plugins/font/plugin.js index 88aa38f..6248e68 100644 --- a/_source/plugins/font/plugin.js +++ b/_source/plugins/font/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -17,27 +17,34 @@ For licensing, see LICENSE.html or http://ckeditor.com/license var styles = {}; for ( var i = 0 ; i < names.length ; i++ ) { - var vars = {}; - var parts = names[ i ].split( '/' ); + var parts = names[ i ]; - var name = names[ i ] = parts[ 0 ]; - vars[ styleType ] = values[ i ] = parts[ 1 ] || name; + if ( parts ) + { + parts = parts.split( '/' ); + + var vars = {}, + name = names[ i ] = parts[ 0 ]; - styles[ name ] = new CKEDITOR.style( styleDefinition, vars ); + vars[ styleType ] = values[ i ] = parts[ 1 ] || name; + + styles[ name ] = new CKEDITOR.style( styleDefinition, vars ); + styles[ name ]._.definition.name = name; + } + else + names.splice( i--, 1 ); } editor.ui.addRichCombo( comboName, { label : lang.label, title : lang.panelTitle, - voiceLabel : lang.voiceLabel, className : 'cke_' + ( styleType == 'size' ? 'fontSize' : 'font' ), - multiSelect : false, - panel : { - css : [ config.contentsCss, CKEDITOR.getUrl( editor.skinPath + 'editor.css' ) ], - voiceLabel : lang.panelVoiceLabel + css : editor.skin.editor.css.concat( config.contentsCss ), + multiSelect : false, + attributes : { 'aria-label' : lang.panelTitle } }, init : function() @@ -49,7 +56,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license var name = names[ i ]; // Add the tag entry to the panel list. - this.add( name, '' + name + '', name ); + this.add( name, styles[ name ].buildPreview(), name ); } }, @@ -86,7 +93,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // the styles. for ( var value in styles ) { - if ( styles[ value ].checkElementRemovable( element, true ) ) + if ( styles[ value ].checkElementMatch( element, true ) ) { if ( value != currentValue ) this.setValue( value );