X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Ffont%2Fplugin.js;h=268f2ee07f48e4b561224b7a79b5624246ff30c5;hb=6e682412d5cc0dfaedb376482e585bf2989c6863;hp=1d411a833ae5b61a40555dfe5373498aa8d3d101;hpb=941b0a9ba4e673e292510d80a5a86806994b8ea6;p=ckeditor.git diff --git a/_source/plugins/font/plugin.js b/_source/plugins/font/plugin.js index 1d411a8..268f2ee 100644 --- a/_source/plugins/font/plugin.js +++ b/_source/plugins/font/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2012, 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 : editor.skin.editor.css.concat( config.contentsCss ), - voiceLabel : lang.panelVoiceLabel + 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 );