From b44b397cdd1aab286acee44e373f45db48c22e3b Mon Sep 17 00:00:00 2001 From: fullex <0xfullex@gmail.com> Date: Thu, 5 Jun 2025 18:44:06 +0800 Subject: [PATCH] fix(SelectionToolbar): prevent CSS updates in demo mode --- .../selection/toolbar/SelectionToolbar.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/renderer/src/windows/selection/toolbar/SelectionToolbar.tsx b/src/renderer/src/windows/selection/toolbar/SelectionToolbar.tsx index ebe41319c4..770c27ed75 100644 --- a/src/renderer/src/windows/selection/toolbar/SelectionToolbar.tsx +++ b/src/renderer/src/windows/selection/toolbar/SelectionToolbar.tsx @@ -147,10 +147,12 @@ const SelectionToolbar: FC<{ demo?: boolean }> = ({ demo = false }) => { }, [demo, isCompact, actionItems]) useEffect(() => { - i18n.changeLanguage(language || navigator.language || defaultLanguage) - }, [language]) + !demo && i18n.changeLanguage(language || navigator.language || defaultLanguage) + }, [language, demo]) useEffect(() => { + if (demo) return + let customCssElement = document.getElementById('user-defined-custom-css') as HTMLStyleElement if (customCssElement) { customCssElement.remove() @@ -164,7 +166,7 @@ const SelectionToolbar: FC<{ demo?: boolean }> = ({ demo = false }) => { customCssElement.textContent = newCustomCss document.head.appendChild(customCssElement) } - }, [customCss]) + }, [customCss, demo]) const onHideCleanUp = () => { setCopyIconStatus('normal') @@ -265,6 +267,7 @@ const LogoWrapper = styled.div` justify-content: center; -webkit-app-region: drag; margin-left: 5px; + background-color: transparent; ` const Logo = styled(Avatar)` @@ -295,6 +298,7 @@ const ActionWrapper = styled.div` align-items: center; justify-content: center; margin-left: 3px; + background-color: transparent; ` const ActionButton = styled.div` display: flex; @@ -302,6 +306,7 @@ const ActionButton = styled.div` align-items: center; justify-content: center; margin: 0 2px; + background-color: transparent; cursor: pointer; border-radius: 4px; padding: 4px 6px; @@ -309,6 +314,7 @@ const ActionButton = styled.div` width: 16px; height: 16px; color: var(--color-selection-toolbar-text); + background-color: transparent; } .btn-title { color: var(--color-selection-toolbar-text); @@ -329,10 +335,10 @@ const ActionIcon = styled.div` display: flex; align-items: center; justify-content: center; - /* margin-right: 3px; */ position: relative; height: 16px; width: 16px; + background-color: transparent; .btn-icon { position: absolute; @@ -416,6 +422,7 @@ const ActionTitle = styled.span` text-overflow: ellipsis; white-space: nowrap; margin-left: 3px; + background-color: transparent; ` export default SelectionToolbar