From 1edf2a23ba5d5a5e3cecb14bf5eec793ba6932ce Mon Sep 17 00:00:00 2001 From: naskya Date: Tue, 1 Aug 2023 21:40:23 +0900 Subject: [PATCH] fix: remove unnecessary mfm types --- packages/client/src/components/MkNote.vue | 4 +--- packages/client/src/components/MkNoteSub.vue | 4 +--- packages/client/src/scripts/get-note-menu.ts | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/client/src/components/MkNote.vue b/packages/client/src/components/MkNote.vue index c7461ed7..74a5fc3c 100644 --- a/packages/client/src/components/MkNote.vue +++ b/packages/client/src/components/MkNote.vue @@ -362,9 +362,7 @@ const expandOnNoteClick = defaultStore.state.expandOnNoteClick; const purifyMFM = (src) => { const nodes = mfm.parse(src); const filtered = mfm.extract(nodes, (node) => { - return ["text", "bold", "center", "small", "italic", "strike"].includes( - node.type, - ); + node.type === "text" || node.type === "quote"; }); return mfm.toString(filtered); }; diff --git a/packages/client/src/components/MkNoteSub.vue b/packages/client/src/components/MkNoteSub.vue index 502d23b2..42cba190 100644 --- a/packages/client/src/components/MkNoteSub.vue +++ b/packages/client/src/components/MkNoteSub.vue @@ -278,9 +278,7 @@ const expandOnNoteClick = defaultStore.state.expandOnNoteClick; const purifyMFM = (src) => { const nodes = mfm.parse(src); const filtered = mfm.extract(nodes, (node) => { - return ["text", "bold", "center", "small", "italic", "strike"].includes( - node.type, - ); + node.type === "text" || node.type === "quote"; }); return mfm.toString(filtered); }; diff --git a/packages/client/src/scripts/get-note-menu.ts b/packages/client/src/scripts/get-note-menu.ts index 04ae9739..ef9adb28 100644 --- a/packages/client/src/scripts/get-note-menu.ts +++ b/packages/client/src/scripts/get-note-menu.ts @@ -242,7 +242,7 @@ export function getNoteMenu(props: { const res = await os.api("notes/translate", { noteId: appearNote.id, targetLang: - localStorege.getItem("translateLang") || + localStorage.getItem("translateLang") || localStorage.getItem("lang") || navigator.language, });