mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-03 04:00:31 +00:00
Add keybind hint to confirm close dialog (#2529)
Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user