FEATURE: always insert images on new lines and add newline after (PR #12895)

GitHub

The title of this pull request changed from “FEATURE: always insert images as separate paragraphs” to "FEATURE: always insert images on new lines and add newline after

Looks good but let’s merge after new beta is cut.

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

you could just do:

return textArea.value.charAt(selectionStart - 1) === "\n";

at the end

Or

return selectionStart === 0 || textArea.value.charAt(selectionStart - 1) === "\n";

instead of the whole if / else if / else block :wink:

Since it’s already merged I guess it’s better not to spam now with a commit that contains refactoring only?

But I will be writing such conditions shorter since we prefer this style.

It’s fine to leave it as is. I personally don’t mind.