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(
|
const onEscape = useCallback(
|
||||||
(e: KeyboardEvent) => {
|
(e: KeyboardEvent) => {
|
||||||
if (e.key === 'Escape') {
|
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',
|
name: 'confirm',
|
||||||
title: 'Cancel draft',
|
title: 'Cancel draft',
|
||||||
onPressConfirm: onClose,
|
onPressConfirm: onClose,
|
||||||
|
@ -102,7 +108,7 @@ export const ComposePost = observer(function ComposePost({
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[store.shell, onClose],
|
[store, onClose],
|
||||||
)
|
)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
Loading…
Reference in New Issue