@wordpress/edit-site 5.25.1-next.79a6196f.0 → 5.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (324) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/actions/index.js +139 -36
  3. package/build/components/actions/index.js.map +1 -1
  4. package/build/components/editor-canvas-container/index.js +1 -1
  5. package/build/components/editor-canvas-container/index.js.map +1 -1
  6. package/build/components/global-styles/font-families.js +3 -2
  7. package/build/components/global-styles/font-families.js.map +1 -1
  8. package/build/components/global-styles/font-family-item.js +3 -4
  9. package/build/components/global-styles/font-family-item.js.map +1 -1
  10. package/build/components/global-styles/font-library-modal/context.js +80 -41
  11. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  12. package/build/components/global-styles/font-library-modal/font-collection.js +49 -22
  13. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  14. package/build/components/global-styles/font-library-modal/fonts-grid.js +4 -1
  15. package/build/components/global-styles/font-library-modal/fonts-grid.js.map +1 -1
  16. package/build/components/global-styles/font-library-modal/index.js +4 -4
  17. package/build/components/global-styles/font-library-modal/index.js.map +1 -1
  18. package/build/components/global-styles/font-library-modal/installed-fonts.js +16 -8
  19. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  20. package/build/components/global-styles/font-library-modal/library-font-card.js +1 -1
  21. package/build/components/global-styles/font-library-modal/library-font-card.js.map +1 -1
  22. package/build/components/global-styles/font-library-modal/library-font-variant.js +2 -2
  23. package/build/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
  24. package/build/components/global-styles/font-library-modal/local-fonts.js +13 -4
  25. package/build/components/global-styles/font-library-modal/local-fonts.js.map +1 -1
  26. package/build/components/global-styles/font-library-modal/resolvers.js +49 -20
  27. package/build/components/global-styles/font-library-modal/resolvers.js.map +1 -1
  28. package/build/components/global-styles/font-library-modal/utils/filter-fonts.js +17 -2
  29. package/build/components/global-styles/font-library-modal/utils/filter-fonts.js.map +1 -1
  30. package/build/components/global-styles/font-library-modal/utils/index.js +103 -17
  31. package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  32. package/build/components/global-styles/font-library-modal/utils/preview-styles.js +4 -3
  33. package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  34. package/build/components/global-styles/screen-typography.js +4 -1
  35. package/build/components/global-styles/screen-typography.js.map +1 -1
  36. package/build/components/layout/hooks.js +6 -5
  37. package/build/components/layout/hooks.js.map +1 -1
  38. package/build/components/layout/index.js +19 -28
  39. package/build/components/layout/index.js.map +1 -1
  40. package/build/components/layout/router.js +135 -0
  41. package/build/components/layout/router.js.map +1 -0
  42. package/build/components/page-pages/index.js +92 -69
  43. package/build/components/page-pages/index.js.map +1 -1
  44. package/build/components/page-patterns/dataviews-pattern-actions.js +11 -6
  45. package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
  46. package/build/components/page-patterns/index.js +295 -15
  47. package/build/components/page-patterns/index.js.map +1 -1
  48. package/build/components/{page-templates/template-actions.js → page-templates-template-parts/actions.js} +51 -23
  49. package/build/components/page-templates-template-parts/actions.js.map +1 -0
  50. package/build/components/page-templates-template-parts/add-new-template-part.js.map +1 -0
  51. package/build/components/page-templates-template-parts/index.js +395 -0
  52. package/build/components/page-templates-template-parts/index.js.map +1 -0
  53. package/build/components/preferences-modal/index.js +9 -134
  54. package/build/components/preferences-modal/index.js.map +1 -1
  55. package/build/components/revisions/index.js +1 -1
  56. package/build/components/revisions/index.js.map +1 -1
  57. package/build/components/save-button/index.js +4 -2
  58. package/build/components/save-button/index.js.map +1 -1
  59. package/build/components/save-panel/index.js +6 -5
  60. package/build/components/save-panel/index.js.map +1 -1
  61. package/build/components/sidebar/index.js +3 -1
  62. package/build/components/sidebar/index.js.map +1 -1
  63. package/build/components/sidebar-dataviews/dataview-item.js +3 -1
  64. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  65. package/build/components/sidebar-dataviews/default-views.js +4 -2
  66. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  67. package/build/components/sidebar-dataviews/index.js +2 -2
  68. package/build/components/sidebar-dataviews/index.js.map +1 -1
  69. package/build/components/sidebar-navigation-screen/index.js +8 -7
  70. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  71. package/build/components/sidebar-navigation-screen-pages/index.js +2 -10
  72. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  73. package/build/components/sidebar-navigation-screen-pages-dataviews/index.js +26 -3
  74. package/build/components/sidebar-navigation-screen-pages-dataviews/index.js.map +1 -1
  75. package/build/components/sidebar-navigation-screen-templates-browse/content.js +76 -0
  76. package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -0
  77. package/build/components/sidebar-navigation-screen-templates-browse/index.js +9 -2
  78. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  79. package/build/components/site-hub/index.js +3 -1
  80. package/build/components/site-hub/index.js.map +1 -1
  81. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +47 -12
  82. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  83. package/build/components/sync-state-with-url/use-sync-path-with-url.js +25 -2
  84. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  85. package/build/hooks/commands/use-edit-mode-commands.js +33 -5
  86. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  87. package/build/hooks/push-changes-to-global-styles/index.js +13 -6
  88. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  89. package/build/hooks/template-part-edit.js +7 -6
  90. package/build/hooks/template-part-edit.js.map +1 -1
  91. package/build/index.js +1 -1
  92. package/build/index.js.map +1 -1
  93. package/build/store/actions.js +11 -29
  94. package/build/store/actions.js.map +1 -1
  95. package/build/store/private-actions.js +85 -1
  96. package/build/store/private-actions.js.map +1 -1
  97. package/build/store/selectors.js +2 -2
  98. package/build/store/selectors.js.map +1 -1
  99. package/build/utils/get-is-list-page.js +1 -1
  100. package/build/utils/get-is-list-page.js.map +1 -1
  101. package/build/utils/use-actual-current-theme.js +32 -0
  102. package/build/utils/use-actual-current-theme.js.map +1 -0
  103. package/build-module/components/actions/index.js +139 -36
  104. package/build-module/components/actions/index.js.map +1 -1
  105. package/build-module/components/editor-canvas-container/index.js +1 -1
  106. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  107. package/build-module/components/global-styles/font-families.js +3 -2
  108. package/build-module/components/global-styles/font-families.js.map +1 -1
  109. package/build-module/components/global-styles/font-family-item.js +4 -5
  110. package/build-module/components/global-styles/font-family-item.js.map +1 -1
  111. package/build-module/components/global-styles/font-library-modal/context.js +82 -42
  112. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  113. package/build-module/components/global-styles/font-library-modal/font-collection.js +49 -22
  114. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  115. package/build-module/components/global-styles/font-library-modal/fonts-grid.js +4 -1
  116. package/build-module/components/global-styles/font-library-modal/fonts-grid.js.map +1 -1
  117. package/build-module/components/global-styles/font-library-modal/index.js +4 -4
  118. package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
  119. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +16 -8
  120. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  121. package/build-module/components/global-styles/font-library-modal/library-font-card.js +1 -1
  122. package/build-module/components/global-styles/font-library-modal/library-font-card.js.map +1 -1
  123. package/build-module/components/global-styles/font-library-modal/library-font-variant.js +2 -2
  124. package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
  125. package/build-module/components/global-styles/font-library-modal/local-fonts.js +13 -4
  126. package/build-module/components/global-styles/font-library-modal/local-fonts.js.map +1 -1
  127. package/build-module/components/global-styles/font-library-modal/resolvers.js +45 -18
  128. package/build-module/components/global-styles/font-library-modal/resolvers.js.map +1 -1
  129. package/build-module/components/global-styles/font-library-modal/utils/filter-fonts.js +17 -2
  130. package/build-module/components/global-styles/font-library-modal/utils/filter-fonts.js.map +1 -1
  131. package/build-module/components/global-styles/font-library-modal/utils/index.js +99 -16
  132. package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  133. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js +4 -3
  134. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  135. package/build-module/components/global-styles/screen-typography.js +4 -1
  136. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  137. package/build-module/components/layout/hooks.js +6 -5
  138. package/build-module/components/layout/hooks.js.map +1 -1
  139. package/build-module/components/layout/index.js +19 -28
  140. package/build-module/components/layout/index.js.map +1 -1
  141. package/build-module/components/layout/router.js +127 -0
  142. package/build-module/components/layout/router.js.map +1 -0
  143. package/build-module/components/page-pages/index.js +91 -70
  144. package/build-module/components/page-pages/index.js.map +1 -1
  145. package/build-module/components/page-patterns/dataviews-pattern-actions.js +11 -6
  146. package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
  147. package/build-module/components/page-patterns/index.js +296 -16
  148. package/build-module/components/page-patterns/index.js.map +1 -1
  149. package/build-module/components/{page-templates/template-actions.js → page-templates-template-parts/actions.js} +52 -24
  150. package/build-module/components/page-templates-template-parts/actions.js.map +1 -0
  151. package/build-module/components/page-templates-template-parts/add-new-template-part.js.map +1 -0
  152. package/build-module/components/page-templates-template-parts/index.js +385 -0
  153. package/build-module/components/page-templates-template-parts/index.js.map +1 -0
  154. package/build-module/components/preferences-modal/index.js +12 -136
  155. package/build-module/components/preferences-modal/index.js.map +1 -1
  156. package/build-module/components/revisions/index.js +1 -1
  157. package/build-module/components/revisions/index.js.map +1 -1
  158. package/build-module/components/save-button/index.js +4 -2
  159. package/build-module/components/save-button/index.js.map +1 -1
  160. package/build-module/components/save-panel/index.js +7 -6
  161. package/build-module/components/save-panel/index.js.map +1 -1
  162. package/build-module/components/sidebar/index.js +3 -1
  163. package/build-module/components/sidebar/index.js.map +1 -1
  164. package/build-module/components/sidebar-dataviews/dataview-item.js +3 -1
  165. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  166. package/build-module/components/sidebar-dataviews/default-views.js +4 -2
  167. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  168. package/build-module/components/sidebar-dataviews/index.js +2 -2
  169. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  170. package/build-module/components/sidebar-navigation-screen/index.js +8 -7
  171. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  172. package/build-module/components/sidebar-navigation-screen-pages/index.js +2 -10
  173. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  174. package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js +27 -4
  175. package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js.map +1 -1
  176. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +68 -0
  177. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -0
  178. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +9 -2
  179. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  180. package/build-module/components/site-hub/index.js +3 -1
  181. package/build-module/components/site-hub/index.js.map +1 -1
  182. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +47 -11
  183. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  184. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +25 -2
  185. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  186. package/build-module/hooks/commands/use-edit-mode-commands.js +33 -5
  187. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  188. package/build-module/hooks/push-changes-to-global-styles/index.js +13 -6
  189. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  190. package/build-module/hooks/template-part-edit.js +7 -6
  191. package/build-module/hooks/template-part-edit.js.map +1 -1
  192. package/build-module/index.js +1 -1
  193. package/build-module/index.js.map +1 -1
  194. package/build-module/store/actions.js +13 -30
  195. package/build-module/store/actions.js.map +1 -1
  196. package/build-module/store/private-actions.js +83 -0
  197. package/build-module/store/private-actions.js.map +1 -1
  198. package/build-module/store/selectors.js +2 -2
  199. package/build-module/store/selectors.js.map +1 -1
  200. package/build-module/utils/get-is-list-page.js +1 -1
  201. package/build-module/utils/get-is-list-page.js.map +1 -1
  202. package/build-module/utils/use-actual-current-theme.js +24 -0
  203. package/build-module/utils/use-actual-current-theme.js.map +1 -0
  204. package/build-style/style-rtl.css +293 -188
  205. package/build-style/style.css +293 -188
  206. package/package.json +42 -42
  207. package/src/components/actions/index.js +236 -84
  208. package/src/components/editor-canvas-container/index.js +1 -1
  209. package/src/components/global-styles/font-families.js +14 -8
  210. package/src/components/global-styles/font-family-item.js +7 -4
  211. package/src/components/global-styles/font-library-modal/context.js +156 -50
  212. package/src/components/global-styles/font-library-modal/font-collection.js +56 -21
  213. package/src/components/global-styles/font-library-modal/fonts-grid.js +6 -2
  214. package/src/components/global-styles/font-library-modal/index.js +4 -4
  215. package/src/components/global-styles/font-library-modal/installed-fonts.js +18 -8
  216. package/src/components/global-styles/font-library-modal/library-font-card.js +2 -1
  217. package/src/components/global-styles/font-library-modal/library-font-variant.js +10 -9
  218. package/src/components/global-styles/font-library-modal/local-fonts.js +14 -4
  219. package/src/components/global-styles/font-library-modal/resolvers.js +50 -17
  220. package/src/components/global-styles/font-library-modal/style.scss +1 -0
  221. package/src/components/global-styles/font-library-modal/utils/filter-fonts.js +19 -2
  222. package/src/components/global-styles/font-library-modal/utils/index.js +136 -29
  223. package/src/components/global-styles/font-library-modal/utils/preview-styles.js +7 -3
  224. package/src/components/global-styles/font-library-modal/utils/test/filter-fonts.spec.js +40 -10
  225. package/src/components/global-styles/font-library-modal/utils/test/preview-styles.spec.js +5 -5
  226. package/src/components/global-styles/screen-typography.js +9 -3
  227. package/src/components/global-styles/style.scss +4 -0
  228. package/src/components/header-edit-mode/style.scss +15 -5
  229. package/src/components/layout/hooks.js +6 -5
  230. package/src/components/layout/index.js +80 -96
  231. package/src/components/layout/router.js +121 -0
  232. package/src/components/layout/style.scss +13 -16
  233. package/src/components/page/style.scss +1 -8
  234. package/src/components/page-pages/index.js +142 -148
  235. package/src/components/page-pages/style.scss +41 -2
  236. package/src/components/page-patterns/dataviews-pattern-actions.js +11 -6
  237. package/src/components/page-patterns/index.js +392 -14
  238. package/src/components/page-patterns/style.scss +36 -2
  239. package/src/components/{page-templates/template-actions.js → page-templates-template-parts/actions.js} +90 -37
  240. package/src/components/{page-templates → page-templates-template-parts}/index.js +198 -169
  241. package/src/components/page-templates-template-parts/style.scss +44 -0
  242. package/src/components/preferences-modal/index.js +8 -211
  243. package/src/components/revisions/index.js +1 -1
  244. package/src/components/save-button/index.js +7 -4
  245. package/src/components/save-panel/index.js +13 -12
  246. package/src/components/sidebar/index.js +4 -5
  247. package/src/components/sidebar-dataviews/dataview-item.js +2 -1
  248. package/src/components/sidebar-dataviews/default-views.js +4 -2
  249. package/src/components/sidebar-dataviews/index.js +8 -6
  250. package/src/components/sidebar-navigation-item/style.scss +1 -1
  251. package/src/components/sidebar-navigation-screen/index.js +19 -10
  252. package/src/components/sidebar-navigation-screen-pages/index.js +2 -10
  253. package/src/components/sidebar-navigation-screen-pages-dataviews/index.js +32 -6
  254. package/src/components/sidebar-navigation-screen-templates-browse/content.js +73 -0
  255. package/src/components/sidebar-navigation-screen-templates-browse/index.js +10 -1
  256. package/src/components/site-hub/index.js +4 -1
  257. package/src/components/site-hub/style.scss +1 -12
  258. package/src/components/site-icon/style.scss +1 -1
  259. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +40 -10
  260. package/src/components/sync-state-with-url/use-sync-path-with-url.js +32 -0
  261. package/src/hooks/commands/use-edit-mode-commands.js +50 -3
  262. package/src/hooks/push-changes-to-global-styles/index.js +29 -23
  263. package/src/hooks/template-part-edit.js +12 -12
  264. package/src/index.js +1 -1
  265. package/src/store/actions.js +17 -51
  266. package/src/store/private-actions.js +133 -0
  267. package/src/store/selectors.js +2 -4
  268. package/src/style.scss +1 -1
  269. package/src/utils/get-is-list-page.js +3 -2
  270. package/src/utils/use-actual-current-theme.js +27 -0
  271. package/build/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +0 -58
  272. package/build/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js.map +0 -1
  273. package/build/components/global-styles/font-library-modal/utils/get-notice-from-response.js +0 -71
  274. package/build/components/global-styles/font-library-modal/utils/get-notice-from-response.js.map +0 -1
  275. package/build/components/page-main/index.js +0 -44
  276. package/build/components/page-main/index.js.map +0 -1
  277. package/build/components/page-patterns/dataviews-patterns.js +0 -307
  278. package/build/components/page-patterns/dataviews-patterns.js.map +0 -1
  279. package/build/components/page-template-parts/add-new-template-part.js.map +0 -1
  280. package/build/components/page-template-parts/index.js +0 -81
  281. package/build/components/page-template-parts/index.js.map +0 -1
  282. package/build/components/page-templates/index.js +0 -352
  283. package/build/components/page-templates/index.js.map +0 -1
  284. package/build/components/page-templates/template-actions.js.map +0 -1
  285. package/build/components/post-preview/index.js +0 -29
  286. package/build/components/post-preview/index.js.map +0 -1
  287. package/build/components/preferences-modal/enable-feature.js +0 -36
  288. package/build/components/preferences-modal/enable-feature.js.map +0 -1
  289. package/build/components/preferences-modal/enable-panel-option.js +0 -33
  290. package/build/components/preferences-modal/enable-panel-option.js.map +0 -1
  291. package/build-module/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +0 -52
  292. package/build-module/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js.map +0 -1
  293. package/build-module/components/global-styles/font-library-modal/utils/get-notice-from-response.js +0 -63
  294. package/build-module/components/global-styles/font-library-modal/utils/get-notice-from-response.js.map +0 -1
  295. package/build-module/components/page-main/index.js +0 -36
  296. package/build-module/components/page-main/index.js.map +0 -1
  297. package/build-module/components/page-patterns/dataviews-patterns.js +0 -299
  298. package/build-module/components/page-patterns/dataviews-patterns.js.map +0 -1
  299. package/build-module/components/page-template-parts/add-new-template-part.js.map +0 -1
  300. package/build-module/components/page-template-parts/index.js +0 -73
  301. package/build-module/components/page-template-parts/index.js.map +0 -1
  302. package/build-module/components/page-templates/index.js +0 -344
  303. package/build-module/components/page-templates/index.js.map +0 -1
  304. package/build-module/components/page-templates/template-actions.js.map +0 -1
  305. package/build-module/components/post-preview/index.js +0 -21
  306. package/build-module/components/post-preview/index.js.map +0 -1
  307. package/build-module/components/preferences-modal/enable-feature.js +0 -29
  308. package/build-module/components/preferences-modal/enable-feature.js.map +0 -1
  309. package/build-module/components/preferences-modal/enable-panel-option.js +0 -26
  310. package/build-module/components/preferences-modal/enable-panel-option.js.map +0 -1
  311. package/src/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +0 -58
  312. package/src/components/global-styles/font-library-modal/utils/get-notice-from-response.js +0 -62
  313. package/src/components/global-styles/font-library-modal/utils/test/getIntersectingFontFaces.spec.js +0 -271
  314. package/src/components/global-styles/font-library-modal/utils/test/makeFormDataFromFontFamily.spec.js +0 -58
  315. package/src/components/page-main/index.js +0 -38
  316. package/src/components/page-patterns/dataviews-patterns.js +0 -380
  317. package/src/components/page-template-parts/index.js +0 -99
  318. package/src/components/page-templates/style.scss +0 -13
  319. package/src/components/post-preview/index.js +0 -16
  320. package/src/components/preferences-modal/enable-feature.js +0 -31
  321. package/src/components/preferences-modal/enable-panel-option.js +0 -23
  322. /package/build/components/{page-template-parts → page-templates-template-parts}/add-new-template-part.js +0 -0
  323. /package/build-module/components/{page-template-parts → page-templates-template-parts}/add-new-template-part.js +0 -0
  324. /package/src/components/{page-template-parts → page-templates-template-parts}/add-new-template-part.js +0 -0
@@ -34,10 +34,10 @@ var _blockEditor = require("@wordpress/block-editor");
34
34
  var _editor = require("@wordpress/editor");
35
35
  var _a11y = require("@wordpress/a11y");
36
36
  var _preferences = require("@wordpress/preferences");
37
- var _htmlEntities = require("@wordpress/html-entities");
38
37
  var _constants = require("./constants");
39
38
  var _isTemplateRevertable = _interopRequireDefault(require("../utils/is-template-revertable"));
40
39
  var _constants2 = require("../utils/constants");
40
+ var _privateActions = require("./private-actions");
41
41
  /**
42
42
  * WordPress dependencies
43
43
  */
@@ -139,32 +139,8 @@ const addTemplate = template => async ({
139
139
  * @param {Object} template The template object.
140
140
  */
141
141
  exports.addTemplate = addTemplate;
142
- const removeTemplate = template => async ({
143
- registry
144
- }) => {
145
- try {
146
- await registry.dispatch(_coreData.store).deleteEntityRecord('postType', template.type, template.id, {
147
- force: true
148
- });
149
- const lastError = registry.select(_coreData.store).getLastEntityDeleteError('postType', template.type, template.id);
150
- if (lastError) {
151
- throw lastError;
152
- }
153
-
154
- // Depending on how the entity was retrieved it's title might be
155
- // an object or simple string.
156
- const templateTitle = typeof template.title === 'string' ? template.title : template.title?.rendered;
157
- registry.dispatch(_notices.store).createSuccessNotice((0, _i18n.sprintf)( /* translators: The template/part's name. */
158
- (0, _i18n.__)('"%s" deleted.'), (0, _htmlEntities.decodeEntities)(templateTitle)), {
159
- type: 'snackbar',
160
- id: 'site-editor-template-deleted-success'
161
- });
162
- } catch (error) {
163
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0, _i18n.__)('An error occurred while deleting the template.');
164
- registry.dispatch(_notices.store).createErrorNotice(errorMessage, {
165
- type: 'snackbar'
166
- });
167
- }
142
+ const removeTemplate = template => {
143
+ return (0, _privateActions.removeTemplates)([template]);
168
144
  };
169
145
 
170
146
  /**
@@ -492,7 +468,7 @@ const switchEditorMode = mode => ({
492
468
  dispatch,
493
469
  registry
494
470
  }) => {
495
- registry.dispatch('core/preferences').set('core/edit-site', 'editorMode', mode);
471
+ registry.dispatch('core/preferences').set('core', 'editorMode', mode);
496
472
 
497
473
  // Unselect blocks when we switch to a non visual mode.
498
474
  if (mode !== 'visual') {
@@ -556,7 +532,13 @@ const toggleDistractionFree = () => ({
556
532
  registry.dispatch(_preferences.store).set('core', 'distractionFree', !isDistractionFree);
557
533
  registry.dispatch(_notices.store).createInfoNotice(isDistractionFree ? (0, _i18n.__)('Distraction free off.') : (0, _i18n.__)('Distraction free on.'), {
558
534
  id: 'core/edit-site/distraction-free-mode/notice',
559
- type: 'snackbar'
535
+ type: 'snackbar',
536
+ actions: [{
537
+ label: (0, _i18n.__)('Undo'),
538
+ onClick: () => {
539
+ registry.dispatch(_preferences.store).toggle('core', 'distractionFree');
540
+ }
541
+ }]
560
542
  });
561
543
  });
562
544
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_apiFetch","_interopRequireDefault","require","_blocks","_deprecated","_url","_i18n","_notices","_coreData","_interface","_blockEditor","_editor","_a11y","_preferences","_htmlEntities","_constants","_isTemplateRevertable","_constants2","toggleFeature","featureName","registry","deprecated","since","alternative","dispatch","preferencesStore","toggle","__experimentalSetPreviewDeviceType","deviceType","version","hint","editorStore","setDeviceType","exports","setTemplate","type","addTemplate","template","newTemplate","coreStore","saveEntityRecord","TEMPLATE_POST_TYPE","content","editEntityRecord","id","blocks","parse","undoIgnore","postType","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","templateTitle","title","rendered","noticesStore","createSuccessNotice","sprintf","__","decodeEntities","error","errorMessage","message","code","createErrorNotice","setTemplatePart","templatePartId","TEMPLATE_PART_POST_TYPE","setNavigationMenu","navigationMenuId","NAVIGATION_POST_TYPE","setEditedEntity","postId","context","setHomeTemplateId","setEditedPostContext","setPage","setNavigationPanelActiveMenu","openNavigationPanelToMenu","setIsNavigationPanelOpened","setIsInserterOpened","value","setIsListViewOpened","isOpen","updateSettings","settings","setIsSaveViewOpened","revertTemplate","allowUndo","noticeId","removeNotice","isTemplateRevertable","templateEntityConfig","getEntityConfig","fileTemplatePath","addQueryArgs","baseURL","source","fileTemplate","apiFetch","path","serializeBlocks","blocksForSerialization","__unstableSerializeAndClean","edited","getEditedEntityRecord","raw","undoRevert","actions","label","onClick","openGeneralSidebar","name","isDistractionFree","get","toggleDistractionFree","interfaceStore","enableComplementaryArea","editSiteStoreName","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","set","blockEditorStore","clearSelectedBlock","speak","setHasPageContentFocus","hasPageContentFocus","batch","createInfoNotice"],"sources":["@wordpress/edit-site/src/store/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { addQueryArgs } from '@wordpress/url';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { speak } from '@wordpress/a11y';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../utils/constants';\n/**\n * Dispatches an action that toggles a feature flag.\n *\n * @param {string} featureName Feature name.\n */\nexport function toggleFeature( featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated(\n\t\t\t\"dispatch( 'core/edit-site' ).toggleFeature( featureName )\",\n\t\t\t{\n\t\t\t\tsince: '6.0',\n\t\t\t\talternative:\n\t\t\t\t\t\"dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )\",\n\t\t\t}\n\t\t);\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-site', featureName );\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @deprecated\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport const __experimentalSetPreviewDeviceType =\n\t( deviceType ) =>\n\t( { registry } ) => {\n\t\tdeprecated(\n\t\t\t\"dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType\",\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\thint: 'registry.dispatch( editorStore ).setDeviceType',\n\t\t\t}\n\t\t);\n\t\tregistry.dispatch( editorStore ).setDeviceType( deviceType );\n\t};\n\n/**\n * Action that sets a template, optionally fetching it from REST API.\n *\n * @return {Object} Action object.\n */\nexport function setTemplate() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setTemplate\", {\n\t\tsince: '6.5',\n\t\tversion: '6.8',\n\t\thint: 'The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically.',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Action that adds a new template and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @deprecated\n *\n * @return {Object} Action object used to set the current template.\n */\nexport const addTemplate =\n\t( template ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).addTemplate\", {\n\t\t\tsince: '6.5',\n\t\t\tversion: '6.8',\n\t\t\thint: 'use saveEntityRecord directly',\n\t\t} );\n\n\t\tconst newTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', TEMPLATE_POST_TYPE, template );\n\n\t\tif ( template.content ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tnewTemplate.id,\n\t\t\t\t\t{ blocks: parse( template.content ) },\n\t\t\t\t\t{ undoIgnore: true }\n\t\t\t\t);\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\tid: newTemplate.id,\n\t\t} );\n\t};\n\n/**\n * Action that removes a template.\n *\n * @param {Object} template The template object.\n */\nexport const removeTemplate =\n\t( template ) =>\n\tasync ( { registry } ) => {\n\t\ttry {\n\t\t\tawait registry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.deleteEntityRecord( 'postType', template.type, template.id, {\n\t\t\t\t\tforce: true,\n\t\t\t\t} );\n\n\t\t\tconst lastError = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getLastEntityDeleteError(\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\tif ( lastError ) {\n\t\t\t\tthrow lastError;\n\t\t\t}\n\n\t\t\t// Depending on how the entity was retrieved it's title might be\n\t\t\t// an object or simple string.\n\t\t\tconst templateTitle =\n\t\t\t\ttypeof template.title === 'string'\n\t\t\t\t\t? template.title\n\t\t\t\t\t: template.title?.rendered;\n\n\t\t\tregistry.dispatch( noticesStore ).createSuccessNotice(\n\t\t\t\tsprintf(\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( templateTitle )\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', id: 'site-editor-template-deleted-success' }\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: __( 'An error occurred while deleting the template.' );\n\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 sets a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: TEMPLATE_PART_POST_TYPE,\n\t\tid: templatePartId,\n\t};\n}\n\n/**\n * Action that sets a navigation menu.\n *\n * @param {string} navigationMenuId The Navigation Menu Post ID.\n *\n * @return {Object} Action object.\n */\nexport function setNavigationMenu( navigationMenuId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: NAVIGATION_POST_TYPE,\n\t\tid: navigationMenuId,\n\t};\n}\n\n/**\n * Action that sets an edited entity.\n *\n * @param {string} postType The entity's post type.\n * @param {string} postId The entity's ID.\n * @param {Object} context The entity's context.\n *\n * @return {Object} Action object.\n */\nexport function setEditedEntity( postType, postId, context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType,\n\t\tid: postId,\n\t\tcontext,\n\t};\n}\n\n/**\n * @deprecated\n */\nexport function setHomeTemplateId() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Set's the current block editor context.\n *\n * @param {Object} context The context object.\n *\n * @return {Object} Action object.\n */\nexport function setEditedPostContext( context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST_CONTEXT',\n\t\tcontext,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @deprecated\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport function setPage() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setPage\", {\n\t\tsince: '6.5',\n\t\tversion: '6.8',\n\t\thint: 'The setPage is not needed anymore, the correct entity is resolved from the URL automatically.',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Action that sets the active navigation panel menu.\n *\n * @deprecated\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @deprecated\n */\nexport function openNavigationPanelToMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).openNavigationPanelToMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @deprecated\n */\nexport function setIsNavigationPanelOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setIsNavigationPanelOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Returns an action object used to open/close the inserter.\n *\n * @deprecated\n *\n * @param {boolean|Object} value Whether the inserter should be opened (true) or closed (false).\n */\nexport const setIsInserterOpened =\n\t( value ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).setIsInserterOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').setIsInserterOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).setIsInserterOpened( value );\n\t};\n\n/**\n * Returns an action object used to open/close the list view.\n *\n * @deprecated\n *\n * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.\n */\nexport const setIsListViewOpened =\n\t( isOpen ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).setIsListViewOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').setIsListViewOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).setIsListViewOpened( isOpen );\n\t};\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the save view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the save view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsSaveViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_SAVE_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\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 reverted.' ), {\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 * Action that opens an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core', 'distractionFree' );\n\t\tif ( isDistractionFree ) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( editSiteStoreName, name );\n\t};\n\n/**\n * Action that closes the sidebar.\n */\nexport const closeGeneralSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.disableComplementaryArea( editSiteStoreName );\n\t};\n\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { dispatch, registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( 'core/preferences' )\n\t\t\t.set( 'core/edit-site', 'editorMode', mode );\n\n\t\t// Unselect blocks when we switch to a non visual mode.\n\t\tif ( mode !== 'visual' ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\n\t\tif ( mode === 'visual' ) {\n\t\t\tspeak( __( 'Visual editor selected' ), 'assertive' );\n\t\t} else if ( mode === 'text' ) {\n\t\t\tconst isDistractionFree = registry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'distractionFree' );\n\t\t\tif ( isDistractionFree ) {\n\t\t\t\tdispatch.toggleDistractionFree();\n\t\t\t}\n\t\t\tspeak( __( 'Code editor selected' ), 'assertive' );\n\t\t}\n\t};\n\n/**\n * Sets whether or not the editor allows only page content to be edited.\n *\n * @param {boolean} hasPageContentFocus True to allow only page content to be\n * edited, false to allow template to be\n * edited.\n */\nexport const setHasPageContentFocus =\n\t( hasPageContentFocus ) =>\n\t( { dispatch, registry } ) => {\n\t\tdeprecated( `dispatch( 'core/edit-site' ).setHasPageContentFocus`, {\n\t\t\tsince: '6.5',\n\t\t} );\n\n\t\tif ( hasPageContentFocus ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'SET_HAS_PAGE_CONTENT_FOCUS',\n\t\t\thasPageContentFocus,\n\t\t} );\n\t};\n\n/**\n * Action that toggles Distraction free mode.\n * Distraction free mode expects there are no sidebars, as due to the\n * z-index values set, you can't close sidebars.\n */\nexport const toggleDistractionFree =\n\t() =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core', 'distractionFree' );\n\t\tif ( ! isDistractionFree ) {\n\t\t\tregistry.batch( () => {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t\t.set( 'core', 'fixedToolbar', true );\n\t\t\t\tregistry.dispatch( editorStore ).setIsInserterOpened( false );\n\t\t\t\tregistry.dispatch( editorStore ).setIsListViewOpened( false );\n\t\t\t\tdispatch.closeGeneralSidebar();\n\t\t\t} );\n\t\t}\n\t\tregistry.batch( () => {\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set( 'core', 'distractionFree', ! isDistractionFree );\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createInfoNotice(\n\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t? __( 'Distraction free off.' )\n\t\t\t\t\t\t: __( 'Distraction free on.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'core/edit-site/distraction-free-mode/notice',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t} );\n\t};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AACA,IAAAU,KAAA,GAAAV,OAAA;AACA,IAAAW,YAAA,GAAAX,OAAA;AACA,IAAAY,aAAA,GAAAZ,OAAA;AAKA,IAAAa,UAAA,GAAAb,OAAA;AACA,IAAAc,qBAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,WAAA,GAAAf,OAAA;AAtBA;AACA;AACA;;AAeA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACO,SAASgB,aAAaA,CAAEC,WAAW,EAAG;EAC5C,OAAO,UAAW;IAAEC;EAAS,CAAC,EAAG;IAChC,IAAAC,mBAAU,EACT,2DAA2D,EAC3D;MACCC,KAAK,EAAE,KAAK;MACZC,WAAW,EACV;IACF,CACD,CAAC;IAEDH,QAAQ,CACNI,QAAQ,CAAEC,kBAAiB,CAAC,CAC5BC,MAAM,CAAE,gBAAgB,EAAEP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AEC,kBAAiB,CAAC,CAC5BqG,GAAG,CAAE,MAAM,EAAE,cAAc,EAAE,IAAK,CAAC;MACrC1G,QAAQ,CAACI,QAAQ,CAAEO,aAAY,CAAC,CAACoD,mBAAmB,CAAE,KAAM,CAAC;MAC7D/D,QAAQ,CAACI,QAAQ,CAAEO,aAAY,CAAC,CAACsD,mBAAmB,CAAE,KAAM,CAAC;MAC7D7D,QAAQ,CAACkG,mBAAmB,CAAC,CAAC;IAC/B,CAAE,CAAC;EACJ;EACAtG,QAAQ,CAACgH,KAAK,CAAE,MAAM;IACrBhH,QAAQ,CACNI,QAAQ,CAAEC,kBAAiB,CAAC,CAC5BqG,GAAG,CAAE,MAAM,EAAE,iBAAiB,EAAE,CAAEV,iBAAkB,CAAC;IACvDhG,QAAQ,CACNI,QAAQ,CAAEkC,cAAa,CAAC,CACxB2E,gBAAgB,CAChBjB,iBAAiB,GACd,IAAAvD,QAAE,EAAE,uBAAwB,CAAC,GAC7B,IAAAA,QAAE,EAAE,sBAAuB,CAAC,EAC/B;MACCjB,EAAE,EAAE,6CAA6C;MACjDT,IAAI,EAAE;IACP,CACD,CAAC;EACH,CAAE,CAAC;AACJ,CAAC;AAACF,OAAA,CAAAqF,qBAAA,GAAAA,qBAAA"}
1
+ {"version":3,"names":["_apiFetch","_interopRequireDefault","require","_blocks","_deprecated","_url","_i18n","_notices","_coreData","_interface","_blockEditor","_editor","_a11y","_preferences","_constants","_isTemplateRevertable","_constants2","_privateActions","toggleFeature","featureName","registry","deprecated","since","alternative","dispatch","preferencesStore","toggle","__experimentalSetPreviewDeviceType","deviceType","version","hint","editorStore","setDeviceType","exports","setTemplate","type","addTemplate","template","newTemplate","coreStore","saveEntityRecord","TEMPLATE_POST_TYPE","content","editEntityRecord","id","blocks","parse","undoIgnore","postType","removeTemplate","removeTemplates","setTemplatePart","templatePartId","TEMPLATE_PART_POST_TYPE","setNavigationMenu","navigationMenuId","NAVIGATION_POST_TYPE","setEditedEntity","postId","context","setHomeTemplateId","setEditedPostContext","setPage","setNavigationPanelActiveMenu","openNavigationPanelToMenu","setIsNavigationPanelOpened","setIsInserterOpened","value","setIsListViewOpened","isOpen","updateSettings","settings","setIsSaveViewOpened","revertTemplate","allowUndo","noticeId","noticesStore","removeNotice","isTemplateRevertable","createErrorNotice","__","templateEntityConfig","select","getEntityConfig","fileTemplatePath","addQueryArgs","baseURL","source","fileTemplate","apiFetch","path","serializeBlocks","blocksForSerialization","__unstableSerializeAndClean","edited","getEditedEntityRecord","raw","undoRevert","createSuccessNotice","actions","label","onClick","error","errorMessage","message","code","openGeneralSidebar","name","isDistractionFree","get","toggleDistractionFree","interfaceStore","enableComplementaryArea","editSiteStoreName","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","set","blockEditorStore","clearSelectedBlock","speak","setHasPageContentFocus","hasPageContentFocus","batch","createInfoNotice"],"sources":["@wordpress/edit-site/src/store/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { addQueryArgs } from '@wordpress/url';\nimport { __ } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { speak } from '@wordpress/a11y';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../utils/constants';\nimport { removeTemplates } from './private-actions';\n\n/**\n * Dispatches an action that toggles a feature flag.\n *\n * @param {string} featureName Feature name.\n */\nexport function toggleFeature( featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated(\n\t\t\t\"dispatch( 'core/edit-site' ).toggleFeature( featureName )\",\n\t\t\t{\n\t\t\t\tsince: '6.0',\n\t\t\t\talternative:\n\t\t\t\t\t\"dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )\",\n\t\t\t}\n\t\t);\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-site', featureName );\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @deprecated\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport const __experimentalSetPreviewDeviceType =\n\t( deviceType ) =>\n\t( { registry } ) => {\n\t\tdeprecated(\n\t\t\t\"dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType\",\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\thint: 'registry.dispatch( editorStore ).setDeviceType',\n\t\t\t}\n\t\t);\n\t\tregistry.dispatch( editorStore ).setDeviceType( deviceType );\n\t};\n\n/**\n * Action that sets a template, optionally fetching it from REST API.\n *\n * @return {Object} Action object.\n */\nexport function setTemplate() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setTemplate\", {\n\t\tsince: '6.5',\n\t\tversion: '6.8',\n\t\thint: 'The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically.',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Action that adds a new template and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @deprecated\n *\n * @return {Object} Action object used to set the current template.\n */\nexport const addTemplate =\n\t( template ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).addTemplate\", {\n\t\t\tsince: '6.5',\n\t\t\tversion: '6.8',\n\t\t\thint: 'use saveEntityRecord directly',\n\t\t} );\n\n\t\tconst newTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', TEMPLATE_POST_TYPE, template );\n\n\t\tif ( template.content ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tnewTemplate.id,\n\t\t\t\t\t{ blocks: parse( template.content ) },\n\t\t\t\t\t{ undoIgnore: true }\n\t\t\t\t);\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\tid: newTemplate.id,\n\t\t} );\n\t};\n\n/**\n * Action that removes a template.\n *\n * @param {Object} template The template object.\n */\nexport const removeTemplate = ( template ) => {\n\treturn removeTemplates( [ template ] );\n};\n\n/**\n * Action that sets a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: TEMPLATE_PART_POST_TYPE,\n\t\tid: templatePartId,\n\t};\n}\n\n/**\n * Action that sets a navigation menu.\n *\n * @param {string} navigationMenuId The Navigation Menu Post ID.\n *\n * @return {Object} Action object.\n */\nexport function setNavigationMenu( navigationMenuId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: NAVIGATION_POST_TYPE,\n\t\tid: navigationMenuId,\n\t};\n}\n\n/**\n * Action that sets an edited entity.\n *\n * @param {string} postType The entity's post type.\n * @param {string} postId The entity's ID.\n * @param {Object} context The entity's context.\n *\n * @return {Object} Action object.\n */\nexport function setEditedEntity( postType, postId, context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType,\n\t\tid: postId,\n\t\tcontext,\n\t};\n}\n\n/**\n * @deprecated\n */\nexport function setHomeTemplateId() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Set's the current block editor context.\n *\n * @param {Object} context The context object.\n *\n * @return {Object} Action object.\n */\nexport function setEditedPostContext( context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST_CONTEXT',\n\t\tcontext,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @deprecated\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport function setPage() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setPage\", {\n\t\tsince: '6.5',\n\t\tversion: '6.8',\n\t\thint: 'The setPage is not needed anymore, the correct entity is resolved from the URL automatically.',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Action that sets the active navigation panel menu.\n *\n * @deprecated\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @deprecated\n */\nexport function openNavigationPanelToMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).openNavigationPanelToMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @deprecated\n */\nexport function setIsNavigationPanelOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setIsNavigationPanelOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Returns an action object used to open/close the inserter.\n *\n * @deprecated\n *\n * @param {boolean|Object} value Whether the inserter should be opened (true) or closed (false).\n */\nexport const setIsInserterOpened =\n\t( value ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).setIsInserterOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').setIsInserterOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).setIsInserterOpened( value );\n\t};\n\n/**\n * Returns an action object used to open/close the list view.\n *\n * @deprecated\n *\n * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.\n */\nexport const setIsListViewOpened =\n\t( isOpen ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).setIsListViewOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').setIsListViewOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).setIsListViewOpened( isOpen );\n\t};\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the save view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the save view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsSaveViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_SAVE_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\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 reverted.' ), {\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 * Action that opens an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core', 'distractionFree' );\n\t\tif ( isDistractionFree ) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( editSiteStoreName, name );\n\t};\n\n/**\n * Action that closes the sidebar.\n */\nexport const closeGeneralSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.disableComplementaryArea( editSiteStoreName );\n\t};\n\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { dispatch, registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( 'core/preferences' )\n\t\t\t.set( 'core', 'editorMode', mode );\n\n\t\t// Unselect blocks when we switch to a non visual mode.\n\t\tif ( mode !== 'visual' ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\n\t\tif ( mode === 'visual' ) {\n\t\t\tspeak( __( 'Visual editor selected' ), 'assertive' );\n\t\t} else if ( mode === 'text' ) {\n\t\t\tconst isDistractionFree = registry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'distractionFree' );\n\t\t\tif ( isDistractionFree ) {\n\t\t\t\tdispatch.toggleDistractionFree();\n\t\t\t}\n\t\t\tspeak( __( 'Code editor selected' ), 'assertive' );\n\t\t}\n\t};\n\n/**\n * Sets whether or not the editor allows only page content to be edited.\n *\n * @param {boolean} hasPageContentFocus True to allow only page content to be\n * edited, false to allow template to be\n * edited.\n */\nexport const setHasPageContentFocus =\n\t( hasPageContentFocus ) =>\n\t( { dispatch, registry } ) => {\n\t\tdeprecated( `dispatch( 'core/edit-site' ).setHasPageContentFocus`, {\n\t\t\tsince: '6.5',\n\t\t} );\n\n\t\tif ( hasPageContentFocus ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'SET_HAS_PAGE_CONTENT_FOCUS',\n\t\t\thasPageContentFocus,\n\t\t} );\n\t};\n\n/**\n * Action that toggles Distraction free mode.\n * Distraction free mode expects there are no sidebars, as due to the\n * z-index values set, you can't close sidebars.\n */\nexport const toggleDistractionFree =\n\t() =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core', 'distractionFree' );\n\t\tif ( ! isDistractionFree ) {\n\t\t\tregistry.batch( () => {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t\t.set( 'core', 'fixedToolbar', true );\n\t\t\t\tregistry.dispatch( editorStore ).setIsInserterOpened( false );\n\t\t\t\tregistry.dispatch( editorStore ).setIsListViewOpened( false );\n\t\t\t\tdispatch.closeGeneralSidebar();\n\t\t\t} );\n\t\t}\n\t\tregistry.batch( () => {\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set( 'core', 'distractionFree', ! isDistractionFree );\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createInfoNotice(\n\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t? __( 'Distraction free off.' )\n\t\t\t\t\t\t: __( 'Distraction free on.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'core/edit-site/distraction-free-mode/notice',\n\t\t\t\t\t\ttype: 'snackbar',\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: () => {\n\t\t\t\t\t\t\t\t\tregistry\n\t\t\t\t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AAQ,CACNI,QAAQ,CAAEC,kBAAiB,CAAC,CAC5B6F,GAAG,CAAE,MAAM,EAAE,cAAc,EAAE,IAAK,CAAC;MACrClG,QAAQ,CAACI,QAAQ,CAAEO,aAAY,CAAC,CAACmC,mBAAmB,CAAE,KAAM,CAAC;MAC7D9C,QAAQ,CAACI,QAAQ,CAAEO,aAAY,CAAC,CAACqC,mBAAmB,CAAE,KAAM,CAAC;MAC7D5C,QAAQ,CAAC0F,mBAAmB,CAAC,CAAC;IAC/B,CAAE,CAAC;EACJ;EACA9F,QAAQ,CAACwG,KAAK,CAAE,MAAM;IACrBxG,QAAQ,CACNI,QAAQ,CAAEC,kBAAiB,CAAC,CAC5B6F,GAAG,CAAE,MAAM,EAAE,iBAAiB,EAAE,CAAEV,iBAAkB,CAAC;IACvDxF,QAAQ,CACNI,QAAQ,CAAEoD,cAAa,CAAC,CACxBiD,gBAAgB,CAChBjB,iBAAiB,GACd,IAAA5B,QAAE,EAAE,uBAAwB,CAAC,GAC7B,IAAAA,QAAE,EAAE,sBAAuB,CAAC,EAC/B;MACCpC,EAAE,EAAE,6CAA6C;MACjDT,IAAI,EAAE,UAAU;MAChBgE,OAAO,EAAE,CACR;QACCC,KAAK,EAAE,IAAApB,QAAE,EAAE,MAAO,CAAC;QACnBqB,OAAO,EAAEA,CAAA,KAAM;UACdjF,QAAQ,CACNI,QAAQ,CAAEC,kBAAiB,CAAC,CAC5BC,MAAM,CAAE,MAAM,EAAE,iBAAkB,CAAC;QACtC;MACD,CAAC;IAEH,CACD,CAAC;EACH,CAAE,CAAC;AACJ,CAAC;AAACO,OAAA,CAAA6E,qBAAA,GAAAA,qBAAA"}
@@ -3,14 +3,23 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setEditorCanvasContainerView = exports.setCanvasMode = void 0;
6
+ exports.setEditorCanvasContainerView = exports.setCanvasMode = exports.removeTemplates = void 0;
7
7
  var _blockEditor = require("@wordpress/block-editor");
8
8
  var _preferences = require("@wordpress/preferences");
9
9
  var _editor = require("@wordpress/editor");
10
+ var _coreData = require("@wordpress/core-data");
11
+ var _notices = require("@wordpress/notices");
12
+ var _i18n = require("@wordpress/i18n");
13
+ var _htmlEntities = require("@wordpress/html-entities");
14
+ var _constants = require("../utils/constants");
10
15
  /**
11
16
  * WordPress dependencies
12
17
  */
13
18
 
19
+ /**
20
+ * Internal dependencies
21
+ */
22
+
14
23
  /**
15
24
  * Action that switches the canvas mode.
16
25
  *
@@ -49,5 +58,80 @@ const setEditorCanvasContainerView = view => ({
49
58
  view
50
59
  });
51
60
  };
61
+
62
+ /**
63
+ * Action that removes an array of templates.
64
+ *
65
+ * @param {Array} items An array of template or template part objects to remove.
66
+ */
52
67
  exports.setEditorCanvasContainerView = setEditorCanvasContainerView;
68
+ const removeTemplates = items => async ({
69
+ registry
70
+ }) => {
71
+ const isTemplate = items[0].type === _constants.TEMPLATE_POST_TYPE;
72
+ const promiseResult = await Promise.allSettled(items.map(item => {
73
+ return registry.dispatch(_coreData.store).deleteEntityRecord('postType', item.type, item.id, {
74
+ force: true
75
+ }, {
76
+ throwOnError: true
77
+ });
78
+ }));
79
+
80
+ // If all the promises were fulfilled with sucess.
81
+ if (promiseResult.every(({
82
+ status
83
+ }) => status === 'fulfilled')) {
84
+ let successMessage;
85
+ if (items.length === 1) {
86
+ // Depending on how the entity was retrieved its title might be
87
+ // an object or simple string.
88
+ const title = typeof items[0].title === 'string' ? items[0].title : items[0].title?.rendered;
89
+ successMessage = (0, _i18n.sprintf)( /* translators: The template/part's name. */
90
+ (0, _i18n.__)('"%s" deleted.'), (0, _htmlEntities.decodeEntities)(title));
91
+ } else {
92
+ successMessage = isTemplate ? (0, _i18n.__)('Templates deleted.') : (0, _i18n.__)('Template parts deleted.');
93
+ }
94
+ registry.dispatch(_notices.store).createSuccessNotice(successMessage, {
95
+ type: 'snackbar',
96
+ id: 'site-editor-template-deleted-success'
97
+ });
98
+ } else {
99
+ // If there was at lease one failure.
100
+ let errorMessage;
101
+ // If we were trying to delete a single template.
102
+ if (promiseResult.length === 1) {
103
+ if (promiseResult[0].reason?.message) {
104
+ errorMessage = promiseResult[0].reason.message;
105
+ } else {
106
+ errorMessage = isTemplate ? (0, _i18n.__)('An error occurred while deleting the template.') : (0, _i18n.__)('An error occurred while deleting the template part.');
107
+ }
108
+ // If we were trying to delete a multiple templates
109
+ } else {
110
+ const errorMessages = new Set();
111
+ const failedPromises = promiseResult.filter(({
112
+ status
113
+ }) => status === 'rejected');
114
+ for (const failedPromise of failedPromises) {
115
+ if (failedPromise.reason?.message) {
116
+ errorMessages.add(failedPromise.reason.message);
117
+ }
118
+ }
119
+ if (errorMessages.size === 0) {
120
+ errorMessage = isTemplate ? (0, _i18n.__)('An error occurred while deleting the templates.') : (0, _i18n.__)('An error occurred while deleting the template parts.');
121
+ } else if (errorMessages.size === 1) {
122
+ errorMessage = isTemplate ? (0, _i18n.sprintf)( /* translators: %s: an error message */
123
+ (0, _i18n.__)('An error occurred while deleting the templates: %s'), [...errorMessages][0]) : (0, _i18n.sprintf)( /* translators: %s: an error message */
124
+ (0, _i18n.__)('An error occurred while deleting the template parts: %s'), [...errorMessages][0]);
125
+ } else {
126
+ errorMessage = isTemplate ? (0, _i18n.sprintf)( /* translators: %s: a list of comma separated error messages */
127
+ (0, _i18n.__)('Some errors occurred while deleting the templates: %s'), [...errorMessages].join(',')) : (0, _i18n.sprintf)( /* translators: %s: a list of comma separated error messages */
128
+ (0, _i18n.__)('Some errors occurred while deleting the template parts: %s'), [...errorMessages].join(','));
129
+ }
130
+ }
131
+ registry.dispatch(_notices.store).createErrorNotice(errorMessage, {
132
+ type: 'snackbar'
133
+ });
134
+ }
135
+ };
136
+ exports.removeTemplates = removeTemplates;
53
137
  //# sourceMappingURL=private-actions.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","_preferences","_editor","setCanvasMode","mode","registry","dispatch","blockEditorStore","__unstableSetEditorMode","type","select","preferencesStore","get","editorStore","setIsListViewOpened","setIsInserterOpened","exports","setEditorCanvasContainerView","view"],"sources":["@wordpress/edit-site/src/store/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch } ) => {\n\t\tregistry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );\n\t\tdispatch( {\n\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\tmode,\n\t\t} );\n\t\t// Check if the block list view should be open by default.\n\t\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t\tif (\n\t\t\tmode === 'edit' &&\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'showListViewByDefault' ) &&\n\t\t\t! registry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'distractionFree' )\n\t\t) {\n\t\t\tregistry.dispatch( editorStore ).setIsListViewOpened( true );\n\t\t} else {\n\t\t\tregistry.dispatch( editorStore ).setIsListViewOpened( false );\n\t\t}\n\t\tregistry.dispatch( editorStore ).setIsInserterOpened( false );\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',\n\t\t\tview,\n\t\t} );\n\t};\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACO,MAAMG,aAAa,GACvBC,IAAI,IACN,CAAE;EAAEC,QAAQ;EAAEC;AAAS,CAAC,KAAM;EAC7BD,QAAQ,CAACC,QAAQ,CAAEC,kBAAiB,CAAC,CAACC,uBAAuB,CAAE,MAAO,CAAC;EACvEF,QAAQ,CAAE;IACTG,IAAI,EAAE,iBAAiB;IACvBL;EACD,CAAE,CAAC;EACH;EACA;EACA,IACCA,IAAI,KAAK,MAAM,IACfC,QAAQ,CACNK,MAAM,CAAEC,kBAAiB,CAAC,CAC1BC,GAAG,CAAE,MAAM,EAAE,uBAAwB,CAAC,IACxC,CAAEP,QAAQ,CACRK,MAAM,CAAEC,kBAAiB,CAAC,CAC1BC,GAAG,CAAE,MAAM,EAAE,iBAAkB,CAAC,EACjC;IACDP,QAAQ,CAACC,QAAQ,CAAEO,aAAY,CAAC,CAACC,mBAAmB,CAAE,IAAK,CAAC;EAC7D,CAAC,MAAM;IACNT,QAAQ,CAACC,QAAQ,CAAEO,aAAY,CAAC,CAACC,mBAAmB,CAAE,KAAM,CAAC;EAC9D;EACAT,QAAQ,CAACC,QAAQ,CAAEO,aAAY,CAAC,CAACE,mBAAmB,CAAE,KAAM,CAAC;AAC9D,CAAC;;AAEF;AACA;AACA;AACA;AACA;AAJAC,OAAA,CAAAb,aAAA,GAAAA,aAAA;AAKO,MAAMc,4BAA4B,GACtCC,IAAI,IACN,CAAE;EAAEZ;AAAS,CAAC,KAAM;EACnBA,QAAQ,CAAE;IACTG,IAAI,EAAE,kCAAkC;IACxCS;EACD,CAAE,CAAC;AACJ,CAAC;AAACF,OAAA,CAAAC,4BAAA,GAAAA,4BAAA"}
1
+ {"version":3,"names":["_blockEditor","require","_preferences","_editor","_coreData","_notices","_i18n","_htmlEntities","_constants","setCanvasMode","mode","registry","dispatch","blockEditorStore","__unstableSetEditorMode","type","select","preferencesStore","get","editorStore","setIsListViewOpened","setIsInserterOpened","exports","setEditorCanvasContainerView","view","removeTemplates","items","isTemplate","TEMPLATE_POST_TYPE","promiseResult","Promise","allSettled","map","item","coreStore","deleteEntityRecord","id","force","throwOnError","every","status","successMessage","length","title","rendered","sprintf","__","decodeEntities","noticesStore","createSuccessNotice","errorMessage","reason","message","errorMessages","Set","failedPromises","filter","failedPromise","add","size","join","createErrorNotice"],"sources":["@wordpress/edit-site/src/store/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../utils/constants';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch } ) => {\n\t\tregistry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );\n\t\tdispatch( {\n\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\tmode,\n\t\t} );\n\t\t// Check if the block list view should be open by default.\n\t\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t\tif (\n\t\t\tmode === 'edit' &&\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'showListViewByDefault' ) &&\n\t\t\t! registry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'distractionFree' )\n\t\t) {\n\t\t\tregistry.dispatch( editorStore ).setIsListViewOpened( true );\n\t\t} else {\n\t\t\tregistry.dispatch( editorStore ).setIsListViewOpened( false );\n\t\t}\n\t\tregistry.dispatch( editorStore ).setIsInserterOpened( false );\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',\n\t\t\tview,\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\t );\n\t\t\t\t}\n\t\t\t}\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"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AAKA,IAAAO,UAAA,GAAAP,OAAA;AAdA;AACA;AACA;;AASA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACO,MAAMQ,aAAa,GACvBC,IAAI,IACN,CAAE;EAAEC,QAAQ;EAAEC;AAAS,CAAC,KAAM;EAC7BD,QAAQ,CAACC,QAAQ,CAAEC,kBAAiB,CAAC,CAACC,uBAAuB,CAAE,MAAO,CAAC;EACvEF,QAAQ,CAAE;IACTG,IAAI,EAAE,iBAAiB;IACvBL;EACD,CAAE,CAAC;E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A,CAAAG,eAAA,GAAAA,eAAA"}
@@ -254,7 +254,7 @@ const getCurrentTemplateTemplateParts = (0, _data.createRegistrySelector)(select
254
254
  const templateParts = select(_coreData.store).getEntityRecords('postType', _constants.TEMPLATE_PART_POST_TYPE, {
255
255
  per_page: -1
256
256
  });
257
- const clientIds = select(_blockEditor.store).__experimentalGetGlobalBlocksByName('core/template-part');
257
+ const clientIds = select(_blockEditor.store).getBlocksByName('core/template-part');
258
258
  const blocks = select(_blockEditor.store).getBlocksByClientId(clientIds);
259
259
  return (0, _utils.getFilteredTemplatePartBlocks)(blocks, templateParts);
260
260
  });
@@ -268,7 +268,7 @@ const getCurrentTemplateTemplateParts = (0, _data.createRegistrySelector)(select
268
268
  */
269
269
  exports.getCurrentTemplateTemplateParts = getCurrentTemplateTemplateParts;
270
270
  const getEditorMode = (0, _data.createRegistrySelector)(select => () => {
271
- return select(_preferences.store).get('core/edit-site', 'editorMode');
271
+ return select(_preferences.store).get('core', 'editorMode');
272
272
  });
273
273
 
274
274
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["_coreData","require","_data","_deprecated","_interopRequireDefault","_element","_preferences","_blockEditor","_editor","_utils","_constants","_lockUnlock","isFeatureActive","createRegistrySelector","select","_","featureName","deprecated","since","alternative","preferencesStore","get","exports","__experimentalGetPreviewDeviceType","version","editorStore","getDeviceType","getCanUserCreateMedia","coreDataStore","canUser","getReusableBlocks","isWeb","Platform","OS","getEntityRecords","per_page","getSettings","state","settings","getHomeTemplateId","getEditedPostType","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","__experimentalGetInsertionPoint","unlock","getInsertionPoint","isListViewOpened","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","templateParts","TEMPLATE_PART_POST_TYPE","clientIds","blockEditorStore","__experimentalGetGlobalBlocksByName","blocks","getBlocksByClientId","getFilteredTemplatePartBlocks","getEditorMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened","isPage","postId","hasPageContentFocus"],"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';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { getFilteredTemplatePartBlocks } from './utils';\nimport { TEMPLATE_PART_POST_TYPE } from '../utils/constants';\nimport { unlock } from '../lock-unlock';\n\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 * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport const __experimentalGetPreviewDeviceType = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\talternative: `select( 'core/editor' ).getDeviceType`,\n\t\t\t}\n\t\t);\n\t\treturn select( editorStore ).getDeviceType();\n\t}\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 true if the inserter is opened.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport const isInserterOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isInserterOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isInserterOpened`,\n\t} );\n\treturn select( editorStore ).isInserterOpened();\n} );\n\n/**\n * Get the insertion point for the inserter.\n *\n * @deprecated\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 ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetInsertionPoint`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t}\n\t\t);\n\t\treturn unlock( select( editorStore ) ).getInsertionPoint();\n\t}\n);\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport const isListViewOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isListViewOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isListViewOpened`,\n\t} );\n\treturn select( editorStore ).isListViewOpened();\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 * @deprecated\n *\n * @return {boolean} Whether or not focus is on editing page content.\n */\nexport function hasPageContentFocus() {\n\tdeprecated( `select( 'core/edit-site' ).hasPageContentFocus`, {\n\t\tsince: '6.5',\n\t} );\n\n\treturn false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,SA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S2C,kBAAkBA,CAAA,EAAG;EACpC,IAAAlD,mBAAU,EAAE,iDAAiD,EAAE;IAC9DC,KAAK,EAAE,KAAK;IACZM,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS4C,MAAMA,CAAE/B,KAAK,EAAG;EAC/B,OAAO,CAAC,CAAEA,KAAK,CAACI,UAAU,CAACK,OAAO,EAAEuB,MAAM;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAAA,EAAG;EACrC,IAAArD,mBAAU,EAAG,gDAA+C,EAAE;IAC7DC,KAAK,EAAE;EACR,CAAE,CAAC;EAEH,OAAO,KAAK;AACb"}
1
+ {"version":3,"names":["_coreData","require","_data","_deprecated","_interopRequireDefault","_element","_preferences","_blockEditor","_editor","_utils","_constants","_lockUnlock","isFeatureActive","createRegistrySelector","select","_","featureName","deprecated","since","alternative","preferencesStore","get","exports","__experimentalGetPreviewDeviceType","version","editorStore","getDeviceType","getCanUserCreateMedia","coreDataStore","canUser","getReusableBlocks","isWeb","Platform","OS","getEntityRecords","per_page","getSettings","state","settings","getHomeTemplateId","getEditedPostType","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","__experimentalGetInsertionPoint","unlock","getInsertionPoint","isListViewOpened","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","templateParts","TEMPLATE_PART_POST_TYPE","clientIds","blockEditorStore","getBlocksByName","blocks","getBlocksByClientId","getFilteredTemplatePartBlocks","getEditorMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened","isPage","postId","hasPageContentFocus"],"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';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { getFilteredTemplatePartBlocks } from './utils';\nimport { TEMPLATE_PART_POST_TYPE } from '../utils/constants';\nimport { unlock } from '../lock-unlock';\n\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 * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport const __experimentalGetPreviewDeviceType = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\talternative: `select( 'core/editor' ).getDeviceType`,\n\t\t\t}\n\t\t);\n\t\treturn select( editorStore ).getDeviceType();\n\t}\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 true if the inserter is opened.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport const isInserterOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isInserterOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isInserterOpened`,\n\t} );\n\treturn select( editorStore ).isInserterOpened();\n} );\n\n/**\n * Get the insertion point for the inserter.\n *\n * @deprecated\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 ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetInsertionPoint`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t}\n\t\t);\n\t\treturn unlock( select( editorStore ) ).getInsertionPoint();\n\t}\n);\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport const isListViewOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isListViewOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isListViewOpened`,\n\t} );\n\treturn select( editorStore ).isListViewOpened();\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 ).getBlocksByName( 'core/template-part' );\n\t\tconst blocks =\n\t\t\tselect( blockEditorStore ).getBlocksByClientId( clientIds );\n\n\t\treturn getFilteredTemplatePartBlocks( blocks, templateParts );\n\t}\n);\n\n/**\n * Returns 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', '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 * @deprecated\n *\n * @return {boolean} Whether or not focus is on editing page content.\n */\nexport function hasPageContentFocus() {\n\tdeprecated( `select( 'core/edit-site' ).hasPageContentFocus`, {\n\t\tsince: '6.5',\n\t} );\n\n\treturn 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;AACA,IAAAO,OAAA,GAAAP,OAAA;AAKA,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B,OAAO,CAAC,CAAEA,KAAK,CAACI,UAAU,CAACK,OAAO,EAAEuB,MAAM;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAAA,EAAG;EACrC,IAAArD,mBAAU,EAAG,gDAA+C,EAAE;IAC7DC,KAAK,EAAE;EACR,CAAE,CAAC;EAEH,OAAO,KAAK;AACb"}
@@ -20,7 +20,7 @@ function getIsListPage({
20
20
  categoryType,
21
21
  categoryId
22
22
  }, isMobileViewport) {
23
- return ['/wp_template/all', '/wp_template_part/all'].includes(path) || path === '/page' && window?.__experimentalAdminViews || path === '/patterns' && (
23
+ return ['/wp_template/all', '/wp_template_part/all', '/pages'].includes(path) || path === '/patterns' && (
24
24
  // Don't treat "/patterns" without categoryType and categoryId as a
25
25
  // list page in mobile because the sidebar covers the whole page.
26
26
  !isMobileViewport || !!categoryType && !!categoryId);
@@ -1 +1 @@
1
- {"version":3,"names":["getIsListPage","path","categoryType","categoryId","isMobileViewport","includes","window","__experimentalAdminViews"],"sources":["@wordpress/edit-site/src/utils/get-is-list-page.js"],"sourcesContent":["/**\n * Returns if the params match the list page route.\n *\n * @param {Object} params The url params.\n * @param {string} params.path The current path.\n * @param {string} [params.categoryType] The current category type.\n * @param {string} [params.categoryId] The current category id.\n * @param {boolean} isMobileViewport Is mobile viewport.\n *\n * @return {boolean} Is list page or not.\n */\nexport default function getIsListPage(\n\t{ path, categoryType, categoryId },\n\tisMobileViewport\n) {\n\treturn (\n\t\t[ '/wp_template/all', '/wp_template_part/all' ].includes( path ) ||\n\t\t( path === '/page' && window?.__experimentalAdminViews ) ||\n\t\t( path === '/patterns' &&\n\t\t\t// Don't treat \"/patterns\" without categoryType and categoryId as a\n\t\t\t// list page in mobile because the sidebar covers the whole page.\n\t\t\t( ! isMobileViewport || ( !! categoryType && !! categoryId ) ) )\n\t);\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,aAAaA,CACpC;EAAEC,IAAI;EAAEC,YAAY;EAAEC;AAAW,CAAC,EAClCC,gBAAgB,EACf;EACD,OACC,CAAE,kBAAkB,EAAE,uBAAuB,CAAE,CAACC,QAAQ,CAAEJ,IAAK,CAAC,IAC9DA,IAAI,KAAK,OAAO,IAAIK,MAAM,EAAEC,wBAA0B,IACtDN,IAAI,KAAK,WAAW;EACrB;EACA;EACE,CAAEG,gBAAgB,IAAM,CAAC,CAAEF,YAAY,IAAI,CAAC,CAAEC,UAAY,CAAI;AAEnE"}
1
+ {"version":3,"names":["getIsListPage","path","categoryType","categoryId","isMobileViewport","includes"],"sources":["@wordpress/edit-site/src/utils/get-is-list-page.js"],"sourcesContent":["/**\n * Returns if the params match the list page route.\n *\n * @param {Object} params The url params.\n * @param {string} params.path The current path.\n * @param {string} [params.categoryType] The current category type.\n * @param {string} [params.categoryId] The current category id.\n * @param {boolean} isMobileViewport Is mobile viewport.\n *\n * @return {boolean} Is list page or not.\n */\nexport default function getIsListPage(\n\t{ path, categoryType, categoryId },\n\tisMobileViewport\n) {\n\treturn (\n\t\t[ '/wp_template/all', '/wp_template_part/all', '/pages' ].includes(\n\t\t\tpath\n\t\t) ||\n\t\t( path === '/patterns' &&\n\t\t\t// Don't treat \"/patterns\" without categoryType and categoryId as a\n\t\t\t// list page in mobile because the sidebar covers the whole page.\n\t\t\t( ! isMobileViewport || ( !! categoryType && !! categoryId ) ) )\n\t);\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,aAAaA,CACpC;EAAEC,IAAI;EAAEC,YAAY;EAAEC;AAAW,CAAC,EAClCC,gBAAgB,EACf;EACD,OACC,CAAE,kBAAkB,EAAE,uBAAuB,EAAE,QAAQ,CAAE,CAACC,QAAQ,CACjEJ,IACD,CAAC,IACCA,IAAI,KAAK,WAAW;EACrB;EACA;EACE,CAAEG,gBAAgB,IAAM,CAAC,CAAEF,YAAY,IAAI,CAAC,CAAEC,UAAY,CAAI;AAEnE"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.useActualCurrentTheme = useActualCurrentTheme;
8
+ var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
9
+ var _element = require("@wordpress/element");
10
+ var _url = require("@wordpress/url");
11
+ /**
12
+ * WordPress dependencies
13
+ */
14
+
15
+ const ACTIVE_THEMES_URL = '/wp/v2/themes?status=active';
16
+ function useActualCurrentTheme() {
17
+ const [currentTheme, setCurrentTheme] = (0, _element.useState)();
18
+ (0, _element.useEffect)(() => {
19
+ // Set the `wp_theme_preview` to empty string to bypass the createThemePreviewMiddleware.
20
+ const path = (0, _url.addQueryArgs)(ACTIVE_THEMES_URL, {
21
+ context: 'edit',
22
+ wp_theme_preview: ''
23
+ });
24
+ (0, _apiFetch.default)({
25
+ path
26
+ }).then(activeThemes => setCurrentTheme(activeThemes[0]))
27
+ // Do nothing
28
+ .catch(() => {});
29
+ }, []);
30
+ return currentTheme;
31
+ }
32
+ //# sourceMappingURL=use-actual-current-theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_apiFetch","_interopRequireDefault","require","_element","_url","ACTIVE_THEMES_URL","useActualCurrentTheme","currentTheme","setCurrentTheme","useState","useEffect","path","addQueryArgs","context","wp_theme_preview","apiFetch","then","activeThemes","catch"],"sources":["@wordpress/edit-site/src/utils/use-actual-current-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { useState, useEffect } from '@wordpress/element';\nimport { addQueryArgs } from '@wordpress/url';\n\nconst ACTIVE_THEMES_URL = '/wp/v2/themes?status=active';\n\nexport function useActualCurrentTheme() {\n\tconst [ currentTheme, setCurrentTheme ] = useState();\n\n\tuseEffect( () => {\n\t\t// Set the `wp_theme_preview` to empty string to bypass the createThemePreviewMiddleware.\n\t\tconst path = addQueryArgs( ACTIVE_THEMES_URL, {\n\t\t\tcontext: 'edit',\n\t\t\twp_theme_preview: '',\n\t\t} );\n\n\t\tapiFetch( { path } )\n\t\t\t.then( ( activeThemes ) => setCurrentTheme( activeThemes[ 0 ] ) )\n\t\t\t// Do nothing\n\t\t\t.catch( () => {} );\n\t}, [] );\n\n\treturn currentTheme;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA,MAAMG,iBAAiB,GAAG,6BAA6B;AAEhD,SAASC,qBAAqBA,CAAA,EAAG;EACvC,MAAM,CAAEC,YAAY,EAAEC,eAAe,CAAE,GAAG,IAAAC,iBAAQ,EAAC,CAAC;EAEpD,IAAAC,kBAAS,EAAE,MAAM;IAChB;IACA,MAAMC,IAAI,GAAG,IAAAC,iBAAY,EAAEP,iBAAiB,EAAE;MAC7CQ,OAAO,EAAE,MAAM;MACfC,gBAAgB,EAAE;IACnB,CAAE,CAAC;IAEH,IAAAC,iBAAQ,EAAE;MAAEJ;IAAK,CAAE,CAAC,CAClBK,IAAI,CAAIC,YAAY,IAAMT,eAAe,CAAES,YAAY,CAAE,CAAC,CAAG,CAAE;IAChE;IAAA,CACCC,KAAK,CAAE,MAAM,CAAC,CAAE,CAAC;EACpB,CAAC,EAAE,EAAG,CAAC;EAEP,OAAOX,YAAY;AACpB"}