Only allow one close draft confirmation at a time (#611)
* Only allow one close draft confirmation at a time * lintzio/stable
parent
c2fb4d4b4b
commit
0192923ef3
|
@ -91,7 +91,13 @@ export const ComposePost = observer(function ComposePost({
|
|||
const onEscape = useCallback(
|
||||
(e: KeyboardEvent) => {
|
||||
if (e.key === 'Escape') {
|
||||
store.shell.openModal({
|
||||
const {shell} = store
|
||||
|
||||
if (shell.activeModals.some(modal => modal.name === 'confirm')) {
|
||||
store.shell.closeModal()
|
||||
}
|
||||
|
||||
shell.openModal({
|
||||
name: 'confirm',
|
||||
title: 'Cancel draft',
|
||||
onPressConfirm: onClose,
|
||||
|
@ -102,7 +108,7 @@ export const ComposePost = observer(function ComposePost({
|
|||
})
|
||||
}
|
||||
},
|
||||
[store.shell, onClose],
|
||||
[store, onClose],
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
|
|
Loading…
Reference in New Issue