Unverified Commit df8d1d4f authored by KidLoveToPlay's avatar KidLoveToPlay Committed by GitHub

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

parent f2a01d9c
...@@ -17,8 +17,9 @@ const SearchBar = observer(() => { ...@@ -17,8 +17,9 @@ const SearchBar = observer(() => {
const onKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => { const onKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
if (e.key === "Enter") { if (e.key === "Enter") {
e.preventDefault(); e.preventDefault();
if (queryText !== "") { const trimmedText = queryText.trim();
const words = queryText.split(" "); if (trimmedText !== "") {
const words = trimmedText.split(/\s+/);
words.forEach((word) => { words.forEach((word) => {
memoFilterStore.addFilter({ memoFilterStore.addFilter({
factor: "contentSearch", factor: "contentSearch",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment