Skip to content

Workspace.on('quick-preview') method

Workspace › on(‘quick-preview’)

Official

Triggered when the active Markdown file is modified. React to file changes before they are saved to disk.

Signature:

on(name: "quick-preview", callback: (file: TFile, data: string) => unknown, ctx?: unknown): EventRef

Parameters:

Parameter Type Description
name "quick-preview" Should be 'quick-preview'.
callback (file: TFile, data: string) => unknown The callback function.
ctx? unknown The context passed as this to the callback function.

Returns: EventRefThe event reference.

Example:

app.workspace.on('quick-preview', (file, data) => {
console.log(file, data);
});