mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-09 01:26:24 +01:00
Fix esc triggering exit confirmation when closing the expander
This commit is contained in:
parent
73b8294811
commit
4e5e2fa75f
1 changed files with 13 additions and 1 deletions
|
@ -348,12 +348,24 @@ function Compose({
|
||||||
};
|
};
|
||||||
useEffect(updateCharCount, []);
|
useEffect(updateCharCount, []);
|
||||||
|
|
||||||
|
const escDownRef = useRef(false);
|
||||||
useHotkeys(
|
useHotkeys(
|
||||||
'esc',
|
'esc',
|
||||||
() => {
|
() => {
|
||||||
if (!standalone && confirmClose()) {
|
escDownRef.current = true;
|
||||||
|
// This won't be true if this event is already handled and not propagated 🤞
|
||||||
|
},
|
||||||
|
{
|
||||||
|
enableOnFormTags: true,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
useHotkeys(
|
||||||
|
'esc',
|
||||||
|
() => {
|
||||||
|
if (!standalone && escDownRef.current && confirmClose()) {
|
||||||
onClose();
|
onClose();
|
||||||
}
|
}
|
||||||
|
escDownRef.current = false;
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
enableOnFormTags: true,
|
enableOnFormTags: true,
|
||||||
|
|
Loading…
Reference in a new issue