Skip to content
Discussion options

You must be logged in to vote

You can do it like this:

const [editor] = useLexicalComposerContext();

useEffect(() => {
  return mergeRegister(
    editor.registerRootListener((rootElement) => {
      if (rootElement) {
        rootElement.addEventListener('keydown', yourKeyDownHandler);
      }
    })
  )
}, [editor, editorReadCallback]);

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@moy2010
Comment options

@gorimatyan
Comment options

@gorimatyan
Comment options

@moy2010
Comment options

@gorimatyan
Comment options

Answer selected by gorimatyan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants