* @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) {
DomUtil.unwrapChildNodes(metacode);
}
- element.textContent = div.innerHTML;
+ return div.innerHTML;
},
/**
* @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;
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;