Fixed embedded attachments in quotes not appearing
authorAlexander Ebert <ebert@woltlab.com>
Mon, 5 Sep 2016 15:28:32 +0000 (17:28 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 5 Sep 2016 15:54:51 +0000 (17:54 +0200)
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Metacode.js
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Quote.js

index c36a3dbf277966e9f66f3ec307b3766e016e2a9c..48eebcf410293df85818193a24d4bcaa04c4fcd0 100644 (file)
@@ -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;
                },
                
                /**
index 5010ef8ac5c6cb2fecf80d265e27423038a6b98d..7630cc74b8499a29a487a54d5c099d2d46618bcc 100644 (file)
@@ -6,7 +6,7 @@
  * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @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, '</p><p>');
                                content = content.replace(/\n/g, '<br>');
                        }
+                       else {
+                               content = UiRedactorMetacode.convertFromHtml(content);
+                       }
                        
                        // bypass the editor as `insert.html()` doesn't like us
                        quote.innerHTML = content;