@mocanvas/mocanvas · function
declare function handleNativeOrMenuCopy(editor: Editor, event?: ClipboardEvent, ids?: readonly ShapeId[]): Promise<boolean>Write the current selection to the clipboard, from either a native copy event or a menu item.
With an event, the content is written synchronously in every flavour at once: the HTML flavour carries mocanvas's own serialized content inside a marker element (so a paste back into the canvas is lossless), and the plain-text flavour carries the text of the copied shapes (so a paste into anything else is readable). Without an event, only the async path is available and only the text flavour is written.
Returns whether anything was copied — an empty selection is not a failure, but the caller usually wants to skip the "copied" toast.
mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.