2 Copyright (c) 2003-2012, 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.readOnly && 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 that applies the <strong>bold</strong> style to the text.
\r
49 * @default <code>{ element : 'strong', overrides : 'b' }</code>
\r
51 * config.coreStyles_bold = { element : 'b', overrides : 'strong' };
\r
53 * config.coreStyles_bold =
\r
56 * attributes : { 'class' : 'Bold' }
\r
59 CKEDITOR.config.coreStyles_bold = { element : 'strong', overrides : 'b' };
\r
62 * The style definition that applies the <em>italics</em> style to the text.
\r
64 * @default <code>{ element : 'em', overrides : 'i' }</code>
\r
66 * config.coreStyles_italic = { element : 'i', overrides : 'em' };
\r
68 * CKEDITOR.config.coreStyles_italic =
\r
71 * attributes : { 'class' : 'Italic' }
\r
74 CKEDITOR.config.coreStyles_italic = { element : 'em', overrides : 'i' };
\r
77 * The style definition that applies the <u>underline</u> style to the text.
\r
79 * @default <code>{ element : 'u' }</code>
\r
81 * CKEDITOR.config.coreStyles_underline =
\r
84 * attributes : { 'class' : 'Underline' }
\r
87 CKEDITOR.config.coreStyles_underline = { element : 'u' };
\r
90 * The style definition that applies the <strike>strike-through</strike> style to the text.
\r
92 * @default <code>{ element : 'strike' }</code>
\r
94 * CKEDITOR.config.coreStyles_strike =
\r
97 * attributes : { 'class' : 'StrikeThrough' },
\r
98 * overrides : 'strike'
\r
101 CKEDITOR.config.coreStyles_strike = { element : 'strike' };
\r
104 * The style definition that applies the subscript style to the text.
\r
106 * @default <code>{ element : 'sub' }</code>
\r
108 * CKEDITOR.config.coreStyles_subscript =
\r
110 * element : 'span',
\r
111 * attributes : { 'class' : 'Subscript' },
\r
112 * overrides : 'sub'
\r
115 CKEDITOR.config.coreStyles_subscript = { element : 'sub' };
\r
118 * The style definition that applies the superscript style to the text.
\r
120 * @default <code>{ element : 'sup' }</code>
\r
122 * CKEDITOR.config.coreStyles_superscript =
\r
124 * element : 'span',
\r
125 * attributes : { 'class' : 'Superscript' },
\r
126 * overrides : 'sup'
\r
129 CKEDITOR.config.coreStyles_superscript = { element : 'sup' };
\r