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.

feat: case-insensitive search (#347)

boojackbdf6d4d42a21
diff --git a/web/src/components/MemoEditor.tsx b/web/src/components/MemoEditor.tsx
index 25075b381..043b21f64 100644
--- a/web/src/components/MemoEditor.tsx
+++ b/web/src/components/MemoEditor.tsx
@@ -396,7 +396,7 @@ const MemoEditor: React.FC = () => {
/>
</div>
<div className="btns-container">
- <button className="action-btn confirm-btn" disabled={!allowSave} onClick={handleSaveBtnClick}>
+ <button className="action-btn confirm-btn" disabled={!allowSave || state.isUploadingResource} onClick={handleSaveBtnClick}>
{t("editor.save")}
<img className="icon-img" src="/logo.webp" />
</button>
diff --git a/web/src/components/MemoList.tsx b/web/src/components/MemoList.tsx
index 76e70de7c..1a727fcaa 100644
--- a/web/src/components/MemoList.tsx
+++ b/web/src/components/MemoList.tsx
@@ -32,7 +32,6 @@ const MemoList = () => {
shouldShow = checkShouldShowMemoWithFilters(memo, filters);
}
}
-
if (tagQuery) {
const tagsSet = new Set<string>();
for (const t of Array.from(memo.content.match(new RegExp(TAG_REG, "g")) ?? [])) {
@@ -63,7 +62,7 @@ const MemoList = () => {
shouldShow = false;
}
}
- if (textQuery && !memo.content.includes(textQuery)) {
+ if (textQuery && !memo.content.toLowerCase().includes(textQuery.toLowerCase())) {
shouldShow = false;
}
diff --git a/web/src/helpers/filter.ts b/web/src/helpers/filter.ts
index 667049cdb..c0100269b 100644
--- a/web/src/helpers/filter.ts
+++ b/web/src/helpers/filter.ts
@@ -142,7 +142,7 @@ export const checkShouldShowMemo = (memo: Memo, filter: Filter) => {
}
shouldShow = matched;
} else if (type === "TEXT") {
- let contained = memo.content.includes(value);
+ let contained = memo.content.toLowerCase().includes(value.toLowerCase());
if (operator === "NOT_CONTAIN") {
contained = !contained;
}