From d37dff08be89fc3e2f0a90b5befa0b20c506b968 Mon Sep 17 00:00:00 2001
From: Alexander Ebert
Date: Mon, 5 Sep 2016 17:28:32 +0200
Subject: [PATCH] Fixed embedded attachments in quotes not appearing
---
.../files/js/WoltLabSuite/Core/Ui/Redactor/Metacode.js | 8 ++++++--
.../files/js/WoltLabSuite/Core/Ui/Redactor/Quote.js | 5 ++++-
2 files changed, 10 insertions(+), 3 deletions(-)
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;
--
2.20.1