import { TLUiDialogsContextType, TldrawUiButton, TldrawUiButtonLabel, TldrawUiDialogBody, TldrawUiDialogCloseButton, TldrawUiDialogFooter, TldrawUiDialogHeader, TldrawUiDialogTitle, useTranslation, } from 'tldraw' /** @public */ export async function shouldOverrideDocument(addDialog: TLUiDialogsContextType['addDialog']) { const shouldContinue = await new Promise((resolve) => { addDialog({ component: ({ onClose }) => ( { resolve(false) onClose() }} onContinue={() => { resolve(true) onClose() }} /> ), onClose: () => { resolve(false) }, }) }) return shouldContinue } function ConfirmOpenDialog({ onCancel, onContinue, }: { onCancel: () => void onContinue: () => void }) { const msg = useTranslation() return ( <> {msg('file-system.confirm-open.title')} {msg('file-system.confirm-open.description')} {msg('file-system.confirm-open.cancel')} onContinue()}> {msg('file-system.confirm-open.open')} ) }