Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix(Customize/CSS-HTML): When copy the script text, also copy the script attributes

haitao(lj)8f38a18512c4
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);
});
};