Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

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

KidLoveToPlaydf8d1d4f3d64
diff --git a/web/src/components/SearchBar.tsx b/web/src/components/SearchBar.tsx
index 8e7cf04a7..9f0209d44 100644
--- a/web/src/components/SearchBar.tsx
+++ b/web/src/components/SearchBar.tsx
@@ -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",