Skip to content

Commit

Permalink
Code style and documentation tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Oct 4, 2018
1 parent 6bc1196 commit 240f3e7
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
1 change: 1 addition & 0 deletions lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
12 changes: 6 additions & 6 deletions packages/components/src/modal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const MyModal = withState( {
<Button isDefault onClick={ () => setState( { isOpen: false } ) }>
My custom close button
</Button>
</Modal>
</Modal>
: null }
</div>
) );
Expand Down Expand Up @@ -77,31 +77,31 @@ 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

### shouldCloseOnClickOutside

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

### isDismissable

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

Expand Down
5 changes: 1 addition & 4 deletions packages/editor/src/components/post-locked-modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -222,9 +221,7 @@ export default compose(
updatePostLock,
};
} ),

withGlobalEvents( {
beforeunload: 'releasePostLock',
} )

)( PostLockedModal );
19 changes: 19 additions & 0 deletions packages/editor/src/store/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down

0 comments on commit 240f3e7

Please sign in to comment.