mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-20 19:16:00 +00:00
Merge pull request #4085 from overleaf/ae-symbol-palette-words
Improve symbol matching for multi-word input GitOrigin-RevId: a12ff1e1ccc38acab8be47fd2f5bcdca2c6c6859
This commit is contained in:
parent
ef2f26eb9f
commit
468817b1a7
1 changed files with 10 additions and 4 deletions
|
@ -32,10 +32,16 @@ export default function SymbolPaletteContent({ handleSelect }) {
|
|||
return null
|
||||
}
|
||||
|
||||
return matchSorter(symbols, input, {
|
||||
keys: ['command', 'description'],
|
||||
threshold: matchSorter.rankings.CONTAINS,
|
||||
})
|
||||
const words = input.trim().split(/\W+/)
|
||||
|
||||
return words.reduceRight(
|
||||
(symbols, word) =>
|
||||
matchSorter(symbols, word, {
|
||||
keys: ['command', 'description'],
|
||||
threshold: matchSorter.rankings.CONTAINS,
|
||||
}),
|
||||
symbols
|
||||
)
|
||||
}, [input])
|
||||
|
||||
const inputRef = useRef(null)
|
||||
|
|
Loading…
Add table
Reference in a new issue