fix: incorrect cursor when text is selected in range (#797)
This commit is contained in:
parent
3c2cd43d28
commit
b6fe4d914e
@ -179,7 +179,12 @@ const MemoEditor = () => {
|
||||
}
|
||||
if (!isShiftKey && event.key === "Tab") {
|
||||
event.preventDefault();
|
||||
const selectedContent = editorRef.current.getSelectedContent();
|
||||
const cursorPosition = editorRef.current.getCursorPosition();
|
||||
editorRef.current.insertText(" ".repeat(TAB_SPACE_WIDTH));
|
||||
if (selectedContent) {
|
||||
editorRef.current.setCursorPosition(cursorPosition + TAB_SPACE_WIDTH);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user