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:

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

Returns: EventRefThe event reference.

Example:

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