SF-3680 Ensure that a verse that is not in a para has a blank segment #3665
+76
−0
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.
This PR fixes an issue where a
{ blank: true }operation is not created for a verse that is not in a para, where that verse is followed by a blank para, resulting in operations subsequent ops being incorrectly offset by 1 by the TextViewModel, which requires a blank operation to be present for the first verse.Although this bug only manifests in the frontend editor (not in conversion from Delta to USX), I have added tests to ensure that behavior is not broken in future, and fixed this bug in the backend as that was the least complicated and most compatible fix (note that I did not have to change the logic in
ToUsx(), onlyToChapterDeltas()).I've also run this PR with the roundtrip tool, and can confirm that additional blank segments were only added where they should have been (a very small number of projects I had access to locally were affected by this).
This change is