File tree Expand file tree Collapse file tree 3 files changed +40
-5
lines changed
types/wordpress__block-editor Expand file tree Collapse file tree 3 files changed +40
-5
lines changed Original file line number Diff line number Diff line change 11{
22 "private" : true ,
33 "name" : " @types/wordpress__block-editor" ,
4- "version" : " 11.5 .9999" ,
4+ "version" : " 14.21 .9999" ,
55 "projects" : [
66 " https://github.com/WordPress/gutenberg/tree/master/packages/block-editor/README.md"
77 ],
88 "dependencies" : {
99 "@types/react" : " ^18" ,
1010 "@types/wordpress__blocks" : " *" ,
11- "@wordpress/components" : " ^27.2 .0" ,
12- "@wordpress/data" : " ^9.13 .0" ,
13- "@wordpress/element" : " ^5.0 .0" ,
14- "@wordpress/keycodes" : " ^3.54 .0" ,
11+ "@wordpress/components" : " ^29.12 .0" ,
12+ "@wordpress/data" : " ^10.26 .0" ,
13+ "@wordpress/element" : " ^6.26 .0" ,
14+ "@wordpress/keycodes" : " ^4.26 .0" ,
1515 "react-autosize-textarea" : " ^7.1.0"
1616 },
1717 "devDependencies" : {
2929 {
3030 "name" : " Dennis Snell" ,
3131 "githubUsername" : " dmsnell"
32+ },
33+ {
34+ "name" : " Joshua Lipstone" ,
35+ "githubUsername" : " joshualip-plaudit"
3236 }
3337 ]
3438}
Original file line number Diff line number Diff line change @@ -118,6 +118,31 @@ export function getBlockName(clientId: string): string | null;
118118 */
119119export function getBlockOrder ( rootClientId ?: string ) : string [ ] ;
120120
121+ /**
122+ * Returns a block's parents' client IDs given its client ID
123+ *
124+ * @param clientId - Block client ID.
125+ * @param ascending - If true, the client ids will be returned from closest to farthest instead of the default of farthest to closest
126+ *
127+ * @returns The client IDs of all parent blocks
128+ */
129+ export function getBlockParents ( clientId : string , ascending ?: boolean ) : string [ ] ;
130+
131+ /**
132+ * Returns a block's parents' client IDs given its client ID pre-filtered to only include blocks with the passed blockNames
133+ *
134+ * @param clientId - Block client ID.
135+ * @param blockName - the name or names of the block types to which the parents list should be filtered
136+ * @param ascending - If true, the client ids will be returned from closest to farthest instead of the default of farthest to closest
137+ *
138+ * @returns The client IDs of all parent blocks filtered by the passed block name or names
139+ */
140+ export function getBlockParentsByBlockName (
141+ clientId : string ,
142+ blockName : string | string [ ] ,
143+ ascending ?: boolean ,
144+ ) : string [ ] ;
145+
121146/**
122147 * Given a block client ID, returns the root block from which the block is nested, an empty string
123148 * for top-level blocks, or `null` if the block does not exist.
Original file line number Diff line number Diff line change @@ -566,6 +566,12 @@ select("core/block-editor").getAdjacentBlockClientId("foo");
566566select ( "core/block-editor" ) . getAdjacentBlockClientId ( "foo" , - 1 ) ;
567567select ( "core/block-editor" ) . getAdjacentBlockClientId ( "foo" , 1 ) ;
568568
569+ // $ExpectType string[]
570+ select ( "core/block-editor" ) . getBlockParents ( "foo" ) ;
571+ select ( "core/block-editor" ) . getBlockParentsByBlockName ( "foo" , [ "core/query" ] ) ;
572+ select ( "core/block-editor" ) . getBlockParents ( "foo" , true ) ;
573+ select ( "core/block-editor" ) . getBlockParentsByBlockName ( "foo" , [ "core/query" ] , true ) ;
574+
569575{
570576 const blockProps : UseBlockProps . Merged & UseBlockProps . Reserved = be . useBlockProps ( ) ;
571577 blockProps ;
You can’t perform that action at this time.
0 commit comments