Skip to content

PluginNoticeUndoAction

An Undo action offered on a notice through PluginNoticeComponentShowNoticeOptions.undo.

The button works once: the first press disables it and runs PluginNoticeUndoAction.onUndo, and later presses do nothing, so an undo can never be run twice. When it settles, the notice holding the button is replaced by a notice reporting the outcome. A failure is reported there once, as Undo failed: <message>, and logged to the console; it is not rethrown, so the unhandled-error notice does not report the same failure a second time.

Import:

import type { PluginNoticeUndoAction } from '@mnaoumov/obsidian-lib/components/plugin-notice-component';

Signature:

export interface PluginNoticeUndoAction

Properties

PropertyTypeDescription
buttonText?stringThe text of the Undo button. When omitted, the localized Undo label is used.
onUndo() => Promisable<DocumentFragment | null | string>Performs the undo.

Links to this page: