Opened 8 years ago
Last modified 7 years ago
#38368 new enhancement
Add front-end revision browsing
Reported by: | 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.
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)
Change History (12)
This ticket was mentioned in Slack in #core-restapi by shelob9. View the logs.
8 years ago
This ticket was mentioned in Slack in #core by rachelbaker. View the logs.
8 years ago
#6
@
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
@
8 years ago
Two more concerns:
- The logic in
placeRevision
doesn't account for themes that have more thanthe_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
@
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
@
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 before yours out there that does anything similar? I ask as that would be good as a use case to see the demand for this. What has the feedback also been from your plugin?
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