Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#22155 closed defect (bug) (fixed)

Images disappear when autosave fires in distraction free mode

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


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 12 years ago.
Fix for 22155
22155.diff (1.7 KB) - added by duck_ 12 years ago.

Download all attachments as: .zip

Change History (13)

#1 @johnbillion
12 years ago

  • Version set to trunk

#2 @nacin
12 years ago

  • Milestone changed from Awaiting Review to 3.5

12 years ago

Fix for 22155

#3 @dannydehaan
12 years 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.

#4 @dannydehaan
12 years ago

  • Keywords reporter-feedback added

#5 @SergeyBiryukov
12 years ago

  • Keywords dev-feedback added; reporter-feedback removed

#6 @duck_
12 years 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.

12 years ago

#7 @duck_
12 years 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 12 years ago by duck_ (previous) (diff)

#8 @nacin
12 years ago

  • Priority changed from normal to high

#9 @nacin
12 years ago

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

#10 @nacin
12 years ago

  • Priority changed from high to low

#11 @koopersmith
12 years 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.