'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabEvent.js?v={@LAST_UPDATE_TIME}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabImage.js?v={@LAST_UPDATE_TIME}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabInlineCode.js?v={@LAST_UPDATE_TIME}',
+ '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabInsert.js?v={@LAST_UPDATE_TIME}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabKeydown.js?v={@LAST_UPDATE_TIME}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabLink.js?v={@LAST_UPDATE_TIME}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabMedia.js?v={@LAST_UPDATE_TIME}',
'WoltLabEvent',
'WoltLabImage',
'WoltLabInlineCode',
+ 'WoltLabInsert',
'WoltLabLink',
'WoltLabModal',
'WoltLabPaste',
--- /dev/null
+$.Redactor.prototype.WoltLabInsert = function() {
+ "use strict";
+
+ return {
+ init: function () {
+ var mpHtml = this.insert.html;
+ this.insert.html = (function (html, data) {
+ this.placeholder.hide();
+ this.core.editor().focus();
+
+ /** @var Element */
+ var block = this.selection.block();
+
+ mpHtml.call(this, html, data);
+
+ if (block && block.nodeName === 'P' && block.nextElementSibling && !block.childElementCount && block.textContent.replace(/\u200B/g, '').trim() === '') {
+ // inserting HTML tends to cause new paragraphs inserted
+ // rather than using the current, empty one
+ elRemove(block);
+ }
+ }).bind(this);
+ }
+ };
+};