mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
fix: incorrect cursor when text is selected in range (#797)
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user