Opened 7 months ago

Closed 6 months ago

#22155 closed defect (bug) (fixed)

Images disappear when autosave fires in distraction free mode

Reported by: johnbillion Owned by: koopersmith
Priority: low Milestone: 3.5
Component: Editor Version: 3.5
Severity: blocker Keywords: has-patch needs-testing dev-feedback
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 7 months ago.
Fix for 22155
22155.diff (1.7 KB) - added by duck_ 7 months ago.

Download all attachments as: .zip

Change History (13)

  • Version set to trunk
  • Milestone changed from Awaiting Review to 3.5

Fix for 22155

  • 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.

  • Keywords reporter-feedback added
  • Keywords dev-feedback added; reporter-feedback removed

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_7 months ago

22155.diff uses the defaults for getContent()/setContent() (which is 'html') and only performs get-attachment AJAX requests when necessary.

Review from koop is required to check:

  • That _.defer() is the best thing to do
  • That garbage collection of view instances is happening
Last edited 7 months ago by duck_ (previous) (diff)
  • Priority changed from normal to high

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

  • Priority changed from high to low
  • 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.