fix: trim queryText and split by regex (#4766)

This commit is contained in:
KidLoveToPlay 2025-06-09 22:13:39 +08:00 committed by GitHub
parent f2a01d9ccb
commit df8d1d4f3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -17,8 +17,9 @@ const SearchBar = observer(() => {
const onKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
if (e.key === "Enter") {
e.preventDefault();
if (queryText !== "") {
const words = queryText.split(" ");
const trimmedText = queryText.trim();
if (trimmedText !== "") {
const words = trimmedText.split(/\s+/);
words.forEach((word) => {
memoFilterStore.addFilter({
factor: "contentSearch",