mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-06 21:35:52 +08:00
* fix: #6301 * fix: update dependencies in useUpdateHandler and add eslint comment in ContentSearch
This commit is contained in:
parent
72d939721d
commit
6f75b1738d
@ -399,6 +399,7 @@ export const ContentSearch = React.forwardRef<ContentSearchRef, Props>(
|
|||||||
searchInputFocus()
|
searchInputFocus()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
const implementation = {
|
const implementation = {
|
||||||
disable() {
|
disable() {
|
||||||
setEnableContentSearch(false)
|
setEnableContentSearch(false)
|
||||||
@ -526,8 +527,7 @@ export const ContentSearch = React.forwardRef<ContentSearchRef, Props>(
|
|||||||
if (enableContentSearch && searchInputRef.current?.value.trim()) {
|
if (enableContentSearch && searchInputRef.current?.value.trim()) {
|
||||||
implementation.search()
|
implementation.search()
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
}, [isCaseSensitive, isWholeWord, enableContentSearch, implementation]) // Add enableContentSearch dependency
|
||||||
}, [isCaseSensitive, isWholeWord, enableContentSearch]) // Add enableContentSearch dependency
|
|
||||||
|
|
||||||
const prevButtonOnClick = () => {
|
const prevButtonOnClick = () => {
|
||||||
implementation.searchPrev()
|
implementation.searchPrev()
|
||||||
@ -690,18 +690,18 @@ const SearchResults = styled.div`
|
|||||||
width: 80px;
|
width: 80px;
|
||||||
margin: 0 2px;
|
margin: 0 2px;
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
color: var(--color-text-secondary);
|
color: var(--color-text-1);
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-family: Ubuntu;
|
font-family: Ubuntu;
|
||||||
`
|
`
|
||||||
|
|
||||||
const SearchResultsPlaceholder = styled.span`
|
const SearchResultsPlaceholder = styled.span`
|
||||||
color: var(--color-text-secondary);
|
color: var(--color-text-1);
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
`
|
`
|
||||||
|
|
||||||
const NoResults = styled.span`
|
const NoResults = styled.span`
|
||||||
color: var(--color-text-secondary);
|
color: var(--color-text-1);
|
||||||
`
|
`
|
||||||
|
|
||||||
const SearchResultCount = styled.span`
|
const SearchResultCount = styled.span`
|
||||||
|
|||||||
@ -85,5 +85,5 @@ export default function useUpdateHandler() {
|
|||||||
})
|
})
|
||||||
]
|
]
|
||||||
return () => removers.forEach((remover) => remover())
|
return () => removers.forEach((remover) => remover())
|
||||||
}, [dispatch, t])
|
}, [dispatch, notificationService, t])
|
||||||
}
|
}
|
||||||
|
|||||||
@ -434,7 +434,7 @@ const Inputbar: FC<Props> = ({ assistant: _assistant, setActiveTopic, topic }) =
|
|||||||
const text = textArea.value
|
const text = textArea.value
|
||||||
|
|
||||||
let match = text.slice(cursorPosition + selectionLength).match(/\$\{[^}]+\}/)
|
let match = text.slice(cursorPosition + selectionLength).match(/\$\{[^}]+\}/)
|
||||||
let startIndex = -1
|
let startIndex: number
|
||||||
|
|
||||||
if (!match) {
|
if (!match) {
|
||||||
match = text.match(/\$\{[^}]+\}/)
|
match = text.match(/\$\{[^}]+\}/)
|
||||||
@ -764,7 +764,12 @@ const Inputbar: FC<Props> = ({ assistant: _assistant, setActiveTopic, topic }) =
|
|||||||
if (document.activeElement?.closest('.ant-modal')) {
|
if (document.activeElement?.closest('.ant-modal')) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
textareaRef.current?.focus()
|
|
||||||
|
const lastFocusedComponent = PasteService.getLastFocusedComponent()
|
||||||
|
|
||||||
|
if (!lastFocusedComponent || lastFocusedComponent === 'inputbar') {
|
||||||
|
textareaRef.current?.focus()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
window.addEventListener('focus', onFocus)
|
window.addEventListener('focus', onFocus)
|
||||||
return () => window.removeEventListener('focus', onFocus)
|
return () => window.removeEventListener('focus', onFocus)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user