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.

chore: fix frontend linter

Steven7e23ceb242d4
diff --git a/web/src/components/MemoContent/TaskList.tsx b/web/src/components/MemoContent/TaskList.tsx
index 2e81e648d..3ba4c95ce 100644
--- a/web/src/components/MemoContent/TaskList.tsx
+++ b/web/src/components/MemoContent/TaskList.tsx
@@ -3,7 +3,7 @@ import classNames from "classnames";
import { repeat } from "lodash-es";
import { useContext, useState } from "react";
import { useMemoStore } from "@/store/v1";
-import { Node, NodeType } from "@/types/node";
+import { Node, NodeType, TaskListNode } from "@/types/node";
import Renderer from "./Renderer";
import { RendererContext } from "./types";
@@ -31,11 +31,11 @@ const TaskList: React.FC<Props> = ({ index, indent, complete, children }: Props)
}
const node = context.nodes[nodeIndex];
- if (node.type !== NodeType.TASK_LIST || !node.taskListNode) {
+ if (node.type !== NodeType.TASK_LIST || !node.node) {
return;
}
- node.taskListNode!.complete = on;
+ (node.node as TaskListNode)!.complete = on;
const content = window.restore(context.nodes);
await memoStore.updateMemo(
{
diff --git a/web/src/utils/tag.ts b/web/src/utils/tag.ts
index 835047a13..07690a9f3 100644
--- a/web/src/utils/tag.ts
+++ b/web/src/utils/tag.ts
@@ -14,8 +14,8 @@ export const extractTagsFromContent = (content: string) => {
}
handle(node);
- if (node.paragraphNode || node.unorderedListNode || node.orderedListNode) {
- const children = ((node.paragraphNode || node.unorderedListNode || node.orderedListNode) as any).children;
+ if (node.type === "PARAGRAPH" || node.type === "ORDERED_LIST" || node.type === "UNORDERED_LIST") {
+ const children = (node.node as any).children;
if (Array.isArray(children)) {
traverse(children, handle);
}
@@ -24,8 +24,8 @@ export const extractTagsFromContent = (content: string) => {
};
traverse(nodes, (node) => {
- if (node.tagNode?.content) {
- tags.add(node.tagNode.content);
+ if (node.type === "TAG" && node.node) {
+ tags.add((node.node as any).content);
}
});