From 242ea279ee258404c1642b560ddfc4bcc794be76 Mon Sep 17 00:00:00 2001 From: fullex <106392080+0xfullex@users.noreply.github.com> Date: Wed, 4 Jun 2025 17:11:31 +0800 Subject: [PATCH] fix(SelectionAssistant): customCSS should not override background (#6746) fix: customCSS should not override background --- .../src/windows/selection/toolbar/SelectionToolbar.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/renderer/src/windows/selection/toolbar/SelectionToolbar.tsx b/src/renderer/src/windows/selection/toolbar/SelectionToolbar.tsx index 0b087a11ea..ebe41319c4 100644 --- a/src/renderer/src/windows/selection/toolbar/SelectionToolbar.tsx +++ b/src/renderer/src/windows/selection/toolbar/SelectionToolbar.tsx @@ -157,9 +157,11 @@ const SelectionToolbar: FC<{ demo?: boolean }> = ({ demo = false }) => { } if (customCss) { + const newCustomCss = customCss.replace(/background(-image|-color)?\s*:[^;]+;/gi, '') + customCssElement = document.createElement('style') customCssElement.id = 'user-defined-custom-css' - customCssElement.textContent = customCss + customCssElement.textContent = newCustomCss document.head.appendChild(customCssElement) } }, [customCss])