WordPress.org

Make WordPress Core

#22155 closed defect (bug) (fixed)

Images disappear when autosave fires in distraction free mode

Reported by: johnbillion Owned by: koopersmith
Milestone: 3.5 Priority: low
Severity: blocker Version: 3.5
Component: Editor Keywords: has-patch needs-testing dev-feedback
Focuses: Cc:

Description

Reporting this to see if anyone else can reproduce. Images inserted into posts disappear when autosave kicks in in distraction free writing mode. The images aren't removed, they just disappear visually. Switching out of distraction free writing mode and the images re-appear.

I'm on r22166, Chrome 22 on Win7.

Attachments (2)

22155.patch (541 bytes) - added by dannydehaan 21 months ago.
Fix for 22155
22155.diff (1.7 KB) - added by duck_ 21 months ago.

Download all attachments as: .zip

Change History (13)

comment:1 johnbillion21 months ago

  • Version set to trunk

comment:2 nacin21 months ago

  • Milestone changed from Awaiting Review to 3.5

dannydehaan21 months ago

Fix for 22155

comment:3 dannydehaan21 months ago

  • Keywords has-patch needs-testing added

I've made a patch for this problem. The script was getting RAW data from the TinyMCE and putting RAW data into the editor. I changed this to HTML and it looks like it works perfectly.

comment:4 dannydehaan21 months ago

  • Keywords reporter-feedback added

comment:5 SergeyBiryukov21 months ago

  • Keywords dev-feedback added; reporter-feedback removed

comment:6 duck_21 months ago

When wp.mce.view.render() is triggered by the onSetContent event the view wrappers in the standard editor have the same IDs as those in the fullscreen editor (they were just copied over). This means that the view instance used is the same one being used in the fullscreen editor and so when its el is detached and appended to the wrapper in the standard editor it is removed from view.

Switching to the HTML format works because wp.mce.view.toViews() will create new view instances (since the view patterns now match the content being set) which will be used by render(). However, are there any issues concerning ballooning the number of views? For example, I know that each autosave would trigger another get-attachment ajax request for each attachment.

A related issue is seen when closing DFW: all images and galleries can be seen to disappear before the rest of the fullscreen editor fades out. See wpFullScreenSave in wpfullscreen/editor_plugin_src.js.

duck_21 months ago

comment:7 duck_21 months ago

22155.diff uses the defaults for getContent()/setContent() (which is 'html').

Review from koop is required to check:

  • That _.defer() is the best thing to do
  • That garbage collection of view instances is happening
Version 0, edited 21 months ago by duck_ (next)

comment:8 nacin20 months ago

  • Priority changed from normal to high

comment:9 nacin20 months ago

Removing views, see #21813 (comment 30), should resolve this for 3.5.

comment:10 nacin20 months ago

  • Priority changed from high to low

comment:11 koopersmith20 months ago

  • Owner set to koopersmith
  • Resolution set to fixed
  • Status changed from new to closed

In 22567:

Media: Restore 3.4 editor behavior and remove TinyMCE views.

  • Reactivates the wpgallery and wpeditimage TinyMCE plugins. Deactivates the wpviews TinyMCE plugin.
  • Moves still-relevant logic from mce-views.js to media-upload.js and shortcode.js.
  • No longer include wp-includes/js/mce-views.js. This code will not be used in 3.5, and should be considered unstable.
  • Currently, this is the real 3.4 experience; as such, editing triggers the old modals. Changing this is the next major step.

When reassessing views, we should look over all of these tickets and anticipate these bugs accordingly.

fixes #21813, #22123, #22155, #22161, #22257, #22266, #22318, #22407, see #21390.

Note: See TracTickets for help on using tickets.