1 // https://civicrm.org/licensing
5 // Weird conflict with drupal styles
6 $('body').removeClass('toolbar');
8 function format(item
) {
9 var icon
= '<span class="ui-icon ui-icon-gear"></span>';
11 icon
= '<img src="' + CRM
.config
.resourceBase
+ item
.icon
+ '" />';
13 return icon
+ ' ' + item
.text
;
16 $('#extraPlugins').crmSelect2({
19 data
: CRM
.vars
.ckConfig
.plugins
,
20 escapeMarkup
: _
.identity
,
22 formatSelection
: format
25 var toolbarModifier
= new ToolbarConfigurator
.ToolbarModifier( 'editor-basic' );
27 toolbarModifier
.init(_
.noop
);
29 CKEDITOR
.document
.getById( 'toolbarModifierWrapper' ).append( toolbarModifier
.mainContainer
);
32 var selectorOpen
= false,
33 changedWhileOpen
= false;
35 $('#toolbarModifierForm')
36 .on('submit', function(e
) {
37 $('.toolbar button:last', '#toolbarModifierWrapper')[0].click();
38 $('.configContainer textarea', '#toolbarModifierWrapper').attr('name', 'config');
40 .on('change', '.config-param', function(e
) {
41 changedWhileOpen
= true;
43 $('#toolbarModifierForm').submit().block();
46 // Debounce the change event so it only fires after the multiselect is closed
47 .on('select2-open', 'input.config-param', function(e
) {
49 changedWhileOpen
= false;
51 .on('select2-close', 'input.config-param', function(e
) {
53 if (changedWhileOpen
) {