namibia
df0489e1eeeeab5a9bd44e1d84fce49924fe1bac
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ (function() { function addCombo( editor, comboName, styleType, lang, entries, defaultLabel, styleDefinition ) { var config = editor.config; // Gets the list of fonts from the settings. var names = entries.split( ';' ), values = []; // Create style objects for all fonts. var styles = {}; for ( var i = 0 ; i < names.length ; i++ ) { var parts = names[ i ]; if ( parts ) { parts = parts.split( '/' ); var vars = {}, name = names[ i ] = parts[ 0 ]; 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, className : 'cke_' + ( styleType == 'size' ? 'fontSize' : 'font' ), panel : { css : editor.skin.editor.css.concat( config.contentsCss ), multiSelect : false, attributes : { 'aria-label' : lang.panelTitle } }, init : function() { this.startGroup( lang.panelTitle ); for ( var i = 0 ; i < names.length ; i++ ) { var name = names[ i ]; // Add the tag entry to the panel list. this.add( name, styles[ name ].buildPreview(), name ); } }, onClick : function( value ) { editor.focus(); editor.fire( 'saveSnapshot' ); var style = styles[ value ]; if ( this.getValue() == value ) style.remove( editor.document ); else style.apply( editor.document ); editor.fire( 'saveSnapshot' ); }, onRender : function() { editor.on( 'selectionChange', function( ev ) { var currentValue = this.getValue(); var elementPath = ev.data.path, elements = elementPath.elements; // For each element into the elements path. for ( var i = 0, element ; i < elements.length ; i++ ) { element = elements[i]; // Check if the element is removable by any of // the styles. for ( var value in styles ) { if ( styles[ value ].checkElementRemovable( element, true ) ) { if ( value != currentValue ) this.setValue( value ); return; } } } // If no styles match, just empty it. this.setValue( '', defaultLabel ); }, this); } }); } CKEDITOR.plugins.add( 'font', { requires : [ 'richcombo', 'styles' ], init : function( editor ) { var config = editor.config; addCombo( editor, 'Font', 'family', editor.lang.font, config.font_names, config.font_defaultLabel, config.font_style ); addCombo( editor, 'FontSize', 'size', editor.lang.fontSize, config.fontSize_sizes, config.fontSize_defaultLabel, config.fontSize_style ); } }); })(); /** * The list of fonts names to be displayed in the Font combo in the toolbar. * Entries are separated by semi-colons (;), while it's possible to have more * than one font for each entry, in the HTML way (separated by comma). * * A display name may be optionally defined by prefixing the entries with the * name and the slash character. For example, "Arial/Arial, Helvetica, sans-serif" * will be displayed as "Arial" in the list, but will be outputted as * "Arial, Helvetica, sans-serif". * @type String * @example * config.font_names = * 'Arial/Arial, Helvetica, sans-serif;' + * 'Times New Roman/Times New Roman, Times, serif;' + * 'Verdana'; * @example * config.font_names = 'Arial;Times New Roman;Verdana'; */ CKEDITOR.config.font_names = 'Arial/Arial, Helvetica, sans-serif;' + 'Comic Sans MS/Comic Sans MS, cursive;' + 'Courier New/Courier New, Courier, monospace;' + 'Georgia/Georgia, serif;' + 'Lucida Sans Unicode/Lucida Sans Unicode, Lucida Grande, sans-serif;' + 'Tahoma/Tahoma, Geneva, sans-serif;' + 'Times New Roman/Times New Roman, Times, serif;' + 'Trebuchet MS/Trebuchet MS, Helvetica, sans-serif;' + 'Verdana/Verdana, Geneva, sans-serif'; /** * The text to be displayed in the Font combo is none of the available values * matches the current cursor position or text selection. * @type String * @example * // If the default site font is Arial, we may making it more explicit to the end user. * config.font_defaultLabel = 'Arial'; */ CKEDITOR.config.font_defaultLabel = ''; /** * The style definition to be used to apply the font in the text. * @type Object * @example * // This is actually the default value for it. * config.font_style = * { * element : 'span', * styles : { 'font-family' : '#(family)' }, * overrides : [ { element : 'font', attributes : { 'face' : null } } ] * }; */ CKEDITOR.config.font_style = { element : 'span', styles : { 'font-family' : '#(family)' }, overrides : [ { element : 'font', attributes : { 'face' : null } } ] }; /** * The list of fonts size to be displayed in the Font Size combo in the * toolbar. Entries are separated by semi-colons (;). * * Any kind of "CSS like" size can be used, like "12px", "2.3em", "130%", * "larger" or "x-small". * * A display name may be optionally defined by prefixing the entries with the * name and the slash character. For example, "Bigger Font/14px" will be * displayed as "Bigger Font" in the list, but will be outputted as "14px". * @type String * @default '8/8px;9/9px;10/10px;11/11px;12/12px;14/14px;16/16px;18/18px;20/20px;22/22px;24/24px;26/26px;28/28px;36/36px;48/48px;72/72px' * @example * config.fontSize_sizes = '16/16px;24/24px;48/48px;'; * @example * config.fontSize_sizes = '12px;2.3em;130%;larger;x-small'; * @example * config.fontSize_sizes = '12 Pixels/12px;Big/2.3em;30 Percent More/130%;Bigger/larger;Very Small/x-small'; */ CKEDITOR.config.fontSize_sizes = '8/8px;9/9px;10/10px;11/11px;12/12px;14/14px;16/16px;18/18px;20/20px;22/22px;24/24px;26/26px;28/28px;36/36px;48/48px;72/72px'; /** * The text to be displayed in the Font Size combo is none of the available * values matches the current cursor position or text selection. * @type String * @example * // If the default site font size is 12px, we may making it more explicit to the end user. * config.fontSize_defaultLabel = '12px'; */ CKEDITOR.config.fontSize_defaultLabel = ''; /** * The style definition to be used to apply the font size in the text. * @type Object * @example * // This is actually the default value for it. * config.fontSize_style = * { * element : 'span', * styles : { 'font-size' : '#(size)' }, * overrides : [ { element : 'font', attributes : { 'size' : null } } ] * }; */ CKEDITOR.config.fontSize_style = { element : 'span', styles : { 'font-size' : '#(size)' }, overrides : [ { element : 'font', attributes : { 'size' : null } } ] }; |
Commits for namibiapublic/scripts/ckeditor/_source/plugins/font/plugin.js
Revision | Author | Commited | Message |
---|---|---|---|
df0489 ... | Mark | Fri 14 Oct, 2016 10:01:00 +0000 | initial commit |