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.
We should add
jqueryas a dependency of thewp-editorscript
This still needs to be done.
| updatePostLock, | ||
| }; | ||
| } ), | ||
|
|
There was a problem hiding this comment.
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. |
mcsf
left a comment
There was a problem hiding this comment.
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.
@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.
We should do similar as to what was done in #8311 as a short-term solution.
There was a problem hiding this comment.
In fact, at least for the heartbeat-tick event, we should already have the action provided through #8311.
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
setupHearthbeatChecklist: