Try: Show a success message when restoring a revision - #20349
Closed
johnwatkins0 wants to merge 6 commits into
Closed
johnwatkins0 wants to merge 6 commits into
johnwatkins0 wants to merge 6 commits into
Conversation
|
Size Change: +106 B (0%) Total Size: 825 kB
ℹ️ View Unchanged
|
johnwatkins0
force-pushed
the
try/19226-restore-revision-success-message
branch
from
May 3, 2020 15:59
9301f39 to
e55b740
Compare
johnwatkins0
commented
May 3, 2020
| "@wordpress/keycodes": "file:../keycodes", | ||
| "@wordpress/priority-queue": "file:../priority-queue", | ||
| "@wordpress/rich-text": "file:../rich-text", | ||
| "@wordpress/shortcode": "file:../shortcode", |
Member
Author
There was a problem hiding this comment.
Merging latest master, got this ESLint error for a file in block-editor:
42:1 error '@wordpress/shortcode' should be listed in the project's dependencies. Run 'npm i -S @wordpress/shortcode' to add it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This would resolve #19226 by showing a success message when a post is restored from a revision:
The challenge with this task is that restoring revisions is not part of what the editor does; revisions are a different UI on a separate page, and the revision is restored server-side before sending the user back to the editor. At this point the only indication that a post is a revision is this URL parameter:
So I see two possible approaches:
initializeEditor, and use this to trigger the notice on loadI went with 2, but this could be adapted for 1. I didn't see any instances of URL parameters being read currently in the editor, so I figured a decision had been made at an earlier point not to do that. We do have the tools to do it, though. Perhaps the
BrowserURLcomponent could be given exclusive unofficial permission to read URL parameters; it could read the URL parameter, remove it, and dispatch a bit of state to trigger the notice. I'd love to try that if people are in favor of it.As this stands now, I'd need to also submit (roughly) the following update to
edit-form-blocks.phpin core. The update could be merged here without the core update in place.Alternative approaches
Aside from maybe handling this entirely in the plugin, I think we could generalize this if we think being able to show other types of snackbar messages on pageload might be useful.
How has this been tested?
revisionNoticeinedit-post/src/editor.js.Types of changes
New feature that will not break existing functionality.
Checklist: