JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.6.1
[ckeditor.git] / _source / plugins / font / plugin.js
index 88aa38f..6248e68 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
@@ -17,27 +17,34 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                var styles = {};\r
                for ( var i = 0 ; i < names.length ; i++ )\r
                {\r
-                       var vars = {};\r
-                       var parts = names[ i ].split( '/' );\r
+                       var parts = names[ i ];\r
 \r
-                       var name = names[ i ] = parts[ 0 ];\r
-                       vars[ styleType ] = values[ i ] = parts[ 1 ] || name;\r
+                       if ( parts )\r
+                       {\r
+                               parts = parts.split( '/' );\r
+\r
+                               var vars = {},\r
+                                       name = names[ i ] = parts[ 0 ];\r
 \r
-                       styles[ name ] = new CKEDITOR.style( styleDefinition, vars );\r
+                               vars[ styleType ] = values[ i ] = parts[ 1 ] || name;\r
+\r
+                               styles[ name ] = new CKEDITOR.style( styleDefinition, vars );\r
+                               styles[ name ]._.definition.name = name;\r
+                       }\r
+                       else\r
+                               names.splice( i--, 1 );\r
                }\r
 \r
                editor.ui.addRichCombo( comboName,\r
                        {\r
                                label : lang.label,\r
                                title : lang.panelTitle,\r
-                               voiceLabel : lang.voiceLabel,\r
                                className : 'cke_' + ( styleType == 'size' ? 'fontSize' : 'font' ),\r
-                               multiSelect : false,\r
-\r
                                panel :\r
                                {\r
-                                       css : [ config.contentsCss, CKEDITOR.getUrl( editor.skinPath + 'editor.css' ) ],\r
-                                       voiceLabel : lang.panelVoiceLabel\r
+                                       css : editor.skin.editor.css.concat( config.contentsCss ),\r
+                                       multiSelect : false,\r
+                                       attributes : { 'aria-label' : lang.panelTitle }\r
                                },\r
 \r
                                init : function()\r
@@ -49,7 +56,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                var name = names[ i ];\r
 \r
                                                // Add the tag entry to the panel list.\r
-                                               this.add( name, '<span style="font-' + styleType + ':' + values[ i ] + '">' + name + '</span>', name );\r
+                                               this.add( name, styles[ name ].buildPreview(), name );\r
                                        }\r
                                },\r
 \r
@@ -86,7 +93,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                // the styles.\r
                                                                for ( var value in styles )\r
                                                                {\r
-                                                                       if ( styles[ value ].checkElementRemovable( element, true ) )\r
+                                                                       if ( styles[ value ].checkElementMatch( element, true ) )\r
                                                                        {\r
                                                                                if ( value != currentValue )\r
                                                                                        this.setValue( value );\r