mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-03 19:30:04 +08:00
fix: escape special characters in search pattern for improved filtering
This commit is contained in:
parent
2b6d02f470
commit
a47c8d4b7d
@ -86,7 +86,12 @@ export const QuickPanelView: React.FC<Props> = ({ setInputText }) => {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
const pattern = lowerSearchText.split('').join('.*')
|
const pattern = lowerSearchText
|
||||||
|
.split('')
|
||||||
|
.map((char) => {
|
||||||
|
return char.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
||||||
|
})
|
||||||
|
.join('.*')
|
||||||
if (tinyPinyin.isSupported() && /[\u4e00-\u9fa5]/.test(filterText)) {
|
if (tinyPinyin.isSupported() && /[\u4e00-\u9fa5]/.test(filterText)) {
|
||||||
try {
|
try {
|
||||||
const pinyinText = tinyPinyin.convertToPinyin(filterText, '', true).toLowerCase()
|
const pinyinText = tinyPinyin.convertToPinyin(filterText, '', true).toLowerCase()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user