mirror of
https://github.com/usememos/memos.git
synced 2025-11-07 07:56:34 +08:00
fix: trim queryText and split by regex (#4766)
This commit is contained in:
parent
f2a01d9ccb
commit
df8d1d4f3d
1 changed files with 3 additions and 2 deletions
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue