Fix text story creation input
This commit is contained in:
parent
97b7f3dbc1
commit
50c48315e3
1 changed files with 31 additions and 31 deletions
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
import type { KeyboardEvent, ReactNode } from 'react';
|
import type { KeyboardEvent, ReactNode } from 'react';
|
||||||
import type { Options, VirtualElement } from '@popperjs/core';
|
import type { Options, VirtualElement } from '@popperjs/core';
|
||||||
import FocusTrap from 'focus-trap-react';
|
|
||||||
import React, { useEffect, useRef, useState } from 'react';
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { usePopper } from 'react-popper';
|
import { usePopper } from 'react-popper';
|
||||||
|
@ -174,6 +173,13 @@ export function ContextMenu<T>({
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ev.key === 'Escape') {
|
||||||
|
setIsMenuShowing(false);
|
||||||
|
closeCurrentOpenContextMenu = undefined;
|
||||||
|
ev.stopPropagation();
|
||||||
|
ev.preventDefault();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClick = (ev: React.MouseEvent) => {
|
const handleClick = (ev: React.MouseEvent) => {
|
||||||
|
@ -282,11 +288,6 @@ export function ContextMenu<T>({
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FocusTrap
|
|
||||||
focusTrapOptions={{
|
|
||||||
allowOutsideClick: true,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
getClassName('__container'),
|
getClassName('__container'),
|
||||||
|
@ -313,6 +314,5 @@ export function ContextMenu<T>({
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</FocusTrap>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue