@wordpress/edit-site 5.22.0 → 5.23.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 (355) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/actions/index.js +86 -4
  3. package/build/components/actions/index.js.map +1 -1
  4. package/build/components/add-new-template/new-template.js +0 -7
  5. package/build/components/add-new-template/new-template.js.map +1 -1
  6. package/build/components/block-editor/use-site-editor-settings.js +54 -63
  7. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  8. package/build/components/dataviews/add-filter.js +90 -0
  9. package/build/components/dataviews/add-filter.js.map +1 -0
  10. package/build/components/dataviews/dataviews.js +23 -4
  11. package/build/components/dataviews/dataviews.js.map +1 -1
  12. package/build/components/dataviews/filters.js +36 -32
  13. package/build/components/dataviews/filters.js.map +1 -1
  14. package/build/components/dataviews/in-filter.js +22 -20
  15. package/build/components/dataviews/in-filter.js.map +1 -1
  16. package/build/components/dataviews/index.js +9 -2
  17. package/build/components/dataviews/index.js.map +1 -1
  18. package/build/components/dataviews/item-actions.js +81 -13
  19. package/build/components/dataviews/item-actions.js.map +1 -1
  20. package/build/components/dataviews/pagination.js +3 -2
  21. package/build/components/dataviews/pagination.js.map +1 -1
  22. package/build/components/dataviews/reset-filters.js +33 -0
  23. package/build/components/dataviews/reset-filters.js.map +1 -0
  24. package/build/components/dataviews/search.js +1 -0
  25. package/build/components/dataviews/search.js.map +1 -1
  26. package/build/components/dataviews/view-actions.js +27 -10
  27. package/build/components/dataviews/view-actions.js.map +1 -1
  28. package/build/components/dataviews/view-list.js +126 -5
  29. package/build/components/dataviews/view-list.js.map +1 -1
  30. package/build/components/dataviews/view-side-by-side.js +20 -0
  31. package/build/components/dataviews/view-side-by-side.js.map +1 -0
  32. package/build/components/editor/index.js +53 -53
  33. package/build/components/editor/index.js.map +1 -1
  34. package/build/components/global-styles/screen-revisions/index.js +42 -21
  35. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  36. package/build/components/global-styles/screen-root.js +3 -3
  37. package/build/components/global-styles/screen-root.js.map +1 -1
  38. package/build/components/global-styles/ui.js +3 -3
  39. package/build/components/global-styles/ui.js.map +1 -1
  40. package/build/components/global-styles-renderer/index.js +1 -1
  41. package/build/components/global-styles-renderer/index.js.map +1 -1
  42. package/build/components/header-edit-mode/document-tools/index.js +160 -0
  43. package/build/components/header-edit-mode/document-tools/index.js.map +1 -0
  44. package/build/components/header-edit-mode/index.js +48 -116
  45. package/build/components/header-edit-mode/index.js.map +1 -1
  46. package/build/components/header-edit-mode/more-menu/site-export.js +2 -6
  47. package/build/components/header-edit-mode/more-menu/site-export.js.map +1 -1
  48. package/build/components/layout/index.js +4 -19
  49. package/build/components/layout/index.js.map +1 -1
  50. package/build/components/list/added-by.js +1 -0
  51. package/build/components/list/added-by.js.map +1 -1
  52. package/build/components/page-content-focus-manager/back-to-page-notification.js +5 -10
  53. package/build/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
  54. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +36 -23
  55. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  56. package/build/components/page-main/index.js +2 -1
  57. package/build/components/page-main/index.js.map +1 -1
  58. package/build/components/page-pages/index.js +133 -78
  59. package/build/components/page-pages/index.js.map +1 -1
  60. package/build/components/page-pages/side-editor.js +25 -0
  61. package/build/components/page-pages/side-editor.js.map +1 -0
  62. package/build/components/page-patterns/grid-item.js +2 -2
  63. package/build/components/page-patterns/grid-item.js.map +1 -1
  64. package/build/components/page-patterns/patterns-list.js +3 -3
  65. package/build/components/page-patterns/patterns-list.js.map +1 -1
  66. package/build/components/page-patterns/use-patterns.js +1 -1
  67. package/build/components/page-patterns/use-patterns.js.map +1 -1
  68. package/build/components/page-templates/dataviews-templates.js +201 -0
  69. package/build/components/page-templates/dataviews-templates.js.map +1 -0
  70. package/build/components/page-templates/template-actions.js +168 -0
  71. package/build/components/page-templates/template-actions.js.map +1 -0
  72. package/build/components/sidebar/index.js +1 -2
  73. package/build/components/sidebar/index.js.map +1 -1
  74. package/build/components/sidebar-dataviews/add-new-view.js +124 -0
  75. package/build/components/sidebar-dataviews/add-new-view.js.map +1 -0
  76. package/build/components/sidebar-dataviews/custom-dataviews-list.js +189 -0
  77. package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -0
  78. package/build/components/sidebar-dataviews/dataview-item.js +71 -0
  79. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -0
  80. package/build/components/sidebar-dataviews/default-views.js +60 -0
  81. package/build/components/sidebar-dataviews/default-views.js.map +1 -0
  82. package/build/components/sidebar-dataviews/index.js +21 -38
  83. package/build/components/sidebar-dataviews/index.js.map +1 -1
  84. package/build/components/sidebar-edit-mode/default-sidebar.js +2 -6
  85. package/build/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
  86. package/build/components/sidebar-edit-mode/page-panels/edit-template.js +11 -11
  87. package/build/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
  88. package/build/components/sidebar-edit-mode/page-panels/page-summary.js +2 -1
  89. package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  90. package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js +4 -12
  91. package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +1 -1
  92. package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js +4 -12
  93. package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +1 -1
  94. package/build/components/sidebar-edit-mode/plugin-sidebar/index.js +2 -6
  95. package/build/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
  96. package/build/components/sidebar-edit-mode/template-panel/hooks.js +3 -3
  97. package/build/components/sidebar-edit-mode/template-panel/hooks.js.map +1 -1
  98. package/build/components/sidebar-navigation-screen-global-styles/index.js +1 -1
  99. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  100. package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +1 -1
  101. package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -1
  102. package/build/components/sidebar-navigation-screen-page/page-details.js +3 -11
  103. package/build/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
  104. package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -1
  105. package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
  106. package/build/components/site-hub/index.js +18 -6
  107. package/build/components/site-hub/index.js.map +1 -1
  108. package/build/components/start-template-options/index.js +12 -16
  109. package/build/components/start-template-options/index.js.map +1 -1
  110. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +112 -49
  111. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  112. package/build/components/template-part-converter/convert-to-regular.js +1 -1
  113. package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
  114. package/build/hooks/push-changes-to-global-styles/index.js +3 -1
  115. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  116. package/build/hooks/template-part-edit.js +6 -2
  117. package/build/hooks/template-part-edit.js.map +1 -1
  118. package/build/index.js +0 -3
  119. package/build/index.js.map +1 -1
  120. package/build/store/actions.js +35 -82
  121. package/build/store/actions.js.map +1 -1
  122. package/build/store/selectors.js +25 -63
  123. package/build/store/selectors.js.map +1 -1
  124. package/build/utils/constants.js +3 -3
  125. package/build/utils/constants.js.map +1 -1
  126. package/build-module/components/actions/index.js +85 -5
  127. package/build-module/components/actions/index.js.map +1 -1
  128. package/build-module/components/add-new-template/new-template.js +0 -7
  129. package/build-module/components/add-new-template/new-template.js.map +1 -1
  130. package/build-module/components/block-editor/use-site-editor-settings.js +54 -62
  131. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  132. package/build-module/components/dataviews/add-filter.js +83 -0
  133. package/build-module/components/dataviews/add-filter.js.map +1 -0
  134. package/build-module/components/dataviews/dataviews.js +22 -4
  135. package/build-module/components/dataviews/dataviews.js.map +1 -1
  136. package/build-module/components/dataviews/filters.js +34 -32
  137. package/build-module/components/dataviews/filters.js.map +1 -1
  138. package/build-module/components/dataviews/in-filter.js +20 -19
  139. package/build-module/components/dataviews/in-filter.js.map +1 -1
  140. package/build-module/components/dataviews/index.js +1 -1
  141. package/build-module/components/dataviews/index.js.map +1 -1
  142. package/build-module/components/dataviews/item-actions.js +84 -16
  143. package/build-module/components/dataviews/item-actions.js.map +1 -1
  144. package/build-module/components/dataviews/pagination.js +3 -2
  145. package/build-module/components/dataviews/pagination.js.map +1 -1
  146. package/build-module/components/dataviews/reset-filters.js +26 -0
  147. package/build-module/components/dataviews/reset-filters.js.map +1 -0
  148. package/build-module/components/dataviews/search.js +1 -0
  149. package/build-module/components/dataviews/search.js.map +1 -1
  150. package/build-module/components/dataviews/view-actions.js +28 -11
  151. package/build-module/components/dataviews/view-actions.js.map +1 -1
  152. package/build-module/components/dataviews/view-list.js +128 -7
  153. package/build-module/components/dataviews/view-list.js.map +1 -1
  154. package/build-module/components/dataviews/view-side-by-side.js +12 -0
  155. package/build-module/components/dataviews/view-side-by-side.js.map +1 -0
  156. package/build-module/components/editor/index.js +57 -57
  157. package/build-module/components/editor/index.js.map +1 -1
  158. package/build-module/components/global-styles/screen-revisions/index.js +42 -21
  159. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  160. package/build-module/components/global-styles/screen-root.js +3 -3
  161. package/build-module/components/global-styles/screen-root.js.map +1 -1
  162. package/build-module/components/global-styles/ui.js +3 -3
  163. package/build-module/components/global-styles/ui.js.map +1 -1
  164. package/build-module/components/global-styles-renderer/index.js +1 -1
  165. package/build-module/components/global-styles-renderer/index.js.map +1 -1
  166. package/build-module/components/header-edit-mode/document-tools/index.js +152 -0
  167. package/build-module/components/header-edit-mode/document-tools/index.js.map +1 -0
  168. package/build-module/components/header-edit-mode/index.js +52 -120
  169. package/build-module/components/header-edit-mode/index.js.map +1 -1
  170. package/build-module/components/header-edit-mode/more-menu/site-export.js +2 -6
  171. package/build-module/components/header-edit-mode/more-menu/site-export.js.map +1 -1
  172. package/build-module/components/layout/index.js +5 -20
  173. package/build-module/components/layout/index.js.map +1 -1
  174. package/build-module/components/list/added-by.js +1 -1
  175. package/build-module/components/list/added-by.js.map +1 -1
  176. package/build-module/components/page-content-focus-manager/back-to-page-notification.js +5 -10
  177. package/build-module/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
  178. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +36 -23
  179. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  180. package/build-module/components/page-main/index.js +2 -1
  181. package/build-module/components/page-main/index.js.map +1 -1
  182. package/build-module/components/page-pages/index.js +137 -80
  183. package/build-module/components/page-pages/index.js.map +1 -1
  184. package/build-module/components/page-pages/side-editor.js +17 -0
  185. package/build-module/components/page-pages/side-editor.js.map +1 -0
  186. package/build-module/components/page-patterns/grid-item.js +2 -2
  187. package/build-module/components/page-patterns/grid-item.js.map +1 -1
  188. package/build-module/components/page-patterns/patterns-list.js +4 -4
  189. package/build-module/components/page-patterns/patterns-list.js.map +1 -1
  190. package/build-module/components/page-patterns/use-patterns.js +2 -2
  191. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  192. package/build-module/components/page-templates/dataviews-templates.js +193 -0
  193. package/build-module/components/page-templates/dataviews-templates.js.map +1 -0
  194. package/build-module/components/page-templates/template-actions.js +157 -0
  195. package/build-module/components/page-templates/template-actions.js.map +1 -0
  196. package/build-module/components/sidebar/index.js +1 -2
  197. package/build-module/components/sidebar/index.js.map +1 -1
  198. package/build-module/components/sidebar-dataviews/add-new-view.js +116 -0
  199. package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -0
  200. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +180 -0
  201. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -0
  202. package/build-module/components/sidebar-dataviews/dataview-item.js +63 -0
  203. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -0
  204. package/build-module/components/sidebar-dataviews/default-views.js +52 -0
  205. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -0
  206. package/build-module/components/sidebar-dataviews/index.js +22 -39
  207. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  208. package/build-module/components/sidebar-edit-mode/default-sidebar.js +2 -6
  209. package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
  210. package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js +12 -12
  211. package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
  212. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +3 -1
  213. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  214. package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js +5 -13
  215. package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +1 -1
  216. package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js +5 -13
  217. package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +1 -1
  218. package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js +2 -6
  219. package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
  220. package/build-module/components/sidebar-edit-mode/template-panel/hooks.js +4 -4
  221. package/build-module/components/sidebar-edit-mode/template-panel/hooks.js.map +1 -1
  222. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +1 -1
  223. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  224. package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +1 -1
  225. package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -1
  226. package/build-module/components/sidebar-navigation-screen-page/page-details.js +3 -11
  227. package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
  228. package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -2
  229. package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
  230. package/build-module/components/site-hub/index.js +19 -7
  231. package/build-module/components/site-hub/index.js.map +1 -1
  232. package/build-module/components/start-template-options/index.js +13 -16
  233. package/build-module/components/start-template-options/index.js.map +1 -1
  234. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +112 -50
  235. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  236. package/build-module/components/template-part-converter/convert-to-regular.js +1 -1
  237. package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
  238. package/build-module/hooks/push-changes-to-global-styles/index.js +4 -2
  239. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  240. package/build-module/hooks/template-part-edit.js +6 -2
  241. package/build-module/hooks/template-part-edit.js.map +1 -1
  242. package/build-module/index.js +0 -3
  243. package/build-module/index.js.map +1 -1
  244. package/build-module/store/actions.js +33 -79
  245. package/build-module/store/actions.js.map +1 -1
  246. package/build-module/store/selectors.js +19 -58
  247. package/build-module/store/selectors.js.map +1 -1
  248. package/build-module/utils/constants.js +1 -1
  249. package/build-module/utils/constants.js.map +1 -1
  250. package/build-style/style-rtl.css +69 -119
  251. package/build-style/style.css +69 -119
  252. package/package.json +41 -41
  253. package/src/components/actions/index.js +113 -5
  254. package/src/components/add-new-template/new-template.js +0 -5
  255. package/src/components/block-editor/style.scss +0 -87
  256. package/src/components/block-editor/use-site-editor-settings.js +68 -89
  257. package/src/components/dataviews/README.md +77 -83
  258. package/src/components/dataviews/add-filter.js +111 -0
  259. package/src/components/dataviews/dataviews.js +20 -2
  260. package/src/components/dataviews/filters.js +56 -49
  261. package/src/components/dataviews/in-filter.js +35 -17
  262. package/src/components/dataviews/index.js +1 -1
  263. package/src/components/dataviews/item-actions.js +95 -20
  264. package/src/components/dataviews/pagination.js +5 -4
  265. package/src/components/dataviews/reset-filters.js +26 -0
  266. package/src/components/dataviews/search.js +1 -0
  267. package/src/components/dataviews/style.scss +5 -1
  268. package/src/components/dataviews/view-actions.js +39 -9
  269. package/src/components/dataviews/view-list.js +174 -3
  270. package/src/components/dataviews/view-side-by-side.js +9 -0
  271. package/src/components/editor/index.js +149 -121
  272. package/src/components/global-styles/screen-revisions/index.js +52 -25
  273. package/src/components/global-styles/screen-root.js +2 -1
  274. package/src/components/global-styles/ui.js +1 -1
  275. package/src/components/global-styles-renderer/index.js +1 -1
  276. package/src/components/header-edit-mode/document-tools/index.js +201 -0
  277. package/src/components/header-edit-mode/index.js +86 -184
  278. package/src/components/header-edit-mode/more-menu/site-export.js +2 -6
  279. package/src/components/header-edit-mode/style.scss +35 -2
  280. package/src/components/layout/index.js +4 -11
  281. package/src/components/layout/style.scss +6 -18
  282. package/src/components/list/added-by.js +1 -1
  283. package/src/components/page-content-focus-manager/back-to-page-notification.js +4 -15
  284. package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +38 -33
  285. package/src/components/page-main/index.js +6 -1
  286. package/src/components/page-pages/index.js +162 -81
  287. package/src/components/page-pages/side-editor.js +14 -0
  288. package/src/components/page-patterns/grid-item.js +3 -3
  289. package/src/components/page-patterns/patterns-list.js +10 -4
  290. package/src/components/page-patterns/use-patterns.js +3 -2
  291. package/src/components/page-templates/dataviews-templates.js +224 -0
  292. package/src/components/page-templates/template-actions.js +209 -0
  293. package/src/components/sidebar/index.js +1 -2
  294. package/src/components/sidebar-dataviews/add-new-view.js +141 -0
  295. package/src/components/sidebar-dataviews/custom-dataviews-list.js +227 -0
  296. package/src/components/sidebar-dataviews/dataview-item.js +67 -0
  297. package/src/components/sidebar-dataviews/default-views.js +54 -0
  298. package/src/components/sidebar-dataviews/index.js +36 -45
  299. package/src/components/sidebar-dataviews/style.scss +22 -0
  300. package/src/components/sidebar-edit-mode/default-sidebar.js +6 -6
  301. package/src/components/sidebar-edit-mode/page-panels/edit-template.js +14 -21
  302. package/src/components/sidebar-edit-mode/page-panels/page-summary.js +3 -0
  303. package/src/components/sidebar-edit-mode/page-panels/reset-default-template.js +10 -9
  304. package/src/components/sidebar-edit-mode/page-panels/style.scss +5 -0
  305. package/src/components/sidebar-edit-mode/page-panels/swap-template-button.js +10 -9
  306. package/src/components/sidebar-edit-mode/plugin-sidebar/index.js +6 -6
  307. package/src/components/sidebar-edit-mode/template-panel/hooks.js +11 -7
  308. package/src/components/sidebar-navigation-screen-global-styles/index.js +1 -1
  309. package/src/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +1 -1
  310. package/src/components/sidebar-navigation-screen-page/page-details.js +4 -17
  311. package/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -2
  312. package/src/components/site-hub/index.js +9 -8
  313. package/src/components/start-template-options/index.js +14 -12
  314. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +117 -50
  315. package/src/components/template-part-converter/convert-to-regular.js +1 -1
  316. package/src/hooks/push-changes-to-global-styles/index.js +13 -6
  317. package/src/hooks/template-part-edit.js +4 -2
  318. package/src/index.js +0 -8
  319. package/src/store/actions.js +37 -95
  320. package/src/store/selectors.js +31 -91
  321. package/src/store/test/actions.js +11 -137
  322. package/src/store/test/selectors.js +0 -82
  323. package/src/style.scss +1 -0
  324. package/src/utils/constants.js +1 -1
  325. package/build/components/block-editor/block-editor-provider/default-block-editor-provider.js +0 -77
  326. package/build/components/block-editor/block-editor-provider/default-block-editor-provider.js.map +0 -1
  327. package/build/components/block-editor/block-editor-provider/index.js +0 -31
  328. package/build/components/block-editor/block-editor-provider/index.js.map +0 -1
  329. package/build/components/block-editor/block-editor-provider/navigation-block-editor-provider.js +0 -110
  330. package/build/components/block-editor/block-editor-provider/navigation-block-editor-provider.js.map +0 -1
  331. package/build/components/block-editor/block-editor-provider/use-page-content-blocks.js +0 -84
  332. package/build/components/block-editor/block-editor-provider/use-page-content-blocks.js.map +0 -1
  333. package/build/components/block-editor/index.js +0 -30
  334. package/build/components/block-editor/index.js.map +0 -1
  335. package/build/components/page-pages/default-views.js +0 -62
  336. package/build/components/page-pages/default-views.js.map +0 -1
  337. package/build-module/components/block-editor/block-editor-provider/default-block-editor-provider.js +0 -69
  338. package/build-module/components/block-editor/block-editor-provider/default-block-editor-provider.js.map +0 -1
  339. package/build-module/components/block-editor/block-editor-provider/index.js +0 -23
  340. package/build-module/components/block-editor/block-editor-provider/index.js.map +0 -1
  341. package/build-module/components/block-editor/block-editor-provider/navigation-block-editor-provider.js +0 -102
  342. package/build-module/components/block-editor/block-editor-provider/navigation-block-editor-provider.js.map +0 -1
  343. package/build-module/components/block-editor/block-editor-provider/use-page-content-blocks.js +0 -78
  344. package/build-module/components/block-editor/block-editor-provider/use-page-content-blocks.js.map +0 -1
  345. package/build-module/components/block-editor/index.js +0 -22
  346. package/build-module/components/block-editor/index.js.map +0 -1
  347. package/build-module/components/page-pages/default-views.js +0 -55
  348. package/build-module/components/page-pages/default-views.js.map +0 -1
  349. package/src/components/block-editor/block-editor-provider/default-block-editor-provider.js +0 -75
  350. package/src/components/block-editor/block-editor-provider/index.js +0 -29
  351. package/src/components/block-editor/block-editor-provider/navigation-block-editor-provider.js +0 -114
  352. package/src/components/block-editor/block-editor-provider/test/use-page-content-blocks.js +0 -116
  353. package/src/components/block-editor/block-editor-provider/use-page-content-blocks.js +0 -90
  354. package/src/components/block-editor/index.js +0 -28
  355. package/src/components/page-pages/default-views.js +0 -60
@@ -6,38 +6,33 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.__experimentalGetInsertionPoint = void 0;
8
8
  exports.__experimentalGetPreviewDeviceType = __experimentalGetPreviewDeviceType;
9
- exports.getCanUserCreateMedia = exports.__unstableGetPreference = void 0;
9
+ exports.getCanUserCreateMedia = void 0;
10
10
  exports.getCurrentTemplateNavigationPanelSubMenu = getCurrentTemplateNavigationPanelSubMenu;
11
11
  exports.getCurrentTemplateTemplateParts = void 0;
12
12
  exports.getEditedPostContext = getEditedPostContext;
13
13
  exports.getEditedPostId = getEditedPostId;
14
14
  exports.getEditedPostType = getEditedPostType;
15
- exports.getEditorMode = getEditorMode;
15
+ exports.getEditorMode = void 0;
16
16
  exports.getHomeTemplateId = getHomeTemplateId;
17
17
  exports.getNavigationPanelActiveMenu = getNavigationPanelActiveMenu;
18
18
  exports.getPage = getPage;
19
- exports.getSettings = exports.getReusableBlocks = void 0;
19
+ exports.getReusableBlocks = void 0;
20
+ exports.getSettings = getSettings;
20
21
  exports.hasPageContentFocus = hasPageContentFocus;
21
- exports.isFeatureActive = isFeatureActive;
22
+ exports.isFeatureActive = void 0;
22
23
  exports.isInserterOpened = isInserterOpened;
23
24
  exports.isListViewOpened = isListViewOpened;
24
25
  exports.isNavigationOpened = isNavigationOpened;
25
26
  exports.isPage = isPage;
26
27
  exports.isSaveViewOpened = isSaveViewOpened;
27
- var _rememo = _interopRequireDefault(require("rememo"));
28
28
  var _coreData = require("@wordpress/core-data");
29
29
  var _data = require("@wordpress/data");
30
30
  var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
31
- var _mediaUtils = require("@wordpress/media-utils");
32
31
  var _element = require("@wordpress/element");
33
32
  var _preferences = require("@wordpress/preferences");
34
33
  var _blockEditor = require("@wordpress/block-editor");
35
34
  var _utils = require("./utils");
36
35
  var _constants = require("../utils/constants");
37
- /**
38
- * External dependencies
39
- */
40
-
41
36
  /**
42
37
  * WordPress dependencies
43
38
  */
@@ -50,17 +45,6 @@ var _constants = require("../utils/constants");
50
45
  * @typedef {'template'|'template_type'} TemplateType Template type.
51
46
  */
52
47
 
53
- /**
54
- * Helper for getting a preference from the preferences store.
55
- *
56
- * This is only present so that `getSettings` doesn't need to be made a
57
- * registry selector.
58
- *
59
- * It's unstable because the selector needs to be exported and so part of the
60
- * public API to work.
61
- */
62
- const __unstableGetPreference = (0, _data.createRegistrySelector)(select => (state, name) => select(_preferences.store).get('core/edit-site', name));
63
-
64
48
  /**
65
49
  * Returns whether the given feature is enabled or not.
66
50
  *
@@ -70,14 +54,13 @@ const __unstableGetPreference = (0, _data.createRegistrySelector)(select => (sta
70
54
  *
71
55
  * @return {boolean} Is active.
72
56
  */
73
- exports.__unstableGetPreference = __unstableGetPreference;
74
- function isFeatureActive(state, featureName) {
57
+ const isFeatureActive = (0, _data.createRegistrySelector)(select => (_, featureName) => {
75
58
  (0, _deprecated.default)(`select( 'core/edit-site' ).isFeatureActive`, {
76
59
  since: '6.0',
77
60
  alternative: `select( 'core/preferences' ).get`
78
61
  });
79
- return !!__unstableGetPreference(state, featureName);
80
- }
62
+ return !!select(_preferences.store).get('core/edit-site', featureName);
63
+ });
81
64
 
82
65
  /**
83
66
  * Returns the current editing canvas device type.
@@ -86,6 +69,7 @@ function isFeatureActive(state, featureName) {
86
69
  *
87
70
  * @return {string} Device type.
88
71
  */
72
+ exports.isFeatureActive = isFeatureActive;
89
73
  function __experimentalGetPreviewDeviceType(state) {
90
74
  return state.deviceType;
91
75
  }
@@ -108,6 +92,10 @@ const getCanUserCreateMedia = (0, _data.createRegistrySelector)(select => () =>
108
92
  */
109
93
  exports.getCanUserCreateMedia = getCanUserCreateMedia;
110
94
  const getReusableBlocks = (0, _data.createRegistrySelector)(select => () => {
95
+ (0, _deprecated.default)("select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )", {
96
+ since: '6.5',
97
+ version: '6.8'
98
+ });
111
99
  const isWeb = _element.Platform.OS === 'web';
112
100
  return isWeb ? select(_coreData.store).getEntityRecords('postType', 'wp_block', {
113
101
  per_page: -1
@@ -115,50 +103,23 @@ const getReusableBlocks = (0, _data.createRegistrySelector)(select => () => {
115
103
  });
116
104
 
117
105
  /**
118
- * Returns the settings, taking into account active features and permissions.
106
+ * Returns the site editor settings.
119
107
  *
120
- * @param {Object} state Global application state.
121
- * @param {Function} setIsInserterOpen Setter for the open state of the global inserter.
108
+ * @param {Object} state Global application state.
122
109
  *
123
110
  * @return {Object} Settings.
124
111
  */
125
112
  exports.getReusableBlocks = getReusableBlocks;
126
- const getSettings = (0, _rememo.default)((state, setIsInserterOpen) => {
127
- const settings = {
128
- ...state.settings,
129
- outlineMode: true,
130
- focusMode: !!__unstableGetPreference(state, 'focusMode'),
131
- isDistractionFree: !!__unstableGetPreference(state, 'distractionFree'),
132
- hasFixedToolbar: !!__unstableGetPreference(state, 'fixedToolbar'),
133
- keepCaretInsideBlock: !!__unstableGetPreference(state, 'keepCaretInsideBlock'),
134
- showIconLabels: !!__unstableGetPreference(state, 'showIconLabels'),
135
- __experimentalSetIsInserterOpened: setIsInserterOpen,
136
- __experimentalReusableBlocks: getReusableBlocks(state),
137
- __experimentalPreferPatternsOnRoot: _constants.TEMPLATE_POST_TYPE === getEditedPostType(state)
138
- };
139
- const canUserCreateMedia = getCanUserCreateMedia(state);
140
- if (!canUserCreateMedia) {
141
- return settings;
142
- }
143
- settings.mediaUpload = ({
144
- onError,
145
- ...rest
146
- }) => {
147
- (0, _mediaUtils.uploadMedia)({
148
- wpAllowedMimeTypes: state.settings.allowedMimeTypes,
149
- onError: ({
150
- message
151
- }) => onError(message),
152
- ...rest
153
- });
154
- };
155
- return settings;
156
- }, state => [getCanUserCreateMedia(state), state.settings, __unstableGetPreference(state, 'focusMode'), __unstableGetPreference(state, 'distractionFree'), __unstableGetPreference(state, 'fixedToolbar'), __unstableGetPreference(state, 'keepCaretInsideBlock'), __unstableGetPreference(state, 'showIconLabels'), getReusableBlocks(state), getEditedPostType(state)]);
113
+ function getSettings(state) {
114
+ // It is important that we don't inject anything into these settings locally.
115
+ // The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings.
116
+ // If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected.
117
+ return state.settings;
118
+ }
157
119
 
158
120
  /**
159
121
  * @deprecated
160
122
  */
161
- exports.getSettings = getSettings;
162
123
  function getHomeTemplateId() {
163
124
  (0, _deprecated.default)("select( 'core/edit-site' ).getHomeTemplateId", {
164
125
  since: '6.2',
@@ -308,13 +269,14 @@ const getCurrentTemplateTemplateParts = (0, _data.createRegistrySelector)(select
308
269
  * @return {string} Editing mode.
309
270
  */
310
271
  exports.getCurrentTemplateTemplateParts = getCurrentTemplateTemplateParts;
311
- function getEditorMode(state) {
312
- return __unstableGetPreference(state, 'editorMode');
313
- }
272
+ const getEditorMode = (0, _data.createRegistrySelector)(select => () => {
273
+ return select(_preferences.store).get('core/edit-site', 'editorMode');
274
+ });
314
275
 
315
276
  /**
316
277
  * @deprecated
317
278
  */
279
+ exports.getEditorMode = getEditorMode;
318
280
  function getCurrentTemplateNavigationPanelSubMenu() {
319
281
  (0, _deprecated.default)("dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu", {
320
282
  since: '6.2',
@@ -1 +1 @@
1
- {"version":3,"names":["_rememo","_interopRequireDefault","require","_coreData","_data","_deprecated","_mediaUtils","_element","_preferences","_blockEditor","_utils","_constants","__unstableGetPreference","createRegistrySelector","select","state","name","preferencesStore","get","exports","isFeatureActive","featureName","deprecated","since","alternative","__experimentalGetPreviewDeviceType","deviceType","getCanUserCreateMedia","coreDataStore","canUser","getReusableBlocks","isWeb","Platform","OS","getEntityRecords","per_page","getSettings","createSelector","setIsInserterOpen","settings","outlineMode","focusMode","isDistractionFree","hasFixedToolbar","keepCaretInsideBlock","showIconLabels","__experimentalSetIsInserterOpened","__experimentalReusableBlocks","__experimentalPreferPatternsOnRoot","TEMPLATE_POST_TYPE","getEditedPostType","canUserCreateMedia","mediaUpload","onError","rest","uploadMedia","wpAllowedMimeTypes","allowedMimeTypes","message","getHomeTemplateId","version","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","hasPageContentFocus","postContentClientId","blockEditorStore","__experimentalGetGlobalBlocksByName","undefined","isListViewOpened","listViewPanel","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","templateParts","TEMPLATE_PART_POST_TYPE","clientIds","blocks","getBlocksByClientId","getFilteredTemplatePartBlocks","getEditorMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened","isPage","postId"],"sources":["@wordpress/edit-site/src/store/selectors.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { getFilteredTemplatePartBlocks } from './utils';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../utils/constants';\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Helper for getting a preference from the preferences store.\n *\n * This is only present so that `getSettings` doesn't need to be made a\n * registry selector.\n *\n * It's unstable because the selector needs to be exported and so part of the\n * public API to work.\n */\nexport const __unstableGetPreference = createRegistrySelector(\n\t( select ) => ( state, name ) =>\n\t\tselect( preferencesStore ).get( 'core/edit-site', name )\n);\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @deprecated\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport function isFeatureActive( state, featureName ) {\n\tdeprecated( `select( 'core/edit-site' ).isFeatureActive`, {\n\t\tsince: '6.0',\n\t\talternative: `select( 'core/preferences' ).get`,\n\t} );\n\n\treturn !! __unstableGetPreference( state, featureName );\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the settings, taking into account active features and permissions.\n *\n * @param {Object} state Global application state.\n * @param {Function} setIsInserterOpen Setter for the open state of the global inserter.\n *\n * @return {Object} Settings.\n */\nexport const getSettings = createSelector(\n\t( state, setIsInserterOpen ) => {\n\t\tconst settings = {\n\t\t\t...state.settings,\n\t\t\toutlineMode: true,\n\t\t\tfocusMode: !! __unstableGetPreference( state, 'focusMode' ),\n\t\t\tisDistractionFree: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'distractionFree'\n\t\t\t),\n\t\t\thasFixedToolbar: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tshowIconLabels: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpen,\n\t\t\t__experimentalReusableBlocks: getReusableBlocks( state ),\n\t\t\t__experimentalPreferPatternsOnRoot:\n\t\t\t\tTEMPLATE_POST_TYPE === getEditedPostType( state ),\n\t\t};\n\n\t\tconst canUserCreateMedia = getCanUserCreateMedia( state );\n\t\tif ( ! canUserCreateMedia ) {\n\t\t\treturn settings;\n\t\t}\n\n\t\tsettings.mediaUpload = ( { onError, ...rest } ) => {\n\t\t\tuploadMedia( {\n\t\t\t\twpAllowedMimeTypes: state.settings.allowedMimeTypes,\n\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t...rest,\n\t\t\t} );\n\t\t};\n\t\treturn settings;\n\t},\n\t( state ) => [\n\t\tgetCanUserCreateMedia( state ),\n\t\tstate.settings,\n\t\t__unstableGetPreference( state, 'focusMode' ),\n\t\t__unstableGetPreference( state, 'distractionFree' ),\n\t\t__unstableGetPreference( state, 'fixedToolbar' ),\n\t\t__unstableGetPreference( state, 'keepCaretInsideBlock' ),\n\t\t__unstableGetPreference( state, 'showIconLabels' ),\n\t\tgetReusableBlocks( state ),\n\t\tgetEditedPostType( state ),\n\t]\n);\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns the current opened/closed state of the inserter panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the inserter panel should be open; false if closed.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\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 __experimentalGetInsertionPoint = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tif ( typeof state.blockInserterPanel === 'object' ) {\n\t\t\tconst { rootClientId, insertionIndex, filterValue } =\n\t\t\t\tstate.blockInserterPanel;\n\t\t\treturn { rootClientId, insertionIndex, filterValue };\n\t\t}\n\n\t\tif ( hasPageContentFocus( state ) ) {\n\t\t\tconst [ postContentClientId ] =\n\t\t\t\tselect( blockEditorStore ).__experimentalGetGlobalBlocksByName(\n\t\t\t\t\t'core/post-content'\n\t\t\t\t);\n\t\t\tif ( postContentClientId ) {\n\t\t\t\treturn {\n\t\t\t\t\trootClientId: postContentClientId,\n\t\t\t\t\tinsertionIndex: undefined,\n\t\t\t\t\tfilterValue: undefined,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\trootClientId: undefined,\n\t\t\tinsertionIndex: undefined,\n\t\t\tfilterValue: undefined,\n\t\t};\n\t}\n);\n\n/**\n * Returns the current opened/closed state of the list view panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the list view panel should be open; false if closed.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\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( coreDataStore ).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 ).__experimentalGetGlobalBlocksByName(\n\t\t\t\t'core/template-part'\n\t\t\t);\n\t\tconst blocks =\n\t\t\tselect( blockEditorStore ).getBlocksByClientId( clientIds );\n\n\t\treturn getFilteredTemplatePartBlocks( blocks, templateParts );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport function getEditorMode( state ) {\n\treturn __unstableGetPreference( state, 'editorMode' );\n}\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Whether or not the editor has a page loaded into it.\n *\n * @see setPage\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not the editor has a page loaded into it.\n */\nexport function isPage( state ) {\n\treturn !! state.editedPost.context?.postId;\n}\n\n/**\n * Whether or not the editor allows only page content to be edited.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not focus is on editing page content.\n */\nexport function hasPageContentFocus( state ) {\n\treturn isPage( state ) ? state.hasPageContentFocus : false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AApBA;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AASrB,mBAAmBA,CAAE3D,KAAK,EAAG;EAC5C,OAAO+E,MAAM,CAAE/E,KAAM,CAAC,GAAGA,KAAK,CAAC2D,mBAAmB,GAAG,KAAK;AAC3D"}
1
+ {"version":3,"names":["_coreData","require","_data","_deprecated","_interopRequireDefault","_element","_preferences","_blockEditor","_utils","_constants","isFeatureActive","createRegistrySelector","select","_","featureName","deprecated","since","alternative","preferencesStore","get","exports","__experimentalGetPreviewDeviceType","state","deviceType","getCanUserCreateMedia","coreDataStore","canUser","getReusableBlocks","version","isWeb","Platform","OS","getEntityRecords","per_page","getSettings","settings","getHomeTemplateId","getEditedPostType","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","hasPageContentFocus","postContentClientId","blockEditorStore","__experimentalGetGlobalBlocksByName","undefined","isListViewOpened","listViewPanel","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","templateParts","TEMPLATE_PART_POST_TYPE","clientIds","blocks","getBlocksByClientId","getFilteredTemplatePartBlocks","getEditorMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened","isPage","postId"],"sources":["@wordpress/edit-site/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { getFilteredTemplatePartBlocks } from './utils';\nimport { TEMPLATE_PART_POST_TYPE } from '../utils/constants';\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @deprecated\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( _, featureName ) => {\n\t\tdeprecated( `select( 'core/edit-site' ).isFeatureActive`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `select( 'core/preferences' ).get`,\n\t\t} );\n\n\t\treturn !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\tfeatureName\n\t\t);\n\t}\n);\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tdeprecated(\n\t\t\"select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )\",\n\t\t{\n\t\t\tsince: '6.5',\n\t\t\tversion: '6.8',\n\t\t}\n\t);\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the site editor settings.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Settings.\n */\nexport function getSettings( state ) {\n\t// It is important that we don't inject anything into these settings locally.\n\t// The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings.\n\t// If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected.\n\treturn state.settings;\n}\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns the current opened/closed state of the inserter panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the inserter panel should be open; false if closed.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\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 __experimentalGetInsertionPoint = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tif ( typeof state.blockInserterPanel === 'object' ) {\n\t\t\tconst { rootClientId, insertionIndex, filterValue } =\n\t\t\t\tstate.blockInserterPanel;\n\t\t\treturn { rootClientId, insertionIndex, filterValue };\n\t\t}\n\n\t\tif ( hasPageContentFocus( state ) ) {\n\t\t\tconst [ postContentClientId ] =\n\t\t\t\tselect( blockEditorStore ).__experimentalGetGlobalBlocksByName(\n\t\t\t\t\t'core/post-content'\n\t\t\t\t);\n\t\t\tif ( postContentClientId ) {\n\t\t\t\treturn {\n\t\t\t\t\trootClientId: postContentClientId,\n\t\t\t\t\tinsertionIndex: undefined,\n\t\t\t\t\tfilterValue: undefined,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\trootClientId: undefined,\n\t\t\tinsertionIndex: undefined,\n\t\t\tfilterValue: undefined,\n\t\t};\n\t}\n);\n\n/**\n * Returns the current opened/closed state of the list view panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the list view panel should be open; false if closed.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\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( coreDataStore ).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 ).__experimentalGetGlobalBlocksByName(\n\t\t\t\t'core/template-part'\n\t\t\t);\n\t\tconst blocks =\n\t\t\tselect( blockEditorStore ).getBlocksByClientId( clientIds );\n\n\t\treturn getFilteredTemplatePartBlocks( blocks, templateParts );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector( ( select ) => () => {\n\treturn select( preferencesStore ).get( 'core/edit-site', 'editorMode' );\n} );\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Whether or not the editor has a page loaded into it.\n *\n * @see setPage\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not the editor has a page loaded into it.\n */\nexport function isPage( state ) {\n\treturn !! state.editedPost.context?.postId;\n}\n\n/**\n * Whether or not the editor allows only page content to be edited.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not focus is on editing page content.\n */\nexport function hasPageContentFocus( state ) {\n\treturn isPage( state ) ? state.hasPageContentFocus : false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AAdA;AACA;AACA;;AAQA;AACA;AACA;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMS,eAAe,GAAG,IAAAC,4BAAsB,EAClDC,MAAM,IAAM,CAAEC,CAAC,EAAEC,WAAW,KAAM;EACnC,IAAAC,mBAAU,EAAG,4CAA2C,EAAE;IACzDC,KAAK,EAAE,KAAK;IACZC,WAAW,EAAG;EACf,CAAE,CAAC;EAEH,OAAO,CAAC,CAAEL,MAAM,CAAEM,kBAAiB,CAAC,CAACC,GAAG,CACvC,gBAAgB,EAChBL,WACD,CAAC;AACF,CACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AANAM,O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V,CACD,CAAC;AACF;;AAEA;AACA;AACA;AACO,SAASyC,4BAA4BA,CAAA,EAAG;EAC9C,IAAAtD,mBAAU,EAAE,2DAA2D,EAAE;IACxEC,KAAK,EAAE,KAAK;IACZY,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACO,SAAS0C,kBAAkBA,CAAA,EAAG;EACpC,IAAAvD,mBAAU,EAAE,iDAAiD,EAAE;IAC9DC,KAAK,EAAE,KAAK;IACZY,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS2C,MAAMA,CAAEjD,KAAK,EAAG;EAC/B,OAAO,CAAC,CAAEA,KAAK,CAACgB,UAAU,CAACK,OAAO,EAAE6B,MAAM;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASrB,mBAAmBA,CAAE7B,KAAK,EAAG;EAC5C,OAAOiD,MAAM,CAAEjD,KAAM,CAAC,GAAGA,KAAK,CAAC6B,mBAAmB,GAAG,KAAK;AAC3D"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.TEMPLATE_POST_TYPE = exports.TEMPLATE_PART_POST_TYPE = exports.TEMPLATE_PART_AREA_DEFAULT_CATEGORY = exports.TEMPLATE_ORIGINS = exports.POST_TYPE_LABELS = exports.PATTERN_USER_CATEGORY = exports.PATTERN_TYPES = exports.PATTERN_SYNC_TYPES = exports.PATTERN_DEFAULT_CATEGORY = exports.PATTERN_CORE_SOURCES = exports.PAGE_CONTENT_BLOCK_TYPES = exports.NAVIGATION_POST_TYPE = exports.FOCUSABLE_ENTITIES = void 0;
6
+ exports.TEMPLATE_POST_TYPE = exports.TEMPLATE_PART_POST_TYPE = exports.TEMPLATE_PART_AREA_DEFAULT_CATEGORY = exports.TEMPLATE_ORIGINS = exports.POST_TYPE_LABELS = exports.PATTERN_USER_CATEGORY = exports.PATTERN_TYPES = exports.PATTERN_SYNC_TYPES = exports.PATTERN_DEFAULT_CATEGORY = exports.PAGE_CONTENT_BLOCK_TYPES = exports.NAVIGATION_POST_TYPE = exports.FOCUSABLE_ENTITIES = exports.EXCLUDED_PATTERN_SOURCES = void 0;
7
7
  var _i18n = require("@wordpress/i18n");
8
8
  var _patterns = require("@wordpress/patterns");
9
9
  var _lockUnlock = require("../lock-unlock");
@@ -38,13 +38,13 @@ const {
38
38
  PATTERN_TYPES,
39
39
  PATTERN_DEFAULT_CATEGORY,
40
40
  PATTERN_USER_CATEGORY,
41
- PATTERN_CORE_SOURCES,
41
+ EXCLUDED_PATTERN_SOURCES,
42
42
  PATTERN_SYNC_TYPES
43
43
  } = (0, _lockUnlock.unlock)(_patterns.privateApis);
44
44
 
45
45
  // Entities that are editable in focus mode.
46
46
  exports.PATTERN_SYNC_TYPES = PATTERN_SYNC_TYPES;
47
- exports.PATTERN_CORE_SOURCES = PATTERN_CORE_SOURCES;
47
+ exports.EXCLUDED_PATTERN_SOURCES = EXCLUDED_PATTERN_SOURCES;
48
48
  exports.PATTERN_USER_CATEGORY = PATTERN_USER_CATEGORY;
49
49
  exports.PATTERN_DEFAULT_CATEGORY = PATTERN_DEFAULT_CATEGORY;
50
50
  exports.PATTERN_TYPES = PATTERN_TYPES;
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_patterns","_lockUnlock","NAVIGATION_POST_TYPE","exports","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","TEMPLATE_ORIGINS","custom","theme","plugin","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","PATTERN_USER_CATEGORY","PATTERN_CORE_SOURCES","PATTERN_SYNC_TYPES","unlock","patternPrivateApis","FOCUSABLE_ENTITIES","user","PAGE_CONTENT_BLOCK_TYPES","POST_TYPE_LABELS","__"],"sources":["@wordpress/edit-site/src/utils/constants.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as patternPrivateApis } from '@wordpress/patterns';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\n// Navigation\nexport const NAVIGATION_POST_TYPE = 'wp_navigation';\n\n// Templates.\nexport const TEMPLATE_POST_TYPE = 'wp_template';\nexport const TEMPLATE_PART_POST_TYPE = 'wp_template_part';\nexport const TEMPLATE_ORIGINS = {\n\tcustom: 'custom',\n\ttheme: 'theme',\n\tplugin: 'plugin',\n};\nexport const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized';\n\n// Patterns.\nexport const {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_USER_CATEGORY,\n\tPATTERN_CORE_SOURCES,\n\tPATTERN_SYNC_TYPES,\n} = unlock( patternPrivateApis );\n\n// Entities that are editable in focus mode.\nexport const FOCUSABLE_ENTITIES = [\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\n/**\n * Block types that are considered to be page content. These are the only blocks\n * editable when hasPageContentFocus() is true.\n */\nexport const PAGE_CONTENT_BLOCK_TYPES = {\n\t'core/post-title': true,\n\t'core/post-featured-image': true,\n\t'core/post-content': true,\n};\n\nexport const POST_TYPE_LABELS = {\n\t[ TEMPLATE_POST_TYPE ]: __( 'Template' ),\n\t[ TEMPLATE_PART_POST_TYPE ]: __( 'Template part' ),\n\t[ PATTERN_TYPES.user ]: __( 'Pattern' ),\n\t[ NAVIGATION_POST_TYPE ]: __( 'Navigation' ),\n};\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,WAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACO,MAAMG,oBAAoB,GAAG,eAAe;;AAEnD;AAAAC,OAAA,CAAAD,oBAAA,GAAAA,oBAAA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AAAG,QAAE,EAAE,SAAU,CAAC;EACvC,CAAEpB,oBAAoB,GAAI,IAAAoB,QAAE,EAAE,YAAa;AAC5C,CAAC;AAACnB,OAAA,CAAAkB,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"names":["_i18n","require","_patterns","_lockUnlock","NAVIGATION_POST_TYPE","exports","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","TEMPLATE_ORIGINS","custom","theme","plugin","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","PATTERN_USER_CATEGORY","EXCLUDED_PATTERN_SOURCES","PATTERN_SYNC_TYPES","unlock","patternPrivateApis","FOCUSABLE_ENTITIES","user","PAGE_CONTENT_BLOCK_TYPES","POST_TYPE_LABELS","__"],"sources":["@wordpress/edit-site/src/utils/constants.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as patternPrivateApis } from '@wordpress/patterns';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\n// Navigation\nexport const NAVIGATION_POST_TYPE = 'wp_navigation';\n\n// Templates.\nexport const TEMPLATE_POST_TYPE = 'wp_template';\nexport const TEMPLATE_PART_POST_TYPE = 'wp_template_part';\nexport const TEMPLATE_ORIGINS = {\n\tcustom: 'custom',\n\ttheme: 'theme',\n\tplugin: 'plugin',\n};\nexport const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized';\n\n// Patterns.\nexport const {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_USER_CATEGORY,\n\tEXCLUDED_PATTERN_SOURCES,\n\tPATTERN_SYNC_TYPES,\n} = unlock( patternPrivateApis );\n\n// Entities that are editable in focus mode.\nexport const FOCUSABLE_ENTITIES = [\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\n/**\n * Block types that are considered to be page content. These are the only blocks\n * editable when hasPageContentFocus() is true.\n */\nexport const PAGE_CONTENT_BLOCK_TYPES = {\n\t'core/post-title': true,\n\t'core/post-featured-image': true,\n\t'core/post-content': true,\n};\n\nexport const POST_TYPE_LABELS = {\n\t[ TEMPLATE_POST_TYPE ]: __( 'Template' ),\n\t[ TEMPLATE_PART_POST_TYPE ]: __( 'Template part' ),\n\t[ PATTERN_TYPES.user ]: __( 'Pattern' ),\n\t[ NAVIGATION_POST_TYPE ]: __( 'Navigation' ),\n};\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,WAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACO,MAAMG,oBAAoB,GAAG,eAAe;;AAEnD;AAAAC,OAAA,CAAAD,oBAAA,GAAAA,oBAAA;AACO,MAAME,kBAAkB,GAAG,aAAa;AAACD,OAAA,CAAAC,kBAAA,GAAAA,kBAAA;AACzC,MAAMC,uBAAuB,GAAG,kBAAkB;AAACF,OAAA,CAAAE,uBAAA,GAAAA,uBAAA;AACnD,MAAMC,gBAAgB,GAAG;EAC/BC,MAAM,EAAE,QAAQ;EAChBC,KAAK,EAAE,OAAO;EACdC,MAAM,EAAE;AACT,CAAC;AAACN,OAAA,CAAAG,gBAAA,GAAAA,gBAAA;AACK,MAAMI,mCAAmC,GAAG,eAAe;;AAElE;AAAAP,OAAA,CAAAO,mCAAA,GAAAA,mCAAA;AACO,MAAM;EACZC,aAAa;EACbC,wBAAwB;EACxBC,qBAAqB;EACrBC,wBAAwB;EACxBC;AACD,CAAC,GAAG,IAAAC,kBAAM,EAAEC,qBAAmB,CAAC;;AAEhC;AAAAd,OAAA,CAAAY,kBAAA,GAAAA,kBAAA;AAAAZ,OAAA,CAAAW,wBAAA,GAAAA,wBAAA;AAAAX,OAAA,CAAAU,qBAAA,GAAAA,qBAAA;AAAAV,OAAA,CAAAS,wBAAA,GAAAA,wBAAA;AAAAT,OAAA,CAAAQ,aAAA,GAAAA,aAAA;AACO,MAAMO,kBAAkB,GAAG,CACjCb,uBAAuB,EACvBH,oBAAoB,EACpBS,aAAa,CAACQ,IAAI,CAClB;;AAED;AACA;AACA;AACA;AAHAhB,OAAA,CAAAe,kBAAA,GAAAA,kBAAA;AAIO,MAAME,wBAAwB,GAAG;EACvC,iBAAiB,EAAE,IAAI;EACvB,0BAA0B,EAAE,IAAI;EAChC,mBAAmB,EAAE;AACtB,CAAC;AAACjB,OAAA,CAAAiB,wBAAA,GAAAA,wBAAA;AAEK,MAAMC,gBAAgB,GAAG;EAC/B,CAAEjB,kBAAkB,GAAI,IAAAkB,QAAE,EAAE,UAAW,CAAC;EACxC,CAAEjB,uBAAuB,GAAI,IAAAiB,QAAE,EAAE,eAAgB,CAAC;EAClD,CAAEX,aAAa,CAACQ,IAAI,GAAI,IAAAG,QAAE,EAAE,SAAU,CAAC;EACvC,CAAEpB,oBAAoB,GAAI,IAAAoB,QAAE,EAAE,YAAa;AAC5C,CAAC;AAACnB,OAAA,CAAAkB,gBAAA,GAAAA,gBAAA"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { external, trash } from '@wordpress/icons';
4
+ import { external, trash, backup } from '@wordpress/icons';
5
5
  import { addQueryArgs } from '@wordpress/url';
6
6
  import { useDispatch } from '@wordpress/data';
7
7
  import { decodeEntities } from '@wordpress/html-entities';
@@ -35,7 +35,7 @@ export function useTrashPostAction() {
35
35
  }) {
36
36
  return status !== 'trash';
37
37
  },
38
- async perform(post) {
38
+ async callback(post) {
39
39
  try {
40
40
  await deleteEntityRecord('postType', post.type, post.id, {}, {
41
41
  throwOnError: true
@@ -54,6 +54,86 @@ export function useTrashPostAction() {
54
54
  }
55
55
  }), [createSuccessNotice, createErrorNotice, deleteEntityRecord]);
56
56
  }
57
+ export function usePermanentlyDeletePostAction() {
58
+ const {
59
+ createSuccessNotice,
60
+ createErrorNotice
61
+ } = useDispatch(noticesStore);
62
+ const {
63
+ deleteEntityRecord
64
+ } = useDispatch(coreStore);
65
+ return useMemo(() => ({
66
+ id: 'permanently-delete',
67
+ label: __('Permanently delete'),
68
+ isPrimary: true,
69
+ icon: trash,
70
+ isEligible({
71
+ status
72
+ }) {
73
+ return status === 'trash';
74
+ },
75
+ async callback(post) {
76
+ try {
77
+ await deleteEntityRecord('postType', post.type, post.id, {
78
+ force: true
79
+ }, {
80
+ throwOnError: true
81
+ });
82
+ createSuccessNotice(sprintf( /* translators: The posts's title. */
83
+ __('"%s" permanently deleted.'), decodeEntities(post.title.rendered)), {
84
+ type: 'snackbar',
85
+ id: 'edit-site-post-permanently-deleted'
86
+ });
87
+ } catch (error) {
88
+ const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : __('An error occurred while permanently deleting the post.');
89
+ createErrorNotice(errorMessage, {
90
+ type: 'snackbar'
91
+ });
92
+ }
93
+ }
94
+ }), [createSuccessNotice, createErrorNotice, deleteEntityRecord]);
95
+ }
96
+ export function useRestorePostAction() {
97
+ const {
98
+ createSuccessNotice,
99
+ createErrorNotice
100
+ } = useDispatch(noticesStore);
101
+ const {
102
+ editEntityRecord,
103
+ saveEditedEntityRecord
104
+ } = useDispatch(coreStore);
105
+ return useMemo(() => ({
106
+ id: 'restore',
107
+ label: __('Restore'),
108
+ isPrimary: true,
109
+ icon: backup,
110
+ isEligible({
111
+ status
112
+ }) {
113
+ return status === 'trash';
114
+ },
115
+ async callback(post) {
116
+ await editEntityRecord('postType', post.type, post.id, {
117
+ status: 'draft'
118
+ });
119
+ try {
120
+ await saveEditedEntityRecord('postType', post.type, post.id, {
121
+ throwOnError: true
122
+ });
123
+ createSuccessNotice(sprintf( /* translators: The posts's title. */
124
+ __('"%s" has been restored.'), decodeEntities(post.title.rendered)), {
125
+ type: 'snackbar',
126
+ id: 'edit-site-post-restored'
127
+ });
128
+ } catch (error) {
129
+ const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : __('An error occurred while restoring the post.');
130
+ createErrorNotice(errorMessage, {
131
+ type: 'snackbar'
132
+ });
133
+ }
134
+ }
135
+ }), [createSuccessNotice, createErrorNotice, editEntityRecord, saveEditedEntityRecord]);
136
+ }
57
137
  export const viewPostAction = {
58
138
  id: 'view-post',
59
139
  label: __('View'),
@@ -62,7 +142,7 @@ export const viewPostAction = {
62
142
  isEligible(post) {
63
143
  return post.status !== 'trash';
64
144
  },
65
- perform(post) {
145
+ callback(post) {
66
146
  document.location.href = post.link;
67
147
  }
68
148
  };
@@ -76,7 +156,7 @@ export function useEditPostAction() {
76
156
  }) {
77
157
  return status !== 'trash';
78
158
  },
79
- perform(post) {
159
+ callback(post) {
80
160
  history.push({
81
161
  postId: post.id,
82
162
  postType: post.type,
@@ -98,7 +178,7 @@ export const postRevisionsAction = {
98
178
  const revisionsCount = (_post$_links$version = post?._links?.['version-history']?.[0]?.count) !== null && _post$_links$version !== void 0 ? _post$_links$version : 0;
99
179
  return lastRevisionId && revisionsCount > 1;
100
180
  },
101
- perform(post) {
181
+ callback(post) {
102
182
  const href = addQueryArgs('revision.php', {
103
183
  revision: post?._links?.['predecessor-version']?.[0]?.id
104
184
  });
@@ -1 +1 @@
1
- {"version":3,"names":["external","trash","addQueryArgs","useDispatch","decodeEntities","store","coreStore","__","sprintf","noticesStore","useMemo","privateApis","routerPrivateApis","unlock","useHistory","useTrashPostAction","createSuccessNotice","createErrorNotice","deleteEntityRecord","id","label","isPrimary","icon","isEligible","status","perform","post","type","throwOnError","title","rendered","error","errorMessage","message","code","viewPostAction","document","location","href","link","useEditPostAction","history","push","postId","postType","canvas","postRevisionsAction","_post$_links$predeces","_post$_links$version","lastRevisionId","_links","revisionsCount","count","revision"],"sources":["@wordpress/edit-site/src/components/actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { external, trash } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nexport function useTrashPostAction() {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'move-to-trash',\n\t\t\tlabel: __( 'Move to Trash' ),\n\t\t\tisPrimary: true,\n\t\t\ticon: trash,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status !== 'trash';\n\t\t\t},\n\t\t\tasync perform( post ) {\n\t\t\t\ttry {\n\t\t\t\t\tawait deleteEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t{},\n\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t);\n\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: The page's title. */\n\t\t\t\t\t\t\t__( '\"%s\" moved to the Trash.' ),\n\t\t\t\t\t\t\tdecodeEntities( post.title.rendered )\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'edit-site-page-trashed',\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t} catch ( error ) {\n\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while moving the page to the trash.'\n\t\t\t\t\t\t\t );\n\n\t\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[ createSuccessNotice, createErrorNotice, deleteEntityRecord ]\n\t);\n}\n\nexport const viewPostAction = {\n\tid: 'view-post',\n\tlabel: __( 'View' ),\n\tisPrimary: true,\n\ticon: external,\n\tisEligible( post ) {\n\t\treturn post.status !== 'trash';\n\t},\n\tperform( post ) {\n\t\tdocument.location.href = post.link;\n\t},\n};\n\nexport function useEditPostAction() {\n\tconst history = useHistory();\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'edit-post',\n\t\t\tlabel: __( 'Edit' ),\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status !== 'trash';\n\t\t\t},\n\t\t\tperform( post ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostId: post.id,\n\t\t\t\t\tpostType: post.type,\n\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t} );\n\t\t\t},\n\t\t} ),\n\t\t[ history ]\n\t);\n}\nexport const postRevisionsAction = {\n\tid: 'view-post-revisions',\n\tlabel: __( 'View revisions' ),\n\tisPrimary: false,\n\tisEligible: ( post ) => {\n\t\tif ( post.status === 'trash' ) {\n\t\t\treturn false;\n\t\t}\n\t\tconst lastRevisionId =\n\t\t\tpost?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;\n\t\tconst revisionsCount =\n\t\t\tpost?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\treturn lastRevisionId && revisionsCount > 1;\n\t},\n\tperform( post ) {\n\t\tconst href = addQueryArgs( 'revision.php', {\n\t\t\trevision: post?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id,\n\t\t} );\n\t\tdocument.location.href = href;\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,KAAK,QAAQ,kBAAkB;AAClD,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,cAAc,Q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AEb,EAAE,CAAE,gBAAiB,CAAC;EAC7Bc,SAAS,EAAE,KAAK;EAChBE,UAAU,EAAIG,IAAI,IAAM;IAAA,IAAAqB,qBAAA,EAAAC,oBAAA;IACvB,IAAKtB,IAAI,CAACF,MAAM,KAAK,OAAO,EAAG;MAC9B,OAAO,KAAK;IACb;IACA,MAAMyB,cAAc,IAAAF,qBAAA,GACnBrB,IAAI,EAAEwB,MAAM,GAAI,qBAAqB,CAAE,GAAI,CAAC,CAAE,EAAE/B,EAAE,cAAA4B,qBAAA,cAAAA,qBAAA,GAAI,IAAI;IAC3D,MAAMI,cAAc,IAAAH,oBAAA,GACnBtB,IAAI,EAAEwB,MAAM,GAAI,iBAAiB,CAAE,GAAI,CAAC,CAAE,EAAEE,KAAK,cAAAJ,oBAAA,cAAAA,oBAAA,GAAI,CAAC;IACvD,OAAOC,cAAc,IAAIE,cAAc,GAAG,CAAC;EAC5C,CAAC;EACD1B,OAAOA,CAAEC,IAAI,EAAG;IACf,MAAMY,IAAI,GAAGpC,YAAY,CAAE,cAAc,EAAE;MAC1CmD,QAAQ,EAAE3B,IAAI,EAAEwB,MAAM,GAAI,qBAAqB,CAAE,GAAI,CAAC,CAAE,EAAE/B;IAC3D,CAAE,CAAC;IACHiB,QAAQ,CAACC,QAAQ,CAACC,IAAI,GAAGA,IAAI;EAC9B;AACD,CAAC"}
1
+ {"version":3,"names":["external","trash","backup","addQueryArgs","useDispatch","decodeEntities","store","coreStore","__","sprintf","noticesStore","useMemo","privateApis","routerPrivateApis","unlock","useHistory","useTrashPostAction","createSuccessNotice","createErrorNotice","deleteEntityRecord","id","label","isPrimary","icon","isEligible","status","callback","post","type","throwOnError","title","rendered","error","errorMessage","message","code","usePermanentlyDeletePostAction","force","useRestorePostAction","editEntityRecord","saveEditedEntityRecord","viewPostAction","document","location","href","link","useEditPostAction","history","push","postId","postType","canvas","postRevisionsAction","_post$_links$predeces","_post$_links$version","lastRevisionId","_links","revisionsCount","count","revision"],"sources":["@wordpress/edit-site/src/components/actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { external, trash, backup } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nexport function useTrashPostAction() {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'move-to-trash',\n\t\t\tlabel: __( 'Move to Trash' ),\n\t\t\tisPrimary: true,\n\t\t\ticon: trash,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status !== 'trash';\n\t\t\t},\n\t\t\tasync callback( post ) {\n\t\t\t\ttry {\n\t\t\t\t\tawait deleteEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t{},\n\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t);\n\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: The page's title. */\n\t\t\t\t\t\t\t__( '\"%s\" moved to the Trash.' ),\n\t\t\t\t\t\t\tdecodeEntities( post.title.rendered )\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'edit-site-page-trashed',\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t} catch ( error ) {\n\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while moving the page to the trash.'\n\t\t\t\t\t\t\t );\n\n\t\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[ createSuccessNotice, createErrorNotice, deleteEntityRecord ]\n\t);\n}\n\nexport function usePermanentlyDeletePostAction() {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'permanently-delete',\n\t\t\tlabel: __( 'Permanently delete' ),\n\t\t\tisPrimary: true,\n\t\t\ticon: trash,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status === 'trash';\n\t\t\t},\n\t\t\tasync callback( post ) {\n\t\t\t\ttry {\n\t\t\t\t\tawait deleteEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\tpost.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\t\tcreateSuccessNotice(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: The posts's title. */\n\t\t\t\t\t\t\t__( '\"%s\" permanently deleted.' ),\n\t\t\t\t\t\t\tdecodeEntities( post.title.rendered )\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'edit-site-post-permanently-deleted',\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t} catch ( error ) {\n\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the post.'\n\t\t\t\t\t\t\t );\n\n\t\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[ createSuccessNotice, createErrorNotice, deleteEntityRecord ]\n\t);\n}\n\nexport function useRestorePostAction() {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'restore',\n\t\t\tlabel: __( 'Restore' ),\n\t\t\tisPrimary: true,\n\t\t\ticon: backup,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status === 'trash';\n\t\t\t},\n\t\t\tasync callback( post ) {\n\t\t\t\tawait editEntityRecord( 'postType', post.type, post.id, {\n\t\t\t\t\tstatus: 'draft',\n\t\t\t\t} );\n\t\t\t\ttry {\n\t\t\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t);\n\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: The posts's title. */\n\t\t\t\t\t\t\t__( '\"%s\" has been restored.' ),\n\t\t\t\t\t\t\tdecodeEntities( post.title.rendered )\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'edit-site-post-restored',\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t} catch ( error ) {\n\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while restoring the post.'\n\t\t\t\t\t\t\t );\n\n\t\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[\n\t\t\tcreateSuccessNotice,\n\t\t\tcreateErrorNotice,\n\t\t\teditEntityRecord,\n\t\t\tsaveEditedEntityRecord,\n\t\t]\n\t);\n}\n\nexport const viewPostAction = {\n\tid: 'view-post',\n\tlabel: __( 'View' ),\n\tisPrimary: true,\n\ticon: external,\n\tisEligible( post ) {\n\t\treturn post.status !== 'trash';\n\t},\n\tcallback( post ) {\n\t\tdocument.location.href = post.link;\n\t},\n};\n\nexport function useEditPostAction() {\n\tconst history = useHistory();\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'edit-post',\n\t\t\tlabel: __( 'Edit' ),\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status !== 'trash';\n\t\t\t},\n\t\t\tcallback( post ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostId: post.id,\n\t\t\t\t\tpostType: post.type,\n\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t} );\n\t\t\t},\n\t\t} ),\n\t\t[ history ]\n\t);\n}\nexport const postRevisionsAction = {\n\tid: 'view-post-revisions',\n\tlabel: __( 'View revisions' ),\n\tisPrimary: false,\n\tisEligible: ( post ) => {\n\t\tif ( post.status === 'trash' ) {\n\t\t\treturn false;\n\t\t}\n\t\tconst lastRevisionId =\n\t\t\tpost?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;\n\t\tconst revisionsCount =\n\t\t\tpost?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\treturn lastRevisionId && revisionsCount > 1;\n\t},\n\tcallback( post ) {\n\t\tconst href = addQueryArgs( 'revision.php', {\n\t\t\trevision: post?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id,\n\t\t} );\n\t\tdocument.location.href = href;\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,KAAK,EAAEC,MAAM,QAAQ,kB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CAAC,CAAE,EACH,CAAEJ,OAAO,CACV,CAAC;AACF;AACA,OAAO,MAAMK,mBAAmB,GAAG;EAClChC,EAAE,EAAE,qBAAqB;EACzBC,KAAK,EAAEb,EAAE,CAAE,gBAAiB,CAAC;EAC7Bc,SAAS,EAAE,KAAK;EAChBE,UAAU,EAAIG,IAAI,IAAM;IAAA,IAAA0B,qBAAA,EAAAC,oBAAA;IACvB,IAAK3B,IAAI,CAACF,MAAM,KAAK,OAAO,EAAG;MAC9B,OAAO,KAAK;IACb;IACA,MAAM8B,cAAc,IAAAF,qBAAA,GACnB1B,IAAI,EAAE6B,MAAM,GAAI,qBAAqB,CAAE,GAAI,CAAC,CAAE,EAAEpC,EAAE,cAAAiC,qBAAA,cAAAA,qBAAA,GAAI,IAAI;IAC3D,MAAMI,cAAc,IAAAH,oBAAA,GACnB3B,IAAI,EAAE6B,MAAM,GAAI,iBAAiB,CAAE,GAAI,CAAC,CAAE,EAAEE,KAAK,cAAAJ,oBAAA,cAAAA,oBAAA,GAAI,CAAC;IACvD,OAAOC,cAAc,IAAIE,cAAc,GAAG,CAAC;EAC5C,CAAC;EACD/B,QAAQA,CAAEC,IAAI,EAAG;IAChB,MAAMiB,IAAI,GAAGzC,YAAY,CAAE,cAAc,EAAE;MAC1CwD,QAAQ,EAAEhC,IAAI,EAAE6B,MAAM,GAAI,qBAAqB,CAAE,GAAI,CAAC,CAAE,EAAEpC;IAC3D,CAAE,CAAC;IACHsB,QAAQ,CAACC,QAAQ,CAACC,IAAI,GAAGA,IAAI;EAC9B;AACD,CAAC"}
@@ -29,7 +29,6 @@ import AddCustomTemplateModalContent from './add-custom-template-modal-content';
29
29
  import { useExistingTemplates, useDefaultTemplateTypes, useTaxonomiesMenuItems, usePostTypeMenuItems, useAuthorMenuItem, usePostTypeArchiveMenuItems } from './utils';
30
30
  import AddCustomGenericTemplateModalContent from './add-custom-generic-template-modal-content';
31
31
  import TemplateActionsLoadingScreen from './template-actions-loading-screen';
32
- import { store as editSiteStore } from '../../store';
33
32
  import { unlock } from '../../lock-unlock';
34
33
  const {
35
34
  useHistory
@@ -109,9 +108,6 @@ export default function NewTemplate({
109
108
  createErrorNotice,
110
109
  createSuccessNotice
111
110
  } = useDispatch(noticesStore);
112
- const {
113
- setTemplate
114
- } = unlock(useDispatch(editSiteStore));
115
111
  const {
116
112
  homeUrl
117
113
  } = useSelect(select => {
@@ -151,9 +147,6 @@ export default function NewTemplate({
151
147
  throwOnError: true
152
148
  });
153
149
 
154
- // Set template before navigating away to avoid initial stale value.
155
- setTemplate(newTemplate.id, newTemplate.slug);
156
-
157
150
  // Navigate to the created template editor.
158
151
  history.push({
159
152
  postId: newTemplate.id,