From: Alexander Ebert Date: Mon, 5 Sep 2016 15:28:32 +0000 (+0200) Subject: Fixed embedded attachments in quotes not appearing X-Git-Tag: 3.0.0_Beta_1~292 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d37dff08be89fc3e2f0a90b5befa0b20c506b968;p=GitHub%2FWoltLab%2FWCF.git Fixed embedded attachments in quotes not appearing --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Metacode.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Metacode.js index c36a3dbf27..48eebcf410 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Metacode.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Metacode.js @@ -19,8 +19,12 @@ define(['EventHandler', 'Dom/Util'], function(EventHandler, DomUtil) { * @param {Element} element textarea element */ convert: function(element) { + element.textContent = this.convertFromHtml(element.textContent); + }, + + convertFromHtml: function (html) { var div = elCreate('div'); - div.innerHTML = element.textContent; + div.innerHTML = html; var attributes, data, metacode, metacodes = elByTag('woltlab-metacode', div), name, tagClose, tagOpen; while (metacodes.length) { @@ -53,7 +57,7 @@ define(['EventHandler', 'Dom/Util'], function(EventHandler, DomUtil) { DomUtil.unwrapChildNodes(metacode); } - element.textContent = div.innerHTML; + return div.innerHTML; }, /** diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Quote.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Quote.js index 5010ef8ac5..7630cc74b8 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Quote.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Quote.js @@ -6,7 +6,7 @@ * @license GNU Lesser General Public License * @module WoltLabSuite/Core/Ui/Redactor/Quote */ -define(['Core', 'EventHandler', 'EventKey', 'Language', 'StringUtil', 'Dom/Util', 'Ui/Dialog', './PseudoHeader'], function (Core, EventHandler, EventKey, Language, StringUtil, DomUtil, UiDialog, UiRedactorPseudoHeader) { +define(['Core', 'EventHandler', 'EventKey', 'Language', 'StringUtil', 'Dom/Util', 'Ui/Dialog', './Metacode', './PseudoHeader'], function (Core, EventHandler, EventKey, Language, StringUtil, DomUtil, UiDialog, UiRedactorMetacode, UiRedactorPseudoHeader) { "use strict"; var _headerHeight = 0; @@ -77,6 +77,9 @@ define(['Core', 'EventHandler', 'EventKey', 'Language', 'StringUtil', 'Dom/Util' content = content.replace(/\n\n/g, '

'); content = content.replace(/\n/g, '
'); } + else { + content = UiRedactorMetacode.convertFromHtml(content); + } // bypass the editor as `insert.html()` doesn't like us quote.innerHTML = content;