|
1 | 1 | import { Select, Option, Button, IconButton, Divider } from "@mui/joy"; |
2 | | -import { isNumber, last, uniq, uniqBy } from "lodash-es"; |
| 2 | +import { isNumber, last, uniqBy } from "lodash-es"; |
3 | 3 | import React, { useCallback, useEffect, useMemo, useRef, useState } from "react"; |
4 | 4 | import { toast } from "react-hot-toast"; |
5 | 5 | import { useTranslation } from "react-i18next"; |
6 | 6 | import useLocalStorage from "react-use/lib/useLocalStorage"; |
7 | 7 | import { TAB_SPACE_WIDTH, UNKNOWN_ID, VISIBILITY_SELECTOR_ITEMS } from "@/helpers/consts"; |
8 | 8 | import useCurrentUser from "@/hooks/useCurrentUser"; |
9 | | -import { getMatchedNodes } from "@/labs/marked"; |
| 9 | +import { getMatchedTagNames } from "@/labs/marked"; |
10 | 10 | import { useGlobalStore, useMemoStore, useResourceStore, useTagStore } from "@/store/module"; |
11 | 11 | import { useUserV1Store } from "@/store/v1"; |
12 | 12 | import { Resource } from "@/types/proto/api/v2/resource_service"; |
@@ -342,8 +342,7 @@ const MemoEditor = (props: Props) => { |
342 | 342 | } |
343 | 343 |
|
344 | 344 | // Upsert tag with the content. |
345 | | - const matchedNodes = getMatchedNodes(content); |
346 | | - const tagNameList = uniq(matchedNodes.filter((node) => node.parserName === "tag").map((node) => node.matchedContent.slice(1))); |
| 345 | + const tagNameList = getMatchedTagNames(content); |
347 | 346 | for (const tagName of tagNameList) { |
348 | 347 | try { |
349 | 348 | await tagStore.upsertTag(tagName); |
|
0 commit comments