Skip to content

Commit b003d3a

Browse files
committed
Add copy link action to context menus
- Show a Copy Link item for safe external URLs - Copy the clicked link URL to the clipboard
1 parent 28e481e commit b003d3a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎apps/desktop/src/main.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as Path from "node:path";
77
import {
88
app,
99
BrowserWindow,
10+
clipboard,
1011
dialog,
1112
ipcMain,
1213
Menu,
@@ -1375,6 +1376,14 @@ function createWindow(): BrowserWindow {
13751376
menuTemplate.push({ type: "separator" });
13761377
}
13771378

1379+
const externalUrl = getSafeExternalUrl(params.linkURL);
1380+
if (externalUrl) {
1381+
menuTemplate.push(
1382+
{ label: "Copy Link", click: () => clipboard.writeText(params.linkURL) },
1383+
{ type: "separator" },
1384+
);
1385+
}
1386+
13781387
menuTemplate.push(
13791388
{ role: "cut", enabled: params.editFlags.canCut },
13801389
{ role: "copy", enabled: params.editFlags.canCopy },

0 commit comments

Comments
 (0)