-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix DecoratorNode
s being treated as block elements
#5371
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised that no tests are breaking, since I made insertNodes
considering the decorators
(which in fact before were not included as blocks and I had to include them for it to work).
I haven't reviewed insertNodes
in detail again, so for my part the only thing I can point out at a glance is a comment about the return type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into this! The terminology for this function is not correct. We have originally referred to blocks as a piece of content that ocuppies the entire horizontal space, resembling display: block
on the browser. Decorator nodes can be blocks so I'd be inclined the say that we have to fix this instead https://github.com/facebook/lexical/blob/main/packages/lexical-selection/src/range-selection.ts#L77
Stamping to unblock since it's been about a month since this was open but ideally we want to iterate on this
closes #5369
This is a result of the larger insertNodes changes in v0.12.3+.
Causal code:
https://github.com/facebook/lexical/pull/5002/files#diff-33353db27f56a5d74e7281df0a8a2fc223eef41e9dc2efc723a412560a0148c9R561-R563
INTERNAL_$isBlock
is treating (non-inline)DecoratorNode
s as block elements, causingElementNode
methods being called on decorator nodes that result in broken functionality.While someone could extend the decorator node class to have the indent and format properties, they are generally not elements and should not be treated as such.