refactor(dialog)!: remove deprecated MessageDialogOptions.okLabel (#3612)

* refactor(dialog)!: remove deprecated MessageDialogOptions.okLabel

Use `buttons: { ok: 'label' }` instead. `ConfirmDialogOptions` (used by
`ask` and `confirm`) still accepts `okLabel` and `cancelLabel`.

* Apply suggestion from @amrbashir

---------

Co-authored-by: Amr Bashir <github@amrbashir.me>
This commit is contained in:
Lucas Fernandes Nogueira
2026-09-22 06:07:16 -03:00
committed by GitHub
co-authored by Amr Bashir
parent 1a43e4701d
commit b2d7c387ef
3 changed files with 8 additions and 14 deletions
+1 -13
View File
@@ -228,12 +228,6 @@ interface MessageDialogOptions {
title?: string
/** The kind of the dialog. Defaults to `info`. */
kind?: 'info' | 'warning' | 'error'
/**
* The label of the Ok button.
*
* @deprecated Use {@linkcode MessageDialogOptions.buttons} instead.
*/
okLabel?: string
/**
* The buttons of the dialog.
*
@@ -405,10 +399,7 @@ async function save(options: SaveDialogOptions = {}): Promise<string | null> {
*/
export type MessageDialogResult = 'Yes' | 'No' | 'Ok' | 'Cancel' | (string & {})
async function messageCommand(
message: string,
options?: Omit<MessageDialogOptions, 'okLabel'>
) {
async function messageCommand(message: string, options?: MessageDialogOptions) {
return await invoke<MessageDialogResult>('plugin:dialog|message', {
message,
title: options?.title,
@@ -439,9 +430,6 @@ async function message(
options?: string | MessageDialogOptions
): Promise<MessageDialogResult> {
const opts = typeof options === 'string' ? { title: options } : options
if (opts && !opts.buttons && opts.okLabel) {
opts.buttons = { ok: opts.okLabel }
}
return messageCommand(message, opts)
}