-
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
Enable post locking in Gutenberg #4217
Conversation
Closing in favor of #4218 which builds on this and adds heartbeat based autosaves as well. |
Reopening to work on standalone post locking since we took a different route with autosaves. |
# Conflicts: # editor/index.js
# Conflicts: # edit-post/index.js
# Conflicts: # packages/editor/src/store/reducer.js
/** | ||
* External dependencies | ||
*/ | ||
import jQuery from 'jquery'; |
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.
We should add
jquery
as a dependency of thewp-editor
script
This still needs to be done.
updatePostLock, | ||
}; | ||
} ), | ||
|
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.
We're inconsistent with newlines between these members of the array. I'd recommend omitting them for broader consistency with the project.
1e140a0
to
240f3e7
Compare
Looks good to me. Thanks for all the hard work. |
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.
Added i18n feedback, which I'll address right now. (By typing it out I can refer to it later.)
Thanks for the hard work everyone. Now it's in we can enhance it with API endpoints at a more reasonable pace :) |
Is this tracked as an issue somewhere I can follow? |
|
// https://developer.wordpress.org/plugins/javascript/heartbeat-api/ | ||
jQuery( document ) | ||
.on( 'heartbeat-send.refresh-lock', this.sendPostLock ) | ||
.on( 'heartbeat-tick.refresh-lock', this.receivePostLock ); |
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.
@adamsilverstein is there a reason we need to rely on jQuery
here? could we have gotten by with addEventListener()
(and for IE attachEvent
)?
given the assumption that WordPress is already loaded jQuery
seems free, but for external uses these few lines can pull in a huge dependency
thoughts?
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.
We should do similar as to what was done in #8311 as a short-term solution.
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.
In fact, at least for the heartbeat-tick
event, we should already have the action provided through #8311.
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.
Pull request at #11781
Description
Enable the post locking feature in gutenberg:
Fixes #4331
uses the existing core code, slightly refactored to pass Gutenberg linting.How Has This Been Tested?
Screenshots (jpeg or gifs if applicable):
Types of changes
setupHearthbeat
Checklist: