On prépare de quoi se concentrer sur les images incorporées.
[ckeditor.git] / skins / ckeditor / _source / plugins / basicstyles / plugin.js
1 /*
2 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
3 For licensing, see LICENSE.html or http://ckeditor.com/license
4 */
5
6 CKEDITOR.plugins.add( 'basicstyles',
7 {
8 requires : [ 'styles', 'button' ],
9
10 init : function( editor )
11 {
12 // All buttons use the same code to register. So, to avoid
13 // duplications, let's use this tool function.
14 var addButtonCommand = function( buttonName, buttonLabel, commandName, styleDefiniton )
15 {
16 var style = new CKEDITOR.style( styleDefiniton );
17
18 editor.attachStyleStateChange( style, function( state )
19 {
20 !editor.readOnly && editor.getCommand( commandName ).setState( state );
21 });
22
23 editor.addCommand( commandName, new CKEDITOR.styleCommand( style ) );
24
25 editor.ui.addButton( buttonName,
26 {
27 label : buttonLabel,
28 command : commandName
29 });
30 };
31
32 var config = editor.config,
33 lang = editor.lang;
34
35 addButtonCommand( 'Bold' , lang.bold , 'bold' , config.coreStyles_bold );
36 addButtonCommand( 'Italic' , lang.italic , 'italic' , config.coreStyles_italic );
37 addButtonCommand( 'Underline' , lang.underline , 'underline' , config.coreStyles_underline );
38 addButtonCommand( 'Strike' , lang.strike , 'strike' , config.coreStyles_strike );
39 addButtonCommand( 'Subscript' , lang.subscript , 'subscript' , config.coreStyles_subscript );
40 addButtonCommand( 'Superscript' , lang.superscript , 'superscript' , config.coreStyles_superscript );
41 }
42 });
43
44 // Basic Inline Styles.
45
46 /**
47 * The style definition to be used to apply the bold style in the text.
48 * @type Object
49 * @example
50 * config.coreStyles_bold = { element : 'b', overrides : 'strong' };
51 * @example
52 * config.coreStyles_bold = { element : 'span', attributes : {'class': 'Bold'} };
53 */
54 CKEDITOR.config.coreStyles_bold = { element : 'strong', overrides : 'b' };
55
56 /**
57 * The style definition to be used to apply the italic style in the text.
58 * @type Object
59 * @default { element : 'em', overrides : 'i' }
60 * @example
61 * config.coreStyles_italic = { element : 'i', overrides : 'em' };
62 * @example
63 * CKEDITOR.config.coreStyles_italic = { element : 'span', attributes : {'class': 'Italic'} };
64 */
65 CKEDITOR.config.coreStyles_italic = { element : 'em', overrides : 'i' };
66
67 /**
68 * The style definition to be used to apply the underline style in the text.
69 * @type Object
70 * @default { element : 'u' }
71 * @example
72 * CKEDITOR.config.coreStyles_underline = { element : 'span', attributes : {'class': 'Underline'}};
73 */
74 CKEDITOR.config.coreStyles_underline = { element : 'u' };
75
76 /**
77 * The style definition to be used to apply the strike style in the text.
78 * @type Object
79 * @default { element : 'strike' }
80 * @example
81 * CKEDITOR.config.coreStyles_strike = { element : 'span', attributes : {'class': 'StrikeThrough'}, overrides : 'strike' };
82 */
83 CKEDITOR.config.coreStyles_strike = { element : 'strike' };
84
85 /**
86 * The style definition to be used to apply the subscript style in the text.
87 * @type Object
88 * @default { element : 'sub' }
89 * @example
90 * CKEDITOR.config.coreStyles_subscript = { element : 'span', attributes : {'class': 'Subscript'}, overrides : 'sub' };
91 */
92 CKEDITOR.config.coreStyles_subscript = { element : 'sub' };
93
94 /**
95 * The style definition to be used to apply the superscript style in the text.
96 * @type Object
97 * @default { element : 'sup' }
98 * @example
99 * CKEDITOR.config.coreStyles_superscript = { element : 'span', attributes : {'class': 'Superscript'}, overrides : 'sup' };
100 */
101 CKEDITOR.config.coreStyles_superscript = { element : 'sup' };