Skip to content

Workspace.on('editor-paste') method

Workspace › on(‘editor-paste’)

Official

Triggered when the editor receives a paste event. Check for evt.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): EventRef

Parameters:

ParameterTypeDescription
name"editor-paste"Should be 'editor-paste'.
callback(evt: ClipboardEvent, editor: Editor, info: MarkdownFileInfo | MarkdownView) => unknownThe callback function.
ctx?unknownThe context passed as this to the callback function.

Returns: EventRefThe event reference.

Example:

app.workspace.on('editor-paste', (evt, editor, info) => {
console.log(evt, editor, info);
});