mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-24 09:38:29 +02:00
Improved prompt function add add ctx.* functions (#301)
This commit is contained in:
@@ -6,7 +6,13 @@ import { showDialog } from './dialog';
|
||||
type PromptArgs = Pick<DialogProps, 'title' | 'description'> &
|
||||
Omit<PromptProps, 'onClose' | 'onCancel' | 'onResult'> & { id: string };
|
||||
|
||||
export async function showPrompt({ id, title, description, ...props }: PromptArgs) {
|
||||
export async function showPrompt({
|
||||
id,
|
||||
title,
|
||||
description,
|
||||
required = true,
|
||||
...props
|
||||
}: PromptArgs) {
|
||||
return new Promise((resolve: PromptProps['onResult']) => {
|
||||
showDialog({
|
||||
id,
|
||||
@@ -21,6 +27,7 @@ export async function showPrompt({ id, title, description, ...props }: PromptArg
|
||||
},
|
||||
render: ({ hide }) =>
|
||||
Prompt({
|
||||
required,
|
||||
onCancel: () => {
|
||||
// Click cancel button within dialog
|
||||
resolve(null);
|
||||
|
||||
Reference in New Issue
Block a user