From 99709d9c40c65418b688dc8cc0c94a2b1180d16c Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 9 Jun 2021 16:59:57 +0200 Subject: [PATCH] Unescape BBCode attributes on editor load --- ts/WoltLabSuite/Core/Ui/Redactor/Metacode.ts | 6 +++++- .../files/js/WoltLabSuite/Core/Ui/Redactor/Metacode.js | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ts/WoltLabSuite/Core/Ui/Redactor/Metacode.ts b/ts/WoltLabSuite/Core/Ui/Redactor/Metacode.ts index f4f5aafbe0..71c8047d25 100644 --- a/ts/WoltLabSuite/Core/Ui/Redactor/Metacode.ts +++ b/ts/WoltLabSuite/Core/Ui/Redactor/Metacode.ts @@ -10,6 +10,7 @@ import * as EventHandler from "../../Event/Handler"; import DomUtil from "../../Dom/Util"; +import * as StringUtil from "../../StringUtil"; type Attributes = string[]; @@ -20,7 +21,10 @@ function getOpeningTag(name: string, attributes: Attributes): Text { let buffer = "[" + name; if (attributes.length) { buffer += "="; - buffer += attributes.map((attribute) => `'${attribute}'`).join(","); + buffer += attributes + .map((attribute) => StringUtil.unescapeHTML(attribute)) + .map((attribute) => `'${attribute}'`) + .join(","); } return document.createTextNode(buffer + "]"); 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 1f804278a2..05292f29e4 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Metacode.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Metacode.js @@ -7,12 +7,13 @@ * @module WoltLabSuite/Core/Ui/Redactor/Metacode * @woltlabExcludeBundle tiny */ -define(["require", "exports", "tslib", "../../Event/Handler", "../../Dom/Util"], function (require, exports, tslib_1, EventHandler, Util_1) { +define(["require", "exports", "tslib", "../../Event/Handler", "../../Dom/Util", "../../StringUtil"], function (require, exports, tslib_1, EventHandler, Util_1, StringUtil) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.convertFromHtml = void 0; EventHandler = tslib_1.__importStar(EventHandler); Util_1 = tslib_1.__importDefault(Util_1); + StringUtil = tslib_1.__importStar(StringUtil); /** * Returns a text node representing the opening bbcode tag. */ @@ -20,7 +21,10 @@ define(["require", "exports", "tslib", "../../Event/Handler", "../../Dom/Util"], let buffer = "[" + name; if (attributes.length) { buffer += "="; - buffer += attributes.map((attribute) => `'${attribute}'`).join(","); + buffer += attributes + .map((attribute) => StringUtil.unescapeHTML(attribute)) + .map((attribute) => `'${attribute}'`) + .join(","); } return document.createTextNode(buffer + "]"); } -- 2.20.1