@wordpress/editor 14.0.1 → 14.1.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 (247) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +164 -20
  3. package/build/components/document-tools/index.js +12 -3
  4. package/build/components/document-tools/index.js.map +1 -1
  5. package/build/components/editor/index.js +18 -24
  6. package/build/components/editor/index.js.map +1 -1
  7. package/build/components/entities-saved-states/hooks/use-is-dirty.js +9 -0
  8. package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  9. package/build/components/entities-saved-states/index.js +28 -0
  10. package/build/components/entities-saved-states/index.js.map +1 -1
  11. package/build/components/global-styles-provider/index.js +9 -2
  12. package/build/components/global-styles-provider/index.js.map +1 -1
  13. package/build/components/index.js +7 -0
  14. package/build/components/index.js.map +1 -1
  15. package/build/components/post-actions/actions.js +9 -4
  16. package/build/components/post-actions/actions.js.map +1 -1
  17. package/build/components/post-publish-button/index.js +4 -0
  18. package/build/components/post-publish-button/index.js.map +1 -1
  19. package/build/components/post-publish-button/label.js +5 -0
  20. package/build/components/post-publish-button/label.js.map +1 -1
  21. package/build/components/post-publish-panel/index.js +4 -0
  22. package/build/components/post-publish-panel/index.js.map +1 -1
  23. package/build/components/post-sticky/check.js +8 -0
  24. package/build/components/post-sticky/check.js.map +1 -1
  25. package/build/components/post-sticky/index.js +5 -1
  26. package/build/components/post-sticky/index.js.map +1 -1
  27. package/build/components/post-switch-to-draft-button/index.js +11 -2
  28. package/build/components/post-switch-to-draft-button/index.js.map +1 -1
  29. package/build/components/post-sync-status/index.js +5 -1
  30. package/build/components/post-sync-status/index.js.map +1 -1
  31. package/build/components/post-taxonomies/check.js +8 -0
  32. package/build/components/post-taxonomies/check.js.map +1 -1
  33. package/build/components/post-taxonomies/flat-term-selector.js +14 -2
  34. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  35. package/build/components/post-taxonomies/index.js +9 -0
  36. package/build/components/post-taxonomies/index.js.map +1 -1
  37. package/build/components/post-taxonomies/panel.js +10 -0
  38. package/build/components/post-taxonomies/panel.js.map +1 -1
  39. package/build/components/post-title/index.js +4 -8
  40. package/build/components/post-title/index.js.map +1 -1
  41. package/build/components/post-title/post-title-raw.js +3 -7
  42. package/build/components/post-title/post-title-raw.js.map +1 -1
  43. package/build/components/post-trash/check.js +8 -0
  44. package/build/components/post-trash/check.js.map +1 -1
  45. package/build/components/post-trash/index.js +6 -1
  46. package/build/components/post-trash/index.js.map +1 -1
  47. package/build/components/post-visibility/index.js +1 -0
  48. package/build/components/post-visibility/index.js.map +1 -1
  49. package/build/components/provider/index.js +18 -15
  50. package/build/components/provider/index.js.map +1 -1
  51. package/build/components/sidebar/post-summary.js +1 -1
  52. package/build/components/sidebar/post-summary.js.map +1 -1
  53. package/build/components/table-of-contents/index.js +11 -0
  54. package/build/components/table-of-contents/index.js.map +1 -1
  55. package/build/components/template-part-menu-items/convert-to-regular.js +38 -0
  56. package/build/components/template-part-menu-items/convert-to-regular.js.map +1 -0
  57. package/build/components/template-part-menu-items/convert-to-template-part.js +77 -0
  58. package/build/components/template-part-menu-items/convert-to-template-part.js.map +1 -0
  59. package/build/components/template-part-menu-items/index.js +67 -0
  60. package/build/components/template-part-menu-items/index.js.map +1 -0
  61. package/build/components/template-part-menu-items/index.native.js +10 -0
  62. package/build/components/template-part-menu-items/index.native.js.map +1 -0
  63. package/build/components/template-validation-notice/index.js +1 -0
  64. package/build/components/template-validation-notice/index.js.map +1 -1
  65. package/build/components/theme-support-check/index.js +9 -0
  66. package/build/components/theme-support-check/index.js.map +1 -1
  67. package/build/components/time-to-read/index.js +6 -0
  68. package/build/components/time-to-read/index.js.map +1 -1
  69. package/build/components/visual-editor/edit-template-blocks-notification.js +1 -0
  70. package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  71. package/build/components/word-count/index.js +5 -1
  72. package/build/components/word-count/index.js.map +1 -1
  73. package/build/dataviews/api.js +61 -0
  74. package/build/dataviews/api.js.map +1 -0
  75. package/build/dataviews/store/private-actions.js +28 -0
  76. package/build/dataviews/store/private-actions.js.map +1 -0
  77. package/build/dataviews/store/private-selectors.js +20 -0
  78. package/build/dataviews/store/private-selectors.js.map +1 -0
  79. package/build/dataviews/store/reducer.js +36 -0
  80. package/build/dataviews/store/reducer.js.map +1 -0
  81. package/build/hooks/pattern-overrides.js +2 -1
  82. package/build/hooks/pattern-overrides.js.map +1 -1
  83. package/build/index.js +12 -0
  84. package/build/index.js.map +1 -1
  85. package/build/private-apis.js +0 -6
  86. package/build/private-apis.js.map +1 -1
  87. package/build/private-apis.native.js +0 -2
  88. package/build/private-apis.native.js.map +1 -1
  89. package/build/store/private-actions.js +21 -0
  90. package/build/store/private-actions.js.map +1 -1
  91. package/build/store/private-selectors.js +5 -0
  92. package/build/store/private-selectors.js.map +1 -1
  93. package/build/store/reducer.js +4 -1
  94. package/build/store/reducer.js.map +1 -1
  95. package/build-module/components/document-tools/index.js +12 -3
  96. package/build-module/components/document-tools/index.js.map +1 -1
  97. package/build-module/components/editor/index.js +19 -24
  98. package/build-module/components/editor/index.js.map +1 -1
  99. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js +10 -0
  100. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  101. package/build-module/components/entities-saved-states/index.js +28 -0
  102. package/build-module/components/entities-saved-states/index.js.map +1 -1
  103. package/build-module/components/global-styles-provider/index.js +9 -2
  104. package/build-module/components/global-styles-provider/index.js.map +1 -1
  105. package/build-module/components/index.js +7 -0
  106. package/build-module/components/index.js.map +1 -1
  107. package/build-module/components/post-actions/actions.js +9 -4
  108. package/build-module/components/post-actions/actions.js.map +1 -1
  109. package/build-module/components/post-publish-button/index.js +4 -0
  110. package/build-module/components/post-publish-button/index.js.map +1 -1
  111. package/build-module/components/post-publish-button/label.js +6 -0
  112. package/build-module/components/post-publish-button/label.js.map +1 -1
  113. package/build-module/components/post-publish-panel/index.js +4 -0
  114. package/build-module/components/post-publish-panel/index.js.map +1 -1
  115. package/build-module/components/post-sticky/check.js +9 -0
  116. package/build-module/components/post-sticky/check.js.map +1 -1
  117. package/build-module/components/post-sticky/index.js +6 -0
  118. package/build-module/components/post-sticky/index.js.map +1 -1
  119. package/build-module/components/post-switch-to-draft-button/index.js +10 -1
  120. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  121. package/build-module/components/post-sync-status/index.js +6 -0
  122. package/build-module/components/post-sync-status/index.js.map +1 -1
  123. package/build-module/components/post-taxonomies/check.js +9 -0
  124. package/build-module/components/post-taxonomies/check.js.map +1 -1
  125. package/build-module/components/post-taxonomies/flat-term-selector.js +14 -2
  126. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  127. package/build-module/components/post-taxonomies/index.js +9 -0
  128. package/build-module/components/post-taxonomies/index.js.map +1 -1
  129. package/build-module/components/post-taxonomies/panel.js +10 -0
  130. package/build-module/components/post-taxonomies/panel.js.map +1 -1
  131. package/build-module/components/post-title/index.js +4 -8
  132. package/build-module/components/post-title/index.js.map +1 -1
  133. package/build-module/components/post-title/post-title-raw.js +3 -7
  134. package/build-module/components/post-title/post-title-raw.js.map +1 -1
  135. package/build-module/components/post-trash/check.js +9 -0
  136. package/build-module/components/post-trash/check.js.map +1 -1
  137. package/build-module/components/post-trash/index.js +7 -0
  138. package/build-module/components/post-trash/index.js.map +1 -1
  139. package/build-module/components/post-visibility/index.js +1 -0
  140. package/build-module/components/post-visibility/index.js.map +1 -1
  141. package/build-module/components/provider/index.js +18 -15
  142. package/build-module/components/provider/index.js.map +1 -1
  143. package/build-module/components/sidebar/post-summary.js +1 -1
  144. package/build-module/components/sidebar/post-summary.js.map +1 -1
  145. package/build-module/components/table-of-contents/index.js +11 -0
  146. package/build-module/components/table-of-contents/index.js.map +1 -1
  147. package/build-module/components/template-part-menu-items/convert-to-regular.js +31 -0
  148. package/build-module/components/template-part-menu-items/convert-to-regular.js.map +1 -0
  149. package/build-module/components/template-part-menu-items/convert-to-template-part.js +71 -0
  150. package/build-module/components/template-part-menu-items/convert-to-template-part.js.map +1 -0
  151. package/build-module/components/template-part-menu-items/index.js +59 -0
  152. package/build-module/components/template-part-menu-items/index.js.map +1 -0
  153. package/build-module/components/template-part-menu-items/index.native.js +4 -0
  154. package/build-module/components/template-part-menu-items/index.native.js.map +1 -0
  155. package/build-module/components/template-validation-notice/index.js +1 -0
  156. package/build-module/components/template-validation-notice/index.js.map +1 -1
  157. package/build-module/components/theme-support-check/index.js +10 -0
  158. package/build-module/components/theme-support-check/index.js.map +1 -1
  159. package/build-module/components/time-to-read/index.js +6 -0
  160. package/build-module/components/time-to-read/index.js.map +1 -1
  161. package/build-module/components/visual-editor/edit-template-blocks-notification.js +1 -0
  162. package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  163. package/build-module/components/word-count/index.js +6 -0
  164. package/build-module/components/word-count/index.js.map +1 -1
  165. package/build-module/dataviews/api.js +54 -0
  166. package/build-module/dataviews/api.js.map +1 -0
  167. package/build-module/dataviews/store/private-actions.js +21 -0
  168. package/build-module/dataviews/store/private-actions.js.map +1 -0
  169. package/build-module/dataviews/store/private-selectors.js +14 -0
  170. package/build-module/dataviews/store/private-selectors.js.map +1 -0
  171. package/build-module/dataviews/store/reducer.js +29 -0
  172. package/build-module/dataviews/store/reducer.js.map +1 -0
  173. package/build-module/hooks/pattern-overrides.js +2 -1
  174. package/build-module/hooks/pattern-overrides.js.map +1 -1
  175. package/build-module/index.js +1 -0
  176. package/build-module/index.js.map +1 -1
  177. package/build-module/private-apis.js +0 -6
  178. package/build-module/private-apis.js.map +1 -1
  179. package/build-module/private-apis.native.js +0 -2
  180. package/build-module/private-apis.native.js.map +1 -1
  181. package/build-module/store/private-actions.js +1 -0
  182. package/build-module/store/private-actions.js.map +1 -1
  183. package/build-module/store/private-selectors.js +4 -0
  184. package/build-module/store/private-selectors.js.map +1 -1
  185. package/build-module/store/reducer.js +3 -1
  186. package/build-module/store/reducer.js.map +1 -1
  187. package/build-style/style-rtl.css +7 -2
  188. package/build-style/style.css +7 -2
  189. package/build-types/dataviews/store/private-actions.d.ts +17 -0
  190. package/build-types/dataviews/store/private-actions.d.ts.map +1 -0
  191. package/build-types/dataviews/store/private-selectors.d.ts +10 -0
  192. package/build-types/dataviews/store/private-selectors.d.ts.map +1 -0
  193. package/build-types/dataviews/store/reducer.d.ts +11 -0
  194. package/build-types/dataviews/store/reducer.d.ts.map +1 -0
  195. package/package.json +35 -35
  196. package/src/components/document-tools/index.js +13 -4
  197. package/src/components/editor/index.js +23 -28
  198. package/src/components/entities-saved-states/hooks/use-is-dirty.js +9 -0
  199. package/src/components/entities-saved-states/index.js +26 -0
  200. package/src/components/global-styles-provider/index.js +12 -2
  201. package/src/components/index.js +7 -0
  202. package/src/components/keyboard-shortcut-help-modal/style.scss +0 -3
  203. package/src/components/post-actions/actions.js +6 -2
  204. package/src/components/post-card-panel/style.scss +4 -0
  205. package/src/components/post-panel-row/style.scss +1 -1
  206. package/src/components/post-publish-button/index.js +3 -0
  207. package/src/components/post-publish-button/label.js +5 -0
  208. package/src/components/post-publish-panel/index.js +3 -0
  209. package/src/components/post-status/style.scss +5 -0
  210. package/src/components/post-sticky/check.js +8 -0
  211. package/src/components/post-sticky/index.js +5 -0
  212. package/src/components/post-switch-to-draft-button/index.js +10 -1
  213. package/src/components/post-sync-status/index.js +5 -0
  214. package/src/components/post-taxonomies/check.js +8 -0
  215. package/src/components/post-taxonomies/flat-term-selector.js +13 -2
  216. package/src/components/post-taxonomies/index.js +8 -0
  217. package/src/components/post-taxonomies/panel.js +9 -0
  218. package/src/components/post-title/index.js +2 -5
  219. package/src/components/post-title/post-title-raw.js +2 -5
  220. package/src/components/post-trash/check.js +8 -0
  221. package/src/components/post-trash/index.js +6 -0
  222. package/src/components/post-visibility/index.js +1 -0
  223. package/src/components/provider/index.js +17 -17
  224. package/src/components/sidebar/post-summary.js +1 -1
  225. package/src/components/table-of-contents/index.js +10 -0
  226. package/src/components/template-part-menu-items/convert-to-regular.js +32 -0
  227. package/src/components/template-part-menu-items/convert-to-template-part.js +75 -0
  228. package/src/components/template-part-menu-items/index.js +59 -0
  229. package/src/components/template-part-menu-items/index.native.js +3 -0
  230. package/src/components/template-validation-notice/index.js +1 -0
  231. package/src/components/theme-support-check/index.js +9 -0
  232. package/src/components/time-to-read/index.js +5 -0
  233. package/src/components/visual-editor/edit-template-blocks-notification.js +1 -0
  234. package/src/components/word-count/index.js +5 -0
  235. package/src/dataviews/api.js +55 -0
  236. package/src/dataviews/store/private-actions.ts +30 -0
  237. package/src/dataviews/store/private-selectors.ts +15 -0
  238. package/src/dataviews/store/reducer.ts +44 -0
  239. package/src/hooks/pattern-overrides.js +2 -0
  240. package/src/index.js +1 -0
  241. package/src/private-apis.js +0 -6
  242. package/src/private-apis.native.js +0 -2
  243. package/src/store/private-actions.js +1 -0
  244. package/src/store/private-selectors.js +5 -0
  245. package/src/store/reducer.js +2 -0
  246. package/tsconfig.json +36 -0
  247. package/tsconfig.tsbuildinfo +1 -0
@@ -1 +1 @@
1
- {"version":3,"names":["fastDeepEqual","store","blockEditorStore","createSelector","createRegistrySelector","layout","symbol","navigation","page","pageIcon","verse","coreStore","getRenderingMode","getCurrentPost","__experimentalGetDefaultTemplatePartAreas","TEMPLATE_PART_POST_TYPE","getFilteredTemplatePartBlocks","EMPTY_INSERTION_POINT","rootClientId","undefined","insertionIndex","filterValue","getInsertionPoint","select","state","blockInserterPanel","postContentClientId","getBlocksByName","getListViewToggleRef","listViewToggleRef","getInserterSidebarToggleRef","inserterSidebarToggleRef","CARD_ICONS","wp_block","wp_navigation","post","getPostIcon","postType","options","find","item","area","icon","postTypeEntity","getPostType","startsWith","slice","getCurrentTemplateTemplateParts","templateParts","getEntityRecords","per_page","clientIds","blocks","getBlocksByClientId","hasPostMetaChanges","postId","type","currentPostType","id","currentPostId","edits","getEntityRecordNonTransientEdits","meta","originalPostMeta","getEntityRecord","footnotes"],"sources":["@wordpress/editor/src/store/private-selectors.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal';\n\n/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\nimport {\n\tlayout,\n\tsymbol,\n\tnavigation,\n\tpage as pageIcon,\n\tverse,\n} from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetRenderingMode,\n\tgetCurrentPost,\n\t__experimentalGetDefaultTemplatePartAreas,\n} from './selectors';\nimport { TEMPLATE_PART_POST_TYPE } from './constants';\nimport { getFilteredTemplatePartBlocks } from './utils/get-filtered-template-parts';\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( ( select ) =>\n\tcreateSelector(\n\t\t( state ) => {\n\t\t\tif ( typeof state.blockInserterPanel === 'object' ) {\n\t\t\t\treturn state.blockInserterPanel;\n\t\t\t}\n\n\t\t\tif ( getRenderingMode( state ) === 'template-locked' ) {\n\t\t\t\tconst [ postContentClientId ] =\n\t\t\t\t\tselect( blockEditorStore ).getBlocksByName(\n\t\t\t\t\t\t'core/post-content'\n\t\t\t\t\t);\n\t\t\t\tif ( postContentClientId ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\trootClientId: postContentClientId,\n\t\t\t\t\t\tinsertionIndex: undefined,\n\t\t\t\t\t\tfilterValue: undefined,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn EMPTY_INSERTION_POINT;\n\t\t},\n\t\t( state ) => {\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\treturn [\n\t\t\t\tstate.blockInserterPanel,\n\t\t\t\tgetRenderingMode( state ),\n\t\t\t\tpostContentClientId,\n\t\t\t];\n\t\t}\n\t)\n);\n\nexport function getListViewToggleRef( state ) {\n\treturn state.listViewToggleRef;\n}\nexport function getInserterSidebarToggleRef( state ) {\n\treturn state.inserterSidebarToggleRef;\n}\nconst CARD_ICONS = {\n\twp_block: symbol,\n\twp_navigation: navigation,\n\tpage: pageIcon,\n\tpost: verse,\n};\n\nexport const getPostIcon = createRegistrySelector(\n\t( select ) => ( state, postType, options ) => {\n\t\t{\n\t\t\tif (\n\t\t\t\tpostType === 'wp_template_part' ||\n\t\t\t\tpostType === 'wp_template'\n\t\t\t) {\n\t\t\t\treturn (\n\t\t\t\t\t__experimentalGetDefaultTemplatePartAreas( state ).find(\n\t\t\t\t\t\t( item ) => options.area === item.area\n\t\t\t\t\t)?.icon || layout\n\t\t\t\t);\n\t\t\t}\n\t\t\tif ( CARD_ICONS[ postType ] ) {\n\t\t\t\treturn CARD_ICONS[ postType ];\n\t\t\t}\n\t\t\tconst postTypeEntity = select( coreStore ).getPostType( postType );\n\t\t\t// `icon` is the `menu_icon` property of a post type. We\n\t\t\t// only handle `dashicons` for now, even if the `menu_icon`\n\t\t\t// also supports urls and svg as values.\n\t\t\tif ( postTypeEntity?.icon?.startsWith( 'dashicons-' ) ) {\n\t\t\t\treturn postTypeEntity.icon.slice( 10 );\n\t\t\t}\n\t\t\treturn pageIcon;\n\t\t}\n\t}\n);\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst templateParts = select( coreStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t{ per_page: -1 }\n\t\t);\n\n\t\tconst clientIds =\n\t\t\tselect( blockEditorStore ).getBlocksByName( 'core/template-part' );\n\t\tconst blocks =\n\t\t\tselect( blockEditorStore ).getBlocksByClientId( clientIds );\n\n\t\treturn getFilteredTemplatePartBlocks( blocks, templateParts );\n\t}\n);\n\n/**\n * Returns true if there are unsaved changes to the\n * post's meta fields, and false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} postType The post type of the post.\n * @param {number} postId The ID of the post.\n *\n * @return {boolean} Whether there are edits or not in the meta fields of the relevant post.\n */\nexport const hasPostMetaChanges = createRegistrySelector(\n\t( select ) => ( state, postType, postId ) => {\n\t\tconst { type: currentPostType, id: currentPostId } =\n\t\t\tgetCurrentPost( state );\n\t\t// If no postType or postId is passed, use the current post.\n\t\tconst edits = select( coreStore ).getEntityRecordNonTransientEdits(\n\t\t\t'postType',\n\t\t\tpostType || currentPostType,\n\t\t\tpostId || currentPostId\n\t\t);\n\n\t\tif ( ! edits?.meta ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Compare if anything apart from `footnotes` has changed.\n\t\tconst originalPostMeta = select( coreStore ).getEntityRecord(\n\t\t\t'postType',\n\t\t\tpostType || currentPostType,\n\t\t\tpostId || currentPostId\n\t\t)?.meta;\n\n\t\treturn ! fastDeepEqual(\n\t\t\t{ ...originalPostMeta, footnotes: undefined },\n\t\t\t{ ...edits.meta, footnotes: undefined }\n\t\t);\n\t}\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,cAAc,EAAEC,sBAAsB,QAAQ,iBAAiB;AACxE,SACCC,MAAM,EACNC,MAAM,EACNC,UAAU,EACVC,IAAI,IAAIC,QAAQ,EAChBC,KAAK,QACC,kBAAkB;AACzB,SAAST,KAAK,IAAIU,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SACCC,gBAAgB,EAChBC,cAAc,EACdC,yCAAyC,QACnC,aAAa;AACpB,SAASC,uBAAuB,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AC;AAC9D,CACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMM,kBAAkB,GAAGlD,sBAAsB,CACrDmB,MAAM,IAAM,CAAEC,KAAK,EAAEa,QAAQ,EAAEkB,MAAM,KAAM;EAC5C,MAAM;IAAEC,IAAI,EAAEC,eAAe;IAAEC,EAAE,EAAEC;EAAc,CAAC,GACjD9C,cAAc,CAAEW,KAAM,CAAC;EACxB;EACA,MAAMoC,KAAK,GAAGrC,MAAM,CAAEZ,SAAU,CAAC,CAACkD,gCAAgC,CACjE,UAAU,EACVxB,QAAQ,IAAIoB,eAAe,EAC3BF,MAAM,IAAII,aACX,CAAC;EAED,IAAK,CAAEC,KAAK,EAAEE,IAAI,EAAG;IACpB,OAAO,KAAK;EACb;;EAEA;EACA,MAAMC,gBAAgB,GAAGxC,MAAM,CAAEZ,SAAU,CAAC,CAACqD,eAAe,CAC3D,UAAU,EACV3B,QAAQ,IAAIoB,eAAe,EAC3BF,MAAM,IAAII,aACX,CAAC,EAAEG,IAAI;EAEP,OAAO,CAAE9D,aAAa,CACrB;IAAE,GAAG+D,gBAAgB;IAAEE,SAAS,EAAE9C;EAAU,CAAC,EAC7C;IAAE,GAAGyC,KAAK,CAACE,IAAI;IAAEG,SAAS,EAAE9C;EAAU,CACvC,CAAC;AACF,CACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["fastDeepEqual","store","blockEditorStore","createSelector","createRegistrySelector","layout","symbol","navigation","page","pageIcon","verse","coreStore","getRenderingMode","getCurrentPost","__experimentalGetDefaultTemplatePartAreas","TEMPLATE_PART_POST_TYPE","getFilteredTemplatePartBlocks","getEntityActions","_getEntityActions","EMPTY_INSERTION_POINT","rootClientId","undefined","insertionIndex","filterValue","getInsertionPoint","select","state","blockInserterPanel","postContentClientId","getBlocksByName","getListViewToggleRef","listViewToggleRef","getInserterSidebarToggleRef","inserterSidebarToggleRef","CARD_ICONS","wp_block","wp_navigation","post","getPostIcon","postType","options","find","item","area","icon","postTypeEntity","getPostType","startsWith","slice","getCurrentTemplateTemplateParts","templateParts","getEntityRecords","per_page","clientIds","blocks","getBlocksByClientId","hasPostMetaChanges","postId","type","currentPostType","id","currentPostId","edits","getEntityRecordNonTransientEdits","meta","originalPostMeta","getEntityRecord","footnotes","args","dataviews"],"sources":["@wordpress/editor/src/store/private-selectors.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal';\n\n/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\nimport {\n\tlayout,\n\tsymbol,\n\tnavigation,\n\tpage as pageIcon,\n\tverse,\n} from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetRenderingMode,\n\tgetCurrentPost,\n\t__experimentalGetDefaultTemplatePartAreas,\n} from './selectors';\nimport { TEMPLATE_PART_POST_TYPE } from './constants';\nimport { getFilteredTemplatePartBlocks } from './utils/get-filtered-template-parts';\nimport { getEntityActions as _getEntityActions } from '../dataviews/store/private-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( ( select ) =>\n\tcreateSelector(\n\t\t( state ) => {\n\t\t\tif ( typeof state.blockInserterPanel === 'object' ) {\n\t\t\t\treturn state.blockInserterPanel;\n\t\t\t}\n\n\t\t\tif ( getRenderingMode( state ) === 'template-locked' ) {\n\t\t\t\tconst [ postContentClientId ] =\n\t\t\t\t\tselect( blockEditorStore ).getBlocksByName(\n\t\t\t\t\t\t'core/post-content'\n\t\t\t\t\t);\n\t\t\t\tif ( postContentClientId ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\trootClientId: postContentClientId,\n\t\t\t\t\t\tinsertionIndex: undefined,\n\t\t\t\t\t\tfilterValue: undefined,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn EMPTY_INSERTION_POINT;\n\t\t},\n\t\t( state ) => {\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\treturn [\n\t\t\t\tstate.blockInserterPanel,\n\t\t\t\tgetRenderingMode( state ),\n\t\t\t\tpostContentClientId,\n\t\t\t];\n\t\t}\n\t)\n);\n\nexport function getListViewToggleRef( state ) {\n\treturn state.listViewToggleRef;\n}\nexport function getInserterSidebarToggleRef( state ) {\n\treturn state.inserterSidebarToggleRef;\n}\nconst CARD_ICONS = {\n\twp_block: symbol,\n\twp_navigation: navigation,\n\tpage: pageIcon,\n\tpost: verse,\n};\n\nexport const getPostIcon = createRegistrySelector(\n\t( select ) => ( state, postType, options ) => {\n\t\t{\n\t\t\tif (\n\t\t\t\tpostType === 'wp_template_part' ||\n\t\t\t\tpostType === 'wp_template'\n\t\t\t) {\n\t\t\t\treturn (\n\t\t\t\t\t__experimentalGetDefaultTemplatePartAreas( state ).find(\n\t\t\t\t\t\t( item ) => options.area === item.area\n\t\t\t\t\t)?.icon || layout\n\t\t\t\t);\n\t\t\t}\n\t\t\tif ( CARD_ICONS[ postType ] ) {\n\t\t\t\treturn CARD_ICONS[ postType ];\n\t\t\t}\n\t\t\tconst postTypeEntity = select( coreStore ).getPostType( postType );\n\t\t\t// `icon` is the `menu_icon` property of a post type. We\n\t\t\t// only handle `dashicons` for now, even if the `menu_icon`\n\t\t\t// also supports urls and svg as values.\n\t\t\tif ( postTypeEntity?.icon?.startsWith( 'dashicons-' ) ) {\n\t\t\t\treturn postTypeEntity.icon.slice( 10 );\n\t\t\t}\n\t\t\treturn pageIcon;\n\t\t}\n\t}\n);\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst templateParts = select( coreStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t{ per_page: -1 }\n\t\t);\n\n\t\tconst clientIds =\n\t\t\tselect( blockEditorStore ).getBlocksByName( 'core/template-part' );\n\t\tconst blocks =\n\t\t\tselect( blockEditorStore ).getBlocksByClientId( clientIds );\n\n\t\treturn getFilteredTemplatePartBlocks( blocks, templateParts );\n\t}\n);\n\n/**\n * Returns true if there are unsaved changes to the\n * post's meta fields, and false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} postType The post type of the post.\n * @param {number} postId The ID of the post.\n *\n * @return {boolean} Whether there are edits or not in the meta fields of the relevant post.\n */\nexport const hasPostMetaChanges = createRegistrySelector(\n\t( select ) => ( state, postType, postId ) => {\n\t\tconst { type: currentPostType, id: currentPostId } =\n\t\t\tgetCurrentPost( state );\n\t\t// If no postType or postId is passed, use the current post.\n\t\tconst edits = select( coreStore ).getEntityRecordNonTransientEdits(\n\t\t\t'postType',\n\t\t\tpostType || currentPostType,\n\t\t\tpostId || currentPostId\n\t\t);\n\n\t\tif ( ! edits?.meta ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Compare if anything apart from `footnotes` has changed.\n\t\tconst originalPostMeta = select( coreStore ).getEntityRecord(\n\t\t\t'postType',\n\t\t\tpostType || currentPostType,\n\t\t\tpostId || currentPostId\n\t\t)?.meta;\n\n\t\treturn ! fastDeepEqual(\n\t\t\t{ ...originalPostMeta, footnotes: undefined },\n\t\t\t{ ...edits.meta, footnotes: undefined }\n\t\t);\n\t}\n);\n\nexport function getEntityActions( state, ...args ) {\n\treturn _getEntityActions( state.dataviews, ...args );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,iBAAiB;;AAE3C;AAC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C;AACF,CACD,CAAC;AAED,OAAO,SAASJ,gBAAgBA,CAAES,KAAK,EAAE,GAAG0C,IAAI,EAAG;EAClD,OAAOlD,iBAAiB,CAAEQ,KAAK,CAAC2C,SAAS,EAAE,GAAGD,IAAK,CAAC;AACrD","ignoreList":[]}
@@ -7,6 +7,7 @@ import { combineReducers } from '@wordpress/data';
7
7
  * Internal dependencies
8
8
  */
9
9
  import { EDITOR_SETTINGS_DEFAULTS } from './defaults';
10
+ import dataviewsReducer from '../dataviews/store/reducer';
10
11
 
11
12
  /**
12
13
  * Returns a post attribute value, flattening nested rendered content using its
@@ -393,6 +394,7 @@ export default combineReducers({
393
394
  inserterSidebarToggleRef,
394
395
  listViewPanel,
395
396
  listViewToggleRef,
396
- publishSidebarActive
397
+ publishSidebarActive,
398
+ dataviews: dataviewsReducer
397
399
  });
398
400
  //# sourceMappingURL=reducer.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["combineReducers","EDITOR_SETTINGS_DEFAULTS","getPostRawValue","value","raw","hasSameKeys","a","b","keysA","Object","keys","sort","keysB","length","every","key","index","isUpdatingSamePostProperty","action","previousAction","type","edits","shouldOverwriteState","shouldCreateUndoLevel","postId","state","templateId","id","postType","template","isValid","saving","pending","options","deleting","postLock","isLocked","lock","postSavingLock","lockName","removedLockName","restState","postAutosavingLock","editorSettings","settings","renderingMode","mode","deviceType","removedPanels","includes","panelName","blockInserterPanel","isOpen","listViewPanel","listViewToggleRef","current","inserterSidebarToggleRef","publishSidebarActive"],"sources":["@wordpress/editor/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { EDITOR_SETTINGS_DEFAULTS } from './defaults';\n\n/**\n * Returns a post attribute value, flattening nested rendered content using its\n * raw value in place of its original object form.\n *\n * @param {*} value Original value.\n *\n * @return {*} Raw value.\n */\nexport function getPostRawValue( value ) {\n\tif ( value && 'object' === typeof value && 'raw' in value ) {\n\t\treturn value.raw;\n\t}\n\n\treturn value;\n}\n\n/**\n * Returns true if the two object arguments have the same keys, or false\n * otherwise.\n *\n * @param {Object} a First object.\n * @param {Object} b Second object.\n *\n * @return {boolean} Whether the two objects have the same keys.\n */\nexport function hasSameKeys( a, b ) {\n\tconst keysA = Object.keys( a ).sort();\n\tconst keysB = Object.keys( b ).sort();\n\treturn (\n\t\tkeysA.length === keysB.length &&\n\t\tkeysA.every( ( key, index ) => keysB[ index ] === key )\n\t);\n}\n\n/**\n * Returns true if, given the currently dispatching action and the previously\n * dispatched action, the two actions are editing the same post property, or\n * false otherwise.\n *\n * @param {Object} action Currently dispatching action.\n * @param {Object} previousAction Previously dispatched action.\n *\n * @return {boolean} Whether actions are updating the same post property.\n */\nexport function isUpdatingSamePostProperty( action, previousAction ) {\n\treturn (\n\t\taction.type === 'EDIT_POST' &&\n\t\thasSameKeys( action.edits, previousAction.edits )\n\t);\n}\n\n/**\n * Returns true if, given the currently dispatching action and the previously\n * dispatched action, the two actions are modifying the same property such that\n * undo history should be batched.\n *\n * @param {Object} action Currently dispatching action.\n * @param {Object} previousAction Previously dispatched action.\n *\n * @return {boolean} Whether to overwrite present state.\n */\nexport function shouldOverwriteState( action, previousAction ) {\n\tif ( action.type === 'RESET_EDITOR_BLOCKS' ) {\n\t\treturn ! action.shouldCreateUndoLevel;\n\t}\n\n\tif ( ! previousAction || action.type !== previousAction.type ) {\n\t\treturn false;\n\t}\n\n\treturn isUpdatingSamePostProperty( action, previousAction );\n}\n\nexport function postId( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_EDITED_POST':\n\t\t\treturn action.postId;\n\t}\n\n\treturn state;\n}\n\nexport function templateId( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_CURRENT_TEMPLATE_ID':\n\t\t\treturn action.id;\n\t}\n\n\treturn state;\n}\n\nexport function postType( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_EDITED_POST':\n\t\t\treturn action.postType;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning whether the post blocks match the defined template or not.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {boolean} Updated state.\n */\nexport function template( state = { isValid: true }, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_TEMPLATE_VALIDITY':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisValid: action.isValid,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning current network request state (whether a request to\n * the WP REST API is in progress, successful, or failed).\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function saving( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REQUEST_POST_UPDATE_START':\n\t\tcase 'REQUEST_POST_UPDATE_FINISH':\n\t\t\treturn {\n\t\t\t\tpending: action.type === 'REQUEST_POST_UPDATE_START',\n\t\t\t\toptions: action.options || {},\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning deleting post request state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deleting( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REQUEST_POST_DELETE_START':\n\t\tcase 'REQUEST_POST_DELETE_FINISH':\n\t\t\treturn {\n\t\t\t\tpending: action.type === 'REQUEST_POST_DELETE_START',\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Post Lock State.\n *\n * @typedef {Object} PostLockState\n *\n * @property {boolean} isLocked Whether the post is locked.\n * @property {?boolean} isTakeover Whether the post editing has been taken over.\n * @property {?boolean} activePostLock Active post lock value.\n * @property {?Object} user User that took over the post.\n */\n\n/**\n * Reducer returning the post lock status.\n *\n * @param {PostLockState} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {PostLockState} Updated state.\n */\nexport function postLock( state = { isLocked: false }, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_POST_LOCK':\n\t\t\treturn action.lock;\n\t}\n\n\treturn state;\n}\n\n/**\n * Post saving lock.\n *\n * When post saving is locked, the post cannot be published or updated.\n *\n * @param {PostLockState} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {PostLockState} Updated state.\n */\nexport function postSavingLock( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'LOCK_POST_SAVING':\n\t\t\treturn { ...state, [ action.lockName ]: true };\n\n\t\tcase 'UNLOCK_POST_SAVING': {\n\t\t\tconst { [ action.lockName ]: removedLockName, ...restState } =\n\t\t\t\tstate;\n\t\t\treturn restState;\n\t\t}\n\t}\n\treturn state;\n}\n\n/**\n * Post autosaving lock.\n *\n * When post autosaving is locked, the post will not autosave.\n *\n * @param {PostLockState} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {PostLockState} Updated state.\n */\nexport function postAutosavingLock( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'LOCK_POST_AUTOSAVING':\n\t\t\treturn { ...state, [ action.lockName ]: true };\n\n\t\tcase 'UNLOCK_POST_AUTOSAVING': {\n\t\t\tconst { [ action.lockName ]: removedLockName, ...restState } =\n\t\t\t\tstate;\n\t\t\treturn restState;\n\t\t}\n\t}\n\treturn state;\n}\n\n/**\n * Reducer returning the post editor setting.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function editorSettings( state = EDITOR_SETTINGS_DEFAULTS, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_EDITOR_SETTINGS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.settings,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\nexport function renderingMode( state = 'post-only', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_RENDERING_MODE':\n\t\t\treturn action.mode;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the editing canvas device type.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deviceType( state = 'Desktop', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_DEVICE_TYPE':\n\t\t\treturn action.deviceType;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer storing the list of all programmatically removed panels.\n *\n * @param {Array} state Current state.\n * @param {Object} action Action object.\n *\n * @return {Array} Updated state.\n */\nexport function removedPanels( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REMOVE_PANEL':\n\t\t\tif ( ! state.includes( action.panelName ) ) {\n\t\t\t\treturn [ ...state, action.panelName ];\n\t\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the list view panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the inserter panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\n/**\n * This reducer does nothing aside initializing a ref to the list view toggle.\n * We will have a unique ref per \"editor\" instance.\n *\n * @param {Object} state\n * @return {Object} Reference to the list view toggle button.\n */\nexport function listViewToggleRef( state = { current: null } ) {\n\treturn state;\n}\n\n/**\n * This reducer does nothing aside initializing a ref to the inserter sidebar toggle.\n * We will have a unique ref per \"editor\" instance.\n *\n * @param {Object} state\n * @return {Object} Reference to the inserter sidebar toggle button.\n */\nexport function inserterSidebarToggleRef( state = { current: null } ) {\n\treturn state;\n}\n\nexport function publishSidebarActive( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_PUBLISH_SIDEBAR':\n\t\t\treturn true;\n\t\tcase 'CLOSE_PUBLISH_SIDEBAR':\n\t\t\treturn false;\n\t\tcase 'TOGGLE_PUBLISH_SIDEBAR':\n\t\t\treturn ! state;\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tpostId,\n\tpostType,\n\ttemplateId,\n\tsaving,\n\tdeleting,\n\tpostLock,\n\ttemplate,\n\tpostSavingLock,\n\teditorSettings,\n\tpostAutosavingLock,\n\trenderingMode,\n\tdeviceType,\n\tremovedPanels,\n\tblockInserterPanel,\n\tinserterSidebarToggleRef,\n\tlistViewPanel,\n\tlistViewToggleRef,\n\tpublishSidebarActive,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,iBAAiB;;AAEjD;AACA;AACA;AACA,SAASC,wBAAwB,QAAQ,YAAY;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAAEC,KAAK,EAAG;EACxC,IAAKA,KAAK,IAAI,QAAQ,KAAK,OAAOA,KAAK,IAAI,KAAK,IAAIA,KAAK,EAAG;IAC3D,OAAOA,KAAK,CAACC,GAAG;EACjB;EAEA,OAAOD,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,WAAWA,CAAEC,CAAC,EAAEC,CAAC,EAAG;EACnC,MAAMC,KAAK,GAAGC,MAAM,CAACC,IAAI,CAAEJ,CAAE,CAAC,CAACK,IAAI,CAAC,CAAC;EACrC,MAAMC,KAAK,GAAGH,MAAM,CAACC,IAAI,CAAEH,CAAE,CAAC,CAACI,IAAI,CAAC,CAAC;EACrC,OACCH,KAAK,CAACK,M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AwB;MAC5B,OAAOF,MAAM,CAACf,KAAK,GAAG,KAAK,GAAGsB,KAAK;IACpC,KAAK,yBAAyB;MAC7B,OAAOP,MAAM,CAACkC,MAAM;EACtB;EACA,OAAO3B,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS6B,iBAAiBA,CAAE7B,KAAK,GAAG;EAAE8B,OAAO,EAAE;AAAK,CAAC,EAAG;EAC9D,OAAO9B,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS+B,wBAAwBA,CAAE/B,KAAK,GAAG;EAAE8B,OAAO,EAAE;AAAK,CAAC,EAAG;EACrE,OAAO9B,KAAK;AACb;AAEA,OAAO,SAASgC,oBAAoBA,CAAEhC,KAAK,GAAG,KAAK,EAAEP,MAAM,EAAG;EAC7D,QAASA,MAAM,CAACE,IAAI;IACnB,KAAK,sBAAsB;MAC1B,OAAO,IAAI;IACZ,KAAK,uBAAuB;MAC3B,OAAO,KAAK;IACb,KAAK,wBAAwB;MAC5B,OAAO,CAAEK,KAAK;EAChB;EACA,OAAOA,KAAK;AACb;AAEA,eAAezB,eAAe,CAAE;EAC/BwB,MAAM;EACNI,QAAQ;EACRF,UAAU;EACVK,MAAM;EACNG,QAAQ;EACRC,QAAQ;EACRN,QAAQ;EACRS,cAAc;EACdK,cAAc;EACdD,kBAAkB;EAClBG,aAAa;EACbE,UAAU;EACVC,aAAa;EACbG,kBAAkB;EAClBK,wBAAwB;EACxBH,aAAa;EACbC,iBAAiB;EACjBG;AACD,CAAE,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["combineReducers","EDITOR_SETTINGS_DEFAULTS","dataviewsReducer","getPostRawValue","value","raw","hasSameKeys","a","b","keysA","Object","keys","sort","keysB","length","every","key","index","isUpdatingSamePostProperty","action","previousAction","type","edits","shouldOverwriteState","shouldCreateUndoLevel","postId","state","templateId","id","postType","template","isValid","saving","pending","options","deleting","postLock","isLocked","lock","postSavingLock","lockName","removedLockName","restState","postAutosavingLock","editorSettings","settings","renderingMode","mode","deviceType","removedPanels","includes","panelName","blockInserterPanel","isOpen","listViewPanel","listViewToggleRef","current","inserterSidebarToggleRef","publishSidebarActive","dataviews"],"sources":["@wordpress/editor/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { EDITOR_SETTINGS_DEFAULTS } from './defaults';\nimport dataviewsReducer from '../dataviews/store/reducer';\n\n/**\n * Returns a post attribute value, flattening nested rendered content using its\n * raw value in place of its original object form.\n *\n * @param {*} value Original value.\n *\n * @return {*} Raw value.\n */\nexport function getPostRawValue( value ) {\n\tif ( value && 'object' === typeof value && 'raw' in value ) {\n\t\treturn value.raw;\n\t}\n\n\treturn value;\n}\n\n/**\n * Returns true if the two object arguments have the same keys, or false\n * otherwise.\n *\n * @param {Object} a First object.\n * @param {Object} b Second object.\n *\n * @return {boolean} Whether the two objects have the same keys.\n */\nexport function hasSameKeys( a, b ) {\n\tconst keysA = Object.keys( a ).sort();\n\tconst keysB = Object.keys( b ).sort();\n\treturn (\n\t\tkeysA.length === keysB.length &&\n\t\tkeysA.every( ( key, index ) => keysB[ index ] === key )\n\t);\n}\n\n/**\n * Returns true if, given the currently dispatching action and the previously\n * dispatched action, the two actions are editing the same post property, or\n * false otherwise.\n *\n * @param {Object} action Currently dispatching action.\n * @param {Object} previousAction Previously dispatched action.\n *\n * @return {boolean} Whether actions are updating the same post property.\n */\nexport function isUpdatingSamePostProperty( action, previousAction ) {\n\treturn (\n\t\taction.type === 'EDIT_POST' &&\n\t\thasSameKeys( action.edits, previousAction.edits )\n\t);\n}\n\n/**\n * Returns true if, given the currently dispatching action and the previously\n * dispatched action, the two actions are modifying the same property such that\n * undo history should be batched.\n *\n * @param {Object} action Currently dispatching action.\n * @param {Object} previousAction Previously dispatched action.\n *\n * @return {boolean} Whether to overwrite present state.\n */\nexport function shouldOverwriteState( action, previousAction ) {\n\tif ( action.type === 'RESET_EDITOR_BLOCKS' ) {\n\t\treturn ! action.shouldCreateUndoLevel;\n\t}\n\n\tif ( ! previousAction || action.type !== previousAction.type ) {\n\t\treturn false;\n\t}\n\n\treturn isUpdatingSamePostProperty( action, previousAction );\n}\n\nexport function postId( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_EDITED_POST':\n\t\t\treturn action.postId;\n\t}\n\n\treturn state;\n}\n\nexport function templateId( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_CURRENT_TEMPLATE_ID':\n\t\t\treturn action.id;\n\t}\n\n\treturn state;\n}\n\nexport function postType( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_EDITED_POST':\n\t\t\treturn action.postType;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning whether the post blocks match the defined template or not.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {boolean} Updated state.\n */\nexport function template( state = { isValid: true }, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_TEMPLATE_VALIDITY':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisValid: action.isValid,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning current network request state (whether a request to\n * the WP REST API is in progress, successful, or failed).\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function saving( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REQUEST_POST_UPDATE_START':\n\t\tcase 'REQUEST_POST_UPDATE_FINISH':\n\t\t\treturn {\n\t\t\t\tpending: action.type === 'REQUEST_POST_UPDATE_START',\n\t\t\t\toptions: action.options || {},\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning deleting post request state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deleting( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REQUEST_POST_DELETE_START':\n\t\tcase 'REQUEST_POST_DELETE_FINISH':\n\t\t\treturn {\n\t\t\t\tpending: action.type === 'REQUEST_POST_DELETE_START',\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Post Lock State.\n *\n * @typedef {Object} PostLockState\n *\n * @property {boolean} isLocked Whether the post is locked.\n * @property {?boolean} isTakeover Whether the post editing has been taken over.\n * @property {?boolean} activePostLock Active post lock value.\n * @property {?Object} user User that took over the post.\n */\n\n/**\n * Reducer returning the post lock status.\n *\n * @param {PostLockState} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {PostLockState} Updated state.\n */\nexport function postLock( state = { isLocked: false }, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_POST_LOCK':\n\t\t\treturn action.lock;\n\t}\n\n\treturn state;\n}\n\n/**\n * Post saving lock.\n *\n * When post saving is locked, the post cannot be published or updated.\n *\n * @param {PostLockState} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {PostLockState} Updated state.\n */\nexport function postSavingLock( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'LOCK_POST_SAVING':\n\t\t\treturn { ...state, [ action.lockName ]: true };\n\n\t\tcase 'UNLOCK_POST_SAVING': {\n\t\t\tconst { [ action.lockName ]: removedLockName, ...restState } =\n\t\t\t\tstate;\n\t\t\treturn restState;\n\t\t}\n\t}\n\treturn state;\n}\n\n/**\n * Post autosaving lock.\n *\n * When post autosaving is locked, the post will not autosave.\n *\n * @param {PostLockState} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {PostLockState} Updated state.\n */\nexport function postAutosavingLock( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'LOCK_POST_AUTOSAVING':\n\t\t\treturn { ...state, [ action.lockName ]: true };\n\n\t\tcase 'UNLOCK_POST_AUTOSAVING': {\n\t\t\tconst { [ action.lockName ]: removedLockName, ...restState } =\n\t\t\t\tstate;\n\t\t\treturn restState;\n\t\t}\n\t}\n\treturn state;\n}\n\n/**\n * Reducer returning the post editor setting.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function editorSettings( state = EDITOR_SETTINGS_DEFAULTS, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_EDITOR_SETTINGS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.settings,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\nexport function renderingMode( state = 'post-only', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_RENDERING_MODE':\n\t\t\treturn action.mode;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the editing canvas device type.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deviceType( state = 'Desktop', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_DEVICE_TYPE':\n\t\t\treturn action.deviceType;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer storing the list of all programmatically removed panels.\n *\n * @param {Array} state Current state.\n * @param {Object} action Action object.\n *\n * @return {Array} Updated state.\n */\nexport function removedPanels( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REMOVE_PANEL':\n\t\t\tif ( ! state.includes( action.panelName ) ) {\n\t\t\t\treturn [ ...state, action.panelName ];\n\t\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the list view panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the inserter panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\n/**\n * This reducer does nothing aside initializing a ref to the list view toggle.\n * We will have a unique ref per \"editor\" instance.\n *\n * @param {Object} state\n * @return {Object} Reference to the list view toggle button.\n */\nexport function listViewToggleRef( state = { current: null } ) {\n\treturn state;\n}\n\n/**\n * This reducer does nothing aside initializing a ref to the inserter sidebar toggle.\n * We will have a unique ref per \"editor\" instance.\n *\n * @param {Object} state\n * @return {Object} Reference to the inserter sidebar toggle button.\n */\nexport function inserterSidebarToggleRef( state = { current: null } ) {\n\treturn state;\n}\n\nexport function publishSidebarActive( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_PUBLISH_SIDEBAR':\n\t\t\treturn true;\n\t\tcase 'CLOSE_PUBLISH_SIDEBAR':\n\t\t\treturn false;\n\t\tcase 'TOGGLE_PUBLISH_SIDEBAR':\n\t\t\treturn ! state;\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tpostId,\n\tpostType,\n\ttemplateId,\n\tsaving,\n\tdeleting,\n\tpostLock,\n\ttemplate,\n\tpostSavingLock,\n\teditorSettings,\n\tpostAutosavingLock,\n\trenderingMode,\n\tdeviceType,\n\tremovedPanels,\n\tblockInserterPanel,\n\tinserterSidebarToggleRef,\n\tlistViewPanel,\n\tlistViewToggleRef,\n\tpublishSidebarActive,\n\tdataviews: dataviewsReducer,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,iBAAiB;;AAEjD;AACA;AACA;AACA,SAASC,wBAAwB,QAAQ,YAAY;AACrD,OAAOC,gBAAgB,MAAM,4BAA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OA,KAAK;AACb;AAEA,eAAe1B,eAAe,CAAE;EAC/ByB,MAAM;EACNI,QAAQ;EACRF,UAAU;EACVK,MAAM;EACNG,QAAQ;EACRC,QAAQ;EACRN,QAAQ;EACRS,cAAc;EACdK,cAAc;EACdD,kBAAkB;EAClBG,aAAa;EACbE,UAAU;EACVC,aAAa;EACbG,kBAAkB;EAClBK,wBAAwB;EACxBH,aAAa;EACbC,iBAAiB;EACjBG,oBAAoB;EACpBC,SAAS,EAAEzD;AACZ,CAAE,CAAC","ignoreList":[]}
@@ -1290,7 +1290,6 @@ body.is-fullscreen-mode .interface-interface-skeleton {
1290
1290
  .editor-keyboard-shortcut-help-modal__shortcut-description {
1291
1291
  flex: 1;
1292
1292
  margin: 0;
1293
- flex-basis: auto;
1294
1293
  }
1295
1294
  .editor-keyboard-shortcut-help-modal__shortcut-key-combination {
1296
1295
  display: block;
@@ -1487,6 +1486,9 @@ body.is-fullscreen-mode .interface-interface-skeleton {
1487
1486
  .editor-post-card-panel__icon.is-sync {
1488
1487
  fill: var(--wp-block-synced-color);
1489
1488
  }
1489
+ .editor-post-card-panel__icon.is-sync + .editor-post-card-panel__title {
1490
+ color: var(--wp-block-synced-color);
1491
+ }
1490
1492
 
1491
1493
  .editor-post-card-panel__title-badge {
1492
1494
  background: #f0f0f0;
@@ -1684,7 +1686,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
1684
1686
  }
1685
1687
 
1686
1688
  .editor-post-panel__row-label {
1687
- width: 30%;
1689
+ width: 38%;
1688
1690
  flex-shrink: 0;
1689
1691
  min-height: 32px;
1690
1692
  display: flex;
@@ -2014,6 +2016,9 @@ body.is-fullscreen-mode .interface-interface-skeleton {
2014
2016
  padding: 0;
2015
2017
  margin-bottom: 8px;
2016
2018
  }
2019
+ .editor-change-status__content p.components-base-control__help:has(.components-checkbox-control__help) {
2020
+ margin-top: 4px;
2021
+ }
2017
2022
 
2018
2023
  .editor-post-sticky__toggle-control {
2019
2024
  padding: 6px 12px;
@@ -1290,7 +1290,6 @@ body.is-fullscreen-mode .interface-interface-skeleton {
1290
1290
  .editor-keyboard-shortcut-help-modal__shortcut-description {
1291
1291
  flex: 1;
1292
1292
  margin: 0;
1293
- flex-basis: auto;
1294
1293
  }
1295
1294
  .editor-keyboard-shortcut-help-modal__shortcut-key-combination {
1296
1295
  display: block;
@@ -1487,6 +1486,9 @@ body.is-fullscreen-mode .interface-interface-skeleton {
1487
1486
  .editor-post-card-panel__icon.is-sync {
1488
1487
  fill: var(--wp-block-synced-color);
1489
1488
  }
1489
+ .editor-post-card-panel__icon.is-sync + .editor-post-card-panel__title {
1490
+ color: var(--wp-block-synced-color);
1491
+ }
1490
1492
 
1491
1493
  .editor-post-card-panel__title-badge {
1492
1494
  background: #f0f0f0;
@@ -1684,7 +1686,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
1684
1686
  }
1685
1687
 
1686
1688
  .editor-post-panel__row-label {
1687
- width: 30%;
1689
+ width: 38%;
1688
1690
  flex-shrink: 0;
1689
1691
  min-height: 32px;
1690
1692
  display: flex;
@@ -2014,6 +2016,9 @@ body.is-fullscreen-mode .interface-interface-skeleton {
2014
2016
  padding: 0;
2015
2017
  margin-bottom: 8px;
2016
2018
  }
2019
+ .editor-change-status__content p.components-base-control__help:has(.components-checkbox-control__help) {
2020
+ margin-top: 4px;
2021
+ }
2017
2022
 
2018
2023
  .editor-post-sticky__toggle-control {
2019
2024
  padding: 6px 12px;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import type { Action, AnyItem } from '@wordpress/dataviews';
5
+ export declare function registerEntityAction<Item extends AnyItem>(kind: string, name: string, config: Action<Item>): {
6
+ type: "REGISTER_ENTITY_ACTION";
7
+ kind: string;
8
+ name: string;
9
+ config: Action<Item>;
10
+ };
11
+ export declare function unregisterEntityAction(kind: string, name: string, actionId: string): {
12
+ type: "UNREGISTER_ENTITY_ACTION";
13
+ kind: string;
14
+ name: string;
15
+ actionId: string;
16
+ };
17
+ //# sourceMappingURL=private-actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private-actions.d.ts","sourceRoot":"","sources":["../../../src/dataviews/store/private-actions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE5D,wBAAgB,oBAAoB,CAAE,IAAI,SAAS,OAAO,EACzD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,CAAE,IAAI,CAAE;;;;;EAQtB;AAED,wBAAgB,sBAAsB,CACrC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM;;;;;EAQhB"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import type { Action } from '@wordpress/dataviews';
5
+ /**
6
+ * Internal dependencies
7
+ */
8
+ import type { State } from './reducer';
9
+ export declare function getEntityActions(state: State, kind: string, name: string): Action<any>[];
10
+ //# sourceMappingURL=private-selectors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private-selectors.d.ts","sourceRoot":"","sources":["../../../src/dataviews/store/private-selectors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnD;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAIvC,wBAAgB,gBAAgB,CAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAEzE"}
@@ -0,0 +1,11 @@
1
+ import type { Action } from '@wordpress/dataviews';
2
+ type ReduxAction = ReturnType<typeof import('./private-actions').registerEntityAction> | ReturnType<typeof import('./private-actions').unregisterEntityAction>;
3
+ export type ActionState = Record<string, Record<string, Action<any>[]>>;
4
+ export type State = {
5
+ actions: ActionState;
6
+ };
7
+ declare const _default: import("redux").Reducer<import("redux").CombinedState<{
8
+ actions: never;
9
+ }>, ReduxAction>;
10
+ export default _default;
11
+ //# sourceMappingURL=reducer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../../src/dataviews/store/reducer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnD,KAAK,WAAW,GACb,UAAU,CAAE,cAAc,mBAAmB,EAAE,oBAAoB,CAAE,GACrE,UAAU,CAAE,cAAc,mBAAmB,EAAE,sBAAsB,CAAE,CAAC;AAE3E,MAAM,MAAM,WAAW,GAAG,MAAM,CAAE,MAAM,EAAE,MAAM,CAAE,MAAM,EAAE,MAAM,CAAE,GAAG,CAAE,EAAE,CAAE,CAAE,CAAC;AAC9E,MAAM,MAAM,KAAK,GAAG;IACnB,OAAO,EAAE,WAAW,CAAC;CACrB,CAAC;;;;AA2BF,wBAEI"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/editor",
3
- "version": "14.0.1",
3
+ "version": "14.1.0",
4
4
  "description": "Enhanced block editor for WordPress posts.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -32,39 +32,39 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7.16.0",
35
- "@wordpress/a11y": "^4.0.1",
36
- "@wordpress/api-fetch": "^7.0.1",
37
- "@wordpress/blob": "^4.0.1",
38
- "@wordpress/block-editor": "^13.0.1",
39
- "@wordpress/blocks": "^13.0.1",
40
- "@wordpress/commands": "^1.0.1",
41
- "@wordpress/components": "^28.0.1",
42
- "@wordpress/compose": "^7.0.1",
43
- "@wordpress/core-data": "^7.0.1",
44
- "@wordpress/data": "^10.0.1",
45
- "@wordpress/date": "^5.0.1",
46
- "@wordpress/deprecated": "^4.0.1",
47
- "@wordpress/dom": "^4.0.1",
48
- "@wordpress/element": "^6.0.1",
49
- "@wordpress/hooks": "^4.0.1",
50
- "@wordpress/html-entities": "^4.0.1",
51
- "@wordpress/i18n": "^5.0.1",
52
- "@wordpress/icons": "^10.0.1",
53
- "@wordpress/interface": "^6.0.1",
54
- "@wordpress/keyboard-shortcuts": "^5.0.1",
55
- "@wordpress/keycodes": "^4.0.1",
56
- "@wordpress/media-utils": "^5.0.1",
57
- "@wordpress/notices": "^5.0.1",
58
- "@wordpress/patterns": "^2.0.1",
59
- "@wordpress/plugins": "^7.0.1",
60
- "@wordpress/preferences": "^4.0.1",
61
- "@wordpress/private-apis": "^1.0.1",
62
- "@wordpress/reusable-blocks": "^5.0.1",
63
- "@wordpress/rich-text": "^7.0.1",
64
- "@wordpress/server-side-render": "^5.0.1",
65
- "@wordpress/url": "^4.0.1",
66
- "@wordpress/warning": "^3.0.1",
67
- "@wordpress/wordcount": "^4.0.1",
35
+ "@wordpress/a11y": "^4.1.0",
36
+ "@wordpress/api-fetch": "^7.1.0",
37
+ "@wordpress/blob": "^4.1.0",
38
+ "@wordpress/block-editor": "^13.1.0",
39
+ "@wordpress/blocks": "^13.1.0",
40
+ "@wordpress/commands": "^1.1.0",
41
+ "@wordpress/components": "^28.1.0",
42
+ "@wordpress/compose": "^7.1.0",
43
+ "@wordpress/core-data": "^7.1.0",
44
+ "@wordpress/data": "^10.1.0",
45
+ "@wordpress/date": "^5.1.0",
46
+ "@wordpress/deprecated": "^4.1.0",
47
+ "@wordpress/dom": "^4.1.0",
48
+ "@wordpress/element": "^6.1.0",
49
+ "@wordpress/hooks": "^4.1.0",
50
+ "@wordpress/html-entities": "^4.1.0",
51
+ "@wordpress/i18n": "^5.1.0",
52
+ "@wordpress/icons": "^10.1.0",
53
+ "@wordpress/interface": "^6.1.0",
54
+ "@wordpress/keyboard-shortcuts": "^5.1.0",
55
+ "@wordpress/keycodes": "^4.1.0",
56
+ "@wordpress/media-utils": "^5.1.0",
57
+ "@wordpress/notices": "^5.1.0",
58
+ "@wordpress/patterns": "^2.1.0",
59
+ "@wordpress/plugins": "^7.1.0",
60
+ "@wordpress/preferences": "^4.1.0",
61
+ "@wordpress/private-apis": "^1.1.0",
62
+ "@wordpress/reusable-blocks": "^5.1.0",
63
+ "@wordpress/rich-text": "^7.1.0",
64
+ "@wordpress/server-side-render": "^5.1.0",
65
+ "@wordpress/url": "^4.1.0",
66
+ "@wordpress/warning": "^3.1.0",
67
+ "@wordpress/wordcount": "^4.1.0",
68
68
  "change-case": "^4.1.2",
69
69
  "client-zip": "^2.4.5",
70
70
  "clsx": "^2.1.1",
@@ -83,5 +83,5 @@
83
83
  "publishConfig": {
84
84
  "access": "public"
85
85
  },
86
- "gitHead": "0e973525f7787401b5a544e0727774d52a78639f"
86
+ "gitHead": "66d3bf12e67d16deddc4b4a9ec42e1d0bed3479a"
87
87
  }
@@ -28,10 +28,6 @@ import { store as editorStore } from '../../store';
28
28
  import EditorHistoryRedo from '../editor-history/redo';
29
29
  import EditorHistoryUndo from '../editor-history/undo';
30
30
 
31
- const preventDefault = ( event ) => {
32
- event.preventDefault();
33
- };
34
-
35
31
  function DocumentTools( { className, disableBlockTools = false } ) {
36
32
  const { setIsInserterOpened, setIsListViewOpened } =
37
33
  useDispatch( editorStore );
@@ -72,6 +68,19 @@ function DocumentTools( { className, disableBlockTools = false } ) {
72
68
  };
73
69
  }, [] );
74
70
 
71
+ const preventDefault = ( event ) => {
72
+ // Because the inserter behaves like a dialog,
73
+ // if the inserter is opened already then when we click on the toggle button
74
+ // then the initial click event will close the inserter and then be propagated
75
+ // to the inserter toggle and it will open it again.
76
+ // To prevent this we need to stop the propagation of the event.
77
+ // This won't be necessary when the inserter no longer behaves like a dialog.
78
+
79
+ if ( isInserterOpened ) {
80
+ event.preventDefault();
81
+ }
82
+ };
83
+
75
84
  const isLargeViewport = useViewportMatch( 'medium' );
76
85
  const isWideViewport = useViewportMatch( 'wide' );
77
86
 
@@ -20,20 +20,16 @@ function Editor( {
20
20
  templateId,
21
21
  settings,
22
22
  children,
23
+ initialEdits,
23
24
 
24
25
  // This could be part of the settings.
25
26
  onActionPerformed,
26
27
 
27
28
  // The following abstractions are not ideal but necessary
28
29
  // to account for site editor and post editor differences for now.
29
- className,
30
- styles,
31
- customSaveButton,
32
- forceDisableBlockTools,
33
- title,
34
- iframeProps,
30
+ extraContent,
35
31
  extraSidebarPanels,
36
- enableRegionNavigation = true,
32
+ ...props
37
33
  } ) {
38
34
  const { post, template, hasLoadedPost } = useSelect(
39
35
  ( select ) => {
@@ -59,12 +55,7 @@ function Editor( {
59
55
  );
60
56
 
61
57
  return (
62
- <ExperimentalEditorProvider
63
- post={ post }
64
- __unstableTemplate={ template }
65
- settings={ settings }
66
- useSubRegistry={ false }
67
- >
58
+ <>
68
59
  { hasLoadedPost && ! post && (
69
60
  <Notice status="warning" isDismissible={ false }>
70
61
  { __(
@@ -72,21 +63,25 @@ function Editor( {
72
63
  ) }
73
64
  </Notice>
74
65
  ) }
75
- <EditorInterface
76
- className={ className }
77
- styles={ styles }
78
- enableRegionNavigation={ enableRegionNavigation }
79
- customSaveButton={ customSaveButton }
80
- forceDisableBlockTools={ forceDisableBlockTools }
81
- title={ title }
82
- iframeProps={ iframeProps }
83
- />
84
- <Sidebar
85
- onActionPerformed={ onActionPerformed }
86
- extraPanels={ extraSidebarPanels }
87
- />
88
- { children }
89
- </ExperimentalEditorProvider>
66
+ { !! post && (
67
+ <ExperimentalEditorProvider
68
+ post={ post }
69
+ __unstableTemplate={ template }
70
+ settings={ settings }
71
+ initialEdits={ initialEdits }
72
+ useSubRegistry={ false }
73
+ >
74
+ <EditorInterface { ...props }>
75
+ { extraContent }
76
+ </EditorInterface>
77
+ <Sidebar
78
+ onActionPerformed={ onActionPerformed }
79
+ extraPanels={ extraSidebarPanels }
80
+ />
81
+ { children }
82
+ </ExperimentalEditorProvider>
83
+ ) }
84
+ </>
90
85
  );
91
86
  }
92
87
 
@@ -5,6 +5,15 @@ import { useSelect } from '@wordpress/data';
5
5
  import { store as coreStore } from '@wordpress/core-data';
6
6
  import { useMemo, useState } from '@wordpress/element';
7
7
 
8
+ /**
9
+ * Custom hook that determines if any entities are dirty (edited) and provides a way to manage selected/unselected entities.
10
+ *
11
+ * @return {Object} An object containing the following properties:
12
+ * - dirtyEntityRecords: An array of dirty entity records.
13
+ * - isDirty: A boolean indicating if there are any dirty entity records.
14
+ * - setUnselectedEntities: A function to set the unselected entities.
15
+ * - unselectedEntities: An array of unselected entities.
16
+ */
8
17
  export const useIsDirty = () => {
9
18
  const { editedEntities, siteEdits, siteEntityConfig } = useSelect(
10
19
  ( select ) => {
@@ -26,6 +26,15 @@ function identity( values ) {
26
26
  return values;
27
27
  }
28
28
 
29
+ /**
30
+ * Renders the component for managing saved states of entities.
31
+ *
32
+ * @param {Object} props The component props.
33
+ * @param {Function} props.close The function to close the dialog.
34
+ * @param {Function} props.renderDialog The function to render the dialog.
35
+ *
36
+ * @return {JSX.Element} The rendered component.
37
+ */
29
38
  export default function EntitiesSavedStates( {
30
39
  close,
31
40
  renderDialog = undefined,
@@ -40,6 +49,23 @@ export default function EntitiesSavedStates( {
40
49
  );
41
50
  }
42
51
 
52
+ /**
53
+ * Renders a panel for saving entities with dirty records.
54
+ *
55
+ * @param {Object} props The component props.
56
+ * @param {string} props.additionalPrompt Additional prompt to display.
57
+ * @param {Function} props.close Function to close the panel.
58
+ * @param {Function} props.onSave Function to call when saving entities.
59
+ * @param {boolean} props.saveEnabled Flag indicating if save is enabled.
60
+ * @param {string} props.saveLabel Label for the save button.
61
+ * @param {Function} props.renderDialog Function to render a custom dialog.
62
+ * @param {Array} props.dirtyEntityRecords Array of dirty entity records.
63
+ * @param {boolean} props.isDirty Flag indicating if there are dirty entities.
64
+ * @param {Function} props.setUnselectedEntities Function to set unselected entities.
65
+ * @param {Array} props.unselectedEntities Array of unselected entities.
66
+ *
67
+ * @return {JSX.Element} The rendered component.
68
+ */
43
69
  export function EntitiesSavedStatesExtensible( {
44
70
  additionalPrompt = undefined,
45
71
  close,
@@ -163,7 +163,13 @@ function useGlobalStylesUserConfig() {
163
163
  }, [ settings, styles, _links ] );
164
164
 
165
165
  const setConfig = useCallback(
166
- ( callback, options = {} ) => {
166
+ /**
167
+ * Set the global styles config.
168
+ * @param {Function|Object} callbackOrObject If the callbackOrObject is a function, pass the current config to the callback so the consumer can merge values.
169
+ * Otherwise, overwrite the current config with the incoming object.
170
+ * @param {Object} options Options for editEntityRecord Core selector.
171
+ */
172
+ ( callbackOrObject, options = {} ) => {
167
173
  const record = getEditedEntityRecord(
168
174
  'root',
169
175
  'globalStyles',
@@ -175,7 +181,11 @@ function useGlobalStylesUserConfig() {
175
181
  settings: record?.settings ?? {},
176
182
  _links: record?._links ?? {},
177
183
  };
178
- const updatedConfig = callback( currentConfig );
184
+
185
+ const updatedConfig =
186
+ typeof callbackOrObject === 'function'
187
+ ? callbackOrObject( currentConfig )
188
+ : callbackOrObject;
179
189
 
180
190
  editEntityRecord(
181
191
  'root',
@@ -106,4 +106,11 @@ export { default as EditorProvider } from './provider';
106
106
 
107
107
  export * from './deprecated';
108
108
  export const VisualEditorGlobalKeyboardShortcuts = EditorKeyboardShortcuts;
109
+
110
+ /**
111
+ * Component handles the global keyboard shortcuts for the Text editor.
112
+ *
113
+ * It provides functionality for various keyboard shortcuts such as toggling editor mode,
114
+ * toggling distraction-free mode, undo/redo.
115
+ */
109
116
  export const TextEditorGlobalKeyboardShortcuts = EditorKeyboardShortcuts;
@@ -33,9 +33,6 @@
33
33
  &__shortcut-description {
34
34
  flex: 1;
35
35
  margin: 0;
36
-
37
- // IE 11 flex item fix - ensure the item does not collapse.
38
- flex-basis: auto;
39
36
  }
40
37
 
41
38
  &__shortcut-key-combination {
@@ -783,7 +783,7 @@ const duplicatePostAction = {
783
783
  sprintf(
784
784
  // translators: %s: Title of the created template e.g: "Category".
785
785
  __( '"%s" successfully created.' ),
786
- newItem.title?.rendered || title
786
+ decodeEntities( newItem.title?.rendered || title )
787
787
  ),
788
788
  {
789
789
  id: 'duplicate-post-action',
@@ -1030,11 +1030,13 @@ export const duplicateTemplatePartAction = {
1030
1030
  };
1031
1031
 
1032
1032
  export function usePostActions( postType, onActionPerformed ) {
1033
- const { postTypeObject } = useSelect(
1033
+ const { defaultActions, postTypeObject } = useSelect(
1034
1034
  ( select ) => {
1035
1035
  const { getPostType } = select( coreStore );
1036
+ const { getEntityActions } = unlock( select( editorStore ) );
1036
1037
  return {
1037
1038
  postTypeObject: getPostType( postType ),
1039
+ defaultActions: getEntityActions( 'postType', postType ),
1038
1040
  };
1039
1041
  },
1040
1042
  [ postType ]
@@ -1072,6 +1074,7 @@ export function usePostActions( postType, onActionPerformed ) {
1072
1074
  ? deletePostAction
1073
1075
  : trashPostAction,
1074
1076
  ! isTemplateOrTemplatePart && permanentlyDeletePostAction,
1077
+ ...defaultActions,
1075
1078
  ].filter( Boolean );
1076
1079
 
1077
1080
  if ( onActionPerformed ) {
@@ -1117,6 +1120,7 @@ export function usePostActions( postType, onActionPerformed ) {
1117
1120
 
1118
1121
  return actions;
1119
1122
  }, [
1123
+ defaultActions,
1120
1124
  isTemplateOrTemplatePart,
1121
1125
  isPattern,
1122
1126
  postTypeObject?.viewable,