@wordpress/edit-site 5.9.0 → 5.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (545) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-template/{add-custom-generic-template-modal.js → add-custom-generic-template-modal-content.js} +7 -22
  3. package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -0
  4. package/build/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +32 -27
  5. package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -0
  6. package/build/components/add-new-template/new-template-part.js +8 -2
  7. package/build/components/add-new-template/new-template-part.js.map +1 -1
  8. package/build/components/add-new-template/new-template.js +104 -68
  9. package/build/components/add-new-template/new-template.js.map +1 -1
  10. package/build/components/app/index.js +8 -2
  11. package/build/components/app/index.js.map +1 -1
  12. package/build/components/block-editor/back-button.js +10 -3
  13. package/build/components/block-editor/back-button.js.map +1 -1
  14. package/build/components/block-editor/editor-canvas.js +39 -6
  15. package/build/components/block-editor/editor-canvas.js.map +1 -1
  16. package/build/components/block-editor/index.js +1 -3
  17. package/build/components/block-editor/index.js.map +1 -1
  18. package/build/components/create-template-part-modal/index.js +6 -7
  19. package/build/components/create-template-part-modal/index.js.map +1 -1
  20. package/build/components/editor/index.js +20 -11
  21. package/build/components/editor/index.js.map +1 -1
  22. package/build/components/editor-canvas-container/index.js +27 -6
  23. package/build/components/editor-canvas-container/index.js.map +1 -1
  24. package/build/components/global-styles/block-preview-panel.js +1 -1
  25. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  26. package/build/components/global-styles/color-palette-panel.js +14 -3
  27. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  28. package/build/components/global-styles/dimensions-panel.js +17 -18
  29. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  30. package/build/components/global-styles/gradients-palette-panel.js +14 -3
  31. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  32. package/build/components/global-styles/root-menu.js +61 -0
  33. package/build/components/global-styles/root-menu.js.map +1 -0
  34. package/build/components/global-styles/screen-block-list.js +3 -1
  35. package/build/components/global-styles/screen-block-list.js.map +1 -1
  36. package/build/components/global-styles/screen-block.js +235 -7
  37. package/build/components/global-styles/screen-block.js.map +1 -1
  38. package/build/components/global-styles/screen-colors.js +9 -26
  39. package/build/components/global-styles/screen-colors.js.map +1 -1
  40. package/build/components/global-styles/screen-css.js +20 -15
  41. package/build/components/global-styles/screen-css.js.map +1 -1
  42. package/build/components/global-styles/screen-layout.js +4 -17
  43. package/build/components/global-styles/screen-layout.js.map +1 -1
  44. package/build/components/global-styles/screen-revisions/index.js +141 -0
  45. package/build/components/global-styles/screen-revisions/index.js.map +1 -0
  46. package/build/components/global-styles/screen-revisions/revisions-buttons.js +130 -0
  47. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -0
  48. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +121 -0
  49. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -0
  50. package/build/components/global-styles/screen-root.js +6 -6
  51. package/build/components/global-styles/screen-root.js.map +1 -1
  52. package/build/components/global-styles/screen-typography-element.js +0 -3
  53. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  54. package/build/components/global-styles/screen-typography.js +11 -39
  55. package/build/components/global-styles/screen-typography.js.map +1 -1
  56. package/build/components/global-styles/style-variations-container.js +9 -18
  57. package/build/components/global-styles/style-variations-container.js.map +1 -1
  58. package/build/components/global-styles/typography-panel.js +7 -11
  59. package/build/components/global-styles/typography-panel.js.map +1 -1
  60. package/build/components/global-styles/ui.js +70 -117
  61. package/build/components/global-styles/ui.js.map +1 -1
  62. package/build/components/global-styles/variations-panel.js +4 -28
  63. package/build/components/global-styles/variations-panel.js.map +1 -1
  64. package/build/components/header-edit-mode/document-actions/index.js +28 -103
  65. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  66. package/build/components/header-edit-mode/index.js +15 -2
  67. package/build/components/header-edit-mode/index.js.map +1 -1
  68. package/build/components/keyboard-shortcuts/register.js +1 -1
  69. package/build/components/keyboard-shortcuts/register.js.map +1 -1
  70. package/build/components/layout/hooks.js +54 -0
  71. package/build/components/layout/hooks.js.map +1 -0
  72. package/build/components/layout/index.js +57 -104
  73. package/build/components/layout/index.js.map +1 -1
  74. package/build/components/list/actions/index.js +5 -2
  75. package/build/components/list/actions/index.js.map +1 -1
  76. package/build/components/list/index.js +9 -3
  77. package/build/components/list/index.js.map +1 -1
  78. package/build/components/list/table.js +1 -1
  79. package/build/components/list/table.js.map +1 -1
  80. package/build/components/plugin-template-setting-panel/index.js +44 -0
  81. package/build/components/plugin-template-setting-panel/index.js.map +1 -0
  82. package/build/components/resizable-frame/index.js +242 -0
  83. package/build/components/resizable-frame/index.js.map +1 -0
  84. package/build/components/revisions/index.js +96 -0
  85. package/build/components/revisions/index.js.map +1 -0
  86. package/build/components/routes/link.js +17 -2
  87. package/build/components/routes/link.js.map +1 -1
  88. package/build/components/routes/use-title.js +8 -2
  89. package/build/components/routes/use-title.js.map +1 -1
  90. package/build/components/save-button/index.js +31 -6
  91. package/build/components/save-button/index.js.map +1 -1
  92. package/build/components/save-hub/index.js +14 -31
  93. package/build/components/save-hub/index.js.map +1 -1
  94. package/build/components/save-panel/index.js +20 -7
  95. package/build/components/save-panel/index.js.map +1 -1
  96. package/build/components/secondary-sidebar/list-view-sidebar.js +6 -10
  97. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  98. package/build/components/sidebar/index.js +19 -5
  99. package/build/components/sidebar/index.js.map +1 -1
  100. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +9 -3
  101. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  102. package/build/components/sidebar-edit-mode/index.js +9 -2
  103. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  104. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +40 -0
  105. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -0
  106. package/build/components/sidebar-edit-mode/template-card/index.js +1 -8
  107. package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  108. package/build/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +2 -2
  109. package/build/components/sidebar-edit-mode/template-revisions/index.js.map +1 -0
  110. package/build/components/sidebar-navigation-item/index.js +5 -7
  111. package/build/components/sidebar-navigation-item/index.js.map +1 -1
  112. package/build/components/sidebar-navigation-screen/index.js +14 -4
  113. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  114. package/build/components/sidebar-navigation-screen-global-styles/index.js +75 -11
  115. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  116. package/build/components/sidebar-navigation-screen-main/index.js +31 -23
  117. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  118. package/build/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
  119. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  120. package/build/components/sidebar-navigation-screen-navigation-menu/index.js +162 -0
  121. package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -0
  122. package/build/components/sidebar-navigation-screen-navigation-menus/constants.js +17 -0
  123. package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -0
  124. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +55 -93
  125. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  126. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +87 -0
  127. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -0
  128. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +14 -71
  129. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  130. package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +53 -0
  131. package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -0
  132. package/build/components/sidebar-navigation-screen-page/index.js +67 -0
  133. package/build/components/sidebar-navigation-screen-page/index.js.map +1 -0
  134. package/build/components/sidebar-navigation-screen-pages/index.js +74 -0
  135. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -0
  136. package/build/components/sidebar-navigation-screen-templates/index.js +39 -12
  137. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  138. package/build/components/sidebar-navigation-subtitle/index.js +18 -0
  139. package/build/components/sidebar-navigation-subtitle/index.js.map +1 -0
  140. package/build/components/site-hub/index.js +34 -6
  141. package/build/components/site-hub/index.js.map +1 -1
  142. package/build/components/start-template-options/index.js +12 -16
  143. package/build/components/start-template-options/index.js.map +1 -1
  144. package/build/components/style-book/index.js +93 -19
  145. package/build/components/style-book/index.js.map +1 -1
  146. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +8 -2
  147. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  148. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +9 -4
  149. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  150. package/build/components/sync-state-with-url/use-sync-path-with-url.js +17 -3
  151. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  152. package/build/components/use-edited-entity-record/index.js +8 -4
  153. package/build/components/use-edited-entity-record/index.js.map +1 -1
  154. package/build/hooks/commands/use-edit-mode-commands.js +105 -0
  155. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -0
  156. package/build/hooks/template-part-edit.js +8 -2
  157. package/build/hooks/template-part-edit.js.map +1 -1
  158. package/build/index.js +8 -0
  159. package/build/index.js.map +1 -1
  160. package/build/store/actions.js +5 -3
  161. package/build/store/actions.js.map +1 -1
  162. package/build/utils/is-previewing-theme.js +27 -0
  163. package/build/utils/is-previewing-theme.js.map +1 -0
  164. package/build/utils/use-activate-theme.js +46 -0
  165. package/build/utils/use-activate-theme.js.map +1 -0
  166. package/build-module/components/add-new-template/{add-custom-generic-template-modal.js → add-custom-generic-template-modal-content.js} +8 -20
  167. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -0
  168. package/build-module/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +34 -28
  169. package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -0
  170. package/build-module/components/add-new-template/new-template-part.js +5 -1
  171. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  172. package/build-module/components/add-new-template/new-template.js +102 -68
  173. package/build-module/components/add-new-template/new-template.js.map +1 -1
  174. package/build-module/components/app/index.js +6 -2
  175. package/build-module/components/app/index.js.map +1 -1
  176. package/build-module/components/block-editor/back-button.js +6 -1
  177. package/build-module/components/block-editor/back-button.js.map +1 -1
  178. package/build-module/components/block-editor/editor-canvas.js +37 -6
  179. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  180. package/build-module/components/block-editor/index.js +1 -3
  181. package/build-module/components/block-editor/index.js.map +1 -1
  182. package/build-module/components/create-template-part-modal/index.js +7 -8
  183. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  184. package/build-module/components/editor/index.js +18 -11
  185. package/build-module/components/editor/index.js.map +1 -1
  186. package/build-module/components/editor-canvas-container/index.js +27 -8
  187. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  188. package/build-module/components/global-styles/block-preview-panel.js +1 -1
  189. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  190. package/build-module/components/global-styles/color-palette-panel.js +13 -3
  191. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  192. package/build-module/components/global-styles/dimensions-panel.js +17 -18
  193. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  194. package/build-module/components/global-styles/gradients-palette-panel.js +13 -3
  195. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  196. package/build-module/components/global-styles/root-menu.js +47 -0
  197. package/build-module/components/global-styles/root-menu.js.map +1 -0
  198. package/build-module/components/global-styles/screen-block-list.js +4 -2
  199. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  200. package/build-module/components/global-styles/screen-block.js +229 -7
  201. package/build-module/components/global-styles/screen-block.js.map +1 -1
  202. package/build-module/components/global-styles/screen-colors.js +9 -25
  203. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  204. package/build-module/components/global-styles/screen-css.js +20 -15
  205. package/build-module/components/global-styles/screen-css.js.map +1 -1
  206. package/build-module/components/global-styles/screen-layout.js +4 -16
  207. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  208. package/build-module/components/global-styles/screen-revisions/index.js +121 -0
  209. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -0
  210. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +118 -0
  211. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -0
  212. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +107 -0
  213. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -0
  214. package/build-module/components/global-styles/screen-root.js +6 -6
  215. package/build-module/components/global-styles/screen-root.js.map +1 -1
  216. package/build-module/components/global-styles/screen-typography-element.js +0 -3
  217. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  218. package/build-module/components/global-styles/screen-typography.js +11 -37
  219. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  220. package/build-module/components/global-styles/style-variations-container.js +10 -18
  221. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  222. package/build-module/components/global-styles/typography-panel.js +7 -11
  223. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  224. package/build-module/components/global-styles/ui.js +71 -115
  225. package/build-module/components/global-styles/ui.js.map +1 -1
  226. package/build-module/components/global-styles/variations-panel.js +3 -22
  227. package/build-module/components/global-styles/variations-panel.js.map +1 -1
  228. package/build-module/components/header-edit-mode/document-actions/index.js +31 -107
  229. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  230. package/build-module/components/header-edit-mode/index.js +16 -4
  231. package/build-module/components/header-edit-mode/index.js.map +1 -1
  232. package/build-module/components/keyboard-shortcuts/register.js +1 -1
  233. package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
  234. package/build-module/components/layout/hooks.js +41 -0
  235. package/build-module/components/layout/hooks.js.map +1 -0
  236. package/build-module/components/layout/index.js +53 -102
  237. package/build-module/components/layout/index.js.map +1 -1
  238. package/build-module/components/list/actions/index.js +6 -3
  239. package/build-module/components/list/actions/index.js.map +1 -1
  240. package/build-module/components/list/index.js +5 -1
  241. package/build-module/components/list/index.js.map +1 -1
  242. package/build-module/components/list/table.js +1 -1
  243. package/build-module/components/list/table.js.map +1 -1
  244. package/build-module/components/plugin-template-setting-panel/index.js +35 -0
  245. package/build-module/components/plugin-template-setting-panel/index.js.map +1 -0
  246. package/build-module/components/resizable-frame/index.js +228 -0
  247. package/build-module/components/resizable-frame/index.js.map +1 -0
  248. package/build-module/components/revisions/index.js +78 -0
  249. package/build-module/components/revisions/index.js.map +1 -0
  250. package/build-module/components/routes/link.js +13 -1
  251. package/build-module/components/routes/link.js.map +1 -1
  252. package/build-module/components/routes/use-title.js +5 -1
  253. package/build-module/components/routes/use-title.js.map +1 -1
  254. package/build-module/components/save-button/index.js +28 -6
  255. package/build-module/components/save-button/index.js.map +1 -1
  256. package/build-module/components/save-hub/index.js +13 -32
  257. package/build-module/components/save-hub/index.js.map +1 -1
  258. package/build-module/components/save-panel/index.js +19 -7
  259. package/build-module/components/save-panel/index.js.map +1 -1
  260. package/build-module/components/secondary-sidebar/list-view-sidebar.js +6 -11
  261. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  262. package/build-module/components/sidebar/index.js +14 -4
  263. package/build-module/components/sidebar/index.js.map +1 -1
  264. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +9 -3
  265. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  266. package/build-module/components/sidebar-edit-mode/index.js +10 -5
  267. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  268. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +29 -0
  269. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -0
  270. package/build-module/components/sidebar-edit-mode/template-card/index.js +2 -7
  271. package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  272. package/build-module/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +2 -2
  273. package/build-module/components/sidebar-edit-mode/template-revisions/index.js.map +1 -0
  274. package/build-module/components/sidebar-navigation-item/index.js +6 -8
  275. package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
  276. package/build-module/components/sidebar-navigation-screen/index.js +13 -5
  277. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  278. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +70 -14
  279. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  280. package/build-module/components/sidebar-navigation-screen-main/index.js +30 -24
  281. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  282. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
  283. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  284. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +141 -0
  285. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -0
  286. package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js +10 -0
  287. package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -0
  288. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +52 -93
  289. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  290. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +71 -0
  291. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -0
  292. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +13 -72
  293. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  294. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +40 -0
  295. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -0
  296. package/build-module/components/sidebar-navigation-screen-page/index.js +48 -0
  297. package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -0
  298. package/build-module/components/sidebar-navigation-screen-pages/index.js +57 -0
  299. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -0
  300. package/build-module/components/sidebar-navigation-screen-templates/index.js +38 -12
  301. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  302. package/build-module/components/sidebar-navigation-subtitle/index.js +10 -0
  303. package/build-module/components/sidebar-navigation-subtitle/index.js.map +1 -0
  304. package/build-module/components/site-hub/index.js +32 -6
  305. package/build-module/components/site-hub/index.js.map +1 -1
  306. package/build-module/components/start-template-options/index.js +13 -17
  307. package/build-module/components/start-template-options/index.js.map +1 -1
  308. package/build-module/components/style-book/index.js +93 -20
  309. package/build-module/components/style-book/index.js.map +1 -1
  310. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -1
  311. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  312. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +5 -1
  313. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  314. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +13 -1
  315. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  316. package/build-module/components/use-edited-entity-record/index.js +8 -4
  317. package/build-module/components/use-edited-entity-record/index.js.map +1 -1
  318. package/build-module/hooks/commands/use-edit-mode-commands.js +86 -0
  319. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -0
  320. package/build-module/hooks/template-part-edit.js +5 -1
  321. package/build-module/hooks/template-part-edit.js.map +1 -1
  322. package/build-module/index.js +1 -0
  323. package/build-module/index.js.map +1 -1
  324. package/build-module/store/actions.js +5 -3
  325. package/build-module/store/actions.js.map +1 -1
  326. package/build-module/utils/is-previewing-theme.js +17 -0
  327. package/build-module/utils/is-previewing-theme.js.map +1 -0
  328. package/build-module/utils/use-activate-theme.js +36 -0
  329. package/build-module/utils/use-activate-theme.js.map +1 -0
  330. package/build-style/style-rtl.css +409 -265
  331. package/build-style/style.css +410 -265
  332. package/package.json +37 -35
  333. package/src/components/add-new-template/add-custom-generic-template-modal-content.js +82 -0
  334. package/src/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +44 -34
  335. package/src/components/add-new-template/new-template-part.js +4 -1
  336. package/src/components/add-new-template/new-template.js +142 -154
  337. package/src/components/add-new-template/style.scss +120 -103
  338. package/src/components/app/index.js +6 -3
  339. package/src/components/block-editor/back-button.js +4 -1
  340. package/src/components/block-editor/editor-canvas.js +36 -8
  341. package/src/components/block-editor/index.js +2 -3
  342. package/src/components/block-editor/style.scss +15 -8
  343. package/src/components/create-template-part-modal/index.js +19 -25
  344. package/src/components/editor/index.js +20 -8
  345. package/src/components/editor/style.scss +21 -6
  346. package/src/components/editor-canvas-container/index.js +43 -21
  347. package/src/components/global-styles/block-preview-panel.js +1 -1
  348. package/src/components/global-styles/color-palette-panel.js +9 -0
  349. package/src/components/global-styles/dimensions-panel.js +15 -15
  350. package/src/components/global-styles/gradients-palette-panel.js +8 -0
  351. package/src/components/global-styles/root-menu.js +66 -0
  352. package/src/components/global-styles/screen-block-list.js +2 -2
  353. package/src/components/global-styles/screen-block.js +255 -7
  354. package/src/components/global-styles/screen-colors.js +9 -16
  355. package/src/components/global-styles/screen-css.js +21 -21
  356. package/src/components/global-styles/screen-layout.js +5 -9
  357. package/src/components/global-styles/screen-revisions/index.js +169 -0
  358. package/src/components/global-styles/screen-revisions/revisions-buttons.js +139 -0
  359. package/src/components/global-styles/screen-revisions/style.scss +100 -0
  360. package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +138 -0
  361. package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +99 -0
  362. package/src/components/global-styles/screen-root.js +7 -5
  363. package/src/components/global-styles/screen-typography-element.js +1 -3
  364. package/src/components/global-styles/screen-typography.js +44 -79
  365. package/src/components/global-styles/style-variations-container.js +17 -28
  366. package/src/components/global-styles/style.scss +4 -23
  367. package/src/components/global-styles/typography-panel.js +12 -13
  368. package/src/components/global-styles/ui.js +83 -110
  369. package/src/components/global-styles/variations-panel.js +3 -26
  370. package/src/components/header-edit-mode/document-actions/index.js +26 -129
  371. package/src/components/header-edit-mode/document-actions/style.scss +28 -59
  372. package/src/components/header-edit-mode/index.js +23 -2
  373. package/src/components/header-edit-mode/style.scss +1 -0
  374. package/src/components/keyboard-shortcuts/register.js +1 -1
  375. package/src/components/layout/hooks.js +46 -0
  376. package/src/components/layout/index.js +60 -125
  377. package/src/components/layout/style.scss +9 -5
  378. package/src/components/list/actions/index.js +12 -5
  379. package/src/components/list/index.js +4 -1
  380. package/src/components/list/style.scss +5 -0
  381. package/src/components/list/table.js +3 -1
  382. package/src/components/plugin-template-setting-panel/index.js +33 -0
  383. package/src/components/resizable-frame/index.js +253 -0
  384. package/src/components/resizable-frame/style.scss +69 -0
  385. package/src/components/revisions/index.js +105 -0
  386. package/src/components/routes/link.js +16 -1
  387. package/src/components/routes/use-title.js +4 -1
  388. package/src/components/save-button/index.js +27 -6
  389. package/src/components/save-hub/index.js +17 -35
  390. package/src/components/save-panel/index.js +15 -3
  391. package/src/components/secondary-sidebar/list-view-sidebar.js +4 -7
  392. package/src/components/sidebar/index.js +15 -4
  393. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +9 -7
  394. package/src/components/sidebar-edit-mode/index.js +17 -6
  395. package/src/components/sidebar-edit-mode/sidebar-fixed-bottom.js +26 -0
  396. package/src/components/sidebar-edit-mode/style.scss +10 -0
  397. package/src/components/sidebar-edit-mode/template-card/index.js +1 -9
  398. package/src/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +1 -2
  399. package/src/components/sidebar-navigation-item/index.js +13 -14
  400. package/src/components/sidebar-navigation-item/style.scss +17 -1
  401. package/src/components/sidebar-navigation-screen/index.js +26 -5
  402. package/src/components/sidebar-navigation-screen/style.scss +1 -2
  403. package/src/components/sidebar-navigation-screen-global-styles/index.js +106 -21
  404. package/src/components/sidebar-navigation-screen-main/index.js +39 -35
  405. package/src/components/sidebar-navigation-screen-navigation-item/index.js +3 -9
  406. package/src/components/sidebar-navigation-screen-navigation-menu/index.js +157 -0
  407. package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +9 -0
  408. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +63 -105
  409. package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +83 -0
  410. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +8 -74
  411. package/src/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +47 -0
  412. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +6 -20
  413. package/src/components/sidebar-navigation-screen-page/index.js +59 -0
  414. package/src/components/sidebar-navigation-screen-pages/index.js +82 -0
  415. package/src/components/sidebar-navigation-screen-pages/style.scss +4 -0
  416. package/src/components/sidebar-navigation-screen-templates/index.js +57 -14
  417. package/src/components/sidebar-navigation-subtitle/index.js +5 -0
  418. package/src/components/sidebar-navigation-subtitle/style.scss +7 -0
  419. package/src/components/site-hub/index.js +88 -58
  420. package/src/components/site-hub/style.scss +8 -0
  421. package/src/components/start-template-options/index.js +19 -27
  422. package/src/components/start-template-options/style.scss +28 -21
  423. package/src/components/style-book/index.js +132 -43
  424. package/src/components/style-book/style.scss +19 -0
  425. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +4 -1
  426. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +3 -1
  427. package/src/components/sync-state-with-url/use-sync-path-with-url.js +14 -1
  428. package/src/components/use-edited-entity-record/index.js +12 -3
  429. package/src/hooks/commands/use-edit-mode-commands.js +79 -0
  430. package/src/hooks/template-part-edit.js +4 -1
  431. package/src/index.js +1 -0
  432. package/src/store/actions.js +4 -5
  433. package/src/store/test/actions.js +6 -14
  434. package/src/store/test/utils.js +15 -5
  435. package/src/style.scss +5 -2
  436. package/src/utils/is-previewing-theme.js +18 -0
  437. package/src/utils/use-activate-theme.js +38 -0
  438. package/build/components/add-new-template/add-custom-generic-template-modal.js.map +0 -1
  439. package/build/components/add-new-template/add-custom-template-modal.js.map +0 -1
  440. package/build/components/global-styles/border-panel.js +0 -133
  441. package/build/components/global-styles/border-panel.js.map +0 -1
  442. package/build/components/global-styles/context-menu.js +0 -126
  443. package/build/components/global-styles/context-menu.js.map +0 -1
  444. package/build/components/global-styles/custom-css.js +0 -113
  445. package/build/components/global-styles/custom-css.js.map +0 -1
  446. package/build/components/global-styles/effects-panel.js +0 -53
  447. package/build/components/global-styles/effects-panel.js.map +0 -1
  448. package/build/components/global-styles/filters-panel.js +0 -50
  449. package/build/components/global-styles/filters-panel.js.map +0 -1
  450. package/build/components/global-styles/screen-border.js +0 -61
  451. package/build/components/global-styles/screen-border.js.map +0 -1
  452. package/build/components/global-styles/screen-effects.js +0 -61
  453. package/build/components/global-styles/screen-effects.js.map +0 -1
  454. package/build/components/global-styles/screen-filters.js +0 -46
  455. package/build/components/global-styles/screen-filters.js.map +0 -1
  456. package/build/components/global-styles/screen-variations.js +0 -71
  457. package/build/components/global-styles/screen-variations.js.map +0 -1
  458. package/build/components/navigate-to-link/index.js +0 -51
  459. package/build/components/navigate-to-link/index.js.map +0 -1
  460. package/build/components/routes/index.js +0 -60
  461. package/build/components/routes/index.js.map +0 -1
  462. package/build/components/sidebar-edit-mode/template-card/last-revision.js.map +0 -1
  463. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -19
  464. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +0 -1
  465. package/build/components/template-details/edit-template-title.js +0 -42
  466. package/build/components/template-details/edit-template-title.js.map +0 -1
  467. package/build/components/template-details/index.js +0 -103
  468. package/build/components/template-details/index.js.map +0 -1
  469. package/build/components/template-details/template-areas.js +0 -160
  470. package/build/components/template-details/template-areas.js.map +0 -1
  471. package/build/components/template-details/template-part-area-selector.js +0 -48
  472. package/build/components/template-details/template-part-area-selector.js.map +0 -1
  473. package/build/hooks/commands/index.js +0 -19
  474. package/build/hooks/commands/index.js.map +0 -1
  475. package/build/hooks/commands/use-navigation-commands.js +0 -126
  476. package/build/hooks/commands/use-navigation-commands.js.map +0 -1
  477. package/build/hooks/commands/use-wp-admin-commands.js +0 -97
  478. package/build/hooks/commands/use-wp-admin-commands.js.map +0 -1
  479. package/build/utils/history.js +0 -41
  480. package/build/utils/history.js.map +0 -1
  481. package/build-module/components/add-new-template/add-custom-generic-template-modal.js.map +0 -1
  482. package/build-module/components/add-new-template/add-custom-template-modal.js.map +0 -1
  483. package/build-module/components/global-styles/border-panel.js +0 -123
  484. package/build-module/components/global-styles/border-panel.js.map +0 -1
  485. package/build-module/components/global-styles/context-menu.js +0 -107
  486. package/build-module/components/global-styles/context-menu.js.map +0 -1
  487. package/build-module/components/global-styles/custom-css.js +0 -98
  488. package/build-module/components/global-styles/custom-css.js.map +0 -1
  489. package/build-module/components/global-styles/effects-panel.js +0 -43
  490. package/build-module/components/global-styles/effects-panel.js.map +0 -1
  491. package/build-module/components/global-styles/filters-panel.js +0 -40
  492. package/build-module/components/global-styles/filters-panel.js.map +0 -1
  493. package/build-module/components/global-styles/screen-border.js +0 -44
  494. package/build-module/components/global-styles/screen-border.js.map +0 -1
  495. package/build-module/components/global-styles/screen-effects.js +0 -44
  496. package/build-module/components/global-styles/screen-effects.js.map +0 -1
  497. package/build-module/components/global-styles/screen-filters.js +0 -33
  498. package/build-module/components/global-styles/screen-filters.js.map +0 -1
  499. package/build-module/components/global-styles/screen-variations.js +0 -54
  500. package/build-module/components/global-styles/screen-variations.js.map +0 -1
  501. package/build-module/components/navigate-to-link/index.js +0 -39
  502. package/build-module/components/navigate-to-link/index.js.map +0 -1
  503. package/build-module/components/routes/index.js +0 -47
  504. package/build-module/components/routes/index.js.map +0 -1
  505. package/build-module/components/sidebar-edit-mode/template-card/last-revision.js.map +0 -1
  506. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -11
  507. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +0 -1
  508. package/build-module/components/template-details/edit-template-title.js +0 -33
  509. package/build-module/components/template-details/edit-template-title.js.map +0 -1
  510. package/build-module/components/template-details/index.js +0 -83
  511. package/build-module/components/template-details/index.js.map +0 -1
  512. package/build-module/components/template-details/template-areas.js +0 -141
  513. package/build-module/components/template-details/template-areas.js.map +0 -1
  514. package/build-module/components/template-details/template-part-area-selector.js +0 -36
  515. package/build-module/components/template-details/template-part-area-selector.js.map +0 -1
  516. package/build-module/hooks/commands/index.js +0 -10
  517. package/build-module/hooks/commands/index.js.map +0 -1
  518. package/build-module/hooks/commands/use-navigation-commands.js +0 -109
  519. package/build-module/hooks/commands/use-navigation-commands.js.map +0 -1
  520. package/build-module/hooks/commands/use-wp-admin-commands.js +0 -81
  521. package/build-module/hooks/commands/use-wp-admin-commands.js.map +0 -1
  522. package/build-module/utils/history.js +0 -31
  523. package/build-module/utils/history.js.map +0 -1
  524. package/src/components/add-new-template/add-custom-generic-template-modal.js +0 -101
  525. package/src/components/global-styles/border-panel.js +0 -112
  526. package/src/components/global-styles/context-menu.js +0 -175
  527. package/src/components/global-styles/custom-css.js +0 -131
  528. package/src/components/global-styles/effects-panel.js +0 -40
  529. package/src/components/global-styles/filters-panel.js +0 -39
  530. package/src/components/global-styles/screen-border.js +0 -35
  531. package/src/components/global-styles/screen-effects.js +0 -35
  532. package/src/components/global-styles/screen-filters.js +0 -27
  533. package/src/components/global-styles/screen-variations.js +0 -46
  534. package/src/components/navigate-to-link/index.js +0 -46
  535. package/src/components/routes/index.js +0 -53
  536. package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -9
  537. package/src/components/template-details/edit-template-title.js +0 -41
  538. package/src/components/template-details/index.js +0 -113
  539. package/src/components/template-details/style.scss +0 -72
  540. package/src/components/template-details/template-areas.js +0 -164
  541. package/src/components/template-details/template-part-area-selector.js +0 -39
  542. package/src/hooks/commands/index.js +0 -10
  543. package/src/hooks/commands/use-navigation-commands.js +0 -112
  544. package/src/hooks/commands/use-wp-admin-commands.js +0 -79
  545. package/src/utils/history.js +0 -39
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/new-template.js"],"names":["DEFAULT_TEMPLATE_SLUGS","TEMPLATE_ICONS","home","postList","single","post","page","archive","search","notFound","index","list","category","author","postAuthor","taxonomy","blockMeta","date","postDate","tag","attachment","media","NewTemplate","postType","toggleProps","showIcon","showCustomTemplateModal","setShowCustomTemplateModal","showCustomGenericTemplateModal","setShowCustomGenericTemplateModal","entityForSuggestions","setEntityForSuggestions","isCreatingTemplate","setIsCreatingTemplate","history","saveEntityRecord","coreStore","createErrorNotice","createSuccessNotice","noticesStore","setTemplate","editSiteStore","createTemplate","template","isWPSuggestion","title","description","slug","newTemplate","toString","status","is_wp_suggestion","throwOnError","id","push","postId","type","canvas","rendered","error","errorMessage","message","code","missingTemplates","useMissingTemplates","length","customTemplateDescription","plus","labels","add_new","add_new_item","noArrow","map","onClick","icon","customGenericTemplateIcon","existingTemplates","defaultTemplateTypes","existingTemplateSlugs","missingDefaultTemplates","filter","includes","onClickMenuItem","_entityForSuggestions","enhancedMissingDefaultTemplateTypes","defaultTaxonomiesMenuItems","taxonomiesMenuItems","defaultPostTypesMenuItems","postTypesMenuItems","authorMenuItem","forEach","menuItem","matchIndex","findIndex","sort","template1","template2","indexOf"],"mappings":";;;;;;;;;AAUA;;AAPA;;AAQA;;AACA;;AACA;;AAkBA;;AACA;;AAKA;;AACA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AAlDA;AACA;AACA;;AAgCA;AACA;AACA;AAgBA,MAAMA,sBAAsB,GAAG,CAC9B,YAD8B,EAE9B,MAF8B,EAG9B,QAH8B,EAI9B,MAJ8B,EAK9B,OAL8B,EAM9B,SAN8B,EAO9B,QAP8B,EAQ9B,UAR8B,EA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AA1C;AACA;AACD,GArBD,EA1BC,CAgDD;;AACAP,EAAAA,mCAAmC,SAAnC,IAAAA,mCAAmC,WAAnC,YAAAA,mCAAmC,CAAEU,IAArC,CAA2C,CAAEC,SAAF,EAAaC,SAAb,KAA4B;AACtE,WACChG,sBAAsB,CAACiG,OAAvB,CAAgCF,SAAS,CAAChD,IAA1C,IACA/C,sBAAsB,CAACiG,OAAvB,CAAgCD,SAAS,CAACjD,IAA1C,CAFD;AAIA,GALD;AAMA,QAAMgB,gBAAgB,GAAG,CACxB,GAAGqB,mCADqB,EAExB,GAAG,yCAFqB,EAGxB,GAAGI,kBAHqB,EAIxB,GAAGF,mBAJqB,CAAzB;AAMA,SAAOvB,gBAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tTooltip,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tarchive,\n\tblockMeta,\n\tcategory,\n\thome,\n\tlist,\n\tmedia,\n\tnotFound,\n\tpage,\n\tplus,\n\tpost,\n\tpostAuthor,\n\tpostDate,\n\tpostList,\n\tsearch,\n\ttag,\n\tlayout as customGenericTemplateIcon,\n} from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport AddCustomTemplateModal from './add-custom-template-modal';\nimport {\n\tuseExistingTemplates,\n\tuseDefaultTemplateTypes,\n\tuseTaxonomiesMenuItems,\n\tusePostTypeMenuItems,\n\tuseAuthorMenuItem,\n\tusePostTypeArchiveMenuItems,\n} from './utils';\nimport AddCustomGenericTemplateModal from './add-custom-generic-template-modal';\nimport TemplateActionsLoadingScreen from './template-actions-loading-screen';\nimport { useHistory } from '../routes';\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\n\nconst DEFAULT_TEMPLATE_SLUGS = [\n\t'front-page',\n\t'home',\n\t'single',\n\t'page',\n\t'index',\n\t'archive',\n\t'author',\n\t'category',\n\t'date',\n\t'tag',\n\t'taxonomy',\n\t'search',\n\t'404',\n];\n\nconst TEMPLATE_ICONS = {\n\t'front-page': home,\n\thome: postList,\n\tsingle: post,\n\tpage,\n\tarchive,\n\tsearch,\n\t404: notFound,\n\tindex: list,\n\tcategory,\n\tauthor: postAuthor,\n\ttaxonomy: blockMeta,\n\tdate: postDate,\n\ttag,\n\tattachment: media,\n};\n\nexport default function NewTemplate( {\n\tpostType,\n\ttoggleProps,\n\tshowIcon = true,\n} ) {\n\tconst [ showCustomTemplateModal, setShowCustomTemplateModal ] =\n\t\tuseState( false );\n\tconst [\n\t\tshowCustomGenericTemplateModal,\n\t\tsetShowCustomGenericTemplateModal,\n\t] = useState( false );\n\tconst [ entityForSuggestions, setEntityForSuggestions ] = useState( {} );\n\tconst [ isCreatingTemplate, setIsCreatingTemplate ] = useState( false );\n\n\tconst history = useHistory();\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { setTemplate } = unlock( useDispatch( editSiteStore ) );\n\tasync function createTemplate( template, isWPSuggestion = true ) {\n\t\tif ( isCreatingTemplate ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsCreatingTemplate( true );\n\t\ttry {\n\t\t\tconst { title, description, slug } = template;\n\t\t\tconst newTemplate = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\t{\n\t\t\t\t\tdescription,\n\t\t\t\t\t// Slugs need to be strings, so this is for template `404`\n\t\t\t\t\tslug: slug.toString(),\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\ttitle,\n\t\t\t\t\t// This adds a post meta field in template that is part of `is_custom` value calculation.\n\t\t\t\t\tis_wp_suggestion: isWPSuggestion,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\t// Set template before navigating away to avoid initial stale value.\n\t\t\tsetTemplate( newTemplate.id, newTemplate.slug );\n\n\t\t\t// Navigate to the created template editor.\n\t\t\thistory.push( {\n\t\t\t\tpostId: newTemplate.id,\n\t\t\t\tpostType: newTemplate.type,\n\t\t\t\tcanvas: 'edit',\n\t\t\t} );\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tnewTemplate.title?.rendered || title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\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: __( 'An error occurred while creating the template.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsCreatingTemplate( false );\n\t\t}\n\t}\n\n\tconst missingTemplates = useMissingTemplates(\n\t\tsetEntityForSuggestions,\n\t\tsetShowCustomTemplateModal\n\t);\n\tif ( ! missingTemplates.length ) {\n\t\treturn null;\n\t}\n\n\tconst customTemplateDescription = __(\n\t\t'A custom template can be manually applied to any post or page.'\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\tclassName=\"edit-site-new-template-dropdown\"\n\t\t\t\ticon={ showIcon ? plus : null }\n\t\t\t\ttext={ showIcon ? null : postType.labels.add_new }\n\t\t\t\tlabel={ postType.labels.add_new_item }\n\t\t\t\tpopoverProps={ {\n\t\t\t\t\tnoArrow: false,\n\t\t\t\t} }\n\t\t\t\ttoggleProps={ toggleProps }\n\t\t\t>\n\t\t\t\t{ () => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isCreatingTemplate && (\n\t\t\t\t\t\t\t<TemplateActionsLoadingScreen />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<div className=\"edit-site-new-template-dropdown__menu-groups\">\n\t\t\t\t\t\t\t<MenuGroup label={ postType.labels.add_new_item }>\n\t\t\t\t\t\t\t\t{ missingTemplates.map( ( template ) => {\n\t\t\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\t\t\t\tslug,\n\t\t\t\t\t\t\t\t\t\tonClick,\n\t\t\t\t\t\t\t\t\t\ticon,\n\t\t\t\t\t\t\t\t\t} = template;\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\t\t\t\tposition=\"top right\"\n\t\t\t\t\t\t\t\t\t\t\ttext={ description }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-new-template-dropdown__menu-item-tooltip\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\t\ticon ||\n\t\t\t\t\t\t\t\t\t\t\t\t\tTEMPLATE_ICONS[ slug ] ||\n\t\t\t\t\t\t\t\t\t\t\t\t\tpost\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? onClick( template )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: createTemplate(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttemplate\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t\t\t\t\t\t{ /* TODO: This probably won't be needed if the <Tooltip> component is accessible.\n\t\t\t\t\t\t\t\t\t\t\t\t * @see https://github.com/WordPress/gutenberg/issues/48222 */ }\n\t\t\t\t\t\t\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\t\t\tposition=\"top right\"\n\t\t\t\t\t\t\t\t\ttext={ customTemplateDescription }\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-new-template-dropdown__menu-item-tooltip\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\ticon={ customGenericTemplateIcon }\n\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\tsetShowCustomGenericTemplateModal(\n\t\t\t\t\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Custom template' ) }\n\t\t\t\t\t\t\t\t\t\t{ /* TODO: This probably won't be needed if the <Tooltip> component is accessible.\n\t\t\t\t\t\t\t\t\t\t * @see https://github.com/WordPress/gutenberg/issues/48222 */ }\n\t\t\t\t\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t\t\t\t\t{ customTemplateDescription }\n\t\t\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t\t{ showCustomTemplateModal && (\n\t\t\t\t<AddCustomTemplateModal\n\t\t\t\t\tonClose={ () => setShowCustomTemplateModal( false ) }\n\t\t\t\t\tonSelect={ createTemplate }\n\t\t\t\t\tentityForSuggestions={ entityForSuggestions }\n\t\t\t\t\tisCreatingTemplate={ isCreatingTemplate }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showCustomGenericTemplateModal && (\n\t\t\t\t<AddCustomGenericTemplateModal\n\t\t\t\t\tonClose={ () => setShowCustomGenericTemplateModal( false ) }\n\t\t\t\t\tcreateTemplate={ createTemplate }\n\t\t\t\t\tisCreatingTemplate={ isCreatingTemplate }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction useMissingTemplates(\n\tsetEntityForSuggestions,\n\tsetShowCustomTemplateModal\n) {\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst existingTemplateSlugs = ( existingTemplates || [] ).map(\n\t\t( { slug } ) => slug\n\t);\n\tconst missingDefaultTemplates = ( defaultTemplateTypes || [] ).filter(\n\t\t( template ) =>\n\t\t\tDEFAULT_TEMPLATE_SLUGS.includes( template.slug ) &&\n\t\t\t! existingTemplateSlugs.includes( template.slug )\n\t);\n\tconst onClickMenuItem = ( _entityForSuggestions ) => {\n\t\tsetShowCustomTemplateModal( true );\n\t\tsetEntityForSuggestions( _entityForSuggestions );\n\t};\n\t// We need to replace existing default template types with\n\t// the create specific template functionality. The original\n\t// info (title, description, etc.) is preserved in the\n\t// used hooks.\n\tconst enhancedMissingDefaultTemplateTypes = [ ...missingDefaultTemplates ];\n\tconst { defaultTaxonomiesMenuItems, taxonomiesMenuItems } =\n\t\tuseTaxonomiesMenuItems( onClickMenuItem );\n\tconst { defaultPostTypesMenuItems, postTypesMenuItems } =\n\t\tusePostTypeMenuItems( onClickMenuItem );\n\n\tconst authorMenuItem = useAuthorMenuItem( onClickMenuItem );\n\t[\n\t\t...defaultTaxonomiesMenuItems,\n\t\t...defaultPostTypesMenuItems,\n\t\tauthorMenuItem,\n\t].forEach( ( menuItem ) => {\n\t\tif ( ! menuItem ) {\n\t\t\treturn;\n\t\t}\n\t\tconst matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(\n\t\t\t( template ) => template.slug === menuItem.slug\n\t\t);\n\t\t// Some default template types might have been filtered above from\n\t\t// `missingDefaultTemplates` because they only check for the general\n\t\t// template. So here we either replace or append the item, augmented\n\t\t// with the check if it has available specific item to create a\n\t\t// template for.\n\t\tif ( matchIndex > -1 ) {\n\t\t\tenhancedMissingDefaultTemplateTypes[ matchIndex ] = menuItem;\n\t\t} else {\n\t\t\tenhancedMissingDefaultTemplateTypes.push( menuItem );\n\t\t}\n\t} );\n\t// Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order.\n\tenhancedMissingDefaultTemplateTypes?.sort( ( template1, template2 ) => {\n\t\treturn (\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template1.slug ) -\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template2.slug )\n\t\t);\n\t} );\n\tconst missingTemplates = [\n\t\t...enhancedMissingDefaultTemplateTypes,\n\t\t...usePostTypeArchiveMenuItems(),\n\t\t...postTypesMenuItems,\n\t\t...taxonomiesMenuItems,\n\t];\n\treturn missingTemplates;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/new-template.js"],"names":["useHistory","routerPrivateApis","DEFAULT_TEMPLATE_SLUGS","TemplateListItem","title","description","onClick","width","modalContentMap","templatesList","customTemplate","customGenericTemplate","NewTemplate","postType","toggleProps","showIcon","showModal","setShowModal","modalContent","setModalContent","entityForSuggestions","setEntityForSuggestions","isCreatingTemplate","setIsCreatingTemplate","history","saveEntityRecord","coreStore","createErrorNotice","createSuccessNotice","noticesStore","setTemplate","editSiteStore","createTemplate","template","isWPSuggestion","slug","newTemplate","toString","status","is_wp_suggestion","throwOnError","id","push","postId","type","canvas","rendered","error","errorMessage","message","code","onModalClose","missingTemplates","useMissingTemplates","length","as","Toggle","Button","restToggleProps","modalTitle","labels","singular_name","plus","add_new_item","undefined","map","existingTemplates","defaultTemplateTypes","existingTemplateSlugs","missingDefaultTemplates","filter","includes","onClickMenuItem","_entityForSuggestions","enhancedMissingDefaultTemplateTypes","defaultTaxonomiesMenuItems","taxonomiesMenuItems","defaultPostTypesMenuItems","postTypesMenuItems","authorMenuItem","forEach","menuItem","matchIndex","findIndex","sort","template1","template2","indexOf"],"mappings":";;;;;;;;;AAeA;;;;AAZA;;AAKA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAQA;;AACA;;AACA;;AACA;;AAtCA;AACA;AACA;;AAGA;AACA;AACA;;AAgBA;AACA;AACA;AAeA,MAAM;AAAEA,EAAAA;AAAF,IAAiB,yBAAQC,mBAAR,CAAvB;AAEA,MAAMC,sBAAsB,GAAG,CAC9B,YAD8B,EAE9B,MAF8B,EAG9B,QAH8B,EAI9B,MAJ8B,EAK9B,OAL8B,EAM9B,SAN8B,EAO9B,QAP8B,EAQ9B,UAR8B,EAS9B,MAT8B,EAU9B,KAV8B,EAW9B,UAX8B,EAY9B,QAZ8B,EAa9B,KAb8B,CAA/B;;AAgBA,SAASC,gBAAT,OAA6D;AAAA,MAAlC;AAAEC,IAAAA,KAAF;AAASC,IAAAA,WAAT;AAAsBC,IAAAA;AAAtB,GAAkC;AAC5D,SACC,4BAAC,kBAAD;AAAQ,IAAA,OAAO,EAAGA;AAAlB,KACC,4BAAC,gCAAD;AACC,IAAA,EAAE,EAAC,MADJ;AA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C1B,QAAK,CAAEA,QAAP,EAAkB;AACjB;AACA;;AACD,UAAMC,UAAU,GAAGR,mCAAmC,CAACS,SAApC,CAChBlD,QAAF,IAAgBA,QAAQ,CAACE,IAAT,KAAkB8C,QAAQ,CAAC9C,IADzB,CAAnB,CAJ0B,CAO1B;AACA;AACA;AACA;AACA;;AACA,QAAK+C,UAAU,GAAG,CAAC,CAAnB,EAAuB;AACtBR,MAAAA,mCAAmC,CAAEQ,UAAF,CAAnC,GAAoDD,QAApD;AACA,KAFD,MAEO;AACNP,MAAAA,mCAAmC,CAAChC,IAApC,CAA0CuC,QAA1C;AACA;AACD,GArBD,EA1BgE,CAgDhE;;AACAP,EAAAA,mCAAmC,SAAnC,IAAAA,mCAAmC,WAAnC,YAAAA,mCAAmC,CAAEU,IAArC,CAA2C,CAAEC,SAAF,EAAaC,SAAb,KAA4B;AACtE,WACCpF,sBAAsB,CAACqF,OAAvB,CAAgCF,SAAS,CAAClD,IAA1C,IACAjC,sBAAsB,CAACqF,OAAvB,CAAgCD,SAAS,CAACnD,IAA1C,CAFD;AAIA,GALD;AAMA,QAAMiB,gBAAgB,GAAG,CACxB,GAAGsB,mCADqB,EAExB,GAAG,yCAFqB,EAGxB,GAAGI,kBAHqB,EAIxB,GAAGF,mBAJqB,CAAzB;AAMA,SAAOxB,gBAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalGrid as Grid,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { plus } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport AddCustomTemplateModalContent from './add-custom-template-modal-content';\nimport {\n\tuseExistingTemplates,\n\tuseDefaultTemplateTypes,\n\tuseTaxonomiesMenuItems,\n\tusePostTypeMenuItems,\n\tuseAuthorMenuItem,\n\tusePostTypeArchiveMenuItems,\n} from './utils';\nimport AddCustomGenericTemplateModalContent from './add-custom-generic-template-modal-content';\nimport TemplateActionsLoadingScreen from './template-actions-loading-screen';\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst DEFAULT_TEMPLATE_SLUGS = [\n\t'front-page',\n\t'home',\n\t'single',\n\t'page',\n\t'index',\n\t'archive',\n\t'author',\n\t'category',\n\t'date',\n\t'tag',\n\t'taxonomy',\n\t'search',\n\t'404',\n];\n\nfunction TemplateListItem( { title, description, onClick } ) {\n\treturn (\n\t\t<Button onClick={ onClick }>\n\t\t\t<VStack\n\t\t\t\tas=\"span\"\n\t\t\t\tspacing={ 2 }\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tstyle={ { width: '100%' } }\n\t\t\t>\n\t\t\t\t<Text\n\t\t\t\t\tweight={ 500 }\n\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t>\n\t\t\t\t\t{ title }\n\t\t\t\t</Text>\n\t\t\t\t<Text\n\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t>\n\t\t\t\t\t{ description }\n\t\t\t\t</Text>\n\t\t\t</VStack>\n\t\t</Button>\n\t);\n}\n\nconst modalContentMap = {\n\ttemplatesList: 1,\n\tcustomTemplate: 2,\n\tcustomGenericTemplate: 3,\n};\n\nexport default function NewTemplate( {\n\tpostType,\n\ttoggleProps,\n\tshowIcon = true,\n} ) {\n\tconst [ showModal, setShowModal ] = useState( false );\n\tconst [ modalContent, setModalContent ] = useState(\n\t\tmodalContentMap.templatesList\n\t);\n\tconst [ entityForSuggestions, setEntityForSuggestions ] = useState( {} );\n\tconst [ isCreatingTemplate, setIsCreatingTemplate ] = useState( false );\n\n\tconst history = useHistory();\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { setTemplate } = unlock( useDispatch( editSiteStore ) );\n\tasync function createTemplate( template, isWPSuggestion = true ) {\n\t\tif ( isCreatingTemplate ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsCreatingTemplate( true );\n\t\ttry {\n\t\t\tconst { title, description, slug } = template;\n\t\t\tconst newTemplate = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\t{\n\t\t\t\t\tdescription,\n\t\t\t\t\t// Slugs need to be strings, so this is for template `404`\n\t\t\t\t\tslug: slug.toString(),\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\ttitle,\n\t\t\t\t\t// This adds a post meta field in template that is part of `is_custom` value calculation.\n\t\t\t\t\tis_wp_suggestion: isWPSuggestion,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\t// Set template before navigating away to avoid initial stale value.\n\t\t\tsetTemplate( newTemplate.id, newTemplate.slug );\n\n\t\t\t// Navigate to the created template editor.\n\t\t\thistory.push( {\n\t\t\t\tpostId: newTemplate.id,\n\t\t\t\tpostType: newTemplate.type,\n\t\t\t\tcanvas: 'edit',\n\t\t\t} );\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tnewTemplate.title?.rendered || title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\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: __( 'An error occurred while creating the template.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsCreatingTemplate( false );\n\t\t}\n\t}\n\tconst onModalClose = () => {\n\t\tsetShowModal( false );\n\t\tsetModalContent( modalContentMap.templatesList );\n\t};\n\n\tconst missingTemplates = useMissingTemplates( setEntityForSuggestions, () =>\n\t\tsetModalContent( modalContentMap.customTemplate )\n\t);\n\tif ( ! missingTemplates.length ) {\n\t\treturn null;\n\t}\n\tconst { as: Toggle = Button, ...restToggleProps } = toggleProps ?? {};\n\n\tlet modalTitle = __( 'Add template' );\n\tif ( modalContent === modalContentMap.customTemplate ) {\n\t\tmodalTitle = sprintf(\n\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t__( 'Add template: %s' ),\n\t\t\tentityForSuggestions.labels.singular_name\n\t\t);\n\t} else if ( modalContent === modalContentMap.customGenericTemplate ) {\n\t\tmodalTitle = __( 'Create custom template' );\n\t}\n\treturn (\n\t\t<>\n\t\t\t{ isCreatingTemplate && <TemplateActionsLoadingScreen /> }\n\t\t\t<Toggle\n\t\t\t\t{ ...restToggleProps }\n\t\t\t\tonClick={ () => setShowModal( true ) }\n\t\t\t\ticon={ showIcon ? plus : null }\n\t\t\t\tlabel={ postType.labels.add_new_item }\n\t\t\t>\n\t\t\t\t{ showIcon ? null : postType.labels.add_new_item }\n\t\t\t</Toggle>\n\t\t\t{ showModal && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ modalTitle }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'edit-site-add-new-template__modal',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'edit-site-add-new-template__modal_template_list':\n\t\t\t\t\t\t\t\tmodalContent === modalContentMap.templatesList,\n\t\t\t\t\t\t\t'edit-site-custom-template-modal':\n\t\t\t\t\t\t\t\tmodalContent === modalContentMap.customTemplate,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tonRequestClose={ onModalClose }\n\t\t\t\t\toverlayClassName={\n\t\t\t\t\t\tmodalContent === modalContentMap.customGenericTemplate\n\t\t\t\t\t\t\t? 'edit-site-custom-generic-template__modal'\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ modalContent === modalContentMap.templatesList && (\n\t\t\t\t\t\t<Grid\n\t\t\t\t\t\t\tcolumns={ 3 }\n\t\t\t\t\t\t\tgap={ 4 }\n\t\t\t\t\t\t\talign=\"flex-start\"\n\t\t\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\t\t\tclassName=\"edit-site-add-new-template__template-list__contents\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ missingTemplates.map( ( template ) => {\n\t\t\t\t\t\t\t\tconst { title, description, slug, onClick } =\n\t\t\t\t\t\t\t\t\ttemplate;\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<TemplateListItem\n\t\t\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\t\t\t\t\tdescription={ description }\n\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\tonClick\n\t\t\t\t\t\t\t\t\t\t\t\t? onClick( template )\n\t\t\t\t\t\t\t\t\t\t\t\t: createTemplate( template )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t<TemplateListItem\n\t\t\t\t\t\t\t\ttitle={ __( 'Custom template' ) }\n\t\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t\t'A custom template can be manually applied to any post or page.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetModalContent(\n\t\t\t\t\t\t\t\t\t\tmodalContentMap.customGenericTemplate\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Grid>\n\t\t\t\t\t) }\n\t\t\t\t\t{ modalContent === modalContentMap.customTemplate && (\n\t\t\t\t\t\t<AddCustomTemplateModalContent\n\t\t\t\t\t\t\tonSelect={ createTemplate }\n\t\t\t\t\t\t\tentityForSuggestions={ entityForSuggestions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ modalContent ===\n\t\t\t\t\t\tmodalContentMap.customGenericTemplate && (\n\t\t\t\t\t\t<AddCustomGenericTemplateModalContent\n\t\t\t\t\t\t\tonClose={ onModalClose }\n\t\t\t\t\t\t\tcreateTemplate={ createTemplate }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction useMissingTemplates( setEntityForSuggestions, onClick ) {\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst existingTemplateSlugs = ( existingTemplates || [] ).map(\n\t\t( { slug } ) => slug\n\t);\n\tconst missingDefaultTemplates = ( defaultTemplateTypes || [] ).filter(\n\t\t( template ) =>\n\t\t\tDEFAULT_TEMPLATE_SLUGS.includes( template.slug ) &&\n\t\t\t! existingTemplateSlugs.includes( template.slug )\n\t);\n\tconst onClickMenuItem = ( _entityForSuggestions ) => {\n\t\tonClick?.();\n\t\tsetEntityForSuggestions( _entityForSuggestions );\n\t};\n\t// We need to replace existing default template types with\n\t// the create specific template functionality. The original\n\t// info (title, description, etc.) is preserved in the\n\t// used hooks.\n\tconst enhancedMissingDefaultTemplateTypes = [ ...missingDefaultTemplates ];\n\tconst { defaultTaxonomiesMenuItems, taxonomiesMenuItems } =\n\t\tuseTaxonomiesMenuItems( onClickMenuItem );\n\tconst { defaultPostTypesMenuItems, postTypesMenuItems } =\n\t\tusePostTypeMenuItems( onClickMenuItem );\n\n\tconst authorMenuItem = useAuthorMenuItem( onClickMenuItem );\n\t[\n\t\t...defaultTaxonomiesMenuItems,\n\t\t...defaultPostTypesMenuItems,\n\t\tauthorMenuItem,\n\t].forEach( ( menuItem ) => {\n\t\tif ( ! menuItem ) {\n\t\t\treturn;\n\t\t}\n\t\tconst matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(\n\t\t\t( template ) => template.slug === menuItem.slug\n\t\t);\n\t\t// Some default template types might have been filtered above from\n\t\t// `missingDefaultTemplates` because they only check for the general\n\t\t// template. So here we either replace or append the item, augmented\n\t\t// with the check if it has available specific item to create a\n\t\t// template for.\n\t\tif ( matchIndex > -1 ) {\n\t\t\tenhancedMissingDefaultTemplateTypes[ matchIndex ] = menuItem;\n\t\t} else {\n\t\t\tenhancedMissingDefaultTemplateTypes.push( menuItem );\n\t\t}\n\t} );\n\t// Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order.\n\tenhancedMissingDefaultTemplateTypes?.sort( ( template1, template2 ) => {\n\t\treturn (\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template1.slug ) -\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template2.slug )\n\t\t);\n\t} );\n\tconst missingTemplates = [\n\t\t...enhancedMissingDefaultTemplateTypes,\n\t\t...usePostTypeArchiveMenuItems(),\n\t\t...postTypesMenuItems,\n\t\t...taxonomiesMenuItems,\n\t];\n\treturn missingTemplates;\n}\n"]}
@@ -23,12 +23,14 @@ var _i18n = require("@wordpress/i18n");
23
23
 
24
24
  var _plugins = require("@wordpress/plugins");
25
25
 
26
- var _routes = require("../routes");
26
+ var _router = require("@wordpress/router");
27
27
 
28
28
  var _layout = _interopRequireDefault(require("../layout"));
29
29
 
30
30
  var _globalStylesProvider = require("../global-styles/global-styles-provider");
31
31
 
32
+ var _privateApis = require("../../private-apis");
33
+
32
34
  /**
33
35
  * WordPress dependencies
34
36
  */
@@ -36,6 +38,10 @@ var _globalStylesProvider = require("../global-styles/global-styles-provider");
36
38
  /**
37
39
  * Internal dependencies
38
40
  */
41
+ const {
42
+ RouterProvider
43
+ } = (0, _privateApis.unlock)(_router.privateApis);
44
+
39
45
  function App() {
40
46
  const {
41
47
  createErrorNotice
@@ -51,7 +57,7 @@ function App() {
51
57
  style: {
52
58
  height: '100%'
53
59
  }
54
- }, (0, _element.createElement)(_components.SlotFillProvider, null, (0, _element.createElement)(_globalStylesProvider.GlobalStylesProvider, null, (0, _element.createElement)(_components.Popover.Slot, null), (0, _element.createElement)(_editor.UnsavedChangesWarning, null), (0, _element.createElement)(_routes.Routes, null, (0, _element.createElement)(_layout.default, null), (0, _element.createElement)(_plugins.PluginArea, {
60
+ }, (0, _element.createElement)(_components.SlotFillProvider, null, (0, _element.createElement)(_globalStylesProvider.GlobalStylesProvider, null, (0, _element.createElement)(_components.Popover.Slot, null), (0, _element.createElement)(_editor.UnsavedChangesWarning, null), (0, _element.createElement)(RouterProvider, null, (0, _element.createElement)(_layout.default, null), (0, _element.createElement)(_plugins.PluginArea, {
55
61
  onError: onPluginAreaError
56
62
  })))));
57
63
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/app/index.js"],"names":["App","createErrorNotice","noticesStore","onPluginAreaError","name","height"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAhBA;AACA;AACA;;AASA;AACA;AACA;AAKe,SAASA,GAAT,GAAe;AAC7B,QAAM;AAAEC,IAAAA;AAAF,MAAwB,uBAAaC,cAAb,CAA9B;;AAEA,WAASC,iBAAT,CAA4BC,IAA5B,EAAmC;AAClCH,IAAAA,iBAAiB,CAChB;AACC;AACA,kBACC,kEADD,CAFD,EAKCG,IALD,CADgB,CAAjB;AASA;;AAED,SACC,4BAAC,mCAAD;AAAkB,IAAA,KAAK,EAAG;AAAEC,MAAAA,MAAM,EAAE;AAAV;AAA1B,KACC,4BAAC,4BAAD,QACC,4BAAC,0CAAD,QACC,4BAAC,mBAAD,CAAS,IAAT,OADD,EAEC,4BAAC,6BAAD,OAFD,EAGC,4BAAC,cAAD,QACC,4BAAC,eAAD,OADD,EAEC,4BAAC,mBAAD;AAAY,IAAA,OAAO,EAAGF;AAAtB,IAFD,CAHD,CADD,CADD,CADD;AAcA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SlotFillProvider, Popover } from '@wordpress/components';\nimport { UnsavedChangesWarning } from '@wordpress/editor';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useDispatch } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { PluginArea } from '@wordpress/plugins';\n\n/**\n * Internal dependencies\n */\nimport { Routes } from '../routes';\nimport Layout from '../layout';\nimport { GlobalStylesProvider } from '../global-styles/global-styles-provider';\n\nexport default function App() {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\treturn (\n\t\t<ShortcutProvider style={ { height: '100%' } }>\n\t\t\t<SlotFillProvider>\n\t\t\t\t<GlobalStylesProvider>\n\t\t\t\t\t<Popover.Slot />\n\t\t\t\t\t<UnsavedChangesWarning />\n\t\t\t\t\t<Routes>\n\t\t\t\t\t\t<Layout />\n\t\t\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t\t</Routes>\n\t\t\t\t</GlobalStylesProvider>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/app/index.js"],"names":["RouterProvider","routerPrivateApis","App","createErrorNotice","noticesStore","onPluginAreaError","name","height"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAUA;AACA;AACA;AAKA,MAAM;AAAEA,EAAAA;AAAF,IAAqB,yBAAQC,mBAAR,CAA3B;;AAEe,SAASC,GAAT,GAAe;AAC7B,QAAM;AAAEC,IAAAA;AAAF,MAAwB,uBAAaC,cAAb,CAA9B;;AAEA,WAASC,iBAAT,CAA4BC,IAA5B,EAAmC;AAClCH,IAAAA,iBAAiB,CAChB;AACC;AACA,kBACC,kEADD,CAFD,EAKCG,IALD,CADgB,CAAjB;AASA;;AAED,SACC,4BAAC,mCAAD;AAAkB,IAAA,KAAK,EAAG;AAAEC,MAAAA,MAAM,EAAE;AAAV;AAA1B,KACC,4BAAC,4BAAD,QACC,4BAAC,0CAAD,QACC,4BAAC,mBAAD,CAAS,IAAT,OADD,EAEC,4BAAC,6BAAD,OAFD,EAGC,4BAAC,cAAD,QACC,4BAAC,eAAD,OADD,EAEC,4BAAC,mBAAD;AAAY,IAAA,OAAO,EAAGF;AAAtB,IAFD,CAHD,CADD,CADD,CADD;AAcA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SlotFillProvider, Popover } from '@wordpress/components';\nimport { UnsavedChangesWarning } from '@wordpress/editor';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useDispatch } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { PluginArea } from '@wordpress/plugins';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport Layout from '../layout';\nimport { GlobalStylesProvider } from '../global-styles/global-styles-provider';\nimport { unlock } from '../../private-apis';\n\nconst { RouterProvider } = unlock( routerPrivateApis );\n\nexport default function App() {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\treturn (\n\t\t<ShortcutProvider style={ { height: '100%' } }>\n\t\t\t<SlotFillProvider>\n\t\t\t\t<GlobalStylesProvider>\n\t\t\t\t\t<Popover.Slot />\n\t\t\t\t\t<UnsavedChangesWarning />\n\t\t\t\t\t<RouterProvider>\n\t\t\t\t\t\t<Layout />\n\t\t\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t\t</RouterProvider>\n\t\t\t\t</GlobalStylesProvider>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n"]}
@@ -13,7 +13,9 @@ var _icons = require("@wordpress/icons");
13
13
 
14
14
  var _i18n = require("@wordpress/i18n");
15
15
 
16
- var _routes = require("../routes");
16
+ var _router = require("@wordpress/router");
17
+
18
+ var _privateApis = require("../../private-apis");
17
19
 
18
20
  /**
19
21
  * WordPress dependencies
@@ -22,11 +24,16 @@ var _routes = require("../routes");
22
24
  /**
23
25
  * Internal dependencies
24
26
  */
27
+ const {
28
+ useLocation,
29
+ useHistory
30
+ } = (0, _privateApis.unlock)(_router.privateApis);
31
+
25
32
  function BackButton() {
26
33
  var _location$state;
27
34
 
28
- const location = (0, _routes.useLocation)();
29
- const history = (0, _routes.useHistory)();
35
+ const location = useLocation();
36
+ const history = useHistory();
30
37
  const isTemplatePart = location.params.postType === 'wp_template_part';
31
38
  const previousTemplateId = (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.fromTemplateId;
32
39
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/back-button.js"],"names":["BackButton","location","history","isTemplatePart","params","postType","previousTemplateId","state","fromTemplateId","arrowLeft","back"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;AAGA,SAASA,UAAT,GAAsB;AAAA;;AACrB,QAAMC,QAAQ,GAAG,0BAAjB;AACA,QAAMC,OAAO,GAAG,yBAAhB;AACA,QAAMC,cAAc,GAAGF,QAAQ,CAACG,MAAT,CAAgBC,QAAhB,KAA6B,kBAApD;AACA,QAAMC,kBAAkB,sBAAGL,QAAQ,CAACM,KAAZ,oDAAG,gBAAgBC,cAA3C;;AAEA,MAAK,CAAEL,cAAF,IAAoB,CAAEG,kBAA3B,EAAgD;AAC/C,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,sCADX;AAEC,IAAA,IAAI,EAAGG,gBAFR;AAGC,IAAA,OAAO,EAAG,MAAM;AACfP,MAAAA,OAAO,CAACQ,IAAR;AACA;AALF,KAOG,cAAI,MAAJ,CAPH,CADD;AAWA;;eAEcV,U","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { arrowLeft } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useLocation, useHistory } from '../routes';\n\nfunction BackButton() {\n\tconst location = useLocation();\n\tconst history = useHistory();\n\tconst isTemplatePart = location.params.postType === 'wp_template_part';\n\tconst previousTemplateId = location.state?.fromTemplateId;\n\n\tif ( ! isTemplatePart || ! previousTemplateId ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"edit-site-visual-editor__back-button\"\n\t\t\ticon={ arrowLeft }\n\t\t\tonClick={ () => {\n\t\t\t\thistory.back();\n\t\t\t} }\n\t\t>\n\t\t\t{ __( 'Back' ) }\n\t\t</Button>\n\t);\n}\n\nexport default BackButton;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/back-button.js"],"names":["useLocation","useHistory","routerPrivateApis","BackButton","location","history","isTemplatePart","params","postType","previousTemplateId","state","fromTemplateId","arrowLeft","back"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGA,MAAM;AAAEA,EAAAA,WAAF;AAAeC,EAAAA;AAAf,IAA8B,yBAAQC,mBAAR,CAApC;;AAEA,SAASC,UAAT,GAAsB;AAAA;;AACrB,QAAMC,QAAQ,GAAGJ,WAAW,EAA5B;AACA,QAAMK,OAAO,GAAGJ,UAAU,EAA1B;AACA,QAAMK,cAAc,GAAGF,QAAQ,CAACG,MAAT,CAAgBC,QAAhB,KAA6B,kBAApD;AACA,QAAMC,kBAAkB,sBAAGL,QAAQ,CAACM,KAAZ,oDAAG,gBAAgBC,cAA3C;;AAEA,MAAK,CAAEL,cAAF,IAAoB,CAAEG,kBAA3B,EAAgD;AAC/C,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,sCADX;AAEC,IAAA,IAAI,EAAGG,gBAFR;AAGC,IAAA,OAAO,EAAG,MAAM;AACfP,MAAAA,OAAO,CAACQ,IAAR;AACA;AALF,KAOG,cAAI,MAAJ,CAPH,CADD;AAWA;;eAEcV,U","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { arrowLeft } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nfunction BackButton() {\n\tconst location = useLocation();\n\tconst history = useHistory();\n\tconst isTemplatePart = location.params.postType === 'wp_template_part';\n\tconst previousTemplateId = location.state?.fromTemplateId;\n\n\tif ( ! isTemplatePart || ! previousTemplateId ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"edit-site-visual-editor__back-button\"\n\t\t\ticon={ arrowLeft }\n\t\t\tonClick={ () => {\n\t\t\t\thistory.back();\n\t\t\t} }\n\t\t>\n\t\t\t{ __( 'Back' ) }\n\t\t</Button>\n\t);\n}\n\nexport default BackButton;\n"]}
@@ -11,14 +11,24 @@ var _element = require("@wordpress/element");
11
11
 
12
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
13
 
14
+ var _classnames = _interopRequireDefault(require("classnames"));
15
+
14
16
  var _blockEditor = require("@wordpress/block-editor");
15
17
 
16
18
  var _data = require("@wordpress/data");
17
19
 
20
+ var _keycodes = require("@wordpress/keycodes");
21
+
22
+ var _i18n = require("@wordpress/i18n");
23
+
18
24
  var _privateApis = require("../../private-apis");
19
25
 
20
26
  var _store = require("../../store");
21
27
 
28
+ /**
29
+ * External dependencies
30
+ */
31
+
22
32
  /**
23
33
  * WordPress dependencies
24
34
  */
@@ -47,6 +57,31 @@ function EditorCanvas(_ref) {
47
57
  } = (0, _privateApis.unlock)((0, _data.useDispatch)(_store.store));
48
58
  const deviceStyles = (0, _blockEditor.__experimentalUseResizeCanvas)(deviceType);
49
59
  const mouseMoveTypingRef = (0, _blockEditor.__unstableUseMouseMoveTypingReset)();
60
+ const [isFocused, setIsFocused] = (0, _element.useState)(false);
61
+ (0, _element.useEffect)(() => {
62
+ if (canvasMode === 'edit') {
63
+ setIsFocused(false);
64
+ }
65
+ }, [canvasMode]);
66
+ const viewModeProps = {
67
+ 'aria-label': (0, _i18n.__)('Editor Canvas'),
68
+ role: 'button',
69
+ tabIndex: 0,
70
+ onFocus: () => setIsFocused(true),
71
+ onBlur: () => setIsFocused(false),
72
+ onKeyDown: event => {
73
+ const {
74
+ keyCode
75
+ } = event;
76
+
77
+ if (keyCode === _keycodes.ENTER || keyCode === _keycodes.SPACE) {
78
+ event.preventDefault();
79
+ setCanvasMode('edit');
80
+ }
81
+ },
82
+ onClick: () => setCanvasMode('edit'),
83
+ readonly: true
84
+ };
50
85
  return (0, _element.createElement)(_blockEditor.__unstableIframe, (0, _extends2.default)({
51
86
  expand: isZoomOutMode,
52
87
  scale: isZoomOutMode && 0.45 || undefined,
@@ -54,12 +89,10 @@ function EditorCanvas(_ref) {
54
89
  style: enableResizing ? {} : deviceStyles,
55
90
  ref: mouseMoveTypingRef,
56
91
  name: "editor-canvas",
57
- className: "edit-site-visual-editor__editor-canvas"
58
- }, props, {
59
- role: canvasMode === 'view' ? 'button' : undefined,
60
- onClick: canvasMode === 'view' ? () => setCanvasMode('edit') : undefined,
61
- readonly: canvasMode === 'view'
62
- }), (0, _element.createElement)(_blockEditor.__unstableEditorStyles, {
92
+ className: (0, _classnames.default)('edit-site-visual-editor__editor-canvas', {
93
+ 'is-focused': isFocused && canvasMode === 'view'
94
+ })
95
+ }, props, canvasMode === 'view' ? viewModeProps : {}), (0, _element.createElement)(_blockEditor.__unstableEditorStyles, {
63
96
  styles: settings.styles
64
97
  }), (0, _element.createElement)("style", null, // Forming a "block formatting context" to prevent margin collapsing.
65
98
  // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/editor-canvas.js"],"names":["EditorCanvas","enableResizing","settings","children","props","canvasMode","deviceType","isZoomOutMode","select","editSiteStore","__experimentalGetPreviewDeviceType","blockEditorStore","__unstableGetEditorMode","getCanvasMode","setCanvasMode","deviceStyles","mouseMoveTypingRef","undefined","styles"],"mappings":";;;;;;;;;;;;;AAGA;;AAOA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAUA;AACA;AACA;AAIA,SAASA,YAAT,OAA0E;AAAA,MAAnD;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,QAAlB;AAA4BC,IAAAA,QAA5B;AAAsC,OAAGC;AAAzC,GAAmD;AACzE,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,UAAd;AAA0BC,IAAAA;AAA1B,MAA4C,qBAC/CC,MAAF,KAAgB;AACfF,IAAAA,UAAU,EACTE,MAAM,CAAEC,YAAF,CAAN,CAAwBC,kCAAxB,EAFc;AAGfH,IAAAA,aAAa,EACZC,MAAM,CAAEG,kBAAF,CAAN,CAA2BC,uBAA3B,OACA,UALc;AAMfP,IAAAA,UAAU,EAAE,yBAAQG,MAAM,CAAEC,YAAF,CAAd,EAAkCI,aAAlC;AANG,GAAhB,CADiD,EASjD,EATiD,CAAlD;AAWA,QAAM;AAAEC,IAAAA;AAAF,MAAoB,yBAAQ,uBAAaL,YAAb,CAAR,CAA1B;AACA,QAAMM,YAAY,GAAG,gDAAiBT,UAAjB,CAArB;AACA,QAAMU,kBAAkB,GAAG,qDAA3B;AAEA,SACC,4BAAC,6BAAD;AACC,IAAA,MAAM,EAAGT,aADV;AAEC,IAAA,KAAK,EAAKA,aAAa,IAAI,IAAnB,IAA6BU,SAFtC;AAGC,IAAA,SAAS,EAAGV,aAAa,GAAG,GAAH,GAASU,SAHnC;AAIC,IAAA,KAAK,EAAGhB,cAAc,GAAG,EAAH,GAAQc,YAJ/B;AAKC,IAAA,GAAG,EAAGC,kBALP;AAMC,IAAA,IAAI,EAAC,eANN;AAOC,IAAA,SAAS,EAAC;AAPX,KAQMZ,KARN;AASC,IAAA,IAAI,EAAGC,UAAU,KAAK,MAAf,GAAwB,QAAxB,GAAmCY,SAT3C;AAUC,IAAA,OAAO,EACNZ,UAAU,KAAK,MAAf,GACG,MAAMS,aAAa,CAAE,MAAF,CADtB,GAEGG,SAbL;AAeC,IAAA,QAAQ,EAAGZ,UAAU,KAAK;AAf3B,MAiBC,4BAAC,mCAAD;AAAc,IAAA,MAAM,EAAGH,QAAQ,CAACgB;AAAhC,IAjBD,EAkBC,2CACC;AACA;AACC,0CACA;AACA;AACAjB,EAAAA,cAAc,GAAG,yBAAH,GAA+B,EAC7C,4BACAI,UAAU,KAAK,MAAf,GAAwB,kBAAxB,GAA6C,EAC7C,IATF,CAlBD,EA6BGF,QA7BH,CADD;AAiCA;;eAEcH,Y","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\nfunction EditorCanvas( { enableResizing, settings, children, ...props } ) {\n\tconst { canvasMode, deviceType, isZoomOutMode } = useSelect(\n\t\t( select ) => ( {\n\t\t\tdeviceType:\n\t\t\t\tselect( editSiteStore ).__experimentalGetPreviewDeviceType(),\n\t\t\tisZoomOutMode:\n\t\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() ===\n\t\t\t\t'zoom-out',\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst mouseMoveTypingRef = useMouseMoveTypingReset();\n\n\treturn (\n\t\t<Iframe\n\t\t\texpand={ isZoomOutMode }\n\t\t\tscale={ ( isZoomOutMode && 0.45 ) || undefined }\n\t\t\tframeSize={ isZoomOutMode ? 100 : undefined }\n\t\t\tstyle={ enableResizing ? {} : deviceStyles }\n\t\t\tref={ mouseMoveTypingRef }\n\t\t\tname=\"editor-canvas\"\n\t\t\tclassName=\"edit-site-visual-editor__editor-canvas\"\n\t\t\t{ ...props }\n\t\t\trole={ canvasMode === 'view' ? 'button' : undefined }\n\t\t\tonClick={\n\t\t\t\tcanvasMode === 'view'\n\t\t\t\t\t? () => setCanvasMode( 'edit' )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\treadonly={ canvasMode === 'view' }\n\t\t>\n\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t<style>{\n\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t`.is-root-container{display:flow-root;${\n\t\t\t\t\t// Some themes will have `min-height: 100vh` for the root container,\n\t\t\t\t\t// which isn't a requirement in auto resize mode.\n\t\t\t\t\tenableResizing ? 'min-height:0!important;' : ''\n\t\t\t\t}}body{position:relative; ${\n\t\t\t\t\tcanvasMode === 'view' ? 'cursor: pointer;' : ''\n\t\t\t\t}}}`\n\t\t\t}</style>\n\t\t\t{ children }\n\t\t</Iframe>\n\t);\n}\n\nexport default EditorCanvas;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/editor-canvas.js"],"names":["EditorCanvas","enableResizing","settings","children","props","canvasMode","deviceType","isZoomOutMode","select","editSiteStore","__experimentalGetPreviewDeviceType","blockEditorStore","__unstableGetEditorMode","getCanvasMode","setCanvasMode","deviceStyles","mouseMoveTypingRef","isFocused","setIsFocused","viewModeProps","role","tabIndex","onFocus","onBlur","onKeyDown","event","keyCode","ENTER","SPACE","preventDefault","onClick","readonly","undefined","styles"],"mappings":";;;;;;;;;AAiBA;;;;AAdA;;AAKA;;AAOA;;AACA;;AAEA;;AAKA;;AACA;;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;AAIA,SAASA,YAAT,OAA0E;AAAA,MAAnD;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,QAAlB;AAA4BC,IAAAA,QAA5B;AAAsC,OAAGC;AAAzC,GAAmD;AACzE,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,UAAd;AAA0BC,IAAAA;AAA1B,MAA4C,qBAC/CC,MAAF,KAAgB;AACfF,IAAAA,UAAU,EACTE,MAAM,CAAEC,YAAF,CAAN,CAAwBC,kCAAxB,EAFc;AAGfH,IAAAA,aAAa,EACZC,MAAM,CAAEG,kBAAF,CAAN,CAA2BC,uBAA3B,OACA,UALc;AAMfP,IAAAA,UAAU,EAAE,yBAAQG,MAAM,CAAEC,YAAF,CAAd,EAAkCI,aAAlC;AANG,GAAhB,CADiD,EASjD,EATiD,CAAlD;AAWA,QAAM;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ANN;AAOC,IAAA,SAAS,EAAG,yBAAY,wCAAZ,EAAsD;AACjE,oBAAcC,SAAS,IAAIZ,UAAU,KAAK;AADuB,KAAtD;AAPb,KAUMD,KAVN,EAWQC,UAAU,KAAK,MAAf,GAAwBc,aAAxB,GAAwC,EAXhD,GAaC,4BAAC,mCAAD;AAAc,IAAA,MAAM,EAAGjB,QAAQ,CAAC+B;AAAhC,IAbD,EAcC,2CACC;AACA;AACC,0CACA;AACA;AACAhC,EAAAA,cAAc,GAAG,yBAAH,GAA+B,EAC7C,4BACAI,UAAU,KAAK,MAAf,GAAwB,kBAAxB,GAA6C,EAC7C,IATF,CAdD,EAyBGF,QAzBH,CADD;AA6BA;;eAEcH,Y","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\nimport { useState, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\nfunction EditorCanvas( { enableResizing, settings, children, ...props } ) {\n\tconst { canvasMode, deviceType, isZoomOutMode } = useSelect(\n\t\t( select ) => ( {\n\t\t\tdeviceType:\n\t\t\t\tselect( editSiteStore ).__experimentalGetPreviewDeviceType(),\n\t\t\tisZoomOutMode:\n\t\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() ===\n\t\t\t\t'zoom-out',\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst mouseMoveTypingRef = useMouseMoveTypingReset();\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( canvasMode === 'edit' ) {\n\t\t\tsetIsFocused( false );\n\t\t}\n\t}, [ canvasMode ] );\n\n\tconst viewModeProps = {\n\t\t'aria-label': __( 'Editor Canvas' ),\n\t\trole: 'button',\n\t\ttabIndex: 0,\n\t\tonFocus: () => setIsFocused( true ),\n\t\tonBlur: () => setIsFocused( false ),\n\t\tonKeyDown: ( event ) => {\n\t\t\tconst { keyCode } = event;\n\t\t\tif ( keyCode === ENTER || keyCode === SPACE ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t}\n\t\t},\n\t\tonClick: () => setCanvasMode( 'edit' ),\n\t\treadonly: true,\n\t};\n\n\treturn (\n\t\t<Iframe\n\t\t\texpand={ isZoomOutMode }\n\t\t\tscale={ ( isZoomOutMode && 0.45 ) || undefined }\n\t\t\tframeSize={ isZoomOutMode ? 100 : undefined }\n\t\t\tstyle={ enableResizing ? {} : deviceStyles }\n\t\t\tref={ mouseMoveTypingRef }\n\t\t\tname=\"editor-canvas\"\n\t\t\tclassName={ classnames( 'edit-site-visual-editor__editor-canvas', {\n\t\t\t\t'is-focused': isFocused && canvasMode === 'view',\n\t\t\t} ) }\n\t\t\t{ ...props }\n\t\t\t{ ...( canvasMode === 'view' ? viewModeProps : {} ) }\n\t\t>\n\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t<style>{\n\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t`.is-root-container{display:flow-root;${\n\t\t\t\t\t// Some themes will have `min-height: 100vh` for the root container,\n\t\t\t\t\t// which isn't a requirement in auto resize mode.\n\t\t\t\t\tenableResizing ? 'min-height:0!important;' : ''\n\t\t\t\t}}body{position:relative; ${\n\t\t\t\t\tcanvasMode === 'view' ? 'cursor: pointer;' : ''\n\t\t\t\t}}}`\n\t\t\t}</style>\n\t\t\t{ children }\n\t\t</Iframe>\n\t);\n}\n\nexport default EditorCanvas;\n"]}
@@ -139,9 +139,7 @@ function BlockEditor() {
139
139
  let [editorCanvasView] = _ref2;
140
140
  return editorCanvasView ? (0, _element.createElement)("div", {
141
141
  className: "edit-site-visual-editor is-focus-mode"
142
- }, (0, _element.createElement)(_resizableEditor.default, {
143
- enableResizing: true
144
- }, editorCanvasView)) : (0, _element.createElement)(_blockEditor.BlockTools, {
142
+ }, editorCanvasView) : (0, _element.createElement)(_blockEditor.BlockTools, {
145
143
  className: (0, _classnames.default)('edit-site-visual-editor', {
146
144
  'is-focus-mode': isTemplatePart || !!editorCanvasView,
147
145
  'is-view-mode': isViewMode
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["ExperimentalBlockEditorProvider","blockEditorPrivateApis","LAYOUT","type","alignments","BlockEditor","setIsInserterOpened","editSiteStore","storedSettings","templateType","canvasMode","select","getSettings","getEditedPostType","getCanvasMode","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","coreStore","getBlockPatterns","getBlockPatternCategories","blockPatterns","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","settings","restStoredSettings","inserterMediaCategories","blocks","onInput","onChange","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","blockEditorStore","resizeObserver","sizes","isTemplatePart","hasBlocks","length","enableResizing","isViewMode","showBlockAppender","undefined","editorCanvasView","event","target","currentTarget","height"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AAUA;;AAKA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;A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AAC,uBAAD;AACC,MAAA,SAAS,EAAG,yBAAY,yBAAZ,EAAuC;AAClD,yBACCP,cAAc,IAAI,CAAC,CAAEO,gBAF4B;AAGlD,wBAAgBH;AAHkC,OAAvC,CADb;AAMC,MAAA,oBAAoB,EAAGX,UANxB;AAOC,MAAA,OAAO,EAAKe,KAAF,IAAa;AACtB;AACA,YAAKA,KAAK,CAACC,MAAN,KAAiBD,KAAK,CAACE,aAA5B,EAA4C;AAC3Cd,UAAAA,kBAAkB;AAClB;AACD;AAZF,OAcC,4BAAC,yCAAD,CAA8B,QAA9B,OAdD,EAeC,4BAAC,mBAAD,OAfD,EAgBC,4BAAC,wBAAD;AACC,MAAA,cAAc,EAAGO,cADlB;AAEC,MAAA,MAAM,mBAAGJ,KAAK,CAACY,MAAT,yDAAmB;AAF1B,OAIC,4BAAC,qBAAD;AACC,MAAA,cAAc,EAAGR,cADlB;AAEC,MAAA,QAAQ,EAAGhB,QAFZ;AAGC,MAAA,UAAU,EAAGO,UAHd;AAIC,MAAA,QAAQ,EAAGpC,UAAU,KAAK;AAJ3B,OAMGwC,cANH,EAOC,4BAAC,sBAAD;AACC,MAAA,SAAS,EAAC,mDADX;AAEC,MAAA,oBAAoB,EAAGhD,MAFxB;AAGC,MAAA,cAAc,EAAGuD;AAHlB,MAPD,CAJD,CAhBD,CARA;AAAA,GADH,CAXD,EA0DC,4BAAC,uCAAD,OA1DD,CADD;AA8DA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo, useRef } from '@wordpress/element';\nimport { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data';\nimport {\n\tBlockList,\n\tBlockInspector,\n\tBlockTools,\n\t__unstableUseClipboardHandler as useClipboardHandler,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tBlockEditorKeyboardShortcuts,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tuseMergeRefs,\n\tuseViewportMatch,\n\tuseResizeObserver,\n} from '@wordpress/compose';\nimport { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';\n\n/**\n * Internal dependencies\n */\nimport inserterMediaCategories from './inserter-media-categories';\nimport TemplatePartConverter from '../template-part-converter';\nimport { SidebarInspectorFill } from '../sidebar-edit-mode';\nimport { store as editSiteStore } from '../../store';\nimport BackButton from './back-button';\nimport ResizableEditor from './resizable-editor';\nimport EditorCanvas from './editor-canvas';\nimport { unlock } from '../../private-apis';\nimport EditorCanvasContainer from '../editor-canvas-container';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\n\nconst LAYOUT = {\n\ttype: 'default',\n\t// At the root level of the site editor, no alignments should be allowed.\n\talignments: [],\n};\n\nexport default function BlockEditor() {\n\tconst { setIsInserterOpened } = useDispatch( editSiteStore );\n\tconst { storedSettings, templateType, canvasMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, getEditedPostType, getCanvasMode } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tstoredSettings: getSettings( setIsInserterOpened ),\n\t\t\t\ttemplateType: getEditedPostType(),\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t};\n\t\t},\n\t\t[ setIsInserterOpened ]\n\t);\n\n\tconst settingsBlockPatterns =\n\t\tstoredSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tstoredSettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories:\n\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( templateType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, templateType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst settings = useMemo( () => {\n\t\tconst {\n\t\t\t__experimentalAdditionalBlockPatterns,\n\t\t\t__experimentalAdditionalBlockPatternCategories,\n\t\t\t...restStoredSettings\n\t\t} = storedSettings;\n\n\t\treturn {\n\t\t\t...restStoredSettings,\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t};\n\t}, [ storedSettings, blockPatterns, blockPatternCategories ] );\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplateType\n\t);\n\n\tconst contentRef = useRef();\n\tconst mergedRefs = useMergeRefs( [\n\t\tcontentRef,\n\t\tuseClipboardHandler(),\n\t\tuseTypingObserver(),\n\t] );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\n\tconst isTemplatePart = templateType === 'wp_template_part';\n\tconst hasBlocks = blocks.length !== 0;\n\tconst enableResizing =\n\t\tisTemplatePart &&\n\t\tcanvasMode !== 'view' &&\n\t\t// Disable resizing in mobile viewport.\n\t\t! isMobileViewport;\n\tconst isViewMode = canvasMode === 'view';\n\tconst showBlockAppender =\n\t\t( isTemplatePart && hasBlocks ) || isViewMode ? false : undefined;\n\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tsettings={ settings }\n\t\t\tvalue={ blocks }\n\t\t\tonInput={ onInput }\n\t\t\tonChange={ onChange }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t<TemplatePartConverter />\n\t\t\t<SidebarInspectorFill>\n\t\t\t\t<BlockInspector />\n\t\t\t</SidebarInspectorFill>\n\t\t\t<EditorCanvasContainer.Slot>\n\t\t\t\t{ ( [ editorCanvasView ] ) =>\n\t\t\t\t\teditorCanvasView ? (\n\t\t\t\t\t\t<div className=\"edit-site-visual-editor is-focus-mode\">\n\t\t\t\t\t\t\t<ResizableEditor enableResizing>\n\t\t\t\t\t\t\t\t{ editorCanvasView }\n\t\t\t\t\t\t\t</ResizableEditor>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<BlockTools\n\t\t\t\t\t\t\tclassName={ classnames( 'edit-site-visual-editor', {\n\t\t\t\t\t\t\t\t'is-focus-mode':\n\t\t\t\t\t\t\t\t\tisTemplatePart || !! editorCanvasView,\n\t\t\t\t\t\t\t\t'is-view-mode': isViewMode,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t__unstableContentRef={ contentRef }\n\t\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\t\t// Clear selected block when clicking on the gray background.\n\t\t\t\t\t\t\t\tif ( event.target === event.currentTarget ) {\n\t\t\t\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t\t\t\t\t<BackButton />\n\t\t\t\t\t\t\t<ResizableEditor\n\t\t\t\t\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\t\t\t\t\theight={ sizes.height ?? '100%' }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<EditorCanvas\n\t\t\t\t\t\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\t\tcontentRef={ mergedRefs }\n\t\t\t\t\t\t\t\t\treadonly={ canvasMode === 'view' }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ resizeObserver }\n\t\t\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-block-editor__block-list wp-site-blocks\"\n\t\t\t\t\t\t\t\t\t\t__experimentalLayout={ LAYOUT }\n\t\t\t\t\t\t\t\t\t\trenderAppender={ showBlockAppender }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</EditorCanvas>\n\t\t\t\t\t\t\t</ResizableEditor>\n\t\t\t\t\t\t</BlockTools>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t</EditorCanvasContainer.Slot>\n\t\t\t<ReusableBlocksMenuItems />\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["ExperimentalBlockEditorProvider","blockEditorPrivateApis","LAYOUT","type","alignments","BlockEditor","setIsInserterOpened","editSiteStore","storedSettings","templateType","canvasMode","select","getSettings","getEditedPostType","getCanvasMode","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","coreStore","getBlockPatterns","getBlockPatternCategories","blockPatterns","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","settings","restStoredSettings","inserterMediaCategories","blocks","onInput","onChange","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","blockEditorStore","resizeObserver","sizes","isTemplatePart","hasBlocks","length","enableResizing","isViewMode","showBlockAppender","undefined","editorCanvasView","event","target","currentTarget","height"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AAUA;;AAKA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvCA;AACA;AACA;;AAGA;AACA;AACA;;AAqBA;AACA;AACA;AAWA,MAAM;AAAEA,EAAAA;AAAF,IAAsC,yBAAQC,wBAAR,CAA5C;AAEA,MAAMC,MAAM,GAAG;AACdC,EAAAA,IAAI,EAAE,SADQ;AAEd;AACAC,EAAAA,UAAU,EAAE;AAHE,CAAf;;AAMe,SAASC,WAAT,GAAuB;AAAA;;AACrC,QAAM;AAAEC,IAAAA;AAAF,MAA0B,uBAAaC,YAAb,CAAhC;AACA,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,YAAlB;AAAgCC,IAAAA;AAAhC,MAA+C,qBAClDC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,WAAF;AAAeC,MAAAA,iBAAf;AAAkCC,MAAAA;AAAlC,QAAoD,yBACzDH,MAAM,CAAEJ,YAAF,CADmD,CAA1D;AAIA,WAAO;AACNC,MAAAA,cAAc,EAAEI,WAAW,CAAEN,mBAAF,CADrB;AAENG,MAAAA,YAAY,EAAEI,iBAAiB,EAFzB;AAGNH,MAAAA,UAAU,EAAEI,aAAa;AAHnB,KAAP;AAKA,GAXmD,EAYpD,CAAER,mBAAF,CAZoD,CAArD;AAeA,QAAMS,qBAAqB,4BAC1BP,cAAc,CAACQ,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GADH,CAXD,EAwDC,4BAAC,uCAAD,OAxDD,CADD;AA4DA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo, useRef } from '@wordpress/element';\nimport { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data';\nimport {\n\tBlockList,\n\tBlockInspector,\n\tBlockTools,\n\t__unstableUseClipboardHandler as useClipboardHandler,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tBlockEditorKeyboardShortcuts,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tuseMergeRefs,\n\tuseViewportMatch,\n\tuseResizeObserver,\n} from '@wordpress/compose';\nimport { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';\n\n/**\n * Internal dependencies\n */\nimport inserterMediaCategories from './inserter-media-categories';\nimport TemplatePartConverter from '../template-part-converter';\nimport { SidebarInspectorFill } from '../sidebar-edit-mode';\nimport { store as editSiteStore } from '../../store';\nimport BackButton from './back-button';\nimport ResizableEditor from './resizable-editor';\nimport EditorCanvas from './editor-canvas';\nimport { unlock } from '../../private-apis';\nimport EditorCanvasContainer from '../editor-canvas-container';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\n\nconst LAYOUT = {\n\ttype: 'default',\n\t// At the root level of the site editor, no alignments should be allowed.\n\talignments: [],\n};\n\nexport default function BlockEditor() {\n\tconst { setIsInserterOpened } = useDispatch( editSiteStore );\n\tconst { storedSettings, templateType, canvasMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, getEditedPostType, getCanvasMode } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tstoredSettings: getSettings( setIsInserterOpened ),\n\t\t\t\ttemplateType: getEditedPostType(),\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t};\n\t\t},\n\t\t[ setIsInserterOpened ]\n\t);\n\n\tconst settingsBlockPatterns =\n\t\tstoredSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tstoredSettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories:\n\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( templateType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, templateType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst settings = useMemo( () => {\n\t\tconst {\n\t\t\t__experimentalAdditionalBlockPatterns,\n\t\t\t__experimentalAdditionalBlockPatternCategories,\n\t\t\t...restStoredSettings\n\t\t} = storedSettings;\n\n\t\treturn {\n\t\t\t...restStoredSettings,\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t};\n\t}, [ storedSettings, blockPatterns, blockPatternCategories ] );\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplateType\n\t);\n\n\tconst contentRef = useRef();\n\tconst mergedRefs = useMergeRefs( [\n\t\tcontentRef,\n\t\tuseClipboardHandler(),\n\t\tuseTypingObserver(),\n\t] );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\n\tconst isTemplatePart = templateType === 'wp_template_part';\n\n\tconst hasBlocks = blocks.length !== 0;\n\tconst enableResizing =\n\t\tisTemplatePart &&\n\t\tcanvasMode !== 'view' &&\n\t\t// Disable resizing in mobile viewport.\n\t\t! isMobileViewport;\n\tconst isViewMode = canvasMode === 'view';\n\tconst showBlockAppender =\n\t\t( isTemplatePart && hasBlocks ) || isViewMode ? false : undefined;\n\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tsettings={ settings }\n\t\t\tvalue={ blocks }\n\t\t\tonInput={ onInput }\n\t\t\tonChange={ onChange }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t<TemplatePartConverter />\n\t\t\t<SidebarInspectorFill>\n\t\t\t\t<BlockInspector />\n\t\t\t</SidebarInspectorFill>\n\t\t\t<EditorCanvasContainer.Slot>\n\t\t\t\t{ ( [ editorCanvasView ] ) =>\n\t\t\t\t\teditorCanvasView ? (\n\t\t\t\t\t\t<div className=\"edit-site-visual-editor is-focus-mode\">\n\t\t\t\t\t\t\t{ editorCanvasView }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<BlockTools\n\t\t\t\t\t\t\tclassName={ classnames( 'edit-site-visual-editor', {\n\t\t\t\t\t\t\t\t'is-focus-mode':\n\t\t\t\t\t\t\t\t\tisTemplatePart || !! editorCanvasView,\n\t\t\t\t\t\t\t\t'is-view-mode': isViewMode,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t__unstableContentRef={ contentRef }\n\t\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\t\t// Clear selected block when clicking on the gray background.\n\t\t\t\t\t\t\t\tif ( event.target === event.currentTarget ) {\n\t\t\t\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t\t\t\t\t<BackButton />\n\t\t\t\t\t\t\t<ResizableEditor\n\t\t\t\t\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\t\t\t\t\theight={ sizes.height ?? '100%' }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<EditorCanvas\n\t\t\t\t\t\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\t\tcontentRef={ mergedRefs }\n\t\t\t\t\t\t\t\t\treadonly={ canvasMode === 'view' }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ resizeObserver }\n\t\t\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-block-editor__block-list wp-site-blocks\"\n\t\t\t\t\t\t\t\t\t\t__experimentalLayout={ LAYOUT }\n\t\t\t\t\t\t\t\t\t\trenderAppender={ showBlockAppender }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</EditorCanvas>\n\t\t\t\t\t\t\t</ResizableEditor>\n\t\t\t\t\t\t</BlockTools>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t</EditorCanvasContainer.Slot>\n\t\t\t<ReusableBlocksMenuItems />\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n"]}
@@ -97,19 +97,18 @@ function CreateTemplatePartModal(_ref) {
97
97
  }, area === value && (0, _element.createElement)(_components.Icon, {
98
98
  icon: _icons.check
99
99
  }))));
100
- }))), (0, _element.createElement)(_components.Flex, {
101
- className: "edit-site-create-template-part-modal__modal-actions",
102
- justify: "flex-end"
103
- }, (0, _element.createElement)(_components.FlexItem, null, (0, _element.createElement)(_components.Button, {
104
- variant: "secondary",
100
+ }))), (0, _element.createElement)(_components.__experimentalHStack, {
101
+ justify: "right"
102
+ }, (0, _element.createElement)(_components.Button, {
103
+ variant: "tertiary",
105
104
  onClick: () => {
106
105
  closeModal();
107
106
  }
108
- }, (0, _i18n.__)('Cancel'))), (0, _element.createElement)(_components.FlexItem, null, (0, _element.createElement)(_components.Button, {
107
+ }, (0, _i18n.__)('Cancel')), (0, _element.createElement)(_components.Button, {
109
108
  variant: "primary",
110
109
  type: "submit",
111
110
  disabled: !title,
112
111
  isBusy: isSubmitting
113
- }, (0, _i18n.__)('Create')))))));
112
+ }, (0, _i18n.__)('Create'))))));
114
113
  }
115
114
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/create-template-part-modal/index.js"],"names":["CreateTemplatePartModal","closeModal","onCreate","title","setTitle","area","setArea","TEMPLATE_PART_AREA_GENERAL","isSubmitting","setIsSubmitting","instanceId","templatePartAreas","select","editorStore","__experimentalGetDefaultTemplatePartAreas","event","preventDefault","map","icon","label","value","description","check"],"mappings":";;;;;;;AAkBA;;AAfA;;AACA;;AAaA;;AAEA;;AACA;;AACA;;AAKA;;AA1BA;AACA;AACA;;AAqBA;AACA;AACA;AAGe,SAASA,uBAAT,OAA6D;AAAA,MAA3B;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,GAA2B;AAC3E,QAAM,CAAEC,KAAF,EAASC,QAAT,IA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/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tIcon,\n\tBaseControl,\n\tTextControl,\n\tFlex,\n\tFlexItem,\n\tFlexBlock,\n\tButton,\n\tModal,\n\t__experimentalRadioGroup as RadioGroup,\n\t__experimentalRadio as Radio,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as editorStore } from '@wordpress/editor';\nimport { check } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_PART_AREA_GENERAL } from '../../store/constants';\n\nexport default function CreateTemplatePartModal( { closeModal, onCreate } ) {\n\tconst [ title, setTitle ] = useState( '' );\n\tconst [ area, setArea ] = useState( TEMPLATE_PART_AREA_GENERAL );\n\tconst [ isSubmitting, setIsSubmitting ] = useState( false );\n\tconst instanceId = useInstanceId( CreateTemplatePartModal );\n\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create a template part' ) }\n\t\t\tonRequestClose={ closeModal }\n\t\t\toverlayClassName=\"edit-site-create-template-part-modal\"\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ async ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tif ( ! title ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tsetIsSubmitting( true );\n\t\t\t\t\tawait onCreate( { title, area } );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"4\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<BaseControl\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tid={ `edit-site-create-template-part-modal__area-selection-${ instanceId }` }\n\t\t\t\t\t\tclassName=\"edit-site-create-template-part-modal__area-base-control\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<RadioGroup\n\t\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\t\tclassName=\"edit-site-create-template-part-modal__area-radio-group\"\n\t\t\t\t\t\t\tid={ `edit-site-create-template-part-modal__area-selection-${ instanceId }` }\n\t\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t\t\tchecked={ area }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ templatePartAreas.map(\n\t\t\t\t\t\t\t\t( {\n\t\t\t\t\t\t\t\t\ticon,\n\t\t\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t\t\tarea: value,\n\t\t\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\t\t} ) => (\n\t\t\t\t\t\t\t\t\t<Radio\n\t\t\t\t\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-create-template-part-modal__area-radio\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Flex align=\"start\" justify=\"start\">\n\t\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t<FlexBlock className=\"edit-site-create-template-part-modal__option-label\">\n\t\t\t\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t\t\t\t\t<div>{ description }</div>\n\t\t\t\t\t\t\t\t\t\t\t</FlexBlock>\n\n\t\t\t\t\t\t\t\t\t\t\t<FlexItem className=\"edit-site-create-template-part-modal__checkbox\">\n\t\t\t\t\t\t\t\t\t\t\t\t{ area === value && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ check } />\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t</Flex>\n\t\t\t\t\t\t\t\t\t</Radio>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</RadioGroup>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t\t<Flex\n\t\t\t\t\t\tclassName=\"edit-site-create-template-part-modal__modal-actions\"\n\t\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\tdisabled={ ! title }\n\t\t\t\t\t\t\t\tisBusy={ isSubmitting }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t</Flex>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/create-template-part-modal/index.js"],"names":["CreateTemplatePartModal","closeModal","onCreate","title","setTitle","area","setArea","TEMPLATE_PART_AREA_GENERAL","isSubmitting","setIsSubmitting","instanceId","templatePartAreas","select","editorStore","__experimentalGetDefaultTemplatePartAreas","event","preventDefault","map","icon","label","value","description","check"],"mappings":";;;;;;;AAmBA;;AAhBA;;AACA;;AAcA;;AAEA;;AACA;;AACA;;AAKA;;AA3BA;AACA;AACA;;AAsBA;AACA;AACA;AAGe,SAASA,uBAAT,OAA6D;AAAA,MAA3B;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,GAA2B;AAC3E,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsB,uBAAU,EAAV,CAA5B;AACA,QAAM,CAAEC,IAAF,EAAQC,OAAR,IAAoB,uBAAUC,qCAAV,CAA1B;AACA,QAAM,CAAEC,YAAF,EAAgBC,eAAhB,IAAoC,uBAAU,KAAV,CAA1C;AACA,QAAMC,UAAU,GAAG,4BAAeV,uBAAf,CAAnB;AAEA,QAAMW,iBAAiB,GAAG,qBACvBC,MAAF,IACCA,MAAM,CAAEC,aAAF,CAAN,CAAsBC,yCAAtB,EAFwB,EAGzB,EAHyB,CAA1B;AAMA,SACC,4BAAC,iBAAD;AACC,IAAA,KAAK,EAAG,cAAI,wBAAJ,CADT;AAEC,IAAA,cAAc,EAAGb,UAFlB;AAGC,IAAA,gBAAgB,EAAC;AAHlB,KAKC;AACC,IAAA,QAAQ,EAAG,MAAQc,KAAR,IAAmB;AAC7BA,MAAAA,KAAK,CAACC,cAAN;;AACA,UAAK,CAAEb,KAAP,EAAe;AACd;AACA;;AACDM,MAAAA,eAAe,CAAE,IAAF,CAAf;AACA,YAAMP,QAAQ,CAAE;AAAEC,QAAAA,KAAF;AAASE,QAAAA;AAAT,OAAF,CAAd;AACA;AARF,KAUC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAC;AAAhB,KACC,4BAAC,uBAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAG,cAAI,MAAJ,CAFT;AAGC,IAAA,KAAK,EAAGF,KAHT;AAIC,IAAA,QAAQ,EAAGC,QAJZ;AAKC,I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AAJ,CANH,CADD,EASC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,IAAA,QAAQ,EAAG,CAAEE,KAHd;AAIC,IAAA,MAAM,EAAGK;AAJV,KAMG,cAAI,QAAJ,CANH,CATD,CApDD,CAVD,CALD,CADD;AA0FA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tIcon,\n\tBaseControl,\n\tTextControl,\n\tFlex,\n\tFlexItem,\n\tFlexBlock,\n\tButton,\n\tModal,\n\t__experimentalRadioGroup as RadioGroup,\n\t__experimentalRadio as Radio,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as editorStore } from '@wordpress/editor';\nimport { check } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_PART_AREA_GENERAL } from '../../store/constants';\n\nexport default function CreateTemplatePartModal( { closeModal, onCreate } ) {\n\tconst [ title, setTitle ] = useState( '' );\n\tconst [ area, setArea ] = useState( TEMPLATE_PART_AREA_GENERAL );\n\tconst [ isSubmitting, setIsSubmitting ] = useState( false );\n\tconst instanceId = useInstanceId( CreateTemplatePartModal );\n\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create a template part' ) }\n\t\t\tonRequestClose={ closeModal }\n\t\t\toverlayClassName=\"edit-site-create-template-part-modal\"\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ async ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tif ( ! title ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tsetIsSubmitting( true );\n\t\t\t\t\tawait onCreate( { title, area } );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"4\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<BaseControl\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tid={ `edit-site-create-template-part-modal__area-selection-${ instanceId }` }\n\t\t\t\t\t\tclassName=\"edit-site-create-template-part-modal__area-base-control\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<RadioGroup\n\t\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\t\tclassName=\"edit-site-create-template-part-modal__area-radio-group\"\n\t\t\t\t\t\t\tid={ `edit-site-create-template-part-modal__area-selection-${ instanceId }` }\n\t\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t\t\tchecked={ area }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ templatePartAreas.map(\n\t\t\t\t\t\t\t\t( {\n\t\t\t\t\t\t\t\t\ticon,\n\t\t\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t\t\tarea: value,\n\t\t\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\t\t} ) => (\n\t\t\t\t\t\t\t\t\t<Radio\n\t\t\t\t\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-create-template-part-modal__area-radio\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Flex align=\"start\" justify=\"start\">\n\t\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t<FlexBlock className=\"edit-site-create-template-part-modal__option-label\">\n\t\t\t\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t\t\t\t\t<div>{ description }</div>\n\t\t\t\t\t\t\t\t\t\t\t</FlexBlock>\n\n\t\t\t\t\t\t\t\t\t\t\t<FlexItem className=\"edit-site-create-template-part-modal__checkbox\">\n\t\t\t\t\t\t\t\t\t\t\t\t{ area === value && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ check } />\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t</Flex>\n\t\t\t\t\t\t\t\t\t</Radio>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</RadioGroup>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tdisabled={ ! title }\n\t\t\t\t\t\t\tisBusy={ isSubmitting }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"]}
@@ -9,6 +9,8 @@ exports.default = Editor;
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+
12
14
  var _data = require("@wordpress/data");
13
15
 
14
16
  var _components = require("@wordpress/components");
@@ -53,6 +55,12 @@ var _privateApis = require("../../private-apis");
53
55
 
54
56
  var _useEditedEntityRecord = _interopRequireDefault(require("../use-edited-entity-record"));
55
57
 
58
+ var _sidebarFixedBottom = require("../sidebar-edit-mode/sidebar-fixed-bottom");
59
+
60
+ /**
61
+ * External dependencies
62
+ */
63
+
56
64
  /**
57
65
  * WordPress dependencies
58
66
  */
@@ -74,7 +82,10 @@ const interfaceLabels = {
74
82
  footer: (0, _i18n.__)('Editor footer')
75
83
  };
76
84
 
77
- function Editor() {
85
+ function Editor(_ref) {
86
+ let {
87
+ isLoading
88
+ } = _ref;
78
89
  const {
79
90
  record: editedPost,
80
91
  getTitle,
@@ -152,12 +163,7 @@ function Editor() {
152
163
 
153
164
 
154
165
  (0, _useTitle.default)(hasLoadedPost && title);
155
-
156
- if (!hasLoadedPost) {
157
- return (0, _element.createElement)(_canvasSpinner.default, null);
158
- }
159
-
160
- return (0, _element.createElement)(_element.Fragment, null, isEditMode && (0, _element.createElement)(_welcomeGuide.default, null), (0, _element.createElement)(_coreData.EntityProvider, {
166
+ return (0, _element.createElement)(_element.Fragment, null, isLoading ? (0, _element.createElement)(_canvasSpinner.default, null) : null, isEditMode && (0, _element.createElement)(_welcomeGuide.default, null), (0, _element.createElement)(_coreData.EntityProvider, {
161
167
  kind: "root",
162
168
  type: "site"
163
169
  }, (0, _element.createElement)(_coreData.EntityProvider, {
@@ -168,16 +174,19 @@ function Editor() {
168
174
  value: blockContext
169
175
  }, (0, _element.createElement)(_sidebarEditMode.SidebarComplementaryAreaFills, null), isEditMode && (0, _element.createElement)(_startTemplateOptions.default, null), (0, _element.createElement)(_interface.InterfaceSkeleton, {
170
176
  enableRegionNavigation: false,
171
- className: showIconLabels && 'show-icon-labels',
172
- notices: isEditMode && (0, _element.createElement)(_editor.EditorSnackbars, null),
177
+ className: (0, _classnames.default)('edit-site-editor__interface-skeleton', {
178
+ 'show-icon-labels': showIconLabels,
179
+ 'is-loading': isLoading
180
+ }),
181
+ notices: (0, _element.createElement)(_editor.EditorSnackbars, null),
173
182
  content: (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_globalStylesRenderer.GlobalStylesRenderer, null), isEditMode && (0, _element.createElement)(_editor.EditorNotices, null), showVisualEditor && editedPost && (0, _element.createElement)(_blockEditor2.default, null), editorMode === 'text' && editedPost && isEditMode && (0, _element.createElement)(_codeEditor.default, null), hasLoadedPost && !editedPost && (0, _element.createElement)(_components.Notice, {
174
183
  status: "warning",
175
184
  isDismissible: false
176
185
  }, (0, _i18n.__)("You attempted to edit an item that doesn't exist. Perhaps it was deleted?")), isEditMode && (0, _element.createElement)(_editMode.default, null)),
177
186
  secondarySidebar: isEditMode && (shouldShowInserter && (0, _element.createElement)(_inserterSidebar.default, null) || shouldShowListView && (0, _element.createElement)(_listViewSidebar.default, null)),
178
- sidebar: isEditMode && isRightSidebarOpen && (0, _element.createElement)(_interface.ComplementaryArea.Slot, {
187
+ sidebar: isEditMode && isRightSidebarOpen && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_interface.ComplementaryArea.Slot, {
179
188
  scope: "core/edit-site"
180
- }),
189
+ }), (0, _element.createElement)(_sidebarFixedBottom.SidebarFixedBottomSlot, null)),
181
190
  footer: shouldShowBlockBreakcrumbs && (0, _element.createElement)(_blockEditor.BlockBreadcrumb, {
182
191
  rootLabelText: (0, _i18n.__)('Template')
183
192
  }),
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/editor/index.js"],"names":["interfaceLabels","body","sidebar","actions","footer","Editor","record","editedPost","getTitle","isLoaded","hasLoadedPost","id","editedPostId","type","editedPostType","context","editorMode","canvasMode","blockEditorMode","isRightSidebarOpen","isInserterOpen","isListViewOpen","showIconLabels","showBlockBreadcrumbs","select","getEditedPostContext","getEditorMode","getCanvasMode","isInserterOpened","isListViewOpened","editSiteStore","__unstableGetEditorMode","blockEditorStore","getActiveComplementaryArea","interfaceStore","name","preferencesStore","get","setEditedPostContext","isViewMode","isEditMode","showVisualEditor","shouldShowBlockBreakcrumbs","shouldShowInserter","shouldShowListView","secondarySidebarLabel","blockContext","queryContext","page","newQueryContext","title","secondarySidebar"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAtCA;AACA;AACA;;AAmBA;AACA;AACA;AAiBA,MAAMA,eAAe,GAAG;AACvB;AACAC,EAAAA,IAAI,EAAE,cAAI,gBAAJ,CAFiB;;AAGvB;AACAC,EAAAA,OAAO,EAAE,cAAI,iBAAJ,CAJc;;AAKvB;AACAC,EAAAA,OAAO,EAAE,cAAI,gBAAJ,CANc;;AAOvB;AACAC,EAAAA,MAAM,EAAE,cAAI,eAAJ;AARe,CAAxB;;AAWe,SAASC,MAAT,GAAkB;AAChC,QAAM;AACLC,IAAAA,MAAM,EAAEC,UADH;AAELC,IAAAA,QAFK;AAGLC,IAAAA,QAAQ,EAAEC;AAHL,MAIF,qCAJJ;AAMA,QAAM;AAAEC,IAAAA,EAAE,EAAEC,YAAN;AAAoBC,IAAAA,IAAI,EAAEC;AAA1B,MAA6CP,UAAnD;AAEA,QAAM;AACLQ,IAAAA,OADK;AAELC,IAAAA,UAFK;AAGLC,IAAAA,UAHK;AAILC,IAAAA,eAJK;AAKLC,IAAAA,kBALK;AAMLC,IAAAA,cANK;AAOLC,IAAAA,cAPK;AAQLC,IAAAA,cARK;AASLC,IAAAA;AATK,MAUF,qBAAaC,MAAF,IAAc;AAC5B,UAAM;AACLC,MAAAA,oBADK;AAELC,MAAAA,aAFK;AAGLC,MAAAA,aAHK;AAILC,MAAAA,gBAJK;AAKLC,MAAAA;AALK,QAMF,yBAAQL,MAAM,CAAEM,YAAF,CAAd,CANJ;AAOA,UAAM;AAAEC,MAAAA;AAAF,QAA8B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C,IAAA,sBAAsB,EAAG,KAD1B;AAEC,IAAA,SAAS,EAAGlB,cAAc,IAAI,kBAF/B;AAGC,IAAA,OAAO,EAAGkB,UAAU,IAAI,4BAAC,uBAAD,OAHzB;AAIC,IAAA,OAAO,EACN,qDACC,4BAAC,0CAAD,OADD,EAEGA,UAAU,IAAI,4BAAC,qBAAD,OAFjB,EAGGC,gBAAgB,IAAIlC,UAApB,IACD,4BAAC,qBAAD,OAJF,EAMGS,UAAU,KAAK,MAAf,IACDT,UADC,IAEDiC,UAFC,IAEa,4BAAC,mBAAD,OARhB,EASG9B,aAAa,IAAI,CAAEH,UAAnB,IACD,4BAAC,kBAAD;AACC,MAAA,MAAM,EAAC,SADR;AAEC,MAAA,aAAa,EAAG;AAFjB,OAIG,cACD,2EADC,CAJH,CAVF,EAmBGiC,UAAU,IACX,4BAAC,iBAAD,OApBF,CALF;AA6BC,IAAA,gBAAgB,EACfA,UAAU,KACNG,kBAAkB,IACrB,4BAAC,wBAAD,OADC,IAGCC,kBAAkB,IACnB,4BAAC,wBAAD,OALQ,CA9BZ;AAsCC,IAAA,OAAO,EACNJ,UAAU,IACVrB,kBADA,IAEC,4BAAC,4BAAD,CAAmB,IAAnB;AAAwB,MAAA,KAAK,EAAC;AAA9B,MAzCH;AA4CC,IAAA,MAAM,EACLuB,0BAA0B,IACzB,4BAAC,4BAAD;AACC,MAAA,aAAa,EAAG,cAAI,UAAJ;AADjB,MA9CH;AAmDC,IAAA,MAAM,EAAG,EACR,GAAG1C,eADK;AAERmD,MAAAA,gBAAgB,EAAEN;AAFV;AAnDV,IAHD,CALD,CADD,CAFD,CADD;AAyEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Notice } from '@wordpress/components';\nimport { EntityProvider } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tBlockContextProvider,\n\tBlockBreadcrumb,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { EditorNotices, EditorSnackbars } from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { SidebarComplementaryAreaFills } from '../sidebar-edit-mode';\nimport BlockEditor from '../block-editor';\nimport CodeEditor from '../code-editor';\nimport KeyboardShortcutsEditMode from '../keyboard-shortcuts/edit-mode';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\nimport WelcomeGuide from '../welcome-guide';\nimport StartTemplateOptions from '../start-template-options';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\n\nimport useTitle from '../routes/use-title';\nimport CanvasSpinner from '../canvas-spinner';\nimport { unlock } from '../../private-apis';\nimport useEditedEntityRecord from '../use-edited-entity-record';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\nexport default function Editor() {\n\tconst {\n\t\trecord: editedPost,\n\t\tgetTitle,\n\t\tisLoaded: hasLoadedPost,\n\t} = useEditedEntityRecord();\n\n\tconst { id: editedPostId, type: editedPostType } = editedPost;\n\n\tconst {\n\t\tcontext,\n\t\teditorMode,\n\t\tcanvasMode,\n\t\tblockEditorMode,\n\t\tisRightSidebarOpen,\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tshowIconLabels,\n\t\tshowBlockBreadcrumbs,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEditedPostContext,\n\t\t\tgetEditorMode,\n\t\t\tgetCanvasMode,\n\t\t\tisInserterOpened,\n\t\t\tisListViewOpened,\n\t\t} = unlock( select( editSiteStore ) );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tcontext: getEditedPostContext(),\n\t\t\teditorMode: getEditorMode(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisRightSidebarOpen: getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\tshowBlockBreadcrumbs: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { setEditedPostContext } = useDispatch( editSiteStore );\n\n\tconst isViewMode = canvasMode === 'view';\n\tconst isEditMode = canvasMode === 'edit';\n\tconst showVisualEditor = isViewMode || editorMode === 'visual';\n\tconst shouldShowBlockBreakcrumbs =\n\t\tshowBlockBreadcrumbs &&\n\t\tisEditMode &&\n\t\tshowVisualEditor &&\n\t\tblockEditorMode !== 'zoom-out';\n\tconst shouldShowInserter = isEditMode && showVisualEditor && isInserterOpen;\n\tconst shouldShowListView = isEditMode && showVisualEditor && isListViewOpen;\n\tconst secondarySidebarLabel = isListViewOpen\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\tconst blockContext = useMemo(\n\t\t() => ( {\n\t\t\t...context,\n\t\t\tqueryContext: [\n\t\t\t\tcontext?.queryContext || { page: 1 },\n\t\t\t\t( newQueryContext ) =>\n\t\t\t\t\tsetEditedPostContext( {\n\t\t\t\t\t\t...context,\n\t\t\t\t\t\tqueryContext: {\n\t\t\t\t\t\t\t...context?.queryContext,\n\t\t\t\t\t\t\t...newQueryContext,\n\t\t\t\t\t\t},\n\t\t\t\t\t} ),\n\t\t\t],\n\t\t} ),\n\t\t[ context, setEditedPostContext ]\n\t);\n\n\tlet title;\n\tif ( hasLoadedPost ) {\n\t\tconst type =\n\t\t\teditedPostType === 'wp_template'\n\t\t\t\t? __( 'Template' )\n\t\t\t\t: __( 'Template Part' );\n\t\ttitle = sprintf(\n\t\t\t// translators: A breadcrumb trail in browser tab. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).\n\t\t\t__( '%1$s ‹ %2$s ‹ Editor' ),\n\t\t\tgetTitle(),\n\t\t\ttype\n\t\t);\n\t}\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URlQueryController> from double-announcing.\n\tuseTitle( hasLoadedPost && title );\n\n\tif ( ! hasLoadedPost ) {\n\t\treturn <CanvasSpinner />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ isEditMode && <WelcomeGuide /> }\n\t\t\t<EntityProvider kind=\"root\" type=\"site\">\n\t\t\t\t<EntityProvider\n\t\t\t\t\tkind=\"postType\"\n\t\t\t\t\ttype={ editedPostType }\n\t\t\t\t\tid={ editedPostId }\n\t\t\t\t>\n\t\t\t\t\t<BlockContextProvider value={ blockContext }>\n\t\t\t\t\t\t<SidebarComplementaryAreaFills />\n\t\t\t\t\t\t{ isEditMode && <StartTemplateOptions /> }\n\t\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\t\tenableRegionNavigation={ false }\n\t\t\t\t\t\t\tclassName={ showIconLabels && 'show-icon-labels' }\n\t\t\t\t\t\t\tnotices={ isEditMode && <EditorSnackbars /> }\n\t\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<GlobalStylesRenderer />\n\t\t\t\t\t\t\t\t\t{ isEditMode && <EditorNotices /> }\n\t\t\t\t\t\t\t\t\t{ showVisualEditor && editedPost && (\n\t\t\t\t\t\t\t\t\t\t<BlockEditor />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ editorMode === 'text' &&\n\t\t\t\t\t\t\t\t\t\teditedPost &&\n\t\t\t\t\t\t\t\t\t\tisEditMode && <CodeEditor /> }\n\t\t\t\t\t\t\t\t\t{ hasLoadedPost && ! editedPost && (\n\t\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t\t\t\t\t<KeyboardShortcutsEditMode />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsecondarySidebar={\n\t\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t\t( ( shouldShowInserter && (\n\t\t\t\t\t\t\t\t\t<InserterSidebar />\n\t\t\t\t\t\t\t\t) ) ||\n\t\t\t\t\t\t\t\t\t( shouldShowListView && (\n\t\t\t\t\t\t\t\t\t\t<ListViewSidebar />\n\t\t\t\t\t\t\t\t\t) ) )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsidebar={\n\t\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t\tisRightSidebarOpen && (\n\t\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfooter={\n\t\t\t\t\t\t\t\tshouldShowBlockBreakcrumbs && (\n\t\t\t\t\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\t\t\t\t\trootLabelText={ __( 'Template' ) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabels={ {\n\t\t\t\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t</EntityProvider>\n\t\t\t</EntityProvider>\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/editor/index.js"],"names":["interfaceLabels","body","sidebar","actions","footer","Editor","isLoading","record","editedPost","getTitle","isLoaded","hasLoadedPost","id","editedPostId","type","editedPostType","context","editorMode","canvasMode","blockEditorMode","isRightSidebarOpen","isInserterOpen","isListViewOpen","showIconLabels","showBlockBreadcrumbs","select","getEditedPostContext","getEditorMode","getCanvasMode","isInserterOpened","isListViewOpened","editSiteStore","__unstableGetEditorMode","blockEditorStore","getActiveComplementaryArea","interfaceStore","name","preferencesStore","get","setEditedPostContext","isViewMode","isEditMode","showVisualEditor","shouldShowBlockBreakcrumbs","shouldShowInserter","shouldShowListView","secondarySidebarLabel","blockContext","queryContext","page","newQueryContext","title","secondarySidebar"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AA5CA;AACA;AACA;;AAGA;AACA;AACA;;AAmBA;AACA;AACA;AAkBA,MAAMA,eAAe,GAAG;AACvB;AACAC,EAAAA,IAAI,EAAE,cAAI,gBAAJ,CAFiB;;AAGvB;AAC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,IAAI,CAAEH,UAAnB,IACD,4BAAC,kBAAD;AACC,MAAA,MAAM,EAAC,SADR;AAEC,MAAA,aAAa,EAAG;AAFjB,OAIG,cACD,2EADC,CAJH,CAVF,EAmBGiC,UAAU,IACX,4BAAC,iBAAD,OApBF,CAXF;AAmCC,IAAA,gBAAgB,EACfA,UAAU,KACNG,kBAAkB,IACrB,4BAAC,wBAAD,OADC,IAGCC,kBAAkB,IACnB,4BAAC,wBAAD,OALQ,CApCZ;AA4CC,IAAA,OAAO,EACNJ,UAAU,IACVrB,kBADA,IAEC,qDACC,4BAAC,4BAAD,CAAmB,IAAnB;AAAwB,MAAA,KAAK,EAAC;AAA9B,MADD,EAEC,4BAAC,0CAAD,OAFD,CA/CH;AAqDC,IAAA,MAAM,EACLuB,0BAA0B,IACzB,4BAAC,4BAAD;AACC,MAAA,aAAa,EAAG,cAAI,UAAJ;AADjB,MAvDH;AA4DC,IAAA,MAAM,EAAG,EACR,GAAG3C,eADK;AAERoD,MAAAA,gBAAgB,EAAEN;AAFV;AA5DV,IAHD,CALD,CADD,CAHD,CADD;AAmFA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Notice } from '@wordpress/components';\nimport { EntityProvider } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tBlockContextProvider,\n\tBlockBreadcrumb,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { EditorNotices, EditorSnackbars } from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { SidebarComplementaryAreaFills } from '../sidebar-edit-mode';\nimport BlockEditor from '../block-editor';\nimport CodeEditor from '../code-editor';\nimport KeyboardShortcutsEditMode from '../keyboard-shortcuts/edit-mode';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\nimport WelcomeGuide from '../welcome-guide';\nimport StartTemplateOptions from '../start-template-options';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\n\nimport useTitle from '../routes/use-title';\nimport CanvasSpinner from '../canvas-spinner';\nimport { unlock } from '../../private-apis';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { SidebarFixedBottomSlot } from '../sidebar-edit-mode/sidebar-fixed-bottom';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\nexport default function Editor( { isLoading } ) {\n\tconst {\n\t\trecord: editedPost,\n\t\tgetTitle,\n\t\tisLoaded: hasLoadedPost,\n\t} = useEditedEntityRecord();\n\n\tconst { id: editedPostId, type: editedPostType } = editedPost;\n\n\tconst {\n\t\tcontext,\n\t\teditorMode,\n\t\tcanvasMode,\n\t\tblockEditorMode,\n\t\tisRightSidebarOpen,\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tshowIconLabels,\n\t\tshowBlockBreadcrumbs,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEditedPostContext,\n\t\t\tgetEditorMode,\n\t\t\tgetCanvasMode,\n\t\t\tisInserterOpened,\n\t\t\tisListViewOpened,\n\t\t} = unlock( select( editSiteStore ) );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tcontext: getEditedPostContext(),\n\t\t\teditorMode: getEditorMode(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisRightSidebarOpen: getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\tshowBlockBreadcrumbs: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { setEditedPostContext } = useDispatch( editSiteStore );\n\n\tconst isViewMode = canvasMode === 'view';\n\tconst isEditMode = canvasMode === 'edit';\n\tconst showVisualEditor = isViewMode || editorMode === 'visual';\n\tconst shouldShowBlockBreakcrumbs =\n\t\tshowBlockBreadcrumbs &&\n\t\tisEditMode &&\n\t\tshowVisualEditor &&\n\t\tblockEditorMode !== 'zoom-out';\n\tconst shouldShowInserter = isEditMode && showVisualEditor && isInserterOpen;\n\tconst shouldShowListView = isEditMode && showVisualEditor && isListViewOpen;\n\tconst secondarySidebarLabel = isListViewOpen\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\tconst blockContext = useMemo(\n\t\t() => ( {\n\t\t\t...context,\n\t\t\tqueryContext: [\n\t\t\t\tcontext?.queryContext || { page: 1 },\n\t\t\t\t( newQueryContext ) =>\n\t\t\t\t\tsetEditedPostContext( {\n\t\t\t\t\t\t...context,\n\t\t\t\t\t\tqueryContext: {\n\t\t\t\t\t\t\t...context?.queryContext,\n\t\t\t\t\t\t\t...newQueryContext,\n\t\t\t\t\t\t},\n\t\t\t\t\t} ),\n\t\t\t],\n\t\t} ),\n\t\t[ context, setEditedPostContext ]\n\t);\n\n\tlet title;\n\tif ( hasLoadedPost ) {\n\t\tconst type =\n\t\t\teditedPostType === 'wp_template'\n\t\t\t\t? __( 'Template' )\n\t\t\t\t: __( 'Template Part' );\n\t\ttitle = sprintf(\n\t\t\t// translators: A breadcrumb trail in browser tab. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).\n\t\t\t__( '%1$s ‹ %2$s ‹ Editor' ),\n\t\t\tgetTitle(),\n\t\t\ttype\n\t\t);\n\t}\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URlQueryController> from double-announcing.\n\tuseTitle( hasLoadedPost && title );\n\n\treturn (\n\t\t<>\n\t\t\t{ isLoading ? <CanvasSpinner /> : null }\n\t\t\t{ isEditMode && <WelcomeGuide /> }\n\t\t\t<EntityProvider kind=\"root\" type=\"site\">\n\t\t\t\t<EntityProvider\n\t\t\t\t\tkind=\"postType\"\n\t\t\t\t\ttype={ editedPostType }\n\t\t\t\t\tid={ editedPostId }\n\t\t\t\t>\n\t\t\t\t\t<BlockContextProvider value={ blockContext }>\n\t\t\t\t\t\t<SidebarComplementaryAreaFills />\n\t\t\t\t\t\t{ isEditMode && <StartTemplateOptions /> }\n\t\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\t\tenableRegionNavigation={ false }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'edit-site-editor__interface-skeleton',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t\t\t\t\t\t\t'is-loading': isLoading,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<GlobalStylesRenderer />\n\t\t\t\t\t\t\t\t\t{ isEditMode && <EditorNotices /> }\n\t\t\t\t\t\t\t\t\t{ showVisualEditor && editedPost && (\n\t\t\t\t\t\t\t\t\t\t<BlockEditor />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ editorMode === 'text' &&\n\t\t\t\t\t\t\t\t\t\teditedPost &&\n\t\t\t\t\t\t\t\t\t\tisEditMode && <CodeEditor /> }\n\t\t\t\t\t\t\t\t\t{ hasLoadedPost && ! editedPost && (\n\t\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t\t\t\t\t<KeyboardShortcutsEditMode />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsecondarySidebar={\n\t\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t\t( ( shouldShowInserter && (\n\t\t\t\t\t\t\t\t\t<InserterSidebar />\n\t\t\t\t\t\t\t\t) ) ||\n\t\t\t\t\t\t\t\t\t( shouldShowListView && (\n\t\t\t\t\t\t\t\t\t\t<ListViewSidebar />\n\t\t\t\t\t\t\t\t\t) ) )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsidebar={\n\t\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t\tisRightSidebarOpen && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t\t\t\t\t\t<SidebarFixedBottomSlot />\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfooter={\n\t\t\t\t\t\t\t\tshouldShowBlockBreakcrumbs && (\n\t\t\t\t\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\t\t\t\t\trootLabelText={ __( 'Template' ) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabels={ {\n\t\t\t\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t</EntityProvider>\n\t\t\t</EntityProvider>\n\t\t</>\n\t);\n}\n"]}