Identify nestedElement fields even if their content expression is overridden #370
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.
What does this change?
The workaround for the text element join after deleting a non-text element between two text elements relied on
nestedElement
fields having the content expressionelement+
.This is flawed, because the fields can have their content expression overridden - in fact we will need to override it to something like
nonKeyTakeawaysElement+
in order to prevent a key takeaway element being pasted into another a key takeaway element.This PR uses the stable "nested-element-field" group that should appear in
nestedFields
as an identifier for our workaround to use. In the long run we'll want to fix the route cause of thenestedElement
fieldView
update bug that caused the join issue, rather than relying on this workaround.n.b. Groups are modelled in a string of space-separated group strings rather than as an array of strings.
How to test
If you're feeling diligent, use this version of
prosemirror-elements
locally in Composer via yalc.Add text on either side of a pullquote and delete the pullquote. The document will appear invalid but will become valid on any mouse move.