diff --git a/src/plugins/core/NestedLexicalEditor.tsx b/src/plugins/core/NestedLexicalEditor.tsx index 0055a320..dab342f2 100644 --- a/src/plugins/core/NestedLexicalEditor.tsx +++ b/src/plugins/core/NestedLexicalEditor.tsx @@ -4,6 +4,7 @@ import { $getNodeByKey, $getRoot, BLUR_COMMAND, + FOCUS_COMMAND, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_HIGH, @@ -12,7 +13,8 @@ import { KEY_BACKSPACE_COMMAND, LexicalEditor, SELECTION_CHANGE_COMMAND, - createEditor + createEditor, + COMMAND_PRIORITY_LOW } from 'lexical' import * as Mdast from 'mdast' import { Node } from 'unist' @@ -260,6 +262,14 @@ export const NestedLexicalEditor = function (props: }) } return mergeRegister( + editor.registerCommand( + FOCUS_COMMAND, + () => { + setEditorInFocus({ editorType: 'lexical', rootNode: lexicalNode }) + return false + }, + COMMAND_PRIORITY_LOW + ), editor.registerCommand( BLUR_COMMAND, (payload) => { diff --git a/src/plugins/table/TableEditor.tsx b/src/plugins/table/TableEditor.tsx index 32af7620..14502cb7 100644 --- a/src/plugins/table/TableEditor.tsx +++ b/src/plugins/table/TableEditor.tsx @@ -8,6 +8,7 @@ import { $getRoot, BLUR_COMMAND, COMMAND_PRIORITY_CRITICAL, + COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_LOW, FOCUS_COMMAND, KEY_ENTER_COMMAND, @@ -443,7 +444,7 @@ const CellEditor: React.FC = ({ focus, setActiveCell, parentEditor, l saveAndFocus(null) return true }, - COMMAND_PRIORITY_CRITICAL + COMMAND_PRIORITY_EDITOR ), editor.registerCommand(