diff --git a/app/actions/definitions/documents.tsx b/app/actions/definitions/documents.tsx
index 667cee99e..6e659f0c0 100644
--- a/app/actions/definitions/documents.tsx
+++ b/app/actions/definitions/documents.tsx
@@ -50,6 +50,7 @@ import {
newDocumentPath,
searchPath,
documentPath,
+ urlify,
} from "~/utils/routeHelpers";
export const openDocument = createAction({
@@ -114,23 +115,6 @@ export const createDocumentFromTemplate = createAction({
),
});
-export const copyDocumentAsMarkdown = createAction({
- name: ({ t }) => t("Copy as Markdown"),
- section: DocumentSection,
- icon: ,
- keywords: "clipboard",
- visible: ({ activeDocumentId }) => !!activeDocumentId,
- perform: ({ stores, activeDocumentId, t }) => {
- const document = activeDocumentId
- ? stores.documents.get(activeDocumentId)
- : undefined;
- if (document) {
- copy(MarkdownHelper.toMarkdown(document));
- toast.success(t("Markdown copied to clipboard"));
- }
- },
-});
-
export const createNestedDocument = createAction({
name: ({ t }) => t("New nested document"),
analyticsName: "New document",
@@ -452,6 +436,47 @@ export const downloadDocument = createAction({
],
});
+export const copyDocumentAsMarkdown = createAction({
+ name: ({ t }) => t("Copy as Markdown"),
+ section: DocumentSection,
+ keywords: "clipboard",
+ visible: ({ activeDocumentId }) => !!activeDocumentId,
+ perform: ({ stores, activeDocumentId, t }) => {
+ const document = activeDocumentId
+ ? stores.documents.get(activeDocumentId)
+ : undefined;
+ if (document) {
+ copy(MarkdownHelper.toMarkdown(document));
+ toast.success(t("Markdown copied to clipboard"));
+ }
+ },
+});
+
+export const copyDocumentLink = createAction({
+ name: ({ t }) => t("Copy link"),
+ section: DocumentSection,
+ keywords: "clipboard",
+ visible: ({ activeDocumentId }) => !!activeDocumentId,
+ perform: ({ stores, activeDocumentId, t }) => {
+ const document = activeDocumentId
+ ? stores.documents.get(activeDocumentId)
+ : undefined;
+ if (document) {
+ copy(urlify(documentPath(document)));
+ toast.success(t("Link copied to clipboard"));
+ }
+ },
+});
+
+export const copyDocument = createAction({
+ name: ({ t }) => t("Copy"),
+ analyticsName: "Copy document",
+ section: DocumentSection,
+ icon: ,
+ keywords: "clipboard",
+ children: [copyDocumentLink, copyDocumentAsMarkdown],
+});
+
export const duplicateDocument = createAction({
name: ({ t, isContextMenu }) =>
isContextMenu ? t("Duplicate") : t("Duplicate document"),
@@ -909,6 +934,7 @@ export const rootDocumentActions = [
deleteDocument,
importDocument,
downloadDocument,
+ copyDocumentLink,
copyDocumentAsMarkdown,
starDocument,
unstarDocument,
diff --git a/app/menus/DocumentMenu.tsx b/app/menus/DocumentMenu.tsx
index ee9009082..e52d59fb1 100644
--- a/app/menus/DocumentMenu.tsx
+++ b/app/menus/DocumentMenu.tsx
@@ -43,6 +43,7 @@ import {
createDocumentFromTemplate,
createNestedDocument,
shareDocument,
+ copyDocument,
} from "~/actions/definitions/documents";
import useActionContext from "~/hooks/useActionContext";
import useCurrentUser from "~/hooks/useCurrentUser";
@@ -293,6 +294,7 @@ function DocumentMenu({
actionToMenuItem(openDocumentHistory, context),
actionToMenuItem(openDocumentInsights, context),
actionToMenuItem(downloadDocument, context),
+ actionToMenuItem(copyDocument, context),
actionToMenuItem(printDocument, context),
{
type: "separator",
diff --git a/shared/i18n/locales/en_US/translation.json b/shared/i18n/locales/en_US/translation.json
index 1545db4ee..fb77846cc 100644
--- a/shared/i18n/locales/en_US/translation.json
+++ b/shared/i18n/locales/en_US/translation.json
@@ -20,8 +20,6 @@
"Open document": "Open document",
"New document": "New document",
"New from template": "New from template",
- "Copy as Markdown": "Copy as Markdown",
- "Markdown copied to clipboard": "Markdown copied to clipboard",
"New nested document": "New nested document",
"Publish": "Publish",
"Published {{ documentName }}": "Published {{ documentName }}",
@@ -40,6 +38,11 @@
"Markdown": "Markdown",
"Download": "Download",
"Download document": "Download document",
+ "Copy as Markdown": "Copy as Markdown",
+ "Markdown copied to clipboard": "Markdown copied to clipboard",
+ "Copy link": "Copy link",
+ "Link copied to clipboard": "Link copied to clipboard",
+ "Copy": "Copy",
"Duplicate": "Duplicate",
"Duplicate document": "Duplicate document",
"Copy document": "Copy document",
@@ -84,7 +87,6 @@
"Log out": "Log out",
"Mark notifications as read": "Mark notifications as read",
"Restore revision": "Restore revision",
- "Copy link": "Copy link",
"Link copied": "Link copied",
"Dark": "Dark",
"Light": "Light",
@@ -297,7 +299,6 @@
"Copied to clipboard": "Copied to clipboard",
"Code": "Code",
"Comment": "Comment",
- "Copy": "Copy",
"Create link": "Create link",
"Sorry, an error occurred creating the link": "Sorry, an error occurred creating the link",
"Create a new doc": "Create a new doc",
@@ -322,7 +323,6 @@
"Info": "Info",
"Info notice": "Info notice",
"Link": "Link",
- "Link copied to clipboard": "Link copied to clipboard",
"Highlight": "Highlight",
"Type '/' to insert": "Type '/' to insert",
"Keep typing to filter": "Keep typing to filter",