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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this was added in 84c3ef1#diff-4eba09d3f5fecc9c57315952b11b3ab68a356d30e87314712467c7e8972ccaa1R232 (the same commit that added the rich text editor).
In the past, we've had bugs related to extra lines being added to the end of code and math regions when saving content in the Rich Text editor (e.g. #6822, #9589). Perhaps this was an attempted/partial fix for one of those issues?
That should be fine!
As there aren't any automated tests for this, I've manually verified that:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds great. I've also had a quick look at the issues you linked and tested those issues and verified that those issues are separate from the one this PR is aiming to fix, as the code block's onSubmit callback is not called when changing editors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes there was a problem before where newlines kept being added each time the dialog was closed, but maybe it's no longer happening. Let's merge for now and see if anyone finds any issue.