Commit d4603b8c by Simon

Update ckeditor-plugins.js

parent e4bd0139
...@@ -4,30 +4,33 @@ if (typeof CKEDITOR !== 'undefined') { ...@@ -4,30 +4,33 @@ if (typeof CKEDITOR !== 'undefined') {
jQuery(document).ready(function ($) { jQuery(document).ready(function ($) {
var CKEDITORPluginExtras = false; var CKEDITORPluginExtras = false;
if (typeof(CKEDITOR) != 'undefined') { if (typeof(CKEDITOR) != 'undefined') {
console.log(ckeditorPlugins);
for (const plugin of ckeditorPlugins) { if(typeof ckeditorPluginsPath !== 'undefined' && typeof ckeditorPlugins !== 'undefined') {
CKEDITOR.plugins.addExternal(plugin, `${ckeditorPluginsPath}/${plugin}/`, 'plugin.js'); for (const plugin of ckeditorPlugins) {
} CKEDITOR.plugins.addExternal(plugin, `${ckeditorPluginsPath}/${plugin}/`, 'plugin.js');
CKEDITOR.on('instanceReady', function (event, instance) {
if (CKEDITORPluginExtras) {
return;
} }
var config = event.editor.config, CKEDITOR.on('instanceReady', function (event, instance) {
name; if (CKEDITORPluginExtras) {
return;
}
var config = event.editor.config,
name;
config.extraPlugins += (config.extraPlugins ? ',' : '') + ckeditorPlugins.join(','); config.extraPlugins += (config.extraPlugins ? ',' : '') + ckeditorPlugins.join(',');
for (name in CKEDITOR.instances) { for (name in CKEDITOR.instances) {
if (CKEDITOR.instances.hasOwnProperty(name)) { if (CKEDITOR.instances.hasOwnProperty(name)) {
CKEDITOR.instances[name].destroy(); CKEDITOR.instances[name].destroy();
CKEDITOR.replace(name, config); CKEDITOR.replace(name, config);
}
} }
}
CKEDITORPluginExtras = true; CKEDITORPluginExtras = true;
}); });
} else {
console.error('Ckeditor-embed-plugin: Path or plugins not defined')
}
} }
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment