fix blur
This commit is contained in:
parent
5402453deb
commit
62f3f7fce0
1 changed files with 13 additions and 3 deletions
|
|
@ -153,14 +153,24 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
setActiveKey,
|
||||
});
|
||||
|
||||
const handleBlur = (e: React.FocusEvent) => {
|
||||
// Check if the new focus target is within our InputBoxDiv
|
||||
const currentTarget = e.currentTarget;
|
||||
const relatedTarget = e.relatedTarget as Node | null;
|
||||
|
||||
if (relatedTarget && currentTarget.contains(relatedTarget)) {
|
||||
return;
|
||||
}
|
||||
|
||||
setShouldHideToolbar(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<InputBoxDiv
|
||||
onFocus={() => {
|
||||
setShouldHideToolbar(false);
|
||||
}}
|
||||
onBlur={() => {
|
||||
setShouldHideToolbar(true);
|
||||
}}
|
||||
onBlur={handleBlur}
|
||||
onKeyDown={handleKeyDown}
|
||||
onKeyUp={handleKeyUp}
|
||||
className={shouldHideToolbar ? "cursor-default" : "cursor-text"}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue