@wordpress/editor 13.31.0 → 13.33.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 (647) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +1080 -0
  3. package/build/bindings/index.js.map +1 -1
  4. package/build/bindings/pattern-overrides.js.map +1 -1
  5. package/build/bindings/post-meta.js +12 -30
  6. package/build/bindings/post-meta.js.map +1 -1
  7. package/build/components/autocompleters/index.js.map +1 -1
  8. package/build/components/autocompleters/user.js.map +1 -1
  9. package/build/components/autosave-monitor/index.js +10 -0
  10. package/build/components/autosave-monitor/index.js.map +1 -1
  11. package/build/components/block-manager/category.js.map +1 -1
  12. package/build/components/block-manager/checklist.js.map +1 -1
  13. package/build/components/block-manager/index.js.map +1 -1
  14. package/build/components/block-removal-warnings/index.js.map +1 -1
  15. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +107 -0
  16. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -0
  17. package/build/components/character-count/index.js.map +1 -1
  18. package/build/components/commands/index.js +20 -1
  19. package/build/components/commands/index.js.map +1 -1
  20. package/build/components/commands/index.native.js.map +1 -1
  21. package/build/components/deprecated.js +158 -0
  22. package/build/components/deprecated.js.map +1 -1
  23. package/build/components/deprecated.native.js.map +1 -1
  24. package/build/components/document-bar/index.js +5 -8
  25. package/build/components/document-bar/index.js.map +1 -1
  26. package/build/components/document-outline/check.js.map +1 -1
  27. package/build/components/document-outline/index.js.map +1 -1
  28. package/build/components/document-outline/item.js.map +1 -1
  29. package/build/components/document-tools/index.js +1 -1
  30. package/build/components/document-tools/index.js.map +1 -1
  31. package/build/components/editor-canvas/edit-template-blocks-notification.js +12 -38
  32. package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
  33. package/build/components/editor-canvas/index.js +5 -2
  34. package/build/components/editor-canvas/index.js.map +1 -1
  35. package/build/components/editor-help/add-blocks.native.js.map +1 -1
  36. package/build/components/editor-help/customize-blocks.native.js.map +1 -1
  37. package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  38. package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
  39. package/build/components/editor-help/help-section-title.native.js.map +1 -1
  40. package/build/components/editor-help/help-topic-row.native.js.map +1 -1
  41. package/build/components/editor-help/icon-move-blocks.native.js.map +1 -1
  42. package/build/components/editor-help/index.native.js.map +1 -1
  43. package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
  44. package/build/components/editor-help/move-blocks.native.js.map +1 -1
  45. package/build/components/editor-help/remove-blocks.native.js.map +1 -1
  46. package/build/components/editor-help/view-sections.native.js.map +1 -1
  47. package/build/components/editor-history/redo.js.map +1 -1
  48. package/build/components/editor-history/undo.js.map +1 -1
  49. package/build/components/editor-notices/index.js.map +1 -1
  50. package/build/components/editor-snackbars/index.js.map +1 -1
  51. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  52. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  53. package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  54. package/build/components/entities-saved-states/index.js +11 -85
  55. package/build/components/entities-saved-states/index.js.map +1 -1
  56. package/build/components/error-boundary/index.js.map +1 -1
  57. package/build/components/error-boundary/index.native.js.map +1 -1
  58. package/build/components/global-keyboard-shortcuts/index.js +24 -0
  59. package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
  60. package/build/components/global-keyboard-shortcuts/register-shortcuts.js +18 -0
  61. package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  62. package/build/components/index.js +57 -1
  63. package/build/components/index.js.map +1 -1
  64. package/build/components/index.native.js.map +1 -1
  65. package/build/components/inserter-sidebar/index.js +5 -1
  66. package/build/components/inserter-sidebar/index.js.map +1 -1
  67. package/build/components/keyboard-shortcut-help-modal/config.js +78 -0
  68. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -0
  69. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +49 -0
  70. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
  71. package/build/components/keyboard-shortcut-help-modal/index.js +126 -0
  72. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -0
  73. package/build/components/keyboard-shortcut-help-modal/shortcut.js +55 -0
  74. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
  75. package/build/components/list-view-sidebar/index.js +2 -1
  76. package/build/components/list-view-sidebar/index.js.map +1 -1
  77. package/build/components/list-view-sidebar/list-view-outline.js.map +1 -1
  78. package/build/components/local-autosave-monitor/index.js.map +1 -1
  79. package/build/components/media-categories/index.js.map +1 -1
  80. package/build/components/mode-switcher/index.js.map +1 -1
  81. package/build/components/offline-status/index.native.js.map +1 -1
  82. package/build/components/page-attributes/check.js.map +1 -1
  83. package/build/components/page-attributes/order.js.map +1 -1
  84. package/build/components/page-attributes/panel.js.map +1 -1
  85. package/build/components/page-attributes/parent.js.map +1 -1
  86. package/build/components/pattern-overrides-panel/index.js +30 -0
  87. package/build/components/pattern-overrides-panel/index.js.map +1 -0
  88. package/build/components/plugin-document-setting-panel/index.js.map +1 -1
  89. package/build/components/plugin-more-menu-item/index.js +78 -0
  90. package/build/components/plugin-more-menu-item/index.js.map +1 -0
  91. package/build/components/plugin-post-publish-panel/index.js +68 -0
  92. package/build/components/plugin-post-publish-panel/index.js.map +1 -0
  93. package/build/components/plugin-post-status-info/index.js +73 -0
  94. package/build/components/plugin-post-status-info/index.js.map +1 -0
  95. package/build/components/plugin-pre-publish-panel/index.js +71 -0
  96. package/build/components/plugin-pre-publish-panel/index.js.map +1 -0
  97. package/build/components/plugin-sidebar/index.js +108 -0
  98. package/build/components/plugin-sidebar/index.js.map +1 -0
  99. package/build/components/plugin-sidebar-more-menu-item/index.js +71 -0
  100. package/build/components/plugin-sidebar-more-menu-item/index.js.map +1 -0
  101. package/build/components/post-actions/actions.js +656 -0
  102. package/build/components/post-actions/actions.js.map +1 -0
  103. package/build/components/post-actions/index.js +137 -0
  104. package/build/components/post-actions/index.js.map +1 -0
  105. package/build/components/post-author/check.js.map +1 -1
  106. package/build/components/post-author/combobox.js.map +1 -1
  107. package/build/components/post-author/constants.js.map +1 -1
  108. package/build/components/post-author/hook.js.map +1 -1
  109. package/build/components/post-author/index.js.map +1 -1
  110. package/build/components/post-author/panel.js.map +1 -1
  111. package/build/components/post-author/select.js.map +1 -1
  112. package/build/components/post-card-panel/index.js +127 -0
  113. package/build/components/post-card-panel/index.js.map +1 -0
  114. package/build/components/post-comments/index.js.map +1 -1
  115. package/build/components/post-discussion/panel.js.map +1 -1
  116. package/build/components/post-excerpt/check.js +8 -0
  117. package/build/components/post-excerpt/check.js.map +1 -1
  118. package/build/components/post-excerpt/index.js.map +1 -1
  119. package/build/components/post-excerpt/panel.js.map +1 -1
  120. package/build/components/post-excerpt/plugin.js.map +1 -1
  121. package/build/components/post-featured-image/check.js.map +1 -1
  122. package/build/components/post-featured-image/index.js.map +1 -1
  123. package/build/components/post-featured-image/panel.js.map +1 -1
  124. package/build/components/post-format/check.js.map +1 -1
  125. package/build/components/post-format/index.js.map +1 -1
  126. package/build/components/post-last-revision/check.js.map +1 -1
  127. package/build/components/post-last-revision/index.js.map +1 -1
  128. package/build/components/post-last-revision/panel.js.map +1 -1
  129. package/build/components/post-locked-modal/index.js.map +1 -1
  130. package/build/components/post-panel-row/index.js.map +1 -1
  131. package/build/components/post-pending-status/check.js.map +1 -1
  132. package/build/components/post-pending-status/index.js.map +1 -1
  133. package/build/components/post-pingbacks/index.js.map +1 -1
  134. package/build/components/post-preview-button/index.js.map +1 -1
  135. package/build/components/post-publish-button/index.js +31 -31
  136. package/build/components/post-publish-button/index.js.map +1 -1
  137. package/build/components/post-publish-button/label.js +51 -43
  138. package/build/components/post-publish-button/label.js.map +1 -1
  139. package/build/components/post-publish-panel/index.js.map +1 -1
  140. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  141. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  142. package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  143. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  144. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  145. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  146. package/build/components/post-saved-state/index.js +10 -6
  147. package/build/components/post-saved-state/index.js.map +1 -1
  148. package/build/components/post-schedule/check.js.map +1 -1
  149. package/build/components/post-schedule/index.js.map +1 -1
  150. package/build/components/post-schedule/label.js.map +1 -1
  151. package/build/components/post-schedule/panel.js +8 -0
  152. package/build/components/post-schedule/panel.js.map +1 -1
  153. package/build/components/post-slug/check.js.map +1 -1
  154. package/build/components/post-slug/index.js +43 -68
  155. package/build/components/post-slug/index.js.map +1 -1
  156. package/build/components/post-status/index.js +239 -0
  157. package/build/components/post-status/index.js.map +1 -0
  158. package/build/components/post-sticky/check.js.map +1 -1
  159. package/build/components/post-sticky/index.js.map +1 -1
  160. package/build/components/post-switch-to-draft-button/index.js +6 -1
  161. package/build/components/post-switch-to-draft-button/index.js.map +1 -1
  162. package/build/components/post-sync-status/index.js.map +1 -1
  163. package/build/components/post-taxonomies/check.js.map +1 -1
  164. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  165. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  166. package/build/components/post-taxonomies/index.js.map +1 -1
  167. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  168. package/build/components/post-taxonomies/panel.js.map +1 -1
  169. package/build/components/post-template/block-theme.js +6 -2
  170. package/build/components/post-template/block-theme.js.map +1 -1
  171. package/build/components/post-template/classic-theme.js.map +1 -1
  172. package/build/components/post-template/create-new-template-modal.js.map +1 -1
  173. package/build/components/post-template/create-new-template.js.map +1 -1
  174. package/build/components/post-template/hooks.js.map +1 -1
  175. package/build/components/post-template/panel.js.map +1 -1
  176. package/build/components/post-template/reset-default-template.js.map +1 -1
  177. package/build/components/post-template/swap-template-button.js.map +1 -1
  178. package/build/components/post-text-editor/index.js.map +1 -1
  179. package/build/components/post-title/constants.js.map +1 -1
  180. package/build/components/post-title/index.js.map +1 -1
  181. package/build/components/post-title/index.native.js +1 -1
  182. package/build/components/post-title/index.native.js.map +1 -1
  183. package/build/components/post-title/post-title-raw.js.map +1 -1
  184. package/build/components/post-title/use-post-title-focus.js.map +1 -1
  185. package/build/components/post-title/use-post-title.js.map +1 -1
  186. package/build/components/post-trash/check.js +23 -25
  187. package/build/components/post-trash/check.js.map +1 -1
  188. package/build/components/post-trash/index.js +2 -1
  189. package/build/components/post-trash/index.js.map +1 -1
  190. package/build/components/post-type-support-check/index.js.map +1 -1
  191. package/build/components/post-url/check.js.map +1 -1
  192. package/build/components/post-url/index.js +44 -19
  193. package/build/components/post-url/index.js.map +1 -1
  194. package/build/components/post-url/label.js.map +1 -1
  195. package/build/components/post-url/panel.js +14 -7
  196. package/build/components/post-url/panel.js.map +1 -1
  197. package/build/components/post-view-link/index.js.map +1 -1
  198. package/build/components/post-visibility/check.js.map +1 -1
  199. package/build/components/post-visibility/index.js +2 -1
  200. package/build/components/post-visibility/index.js.map +1 -1
  201. package/build/components/post-visibility/label.js.map +1 -1
  202. package/build/components/post-visibility/utils.js.map +1 -1
  203. package/build/components/preferences-modal/enable-panel.js.map +1 -1
  204. package/build/components/preferences-modal/enable-plugin-document-setting-panel.js.map +1 -1
  205. package/build/components/preferences-modal/index.js +19 -17
  206. package/build/components/preferences-modal/index.js.map +1 -1
  207. package/build/components/preview-dropdown/index.js.map +1 -1
  208. package/build/components/provider/disable-non-page-content-blocks.js +36 -20
  209. package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
  210. package/build/components/provider/index.js +4 -2
  211. package/build/components/provider/index.js.map +1 -1
  212. package/build/components/provider/index.native.js +6 -1
  213. package/build/components/provider/index.native.js.map +1 -1
  214. package/build/components/provider/navigation-block-editing-mode.js.map +1 -1
  215. package/build/components/provider/use-auto-switch-editor-sidebars.js +52 -0
  216. package/build/components/provider/use-auto-switch-editor-sidebars.js.map +1 -0
  217. package/build/components/provider/use-block-editor-settings.js +70 -50
  218. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  219. package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
  220. package/build/components/provider/use-hide-blocks-from-inserter.js.map +1 -1
  221. package/build/components/provider/with-registry-provider.js +1 -0
  222. package/build/components/provider/with-registry-provider.js.map +1 -1
  223. package/build/components/start-page-options/index.js +139 -0
  224. package/build/components/start-page-options/index.js.map +1 -0
  225. package/build/components/table-of-contents/index.js.map +1 -1
  226. package/build/components/table-of-contents/panel.js.map +1 -1
  227. package/build/components/template-areas/index.js +70 -0
  228. package/build/components/template-areas/index.js.map +1 -0
  229. package/build/components/template-validation-notice/index.js +23 -29
  230. package/build/components/template-validation-notice/index.js.map +1 -1
  231. package/build/components/theme-support-check/index.js +10 -16
  232. package/build/components/theme-support-check/index.js.map +1 -1
  233. package/build/components/time-to-read/index.js.map +1 -1
  234. package/build/components/unsaved-changes-warning/index.js.map +1 -1
  235. package/build/components/word-count/index.js.map +1 -1
  236. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  237. package/build/hooks/default-autocompleters.js.map +1 -1
  238. package/build/hooks/index.js.map +1 -1
  239. package/build/hooks/index.native.js.map +1 -1
  240. package/build/hooks/pattern-overrides.js +22 -10
  241. package/build/hooks/pattern-overrides.js.map +1 -1
  242. package/build/hooks/use-select-nearest-editable-block.js +87 -0
  243. package/build/hooks/use-select-nearest-editable-block.js.map +1 -0
  244. package/build/index.js.map +1 -1
  245. package/build/index.native.js.map +1 -1
  246. package/build/lock-unlock.js.map +1 -1
  247. package/build/private-apis.js +26 -1
  248. package/build/private-apis.js.map +1 -1
  249. package/build/store/actions.js +46 -6
  250. package/build/store/actions.js.map +1 -1
  251. package/build/store/actions.native.js.map +1 -1
  252. package/build/store/constants.js +10 -1
  253. package/build/store/constants.js.map +1 -1
  254. package/build/store/defaults.js.map +1 -1
  255. package/build/store/index.js +1 -1
  256. package/build/store/index.js.map +1 -1
  257. package/build/store/local-autosave.js.map +1 -1
  258. package/build/store/private-actions.js +253 -1
  259. package/build/store/private-actions.js.map +1 -1
  260. package/build/store/private-selectors.js +50 -3
  261. package/build/store/private-selectors.js.map +1 -1
  262. package/build/store/reducer.js +14 -1
  263. package/build/store/reducer.js.map +1 -1
  264. package/build/store/reducer.native.js.map +1 -1
  265. package/build/store/selectors.js +25 -20
  266. package/build/store/selectors.js.map +1 -1
  267. package/build/store/selectors.native.js.map +1 -1
  268. package/build/store/utils/get-filtered-template-parts.js +71 -0
  269. package/build/store/utils/get-filtered-template-parts.js.map +1 -0
  270. package/build/store/utils/is-template-revertable.js +28 -0
  271. package/build/store/utils/is-template-revertable.js.map +1 -0
  272. package/build/store/utils/notice-builder.js.map +1 -1
  273. package/build/utils/get-template-part-icon.js.map +1 -1
  274. package/build/utils/index.js.map +1 -1
  275. package/build/utils/index.native.js.map +1 -1
  276. package/build/utils/media-upload/index.js.map +1 -1
  277. package/build/utils/media-upload/index.native.js.map +1 -1
  278. package/build/utils/terms.js.map +1 -1
  279. package/build/utils/url.js.map +1 -1
  280. package/build-module/bindings/index.js.map +1 -1
  281. package/build-module/bindings/pattern-overrides.js.map +1 -1
  282. package/build-module/bindings/post-meta.js +14 -31
  283. package/build-module/bindings/post-meta.js.map +1 -1
  284. package/build-module/components/autocompleters/index.js.map +1 -1
  285. package/build-module/components/autocompleters/user.js.map +1 -1
  286. package/build-module/components/autosave-monitor/index.js +10 -0
  287. package/build-module/components/autosave-monitor/index.js.map +1 -1
  288. package/build-module/components/block-manager/category.js.map +1 -1
  289. package/build-module/components/block-manager/checklist.js.map +1 -1
  290. package/build-module/components/block-manager/index.js.map +1 -1
  291. package/build-module/components/block-removal-warnings/index.js.map +1 -1
  292. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +100 -0
  293. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -0
  294. package/build-module/components/character-count/index.js.map +1 -1
  295. package/build-module/components/commands/index.js +21 -2
  296. package/build-module/components/commands/index.js.map +1 -1
  297. package/build-module/components/commands/index.native.js.map +1 -1
  298. package/build-module/components/deprecated.js +159 -0
  299. package/build-module/components/deprecated.js.map +1 -1
  300. package/build-module/components/deprecated.native.js.map +1 -1
  301. package/build-module/components/document-bar/index.js +6 -9
  302. package/build-module/components/document-bar/index.js.map +1 -1
  303. package/build-module/components/document-outline/check.js.map +1 -1
  304. package/build-module/components/document-outline/index.js.map +1 -1
  305. package/build-module/components/document-outline/item.js.map +1 -1
  306. package/build-module/components/document-tools/index.js +1 -1
  307. package/build-module/components/document-tools/index.js.map +1 -1
  308. package/build-module/components/editor-canvas/edit-template-blocks-notification.js +14 -40
  309. package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
  310. package/build-module/components/editor-canvas/index.js +5 -2
  311. package/build-module/components/editor-canvas/index.js.map +1 -1
  312. package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
  313. package/build-module/components/editor-help/customize-blocks.native.js.map +1 -1
  314. package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  315. package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -1
  316. package/build-module/components/editor-help/help-section-title.native.js.map +1 -1
  317. package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
  318. package/build-module/components/editor-help/icon-move-blocks.native.js.map +1 -1
  319. package/build-module/components/editor-help/index.native.js.map +1 -1
  320. package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
  321. package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
  322. package/build-module/components/editor-help/remove-blocks.native.js.map +1 -1
  323. package/build-module/components/editor-help/view-sections.native.js.map +1 -1
  324. package/build-module/components/editor-history/redo.js.map +1 -1
  325. package/build-module/components/editor-history/undo.js.map +1 -1
  326. package/build-module/components/editor-notices/index.js.map +1 -1
  327. package/build-module/components/editor-snackbars/index.js.map +1 -1
  328. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  329. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  330. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  331. package/build-module/components/entities-saved-states/index.js +11 -85
  332. package/build-module/components/entities-saved-states/index.js.map +1 -1
  333. package/build-module/components/error-boundary/index.js.map +1 -1
  334. package/build-module/components/error-boundary/index.native.js.map +1 -1
  335. package/build-module/components/global-keyboard-shortcuts/index.js +24 -0
  336. package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
  337. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +18 -0
  338. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  339. package/build-module/components/index.js +7 -0
  340. package/build-module/components/index.js.map +1 -1
  341. package/build-module/components/index.native.js.map +1 -1
  342. package/build-module/components/inserter-sidebar/index.js +5 -1
  343. package/build-module/components/inserter-sidebar/index.js.map +1 -1
  344. package/build-module/components/keyboard-shortcut-help-modal/config.js +71 -0
  345. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -0
  346. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +41 -0
  347. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
  348. package/build-module/components/keyboard-shortcut-help-modal/index.js +118 -0
  349. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -0
  350. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +48 -0
  351. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
  352. package/build-module/components/list-view-sidebar/index.js +2 -1
  353. package/build-module/components/list-view-sidebar/index.js.map +1 -1
  354. package/build-module/components/list-view-sidebar/list-view-outline.js.map +1 -1
  355. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  356. package/build-module/components/media-categories/index.js.map +1 -1
  357. package/build-module/components/mode-switcher/index.js.map +1 -1
  358. package/build-module/components/offline-status/index.native.js.map +1 -1
  359. package/build-module/components/page-attributes/check.js.map +1 -1
  360. package/build-module/components/page-attributes/order.js.map +1 -1
  361. package/build-module/components/page-attributes/panel.js.map +1 -1
  362. package/build-module/components/page-attributes/parent.js.map +1 -1
  363. package/build-module/components/pattern-overrides-panel/index.js +23 -0
  364. package/build-module/components/pattern-overrides-panel/index.js.map +1 -0
  365. package/build-module/components/plugin-document-setting-panel/index.js.map +1 -1
  366. package/build-module/components/plugin-more-menu-item/index.js +73 -0
  367. package/build-module/components/plugin-more-menu-item/index.js.map +1 -0
  368. package/build-module/components/plugin-post-publish-panel/index.js +61 -0
  369. package/build-module/components/plugin-post-publish-panel/index.js.map +1 -0
  370. package/build-module/components/plugin-post-status-info/index.js +66 -0
  371. package/build-module/components/plugin-post-status-info/index.js.map +1 -0
  372. package/build-module/components/plugin-pre-publish-panel/index.js +64 -0
  373. package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -0
  374. package/build-module/components/plugin-sidebar/index.js +102 -0
  375. package/build-module/components/plugin-sidebar/index.js.map +1 -0
  376. package/build-module/components/plugin-sidebar-more-menu-item/index.js +65 -0
  377. package/build-module/components/plugin-sidebar-more-menu-item/index.js.map +1 -0
  378. package/build-module/components/post-actions/actions.js +648 -0
  379. package/build-module/components/post-actions/actions.js.map +1 -0
  380. package/build-module/components/post-actions/index.js +130 -0
  381. package/build-module/components/post-actions/index.js.map +1 -0
  382. package/build-module/components/post-author/check.js.map +1 -1
  383. package/build-module/components/post-author/combobox.js.map +1 -1
  384. package/build-module/components/post-author/constants.js.map +1 -1
  385. package/build-module/components/post-author/hook.js.map +1 -1
  386. package/build-module/components/post-author/index.js.map +1 -1
  387. package/build-module/components/post-author/panel.js.map +1 -1
  388. package/build-module/components/post-author/select.js.map +1 -1
  389. package/build-module/components/post-card-panel/index.js +119 -0
  390. package/build-module/components/post-card-panel/index.js.map +1 -0
  391. package/build-module/components/post-comments/index.js.map +1 -1
  392. package/build-module/components/post-discussion/panel.js.map +1 -1
  393. package/build-module/components/post-excerpt/check.js +9 -0
  394. package/build-module/components/post-excerpt/check.js.map +1 -1
  395. package/build-module/components/post-excerpt/index.js.map +1 -1
  396. package/build-module/components/post-excerpt/panel.js.map +1 -1
  397. package/build-module/components/post-excerpt/plugin.js.map +1 -1
  398. package/build-module/components/post-featured-image/check.js.map +1 -1
  399. package/build-module/components/post-featured-image/index.js.map +1 -1
  400. package/build-module/components/post-featured-image/panel.js.map +1 -1
  401. package/build-module/components/post-format/check.js.map +1 -1
  402. package/build-module/components/post-format/index.js.map +1 -1
  403. package/build-module/components/post-last-revision/check.js.map +1 -1
  404. package/build-module/components/post-last-revision/index.js.map +1 -1
  405. package/build-module/components/post-last-revision/panel.js.map +1 -1
  406. package/build-module/components/post-locked-modal/index.js.map +1 -1
  407. package/build-module/components/post-panel-row/index.js.map +1 -1
  408. package/build-module/components/post-pending-status/check.js.map +1 -1
  409. package/build-module/components/post-pending-status/index.js.map +1 -1
  410. package/build-module/components/post-pingbacks/index.js.map +1 -1
  411. package/build-module/components/post-preview-button/index.js.map +1 -1
  412. package/build-module/components/post-publish-button/index.js +31 -31
  413. package/build-module/components/post-publish-button/index.js.map +1 -1
  414. package/build-module/components/post-publish-button/label.js +51 -42
  415. package/build-module/components/post-publish-button/label.js.map +1 -1
  416. package/build-module/components/post-publish-panel/index.js.map +1 -1
  417. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  418. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  419. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  420. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  421. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  422. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  423. package/build-module/components/post-saved-state/index.js +10 -6
  424. package/build-module/components/post-saved-state/index.js.map +1 -1
  425. package/build-module/components/post-schedule/check.js.map +1 -1
  426. package/build-module/components/post-schedule/index.js.map +1 -1
  427. package/build-module/components/post-schedule/label.js.map +1 -1
  428. package/build-module/components/post-schedule/panel.js +8 -0
  429. package/build-module/components/post-schedule/panel.js.map +1 -1
  430. package/build-module/components/post-slug/check.js.map +1 -1
  431. package/build-module/components/post-slug/index.js +44 -68
  432. package/build-module/components/post-slug/index.js.map +1 -1
  433. package/build-module/components/post-status/index.js +231 -0
  434. package/build-module/components/post-status/index.js.map +1 -0
  435. package/build-module/components/post-sticky/check.js.map +1 -1
  436. package/build-module/components/post-sticky/index.js.map +1 -1
  437. package/build-module/components/post-switch-to-draft-button/index.js +7 -1
  438. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  439. package/build-module/components/post-sync-status/index.js.map +1 -1
  440. package/build-module/components/post-taxonomies/check.js.map +1 -1
  441. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  442. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  443. package/build-module/components/post-taxonomies/index.js.map +1 -1
  444. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  445. package/build-module/components/post-taxonomies/panel.js.map +1 -1
  446. package/build-module/components/post-template/block-theme.js +7 -3
  447. package/build-module/components/post-template/block-theme.js.map +1 -1
  448. package/build-module/components/post-template/classic-theme.js.map +1 -1
  449. package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
  450. package/build-module/components/post-template/create-new-template.js.map +1 -1
  451. package/build-module/components/post-template/hooks.js.map +1 -1
  452. package/build-module/components/post-template/panel.js.map +1 -1
  453. package/build-module/components/post-template/reset-default-template.js.map +1 -1
  454. package/build-module/components/post-template/swap-template-button.js.map +1 -1
  455. package/build-module/components/post-text-editor/index.js.map +1 -1
  456. package/build-module/components/post-title/constants.js.map +1 -1
  457. package/build-module/components/post-title/index.js.map +1 -1
  458. package/build-module/components/post-title/index.native.js +1 -1
  459. package/build-module/components/post-title/index.native.js.map +1 -1
  460. package/build-module/components/post-title/post-title-raw.js.map +1 -1
  461. package/build-module/components/post-title/use-post-title-focus.js.map +1 -1
  462. package/build-module/components/post-title/use-post-title.js.map +1 -1
  463. package/build-module/components/post-trash/check.js +24 -26
  464. package/build-module/components/post-trash/check.js.map +1 -1
  465. package/build-module/components/post-trash/index.js +2 -1
  466. package/build-module/components/post-trash/index.js.map +1 -1
  467. package/build-module/components/post-type-support-check/index.js.map +1 -1
  468. package/build-module/components/post-url/check.js.map +1 -1
  469. package/build-module/components/post-url/index.js +46 -21
  470. package/build-module/components/post-url/index.js.map +1 -1
  471. package/build-module/components/post-url/label.js.map +1 -1
  472. package/build-module/components/post-url/panel.js +14 -7
  473. package/build-module/components/post-url/panel.js.map +1 -1
  474. package/build-module/components/post-view-link/index.js.map +1 -1
  475. package/build-module/components/post-visibility/check.js.map +1 -1
  476. package/build-module/components/post-visibility/index.js +2 -1
  477. package/build-module/components/post-visibility/index.js.map +1 -1
  478. package/build-module/components/post-visibility/label.js.map +1 -1
  479. package/build-module/components/post-visibility/utils.js.map +1 -1
  480. package/build-module/components/preferences-modal/enable-panel.js.map +1 -1
  481. package/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js.map +1 -1
  482. package/build-module/components/preferences-modal/index.js +19 -17
  483. package/build-module/components/preferences-modal/index.js.map +1 -1
  484. package/build-module/components/preview-dropdown/index.js.map +1 -1
  485. package/build-module/components/provider/disable-non-page-content-blocks.js +36 -20
  486. package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
  487. package/build-module/components/provider/index.js +5 -3
  488. package/build-module/components/provider/index.js.map +1 -1
  489. package/build-module/components/provider/index.native.js.map +1 -1
  490. package/build-module/components/provider/navigation-block-editing-mode.js.map +1 -1
  491. package/build-module/components/provider/use-auto-switch-editor-sidebars.js +46 -0
  492. package/build-module/components/provider/use-auto-switch-editor-sidebars.js.map +1 -0
  493. package/build-module/components/provider/use-block-editor-settings.js +73 -53
  494. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  495. package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
  496. package/build-module/components/provider/use-hide-blocks-from-inserter.js.map +1 -1
  497. package/build-module/components/provider/with-registry-provider.js +1 -0
  498. package/build-module/components/provider/with-registry-provider.js.map +1 -1
  499. package/build-module/components/start-page-options/index.js +132 -0
  500. package/build-module/components/start-page-options/index.js.map +1 -0
  501. package/build-module/components/table-of-contents/index.js.map +1 -1
  502. package/build-module/components/table-of-contents/panel.js.map +1 -1
  503. package/build-module/components/template-areas/index.js +63 -0
  504. package/build-module/components/template-areas/index.js.map +1 -0
  505. package/build-module/components/template-validation-notice/index.js +25 -31
  506. package/build-module/components/template-validation-notice/index.js.map +1 -1
  507. package/build-module/components/theme-support-check/index.js +11 -16
  508. package/build-module/components/theme-support-check/index.js.map +1 -1
  509. package/build-module/components/time-to-read/index.js.map +1 -1
  510. package/build-module/components/unsaved-changes-warning/index.js.map +1 -1
  511. package/build-module/components/word-count/index.js.map +1 -1
  512. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  513. package/build-module/hooks/default-autocompleters.js.map +1 -1
  514. package/build-module/hooks/index.js.map +1 -1
  515. package/build-module/hooks/index.native.js.map +1 -1
  516. package/build-module/hooks/pattern-overrides.js +22 -10
  517. package/build-module/hooks/pattern-overrides.js.map +1 -1
  518. package/build-module/hooks/use-select-nearest-editable-block.js +80 -0
  519. package/build-module/hooks/use-select-nearest-editable-block.js.map +1 -0
  520. package/build-module/index.js.map +1 -1
  521. package/build-module/index.native.js.map +1 -1
  522. package/build-module/lock-unlock.js.map +1 -1
  523. package/build-module/private-apis.js +24 -1
  524. package/build-module/private-apis.js.map +1 -1
  525. package/build-module/store/actions.js +37 -3
  526. package/build-module/store/actions.js.map +1 -1
  527. package/build-module/store/actions.native.js.map +1 -1
  528. package/build-module/store/constants.js +9 -0
  529. package/build-module/store/constants.js.map +1 -1
  530. package/build-module/store/defaults.js.map +1 -1
  531. package/build-module/store/index.js.map +1 -1
  532. package/build-module/store/local-autosave.js.map +1 -1
  533. package/build-module/store/private-actions.js +249 -1
  534. package/build-module/store/private-actions.js.map +1 -1
  535. package/build-module/store/private-selectors.js +50 -4
  536. package/build-module/store/private-selectors.js.map +1 -1
  537. package/build-module/store/reducer.js +13 -1
  538. package/build-module/store/reducer.js.map +1 -1
  539. package/build-module/store/reducer.native.js.map +1 -1
  540. package/build-module/store/selectors.js +20 -16
  541. package/build-module/store/selectors.js.map +1 -1
  542. package/build-module/store/selectors.native.js.map +1 -1
  543. package/build-module/store/utils/get-filtered-template-parts.js +64 -0
  544. package/build-module/store/utils/get-filtered-template-parts.js.map +1 -0
  545. package/build-module/store/utils/is-template-revertable.js +22 -0
  546. package/build-module/store/utils/is-template-revertable.js.map +1 -0
  547. package/build-module/store/utils/notice-builder.js.map +1 -1
  548. package/build-module/utils/get-template-part-icon.js.map +1 -1
  549. package/build-module/utils/index.js.map +1 -1
  550. package/build-module/utils/index.native.js.map +1 -1
  551. package/build-module/utils/media-upload/index.js.map +1 -1
  552. package/build-module/utils/media-upload/index.native.js.map +1 -1
  553. package/build-module/utils/terms.js.map +1 -1
  554. package/build-module/utils/url.js.map +1 -1
  555. package/build-style/style-rtl.css +565 -49
  556. package/build-style/style.css +565 -49
  557. package/package.json +36 -36
  558. package/src/bindings/post-meta.js +11 -27
  559. package/src/components/autosave-monitor/index.js +9 -0
  560. package/src/components/block-settings-menu/plugin-block-settings-menu-item.js +108 -0
  561. package/src/components/commands/index.js +21 -2
  562. package/src/components/deprecated.js +157 -0
  563. package/src/components/document-bar/index.js +9 -15
  564. package/src/components/document-bar/style.scss +9 -12
  565. package/src/components/document-tools/index.js +16 -14
  566. package/src/components/document-tools/style.scss +4 -11
  567. package/src/components/editor-canvas/edit-template-blocks-notification.js +17 -53
  568. package/src/components/editor-canvas/index.js +8 -4
  569. package/src/components/entities-saved-states/index.js +12 -113
  570. package/src/components/error-boundary/style.native.scss +1 -1
  571. package/src/components/global-keyboard-shortcuts/index.js +25 -0
  572. package/src/components/global-keyboard-shortcuts/register-shortcuts.js +20 -0
  573. package/src/components/index.js +7 -0
  574. package/src/components/inserter-sidebar/index.js +7 -1
  575. package/src/components/keyboard-shortcut-help-modal/config.js +53 -0
  576. package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +43 -0
  577. package/src/components/keyboard-shortcut-help-modal/index.js +160 -0
  578. package/src/components/keyboard-shortcut-help-modal/shortcut.js +67 -0
  579. package/src/components/keyboard-shortcut-help-modal/style.scss +61 -0
  580. package/src/components/list-view-sidebar/index.js +1 -0
  581. package/src/components/list-view-sidebar/style.scss +1 -1
  582. package/src/components/pattern-overrides-panel/index.js +26 -0
  583. package/src/components/plugin-more-menu-item/index.js +73 -0
  584. package/src/components/plugin-post-publish-panel/index.js +64 -0
  585. package/src/components/plugin-post-publish-panel/test/__snapshots__/index.js.snap +39 -0
  586. package/src/components/plugin-post-publish-panel/test/index.js +33 -0
  587. package/src/components/plugin-post-status-info/index.js +63 -0
  588. package/src/components/plugin-pre-publish-panel/index.js +67 -0
  589. package/src/components/plugin-pre-publish-panel/test/index.js +33 -0
  590. package/src/components/plugin-sidebar/index.js +98 -0
  591. package/src/components/plugin-sidebar-more-menu-item/index.js +64 -0
  592. package/src/components/post-actions/actions.js +862 -0
  593. package/src/components/post-actions/index.js +156 -0
  594. package/src/components/post-actions/style.scss +3 -0
  595. package/src/components/post-card-panel/index.js +168 -0
  596. package/src/components/post-card-panel/style.scss +32 -0
  597. package/src/components/post-excerpt/check.js +8 -0
  598. package/src/components/post-featured-image/style.scss +3 -2
  599. package/src/components/post-publish-button/index.js +23 -36
  600. package/src/components/post-publish-button/label.js +54 -39
  601. package/src/components/post-publish-button/test/index.js +15 -26
  602. package/src/components/post-publish-button/test/label.js +44 -21
  603. package/src/components/post-saved-state/index.js +13 -6
  604. package/src/components/post-saved-state/test/index.js +4 -0
  605. package/src/components/post-schedule/panel.js +22 -0
  606. package/src/components/post-slug/index.js +50 -68
  607. package/src/components/post-slug/test/index.js +29 -6
  608. package/src/components/post-status/index.js +310 -0
  609. package/src/components/post-status/style.scss +75 -0
  610. package/src/components/post-switch-to-draft-button/index.js +5 -0
  611. package/src/components/post-template/block-theme.js +31 -22
  612. package/src/components/post-title/index.native.js +1 -1
  613. package/src/components/post-trash/check.js +19 -19
  614. package/src/components/post-trash/index.js +1 -0
  615. package/src/components/post-url/index.js +131 -101
  616. package/src/components/post-url/panel.js +20 -7
  617. package/src/components/post-url/style.scss +8 -6
  618. package/src/components/post-visibility/index.js +1 -0
  619. package/src/components/preferences-modal/index.js +26 -22
  620. package/src/components/provider/disable-non-page-content-blocks.js +40 -20
  621. package/src/components/provider/index.js +17 -8
  622. package/src/components/provider/use-auto-switch-editor-sidebars.js +49 -0
  623. package/src/components/provider/use-block-editor-settings.js +70 -44
  624. package/src/components/provider/with-registry-provider.js +1 -0
  625. package/src/components/start-page-options/index.js +135 -0
  626. package/src/components/start-page-options/style.scss +26 -0
  627. package/src/components/template-areas/index.js +85 -0
  628. package/src/components/template-areas/style.scss +23 -0
  629. package/src/components/template-validation-notice/index.js +48 -50
  630. package/src/components/theme-support-check/index.js +9 -16
  631. package/src/components/theme-support-check/test/index.js +44 -43
  632. package/src/hooks/pattern-overrides.js +25 -14
  633. package/src/hooks/use-select-nearest-editable-block.js +95 -0
  634. package/src/private-apis.js +21 -0
  635. package/src/store/actions.js +37 -3
  636. package/src/store/constants.js +9 -0
  637. package/src/store/private-actions.js +377 -1
  638. package/src/store/private-selectors.js +101 -18
  639. package/src/store/reducer.js +13 -0
  640. package/src/store/selectors.js +51 -46
  641. package/src/store/utils/get-filtered-template-parts.js +69 -0
  642. package/src/store/utils/is-template-revertable.js +23 -0
  643. package/src/store/utils/test/get-filtered-template-parts.js +189 -0
  644. package/src/style.scss +8 -2
  645. package/src/components/post-publish-button/style.scss +0 -8
  646. package/src/components/provider/test/disable-non-page-content-blocks.js +0 -90
  647. package/src/components/template-validation-notice/style.scss +0 -9
@@ -2,9 +2,20 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { store as coreStore } from '@wordpress/core-data';
5
- import { __ } from '@wordpress/i18n';
5
+ import { __, sprintf } from '@wordpress/i18n';
6
6
  import { store as noticesStore } from '@wordpress/notices';
7
+ import { store as blockEditorStore } from '@wordpress/block-editor';
7
8
  import { store as preferencesStore } from '@wordpress/preferences';
9
+ import { addQueryArgs } from '@wordpress/url';
10
+ import apiFetch from '@wordpress/api-fetch';
11
+ import { parse, __unstableSerializeAndClean } from '@wordpress/blocks';
12
+ import { decodeEntities } from '@wordpress/html-entities';
13
+
14
+ /**
15
+ * Internal dependencies
16
+ */
17
+ import isTemplateRevertable from './utils/is-template-revertable';
18
+ import { TEMPLATE_POST_TYPE } from './constants';
8
19
 
9
20
  /**
10
21
  * Returns an action object used to set which template is currently being used/edited.
@@ -71,4 +82,241 @@ export const hideBlockTypes = blockNames => ({
71
82
  const mergedBlockNames = new Set([...existingBlockNames, ...(Array.isArray(blockNames) ? blockNames : [blockNames])]);
72
83
  registry.dispatch(preferencesStore).set('core', 'hiddenBlockTypes', [...mergedBlockNames]);
73
84
  };
85
+
86
+ /**
87
+ * Save entity records marked as dirty.
88
+ *
89
+ * @param {Object} options Options for the action.
90
+ * @param {Function} [options.onSave] Callback when saving happens.
91
+ * @param {object[]} [options.dirtyEntityRecords] Array of dirty entities.
92
+ * @param {object[]} [options.entitiesToSkip] Array of entities to skip saving.
93
+ * @param {Function} [options.close] Callback when the actions is called. It should be consolidated with `onSave`.
94
+ */
95
+ export const saveDirtyEntities = ({
96
+ onSave,
97
+ dirtyEntityRecords = [],
98
+ entitiesToSkip = [],
99
+ close
100
+ } = {}) => ({
101
+ registry
102
+ }) => {
103
+ const PUBLISH_ON_SAVE_ENTITIES = [{
104
+ kind: 'postType',
105
+ name: 'wp_navigation'
106
+ }];
107
+ const saveNoticeId = 'site-editor-save-success';
108
+ const homeUrl = registry.select(coreStore).getUnstableBase()?.home;
109
+ registry.dispatch(noticesStore).removeNotice(saveNoticeId);
110
+ const entitiesToSave = dirtyEntityRecords.filter(({
111
+ kind,
112
+ name,
113
+ key,
114
+ property
115
+ }) => {
116
+ return !entitiesToSkip.some(elt => elt.kind === kind && elt.name === name && elt.key === key && elt.property === property);
117
+ });
118
+ close?.(entitiesToSave);
119
+ const siteItemsToSave = [];
120
+ const pendingSavedRecords = [];
121
+ entitiesToSave.forEach(({
122
+ kind,
123
+ name,
124
+ key,
125
+ property
126
+ }) => {
127
+ if ('root' === kind && 'site' === name) {
128
+ siteItemsToSave.push(property);
129
+ } else {
130
+ if (PUBLISH_ON_SAVE_ENTITIES.some(typeToPublish => typeToPublish.kind === kind && typeToPublish.name === name)) {
131
+ registry.dispatch(coreStore).editEntityRecord(kind, name, key, {
132
+ status: 'publish'
133
+ });
134
+ }
135
+ pendingSavedRecords.push(registry.dispatch(coreStore).saveEditedEntityRecord(kind, name, key));
136
+ }
137
+ });
138
+ if (siteItemsToSave.length) {
139
+ pendingSavedRecords.push(registry.dispatch(coreStore).__experimentalSaveSpecifiedEntityEdits('root', 'site', undefined, siteItemsToSave));
140
+ }
141
+ registry.dispatch(blockEditorStore).__unstableMarkLastChangeAsPersistent();
142
+ Promise.all(pendingSavedRecords).then(values => {
143
+ return onSave ? onSave(values) : values;
144
+ }).then(values => {
145
+ if (values.some(value => typeof value === 'undefined')) {
146
+ registry.dispatch(noticesStore).createErrorNotice(__('Saving failed.'));
147
+ } else {
148
+ registry.dispatch(noticesStore).createSuccessNotice(__('Site updated.'), {
149
+ type: 'snackbar',
150
+ id: saveNoticeId,
151
+ actions: [{
152
+ label: __('View site'),
153
+ url: homeUrl
154
+ }]
155
+ });
156
+ }
157
+ }).catch(error => registry.dispatch(noticesStore).createErrorNotice(`${__('Saving failed.')} ${error}`));
158
+ };
159
+
160
+ /**
161
+ * Reverts a template to its original theme-provided file.
162
+ *
163
+ * @param {Object} template The template to revert.
164
+ * @param {Object} [options]
165
+ * @param {boolean} [options.allowUndo] Whether to allow the user to undo
166
+ * reverting the template. Default true.
167
+ */
168
+ export const revertTemplate = (template, {
169
+ allowUndo = true
170
+ } = {}) => async ({
171
+ registry
172
+ }) => {
173
+ const noticeId = 'edit-site-template-reverted';
174
+ registry.dispatch(noticesStore).removeNotice(noticeId);
175
+ if (!isTemplateRevertable(template)) {
176
+ registry.dispatch(noticesStore).createErrorNotice(__('This template is not revertable.'), {
177
+ type: 'snackbar'
178
+ });
179
+ return;
180
+ }
181
+ try {
182
+ const templateEntityConfig = registry.select(coreStore).getEntityConfig('postType', template.type);
183
+ if (!templateEntityConfig) {
184
+ registry.dispatch(noticesStore).createErrorNotice(__('The editor has encountered an unexpected error. Please reload.'), {
185
+ type: 'snackbar'
186
+ });
187
+ return;
188
+ }
189
+ const fileTemplatePath = addQueryArgs(`${templateEntityConfig.baseURL}/${template.id}`, {
190
+ context: 'edit',
191
+ source: 'theme'
192
+ });
193
+ const fileTemplate = await apiFetch({
194
+ path: fileTemplatePath
195
+ });
196
+ if (!fileTemplate) {
197
+ registry.dispatch(noticesStore).createErrorNotice(__('The editor has encountered an unexpected error. Please reload.'), {
198
+ type: 'snackbar'
199
+ });
200
+ return;
201
+ }
202
+ const serializeBlocks = ({
203
+ blocks: blocksForSerialization = []
204
+ }) => __unstableSerializeAndClean(blocksForSerialization);
205
+ const edited = registry.select(coreStore).getEditedEntityRecord('postType', template.type, template.id);
206
+
207
+ // We are fixing up the undo level here to make sure we can undo
208
+ // the revert in the header toolbar correctly.
209
+ registry.dispatch(coreStore).editEntityRecord('postType', template.type, template.id, {
210
+ content: serializeBlocks,
211
+ // Required to make the `undo` behave correctly.
212
+ blocks: edited.blocks,
213
+ // Required to revert the blocks in the editor.
214
+ source: 'custom' // required to avoid turning the editor into a dirty state
215
+ }, {
216
+ undoIgnore: true // Required to merge this edit with the last undo level.
217
+ });
218
+ const blocks = parse(fileTemplate?.content?.raw);
219
+ registry.dispatch(coreStore).editEntityRecord('postType', template.type, fileTemplate.id, {
220
+ content: serializeBlocks,
221
+ blocks,
222
+ source: 'theme'
223
+ });
224
+ if (allowUndo) {
225
+ const undoRevert = () => {
226
+ registry.dispatch(coreStore).editEntityRecord('postType', template.type, edited.id, {
227
+ content: serializeBlocks,
228
+ blocks: edited.blocks,
229
+ source: 'custom'
230
+ });
231
+ };
232
+ registry.dispatch(noticesStore).createSuccessNotice(__('Template reset.'), {
233
+ type: 'snackbar',
234
+ id: noticeId,
235
+ actions: [{
236
+ label: __('Undo'),
237
+ onClick: undoRevert
238
+ }]
239
+ });
240
+ }
241
+ } catch (error) {
242
+ const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : __('Template revert failed. Please reload.');
243
+ registry.dispatch(noticesStore).createErrorNotice(errorMessage, {
244
+ type: 'snackbar'
245
+ });
246
+ }
247
+ };
248
+
249
+ /**
250
+ * Action that removes an array of templates.
251
+ *
252
+ * @param {Array} items An array of template or template part objects to remove.
253
+ */
254
+ export const removeTemplates = items => async ({
255
+ registry
256
+ }) => {
257
+ const isTemplate = items[0].type === TEMPLATE_POST_TYPE;
258
+ const promiseResult = await Promise.allSettled(items.map(item => {
259
+ return registry.dispatch(coreStore).deleteEntityRecord('postType', item.type, item.id, {
260
+ force: true
261
+ }, {
262
+ throwOnError: true
263
+ });
264
+ }));
265
+
266
+ // If all the promises were fulfilled with sucess.
267
+ if (promiseResult.every(({
268
+ status
269
+ }) => status === 'fulfilled')) {
270
+ let successMessage;
271
+ if (items.length === 1) {
272
+ // Depending on how the entity was retrieved its title might be
273
+ // an object or simple string.
274
+ const title = typeof items[0].title === 'string' ? items[0].title : items[0].title?.rendered;
275
+ successMessage = sprintf( /* translators: The template/part's name. */
276
+ __('"%s" deleted.'), decodeEntities(title));
277
+ } else {
278
+ successMessage = isTemplate ? __('Templates deleted.') : __('Template parts deleted.');
279
+ }
280
+ registry.dispatch(noticesStore).createSuccessNotice(successMessage, {
281
+ type: 'snackbar',
282
+ id: 'site-editor-template-deleted-success'
283
+ });
284
+ } else {
285
+ // If there was at lease one failure.
286
+ let errorMessage;
287
+ // If we were trying to delete a single template.
288
+ if (promiseResult.length === 1) {
289
+ if (promiseResult[0].reason?.message) {
290
+ errorMessage = promiseResult[0].reason.message;
291
+ } else {
292
+ errorMessage = isTemplate ? __('An error occurred while deleting the template.') : __('An error occurred while deleting the template part.');
293
+ }
294
+ // If we were trying to delete a multiple templates
295
+ } else {
296
+ const errorMessages = new Set();
297
+ const failedPromises = promiseResult.filter(({
298
+ status
299
+ }) => status === 'rejected');
300
+ for (const failedPromise of failedPromises) {
301
+ if (failedPromise.reason?.message) {
302
+ errorMessages.add(failedPromise.reason.message);
303
+ }
304
+ }
305
+ if (errorMessages.size === 0) {
306
+ errorMessage = isTemplate ? __('An error occurred while deleting the templates.') : __('An error occurred while deleting the template parts.');
307
+ } else if (errorMessages.size === 1) {
308
+ errorMessage = isTemplate ? sprintf( /* translators: %s: an error message */
309
+ __('An error occurred while deleting the templates: %s'), [...errorMessages][0]) : sprintf( /* translators: %s: an error message */
310
+ __('An error occurred while deleting the template parts: %s'), [...errorMessages][0]);
311
+ } else {
312
+ errorMessage = isTemplate ? sprintf( /* translators: %s: a list of comma separated error messages */
313
+ __('Some errors occurred while deleting the templates: %s'), [...errorMessages].join(',')) : sprintf( /* translators: %s: a list of comma separated error messages */
314
+ __('Some errors occurred while deleting the template parts: %s'), [...errorMessages].join(','));
315
+ }
316
+ }
317
+ registry.dispatch(noticesStore).createErrorNotice(errorMessage, {
318
+ type: 'snackbar'
319
+ });
320
+ }
321
+ };
74
322
  //# sourceMappingURL=private-actions.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["store","coreStore","__","noticesStore","preferencesStore","setCurrentTemplateId","id","type","createTemplate","template","select","dispatch","registry","savedTemplate","saveEntityRecord","editEntityRecord","getCurrentPostType","getCurrentPostId","slug","createSuccessNotice","actions","label","onClick","setRenderingMode","getEditorSettings","defaultRenderingMode","showBlockTypes","blockNames","_registry$select$get","existingBlockNames","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\treturn savedTemplate;\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":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASF,KAAK,IAAIG,YAAY,QAAQ,oBAAoB;AAC1D,SAASH,KAAK,IAAII,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAAEC,EAAE,EAAG;EAC1C,OAAO;IACNC,IAAI,EAAE,yBAAyB;IAC/BD;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,cAAc,GACxBC,QAAQ,IACV,OAAQ;EAAEC,MAAM;EAAEC,QAAQ;EAAEC;AAAS,CAAC,KAAM;EAC3C,MAAMC,aAAa,GAAG,MAAMD,QAAQ,CAClCD,QAAQ,CAAEV,SAAU,CAAC,CACrBa,gBAAgB,CAAE,UAAU,EAAE,aAAa,E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;AACA,OAAO,MAAMM,cAAc,GACxBV,UAAU,IACZ,CAAE;EAAEf;AAAS,CAAC,KAAM;EAAA,IAAA0B,qBAAA;EACnB,MAAMT,kBAAkB,IAAAS,qBAAA,GACvB1B,QAAQ,CACNF,MAAM,CAAEN,gBAAiB,CAAC,CAC1B0B,GAAG,CAAE,MAAM,EAAE,kBAAmB,CAAC,cAAAQ,qBAAA,cAAAA,qBAAA,GAAI,EAAE;EAE1C,MAAMC,gBAAgB,GAAG,IAAIC,GAAG,CAAE,CACjC,GAAGX,kBAAkB,EACrB,IAAKI,KAAK,CAACC,OAAO,CAAEP,UAAW,CAAC,GAAGA,UAAU,GAAG,CAAEA,UAAU,CAAE,CAAE,CAC/D,CAAC;EAEHf,QAAQ,CACND,QAAQ,CAAEP,gBAAiB,CAAC,CAC5BgC,GAAG,CAAE,MAAM,EAAE,kBAAkB,EAAE,CAAE,GAAGG,gBAAgB,CAAG,CAAC;AAC7D,CAAC"}
1
+ {"version":3,"names":["store","coreStore","__","sprintf","noticesStore","blockEditorStore","preferencesStore","addQueryArgs","apiFetch","parse","__unstableSerializeAndClean","decodeEntities","isTemplateRevertable","TEMPLATE_POST_TYPE","setCurrentTemplateId","id","type","createTemplate","template","select","dispatch","registry","savedTemplate","saveEntityRecord","editEntityRecord","getCurrentPostType","getCurrentPostId","slug","createSuccessNotice","actions","label","onClick","setRenderingMode","getEditorSettings","defaultRenderingMode","showBlockTypes","blockNames","_registry$select$get","existingBlockNames","get","newBlockNames","filter","Array","isArray","includes","set","hideBlockTypes","_registry$select$get2","mergedBlockNames","Set","saveDirtyEntities","onSave","dirtyEntityRecords","entitiesToSkip","close","PUBLISH_ON_SAVE_ENTITIES","kind","name","saveNoticeId","homeUrl","getUnstableBase","home","removeNotice","entitiesToSave","key","property","some","elt","siteItemsToSave","pendingSavedRecords","forEach","push","typeToPublish","status","saveEditedEntityRecord","length","__experimentalSaveSpecifiedEntityEdits","undefined","__unstableMarkLastChangeAsPersistent","Promise","all","then","values","value","createErrorNotice","url","catch","error","revertTemplate","allowUndo","noticeId","templateEntityConfig","getEntityConfig","fileTemplatePath","baseURL","context","source","fileTemplate","path","serializeBlocks","blocks","blocksForSerialization","edited","getEditedEntityRecord","content","undoIgnore","raw","undoRevert","errorMessage","message","code","removeTemplates","items","isTemplate","promiseResult","allSettled","map","item","deleteEntityRecord","force","throwOnError","every","successMessage","title","rendered","reason","errorMessages","failedPromises","failedPromise","add","size","join"],"sources":["@wordpress/editor/src/store/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { addQueryArgs } from '@wordpress/url';\nimport apiFetch from '@wordpress/api-fetch';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport isTemplateRevertable from './utils/is-template-revertable';\nimport { TEMPLATE_POST_TYPE } from './constants';\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\treturn savedTemplate;\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\n/**\n * Save entity records marked as dirty.\n *\n * @param {Object} options Options for the action.\n * @param {Function} [options.onSave] Callback when saving happens.\n * @param {object[]} [options.dirtyEntityRecords] Array of dirty entities.\n * @param {object[]} [options.entitiesToSkip] Array of entities to skip saving.\n * @param {Function} [options.close] Callback when the actions is called. It should be consolidated with `onSave`.\n */\nexport const saveDirtyEntities =\n\t( { onSave, dirtyEntityRecords = [], entitiesToSkip = [], close } = {} ) =>\n\t( { registry } ) => {\n\t\tconst PUBLISH_ON_SAVE_ENTITIES = [\n\t\t\t{ kind: 'postType', name: 'wp_navigation' },\n\t\t];\n\t\tconst saveNoticeId = 'site-editor-save-success';\n\t\tconst homeUrl = registry.select( coreStore ).getUnstableBase()?.home;\n\t\tregistry.dispatch( noticesStore ).removeNotice( saveNoticeId );\n\t\tconst entitiesToSave = dirtyEntityRecords.filter(\n\t\t\t( { kind, name, key, property } ) => {\n\t\t\t\treturn ! entitiesToSkip.some(\n\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\telt.kind === kind &&\n\t\t\t\t\t\telt.name === name &&\n\t\t\t\t\t\telt.key === key &&\n\t\t\t\t\t\telt.property === property\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\t\tclose?.( entitiesToSave );\n\t\tconst siteItemsToSave = [];\n\t\tconst pendingSavedRecords = [];\n\t\tentitiesToSave.forEach( ( { kind, name, key, property } ) => {\n\t\t\tif ( 'root' === kind && 'site' === name ) {\n\t\t\t\tsiteItemsToSave.push( property );\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tPUBLISH_ON_SAVE_ENTITIES.some(\n\t\t\t\t\t\t( typeToPublish ) =>\n\t\t\t\t\t\t\ttypeToPublish.kind === kind &&\n\t\t\t\t\t\t\ttypeToPublish.name === name\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.editEntityRecord( kind, name, key, {\n\t\t\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\tpendingSavedRecords.push(\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.saveEditedEntityRecord( kind, name, key )\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\t\tif ( siteItemsToSave.length ) {\n\t\t\tpendingSavedRecords.push(\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t.__experimentalSaveSpecifiedEntityEdits(\n\t\t\t\t\t\t'root',\n\t\t\t\t\t\t'site',\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tsiteItemsToSave\n\t\t\t\t\t)\n\t\t\t);\n\t\t}\n\t\tregistry\n\t\t\t.dispatch( blockEditorStore )\n\t\t\t.__unstableMarkLastChangeAsPersistent();\n\t\tPromise.all( pendingSavedRecords )\n\t\t\t.then( ( values ) => {\n\t\t\t\treturn onSave ? onSave( values ) : values;\n\t\t\t} )\n\t\t\t.then( ( values ) => {\n\t\t\t\tif (\n\t\t\t\t\tvalues.some( ( value ) => typeof value === 'undefined' )\n\t\t\t\t) {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t\t.createErrorNotice( __( 'Saving failed.' ) );\n\t\t\t\t} else {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t\t.createSuccessNotice( __( 'Site updated.' ), {\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: saveNoticeId,\n\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tlabel: __( 'View site' ),\n\t\t\t\t\t\t\t\t\turl: homeUrl,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( ( error ) =>\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t`${ __( 'Saving failed.' ) } ${ error }`\n\t\t\t\t\t)\n\t\t\t);\n\t};\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport const revertTemplate =\n\t( template, { allowUndo = true } = {} ) =>\n\tasync ( { registry } ) => {\n\t\tconst noticeId = 'edit-site-template-reverted';\n\t\tregistry.dispatch( noticesStore ).removeNotice( noticeId );\n\t\tif ( ! isTemplateRevertable( template ) ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( __( 'This template is not revertable.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst templateEntityConfig = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEntityConfig( 'postType', template.type );\n\n\t\t\tif ( ! templateEntityConfig ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t\t`${ templateEntityConfig.baseURL }/${ template.id }`,\n\t\t\t\t{ context: 'edit', source: 'theme' }\n\t\t\t);\n\n\t\t\tconst fileTemplate = await apiFetch( { path: fileTemplatePath } );\n\t\t\tif ( ! fileTemplate ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst serializeBlocks = ( {\n\t\t\t\tblocks: blocksForSerialization = [],\n\t\t\t} ) => __unstableSerializeAndClean( blocksForSerialization );\n\n\t\t\tconst edited = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t\t// the revert in the header toolbar correctly.\n\t\t\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: serializeBlocks, // Required to make the `undo` behave correctly.\n\t\t\t\t\tblocks: edited.blocks, // Required to revert the blocks in the editor.\n\t\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tundoIgnore: true, // Required to merge this edit with the last undo level.\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord( 'postType', template.type, fileTemplate.id, {\n\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\tblocks,\n\t\t\t\t\tsource: 'theme',\n\t\t\t\t} );\n\n\t\t\tif ( allowUndo ) {\n\t\t\t\tconst undoRevert = () => {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\t\tedited.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t};\n\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createSuccessNotice( __( 'Template reset.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: noticeId,\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\t\tonClick: undoRevert,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t} );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'Template revert failed. Please reload.' );\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n\n/**\n * Action that removes an array of templates.\n *\n * @param {Array} items An array of template or template part objects to remove.\n */\nexport const removeTemplates =\n\t( items ) =>\n\tasync ( { registry } ) => {\n\t\tconst isTemplate = items[ 0 ].type === TEMPLATE_POST_TYPE;\n\t\tconst promiseResult = await Promise.allSettled(\n\t\t\titems.map( ( item ) => {\n\t\t\t\treturn registry\n\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t.deleteEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\titem.type,\n\t\t\t\t\t\titem.id,\n\t\t\t\t\t\t{ force: true },\n\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t);\n\t\t\t} )\n\t\t);\n\n\t\t// If all the promises were fulfilled with sucess.\n\t\tif ( promiseResult.every( ( { status } ) => status === 'fulfilled' ) ) {\n\t\t\tlet successMessage;\n\n\t\t\tif ( items.length === 1 ) {\n\t\t\t\t// Depending on how the entity was retrieved its title might be\n\t\t\t\t// an object or simple string.\n\t\t\t\tconst title =\n\t\t\t\t\ttypeof items[ 0 ].title === 'string'\n\t\t\t\t\t\t? items[ 0 ].title\n\t\t\t\t\t\t: items[ 0 ].title?.rendered;\n\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tsuccessMessage = isTemplate\n\t\t\t\t\t? __( 'Templates deleted.' )\n\t\t\t\t\t: __( 'Template parts deleted.' );\n\t\t\t}\n\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createSuccessNotice( successMessage, {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'site-editor-template-deleted-success',\n\t\t\t\t} );\n\t\t} else {\n\t\t\t// If there was at lease one failure.\n\t\t\tlet errorMessage;\n\t\t\t// If we were trying to delete a single template.\n\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = isTemplate\n\t\t\t\t\t\t? __( 'An error occurred while deleting the template.' )\n\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t'An error occurred while deleting the template part.'\n\t\t\t\t\t\t );\n\t\t\t\t}\n\t\t\t\t// If we were trying to delete a multiple templates\n\t\t\t} else {\n\t\t\t\tconst errorMessages = new Set();\n\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t);\n\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\terrorMessages.add( failedPromise.reason.message );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\terrorMessage = isTemplate\n\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t'An error occurred while deleting the templates.'\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t'An error occurred while deleting the template parts.'\n\t\t\t\t\t\t );\n\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\terrorMessage = isTemplate\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while deleting the templates: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while deleting the template parts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t );\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = isTemplate\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while deleting the templates: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while deleting the template parts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t\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C,CACvB,CAAC,GACD3H,OAAO,EACP;QACAD,EAAE,CACD,yDACD,CAAC,EACD,CAAE,GAAG4H,aAAa,CAAE,CAAE,CAAC,CACvB,CAAC;MACL,CAAC,MAAM;QACNlB,YAAY,GAAGK,UAAU,GACtB9G,OAAO,EACP;QACAD,EAAE,CACD,uDACD,CAAC,EACD,CAAE,GAAG4H,aAAa,CAAE,CAACK,IAAI,CAAE,GAAI,CAC/B,CAAC,GACDhI,OAAO,EACP;QACAD,EAAE,CACD,4DACD,CAAC,EACD,CAAE,GAAG4H,aAAa,CAAE,CAACK,IAAI,CAAE,GAAI,CAC/B,CAAC;MACL;IACD;IACA9G,QAAQ,CACND,QAAQ,CAAEhB,YAAa,CAAC,CACxBgF,iBAAiB,CAAEwB,YAAY,EAAE;MAAE5F,IAAI,EAAE;IAAW,CAAE,CAAC;EAC1D;AACD,CAAC","ignoreList":[]}
@@ -2,12 +2,16 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { store as blockEditorStore } from '@wordpress/block-editor';
5
- import { createRegistrySelector } from '@wordpress/data';
5
+ import { createSelector, createRegistrySelector } from '@wordpress/data';
6
+ import { layout, symbol, navigation, page as pageIcon, verse } from '@wordpress/icons';
7
+ import { store as coreStore } from '@wordpress/core-data';
6
8
 
7
9
  /**
8
10
  * Internal dependencies
9
11
  */
10
- import { getRenderingMode } from './selectors';
12
+ import { getRenderingMode, __experimentalGetDefaultTemplatePartAreas } from './selectors';
13
+ import { TEMPLATE_PART_POST_TYPE } from './constants';
14
+ import { getFilteredTemplatePartBlocks } from './utils/get-filtered-template-parts';
11
15
  const EMPTY_INSERTION_POINT = {
12
16
  rootClientId: undefined,
13
17
  insertionIndex: undefined,
@@ -21,7 +25,7 @@ const EMPTY_INSERTION_POINT = {
21
25
  *
22
26
  * @return {Object} The root client ID, index to insert at and starting filter value.
23
27
  */
24
- export const getInsertionPoint = createRegistrySelector(select => state => {
28
+ export const getInsertionPoint = createRegistrySelector(select => createSelector(state => {
25
29
  if (typeof state.blockInserterPanel === 'object') {
26
30
  return state.blockInserterPanel;
27
31
  }
@@ -36,8 +40,50 @@ export const getInsertionPoint = createRegistrySelector(select => state => {
36
40
  }
37
41
  }
38
42
  return EMPTY_INSERTION_POINT;
39
- });
43
+ }, state => {
44
+ const [postContentClientId] = select(blockEditorStore).getBlocksByName('core/post-content');
45
+ return [state.blockInserterPanel, getRenderingMode(state), postContentClientId];
46
+ }));
40
47
  export function getListViewToggleRef(state) {
41
48
  return state.listViewToggleRef;
42
49
  }
50
+ const CARD_ICONS = {
51
+ wp_block: symbol,
52
+ wp_navigation: navigation,
53
+ page: pageIcon,
54
+ post: verse
55
+ };
56
+ export const getPostIcon = createRegistrySelector(select => (state, postType, options) => {
57
+ {
58
+ if (postType === 'wp_template_part' || postType === 'wp_template') {
59
+ return __experimentalGetDefaultTemplatePartAreas(state).find(item => options.area === item.area)?.icon || layout;
60
+ }
61
+ if (CARD_ICONS[postType]) {
62
+ return CARD_ICONS[postType];
63
+ }
64
+ const postTypeEntity = select(coreStore).getPostType(postType);
65
+ // `icon` is the `menu_icon` property of a post type. We
66
+ // only handle `dashicons` for now, even if the `menu_icon`
67
+ // also supports urls and svg as values.
68
+ if (postTypeEntity?.icon?.startsWith('dashicons-')) {
69
+ return postTypeEntity.icon.slice(10);
70
+ }
71
+ return pageIcon;
72
+ }
73
+ });
74
+
75
+ /**
76
+ * Returns the template parts and their blocks for the current edited template.
77
+ *
78
+ * @param {Object} state Global application state.
79
+ * @return {Array} Template parts and their blocks in an array.
80
+ */
81
+ export const getCurrentTemplateTemplateParts = createRegistrySelector(select => () => {
82
+ const templateParts = select(coreStore).getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, {
83
+ per_page: -1
84
+ });
85
+ const clientIds = select(blockEditorStore).getBlocksByName('core/template-part');
86
+ const blocks = select(blockEditorStore).getBlocksByClientId(clientIds);
87
+ return getFilteredTemplatePartBlocks(blocks, templateParts);
88
+ });
43
89
  //# sourceMappingURL=private-selectors.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["store","blockEditorStore","createRegistrySelector","getRenderingMode","EMPTY_INSERTION_POINT","rootClientId","undefined","insertionIndex","filterValue","getInsertionPoint","select","state","blockInserterPanel","postContentClientId","getBlocksByName","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":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,sBAAsB,QAAQ,iBAAiB;;AAExD;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,aAAa;AAE9C,MAAMC,qBAAqB,GAAG;EAC7BC,YAAY,EAAEC,SAAS;EACvBC,cAAc,EAAED,SAAS;EACzBE,WAAW,EAAEF;AACd,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMG,iBAAiB,GAAGP,sBAAsB,CACpDQ,MAAM,IAAQC,KAAK,IAAM;EAC1B,IAAK,OAAOA,KAAK,CAACC,kBAAkB,KAAK,QAAQ,EAAG;IACnD,OAAOD,KAAK,CAACC,kBAAkB;EAChC;EAEA,IAAKT,gBAAgB,CAAEQ,KAAM,CAAC,KAAK,iBAAiB,EAAG;IACtD,MAAM,CAAEE,mBAAmB,CAAE,GAC5BH,MAAM,CAAET,gBAAiB,CAAC,CAACa,eAAe,CACzC,mBACD,CAAC;IACF,IAAKD,mBAAmB,EAAG;MAC1B,OAAO;QACNR,YAAY,EAAEQ,mBAAmB;QACjCN,cAAc,EAAED,SAAS;QACzBE,WAAW,EAAEF;MACd,CAAC;IACF;EACD;EAEA,OAAOF,qBAAqB;AAC7B,CACD,CAAC;AAED,OAAO,SAASW,oBAAoBA,CAAEJ,KAAK,EAAG;EAC7C,OAAOA,KAAK,CAACK,iBAAiB;AAC/B"}
1
+ {"version":3,"names":["store","blockEditorStore","createSelector","createRegistrySelector","layout","symbol","navigation","page","pageIcon","verse","coreStore","getRenderingMode","__experimentalGetDefaultTemplatePartAreas","TEMPLATE_PART_POST_TYPE","getFilteredTemplatePartBlocks","EMPTY_INSERTION_POINT","rootClientId","undefined","insertionIndex","filterValue","getInsertionPoint","select","state","blockInserterPanel","postContentClientId","getBlocksByName","getListViewToggleRef","listViewToggleRef","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"],"sources":["@wordpress/editor/src/store/private-selectors.js"],"sourcesContent":["/**\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\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}\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"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,cAAc,EA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eAAe,CAAE,oBAAqB,CAAC;EACnE,MAAMuB,MAAM,GACX3B,MAAM,CAAEpB,gBAAiB,CAAC,CAACgD,mBAAmB,CAAEF,SAAU,CAAC;EAE5D,OAAOjC,6BAA6B,CAAEkC,MAAM,EAAEJ,aAAc,CAAC;AAC9D,CACD,CAAC","ignoreList":[]}
@@ -351,6 +351,17 @@ export function listViewToggleRef(state = {
351
351
  }) {
352
352
  return state;
353
353
  }
354
+ export function publishSidebarActive(state = false, action) {
355
+ switch (action.type) {
356
+ case 'OPEN_PUBLISH_SIDEBAR':
357
+ return true;
358
+ case 'CLOSE_PUBLISH_SIDEBAR':
359
+ return false;
360
+ case 'TOGGLE_PUBLISH_SIDEBAR':
361
+ return !state;
362
+ }
363
+ return state;
364
+ }
354
365
  export default combineReducers({
355
366
  postId,
356
367
  postType,
@@ -367,6 +378,7 @@ export default combineReducers({
367
378
  removedPanels,
368
379
  blockInserterPanel,
369
380
  listViewPanel,
370
- listViewToggleRef
381
+ listViewToggleRef,
382
+ publishSidebarActive
371
383
  });
372
384
  //# 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"],"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\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\tlistViewPanel,\n\tlistViewToggleRef,\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,MAAM,KAAKD,KAAK,CAACC,MAAM,IAC7BL,KAAK,CAACM,KAAK,CAAE,CAAEC,GAAG,EAAEC,KAAK,KAAMJ,KAAK,CAAEI,KAAK,CAAE,KAAKD,GAAI,CAAC;AAEzD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,0BAA0BA,CAAEC,MAAM,EAAEC,cAAc,EAAG;EACpE,OACCD,MAAM,CAACE,IAAI,KAAK,WAAW,IAC3Bf,WAAW,CAAEa,MAAM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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;EAClBE,aAAa;EACbC;AACD,CAAE,CAAC"}
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","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\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\tlistViewPanel,\n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AK;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;EAClBE,aAAa;EACbC,iBAAiB;EACjBE;AACD,CAAE,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["combineReducers","postId","postType","saving","postLock","postSavingLock","template","editorSettings","EDITOR_SETTINGS_DEFAULTS","autosaveInterval","postTitle","isSelected","state","action","type","clipboard","notices","notice","filter","id"],"sources":["@wordpress/editor/src/store/reducer.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tpostId,\n\tpostType,\n\tsaving,\n\tpostLock,\n\tpostSavingLock,\n\ttemplate,\n\teditorSettings,\n} from './reducer.js';\n\nimport { EDITOR_SETTINGS_DEFAULTS } from './defaults.js';\n\nEDITOR_SETTINGS_DEFAULTS.autosaveInterval = 1; // This is a way to override default behavior on mobile, and make it ping the native save every second as long as something changed\n\nexport * from './reducer.js';\n\n/**\n * Reducer returning the post title state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const postTitle = combineReducers( {\n\tisSelected( state = false, action ) {\n\t\tswitch ( action.type ) {\n\t\t\tcase 'TOGGLE_POST_TITLE_SELECTION':\n\t\t\t\treturn action.isSelected;\n\t\t}\n\n\t\treturn state;\n\t},\n} );\n\n/**\n * Reducer returning the clipboard state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function clipboard( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_CLIPBOARD':\n\t\t\treturn action.clipboard;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the notices state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function notices( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'CREATE_NOTICE':\n\t\t\treturn [ ...state, action.notice ];\n\t\tcase 'REMOVE_ALL_NOTICES':\n\t\t\treturn [];\n\t\tcase 'REMOVE_NOTICE':\n\t\t\treturn state.filter( ( notice ) => notice.id !== action.id );\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tpostId,\n\tpostType,\n\tpostTitle,\n\tsaving,\n\tpostLock,\n\tpostSavingLock,\n\ttemplate,\n\teditorSettings,\n\tclipboard,\n\tnotices,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,iBAAiB;;AAEjD;AACA;AACA;AACA,SACCC,MAAM,EACNC,QAAQ,EACRC,MAAM,EACNC,QAAQ,EACRC,cAAc,EACdC,QAAQ,EACRC,cAAc,QACR,cAAc;AAErB,SAASC,wBAAwB,QAAQ,eAAe;AAExDA,wBAAwB,CAACC,gBAAgB,GAAG,CAAC,CAAC,CAAC;;AAE/C,cAAc,cAAc;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAGV,eAAe,CAAE;EACzCW,UAAUA,CAAEC,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;IACnC,QAASA,MAAM,CAACC,IAAI;MACnB,KAAK,6BAA6B;QACjC,OAAOD,MAAM,CAACF,UAAU;IAC1B;IAEA,OAAOC,KAAK;EACb;AACD,CAAE,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,SAASA,CAAEH,KAAK,GAAG,IAAI,EAAEC,MAAM,EAAG;EACjD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,kBAAkB;MACtB,OAAOD,MAAM,CAACE,SAAS;EACzB;EAEA,OAAOH,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,OAAOA,CAAEJ,KAAK,GAAG,EAAE,EAAEC,MAAM,EAAG;EAC7C,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,eAAe;MACnB,OAAO,CAAE,GAAGF,KAAK,EAAEC,MAAM,CAACI,MAAM,CAAE;IACnC,KAAK,oBAAoB;MACxB,OAAO,EAAE;IACV,KAAK,eAAe;MACnB,OAAOL,KAAK,CAACM,MAAM,CAAID,MAAM,IAAMA,MAAM,CAACE,EAAE,KAAKN,MAAM,CAACM,EAAG,CAAC;EAC9D;EACA,OAAOP,KAAK;AACb;AAEA,eAAeZ,eAAe,CAAE;EAC/BC,MAAM;EACNC,QAAQ;EACRQ,SAAS;EACTP,MAAM;EACNC,QAAQ;EACRC,cAAc;EACdC,QAAQ;EACRC,cAAc;EACdQ,SAAS;EACTC;AACD,CAAE,CAAC"}
1
+ {"version":3,"names":["combineReducers","postId","postType","saving","postLock","postSavingLock","template","editorSettings","EDITOR_SETTINGS_DEFAULTS","autosaveInterval","postTitle","isSelected","state","action","type","clipboard","notices","notice","filter","id"],"sources":["@wordpress/editor/src/store/reducer.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tpostId,\n\tpostType,\n\tsaving,\n\tpostLock,\n\tpostSavingLock,\n\ttemplate,\n\teditorSettings,\n} from './reducer.js';\n\nimport { EDITOR_SETTINGS_DEFAULTS } from './defaults.js';\n\nEDITOR_SETTINGS_DEFAULTS.autosaveInterval = 1; // This is a way to override default behavior on mobile, and make it ping the native save every second as long as something changed\n\nexport * from './reducer.js';\n\n/**\n * Reducer returning the post title state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const postTitle = combineReducers( {\n\tisSelected( state = false, action ) {\n\t\tswitch ( action.type ) {\n\t\t\tcase 'TOGGLE_POST_TITLE_SELECTION':\n\t\t\t\treturn action.isSelected;\n\t\t}\n\n\t\treturn state;\n\t},\n} );\n\n/**\n * Reducer returning the clipboard state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function clipboard( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_CLIPBOARD':\n\t\t\treturn action.clipboard;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the notices state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function notices( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'CREATE_NOTICE':\n\t\t\treturn [ ...state, action.notice ];\n\t\tcase 'REMOVE_ALL_NOTICES':\n\t\t\treturn [];\n\t\tcase 'REMOVE_NOTICE':\n\t\t\treturn state.filter( ( notice ) => notice.id !== action.id );\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tpostId,\n\tpostType,\n\tpostTitle,\n\tsaving,\n\tpostLock,\n\tpostSavingLock,\n\ttemplate,\n\teditorSettings,\n\tclipboard,\n\tnotices,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,iBAAiB;;AAEjD;AACA;AACA;AACA,SACCC,MAAM,EACNC,QAAQ,EACRC,MAAM,EACNC,QAAQ,EACRC,cAAc,EACdC,QAAQ,EACRC,cAAc,QACR,cAAc;AAErB,SAASC,wBAAwB,QAAQ,eAAe;AAExDA,wBAAwB,CAACC,gBAAgB,GAAG,CAAC,CAAC,CAAC;;AAE/C,cAAc,cAAc;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAGV,eAAe,CAAE;EACzCW,UAAUA,CAAEC,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;IACnC,QAASA,MAAM,CAACC,IAAI;MACnB,KAAK,6BAA6B;QACjC,OAAOD,MAAM,CAACF,UAAU;IAC1B;IAEA,O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