diff --git a/app/assets/javascripts/discourse/app/controllers/history.js b/app/assets/javascripts/discourse/app/controllers/history.js index b368a283fb7..4ed3da9b801 100644 --- a/app/assets/javascripts/discourse/app/controllers/history.js +++ b/app/assets/javascripts/discourse/app/controllers/history.js @@ -261,9 +261,10 @@ export default Controller.extend(ModalFunctionality, { this.set("bodyDiff", html); } else { const opts = { - features: { editHistory: true }, + features: { editHistory: true, historyOneboxes: true }, whiteListed: { - editHistory: { custom: (tag, attr) => attr === "class" } + editHistory: { custom: (tag, attr) => attr === "class" }, + historyOneboxes: ["header", "article", "div[style]"] } }; diff --git a/test/javascripts/controllers/history-test.js b/test/javascripts/controllers/history-test.js index 6d8ccae7cfc..0d8788239dc 100644 --- a/test/javascripts/controllers/history-test.js +++ b/test/javascripts/controllers/history-test.js @@ -40,6 +40,17 @@ QUnit.test("displayEdit", async function(assert) { const html = `

" width="276" height="183">

+ @@ -58,6 +69,17 @@ QUnit.test("displayEdit", async function(assert) { const expectedOutput = `

" width="276" height="183">

+
@@ -85,5 +107,9 @@ QUnit.test("displayEdit", async function(assert) { await HistoryController.bodyDiffChanged(); const output = HistoryController.get("bodyDiff"); - assert.equal(output, expectedOutput, "it keeps safe HTML"); + assert.equal( + output, + expectedOutput, + "it keeps HTML safe and doesn't strip onebox tags" + ); });