fix(SelectionAssistant): customCSS should not override background (#6746)

fix: customCSS should not override background
This commit is contained in:
fullex 2025-06-04 17:11:31 +08:00 committed by GitHub
parent 9c89676030
commit 958f8387d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -157,9 +157,11 @@ const SelectionToolbar: FC<{ demo?: boolean }> = ({ demo = false }) => {
} }
if (customCss) { if (customCss) {
const newCustomCss = customCss.replace(/background(-image|-color)?\s*:[^;]+;/gi, '')
customCssElement = document.createElement('style') customCssElement = document.createElement('style')
customCssElement.id = 'user-defined-custom-css' customCssElement.id = 'user-defined-custom-css'
customCssElement.textContent = customCss customCssElement.textContent = newCustomCss
document.head.appendChild(customCssElement) document.head.appendChild(customCssElement)
} }
}, [customCss]) }, [customCss])