@wordpress/edit-site 4.18.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (352) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/build/components/add-new-template/add-custom-template-modal.js +4 -1
  3. package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
  4. package/build/components/add-new-template/index.js +8 -5
  5. package/build/components/add-new-template/index.js.map +1 -1
  6. package/build/components/add-new-template/new-template-part.js +21 -6
  7. package/build/components/add-new-template/new-template-part.js.map +1 -1
  8. package/build/components/add-new-template/new-template.js +12 -8
  9. package/build/components/add-new-template/new-template.js.map +1 -1
  10. package/build/components/app/index.js +15 -30
  11. package/build/components/app/index.js.map +1 -1
  12. package/build/components/block-editor/editor-canvas.js +64 -0
  13. package/build/components/block-editor/editor-canvas.js.map +1 -0
  14. package/build/components/block-editor/index.js +61 -59
  15. package/build/components/block-editor/index.js.map +1 -1
  16. package/build/components/block-editor/resizable-editor.js +13 -85
  17. package/build/components/block-editor/resizable-editor.js.map +1 -1
  18. package/build/components/editor/index.js +80 -127
  19. package/build/components/editor/index.js.map +1 -1
  20. package/build/components/global-styles/block-preview-panel.js +42 -0
  21. package/build/components/global-styles/block-preview-panel.js.map +1 -0
  22. package/build/components/global-styles/context-menu.js +6 -2
  23. package/build/components/global-styles/context-menu.js.map +1 -1
  24. package/build/components/global-styles/custom-css.js +61 -0
  25. package/build/components/global-styles/custom-css.js.map +1 -0
  26. package/build/components/global-styles/dimensions-panel.js +42 -2
  27. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  28. package/build/components/global-styles/global-styles-provider.js +15 -2
  29. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  30. package/build/components/global-styles/hooks.js +37 -2
  31. package/build/components/global-styles/hooks.js.map +1 -1
  32. package/build/components/global-styles/palette.js +9 -2
  33. package/build/components/global-styles/palette.js.map +1 -1
  34. package/build/components/global-styles/screen-block-list.js +2 -1
  35. package/build/components/global-styles/screen-block-list.js.map +1 -1
  36. package/build/components/global-styles/screen-block.js +10 -2
  37. package/build/components/global-styles/screen-block.js.map +1 -1
  38. package/build/components/global-styles/screen-border.js +43 -0
  39. package/build/components/global-styles/screen-border.js.map +1 -0
  40. package/build/components/global-styles/screen-colors.js +1 -1
  41. package/build/components/global-styles/screen-colors.js.map +1 -1
  42. package/build/components/global-styles/screen-css.js +42 -0
  43. package/build/components/global-styles/screen-css.js.map +1 -0
  44. package/build/components/global-styles/screen-layout.js +0 -5
  45. package/build/components/global-styles/screen-layout.js.map +1 -1
  46. package/build/components/global-styles/screen-root.js +14 -1
  47. package/build/components/global-styles/screen-root.js.map +1 -1
  48. package/build/components/global-styles/screen-style-variations.js +3 -3
  49. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  50. package/build/components/global-styles/typography-panel.js +52 -16
  51. package/build/components/global-styles/typography-panel.js.map +1 -1
  52. package/build/components/global-styles/ui.js +50 -4
  53. package/build/components/global-styles/ui.js.map +1 -1
  54. package/build/components/global-styles/use-global-styles-output.js +47 -8
  55. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  56. package/build/components/global-styles/utils.js +3 -3
  57. package/build/components/global-styles/utils.js.map +1 -1
  58. package/build/components/{editor/global-styles-renderer.js → global-styles-renderer/index.js} +4 -8
  59. package/build/components/global-styles-renderer/index.js.map +1 -0
  60. package/build/components/header-edit-mode/document-actions/index.js +14 -5
  61. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  62. package/build/components/header-edit-mode/index.js +31 -17
  63. package/build/components/header-edit-mode/index.js.map +1 -1
  64. package/build/components/keyboard-shortcuts/index.js +14 -1
  65. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  66. package/build/components/layout/index.js +231 -0
  67. package/build/components/layout/index.js.map +1 -0
  68. package/build/components/list/header.js +5 -1
  69. package/build/components/list/header.js.map +1 -1
  70. package/build/components/list/index.js +4 -22
  71. package/build/components/list/index.js.map +1 -1
  72. package/build/components/list/table.js +1 -1
  73. package/build/components/list/table.js.map +1 -1
  74. package/build/components/list/use-register-shortcuts.js +3 -0
  75. package/build/components/list/use-register-shortcuts.js.map +1 -1
  76. package/build/components/navigate-to-link/index.js +1 -3
  77. package/build/components/navigate-to-link/index.js.map +1 -1
  78. package/build/components/routes/index.js +1 -1
  79. package/build/components/routes/index.js.map +1 -1
  80. package/build/components/save-button/index.js +20 -2
  81. package/build/components/save-button/index.js.map +1 -1
  82. package/build/components/sidebar/index.js +42 -0
  83. package/build/components/sidebar/index.js.map +1 -0
  84. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +24 -4
  85. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  86. package/build/components/sidebar-edit-mode/index.js +1 -1
  87. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  88. package/build/components/sidebar-edit-mode/template-card/index.js +4 -2
  89. package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  90. package/build/components/sidebar-navigation-item/index.js +53 -0
  91. package/build/components/sidebar-navigation-item/index.js.map +1 -0
  92. package/build/components/sidebar-navigation-screen/index.js +49 -0
  93. package/build/components/sidebar-navigation-screen/index.js.map +1 -0
  94. package/build/components/sidebar-navigation-screen-main/index.js +76 -0
  95. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -0
  96. package/build/components/sidebar-navigation-screen-templates/index.js +188 -0
  97. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -0
  98. package/build/components/site-icon/index.js +70 -0
  99. package/build/components/site-icon/index.js.map +1 -0
  100. package/build/components/site-title/index.js +55 -0
  101. package/build/components/site-title/index.js.map +1 -0
  102. package/build/components/style-book/index.js +173 -0
  103. package/build/components/style-book/index.js.map +1 -0
  104. package/build/components/{url-query-controller/index.js → sync-state-with-url/use-init-edited-entity-from-url.js} +5 -4
  105. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -0
  106. package/build/components/sync-state-with-url/use-sync-sidebar-path-with-url.js +53 -0
  107. package/build/components/sync-state-with-url/use-sync-sidebar-path-with-url.js.map +1 -0
  108. package/build/components/template-details/index.js +4 -2
  109. package/build/components/template-details/index.js.map +1 -1
  110. package/build/index.js +2 -45
  111. package/build/index.js.map +1 -1
  112. package/build/store/actions.js +93 -43
  113. package/build/store/actions.js.map +1 -1
  114. package/build/store/reducer.js +35 -107
  115. package/build/store/reducer.js.map +1 -1
  116. package/build/store/selectors.js +69 -78
  117. package/build/store/selectors.js.map +1 -1
  118. package/build-module/components/add-new-template/add-custom-template-modal.js +3 -1
  119. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  120. package/build-module/components/add-new-template/index.js +7 -5
  121. package/build-module/components/add-new-template/index.js.map +1 -1
  122. package/build-module/components/add-new-template/new-template-part.js +18 -6
  123. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  124. package/build-module/components/add-new-template/new-template.js +13 -9
  125. package/build-module/components/add-new-template/new-template.js.map +1 -1
  126. package/build-module/components/app/index.js +15 -28
  127. package/build-module/components/app/index.js.map +1 -1
  128. package/build-module/components/block-editor/editor-canvas.js +51 -0
  129. package/build-module/components/block-editor/editor-canvas.js.map +1 -0
  130. package/build-module/components/block-editor/index.js +61 -60
  131. package/build-module/components/block-editor/index.js.map +1 -1
  132. package/build-module/components/block-editor/resizable-editor.js +15 -82
  133. package/build-module/components/block-editor/resizable-editor.js.map +1 -1
  134. package/build-module/components/editor/index.js +81 -124
  135. package/build-module/components/editor/index.js.map +1 -1
  136. package/build-module/components/global-styles/block-preview-panel.js +32 -0
  137. package/build-module/components/global-styles/block-preview-panel.js.map +1 -0
  138. package/build-module/components/global-styles/context-menu.js +7 -3
  139. package/build-module/components/global-styles/context-menu.js.map +1 -1
  140. package/build-module/components/global-styles/custom-css.js +51 -0
  141. package/build-module/components/global-styles/custom-css.js.map +1 -0
  142. package/build-module/components/global-styles/dimensions-panel.js +43 -3
  143. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  144. package/build-module/components/global-styles/global-styles-provider.js +15 -2
  145. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  146. package/build-module/components/global-styles/hooks.js +32 -4
  147. package/build-module/components/global-styles/hooks.js.map +1 -1
  148. package/build-module/components/global-styles/palette.js +10 -4
  149. package/build-module/components/global-styles/palette.js.map +1 -1
  150. package/build-module/components/global-styles/screen-block-list.js +2 -1
  151. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  152. package/build-module/components/global-styles/screen-block.js +8 -2
  153. package/build-module/components/global-styles/screen-block.js.map +1 -1
  154. package/build-module/components/global-styles/screen-border.js +27 -0
  155. package/build-module/components/global-styles/screen-border.js.map +1 -0
  156. package/build-module/components/global-styles/screen-colors.js +1 -1
  157. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  158. package/build-module/components/global-styles/screen-css.js +28 -0
  159. package/build-module/components/global-styles/screen-css.js.map +1 -0
  160. package/build-module/components/global-styles/screen-layout.js +0 -4
  161. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  162. package/build-module/components/global-styles/screen-root.js +14 -1
  163. package/build-module/components/global-styles/screen-root.js.map +1 -1
  164. package/build-module/components/global-styles/screen-style-variations.js +2 -2
  165. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  166. package/build-module/components/global-styles/typography-panel.js +53 -16
  167. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  168. package/build-module/components/global-styles/ui.js +48 -5
  169. package/build-module/components/global-styles/ui.js.map +1 -1
  170. package/build-module/components/global-styles/use-global-styles-output.js +48 -9
  171. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  172. package/build-module/components/global-styles/utils.js +4 -4
  173. package/build-module/components/global-styles/utils.js.map +1 -1
  174. package/build-module/components/{editor/global-styles-renderer.js → global-styles-renderer/index.js} +4 -7
  175. package/build-module/components/global-styles-renderer/index.js.map +1 -0
  176. package/build-module/components/header-edit-mode/document-actions/index.js +14 -6
  177. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  178. package/build-module/components/header-edit-mode/index.js +27 -16
  179. package/build-module/components/header-edit-mode/index.js.map +1 -1
  180. package/build-module/components/keyboard-shortcuts/index.js +13 -1
  181. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  182. package/build-module/components/layout/index.js +203 -0
  183. package/build-module/components/layout/index.js.map +1 -0
  184. package/build-module/components/list/header.js +5 -1
  185. package/build-module/components/list/header.js.map +1 -1
  186. package/build-module/components/list/index.js +4 -19
  187. package/build-module/components/list/index.js.map +1 -1
  188. package/build-module/components/list/table.js +1 -1
  189. package/build-module/components/list/table.js.map +1 -1
  190. package/build-module/components/list/use-register-shortcuts.js +3 -0
  191. package/build-module/components/list/use-register-shortcuts.js.map +1 -1
  192. package/build-module/components/navigate-to-link/index.js +1 -3
  193. package/build-module/components/navigate-to-link/index.js.map +1 -1
  194. package/build-module/components/routes/index.js +1 -1
  195. package/build-module/components/routes/index.js.map +1 -1
  196. package/build-module/components/save-button/index.js +21 -2
  197. package/build-module/components/save-button/index.js.map +1 -1
  198. package/build-module/components/sidebar/index.js +30 -0
  199. package/build-module/components/sidebar/index.js.map +1 -0
  200. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +27 -7
  201. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  202. package/build-module/components/sidebar-edit-mode/index.js +3 -3
  203. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  204. package/build-module/components/sidebar-edit-mode/template-card/index.js +3 -2
  205. package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  206. package/build-module/components/sidebar-navigation-item/index.js +40 -0
  207. package/build-module/components/sidebar-navigation-item/index.js.map +1 -0
  208. package/build-module/components/sidebar-navigation-screen/index.js +39 -0
  209. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -0
  210. package/build-module/components/sidebar-navigation-screen-main/index.js +57 -0
  211. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -0
  212. package/build-module/components/sidebar-navigation-screen-templates/index.js +165 -0
  213. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -0
  214. package/build-module/components/site-icon/index.js +55 -0
  215. package/build-module/components/site-icon/index.js.map +1 -0
  216. package/build-module/components/site-title/index.js +43 -0
  217. package/build-module/components/site-title/index.js.map +1 -0
  218. package/build-module/components/style-book/index.js +156 -0
  219. package/build-module/components/style-book/index.js.map +1 -0
  220. package/build-module/components/{url-query-controller/index.js → sync-state-with-url/use-init-edited-entity-from-url.js} +4 -3
  221. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -0
  222. package/build-module/components/sync-state-with-url/use-sync-sidebar-path-with-url.js +43 -0
  223. package/build-module/components/sync-state-with-url/use-sync-sidebar-path-with-url.js.map +1 -0
  224. package/build-module/components/template-details/index.js +3 -2
  225. package/build-module/components/template-details/index.js.map +1 -1
  226. package/build-module/index.js +5 -36
  227. package/build-module/index.js.map +1 -1
  228. package/build-module/store/actions.js +87 -42
  229. package/build-module/store/actions.js.map +1 -1
  230. package/build-module/store/reducer.js +35 -102
  231. package/build-module/store/reducer.js.map +1 -1
  232. package/build-module/store/selectors.js +60 -72
  233. package/build-module/store/selectors.js.map +1 -1
  234. package/build-style/style-rtl.css +558 -354
  235. package/build-style/style.css +558 -354
  236. package/package.json +33 -31
  237. package/src/components/add-new-template/add-custom-template-modal.js +6 -1
  238. package/src/components/add-new-template/index.js +6 -3
  239. package/src/components/add-new-template/new-template-part.js +15 -3
  240. package/src/components/add-new-template/new-template.js +14 -7
  241. package/src/components/add-new-template/style.scss +0 -4
  242. package/src/components/app/index.js +14 -43
  243. package/src/components/block-editor/editor-canvas.js +69 -0
  244. package/src/components/block-editor/index.js +102 -87
  245. package/src/components/block-editor/resizable-editor.js +12 -112
  246. package/src/components/block-editor/style.scss +25 -1
  247. package/src/components/code-editor/style.scss +1 -1
  248. package/src/components/editor/index.js +170 -236
  249. package/src/components/editor/style.scss +1 -29
  250. package/src/components/global-styles/block-preview-panel.js +29 -0
  251. package/src/components/global-styles/context-menu.js +11 -2
  252. package/src/components/global-styles/custom-css.js +73 -0
  253. package/src/components/global-styles/dimensions-panel.js +56 -1
  254. package/src/components/global-styles/global-styles-provider.js +39 -17
  255. package/src/components/global-styles/hooks.js +44 -3
  256. package/src/components/global-styles/palette.js +16 -2
  257. package/src/components/global-styles/screen-block-list.js +2 -1
  258. package/src/components/global-styles/screen-block.js +9 -1
  259. package/src/components/global-styles/screen-border.js +23 -0
  260. package/src/components/global-styles/screen-colors.js +2 -1
  261. package/src/components/global-styles/screen-css.js +33 -0
  262. package/src/components/global-styles/screen-layout.js +0 -3
  263. package/src/components/global-styles/screen-root.js +30 -1
  264. package/src/components/global-styles/screen-style-variations.js +5 -2
  265. package/src/components/global-styles/style.scss +31 -2
  266. package/src/components/global-styles/test/typography-utils.js +82 -98
  267. package/src/components/global-styles/test/use-global-styles-output.js +6 -6
  268. package/src/components/global-styles/typography-panel.js +57 -15
  269. package/src/components/global-styles/ui.js +47 -4
  270. package/src/components/global-styles/use-global-styles-output.js +52 -10
  271. package/src/components/global-styles/utils.js +8 -5
  272. package/src/components/{editor/global-styles-renderer.js → global-styles-renderer/index.js} +3 -9
  273. package/src/components/header-edit-mode/document-actions/index.js +16 -10
  274. package/src/components/header-edit-mode/document-actions/style.scss +8 -1
  275. package/src/components/header-edit-mode/index.js +104 -82
  276. package/src/components/header-edit-mode/style.scss +5 -33
  277. package/src/components/keyboard-shortcuts/index.js +17 -0
  278. package/src/components/layout/index.js +278 -0
  279. package/src/components/layout/style.scss +176 -0
  280. package/src/components/list/header.js +5 -1
  281. package/src/components/list/index.js +12 -31
  282. package/src/components/list/style.scss +10 -4
  283. package/src/components/list/table.js +1 -1
  284. package/src/components/list/use-register-shortcuts.js +4 -0
  285. package/src/components/navigate-to-link/index.js +2 -8
  286. package/src/components/routes/index.js +1 -1
  287. package/src/components/save-button/index.js +17 -1
  288. package/src/components/sidebar/index.js +34 -0
  289. package/src/components/sidebar/style.scss +8 -0
  290. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +42 -7
  291. package/src/components/sidebar-edit-mode/index.js +3 -3
  292. package/src/components/sidebar-edit-mode/navigation-menu-sidebar/style.scss +21 -3
  293. package/src/components/sidebar-edit-mode/settings-header/style.scss +47 -34
  294. package/src/components/sidebar-edit-mode/style.scss +0 -13
  295. package/src/components/sidebar-edit-mode/template-card/index.js +3 -2
  296. package/src/components/sidebar-navigation-item/index.js +51 -0
  297. package/src/components/sidebar-navigation-item/style.scss +17 -0
  298. package/src/components/sidebar-navigation-screen/index.js +55 -0
  299. package/src/components/sidebar-navigation-screen/style.scss +41 -0
  300. package/src/components/sidebar-navigation-screen-main/index.js +72 -0
  301. package/src/components/sidebar-navigation-screen-templates/index.js +181 -0
  302. package/src/components/sidebar-navigation-screen-templates/style.scss +9 -0
  303. package/src/components/site-icon/index.js +56 -0
  304. package/src/components/site-icon/style.scss +10 -0
  305. package/src/components/site-title/index.js +39 -0
  306. package/src/components/style-book/index.js +193 -0
  307. package/src/components/style-book/style.scss +78 -0
  308. package/src/components/{url-query-controller/index.js → sync-state-with-url/use-init-edited-entity-from-url.js} +3 -3
  309. package/src/components/sync-state-with-url/use-sync-sidebar-path-with-url.js +36 -0
  310. package/src/components/template-details/index.js +3 -2
  311. package/src/components/template-details/style.scss +4 -0
  312. package/src/index.js +3 -53
  313. package/src/store/actions.js +93 -48
  314. package/src/store/reducer.js +29 -91
  315. package/src/store/selectors.js +61 -101
  316. package/src/store/test/actions.js +3 -15
  317. package/src/store/test/reducer.js +8 -192
  318. package/src/store/test/selectors.js +3 -42
  319. package/src/style.scss +19 -3
  320. package/build/components/editor/global-styles-renderer.js.map +0 -1
  321. package/build/components/navigation-sidebar/index.js +0 -62
  322. package/build/components/navigation-sidebar/index.js.map +0 -1
  323. package/build/components/navigation-sidebar/navigation-panel/constants.js +0 -77
  324. package/build/components/navigation-sidebar/navigation-panel/constants.js.map +0 -1
  325. package/build/components/navigation-sidebar/navigation-panel/index.js +0 -152
  326. package/build/components/navigation-sidebar/navigation-panel/index.js.map +0 -1
  327. package/build/components/navigation-sidebar/navigation-panel/template-hierarchy.js +0 -81
  328. package/build/components/navigation-sidebar/navigation-panel/template-hierarchy.js.map +0 -1
  329. package/build/components/navigation-sidebar/navigation-toggle/index.js +0 -124
  330. package/build/components/navigation-sidebar/navigation-toggle/index.js.map +0 -1
  331. package/build/components/url-query-controller/index.js.map +0 -1
  332. package/build-module/components/editor/global-styles-renderer.js.map +0 -1
  333. package/build-module/components/navigation-sidebar/index.js +0 -45
  334. package/build-module/components/navigation-sidebar/index.js.map +0 -1
  335. package/build-module/components/navigation-sidebar/navigation-panel/constants.js +0 -49
  336. package/build-module/components/navigation-sidebar/navigation-panel/constants.js.map +0 -1
  337. package/build-module/components/navigation-sidebar/navigation-panel/index.js +0 -131
  338. package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +0 -1
  339. package/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js +0 -66
  340. package/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js.map +0 -1
  341. package/build-module/components/navigation-sidebar/navigation-toggle/index.js +0 -108
  342. package/build-module/components/navigation-sidebar/navigation-toggle/index.js.map +0 -1
  343. package/build-module/components/url-query-controller/index.js.map +0 -1
  344. package/src/components/navigation-sidebar/index.js +0 -46
  345. package/src/components/navigation-sidebar/navigation-panel/constants.js +0 -94
  346. package/src/components/navigation-sidebar/navigation-panel/index.js +0 -142
  347. package/src/components/navigation-sidebar/navigation-panel/style.scss +0 -159
  348. package/src/components/navigation-sidebar/navigation-panel/template-hierarchy.js +0 -81
  349. package/src/components/navigation-sidebar/navigation-toggle/index.js +0 -114
  350. package/src/components/navigation-sidebar/navigation-toggle/style.scss +0 -71
  351. package/src/components/navigation-sidebar/navigation-toggle/test/__snapshots__/index.js.snap +0 -41
  352. package/src/components/navigation-sidebar/navigation-toggle/test/index.js +0 -69
@@ -0,0 +1,51 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import { createElement, Fragment } from "@wordpress/element";
3
+
4
+ /**
5
+ * WordPress dependencies
6
+ */
7
+ import { __experimentalUseResizeCanvas as useResizeCanvas, __unstableEditorStyles as EditorStyles, __unstableIframe as Iframe, __unstableUseMouseMoveTypingReset as useMouseMoveTypingReset, store as blockEditorStore } from '@wordpress/block-editor';
8
+ import { useSelect } from '@wordpress/data';
9
+ /**
10
+ * Internal dependencies
11
+ */
12
+
13
+ import { store as editSiteStore } from '../../store';
14
+
15
+ function EditorCanvas(_ref) {
16
+ let {
17
+ enableResizing,
18
+ settings,
19
+ children,
20
+ ...props
21
+ } = _ref;
22
+ const {
23
+ deviceType,
24
+ isZoomOutMode
25
+ } = useSelect(select => ({
26
+ deviceType: select(editSiteStore).__experimentalGetPreviewDeviceType(),
27
+ isZoomOutMode: select(blockEditorStore).__unstableGetEditorMode() === 'zoom-out'
28
+ }), []);
29
+ const deviceStyles = useResizeCanvas(deviceType);
30
+ const mouseMoveTypingRef = useMouseMoveTypingReset();
31
+ return createElement(Iframe, _extends({
32
+ scale: isZoomOutMode && 0.45 || undefined,
33
+ frameSize: isZoomOutMode ? 100 : undefined,
34
+ style: enableResizing ? {} : deviceStyles,
35
+ head: createElement(Fragment, null, createElement(EditorStyles, {
36
+ styles: settings.styles
37
+ }), createElement("style", null, // Forming a "block formatting context" to prevent margin collapsing.
38
+ // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
39
+ `.is-root-container { display: flow-root; }
40
+ body { position: relative; }`), enableResizing && createElement("style", null, // Some themes will have `min-height: 100vh` for the root container,
41
+ // which isn't a requirement in auto resize mode.
42
+ `.is-root-container { min-height: 0 !important; }`)),
43
+ assets: settings.__unstableResolvedAssets,
44
+ ref: mouseMoveTypingRef,
45
+ name: "editor-canvas",
46
+ className: "edit-site-visual-editor__editor-canvas"
47
+ }, props), settings.svgFilters, children);
48
+ }
49
+
50
+ export default EditorCanvas;
51
+ //# sourceMappingURL=editor-canvas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/editor-canvas.js"],"names":["__experimentalUseResizeCanvas","useResizeCanvas","__unstableEditorStyles","EditorStyles","__unstableIframe","Iframe","__unstableUseMouseMoveTypingReset","useMouseMoveTypingReset","store","blockEditorStore","useSelect","editSiteStore","EditorCanvas","enableResizing","settings","children","props","deviceType","isZoomOutMode","select","__experimentalGetPreviewDeviceType","__unstableGetEditorMode","deviceStyles","mouseMoveTypingRef","undefined","styles","__unstableResolvedAssets","svgFilters"],"mappings":";;;AAAA;AACA;AACA;AACA,SACCA,6BAA6B,IAAIC,eADlC,EAECC,sBAAsB,IAAIC,YAF3B,EAGCC,gBAAgB,IAAIC,MAHrB,EAICC,iCAAiC,IAAIC,uBAJtC,EAKCC,KAAK,IAAIC,gBALV,QAMO,yBANP;AAOA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,aAAvC;;AAEA,SAASC,YAAT,OAA0E;AAAA,MAAnD;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,QAAlB;AAA4BC,IAAAA,QAA5B;AAAsC,OAAGC;AAAzC,GAAmD;AACzE,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAAgCR,SAAS,CAC5CS,MAAF,KAAgB;AACfF,IAAAA,UAAU,EACTE,MAAM,CAAER,aAAF,CAAN,CAAwBS,kCAAxB,EAFc;AAGfF,IAAAA,aAAa,EACZC,MAAM,CAAEV,gBAAF,CAAN,CAA2BY,uBAA3B,OACA;AALc,GAAhB,CAD8C,EAQ9C,EAR8C,CAA/C;AAUA,QAAMC,YAAY,GAAGrB,eAAe,CAAEgB,UAAF,CAApC;AACA,QAAMM,kBAAkB,GAAGhB,uBAAuB,EAAlD;AACA,SACC,cAAC,MAAD;AACC,IAAA,KAAK,EAAKW,aAAa,IAAI,IAAnB,IAA6BM,SADtC;AAEC,IAAA,SAAS,EAAGN,aAAa,GAAG,GAAH,GAASM,SAFnC;AAGC,IAAA,KAAK,EAAGX,cAAc,GAAG,EAAH,GAAQS,YAH/B;AAIC,IAAA,IAAI,EACH,8BACC,cAAC,YAAD;AAAc,MAAA,MAAM,EAAGR,QAAQ,CAACW;AAAhC,MADD,EAEC,6BACC;AACA;AACC;AACP,oCAJK,CAFD,EAQGZ,cAAc,IACf,6BAEE;AACA;AACC,sDAJH,CATF,CALF;AAwBC,IAAA,MAAM,EAAGC,QAAQ,CAACY,wBAxBnB;AAyBC,IAAA,GAAG,EAAGH,kBAzBP;AA0BC,IAAA,IAAI,EAAC,eA1BN;AA2BC,IAAA,SAAS,EAAC;AA3BX,KA4BMP,KA5BN,GA+BGF,QAAQ,CAACa,UA/BZ,EAgCGZ,QAhCH,CADD;AAoCA;;AAED,eAAeH,YAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nfunction EditorCanvas( { enableResizing, settings, children, ...props } ) {\n\tconst { deviceType, isZoomOutMode } = useSelect(\n\t\t( select ) => ( {\n\t\t\tdeviceType:\n\t\t\t\tselect( editSiteStore ).__experimentalGetPreviewDeviceType(),\n\t\t\tisZoomOutMode:\n\t\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() ===\n\t\t\t\t'zoom-out',\n\t\t} ),\n\t\t[]\n\t);\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst mouseMoveTypingRef = useMouseMoveTypingReset();\n\treturn (\n\t\t<Iframe\n\t\t\tscale={ ( isZoomOutMode && 0.45 ) || undefined }\n\t\t\tframeSize={ isZoomOutMode ? 100 : undefined }\n\t\t\tstyle={ enableResizing ? {} : deviceStyles }\n\t\t\thead={\n\t\t\t\t<>\n\t\t\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t\t\t<style>{\n\t\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\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`.is-root-container { display: flow-root; }\n\t\t\t\t\t\t\tbody { position: relative; }`\n\t\t\t\t\t}</style>\n\t\t\t\t\t{ enableResizing && (\n\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// Some themes will have `min-height: 100vh` for the root container,\n\t\t\t\t\t\t\t\t// which isn't a requirement in auto resize mode.\n\t\t\t\t\t\t\t\t`.is-root-container { min-height: 0 !important; }`\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</style>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t\tassets={ settings.__unstableResolvedAssets }\n\t\t\tref={ mouseMoveTypingRef }\n\t\t\tname=\"editor-canvas\"\n\t\t\tclassName=\"edit-site-visual-editor__editor-canvas\"\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ /* Filters need to be rendered before children to avoid Safari rendering issues. */ }\n\t\t\t{ settings.svgFilters }\n\t\t\t{ children }\n\t\t</Iframe>\n\t);\n}\n\nexport default EditorCanvas;\n"]}
@@ -11,14 +11,13 @@ import classnames from 'classnames';
11
11
 
12
12
  import { useSelect, useDispatch } from '@wordpress/data';
13
13
  import { useCallback, useMemo, useRef, Fragment } from '@wordpress/element';
14
- import { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data';
14
+ import { useEntityBlockEditor, __experimentalFetchMedia as fetchMedia, store as coreStore } from '@wordpress/core-data';
15
15
  import { BlockList, BlockEditorProvider, __experimentalLinkControl, BlockInspector, BlockTools, __unstableBlockToolbarLastItem, __unstableBlockSettingsMenuFirstItem, __unstableUseTypingObserver as useTypingObserver, BlockEditorKeyboardShortcuts, store as blockEditorStore, __unstableBlockNameContext } from '@wordpress/block-editor';
16
- import { useMergeRefs, useViewportMatch } from '@wordpress/compose';
16
+ import { useMergeRefs, useViewportMatch, useResizeObserver } from '@wordpress/compose';
17
17
  import { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';
18
18
  import { listView } from '@wordpress/icons';
19
19
  import { ToolbarButton, ToolbarGroup } from '@wordpress/components';
20
20
  import { __ } from '@wordpress/i18n';
21
- import { store as interfaceStore } from '@wordpress/interface';
22
21
  /**
23
22
  * Internal dependencies
24
23
  */
@@ -30,14 +29,15 @@ import { store as editSiteStore } from '../../store';
30
29
  import BlockInspectorButton from './block-inspector-button';
31
30
  import BackButton from './back-button';
32
31
  import ResizableEditor from './resizable-editor';
32
+ import EditorCanvas from './editor-canvas';
33
+ import StyleBook from '../style-book';
33
34
  const LAYOUT = {
34
35
  type: 'default',
35
36
  // At the root level of the site editor, no alignments should be allowed.
36
37
  alignments: []
37
38
  };
38
- const NAVIGATION_SIDEBAR_NAME = 'edit-site/navigation-menu';
39
39
  export default function BlockEditor(_ref) {
40
- var _storedSettings$__exp, _storedSettings$__exp2;
40
+ var _storedSettings$__exp, _storedSettings$__exp2, _window;
41
41
 
42
42
  let {
43
43
  setIsInserterOpen
@@ -45,22 +45,17 @@ export default function BlockEditor(_ref) {
45
45
  const {
46
46
  storedSettings,
47
47
  templateType,
48
- templateId,
49
- page,
50
- isNavigationSidebarOpen
48
+ canvasMode
51
49
  } = useSelect(select => {
52
50
  const {
53
51
  getSettings,
54
52
  getEditedPostType,
55
- getEditedPostId,
56
- getPage
53
+ __unstableGetCanvasMode
57
54
  } = select(editSiteStore);
58
55
  return {
59
56
  storedSettings: getSettings(setIsInserterOpen),
60
57
  templateType: getEditedPostType(),
61
- templateId: getEditedPostId(),
62
- page: getPage(),
63
- isNavigationSidebarOpen: select(interfaceStore).getActiveComplementaryArea(editSiteStore.name) === NAVIGATION_SIDEBAR_NAME
58
+ canvasMode: __unstableGetCanvasMode()
64
59
  };
65
60
  }, [setIsInserterOpen]);
66
61
  const settingsBlockPatterns = (_storedSettings$__exp = storedSettings.__experimentalAdditionalBlockPatterns) !== null && _storedSettings$__exp !== void 0 ? _storedSettings$__exp : // WP 6.0
@@ -90,6 +85,7 @@ export default function BlockEditor(_ref) {
90
85
  ...restStoredSettings
91
86
  } = storedSettings;
92
87
  return { ...restStoredSettings,
88
+ __unstableFetchMedia: fetchMedia,
93
89
  __experimentalBlockPatterns: blockPatterns,
94
90
  __experimentalBlockPatternCategories: blockPatternCategories
95
91
  };
@@ -98,37 +94,34 @@ export default function BlockEditor(_ref) {
98
94
  const {
99
95
  setPage
100
96
  } = useDispatch(editSiteStore);
101
- const {
102
- enableComplementaryArea,
103
- disableComplementaryArea
104
- } = useDispatch(interfaceStore);
105
- const toggleNavigationSidebar = useCallback(() => {
106
- const toggleComplementaryArea = isNavigationSidebarOpen ? disableComplementaryArea : enableComplementaryArea;
107
- toggleComplementaryArea(editSiteStore.name, NAVIGATION_SIDEBAR_NAME);
108
- }, [isNavigationSidebarOpen]);
109
97
  const contentRef = useRef();
110
98
  const mergedRefs = useMergeRefs([contentRef, useTypingObserver()]);
111
99
  const isMobileViewport = useViewportMatch('small', '<');
112
100
  const {
113
101
  clearSelectedBlock
114
102
  } = useDispatch(blockEditorStore);
103
+ const [resizeObserver, sizes] = useResizeObserver();
115
104
  const isTemplatePart = templateType === 'wp_template_part';
116
105
  const hasBlocks = blocks.length !== 0;
106
+ const enableResizing = isTemplatePart && canvasMode !== 'view' && // Disable resizing in mobile viewport.
107
+ !isMobileViewport;
108
+ const isViewMode = canvasMode === 'view'; // eslint-disable-next-line @wordpress/data-no-store-string-literals
109
+
110
+ const {
111
+ enableComplementaryArea
112
+ } = useDispatch('core/interface');
117
113
 
118
114
  const NavMenuSidebarToggle = () => createElement(ToolbarGroup, null, createElement(ToolbarButton, {
119
115
  className: "components-toolbar__control",
120
- label: isNavigationSidebarOpen ? __('Close list view') : __('Open list view'),
121
- onClick: toggleNavigationSidebar,
122
- icon: listView,
123
- isActive: isNavigationSidebarOpen
124
- })); // Conditionally include NavMenu sidebar in Plugin only.
125
- // Optimise for dead code elimination.
126
- // See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination.
127
-
116
+ label: __('Open navigation list view'),
117
+ onClick: () => enableComplementaryArea('core/edit-site', 'edit-site/block-inspector'),
118
+ icon: listView
119
+ }));
128
120
 
129
121
  let MaybeNavMenuSidebarToggle = Fragment;
122
+ const isOffCanvasNavigationEditorEnabled = ((_window = window) === null || _window === void 0 ? void 0 : _window.__experimentalEnableOffCanvasNavigationEditor) === true;
130
123
 
131
- if (process.env.IS_GUTENBERG_PLUGIN) {
124
+ if (isOffCanvasNavigationEditorEnabled) {
132
125
  MaybeNavMenuSidebarToggle = NavMenuSidebarToggle;
133
126
  }
134
127
 
@@ -139,37 +132,45 @@ export default function BlockEditor(_ref) {
139
132
  onChange: onChange,
140
133
  useSubRegistry: false
141
134
  }, createElement(TemplatePartConverter, null), createElement(__experimentalLinkControl.ViewerFill, null, useCallback(fillProps => createElement(NavigateToLink, _extends({}, fillProps, {
142
- activePage: page,
143
135
  onActivePageChange: setPage
144
- })), [page])), createElement(SidebarInspectorFill, null, createElement(BlockInspector, null)), createElement(BlockTools, {
145
- className: classnames('edit-site-visual-editor', {
146
- 'is-focus-mode': isTemplatePart
147
- }),
148
- __unstableContentRef: contentRef,
149
- onClick: event => {
150
- // Clear selected block when clicking on the gray background.
151
- if (event.target === event.currentTarget) {
152
- clearSelectedBlock();
136
+ })), [])), createElement(SidebarInspectorFill, null, createElement(BlockInspector, null)), createElement(StyleBook.Slot, null, _ref3 => {
137
+ let [styleBook] = _ref3;
138
+ return styleBook ? createElement("div", {
139
+ className: "edit-site-visual-editor is-focus-mode"
140
+ }, createElement(ResizableEditor, {
141
+ enableResizing: true
142
+ }, styleBook)) : createElement(BlockTools, {
143
+ className: classnames('edit-site-visual-editor', {
144
+ 'is-focus-mode': isTemplatePart || !!styleBook,
145
+ 'is-view-mode': isViewMode
146
+ }),
147
+ __unstableContentRef: contentRef,
148
+ onClick: event => {
149
+ // Clear selected block when clicking on the gray background.
150
+ if (event.target === event.currentTarget) {
151
+ clearSelectedBlock();
152
+ }
153
153
  }
154
- }
155
- }, createElement(BlockEditorKeyboardShortcuts.Register, null), createElement(BackButton, null), createElement(ResizableEditor // Reinitialize the editor and reset the states when the template changes.
156
- , {
157
- key: templateId,
158
- enableResizing: isTemplatePart && // Disable resizing in mobile viewport.
159
- !isMobileViewport,
160
- settings: settings,
161
- contentRef: mergedRefs
162
- }, createElement(BlockList, {
163
- className: "edit-site-block-editor__block-list wp-site-blocks",
164
- __experimentalLayout: LAYOUT,
165
- renderAppender: isTemplatePart && hasBlocks ? false : undefined
166
- })), createElement(__unstableBlockSettingsMenuFirstItem, null, _ref3 => {
167
- let {
168
- onClose
169
- } = _ref3;
170
- return createElement(BlockInspectorButton, {
171
- onClick: onClose
172
- });
173
- }), createElement(__unstableBlockToolbarLastItem, null, createElement(__unstableBlockNameContext.Consumer, null, blockName => blockName === 'core/navigation' && createElement(MaybeNavMenuSidebarToggle, null)))), createElement(ReusableBlocksMenuItems, null));
154
+ }, createElement(BlockEditorKeyboardShortcuts.Register, null), createElement(BackButton, null), createElement(ResizableEditor, {
155
+ enableResizing: enableResizing,
156
+ height: sizes.height
157
+ }, createElement(EditorCanvas, {
158
+ enableResizing: enableResizing,
159
+ settings: settings,
160
+ contentRef: mergedRefs,
161
+ readonly: canvasMode === 'view'
162
+ }, resizeObserver, createElement(BlockList, {
163
+ className: "edit-site-block-editor__block-list wp-site-blocks",
164
+ __experimentalLayout: LAYOUT,
165
+ renderAppender: isTemplatePart && hasBlocks ? false : undefined
166
+ }))), createElement(__unstableBlockSettingsMenuFirstItem, null, _ref4 => {
167
+ let {
168
+ onClose
169
+ } = _ref4;
170
+ return createElement(BlockInspectorButton, {
171
+ onClick: onClose
172
+ });
173
+ }), createElement(__unstableBlockToolbarLastItem, null, createElement(__unstableBlockNameContext.Consumer, null, blockName => blockName === 'core/navigation' && createElement(MaybeNavMenuSidebarToggle, null))));
174
+ }), createElement(ReusableBlocksMenuItems, null));
174
175
  }
175
176
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["classnames","useSelect","useDispatch","useCallback","useMemo","useRef","Fragment","useEntityBlockEditor","store","coreStore","BlockList","BlockEditorProvider","__experimentalLinkControl","BlockInspector","BlockTools","__unstableBlockToolbarLastItem","__unstableBlockSettingsMenuFirstItem","__unstableUseTypingObserver","useTypingObserver","BlockEditorKeyboardShortcuts","blockEditorStore","__unstableBlockNameContext","useMergeRefs","useViewportMatch","ReusableBlocksMenuItems","listView","ToolbarButton","ToolbarGroup","__","interfaceStore","TemplatePartConverter","NavigateToLink","SidebarInspectorFill","editSiteStore","BlockInspectorButton","BackButton","ResizableEditor","LAYOUT","type","alignments","NAVIGATION_SIDEBAR_NAME","BlockEditor","setIsInserterOpen","storedSettings","templateType","templateId","page","isNavigationSidebarOpen","select","getSettings","getEditedPostType","getEditedPostId","getPage","getActiveComplementaryArea","name","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","getBlockPatterns","getBlockPatternCategories","blockPatterns","filter","x","index","arr","findIndex","y","postTypes","Array","isArray","includes","blockPatternCategories","settings","restStoredSettings","blocks","onInput","onChange","setPage","enableComplementaryArea","disableComplementaryArea","toggleNavigationSidebar","toggleComplementaryArea","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","isTemplatePart","hasBlocks","length","NavMenuSidebarToggle","MaybeNavMenuSidebarToggle","process","env","IS_GUTENBERG_PLUGIN","fillProps","event","target","currentTarget","undefined","onClose","blockName"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,E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C,8BAAD,QACC,cAAC,0BAAD,CAA4B,QAA5B,QACKC,SAAF,IACDA,SAAS,KAAK,iBAAd,IACC,cAAC,yBAAD,OAHH,CADD,CAtCD,CAvBD,EAuEC,cAAC,uBAAD,OAvED,CADD;AA2EA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCallback, useMemo, useRef, Fragment } from '@wordpress/element';\nimport { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data';\nimport {\n\tBlockList,\n\tBlockEditorProvider,\n\t__experimentalLinkControl,\n\tBlockInspector,\n\tBlockTools,\n\t__unstableBlockToolbarLastItem,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tBlockEditorKeyboardShortcuts,\n\tstore as blockEditorStore,\n\t__unstableBlockNameContext,\n} from '@wordpress/block-editor';\nimport { useMergeRefs, useViewportMatch } from '@wordpress/compose';\nimport { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';\nimport { listView } from '@wordpress/icons';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartConverter from '../template-part-converter';\nimport NavigateToLink from '../navigate-to-link';\nimport { SidebarInspectorFill } from '../sidebar-edit-mode';\nimport { store as editSiteStore } from '../../store';\nimport BlockInspectorButton from './block-inspector-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\nconst NAVIGATION_SIDEBAR_NAME = 'edit-site/navigation-menu';\n\nexport default function BlockEditor( { setIsInserterOpen } ) {\n\tconst {\n\t\tstoredSettings,\n\t\ttemplateType,\n\t\ttemplateId,\n\t\tpage,\n\t\tisNavigationSidebarOpen,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, getEditedPostType, getEditedPostId, getPage } =\n\t\t\t\tselect( editSiteStore );\n\n\t\t\treturn {\n\t\t\t\tstoredSettings: getSettings( setIsInserterOpen ),\n\t\t\t\ttemplateType: getEditedPostType(),\n\t\t\t\ttemplateId: getEditedPostId(),\n\t\t\t\tpage: getPage(),\n\t\t\t\tisNavigationSidebarOpen:\n\t\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t\t\teditSiteStore.name\n\t\t\t\t\t) === NAVIGATION_SIDEBAR_NAME,\n\t\t\t};\n\t\t},\n\t\t[ setIsInserterOpen ]\n\t);\n\n\tconst settingsBlockPatterns =\n\t\tstoredSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tstoredSettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories:\n\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( templateType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, templateType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst settings = useMemo( () => {\n\t\tconst {\n\t\t\t__experimentalAdditionalBlockPatterns,\n\t\t\t__experimentalAdditionalBlockPatternCategories,\n\t\t\t...restStoredSettings\n\t\t} = storedSettings;\n\n\t\treturn {\n\t\t\t...restStoredSettings,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t};\n\t}, [ storedSettings, blockPatterns, blockPatternCategories ] );\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplateType\n\t);\n\tconst { setPage } = useDispatch( editSiteStore );\n\tconst { enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\tconst toggleNavigationSidebar = useCallback( () => {\n\t\tconst toggleComplementaryArea = isNavigationSidebarOpen\n\t\t\t? disableComplementaryArea\n\t\t\t: enableComplementaryArea;\n\t\ttoggleComplementaryArea( editSiteStore.name, NAVIGATION_SIDEBAR_NAME );\n\t}, [ isNavigationSidebarOpen ] );\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\tconst hasBlocks = blocks.length !== 0;\n\n\tconst NavMenuSidebarToggle = () => (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName=\"components-toolbar__control\"\n\t\t\t\tlabel={\n\t\t\t\t\tisNavigationSidebarOpen\n\t\t\t\t\t\t? __( 'Close list view' )\n\t\t\t\t\t\t: __( 'Open list view' )\n\t\t\t\t}\n\t\t\t\tonClick={ toggleNavigationSidebar }\n\t\t\t\ticon={ listView }\n\t\t\t\tisActive={ isNavigationSidebarOpen }\n\t\t\t/>\n\t\t</ToolbarGroup>\n\t);\n\n\t// Conditionally include NavMenu sidebar in Plugin only.\n\t// Optimise for dead code elimination.\n\t// See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination.\n\tlet MaybeNavMenuSidebarToggle = Fragment;\n\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\tMaybeNavMenuSidebarToggle = NavMenuSidebarToggle;\n\t}\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<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<BlockEditorKeyboardShortcuts.Register />\n\t\t\t\t<BackButton />\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\trenderAppender={\n\t\t\t\t\t\t\tisTemplatePart && hasBlocks ? false : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ResizableEditor>\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\t<__unstableBlockToolbarLastItem>\n\t\t\t\t\t<__unstableBlockNameContext.Consumer>\n\t\t\t\t\t\t{ ( blockName ) =>\n\t\t\t\t\t\t\tblockName === 'core/navigation' && (\n\t\t\t\t\t\t\t\t<MaybeNavMenuSidebarToggle />\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t</__unstableBlockNameContext.Consumer>\n\t\t\t\t</__unstableBlockToolbarLastItem>\n\t\t\t</BlockTools>\n\t\t\t<ReusableBlocksMenuItems />\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","useMemo","useRef","Fragment","useEntityBlockEditor","__experimentalFetchMedia","fetchMedia","store","coreStore","BlockList","BlockEditorProvider","__experimentalLinkControl","BlockInspector","BlockTools","__unstableBlockToolbarLastItem","__unstableBlockSettingsMenuFirstItem","__unstableUseTypingObserver","useTypingObserver","BlockEditorKeyboardShortcuts","blockEditorStore","__unstableBlockNameContext","useMergeRefs","useViewportMatch","useResizeObserver","ReusableBlocksMenuItems","listView","ToolbarButton","ToolbarGroup","__","TemplatePartConverter","NavigateToLink","SidebarInspectorFill","editSiteStore","BlockInspectorButton","BackButton","ResizableEditor","EditorCanvas","StyleBook","LAYOUT","type","alignments","BlockEditor","setIsInserterOpen","storedSettings","templateType","canvasMode","select","getSettings","getEditedPostType","__unstableGetCanvasMode","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","getBlockPatterns","getBlockPatternCategories","blockPatterns","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","settings","restStoredSettings","__unstableFetchMedia","blocks","onInput","onChange","setPage","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","resizeObserver","sizes","isTemplatePart","hasBlocks","length","enableResizing","isViewMode","enableComplementaryArea","NavMenuSidebarToggle","MaybeNavMenuSidebarToggle","isOffCanvasNavigationEditorEnabled","window","__experimentalEnableOffCanvasNavigationEditor","fillProps","styleBook","event","target","currentTarget","height","undefined","onClose","blockName"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,WAAT,EAAsBC,OAAtB,EAA+BC,MAA/B,EAAuCC,QAAvC,QAAuD,oBAAvD;AACA,SAC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AS,KAAK,iBAAd,IACC,cAAC,yBAAD,OAHH,CADD,CA1CD,CARA;AAAA,GADH,CAvBD,EAuFC,cAAC,uBAAD,OAvFD,CADD;AA2FA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCallback, useMemo, useRef, Fragment } from '@wordpress/element';\nimport {\n\tuseEntityBlockEditor,\n\t__experimentalFetchMedia as fetchMedia,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport {\n\tBlockList,\n\tBlockEditorProvider,\n\t__experimentalLinkControl,\n\tBlockInspector,\n\tBlockTools,\n\t__unstableBlockToolbarLastItem,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tBlockEditorKeyboardShortcuts,\n\tstore as blockEditorStore,\n\t__unstableBlockNameContext,\n} from '@wordpress/block-editor';\nimport {\n\tuseMergeRefs,\n\tuseViewportMatch,\n\tuseResizeObserver,\n} from '@wordpress/compose';\nimport { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';\nimport { listView } from '@wordpress/icons';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartConverter from '../template-part-converter';\nimport NavigateToLink from '../navigate-to-link';\nimport { SidebarInspectorFill } from '../sidebar-edit-mode';\nimport { store as editSiteStore } from '../../store';\nimport BlockInspectorButton from './block-inspector-button';\nimport BackButton from './back-button';\nimport ResizableEditor from './resizable-editor';\nimport EditorCanvas from './editor-canvas';\nimport StyleBook from '../style-book';\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 { storedSettings, templateType, canvasMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, getEditedPostType, __unstableGetCanvasMode } =\n\t\t\t\tselect( editSiteStore );\n\n\t\t\treturn {\n\t\t\t\tstoredSettings: getSettings( setIsInserterOpen ),\n\t\t\t\ttemplateType: getEditedPostType(),\n\t\t\t\tcanvasMode: __unstableGetCanvasMode(),\n\t\t\t};\n\t\t},\n\t\t[ setIsInserterOpen ]\n\t);\n\n\tconst settingsBlockPatterns =\n\t\tstoredSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tstoredSettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories:\n\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( templateType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, templateType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst settings = useMemo( () => {\n\t\tconst {\n\t\t\t__experimentalAdditionalBlockPatterns,\n\t\t\t__experimentalAdditionalBlockPatternCategories,\n\t\t\t...restStoredSettings\n\t\t} = storedSettings;\n\n\t\treturn {\n\t\t\t...restStoredSettings,\n\t\t\t__unstableFetchMedia: fetchMedia,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t};\n\t}, [ storedSettings, blockPatterns, blockPatternCategories ] );\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplateType\n\t);\n\tconst { setPage } = useDispatch( editSiteStore );\n\n\tconst contentRef = useRef();\n\tconst mergedRefs = useMergeRefs( [ contentRef, useTypingObserver() ] );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\n\tconst isTemplatePart = templateType === 'wp_template_part';\n\tconst hasBlocks = blocks.length !== 0;\n\tconst enableResizing =\n\t\tisTemplatePart &&\n\t\tcanvasMode !== 'view' &&\n\t\t// Disable resizing in mobile viewport.\n\t\t! isMobileViewport;\n\tconst isViewMode = canvasMode === 'view';\n\n\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\tconst { enableComplementaryArea } = useDispatch( 'core/interface' );\n\n\tconst NavMenuSidebarToggle = () => (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName=\"components-toolbar__control\"\n\t\t\t\tlabel={ __( 'Open navigation list view' ) }\n\t\t\t\tonClick={ () =>\n\t\t\t\t\tenableComplementaryArea(\n\t\t\t\t\t\t'core/edit-site',\n\t\t\t\t\t\t'edit-site/block-inspector'\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\ticon={ listView }\n\t\t\t/>\n\t\t</ToolbarGroup>\n\t);\n\n\tlet MaybeNavMenuSidebarToggle = Fragment;\n\tconst isOffCanvasNavigationEditorEnabled =\n\t\twindow?.__experimentalEnableOffCanvasNavigationEditor === true;\n\n\tif ( isOffCanvasNavigationEditorEnabled ) {\n\t\tMaybeNavMenuSidebarToggle = NavMenuSidebarToggle;\n\t}\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<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\tonActivePageChange={ setPage }\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\t[]\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{ /* Potentially this could be a generic slot (e.g. EditorCanvas.Slot) if there are other uses for it. */ }\n\t\t\t<StyleBook.Slot>\n\t\t\t\t{ ( [ styleBook ] ) =>\n\t\t\t\t\tstyleBook ? (\n\t\t\t\t\t\t<div className=\"edit-site-visual-editor is-focus-mode\">\n\t\t\t\t\t\t\t<ResizableEditor enableResizing>\n\t\t\t\t\t\t\t\t{ styleBook }\n\t\t\t\t\t\t\t</ResizableEditor>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<BlockTools\n\t\t\t\t\t\t\tclassName={ classnames( 'edit-site-visual-editor', {\n\t\t\t\t\t\t\t\t'is-focus-mode': isTemplatePart || !! styleBook,\n\t\t\t\t\t\t\t\t'is-view-mode': isViewMode,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t__unstableContentRef={ contentRef }\n\t\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\t\t// Clear selected block when clicking on the gray background.\n\t\t\t\t\t\t\t\tif ( event.target === event.currentTarget ) {\n\t\t\t\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t\t\t\t\t<BackButton />\n\t\t\t\t\t\t\t<ResizableEditor\n\t\t\t\t\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\t\t\t\t\theight={ sizes.height }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<EditorCanvas\n\t\t\t\t\t\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\t\tcontentRef={ mergedRefs }\n\t\t\t\t\t\t\t\t\treadonly={ canvasMode === 'view' }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ resizeObserver }\n\t\t\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-block-editor__block-list wp-site-blocks\"\n\t\t\t\t\t\t\t\t\t\t__experimentalLayout={ LAYOUT }\n\t\t\t\t\t\t\t\t\t\trenderAppender={\n\t\t\t\t\t\t\t\t\t\t\tisTemplatePart && hasBlocks\n\t\t\t\t\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</EditorCanvas>\n\t\t\t\t\t\t\t</ResizableEditor>\n\t\t\t\t\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t\t\t\t<__unstableBlockToolbarLastItem>\n\t\t\t\t\t\t\t\t<__unstableBlockNameContext.Consumer>\n\t\t\t\t\t\t\t\t\t{ ( blockName ) =>\n\t\t\t\t\t\t\t\t\t\tblockName === 'core/navigation' && (\n\t\t\t\t\t\t\t\t\t\t\t<MaybeNavMenuSidebarToggle />\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</__unstableBlockNameContext.Consumer>\n\t\t\t\t\t\t\t</__unstableBlockToolbarLastItem>\n\t\t\t\t\t\t</BlockTools>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t</StyleBook.Slot>\n\t\t\t<ReusableBlocksMenuItems />\n\t\t</BlockEditorProvider>\n\t);\n}\n"]}
@@ -1,24 +1,15 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { createElement, Fragment } from "@wordpress/element";
1
+ import { createElement } from "@wordpress/element";
3
2
 
4
3
  /**
5
4
  * WordPress dependencies
6
5
  */
7
- import { useState, useEffect, useRef, useCallback } from '@wordpress/element';
6
+ import { useState, useRef, useCallback } from '@wordpress/element';
8
7
  import { ResizableBox } from '@wordpress/components';
9
- import { __experimentalUseResizeCanvas as useResizeCanvas, __unstableEditorStyles as EditorStyles, __unstableIframe as Iframe, __unstableUseMouseMoveTypingReset as useMouseMoveTypingReset, store as blockEditorStore } from '@wordpress/block-editor';
10
- import { useSelect } from '@wordpress/data';
11
- import { useMergeRefs } from '@wordpress/compose';
12
8
  /**
13
9
  * Internal dependencies
14
10
  */
15
11
 
16
- import { store as editSiteStore } from '../../store';
17
- import ResizeHandle from './resize-handle';
18
- const DEFAULT_STYLES = {
19
- width: '100%',
20
- height: '100%'
21
- }; // Removes the inline styles in the drag handles.
12
+ import ResizeHandle from './resize-handle'; // Removes the inline styles in the drag handles.
22
13
 
23
14
  const HANDLE_STYLES_OVERRIDE = {
24
15
  position: undefined,
@@ -35,64 +26,23 @@ const HANDLE_STYLES_OVERRIDE = {
35
26
  function ResizableEditor(_ref) {
36
27
  let {
37
28
  enableResizing,
38
- settings,
39
- children,
40
- ...props
29
+ height,
30
+ children
41
31
  } = _ref;
42
- const {
43
- deviceType,
44
- isZoomOutMode
45
- } = useSelect(select => ({
46
- deviceType: select(editSiteStore).__experimentalGetPreviewDeviceType(),
47
- isZoomOutMode: select(blockEditorStore).__unstableGetEditorMode() === 'zoom-out'
48
- }), []);
49
- const deviceStyles = useResizeCanvas(deviceType);
50
- const [width, setWidth] = useState(DEFAULT_STYLES.width);
51
- const [height, setHeight] = useState(DEFAULT_STYLES.height);
52
- const iframeRef = useRef();
53
- const mouseMoveTypingResetRef = useMouseMoveTypingReset();
54
- const ref = useMergeRefs([iframeRef, mouseMoveTypingResetRef]);
55
- useEffect(function autoResizeIframeHeight() {
56
- if (!iframeRef.current || !enableResizing) {
57
- return;
58
- }
59
-
60
- const iframe = iframeRef.current;
61
-
62
- function setFrameHeight() {
63
- setHeight(iframe.contentDocument.body.scrollHeight);
64
- }
65
-
66
- let resizeObserver;
67
-
68
- function registerObserver() {
69
- var _resizeObserver;
70
-
71
- (_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : _resizeObserver.disconnect();
72
- resizeObserver = new iframe.contentWindow.ResizeObserver(setFrameHeight); // Observe the body, since the `html` element seems to always
73
- // have a height of `100%`.
74
-
75
- resizeObserver.observe(iframe.contentDocument.body);
76
- setFrameHeight();
77
- }
78
-
79
- iframe.addEventListener('load', registerObserver);
80
- return () => {
81
- var _resizeObserver2;
82
-
83
- (_resizeObserver2 = resizeObserver) === null || _resizeObserver2 === void 0 ? void 0 : _resizeObserver2.disconnect();
84
- iframe.removeEventListener('load', registerObserver);
85
- };
86
- }, [enableResizing, iframeRef.current]);
32
+ const [width, setWidth] = useState('100%');
33
+ const resizableRef = useRef();
87
34
  const resizeWidthBy = useCallback(deltaPixels => {
88
- if (iframeRef.current) {
89
- setWidth(iframeRef.current.offsetWidth + deltaPixels);
35
+ if (resizableRef.current) {
36
+ setWidth(resizableRef.current.offsetWidth + deltaPixels);
90
37
  }
91
38
  }, []);
92
39
  return createElement(ResizableBox, {
40
+ ref: api => {
41
+ resizableRef.current = api === null || api === void 0 ? void 0 : api.resizable;
42
+ },
93
43
  size: {
94
- width,
95
- height
44
+ width: enableResizing ? width : '100%',
45
+ height: enableResizing && height ? height : '100%'
96
46
  },
97
47
  onResizeStop: (event, direction, element) => {
98
48
  setWidth(element.style.width);
@@ -124,24 +74,7 @@ function ResizableEditor(_ref) {
124
74
  left: HANDLE_STYLES_OVERRIDE,
125
75
  right: HANDLE_STYLES_OVERRIDE
126
76
  }
127
- }, createElement(Iframe, _extends({
128
- isZoomedOut: isZoomOutMode,
129
- style: enableResizing ? {
130
- height
131
- } : deviceStyles,
132
- head: createElement(Fragment, null, createElement(EditorStyles, {
133
- styles: settings.styles
134
- }), createElement("style", null, // Forming a "block formatting context" to prevent margin collapsing.
135
- // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
136
- `.is-root-container { display: flow-root; }`), enableResizing && createElement("style", null, // Force the <html> and <body>'s heights to fit the content.
137
- `html, body { height: -moz-fit-content !important; height: fit-content !important; min-height: 0 !important; }`, // Some themes will have `min-height: 100vh` for the root container,
138
- // which isn't a requirement in auto resize mode.
139
- `.is-root-container { min-height: 0 !important; }`)),
140
- assets: settings.__unstableResolvedAssets,
141
- ref: ref,
142
- name: "editor-canvas",
143
- className: "edit-site-visual-editor__editor-canvas"
144
- }, props), settings.svgFilters, children));
77
+ }, children);
145
78
  }
146
79
 
147
80
  export default ResizableEditor;
@@ -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","store","blockEditorStore","useSelect","useMergeRefs","editSiteStore","ResizeHandle","DEFAULT_STYLES","width","height","HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","top","right","bottom","left","ResizableEditor","enableResizing","settings","children","props","deviceType","isZoomOutMode","select","__experimentalGetPreviewDeviceType","__unstableGetEditorMode","deviceStyles","setWidth","setHeight","iframeRef","mouseMoveTypingResetRef","ref","autoResizeIframeHeight","current","iframe","setFrameHeight","contentDocument","body","scrollHeight","resizeObserver","registerObserver","disconnect","contentWindow","ResizeObserver","observe","addEventListener","removeEventListener","resizeWidthBy","deltaPixels","offsetWidth","event","direction","element","style","styles","__unstableResolvedAssets","svgFilters"],"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,EAKCC,KAAK,IAAIC,gBALV,QAMO,yBANP;AAOA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,YAAT,QAA6B,oBAA7B;AAEA;AACA;AACA;;AACA,SAASH,KAAK,IAAII,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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AEI,cADC;AAERF,MAAAA,IAAI,EAAEE;AAFE,KAXV;AAeC,IAAA,UAAU,EAAGA,cAfd,CAgBC;AACA;AACA;AAlBD;AAmBC,IAAA,WAAW,EAAG,CAnBf;AAoBC,IAAA,eAAe,EAAG;AACjBF,MAAAA,IAAI,EACH,cAAC,YAAD;AACC,QAAA,SAAS,EAAC,MADX;AAEC,QAAA,aAAa,EAAGgC;AAFjB,QAFgB;AAOjBlC,MAAAA,KAAK,EACJ,cAAC,YAAD;AACC,QAAA,SAAS,EAAC,OADX;AAEC,QAAA,aAAa,EAAGkC;AAFjB;AARgB,KApBnB;AAkCC,IAAA,aAAa,EAAGtC,SAlCjB;AAmCC,IAAA,YAAY,EAAG;AACdM,MAAAA,IAAI,EAAER,sBADQ;AAEdM,MAAAA,KAAK,EAAEN;AAFO;AAnChB,KAwCC,cAAC,MAAD;AACC,IAAA,WAAW,EAAGe,aADf;AAEC,IAAA,KAAK,EAAGL,cAAc,GAAG;AAAEX,MAAAA;AAAF,KAAH,GAAgBoB,YAFvC;AAGC,IAAA,IAAI,EACH,8BACC,cAAC,YAAD;AAAc,MAAA,MAAM,EAAGR,QAAQ,CAACoC;AAAhC,MADD,EAEC,6BACC;AACA;AACC,gDAHF,CAFD,EAOGrC,cAAc,IACf,6BAEE;AACC,mHAHH,EAME;AACA;AACC,sDARH,CARF,CAJF;AA0BC,IAAA,MAAM,EAAGC,QAAQ,CAACqC,wBA1BnB;AA2BC,IAAA,GAAG,EAAGxB,GA3BP;AA4BC,IAAA,IAAI,EAAC,eA5BN;AA6BC,IAAA,SAAS,EAAC;AA7BX,KA8BMX,KA9BN,GAiCGF,QAAQ,CAACsC,UAjCZ,EAkCGrC,QAlCH,CAxCD,CADD;AA+EA;;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\tstore as blockEditorStore,\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, children, ...props } ) {\n\tconst { deviceType, isZoomOutMode } = useSelect(\n\t\t( select ) => ( {\n\t\t\tdeviceType:\n\t\t\t\tselect( editSiteStore ).__experimentalGetPreviewDeviceType(),\n\t\t\tisZoomOutMode:\n\t\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() ===\n\t\t\t\t'zoom-out',\n\t\t} ),\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\tif ( ! iframeRef.current || ! enableResizing ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst iframe = iframeRef.current;\n\n\t\t\tfunction setFrameHeight() {\n\t\t\t\tsetHeight( iframe.contentDocument.body.scrollHeight );\n\t\t\t}\n\n\t\t\tlet resizeObserver;\n\n\t\t\tfunction registerObserver() {\n\t\t\t\tresizeObserver?.disconnect();\n\n\t\t\t\tresizeObserver = new iframe.contentWindow.ResizeObserver(\n\t\t\t\t\tsetFrameHeight\n\t\t\t\t);\n\n\t\t\t\t// Observe the body, since the `html` element seems to always\n\t\t\t\t// have a height of `100%`.\n\t\t\t\tresizeObserver.observe( iframe.contentDocument.body );\n\t\t\t\tsetFrameHeight();\n\t\t\t}\n\n\t\t\tiframe.addEventListener( 'load', registerObserver );\n\n\t\t\treturn () => {\n\t\t\t\tresizeObserver?.disconnect();\n\t\t\t\tiframe.removeEventListener( 'load', registerObserver );\n\t\t\t};\n\t\t},\n\t\t[ enableResizing, iframeRef.current ]\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\tisZoomedOut={ isZoomOutMode }\n\t\t\t\tstyle={ enableResizing ? { height } : 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`.is-root-container { display: flow-root; }`\n\t\t\t\t\t\t}</style>\n\t\t\t\t\t\t{ enableResizing && (\n\t\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// Force the <html> and <body>'s heights to fit the content.\n\t\t\t\t\t\t\t\t\t`html, body { height: -moz-fit-content !important; height: fit-content !important; min-height: 0 !important; }`\n\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// Some themes will have `min-height: 100vh` for the root container,\n\t\t\t\t\t\t\t\t\t// which isn't a requirement in auto resize mode.\n\t\t\t\t\t\t\t\t\t`.is-root-container { min-height: 0 !important; }`\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</style>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tassets={ settings.__unstableResolvedAssets }\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\t\t{ /* Filters need to be rendered before children to avoid Safari rendering issues. */ }\n\t\t\t\t{ settings.svgFilters }\n\t\t\t\t{ children }\n\t\t\t</Iframe>\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","useRef","useCallback","ResizableBox","ResizeHandle","HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","width","height","top","right","bottom","left","ResizableEditor","enableResizing","children","setWidth","resizableRef","resizeWidthBy","deltaPixels","current","offsetWidth","api","resizable","event","direction","element","style"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,MAAnB,EAA2BC,WAA3B,QAA8C,oBAA9C;AACA,SAASC,YAAT,QAA6B,uBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,iBAAzB,C,CAEA;;AACA,MAAMC,sBAAsB,GAAG;AAC9BC,EAAAA,QAAQ,EAAEC,SADoB;AAE9BC,EAAAA,UAAU,EAAED,SAFkB;AAG9BE,EAAAA,MAAM,EAAEF,SAHsB;AAI9BG,EAAAA,KAAK,EAAEH,SAJuB;AAK9BI,EAAAA,MAAM,EAAEJ,SALsB;AAM9BK,EAAAA,GAAG,EAAEL,SANyB;AAO9BM,EAAAA,KAAK,EAAEN,SAPuB;AAQ9BO,EAAAA,MAAM,EAAEP,SARsB;AAS9BQ,EAAAA,IAAI,EAAER;AATwB,CAA/B;;AAYA,SAASS,eAAT,OAAiE;AAAA,MAAvC;AAAEC,IAAAA,cAAF;AAAkBN,IAAAA,MAAlB;AAA0BO,IAAAA;AAA1B,GAAuC;AAChE,QAAM,CAAER,KAAF,EAASS,QAAT,IAAsBnB,QAAQ,CAAE,MAAF,CAApC;AACA,QAAMoB,YAAY,GAAGnB,MAAM,EAA3B;AACA,QAAMoB,aAAa,GAAGnB,WAAW,CAAIoB,WAAF,IAAmB;AACrD,QAAKF,YAAY,CAACG,OAAlB,EAA4B;AAC3BJ,MAAAA,QAAQ,CAAEC,YAAY,CAAC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QA3CH,CADD;AA+CA;;AAED,eAAeF,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useRef, useCallback } from '@wordpress/element';\nimport { ResizableBox } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ResizeHandle from './resize-handle';\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, height, children } ) {\n\tconst [ width, setWidth ] = useState( '100%' );\n\tconst resizableRef = useRef();\n\tconst resizeWidthBy = useCallback( ( deltaPixels ) => {\n\t\tif ( resizableRef.current ) {\n\t\t\tsetWidth( resizableRef.current.offsetWidth + deltaPixels );\n\t\t}\n\t}, [] );\n\treturn (\n\t\t<ResizableBox\n\t\t\tref={ ( api ) => {\n\t\t\t\tresizableRef.current = api?.resizable;\n\t\t\t} }\n\t\t\tsize={ {\n\t\t\t\twidth: enableResizing ? width : '100%',\n\t\t\t\theight: enableResizing && height ? height : '100%',\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{ children }\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableEditor;\n"]}