diff --git a/web/src/components/MemoEditor/Editor/CommandSuggestions.tsx b/web/src/components/MemoEditor/Editor/CommandSuggestions.tsx index 200d7267d..be73e1111 100644 --- a/web/src/components/MemoEditor/Editor/CommandSuggestions.tsx +++ b/web/src/components/MemoEditor/Editor/CommandSuggestions.tsx @@ -50,7 +50,7 @@ const CommandSuggestions = observer(({ editorRef, editorActions, commands }: Pro editorActions.current.removeText(index, word.length); editorActions.current.insertText(cmd.run()); if (cmd.cursorOffset) { - editorActions.current.setCursorPosition(cmd.cursorOffset); + editorActions.current.setCursorPosition(editorActions.current.getCursorPosition() + cmd.cursorOffset); } hide(); }; diff --git a/web/src/components/MemoEditor/Editor/commands.ts b/web/src/components/MemoEditor/Editor/commands.ts index 766bbf4ee..edc375842 100644 --- a/web/src/components/MemoEditor/Editor/commands.ts +++ b/web/src/components/MemoEditor/Editor/commands.ts @@ -20,17 +20,11 @@ export const editorCommands: Command[] = [ cursorOffset: 1, }, { - name: "table-2", + name: "table", description: "Insert a table", run: () => "| Header | Header |\n| ------ | ------ |\n| Cell | Cell |", cursorOffset: 1, }, - { - name: "table-3", - description: "Insert a table", - run: () => "| Header | Header | Header |\n| ------ | ------ | ------ |\n| Cell | Cell | Cell |", - cursorOffset: 1, - }, { name: "highlight", description: "Insert highlighted text",