Add input dialog

This commit is contained in:
2025-01-19 20:55:53 +08:00
parent 51b7df02e7
commit 63346396e0
4 changed files with 56 additions and 15 deletions

View File

@@ -1276,5 +1276,20 @@ let UI = {
function: 'cancelLoading',
id: id
})
},
/**
* Show an input dialog
* @param title {string}
* @param validator {(string) => string | null | undefined} - A function that validates the input. If the function returns a string, the dialog will show the error message.
* @returns {string | null} - The input value. If the dialog is canceled, return null.
*/
showInputDialog: (title, validator) => {
return sendMessage({
method: 'UI',
function: 'showInputDialog',
title: title,
validator: validator
})
}
}