A weird case where TreeView shows selection but editorState does not have selection #5651
Unanswered
addlistener
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The problem
My TOGGLE_LINK_COMMAND is broken and making
activeEditorState._selectionto equalnullwhen trying to render a Lexical in a separate root created in an iframe.The crime scene
As shown below, I run into an breakpoint. LexicalLinkPlugin uses
$getSelectionlexical/packages/lexical-link/src/index.ts
Line 417 in 21d5447
And it returns null selection, I stepped in and found editorState does not have _selection.
LexicalTreeView is also using
$getSelectionlexical/packages/lexical-react/src/LexicalTreeView.tsx
Line 401 in 21d5447
but it works fine.
Background
I'm rendering lexical in an iframe, created a separate react root compared to parent window's root.
My research
I have read about #2108 and it seems that the portal into iframe problem should already be solved by https://github.com/facebook/lexical/pull/2918/files
In my case there are no portals. Just a separate react root.
Still thinking...
Beta Was this translation helpful? Give feedback.
All reactions