feat: case-insensitive search (#347)

pull/350/head
boojack 3 years ago committed by GitHub
parent cb2e1ae355
commit bdf6d4d42a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -396,7 +396,7 @@ const MemoEditor: React.FC = () => {
/> />
</div> </div>
<div className="btns-container"> <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")} {t("editor.save")}
<img className="icon-img" src="/logo.webp" /> <img className="icon-img" src="/logo.webp" />
</button> </button>

@ -32,7 +32,6 @@ const MemoList = () => {
shouldShow = checkShouldShowMemoWithFilters(memo, filters); shouldShow = checkShouldShowMemoWithFilters(memo, filters);
} }
} }
if (tagQuery) { if (tagQuery) {
const tagsSet = new Set<string>(); const tagsSet = new Set<string>();
for (const t of Array.from(memo.content.match(new RegExp(TAG_REG, "g")) ?? [])) { for (const t of Array.from(memo.content.match(new RegExp(TAG_REG, "g")) ?? [])) {
@ -63,7 +62,7 @@ const MemoList = () => {
shouldShow = false; shouldShow = false;
} }
} }
if (textQuery && !memo.content.includes(textQuery)) { if (textQuery && !memo.content.toLowerCase().includes(textQuery.toLowerCase())) {
shouldShow = false; shouldShow = false;
} }

@ -142,7 +142,7 @@ export const checkShouldShowMemo = (memo: Memo, filter: Filter) => {
} }
shouldShow = matched; shouldShow = matched;
} else if (type === "TEXT") { } else if (type === "TEXT") {
let contained = memo.content.includes(value); let contained = memo.content.toLowerCase().includes(value.toLowerCase());
if (operator === "NOT_CONTAIN") { if (operator === "NOT_CONTAIN") {
contained = !contained; contained = !contained;
} }

Loading…
Cancel
Save