From 1a433193d18d2281aa6a368e5b8d8c1e0157c84c Mon Sep 17 00:00:00 2001 From: Bianca Nenciu Date: Thu, 18 Mar 2021 15:30:15 +0200 Subject: [PATCH] FIX: Do not treat code tag as block level element (#12432) When syncing code elements, the inner text used to be escaped, which rendered the actual HTML code instead. This commit overwrites default parser settings to fix the way code tags are handled. --- .../javascripts/discourse/app/components/d-editor.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/app/components/d-editor.js b/app/assets/javascripts/discourse/app/components/d-editor.js index a05cb731363..83d9e24f9c0 100644 --- a/app/assets/javascripts/discourse/app/components/d-editor.js +++ b/app/assets/javascripts/discourse/app/components/d-editor.js @@ -416,7 +416,12 @@ export default Component.extend({ loadScript("/javascripts/diffhtml.min.js").then(() => { window.diff.innerHTML( this.element.querySelector(".d-editor-preview"), - cookedElement.innerHTML + cookedElement.innerHTML, + { + parser: { + rawElements: ["script", "noscript", "style", "template"], + }, + } ); }); }