UNPKG

obsidian-dev-utils

Version:

This is the collection of useful functions that you can use for your Obsidian plugin development

45 lines (44 loc) 1.19 kB
/** * @packageDocumentation * * Utility for displaying confirm modals in Obsidian. * * This module exports a function to display a modal with a message in Obsidian. The modal includes "OK" and "Cancel" buttons to confirm or cancel the action. */ import type { App } from 'obsidian'; /** * The options for the confirm modal. */ export interface ConfirmOptions { /** * The Obsidian app instance. */ app: App; /** * The text for the "Cancel" button. */ cancelButtonText?: string; /** * The CSS class to apply to the modal. */ cssClass?: string; /** * The message to display in the modal. */ message: DocumentFragment | string; /** * The text for the "OK" button. */ okButtonText?: string; /** * The title of the modal. */ title?: DocumentFragment | string; } /** * Displays an confirm modal in Obsidian with a specified message. * * @param options - The options for the confirm modal. * @returns A {@link Promise} that resolves with a boolean indicating whether the "OK" button was clicked. */ export declare function confirm(options: ConfirmOptions): Promise<boolean>;