From 8f38a18512c46154b1c3c04f8a671df60e4a6f07 Mon Sep 17 00:00:00 2001 From: "haitao(lj)" Date: Tue, 20 Dec 2022 17:33:47 +0800 Subject: [PATCH] fix(Customize/CSS-HTML): When copy the script text, also copy the script attributes --- ui/src/components/Customize/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/src/components/Customize/index.tsx b/ui/src/components/Customize/index.tsx index 78665be8..0570d19f 100644 --- a/ui/src/components/Customize/index.tsx +++ b/ui/src/components/Customize/index.tsx @@ -34,7 +34,11 @@ const ActivateScriptNodes = (el, part) => { } scriptList.forEach((so) => { const script = document.createElement('script'); - script.textContent = so.textContent; + script.text = so.text; + for (let i = 0; i < so.attributes.length; i += 1) { + const attr = so.attributes[i]; + script.setAttribute(attr.name, attr.value); + } el.replaceChild(script, so); }); };