2
0

🐛 (editor) Fix text bubble refocus carret position

Closes #329
This commit is contained in:
Baptiste Arnaud
2023-02-23 08:49:07 +01:00
parent cc9817b2e3
commit bc47cc46c0

View File

@@ -95,9 +95,9 @@ const TextBubbleEditorContent = ({
const handleVariableSelected = (variable?: Variable) => { const handleVariableSelected = (variable?: Variable) => {
setIsVariableDropdownOpen(false) setIsVariableDropdownOpen(false)
if (!rememberedSelection.current || !variable) return if (!rememberedSelection.current || !variable) return
ReactEditor.focus(editor as unknown as ReactEditor)
Transforms.select(editor as BaseEditor, rememberedSelection.current) Transforms.select(editor as BaseEditor, rememberedSelection.current)
Transforms.insertText(editor as BaseEditor, '{{' + variable.name + '}}') Transforms.insertText(editor as BaseEditor, '{{' + variable.name + '}}')
ReactEditor.focus(editor as unknown as ReactEditor)
} }
const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => { const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {