fix: editor focus handling on click events (#716)

This commit is contained in:
LangLangBart 2023-12-29 01:50:44 +01:00 • committed by GitHub
parent a2188645b9
commit f1660a5331
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -340,7 +340,12 @@ function TipTapEditor(props: TipTapEditorProps) {
}, [editor, props.isMainInput, historyLength, ignoreHighlightedCode]);
return (
<InputBoxDiv className="cursor-text">
<InputBoxDiv
className="cursor-text"
onClick={() => {
editor && editor.commands.focus();
}}
>
<EditorContent
editor={editor}
onFocus={() => {
@ -352,6 +357,9 @@ function TipTapEditor(props: TipTapEditorProps) {
setInputFocused(false);
}, 100);
}}
onClick={(event) => {
event.stopPropagation();
}}
/>
<InputToolbar
hidden={!(inputFocused || props.isMainInput)}
@ -364,9 +372,6 @@ function TipTapEditor(props: TipTapEditorProps) {
onEnter={() => {
onEnterRef.current(editor.getJSON());
}}
onClick={() => {
editor.commands.focus("end");
}}
/>
</InputBoxDiv>
);