Add keybind hint to confirm close dialog (#2529)

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
bymyself
2025-02-12 08:02:27 -07:00
committed by GitHub
parent 29cd693335
commit bfec9b692b
10 changed files with 33 additions and 6 deletions

View File

@@ -133,7 +133,8 @@ export const useDialogService = () => {
title,
message,
type = 'default',
itemList = []
itemList = [],
hint
}: {
/** Dialog heading */
title: string
@@ -141,8 +142,9 @@ export const useDialogService = () => {
message: string
/** Pre-configured dialog type */
type?: ConfirmationDialogType
/** Displayed as an unorderd list immediately below the message body */
/** Displayed as an unordered list immediately below the message body */
itemList?: string[]
hint?: string
}): Promise<boolean | null> {
return new Promise((resolve) => {
const options: ShowDialogOptions = {
@@ -153,7 +155,8 @@ export const useDialogService = () => {
message,
type,
itemList,
onConfirm: resolve
onConfirm: resolve,
hint
},
dialogComponentProps: {
onClose: () => resolve(null)

View File

@@ -188,14 +188,17 @@ export const useWorkflowService = () => {
*/
const closeWorkflow = async (
workflow: ComfyWorkflow,
options: { warnIfUnsaved: boolean } = { warnIfUnsaved: true }
options: { warnIfUnsaved: boolean; hint?: string } = {
warnIfUnsaved: true
}
): Promise<boolean> => {
if (workflow.isModified && options.warnIfUnsaved) {
const confirmed = await dialogService.confirm({
title: t('sideToolbar.workflowTab.dirtyCloseTitle'),
type: 'dirtyClose',
message: t('sideToolbar.workflowTab.dirtyClose'),
itemList: [workflow.path]
itemList: [workflow.path],
hint: options.hint
})
// Cancel
if (confirmed === null) return false