Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

fix: inject additional style and scripts

Steven416e07cb1fbc
diff --git a/web/src/App.tsx b/web/src/App.tsx
index c0b04efaa..30950217b 100644
--- a/web/src/App.tsx
+++ b/web/src/App.tsx
@@ -59,7 +59,6 @@ const App = () => {
}
}, []);
- // Inject additional style and script codes.
useEffect(() => {
if (systemStatus.additionalStyle) {
const styleEl = document.createElement("style");
@@ -67,17 +66,22 @@ const App = () => {
styleEl.setAttribute("type", "text/css");
document.body.insertAdjacentElement("beforeend", styleEl);
}
+ }, [systemStatus.additionalStyle]);
+
+ useEffect(() => {
if (systemStatus.additionalScript) {
const scriptEl = document.createElement("script");
scriptEl.innerHTML = systemStatus.additionalScript;
document.head.appendChild(scriptEl);
}
+ }, [systemStatus.additionalScript]);
+ useEffect(() => {
// dynamic update metadata with customized profile.
document.title = systemStatus.customizedProfile.name;
const link = document.querySelector("link[rel~='icon']") as HTMLLinkElement;
link.href = systemStatus.customizedProfile.logoUrl || "/logo.webp";
- }, [systemStatus]);
+ }, [systemStatus.customizedProfile]);
useEffect(() => {
document.documentElement.setAttribute("lang", locale);