Skip to content

Commit

Permalink
moved around plugin setup so that plugins are added externally to build
Browse files Browse the repository at this point in the history
  • Loading branch information
greasysock committed Mar 19, 2020
1 parent 6f40ba5 commit ef8e9e9
Show file tree
Hide file tree
Showing 18 changed files with 1,289 additions and 1,163 deletions.
3 changes: 3 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ java -jar ckbuilder/$CKBUILDER_VERSION/ckbuilder.jar --build ckeditor $target $s
cp presets/$1-ckeditor-config.js $target/ckeditor/config.js
cp presets/README.md $target/ckeditor/

echo ""
echo "Copying external plugins..."
cp -r external_plugins/* $target/ckeditor/plugins/

echo "Removing added plugins..."
cd ckeditor
Expand Down
2,310 changes: 1,153 additions & 1,157 deletions build/touchpoint/ckeditor/ckeditor.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions build/touchpoint/ckeditor/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ CKEDITOR.editorConfig = function( config ) {
{ name: 'about' }
];

config.extraPlugins = [ 'ddf'].join(',')

// Remove some buttons provided by the standard plugins, which are
// not needed in the Standard(s) toolbar.
config.removeButtons = 'Underline,Subscript,Superscript';
Expand Down
File renamed without changes
File renamed without changes.
Binary file modified build/touchpoint/ckeditor/plugins/icons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified build/touchpoint/ckeditor/plugins/icons_hidpi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion build/touchpoint/ckeditor/skins/moono-lisa/editor.css

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/touchpoint/ckeditor/skins/moono-lisa/editor_ie.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/touchpoint/ckeditor/skins/moono-lisa/editor_ie8.css

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file modified build/touchpoint/ckeditor/skins/moono-lisa/icons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified build/touchpoint/ckeditor/skins/moono-lisa/icons_hidpi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added external_plugins/ddf/icons/ddf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
124 changes: 124 additions & 0 deletions external_plugins/ddf/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
"use strict";

CKEDITOR.plugins.add('ddf', {
icons: 'ddf',
init: function init(editor) {
if (editor.element.hasClass("ddf")) {
editor.addCommand('ddf', new CKEDITOR.dialogCommand('ddfDialog'));
editor.ui.addButton('DDF', {
label: 'Insert Dymanic Data',
command: 'ddf',
toolbar: 'insert'
});
editor.addMenuGroup('ddfGroup');
editor.addMenuItem('ddfItem', {
label: 'Edit Dymanic Data',
icon: this.path + 'icons/ddf.png',
command: 'ddf',
group: 'ddfGroup'
});

if (editor.contextMenu != null) {
editor.contextMenu.addListener(function (element) {
if (element.getAscendant('x-ddf', true)) {
return {
ddfItem: CKEDITOR.TRISTATE_OFF
};
}
});
}

return editor.on('doubleclick', function (evt) {
var element = evt.data.element;

if (element.is('x-ddf')) {
return evt.data.dialog = 'ddfDialog';
}
});
}
},
onLoad: function onLoad() {
return CKEDITOR.addCss("x-ddf::before { content: \"<\"; }\nx-ddf::after { content: \">\"; }");
}
});
CKEDITOR.on('dialogDefinition', function (evt) {
if (evt.data.name === 'image' && evt.editor.element.hasClass("ddf")) {
var imageTab = evt.data.definition.getContents('info');
return imageTab.elements.splice(1, 0, {
type: 'select',
id: 'field',
label: 'DDF',
width: 'auto; display: block',
items: window.ddFields && [[], ['Attendee Photo', 'viewer.photo_url']],
setup: function setup(type, element) {
return this.setValue(element.getAttribute("data-field"));
},
commit: function commit(type, element) {
var value = this.getValue();

if (value !== '') {
return element.setAttribute('data-field', value);
} else {
return element.removeAttribute('data-field');
}
},
onChange: function onChange() {
var iconPath = this.getDialog().getParentEditor().plugins.ddf.path + 'icons/ddf.png';
return this.getDialog().getContentElement('info', 'txtUrl').setValue(this.getValue() !== '' ? iconPath : '');
}
});
}
});
CKEDITOR.dialog.add('ddfDialog', function (editor) {
return {
title: 'Dymanic Data Field',
minWidth: 200,
minHeight: 80,
contents: [{
id: 'tab-basic',
label: 'Basic Settings',
elements: [{
type: 'select',
id: 'field',
width: 'auto; display: block',
items: window.ddFields || [],
validate: CKEDITOR.dialog.validate.notEmpty("Data field must be selected."),
setup: function setup(element) {
return this.setValue(element.getAttribute("data-field"));
},
commit: function commit(element) {
var select = this.getInputElement().$;
var label = select.options[select.selectedIndex].text;
element.setText(label);
return element.setAttribute("data-field", this.getValue());
}
}]
}],
onOk: function onOk() {
this.commitContent(this.element);

if (this.insertMode) {
return editor.insertElement(this.element);
}
},
onShow: function onShow() {
var selection = editor.getSelection();
this.element = selection.getStartElement();

if (this.element) {
this.element = this.element.getAscendant('x-ddf', true);
}

if (!this.element || this.element.getName() !== 'x-ddf') {
this.element = editor.document.createElement('x-ddf');
this.insertMode = true;
} else {
this.insertMode = false;
}

if (!this.insertMode) {
return this.setupContent(this.element);
}
}
};
});
1 change: 0 additions & 1 deletion presets/touchpoint-build-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ var CKBUILDER_CONFIG = {
uploadimage: 1,
wsc: 1,
wysiwygarea: 1,
ddf: 1,
scayt: 1
}
};
2 changes: 2 additions & 0 deletions presets/touchpoint-ckeditor-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ CKEDITOR.editorConfig = function( config ) {
{ name: 'about' }
];

config.extraPlugins = [ 'ddf'].join(',')

// Remove some buttons provided by the standard plugins, which are
// not needed in the Standard(s) toolbar.
config.removeButtons = 'Underline,Subscript,Superscript';
Expand Down

0 comments on commit ef8e9e9

Please sign in to comment.