mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-14 12:18:30 +03:00
Esc for compose field
This commit is contained in:
parent
d2d8571b3f
commit
0d92f65f7e
1 changed files with 13 additions and 0 deletions
|
@ -2,6 +2,7 @@ import './compose.css';
|
|||
|
||||
import '@github/text-expander-element';
|
||||
import { useEffect, useMemo, useRef, useState } from 'preact/hooks';
|
||||
import { useHotkeys } from 'react-hotkeys-hook';
|
||||
import stringLength from 'string-length';
|
||||
|
||||
import supportedLanguages from '../data/status-supported-languages';
|
||||
|
@ -445,6 +446,18 @@ function Compose({
|
|||
setCharCount(getCharCount());
|
||||
};
|
||||
|
||||
useHotkeys(
|
||||
'esc',
|
||||
() => {
|
||||
if (!standalone && confirmClose()) {
|
||||
onClose();
|
||||
}
|
||||
},
|
||||
{
|
||||
enableOnFormTags: true,
|
||||
},
|
||||
);
|
||||
|
||||
return (
|
||||
<div id="compose-container" class={standalone ? 'standalone' : ''}>
|
||||
<div class="compose-top">
|
||||
|
|
Loading…
Add table
Reference in a new issue