mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-01-23 00:56:23 +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, []);
|
||||
|
||||
const escDownRef = useRef(false);
|
||||
useHotkeys(
|
||||
'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();
|
||||
}
|
||||
escDownRef.current = false;
|
||||
},
|
||||
{
|
||||
enableOnFormTags: true,
|
||||
|
|
Loading…
Reference in a new issue