Skip to content

Commit 87da19a

Browse files
committed
Added selection:copy-to-clipboard command with keyboard shortcuts (Ctrl+C / Cmd+C)
Added `selection:copy-to-clipboard` command with keyboard shortcuts (Ctrl+C / Cmd+C) that copies selected text without clearing the selection, providing a better user experience for keyboard-based copying.
1 parent 99ac546 commit 87da19a

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

.changeset/swift-cats-jump.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@embedpdf/snippet': patch
3+
---
4+
5+
Added `selection:copy-to-clipboard` command with keyboard shortcuts (Ctrl+C / Cmd+C) that copies selected text without clearing the selection, providing a better user experience for keyboard-based copying.

viewers/snippet/src/config/commands.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,6 +1486,19 @@ export const commands: Record<string, Command<State>> = {
14861486
},
14871487
},
14881488

1489+
'selection:copy-to-clipboard': {
1490+
id: 'selection:copy-to-clipboard',
1491+
labelKey: 'selection.copyToClipboard',
1492+
icon: 'copy',
1493+
shortcuts: ['Ctrl+C', 'Meta+C'],
1494+
categories: ['selection', 'selection-copy-to-clipboard'],
1495+
action: ({ registry, documentId }) => {
1496+
const plugin = registry.getPlugin<SelectionPlugin>('selection');
1497+
const scope = plugin?.provides().forDocument(documentId);
1498+
scope?.copyToClipboard();
1499+
},
1500+
},
1501+
14891502
'selection:copy': {
14901503
id: 'selection:copy',
14911504
labelKey: 'selection.copy',

0 commit comments

Comments
 (0)