[lexical-list] Feature: Add the createListItemNode method to the ListNode and use it for children normalization#8427
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Maybe a better solution to solve the problem at hand is to give ListNode a createListItem(): ListItemNode { return $createListItem(); } method by subclasses. I think this is probably the actual behavior you're trying to achieve here (also the splice method could use this)?
|
I don't quite understand why the ListItemNode class needs a method that will create an instance of the same class. In this case, it is important to create a copy of the same instance that is already contained in the ListNode |
|
That was a typo on my part, edited to correct ListItem to ListNode |
|
I'd like more context about why it is important to create a copy of some arbitrary other ListItemNode and why the ListNode subclass wouldn't have enough information to create the correct type of ListItemNode wrapper |
|
In actually, with the |
|
There's already ListItemNode.createParentElementNode() which can be used to create a parent ListNode and be overridden. I haven't audited it to see if it's used everywhere it should be, but that would solve the missing ListNode problem in an extensible way without copy heuristics. |
createListItemNode method to the ListNode and use it for children normalization
…stNode and use it for children normalization (facebook#8427) Co-authored-by: Bob Ippolito <bob@redivi.com>

Description
Follow-up #8213
Classes that extend ListNode can use the parent
aftermethod from the conversion function inimportDOM. To ensure that child normalization works correctly,createListItemNodemethod has been added to theListNodeclass, which can be overridden in subclassesTest plan
Before
Insert relevant screenshots/recordings/automated-tests
After
Insert relevant screenshots/recordings/automated-tests