From a19c834f4c6d54426458b70b250b303e5e53a429 Mon Sep 17 00:00:00 2001 From: German Bisurgi Date: Fri, 8 May 2020 10:09:30 +0200 Subject: [PATCH] make sure divarea is always present in case another version of the ckeditor is intalled --- src/JsonEditorPluginsAsset.php | 3 ++- src/assets/editors/ckplugins/divarea.js | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 src/assets/editors/ckplugins/divarea.js diff --git a/src/JsonEditorPluginsAsset.php b/src/JsonEditorPluginsAsset.php index bd7a132..17a651b 100755 --- a/src/JsonEditorPluginsAsset.php +++ b/src/JsonEditorPluginsAsset.php @@ -21,6 +21,7 @@ class JsonEditorPluginsAsset extends AssetBundle public $js = [ 'editors/filefly.js', 'editors/ckeditor.js', + 'editors/ckplugins/divarea.js', ]; public $depends = [ @@ -29,4 +30,4 @@ class JsonEditorPluginsAsset extends AssetBundle JqueryAsset::class ]; -} \ No newline at end of file +} diff --git a/src/assets/editors/ckplugins/divarea.js b/src/assets/editors/ckplugins/divarea.js new file mode 100644 index 0000000..5bbe1dc --- /dev/null +++ b/src/assets/editors/ckplugins/divarea.js @@ -0,0 +1,17 @@ +CKEDITOR.plugins.add("divarea", { + afterInit: function(a) { + a.addMode("wysiwyg", function(c) { + var b = CKEDITOR.dom.element.createFromHtml('\x3cdiv class\x3d"cke_wysiwyg_div cke_reset cke_enable_context_menu" hidefocus\x3d"true"\x3e\x3c/div\x3e'); + a.ui.space("contents").append(b); + b = a.editable(b); + b.detach = CKEDITOR.tools.override(b.detach, function(a) { + return function() { + a.apply(this, arguments); + this.remove() + } + }); + a.setData(a.getData(1), c); + a.fire("contentDom") + }) + } +});