Skip to content

Commit 067ce65

Browse files
committed
Plugins: Added copyToClipboard command
1 parent 302577e commit 067ce65

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ packages/app-desktop/app.js
151151
packages/app-desktop/bridge.js
152152
packages/app-desktop/checkForUpdates.js
153153
packages/app-desktop/commands/copyDevCommand.js
154+
packages/app-desktop/commands/copyToClipboard.js
154155
packages/app-desktop/commands/editProfileConfig.js
155156
packages/app-desktop/commands/emptyTrash.js
156157
packages/app-desktop/commands/exportDeletionLog.test.js

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ packages/app-desktop/app.js
125125
packages/app-desktop/bridge.js
126126
packages/app-desktop/checkForUpdates.js
127127
packages/app-desktop/commands/copyDevCommand.js
128+
packages/app-desktop/commands/copyToClipboard.js
128129
packages/app-desktop/commands/editProfileConfig.js
129130
packages/app-desktop/commands/emptyTrash.js
130131
packages/app-desktop/commands/exportDeletionLog.test.js
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { CommandRuntime, CommandDeclaration } from '@joplin/lib/services/CommandService';
2+
import { clipboard } from 'electron';
3+
4+
export const declaration: CommandDeclaration = {
5+
name: 'copyToClipboard',
6+
};
7+
8+
export const runtime = (): CommandRuntime => {
9+
return {
10+
execute: async (_context, content: string) => {
11+
if (!content || (typeof content !== 'string')) return;
12+
clipboard.writeText(content);
13+
},
14+
};
15+
};

packages/app-desktop/commands/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// AUTO-GENERATED using `gulp buildScriptIndexes`
22
import * as copyDevCommand from './copyDevCommand';
3+
import * as copyToClipboard from './copyToClipboard';
34
import * as editProfileConfig from './editProfileConfig';
45
import * as emptyTrash from './emptyTrash';
56
import * as exportDeletionLog from './exportDeletionLog';
@@ -24,6 +25,7 @@ import * as toggleTabMovesFocus from './toggleTabMovesFocus';
2425

2526
const index: any[] = [
2627
copyDevCommand,
28+
copyToClipboard,
2729
editProfileConfig,
2830
emptyTrash,
2931
exportDeletionLog,

0 commit comments

Comments
 (0)