2 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
\r
3 For licensing, see LICENSE.html or http://ckeditor.com/license
\r
6 CKEDITOR.plugins.add( 'basicstyles',
\r
8 requires : [ 'styles', 'button' ],
\r
10 init : function( editor )
\r
12 // All buttons use the same code to register. So, to avoid
\r
13 // duplications, let's use this tool function.
\r
14 var addButtonCommand = function( buttonName, buttonLabel, commandName, styleDefiniton )
\r
16 var style = new CKEDITOR.style( styleDefiniton );
\r
18 editor.attachStyleStateChange( style, function( state )
\r
20 editor.getCommand( commandName ).setState( state );
\r
23 editor.addCommand( commandName, new CKEDITOR.styleCommand( style ) );
\r
25 editor.ui.addButton( buttonName,
\r
27 label : buttonLabel,
\r
28 command : commandName
\r
32 var config = editor.config,
\r
35 addButtonCommand( 'Bold' , lang.bold , 'bold' , config.coreStyles_bold );
\r
36 addButtonCommand( 'Italic' , lang.italic , 'italic' , config.coreStyles_italic );
\r
37 addButtonCommand( 'Underline' , lang.underline , 'underline' , config.coreStyles_underline );
\r
38 addButtonCommand( 'Strike' , lang.strike , 'strike' , config.coreStyles_strike );
\r
39 addButtonCommand( 'Subscript' , lang.subscript , 'subscript' , config.coreStyles_subscript );
\r
40 addButtonCommand( 'Superscript' , lang.superscript , 'superscript' , config.coreStyles_superscript );
\r
44 // Basic Inline Styles.
\r
47 * The style definition to be used to apply the bold style in the text.
\r
50 * config.coreStyles_bold = { element : 'b', overrides : 'strong' };
\r
52 * config.coreStyles_bold = { element : 'span', attributes : {'class': 'Bold'} };
\r
54 CKEDITOR.config.coreStyles_bold = { element : 'strong', overrides : 'b' };
\r
57 * The style definition to be used to apply the italic style in the text.
\r
59 * @default { element : 'em', overrides : 'i' }
\r
61 * config.coreStyles_italic = { element : 'i', overrides : 'em' };
\r
63 * CKEDITOR.config.coreStyles_italic = { element : 'span', attributes : {'class': 'Italic'} };
\r
65 CKEDITOR.config.coreStyles_italic = { element : 'em', overrides : 'i' };
\r
68 * The style definition to be used to apply the underline style in the text.
\r
70 * @default { element : 'u' }
\r
72 * CKEDITOR.config.coreStyles_underline = { element : 'span', attributes : {'class': 'Underline'}};
\r
74 CKEDITOR.config.coreStyles_underline = { element : 'u' };
\r
77 * The style definition to be used to apply the strike style in the text.
\r
79 * @default { element : 'strike' }
\r
81 * CKEDITOR.config.coreStyles_strike = { element : 'span', attributes : {'class': 'StrikeThrough'}, overrides : 'strike' };
\r
83 CKEDITOR.config.coreStyles_strike = { element : 'strike' };
\r
86 * The style definition to be used to apply the subscript style in the text.
\r
88 * @default { element : 'sub' }
\r
90 * CKEDITOR.config.coreStyles_subscript = { element : 'span', attributes : {'class': 'Subscript'}, overrides : 'sub' };
\r
92 CKEDITOR.config.coreStyles_subscript = { element : 'sub' };
\r
95 * The style definition to be used to apply the superscript style in the text.
\r
97 * @default { element : 'sup' }
\r
99 * CKEDITOR.config.coreStyles_superscript = { element : 'span', attributes : {'class': 'Superscript'}, overrides : 'sup' };
\r
101 CKEDITOR.config.coreStyles_superscript = { element : 'sup' };
\r