A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: support copying notebook/tag/color internal link
Abdullah Atta7f367389bbf5
diff --git a/apps/web/src/components/navigation-menu/index.tsx b/apps/web/src/components/navigation-menu/index.tsxindex 793fa009e..3d939de7f 100644--- a/apps/web/src/components/navigation-menu/index.tsx+++ b/apps/web/src/components/navigation-menu/index.tsx@@ -47,7 +47,8 @@ import {Notebook as NotebookIcon,Plus,SortBy,- Tag as TagIcon+ Tag as TagIcon,+ InternalLink} from "../icons";import { SortableNavigationItem } from "./navigation-item";import {@@ -89,7 +90,7 @@ import {} from "@dnd-kit/sortable";import { usePersistentState } from "../../hooks/use-persistent-state";import { MenuItem } from "@notesnook/ui";-import { Color, Notebook, Tag } from "@notesnook/core";+import { Color, createInternalLink, Notebook, Tag } from "@notesnook/core";import { handleDrop } from "../../common/drop-handler";import { Menu } from "../../hooks/use-menu";import { RenameColorDialog } from "../../dialogs/item-dialog";@@ -117,6 +118,7 @@ import {} from "@notesnook/common";import { isUserSubscribed } from "../../hooks/use-is-user-premium";import { shouldShowWrapped } from "../../utils/should-show-wrapped";+import { writeToClipboard } from "../../utils/clipboard";type Route = {id: "notes" | "favorites" | "reminders" | "monographs" | "trash" | "archive";@@ -626,9 +628,23 @@ function ColorItem({},icon: Trash.path},+ {+ type: "button",+ key: "copy-link",+ title: strings.copyLink(),+ icon: InternalLink.path,+ onClick: () => {+ const link = createInternalLink("color", color.id);+ writeToClipboard({+ "text/plain": link,+ "text/html": `<a href="${link}">${color.title}</a>`,+ "text/markdown": `[${color.title}](${link})`+ });+ }+ },{type: "lazy-loader",- key: "sidebar-items-loader",+ key: "sidebar-items-loader2",items: async () => [createSetDefaultHomepageMenuItem(color.id,diff --git a/apps/web/src/components/notebook/index.tsx b/apps/web/src/components/notebook/index.tsxindex 7b4ee29be..11f81da60 100644--- a/apps/web/src/components/notebook/index.tsx+++ b/apps/web/src/components/notebook/index.tsx@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.import ListItem from "../list-item";import { Button, Flex, Text } from "@theme-ui/components";import { useStore as useNotesStore } from "../../stores/note-store";-import { Notebook as NotebookType } from "@notesnook/core";+import { createInternalLink, Notebook as NotebookType } from "@notesnook/core";import {ChevronDown,ChevronRight,@@ -31,7 +31,9 @@ import {Trash,Notebook as NotebookIcon,ArrowUp,- Move+ Move,+ Copy,+ InternalLink} from "../icons";import { MenuItem } from "@notesnook/ui";import { hashNavigate, navigate } from "../../navigation";@@ -51,6 +53,7 @@ import {import { useStore as useNotebookStore } from "../../stores/notebook-store";import { MoveNotebookDialog } from "../../dialogs/move-notebook-dialog";import { areFeaturesAvailable } from "@notesnook/common";+import { writeToClipboard } from "../../utils/clipboard";type NotebookProps = {item: NotebookType;@@ -254,6 +257,20 @@ export const notebookMenuItems: (MoveNotebookDialog.show({ notebook: notebook });}},+ {+ type: "button",+ key: "copy-link",+ title: strings.copyLink(),+ icon: InternalLink.path,+ onClick: () => {+ const link = createInternalLink("notebook", notebook.id);+ writeToClipboard({+ "text/plain": link,+ "text/html": `<a href="${link}">${notebook.title}</a>`,+ "text/markdown": `[${notebook.title}](${link})`+ });+ }+ },{type: "button",key: "move-to-top",diff --git a/apps/web/src/components/tag/index.tsx b/apps/web/src/components/tag/index.tsxindex 85fc01a20..574e7eba8 100644--- a/apps/web/src/components/tag/index.tsx+++ b/apps/web/src/components/tag/index.tsx@@ -22,9 +22,15 @@ import { navigate } from "../../navigation";import { Flex, Text } from "@theme-ui/components";import { store as appStore } from "../../stores/app-store";import { db } from "../../common/db";-import { Edit, Shortcut, DeleteForver, Tag as TagIcon } from "../icons";+import {+ Edit,+ Shortcut,+ DeleteForver,+ Tag as TagIcon,+ InternalLink+} from "../icons";import { MenuItem } from "@notesnook/ui";-import { Tag as TagType } from "@notesnook/core";+import { createInternalLink, Tag as TagType } from "@notesnook/core";import { handleDrop } from "../../common/drop-handler";import { EditTagDialog } from "../../dialogs/item-dialog";import { useStore as useSelectionStore } from "../../stores/selection-store";@@ -36,6 +42,7 @@ import {withFeatureCheck} from "../../common";import { areFeaturesAvailable } from "@notesnook/common";+import { writeToClipboard } from "../../utils/clipboard";type TagProps = { item: TagType; totalNotes: number };function Tag(props: TagProps) {@@ -149,6 +156,20 @@ export const tagMenuItems: (appStore.addToShortcuts(tag))},+ {+ type: "button",+ key: "copy-link",+ title: strings.copyLink(),+ icon: InternalLink.path,+ onClick: () => {+ const link = createInternalLink("tag", tag.id);+ writeToClipboard({+ "text/plain": link,+ "text/html": `<a href="${link}">${tag.title}</a>`,+ "text/markdown": `[${tag.title}](${link})`+ });+ }+ },{ key: "sep", type: "separator" },{type: "button",