@wordpress/block-editor 12.3.3 → 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 (92) 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-mobile-toolbar/block-actions-menu.native.js +3 -6
  5. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  6. package/build/components/block-parent-selector/index.js +8 -5
  7. package/build/components/block-parent-selector/index.js.map +1 -1
  8. package/build/components/block-removal-warning-modal/index.js +5 -2
  9. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  10. package/build/components/block-tools/block-contextual-toolbar.js +7 -11
  11. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  12. package/build/components/global-styles/filters-panel.js +1 -1
  13. package/build/components/global-styles/filters-panel.js.map +1 -1
  14. package/build/components/index.js +10 -1
  15. package/build/components/index.js.map +1 -1
  16. package/build/components/inserter/block-patterns-explorer/patterns-list.js +2 -2
  17. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  18. package/build/components/inserter/block-patterns-tab.js +7 -35
  19. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  20. package/build/components/inserter/hooks/use-block-types-state.js +3 -4
  21. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  22. package/build/components/inserter/hooks/use-patterns-state.js +9 -3
  23. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  24. package/build/components/inserter/reusable-block-rename-hint.js +62 -0
  25. package/build/components/inserter/reusable-block-rename-hint.js.map +1 -0
  26. package/build/components/inserter/reusable-blocks-tab.js +6 -2
  27. package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
  28. package/build/components/list-view/use-list-view-client-ids.js +2 -2
  29. package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
  30. package/build/store/private-selectors.js +5 -6
  31. package/build/store/private-selectors.js.map +1 -1
  32. package/build/store/selectors.js +33 -15
  33. package/build/store/selectors.js.map +1 -1
  34. package/build-module/components/block-edit/edit.js +27 -10
  35. package/build-module/components/block-edit/edit.js.map +1 -1
  36. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +4 -6
  37. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  38. package/build-module/components/block-parent-selector/index.js +7 -5
  39. package/build-module/components/block-parent-selector/index.js.map +1 -1
  40. package/build-module/components/block-removal-warning-modal/index.js +6 -3
  41. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  42. package/build-module/components/block-tools/block-contextual-toolbar.js +8 -11
  43. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  44. package/build-module/components/global-styles/filters-panel.js +2 -2
  45. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  46. package/build-module/components/index.js +5 -0
  47. package/build-module/components/index.js.map +1 -1
  48. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +2 -2
  49. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  50. package/build-module/components/inserter/block-patterns-tab.js +7 -33
  51. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  52. package/build-module/components/inserter/hooks/use-block-types-state.js +3 -4
  53. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  54. package/build-module/components/inserter/hooks/use-patterns-state.js +9 -3
  55. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  56. package/build-module/components/inserter/reusable-block-rename-hint.js +48 -0
  57. package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -0
  58. package/build-module/components/inserter/reusable-blocks-tab.js +5 -2
  59. package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
  60. package/build-module/components/list-view/use-list-view-client-ids.js +2 -2
  61. package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
  62. package/build-module/store/private-selectors.js +3 -3
  63. package/build-module/store/private-selectors.js.map +1 -1
  64. package/build-module/store/selectors.js +33 -15
  65. package/build-module/store/selectors.js.map +1 -1
  66. package/build-style/content-rtl.css +3 -0
  67. package/build-style/content.css +3 -0
  68. package/build-style/style-rtl.css +72 -22
  69. package/build-style/style.css +72 -22
  70. package/package.json +9 -9
  71. package/src/components/block-edit/edit.js +26 -9
  72. package/src/components/block-edit/test/edit.js +1 -1
  73. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +4 -8
  74. package/src/components/block-parent-selector/index.js +13 -8
  75. package/src/components/block-removal-warning-modal/index.js +7 -6
  76. package/src/components/block-tools/block-contextual-toolbar.js +5 -11
  77. package/src/components/block-tools/style.scss +69 -26
  78. package/src/components/default-block-appender/content.scss +11 -0
  79. package/src/components/global-styles/filters-panel.js +2 -2
  80. package/src/components/index.js +5 -0
  81. package/src/components/inserter/block-patterns-explorer/patterns-list.js +8 -2
  82. package/src/components/inserter/block-patterns-tab.js +8 -56
  83. package/src/components/inserter/hooks/use-block-types-state.js +3 -4
  84. package/src/components/inserter/hooks/use-patterns-state.js +35 -19
  85. package/src/components/inserter/reusable-block-rename-hint.js +52 -0
  86. package/src/components/inserter/reusable-blocks-tab.js +5 -1
  87. package/src/components/inserter/style.scss +28 -0
  88. package/src/components/list-view/style.scss +1 -2
  89. package/src/components/list-view/use-list-view-client-ids.js +2 -2
  90. package/src/store/private-selectors.js +3 -6
  91. package/src/store/selectors.js +54 -20
  92. 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","isRem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,EAiBrCL,KAAF,IAAa,CACZA,KAAK,CAACsB,MAAN,CAAaK,KADD,EAEZ3B,KAAK,CAACM,iBAFM,EAGZN,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;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,sBAAT,CAAiCC,KAAjC,EAAyC;AAC/C,SAAOA,KAAK,CAACD,sBAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASE,8BAAT,CAAyCD,KAAzC,EAAiD;AACvD,SAAOA,KAAK,EAAEE,iBAAP,EAA0BC,SAAjC;AACA;AAED;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,mBAAT,CAA8BJ,KAA9B,EAAqCK,QAAQ,GAAG,EAAhD,EAAqD;AAC3D,MAAKL,KAAK,CAACM,iBAAN,CAAwBC,GAAxB,CAA6BF,QAA7B,CAAL,EAA+C;AAC9C,WAAOL,KAAK,CAACM,iBAAN,CAAwBE,GAAxB,CAA6BH,QAA7B,CAAP;AACA;;AACD,MAAK,CAAEA,QAAP,EAAkB;AACjB,WAAO,SAAP;AACA;;AACD,QAAMI,YAAY,GAAG,qCAAsBT,KAAtB,EAA6BK,QAA7B,CAArB;AACA,QAAMK,YAAY,GAAG,gCAAiBV,KAAjB,EAAwBS,YAAxB,CAArB;;AACA,MAAKC,YAAY,KAAK,aAAtB,EAAsC;AACrC,UAAMC,IAAI,GAAG,6BAAcX,KAAd,EAAqBK,QAArB,CAAb,CADqC,CAErC;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,UAAMO,SAAS,GACd,kBAAQC,aAAR,EAAsBC,qCAAtB,CAA6DH,IAA7D,CADD;;AAEA,WAAOC,SAAS,GAAG,aAAH,GAAmB,UAAnC;AACA;;AACD,QAAMG,UAA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A,GAVM,CAAP;AAWA,CAbqC,EAcpCL,KAAF,IAAa,CACZA,KAAK,CAACsB,MAAN,CAAaK,KADD,EAEZ3B,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"]}
@@ -1967,7 +1967,6 @@ const buildBlockTypeItem = (state, {
1967
1967
  *
1968
1968
  * @param {Object} state Editor state.
1969
1969
  * @param {?string} rootClientId Optional root client ID of block list.
1970
- * @param {?string} syncStatus Optional sync status to filter pattern blocks by.
1971
1970
  *
1972
1971
  * @return {WPEditorInserterItem[]} Items that appear in inserter.
1973
1972
  *
@@ -1985,10 +1984,7 @@ const buildBlockTypeItem = (state, {
1985
1984
  */
1986
1985
 
1987
1986
 
1988
- const getInserterItems = (0, _rememo.default)((state, rootClientId = null, syncStatus) => {
1989
- const buildBlockTypeInserterItem = buildBlockTypeItem(state, {
1990
- buildScope: 'inserter'
1991
- });
1987
+ const getInserterItems = (0, _rememo.default)((state, rootClientId = null) => {
1992
1988
  /*
1993
1989
  * Matches block comment delimiters amid serialized content.
1994
1990
  *
@@ -2002,7 +1998,6 @@ const getInserterItems = (0, _rememo.default)((state, rootClientId = null, syncS
2002
1998
  * - prepended ^\s*
2003
1999
  *
2004
2000
  */
2005
-
2006
2001
  const blockParserTokenizer = /^\s*<!--\s+(\/)?wp:([a-z][a-z0-9_-]*\/)?([a-z][a-z0-9_-]*)\s+({(?:(?=([^}]+|}+(?=})|(?!}\s+\/?-->)[^])*)\5|[^]*?)}\s+)?(\/)?-->/;
2007
2002
 
2008
2003
  const buildReusableBlockInserterItem = reusableBlock => {
@@ -2054,8 +2049,15 @@ const getInserterItems = (0, _rememo.default)((state, rootClientId = null, syncS
2054
2049
  };
2055
2050
  };
2056
2051
 
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) : [];
2057
+ const buildBlockTypeInserterItem = buildBlockTypeItem(state, {
2058
+ buildScope: 'inserter'
2059
+ });
2057
2060
  const blockTypeInserterItems = (0, _blocks.getBlockTypes)().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)).map(buildBlockTypeInserterItem);
2058
- const reusableBlockInserterItems = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) ? getReusableBlocks(state).filter(reusableBlock => syncStatus === reusableBlock.meta?.sync_status || !syncStatus && reusableBlock.meta?.sync_status === '').map(buildReusableBlockInserterItem) : [];
2059
2061
  const items = blockTypeInserterItems.reduce((accumulator, item) => {
2060
2062
  const {
2061
2063
  variations = []
@@ -2097,7 +2099,7 @@ const getInserterItems = (0, _rememo.default)((state, rootClientId = null, syncS
2097
2099
  noncore: []
2098
2100
  });
2099
2101
  const sortedBlockTypes = [...coreItems, ...nonCoreItems];
2100
- return [...sortedBlockTypes, ...reusableBlockInserterItems];
2102
+ return [...sortedBlockTypes, ...syncedPatternInserterItems];
2101
2103
  }, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.blocks.order, state.preferences.insertUsage, state.settings.allowedBlockTypes, state.settings.templateLock, getReusableBlocks(state), (0, _blocks.getBlockTypes)()]);
2102
2104
  /**
2103
2105
  * Determines the items that appear in the available block transforms list.
@@ -2251,9 +2253,24 @@ const checkAllowListRecursive = (blocks, allowedBlockTypes) => {
2251
2253
  return true;
2252
2254
  };
2253
2255
 
2256
+ function getUnsyncedPatterns(state) {
2257
+ var _state$settings$__exp;
2258
+
2259
+ const reusableBlocks = (_state$settings$__exp = state?.settings?.__experimentalReusableBlocks) !== null && _state$settings$__exp !== void 0 ? _state$settings$__exp : EMPTY_ARRAY;
2260
+ return reusableBlocks.filter(reusableBlock => reusableBlock.wp_pattern_sync_status === 'unsynced').map(reusableBlock => {
2261
+ return {
2262
+ name: `core/block/${reusableBlock.id}`,
2263
+ title: reusableBlock.title.raw,
2264
+ categories: ['custom'],
2265
+ content: reusableBlock.content.raw
2266
+ };
2267
+ });
2268
+ }
2269
+
2254
2270
  const __experimentalGetParsedPattern = (0, _rememo.default)((state, patternName) => {
2255
2271
  const patterns = state.settings.__experimentalBlockPatterns;
2256
- const pattern = patterns.find(({
2272
+ const unsyncedPatterns = getUnsyncedPatterns(state);
2273
+ const pattern = [...patterns, ...unsyncedPatterns].find(({
2257
2274
  name
2258
2275
  }) => name === patternName);
2259
2276
 
@@ -2266,15 +2283,16 @@ const __experimentalGetParsedPattern = (0, _rememo.default)((state, patternName)
2266
2283
  __unstableSkipMigrationLogs: true
2267
2284
  })
2268
2285
  };
2269
- }, state => [state.settings.__experimentalBlockPatterns]);
2286
+ }, state => [state.settings.__experimentalBlockPatterns, state.settings.__experimentalReusableBlocks]);
2270
2287
 
2271
2288
  exports.__experimentalGetParsedPattern = __experimentalGetParsedPattern;
2272
2289
  const getAllAllowedPatterns = (0, _rememo.default)(state => {
2273
2290
  const patterns = state.settings.__experimentalBlockPatterns;
2291
+ const unsyncedPatterns = getUnsyncedPatterns(state);
2274
2292
  const {
2275
2293
  allowedBlockTypes
2276
2294
  } = getSettings(state);
2277
- const parsedPatterns = patterns.filter(({
2295
+ const parsedPatterns = [...patterns, ...unsyncedPatterns].filter(({
2278
2296
  inserter = true
2279
2297
  }) => !!inserter).map(({
2280
2298
  name
@@ -2283,7 +2301,7 @@ const getAllAllowedPatterns = (0, _rememo.default)(state => {
2283
2301
  blocks
2284
2302
  }) => checkAllowListRecursive(blocks, allowedBlockTypes));
2285
2303
  return allowedPatterns;
2286
- }, state => [state.settings.__experimentalBlockPatterns, state.settings.allowedBlockTypes]);
2304
+ }, state => [state.settings.__experimentalBlockPatterns, state.settings.__experimentalReusableBlocks, state.settings.allowedBlockTypes]);
2287
2305
  /**
2288
2306
  * Returns the list of allowed patterns for inner blocks children.
2289
2307
  *
@@ -2301,7 +2319,7 @@ const __experimentalGetAllowedPatterns = (0, _rememo.default)((state, rootClient
2301
2319
  name
2302
2320
  }) => canInsertBlockType(state, name, rootClientId)));
2303
2321
  return patternsAllowed;
2304
- }, (state, rootClientId) => [state.settings.__experimentalBlockPatterns, state.settings.allowedBlockTypes, state.settings.templateLock, state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId)]);
2322
+ }, (state, rootClientId) => [state.settings.__experimentalBlockPatterns, state.settings.__experimentalReusableBlocks, state.settings.allowedBlockTypes, state.settings.templateLock, state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId)]);
2305
2323
  /**
2306
2324
  * Returns the list of patterns based on their declared `blockTypes`
2307
2325
  * and a block's name.
@@ -2547,9 +2565,9 @@ function __experimentalGetLastBlockAttributeChanges(state) {
2547
2565
 
2548
2566
 
2549
2567
  function getReusableBlocks(state) {
2550
- var _state$settings$__exp;
2568
+ var _state$settings$__exp2;
2551
2569
 
2552
- return (_state$settings$__exp = state?.settings?.__experimentalReusableBlocks) !== null && _state$settings$__exp !== void 0 ? _state$settings$__exp : EMPTY_ARRAY;
2570
+ return (_state$settings$__exp2 = state?.settings?.__experimentalReusableBlocks) !== null && _state$settings$__exp2 !== void 0 ? _state$settings$__exp2 : EMPTY_ARRAY;
2553
2571
  }
2554
2572
  /**
2555
2573
  * Returns whether the navigation mode is enabled.