Fix insertNodes insert position at start of inline ElementNode #5110
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
insertNodes
does too much...insertNodes
is a function that's able to insert N amount of nodes and fixed the hierarchy accordingly.In #1996 we determined that insertNodes
[x, y, z]
wherey
is an ElementNode should never be merged intoz
. That makes sense, from a user PoV these are 3 separate nodes (an array) and you'd want them one next to the other.However, when you
insertNodes
from a paste PoV, if your target is non-empty ElementNode you'd want toinsertBefore
the Element. For example,insertNodes[$createLineBreakNode()]
with the aforementioned target should prepend it on the list of nodes.Where do we draw the line?
We don't, we reduceWe can assume that the first node's target can be treated as merge with the current hierarchy, whereasinsertNodes
responsibilities.target
s for subsequent node's should always be appended.Screen.Recording.2023-10-10.at.3.54.44.PM.mov
Closes #4172