TINY-10755: fix some edge cases of selection.setContent
#9554
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.
Related Ticket: TINY-10755
Description of Changes:
The problem was that after
setContent
the selection is moved to the next element if that element is a text node, but if this text node is wrapped by apre+code
or anh1
the selection was moved in the wrong place and it cause an error on insert new line.I chose to change how the selection after
setContent
works because at the moment the insertion is impossible navigating the context to go back to the wrong selectionPre-checks:
feature/
,hotfix/
orspike/
Review:
Docs ticket created (if applicable)GitHub issues (if applicable):