From 8dbbbdefa47b6be63b8bcf99272f6af63ac1b01d Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 1 Aug 2016 11:37:43 +0200 Subject: [PATCH] Fixed image handling --- com.woltlab.wcf/templates/wysiwyg.tpl | 6 ++++-- .../install/files/acp/templates/wysiwyg.tpl | 6 ++++-- .../3rdParty/redactor2/plugins/WoltLabUtils.js | 17 +++++++++++++++++ 3 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabUtils.js diff --git a/com.woltlab.wcf/templates/wysiwyg.tpl b/com.woltlab.wcf/templates/wysiwyg.tpl index e7bb151a13..5a3e8a03ef 100644 --- a/com.woltlab.wcf/templates/wysiwyg.tpl +++ b/com.woltlab.wcf/templates/wysiwyg.tpl @@ -37,7 +37,8 @@ '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabQuote.js?v={@LAST_UPDATE_TIME}', '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabSize.js?v={@LAST_UPDATE_TIME}', '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabSmiley.js?v={@LAST_UPDATE_TIME}', - '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabSpoiler.js?v={@LAST_UPDATE_TIME}' + '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabSpoiler.js?v={@LAST_UPDATE_TIME}', + '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabUtils.js?v={@LAST_UPDATE_TIME}' {else} '{@$__wcf->getPath()}js/3rdParty/redactor2/redactor.min.js?v={@LAST_UPDATE_TIME}', '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/combined.min.js?v={@LAST_UPDATE_TIME}' @@ -173,7 +174,8 @@ 'WoltLabQuote', 'WoltLabSize', 'WoltLabSmiley', - 'WoltLabSpoiler' + 'WoltLabSpoiler', + 'WoltLabUtils' ], toolbarFixed: false, woltlab: { diff --git a/wcfsetup/install/files/acp/templates/wysiwyg.tpl b/wcfsetup/install/files/acp/templates/wysiwyg.tpl index e7bb151a13..5a3e8a03ef 100644 --- a/wcfsetup/install/files/acp/templates/wysiwyg.tpl +++ b/wcfsetup/install/files/acp/templates/wysiwyg.tpl @@ -37,7 +37,8 @@ '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabQuote.js?v={@LAST_UPDATE_TIME}', '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabSize.js?v={@LAST_UPDATE_TIME}', '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabSmiley.js?v={@LAST_UPDATE_TIME}', - '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabSpoiler.js?v={@LAST_UPDATE_TIME}' + '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabSpoiler.js?v={@LAST_UPDATE_TIME}', + '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabUtils.js?v={@LAST_UPDATE_TIME}' {else} '{@$__wcf->getPath()}js/3rdParty/redactor2/redactor.min.js?v={@LAST_UPDATE_TIME}', '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/combined.min.js?v={@LAST_UPDATE_TIME}' @@ -173,7 +174,8 @@ 'WoltLabQuote', 'WoltLabSize', 'WoltLabSmiley', - 'WoltLabSpoiler' + 'WoltLabSpoiler', + 'WoltLabUtils' ], toolbarFixed: false, woltlab: { diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabUtils.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabUtils.js new file mode 100644 index 0000000000..539cf4b8c0 --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabUtils.js @@ -0,0 +1,17 @@ +$.Redactor.prototype.WoltLabUtils = function() { + "use strict"; + + return { + init: function() { + var mpReplaceToTag = this.utils.replaceToTag; + this.utils.replaceToTag = (function (node, tag) { + if (tag === 'figure') { + // prevent

wrapping an being replaced + return node; + } + + return mpReplaceToTag.call(this, node, tag); + }).bind(this); + } + }; +}; -- 2.20.1