fix(SelectionToolbar): prevent CSS updates in demo mode

This commit is contained in:
fullex 2025-06-05 18:44:06 +08:00 committed by 亢奋猫
parent ff56016d72
commit b44b397cdd

View File

@ -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