-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: save lock control via actions #10649
Conversation
c69d86f
to
6db9774
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to consider the post lock for autosaving?
We should have unit tests for at least selectors and reducer.
You need to run and commit changed files from npm run docs:build
.
I don't think so, these should fire as usual. Autosaves protect the user from lost content.
I can add these, wanted to make sure approach was acceptable first.
Ah, ok will do. |
@aduth I have addressed your feedback and this is ready for review. |
All the changes look great.
Let's do that ☝️ We also need to start a new document with UI extensibility for the editor and provide some examples on how to use it in action. |
@aduth - I addressed your feedback. |
I'll work on some tests. |
Thanks @adamsilverstein, great to see we have it finally sorted out 🎉 |
I will open a follow-up with CHANGELOG update, I missed it. |
…rnmobile/merge-blocks-on-backspace * 'master' of https://github.com/WordPress/gutenberg: Do not add isDirty prop to DOM (#11093) Format API (#10209) Remove 4.2 deprecated features (#10952) Update `@wordpress/hooks` README to include namespace mention (#11061) Feature: save lock control via actions (#10649) Fix usage of `preg_quote()` (#10998) Update plugin version to 4.1.1 (#11078) Improve preloading request code (#11007) Fix dynamic blocks not rendering in the frontend (#11050) Media & Text: Fixing vertical alignment of the image (#11025) Date: Mark getSettings as experimental (#10636) Improve handling of centered 1-col galleries with small images (#11040) Use better help text for ALT text input; fixes #8391. (#11052) # Conflicts: # packages/editor/src/components/rich-text/index.native.js
@adamsilverstein We've had a few requests for documentation on this so I'm digging in to try to understand how this was implemented. One question I have is why was this implemented just as a save lock, vs separate publish and save locks? Just curious from a conceptual level. I have read the original ticket and the other related closed PRs, but still not sure I understand. |
@chrisvanpatten Any update on documentation for this? I have a theme that requires a featured image to be horizontal, and the hooks I used to handle the validation and error messaging for this do not work at all with Gutenberg. I think this "save locking" feature is what I'm looking for, but need some kind of documentation to implement. Any feedback would be helpful. Thanks! |
Does anyone have a working example of this save lock control action for a publish/update conditional? |
@chrisvanpatten missed this earlier. likely we chose this approach because this is how the buttons were already architected in regards to other conditionals. plugins should be able to control each button (publish vs update) individually still, happy to help with some example code here. |
Any update on documentation and/or example(s) for this? Can't seem to find anything here, on the codex, nor stack exchange. |
Happy to add some documentation, where should this go? |
Since this was merged, enhancements were made to the data documentation workflow, so we could include examples for actions (like the ones introduced here) using See also: |
Excellent, thanks for the tip. I'll work on it. |
Description
Add a post save locking feature. Plugins can add and remove locks and when any locks are present the publish and update buttons are disabled.
Supersedes #10115
Fixes #7020
How has this been tested?
Load gutenberg and make some edits. In the console, type:
wp.data.dispatch( 'core/editor' ).lockPostSaving( 'mylock' );
Note: the publish or update button becomes disabled.
Remove the post lock with:
wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' );
Types of changes
Checklist: