Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#22407 closed defect (bug) (fixed)

Undo and redo in TinyMCE are broken after deleting a view

Reported by: azaozz Owned by: koopersmith
Priority: low Milestone: 3.5
Component: Media Version: 3.5
Severity: normal Keywords:
Cc: Focuses:

Description

As the title. To reproduce:

  • Add an image or a gallery to a post using the Add Media button.
  • Click on it to select it and delete it (with the backspace or delete key).
  • Press Crtl+Z or click on the Undo button in the editor.

Attachments (1)

22407.patch (3.0 KB ) - added by azaozz 14 years ago.

Download all attachments as: .zip

Change History (5)

@azaozz
14 years ago

#1 @azaozz
14 years ago

22407.patch seems to work well (still includes some debug code for testing). It converts all views to their text mode before adding new undo level in TinyMCE and converts them back to dom nodes when doing redo.

In addition it adds another step when deleting a view, so deleting now does:

  • Convert the view to it's text.
  • Replace the view wrapper node with a temp span containing that text.
  • Run any 'delete' callbacks.
  • Remove the temp span keeping its content.
  • Cancel the undo level up to this point.
  • Delete the view's text (this is captured in the undo level).

This introduces quite a bit of overhead on adding new undo levels in TinyMCE (which happens pretty often, like on every new paragraph or on node changes), but seems to work well with contenteditable=false nodes.

#2 @azaozz
14 years ago

  • Keywords early added
  • Milestone 3.5Future Release
  • Priority highnormal
  • Severity blockernormal

Leaving for 3.6 after discussing in IRC.

#3 @koopersmith
14 years ago

  • Keywords early removed
  • Milestone Future Release3.5
  • Priority normallow

Moving back to 3.5 and grouping with the rest of the views tickets. When we take a crack at views in the future, we'll create and parcel out tickets from there.

#4 @koopersmith
14 years ago

  • Owner set to koopersmith
  • Resolutionfixed
  • Status newclosed

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.