@wordpress/editor 13.26.1-next.79a6196f.0 → 13.27.0

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 (132) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/build/bindings/index.js +20 -0
  3. package/build/bindings/index.js.map +1 -0
  4. package/build/bindings/post-meta.js +52 -0
  5. package/build/bindings/post-meta.js.map +1 -0
  6. package/build/components/block-manager/category.js +106 -0
  7. package/build/components/block-manager/category.js.map +1 -0
  8. package/build/components/block-manager/checklist.js +35 -0
  9. package/build/components/block-manager/checklist.js.map +1 -0
  10. package/build/components/block-manager/index.js +130 -0
  11. package/build/components/block-manager/index.js.map +1 -0
  12. package/build/components/document-tools/index.js +58 -52
  13. package/build/components/document-tools/index.js.map +1 -1
  14. package/build/components/editor-canvas/index.js +4 -4
  15. package/build/components/editor-canvas/index.js.map +1 -1
  16. package/build/components/editor-notices/index.js +11 -11
  17. package/build/components/editor-notices/index.js.map +1 -1
  18. package/build/components/entities-saved-states/entity-type-list.js +38 -7
  19. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  20. package/build/components/offline-status/index.native.js +1 -3
  21. package/build/components/offline-status/index.native.js.map +1 -1
  22. package/build/components/post-locked-modal/index.js +1 -1
  23. package/build/components/post-locked-modal/index.js.map +1 -1
  24. package/build/components/post-saved-state/index.js +10 -24
  25. package/build/components/post-saved-state/index.js.map +1 -1
  26. package/build/components/post-schedule/check.js +5 -16
  27. package/build/components/post-schedule/check.js.map +1 -1
  28. package/build/components/preferences-modal/enable-panel.js +42 -0
  29. package/build/components/preferences-modal/enable-panel.js.map +1 -0
  30. package/build/components/preferences-modal/enable-plugin-document-setting-panel.js +33 -0
  31. package/build/components/preferences-modal/enable-plugin-document-setting-panel.js.map +1 -0
  32. package/build/components/preferences-modal/index.js +186 -0
  33. package/build/components/preferences-modal/index.js.map +1 -0
  34. package/build/components/provider/disable-non-page-content-blocks.js +1 -4
  35. package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
  36. package/build/components/provider/use-block-editor-settings.js +34 -8
  37. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  38. package/build/hooks/pattern-partial-syncing.js +12 -6
  39. package/build/hooks/pattern-partial-syncing.js.map +1 -1
  40. package/build/index.js +1 -0
  41. package/build/index.js.map +1 -1
  42. package/build/private-apis.js +6 -2
  43. package/build/private-apis.js.map +1 -1
  44. package/build/store/defaults.js +2 -0
  45. package/build/store/defaults.js.map +1 -1
  46. package/build/store/private-actions.js +33 -1
  47. package/build/store/private-actions.js.map +1 -1
  48. package/build/store/private-selectors.js +1 -1
  49. package/build/store/private-selectors.js.map +1 -1
  50. package/build-module/bindings/index.js +15 -0
  51. package/build-module/bindings/index.js.map +1 -0
  52. package/build-module/bindings/post-meta.js +45 -0
  53. package/build-module/bindings/post-meta.js.map +1 -0
  54. package/build-module/components/block-manager/category.js +97 -0
  55. package/build-module/components/block-manager/category.js.map +1 -0
  56. package/build-module/components/block-manager/checklist.js +27 -0
  57. package/build-module/components/block-manager/checklist.js.map +1 -0
  58. package/build-module/components/block-manager/index.js +121 -0
  59. package/build-module/components/block-manager/index.js.map +1 -0
  60. package/build-module/components/document-tools/index.js +58 -52
  61. package/build-module/components/document-tools/index.js.map +1 -1
  62. package/build-module/components/editor-canvas/index.js +4 -4
  63. package/build-module/components/editor-canvas/index.js.map +1 -1
  64. package/build-module/components/editor-notices/index.js +12 -12
  65. package/build-module/components/editor-notices/index.js.map +1 -1
  66. package/build-module/components/entities-saved-states/entity-type-list.js +39 -8
  67. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  68. package/build-module/components/offline-status/index.native.js +1 -3
  69. package/build-module/components/offline-status/index.native.js.map +1 -1
  70. package/build-module/components/post-locked-modal/index.js +1 -1
  71. package/build-module/components/post-locked-modal/index.js.map +1 -1
  72. package/build-module/components/post-saved-state/index.js +11 -25
  73. package/build-module/components/post-saved-state/index.js.map +1 -1
  74. package/build-module/components/post-schedule/check.js +6 -15
  75. package/build-module/components/post-schedule/check.js.map +1 -1
  76. package/build-module/components/preferences-modal/enable-panel.js +34 -0
  77. package/build-module/components/preferences-modal/enable-panel.js.map +1 -0
  78. package/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js +24 -0
  79. package/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js.map +1 -0
  80. package/build-module/components/preferences-modal/index.js +179 -0
  81. package/build-module/components/preferences-modal/index.js.map +1 -0
  82. package/build-module/components/provider/disable-non-page-content-blocks.js +1 -4
  83. package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
  84. package/build-module/components/provider/use-block-editor-settings.js +35 -9
  85. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  86. package/build-module/hooks/pattern-partial-syncing.js +12 -6
  87. package/build-module/hooks/pattern-partial-syncing.js.map +1 -1
  88. package/build-module/index.js +1 -0
  89. package/build-module/index.js.map +1 -1
  90. package/build-module/private-apis.js +6 -2
  91. package/build-module/private-apis.js.map +1 -1
  92. package/build-module/store/defaults.js +2 -0
  93. package/build-module/store/defaults.js.map +1 -1
  94. package/build-module/store/private-actions.js +29 -0
  95. package/build-module/store/private-actions.js.map +1 -1
  96. package/build-module/store/private-selectors.js +1 -1
  97. package/build-module/store/private-selectors.js.map +1 -1
  98. package/build-style/style-rtl.css +80 -12
  99. package/build-style/style.css +80 -12
  100. package/package.json +33 -33
  101. package/src/bindings/index.js +13 -0
  102. package/src/bindings/post-meta.js +42 -0
  103. package/src/components/block-manager/category.js +96 -0
  104. package/src/components/block-manager/checklist.js +30 -0
  105. package/src/components/block-manager/index.js +160 -0
  106. package/src/components/block-manager/style.scss +82 -0
  107. package/src/components/document-tools/index.js +9 -1
  108. package/src/components/editor-canvas/index.js +3 -2
  109. package/src/components/editor-notices/index.js +11 -12
  110. package/src/components/editor-notices/style.scss +0 -1
  111. package/src/components/entities-saved-states/entity-type-list.js +47 -5
  112. package/src/components/entities-saved-states/style.scss +4 -0
  113. package/src/components/offline-status/index.native.js +2 -4
  114. package/src/components/post-locked-modal/index.js +1 -1
  115. package/src/components/post-locked-modal/style.scss +0 -6
  116. package/src/components/post-saved-state/index.js +30 -47
  117. package/src/components/post-schedule/check.js +10 -14
  118. package/src/components/post-schedule/test/check.js +24 -9
  119. package/src/components/preferences-modal/enable-panel.js +30 -0
  120. package/src/components/preferences-modal/enable-plugin-document-setting-panel.js +23 -0
  121. package/src/components/preferences-modal/index.js +269 -0
  122. package/src/components/preferences-modal/test/index.js +28 -0
  123. package/src/components/provider/disable-non-page-content-blocks.js +3 -3
  124. package/src/components/provider/use-block-editor-settings.js +45 -17
  125. package/src/hooks/pattern-partial-syncing.js +26 -22
  126. package/src/index.js +1 -0
  127. package/src/private-apis.js +6 -2
  128. package/src/store/defaults.js +2 -0
  129. package/src/store/private-actions.js +49 -0
  130. package/src/store/private-selectors.js +1 -1
  131. package/src/style.scss +1 -1
  132. package/src/components/editor-canvas/style.scss +0 -5
@@ -1 +1 @@
1
- {"version":3,"names":["_hooks","require","_patterns","_compose","_blockEditor","_data","_store","_lockUnlock","PartialSyncingControls","PATTERN_TYPES","PARTIAL_SYNCING_SUPPORTED_BLOCKS","unlock","patternsPrivateApis","withPartialSyncingControls","createHigherOrderComponent","BlockEdit","props","blockEditingMode","useBlockEditingMode","isEditingPattern","useSelect","select","editorStore","getCurrentPostType","user","shouldShowPartialSyncingControls","isSelected","Object","keys","includes","name","_react","createElement","Fragment","window","__experimentalPatternPartialSyncing","addFilter"],"sources":["@wordpress/editor/src/hooks/pattern-partial-syncing.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useBlockEditingMode } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\nconst {\n\tPartialSyncingControls,\n\tPATTERN_TYPES,\n\tPARTIAL_SYNCING_SUPPORTED_BLOCKS,\n} = unlock( patternsPrivateApis );\n\n/**\n * Override the default edit UI to include a new block inspector control for\n * assigning a partial syncing controls to supported blocks in the pattern editor.\n * Currently, only the `core/paragraph` block is supported.\n *\n * @param {Component} BlockEdit Original component.\n *\n * @return {Component} Wrapped component.\n */\nconst withPartialSyncingControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst blockEditingMode = useBlockEditingMode();\n\t\tconst isEditingPattern = useSelect(\n\t\t\t( select ) =>\n\t\t\t\tselect( editorStore ).getCurrentPostType() ===\n\t\t\t\tPATTERN_TYPES.user,\n\t\t\t[]\n\t\t);\n\n\t\tconst shouldShowPartialSyncingControls =\n\t\t\tprops.isSelected &&\n\t\t\tisEditingPattern &&\n\t\t\tblockEditingMode === 'default' &&\n\t\t\tObject.keys( PARTIAL_SYNCING_SUPPORTED_BLOCKS ).includes(\n\t\t\t\tprops.name\n\t\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ shouldShowPartialSyncingControls && (\n\t\t\t\t\t<PartialSyncingControls { ...props } />\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n);\n\nif ( window.__experimentalPatternPartialSyncing ) {\n\taddFilter(\n\t\t'editor.BlockEdit',\n\t\t'core/editor/with-partial-syncing-controls',\n\t\twithPartialSyncingControls\n\t);\n}\n"],"mappings":";;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAbA;AACA;AACA;;AAOA;AACA;AACA;;AAIA,MAAM;EACLO,sBAAsB;EACtBC,aAAa;EACbC;AACD,CAAC,GAAG,IAAAC,kBAAM,EAAEC,qBAAoB,CAAC;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,0BAA0B,GAAG,IAAAC,mCAA0B,EAC1DC,SAAS,IAAQC,KAAK,IAAM;EAC7B,MAAMC,gBAAgB,GAAG,IAAAC,gCAAmB,EAAC,CAAC;EAC9C,MAAMC,gBAAgB,GAAG,IAAAC,eAAS,EAC/BC,MAAM,IACPA,MAAM,CAAEC,YAAY,CAAC,CAACC,kBAAkB,CAAC,CAAC,KAC1Cd,aAAa,CAACe,IAAI,EACnB,EACD,CAAC;EAED,MAAMC,gCAAgC,GACrCT,KAAK,CAACU,UAAU,IAChBP,gBAAgB,IAChBF,gBAAgB,KAAK,SAAS,IAC9BU,MAAM,CAACC,IAAI,CAAElB,gCAAiC,CAAC,CAACmB,QAAQ,CACvDb,KAAK,CAACc,IACP,CAAC;EAEF,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,EAACjB,SAAS;IAAA,GAAMC;EAAK,CAAI,CAAC,EACxBS,gCAAgC,IACjC,IAAAM,MAAA,CAAAC,aAAA,EAACxB,sBAAsB;IAAA,GAAMQ;EAAK,CAAI,CAEtC,CAAC;AAEL,CACD,CAAC;AAED,IAAKkB,MAAM,CAACC,mCAAmC,EAAG;EACjD,IAAAC,gBAAS,EACR,kBAAkB,EAClB,2CAA2C,EAC3CvB,0BACD,CAAC;AACF"}
1
+ {"version":3,"names":["_hooks","require","_patterns","_compose","_blockEditor","_data","_store","_lockUnlock","PartialSyncingControls","PATTERN_TYPES","PARTIAL_SYNCING_SUPPORTED_BLOCKS","unlock","patternsPrivateApis","withPartialSyncingControls","createHigherOrderComponent","BlockEdit","props","isSupportedBlock","Object","keys","includes","name","_react","createElement","Fragment","isSelected","ControlsWithStoreSubscription","blockEditingMode","useBlockEditingMode","isEditingPattern","useSelect","select","editorStore","getCurrentPostType","user","addFilter"],"sources":["@wordpress/editor/src/hooks/pattern-partial-syncing.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useBlockEditingMode } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\nconst {\n\tPartialSyncingControls,\n\tPATTERN_TYPES,\n\tPARTIAL_SYNCING_SUPPORTED_BLOCKS,\n} = unlock( patternsPrivateApis );\n\n/**\n * Override the default edit UI to include a new block inspector control for\n * assigning a partial syncing controls to supported blocks in the pattern editor.\n * Currently, only the `core/paragraph` block is supported.\n *\n * @param {Component} BlockEdit Original component.\n *\n * @return {Component} Wrapped component.\n */\nconst withPartialSyncingControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst isSupportedBlock = Object.keys(\n\t\t\tPARTIAL_SYNCING_SUPPORTED_BLOCKS\n\t\t).includes( props.name );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ props.isSelected && isSupportedBlock && (\n\t\t\t\t\t<ControlsWithStoreSubscription { ...props } />\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n);\n\n// Split into a separate component to avoid a store subscription\n// on every block.\nfunction ControlsWithStoreSubscription( props ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst isEditingPattern = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getCurrentPostType() === PATTERN_TYPES.user,\n\t\t[]\n\t);\n\n\treturn (\n\t\tisEditingPattern &&\n\t\tblockEditingMode === 'default' && (\n\t\t\t<PartialSyncingControls { ...props } />\n\t\t)\n\t);\n}\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/with-partial-syncing-controls',\n\twithPartialSyncingControls\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AA,EAACf,sBAAsB;IAAA,GAAMQ;EAAK,CAAI,CACtC;AAEH;AAEA,IAAAmB,gBAAS,EACR,kBAAkB,EAClB,2CAA2C,EAC3CtB,0BACD,CAAC"}
package/build/index.js CHANGED
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "transformStyles", {
26
26
  return _blockEditor.transformStyles;
27
27
  }
28
28
  });
29
+ require("./bindings");
29
30
  require("./hooks");
30
31
  var _store = require("./store");
31
32
  var _components = require("./components");
@@ -1 +1 @@
1
- {"version":3,"names":["require","_store","_components","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_utils","_privateApis","_blockEditor"],"sources":["@wordpress/editor/src/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport './hooks';\n\nexport { storeConfig, store } from './store';\nexport * from './components';\nexport * from './utils';\nexport * from './private-apis';\n\n/*\n * Backward compatibility\n */\nexport { transformStyles } from '@wordpress/block-editor';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGAA,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAAAG,MAAA,CAAAC,IAAA,CAAAF,WAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,WAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,WAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,MAAA,GAAAf,OAAA;AAAAG,MAAA,CAAAC,IAAA,CAAAW,MAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,MAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,MAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,YAAA,GAAAhB,OAAA;AAAAG,MAAA,CAAAC,IAAA,CAAAY,YAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAU,YAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,YAAA,CAAAV,GAAA;IAAA;EAAA;AAAA;AAKA,IAAAW,YAAA,GAAAjB,OAAA"}
1
+ {"version":3,"names":["require","_store","_components","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_utils","_privateApis","_blockEditor"],"sources":["@wordpress/editor/src/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport './bindings';\nimport './hooks';\n\nexport { storeConfig, store } from './store';\nexport * from './components';\nexport * from './utils';\nexport * from './private-apis';\n\n/*\n * Backward compatibility\n */\nexport { transformStyles } from '@wordpress/block-editor';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGAA,OAAA;AACAA,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA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AA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,YAAA,CAAAV,GAAA;IAAA;EAAA;AAAA;AAKA,IAAAW,YAAA,GAAAjB,OAAA"}
@@ -8,15 +8,17 @@ exports.privateApis = void 0;
8
8
  var _editorCanvas = _interopRequireDefault(require("./components/editor-canvas"));
9
9
  var _provider = require("./components/provider");
10
10
  var _lockUnlock = require("./lock-unlock");
11
+ var _enablePluginDocumentSettingPanel = _interopRequireDefault(require("./components/preferences-modal/enable-plugin-document-setting-panel"));
11
12
  var _entitiesSavedStates = require("./components/entities-saved-states");
12
13
  var _useBlockEditorSettings = _interopRequireDefault(require("./components/provider/use-block-editor-settings"));
13
14
  var _documentTools = _interopRequireDefault(require("./components/document-tools"));
14
15
  var _inserterSidebar = _interopRequireDefault(require("./components/inserter-sidebar"));
15
16
  var _listViewSidebar = _interopRequireDefault(require("./components/list-view-sidebar"));
17
+ var _plugin = _interopRequireDefault(require("./components/post-excerpt/plugin"));
16
18
  var _postPanelRow = _interopRequireDefault(require("./components/post-panel-row"));
17
19
  var _postViewLink = _interopRequireDefault(require("./components/post-view-link"));
18
20
  var _previewDropdown = _interopRequireDefault(require("./components/preview-dropdown"));
19
- var _plugin = _interopRequireDefault(require("./components/post-excerpt/plugin"));
21
+ var _preferencesModal = _interopRequireDefault(require("./components/preferences-modal"));
20
22
  /**
21
23
  * Internal dependencies
22
24
  */
@@ -27,13 +29,15 @@ exports.privateApis = privateApis;
27
29
  DocumentTools: _documentTools.default,
28
30
  EditorCanvas: _editorCanvas.default,
29
31
  ExperimentalEditorProvider: _provider.ExperimentalEditorProvider,
32
+ EnablePluginDocumentSettingPanelOption: _enablePluginDocumentSettingPanel.default,
30
33
  EntitiesSavedStatesExtensible: _entitiesSavedStates.EntitiesSavedStatesExtensible,
31
34
  InserterSidebar: _inserterSidebar.default,
32
35
  ListViewSidebar: _listViewSidebar.default,
36
+ PluginPostExcerpt: _plugin.default,
33
37
  PostPanelRow: _postPanelRow.default,
34
38
  PostViewLink: _postViewLink.default,
35
39
  PreviewDropdown: _previewDropdown.default,
36
- PluginPostExcerpt: _plugin.default,
40
+ PreferencesModal: _preferencesModal.default,
37
41
  // This is a temporary private API while we're updating the site editor to use EditorProvider.
38
42
  useBlockEditorSettings: _useBlockEditorSettings.default
39
43
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_editorCanvas","_interopRequireDefault","require","_provider","_lockUnlock","_entitiesSavedStates","_useBlockEditorSettings","_documentTools","_inserterSidebar","_listViewSidebar","_postPanelRow","_postViewLink","_previewDropdown","_plugin","privateApis","exports","lock","DocumentTools","EditorCanvas","ExperimentalEditorProvider","EntitiesSavedStatesExtensible","InserterSidebar","ListViewSidebar","PostPanelRow","PostViewLink","PreviewDropdown","PluginPostExcerpt","useBlockEditorSettings"],"sources":["@wordpress/editor/src/private-apis.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport EditorCanvas from './components/editor-canvas';\nimport { ExperimentalEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport { EntitiesSavedStatesExtensible } from './components/entities-saved-states';\nimport useBlockEditorSettings from './components/provider/use-block-editor-settings';\nimport DocumentTools from './components/document-tools';\nimport InserterSidebar from './components/inserter-sidebar';\nimport ListViewSidebar from './components/list-view-sidebar';\nimport PostPanelRow from './components/post-panel-row';\nimport PostViewLink from './components/post-view-link';\nimport PreviewDropdown from './components/preview-dropdown';\nimport PluginPostExcerpt from './components/post-excerpt/plugin';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tDocumentTools,\n\tEditorCanvas,\n\tExperimentalEditorProvider,\n\tEntitiesSavedStatesExtensible,\n\tInserterSidebar,\n\tListViewSidebar,\n\tPostPanelRow,\n\tPostViewLink,\n\tPreviewDropdown,\n\tPluginPostExcerpt,\n\n\t// This is a temporary private API while we're updating the site editor to use EditorProvider.\n\tuseBlockEditorSettings,\n} );\n"],"mappings":";;;;;;;AAGA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAH,OAAA;AACA,IAAAI,uBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,cAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,gBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,gBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,aAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,aAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,gBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,OAAA,GAAAZ,sBAAA,CAAAC,OAAA;AAdA;AACA;AACA;;AAcO,MAAMY,WAAW,GAAG,CAAC,CAAC;AAACC,OAAA,CAAAD,WAAA,GAAAA,WAAA;AAC9B,IAAAE,gBAAI,EAAEF,WAAW,EAAE;EAClBG,aAAa,EAAbA,sBAAa;EACbC,YAAY,EAAZA,qBAAY;EACZC,0BAA0B,EAA1BA,oCAA0B;EAC1BC,6BAA6B,EAA7BA,kDAA6B;EAC7BC,eAAe,EAAfA,wBAAe;EACfC,eAAe,EAAfA,wBAAe;EACfC,YAAY,EAAZA,qBAAY;EACZC,YAAY,EAAZA,qBAAY;EACZC,eAAe,EAAfA,wBAAe;EACfC,iBAAiB,EAAjBA,eAAiB;EAEjB;EACAC,sBAAsB,EAAtBA;AACD,CAAE,CAAC"}
1
+ {"version":3,"names":["_editorCanvas","_interopRequireDefault","require","_provider","_lockUnlock","_enablePluginDocumentSettingPanel","_entitiesSavedStates","_useBlockEditorSettings","_documentTools","_inserterSidebar","_listViewSidebar","_plugin","_postPanelRow","_postViewLink","_previewDropdown","_preferencesModal","privateApis","exports","lock","DocumentTools","EditorCanvas","ExperimentalEditorProvider","EnablePluginDocumentSettingPanelOption","EntitiesSavedStatesExtensible","InserterSidebar","ListViewSidebar","PluginPostExcerpt","PostPanelRow","PostViewLink","PreviewDropdown","PreferencesModal","useBlockEditorSettings"],"sources":["@wordpress/editor/src/private-apis.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport EditorCanvas from './components/editor-canvas';\nimport { ExperimentalEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport EnablePluginDocumentSettingPanelOption from './components/preferences-modal/enable-plugin-document-setting-panel';\nimport { EntitiesSavedStatesExtensible } from './components/entities-saved-states';\nimport useBlockEditorSettings from './components/provider/use-block-editor-settings';\nimport DocumentTools from './components/document-tools';\nimport InserterSidebar from './components/inserter-sidebar';\nimport ListViewSidebar from './components/list-view-sidebar';\nimport PluginPostExcerpt from './components/post-excerpt/plugin';\nimport PostPanelRow from './components/post-panel-row';\nimport PostViewLink from './components/post-view-link';\nimport PreviewDropdown from './components/preview-dropdown';\nimport PreferencesModal from './components/preferences-modal';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tDocumentTools,\n\tEditorCanvas,\n\tExperimentalEditorProvider,\n\tEnablePluginDocumentSettingPanelOption,\n\tEntitiesSavedStatesExtensible,\n\tInserterSidebar,\n\tListViewSidebar,\n\tPluginPostExcerpt,\n\tPostPanelRow,\n\tPostViewLink,\n\tPreviewDropdown,\n\tPreferencesModal,\n\n\t// This is a temporary private API while we're updating the site editor to use EditorProvider.\n\tuseBlockEditorSettings,\n} );\n"],"mappings":";;;;;;;AAGA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,iCAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,oBAAA,GAAAJ,OAAA;AACA,IAAAK,uBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,cAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,gBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,gBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,OAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,aAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,aAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,gBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,iBAAA,GAAAd,sBAAA,CAAAC,OAAA;AAhBA;AACA;AACA;;AAgBO,MAAMc,WAAW,GAAG,CAAC,CAAC;AAACC,OAAA,CAAAD,WAAA,GAAAA,WAAA;AAC9B,IAAAE,gBAAI,EAAEF,WAAW,EAAE;EAClBG,aAAa,EAAbA,sBAAa;EACbC,YAAY,EAAZA,qBAAY;EACZC,0BAA0B,EAA1BA,oCAA0B;EAC1BC,sCAAsC,EAAtCA,yCAAsC;EACtCC,6BAA6B,EAA7BA,kDAA6B;EAC7BC,eAAe,EAAfA,wBAAe;EACfC,eAAe,EAAfA,wBAAe;EACfC,iBAAiB,EAAjBA,eAAiB;EACjBC,YAAY,EAAZA,qBAAY;EACZC,YAAY,EAAZA,qBAAY;EACZC,eAAe,EAAfA,wBAAe;EACfC,gBAAgB,EAAhBA,yBAAgB;EAEhB;EACAC,sBAAsB,EAAtBA;AACD,CAAE,CAAC"}
@@ -15,6 +15,7 @@ var _blockEditor = require("@wordpress/block-editor");
15
15
  * @property {boolean|Array} allowedBlockTypes Allowed block types
16
16
  * @property {boolean} richEditingEnabled Whether rich editing is enabled or not
17
17
  * @property {boolean} codeEditingEnabled Whether code editing is enabled or not
18
+ * @property {boolean} fontLibraryEnabled Whether the font library is enabled or not.
18
19
  * @property {boolean} enableCustomFields Whether the WordPress custom fields are enabled or not.
19
20
  * true = the user has opted to show the Custom Fields panel at the bottom of the editor.
20
21
  * false = the user has opted to hide the Custom Fields panel at the bottom of the editor.
@@ -31,6 +32,7 @@ const EDITOR_SETTINGS_DEFAULTS = {
31
32
  ..._blockEditor.SETTINGS_DEFAULTS,
32
33
  richEditingEnabled: true,
33
34
  codeEditingEnabled: true,
35
+ fontLibraryEnabled: true,
34
36
  enableCustomFields: undefined,
35
37
  defaultRenderingMode: 'post-only'
36
38
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","EDITOR_SETTINGS_DEFAULTS","SETTINGS_DEFAULTS","richEditingEnabled","codeEditingEnabled","enableCustomFields","undefined","defaultRenderingMode","exports"],"sources":["@wordpress/editor/src/store/defaults.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SETTINGS_DEFAULTS } from '@wordpress/block-editor';\n\n/**\n * The default post editor settings.\n *\n * @property {boolean|Array} allowedBlockTypes Allowed block types\n * @property {boolean} richEditingEnabled Whether rich editing is enabled or not\n * @property {boolean} codeEditingEnabled Whether code editing is enabled or not\n * @property {boolean} enableCustomFields Whether the WordPress custom fields are enabled or not.\n * true = the user has opted to show the Custom Fields panel at the bottom of the editor.\n * false = the user has opted to hide the Custom Fields panel at the bottom of the editor.\n * undefined = the current environment does not support Custom Fields, so the option toggle in Preferences -> Panels to enable the Custom Fields panel is not displayed.\n * @property {number} autosaveInterval How often in seconds the post will be auto-saved via the REST API.\n * @property {number} localAutosaveInterval How often in seconds the post will be backed up to sessionStorage.\n * @property {Array?} availableTemplates The available post templates\n * @property {boolean} disablePostFormats Whether or not the post formats are disabled\n * @property {Array?} allowedMimeTypes List of allowed mime types and file extensions\n * @property {number} maxUploadFileSize Maximum upload file size\n * @property {boolean} supportsLayout Whether the editor supports layouts.\n */\nexport const EDITOR_SETTINGS_DEFAULTS = {\n\t...SETTINGS_DEFAULTS,\n\n\trichEditingEnabled: true,\n\tcodeEditingEnabled: true,\n\tenableCustomFields: undefined,\n\tdefaultRenderingMode: 'post-only',\n};\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,wBAAwB,GAAG;EACvC,GAAGC,8BAAiB;EAEpBC,kBAAkB,EAAE,IAAI;EACxBC,kBAAkB,EAAE,IAAI;EACxBC,kBAAkB,EAAEC,SAAS;EAC7BC,oBAAoB,EAAE;AACvB,CAAC;AAACC,OAAA,CAAAP,wBAAA,GAAAA,wBAAA"}
1
+ {"version":3,"names":["_blockEditor","require","EDITOR_SETTINGS_DEFAULTS","SETTINGS_DEFAULTS","richEditingEnabled","codeEditingEnabled","fontLibraryEnabled","enableCustomFields","undefined","defaultRenderingMode","exports"],"sources":["@wordpress/editor/src/store/defaults.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SETTINGS_DEFAULTS } from '@wordpress/block-editor';\n\n/**\n * The default post editor settings.\n *\n * @property {boolean|Array} allowedBlockTypes Allowed block types\n * @property {boolean} richEditingEnabled Whether rich editing is enabled or not\n * @property {boolean} codeEditingEnabled Whether code editing is enabled or not\n * @property {boolean} fontLibraryEnabled Whether the font library is enabled or not.\n * @property {boolean} enableCustomFields Whether the WordPress custom fields are enabled or not.\n * true = the user has opted to show the Custom Fields panel at the bottom of the editor.\n * false = the user has opted to hide the Custom Fields panel at the bottom of the editor.\n * undefined = the current environment does not support Custom Fields, so the option toggle in Preferences -> Panels to enable the Custom Fields panel is not displayed.\n * @property {number} autosaveInterval How often in seconds the post will be auto-saved via the REST API.\n * @property {number} localAutosaveInterval How often in seconds the post will be backed up to sessionStorage.\n * @property {Array?} availableTemplates The available post templates\n * @property {boolean} disablePostFormats Whether or not the post formats are disabled\n * @property {Array?} allowedMimeTypes List of allowed mime types and file extensions\n * @property {number} maxUploadFileSize Maximum upload file size\n * @property {boolean} supportsLayout Whether the editor supports layouts.\n */\nexport const EDITOR_SETTINGS_DEFAULTS = {\n\t...SETTINGS_DEFAULTS,\n\n\trichEditingEnabled: true,\n\tcodeEditingEnabled: true,\n\tfontLibraryEnabled: true,\n\tenableCustomFields: undefined,\n\tdefaultRenderingMode: 'post-only',\n};\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,wBAAwB,GAAG;EACvC,GAAGC,8BAAiB;EAEpBC,kBAAkB,EAAE,IAAI;EACxBC,kBAAkB,EAAE,IAAI;EACxBC,kBAAkB,EAAE,IAAI;EACxBC,kBAAkB,EAAEC,SAAS;EAC7BC,oBAAoB,EAAE;AACvB,CAAC;AAACC,OAAA,CAAAR,wBAAA,GAAAA,wBAAA"}
@@ -3,11 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.createTemplate = void 0;
6
+ exports.hideBlockTypes = exports.createTemplate = void 0;
7
7
  exports.setCurrentTemplateId = setCurrentTemplateId;
8
+ exports.showBlockTypes = void 0;
8
9
  var _coreData = require("@wordpress/core-data");
9
10
  var _i18n = require("@wordpress/i18n");
10
11
  var _notices = require("@wordpress/notices");
12
+ var _preferences = require("@wordpress/preferences");
11
13
  /**
12
14
  * WordPress dependencies
13
15
  */
@@ -48,5 +50,35 @@ const createTemplate = template => async ({
48
50
  }]
49
51
  });
50
52
  };
53
+
54
+ /**
55
+ * Update the provided block types to be visible.
56
+ *
57
+ * @param {string[]} blockNames Names of block types to show.
58
+ */
51
59
  exports.createTemplate = createTemplate;
60
+ const showBlockTypes = blockNames => ({
61
+ registry
62
+ }) => {
63
+ var _registry$select$get;
64
+ const existingBlockNames = (_registry$select$get = registry.select(_preferences.store).get('core', 'hiddenBlockTypes')) !== null && _registry$select$get !== void 0 ? _registry$select$get : [];
65
+ const newBlockNames = existingBlockNames.filter(type => !(Array.isArray(blockNames) ? blockNames : [blockNames]).includes(type));
66
+ registry.dispatch(_preferences.store).set('core', 'hiddenBlockTypes', newBlockNames);
67
+ };
68
+
69
+ /**
70
+ * Update the provided block types to be hidden.
71
+ *
72
+ * @param {string[]} blockNames Names of block types to hide.
73
+ */
74
+ exports.showBlockTypes = showBlockTypes;
75
+ const hideBlockTypes = blockNames => ({
76
+ registry
77
+ }) => {
78
+ var _registry$select$get2;
79
+ const existingBlockNames = (_registry$select$get2 = registry.select(_preferences.store).get('core', 'hiddenBlockTypes')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : [];
80
+ const mergedBlockNames = new Set([...existingBlockNames, ...(Array.isArray(blockNames) ? blockNames : [blockNames])]);
81
+ registry.dispatch(_preferences.store).set('core', 'hiddenBlockTypes', [...mergedBlockNames]);
82
+ };
83
+ exports.hideBlockTypes = hideBlockTypes;
52
84
  //# sourceMappingURL=private-actions.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_coreData","require","_i18n","_notices","setCurrentTemplateId","id","type","createTemplate","template","select","dispatch","registry","savedTemplate","coreStore","saveEntityRecord","editEntityRecord","getCurrentPostType","getCurrentPostId","slug","noticesStore","createSuccessNotice","__","actions","label","onClick","setRenderingMode","getEditorSettings","defaultRenderingMode","exports"],"sources":["@wordpress/editor/src/store/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Returns an action object used to set which template is currently being used/edited.\n *\n * @param {string} id Template Id.\n *\n * @return {Object} Action object.\n */\nexport function setCurrentTemplateId( id ) {\n\treturn {\n\t\ttype: 'SET_CURRENT_TEMPLATE_ID',\n\t\tid,\n\t};\n}\n\n/**\n * Create a block based template.\n *\n * @param {Object?} template Template to create and assign.\n */\nexport const createTemplate =\n\t( template ) =>\n\tasync ( { select, dispatch, registry } ) => {\n\t\tconst savedTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\t\tregistry\n\t\t\t.dispatch( coreStore )\n\t\t\t.editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tselect.getCurrentPostType(),\n\t\t\t\tselect.getCurrentPostId(),\n\t\t\t\t{\n\t\t\t\t\ttemplate: savedTemplate.slug,\n\t\t\t\t}\n\t\t\t);\n\t\tregistry\n\t\t\t.dispatch( noticesStore )\n\t\t\t.createSuccessNotice(\n\t\t\t\t__( \"Custom template created. You're in template mode now.\" ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\t\t\tdispatch.setRenderingMode(\n\t\t\t\t\t\t\t\t\tselect.getEditorSettings()\n\t\t\t\t\t\t\t\t\t\t.defaultRenderingMode\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t};\n"],"mappings":";;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,oBAAoBA,CAAEC,EAAE,EAAG;EAC1C,OAAO;IACNC,IAAI,EAAE,yBAAyB;IAC/BD;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACO,MAAME,cAAc,GACxBC,QAAQ,IACV,OAAQ;EAAEC,MAAM;EAAEC,QAAQ;EAAEC;AAAS,CAAC,KAAM;EAC3C,MAAMC,aAAa,GAAG,MAAMD,QAAQ,CAClCD,QAAQ,CAAEG,eAAU,CAAC,CACrBC,gBAAgB,CAAE,UAAU,EAAE,aAAa,EAAEN,QAAS,CAAC;EACzDG,QAAQ,CACND,QAAQ,CAAEG,eAAU,CAAC,CACrBE,gBAAgB,CAChB,UAAU,EACVN,MAAM,CAACO,kBAAkB,CAAC,CAAC,EAC3BP,MAAM,CAACQ,gBAAgB,CAAC,CAAC,EACzB;IACCT,QAAQ,EAAEI,aAAa,CAACM;EACzB,CACD,CAAC;EACFP,QAAQ,CACND,QAAQ,CAAES,cAAa,CAAC,CACxBC,mBAAmB,CACnB,IAAAC,QAAE,EAAE,uDAAwD,CAAC,EAC7D;IACCf,IAAI,EAAE,UAAU;IAChBgB,OAAO,EAAE,CACR;MACCC,KAAK,EAAE,IAAAF,QAAE,EAAE,SAAU,CAAC;MACtBG,OAAO,EAAEA,CAAA,KACRd,QAAQ,CAACe,gBAAgB,CACxBhB,MAAM,CAACiB,iBAAiB,CAAC,CAAC,CACxBC,oBACH;IACF,CAAC;EAEH,CACD,CAAC;AACH,CAAC;AAACC,OAAA,CAAArB,cAAA,GAAAA,cAAA"}
1
+ {"version":3,"names":["_coreData","require","_i18n","_notices","_preferences","setCurrentTemplateId","id","type","createTemplate","template","select","dispatch","registry","savedTemplate","coreStore","saveEntityRecord","editEntityRecord","getCurrentPostType","getCurrentPostId","slug","noticesStore","createSuccessNotice","__","actions","label","onClick","setRenderingMode","getEditorSettings","defaultRenderingMode","exports","showBlockTypes","blockNames","_registry$select$get","existingBlockNames","preferencesStore","get","newBlockNames","filter","Array","isArray","includes","set","hideBlockTypes","_registry$select$get2","mergedBlockNames","Set"],"sources":["@wordpress/editor/src/store/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Returns an action object used to set which template is currently being used/edited.\n *\n * @param {string} id Template Id.\n *\n * @return {Object} Action object.\n */\nexport function setCurrentTemplateId( id ) {\n\treturn {\n\t\ttype: 'SET_CURRENT_TEMPLATE_ID',\n\t\tid,\n\t};\n}\n\n/**\n * Create a block based template.\n *\n * @param {Object?} template Template to create and assign.\n */\nexport const createTemplate =\n\t( template ) =>\n\tasync ( { select, dispatch, registry } ) => {\n\t\tconst savedTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\t\tregistry\n\t\t\t.dispatch( coreStore )\n\t\t\t.editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tselect.getCurrentPostType(),\n\t\t\t\tselect.getCurrentPostId(),\n\t\t\t\t{\n\t\t\t\t\ttemplate: savedTemplate.slug,\n\t\t\t\t}\n\t\t\t);\n\t\tregistry\n\t\t\t.dispatch( noticesStore )\n\t\t\t.createSuccessNotice(\n\t\t\t\t__( \"Custom template created. You're in template mode now.\" ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\t\t\tdispatch.setRenderingMode(\n\t\t\t\t\t\t\t\t\tselect.getEditorSettings()\n\t\t\t\t\t\t\t\t\t\t.defaultRenderingMode\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t};\n\n/**\n * Update the provided block types to be visible.\n *\n * @param {string[]} blockNames Names of block types to show.\n */\nexport const showBlockTypes =\n\t( blockNames ) =>\n\t( { registry } ) => {\n\t\tconst existingBlockNames =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'hiddenBlockTypes' ) ?? [];\n\n\t\tconst newBlockNames = existingBlockNames.filter(\n\t\t\t( type ) =>\n\t\t\t\t! (\n\t\t\t\t\tArray.isArray( blockNames ) ? blockNames : [ blockNames ]\n\t\t\t\t).includes( type )\n\t\t);\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core', 'hiddenBlockTypes', newBlockNames );\n\t};\n\n/**\n * Update the provided block types to be hidden.\n *\n * @param {string[]} blockNames Names of block types to hide.\n */\nexport const hideBlockTypes =\n\t( blockNames ) =>\n\t( { registry } ) => {\n\t\tconst existingBlockNames =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'hiddenBlockTypes' ) ?? [];\n\n\t\tconst mergedBlockNames = new Set( [\n\t\t\t...existingBlockNames,\n\t\t\t...( Array.isArray( blockNames ) ? blockNames : [ blockNames ] ),\n\t\t] );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core', 'hiddenBlockTypes', [ ...mergedBlockNames ] );\n\t};\n"],"mappings":";;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,oBAAoBA,CAAEC,EAAE,EAAG;EAC1C,OAAO;IACNC,IAAI,EAAE,yBAAyB;IAC/BD;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACO,MAAME,cAAc,GACxBC,QAAQ,IACV,OAAQ;EAAEC,MAAM;EAAEC,QAAQ;EAAEC;AAAS,CAAC,KAAM;EAC3C,MAAMC,aAAa,GAAG,MAAMD,QAAQ,CAClCD,QAAQ,CAAEG,eAAU,CAAC,CACrBC,gBAAgB,CAAE,UAAU,EAAE,aAAa,EAAEN,QAAS,CAAC;EACzDG,QAAQ,CACND,QAAQ,CAAEG,eAAU,CAAC,CACrBE,gBAAgB,CAChB,UAAU,EACVN,MAAM,CAACO,kBAAkB,CAAC,CAAC,EAC3BP,MAAM,CAACQ,gBAAgB,CAAC,CAAC,EACzB;IACCT,QAAQ,EAAEI,aAAa,CAACM;EACzB,CACD,CAAC;EACFP,QAAQ,CACND,QAAQ,CAAES,cAAa,CAAC,CACxBC,mBAAmB,CACnB,IAAAC,QAAE,EAAE,uDAAwD,CAAC,EAC7D;IACCf,IAAI,EAAE,UAAU;IAChBgB,OAAO,EAAE,CACR;MACCC,KAAK,EAAE,I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AkB,EACrB,IAAKK,KAAK,CAACC,OAAO,CAAER,UAAW,CAAC,GAAGA,UAAU,GAAG,CAAEA,UAAU,CAAE,CAAE,CAC/D,CAAC;EAEHnB,QAAQ,CACND,QAAQ,CAAEuB,kBAAiB,CAAC,CAC5BO,GAAG,CAAE,MAAM,EAAE,kBAAkB,EAAE,CAAE,GAAGG,gBAAgB,CAAG,CAAC;AAC7D,CAAC;AAACf,OAAA,CAAAa,cAAA,GAAAA,cAAA"}
@@ -34,7 +34,7 @@ const getInsertionPoint = (0, _data.createRegistrySelector)(select => state => {
34
34
  return state.blockInserterPanel;
35
35
  }
36
36
  if ((0, _selectors.getRenderingMode)(state) === 'template-locked') {
37
- const [postContentClientId] = select(_blockEditor.store).__experimentalGetGlobalBlocksByName('core/post-content');
37
+ const [postContentClientId] = select(_blockEditor.store).getBlocksByName('core/post-content');
38
38
  if (postContentClientId) {
39
39
  return {
40
40
  rootClientId: postContentClientId,
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","_data","_selectors","EMPTY_INSERTION_POINT","rootClientId","undefined","insertionIndex","filterValue","getInsertionPoint","createRegistrySelector","select","state","blockInserterPanel","getRenderingMode","postContentClientId","blockEditorStore","__experimentalGetGlobalBlocksByName","exports","getListViewToggleRef","listViewToggleRef"],"sources":["@wordpress/editor/src/store/private-selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { createRegistrySelector } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { getRenderingMode } from './selectors';\n\nconst EMPTY_INSERTION_POINT = {\n\trootClientId: undefined,\n\tinsertionIndex: undefined,\n\tfilterValue: undefined,\n};\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport const getInsertionPoint = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tif ( typeof state.blockInserterPanel === 'object' ) {\n\t\t\treturn state.blockInserterPanel;\n\t\t}\n\n\t\tif ( getRenderingMode( state ) === 'template-locked' ) {\n\t\t\tconst [ postContentClientId ] =\n\t\t\t\tselect( blockEditorStore ).__experimentalGetGlobalBlocksByName(\n\t\t\t\t\t'core/post-content'\n\t\t\t\t);\n\t\t\tif ( postContentClientId ) {\n\t\t\t\treturn {\n\t\t\t\t\trootClientId: postContentClientId,\n\t\t\t\t\tinsertionIndex: undefined,\n\t\t\t\t\tfilterValue: undefined,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn EMPTY_INSERTION_POINT;\n\t}\n);\n\nexport function getListViewToggleRef( state ) {\n\treturn state.listViewToggleRef;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA,MAAMG,qBAAqB,GAAG;EAC7BC,YAAY,EAAEC,SAAS;EACvBC,cAAc,EAAED,SAAS;EACzBE,WAAW,EAAEF;AACd,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,iBAAiB,GAAG,IAAAC,4BAAsB,EACpDC,MAAM,IAAQC,KAAK,IAAM;EAC1B,IAAK,OAAOA,KAAK,CAACC,kBAAkB,KAAK,QAAQ,EAAG;IACnD,OAAOD,KAAK,CAACC,kBAAkB;EAChC;EAEA,IAAK,IAAAC,2BAAgB,EAAEF,KAAM,CAAC,KAAK,iBAAiB,EAAG;IACtD,MAAM,CAAEG,mBAAmB,CAAE,GAC5BJ,MAAM,CAAEK,kBAAiB,CAAC,CAACC,mCAAmC,CAC7D,mBACD,CAAC;IACF,IAAKF,mBAAmB,EAAG;MAC1B,OAAO;QACNV,YAAY,EAAEU,mBAAmB;QACjCR,cAAc,EAAED,SAAS;QACzBE,WAAW,EAAEF;MACd,CAAC;IACF;EACD;EAEA,OAAOF,qBAAqB;AAC7B,CACD,CAAC;AAACc,OAAA,CAAAT,iBAAA,GAAAA,iBAAA;AAEK,SAASU,oBAAoBA,CAAEP,KAAK,EAAG;EAC7C,OAAOA,KAAK,CAACQ,iBAAiB;AAC/B"}
1
+ {"version":3,"names":["_blockEditor","require","_data","_selectors","EMPTY_INSERTION_POINT","rootClientId","undefined","insertionIndex","filterValue","getInsertionPoint","createRegistrySelector","select","state","blockInserterPanel","getRenderingMode","postContentClientId","blockEditorStore","getBlocksByName","exports","getListViewToggleRef","listViewToggleRef"],"sources":["@wordpress/editor/src/store/private-selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { createRegistrySelector } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { getRenderingMode } from './selectors';\n\nconst EMPTY_INSERTION_POINT = {\n\trootClientId: undefined,\n\tinsertionIndex: undefined,\n\tfilterValue: undefined,\n};\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport const getInsertionPoint = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tif ( typeof state.blockInserterPanel === 'object' ) {\n\t\t\treturn state.blockInserterPanel;\n\t\t}\n\n\t\tif ( getRenderingMode( state ) === 'template-locked' ) {\n\t\t\tconst [ postContentClientId ] =\n\t\t\t\tselect( blockEditorStore ).getBlocksByName(\n\t\t\t\t\t'core/post-content'\n\t\t\t\t);\n\t\t\tif ( postContentClientId ) {\n\t\t\t\treturn {\n\t\t\t\t\trootClientId: postContentClientId,\n\t\t\t\t\tinsertionIndex: undefined,\n\t\t\t\t\tfilterValue: undefined,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn EMPTY_INSERTION_POINT;\n\t}\n);\n\nexport function getListViewToggleRef( state ) {\n\treturn state.listViewToggleRef;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA,MAAMG,qBAAqB,GAAG;EAC7BC,YAAY,EAAEC,SAAS;EACvBC,cAAc,EAAED,SAAS;EACzBE,WAAW,EAAEF;AACd,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,iBAAiB,GAAG,IAAAC,4BAAsB,EACpDC,MAAM,IAAQC,KAAK,IAAM;EAC1B,IAAK,OAAOA,KAAK,CAACC,kBAAkB,KAAK,QAAQ,EAAG;IACnD,OAAOD,KAAK,CAACC,kBAAkB;EAChC;EAEA,IAAK,IAAAC,2BAAgB,EAAEF,KAAM,CAAC,KAAK,iBAAiB,EAAG;IACtD,MAAM,CAAEG,mBAAmB,CAAE,GAC5BJ,MAAM,CAAEK,kBAAiB,CAAC,CAACC,eAAe,CACzC,mBACD,CAAC;IACF,IAAKF,mBAAmB,EAAG;MAC1B,OAAO;QACNV,YAAY,EAAEU,mBAAmB;QACjCR,cAAc,EAAED,SAAS;QACzBE,WAAW,EAAEF;MACd,CAAC;IACF;EACD;EAEA,OAAOF,qBAAqB;AAC7B,CACD,CAAC;AAACc,OAAA,CAAAT,iBAAA,GAAAA,iBAAA;AAEK,SAASU,oBAAoBA,CAAEP,KAAK,EAAG;EAC7C,OAAOA,KAAK,CAACQ,iBAAiB;AAC/B"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { store as blockEditorStore } from '@wordpress/block-editor';
5
+ import { dispatch } from '@wordpress/data';
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import { unlock } from '../lock-unlock';
10
+ import postMeta from './post-meta';
11
+ const {
12
+ registerBlockBindingsSource
13
+ } = unlock(dispatch(blockEditorStore));
14
+ registerBlockBindingsSource(postMeta);
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["store","blockEditorStore","dispatch","unlock","postMeta","registerBlockBindingsSource"],"sources":["@wordpress/editor/src/bindings/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { dispatch } from '@wordpress/data';\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport postMeta from './post-meta';\n\nconst { registerBlockBindingsSource } = unlock( dispatch( blockEditorStore ) );\nregisterBlockBindingsSource( postMeta );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C;AACA;AACA;AACA,SAASC,MAAM,QAAQ,gBAAgB;AACvC,OAAOC,QAAQ,MAAM,aAAa;AAElC,MAAM;EAAEC;AAA4B,CAAC,GAAGF,MAAM,CAAED,QAAQ,CAAED,gBAAiB,CAAE,CAAC;AAC9EI,2BAA2B,CAAED,QAAS,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useEntityProp } from '@wordpress/core-data';
5
+ import { useSelect } from '@wordpress/data';
6
+ import { __ } from '@wordpress/i18n';
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { store as editorStore } from '../store';
11
+ export default {
12
+ name: 'post_meta',
13
+ label: __('Post Meta'),
14
+ useSource(props, sourceAttributes) {
15
+ const {
16
+ getCurrentPostType
17
+ } = useSelect(editorStore);
18
+ const {
19
+ context
20
+ } = props;
21
+ const {
22
+ value: metaKey
23
+ } = sourceAttributes;
24
+ const postType = context.postType ? context.postType : getCurrentPostType();
25
+ const [meta, setMeta] = useEntityProp('postType', context.postType, 'meta', context.postId);
26
+ if (postType === 'wp_template') {
27
+ return {
28
+ placeholder: metaKey
29
+ };
30
+ }
31
+ const metaValue = meta[metaKey];
32
+ const updateMetaValue = newValue => {
33
+ setMeta({
34
+ ...meta,
35
+ [metaKey]: newValue
36
+ });
37
+ };
38
+ return {
39
+ placeholder: metaKey,
40
+ useValue: [metaValue, updateMetaValue]
41
+ };
42
+ },
43
+ lockAttributesEditing: true
44
+ };
45
+ //# sourceMappingURL=post-meta.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEntityProp","useSelect","__","store","editorStore","name","label","useSource","props","sourceAttributes","getCurrentPostType","context","value","metaKey","postType","meta","setMeta","postId","placeholder","metaValue","updateMetaValue","newValue","useValue","lockAttributesEditing"],"sources":["@wordpress/editor/src/bindings/post-meta.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\nexport default {\n\tname: 'post_meta',\n\tlabel: __( 'Post Meta' ),\n\tuseSource( props, sourceAttributes ) {\n\t\tconst { getCurrentPostType } = useSelect( editorStore );\n\t\tconst { context } = props;\n\t\tconst { value: metaKey } = sourceAttributes;\n\t\tconst postType = context.postType\n\t\t\t? context.postType\n\t\t\t: getCurrentPostType();\n\t\tconst [ meta, setMeta ] = useEntityProp(\n\t\t\t'postType',\n\t\t\tcontext.postType,\n\t\t\t'meta',\n\t\t\tcontext.postId\n\t\t);\n\n\t\tif ( postType === 'wp_template' ) {\n\t\t\treturn { placeholder: metaKey };\n\t\t}\n\t\tconst metaValue = meta[ metaKey ];\n\t\tconst updateMetaValue = ( newValue ) => {\n\t\t\tsetMeta( { ...meta, [ metaKey ]: newValue } );\n\t\t};\n\t\treturn {\n\t\t\tplaceholder: metaKey,\n\t\t\tuseValue: [ metaValue, updateMetaValue ],\n\t\t};\n\t},\n\tlockAttributesEditing: true,\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,sBAAsB;AACpD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,UAAU;AAE/C,eAAe;EACdC,IAAI,EAAE,WAAW;EACjBC,KAAK,EAAEJ,EAAE,CAAE,WAAY,CAAC;EACxBK,SAASA,CAAEC,KAAK,EAAEC,gBAAgB,EAAG;IACpC,MAAM;MAAEC;IAAmB,CAAC,GAAGT,SAAS,CAAEG,WAAY,CAAC;IACvD,MAAM;MAAEO;IAAQ,CAAC,GAAGH,KAAK;IACzB,MAAM;MAAEI,KAAK,EAAEC;IAAQ,CAAC,GAAGJ,gBAAgB;IAC3C,MAAMK,QAAQ,GAAGH,OAAO,CAACG,QAAQ,GAC9BH,OAAO,CAACG,QAAQ,GAChBJ,kBAAkB,CAAC,CAAC;IACvB,MAAM,CAAEK,IAAI,EAAEC,OAAO,CAAE,GAAGhB,aAAa,CACtC,UAAU,EACVW,OAAO,CAACG,QAAQ,EAChB,MAAM,EACNH,OAAO,CAACM,MACT,CAAC;IAED,IAAKH,QAAQ,KAAK,aAAa,EAAG;MACjC,OAAO;QAAEI,WAAW,EAAEL;MAAQ,CAAC;IAChC;IACA,MAAMM,SAAS,GAAGJ,IAAI,CAAEF,OAAO,CAAE;IACjC,MAAMO,eAAe,GAAKC,QAAQ,IAAM;MACvCL,OAAO,CAAE;QAAE,GAAGD,IAAI;QAAE,CAAEF,OAAO,GAAIQ;MAAS,CAAE,CAAC;IAC9C,CAAC;IACD,OAAO;MACNH,WAAW,EAAEL,OAAO;MACpBS,QAAQ,EAAE,CAAEH,SAAS,EAAEC,eAAe;IACvC,CAAC;EACF,CAAC;EACDG,qBAAqB,EAAE;AACxB,CAAC"}
@@ -0,0 +1,97 @@
1
+ import { createElement } from "react";
2
+ /**
3
+ * WordPress dependencies
4
+ */
5
+ import { useMemo, useCallback } from '@wordpress/element';
6
+ import { useDispatch, useSelect } from '@wordpress/data';
7
+ import { useInstanceId } from '@wordpress/compose';
8
+ import { CheckboxControl } from '@wordpress/components';
9
+ import { store as preferencesStore } from '@wordpress/preferences';
10
+
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+ import BlockTypesChecklist from './checklist';
15
+ import { store as editorStore } from '../../store';
16
+ import { unlock } from '../../lock-unlock';
17
+ function BlockManagerCategory({
18
+ title,
19
+ blockTypes
20
+ }) {
21
+ const instanceId = useInstanceId(BlockManagerCategory);
22
+ const {
23
+ allowedBlockTypes,
24
+ hiddenBlockTypes
25
+ } = useSelect(select => {
26
+ const {
27
+ getEditorSettings
28
+ } = select(editorStore);
29
+ const {
30
+ get
31
+ } = select(preferencesStore);
32
+ return {
33
+ allowedBlockTypes: getEditorSettings().allowedBlockTypes,
34
+ hiddenBlockTypes: get('core', 'hiddenBlockTypes')
35
+ };
36
+ }, []);
37
+ const filteredBlockTypes = useMemo(() => {
38
+ if (allowedBlockTypes === true) {
39
+ return blockTypes;
40
+ }
41
+ return blockTypes.filter(({
42
+ name
43
+ }) => {
44
+ return allowedBlockTypes?.includes(name);
45
+ });
46
+ }, [allowedBlockTypes, blockTypes]);
47
+ const {
48
+ showBlockTypes,
49
+ hideBlockTypes
50
+ } = unlock(useDispatch(editorStore));
51
+ const toggleVisible = useCallback((blockName, nextIsChecked) => {
52
+ if (nextIsChecked) {
53
+ showBlockTypes(blockName);
54
+ } else {
55
+ hideBlockTypes(blockName);
56
+ }
57
+ }, [showBlockTypes, hideBlockTypes]);
58
+ const toggleAllVisible = useCallback(nextIsChecked => {
59
+ const blockNames = blockTypes.map(({
60
+ name
61
+ }) => name);
62
+ if (nextIsChecked) {
63
+ showBlockTypes(blockNames);
64
+ } else {
65
+ hideBlockTypes(blockNames);
66
+ }
67
+ }, [blockTypes, showBlockTypes, hideBlockTypes]);
68
+ if (!filteredBlockTypes.length) {
69
+ return null;
70
+ }
71
+ const checkedBlockNames = filteredBlockTypes.map(({
72
+ name
73
+ }) => name).filter(type => !(hiddenBlockTypes !== null && hiddenBlockTypes !== void 0 ? hiddenBlockTypes : []).includes(type));
74
+ const titleId = 'editor-block-manager__category-title-' + instanceId;
75
+ const isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;
76
+ const isIndeterminate = !isAllChecked && checkedBlockNames.length > 0;
77
+ return createElement("div", {
78
+ role: "group",
79
+ "aria-labelledby": titleId,
80
+ className: "editor-block-manager__category"
81
+ }, createElement(CheckboxControl, {
82
+ __nextHasNoMarginBottom: true,
83
+ checked: isAllChecked,
84
+ onChange: toggleAllVisible,
85
+ className: "editor-block-manager__category-title",
86
+ indeterminate: isIndeterminate,
87
+ label: createElement("span", {
88
+ id: titleId
89
+ }, title)
90
+ }), createElement(BlockTypesChecklist, {
91
+ blockTypes: filteredBlockTypes,
92
+ value: checkedBlockNames,
93
+ onItemChange: toggleVisible
94
+ }));
95
+ }
96
+ export default BlockManagerCategory;
97
+ //# sourceMappingURL=category.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useMemo","useCallback","useDispatch","useSelect","useInstanceId","CheckboxControl","store","preferencesStore","BlockTypesChecklist","editorStore","unlock","BlockManagerCategory","title","blockTypes","instanceId","allowedBlockTypes","hiddenBlockTypes","select","getEditorSettings","get","filteredBlockTypes","filter","name","includes","showBlockTypes","hideBlockTypes","toggleVisible","blockName","nextIsChecked","toggleAllVisible","blockNames","map","length","checkedBlockNames","type","titleId","isAllChecked","isIndeterminate","createElement","role","className","__nextHasNoMarginBottom","checked","onChange","indeterminate","label","id","value","onItemChange"],"sources":["@wordpress/editor/src/components/block-manager/category.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { CheckboxControl } from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesChecklist from './checklist';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction BlockManagerCategory( { title, blockTypes } ) {\n\tconst instanceId = useInstanceId( BlockManagerCategory );\n\tconst { allowedBlockTypes, hiddenBlockTypes } = useSelect( ( select ) => {\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst { get } = select( preferencesStore );\n\t\treturn {\n\t\t\tallowedBlockTypes: getEditorSettings().allowedBlockTypes,\n\t\t\thiddenBlockTypes: get( 'core', 'hiddenBlockTypes' ),\n\t\t};\n\t}, [] );\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( allowedBlockTypes === true ) {\n\t\t\treturn blockTypes;\n\t\t}\n\t\treturn blockTypes.filter( ( { name } ) => {\n\t\t\treturn allowedBlockTypes?.includes( name );\n\t\t} );\n\t}, [ allowedBlockTypes, blockTypes ] );\n\tconst { showBlockTypes, hideBlockTypes } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\tconst toggleVisible = useCallback(\n\t\t( blockName, nextIsChecked ) => {\n\t\t\tif ( nextIsChecked ) {\n\t\t\t\tshowBlockTypes( blockName );\n\t\t\t} else {\n\t\t\t\thideBlockTypes( blockName );\n\t\t\t}\n\t\t},\n\t\t[ showBlockTypes, hideBlockTypes ]\n\t);\n\tconst toggleAllVisible = useCallback(\n\t\t( nextIsChecked ) => {\n\t\t\tconst blockNames = blockTypes.map( ( { name } ) => name );\n\t\t\tif ( nextIsChecked ) {\n\t\t\t\tshowBlockTypes( blockNames );\n\t\t\t} else {\n\t\t\t\thideBlockTypes( blockNames );\n\t\t\t}\n\t\t},\n\t\t[ blockTypes, showBlockTypes, hideBlockTypes ]\n\t);\n\n\tif ( ! filteredBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\tconst checkedBlockNames = filteredBlockTypes\n\t\t.map( ( { name } ) => name )\n\t\t.filter( ( type ) => ! ( hiddenBlockTypes ?? [] ).includes( type ) );\n\n\tconst titleId = 'editor-block-manager__category-title-' + instanceId;\n\n\tconst isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;\n\tconst isIndeterminate = ! isAllChecked && checkedBlockNames.length > 0;\n\n\treturn (\n\t\t<div\n\t\t\trole=\"group\"\n\t\t\taria-labelledby={ titleId }\n\t\t\tclassName=\"editor-block-manager__category\"\n\t\t>\n\t\t\t<CheckboxControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tchecked={ isAllChecked }\n\t\t\t\tonChange={ toggleAllVisible }\n\t\t\t\tclassName=\"editor-block-manager__category-title\"\n\t\t\t\tindeterminate={ isIndeterminate }\n\t\t\t\tlabel={ <span id={ titleId }>{ title }</span> }\n\t\t\t/>\n\t\t\t<BlockTypesChecklist\n\t\t\t\tblockTypes={ filteredBlockTypes }\n\t\t\t\tvalue={ checkedBlockNames }\n\t\t\t\tonItemChange={ toggleVisible }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default BlockManagerCategory;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,WAAW,QAAQ,oBAAoB;AACzD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,aAAa;AAC7C,SAASF,KAAK,IAAIG,WAAW,QAAQ,aAAa;AAClD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,SAASC,oBAAoBA,CAAE;EAAEC,KAAK;EAAEC;AAAW,CAAC,EAAG;EACtD,MAAMC,UAAU,GAAGV,aAAa,CAAEO,oBAAqB,CAAC;EACxD,MAAM;IAAEI,iBAAiB;IAAEC;EAAiB,CAAC,GAAGb,SAAS,CAAIc,MAAM,IAAM;IACxE,MAAM;MAAEC;IAAkB,CAAC,GAAGD,MAAM,CAAER,WAAY,CAAC;IACnD,MAAM;MAAEU;IAAI,CAAC,GAAGF,MAAM,CAAEV,gBAAiB,CAAC;IAC1C,OAAO;MACNQ,iBAAiB,EAAEG,iBAAiB,CAAC,CAAC,CAACH,iBAAiB;MACxDC,gBAAgB,EAAEG,GAAG,CAAE,MAAM,EAAE,kBAAmB;IACnD,CAAC;EACF,CAAC,EAAE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aAAhBA,gBAAgB,cAAhBA,gBAAgB,GAAI,EAAE,EAAGO,QAAQ,CAAEW,IAAK,CAAE,CAAC;EAErE,MAAMC,OAAO,GAAG,uCAAuC,GAAGrB,UAAU;EAEpE,MAAMsB,YAAY,GAAGH,iBAAiB,CAACD,MAAM,KAAKZ,kBAAkB,CAACY,MAAM;EAC3E,MAAMK,eAAe,GAAG,CAAED,YAAY,IAAIH,iBAAiB,CAACD,MAAM,GAAG,CAAC;EAEtE,OACCM,aAAA;IACCC,IAAI,EAAC,OAAO;IACZ,mBAAkBJ,OAAS;IAC3BK,SAAS,EAAC;EAAgC,GAE1CF,aAAA,CAACjC,eAAe;IACfoC,uBAAuB;IACvBC,OAAO,EAAGN,YAAc;IACxBO,QAAQ,EAAGd,gBAAkB;IAC7BW,SAAS,EAAC,sCAAsC;IAChDI,aAAa,EAAGP,eAAiB;IACjCQ,KAAK,EAAGP,aAAA;MAAMQ,EAAE,EAAGX;IAAS,GAAGvB,KAAa;EAAG,CAC/C,CAAC,EACF0B,aAAA,CAAC9B,mBAAmB;IACnBK,UAAU,EAAGO,kBAAoB;IACjC2B,KAAK,EAAGd,iBAAmB;IAC3Be,YAAY,EAAGtB;EAAe,CAC9B,CACG,CAAC;AAER;AAEA,eAAef,oBAAoB"}
@@ -0,0 +1,27 @@
1
+ import { createElement } from "react";
2
+ /**
3
+ * WordPress dependencies
4
+ */
5
+ import { BlockIcon } from '@wordpress/block-editor';
6
+ import { CheckboxControl } from '@wordpress/components';
7
+ function BlockTypesChecklist({
8
+ blockTypes,
9
+ value,
10
+ onItemChange
11
+ }) {
12
+ return createElement("ul", {
13
+ className: "editor-block-manager__checklist"
14
+ }, blockTypes.map(blockType => createElement("li", {
15
+ key: blockType.name,
16
+ className: "editor-block-manager__checklist-item"
17
+ }, createElement(CheckboxControl, {
18
+ __nextHasNoMarginBottom: true,
19
+ label: blockType.title,
20
+ checked: value.includes(blockType.name),
21
+ onChange: (...args) => onItemChange(blockType.name, ...args)
22
+ }), createElement(BlockIcon, {
23
+ icon: blockType.icon
24
+ }))));
25
+ }
26
+ export default BlockTypesChecklist;
27
+ //# sourceMappingURL=checklist.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BlockIcon","CheckboxControl","BlockTypesChecklist","blockTypes","value","onItemChange","createElement","className","map","blockType","key","name","__nextHasNoMarginBottom","label","title","checked","includes","onChange","args","icon"],"sources":["@wordpress/editor/src/components/block-manager/checklist.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { CheckboxControl } from '@wordpress/components';\n\nfunction BlockTypesChecklist( { blockTypes, value, onItemChange } ) {\n\treturn (\n\t\t<ul className=\"editor-block-manager__checklist\">\n\t\t\t{ blockTypes.map( ( blockType ) => (\n\t\t\t\t<li\n\t\t\t\t\tkey={ blockType.name }\n\t\t\t\t\tclassName=\"editor-block-manager__checklist-item\"\n\t\t\t\t>\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ blockType.title }\n\t\t\t\t\t\tchecked={ value.includes( blockType.name ) }\n\t\t\t\t\t\tonChange={ ( ...args ) =>\n\t\t\t\t\t\t\tonItemChange( blockType.name, ...args )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<BlockIcon icon={ blockType.icon } />\n\t\t\t\t</li>\n\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n\nexport default BlockTypesChecklist;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,yBAAyB;AACnD,SAASC,eAAe,QAAQ,uBAAuB;AAEvD,SAASC,mBAAmBA,CAAE;EAAEC,UAAU;EAAEC,KAAK;EAAEC;AAAa,CAAC,EAAG;EACnE,OACCC,aAAA;IAAIC,SAAS,EAAC;EAAiC,GAC5CJ,UAAU,CAACK,GAAG,CAAIC,SAAS,IAC5BH,aAAA;IACCI,GAAG,EAAGD,SAAS,CAACE,IAAM;IACtBJ,SAAS,EAAC;EAAsC,GAEhDD,aAAA,CAACL,eAAe;IACfW,uBAAuB;IACvBC,KAAK,EAAGJ,SAAS,CAACK,KAAO;IACzBC,OAAO,EAAGX,KAAK,CAACY,QAAQ,CAAEP,SAAS,CAACE,IAAK,CAAG;IAC5CM,QAAQ,EAAGA,CAAE,GAAGC,IAAI,KACnBb,YAAY,CAAEI,SAAS,CAACE,IAAI,EAAE,GAAGO,IAAK;EACtC,CACD,CAAC,EACFZ,aAAA,CAACN,SAAS;IAACmB,IAAI,EAAGV,SAAS,CAACU;EAAM,CAAE,CACjC,CACH,CACC,CAAC;AAEP;AAEA,eAAejB,mBAAmB"}
@@ -0,0 +1,121 @@
1
+ import { createElement } from "react";
2
+ /**
3
+ * WordPress dependencies
4
+ */
5
+ import { store as blocksStore } from '@wordpress/blocks';
6
+ import { withSelect, withDispatch } from '@wordpress/data';
7
+ import { SearchControl, Button } from '@wordpress/components';
8
+ import { __, _n, sprintf } from '@wordpress/i18n';
9
+ import { useEffect, useState } from '@wordpress/element';
10
+ import { useDebounce, compose } from '@wordpress/compose';
11
+ import { speak } from '@wordpress/a11y';
12
+ import { store as preferencesStore } from '@wordpress/preferences';
13
+
14
+ /**
15
+ * Internal dependencies
16
+ */
17
+ import { unlock } from '../../lock-unlock';
18
+ import { store as editorStore } from '../../store';
19
+ import BlockManagerCategory from './category';
20
+ function BlockManager({
21
+ blockTypes,
22
+ categories,
23
+ hasBlockSupport,
24
+ isMatchingSearchTerm,
25
+ numberOfHiddenBlocks,
26
+ enableAllBlockTypes
27
+ }) {
28
+ const debouncedSpeak = useDebounce(speak, 500);
29
+ const [search, setSearch] = useState('');
30
+
31
+ // Filtering occurs here (as opposed to `withSelect`) to avoid
32
+ // wasted renders by consequence of `Array#filter` producing
33
+ // a new value reference on each call.
34
+ blockTypes = blockTypes.filter(blockType => hasBlockSupport(blockType, 'inserter', true) && (!search || isMatchingSearchTerm(blockType, search)) && (!blockType.parent || blockType.parent.includes('core/post-content')));
35
+
36
+ // Announce search results on change
37
+ useEffect(() => {
38
+ if (!search) {
39
+ return;
40
+ }
41
+ const count = blockTypes.length;
42
+ const resultsFoundMessage = sprintf( /* translators: %d: number of results. */
43
+ _n('%d result found.', '%d results found.', count), count);
44
+ debouncedSpeak(resultsFoundMessage);
45
+ }, [blockTypes.length, search, debouncedSpeak]);
46
+ return createElement("div", {
47
+ className: "editor-block-manager__content"
48
+ }, !!numberOfHiddenBlocks && createElement("div", {
49
+ className: "editor-block-manager__disabled-blocks-count"
50
+ }, sprintf( /* translators: %d: number of blocks. */
51
+ _n('%d block is hidden.', '%d blocks are hidden.', numberOfHiddenBlocks), numberOfHiddenBlocks), createElement(Button, {
52
+ variant: "link",
53
+ onClick: () => enableAllBlockTypes(blockTypes)
54
+ }, __('Reset'))), createElement(SearchControl, {
55
+ __nextHasNoMarginBottom: true,
56
+ label: __('Search for a block'),
57
+ placeholder: __('Search for a block'),
58
+ value: search,
59
+ onChange: nextSearch => setSearch(nextSearch),
60
+ className: "editor-block-manager__search"
61
+ }), createElement("div", {
62
+ tabIndex: "0",
63
+ role: "region",
64
+ "aria-label": __('Available block types'),
65
+ className: "editor-block-manager__results"
66
+ }, blockTypes.length === 0 && createElement("p", {
67
+ className: "editor-block-manager__no-results"
68
+ }, __('No blocks found.')), categories.map(category => createElement(BlockManagerCategory, {
69
+ key: category.slug,
70
+ title: category.title,
71
+ blockTypes: blockTypes.filter(blockType => blockType.category === category.slug)
72
+ })), createElement(BlockManagerCategory, {
73
+ title: __('Uncategorized'),
74
+ blockTypes: blockTypes.filter(({
75
+ category
76
+ }) => !category)
77
+ })));
78
+ }
79
+ export default compose([withSelect(select => {
80
+ var _get;
81
+ const {
82
+ getBlockTypes,
83
+ getCategories,
84
+ hasBlockSupport,
85
+ isMatchingSearchTerm
86
+ } = select(blocksStore);
87
+ const {
88
+ get
89
+ } = select(preferencesStore);
90
+
91
+ // Some hidden blocks become unregistered
92
+ // by removing for instance the plugin that registered them, yet
93
+ // they're still remain as hidden by the user's action.
94
+ // We consider "hidden", blocks which were hidden and
95
+ // are still registered.
96
+ const blockTypes = getBlockTypes();
97
+ const hiddenBlockTypes = ((_get = get('core', 'hiddenBlockTypes')) !== null && _get !== void 0 ? _get : []).filter(hiddenBlock => {
98
+ return blockTypes.some(registeredBlock => registeredBlock.name === hiddenBlock);
99
+ });
100
+ const numberOfHiddenBlocks = Array.isArray(hiddenBlockTypes) && hiddenBlockTypes.length;
101
+ return {
102
+ blockTypes,
103
+ categories: getCategories(),
104
+ hasBlockSupport,
105
+ isMatchingSearchTerm,
106
+ numberOfHiddenBlocks
107
+ };
108
+ }), withDispatch(dispatch => {
109
+ const {
110
+ showBlockTypes
111
+ } = unlock(dispatch(editorStore));
112
+ return {
113
+ enableAllBlockTypes: blockTypes => {
114
+ const blockNames = blockTypes.map(({
115
+ name
116
+ }) => name);
117
+ showBlockTypes(blockNames);
118
+ }
119
+ };
120
+ })])(BlockManager);
121
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["store","blocksStore","withSelect","withDispatch","SearchControl","Button","__","_n","sprintf","useEffect","useState","useDebounce","compose","speak","preferencesStore","unlock","editorStore","BlockManagerCategory","BlockManager","blockTypes","categories","hasBlockSupport","isMatchingSearchTerm","numberOfHiddenBlocks","enableAllBlockTypes","debouncedSpeak","search","setSearch","filter","blockType","parent","includes","count","length","resultsFoundMessage","createElement","className","variant","onClick","__nextHasNoMarginBottom","label","placeholder","value","onChange","nextSearch","tabIndex","role","map","category","key","slug","title","select","_get","getBlockTypes","getCategories","get","hiddenBlockTypes","hiddenBlock","some","registeredBlock","name","Array","isArray","dispatch","showBlockTypes","blockNames"],"sources":["@wordpress/editor/src/components/block-manager/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { SearchControl, Button } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState } from '@wordpress/element';\nimport { useDebounce, compose } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport BlockManagerCategory from './category';\n\nfunction BlockManager( {\n\tblockTypes,\n\tcategories,\n\thasBlockSupport,\n\tisMatchingSearchTerm,\n\tnumberOfHiddenBlocks,\n\tenableAllBlockTypes,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst [ search, setSearch ] = useState( '' );\n\n\t// Filtering occurs here (as opposed to `withSelect`) to avoid\n\t// wasted renders by consequence of `Array#filter` producing\n\t// a new value reference on each call.\n\tblockTypes = blockTypes.filter(\n\t\t( blockType ) =>\n\t\t\thasBlockSupport( blockType, 'inserter', true ) &&\n\t\t\t( ! search || isMatchingSearchTerm( blockType, search ) ) &&\n\t\t\t( ! blockType.parent ||\n\t\t\t\tblockType.parent.includes( 'core/post-content' ) )\n\t);\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! search ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = blockTypes.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ blockTypes.length, search, debouncedSpeak ] );\n\n\treturn (\n\t\t<div className=\"editor-block-manager__content\">\n\t\t\t{ !! numberOfHiddenBlocks && (\n\t\t\t\t<div className=\"editor-block-manager__disabled-blocks-count\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d block is hidden.',\n\t\t\t\t\t\t\t'%d blocks are hidden.',\n\t\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t) }\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => enableAllBlockTypes( blockTypes ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<SearchControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Search for a block' ) }\n\t\t\t\tplaceholder={ __( 'Search for a block' ) }\n\t\t\t\tvalue={ search }\n\t\t\t\tonChange={ ( nextSearch ) => setSearch( nextSearch ) }\n\t\t\t\tclassName=\"editor-block-manager__search\"\n\t\t\t/>\n\t\t\t<div\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"region\"\n\t\t\t\taria-label={ __( 'Available block types' ) }\n\t\t\t\tclassName=\"editor-block-manager__results\"\n\t\t\t>\n\t\t\t\t{ blockTypes.length === 0 && (\n\t\t\t\t\t<p className=\"editor-block-manager__no-results\">\n\t\t\t\t\t\t{ __( 'No blocks found.' ) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<BlockManagerCategory\n\t\t\t\t\t\tkey={ category.slug }\n\t\t\t\t\t\ttitle={ category.title }\n\t\t\t\t\t\tblockTypes={ blockTypes.filter(\n\t\t\t\t\t\t\t( blockType ) =>\n\t\t\t\t\t\t\t\tblockType.category === category.slug\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t\t<BlockManagerCategory\n\t\t\t\t\ttitle={ __( 'Uncategorized' ) }\n\t\t\t\t\tblockTypes={ blockTypes.filter(\n\t\t\t\t\t\t( { category } ) => ! category\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockTypes,\n\t\t\tgetCategories,\n\t\t\thasBlockSupport,\n\t\t\tisMatchingSearchTerm,\n\t\t} = select( blocksStore );\n\t\tconst { get } = select( preferencesStore );\n\n\t\t// Some hidden blocks become unregistered\n\t\t// by removing for instance the plugin that registered them, yet\n\t\t// they're still remain as hidden by the user's action.\n\t\t// We consider \"hidden\", blocks which were hidden and\n\t\t// are still registered.\n\t\tconst blockTypes = getBlockTypes();\n\t\tconst hiddenBlockTypes = (\n\t\t\tget( 'core', 'hiddenBlockTypes' ) ?? []\n\t\t).filter( ( hiddenBlock ) => {\n\t\t\treturn blockTypes.some(\n\t\t\t\t( registeredBlock ) => registeredBlock.name === hiddenBlock\n\t\t\t);\n\t\t} );\n\t\tconst numberOfHiddenBlocks =\n\t\t\tArray.isArray( hiddenBlockTypes ) && hiddenBlockTypes.length;\n\n\t\treturn {\n\t\t\tblockTypes,\n\t\t\tcategories: getCategories(),\n\t\t\thasBlockSupport,\n\t\t\tisMatchingSearchTerm,\n\t\t\tnumberOfHiddenBlocks,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { showBlockTypes } = unlock( dispatch( editorStore ) );\n\t\treturn {\n\t\t\tenableAllBlockTypes: ( blockTypes ) => {\n\t\t\t\tconst blockNames = blockTypes.map( ( { name } ) => name );\n\t\t\t\tshowBlockTypes( blockNames );\n\t\t\t},\n\t\t};\n\t} ),\n] )( BlockManager );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC1D,SAASC,aAAa,EAAEC,MAAM,QAAQ,uBAAuB;AAC7D,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AACxD,SAASC,WAAW,EAAEC,OAAO,QAAQ,oBAAoB;AACzD,SAASC,KAAK,QAAQ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