@wordpress/block-editor 12.3.4 → 12.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +4 -0
  2. package/build/components/block-edit/edit.js +25 -13
  3. package/build/components/block-edit/edit.js.map +1 -1
  4. package/build/components/block-parent-selector/index.js +8 -5
  5. package/build/components/block-parent-selector/index.js.map +1 -1
  6. package/build/components/block-removal-warning-modal/index.js +4 -1
  7. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  8. package/build/components/block-tools/block-contextual-toolbar.js +7 -11
  9. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  10. package/build/components/index.js +10 -1
  11. package/build/components/index.js.map +1 -1
  12. package/build/components/inserter/reusable-block-rename-hint.js +62 -0
  13. package/build/components/inserter/reusable-block-rename-hint.js.map +1 -0
  14. package/build/components/inserter/reusable-blocks-tab.js +5 -1
  15. package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
  16. package/build/components/list-view/use-list-view-client-ids.js +2 -2
  17. package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
  18. package/build/store/private-selectors.js +5 -6
  19. package/build/store/private-selectors.js.map +1 -1
  20. package/build/store/selectors.js +6 -4
  21. package/build/store/selectors.js.map +1 -1
  22. package/build-module/components/block-edit/edit.js +27 -10
  23. package/build-module/components/block-edit/edit.js.map +1 -1
  24. package/build-module/components/block-parent-selector/index.js +7 -5
  25. package/build-module/components/block-parent-selector/index.js.map +1 -1
  26. package/build-module/components/block-removal-warning-modal/index.js +4 -1
  27. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  28. package/build-module/components/block-tools/block-contextual-toolbar.js +8 -11
  29. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  30. package/build-module/components/index.js +5 -0
  31. package/build-module/components/index.js.map +1 -1
  32. package/build-module/components/inserter/reusable-block-rename-hint.js +48 -0
  33. package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -0
  34. package/build-module/components/inserter/reusable-blocks-tab.js +4 -1
  35. package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
  36. package/build-module/components/list-view/use-list-view-client-ids.js +2 -2
  37. package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
  38. package/build-module/store/private-selectors.js +3 -3
  39. package/build-module/store/private-selectors.js.map +1 -1
  40. package/build-module/store/selectors.js +6 -4
  41. package/build-module/store/selectors.js.map +1 -1
  42. package/build-style/style-rtl.css +71 -20
  43. package/build-style/style.css +71 -20
  44. package/package.json +9 -9
  45. package/src/components/block-edit/edit.js +26 -9
  46. package/src/components/block-edit/test/edit.js +1 -1
  47. package/src/components/block-parent-selector/index.js +13 -8
  48. package/src/components/block-removal-warning-modal/index.js +3 -0
  49. package/src/components/block-tools/block-contextual-toolbar.js +5 -11
  50. package/src/components/block-tools/style.scss +69 -26
  51. package/src/components/index.js +5 -0
  52. package/src/components/inserter/reusable-block-rename-hint.js +52 -0
  53. package/src/components/inserter/reusable-blocks-tab.js +4 -0
  54. package/src/components/inserter/style.scss +28 -0
  55. package/src/components/list-view/use-list-view-client-ids.js +2 -2
  56. package/src/store/private-selectors.js +3 -6
  57. package/src/store/selectors.js +9 -6
  58. package/src/store/test/private-selectors.js +5 -5
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/store/private-selectors.js"],"names":["isBlockInterfaceHidden","state","getLastInsertedBlocksClientIds","lastBlockInserted","clientIds","getBlockEditingMode","clientId","blockEditingModes","has","get","rootClientId","templateLock","name","isContent","blocksStore","__experimentalHasContentRoleAttribute","parentMode","isBlockSubtreeDisabled","isChildSubtreeDisabled","childClientId","mode","undefined","every","blocks","parents","getListViewClientIdsTree","flatMap","innerBlocks","order","settings","blockListSettings","getEnabledBlockParents","ascending","filter","parent","getRemovalPromptData","removalPromptData","isRemovalPromptSupported"],"mappings":";;;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AAdA;AACA;AACA;;AAGA;AACA;A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N,KAAK,CAAC4B,QAAN,CAAelB,YAHH,EAIZV,KAAK,CAAC6B,iBAJM,CAjB0B,CAAjC;AAyBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMC,sBAAsB,GAAG,qBACrC,CAAE9B,KAAF,EAASK,QAAT,EAAmB0B,SAAS,GAAG,KAA/B,KAA0C;AACzC,SAAO,gCAAiB/B,KAAjB,EAAwBK,QAAxB,EAAkC0B,SAAlC,EAA8CC,MAA9C,CACJC,MAAF,IAAc7B,mBAAmB,CAAEJ,KAAF,EAASiC,MAAT,CAAnB,KAAyC,UADjD,CAAP;AAGA,CALoC,EAMnCjC,KAAF,IAAa,CACZA,KAAK,CAACsB,MAAN,CAAaC,OADD,EAEZvB,KAAK,CAACM,iBAFM,EAGZN,KAAK,CAAC4B,QAAN,CAAelB,YAHH,EAIZV,KAAK,CAAC6B,iBAJM,CANwB,CAA/B;AAcP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASK,oBAAT,CAA+BlC,KAA/B,EAAuC;AAC7C,SAAOA,KAAK,CAACmC,iBAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,wBAAT,CAAmCpC,KAAnC,EAA2C;AACjD,SAAOA,KAAK,CAACoC,wBAAb;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { select } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetBlockRootClientId,\n\tgetTemplateLock,\n\tgetBlockName,\n\tgetBlockOrder,\n\tgetBlockParents,\n} from './selectors';\n\n/**\n * Returns true if the block interface is hidden, or false otherwise.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the block toolbar is hidden.\n */\nexport function isBlockInterfaceHidden( state ) {\n\treturn state.isBlockInterfaceHidden;\n}\n\n/**\n * Gets the client ids of the last inserted blocks.\n *\n * @param {Object} state Global application state.\n * @return {Array|undefined} Client Ids of the last inserted block(s).\n */\nexport function getLastInsertedBlocksClientIds( state ) {\n\treturn state?.lastBlockInserted?.clientIds;\n}\n\n/**\n * @typedef {import('../components/block-editing-mode').BlockEditingMode} BlockEditingMode\n */\n\n/**\n * Returns the block editing mode for a given block.\n *\n * The mode can be one of three options:\n *\n * - `'disabled'`: Prevents editing the block entirely, i.e. it cannot be\n * selected.\n * - `'contentOnly'`: Hides all non-content UI, e.g. auxiliary controls in the\n * toolbar, the block movers, block settings.\n * - `'default'`: Allows editing the block as normal.\n *\n * Blocks can set a mode using the `useBlockEditingMode` hook.\n *\n * The mode is inherited by all of the block's inner blocks, unless they have\n * their own mode.\n *\n * A template lock can also set a mode. If the template lock is `'contentOnly'`,\n * the block's mode is overridden to `'contentOnly'` if the block has a content\n * role attribute, or `'disabled'` otherwise.\n *\n * @see useBlockEditingMode\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID, or `''` for the root container.\n *\n * @return {BlockEditingMode} The block editing mode. One of `'disabled'`,\n * `'contentOnly'`, or `'default'`.\n */\nexport function getBlockEditingMode( state, clientId = '' ) {\n\tif ( state.blockEditingModes.has( clientId ) ) {\n\t\treturn state.blockEditingModes.get( clientId );\n\t}\n\tif ( ! clientId ) {\n\t\treturn 'default';\n\t}\n\tconst rootClientId = getBlockRootClientId( state, clientId );\n\tconst templateLock = getTemplateLock( state, rootClientId );\n\tif ( templateLock === 'contentOnly' ) {\n\t\tconst name = getBlockName( state, clientId );\n\t\t// TODO: Terrible hack! We're calling the global select() function\n\t\t// here instead of using createRegistrySelector(). The problem with\n\t\t// using createRegistrySelector() is that then the public\n\t\t// block-editor selectors (e.g. canInsertBlockTypeUnmemoized) can't\n\t\t// call this private block-editor selector due to a bug in\n\t\t// @wordpress/data. See\n\t\t// https://github.com/WordPress/gutenberg/pull/50985.\n\t\tconst isContent =\n\t\t\tselect( blocksStore ).__experimentalHasContentRoleAttribute( name );\n\t\treturn isContent ? 'contentOnly' : 'disabled';\n\t}\n\tconst parentMode = getBlockEditingMode( state, rootClientId );\n\treturn parentMode === 'contentOnly' ? 'default' : parentMode;\n}\n\n/**\n * Returns true if the block with the given client ID and all of its descendants\n * have an editing mode of 'disabled', or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID.\n *\n * @return {boolean} Whether the block and its descendants are disabled.\n */\nexport const isBlockSubtreeDisabled = createSelector(\n\t( state, clientId ) => {\n\t\tconst isChildSubtreeDisabled = ( childClientId ) => {\n\t\t\tconst mode = state.blockEditingModes.get( childClientId );\n\t\t\treturn (\n\t\t\t\t( mode === undefined || mode === 'disabled' ) &&\n\t\t\t\tgetBlockOrder( state, childClientId ).every(\n\t\t\t\t\tisChildSubtreeDisabled\n\t\t\t\t)\n\t\t\t);\n\t\t};\n\t\treturn (\n\t\t\tgetBlockEditingMode( state, clientId ) === 'disabled' &&\n\t\t\tgetBlockOrder( state, clientId ).every( isChildSubtreeDisabled )\n\t\t);\n\t},\n\t( state ) => [ state.blockEditingModes, state.blocks.parents ]\n);\n\n/**\n * Returns a tree of block objects with only clientID and innerBlocks set.\n * Blocks with a 'disabled' editing mode are not included.\n *\n * @param {Object} state Global application state.\n * @param {?string} rootClientId Optional root client ID of block list.\n *\n * @return {Object[]} Tree of block objects with only clientID and innerBlocks set.\n */\nexport const getListViewClientIdsTree = createSelector(\n\t( state, rootClientId = '' ) => {\n\t\treturn getBlockOrder( state, rootClientId ).flatMap( ( clientId ) => {\n\t\t\tif ( getBlockEditingMode( state, clientId ) !== 'disabled' ) {\n\t\t\t\treturn [\n\t\t\t\t\t{\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tinnerBlocks: getListViewClientIdsTree(\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\tclientId\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t}\n\t\t\treturn getListViewClientIdsTree( state, clientId );\n\t\t} );\n\t},\n\t( state ) => [\n\t\tstate.blocks.order,\n\t\tstate.blockEditingModes,\n\t\tstate.settings.templateLock,\n\t\tstate.blockListSettings,\n\t]\n);\n\n/**\n * Returns a list of a given block's ancestors, from top to bottom. Blocks with\n * a 'disabled' editing mode are excluded.\n *\n * @see getBlockParents\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID.\n * @param {boolean} ascending Order results from bottom to top (true) or top\n * to bottom (false).\n */\nexport const getEnabledBlockParents = createSelector(\n\t( state, clientId, ascending = false ) => {\n\t\treturn getBlockParents( state, clientId, ascending ).filter(\n\t\t\t( parent ) => getBlockEditingMode( state, parent ) !== 'disabled'\n\t\t);\n\t},\n\t( state ) => [\n\t\tstate.blocks.parents,\n\t\tstate.blockEditingModes,\n\t\tstate.settings.templateLock,\n\t\tstate.blockListSettings,\n\t]\n);\n\n/**\n * Selector that returns the data needed to display a prompt when certain\n * blocks are removed, or `false` if no such prompt is requested.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object|false} Data for removal prompt display, if any.\n */\nexport function getRemovalPromptData( state ) {\n\treturn state.removalPromptData;\n}\n\n/**\n * Returns true if removal prompt exists, or false otherwise.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether removal prompt exists.\n */\nexport function isRemovalPromptSupported( state ) {\n\treturn state.isRemovalPromptSupported;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/store/private-selectors.js"],"names":["isBlockInterfaceHidden","state","getLastInsertedBlocksClientIds","lastBlockInserted","clientIds","getBlockEditingMode","clientId","blockEditingModes","has","get","rootClientId","templateLock","name","isContent","blocksStore","__experimentalHasContentRoleAttribute","parentMode","isBlockSubtreeDisabled","isChildSubtreeDisabled","childClientId","mode","undefined","every","blocks","parents","getEnabledClientIdsTree","flatMap","innerBlocks","order","settings","blockListSettings","getEnabledBlockParents","ascending","filter","parent","getRemovalPromptData","removalPromptData","isRemovalPromptSupported"],"mappings":";;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA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,KAAK,CAACM,iBAFM,EAGZN,KAAK,CAAC4B,QAAN,CAAelB,YAHH,EAIZV,KAAK,CAAC6B,iBAJM,CAdyB,CAAhC;AAsBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMC,sBAAsB,GAAG,qBACrC,CAAE9B,KAAF,EAASK,QAAT,EAAmB0B,SAAS,GAAG,KAA/B,KAA0C;AACzC,SAAO,gCAAiB/B,KAAjB,EAAwBK,QAAxB,EAAkC0B,SAAlC,EAA8CC,MAA9C,CACJC,MAAF,IAAc7B,mBAAmB,CAAEJ,KAAF,EAASiC,MAAT,CAAnB,KAAyC,UADjD,CAAP;AAGA,CALoC,EAMnCjC,KAAF,IAAa,CACZA,KAAK,CAACsB,MAAN,CAAaC,OADD,EAEZvB,KAAK,CAACM,iBAFM,EAGZN,KAAK,CAAC4B,QAAN,CAAelB,YAHH,EAIZV,KAAK,CAAC6B,iBAJM,CANwB,CAA/B;AAcP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASK,oBAAT,CAA+BlC,KAA/B,EAAuC;AAC7C,SAAOA,KAAK,CAACmC,iBAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,wBAAT,CAAmCpC,KAAnC,EAA2C;AACjD,SAAOA,KAAK,CAACoC,wBAAb;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { select } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetBlockRootClientId,\n\tgetTemplateLock,\n\tgetBlockName,\n\tgetBlockOrder,\n\tgetBlockParents,\n} from './selectors';\n\n/**\n * Returns true if the block interface is hidden, or false otherwise.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the block toolbar is hidden.\n */\nexport function isBlockInterfaceHidden( state ) {\n\treturn state.isBlockInterfaceHidden;\n}\n\n/**\n * Gets the client ids of the last inserted blocks.\n *\n * @param {Object} state Global application state.\n * @return {Array|undefined} Client Ids of the last inserted block(s).\n */\nexport function getLastInsertedBlocksClientIds( state ) {\n\treturn state?.lastBlockInserted?.clientIds;\n}\n\n/**\n * @typedef {import('../components/block-editing-mode').BlockEditingMode} BlockEditingMode\n */\n\n/**\n * Returns the block editing mode for a given block.\n *\n * The mode can be one of three options:\n *\n * - `'disabled'`: Prevents editing the block entirely, i.e. it cannot be\n * selected.\n * - `'contentOnly'`: Hides all non-content UI, e.g. auxiliary controls in the\n * toolbar, the block movers, block settings.\n * - `'default'`: Allows editing the block as normal.\n *\n * Blocks can set a mode using the `useBlockEditingMode` hook.\n *\n * The mode is inherited by all of the block's inner blocks, unless they have\n * their own mode.\n *\n * A template lock can also set a mode. If the template lock is `'contentOnly'`,\n * the block's mode is overridden to `'contentOnly'` if the block has a content\n * role attribute, or `'disabled'` otherwise.\n *\n * @see useBlockEditingMode\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID, or `''` for the root container.\n *\n * @return {BlockEditingMode} The block editing mode. One of `'disabled'`,\n * `'contentOnly'`, or `'default'`.\n */\nexport function getBlockEditingMode( state, clientId = '' ) {\n\tif ( state.blockEditingModes.has( clientId ) ) {\n\t\treturn state.blockEditingModes.get( clientId );\n\t}\n\tif ( ! clientId ) {\n\t\treturn 'default';\n\t}\n\tconst rootClientId = getBlockRootClientId( state, clientId );\n\tconst templateLock = getTemplateLock( state, rootClientId );\n\tif ( templateLock === 'contentOnly' ) {\n\t\tconst name = getBlockName( state, clientId );\n\t\t// TODO: Terrible hack! We're calling the global select() function\n\t\t// here instead of using createRegistrySelector(). The problem with\n\t\t// using createRegistrySelector() is that then the public\n\t\t// block-editor selectors (e.g. canInsertBlockTypeUnmemoized) can't\n\t\t// call this private block-editor selector due to a bug in\n\t\t// @wordpress/data. See\n\t\t// https://github.com/WordPress/gutenberg/pull/50985.\n\t\tconst isContent =\n\t\t\tselect( blocksStore ).__experimentalHasContentRoleAttribute( name );\n\t\treturn isContent ? 'contentOnly' : 'disabled';\n\t}\n\tconst parentMode = getBlockEditingMode( state, rootClientId );\n\treturn parentMode === 'contentOnly' ? 'default' : parentMode;\n}\n\n/**\n * Returns true if the block with the given client ID and all of its descendants\n * have an editing mode of 'disabled', or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID.\n *\n * @return {boolean} Whether the block and its descendants are disabled.\n */\nexport const isBlockSubtreeDisabled = createSelector(\n\t( state, clientId ) => {\n\t\tconst isChildSubtreeDisabled = ( childClientId ) => {\n\t\t\tconst mode = state.blockEditingModes.get( childClientId );\n\t\t\treturn (\n\t\t\t\t( mode === undefined || mode === 'disabled' ) &&\n\t\t\t\tgetBlockOrder( state, childClientId ).every(\n\t\t\t\t\tisChildSubtreeDisabled\n\t\t\t\t)\n\t\t\t);\n\t\t};\n\t\treturn (\n\t\t\tgetBlockEditingMode( state, clientId ) === 'disabled' &&\n\t\t\tgetBlockOrder( state, clientId ).every( isChildSubtreeDisabled )\n\t\t);\n\t},\n\t( state ) => [ state.blockEditingModes, state.blocks.parents ]\n);\n\n/**\n * Returns a tree of block objects with only clientID and innerBlocks set.\n * Blocks with a 'disabled' editing mode are not included.\n *\n * @param {Object} state Global application state.\n * @param {?string} rootClientId Optional root client ID of block list.\n *\n * @return {Object[]} Tree of block objects with only clientID and innerBlocks set.\n */\nexport const getEnabledClientIdsTree = createSelector(\n\t( state, rootClientId = '' ) => {\n\t\treturn getBlockOrder( state, rootClientId ).flatMap( ( clientId ) => {\n\t\t\tif ( getBlockEditingMode( state, clientId ) !== 'disabled' ) {\n\t\t\t\treturn [\n\t\t\t\t\t{\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tinnerBlocks: getEnabledClientIdsTree( state, clientId ),\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t}\n\t\t\treturn getEnabledClientIdsTree( state, clientId );\n\t\t} );\n\t},\n\t( state ) => [\n\t\tstate.blocks.order,\n\t\tstate.blockEditingModes,\n\t\tstate.settings.templateLock,\n\t\tstate.blockListSettings,\n\t]\n);\n\n/**\n * Returns a list of a given block's ancestors, from top to bottom. Blocks with\n * a 'disabled' editing mode are excluded.\n *\n * @see getBlockParents\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID.\n * @param {boolean} ascending Order results from bottom to top (true) or top\n * to bottom (false).\n */\nexport const getEnabledBlockParents = createSelector(\n\t( state, clientId, ascending = false ) => {\n\t\treturn getBlockParents( state, clientId, ascending ).filter(\n\t\t\t( parent ) => getBlockEditingMode( state, parent ) !== 'disabled'\n\t\t);\n\t},\n\t( state ) => [\n\t\tstate.blocks.parents,\n\t\tstate.blockEditingModes,\n\t\tstate.settings.templateLock,\n\t\tstate.blockListSettings,\n\t]\n);\n\n/**\n * Selector that returns the data needed to display a prompt when certain\n * blocks are removed, or `false` if no such prompt is requested.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object|false} Data for removal prompt display, if any.\n */\nexport function getRemovalPromptData( state ) {\n\treturn state.removalPromptData;\n}\n\n/**\n * Returns true if removal prompt exists, or false otherwise.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether removal prompt exists.\n */\nexport function isRemovalPromptSupported( state ) {\n\treturn state.isRemovalPromptSupported;\n}\n"]}
@@ -2049,9 +2049,11 @@ const getInserterItems = (0, _rememo.default)((state, rootClientId = null) => {
2049
2049
  };
2050
2050
  };
2051
2051
 
2052
- const syncedPatternInserterItems = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) ? getReusableBlocks(state).filter(reusableBlock => // Filter to either fully synced patterns (sync_status === 'fully'),
2053
- // or old school reusable blocks (sync_status === '').
2054
- reusableBlock.meta?.sync_status === 'fully' || reusableBlock.meta?.sync_status === '' || !reusableBlock.meta?.sync_status).map(buildReusableBlockInserterItem) : [];
2052
+ const syncedPatternInserterItems = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) ? getReusableBlocks(state).filter(reusableBlock => // Reusable blocks that are fully synced should have no sync status set
2053
+ // for backwards compat between patterns and old reusable blocks, but
2054
+ // some in release 16.1 may have had sync status inadvertantly set to
2055
+ // 'fully' if created in the site editor.
2056
+ reusableBlock.wp_pattern_sync_status === 'fully' || reusableBlock.wp_pattern_sync_status === '' || !reusableBlock.wp_pattern_sync_status).map(buildReusableBlockInserterItem) : [];
2055
2057
  const buildBlockTypeInserterItem = buildBlockTypeItem(state, {
2056
2058
  buildScope: 'inserter'
2057
2059
  });
@@ -2255,7 +2257,7 @@ function getUnsyncedPatterns(state) {
2255
2257
  var _state$settings$__exp;
2256
2258
 
2257
2259
  const reusableBlocks = (_state$settings$__exp = state?.settings?.__experimentalReusableBlocks) !== null && _state$settings$__exp !== void 0 ? _state$settings$__exp : EMPTY_ARRAY;
2258
- return reusableBlocks.filter(reusableBlock => reusableBlock.meta?.sync_status === 'unsynced').map(reusableBlock => {
2260
+ return reusableBlocks.filter(reusableBlock => reusableBlock.wp_pattern_sync_status === 'unsynced').map(reusableBlock => {
2259
2261
  return {
2260
2262
  name: `core/block/${reusableBlock.id}`,
2261
2263
  title: reusableBlock.title.raw,