mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-07 22:10:21 +08:00
fix(SelectionToolbar): prevent CSS updates in demo mode
This commit is contained in:
parent
ff56016d72
commit
b44b397cdd
@ -147,10 +147,12 @@ const SelectionToolbar: FC<{ demo?: boolean }> = ({ demo = false }) => {
|
|||||||
}, [demo, isCompact, actionItems])
|
}, [demo, isCompact, actionItems])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
i18n.changeLanguage(language || navigator.language || defaultLanguage)
|
!demo && i18n.changeLanguage(language || navigator.language || defaultLanguage)
|
||||||
}, [language])
|
}, [language, demo])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (demo) return
|
||||||
|
|
||||||
let customCssElement = document.getElementById('user-defined-custom-css') as HTMLStyleElement
|
let customCssElement = document.getElementById('user-defined-custom-css') as HTMLStyleElement
|
||||||
if (customCssElement) {
|
if (customCssElement) {
|
||||||
customCssElement.remove()
|
customCssElement.remove()
|
||||||
@ -164,7 +166,7 @@ const SelectionToolbar: FC<{ demo?: boolean }> = ({ demo = false }) => {
|
|||||||
customCssElement.textContent = newCustomCss
|
customCssElement.textContent = newCustomCss
|
||||||
document.head.appendChild(customCssElement)
|
document.head.appendChild(customCssElement)
|
||||||
}
|
}
|
||||||
}, [customCss])
|
}, [customCss, demo])
|
||||||
|
|
||||||
const onHideCleanUp = () => {
|
const onHideCleanUp = () => {
|
||||||
setCopyIconStatus('normal')
|
setCopyIconStatus('normal')
|
||||||
@ -265,6 +267,7 @@ const LogoWrapper = styled.div`
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
-webkit-app-region: drag;
|
-webkit-app-region: drag;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
|
background-color: transparent;
|
||||||
`
|
`
|
||||||
|
|
||||||
const Logo = styled(Avatar)`
|
const Logo = styled(Avatar)`
|
||||||
@ -295,6 +298,7 @@ const ActionWrapper = styled.div`
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin-left: 3px;
|
margin-left: 3px;
|
||||||
|
background-color: transparent;
|
||||||
`
|
`
|
||||||
const ActionButton = styled.div`
|
const ActionButton = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -302,6 +306,7 @@ const ActionButton = styled.div`
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin: 0 2px;
|
margin: 0 2px;
|
||||||
|
background-color: transparent;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
padding: 4px 6px;
|
padding: 4px 6px;
|
||||||
@ -309,6 +314,7 @@ const ActionButton = styled.div`
|
|||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
color: var(--color-selection-toolbar-text);
|
color: var(--color-selection-toolbar-text);
|
||||||
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
.btn-title {
|
.btn-title {
|
||||||
color: var(--color-selection-toolbar-text);
|
color: var(--color-selection-toolbar-text);
|
||||||
@ -329,10 +335,10 @@ const ActionIcon = styled.div`
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
/* margin-right: 3px; */
|
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
width: 16px;
|
width: 16px;
|
||||||
|
background-color: transparent;
|
||||||
|
|
||||||
.btn-icon {
|
.btn-icon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -416,6 +422,7 @@ const ActionTitle = styled.span`
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
margin-left: 3px;
|
margin-left: 3px;
|
||||||
|
background-color: transparent;
|
||||||
`
|
`
|
||||||
|
|
||||||
export default SelectionToolbar
|
export default SelectionToolbar
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user