[wp-trac] [WordPress Trac] #32273: TinyMCE results in lost data if post save fails and back button is clicked

WordPress Trac noreply at wordpress.org
Fri Jun 3 01:52:00 UTC 2016


#32273: TinyMCE results in lost data if post save fails and back button is clicked
-------------------------------+------------------------------
 Reporter:  archon810          |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  TinyMCE            |     Version:  4.2.1
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:  javascript
-------------------------------+------------------------------

Comment (by azaozz):

 Replying to [comment:4 archon810]:

 Right, not exact duplicate, just related. I've repeated the same steps:
 - Edit or create a post.
 - Trigger `wp_die()` on attempting to save or update it.
 - Press the Back button in the browser.

 At this point the last saved revision (or autosave) is loaded in the
 browser, and the "restore from the data in browser storage" notice is
 triggered.

 I'm not sure we can do anything more in WordPress to remedy this
 situation. Restoring from the backup in the browser works properly and
 brings the post content back.

 > We actually tried to change this otherwise ideal behavior to return
 admin_notices instead, thus saving the revision instead of wp_die()ing...

 This should work: when the post is being saved (as draft or published),
 you can block updating it in the DB, save it somewhere temporary (post-
 meta perhaps), then load the rejected post_content in the editor when the
 Edit Post page loads after the redirect, and delete the meta.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32273#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list