mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-21 04:48:11 +08:00
11 lines
431 B
TypeScript
11 lines
431 B
TypeScript
import { type Editor } from "@graphite/editor";
|
|
import { TriggerTextCopy } from "@graphite/messages";
|
|
|
|
export function createClipboardManager(editor: Editor) {
|
|
// Subscribe to process backend event
|
|
editor.subscriptions.subscribeJsMessage(TriggerTextCopy, (triggerTextCopy) => {
|
|
// If the Clipboard API is supported in the browser, copy text to the clipboard
|
|
navigator.clipboard?.writeText?.(triggerTextCopy.copyText);
|
|
});
|
|
}
|