Workspace.on('editor-paste') method
Workspace › on(‘editor-paste’)
Official
Triggered when the editor receives a paste event. Check forevt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Signature:
on(name: "editor-paste", callback: (evt: ClipboardEvent, editor: Editor, info: MarkdownFileInfo | MarkdownView) => unknown, ctx?: unknown): EventRefParameters:
| Parameter | Type | Description |
|---|---|---|
| name | "editor-paste" | Should be 'editor-paste'. |
| callback | (evt: ClipboardEvent, editor: Editor, info: MarkdownFileInfo | MarkdownView) => unknown | The callback function. |
| ctx? | unknown | The context passed as this to the callback function. |
Returns: EventRef — The event reference.
Example:
app.workspace.on('editor-paste', (evt, editor, info) => { console.log(evt, editor, info);});