mirror of
https://github.com/usememos/memos.git
synced 2025-11-09 17:01:36 +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>) => {
|
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",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue