From 240f3e73e5ea71631c0769a9020c63b45c0e8b4d Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Thu, 4 Oct 2018 11:48:49 -0400 Subject: [PATCH] Code style and documentation tweaks --- lib/client-assets.php | 1 + packages/components/src/modal/README.md | 12 ++++++------ .../src/components/post-locked-modal/index.js | 5 +---- packages/editor/src/store/reducer.js | 19 +++++++++++++++++++ 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/lib/client-assets.php b/lib/client-assets.php index 9ea6fdd7f2bc4..30ce013de655d 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -593,6 +593,7 @@ function gutenberg_register_scripts_and_styles() { 'wp-editor', gutenberg_url( 'build/editor/index.js' ), array( + 'jquery', 'lodash', 'tinymce-latest-lists', 'wp-a11y', diff --git a/packages/components/src/modal/README.md b/packages/components/src/modal/README.md index 85c141c602eed..13667139f8fec 100644 --- a/packages/components/src/modal/README.md +++ b/packages/components/src/modal/README.md @@ -24,7 +24,7 @@ const MyModal = withState( { - + : null } ) ); @@ -77,15 +77,15 @@ If this property is added, it will be added to the modal content `div` as `aria- If this property is true, it will focus the first tabbable element rendered in the modal. -- Type: `bool` +- Type: `boolean` - Required: No - Default: true ### shouldCloseOnEsc -If this property is added, it will determine whether the modal requests to close when the escape key is pressed. +If this property is added, it will determine whether the modal requests to close when the escape key is pressed. -- Type: `bool` +- Type: `boolean` - Required: No - Default: true @@ -93,7 +93,7 @@ If this property is added, it will determine whether the modal requests to close If this property is added, it will determine whether the modal requests to close when a mouse click occurs outside of the modal content. -- Type: `bool` +- Type: `boolean` - Required: No - Default: true @@ -101,7 +101,7 @@ If this property is added, it will determine whether the modal requests to close If this property is set to false, the modal will not display a close icon and cannot be dismissed. -- Type: `bool` +- Type: `boolean` - Required: No - Default: true diff --git a/packages/editor/src/components/post-locked-modal/index.js b/packages/editor/src/components/post-locked-modal/index.js index df421ea1dacf2..03e2bc2125e98 100644 --- a/packages/editor/src/components/post-locked-modal/index.js +++ b/packages/editor/src/components/post-locked-modal/index.js @@ -96,8 +96,6 @@ class PostLockedModal extends Component { /** * Unlock the post before the window is exited. - * - * @param {Object} event Event. */ releasePostLock() { const { isLocked, activePostLock, postLockUtils, postId } = this.props; @@ -125,6 +123,7 @@ class PostLockedModal extends Component { return null; } + /* translators: Fallback user name for the post lock message. */ const userDisplayName = user.name || __( 'Another user' ); const userAvatar = user.avatar; @@ -222,9 +221,7 @@ export default compose( updatePostLock, }; } ), - withGlobalEvents( { beforeunload: 'releasePostLock', } ) - )( PostLockedModal ); diff --git a/packages/editor/src/store/reducer.js b/packages/editor/src/store/reducer.js index 378c088dcf300..1bcfae88dab7b 100644 --- a/packages/editor/src/store/reducer.js +++ b/packages/editor/src/store/reducer.js @@ -885,6 +885,25 @@ export function notices( state = [], action ) { return state; } +/** + * Post Lock State. + * + * @typedef {Object} PostLockState + * + * @property {boolean} isLocked Whether the post is locked. + * @property {?boolean} isTakeover Whether the post editing has been taken over. + * @property {?boolean} activePostLock Active post lock value. + * @property {?Object} user User that took over the post. + */ + +/** + * Reducer returning the post lock status. + * + * @param {PostLockState} state Current state. + * @param {Object} action Dispatched action. + * + * @return {PostLockState} Updated state. + */ export function postLock( state = { isLocked: false }, action ) { switch ( action.type ) { case 'UPDATE_POST_LOCK':