From 2b1eb4fca4cb709b920554d5ac1283915e421a58 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Wed, 24 Jan 2024 19:30:00 +0500 Subject: [PATCH] web: use createInternalLink everywhere --- apps/mobile/app/hooks/use-actions.tsx | 5 +++-- apps/web/src/components/properties/index.tsx | 14 +++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/apps/mobile/app/hooks/use-actions.tsx b/apps/mobile/app/hooks/use-actions.tsx index a33e72ad4..16b5c5f84 100644 --- a/apps/mobile/app/hooks/use-actions.tsx +++ b/apps/mobile/app/hooks/use-actions.tsx @@ -64,6 +64,7 @@ import { deleteItems } from "../utils/functions"; import { convertNoteToText } from "../utils/note-to-text"; import { sleep } from "../utils/time"; import { ReferencesList } from "../components/sheets/references"; +import { createInternalLink } from "@notesnook/core"; export const useActions = ({ close, @@ -762,10 +763,10 @@ export const useActions = ({ title: "Copy link", icon: "link", func: () => { - Clipboard.setString(`nn://note/${item.id}`); + Clipboard.setString(createInternalLink("note", item.id)); ToastManager.show({ heading: "Note link copied", - message: `nn://note/${item.id}`, + message: createInternalLink("note", item.id), context: "local", type: "success" }); diff --git a/apps/web/src/components/properties/index.tsx b/apps/web/src/components/properties/index.tsx index 9562b6c29..d09a9783e 100644 --- a/apps/web/src/components/properties/index.tsx +++ b/apps/web/src/components/properties/index.tsx @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import React, { PropsWithChildren, useRef, useState } from "react"; +import React, { PropsWithChildren, useState } from "react"; import { Pin, StarOutline, @@ -42,7 +42,7 @@ import { store as noteStore } from "../../stores/note-store"; import { AnimatedFlex } from "../animated"; import Toggle from "./toggle"; import ScrollContainer from "../scroll-container"; -import { ellipsize, getFormattedDate } from "@notesnook/common"; +import { getFormattedDate } from "@notesnook/common"; import { ScopedThemeProvider } from "../theme-provider"; import usePromise from "../../hooks/use-promise"; import { ListItemWrapper } from "../list-container/list-profiles"; @@ -53,14 +53,12 @@ import { COLORS } from "../../common/constants"; import { ContentBlock, DefaultColors, - InternalLink, Note, VirtualizedGrouping, - highlightInternalLinks, - parseInternalLink + createInternalLink, + highlightInternalLinks } from "@notesnook/core"; import { VirtualizedTable } from "../virtualized-table"; -import { toChunks } from "@notesnook/core/dist/utils/array"; import { TextSlice } from "@notesnook/core/dist/utils/content-block"; const tools = [ @@ -456,7 +454,9 @@ function ReferencedIn({ const blocks = await db.notes.contentBlocks(item.id); setBlocks( blocks - .filter((b) => b.content.includes(`nn://note/${noteId}`)) + .filter((b) => + b.content.includes(createInternalLink("note", noteId)) + ) .map((block) => ({ id: block.id, links: highlightInternalLinks(block, noteId)