gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

"Return to editor" link is wrong when comparing revisions

Open GaryJones opened this issue 9 years ago • 7 comments

Edit by @aduth (2017-09-27): The original issue reported here has since been resolved, but behavior of "Return to editor" is still not always correct. See https://github.com/WordPress/gutenberg/issues/2808#issuecomment-332617564 for more details.


Issue Overview

"Return to editor" link (and post title link) is wrong when coming from Gutenberg editor.

Steps to Reproduce (for bugs)

  1. Save a post (can be draft or published), and then make edits and update, so WordPress has at least two revisions.
  2. Click the Revisions link in the Document inspector: screenshot 2017-09-27 10 48 35
  3. Now click the "Return to editor" link: screenshot 2017-09-27 10 46 49

Expected Behavior

I'd expect to go back to the Gutenberg editor.

Current Behavior

I end up in the normal editor: screenshot 2017-09-27 10 50 43

Possible Solution

Add a querystring argument to the "X revisions" link in Document inspector, and use that to conditionally filter the URL for the return to editor link (get_editor_post_link filter).

https://github.com/WordPress/WordPress/blob/dd6da701b286579819cd6aa518aa2d7018efd759/wp-admin/revision.php#L75-L78

GaryJones avatar Sep 27 '17 10:09 GaryJones

Are you running from the plugin version? I expect this is fixed by the get_edit_post_link filter introduced in #1797 , which will be included in the next plugin release. Testing myself, this seems to work correctly.

Closing, but please reopen if the issue is not resolved.

aduth avatar Sep 27 '17 11:09 aduth

Are you running from the plugin version?

Sorry - yes, I was (1.1.0).

I'll wait until 1.2.0 and give that a go.

GaryJones avatar Sep 27 '17 18:09 GaryJones

@GaryJones 1.2.0 was released today, if you want to try giving it another go.

aduth avatar Sep 27 '17 18:09 aduth

Testing with 1.2.1, and generally it works, though there is an edge case that it doesn't.

The commit in #1797 has this line which checks that the post has at least one block.

The edge case can therefore be triggered by:

  1. Select Gutenberg -> New Post.
  2. Add a title only.
  3. Save, and reload the page to see the Revisions link in the Document inspector.
  4. Click Revisions link, then the Return to editor link.

You'll end up back in the old editor.

Closing, but please reopen if the issue is not resolved.

I also apparently don't have the ability to re-open.

GaryJones avatar Sep 27 '17 18:09 GaryJones

Thanks for the detail @GaryJones . I've edited the original message with a pointer to the new steps, and will reopen.

aduth avatar Sep 27 '17 21:09 aduth

This is still happening in 1.5.2

mor10 avatar Oct 30 '17 18:10 mor10

It seems like this still hasen't been fixed yet. I am using WordPress 4.9.1 with Gutenberg 1.8.1. I am not able to restore a revision, it already produces an empty post.

See here: https://de.wordpress.org/support/topic/gutenberg-revisionen-wiederherstellen-fuehren-zu-leerem-beitrag-wie-loesen/

Any ideas on how to bring the content back? Hotfix would be a thing.

jacboy avatar Dec 05 '17 14:12 jacboy