Skip to content

Commit

Permalink
Adding JSDoc for the parents selector
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Oct 23, 2019
1 parent 86ac1e8 commit 78b3925
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,16 @@ _Returns_

<a name="getBlockParents" href="#getBlockParents">#</a> **getBlockParents**

Undocumented declaration.
Given a block client ID, returns the list of all its parents.

_Parameters_

- _state_ `Object`: Editor state.
- _clientId_ `string`: Block from which to find root client ID.

_Returns_

- `Array`: ClientIDs of the parent blocks.

<a name="getBlockRootClientId" href="#getBlockRootClientId">#</a> **getBlockRootClientId**

Expand Down
8 changes: 8 additions & 0 deletions packages/block-editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,14 @@ export function getBlockRootClientId( state, clientId ) {
null;
}

/**
* Given a block client ID, returns the list of all its parents.
*
* @param {Object} state Editor state.
* @param {string} clientId Block from which to find root client ID.
*
* @return {Array} ClientIDs of the parent blocks.
*/
export const getBlockParents = createSelector(
( state, clientId ) => {
const parents = [];
Expand Down

0 comments on commit 78b3925

Please sign in to comment.