mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-25 19:01:38 +01:00
Make prompt() to return null on cancel
This commit is contained in:
@@ -10,7 +10,7 @@ import { IconButton } from './IconButton';
|
||||
export interface DialogProps {
|
||||
children: ReactNode;
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
onClose?: () => void;
|
||||
title?: ReactNode;
|
||||
description?: ReactNode;
|
||||
className?: string;
|
||||
@@ -44,7 +44,7 @@ export function Dialog({
|
||||
'Escape',
|
||||
() => {
|
||||
if (!open) return;
|
||||
onClose();
|
||||
onClose?.();
|
||||
},
|
||||
{},
|
||||
[open],
|
||||
|
||||
@@ -26,7 +26,7 @@ export type InputProps = Omit<
|
||||
> & {
|
||||
name?: string;
|
||||
type?: 'text' | 'password';
|
||||
label: string;
|
||||
label: ReactNode;
|
||||
hideLabel?: boolean;
|
||||
labelPosition?: 'top' | 'left';
|
||||
labelClassName?: string;
|
||||
|
||||
@@ -512,7 +512,7 @@ function PairEditorRow({
|
||||
leftSlot: <Icon icon="pencil" />,
|
||||
hidden: !pairContainer.pair.isFile,
|
||||
onSelect: async () => {
|
||||
const v = await prompt({
|
||||
const contentType = await prompt({
|
||||
id: 'content-type',
|
||||
require: false,
|
||||
title: 'Override Content-Type',
|
||||
@@ -522,7 +522,8 @@ function PairEditorRow({
|
||||
confirmText: 'Set',
|
||||
description: 'Leave blank to auto-detect',
|
||||
});
|
||||
handleChangeValueContentType(v);
|
||||
if (contentType == null) return;
|
||||
handleChangeValueContentType(contentType);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user