Skip to content

A platform for community discussion. Free, open, simple.

FIX: HTML content in JSON-schema-based theme settings (#38732)

David Taylorc8c0d40e2649
diff --git a/frontend/discourse/package.json b/frontend/discourse/package.json
index f82dac8f9ab..6a06c687a95 100644
--- a/frontend/discourse/package.json
+++ b/frontend/discourse/package.json
@@ -36,7 +36,7 @@
"@glint/ember-tsc": "^1.0.8",
"@glint/template": "^1.7.3",
"@highlightjs/cdn-assets": "11.11.1",
- "@json-editor/json-editor": "2.16.0",
+ "@json-editor/json-editor": "2.15.2",
"@jsquash/jpeg": "^1.6.0",
"@jsquash/resize": "^2.1.0",
"ace-builds": "^1.43.5",
diff --git a/frontend/discourse/tests/unit/components/json-schema-editor-test.gjs b/frontend/discourse/tests/unit/components/json-schema-editor-test.gjs
index 36080db9aad..33f23449657 100644
--- a/frontend/discourse/tests/unit/components/json-schema-editor-test.gjs
+++ b/frontend/discourse/tests/unit/components/json-schema-editor-test.gjs
@@ -43,4 +43,34 @@ module("Unit | Component | <JsonSchemaEditor />", function (hooks) {
assert.deepEqual(JSON.parse(result), [{ color: "red", icon: "" }]);
});
+
+ test("allows HTML content", async function (assert) {
+ let result;
+ const model = {
+ value: "[]",
+ settingName: "My setting name",
+ jsonSchema: TEST_SCHEMA,
+ updateValue: (val) => (result = val),
+ };
+
+ const closeModal = () => {};
+
+ await render(
+ <template>
+ <JsonSchemaEditor
+ @inline={{true}}
+ @model={{model}}
+ @closeModal={{closeModal}}
+ />
+ </template>
+ );
+
+ await click(".json-editor-btn-add");
+ await fillIn("[name='root[0][color]']", "red <a>link</a>");
+ await click(".d-modal__footer .btn-primary");
+
+ assert.deepEqual(JSON.parse(result), [
+ { color: "red <a>link</a>", icon: "" },
+ ]);
+ });
});
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 5de198eff9d..37c043328d9 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -272,8 +272,8 @@ importers:
specifier: 11.11.1
version: 11.11.1
'@json-editor/json-editor':
- specifier: 2.16.0
- version: 2.16.0
+ specifier: 2.15.2
+ version: 2.15.2
'@jsquash/jpeg':
specifier: ^1.6.0
version: 1.6.0
@@ -2611,8 +2611,8 @@ packages:
resolution: {integrity: sha512-yYxMVH7Dqw6nO0d5NIV8OQWnitU8k6vXH8NtgqAfIa/IUqRMxRv/NUJJ08VEKbAakwxlgBl5PJdrU0dMPStsnw==}
engines: {node: '>=v12.0.0'}
- '@json-editor/[email protected]':
- resolution: {integrity: sha512-qzCDDImLAkqCpOp3G156ikEHTJKQviVyxie+3QXE1MTxRuT+BZ3yTYsXfUpvgRyaLBcYDJIind59Hj3oz+5TqA==}
+ '@json-editor/[email protected]':
+ resolution: {integrity: sha512-vUQ7Oy+7VfNIzu6irtPz5qfHbMNTlQWUbHJ7eunxFza+SBwUXfq2Uh5QYD2d6hLDhF22sYh8DPpLWFixQrt1+Q==}
engines: {node: '>= 0.8.0'}
'@jsonjoy.com/[email protected]':
@@ -11597,7 +11597,7 @@ snapshots:
dependencies:
lodash: 4.17.23
- '@json-editor/[email protected]':
+ '@json-editor/[email protected]':
dependencies:
core-js: 3.48.0