Make WordPress Core

Opened 8 years ago

Last modified 6 years ago

#38368 new enhancement

Add front-end revision browsing

Reported by: shelob9's profile Shelob9 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Revisions Keywords:
Focuses: ui, rest-api Cc:

Description

This patch will add a live-updating revision browser to single post view when the current user can edit posts.

This feature requires the post and post revision routes of the WordPress REST API, as well as the JavaScript client for the REST API.

Here is demo of this patch:
https://github.com/Shelob9/revisions-browser/blob/master/CvIKaDdWcAAtRSa.gif

Currently this is a functional prototype, as a plugin -- https://github.com/Shelob9/revisions-browser -- prepared by myself with guidance from @adamsilverstein and contributions from @mrahmadawais + @websupporter + @kadamwhite + @circlecube

Attachments (1)

38368.diff (7.1 KB) - added by Shelob9 8 years ago.
Patch from https://github.com/WordPress/WordPress/pull/248

Download all attachments as: .zip

Change History (12)

#1 @Shelob9
8 years ago

  • Component changed from General to REST API

This ticket was mentioned in Slack in #core-restapi by shelob9. View the logs.


8 years ago

#3 @westonruter
8 years ago

Actually, this wouldn't depend on the REST API. An alternate implementation can be powered by customizer (even on frontend) with changesets, selective refresh, and a WP_Customize_Post_Setting (from Customize Posts). See #31088 and https://github.com/xwp/wp-customize-posts/issues/17

#4 @Shelob9
8 years ago

Some feedback on UI via twitter started by @markjaquith :

https://i.imgur.com/w7qTJeHl.png

I agree with Mark that hiding previous and next is odd. I will refresh to make them unlcickable or something instead.

@mrahmadawais and I discussed arrows, but felt it didn't match core UI, but we could be wrong.

This ticket was mentioned in Slack in #core by rachelbaker. View the logs.


8 years ago

#6 @westonruter
8 years ago

I also want to mention that Selective Refresh in the customizer has JS hooks that themes and plugins can use for ensuring that any dynamic content elements will get set up properly when refreshed. Consider content that has emoji, media elements, and other elements that need JavaScript initialization. Selective Refresh also already has the construct for associating an a partial (e.g. title or content) with a given selector. Just want to avoid reinventing the wheel for something that already exists.

#7 @westonruter
8 years ago

Two more concerns:

  • The logic in placeRevision doesn't account for themes that have more than the_content() in the .entry-content element. Twenty Sixteen also includes the author bio here.
  • Using the content as rendered by the REST API will not account for shortcodes that contain content that is contextual based on where the post/page appears on the site. Since the REST API call is stateless, it won't render knowing if the content is to appear on the homepage, on an archive, or on a singular template. This may not be specifically a concern here if the intention is for the revisions to only be viewable on the singular template, but it seems ideal if the revisions could be viewed anywhere the post appears on a site.

Sorry to keep harping on this, but these are all challenges we've been working hard on in the customizer with changesets, selective refresh, and the Customize Posts feature plugin.

I think there definitely is a place for using the REST API here, and that is to get the raw data. The responsibility to render the data, however, I feel should be left to the customizer.

#8 @mrahmadawais
8 years ago

Following the conversation before jumping back into the code. @Shelob9 where do we stand with this now? I think not everyone needs this, so there should also be an option to enable it whereas it should come disabled by default.
Looking forward!

#9 @karmatosed
8 years ago

I can see some use cases for this, but tend to agree that I don't think everyone would need this functionality. If that's enough people, then it seems a good idea. Is there a plugin out there that does anything similar? I ask as that would be good as a use case to see the demand for this.

Version 0, edited 8 years ago by karmatosed (next)

#10 @ocean90
8 years ago

  • Component changed from REST API to Revisions
  • Focuses rest-api added
Note: See TracTickets for help on using tickets.