@wordpress/edit-site 3.0.6 → 3.0.10

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 (373) hide show
  1. package/build/components/add-new-template/index.js +49 -0
  2. package/build/components/add-new-template/index.js.map +1 -0
  3. package/build/components/add-new-template/new-template-part.js +79 -0
  4. package/build/components/add-new-template/new-template-part.js.map +1 -0
  5. package/build/components/add-new-template/new-template.js +115 -0
  6. package/build/components/add-new-template/new-template.js.map +1 -0
  7. package/build/components/block-editor/block-inspector-button.js +4 -3
  8. package/build/components/block-editor/block-inspector-button.js.map +1 -1
  9. package/build/components/block-editor/index.js +12 -8
  10. package/build/components/block-editor/index.js.map +1 -1
  11. package/build/components/block-editor/resizable-editor.js +6 -5
  12. package/build/components/block-editor/resizable-editor.js.map +1 -1
  13. package/build/components/block-editor/resize-handle.js +6 -4
  14. package/build/components/block-editor/resize-handle.js.map +1 -1
  15. package/build/components/create-template-part-modal/index.js +115 -0
  16. package/build/components/create-template-part-modal/index.js.map +1 -0
  17. package/build/components/edit-template-part-menu-button/index.js +15 -11
  18. package/build/components/edit-template-part-menu-button/index.js.map +1 -1
  19. package/build/components/editor/index.js +16 -17
  20. package/build/components/editor/index.js.map +1 -1
  21. package/build/components/error-boundary/index.js +5 -4
  22. package/build/components/error-boundary/index.js.map +1 -1
  23. package/build/components/global-styles/border-panel.js +5 -4
  24. package/build/components/global-styles/border-panel.js.map +1 -1
  25. package/build/components/global-styles/color-palette-panel.js +4 -3
  26. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  27. package/build/components/global-styles/context-menu.js +5 -4
  28. package/build/components/global-styles/context-menu.js.map +1 -1
  29. package/build/components/global-styles/dimensions-panel.js +5 -4
  30. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  31. package/build/components/global-styles/global-styles-provider.js +16 -13
  32. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  33. package/build/components/global-styles/header.js +6 -5
  34. package/build/components/global-styles/header.js.map +1 -1
  35. package/build/components/global-styles/hooks.js +34 -30
  36. package/build/components/global-styles/hooks.js.map +1 -1
  37. package/build/components/global-styles/index.js +6 -6
  38. package/build/components/global-styles/navigation-button.js +8 -7
  39. package/build/components/global-styles/navigation-button.js.map +1 -1
  40. package/build/components/global-styles/palette.js +13 -9
  41. package/build/components/global-styles/palette.js.map +1 -1
  42. package/build/components/global-styles/screen-background-color.js +4 -3
  43. package/build/components/global-styles/screen-background-color.js.map +1 -1
  44. package/build/components/global-styles/screen-block-list.js +13 -4
  45. package/build/components/global-styles/screen-block-list.js.map +1 -1
  46. package/build/components/global-styles/screen-block.js +4 -3
  47. package/build/components/global-styles/screen-block.js.map +1 -1
  48. package/build/components/global-styles/screen-color-palette.js +4 -3
  49. package/build/components/global-styles/screen-color-palette.js.map +1 -1
  50. package/build/components/global-styles/screen-colors.js +19 -15
  51. package/build/components/global-styles/screen-colors.js.map +1 -1
  52. package/build/components/global-styles/screen-layout.js +8 -5
  53. package/build/components/global-styles/screen-layout.js.map +1 -1
  54. package/build/components/global-styles/screen-link-color.js +4 -3
  55. package/build/components/global-styles/screen-link-color.js.map +1 -1
  56. package/build/components/global-styles/screen-text-color.js +4 -3
  57. package/build/components/global-styles/screen-text-color.js.map +1 -1
  58. package/build/components/global-styles/screen-typography.js +4 -3
  59. package/build/components/global-styles/screen-typography.js.map +1 -1
  60. package/build/components/global-styles/subtitle.js +4 -3
  61. package/build/components/global-styles/subtitle.js.map +1 -1
  62. package/build/components/global-styles/typography-panel.js +10 -8
  63. package/build/components/global-styles/typography-panel.js.map +1 -1
  64. package/build/components/global-styles/ui.js +4 -3
  65. package/build/components/global-styles/ui.js.map +1 -1
  66. package/build/components/global-styles/use-global-styles-output.js +61 -44
  67. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  68. package/build/components/global-styles/utils.js +4 -3
  69. package/build/components/global-styles/utils.js.map +1 -1
  70. package/build/components/header/document-actions/index.js +23 -19
  71. package/build/components/header/document-actions/index.js.map +1 -1
  72. package/build/components/header/feature-toggle/index.js +9 -7
  73. package/build/components/header/feature-toggle/index.js.map +1 -1
  74. package/build/components/header/index.js +15 -13
  75. package/build/components/header/index.js.map +1 -1
  76. package/build/components/header/more-menu/index.js +30 -27
  77. package/build/components/header/more-menu/index.js.map +1 -1
  78. package/build/components/header/tools-more-menu-group/index.js +10 -7
  79. package/build/components/header/tools-more-menu-group/index.js.map +1 -1
  80. package/build/components/keyboard-shortcuts/index.js +4 -3
  81. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  82. package/build/components/list/header.js +50 -0
  83. package/build/components/list/header.js.map +1 -0
  84. package/build/components/list/index.js +55 -0
  85. package/build/components/list/index.js.map +1 -0
  86. package/build/components/list/table.js +128 -0
  87. package/build/components/list/table.js.map +1 -0
  88. package/build/components/main-dashboard-button/index.js +4 -3
  89. package/build/components/main-dashboard-button/index.js.map +1 -1
  90. package/build/components/navigate-to-link/index.js +7 -6
  91. package/build/components/navigate-to-link/index.js.map +1 -1
  92. package/build/components/navigation-sidebar/index.js +12 -11
  93. package/build/components/navigation-sidebar/index.js.map +1 -1
  94. package/build/components/navigation-sidebar/navigation-panel/constants.js +1 -1
  95. package/build/components/navigation-sidebar/navigation-panel/content-navigation-item.js +4 -3
  96. package/build/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map +1 -1
  97. package/build/components/navigation-sidebar/navigation-panel/index.js +36 -55
  98. package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
  99. package/build/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js +6 -5
  100. package/build/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js.map +1 -1
  101. package/build/components/navigation-sidebar/navigation-panel/menus/template-parts.js +26 -20
  102. package/build/components/navigation-sidebar/navigation-panel/menus/template-parts.js.map +1 -1
  103. package/build/components/navigation-sidebar/navigation-panel/menus/templates-sub.js +17 -10
  104. package/build/components/navigation-sidebar/navigation-panel/menus/templates-sub.js.map +1 -1
  105. package/build/components/navigation-sidebar/navigation-panel/menus/templates.js +11 -5
  106. package/build/components/navigation-sidebar/navigation-panel/menus/templates.js.map +1 -1
  107. package/build/components/navigation-sidebar/navigation-panel/navigation-entity-items.js +13 -11
  108. package/build/components/navigation-sidebar/navigation-panel/navigation-entity-items.js.map +1 -1
  109. package/build/components/navigation-sidebar/navigation-panel/new-template-dropdown.js +24 -18
  110. package/build/components/navigation-sidebar/navigation-panel/new-template-dropdown.js.map +1 -1
  111. package/build/components/navigation-sidebar/navigation-panel/search-results.js +14 -11
  112. package/build/components/navigation-sidebar/navigation-panel/search-results.js.map +1 -1
  113. package/build/components/navigation-sidebar/navigation-panel/template-hierarchy.js +8 -5
  114. package/build/components/navigation-sidebar/navigation-panel/template-hierarchy.js.map +1 -1
  115. package/build/components/navigation-sidebar/navigation-panel/template-navigation-item.js +4 -3
  116. package/build/components/navigation-sidebar/navigation-panel/template-navigation-item.js.map +1 -1
  117. package/build/components/navigation-sidebar/navigation-panel/template-preview.js +5 -4
  118. package/build/components/navigation-sidebar/navigation-panel/template-preview.js.map +1 -1
  119. package/build/components/navigation-sidebar/navigation-toggle/index.js +7 -27
  120. package/build/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
  121. package/build/components/save-button/index.js +5 -4
  122. package/build/components/save-button/index.js.map +1 -1
  123. package/build/components/sidebar/constants.js +1 -1
  124. package/build/components/sidebar/default-sidebar.js +11 -10
  125. package/build/components/sidebar/default-sidebar.js.map +1 -1
  126. package/build/components/sidebar/plugin-sidebar/index.js +5 -4
  127. package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
  128. package/build/components/sidebar/settings-header/index.js +4 -3
  129. package/build/components/sidebar/settings-header/index.js.map +1 -1
  130. package/build/components/sidebar/template-card/template-areas.js +17 -13
  131. package/build/components/sidebar/template-card/template-areas.js.map +1 -1
  132. package/build/components/template-details/index.js +14 -9
  133. package/build/components/template-details/index.js.map +1 -1
  134. package/build/components/template-details/template-areas.js +38 -29
  135. package/build/components/template-details/template-areas.js.map +1 -1
  136. package/build/components/template-part-converter/convert-to-regular.js +15 -11
  137. package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
  138. package/build/components/template-part-converter/convert-to-template-part.js +29 -86
  139. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  140. package/build/components/welcome-guide/editor.js +58 -0
  141. package/build/components/welcome-guide/editor.js.map +1 -0
  142. package/build/components/welcome-guide/image.js +27 -0
  143. package/build/components/welcome-guide/image.js.map +1 -0
  144. package/build/components/welcome-guide/index.js +49 -0
  145. package/build/components/welcome-guide/index.js.map +1 -0
  146. package/build/components/welcome-guide/styles.js +83 -0
  147. package/build/components/welcome-guide/styles.js.map +1 -0
  148. package/build/index.js +40 -16
  149. package/build/index.js.map +1 -1
  150. package/build/plugins/index.js +4 -2
  151. package/build/plugins/index.js.map +1 -1
  152. package/build/plugins/welcome-guide-menu-item.js +39 -0
  153. package/build/plugins/welcome-guide-menu-item.js.map +1 -0
  154. package/build/store/actions.js +24 -24
  155. package/build/store/actions.js.map +1 -1
  156. package/build/store/constants.js +1 -1
  157. package/build/store/defaults.js +4 -1
  158. package/build/store/defaults.js.map +1 -1
  159. package/build/store/index.js +5 -3
  160. package/build/store/index.js.map +1 -1
  161. package/build/store/reducer.js +36 -14
  162. package/build/store/reducer.js.map +1 -1
  163. package/build/store/selectors.js +27 -19
  164. package/build/store/selectors.js.map +1 -1
  165. package/build/utils/is-template-removable.js +21 -0
  166. package/build/utils/is-template-removable.js.map +1 -0
  167. package/build-module/components/add-new-template/index.js +36 -0
  168. package/build-module/components/add-new-template/index.js.map +1 -0
  169. package/build-module/components/add-new-template/new-template-part.js +66 -0
  170. package/build-module/components/add-new-template/new-template-part.js.map +1 -0
  171. package/build-module/components/add-new-template/new-template.js +98 -0
  172. package/build-module/components/add-new-template/new-template.js.map +1 -0
  173. package/build-module/components/block-editor/block-inspector-button.js +4 -3
  174. package/build-module/components/block-editor/block-inspector-button.js.map +1 -1
  175. package/build-module/components/block-editor/index.js +12 -8
  176. package/build-module/components/block-editor/index.js.map +1 -1
  177. package/build-module/components/block-editor/resizable-editor.js +6 -5
  178. package/build-module/components/block-editor/resizable-editor.js.map +1 -1
  179. package/build-module/components/block-editor/resize-handle.js +6 -4
  180. package/build-module/components/block-editor/resize-handle.js.map +1 -1
  181. package/build-module/components/create-template-part-modal/index.js +102 -0
  182. package/build-module/components/create-template-part-modal/index.js.map +1 -0
  183. package/build-module/components/edit-template-part-menu-button/index.js +15 -11
  184. package/build-module/components/edit-template-part-menu-button/index.js.map +1 -1
  185. package/build-module/components/editor/index.js +14 -17
  186. package/build-module/components/editor/index.js.map +1 -1
  187. package/build-module/components/error-boundary/index.js +5 -4
  188. package/build-module/components/error-boundary/index.js.map +1 -1
  189. package/build-module/components/global-styles/border-panel.js +4 -3
  190. package/build-module/components/global-styles/border-panel.js.map +1 -1
  191. package/build-module/components/global-styles/color-palette-panel.js +4 -3
  192. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  193. package/build-module/components/global-styles/context-menu.js +5 -4
  194. package/build-module/components/global-styles/context-menu.js.map +1 -1
  195. package/build-module/components/global-styles/dimensions-panel.js +4 -3
  196. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  197. package/build-module/components/global-styles/global-styles-provider.js +16 -13
  198. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  199. package/build-module/components/global-styles/header.js +6 -5
  200. package/build-module/components/global-styles/header.js.map +1 -1
  201. package/build-module/components/global-styles/hooks.js +32 -28
  202. package/build-module/components/global-styles/hooks.js.map +1 -1
  203. package/build-module/components/global-styles/navigation-button.js +8 -7
  204. package/build-module/components/global-styles/navigation-button.js.map +1 -1
  205. package/build-module/components/global-styles/palette.js +13 -9
  206. package/build-module/components/global-styles/palette.js.map +1 -1
  207. package/build-module/components/global-styles/screen-background-color.js +4 -3
  208. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  209. package/build-module/components/global-styles/screen-block-list.js +11 -4
  210. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  211. package/build-module/components/global-styles/screen-block.js +4 -3
  212. package/build-module/components/global-styles/screen-block.js.map +1 -1
  213. package/build-module/components/global-styles/screen-color-palette.js +4 -3
  214. package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
  215. package/build-module/components/global-styles/screen-colors.js +19 -15
  216. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  217. package/build-module/components/global-styles/screen-layout.js +4 -3
  218. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  219. package/build-module/components/global-styles/screen-link-color.js +4 -3
  220. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  221. package/build-module/components/global-styles/screen-text-color.js +4 -3
  222. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  223. package/build-module/components/global-styles/screen-typography.js +4 -3
  224. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  225. package/build-module/components/global-styles/subtitle.js +4 -3
  226. package/build-module/components/global-styles/subtitle.js.map +1 -1
  227. package/build-module/components/global-styles/typography-panel.js +9 -7
  228. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  229. package/build-module/components/global-styles/ui.js +4 -3
  230. package/build-module/components/global-styles/ui.js.map +1 -1
  231. package/build-module/components/global-styles/use-global-styles-output.js +60 -43
  232. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  233. package/build-module/components/global-styles/utils.js +3 -2
  234. package/build-module/components/global-styles/utils.js.map +1 -1
  235. package/build-module/components/header/document-actions/index.js +23 -19
  236. package/build-module/components/header/document-actions/index.js.map +1 -1
  237. package/build-module/components/header/feature-toggle/index.js +9 -7
  238. package/build-module/components/header/feature-toggle/index.js.map +1 -1
  239. package/build-module/components/header/index.js +15 -12
  240. package/build-module/components/header/index.js.map +1 -1
  241. package/build-module/components/header/more-menu/index.js +30 -27
  242. package/build-module/components/header/more-menu/index.js.map +1 -1
  243. package/build-module/components/header/tools-more-menu-group/index.js +10 -7
  244. package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
  245. package/build-module/components/keyboard-shortcuts/index.js +4 -3
  246. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  247. package/build-module/components/list/header.js +37 -0
  248. package/build-module/components/list/header.js.map +1 -0
  249. package/build-module/components/list/index.js +40 -0
  250. package/build-module/components/list/index.js.map +1 -0
  251. package/build-module/components/list/table.js +112 -0
  252. package/build-module/components/list/table.js.map +1 -0
  253. package/build-module/components/main-dashboard-button/index.js +4 -3
  254. package/build-module/components/main-dashboard-button/index.js.map +1 -1
  255. package/build-module/components/navigate-to-link/index.js +7 -6
  256. package/build-module/components/navigate-to-link/index.js.map +1 -1
  257. package/build-module/components/navigation-sidebar/index.js +12 -8
  258. package/build-module/components/navigation-sidebar/index.js.map +1 -1
  259. package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js +4 -3
  260. package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map +1 -1
  261. package/build-module/components/navigation-sidebar/navigation-panel/index.js +38 -55
  262. package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
  263. package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js +6 -5
  264. package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js.map +1 -1
  265. package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts.js +26 -20
  266. package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts.js.map +1 -1
  267. package/build-module/components/navigation-sidebar/navigation-panel/menus/templates-sub.js +17 -10
  268. package/build-module/components/navigation-sidebar/navigation-panel/menus/templates-sub.js.map +1 -1
  269. package/build-module/components/navigation-sidebar/navigation-panel/menus/templates.js +11 -5
  270. package/build-module/components/navigation-sidebar/navigation-panel/menus/templates.js.map +1 -1
  271. package/build-module/components/navigation-sidebar/navigation-panel/navigation-entity-items.js +13 -11
  272. package/build-module/components/navigation-sidebar/navigation-panel/navigation-entity-items.js.map +1 -1
  273. package/build-module/components/navigation-sidebar/navigation-panel/new-template-dropdown.js +24 -18
  274. package/build-module/components/navigation-sidebar/navigation-panel/new-template-dropdown.js.map +1 -1
  275. package/build-module/components/navigation-sidebar/navigation-panel/search-results.js +14 -11
  276. package/build-module/components/navigation-sidebar/navigation-panel/search-results.js.map +1 -1
  277. package/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js +6 -3
  278. package/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js.map +1 -1
  279. package/build-module/components/navigation-sidebar/navigation-panel/template-navigation-item.js +4 -3
  280. package/build-module/components/navigation-sidebar/navigation-panel/template-navigation-item.js.map +1 -1
  281. package/build-module/components/navigation-sidebar/navigation-panel/template-preview.js +5 -4
  282. package/build-module/components/navigation-sidebar/navigation-panel/template-preview.js.map +1 -1
  283. package/build-module/components/navigation-sidebar/navigation-toggle/index.js +8 -27
  284. package/build-module/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
  285. package/build-module/components/save-button/index.js +5 -4
  286. package/build-module/components/save-button/index.js.map +1 -1
  287. package/build-module/components/sidebar/default-sidebar.js +11 -10
  288. package/build-module/components/sidebar/default-sidebar.js.map +1 -1
  289. package/build-module/components/sidebar/plugin-sidebar/index.js +5 -4
  290. package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
  291. package/build-module/components/sidebar/settings-header/index.js +4 -3
  292. package/build-module/components/sidebar/settings-header/index.js.map +1 -1
  293. package/build-module/components/sidebar/template-card/template-areas.js +17 -13
  294. package/build-module/components/sidebar/template-card/template-areas.js.map +1 -1
  295. package/build-module/components/template-details/index.js +14 -9
  296. package/build-module/components/template-details/index.js.map +1 -1
  297. package/build-module/components/template-details/template-areas.js +38 -29
  298. package/build-module/components/template-details/template-areas.js.map +1 -1
  299. package/build-module/components/template-part-converter/convert-to-regular.js +15 -11
  300. package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
  301. package/build-module/components/template-part-converter/convert-to-template-part.js +29 -86
  302. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  303. package/build-module/components/welcome-guide/editor.js +45 -0
  304. package/build-module/components/welcome-guide/editor.js.map +1 -0
  305. package/build-module/components/welcome-guide/image.js +19 -0
  306. package/build-module/components/welcome-guide/image.js.map +1 -0
  307. package/build-module/components/welcome-guide/index.js +35 -0
  308. package/build-module/components/welcome-guide/index.js.map +1 -0
  309. package/build-module/components/welcome-guide/styles.js +69 -0
  310. package/build-module/components/welcome-guide/styles.js.map +1 -0
  311. package/build-module/index.js +21 -1
  312. package/build-module/index.js.map +1 -1
  313. package/build-module/plugins/index.js +3 -2
  314. package/build-module/plugins/index.js.map +1 -1
  315. package/build-module/plugins/welcome-guide-menu-item.js +27 -0
  316. package/build-module/plugins/welcome-guide-menu-item.js.map +1 -0
  317. package/build-module/store/actions.js +11 -11
  318. package/build-module/store/actions.js.map +1 -1
  319. package/build-module/store/defaults.js +4 -1
  320. package/build-module/store/defaults.js.map +1 -1
  321. package/build-module/store/reducer.js +31 -10
  322. package/build-module/store/reducer.js.map +1 -1
  323. package/build-module/store/selectors.js +17 -10
  324. package/build-module/store/selectors.js.map +1 -1
  325. package/build-module/utils/is-template-removable.js +14 -0
  326. package/build-module/utils/is-template-removable.js.map +1 -0
  327. package/build-style/style-rtl.css +365 -40
  328. package/build-style/style.css +365 -40
  329. package/package.json +27 -27
  330. package/src/components/add-new-template/index.js +30 -0
  331. package/src/components/add-new-template/new-template-part.js +67 -0
  332. package/src/components/add-new-template/new-template.js +117 -0
  333. package/src/components/add-new-template/style.scss +11 -0
  334. package/src/components/create-template-part-modal/index.js +132 -0
  335. package/src/components/{template-part-converter → create-template-part-modal}/style.scss +9 -9
  336. package/src/components/editor/index.js +10 -14
  337. package/src/components/editor/style.scss +8 -0
  338. package/src/components/global-styles/global-styles-provider.js +4 -3
  339. package/src/components/global-styles/hooks.js +58 -26
  340. package/src/components/global-styles/screen-block-list.js +11 -1
  341. package/src/components/global-styles/test/use-global-styles-output.js +2 -2
  342. package/src/components/global-styles/use-global-styles-output.js +2 -2
  343. package/src/components/global-styles/utils.js +1 -1
  344. package/src/components/header/index.js +0 -3
  345. package/src/components/list/header.js +34 -0
  346. package/src/components/list/index.js +38 -0
  347. package/src/components/list/style.scss +113 -0
  348. package/src/components/list/table.js +133 -0
  349. package/src/components/navigation-sidebar/index.js +15 -8
  350. package/src/components/navigation-sidebar/navigation-panel/index.js +44 -55
  351. package/src/components/navigation-sidebar/navigation-panel/style.scss +4 -2
  352. package/src/components/navigation-sidebar/navigation-toggle/index.js +4 -28
  353. package/src/components/template-details/index.js +3 -2
  354. package/src/components/template-part-converter/convert-to-template-part.js +20 -140
  355. package/src/components/welcome-guide/editor.js +63 -0
  356. package/src/components/welcome-guide/image.js +11 -0
  357. package/src/components/welcome-guide/index.js +33 -0
  358. package/src/components/welcome-guide/style.scss +37 -0
  359. package/src/components/welcome-guide/styles.js +116 -0
  360. package/src/index.js +21 -1
  361. package/src/plugins/index.js +3 -1
  362. package/src/plugins/welcome-guide-menu-item.js +35 -0
  363. package/src/store/actions.js +11 -9
  364. package/src/store/defaults.js +4 -1
  365. package/src/store/test/actions.js +14 -20
  366. package/src/style.scss +11 -7
  367. package/src/utils/is-template-removable.js +13 -0
  368. package/build/components/header/navigation-link/index.js +0 -86
  369. package/build/components/header/navigation-link/index.js.map +0 -1
  370. package/build-module/components/header/navigation-link/index.js +0 -73
  371. package/build-module/components/header/navigation-link/index.js.map +0 -1
  372. package/src/components/header/navigation-link/index.js +0 -71
  373. package/src/components/header/navigation-link/style.scss +0 -69
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/new-template-part.js"],"names":["kebabCase","useState","Button","addQueryArgs","apiFetch","CreateTemplatePartModal","NewTemplatePart","postType","isModalOpen","setIsModalOpen","createTemplatePart","title","area","templatePart","path","method","data","slug","content","window","location","search","page","postId","id","Promise","labels","add_new"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,MAAT,QAAuB,uBAAv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,cAAc,CAAE,KAAF,CADlC;AAEC,IAAA,QAAQ,EAAGC;AAFZ,IAVF,CADD;AAkBA","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { Button } from '@wordpress/components';\nimport { addQueryArgs } from '@wordpress/url';\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport CreateTemplatePartModal from '../create-template-part-modal';\n\nexport default function NewTemplatePart( { postType } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\n\tasync function createTemplatePart( { title, area } ) {\n\t\tif ( ! title ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst templatePart = await apiFetch( {\n\t\t\tpath: '/wp/v2/template-parts',\n\t\t\tmethod: 'POST',\n\t\t\tdata: {\n\t\t\t\tslug: kebabCase( title ),\n\t\t\t\ttitle,\n\t\t\t\tcontent: '',\n\t\t\t\tarea,\n\t\t\t},\n\t\t} );\n\n\t\t// Navigate to the created template part editor.\n\t\twindow.location.search = addQueryArgs( '', {\n\t\t\tpage: 'gutenberg-edit-site',\n\t\t\tpostId: templatePart.id,\n\t\t\tpostType: 'wp_template_part',\n\t\t} );\n\n\t\t// Wait for async navigation to happen before closing the modal.\n\t\tawait new Promise( () => {} );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ postType.labels.add_new }\n\t\t\t</Button>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => setIsModalOpen( false ) }\n\t\t\t\t\tonCreate={ createTemplatePart }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
@@ -0,0 +1,98 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * External dependencies
5
+ */
6
+ import { filter, find, includes, map } from 'lodash';
7
+ /**
8
+ * WordPress dependencies
9
+ */
10
+
11
+ import { DropdownMenu, MenuGroup, MenuItem, NavigableMenu } from '@wordpress/components';
12
+ import { useSelect } from '@wordpress/data';
13
+ import { store as coreStore } from '@wordpress/core-data';
14
+ import { store as editorStore } from '@wordpress/editor';
15
+ import { addQueryArgs } from '@wordpress/url';
16
+ import apiFetch from '@wordpress/api-fetch';
17
+ const DEFAULT_TEMPLATE_SLUGS = ['front-page', 'single-post', 'page', 'archive', 'search', '404', 'index'];
18
+ export default function NewTemplate(_ref) {
19
+ let {
20
+ postType
21
+ } = _ref;
22
+ const {
23
+ templates,
24
+ defaultTemplateTypes
25
+ } = useSelect(select => ({
26
+ templates: select(coreStore).getEntityRecords('postType', 'wp_template'),
27
+ defaultTemplateTypes: select(editorStore).__experimentalGetDefaultTemplateTypes()
28
+ }), []);
29
+
30
+ async function createTemplate(_ref2) {
31
+ let {
32
+ slug
33
+ } = _ref2;
34
+ const {
35
+ title,
36
+ description
37
+ } = find(defaultTemplateTypes, {
38
+ slug
39
+ });
40
+ const template = await apiFetch({
41
+ path: '/wp/v2/templates',
42
+ method: 'POST',
43
+ data: {
44
+ excerpt: description,
45
+ // Slugs need to be strings, so this is for template `404`
46
+ slug: slug.toString(),
47
+ status: 'publish',
48
+ title
49
+ }
50
+ }); // Navigate to the created template editor.
51
+
52
+ window.location.search = addQueryArgs('', {
53
+ page: 'gutenberg-edit-site',
54
+ postId: template.id,
55
+ postType: 'wp_template'
56
+ });
57
+ }
58
+
59
+ const existingTemplateSlugs = map(templates, 'slug');
60
+ const missingTemplates = filter(defaultTemplateTypes, template => includes(DEFAULT_TEMPLATE_SLUGS, template.slug) && !includes(existingTemplateSlugs, template.slug));
61
+
62
+ if (!missingTemplates.length) {
63
+ return null;
64
+ }
65
+
66
+ return createElement(DropdownMenu, {
67
+ className: "edit-site-new-template-dropdown",
68
+ icon: null,
69
+ text: postType.labels.add_new,
70
+ label: postType.labels.add_new_item,
71
+ popoverProps: {
72
+ noArrow: false
73
+ },
74
+ toggleProps: {
75
+ variant: 'primary'
76
+ }
77
+ }, () => createElement(NavigableMenu, {
78
+ className: "edit-site-new-template-dropdown__popover"
79
+ }, createElement(MenuGroup, {
80
+ label: postType.labels.add_new_item
81
+ }, map(missingTemplates, _ref3 => {
82
+ let {
83
+ title,
84
+ description,
85
+ slug
86
+ } = _ref3;
87
+ return createElement(MenuItem, {
88
+ info: description,
89
+ key: slug,
90
+ onClick: () => {
91
+ createTemplate({
92
+ slug
93
+ }); // We will be navigated way so no need to close the dropdown.
94
+ }
95
+ }, title);
96
+ }))));
97
+ }
98
+ //# sourceMappingURL=new-template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/new-template.js"],"names":["filter","find","includes","map","DropdownMenu","MenuGroup","MenuItem","NavigableMenu","useSelect","store","coreStore","editorStore","addQueryArgs","apiFetch","DEFAULT_TEMPLATE_SLUGS","NewTemplate","postType","templates","defaultTemplateTypes","select","getEntityRecords","__experimentalGetDefaultTemplateTypes","createTemplate","slug","title","description","template","path","method","data","excerpt","toString","status","window","location","search","page","postId","id","existingTemplateSlugs","missingTemplates","length","labels","add_new","add_new_item","noArrow","variant"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,IAAjB,EAAuBC,QAAvB,EAAiCC,GAAjC,QAA4C,QAA5C;AAEA;AACA;AACA;;AACA,SACCC,YADD,EAECC,SAFD,EAGCC,QAHD,EAICC,aAJD,QAKO,uBALP;AAMA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,mBAArC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,OAAOC,QAAP,MAAqB,sBAArB;AAEA,MAAMC,sBAAsB,GAAG,CAC9B,YAD8B,EAE9B,aAF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EAAa,MAAb,CAAjC;AAEA,QAAMuB,gBAAgB,GAAGxC,MAAM,CAC9BkB,oBAD8B,EAE5BQ,QAAF,IACCxB,QAAQ,CAAEY,sBAAF,EAA0BY,QAAQ,CAACH,IAAnC,CAAR,IACA,CAAErB,QAAQ,CAAEqC,qBAAF,EAAyBb,QAAQ,CAACH,IAAlC,CAJmB,CAA/B;;AAOA,MAAK,CAAEiB,gBAAgB,CAACC,MAAxB,EAAiC;AAChC,WAAO,IAAP;AACA;;AAED,SACC,cAAC,YAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,IAAI,EAAG,IAFR;AAGC,IAAA,IAAI,EAAGzB,QAAQ,CAAC0B,MAAT,CAAgBC,OAHxB;AAIC,IAAA,KAAK,EAAG3B,QAAQ,CAAC0B,MAAT,CAAgBE,YAJzB;AAKC,IAAA,YAAY,EAAG;AACdC,MAAAA,OAAO,EAAE;AADK,KALhB;AAQC,IAAA,WAAW,EAAG;AACbC,MAAAA,OAAO,EAAE;AADI;AARf,KAYG,MACD,cAAC,aAAD;AAAe,IAAA,SAAS,EAAC;AAAzB,KACC,cAAC,SAAD;AAAW,IAAA,KAAK,EAAG9B,QAAQ,CAAC0B,MAAT,CAAgBE;AAAnC,KACGzC,GAAG,CACJqC,gBADI,EAEJ;AAAA,QAAE;AAAEhB,MAAAA,KAAF;AAASC,MAAAA,WAAT;AAAsBF,MAAAA;AAAtB,KAAF;AAAA,WACC,cAAC,QAAD;AACC,MAAA,IAAI,EAAGE,WADR;AAEC,MAAA,GAAG,EAAGF,IAFP;AAGC,MAAA,OAAO,EAAG,MAAM;AACfD,QAAAA,cAAc,CAAE;AAAEC,UAAAA;AAAF,SAAF,CAAd,CADe,CAEf;AACA;AANF,OAQGC,KARH,CADD;AAAA,GAFI,CADN,CADD,CAbF,CADD;AAoCA","sourcesContent":["/**\n * External dependencies\n */\nimport { filter, find, includes, map } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tNavigableMenu,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { addQueryArgs } from '@wordpress/url';\nimport apiFetch from '@wordpress/api-fetch';\n\nconst DEFAULT_TEMPLATE_SLUGS = [\n\t'front-page',\n\t'single-post',\n\t'page',\n\t'archive',\n\t'search',\n\t'404',\n\t'index',\n];\n\nexport default function NewTemplate( { postType } ) {\n\tconst { templates, defaultTemplateTypes } = useSelect(\n\t\t( select ) => ( {\n\t\t\ttemplates: select( coreStore ).getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template'\n\t\t\t),\n\t\t\tdefaultTemplateTypes: select(\n\t\t\t\teditorStore\n\t\t\t).__experimentalGetDefaultTemplateTypes(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tasync function createTemplate( { slug } ) {\n\t\tconst { title, description } = find( defaultTemplateTypes, { slug } );\n\n\t\tconst template = await apiFetch( {\n\t\t\tpath: '/wp/v2/templates',\n\t\t\tmethod: 'POST',\n\t\t\tdata: {\n\t\t\t\texcerpt: description,\n\t\t\t\t// Slugs need to be strings, so this is for template `404`\n\t\t\t\tslug: slug.toString(),\n\t\t\t\tstatus: 'publish',\n\t\t\t\ttitle,\n\t\t\t},\n\t\t} );\n\n\t\t// Navigate to the created template editor.\n\t\twindow.location.search = addQueryArgs( '', {\n\t\t\tpage: 'gutenberg-edit-site',\n\t\t\tpostId: template.id,\n\t\t\tpostType: 'wp_template',\n\t\t} );\n\t}\n\n\tconst existingTemplateSlugs = map( templates, 'slug' );\n\n\tconst missingTemplates = filter(\n\t\tdefaultTemplateTypes,\n\t\t( template ) =>\n\t\t\tincludes( DEFAULT_TEMPLATE_SLUGS, template.slug ) &&\n\t\t\t! includes( existingTemplateSlugs, template.slug )\n\t);\n\n\tif ( ! missingTemplates.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName=\"edit-site-new-template-dropdown\"\n\t\t\ticon={ null }\n\t\t\ttext={ postType.labels.add_new }\n\t\t\tlabel={ postType.labels.add_new_item }\n\t\t\tpopoverProps={ {\n\t\t\t\tnoArrow: false,\n\t\t\t} }\n\t\t\ttoggleProps={ {\n\t\t\t\tvariant: 'primary',\n\t\t\t} }\n\t\t>\n\t\t\t{ () => (\n\t\t\t\t<NavigableMenu className=\"edit-site-new-template-dropdown__popover\">\n\t\t\t\t\t<MenuGroup label={ postType.labels.add_new_item }>\n\t\t\t\t\t\t{ map(\n\t\t\t\t\t\t\tmissingTemplates,\n\t\t\t\t\t\t\t( { title, description, slug } ) => (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tinfo={ description }\n\t\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tcreateTemplate( { slug } );\n\t\t\t\t\t\t\t\t\t\t// We will be navigated way so no need to close the dropdown.\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\t\t{ title }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) }\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</NavigableMenu>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"]}
@@ -16,9 +16,10 @@ import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
16
16
  import { store as editSiteStore } from '../../store';
17
17
  import { STORE_NAME } from '../../store/constants';
18
18
  import { SIDEBAR_BLOCK } from '../sidebar/constants';
19
- export default function BlockInspectorButton({
20
- onClick = () => {}
21
- }) {
19
+ export default function BlockInspectorButton(_ref) {
20
+ let {
21
+ onClick = () => {}
22
+ } = _ref;
22
23
  const {
23
24
  shortcut,
24
25
  isBlockInspectorOpen
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/block-inspector-button.js"],"names":["__","speak","MenuItem","useSelect","useDispatch","store","interfaceStore","keyboardShortcutsStore","editSiteStore","STORE_NAME","SIDEBAR_BLOCK","BlockInspectorButton","onClick","shortcut","isBlockInspectorOpen","select","getShortcutRepresentation","getActiveComplementaryArea","name","enableComplementaryArea","disableComplementaryArea","label"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,sBAAxC;AACA,SAASD,KAAK,IAAIE,sBAAlB,QAAgD,+BAAhD;AAEA;AACA;AACA;;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,aAAvC;AACA,SAASC,UAAT,QAA2B,uBAA3B;AACA,SAASC,aAAT,QAA8B,sBAA9B;AAEA,eAAe,SAASC,oBAAT,CAA+B;AAAEC,EAAAA,OAAO,GAAG,MAAM,CAAE;AAApB,CAA/B,EAAwD;AACtE,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAqCX,SAAS,CACjDY,MAAF,KAAgB;AACfF,IAAAA,QAAQ,EAAEE,MAAM,CACfR,sBADe,CAAN,CAERS,yBAFQ,CAGT,8CAHS,CADK;AAMfF,IAAAA,oBAAoB,EACnBC,MAAM,CAAET,cAAF,CAAN,CAAyBW,0BAAzB,CACCT,aAAa,CAACU,IADf,MAEMR;AATQ,GAAhB,CADmD,EAYnD,EAZmD,CAApD;AAcA,QAAM;AAAES,IAAAA,uBAAF;AAA2BC,IAAAA;AAA3B,MAAwDhB,WAAW,CACxEE,cADwE,CAAzE;AAIA,QAAMe,KAAK,GAAGP,oBAAoB,GAC/Bd,EAAE,CAAE,oBAAF,CAD6B,GAE/BA,EAAE,CAAE,oBAAF,CAFL;AAIA,SACC,cAAC,QAAD;AACC,IAAA,OAAO,EAAG,MAAM;AACf,UAAKc,oBAAL,EAA4B;AAC3BM,QAAAA,wBAAwB,CAAEX,UAAF,CAAxB;AACAR,QAAAA,KAAK,CAAED,EAAE,CAAE,uBAAF,CAAJ,CAAL;AACA,OAHD,MAGO;AACNmB,QAAAA,uBAAuB,CAAEV,UAAF,EAAcC,aAAd,CAAvB;AACAT,QAAAA,KAAK,CACJD,EAAE,CACD,4EADC,CADE,CAAL;AAKA,OAXc,CAYf;;;AACAY,MAAAA,OAAO;AACP,KAfF;AAgBC,IAAA,QAAQ,EAAGC;AAhBZ,KAkBGQ,KAlBH,CADD;AAsBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { speak } from '@wordpress/a11y';\nimport { MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { STORE_NAME } from '../../store/constants';\nimport { SIDEBAR_BLOCK } from '../sidebar/constants';\n\nexport default function BlockInspectorButton( { onClick = () => {} } ) {\n\tconst { shortcut, isBlockInspectorOpen } = useSelect(\n\t\t( select ) => ( {\n\t\t\tshortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation(\n\t\t\t\t'core/edit-site/toggle-block-settings-sidebar'\n\t\t\t),\n\t\t\tisBlockInspectorOpen:\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t\teditSiteStore.name\n\t\t\t\t) === SIDEBAR_BLOCK,\n\t\t} ),\n\t\t[]\n\t);\n\tconst { enableComplementaryArea, disableComplementaryArea } = useDispatch(\n\t\tinterfaceStore\n\t);\n\n\tconst label = isBlockInspectorOpen\n\t\t? __( 'Hide more settings' )\n\t\t: __( 'Show more settings' );\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\tif ( isBlockInspectorOpen ) {\n\t\t\t\t\tdisableComplementaryArea( STORE_NAME );\n\t\t\t\t\tspeak( __( 'Block settings closed' ) );\n\t\t\t\t} else {\n\t\t\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\t\t\t\t\tspeak(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Additional settings are now available in the Editor block settings sidebar'\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// Close dropdown menu.\n\t\t\t\tonClick();\n\t\t\t} }\n\t\t\tshortcut={ shortcut }\n\t\t>\n\t\t\t{ label }\n\t\t</MenuItem>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/block-inspector-button.js"],"names":["__","speak","MenuItem","useSelect","useDispatch","store","interfaceStore","keyboardShortcutsStore","editSiteStore","STORE_NAME","SIDEBAR_BLOCK","BlockInspectorButton","onClick","shortcut","isBlockInspectorOpen","select","getShortcutRepresentation","getActiveComplementaryArea","name","enableComplementaryArea","disableComplementaryArea","label"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,sBAAxC;AACA,SAASD,KAAK,IAAIE,sBAAlB,QAAgD,+BAAhD;AAEA;AACA;AACA;;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,aAAvC;AACA,SAASC,UAAT,QAA2B,uBAA3B;AACA,SAASC,aAAT,QAA8B,sBAA9B;AAEA,eAAe,SAASC,oBAAT,OAAwD;AAAA,MAAzB;AAAEC,IAAAA,OAAO,GAAG,MAAM,CAAE;AAApB,GAAyB;AACtE,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAqCX,SAAS,CACjDY,MAAF,KAAgB;AACfF,IAAAA,QAAQ,EAAEE,MAAM,CACfR,sBADe,CAAN,CAERS,yBAFQ,CAGT,8CAHS,CADK;AAMfF,IAAAA,oBAAoB,EACnBC,MAAM,CAAET,cAAF,CAAN,CAAyBW,0BAAzB,CACCT,aAAa,CAACU,IADf,MAEMR;AATQ,GAAhB,CADmD,EAYnD,EAZmD,CAApD;AAcA,QAAM;AAAES,IAAAA,uBAAF;AAA2BC,IAAAA;AAA3B,MAAwDhB,WAAW,CACxEE,cADwE,CAAzE;AAIA,QAAMe,KAAK,GAAGP,oBAAoB,GAC/Bd,EAAE,CAAE,oBAAF,CAD6B,GAE/BA,EAAE,CAAE,oBAAF,CAFL;AAIA,SACC,cAAC,QAAD;AACC,IAAA,OAAO,EAAG,MAAM;AACf,UAAKc,oBAAL,EAA4B;AAC3BM,QAAAA,wBAAwB,CAAEX,UAAF,CAAxB;AACAR,QAAAA,KAAK,CAAED,EAAE,CAAE,uBAAF,CAAJ,CAAL;AACA,OAHD,MAGO;AACNmB,QAAAA,uBAAuB,CAAEV,UAAF,EAAcC,aAAd,CAAvB;AACAT,QAAAA,KAAK,CACJD,EAAE,CACD,4EADC,CADE,CAAL;AAKA,OAXc,CAYf;;;AACAY,MAAAA,OAAO;AACP,KAfF;AAgBC,IAAA,QAAQ,EAAGC;AAhBZ,KAkBGQ,KAlBH,CADD;AAsBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { speak } from '@wordpress/a11y';\nimport { MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { STORE_NAME } from '../../store/constants';\nimport { SIDEBAR_BLOCK } from '../sidebar/constants';\n\nexport default function BlockInspectorButton( { onClick = () => {} } ) {\n\tconst { shortcut, isBlockInspectorOpen } = useSelect(\n\t\t( select ) => ( {\n\t\t\tshortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation(\n\t\t\t\t'core/edit-site/toggle-block-settings-sidebar'\n\t\t\t),\n\t\t\tisBlockInspectorOpen:\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t\teditSiteStore.name\n\t\t\t\t) === SIDEBAR_BLOCK,\n\t\t} ),\n\t\t[]\n\t);\n\tconst { enableComplementaryArea, disableComplementaryArea } = useDispatch(\n\t\tinterfaceStore\n\t);\n\n\tconst label = isBlockInspectorOpen\n\t\t? __( 'Hide more settings' )\n\t\t: __( 'Show more settings' );\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\tif ( isBlockInspectorOpen ) {\n\t\t\t\t\tdisableComplementaryArea( STORE_NAME );\n\t\t\t\t\tspeak( __( 'Block settings closed' ) );\n\t\t\t\t} else {\n\t\t\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\t\t\t\t\tspeak(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Additional settings are now available in the Editor block settings sidebar'\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// Close dropdown menu.\n\t\t\t\tonClick();\n\t\t\t} }\n\t\t\tshortcut={ shortcut }\n\t\t>\n\t\t\t{ label }\n\t\t</MenuItem>\n\t);\n}\n"]}
@@ -31,9 +31,10 @@ const LAYOUT = {
31
31
  // At the root level of the site editor, no alignments should be allowed.
32
32
  alignments: []
33
33
  };
34
- export default function BlockEditor({
35
- setIsInserterOpen
36
- }) {
34
+ export default function BlockEditor(_ref) {
35
+ let {
36
+ setIsInserterOpen
37
+ } = _ref;
37
38
  const {
38
39
  settings,
39
40
  templateType,
@@ -94,10 +95,13 @@ export default function BlockEditor({
94
95
  }, createElement(BlockList, {
95
96
  className: "edit-site-block-editor__block-list wp-site-blocks",
96
97
  __experimentalLayout: LAYOUT
97
- })), createElement(__unstableBlockSettingsMenuFirstItem, null, ({
98
- onClose
99
- }) => createElement(BlockInspectorButton, {
100
- onClick: onClose
101
- }))));
98
+ })), createElement(__unstableBlockSettingsMenuFirstItem, null, _ref2 => {
99
+ let {
100
+ onClose
101
+ } = _ref2;
102
+ return createElement(BlockInspectorButton, {
103
+ onClick: onClose
104
+ });
105
+ })));
102
106
  }
103
107
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["classnames","useSelect","useDispatch","useCallback","useRef","useEntityBlockEditor","BlockList","BlockEditorProvider","__experimentalLinkControl","BlockInspector","BlockTools","__unstableBlockSettingsMenuFirstItem","__unstableUseTypingObserver","useTypingObserver","store","blockEditorStore","useMergeRefs","useViewportMatch","TemplatePartConverter","NavigateToLink","SidebarInspectorFill","editSiteStore","BlockInspectorButton","EditTemplatePartMenuButton","BackButton","ResizableEditor","LAYOUT","type","alignments","BlockEditor","setIsInserterOpen","settings","templateType","templateId","page","select","getSettings","getEditedPostType","getEditedPostId","getPage","blocks","onInput","onChange","setPage","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","isTemplatePart","fillProps","event","target","currentTarget","onClose"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,oBAApC;AACA,SAASC,oBAAT,QAAqC,sBAArC;AACA,SACCC,SADD,EAECC,mBAFD,EAGCC,yBAHD,EAICC,cAJD,EAKCC,UALD,EAMCC,oCAND,EAOCC,2BAA2B,IAAIC,iBAPhC,EAQCC,KAAK,IAAIC,gBARV,QASO,yBATP;AAUA,SAASC,YAAT,EAAuBC,gBAAvB,QAA+C,oBAA/C;AAEA;AACA;AACA;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EC,IAAA,oBAAoB,EAAGnB;AAFxB,IAXD,CAdD,EA+BC,cAAC,oCAAD,QACG,CAAE;AAAE2B,IAAAA;AAAF,GAAF,KACD,cAAC,oBAAD;AAAsB,IAAA,OAAO,EAAGA;AAAhC,IAFF,CA/BD,CAxBD,CADD;AAgEA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport {\n\tBlockList,\n\tBlockEditorProvider,\n\t__experimentalLinkControl,\n\tBlockInspector,\n\tBlockTools,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useMergeRefs, useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartConverter from '../template-part-converter';\nimport NavigateToLink from '../navigate-to-link';\nimport { SidebarInspectorFill } from '../sidebar';\nimport { store as editSiteStore } from '../../store';\nimport BlockInspectorButton from './block-inspector-button';\nimport EditTemplatePartMenuButton from '../edit-template-part-menu-button';\nimport BackButton from './back-button';\nimport ResizableEditor from './resizable-editor';\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( { setIsInserterOpen } ) {\n\tconst { settings, templateType, templateId, page } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetSettings,\n\t\t\t\tgetEditedPostType,\n\t\t\t\tgetEditedPostId,\n\t\t\t\tgetPage,\n\t\t\t} = select( editSiteStore );\n\n\t\t\treturn {\n\t\t\t\tsettings: getSettings( setIsInserterOpen ),\n\t\t\t\ttemplateType: getEditedPostType(),\n\t\t\t\ttemplateId: getEditedPostId(),\n\t\t\t\tpage: getPage(),\n\t\t\t};\n\t\t},\n\t\t[ setIsInserterOpen ]\n\t);\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplateType\n\t);\n\tconst { setPage } = useDispatch( editSiteStore );\n\tconst contentRef = useRef();\n\tconst mergedRefs = useMergeRefs( [ contentRef, useTypingObserver() ] );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\n\tconst isTemplatePart = templateType === 'wp_template_part';\n\n\treturn (\n\t\t<BlockEditorProvider\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<EditTemplatePartMenuButton />\n\t\t\t<TemplatePartConverter />\n\t\t\t<__experimentalLinkControl.ViewerFill>\n\t\t\t\t{ useCallback(\n\t\t\t\t\t( fillProps ) => (\n\t\t\t\t\t\t<NavigateToLink\n\t\t\t\t\t\t\t{ ...fillProps }\n\t\t\t\t\t\t\tactivePage={ page }\n\t\t\t\t\t\t\tonActivePageChange={ setPage }\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\t[ page ]\n\t\t\t\t) }\n\t\t\t</__experimentalLinkControl.ViewerFill>\n\t\t\t<SidebarInspectorFill>\n\t\t\t\t<BlockInspector />\n\t\t\t</SidebarInspectorFill>\n\t\t\t<BlockTools\n\t\t\t\tclassName={ classnames( 'edit-site-visual-editor', {\n\t\t\t\t\t'is-focus-mode': isTemplatePart,\n\t\t\t\t} ) }\n\t\t\t\t__unstableContentRef={ contentRef }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t// Clear selected block when clicking on the gray background.\n\t\t\t\t\tif ( event.target === event.currentTarget ) {\n\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<BackButton />\n\n\t\t\t\t<ResizableEditor\n\t\t\t\t\t// Reinitialize the editor and reset the states when the template changes.\n\t\t\t\t\tkey={ templateId }\n\t\t\t\t\tenableResizing={\n\t\t\t\t\t\tisTemplatePart &&\n\t\t\t\t\t\t// Disable resizing in mobile viewport.\n\t\t\t\t\t\t! isMobileViewport\n\t\t\t\t\t}\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tcontentRef={ mergedRefs }\n\t\t\t\t>\n\t\t\t\t\t<BlockList\n\t\t\t\t\t\tclassName=\"edit-site-block-editor__block-list wp-site-blocks\"\n\t\t\t\t\t\t__experimentalLayout={ LAYOUT }\n\t\t\t\t\t/>\n\t\t\t\t</ResizableEditor>\n\n\t\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t\t</BlockTools>\n\t\t</BlockEditorProvider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["classnames","useSelect","useDispatch","useCallback","useRef","useEntityBlockEditor","BlockList","BlockEditorProvider","__experimentalLinkControl","BlockInspector","BlockTools","__unstableBlockSettingsMenuFirstItem","__unstableUseTypingObserver","useTypingObserver","store","blockEditorStore","useMergeRefs","useViewportMatch","TemplatePartConverter","NavigateToLink","SidebarInspectorFill","editSiteStore","BlockInspectorButton","EditTemplatePartMenuButton","BackButton","ResizableEditor","LAYOUT","type","alignments","BlockEditor","setIsInserterOpen","settings","templateType","templateId","page","select","getSettings","getEditedPostType","getEditedPostId","getPage","blocks","onInput","onChange","setPage","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","isTemplatePart","fillProps","event","target","currentTarget","onClose"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,WAAT,EAAs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AAAA,kBAAkB;AAClB;AACD;AAVF,KAYC,cAAC,UAAD,OAZD,EAcC,cAAC,eAAD,CACC;AADD;AAEC,IAAA,GAAG,EAAGd,UAFP;AAGC,IAAA,cAAc,EACbe,cAAc,IACd;AACA,KAAEF,gBANJ;AAQC,IAAA,QAAQ,EAAGf,QARZ;AASC,IAAA,UAAU,EAAGc;AATd,KAWC,cAAC,SAAD;AACC,IAAA,SAAS,EAAC,mDADX;AAEC,IAAA,oBAAoB,EAAGnB;AAFxB,IAXD,CAdD,EA+BC,cAAC,oCAAD,QACG;AAAA,QAAE;AAAE2B,MAAAA;AAAF,KAAF;AAAA,WACD,cAAC,oBAAD;AAAsB,MAAA,OAAO,EAAGA;AAAhC,MADC;AAAA,GADH,CA/BD,CAxBD,CADD;AAgEA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport {\n\tBlockList,\n\tBlockEditorProvider,\n\t__experimentalLinkControl,\n\tBlockInspector,\n\tBlockTools,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useMergeRefs, useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartConverter from '../template-part-converter';\nimport NavigateToLink from '../navigate-to-link';\nimport { SidebarInspectorFill } from '../sidebar';\nimport { store as editSiteStore } from '../../store';\nimport BlockInspectorButton from './block-inspector-button';\nimport EditTemplatePartMenuButton from '../edit-template-part-menu-button';\nimport BackButton from './back-button';\nimport ResizableEditor from './resizable-editor';\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( { setIsInserterOpen } ) {\n\tconst { settings, templateType, templateId, page } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetSettings,\n\t\t\t\tgetEditedPostType,\n\t\t\t\tgetEditedPostId,\n\t\t\t\tgetPage,\n\t\t\t} = select( editSiteStore );\n\n\t\t\treturn {\n\t\t\t\tsettings: getSettings( setIsInserterOpen ),\n\t\t\t\ttemplateType: getEditedPostType(),\n\t\t\t\ttemplateId: getEditedPostId(),\n\t\t\t\tpage: getPage(),\n\t\t\t};\n\t\t},\n\t\t[ setIsInserterOpen ]\n\t);\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplateType\n\t);\n\tconst { setPage } = useDispatch( editSiteStore );\n\tconst contentRef = useRef();\n\tconst mergedRefs = useMergeRefs( [ contentRef, useTypingObserver() ] );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\n\tconst isTemplatePart = templateType === 'wp_template_part';\n\n\treturn (\n\t\t<BlockEditorProvider\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<EditTemplatePartMenuButton />\n\t\t\t<TemplatePartConverter />\n\t\t\t<__experimentalLinkControl.ViewerFill>\n\t\t\t\t{ useCallback(\n\t\t\t\t\t( fillProps ) => (\n\t\t\t\t\t\t<NavigateToLink\n\t\t\t\t\t\t\t{ ...fillProps }\n\t\t\t\t\t\t\tactivePage={ page }\n\t\t\t\t\t\t\tonActivePageChange={ setPage }\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\t[ page ]\n\t\t\t\t) }\n\t\t\t</__experimentalLinkControl.ViewerFill>\n\t\t\t<SidebarInspectorFill>\n\t\t\t\t<BlockInspector />\n\t\t\t</SidebarInspectorFill>\n\t\t\t<BlockTools\n\t\t\t\tclassName={ classnames( 'edit-site-visual-editor', {\n\t\t\t\t\t'is-focus-mode': isTemplatePart,\n\t\t\t\t} ) }\n\t\t\t\t__unstableContentRef={ contentRef }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t// Clear selected block when clicking on the gray background.\n\t\t\t\t\tif ( event.target === event.currentTarget ) {\n\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<BackButton />\n\n\t\t\t\t<ResizableEditor\n\t\t\t\t\t// Reinitialize the editor and reset the states when the template changes.\n\t\t\t\t\tkey={ templateId }\n\t\t\t\t\tenableResizing={\n\t\t\t\t\t\tisTemplatePart &&\n\t\t\t\t\t\t// Disable resizing in mobile viewport.\n\t\t\t\t\t\t! isMobileViewport\n\t\t\t\t\t}\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tcontentRef={ mergedRefs }\n\t\t\t\t>\n\t\t\t\t\t<BlockList\n\t\t\t\t\t\tclassName=\"edit-site-block-editor__block-list wp-site-blocks\"\n\t\t\t\t\t\t__experimentalLayout={ LAYOUT }\n\t\t\t\t\t/>\n\t\t\t\t</ResizableEditor>\n\n\t\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t\t</BlockTools>\n\t\t</BlockEditorProvider>\n\t);\n}\n"]}
@@ -32,11 +32,12 @@ const HANDLE_STYLES_OVERRIDE = {
32
32
  left: undefined
33
33
  };
34
34
 
35
- function ResizableEditor({
36
- enableResizing,
37
- settings,
38
- ...props
39
- }) {
35
+ function ResizableEditor(_ref) {
36
+ let {
37
+ enableResizing,
38
+ settings,
39
+ ...props
40
+ } = _ref;
40
41
  const deviceType = useSelect(select => select(editSiteStore).__experimentalGetPreviewDeviceType(), []);
41
42
  const deviceStyles = useResizeCanvas(deviceType);
42
43
  const [width, setWidth] = useState(DEFAULT_STYLES.width);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/resizable-editor.js"],"names":["useState","useEffect","useRef","useCallback","ResizableBox","__experimentalUseResizeCanvas","useResizeCanvas","__unstableEditorStyles","EditorStyles","__unstableIframe","Iframe","__unstableUseMouseMoveTypingReset","useMouseMoveTypingReset","useSelect","useMergeRefs","store","editSiteStore","ResizeHandle","DEFAULT_STYLES","width","height","HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","top","right","bottom","left","ResizableEditor","enableResizing","settings","props","deviceType","select","__experimentalGetPreviewDeviceType","deviceStyles","setWidth","setHeight","iframeRef","mouseMoveTypingResetRef","ref","autoResizeIframeHeight","iframe","current","resizeObserver","contentWindow","ResizeObserver","contentDocument","querySelector","offsetHeight","observe","documentElement","disconnect","resizeWidthBy","deltaPixels","offsetWidth","event","direction","element","style","styles"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,SAAnB,EAA8BC,MAA9B,EAAsCC,WAAtC,QAAyD,oBAAzD;AACA,SAASC,YAAT,QAA6B,uBAA7B;AACA,SACCC,6BAA6B,IAAIC,eADlC,EAECC,sBAAsB,IAAIC,YAF3B,EAGCC,gBAAgB,IAAIC,MAHrB,EAICC,iCAAiC,IAAIC,uBAJtC,QAKO,yBALP;AAMA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,YAAT,QAA6B,oBAA7B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AAEA,MAAMC,cAAc,GAAG;AACtBC,EAAAA,KAAK,EAAE,MADe;AAEtBC,EAAAA,MAAM,EAAE;AAFc,CAAvB,C,CAKA;;AACA,MAAMC,sBAAsB,GAAG;AAC9BC,EAAAA,QAAQ,EAAEC,SADoB;AAE9BC,EAAAA,UAAU,EAAED,SAFkB;AAG9BE,EAAAA,MAAM,EAAEF,SAHsB;AAI9BJ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AI,EAAER,sBADQ;AAEdM,MAAAA,KAAK,EAAEN;AAFO;AAnChB,KAwCC,cAAC,MAAD;AACC,IAAA,KAAK,EAAGU,cAAc,GAAGR,SAAH,GAAec,YADtC;AAEC,IAAA,IAAI,EACH,8BACC,cAAC,YAAD;AAAc,MAAA,MAAM,EAAGL,QAAQ,CAAC8B;AAAhC,MADD,EAEC,6BACC;AACA;AACC,iEAHF,CAFD,CAHF;AAYC,IAAA,GAAG,EAAGpB,GAZP;AAaC,IAAA,IAAI,EAAC,eAbN;AAcC,IAAA,SAAS,EAAC;AAdX,KAeMT,KAfN,EAxCD,CADD;AA4DA;;AAED,eAAeH,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useRef, useCallback } from '@wordpress/element';\nimport { ResizableBox } from '@wordpress/components';\nimport {\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport ResizeHandle from './resize-handle';\n\nconst DEFAULT_STYLES = {\n\twidth: '100%',\n\theight: '100%',\n};\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\nfunction ResizableEditor( { enableResizing, settings, ...props } ) {\n\tconst deviceType = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editSiteStore ).__experimentalGetPreviewDeviceType(),\n\t\t[]\n\t);\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst [ width, setWidth ] = useState( DEFAULT_STYLES.width );\n\tconst [ height, setHeight ] = useState( DEFAULT_STYLES.height );\n\tconst iframeRef = useRef();\n\tconst mouseMoveTypingResetRef = useMouseMoveTypingReset();\n\tconst ref = useMergeRefs( [ iframeRef, mouseMoveTypingResetRef ] );\n\n\tuseEffect(\n\t\tfunction autoResizeIframeHeight() {\n\t\t\tconst iframe = iframeRef.current;\n\n\t\t\tif ( ! iframe || ! enableResizing ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst resizeObserver = new iframe.contentWindow.ResizeObserver(\n\t\t\t\t() => {\n\t\t\t\t\tsetHeight(\n\t\t\t\t\t\tiframe.contentDocument.querySelector(\n\t\t\t\t\t\t\t`.edit-site-block-editor__block-list`\n\t\t\t\t\t\t).offsetHeight\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// Observing the <html> rather than the <body> because the latter\n\t\t\t// gets destroyed and remounted after initialization in <Iframe>.\n\t\t\tresizeObserver.observe( iframe.contentDocument.documentElement );\n\n\t\t\treturn () => {\n\t\t\t\tresizeObserver.disconnect();\n\t\t\t};\n\t\t},\n\t\t[ enableResizing ]\n\t);\n\n\tconst resizeWidthBy = useCallback( ( deltaPixels ) => {\n\t\tif ( iframeRef.current ) {\n\t\t\tsetWidth( iframeRef.current.offsetWidth + deltaPixels );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tsize={ {\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t} }\n\t\t\tonResizeStop={ ( event, direction, element ) => {\n\t\t\t\tsetWidth( element.style.width );\n\t\t\t} }\n\t\t\tminWidth={ 300 }\n\t\t\tmaxWidth=\"100%\"\n\t\t\tmaxHeight=\"100%\"\n\t\t\tenable={ {\n\t\t\t\tright: enableResizing,\n\t\t\t\tleft: enableResizing,\n\t\t\t} }\n\t\t\tshowHandle={ enableResizing }\n\t\t\t// The editor is centered horizontally, resizing it only\n\t\t\t// moves half the distance. Hence double the ratio to correctly\n\t\t\t// align the cursor to the resizer handle.\n\t\t\tresizeRatio={ 2 }\n\t\t\thandleComponent={ {\n\t\t\t\tleft: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"left\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t\tright: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"right\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t} }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t>\n\t\t\t<Iframe\n\t\t\t\tstyle={ enableResizing ? undefined : deviceStyles }\n\t\t\t\thead={\n\t\t\t\t\t<>\n\t\t\t\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t\t\t\t<style>{\n\t\t\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t\t\t\t`.edit-site-block-editor__block-list { display: flow-root; }`\n\t\t\t\t\t\t}</style>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tref={ ref }\n\t\t\t\tname=\"editor-canvas\"\n\t\t\t\tclassName=\"edit-site-visual-editor__editor-canvas\"\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableEditor;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/resizable-editor.js"],"names":["useState","useEffect","useRef","useCallback","ResizableBox","__experimentalUseResizeCanvas","useResizeCanvas","__unstableEditorStyles","EditorStyles","__unstableIframe","Iframe","__unstableUseMouseMoveTypingReset","useMouseMoveTypingReset","useSelect","useMergeRefs","store","editSiteStore","ResizeHandle","DEFAULT_STYLES","width","height","HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","top","right","bottom","left","ResizableEditor","enableResizing","settings","props","deviceType","select","__experimentalGetPreviewDeviceType","deviceStyles","setWidth","setHeight","iframeRef","mouseMoveTypingResetRef","ref","autoResizeIframeHeight","iframe","current","resizeObserver","contentWindow","ResizeObserver","contentDocument","querySelector","offsetHeight","observe","documentElement","disconnect","resizeWidthBy","deltaPixels","offsetWidth","event","direction","element","style","styles"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,SAAnB,EAA8BC,MAA9B,EAAsCC,WAAtC,QAAyD,oBAAzD;AACA,SAASC,YAAT,QAA6B,uBAA7B;AACA,SACCC,6BAA6B,IAAIC,eADlC,EAECC,sBAAsB,IAAIC,YAF3B,EAGCC,gBAAgB,IAAIC,MAHrB,EAICC,iCAAiC,IAAIC,uBAJtC,QAKO,yBALP;AAMA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,YAAT,QAA6B,oBAA7B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AAEA,MAAMC,cAAc,GAAG;AACtBC,EAAAA,KAAK,EAAE,MADe;AAEtBC,EAAAA,MAAM,EAAE;AAFc,CAAvB,C,CAKA;;AACA,MAAMC,sBAAsB,GAAG;AAC9BC,EAAAA,QAAQ,EAAEC,SADoB;AAE9BC,EAAAA,UAAU,EAAED,SAFkB;AAG9BE,EAAAA,MAAM,EAAEF,SAHsB;AAI9BJ,EAAAA,KAAK,EAAEI,SAJuB;AAK9BH,EAAAA,MAAM,EAAEG,SALsB;AAM9BG,EAAAA,GAAG,EAAEH,SANyB;AAO9BI,EAAAA,KAAK,EAAEJ,SAPuB;AAQ9BK,EAAAA,MAAM,EAAEL,SARsB;AAS9BM,EAAAA,IAAI,EAAEN;AATwB,CAA/B;;AAYA,SAASO,eAAT,OAAmE;AAAA,MAAzC;AAAE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F,CAFD,CAHF;AAYC,IAAA,GAAG,EAAGpB,GAZP;AAaC,IAAA,IAAI,EAAC,eAbN;AAcC,IAAA,SAAS,EAAC;AAdX,KAeMT,KAfN,EAxCD,CADD;AA4DA;;AAED,eAAeH,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useRef, useCallback } from '@wordpress/element';\nimport { ResizableBox } from '@wordpress/components';\nimport {\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport ResizeHandle from './resize-handle';\n\nconst DEFAULT_STYLES = {\n\twidth: '100%',\n\theight: '100%',\n};\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\nfunction ResizableEditor( { enableResizing, settings, ...props } ) {\n\tconst deviceType = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editSiteStore ).__experimentalGetPreviewDeviceType(),\n\t\t[]\n\t);\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst [ width, setWidth ] = useState( DEFAULT_STYLES.width );\n\tconst [ height, setHeight ] = useState( DEFAULT_STYLES.height );\n\tconst iframeRef = useRef();\n\tconst mouseMoveTypingResetRef = useMouseMoveTypingReset();\n\tconst ref = useMergeRefs( [ iframeRef, mouseMoveTypingResetRef ] );\n\n\tuseEffect(\n\t\tfunction autoResizeIframeHeight() {\n\t\t\tconst iframe = iframeRef.current;\n\n\t\t\tif ( ! iframe || ! enableResizing ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst resizeObserver = new iframe.contentWindow.ResizeObserver(\n\t\t\t\t() => {\n\t\t\t\t\tsetHeight(\n\t\t\t\t\t\tiframe.contentDocument.querySelector(\n\t\t\t\t\t\t\t`.edit-site-block-editor__block-list`\n\t\t\t\t\t\t).offsetHeight\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// Observing the <html> rather than the <body> because the latter\n\t\t\t// gets destroyed and remounted after initialization in <Iframe>.\n\t\t\tresizeObserver.observe( iframe.contentDocument.documentElement );\n\n\t\t\treturn () => {\n\t\t\t\tresizeObserver.disconnect();\n\t\t\t};\n\t\t},\n\t\t[ enableResizing ]\n\t);\n\n\tconst resizeWidthBy = useCallback( ( deltaPixels ) => {\n\t\tif ( iframeRef.current ) {\n\t\t\tsetWidth( iframeRef.current.offsetWidth + deltaPixels );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tsize={ {\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t} }\n\t\t\tonResizeStop={ ( event, direction, element ) => {\n\t\t\t\tsetWidth( element.style.width );\n\t\t\t} }\n\t\t\tminWidth={ 300 }\n\t\t\tmaxWidth=\"100%\"\n\t\t\tmaxHeight=\"100%\"\n\t\t\tenable={ {\n\t\t\t\tright: enableResizing,\n\t\t\t\tleft: enableResizing,\n\t\t\t} }\n\t\t\tshowHandle={ enableResizing }\n\t\t\t// The editor is centered horizontally, resizing it only\n\t\t\t// moves half the distance. Hence double the ratio to correctly\n\t\t\t// align the cursor to the resizer handle.\n\t\t\tresizeRatio={ 2 }\n\t\t\thandleComponent={ {\n\t\t\t\tleft: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"left\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t\tright: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"right\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t} }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t>\n\t\t\t<Iframe\n\t\t\t\tstyle={ enableResizing ? undefined : deviceStyles }\n\t\t\t\thead={\n\t\t\t\t\t<>\n\t\t\t\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t\t\t\t<style>{\n\t\t\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t\t\t\t`.edit-site-block-editor__block-list { display: flow-root; }`\n\t\t\t\t\t\t}</style>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tref={ ref }\n\t\t\t\tname=\"editor-canvas\"\n\t\t\t\tclassName=\"edit-site-visual-editor__editor-canvas\"\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableEditor;\n"]}
@@ -8,10 +8,12 @@ import { LEFT, RIGHT } from '@wordpress/keycodes';
8
8
  import { VisuallyHidden } from '@wordpress/components';
9
9
  const DELTA_DISTANCE = 20; // The distance to resize per keydown in pixels.
10
10
 
11
- export default function ResizeHandle({
12
- direction,
13
- resizeWidthBy
14
- }) {
11
+ export default function ResizeHandle(_ref) {
12
+ let {
13
+ direction,
14
+ resizeWidthBy
15
+ } = _ref;
16
+
15
17
  function handleKeyDown(event) {
16
18
  const {
17
19
  keyCode
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/resize-handle.js"],"names":["__","LEFT","RIGHT","VisuallyHidden","DELTA_DISTANCE","ResizeHandle","direction","resizeWidthBy","handleKeyDown","event","keyCode"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,IAAT,EAAeC,KAAf,QAA4B,qBAA5B;AACA,SAASC,cAAT,QAA+B,uBAA/B;AAEA,MAAMC,cAAc,GAAG,EAAvB,C,CAA2B;;AAE3B,eAAe,SAASC,YAAT,CAAuB;AAAEC,EAAAA,SAAF;AAAaC,EAAAA;AAAb,CAAvB,EAAsD;AACpE,WAASC,aAAT,CAAwBC,KAAxB,EAAgC;AAC/B,UAAM;AAAEC,MAAAA;AAAF,QAAcD,KAApB;;AAEA,QACGH,SAAS,KAAK,MAAd,IAAwBI,OAAO,KAAKT,IAAtC,IACEK,SAAS,KAAK,OAAd,IAAyBI,OAAO,KAAKR,KAFxC,EAGE;AACDK,MAAAA,aAAa,CAAEH,cAAF,CAAb;AACA,KALD,MAKO,IACJE,SAAS,KAAK,MAAd,IAAwBI,OAAO,KAAKR,KAAtC,IACEI,SAAS,KAAK,OAAd,IAAyBI,OAAO,KAAKT,IAFjC,EAGL;AACDM,MAAAA,aAAa,CAAE,CAACH,cAAH,CAAb;AACA;AACD;;AAED,SACC,8BACC;AACC,IAAA,SAAS,EAAI,oCAAoCE,SAAW,EAD7D;AAEC,kBAAaN,EAAE,CAAE,gBAAF,CAFhB;AAGC,wBAAoB,iCAAiCM,SAAW,EAHjE;AAIC,IAAA,SAAS,EAAGE;AAJb,IADD,EAOC,cAAC,cAAD;AACC,IAAA,EAAE,EAAI,iCAAiCF,SAAW;AADnD,KAGGN,EAAE,CAAE,qDAAF,CAHL,CAPD,CADD;AAeA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { LEFT, RIGHT } from '@wordpress/keycodes';\nimport { VisuallyHidden } from '@wordpress/components';\n\nconst DELTA_DISTANCE = 20; // The distance to resize per keydown in pixels.\n\nexport default function ResizeHandle( { direction, resizeWidthBy } ) {\n\tfunction handleKeyDown( event ) {\n\t\tconst { keyCode } = event;\n\n\t\tif (\n\t\t\t( direction === 'left' && keyCode === LEFT ) ||\n\t\t\t( direction === 'right' && keyCode === RIGHT )\n\t\t) {\n\t\t\tresizeWidthBy( DELTA_DISTANCE );\n\t\t} else if (\n\t\t\t( direction === 'left' && keyCode === RIGHT ) ||\n\t\t\t( direction === 'right' && keyCode === LEFT )\n\t\t) {\n\t\t\tresizeWidthBy( -DELTA_DISTANCE );\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<button\n\t\t\t\tclassName={ `resizable-editor__drag-handle is-${ direction }` }\n\t\t\t\taria-label={ __( 'Drag to resize' ) }\n\t\t\t\taria-describedby={ `resizable-editor__resize-help-${ direction }` }\n\t\t\t\tonKeyDown={ handleKeyDown }\n\t\t\t/>\n\t\t\t<VisuallyHidden\n\t\t\t\tid={ `resizable-editor__resize-help-${ direction }` }\n\t\t\t>\n\t\t\t\t{ __( 'Use left and right arrow keys to resize the canvas.' ) }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/resize-handle.js"],"names":["__","LEFT","RIGHT","VisuallyHidden","DELTA_DISTANCE","ResizeHandle","direction","resizeWidthBy","handleKeyDown","event","keyCode"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,IAAT,EAAeC,KAAf,QAA4B,qBAA5B;AACA,SAASC,cAAT,QAA+B,uBAA/B;AAEA,MAAMC,cAAc,GAAG,EAAvB,C,CAA2B;;AAE3B,eAAe,SAASC,YAAT,OAAsD;AAAA,MAA/B;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,GAA+B;;AACpE,WAASC,aAAT,CAAwBC,KAAxB,EAAgC;AAC/B,UAAM;AAAEC,MAAAA;AAAF,QAAcD,KAApB;;AAEA,QACGH,SAAS,KAAK,MAAd,IAAwBI,OAAO,KAAKT,IAAtC,IACEK,SAAS,KAAK,OAAd,IAAyBI,OAAO,KAAKR,KAFxC,EAGE;AACDK,MAAAA,aAAa,CAAEH,cAAF,CAAb;AACA,KALD,MAKO,IACJE,SAAS,KAAK,MAAd,IAAwBI,OAAO,KAAKR,KAAtC,IACEI,SAAS,KAAK,OAAd,IAAyBI,OAAO,KAAKT,IAFjC,EAGL;AACDM,MAAAA,aAAa,CAAE,CAACH,cAAH,CAAb;AACA;AACD;;AAED,SACC,8BACC;AACC,IAAA,SAAS,EAAI,oCAAoCE,SAAW,EAD7D;AAEC,kBAAaN,EAAE,CAAE,gBAAF,CAFhB;AAGC,wBAAoB,iCAAiCM,SAAW,EAHjE;AAIC,IAAA,SAAS,EAAGE;AAJb,IADD,EAOC,cAAC,cAAD;AACC,IAAA,EAAE,EAAI,iCAAiCF,SAAW;AADnD,KAGGN,EAAE,CAAE,qDAAF,CAHL,CAPD,CADD;AAeA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { LEFT, RIGHT } from '@wordpress/keycodes';\nimport { VisuallyHidden } from '@wordpress/components';\n\nconst DELTA_DISTANCE = 20; // The distance to resize per keydown in pixels.\n\nexport default function ResizeHandle( { direction, resizeWidthBy } ) {\n\tfunction handleKeyDown( event ) {\n\t\tconst { keyCode } = event;\n\n\t\tif (\n\t\t\t( direction === 'left' && keyCode === LEFT ) ||\n\t\t\t( direction === 'right' && keyCode === RIGHT )\n\t\t) {\n\t\t\tresizeWidthBy( DELTA_DISTANCE );\n\t\t} else if (\n\t\t\t( direction === 'left' && keyCode === RIGHT ) ||\n\t\t\t( direction === 'right' && keyCode === LEFT )\n\t\t) {\n\t\t\tresizeWidthBy( -DELTA_DISTANCE );\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<button\n\t\t\t\tclassName={ `resizable-editor__drag-handle is-${ direction }` }\n\t\t\t\taria-label={ __( 'Drag to resize' ) }\n\t\t\t\taria-describedby={ `resizable-editor__resize-help-${ direction }` }\n\t\t\t\tonKeyDown={ handleKeyDown }\n\t\t\t/>\n\t\t\t<VisuallyHidden\n\t\t\t\tid={ `resizable-editor__resize-help-${ direction }` }\n\t\t\t>\n\t\t\t\t{ __( 'Use left and right arrow keys to resize the canvas.' ) }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n}\n"]}
@@ -0,0 +1,102 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { useSelect } from '@wordpress/data';
7
+ import { Icon, BaseControl, TextControl, Flex, FlexItem, FlexBlock, Button, Modal, __experimentalRadioGroup as RadioGroup, __experimentalRadio as Radio } from '@wordpress/components';
8
+ import { __ } from '@wordpress/i18n';
9
+ import { useState } from '@wordpress/element';
10
+ import { useInstanceId } from '@wordpress/compose';
11
+ import { store as editorStore } from '@wordpress/editor';
12
+ import { check } from '@wordpress/icons';
13
+ /**
14
+ * Internal dependencies
15
+ */
16
+
17
+ import { TEMPLATE_PART_AREA_GENERAL } from '../../store/constants';
18
+ export default function CreateTemplatePartModal(_ref) {
19
+ let {
20
+ closeModal,
21
+ onCreate
22
+ } = _ref;
23
+ const [title, setTitle] = useState('');
24
+ const [area, setArea] = useState(TEMPLATE_PART_AREA_GENERAL);
25
+ const [isSubmitting, setIsSubmitting] = useState(false);
26
+ const instanceId = useInstanceId(CreateTemplatePartModal);
27
+ const templatePartAreas = useSelect(select => select(editorStore).__experimentalGetDefaultTemplatePartAreas(), []);
28
+ return createElement(Modal, {
29
+ title: __('Create a template part'),
30
+ closeLabel: __('Close'),
31
+ onRequestClose: closeModal,
32
+ overlayClassName: "edit-site-create-template-part-modal"
33
+ }, createElement("form", {
34
+ onSubmit: async event => {
35
+ event.preventDefault();
36
+
37
+ if (!title) {
38
+ return;
39
+ }
40
+
41
+ setIsSubmitting(true);
42
+ await onCreate({
43
+ title,
44
+ area
45
+ });
46
+ setIsSubmitting(false);
47
+ closeModal();
48
+ }
49
+ }, createElement(TextControl, {
50
+ label: __('Name'),
51
+ value: title,
52
+ onChange: setTitle,
53
+ required: true
54
+ }), createElement(BaseControl, {
55
+ label: __('Area'),
56
+ id: `edit-site-create-template-part-modal__area-selection-${instanceId}`,
57
+ className: "edit-site-create-template-part-modal__area-base-control"
58
+ }, createElement(RadioGroup, {
59
+ label: __('Area'),
60
+ className: "edit-site-create-template-part-modal__area-radio-group",
61
+ id: `edit-site-create-template-part-modal__area-selection-${instanceId}`,
62
+ onChange: setArea,
63
+ checked: area
64
+ }, templatePartAreas.map(_ref2 => {
65
+ let {
66
+ icon,
67
+ label,
68
+ area: value,
69
+ description
70
+ } = _ref2;
71
+ return createElement(Radio, {
72
+ key: label,
73
+ value: value,
74
+ className: "edit-site-create-template-part-modal__area-radio"
75
+ }, createElement(Flex, {
76
+ align: "start",
77
+ justify: "start"
78
+ }, createElement(FlexItem, null, createElement(Icon, {
79
+ icon: icon
80
+ })), createElement(FlexBlock, {
81
+ className: "edit-site-create-template-part-modal__option-label"
82
+ }, label, createElement("div", null, description)), createElement(FlexItem, {
83
+ className: "edit-site-create-template-part-modal__checkbox"
84
+ }, area === value && createElement(Icon, {
85
+ icon: check
86
+ }))));
87
+ }))), createElement(Flex, {
88
+ className: "edit-site-create-template-part-modal__modal-actions",
89
+ justify: "flex-end"
90
+ }, createElement(FlexItem, null, createElement(Button, {
91
+ variant: "secondary",
92
+ onClick: () => {
93
+ closeModal();
94
+ }
95
+ }, __('Cancel'))), createElement(FlexItem, null, createElement(Button, {
96
+ variant: "primary",
97
+ type: "submit",
98
+ disabled: !title,
99
+ isBusy: isSubmitting
100
+ }, __('Create'))))));
101
+ }
102
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/create-template-part-modal/index.js"],"names":["useSelect","Icon","BaseControl","TextControl","Flex","FlexItem","FlexBlock","Button","Modal","__experimentalRadioGroup","RadioGroup","__experimentalRadio","Radio","__","useState","useInstanceId","store","editorStore","check","TEMPLATE_PART_AREA_GENERAL","CreateTemplatePartModal","closeModal","onCreate","title","setTitle","area","setArea","isSubmitting","setIsSubmitting","instanceId","templatePartAreas","select","__experimentalGetDefaultTemplatePartAreas","event","preventDefault","map","icon","label","value","description"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SACCC,IADD,EAECC,WAFD,EAGCC,WAHD,EAICC,IAJD,EAKCC,QALD,EAMCC,SAND,EAOCC,MAPD,EAQCC,KARD,EASCC,wBAAwB,IAAIC,UAT7B,EAUCC,mBAAmB,IAAIC,KAVxB,QAWO,uBAXP;AAYA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,KAAT,QAAsB,kBAAtB;AAEA;AACA;AACA;;AACA,SAASC,0BAAT,QAA2C,uBAA3C;AAEA,eAAe,SAASC,uBAAT,OAA6D;AAAA,MAA3B;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,GAA2B;AAC3E,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsBV,QAAQ,CAAE,EAAF,CAApC;AACA,QAAM,CAAEW,IAAF,EAAQC,OAAR,IAAoBZ,QAAQ,CAAEK,0BAAF,CAAlC;AACA,QAAM,CAAEQ,YAAF,EAAgBC,eAAhB,IAAoCd,QAAQ,CAAE,KAAF,CAAlD;AACA,QAAMe,UAAU,GAAGd,aAAa,CAAEK,uBAAF,CAAhC;AAEA,QAAMU,iBAAiB,GAAG9B,SAAS,CAChC+B,MAAF,IACCA,MAAM,CAAEd,WAAF,CAAN,CAAsBe,yCAAtB,EAFiC,EAGlC,EAHkC,CAAnC;AAMA,SACC,cAAC,KAAD;AACC,IAAA,KAAK,EAAGnB,EAAE,CAAE,wBAAF,CADX;AAEC,IAAA,UAAU,EAAGA,EAAE,CAAE,OAAF,CAFhB;AAGC,IAAA,cAAc,EAAGQ,UAHlB;AAIC,IAAA,gBAAgB,EAAC;AAJlB,KAMC;AACC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,EAIC,cAAC,SAAD;AAAW,MAAA,SAAS,EAAC;AAArB,OACGC,KADH,EAEC,2BAAOE,WAAP,CAFD,CAJD,EASC,cAAC,QAAD;AAAU,MAAA,SAAS,EAAC;AAApB,OACGd,IAAI,KAAKa,KAAT,IACD,cAAC,IAAD;AAAM,MAAA,IAAI,EAAGpB;AAAb,MAFF,CATD,CALD,CADD;AAAA,GADC,CAPH,CALD,CAlBD,EAyDC,cAAC,IAAD;AACC,IAAA,SAAS,EAAC,qDADX;AAEC,IAAA,OAAO,EAAC;AAFT,KAIC,cAAC,QAAD,QACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,WADT;AAEC,IAAA,OAAO,EAAG,MAAM;AACfG,MAAAA,UAAU;AACV;AAJF,KAMGR,EAAE,CAAE,QAAF,CANL,CADD,CAJD,EAcC,cAAC,QAAD,QACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,IAAA,QAAQ,EAAG,CAAEU,KAHd;AAIC,IAAA,MAAM,EAAGI;AAJV,KAMGd,EAAE,CAAE,QAAF,CANL,CADD,CAdD,CAzDD,CAND,CADD;AA4FA","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} 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\tcloseLabel={ __( 'Close' ) }\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\tsetIsSubmitting( false );\n\t\t\t\t\tcloseModal();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<TextControl\n\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\trequired\n\t\t\t\t/>\n\t\t\t\t<BaseControl\n\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\tid={ `edit-site-create-template-part-modal__area-selection-${ instanceId }` }\n\t\t\t\t\tclassName=\"edit-site-create-template-part-modal__area-base-control\"\n\t\t\t\t>\n\t\t\t\t\t<RadioGroup\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tclassName=\"edit-site-create-template-part-modal__area-radio-group\"\n\t\t\t\t\t\tid={ `edit-site-create-template-part-modal__area-selection-${ instanceId }` }\n\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t\tchecked={ area }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ templatePartAreas.map(\n\t\t\t\t\t\t\t( { icon, label, area: value, description } ) => (\n\t\t\t\t\t\t\t\t<Radio\n\t\t\t\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\t\t\t\tvalue={ value }\n\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>\n\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<FlexItem>\n\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</FlexItem>\n\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{ label }\n\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</FlexBlock>\n\n\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{ area === value && (\n\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) }\n\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t</Flex>\n\t\t\t\t\t\t\t\t</Radio>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) }\n\t\t\t\t\t</RadioGroup>\n\t\t\t\t</BaseControl>\n\t\t\t\t<Flex\n\t\t\t\t\tclassName=\"edit-site-create-template-part-modal__modal-actions\"\n\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"secondary\"\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</FlexItem>\n\t\t\t\t\t<FlexItem>\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</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"]}
@@ -15,19 +15,23 @@ import { __, sprintf } from '@wordpress/i18n';
15
15
 
16
16
  import { store as editSiteStore } from '../../store';
17
17
  export default function EditTemplatePartMenuButton() {
18
- return createElement(BlockSettingsMenuControls, null, ({
19
- selectedClientIds,
20
- onClose
21
- }) => createElement(EditTemplatePartMenuItem, {
22
- selectedClientId: selectedClientIds[0],
23
- onClose: onClose
24
- }));
18
+ return createElement(BlockSettingsMenuControls, null, _ref => {
19
+ let {
20
+ selectedClientIds,
21
+ onClose
22
+ } = _ref;
23
+ return createElement(EditTemplatePartMenuItem, {
24
+ selectedClientId: selectedClientIds[0],
25
+ onClose: onClose
26
+ });
27
+ });
25
28
  }
26
29
 
27
- function EditTemplatePartMenuItem({
28
- selectedClientId,
29
- onClose
30
- }) {
30
+ function EditTemplatePartMenuItem(_ref2) {
31
+ let {
32
+ selectedClientId,
33
+ onClose
34
+ } = _ref2;
31
35
  const selectedTemplatePart = useSelect(select => {
32
36
  const block = select(blockEditorStore).getBlock(selectedClientId);
33
37
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/edit-template-part-menu-button/index.js"],"names":["useSelect","useDispatch","store","blockEditorStore","BlockSettingsMenuControls","coreStore","MenuItem","isTemplatePart","__","sprintf","editSiteStore","EditTemplatePartMenuButton","selectedClientIds","onClose","EditTemplatePartMenuItem","selectedClientId","selectedTemplatePart","select","block","getBlock","theme","slug","attributes","getEntityRecord","pushTemplatePart","id"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,E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SACC,cAAC,QAAD;AACC,IAAA,OAAO,EAAG,MAAM;AACfQ,MAAAA,gBAAgB,CAAER,oBAAoB,CAACS,EAAvB,CAAhB;AACAZ,MAAAA,OAAO;AACP;AAJF;AAOE;AACAJ,EAAAA,OAAO,CAAED,EAAE,CAAE,SAAF,CAAJ,EAAmBQ,oBAAoB,CAACK,IAAxC,CART,CADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tstore as blockEditorStore,\n\tBlockSettingsMenuControls,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { MenuItem } from '@wordpress/components';\nimport { isTemplatePart } from '@wordpress/blocks';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function EditTemplatePartMenuButton() {\n\treturn (\n\t\t<BlockSettingsMenuControls>\n\t\t\t{ ( { selectedClientIds, onClose } ) => (\n\t\t\t\t<EditTemplatePartMenuItem\n\t\t\t\t\tselectedClientId={ selectedClientIds[ 0 ] }\n\t\t\t\t\tonClose={ onClose }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</BlockSettingsMenuControls>\n\t);\n}\n\nfunction EditTemplatePartMenuItem( { selectedClientId, onClose } ) {\n\tconst selectedTemplatePart = useSelect(\n\t\t( select ) => {\n\t\t\tconst block = select( blockEditorStore ).getBlock(\n\t\t\t\tselectedClientId\n\t\t\t);\n\n\t\t\tif ( block && isTemplatePart( block ) ) {\n\t\t\t\tconst { theme, slug } = block.attributes;\n\n\t\t\t\treturn select( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template_part',\n\t\t\t\t\t// Ideally this should be an official public API.\n\t\t\t\t\t`${ theme }//${ slug }`\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ selectedClientId ]\n\t);\n\n\tconst { pushTemplatePart } = useDispatch( editSiteStore );\n\n\tif ( ! selectedTemplatePart ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\tpushTemplatePart( selectedTemplatePart.id );\n\t\t\t\tonClose();\n\t\t\t} }\n\t\t>\n\t\t\t{\n\t\t\t\t/* translators: %s: template part title */\n\t\t\t\tsprintf( __( 'Edit %s' ), selectedTemplatePart.slug )\n\t\t\t}\n\t\t</MenuItem>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/edit-template-part-menu-button/index.js"],"names":["useSelect","useDispatch","store","blockEditorStore","BlockSettingsMenuControls","coreStore","MenuItem","isTemplatePart","__","sprintf","editSiteStore","EditTemplatePartMenuButton","selectedClientIds","onClose","EditTemplatePartMenuItem","selectedClientId","selectedTemplatePart","select","block","getBlock","theme","slug","attributes","getEntityRecord","pushTemplatePart","id"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,KAAK,IAAIC,gBADV,EAECC,yBAFD,QAGO,yBAHP;AAIA,SAASF,KAAK,IAAIG,SAAlB,QAAmC,sBAAnC;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,cAAT,QAA+B,mBAA/B;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AAEA;AACA;AACA;;AACA,SAASP,KAAK,IAAIQ,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,0BAAT,GAAsC;AACpD,SACC,cAAC,yBAAD,QACG;AAAA,QAAE;AAAEC,MAAAA,iBAAF;AAAqBC,MAAAA;AAArB,KAAF;AAAA,WACD,cAAC,wBAAD;AACC,MAAA,gBAAgB,EAAGD,iBAAiB,CAAE,CAAF,CADrC;AAEC,MAAA,OAAO,EAAGC;AAFX,MADC;AAAA,GADH,CADD;AAUA;;AAED,SAASC,wBAAT,QAAmE;AAAA,MAAhC;AAAEC,IAAAA,gBAAF;AAAoBF,IAAAA;AAApB,GAAgC;AAClE,QAAMG,oBAAoB,GAAGhB,SAAS,CACnCiB,MAAF,IAAc;AACb,UAAMC,KAAK,GAAGD,MAAM,CAAEd,gBAAF,CAAN,CAA2BgB,QAA3B,CACbJ,gBADa,CAAd;;AAIA,QAAKG,KAAK,IAAIX,cAAc,CAAEW,KAAF,CAA5B,EAAwC;AACvC,YAAM;AAAEE,QAAAA,KAAF;AAASC,QAAAA;AAAT,UAAkBH,KAAK,CAACI,UAA9B;AAEA,aAAOL,MAAM,CAAEZ,SAAF,CAAN,CAAoBkB,eAApB,CACN,UADM,EAEN,kBAFM,EAGN;AACC,SAAGH,KAAO,KAAKC,IAAM,EAJhB,CAAP;AAMA;AACD,GAhBoC,EAiBrC,CAAEN,gBAAF,CAjBqC,CAAtC;AAoBA,QAAM;AAAES,IAAAA;AAAF,MAAuBvB,WAAW,CAAES,aAAF,CAAxC;;AAEA,MAAK,CAAEM,oBAAP,EAA8B;AAC7B,WAAO,IAAP;AACA;;AAED,SACC,cAAC,QAAD;AACC,IAAA,OAAO,EAAG,MAAM;AACfQ,MAAAA,gBAAgB,CAAER,oBAAoB,CAACS,EAAvB,CAAhB;AACAZ,MAAAA,OAAO;AACP;AAJF;AAOE;AACAJ,EAAAA,OAAO,CAAED,EAAE,CAAE,SAAF,CAAJ,EAAmBQ,oBAAoB,CAACK,IAAxC,CART,CADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tstore as blockEditorStore,\n\tBlockSettingsMenuControls,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { MenuItem } from '@wordpress/components';\nimport { isTemplatePart } from '@wordpress/blocks';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function EditTemplatePartMenuButton() {\n\treturn (\n\t\t<BlockSettingsMenuControls>\n\t\t\t{ ( { selectedClientIds, onClose } ) => (\n\t\t\t\t<EditTemplatePartMenuItem\n\t\t\t\t\tselectedClientId={ selectedClientIds[ 0 ] }\n\t\t\t\t\tonClose={ onClose }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</BlockSettingsMenuControls>\n\t);\n}\n\nfunction EditTemplatePartMenuItem( { selectedClientId, onClose } ) {\n\tconst selectedTemplatePart = useSelect(\n\t\t( select ) => {\n\t\t\tconst block = select( blockEditorStore ).getBlock(\n\t\t\t\tselectedClientId\n\t\t\t);\n\n\t\t\tif ( block && isTemplatePart( block ) ) {\n\t\t\t\tconst { theme, slug } = block.attributes;\n\n\t\t\t\treturn select( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template_part',\n\t\t\t\t\t// Ideally this should be an official public API.\n\t\t\t\t\t`${ theme }//${ slug }`\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ selectedClientId ]\n\t);\n\n\tconst { pushTemplatePart } = useDispatch( editSiteStore );\n\n\tif ( ! selectedTemplatePart ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\tpushTemplatePart( selectedTemplatePart.id );\n\t\t\t\tonClose();\n\t\t\t} }\n\t\t>\n\t\t\t{\n\t\t\t\t/* translators: %s: template part title */\n\t\t\t\tsprintf( __( 'Edit %s' ), selectedTemplatePart.slug )\n\t\t\t}\n\t\t</MenuItem>\n\t);\n}\n"]}
@@ -19,23 +19,27 @@ import { ShortcutProvider } from '@wordpress/keyboard-shortcuts';
19
19
 
20
20
  import Header from '../header';
21
21
  import { SidebarComplementaryAreaFills } from '../sidebar';
22
+ import NavigationSidebar from '../navigation-sidebar';
22
23
  import BlockEditor from '../block-editor';
23
24
  import KeyboardShortcuts from '../keyboard-shortcuts';
24
25
  import URLQueryController from '../url-query-controller';
25
26
  import InserterSidebar from '../secondary-sidebar/inserter-sidebar';
26
27
  import ListViewSidebar from '../secondary-sidebar/list-view-sidebar';
27
28
  import ErrorBoundary from '../error-boundary';
29
+ import WelcomeGuide from '../welcome-guide';
28
30
  import { store as editSiteStore } from '../../store';
29
31
  import { GlobalStylesRenderer } from './global-styles-renderer';
30
32
  import { GlobalStylesProvider } from '../global-styles/global-styles-provider';
31
33
  const interfaceLabels = {
32
- secondarySidebar: __('Block Library')
34
+ secondarySidebar: __('Block Library'),
35
+ drawer: __('Navigation Sidebar')
33
36
  };
34
37
 
35
- function Editor({
36
- initialSettings,
37
- onError
38
- }) {
38
+ function Editor(_ref) {
39
+ let {
40
+ initialSettings,
41
+ onError
42
+ } = _ref;
39
43
  const {
40
44
  isInserterOpen,
41
45
  isListViewOpen,
@@ -85,9 +89,6 @@ function Editor({
85
89
  setIsInserterOpened,
86
90
  updateSettings
87
91
  } = useDispatch(editSiteStore);
88
- const {
89
- enableComplementaryArea
90
- } = useDispatch(interfaceStore);
91
92
  useEffect(() => {
92
93
  updateSettings(initialSettings);
93
94
  }, []); // Keep the defaultTemplateTypes in the core/editor settings too,
@@ -127,14 +128,7 @@ function Editor({
127
128
  } else {
128
129
  document.body.classList.remove('is-navigation-sidebar-open');
129
130
  }
130
- }, [isNavigationOpen]);
131
- useEffect(function openGlobalStylesOnLoad() {
132
- const searchParams = new URLSearchParams(window.location.search);
133
-
134
- if (searchParams.get('styles') === 'open') {
135
- enableComplementaryArea('core/edit-site', 'edit-site/global-styles');
136
- }
137
- }, [enableComplementaryArea]); // Don't render the Editor until the settings are set and loaded
131
+ }, [isNavigationOpen]); // Don't render the Editor until the settings are set and loaded
138
132
 
139
133
  const isReady = (settings === null || settings === void 0 ? void 0 : settings.siteUrl) && templateType !== undefined && entityId !== undefined;
140
134
 
@@ -169,6 +163,9 @@ function Editor({
169
163
  sidebar: sidebarIsOpened && createElement(ComplementaryArea.Slot, {
170
164
  scope: "core/edit-site"
171
165
  }),
166
+ drawer: createElement(NavigationSidebar, {
167
+ defaultIsOpen: false
168
+ }),
172
169
  header: createElement(Header, {
173
170
  openEntitiesSavedStates: openEntitiesSavedStates
174
171
  }),
@@ -192,7 +189,7 @@ function Editor({
192
189
  "aria-expanded": false
193
190
  }, __('Open save panel')))),
194
191
  footer: createElement(BlockBreadcrumb, null)
195
- }), createElement(Popover.Slot, null), createElement(PluginArea, null)))))))));
192
+ }), createElement(WelcomeGuide, null), createElement(Popover.Slot, null), createElement(PluginArea, null)))))))));
196
193
  }
197
194
 
198
195
  export default Editor;