commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-old / civicrm / packages / ckeditor / plugins / format_buttons / plugin.js
1 /*
2 * Youtube Embed Plugin
3 *
4 * @author Jonnas Fonini <contato@fonini.net>
5 * @version 1.0.10
6 */
7 ( function() {
8
9 "use strict";
10 var pluginName = "format_buttons";
11
12 CKEDITOR.plugins.add(pluginName, {
13
14 lang: 'en,nl',
15 icons: 'h1,h2,h3,h4,h5,h6',
16 hidpi: true,
17
18 init: function( editor ) {
19
20 var order = 0;
21 // All buttons use the same code to register. So, to avoid
22 // duplications, let's use this tool function.
23 var addButtonCommand = function( buttonName, buttonLabel, commandName, styleDefiniton ) {
24 // Disable the command if no definition is configured.
25 if ( !styleDefiniton )
26 return;
27
28 var style = new CKEDITOR.style( styleDefiniton ),
29 forms = contentForms[ commandName ];
30
31 // Put the style as the most important form.
32 forms.unshift( style );
33
34 // Listen to contextual style activation.
35 editor.attachStyleStateChange( style, function( state ) {
36 !editor.readOnly && editor.getCommand( commandName ).setState( state );
37 } );
38
39 // Create the command that can be used to apply the style.
40 editor.addCommand( commandName, new CKEDITOR.styleCommand( style, {
41 contentForms: forms
42 } ) );
43
44 // Register the button, if the button plugin is loaded.
45 if ( editor.ui.addButton ) {
46 editor.ui.addButton( buttonName, {
47 label: buttonLabel,
48 command: commandName,
49 toolbar: 'basicstyles,' + ( order += 10 )
50 } );
51 }
52 };
53
54 var contentForms = {
55 h1: ['h1'],
56 h2: ['h2'],
57 h3: ['h3'],
58 h4: ['h4'],
59 h5: ['h5'],
60 h6: ['h6'],
61 },
62 config = editor.config,
63 lang = editor.lang.format_buttons;
64
65 addButtonCommand( 'h1', lang.h1, 'h1', config.h1 );
66 addButtonCommand( 'h2', lang.h2, 'h2', config.h2 );
67 addButtonCommand( 'h3', lang.h3, 'h3', config.h3 );
68 addButtonCommand( 'h4', lang.h4, 'h4', config.h4 );
69 addButtonCommand( 'h5', lang.h5, 'h5', config.h5 );
70 addButtonCommand( 'h6', lang.h6, 'h6', config.h6 );
71
72 }
73
74 });
75
76
77 })();
78
79
80 // Basic Styles.
81 CKEDITOR.config.h1 = { element: 'h1' };
82 CKEDITOR.config.h2 = { element: 'h2' };
83 CKEDITOR.config.h3 = { element: 'h3' };
84 CKEDITOR.config.h4 = { element: 'h4' };
85 CKEDITOR.config.h5 = { element: 'h5' };
86 CKEDITOR.config.h6 = { element: 'h6' };