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 |
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.add( 'format', { requires : [ 'richcombo', 'styles' ], init : function( editor ) { var config = editor.config, lang = editor.lang.format; // Gets the list of tags from the settings. var tags = config.format_tags.split( ';' ); // Create style objects for all defined styles. var styles = {}; for ( var i = 0 ; i < tags.length ; i++ ) { var tag = tags[ i ]; styles[ tag ] = new CKEDITOR.style( config[ 'format_' + tag ] ); styles[ tag ]._.enterMode = editor.config.enterMode; } editor.ui.addRichCombo( 'Format', { label : lang.label, title : lang.panelTitle, className : 'cke_format', panel : { css : editor.skin.editor.css.concat( config.contentsCss ), multiSelect : false, attributes : { 'aria-label' : lang.panelTitle } }, init : function() { this.startGroup( lang.panelTitle ); for ( var tag in styles ) { var label = lang[ 'tag_' + tag ]; // Add the tag entry to the panel list. this.add( tag, styles[tag].buildPreview( label ), label ); } }, onClick : function( value ) { editor.focus(); editor.fire( 'saveSnapshot' ); var style = styles[ value ], elementPath = new CKEDITOR.dom.elementPath( editor.getSelection().getStartElement() ); style[ style.checkActive( elementPath ) ? 'remove' : 'apply' ]( editor.document ); // Save the undo snapshot after all changes are affected. (#4899) setTimeout( function() { editor.fire( 'saveSnapshot' ); }, 0 ); }, onRender : function() { editor.on( 'selectionChange', function( ev ) { var currentTag = this.getValue(); var elementPath = ev.data.path; for ( var tag in styles ) { if ( styles[ tag ].checkActive( elementPath ) ) { if ( tag != currentTag ) this.setValue( tag, editor.lang.format[ 'tag_' + tag ] ); return; } } // If no styles match, just empty it. this.setValue( '' ); }, this); } }); } }); /** * A list of semi colon separated style names (by default tags) representing * the style definition for each entry to be displayed in the Format combo in * the toolbar. Each entry must have its relative definition configuration in a * setting named "format_(tagName)". For example, the "p" entry has its * definition taken from config.format_p. * @type String * @default 'p;h1;h2;h3;h4;h5;h6;pre;address;div' * @example * config.format_tags = 'p;h2;h3;pre' */ CKEDITOR.config.format_tags = 'p;h1;h2;h3;h4;h5;h6;pre;address;div'; /** * The style definition to be used to apply the "Normal" format. * @type Object * @default { element : 'p' } * @example * config.format_p = { element : 'p', attributes : { 'class' : 'normalPara' } }; */ CKEDITOR.config.format_p = { element : 'p' }; /** * The style definition to be used to apply the "Normal (DIV)" format. * @type Object * @default { element : 'div' } * @example * config.format_div = { element : 'div', attributes : { 'class' : 'normalDiv' } }; */ CKEDITOR.config.format_div = { element : 'div' }; /** * The style definition to be used to apply the "Formatted" format. * @type Object * @default { element : 'pre' } * @example * config.format_pre = { element : 'pre', attributes : { 'class' : 'code' } }; */ CKEDITOR.config.format_pre = { element : 'pre' }; /** * The style definition to be used to apply the "Address" format. * @type Object * @default { element : 'address' } * @example * config.format_address = { element : 'address', attributes : { 'class' : 'styledAddress' } }; */ CKEDITOR.config.format_address = { element : 'address' }; /** * The style definition to be used to apply the "Heading 1" format. * @type Object * @default { element : 'h1' } * @example * config.format_h1 = { element : 'h1', attributes : { 'class' : 'contentTitle1' } }; */ CKEDITOR.config.format_h1 = { element : 'h1' }; /** * The style definition to be used to apply the "Heading 1" format. * @type Object * @default { element : 'h2' } * @example * config.format_h2 = { element : 'h2', attributes : { 'class' : 'contentTitle2' } }; */ CKEDITOR.config.format_h2 = { element : 'h2' }; /** * The style definition to be used to apply the "Heading 1" format. * @type Object * @default { element : 'h3' } * @example * config.format_h3 = { element : 'h3', attributes : { 'class' : 'contentTitle3' } }; */ CKEDITOR.config.format_h3 = { element : 'h3' }; /** * The style definition to be used to apply the "Heading 1" format. * @type Object * @default { element : 'h4' } * @example * config.format_h4 = { element : 'h4', attributes : { 'class' : 'contentTitle4' } }; */ CKEDITOR.config.format_h4 = { element : 'h4' }; /** * The style definition to be used to apply the "Heading 1" format. * @type Object * @default { element : 'h5' } * @example * config.format_h5 = { element : 'h5', attributes : { 'class' : 'contentTitle5' } }; */ CKEDITOR.config.format_h5 = { element : 'h5' }; /** * The style definition to be used to apply the "Heading 1" format. * @type Object * @default { element : 'h6' } * @example * config.format_h6 = { element : 'h6', attributes : { 'class' : 'contentTitle6' } }; */ CKEDITOR.config.format_h6 = { element : 'h6' }; |
Commits for namibiapublic/scripts/ckeditor/_source/plugins/format/plugin.js
Revision | Author | Commited | Message |
---|---|---|---|
df0489 ... | Mark | Fri 14 Oct, 2016 10:01:00 +0000 | initial commit |