-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Editor: Reimplement select previous/next as independent controls (#13924
) * Block Editor: Reimplement removeBlocks previous selection as control * Editor: Reimplement select previous/next as independent controls * Refactor controls to actions * Editor: Pass initialPosition in selectPreviousBlock * Editor: Rename storeKey to storeName
- Loading branch information
1 parent
74b0fec
commit 9d08001
Showing
6 changed files
with
135 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { createRegistryControl } from '@wordpress/data'; | ||
|
||
/** | ||
* Calls a selector using the current state. | ||
* | ||
* @param {string} storeName Store name. | ||
* @param {string} selectorName Selector name. | ||
* @param {Array} args Selector arguments. | ||
* | ||
* @return {Object} control descriptor. | ||
*/ | ||
export function select( storeName, selectorName, ...args ) { | ||
return { | ||
type: 'SELECT', | ||
storeName, | ||
selectorName, | ||
args, | ||
}; | ||
} | ||
|
||
const controls = { | ||
SELECT: createRegistryControl( ( registry ) => ( { storeName, selectorName, args } ) => { | ||
return registry.select( storeName )[ selectorName ]( ...args ); | ||
} ), | ||
}; | ||
|
||
export default controls; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters