[wp-trac] [WordPress Trac] #28037: Editor merges paragraphs when post edit screen is accessed by pressing browser's back button
WordPress Trac
noreply at wordpress.org
Tue Jul 29 22:49:33 UTC 2014
#28037: Editor merges paragraphs when post edit screen is accessed by pressing
browser's back button
--------------------------+-----------------------------------------
Reporter: dbernar1 | Owner: azaozz
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: 4.0
Component: Editor | Version: trunk
Severity: normal | Resolution:
Keywords: | Focuses: javascript, administration
--------------------------+-----------------------------------------
Comment (by azaozz):
Replying to [comment:12 DrewAPicture]:
Re-testing the patch, it still seems to work in all the WebKit browsers I
have access to (latest "desktop" Chrome and Safari, iOS7.1 Chrome and
Safari, Android KitKat). However it is a "dangerous" thing to do.
There is no way to detect if the page is being loaded because the user
clicked the Back or Forward button, so that code has to run on every
TinyMCE init. The risk is that some old(er) or "obscure" versions of
WebKit based browsers may not work properly when replacing
`textarea.value` with `textarea.textContent`. That could make the editor
completely unusable.
Replying to [comment:10 avryl]:
This is possible in theory, however passing the content through wpautop()
twice may break it in some cases. So we will have to determine if the
content was passed through wpautop() first. As far as I see such test may
not be 100% accurate.
IMHO the best change that will also fix this is to always load the
post_content before is was filtered with wpautop(), i.e. ditch
`wp_richedit_pre()` completely and only use `wp_htmledit_pre()`. Then add
another `'BeforeSetContent'` in the 'wordpress' plugin that will run the
content through the JS wpautop() before it is loaded in MCE.
Been thinking about doing this (and testing it) few times in the past. It
works well however may bring some back-compat issues. Can probably try it
in 4.1?
For now I think the safest option is to set `autocomplete="off"` on the
whole form in all WebKit browsers. This works well but would prevent
autocomplete for all fields, including all metaboxes added by plugins.
There will likely be some unhappy users because of this. So the question
is: what is more important, maintain the editor content when the user
clicks the Back button or have autocomplete for metaboxes?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28037#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list