@wordpress/edit-site 5.12.5 → 5.12.7

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 (353) hide show
  1. package/build/components/add-new-template/new-template.js +1 -1
  2. package/build/components/add-new-template/new-template.js.map +1 -1
  3. package/build/components/block-editor/editor-canvas.js +1 -1
  4. package/build/components/block-editor/editor-canvas.js.map +1 -1
  5. package/build/components/block-editor/use-site-editor-settings.js +10 -5
  6. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  7. package/build/components/create-pattern-modal/index.js +8 -8
  8. package/build/components/create-pattern-modal/index.js.map +1 -1
  9. package/build/components/global-styles/palette.js +1 -1
  10. package/build/components/global-styles/palette.js.map +1 -1
  11. package/build/components/header-edit-mode/document-actions/index.js +9 -1
  12. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  13. package/build/components/header-edit-mode/index.js +6 -2
  14. package/build/components/header-edit-mode/index.js.map +1 -1
  15. package/build/components/layout/index.js +1 -1
  16. package/build/components/layout/index.js.map +1 -1
  17. package/build/components/page/header.js +1 -1
  18. package/build/components/page/header.js.map +1 -1
  19. package/build/components/page/index.js +3 -1
  20. package/build/components/page/index.js.map +1 -1
  21. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -5
  22. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  23. package/build/components/page-main/index.js +8 -4
  24. package/build/components/page-main/index.js.map +1 -1
  25. package/build/components/{page-library → page-patterns}/grid-item.js +52 -27
  26. package/build/components/page-patterns/grid-item.js.map +1 -0
  27. package/build/components/{page-library → page-patterns}/grid.js +1 -1
  28. package/build/components/page-patterns/grid.js.map +1 -0
  29. package/build/components/{page-library → page-patterns}/index.js +6 -6
  30. package/build/components/page-patterns/index.js.map +1 -0
  31. package/build/components/{page-library → page-patterns}/no-patterns.js +1 -1
  32. package/build/components/page-patterns/no-patterns.js.map +1 -0
  33. package/build/components/{page-library → page-patterns}/patterns-list.js +9 -9
  34. package/build/components/page-patterns/patterns-list.js.map +1 -0
  35. package/build/components/page-patterns/search-items.js.map +1 -0
  36. package/build/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +3 -3
  37. package/build/components/page-patterns/use-pattern-settings.js.map +1 -0
  38. package/build/components/{page-library → page-patterns}/use-patterns.js +4 -2
  39. package/build/components/page-patterns/use-patterns.js.map +1 -0
  40. package/build/components/{page-library → page-patterns}/utils.js +3 -3
  41. package/build/components/page-patterns/utils.js.map +1 -0
  42. package/build/components/page-template-parts/index.js +103 -0
  43. package/build/components/page-template-parts/index.js.map +1 -0
  44. package/build/components/page-templates/index.js +1 -0
  45. package/build/components/page-templates/index.js.map +1 -1
  46. package/build/components/sidebar/index.js +6 -6
  47. package/build/components/sidebar/index.js.map +1 -1
  48. package/build/components/sidebar-edit-mode/page-panels/page-content.js +4 -3
  49. package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
  50. package/build/components/sidebar-edit-mode/settings-header/index.js +7 -1
  51. package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
  52. package/build/components/sidebar-navigation-screen-global-styles/index.js +63 -11
  53. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  54. package/build/components/sidebar-navigation-screen-main/index.js +5 -3
  55. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  56. package/build/components/sidebar-navigation-screen-main/template-part-hint.js +45 -0
  57. package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
  58. package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -11
  59. package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
  60. package/build/components/sidebar-navigation-screen-navigation-menu/index.js +2 -4
  61. package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  62. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +6 -2
  63. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  64. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +16 -4
  65. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  66. package/build/components/sidebar-navigation-screen-page/status-label.js +1 -1
  67. package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  68. package/build/components/sidebar-navigation-screen-pages/index.js +1 -1
  69. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  70. package/build/components/sidebar-navigation-screen-pattern/index.js +13 -8
  71. package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  72. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +25 -2
  73. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  74. package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +3 -3
  75. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
  76. package/build/components/sidebar-navigation-screen-patterns/index.js +177 -0
  77. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
  78. package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
  79. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +30 -0
  80. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
  81. package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +2 -20
  82. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
  83. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +52 -0
  84. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
  85. package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
  86. package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
  87. package/build/components/sidebar-navigation-screen-templates/index.js +11 -63
  88. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  89. package/build/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
  90. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  91. package/build/components/site-hub/index.js +1 -1
  92. package/build/components/site-hub/index.js.map +1 -1
  93. package/build/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
  94. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  95. package/build/components/template-actions/index.js +22 -6
  96. package/build/components/template-actions/index.js.map +1 -1
  97. package/build/components/welcome-guide/editor.js +1 -1
  98. package/build/components/welcome-guide/editor.js.map +1 -1
  99. package/build/components/welcome-guide/index.js +5 -1
  100. package/build/components/welcome-guide/index.js.map +1 -1
  101. package/build/components/welcome-guide/page.js +70 -0
  102. package/build/components/welcome-guide/page.js.map +1 -0
  103. package/build/components/welcome-guide/styles.js +1 -1
  104. package/build/components/welcome-guide/styles.js.map +1 -1
  105. package/build/components/welcome-guide/template.js +71 -0
  106. package/build/components/welcome-guide/template.js.map +1 -0
  107. package/build/hooks/commands/use-common-commands.js +17 -2
  108. package/build/hooks/commands/use-common-commands.js.map +1 -1
  109. package/build/hooks/commands/use-edit-mode-commands.js +3 -3
  110. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  111. package/build/index.js +2 -0
  112. package/build/index.js.map +1 -1
  113. package/build/store/actions.js +5 -2
  114. package/build/store/actions.js.map +1 -1
  115. package/build/store/private-actions.js +7 -1
  116. package/build/store/private-actions.js.map +1 -1
  117. package/build/utils/get-is-list-page.js +2 -2
  118. package/build/utils/get-is-list-page.js.map +1 -1
  119. package/build-module/components/add-new-template/new-template.js +2 -2
  120. package/build-module/components/add-new-template/new-template.js.map +1 -1
  121. package/build-module/components/block-editor/editor-canvas.js +1 -1
  122. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  123. package/build-module/components/block-editor/use-site-editor-settings.js +10 -5
  124. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  125. package/build-module/components/create-pattern-modal/index.js +8 -8
  126. package/build-module/components/create-pattern-modal/index.js.map +1 -1
  127. package/build-module/components/global-styles/palette.js +1 -1
  128. package/build-module/components/global-styles/palette.js.map +1 -1
  129. package/build-module/components/header-edit-mode/document-actions/index.js +10 -2
  130. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  131. package/build-module/components/header-edit-mode/index.js +6 -2
  132. package/build-module/components/header-edit-mode/index.js.map +1 -1
  133. package/build-module/components/layout/index.js +1 -1
  134. package/build-module/components/layout/index.js.map +1 -1
  135. package/build-module/components/page/header.js +1 -1
  136. package/build-module/components/page/header.js.map +1 -1
  137. package/build-module/components/page/index.js +2 -1
  138. package/build-module/components/page/index.js.map +1 -1
  139. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -3
  140. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  141. package/build-module/components/page-main/index.js +6 -3
  142. package/build-module/components/page-main/index.js.map +1 -1
  143. package/build-module/components/{page-library → page-patterns}/grid-item.js +56 -29
  144. package/build-module/components/page-patterns/grid-item.js.map +1 -0
  145. package/build-module/components/{page-library → page-patterns}/grid.js +1 -1
  146. package/build-module/components/page-patterns/grid.js.map +1 -0
  147. package/build-module/components/{page-library → page-patterns}/index.js +5 -5
  148. package/build-module/components/page-patterns/index.js.map +1 -0
  149. package/build-module/components/{page-library → page-patterns}/no-patterns.js +1 -1
  150. package/build-module/components/page-patterns/no-patterns.js.map +1 -0
  151. package/build-module/components/{page-library → page-patterns}/patterns-list.js +9 -9
  152. package/build-module/components/page-patterns/patterns-list.js.map +1 -0
  153. package/build-module/components/page-patterns/search-items.js.map +1 -0
  154. package/build-module/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +2 -2
  155. package/build-module/components/page-patterns/use-pattern-settings.js.map +1 -0
  156. package/build-module/components/{page-library → page-patterns}/use-patterns.js +4 -2
  157. package/build-module/components/page-patterns/use-patterns.js.map +1 -0
  158. package/build-module/components/{page-library → page-patterns}/utils.js +3 -3
  159. package/build-module/components/page-patterns/utils.js.map +1 -0
  160. package/build-module/components/page-template-parts/index.js +82 -0
  161. package/build-module/components/page-template-parts/index.js.map +1 -0
  162. package/build-module/components/page-templates/index.js +1 -0
  163. package/build-module/components/page-templates/index.js.map +1 -1
  164. package/build-module/components/sidebar/index.js +5 -5
  165. package/build-module/components/sidebar/index.js.map +1 -1
  166. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +5 -2
  167. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
  168. package/build-module/components/sidebar-edit-mode/settings-header/index.js +6 -1
  169. package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
  170. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +62 -11
  171. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  172. package/build-module/components/sidebar-navigation-screen-main/index.js +5 -4
  173. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  174. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +33 -0
  175. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
  176. package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -9
  177. package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
  178. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +2 -4
  179. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  180. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +6 -3
  181. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  182. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +15 -5
  183. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  184. package/build-module/components/sidebar-navigation-screen-page/status-label.js +1 -1
  185. package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  186. package/build-module/components/sidebar-navigation-screen-pages/index.js +2 -2
  187. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  188. package/build-module/components/sidebar-navigation-screen-pattern/index.js +12 -7
  189. package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  190. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +23 -2
  191. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  192. package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +3 -3
  193. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
  194. package/build-module/components/sidebar-navigation-screen-patterns/index.js +152 -0
  195. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
  196. package/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
  197. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +20 -0
  198. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
  199. package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +2 -17
  200. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
  201. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +43 -0
  202. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
  203. package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
  204. package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
  205. package/build-module/components/sidebar-navigation-screen-templates/index.js +12 -62
  206. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  207. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
  208. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  209. package/build-module/components/site-hub/index.js +1 -1
  210. package/build-module/components/site-hub/index.js.map +1 -1
  211. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
  212. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  213. package/build-module/components/template-actions/index.js +24 -7
  214. package/build-module/components/template-actions/index.js.map +1 -1
  215. package/build-module/components/welcome-guide/editor.js +1 -1
  216. package/build-module/components/welcome-guide/editor.js.map +1 -1
  217. package/build-module/components/welcome-guide/index.js +3 -1
  218. package/build-module/components/welcome-guide/index.js.map +1 -1
  219. package/build-module/components/welcome-guide/page.js +59 -0
  220. package/build-module/components/welcome-guide/page.js.map +1 -0
  221. package/build-module/components/welcome-guide/styles.js +1 -1
  222. package/build-module/components/welcome-guide/styles.js.map +1 -1
  223. package/build-module/components/welcome-guide/template.js +60 -0
  224. package/build-module/components/welcome-guide/template.js.map +1 -0
  225. package/build-module/hooks/commands/use-common-commands.js +16 -2
  226. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  227. package/build-module/hooks/commands/use-edit-mode-commands.js +3 -3
  228. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  229. package/build-module/index.js +2 -0
  230. package/build-module/index.js.map +1 -1
  231. package/build-module/store/actions.js +5 -2
  232. package/build-module/store/actions.js.map +1 -1
  233. package/build-module/store/private-actions.js +7 -1
  234. package/build-module/store/private-actions.js.map +1 -1
  235. package/build-module/utils/get-is-list-page.js +2 -2
  236. package/build-module/utils/get-is-list-page.js.map +1 -1
  237. package/build-style/style-rtl.css +90 -32
  238. package/build-style/style.css +90 -32
  239. package/package.json +19 -19
  240. package/src/components/add-new-template/new-template.js +2 -2
  241. package/src/components/block-editor/editor-canvas.js +3 -1
  242. package/src/components/block-editor/use-site-editor-settings.js +8 -4
  243. package/src/components/create-pattern-modal/index.js +10 -11
  244. package/src/components/global-styles/palette.js +10 -9
  245. package/src/components/header-edit-mode/document-actions/index.js +9 -1
  246. package/src/components/header-edit-mode/document-actions/style.scss +8 -0
  247. package/src/components/header-edit-mode/index.js +17 -9
  248. package/src/components/layout/index.js +1 -1
  249. package/src/components/layout/style.scss +0 -11
  250. package/src/components/page/header.js +1 -1
  251. package/src/components/page/index.js +5 -1
  252. package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +12 -3
  253. package/src/components/page-main/index.js +6 -3
  254. package/src/components/{page-library → page-patterns}/grid-item.js +79 -24
  255. package/src/components/{page-library → page-patterns}/grid.js +1 -1
  256. package/src/components/{page-library → page-patterns}/index.js +5 -5
  257. package/src/components/{page-library → page-patterns}/no-patterns.js +1 -1
  258. package/src/components/{page-library → page-patterns}/patterns-list.js +9 -9
  259. package/src/components/{page-library → page-patterns}/style.scss +16 -12
  260. package/src/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +1 -1
  261. package/src/components/{page-library → page-patterns}/use-patterns.js +5 -2
  262. package/src/components/{page-library → page-patterns}/utils.js +3 -3
  263. package/src/components/page-template-parts/index.js +105 -0
  264. package/src/components/page-templates/index.js +1 -1
  265. package/src/components/sidebar/index.js +6 -6
  266. package/src/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
  267. package/src/components/sidebar-edit-mode/settings-header/index.js +7 -2
  268. package/src/components/sidebar-navigation-screen/style.scss +19 -1
  269. package/src/components/sidebar-navigation-screen-global-styles/index.js +54 -26
  270. package/src/components/sidebar-navigation-screen-main/index.js +44 -40
  271. package/src/components/sidebar-navigation-screen-main/template-part-hint.js +36 -0
  272. package/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js +8 -11
  273. package/src/components/sidebar-navigation-screen-navigation-menu/index.js +2 -6
  274. package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +10 -6
  275. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +12 -4
  276. package/src/components/sidebar-navigation-screen-page/status-label.js +1 -1
  277. package/src/components/sidebar-navigation-screen-pages/index.js +2 -2
  278. package/src/components/sidebar-navigation-screen-pattern/index.js +13 -6
  279. package/src/components/sidebar-navigation-screen-pattern/style.scss +4 -0
  280. package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +45 -3
  281. package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +3 -3
  282. package/src/components/sidebar-navigation-screen-patterns/index.js +199 -0
  283. package/src/components/sidebar-navigation-screen-patterns/style.scss +28 -0
  284. package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +23 -0
  285. package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +1 -18
  286. package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +55 -0
  287. package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
  288. package/src/components/sidebar-navigation-screen-templates/index.js +15 -82
  289. package/src/components/sidebar-navigation-screen-templates-browse/index.js +2 -0
  290. package/src/components/site-hub/index.js +1 -1
  291. package/src/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
  292. package/src/components/template-actions/index.js +38 -8
  293. package/src/components/welcome-guide/editor.js +1 -1
  294. package/src/components/welcome-guide/index.js +4 -0
  295. package/src/components/welcome-guide/page.js +75 -0
  296. package/src/components/welcome-guide/style.scss +15 -1
  297. package/src/components/welcome-guide/styles.js +1 -1
  298. package/src/components/welcome-guide/template.js +82 -0
  299. package/src/hooks/commands/use-common-commands.js +13 -1
  300. package/src/hooks/commands/use-edit-mode-commands.js +5 -2
  301. package/src/index.js +2 -0
  302. package/src/store/actions.js +8 -1
  303. package/src/store/private-actions.js +5 -1
  304. package/src/style.scss +2 -2
  305. package/src/utils/get-is-list-page.js +4 -3
  306. package/build/components/page-content-focus-manager/constants.js +0 -9
  307. package/build/components/page-content-focus-manager/constants.js.map +0 -1
  308. package/build/components/page-library/grid-item.js.map +0 -1
  309. package/build/components/page-library/grid.js.map +0 -1
  310. package/build/components/page-library/index.js.map +0 -1
  311. package/build/components/page-library/no-patterns.js.map +0 -1
  312. package/build/components/page-library/patterns-list.js.map +0 -1
  313. package/build/components/page-library/search-items.js.map +0 -1
  314. package/build/components/page-library/use-library-settings.js.map +0 -1
  315. package/build/components/page-library/use-patterns.js.map +0 -1
  316. package/build/components/page-library/utils.js.map +0 -1
  317. package/build/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
  318. package/build/components/sidebar-navigation-screen-library/index.js +0 -112
  319. package/build/components/sidebar-navigation-screen-library/index.js.map +0 -1
  320. package/build/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
  321. package/build/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
  322. package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js +0 -41
  323. package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
  324. package/build/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
  325. package/build-module/components/page-content-focus-manager/constants.js +0 -2
  326. package/build-module/components/page-content-focus-manager/constants.js.map +0 -1
  327. package/build-module/components/page-library/grid-item.js.map +0 -1
  328. package/build-module/components/page-library/grid.js.map +0 -1
  329. package/build-module/components/page-library/index.js.map +0 -1
  330. package/build-module/components/page-library/no-patterns.js.map +0 -1
  331. package/build-module/components/page-library/patterns-list.js.map +0 -1
  332. package/build-module/components/page-library/search-items.js.map +0 -1
  333. package/build-module/components/page-library/use-library-settings.js.map +0 -1
  334. package/build-module/components/page-library/use-patterns.js.map +0 -1
  335. package/build-module/components/page-library/utils.js.map +0 -1
  336. package/build-module/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
  337. package/build-module/components/sidebar-navigation-screen-library/index.js +0 -87
  338. package/build-module/components/sidebar-navigation-screen-library/index.js.map +0 -1
  339. package/build-module/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
  340. package/build-module/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
  341. package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js +0 -34
  342. package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
  343. package/build-module/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
  344. package/src/components/page-content-focus-manager/constants.js +0 -5
  345. package/src/components/sidebar-navigation-screen-library/index.js +0 -136
  346. package/src/components/sidebar-navigation-screen-library/style.scss +0 -3
  347. package/src/components/sidebar-navigation-screen-library/use-template-part-areas.js +0 -33
  348. /package/build/components/{page-library → page-patterns}/search-items.js +0 -0
  349. /package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
  350. /package/build-module/components/{page-library → page-patterns}/search-items.js +0 -0
  351. /package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
  352. /package/src/components/{page-library → page-patterns}/search-items.js +0 -0
  353. /package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
@@ -0,0 +1,60 @@
1
+ import { createElement, Fragment } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { useDispatch, useSelect } from '@wordpress/data';
7
+ import { Guide } from '@wordpress/components';
8
+ import { __ } from '@wordpress/i18n';
9
+ import { store as preferencesStore } from '@wordpress/preferences';
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+
14
+ import { store as editSiteStore } from '../../store';
15
+ export default function WelcomeGuideTemplate() {
16
+ const {
17
+ toggle
18
+ } = useDispatch(preferencesStore);
19
+ const isVisible = useSelect(select => {
20
+ const isTemplateActive = !!select(preferencesStore).get('core/edit-site', 'welcomeGuideTemplate');
21
+ const isEditorActive = !!select(preferencesStore).get('core/edit-site', 'welcomeGuide');
22
+ const {
23
+ isPage,
24
+ hasPageContentFocus
25
+ } = select(editSiteStore);
26
+ return isTemplateActive && !isEditorActive && isPage() && !hasPageContentFocus();
27
+ }, []);
28
+
29
+ if (!isVisible) {
30
+ return null;
31
+ }
32
+
33
+ const heading = __('Editing a template');
34
+
35
+ return createElement(Guide, {
36
+ className: "edit-site-welcome-guide guide-template",
37
+ contentLabel: heading,
38
+ finishButtonText: __('Continue'),
39
+ onFinish: () => toggle('core/edit-site', 'welcomeGuideTemplate'),
40
+ pages: [{
41
+ image: createElement("video", {
42
+ className: "edit-site-welcome-guide__video",
43
+ autoPlay: true,
44
+ loop: true,
45
+ muted: true,
46
+ width: "312",
47
+ height: "240"
48
+ }, createElement("source", {
49
+ src: "https://s.w.org/images/block-editor/editing-your-template.mp4",
50
+ type: "video/mp4"
51
+ })),
52
+ content: createElement(Fragment, null, createElement("h1", {
53
+ className: "edit-site-welcome-guide__heading"
54
+ }, heading), createElement("p", {
55
+ className: "edit-site-welcome-guide__text"
56
+ }, __('Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the ‘Back’ button in the toolbar.')))
57
+ }]
58
+ });
59
+ }
60
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/template.js"],"names":["useDispatch","useSelect","Guide","__","store","preferencesStore","editSiteStore","WelcomeGuideTemplate","toggle","isVisible","select","isTemplateActive","get","isEditorActive","isPage","hasPageContentFocus","heading","image","content"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAT,QAAsB,uBAAtB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,oBAAT,GAAgC;AAC9C,QAAM;AAAEC,IAAAA;AAAF,MAAaR,WAAW,CAAEK,gBAAF,CAA9B;AAEA,QAAMI,SAAS,GAAGR,SAAS,CAAIS,MAAF,IAAc;AAC1C,UAAMC,gBAAgB,GAAG,CAAC,CAAED,MAAM,CAAEL,gBAAF,CAAN,CAA2BO,GAA3B,CAC3B,gBAD2B,EAE3B,sBAF2B,CAA5B;AAIA,UAAMC,cAAc,GAAG,CAAC,CAAEH,MAAM,CAAEL,gBAAF,CAAN,CAA2BO,GAA3B,CACzB,gBADyB,EAEzB,cAFyB,CAA1B;AAIA,UAAM;AAAEE,MAAAA,MAAF;AAAUC,MAAAA;AAAV,QAAkCL,MAAM,CAAEJ,aAAF,CAA9C;AACA,WACCK,gBAAgB,IAChB,CAAEE,cADF,IAEAC,MAAM,EAFN,IAGA,CAAEC,mBAAmB,EAJtB;AAMA,GAhB0B,EAgBxB,EAhBwB,CAA3B;;AAkBA,MAAK,CAAEN,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,QAAMO,OAAO,GAAGb,EAAE,CAAE,oBAAF,CAAlB;;AAEA,SACC,cAAC,KAAD;AACC,IAAA,SAAS,EAAC,wCADX;AAEC,IAAA,YAAY,EAAGa,OAFhB;AAGC,IAAA,gBAAgB,EAAGb,EAAE,CAAE,UAAF,CAHtB;AAIC,IAAA,QAAQ,EAAG,MACVK,MAAM,CAAE,gBAAF,EAAoB,sBAApB,CALR;AAOC,IAAA,KAAK,EAAG,CACP;AACCS,MAAAA,KAAK,EACJ;AACC,QAAA,SAAS,EAAC,gCADX;AAEC,QAAA,QAAQ,MAFT;AAGC,QAAA,IAAI,MAHL;AAIC,QAAA,KAAK,MAJN;AAKC,QAAA,KAAK,EAAC,KALP;AAMC,QAAA,MAAM,EAAC;AANR,SAQC;AACC,QAAA,GAAG,EAAC,+DADL;AAEC,QAAA,IAAI,EAAC;AAFN,QARD,CAFF;AAgBCC,MAAAA,OAAO,EACN,8BACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACGF,OADH,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACGb,EAAE,CACH,4MADG,CADL,CAJD;AAjBF,KADO;AAPT,IADD;AAyCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Guide } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function WelcomeGuideTemplate() {\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst isVisible = useSelect( ( select ) => {\n\t\tconst isTemplateActive = !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\t'welcomeGuideTemplate'\n\t\t);\n\t\tconst isEditorActive = !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\t'welcomeGuide'\n\t\t);\n\t\tconst { isPage, hasPageContentFocus } = select( editSiteStore );\n\t\treturn (\n\t\t\tisTemplateActive &&\n\t\t\t! isEditorActive &&\n\t\t\tisPage() &&\n\t\t\t! hasPageContentFocus()\n\t\t);\n\t}, [] );\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\tconst heading = __( 'Editing a template' );\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-site-welcome-guide guide-template\"\n\t\t\tcontentLabel={ heading }\n\t\t\tfinishButtonText={ __( 'Continue' ) }\n\t\t\tonFinish={ () =>\n\t\t\t\ttoggle( 'core/edit-site', 'welcomeGuideTemplate' )\n\t\t\t}\n\t\t\tpages={ [\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<video\n\t\t\t\t\t\t\tclassName=\"edit-site-welcome-guide__video\"\n\t\t\t\t\t\t\tautoPlay\n\t\t\t\t\t\t\tloop\n\t\t\t\t\t\t\tmuted\n\t\t\t\t\t\t\twidth=\"312\"\n\t\t\t\t\t\t\theight=\"240\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<source\n\t\t\t\t\t\t\t\tsrc=\"https://s.w.org/images/block-editor/editing-your-template.mp4\"\n\t\t\t\t\t\t\t\ttype=\"video/mp4\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</video>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ heading }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the ‘Back’ button in the toolbar.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t] }\n\t\t/>\n\t);\n}\n"]}
@@ -10,6 +10,7 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
10
10
  import { privateApis as routerPrivateApis } from '@wordpress/router';
11
11
  import { store as preferencesStore } from '@wordpress/preferences';
12
12
  import { store as coreStore } from '@wordpress/core-data';
13
+ import { store as noticesStore } from '@wordpress/notices';
13
14
  /**
14
15
  * Internal dependencies
15
16
  */
@@ -107,16 +108,21 @@ export function useCommonCommands() {
107
108
  const {
108
109
  set
109
110
  } = useDispatch(preferencesStore);
111
+ const {
112
+ createInfoNotice
113
+ } = useDispatch(noticesStore);
110
114
  const history = useHistory();
111
115
  const {
112
- homeUrl
116
+ homeUrl,
117
+ isDistractionFree
113
118
  } = useSelect(select => {
114
119
  const {
115
120
  getUnstableBase // Site index.
116
121
 
117
122
  } = select(coreStore);
118
123
  return {
119
- homeUrl: getUnstableBase()?.home
124
+ homeUrl: getUnstableBase()?.home,
125
+ isDistractionFree: select(preferencesStore).get(editSiteStore.name, 'distractionFree')
120
126
  };
121
127
  }, []);
122
128
  useCommand({
@@ -146,6 +152,14 @@ export function useCommonCommands() {
146
152
  path: '/wp_global_styles',
147
153
  canvas: 'edit'
148
154
  });
155
+
156
+ if (isDistractionFree) {
157
+ set(editSiteStore.name, 'distractionFree', false);
158
+ createInfoNotice(__('Distraction free mode turned off.'), {
159
+ type: 'snackbar'
160
+ });
161
+ }
162
+
149
163
  openGeneralSidebar('edit-site/global-styles');
150
164
  },
151
165
  icon: styles
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/hooks/commands/use-common-commands.js"],"names":["useMemo","useDispatch","useSelect","__","trash","backup","help","styles","external","useCommandLoader","useCommand","privateApis","blockEditorPrivateApis","routerPrivateApis","store","preferencesStore","coreStore","unlock","editSiteStore","useGlobalStylesReset","useHistory","useGlobalStylesResetCommands","canReset","onReset","commands","name","label","icon","callback","close","isLoading","useGlobalStylesOpenCssCommands","openGeneralSidebar","setEditorCanvasContainerView","history","canEditCSS","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","push","path","canvas","useCommonCommands","set","homeUrl","getUnstableBase","home","setTimeout","window","open","hook"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAT,EAAgBC,MAAhB,EAAwBC,IAAxB,EAA8BC,MAA9B,EAAsCC,QAAtC,QAAsD,kBAAtD;AACA,SAASC,gBAAT,EAA2BC,UAA3B,QAA6C,qBAA7C;AACA,SAASC,WAAW,IAAIC,sBAAxB,QAAsD,yBAAtD;AACA,SAASD,WAAW,IAAIE,iBAAxB,QAAiD,mBAAjD;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,mBAAvB;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,aAAvC;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAA2BF,MAAM,CAAEL,sBAAF,CAAvC;AACA,MAAM;AAAEQ,EAAAA;AAAF,IAAiBH,MAAM,CAAEJ,iBAAF,CAA7B;;AAEA,SAASQ,4BAAT,GAAwC;AACvC,QAAM,CAAEC,QAAF,EAAYC,OAAZ,IAAwBJ,oBAAoB,EAAlD;AACA,QAAMK,QAAQ,GAAGxB,OAAO,CAAE,MAAM;AAC/B,Q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EAA0C,IAA1C,CAAH;AACA,OAFS,EAEP,GAFO,CAAV;AAGA,KAhBU;AAiBXpB,IAAAA,IAAI,EAAErB;AAjBK,GAAF,CAAV;AAoBAI,EAAAA,UAAU,CAAE;AACXe,IAAAA,IAAI,EAAE,0BADK;AAEXC,IAAAA,KAAK,EAAEvB,EAAE,CAAE,WAAF,CAFE;AAGXyB,IAAAA,QAAQ,EAAE,CAAE;AAAEC,MAAAA;AAAF,KAAF,KAAiB;AAC1BA,MAAAA,KAAK;AACLuB,MAAAA,MAAM,CAACC,IAAP,CAAaL,OAAb,EAAsB,QAAtB;AACA,KANU;AAOXrB,IAAAA,IAAI,EAAEnB;AAPK,GAAF,CAAV;AAUAC,EAAAA,gBAAgB,CAAE;AACjBgB,IAAAA,IAAI,EAAE,oCADW;AAEjB6B,IAAAA,IAAI,EAAEjC;AAFW,GAAF,CAAhB;AAKAZ,EAAAA,gBAAgB,CAAE;AACjBgB,IAAAA,IAAI,EAAE,gCADW;AAEjB6B,IAAAA,IAAI,EAAEvB;AAFW,GAAF,CAAhB;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { trash, backup, help, styles, external } from '@wordpress/icons';\nimport { useCommandLoader, useCommand } from '@wordpress/commands';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\nconst { useGlobalStylesReset } = unlock( blockEditorPrivateApis );\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction useGlobalStylesResetCommands() {\n\tconst [ canReset, onReset ] = useGlobalStylesReset();\n\tconst commands = useMemo( () => {\n\t\tif ( ! canReset ) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tname: 'core/edit-site/reset-global-styles',\n\t\t\t\tlabel: __( 'Reset styles to defaults' ),\n\t\t\t\ticon: trash,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\tclose();\n\t\t\t\t\tonReset();\n\t\t\t\t},\n\t\t\t},\n\t\t];\n\t}, [ canReset, onReset ] );\n\n\treturn {\n\t\tisLoading: false,\n\t\tcommands,\n\t};\n}\n\nfunction useGlobalStylesOpenCssCommands() {\n\tconst { openGeneralSidebar, setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst history = useHistory();\n\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanEditCSS:\n\t\t\t\t!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,\n\t\t};\n\t}, [] );\n\n\tconst commands = useMemo( () => {\n\t\tif ( ! canEditCSS ) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tname: 'core/edit-site/open-styles-css',\n\t\t\t\tlabel: __( 'Open CSS' ),\n\t\t\t\ticon: styles,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\tclose();\n\t\t\t\t\thistory.push( {\n\t\t\t\t\t\tpath: '/wp_global_styles',\n\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t} );\n\t\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t\t\tsetEditorCanvasContainerView( 'global-styles-css' );\n\t\t\t\t},\n\t\t\t},\n\t\t];\n\t}, [\n\t\thistory,\n\t\topenGeneralSidebar,\n\t\tsetEditorCanvasContainerView,\n\t\tcanEditCSS,\n\t] );\n\treturn {\n\t\tisLoading: false,\n\t\tcommands,\n\t};\n}\n\nexport function useCommonCommands() {\n\tconst { openGeneralSidebar, setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { set } = useDispatch( preferencesStore );\n\tconst history = useHistory();\n\tconst { homeUrl } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetUnstableBase, // Site index.\n\t\t} = select( coreStore );\n\n\t\treturn {\n\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t};\n\t}, [] );\n\n\tuseCommand( {\n\t\tname: 'core/edit-site/open-global-styles-revisions',\n\t\tlabel: __( 'Open styles revisions' ),\n\t\ticon: backup,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\thistory.push( {\n\t\t\t\tpath: '/wp_global_styles',\n\t\t\t\tcanvas: 'edit',\n\t\t\t} );\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/edit-site/open-styles',\n\t\tlabel: __( 'Open styles' ),\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\thistory.push( {\n\t\t\t\tpath: '/wp_global_styles',\n\t\t\t\tcanvas: 'edit',\n\t\t\t} );\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t},\n\t\ticon: styles,\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/edit-site/toggle-styles-welcome-guide',\n\t\tlabel: __( 'Learn about styles' ),\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\thistory.push( {\n\t\t\t\tpath: '/wp_global_styles',\n\t\t\t\tcanvas: 'edit',\n\t\t\t} );\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\tset( 'core/edit-site', 'welcomeGuideStyles', true );\n\t\t\t// sometimes there's a focus loss that happens after some time\n\t\t\t// that closes the modal, we need to force reopening it.\n\t\t\tsetTimeout( () => {\n\t\t\t\tset( 'core/edit-site', 'welcomeGuideStyles', true );\n\t\t\t}, 500 );\n\t\t},\n\t\ticon: help,\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/edit-site/view-site',\n\t\tlabel: __( 'View site' ),\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\twindow.open( homeUrl, '_blank' );\n\t\t},\n\t\ticon: external,\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/reset-global-styles',\n\t\thook: useGlobalStylesResetCommands,\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/open-styles-css',\n\t\thook: useGlobalStylesOpenCssCommands,\n\t} );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/hooks/commands/use-common-commands.js"],"names":["useMemo","useDispatch","useSelect","__","trash","backup","help","styles","external","useCommandLoader","useCommand","privateApis","blockEditorPrivateApis","routerPrivateApis","store","preferencesStore","coreStore","noticesStore","unlock","editSiteStore","useGlobalStylesReset","useHistory","useGlobalStylesResetCommands","canReset","onReset","commands","name","label","icon","callback","close","isLoading","useGlobalStylesOpenCssCommands","openGeneralSidebar","setEditorCanvasContainerView","history","canEditCSS","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","push","path","canvas","useCommonCommands","set","createInfoNotice","homeUrl","isDistractionFree","getUnstableBase","home","get","type","setTimeout","window","open","hook"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAT,EAAgBC,MAAhB,EAAwBC,IAAxB,EAA8BC,MAA9B,EAAsCC,QAAtC,QAAsD,kBAAtD;AACA,SAASC,gBAAT,EAA2BC,UAA3B,QAA6C,qBAA7C;AACA,SAASC,WAAW,IAAI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ExB,EAAE,CAAE,WAAF,CAFE;AAGX0B,IAAAA,QAAQ,EAAE,CAAE;AAAEC,MAAAA;AAAF,KAAF,KAAiB;AAC1BA,MAAAA,KAAK;AACL2B,MAAAA,MAAM,CAACC,IAAP,CAAaR,OAAb,EAAsB,QAAtB;AACA,KANU;AAOXtB,IAAAA,IAAI,EAAEpB;AAPK,GAAF,CAAV;AAUAC,EAAAA,gBAAgB,CAAE;AACjBiB,IAAAA,IAAI,EAAE,oCADW;AAEjBiC,IAAAA,IAAI,EAAErC;AAFW,GAAF,CAAhB;AAKAb,EAAAA,gBAAgB,CAAE;AACjBiB,IAAAA,IAAI,EAAE,gCADW;AAEjBiC,IAAAA,IAAI,EAAE3B;AAFW,GAAF,CAAhB;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { trash, backup, help, styles, external } from '@wordpress/icons';\nimport { useCommandLoader, useCommand } from '@wordpress/commands';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\nconst { useGlobalStylesReset } = unlock( blockEditorPrivateApis );\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction useGlobalStylesResetCommands() {\n\tconst [ canReset, onReset ] = useGlobalStylesReset();\n\tconst commands = useMemo( () => {\n\t\tif ( ! canReset ) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tname: 'core/edit-site/reset-global-styles',\n\t\t\t\tlabel: __( 'Reset styles to defaults' ),\n\t\t\t\ticon: trash,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\tclose();\n\t\t\t\t\tonReset();\n\t\t\t\t},\n\t\t\t},\n\t\t];\n\t}, [ canReset, onReset ] );\n\n\treturn {\n\t\tisLoading: false,\n\t\tcommands,\n\t};\n}\n\nfunction useGlobalStylesOpenCssCommands() {\n\tconst { openGeneralSidebar, setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst history = useHistory();\n\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanEditCSS:\n\t\t\t\t!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,\n\t\t};\n\t}, [] );\n\n\tconst commands = useMemo( () => {\n\t\tif ( ! canEditCSS ) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tname: 'core/edit-site/open-styles-css',\n\t\t\t\tlabel: __( 'Open CSS' ),\n\t\t\t\ticon: styles,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\tclose();\n\t\t\t\t\thistory.push( {\n\t\t\t\t\t\tpath: '/wp_global_styles',\n\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t} );\n\t\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t\t\tsetEditorCanvasContainerView( 'global-styles-css' );\n\t\t\t\t},\n\t\t\t},\n\t\t];\n\t}, [\n\t\thistory,\n\t\topenGeneralSidebar,\n\t\tsetEditorCanvasContainerView,\n\t\tcanEditCSS,\n\t] );\n\treturn {\n\t\tisLoading: false,\n\t\tcommands,\n\t};\n}\n\nexport function useCommonCommands() {\n\tconst { openGeneralSidebar, setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { set } = useDispatch( preferencesStore );\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\tconst history = useHistory();\n\tconst { homeUrl, isDistractionFree } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetUnstableBase, // Site index.\n\t\t} = select( coreStore );\n\n\t\treturn {\n\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t\tisDistractionFree: select( preferencesStore ).get(\n\t\t\t\teditSiteStore.name,\n\t\t\t\t'distractionFree'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tuseCommand( {\n\t\tname: 'core/edit-site/open-global-styles-revisions',\n\t\tlabel: __( 'Open styles revisions' ),\n\t\ticon: backup,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\thistory.push( {\n\t\t\t\tpath: '/wp_global_styles',\n\t\t\t\tcanvas: 'edit',\n\t\t\t} );\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/edit-site/open-styles',\n\t\tlabel: __( 'Open styles' ),\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\thistory.push( {\n\t\t\t\tpath: '/wp_global_styles',\n\t\t\t\tcanvas: 'edit',\n\t\t\t} );\n\t\t\tif ( isDistractionFree ) {\n\t\t\t\tset( editSiteStore.name, 'distractionFree', false );\n\t\t\t\tcreateInfoNotice( __( 'Distraction free mode turned off.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t}\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t},\n\t\ticon: styles,\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/edit-site/toggle-styles-welcome-guide',\n\t\tlabel: __( 'Learn about styles' ),\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\thistory.push( {\n\t\t\t\tpath: '/wp_global_styles',\n\t\t\t\tcanvas: 'edit',\n\t\t\t} );\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\tset( 'core/edit-site', 'welcomeGuideStyles', true );\n\t\t\t// sometimes there's a focus loss that happens after some time\n\t\t\t// that closes the modal, we need to force reopening it.\n\t\t\tsetTimeout( () => {\n\t\t\t\tset( 'core/edit-site', 'welcomeGuideStyles', true );\n\t\t\t}, 500 );\n\t\t},\n\t\ticon: help,\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/edit-site/view-site',\n\t\tlabel: __( 'View site' ),\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\twindow.open( homeUrl, '_blank' );\n\t\t},\n\t\ticon: external,\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/reset-global-styles',\n\t\thook: useGlobalStylesResetCommands,\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/open-styles-css',\n\t\thook: useGlobalStylesOpenCssCommands,\n\t} );\n}\n"]}
@@ -116,6 +116,7 @@ function useManipulateDocumentCommands() {
116
116
 
117
117
  if (isTemplateRemovable(template) && !hasPageContentFocus) {
118
118
  const label = template.type === 'wp_template' ? __('Delete template') : __('Delete template part');
119
+ const path = template.type === 'wp_template' ? '/wp_template' : '/wp_template_part/all';
119
120
  commands.push({
120
121
  name: 'core/remove-template',
121
122
  label,
@@ -126,7 +127,7 @@ function useManipulateDocumentCommands() {
126
127
  removeTemplate(template); // Navigate to the template list
127
128
 
128
129
  history.push({
129
- path: '/' + template.type
130
+ path
130
131
  });
131
132
  close();
132
133
  }
@@ -264,8 +265,7 @@ export function useEditModeCommands() {
264
265
  });
265
266
  useCommandLoader({
266
267
  name: 'core/edit-site/manipulate-document',
267
- hook: useManipulateDocumentCommands,
268
- context: 'site-editor-edit'
268
+ hook: useManipulateDocumentCommands
269
269
  });
270
270
  useCommandLoader({
271
271
  name: 'core/edit-site/edit-ui',
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/hooks/commands/use-edit-mode-commands.js"],"names":["useSelect","useDispatch","__","isRTL","trash","backup","layout","page","drawerLeft","drawerRight","blockDefault","cog","code","keyboardClose","useCommandLoader","privateApis","routerPrivateApis","store","preferencesStore","interfaceStore","editSiteStore","useEditedEntityRecord","isTemplateRemovable","isTemplateRevertable","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","PREFERENCES_MODAL_NAME","unlock","useHistory","usePageContentFocusCommands","isPage","canvasMode","hasPageContentFocus","select","getCanvasMode","setHasPageContentFocus","isLoading","commands","push","name","label","icon","callback","close","useManipulateDocumentCommands","isLoaded","record","template","removeTemplate","revertTemplate","history","type","path","useEditUICommands","openGeneralSidebar","closeGeneralSidebar","switchEditorMode","editorMode","activeSidebar","getEditorMode","getActiveComplementaryArea","openModal","toggle","useEditModeCommands","hook","context"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,EAAaC,KAAb,QAA0B,iBAA1B;AACA,SACCC,KADD,EAECC,MAFD,EAGCC,MAHD,EAICC,IAJD,EAKCC,UALD,EAMCC,WAND,EAOCC,YAPD,EAQCC,GARD,EASCC,IATD,EAUCC,aAVD,QAWO,kBAXP;AAYA,SAASC,gBAAT,QAAiC,qBAAjC;AACA,SAASC,WAAW,IAAIC,iBAAxB,QAAiD,mBAAjD;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AACA,SAASD,KAAK,IAAIE,cAAlB,QAAwC,sBAAxC;AAEA;AACA;AACA;;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,aAAvC;AACA,OAAOC,qBAAP,MAAkC,2CAAlC;AACA,OAAOC,mBAAP,MAAgC,mCAAhC;AACA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,SAASC,iCAAT,QAAkD,+CAAlD;AACA,SAASC,sBAAT,QAAuC,oCAAvC;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAA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ADQ;AAEdC,IAAAA,KAAK,EAAErC,EAAE,CAAE,yBAAF,CAFK;AAGdsC,IAAAA,IAAI,EAAE3B,aAHQ;AAId4B,IAAAA,QAAQ,EAAE,MAAM;AACfmB,MAAAA,SAAS,CAAEpC,iCAAF,CAAT;AACA;AANa,GAAf;AASA,SAAO;AACNW,IAAAA,SAAS,EAAE,KADL;AAENC,IAAAA;AAFM,GAAP;AAIA;;AAED,OAAO,SAAS0B,mBAAT,GAA+B;AACrChD,EAAAA,gBAAgB,CAAE;AACjBwB,IAAAA,IAAI,EAAE,mCADW;AAEjByB,IAAAA,IAAI,EAAEnC,2BAFW;AAGjBoC,IAAAA,OAAO,EAAE;AAHQ,GAAF,CAAhB;AAMAlD,EAAAA,gBAAgB,CAAE;AACjBwB,IAAAA,IAAI,EAAE,oCADW;AAEjByB,IAAAA,IAAI,EAAEpB,6BAFW;AAGjBqB,IAAAA,OAAO,EAAE;AAHQ,GAAF,CAAhB;AAMAlD,EAAAA,gBAAgB,CAAE;AACjBwB,IAAAA,IAAI,EAAE,wBADW;AAEjByB,IAAAA,IAAI,EAAEX;AAFW,GAAF,CAAhB;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\ttrash,\n\tbackup,\n\tlayout,\n\tpage,\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tcog,\n\tcode,\n\tkeyboardClose,\n} from '@wordpress/icons';\nimport { useCommandLoader } from '@wordpress/commands';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport useEditedEntityRecord from '../../components/use-edited-entity-record';\nimport isTemplateRemovable from '../../utils/is-template-removable';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction usePageContentFocusCommands() {\n\tconst { isPage, canvasMode, hasPageContentFocus } = useSelect(\n\t\t( select ) => ( {\n\t\t\tisPage: select( editSiteStore ).isPage(),\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\thasPageContentFocus: select( editSiteStore ).hasPageContentFocus(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { setHasPageContentFocus } = useDispatch( editSiteStore );\n\n\tif ( ! isPage || canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( hasPageContentFocus ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-template-focus',\n\t\t\tlabel: __( 'Edit template' ),\n\t\t\ticon: layout,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetHasPageContentFocus( false );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t} else {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-page-focus',\n\t\t\tlabel: __( 'Back to page' ),\n\t\t\ticon: page,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetHasPageContentFocus( true );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nfunction useManipulateDocumentCommands() {\n\tconst { isLoaded, record: template } = useEditedEntityRecord();\n\tconst { removeTemplate, revertTemplate } = useDispatch( editSiteStore );\n\tconst history = useHistory();\n\tconst hasPageContentFocus = useSelect(\n\t\t( select ) => select( editSiteStore ).hasPageContentFocus(),\n\t\t[]\n\t);\n\n\tif ( ! isLoaded ) {\n\t\treturn { isLoading: true, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( isTemplateRevertable( template ) && ! hasPageContentFocus ) {\n\t\tconst label =\n\t\t\ttemplate.type === 'wp_template'\n\t\t\t\t? __( 'Reset template' )\n\t\t\t\t: __( 'Reset template part' );\n\t\tcommands.push( {\n\t\t\tname: 'core/reset-template',\n\t\t\tlabel,\n\t\t\ticon: backup,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\trevertTemplate( template );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\tif ( isTemplateRemovable( template ) && ! hasPageContentFocus ) {\n\t\tconst label =\n\t\t\ttemplate.type === 'wp_template'\n\t\t\t\t? __( 'Delete template' )\n\t\t\t\t: __( 'Delete template part' );\n\t\tcommands.push( {\n\t\t\tname: 'core/remove-template',\n\t\t\tlabel,\n\t\t\ticon: trash,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tremoveTemplate( template );\n\t\t\t\t// Navigate to the template list\n\t\t\t\thistory.push( {\n\t\t\t\t\tpath: '/' + template.type,\n\t\t\t\t} );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn {\n\t\tisLoading: ! isLoaded,\n\t\tcommands,\n\t};\n}\n\nfunction useEditUICommands() {\n\tconst { openGeneralSidebar, closeGeneralSidebar, switchEditorMode } =\n\t\tuseDispatch( editSiteStore );\n\tconst { canvasMode, editorMode, activeSidebar } = useSelect(\n\t\t( select ) => ( {\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\teditorMode: select( editSiteStore ).getEditorMode(),\n\t\t\tactiveSidebar: select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tif ( canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tcommands.push( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-site/template' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-site/template' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-site/block-inspector' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-site/block-inspector' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-spotlight-mode',\n\t\tlabel: __( 'Toggle spotlight mode' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-site', 'focusMode' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-top-toolbar',\n\t\tlabel: __( 'Toggle top toolbar' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-site', 'fixedToolbar' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-code-editor',\n\t\tlabel: __( 'Toggle code editor' ),\n\t\ticon: code,\n\t\tcallback: ( { close } ) => {\n\t\t\tswitchEditorMode( editorMode === 'visual' ? 'text' : 'visual' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Open editor preferences' ),\n\t\ticon: cog,\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Open keyboard shortcuts' ),\n\t\ticon: keyboardClose,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n\n\treturn {\n\t\tisLoading: false,\n\t\tcommands,\n\t};\n}\n\nexport function useEditModeCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/page-content-focus',\n\t\thook: usePageContentFocusCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/manipulate-document',\n\t\thook: useManipulateDocumentCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/edit-ui',\n\t\thook: useEditUICommands,\n\t} );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/hooks/commands/use-edit-mode-commands.js"],"names":["useSelect","useDispatch","__","isRTL","trash","backup","layout","page","drawerLeft","drawerRight","blockDefault","cog","code","keyboardClose","useCommandLoader","privateApis","routerPrivateApis","store","preferencesStore","interfaceStore","editSiteStore","useEditedEntityRecord","isTemplateRemovable","isTemplateRevertable","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","PREFERENCES_MODAL_NAME","unlock","useHistory","usePageContentFocusCommands","isPage","canvasMode","hasPageContentFocus","select","getCanvasMode","setHasPageContentFocus","isLoading","commands","push","name","label","icon","callback","close","useManipulateDocumentCommands","isLoaded","record","template","removeTemplate","revertTemplate","history","type","path","useEditUICommands","openGeneralSidebar","closeGeneralSidebar","switchEditorMode","editorMode","activeSidebar","getEditorMode","getActiveComplementaryArea","openModal","toggle","useEditModeCommands","hook","context"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,EAAaC,KAAb,QAA0B,iBAA1B;AACA,SACCC,KADD,EAECC,MAFD,EAGCC,MAHD,EAICC,IAJD,EAKCC,UALD,EAMCC,WAND,EAOCC,YAPD,EAQCC,GARD,EAS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hB;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\ttrash,\n\tbackup,\n\tlayout,\n\tpage,\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tcog,\n\tcode,\n\tkeyboardClose,\n} from '@wordpress/icons';\nimport { useCommandLoader } from '@wordpress/commands';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport useEditedEntityRecord from '../../components/use-edited-entity-record';\nimport isTemplateRemovable from '../../utils/is-template-removable';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction usePageContentFocusCommands() {\n\tconst { isPage, canvasMode, hasPageContentFocus } = useSelect(\n\t\t( select ) => ( {\n\t\t\tisPage: select( editSiteStore ).isPage(),\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\thasPageContentFocus: select( editSiteStore ).hasPageContentFocus(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { setHasPageContentFocus } = useDispatch( editSiteStore );\n\n\tif ( ! isPage || canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( hasPageContentFocus ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-template-focus',\n\t\t\tlabel: __( 'Edit template' ),\n\t\t\ticon: layout,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetHasPageContentFocus( false );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t} else {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-page-focus',\n\t\t\tlabel: __( 'Back to page' ),\n\t\t\ticon: page,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetHasPageContentFocus( true );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nfunction useManipulateDocumentCommands() {\n\tconst { isLoaded, record: template } = useEditedEntityRecord();\n\tconst { removeTemplate, revertTemplate } = useDispatch( editSiteStore );\n\tconst history = useHistory();\n\tconst hasPageContentFocus = useSelect(\n\t\t( select ) => select( editSiteStore ).hasPageContentFocus(),\n\t\t[]\n\t);\n\n\tif ( ! isLoaded ) {\n\t\treturn { isLoading: true, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( isTemplateRevertable( template ) && ! hasPageContentFocus ) {\n\t\tconst label =\n\t\t\ttemplate.type === 'wp_template'\n\t\t\t\t? __( 'Reset template' )\n\t\t\t\t: __( 'Reset template part' );\n\t\tcommands.push( {\n\t\t\tname: 'core/reset-template',\n\t\t\tlabel,\n\t\t\ticon: backup,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\trevertTemplate( template );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\tif ( isTemplateRemovable( template ) && ! hasPageContentFocus ) {\n\t\tconst label =\n\t\t\ttemplate.type === 'wp_template'\n\t\t\t\t? __( 'Delete template' )\n\t\t\t\t: __( 'Delete template part' );\n\t\tconst path =\n\t\t\ttemplate.type === 'wp_template'\n\t\t\t\t? '/wp_template'\n\t\t\t\t: '/wp_template_part/all';\n\t\tcommands.push( {\n\t\t\tname: 'core/remove-template',\n\t\t\tlabel,\n\t\t\ticon: trash,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tremoveTemplate( template );\n\t\t\t\t// Navigate to the template list\n\t\t\t\thistory.push( {\n\t\t\t\t\tpath,\n\t\t\t\t} );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn {\n\t\tisLoading: ! isLoaded,\n\t\tcommands,\n\t};\n}\n\nfunction useEditUICommands() {\n\tconst { openGeneralSidebar, closeGeneralSidebar, switchEditorMode } =\n\t\tuseDispatch( editSiteStore );\n\tconst { canvasMode, editorMode, activeSidebar } = useSelect(\n\t\t( select ) => ( {\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\teditorMode: select( editSiteStore ).getEditorMode(),\n\t\t\tactiveSidebar: select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tif ( canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tcommands.push( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-site/template' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-site/template' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-site/block-inspector' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-site/block-inspector' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-spotlight-mode',\n\t\tlabel: __( 'Toggle spotlight mode' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-site', 'focusMode' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-top-toolbar',\n\t\tlabel: __( 'Toggle top toolbar' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-site', 'fixedToolbar' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-code-editor',\n\t\tlabel: __( 'Toggle code editor' ),\n\t\ticon: code,\n\t\tcallback: ( { close } ) => {\n\t\t\tswitchEditorMode( editorMode === 'visual' ? 'text' : 'visual' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Open editor preferences' ),\n\t\ticon: cog,\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Open keyboard shortcuts' ),\n\t\ticon: keyboardClose,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n\n\treturn {\n\t\tisLoading: false,\n\t\tcommands,\n\t};\n}\n\nexport function useEditModeCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/page-content-focus',\n\t\thook: usePageContentFocusCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/manipulate-document',\n\t\thook: useManipulateDocumentCommands,\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/edit-ui',\n\t\thook: useEditUICommands,\n\t} );\n}\n"]}
@@ -66,6 +66,8 @@ export function initializeEditor(id, settings) {
66
66
  keepCaretInsideBlock: false,
67
67
  welcomeGuide: true,
68
68
  welcomeGuideStyles: true,
69
+ welcomeGuidePage: true,
70
+ welcomeGuideTemplate: true,
69
71
  showListViewByDefault: false,
70
72
  showBlockBreadcrumbs: true
71
73
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["store","blocksStore","registerCoreBlocks","__experimentalGetCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","deprecated","createRoot","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","editorStore","interfaceStore","preferencesStore","registerLegacyWidgetBlock","registerWidgetGroupBlock","editSiteStore","App","initializeEditor","id","settings","target","document","getElementById","root","search","searchOptions","__experimentalFetchRichUrlData","__experimentalReapplyBlockTypeFilters","coreBlocks","filter","name","setFreeformFallbackBlockName","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","setDefaults","editorMode","fixedToolbar","focusMode","distractionFree","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","showListViewByDefault","showBlockBreadcrumbs","setDefaultComplementaryArea","updateSettings","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","render","reinitializeEditor","since","version","default","PluginSidebar","PluginSidebarMoreMenuItem","PluginMoreMenuItem","PluginTemplateSettingPanel"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SACCC,kBADD,EAECC,2BAFD,EAGCC,4CAHD,QAIO,0BAJP;AAKA,SAASC,QAAT,QAAyB,iBAAzB;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,UAAT,QAA2B,oBAA3B;AACA,SACCC,kCAAkC,IAAIC,oBADvC,EAECC,0BAA0B,IAAIC,YAF/B,QAGO,sBAHP;AAIA,SAASX,KAAK,IAAIY,WAAlB,QAAqC,mBAArC;AACA,SAASZ,KAAK,IAAIa,cAAlB,QAAwC,sBAAxC;AACA,SAASb,KAAK,IAAIc,gBAAlB,QAA0C,wBAA1C;AACA,SACCC,yBADD,EAECC,wBAFD,QAGO,oBAHP;AAKA;AACA;AACA;;AACA,OAAO,SAAP;AACA,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ACA,SAASF,OAAO,IAAIG,kBAApB,QAA8C,qDAA9C;AACA,SAASH,OAAO,IAAII,0BAApB,QAAsD,4CAAtD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport App from './components/app';\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tdistractionFree: false,\n\t\tkeepCaretInsideBlock: false,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\tshowListViewByDefault: false,\n\t\tshowBlockBreadcrumbs: true,\n\t} );\n\n\tdispatch( interfaceStore ).setDefaultComplementaryArea(\n\t\t'core/edit-site',\n\t\t'edit-site/template'\n\t);\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t// so that they can be selected with core/editor selectors in any editor.\n\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t// which internally uses updateEditorSettings as well.\n\tdispatch( editorStore ).updateEditorSettings( {\n\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t} );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render( <App /> );\n\n\treturn root;\n}\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editSite.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginSidebar } from './components/sidebar-edit-mode/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header-edit-mode/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header-edit-mode/plugin-more-menu-item';\nexport { default as PluginTemplateSettingPanel } from './components/plugin-template-setting-panel';\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["store","blocksStore","registerCoreBlocks","__experimentalGetCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","deprecated","createRoot","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","editorStore","interfaceStore","preferencesStore","registerLegacyWidgetBlock","registerWidgetGroupBlock","editSiteStore","App","initializeEditor","id","settings","target","document","getElementById","root","search","searchOptions","__experimentalFetchRichUrlData","__experimentalReapplyBlockTypeFilters","coreBlocks","filter","name","setFreeformFallbackBlockName","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","setDefaults","editorMode","fixedToolbar","focusMode","distractionFree","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","welcomeGuidePage","welcomeGuideTemplate","showListViewByDefault","showBlockBreadcrumbs","setDefaultComplementaryArea","updateSettings","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","render","reinitializeEditor","since","version","default","PluginSidebar","PluginSidebarMoreMenuItem","PluginMoreMenuItem","PluginTemplateSettingPanel"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SACCC,kBADD,EAECC,2BAFD,EAGCC,4CAHD,QAIO,0BAJP;AAKA,SAASC,QAAT,QAAyB,iBAAzB;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,UAAT,QAA2B,oBAA3B;AACA,SACCC,kCAAkC,IAAIC,oBADvC,EAECC,0BAA0B,IAAIC,YAF/B,QAGO,sBAHP;AAIA,SAASX,KAAK,IAAIY,WAAlB,QAAqC,mBAArC;AACA,SAASZ,KAAK,IAAIa,cAAlB,QAAwC,sBAAxC;AACA,SAASb,KAAK,IAAIc,gBAAlB,QAA0C,wBAA1C;AACA,SACCC,yBADD,EAECC,wBAFD,QAGO,oBAHP;AAKA;AACA;AACA;;AACA,OAAO,SAAP;AACA,SAAShB,KAAK,IAAIiB,aAAlB,QAAuC,SAAvC;AACA,OAAOC,GAAP,MAAgB,kBAAhB;AAE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OAAO,IAAIG,kBAApB,QAA8C,qDAA9C;AACA,SAASH,OAAO,IAAII,0BAApB,QAAsD,4CAAtD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport App from './components/app';\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tdistractionFree: false,\n\t\tkeepCaretInsideBlock: false,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\twelcomeGuidePage: true,\n\t\twelcomeGuideTemplate: true,\n\t\tshowListViewByDefault: false,\n\t\tshowBlockBreadcrumbs: true,\n\t} );\n\n\tdispatch( interfaceStore ).setDefaultComplementaryArea(\n\t\t'core/edit-site',\n\t\t'edit-site/template'\n\t);\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t// so that they can be selected with core/editor selectors in any editor.\n\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t// which internally uses updateEditorSettings as well.\n\tdispatch( editorStore ).updateEditorSettings( {\n\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t} );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render( <App /> );\n\n\treturn root;\n}\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editSite.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginSidebar } from './components/sidebar-edit-mode/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header-edit-mode/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header-edit-mode/plugin-more-menu-item';\nexport { default as PluginTemplateSettingPanel } from './components/plugin-template-setting-panel';\n"]}
@@ -126,11 +126,14 @@ export const removeTemplate = template => async ({
126
126
 
127
127
  if (lastError) {
128
128
  throw lastError;
129
- }
129
+ } // Depending on how the entity was retrieved it's title might be
130
+ // an object or simple string.
131
+
130
132
 
133
+ const templateTitle = typeof template.title === 'string' ? template.title : template.title?.rendered;
131
134
  registry.dispatch(noticesStore).createSuccessNotice(sprintf(
132
135
  /* translators: The template/part's name. */
133
- __('"%s" deleted.'), decodeEntities(template.title.rendered)), {
136
+ __('"%s" deleted.'), decodeEntities(templateTitle)), {
134
137
  type: 'snackbar',
135
138
  id: 'site-editor-template-deleted-success'
136
139
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/actions.js"],"names":["apiFetch","parse","__unstableSerializeAndClean","deprecated","addQueryArgs","getPathAndQueryString","__","sprintf","store","noticesStore","coreStore","interfaceStore","blockEditorStore","speak","preferencesStore","decodeEntities","STORE_NAME","editSiteStoreName","isTemplateRevertable","toggleFeature","featureName","registry","since","alternative","dispatch","toggle","__experimentalSetPreviewDeviceType","deviceType","type","setTemplate","templateId","templateSlug","template","resolveSelect","getEntityRecord","slug","error","postType","id","context","addTemplate","newTemplate","saveEntityRecord","content","editEntityRecord","blocks","undoIgnore","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","createSuccessNotice","title","rendered","errorMessage","message","code","createErrorNotice","setTemplatePart","templatePartId","setNavigationMenu","navigationMenuId","setEditedEntity","postId","setHomeTemplateId","version","setEditedPostContext","setPage","page","path","entity","link","__experimentalGetTemplateForLink","setNavigationPanelActiveMenu","openNavigationPanelToMenu","setIsNavigationPanelOpened","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","isOpen","setIsSaveViewOpened","revertTemplate","allowUndo","noticeId","removeNotice","templateEntityConfig","getEntityConfig","fileTemplatePath","baseURL","source","fileTemplate","serializeBlocks","blocksForSerialization","edited","getEditedEntityRecord","raw","undoRevert","actions","label","onClick","openGeneralSidebar","name","enableComplementaryArea","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","set","clearSelect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AAAA,QAAQ,CAACG,QAAT,CAAmBZ,gBAAnB,EAAsCoG,kBAAtC;AACA;;AAED,MAAKF,IAAI,KAAK,QAAd,EAAyB;AACxBjG,IAAAA,KAAK,CAAEP,EAAE,CAAE,wBAAF,CAAJ,EAAkC,WAAlC,CAAL;AACA,GAFD,MAEO,IAAKwG,IAAI,KAAK,MAAd,EAAuB;AAC7BjG,IAAAA,KAAK,CAAEP,EAAE,CAAE,sBAAF,CAAJ,EAAgC,WAAhC,CAAL;AACA;AACD,CAjBK;AAmBP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAM2G,sBAAsB,GAChCC,mBAAF,IACA,CAAE;AAAE1F,EAAAA,QAAF;AAAYH,EAAAA;AAAZ,CAAF,KAA8B;AAC7B,MAAK6F,mBAAL,EAA2B;AAC1B7F,IAAAA,QAAQ,CAACG,QAAT,CAAmBZ,gBAAnB,EAAsCoG,kBAAtC;AACA;;AACDxF,EAAAA,QAAQ,CAAE;AACTI,IAAAA,IAAI,EAAE,4BADG;AAETsF,IAAAA;AAFS,GAAF,CAAR;AAIA,CAVK","sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { addQueryArgs, getPathAndQueryString } 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 { 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';\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( \"select( 'core/edit-site' ).toggleFeature( featureName )\", {\n\t\t\tsince: '6.0',\n\t\t\talternative:\n\t\t\t\t\"select( 'core/preferences').toggle( 'core/edit-site', featureName )\",\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 * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Action that sets a template, optionally fetching it from REST API.\n *\n * @param {number} templateId The template ID.\n * @param {string} templateSlug The template slug.\n * @return {Object} Action object.\n */\nexport const setTemplate =\n\t( templateId, templateSlug ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! templateSlug ) {\n\t\t\ttry {\n\t\t\t\tconst template = await registry\n\t\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t\t.getEntityRecord( 'postType', 'wp_template', templateId );\n\t\t\t\ttemplateSlug = template?.slug;\n\t\t\t} catch ( error ) {}\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: templateId,\n\t\t\tcontext: { templateSlug },\n\t\t} );\n\t};\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 * @return {Object} Action object used to set the current template.\n */\nexport const addTemplate =\n\t( template ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tconst newTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', 'wp_template', 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\t'wp_template',\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: 'wp_template',\n\t\t\tid: newTemplate.id,\n\t\t\tcontext: { templateSlug: newTemplate.slug },\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\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( template.title.rendered )\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: 'wp_template_part',\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: 'wp_navigation',\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 *\n * @return {Object} Action object.\n */\nexport function setEditedEntity( postType, postId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType,\n\t\tid: postId,\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 {number} The resolved template ID for the page route.\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 * @param {Object} page The page object.\n * @param {string} page.type The page type.\n * @param {string} page.slug The page slug.\n * @param {string} page.path The page path.\n * @param {Object} page.context The page context.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport const setPage =\n\t( page ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! page.path && page.context?.postId ) {\n\t\t\tconst entity = await registry\n\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t.getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpage.context.postType || 'post',\n\t\t\t\t\tpage.context.postId\n\t\t\t\t);\n\t\t\t// If the entity is undefined for some reason, path will resolve to \"/\"\n\t\t\tpage.path = getPathAndQueryString( entity?.link );\n\t\t}\n\n\t\tconst template = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.__experimentalGetTemplateForLink( page.path );\n\n\t\tif ( ! template ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: template.id,\n\t\t\tcontext: {\n\t\t\t\t...page.context,\n\t\t\t\ttemplateSlug: template.slug,\n\t\t\t},\n\t\t} );\n\n\t\treturn template.id;\n\t};\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 * Opens or closes the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\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 list view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the list view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\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( { registry } ) => {\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( { 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\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\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"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/actions.js"],"names":["apiFetch","parse","__unstableSerializeAndClean","deprecated","addQueryArgs","getPathAndQueryString","__","sprintf","store","noticesStore","coreStore","interfaceStore","blockEditorStore","speak","preferencesStore","decodeEntities","STORE_NAME","editSiteStoreName","isTemplateRevertable","toggleFeature","featureName","registry","since","alternative","dispatch","toggle","__experimentalSetPreviewDeviceType","deviceType","type","setTemplate","templateId","templateSlug","template","resolveSelect","getEntityRecord","slug","error","postType","id","context","addTemplate","newTemplate","saveEntityRecord","content","editEntityRecord","blocks","undoIgnore","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","templateTitle","title","rendered","createSuccessNotice","errorMessage","message","code","createErrorNotice","setTemplatePart","templatePartId","setNavigationMenu","navigationMenuId","setEditedEntity","postId","setHomeTemplateId","version","setEditedPostContext","setPage","page","path","entity","link","__experimentalGetTemplateForLink","setNavigationPanelActiveMenu","openNavigationPanelToMenu","setIsNavigationPanelOpened","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","isOpen","setIsSaveViewOpened","revertTemplate","allowUndo","noticeId","removeNotice","templateEntityConfig","getEntityConfig","fileTemplatePath","baseURL","source","fileTemplate","serializeBlocks","blocksForSerialization","edited","getEditedEntityRecord","raw","undoRevert","actions","label","onClick","openGeneralSidebar","name","enableComplementaryArea","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","set","clearSelectedBlock","setHasPageContentFocus","hasPageContentFocus"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,QAAP,MAAqB,sBAArB;AACA,SAASC,KAAT,EAAgBC,2BAAhB,QAAmD,mBAAnD;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,YAAT,EAAuBC,qBAAvB,QAAoD,gBAApD;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASF,KAAK,IAAIG,cAAlB,QAAwC,sBAAxC;AACA,SAASH,KAAK,IAAII,gBAAlB,QAA0C,yBAA1C;AACA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASL,KAAK,IAAIM,gBAAlB,QAA0C,wBAA1C;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,SAASC,UAAU,IAAIC,iBAAvB,QAAgD,aAAhD;AACA,OAAOC,oBAAP,MAAiC,iCAAjC;AAEA;AACA;AACA;AACA;AACA;;AACA,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C;AACA;;AACDzF,EAAAA,QAAQ,CAAE;AACTI,IAAAA,IAAI,EAAE,4BADG;AAETuF,IAAAA;AAFS,GAAF,CAAR;AAIA,CAVK","sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { addQueryArgs, getPathAndQueryString } 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 { 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';\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( \"select( 'core/edit-site' ).toggleFeature( featureName )\", {\n\t\t\tsince: '6.0',\n\t\t\talternative:\n\t\t\t\t\"select( 'core/preferences').toggle( 'core/edit-site', featureName )\",\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 * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Action that sets a template, optionally fetching it from REST API.\n *\n * @param {number} templateId The template ID.\n * @param {string} templateSlug The template slug.\n * @return {Object} Action object.\n */\nexport const setTemplate =\n\t( templateId, templateSlug ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! templateSlug ) {\n\t\t\ttry {\n\t\t\t\tconst template = await registry\n\t\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t\t.getEntityRecord( 'postType', 'wp_template', templateId );\n\t\t\t\ttemplateSlug = template?.slug;\n\t\t\t} catch ( error ) {}\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: templateId,\n\t\t\tcontext: { templateSlug },\n\t\t} );\n\t};\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 * @return {Object} Action object used to set the current template.\n */\nexport const addTemplate =\n\t( template ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tconst newTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', 'wp_template', 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\t'wp_template',\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: 'wp_template',\n\t\t\tid: newTemplate.id,\n\t\t\tcontext: { templateSlug: newTemplate.slug },\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: 'wp_template_part',\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: 'wp_navigation',\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 *\n * @return {Object} Action object.\n */\nexport function setEditedEntity( postType, postId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType,\n\t\tid: postId,\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 {number} The resolved template ID for the page route.\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 * @param {Object} page The page object.\n * @param {string} page.type The page type.\n * @param {string} page.slug The page slug.\n * @param {string} page.path The page path.\n * @param {Object} page.context The page context.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport const setPage =\n\t( page ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! page.path && page.context?.postId ) {\n\t\t\tconst entity = await registry\n\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t.getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpage.context.postType || 'post',\n\t\t\t\t\tpage.context.postId\n\t\t\t\t);\n\t\t\t// If the entity is undefined for some reason, path will resolve to \"/\"\n\t\t\tpage.path = getPathAndQueryString( entity?.link );\n\t\t}\n\n\t\tconst template = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.__experimentalGetTemplateForLink( page.path );\n\n\t\tif ( ! template ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: template.id,\n\t\t\tcontext: {\n\t\t\t\t...page.context,\n\t\t\t\ttemplateSlug: template.slug,\n\t\t\t},\n\t\t} );\n\n\t\treturn template.id;\n\t};\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 * Opens or closes the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\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 list view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the list view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\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( { registry } ) => {\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( { 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\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\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"]}
@@ -11,7 +11,8 @@ import { store as preferencesStore } from '@wordpress/preferences';
11
11
 
12
12
  export const setCanvasMode = mode => ({
13
13
  registry,
14
- dispatch
14
+ dispatch,
15
+ select
15
16
  }) => {
16
17
  registry.dispatch(blockEditorStore).__unstableSetEditorMode('edit');
17
18
 
@@ -22,6 +23,11 @@ export const setCanvasMode = mode => ({
22
23
 
23
24
  if (mode === 'edit' && registry.select(preferencesStore).get('core/edit-site', 'showListViewByDefault')) {
24
25
  dispatch.setIsListViewOpened(true);
26
+ } // Switch focus away from editing the template when switching to view mode.
27
+
28
+
29
+ if (mode === 'view' && select.isPage()) {
30
+ dispatch.setHasPageContentFocus(true);
25
31
  }
26
32
  };
27
33
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/private-actions.js"],"names":["store","blockEditorStore","preferencesStore","setCanvasMode","mode","registry","dispatch","__unstableSetEditorMode","type","select","get","setIsListViewOpened","setEditorCanvasContainerView","view"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,aAAa,GACvBC,IAAF,IACA,CAAE;AAAEC,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,CAAF,KAA8B;AAC7BD,EAAAA,QAAQ,CAACC,QAAT,CAAmBL,gBAAnB,EAAsCM,uBAAtC,CAA+D,MAA/D;;AACAD,EAAAA,QAAQ,CAAE;AACTE,IAAAA,IAAI,EAAE,iBADG;AAETJ,IAAAA;AAFS,GAAF,CAAR,CAF6B,CAM7B;;AACA,MACCA,IAAI,KAAK,MAAT,IACAC,QAAQ,CACNI,MADF,CACUP,gBADV,EAEEQ,GAFF,CAEO,gBAFP,EAEyB,uBAFzB,CAFD,EAKE;AACDJ,IAAAA,QAAQ,CAACK,mBAAT,CAA8B,IAA9B;AACA;AACD,CAjBK;AAmBP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,4BAA4B,GACtCC,IAAF,IACA,CAAE;AAAEP,EAAAA;AAAF,CAAF,KAAoB;AACnBA,EAAAA,QAAQ,CAAE;AACTE,IAAAA,IAAI,EAAE,kCADG;AAETK,IAAAA;AAFS,GAAF,CAAR;AAIA,CAPK","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\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\tif (\n\t\t\tmode === 'edit' &&\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'showListViewByDefault' )\n\t\t) {\n\t\t\tdispatch.setIsListViewOpened( true );\n\t\t}\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"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/private-actions.js"],"names":["store","blockEditorStore","preferencesStore","setCanvasMode","mode","registry","dispatch","select","__unstableSetEditorMode","type","get","setIsListViewOpened","isPage","setHasPageContentFocus","setEditorCanvasContainerView","view"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,aAAa,GACvBC,IAAF,IACA,CAAE;AAAEC,EAAAA,QAAF;AAAYC,EAAAA,QAAZ;AAAsBC,EAAAA;AAAtB,CAAF,KAAsC;AACrCF,EAAAA,QAAQ,CAACC,QAAT,CAAmBL,gBAAnB,EAAsCO,uBAAtC,CAA+D,MAA/D;;AACAF,EAAAA,QAAQ,CAAE;AACTG,IAAAA,IAAI,EAAE,iBADG;AAETL,IAAAA;AAFS,GAAF,CAAR,CAFqC,CAMrC;;AACA,MACCA,IAAI,KAAK,MAAT,IACAC,QAAQ,CACNE,MADF,CACUL,gBADV,EAEEQ,GAFF,CAEO,gBAFP,EAEyB,uBAFzB,CAFD,EAKE;AACDJ,IAAAA,QAAQ,CAACK,mBAAT,CAA8B,IAA9B;AACA,GAdoC,CAerC;;;AACA,MAAKP,IAAI,KAAK,MAAT,IAAmBG,MAAM,CAACK,MAAP,EAAxB,EAA0C;AACzCN,IAAAA,QAAQ,CAACO,sBAAT,CAAiC,IAAjC;AACA;AACD,CArBK;AAuBP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,4BAA4B,GACtCC,IAAF,IACA,CAAE;AAAET,EAAAA;AAAF,CAAF,KAAoB;AACnBA,EAAAA,QAAQ,CAAE;AACTG,IAAAA,IAAI,EAAE,kCADG;AAETM,IAAAA;AAFS,GAAF,CAAR;AAIA,CAPK","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\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, select } ) => {\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\tif (\n\t\t\tmode === 'edit' &&\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'showListViewByDefault' )\n\t\t) {\n\t\t\tdispatch.setIsListViewOpened( true );\n\t\t}\n\t\t// Switch focus away from editing the template when switching to view mode.\n\t\tif ( mode === 'view' && select.isPage() ) {\n\t\t\tdispatch.setHasPageContentFocus( true );\n\t\t}\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"]}
@@ -14,8 +14,8 @@ export default function getIsListPage({
14
14
  categoryType,
15
15
  categoryId
16
16
  }, isMobileViewport) {
17
- return path === '/wp_template/all' || path === '/library' && ( // Don't treat "/library" without categoryType and categoryId as a list page
18
- // in mobile because the sidebar covers the whole page.
17
+ return path === '/wp_template/all' || path === '/wp_template_part/all' || path === '/patterns' && ( // Don't treat "/patterns" without categoryType and categoryId as a
18
+ // list page in mobile because the sidebar covers the whole page.
19
19
  !isMobileViewport || !!categoryType && !!categoryId);
20
20
  }
21
21
  //# sourceMappingURL=get-is-list-page.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/utils/get-is-list-page.js"],"names":["getIsListPage","path","categoryType","categoryId","isMobileViewport"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,aAAT,CACd;AAAEC,EAAAA,IAAF;AAAQC,EAAAA,YAAR;AAAsBC,EAAAA;AAAtB,CADc,EAEdC,gBAFc,EAGb;AACD,SACCH,IAAI,KAAK,kBAAT,IACEA,IAAI,KAAK,UAAT,MACD;AACA;AACE,GAAEG,gBAAF,IAAwB,CAAC,CAAEF,YAAH,IAAmB,CAAC,CAAEC,UAH/C,CAFH;AAOA","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\tpath === '/wp_template/all' ||\n\t\t( path === '/library' &&\n\t\t\t// Don't treat \"/library\" without categoryType and categoryId as a list page\n\t\t\t// in mobile because the sidebar covers the whole page.\n\t\t\t( ! isMobileViewport || ( !! categoryType && !! categoryId ) ) )\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/utils/get-is-list-page.js"],"names":["getIsListPage","path","categoryType","categoryId","isMobileViewport"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,aAAT,CACd;AAAEC,EAAAA,IAAF;AAAQC,EAAAA,YAAR;AAAsBC,EAAAA;AAAtB,CADc,EAEdC,gBAFc,EAGb;AACD,SACCH,IAAI,KAAK,kBAAT,IACAA,IAAI,KAAK,uBADT,IAEEA,IAAI,KAAK,WAAT,MACD;AACA;AACE,GAAEG,gBAAF,IAAwB,CAAC,CAAEF,YAAH,IAAmB,CAAC,CAAEC,UAH/C,CAHH;AAQA","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\tpath === '/wp_template/all' ||\n\t\tpath === '/wp_template_part/all' ||\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"]}