@@ -320,6 +320,25 @@ unsaved status values.
320320
321321Whether the post has been published.
322322
323+ ### getBlockDependantsCacheBust
324+
325+ Returns a new reference when the inner blocks of a given block client ID
326+ change. This is used exclusively as a memoized selector dependant, relying
327+ on this selector's shared return value and recursively those of its inner
328+ blocks defined as dependencies. This abuses mechanics of the selector
329+ memoization to return from the original selector function only when
330+ dependants change.
331+
332+ * Parameters*
333+
334+ * state: Editor state.
335+ * clientId: Block client ID.
336+
337+ * Returns*
338+
339+ A value whose reference will change only when inner blocks of
340+ the given block client ID change.
341+
323342### getBlockName
324343
325344Returns a block's name given its client ID, or null if no block exists with
@@ -334,6 +353,80 @@ the client ID.
334353
335354Block name.
336355
356+ ### getBlock
357+
358+ Returns a block given its client ID. This is a parsed copy of the block,
359+ containing its ` blockName ` , ` clientId ` , and current ` attributes ` state. This
360+ is not the block's registration settings, which must be retrieved from the
361+ blocks module registration store.
362+
363+ * Parameters*
364+
365+ * state: Editor state.
366+ * clientId: Block client ID.
367+
368+ * Returns*
369+
370+ Parsed block object.
371+
372+ ### getBlocks
373+
374+ Returns all block objects for the current post being edited as an array in
375+ the order they appear in the post.
376+
377+ Note: It's important to memoize this selector to avoid return a new instance
378+ on each call
379+
380+ * Parameters*
381+
382+ * state: Editor state.
383+ * rootClientId: Optional root client ID of block list.
384+
385+ * Returns*
386+
387+ Post blocks.
388+
389+ ### getClientIdsWithDescendants
390+
391+ Returns an array containing the clientIds of the top-level blocks
392+ and their descendants of any depth (for nested blocks).
393+
394+ * Parameters*
395+
396+ * state: Global application state.
397+
398+ * Returns*
399+
400+ ids of top-level and descendant blocks.
401+
402+ ### getGlobalBlockCount
403+
404+ Returns the total number of blocks, or the total number of blocks with a specific name in a post.
405+ The number returned includes nested blocks.
406+
407+ * Parameters*
408+
409+ * state: Global application state.
410+ * blockName: Optional block name, if specified only blocks of that type will be counted.
411+
412+ * Returns*
413+
414+ Number of blocks in the post, or number of blocks with name equal to blockName.
415+
416+ ### getBlocksByClientId
417+
418+ Given an array of block client IDs, returns the corresponding array of block
419+ objects.
420+
421+ * Parameters*
422+
423+ * state: Editor state.
424+ * clientIds: Client IDs for which blocks are to be returned.
425+
426+ * Returns*
427+
428+ Block objects.
429+
337430### getBlockCount
338431
339432Returns the number of blocks currently present in the post.
@@ -503,6 +596,32 @@ This position is to used to position the caret properly when the selected block
503596
504597Selected block.
505598
599+ ### getMultiSelectedBlockClientIds
600+
601+ Returns the current multi-selection set of block client IDs, or an empty
602+ array if there is no multi-selection.
603+
604+ * Parameters*
605+
606+ * state: Editor state.
607+
608+ * Returns*
609+
610+ Multi-selected block client IDs.
611+
612+ ### getMultiSelectedBlocks
613+
614+ Returns the current multi-selection set of blocks, or an empty array if
615+ there is no multi-selection.
616+
617+ * Parameters*
618+
619+ * state: Editor state.
620+
621+ * Returns*
622+
623+ Multi-selected block objects.
624+
506625### getFirstMultiSelectedBlockClientId
507626
508627Returns the client ID of the first block in the multi-selection set, or null
@@ -558,6 +677,21 @@ false otherwise.
558677
559678Whether block is in multi-selection set.
560679
680+ ### isAncestorMultiSelected
681+
682+ Returns true if an ancestor of the block is multi-selected, or false
683+ otherwise.
684+
685+ * Parameters*
686+
687+ * state: Editor state.
688+ * clientId: Block client ID.
689+
690+ * Returns*
691+
692+ Whether an ancestor of the block is in multi-selection
693+ set.
694+
561695### getMultiSelectedBlocksStartClientId
562696
563697Returns the client ID of the block which begins the multi-selection set, or
@@ -855,6 +989,19 @@ default post format. Returns null if the format cannot be determined.
855989
856990Suggested post format.
857991
992+ ### getEditedPostContent
993+
994+ Returns the content of the post being edited, preferring raw string edit
995+ before falling back to serialization of block state.
996+
997+ * Parameters*
998+
999+ * state: Global application state.
1000+
1001+ * Returns*
1002+
1003+ Post content.
1004+
8581005### getNotices
8591006
8601007Returns the user notices array.
@@ -867,6 +1014,67 @@ Returns the user notices array.
8671014
8681015List of notices.
8691016
1017+ ### canInsertBlockType
1018+
1019+ Determines if the given block type is allowed to be inserted, and, if
1020+ parentClientId is provided, whether it is allowed to be nested within the
1021+ given parent.
1022+
1023+ * Parameters*
1024+
1025+ * state: Editor state.
1026+ * blockName: The name of the given block type, e.g.
1027+ 'core/paragraph'.
1028+ * parentClientId: The parent that the given block is to be
1029+ nested within, or null.
1030+
1031+ * Returns*
1032+
1033+ Whether the given block type is allowed to be inserted.
1034+
1035+ ### getInserterItems
1036+
1037+ Determines the items that appear in the inserter. Includes both static
1038+ items (e.g. a regular block type) and dynamic items (e.g. a reusable block).
1039+
1040+ Each item object contains what's necessary to display a button in the
1041+ inserter and handle its selection.
1042+
1043+ The 'utility' property indicates how useful we think an item will be to the
1044+ user. There are 4 levels of utility:
1045+
1046+ 1 . Blocks that are contextually useful (utility = 3)
1047+ 2 . Blocks that have been previously inserted (utility = 2)
1048+ 3 . Blocks that are in the common category (utility = 1)
1049+ 4 . All other blocks (utility = 0)
1050+
1051+ The 'frecency' property is a heuristic (https://en.wikipedia.org/wiki/Frecency )
1052+ that combines block usage frequenty and recency.
1053+
1054+ Items are returned ordered descendingly by their 'utility' and 'frecency'.
1055+
1056+ * Parameters*
1057+
1058+ * state: Editor state.
1059+ * parentClientId: The block we are inserting into, if any.
1060+
1061+ * Returns*
1062+
1063+ Items that appear in inserter.
1064+
1065+ ### getReusableBlock
1066+
1067+ Returns the reusable block with the given ID.
1068+
1069+ * Parameters*
1070+
1071+ * state: Global application state.
1072+ * ref: The reusable block's ID.
1073+
1074+ * Returns*
1075+
1076+ The reusable block, or null if none exists.
1077+
8701078### isSavingReusableBlock
8711079
8721080Returns whether or not the reusable block with the given ID is being saved.
@@ -1411,4 +1619,4 @@ Returns an action object used in signalling that the editor settings have been u
14111619
14121620* Parameters*
14131621
1414- * settings: Updated settings
1622+ * settings: Updated settings
0 commit comments