wohali: photograph of Joan (Default)
wohali ([personal profile] wohali) wrote in [site community profile] dw_dev 2016-10-03 10:31 pm (UTC)

So here's the two issues with what you've said as I see it.

When someone goes from RTE to HTML mode, without special handling by the HTML writer code, all newlines are purged, semantic or not.. This is why I immediately have to convert all newlines to br tags the instant someone transitions from HTML to RTE mode - this protects the semantic newlines by transforming them into tags.

This is also why the box gets checked the instant you move into RTE mode. Because we insert non-original newlines when going back from RTE to HTML mode, if we preserve the state of your checkbox when returning to HTML mode, you'll get newlines where you don't expect them, say around newly-inserted paragraph or div tags. So sure, I can preserve the state of your checkbox but if you roundtrip HTML->RTE->HTML, leaving the checkbox unchecked upon submission will corrupt the result of the output as well.

If we shifted to double-new-lines as paragraph markers, I could preserve the state of the checkbox and we'd be ok, because the HTML writer would never insert two linebreaks in a row; these would only ever be represented by br tags, which I could reverse-translate back into double newlines if desired. But this only works if we change the standard.

But things are not all sunshine and roses with a double-newline-as-br standard. Remember that the DW backend preserves any newlines in entries verbatim and converts them at render time to newlines if the checkbox is not ticked, which is why submitting text with newlines in it in raw/HTML mode with the checkbox checked will preserve those newlines in rendered posts. We could have the new RTE default be to convert double-new-lines to paragraphs, but we'd probably want to still save the post with the checkbox ticked and double-newlines converted to br tags, meaning the backend's auto-newline-to-br-tag processing would never be triggered and the RTE itself would be responsible for ensuring proper HTML is saved into the backend. (We can't change the backend's linebreak processing without breaking the rendering of thousands (millions?) of old posts.)

This is a bit of a braindump, so if anything is unclear please ask away.

Post a comment in response:

From:
Anonymous
OpenID
Identity URL: 
User
Account name:
Password:
If you don't have an account you can create one now.
Subject:
HTML doesn't work in the subject.

Message:

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org


 
Notice: This account is set to log the IP addresses of everyone who comments.
Links will be displayed as unclickable URLs to help prevent spam.