@wordpress/edit-site 5.11.0 → 5.12.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 (587) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-page/index.js +105 -0
  3. package/build/components/add-new-page/index.js.map +1 -0
  4. package/build/components/add-new-template/add-custom-generic-template-modal-content.js +4 -5
  5. package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  6. package/build/components/add-new-template/add-custom-template-modal-content.js +19 -22
  7. package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
  8. package/build/components/add-new-template/index.js +4 -5
  9. package/build/components/add-new-template/index.js.map +1 -1
  10. package/build/components/add-new-template/new-template-part.js +9 -12
  11. package/build/components/add-new-template/new-template-part.js.map +1 -1
  12. package/build/components/add-new-template/new-template.js +19 -26
  13. package/build/components/add-new-template/new-template.js.map +1 -1
  14. package/build/components/add-new-template/utils.js +71 -120
  15. package/build/components/add-new-template/utils.js.map +1 -1
  16. package/build/components/block-editor/back-button.js +1 -3
  17. package/build/components/block-editor/back-button.js.map +1 -1
  18. package/build/components/block-editor/block-inspector-button.js +3 -4
  19. package/build/components/block-editor/block-inspector-button.js.map +1 -1
  20. package/build/components/block-editor/editor-canvas.js +6 -7
  21. package/build/components/block-editor/editor-canvas.js.map +1 -1
  22. package/build/components/block-editor/index.js +13 -10
  23. package/build/components/block-editor/index.js.map +1 -1
  24. package/build/components/block-editor/inserter-media-categories.js +25 -42
  25. package/build/components/block-editor/inserter-media-categories.js.map +1 -1
  26. package/build/components/block-editor/resizable-editor.js +6 -7
  27. package/build/components/block-editor/resizable-editor.js.map +1 -1
  28. package/build/components/block-editor/resize-handle.js +5 -7
  29. package/build/components/block-editor/resize-handle.js.map +1 -1
  30. package/build/components/code-editor/code-editor-text-area.js +5 -6
  31. package/build/components/code-editor/code-editor-text-area.js.map +1 -1
  32. package/build/components/create-template-part-modal/index.js +25 -29
  33. package/build/components/create-template-part-modal/index.js.map +1 -1
  34. package/build/components/editor/index.js +26 -17
  35. package/build/components/editor/index.js.map +1 -1
  36. package/build/components/editor-canvas-container/index.js +7 -8
  37. package/build/components/editor-canvas-container/index.js.map +1 -1
  38. package/build/components/error-boundary/warning.js +8 -10
  39. package/build/components/error-boundary/warning.js.map +1 -1
  40. package/build/components/global-styles/block-preview-panel.js +7 -10
  41. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  42. package/build/components/global-styles/color-indicator-wrapper.js +4 -5
  43. package/build/components/global-styles/color-indicator-wrapper.js.map +1 -1
  44. package/build/components/global-styles/color-palette-panel.js +3 -4
  45. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  46. package/build/components/global-styles/dimensions-panel.js +1 -3
  47. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  48. package/build/components/global-styles/global-styles-provider.js +8 -10
  49. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  50. package/build/components/global-styles/gradients-palette-panel.js +3 -4
  51. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  52. package/build/components/global-styles/header.js +4 -5
  53. package/build/components/global-styles/header.js.map +1 -1
  54. package/build/components/global-styles/icon-with-current-color.js +4 -5
  55. package/build/components/global-styles/icon-with-current-color.js.map +1 -1
  56. package/build/components/global-styles/navigation-button.js +5 -6
  57. package/build/components/global-styles/navigation-button.js.map +1 -1
  58. package/build/components/global-styles/palette.js +10 -14
  59. package/build/components/global-styles/palette.js.map +1 -1
  60. package/build/components/global-styles/preview.js +41 -51
  61. package/build/components/global-styles/preview.js.map +1 -1
  62. package/build/components/global-styles/screen-block-list.js +4 -7
  63. package/build/components/global-styles/screen-block-list.js.map +1 -1
  64. package/build/components/global-styles/screen-block.js +9 -10
  65. package/build/components/global-styles/screen-block.js.map +1 -1
  66. package/build/components/global-styles/screen-color-palette.js +3 -4
  67. package/build/components/global-styles/screen-color-palette.js.map +1 -1
  68. package/build/components/global-styles/screen-revisions/index.js +8 -8
  69. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  70. package/build/components/global-styles/screen-revisions/revisions-buttons.js +14 -19
  71. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  72. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +5 -11
  73. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  74. package/build/components/global-styles/screen-root.js +3 -3
  75. package/build/components/global-styles/screen-root.js.map +1 -1
  76. package/build/components/global-styles/screen-typography-element.js +3 -4
  77. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  78. package/build/components/global-styles/screen-typography.js +5 -6
  79. package/build/components/global-styles/screen-typography.js.map +1 -1
  80. package/build/components/global-styles/style-variations-container.js +5 -6
  81. package/build/components/global-styles/style-variations-container.js.map +1 -1
  82. package/build/components/global-styles/subtitle.js +4 -5
  83. package/build/components/global-styles/subtitle.js.map +1 -1
  84. package/build/components/global-styles/typography-panel.js +4 -5
  85. package/build/components/global-styles/typography-panel.js.map +1 -1
  86. package/build/components/global-styles/typography-preview.js +5 -6
  87. package/build/components/global-styles/typography-preview.js.map +1 -1
  88. package/build/components/global-styles/ui.js +40 -21
  89. package/build/components/global-styles/ui.js.map +1 -1
  90. package/build/components/global-styles/variations-panel.js +5 -6
  91. package/build/components/global-styles/variations-panel.js.map +1 -1
  92. package/build/components/header-edit-mode/document-actions/index.js +102 -23
  93. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  94. package/build/components/header-edit-mode/index.js +2 -6
  95. package/build/components/header-edit-mode/index.js.map +1 -1
  96. package/build/components/header-edit-mode/more-menu/index.js +49 -53
  97. package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
  98. package/build/components/header-edit-mode/tools-more-menu-group/index.js +5 -14
  99. package/build/components/header-edit-mode/tools-more-menu-group/index.js.map +1 -1
  100. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
  101. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  102. package/build/components/keyboard-shortcut-help-modal/index.js +41 -51
  103. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  104. package/build/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
  105. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  106. package/build/components/layout/index.js +4 -12
  107. package/build/components/layout/index.js.map +1 -1
  108. package/build/components/list/added-by.js +13 -23
  109. package/build/components/list/added-by.js.map +1 -1
  110. package/build/components/list/header.js +4 -7
  111. package/build/components/list/header.js.map +1 -1
  112. package/build/components/list/index.js +2 -4
  113. package/build/components/list/index.js.map +1 -1
  114. package/build/components/list/table.js +35 -40
  115. package/build/components/list/table.js.map +1 -1
  116. package/build/components/page-actions/delete-page-menu-item.js +70 -0
  117. package/build/components/page-actions/delete-page-menu-item.js.map +1 -0
  118. package/build/components/page-actions/index.js +43 -0
  119. package/build/components/page-actions/index.js.map +1 -0
  120. package/build/components/page-content-lock/constants.js +9 -0
  121. package/build/components/page-content-lock/constants.js.map +1 -0
  122. package/build/components/page-content-lock/index.js +29 -0
  123. package/build/components/page-content-lock/index.js.map +1 -0
  124. package/build/components/page-content-lock/use-disable-non-content-blocks.js +49 -0
  125. package/build/components/page-content-lock/use-disable-non-content-blocks.js.map +1 -0
  126. package/build/components/page-content-lock/use-page-content-lock-notifications.js +112 -0
  127. package/build/components/page-content-lock/use-page-content-lock-notifications.js.map +1 -0
  128. package/build/components/preferences-modal/index.js +4 -5
  129. package/build/components/preferences-modal/index.js.map +1 -1
  130. package/build/components/resizable-frame/index.js +20 -12
  131. package/build/components/resizable-frame/index.js.map +1 -1
  132. package/build/components/revisions/index.js +11 -14
  133. package/build/components/revisions/index.js.map +1 -1
  134. package/build/components/routes/link.js +8 -12
  135. package/build/components/routes/link.js.map +1 -1
  136. package/build/components/routes/use-title.js +1 -5
  137. package/build/components/routes/use-title.js.map +1 -1
  138. package/build/components/save-button/index.js +13 -7
  139. package/build/components/save-button/index.js.map +1 -1
  140. package/build/components/save-hub/index.js +97 -5
  141. package/build/components/save-hub/index.js.map +1 -1
  142. package/build/components/save-panel/index.js +63 -17
  143. package/build/components/save-panel/index.js.map +1 -1
  144. package/build/components/secondary-sidebar/list-view-sidebar.js +8 -3
  145. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  146. package/build/components/sidebar/index.js +7 -5
  147. package/build/components/sidebar/index.js.map +1 -1
  148. package/build/components/sidebar-edit-mode/default-sidebar.js +11 -12
  149. package/build/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
  150. package/build/components/sidebar-edit-mode/index.js +13 -10
  151. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  152. package/build/components/sidebar-edit-mode/page-panels/content-blocks-list.js +79 -0
  153. package/build/components/sidebar-edit-mode/page-panels/content-blocks-list.js.map +1 -0
  154. package/build/components/sidebar-edit-mode/page-panels/index.js +86 -0
  155. package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -0
  156. package/build/components/sidebar-edit-mode/plugin-sidebar/index.js +4 -5
  157. package/build/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
  158. package/build/components/sidebar-edit-mode/settings-header/index.js +39 -21
  159. package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
  160. package/build/components/sidebar-edit-mode/sidebar-card/index.js +46 -0
  161. package/build/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -0
  162. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +3 -4
  163. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -1
  164. package/build/components/sidebar-edit-mode/{template-card → template-panel}/index.js +22 -18
  165. package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -0
  166. package/build/components/sidebar-edit-mode/{template-revisions/index.js → template-panel/last-revision.js} +7 -8
  167. package/{build-module/components/sidebar-edit-mode/template-revisions/index.js.map → build/components/sidebar-edit-mode/template-panel/last-revision.js.map} +1 -1
  168. package/build/components/sidebar-edit-mode/{template-card → template-panel}/template-actions.js +12 -16
  169. package/build/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -0
  170. package/build/components/sidebar-edit-mode/{template-card → template-panel}/template-areas.js +15 -19
  171. package/build/components/sidebar-edit-mode/template-panel/template-areas.js.map +1 -0
  172. package/build/components/sidebar-navigation-item/index.js +7 -8
  173. package/build/components/sidebar-navigation-item/index.js.map +1 -1
  174. package/build/components/sidebar-navigation-screen/index.js +21 -14
  175. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  176. package/build/components/sidebar-navigation-screen-global-styles/index.js +103 -13
  177. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  178. package/build/components/sidebar-navigation-screen-navigation-item/index.js +3 -5
  179. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  180. package/build/components/sidebar-navigation-screen-navigation-menu/index.js +7 -10
  181. package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  182. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +17 -23
  183. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  184. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +20 -23
  185. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  186. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +4 -5
  187. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  188. package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +8 -9
  189. package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -1
  190. package/build/components/sidebar-navigation-screen-page/index.js +81 -10
  191. package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
  192. package/build/components/sidebar-navigation-screen-page/page-details.js +148 -0
  193. package/build/components/sidebar-navigation-screen-page/page-details.js.map +1 -0
  194. package/build/components/sidebar-navigation-screen-page/status-label.js +110 -0
  195. package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -0
  196. package/build/components/sidebar-navigation-screen-pages/index.js +128 -17
  197. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  198. package/build/components/sidebar-navigation-screen-template/index.js +22 -16
  199. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  200. package/build/components/sidebar-navigation-screen-template-part/index.js +105 -0
  201. package/build/components/sidebar-navigation-screen-template-part/index.js.map +1 -0
  202. package/build/components/sidebar-navigation-screen-templates/index.js +13 -18
  203. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  204. package/build/components/sidebar-navigation-subtitle/index.js +3 -4
  205. package/build/components/sidebar-navigation-subtitle/index.js.map +1 -1
  206. package/build/components/site-hub/index.js +20 -13
  207. package/build/components/site-hub/index.js.map +1 -1
  208. package/build/components/site-icon/index.js +4 -5
  209. package/build/components/site-icon/index.js.map +1 -1
  210. package/build/components/start-template-options/index.js +15 -21
  211. package/build/components/start-template-options/index.js.map +1 -1
  212. package/build/components/style-book/index.js +35 -39
  213. package/build/components/style-book/index.js.map +1 -1
  214. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +2 -2
  215. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  216. package/build/components/sync-state-with-url/use-sync-path-with-url.js +9 -10
  217. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  218. package/build/components/{list/actions → template-actions}/index.js +34 -31
  219. package/build/components/template-actions/index.js.map +1 -0
  220. package/build/components/{list/actions → template-actions}/rename-menu-item.js +4 -5
  221. package/build/components/template-actions/rename-menu-item.js.map +1 -0
  222. package/build/components/template-part-converter/convert-to-regular.js +4 -5
  223. package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
  224. package/build/components/template-part-converter/convert-to-template-part.js +8 -10
  225. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  226. package/build/components/template-part-converter/index.js +12 -18
  227. package/build/components/template-part-converter/index.js.map +1 -1
  228. package/build/components/welcome-guide/image.js +4 -5
  229. package/build/components/welcome-guide/image.js.map +1 -1
  230. package/build/hooks/commands/use-edit-mode-commands.js +6 -8
  231. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  232. package/build/hooks/push-changes-to-global-styles/index.js +11 -8
  233. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  234. package/build/hooks/template-part-edit.js +5 -6
  235. package/build/hooks/template-part-edit.js.map +1 -1
  236. package/build/index.js +3 -6
  237. package/build/index.js.map +1 -1
  238. package/build/store/actions.js +129 -125
  239. package/build/store/actions.js.map +1 -1
  240. package/build/store/private-actions.js +7 -10
  241. package/build/store/private-actions.js.map +1 -1
  242. package/build/store/reducer.js +32 -33
  243. package/build/store/reducer.js.map +1 -1
  244. package/build/store/selectors.js +35 -11
  245. package/build/store/selectors.js.map +1 -1
  246. package/build/store/utils.js +1 -3
  247. package/build/store/utils.js.map +1 -1
  248. package/build/utils/get-is-list-page.js +3 -4
  249. package/build/utils/get-is-list-page.js.map +1 -1
  250. package/build/utils/is-previewing-theme.js +1 -3
  251. package/build/utils/is-previewing-theme.js.map +1 -1
  252. package/build/utils/is-template-revertable.js +1 -1
  253. package/build/utils/is-template-revertable.js.map +1 -1
  254. package/build-module/components/add-new-page/index.js +93 -0
  255. package/build-module/components/add-new-page/index.js.map +1 -0
  256. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +4 -5
  257. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  258. package/build-module/components/add-new-template/add-custom-template-modal-content.js +19 -22
  259. package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
  260. package/build-module/components/add-new-template/index.js +4 -5
  261. package/build-module/components/add-new-template/index.js.map +1 -1
  262. package/build-module/components/add-new-template/new-template-part.js +9 -12
  263. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  264. package/build-module/components/add-new-template/new-template.js +18 -26
  265. package/build-module/components/add-new-template/new-template.js.map +1 -1
  266. package/build-module/components/add-new-template/utils.js +71 -120
  267. package/build-module/components/add-new-template/utils.js.map +1 -1
  268. package/build-module/components/block-editor/back-button.js +1 -3
  269. package/build-module/components/block-editor/back-button.js.map +1 -1
  270. package/build-module/components/block-editor/block-inspector-button.js +3 -4
  271. package/build-module/components/block-editor/block-inspector-button.js.map +1 -1
  272. package/build-module/components/block-editor/editor-canvas.js +6 -7
  273. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  274. package/build-module/components/block-editor/index.js +12 -10
  275. package/build-module/components/block-editor/index.js.map +1 -1
  276. package/build-module/components/block-editor/inserter-media-categories.js +25 -42
  277. package/build-module/components/block-editor/inserter-media-categories.js.map +1 -1
  278. package/build-module/components/block-editor/resizable-editor.js +6 -7
  279. package/build-module/components/block-editor/resizable-editor.js.map +1 -1
  280. package/build-module/components/block-editor/resize-handle.js +5 -7
  281. package/build-module/components/block-editor/resize-handle.js.map +1 -1
  282. package/build-module/components/code-editor/code-editor-text-area.js +5 -6
  283. package/build-module/components/code-editor/code-editor-text-area.js.map +1 -1
  284. package/build-module/components/create-template-part-modal/index.js +25 -29
  285. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  286. package/build-module/components/editor/index.js +26 -17
  287. package/build-module/components/editor/index.js.map +1 -1
  288. package/build-module/components/editor-canvas-container/index.js +7 -8
  289. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  290. package/build-module/components/error-boundary/warning.js +8 -10
  291. package/build-module/components/error-boundary/warning.js.map +1 -1
  292. package/build-module/components/global-styles/block-preview-panel.js +7 -10
  293. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  294. package/build-module/components/global-styles/color-indicator-wrapper.js +4 -5
  295. package/build-module/components/global-styles/color-indicator-wrapper.js.map +1 -1
  296. package/build-module/components/global-styles/color-palette-panel.js +3 -4
  297. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  298. package/build-module/components/global-styles/dimensions-panel.js +1 -3
  299. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  300. package/build-module/components/global-styles/global-styles-provider.js +8 -10
  301. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  302. package/build-module/components/global-styles/gradients-palette-panel.js +3 -4
  303. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  304. package/build-module/components/global-styles/header.js +4 -5
  305. package/build-module/components/global-styles/header.js.map +1 -1
  306. package/build-module/components/global-styles/icon-with-current-color.js +4 -5
  307. package/build-module/components/global-styles/icon-with-current-color.js.map +1 -1
  308. package/build-module/components/global-styles/navigation-button.js +5 -6
  309. package/build-module/components/global-styles/navigation-button.js.map +1 -1
  310. package/build-module/components/global-styles/palette.js +10 -14
  311. package/build-module/components/global-styles/palette.js.map +1 -1
  312. package/build-module/components/global-styles/preview.js +41 -51
  313. package/build-module/components/global-styles/preview.js.map +1 -1
  314. package/build-module/components/global-styles/screen-block-list.js +4 -7
  315. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  316. package/build-module/components/global-styles/screen-block.js +9 -10
  317. package/build-module/components/global-styles/screen-block.js.map +1 -1
  318. package/build-module/components/global-styles/screen-color-palette.js +3 -4
  319. package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
  320. package/build-module/components/global-styles/screen-revisions/index.js +8 -8
  321. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  322. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +14 -19
  323. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  324. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +5 -10
  325. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  326. package/build-module/components/global-styles/screen-root.js +3 -3
  327. package/build-module/components/global-styles/screen-root.js.map +1 -1
  328. package/build-module/components/global-styles/screen-typography-element.js +3 -4
  329. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  330. package/build-module/components/global-styles/screen-typography.js +5 -6
  331. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  332. package/build-module/components/global-styles/style-variations-container.js +5 -6
  333. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  334. package/build-module/components/global-styles/subtitle.js +4 -5
  335. package/build-module/components/global-styles/subtitle.js.map +1 -1
  336. package/build-module/components/global-styles/typography-panel.js +4 -5
  337. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  338. package/build-module/components/global-styles/typography-preview.js +5 -6
  339. package/build-module/components/global-styles/typography-preview.js.map +1 -1
  340. package/build-module/components/global-styles/ui.js +40 -21
  341. package/build-module/components/global-styles/ui.js.map +1 -1
  342. package/build-module/components/global-styles/variations-panel.js +5 -6
  343. package/build-module/components/global-styles/variations-panel.js.map +1 -1
  344. package/build-module/components/header-edit-mode/document-actions/index.js +102 -24
  345. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  346. package/build-module/components/header-edit-mode/index.js +2 -6
  347. package/build-module/components/header-edit-mode/index.js.map +1 -1
  348. package/build-module/components/header-edit-mode/more-menu/index.js +49 -53
  349. package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
  350. package/build-module/components/header-edit-mode/tools-more-menu-group/index.js +5 -13
  351. package/build-module/components/header-edit-mode/tools-more-menu-group/index.js.map +1 -1
  352. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
  353. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  354. package/build-module/components/keyboard-shortcut-help-modal/index.js +39 -49
  355. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  356. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
  357. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  358. package/build-module/components/layout/index.js +4 -12
  359. package/build-module/components/layout/index.js.map +1 -1
  360. package/build-module/components/list/added-by.js +13 -23
  361. package/build-module/components/list/added-by.js.map +1 -1
  362. package/build-module/components/list/header.js +4 -7
  363. package/build-module/components/list/header.js.map +1 -1
  364. package/build-module/components/list/index.js +2 -4
  365. package/build-module/components/list/index.js.map +1 -1
  366. package/build-module/components/list/table.js +34 -39
  367. package/build-module/components/list/table.js.map +1 -1
  368. package/build-module/components/page-actions/delete-page-menu-item.js +58 -0
  369. package/build-module/components/page-actions/delete-page-menu-item.js.map +1 -0
  370. package/build-module/components/page-actions/index.js +30 -0
  371. package/build-module/components/page-actions/index.js.map +1 -0
  372. package/build-module/components/page-content-lock/constants.js +2 -0
  373. package/build-module/components/page-content-lock/constants.js.map +1 -0
  374. package/build-module/components/page-content-lock/index.js +14 -0
  375. package/build-module/components/page-content-lock/index.js.map +1 -0
  376. package/build-module/components/page-content-lock/use-disable-non-content-blocks.js +36 -0
  377. package/build-module/components/page-content-lock/use-disable-non-content-blocks.js.map +1 -0
  378. package/build-module/components/page-content-lock/use-page-content-lock-notifications.js +98 -0
  379. package/build-module/components/page-content-lock/use-page-content-lock-notifications.js.map +1 -0
  380. package/build-module/components/preferences-modal/index.js +4 -5
  381. package/build-module/components/preferences-modal/index.js.map +1 -1
  382. package/build-module/components/resizable-frame/index.js +20 -12
  383. package/build-module/components/resizable-frame/index.js.map +1 -1
  384. package/build-module/components/revisions/index.js +11 -13
  385. package/build-module/components/revisions/index.js.map +1 -1
  386. package/build-module/components/routes/link.js +8 -12
  387. package/build-module/components/routes/link.js.map +1 -1
  388. package/build-module/components/routes/use-title.js +1 -5
  389. package/build-module/components/routes/use-title.js.map +1 -1
  390. package/build-module/components/save-button/index.js +13 -7
  391. package/build-module/components/save-button/index.js.map +1 -1
  392. package/build-module/components/save-hub/index.js +95 -8
  393. package/build-module/components/save-hub/index.js.map +1 -1
  394. package/build-module/components/save-panel/index.js +62 -19
  395. package/build-module/components/save-panel/index.js.map +1 -1
  396. package/build-module/components/secondary-sidebar/list-view-sidebar.js +9 -3
  397. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  398. package/build-module/components/sidebar/index.js +6 -5
  399. package/build-module/components/sidebar/index.js.map +1 -1
  400. package/build-module/components/sidebar-edit-mode/default-sidebar.js +11 -12
  401. package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
  402. package/build-module/components/sidebar-edit-mode/index.js +14 -11
  403. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  404. package/build-module/components/sidebar-edit-mode/page-panels/content-blocks-list.js +67 -0
  405. package/build-module/components/sidebar-edit-mode/page-panels/content-blocks-list.js.map +1 -0
  406. package/build-module/components/sidebar-edit-mode/page-panels/index.js +67 -0
  407. package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -0
  408. package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js +4 -5
  409. package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
  410. package/build-module/components/sidebar-edit-mode/settings-header/index.js +36 -22
  411. package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
  412. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js +35 -0
  413. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -0
  414. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +3 -4
  415. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -1
  416. package/build-module/components/sidebar-edit-mode/{template-card → template-panel}/index.js +20 -19
  417. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -0
  418. package/build-module/components/sidebar-edit-mode/{template-revisions/index.js → template-panel/last-revision.js} +7 -8
  419. package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js.map +1 -0
  420. package/build-module/components/sidebar-edit-mode/{template-card → template-panel}/template-actions.js +12 -16
  421. package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -0
  422. package/build-module/components/sidebar-edit-mode/{template-card → template-panel}/template-areas.js +15 -19
  423. package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js.map +1 -0
  424. package/build-module/components/sidebar-navigation-item/index.js +7 -8
  425. package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
  426. package/build-module/components/sidebar-navigation-screen/index.js +22 -15
  427. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  428. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +104 -14
  429. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  430. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +3 -5
  431. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  432. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +7 -10
  433. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  434. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +17 -23
  435. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  436. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +20 -23
  437. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  438. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +4 -5
  439. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  440. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +8 -9
  441. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -1
  442. package/build-module/components/sidebar-navigation-screen-page/index.js +79 -14
  443. package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
  444. package/build-module/components/sidebar-navigation-screen-page/page-details.js +131 -0
  445. package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +1 -0
  446. package/build-module/components/sidebar-navigation-screen-page/status-label.js +97 -0
  447. package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -0
  448. package/build-module/components/sidebar-navigation-screen-pages/index.js +125 -19
  449. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  450. package/build-module/components/sidebar-navigation-screen-template/index.js +22 -17
  451. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  452. package/build-module/components/sidebar-navigation-screen-template-part/index.js +86 -0
  453. package/build-module/components/sidebar-navigation-screen-template-part/index.js.map +1 -0
  454. package/build-module/components/sidebar-navigation-screen-templates/index.js +13 -18
  455. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  456. package/build-module/components/sidebar-navigation-subtitle/index.js +3 -4
  457. package/build-module/components/sidebar-navigation-subtitle/index.js.map +1 -1
  458. package/build-module/components/site-hub/index.js +21 -14
  459. package/build-module/components/site-hub/index.js.map +1 -1
  460. package/build-module/components/site-icon/index.js +4 -5
  461. package/build-module/components/site-icon/index.js.map +1 -1
  462. package/build-module/components/start-template-options/index.js +15 -21
  463. package/build-module/components/start-template-options/index.js.map +1 -1
  464. package/build-module/components/style-book/index.js +35 -39
  465. package/build-module/components/style-book/index.js.map +1 -1
  466. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +2 -2
  467. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  468. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +9 -10
  469. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  470. package/build-module/components/{list/actions → template-actions}/index.js +34 -31
  471. package/build-module/components/template-actions/index.js.map +1 -0
  472. package/build-module/components/{list/actions → template-actions}/rename-menu-item.js +4 -5
  473. package/build-module/components/template-actions/rename-menu-item.js.map +1 -0
  474. package/build-module/components/template-part-converter/convert-to-regular.js +4 -5
  475. package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
  476. package/build-module/components/template-part-converter/convert-to-template-part.js +8 -10
  477. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  478. package/build-module/components/template-part-converter/index.js +12 -18
  479. package/build-module/components/template-part-converter/index.js.map +1 -1
  480. package/build-module/components/welcome-guide/image.js +4 -5
  481. package/build-module/components/welcome-guide/image.js.map +1 -1
  482. package/build-module/hooks/commands/use-edit-mode-commands.js +6 -8
  483. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  484. package/build-module/hooks/push-changes-to-global-styles/index.js +11 -8
  485. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  486. package/build-module/hooks/template-part-edit.js +5 -6
  487. package/build-module/hooks/template-part-edit.js.map +1 -1
  488. package/build-module/index.js +3 -6
  489. package/build-module/index.js.map +1 -1
  490. package/build-module/store/actions.js +125 -126
  491. package/build-module/store/actions.js.map +1 -1
  492. package/build-module/store/private-actions.js +7 -10
  493. package/build-module/store/private-actions.js.map +1 -1
  494. package/build-module/store/reducer.js +30 -33
  495. package/build-module/store/reducer.js.map +1 -1
  496. package/build-module/store/selectors.js +31 -11
  497. package/build-module/store/selectors.js.map +1 -1
  498. package/build-module/store/utils.js +1 -3
  499. package/build-module/store/utils.js.map +1 -1
  500. package/build-module/utils/get-is-list-page.js +3 -4
  501. package/build-module/utils/get-is-list-page.js.map +1 -1
  502. package/build-module/utils/is-previewing-theme.js +1 -3
  503. package/build-module/utils/is-previewing-theme.js.map +1 -1
  504. package/build-module/utils/is-template-revertable.js +1 -1
  505. package/build-module/utils/is-template-revertable.js.map +1 -1
  506. package/build-style/style-rtl.css +281 -59
  507. package/build-style/style.css +281 -59
  508. package/package.json +39 -36
  509. package/src/components/add-new-page/index.js +105 -0
  510. package/src/components/add-new-template/new-template.js +2 -1
  511. package/src/components/block-editor/index.js +25 -14
  512. package/src/components/editor/index.js +14 -8
  513. package/src/components/editor/style.scss +6 -11
  514. package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +7 -5
  515. package/src/components/global-styles/ui.js +28 -0
  516. package/src/components/header-edit-mode/document-actions/index.js +126 -32
  517. package/src/components/header-edit-mode/document-actions/style.scss +64 -9
  518. package/src/components/header-edit-mode/tools-more-menu-group/index.js +1 -6
  519. package/src/components/layout/index.js +3 -9
  520. package/src/components/list/table.js +6 -2
  521. package/src/components/page-actions/delete-page-menu-item.js +71 -0
  522. package/src/components/page-actions/index.js +36 -0
  523. package/src/components/page-content-lock/constants.js +5 -0
  524. package/src/components/page-content-lock/index.js +14 -0
  525. package/src/components/page-content-lock/use-disable-non-content-blocks.js +44 -0
  526. package/src/components/page-content-lock/use-page-content-lock-notifications.js +128 -0
  527. package/src/components/resizable-frame/index.js +15 -5
  528. package/src/components/resizable-frame/style.scss +20 -18
  529. package/src/components/revisions/index.js +6 -7
  530. package/src/components/save-button/index.js +6 -0
  531. package/src/components/save-hub/index.js +143 -38
  532. package/src/components/save-hub/style.scss +6 -0
  533. package/src/components/save-panel/index.js +62 -15
  534. package/src/components/secondary-sidebar/list-view-sidebar.js +8 -1
  535. package/src/components/sidebar/index.js +6 -4
  536. package/src/components/sidebar/style.scss +3 -4
  537. package/src/components/sidebar-edit-mode/index.js +16 -14
  538. package/src/components/sidebar-edit-mode/page-panels/content-blocks-list.js +77 -0
  539. package/src/components/sidebar-edit-mode/page-panels/index.js +89 -0
  540. package/src/components/sidebar-edit-mode/page-panels/style.scss +10 -0
  541. package/src/components/sidebar-edit-mode/settings-header/index.js +51 -28
  542. package/src/components/sidebar-edit-mode/sidebar-card/index.js +34 -0
  543. package/src/components/sidebar-edit-mode/sidebar-card/style.scss +34 -0
  544. package/src/components/sidebar-edit-mode/{template-card → template-panel}/index.js +22 -19
  545. package/src/components/sidebar-edit-mode/{template-card → template-panel}/style.scss +2 -32
  546. package/src/components/sidebar-navigation-screen/index.js +74 -50
  547. package/src/components/sidebar-navigation-screen/style.scss +45 -4
  548. package/src/components/sidebar-navigation-screen-global-styles/index.js +118 -12
  549. package/src/components/sidebar-navigation-screen-global-styles/style.scss +15 -0
  550. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +1 -1
  551. package/src/components/sidebar-navigation-screen-page/index.js +137 -24
  552. package/src/components/sidebar-navigation-screen-page/page-details.js +163 -0
  553. package/src/components/sidebar-navigation-screen-page/status-label.js +101 -0
  554. package/src/components/sidebar-navigation-screen-page/style.scss +80 -0
  555. package/src/components/sidebar-navigation-screen-pages/index.js +180 -44
  556. package/src/components/sidebar-navigation-screen-template/index.js +25 -22
  557. package/src/components/sidebar-navigation-screen-template-part/index.js +103 -0
  558. package/src/components/sidebar-navigation-screen-templates/index.js +1 -1
  559. package/src/components/sidebar-navigation-subtitle/style.scss +2 -2
  560. package/src/components/site-hub/index.js +21 -6
  561. package/src/components/site-hub/style.scss +26 -0
  562. package/src/components/{list/actions → template-actions}/index.js +19 -6
  563. package/src/hooks/push-changes-to-global-styles/index.js +13 -7
  564. package/src/store/actions.js +20 -1
  565. package/src/store/reducer.js +20 -0
  566. package/src/store/selectors.js +24 -0
  567. package/src/store/test/actions.js +31 -0
  568. package/src/store/test/reducer.js +44 -0
  569. package/src/store/test/selectors.js +57 -0
  570. package/src/style.scss +5 -2
  571. package/src/utils/is-previewing-theme.js +1 -4
  572. package/build/components/list/actions/index.js.map +0 -1
  573. package/build/components/list/actions/rename-menu-item.js.map +0 -1
  574. package/build/components/sidebar-edit-mode/template-card/index.js.map +0 -1
  575. package/build/components/sidebar-edit-mode/template-card/template-actions.js.map +0 -1
  576. package/build/components/sidebar-edit-mode/template-card/template-areas.js.map +0 -1
  577. package/build/components/sidebar-edit-mode/template-revisions/index.js.map +0 -1
  578. package/build-module/components/list/actions/index.js.map +0 -1
  579. package/build-module/components/list/actions/rename-menu-item.js.map +0 -1
  580. package/build-module/components/sidebar-edit-mode/template-card/index.js.map +0 -1
  581. package/build-module/components/sidebar-edit-mode/template-card/template-actions.js.map +0 -1
  582. package/build-module/components/sidebar-edit-mode/template-card/template-areas.js.map +0 -1
  583. package/src/components/sidebar-navigation-screen-pages/style.scss +0 -4
  584. /package/src/components/sidebar-edit-mode/{template-revisions/index.js → template-panel/last-revision.js} +0 -0
  585. /package/src/components/sidebar-edit-mode/{template-card → template-panel}/template-actions.js +0 -0
  586. /package/src/components/sidebar-edit-mode/{template-card → template-panel}/template-areas.js +0 -0
  587. /package/src/components/{list/actions → template-actions}/rename-menu-item.js +0 -0
@@ -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,gCAA9B;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,MACLhB,WAAW,CAAEE,cAAF,CADZ;AAGA,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-edit-mode/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 } =\n\t\tuseDispatch( interfaceStore );\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,gCAA9B;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,MACLhB,WAAW,CAAEE,cAAF,CADZ;AAGA,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-edit-mode/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 } =\n\t\tuseDispatch( interfaceStore );\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"]}
@@ -21,13 +21,12 @@ import { __ } from '@wordpress/i18n';
21
21
  import { unlock } from '../../private-apis';
22
22
  import { store as editSiteStore } from '../../store';
23
23
 
24
- function EditorCanvas(_ref) {
25
- let {
26
- enableResizing,
27
- settings,
28
- children,
29
- ...props
30
- } = _ref;
24
+ function EditorCanvas({
25
+ enableResizing,
26
+ settings,
27
+ children,
28
+ ...props
29
+ }) {
31
30
  const {
32
31
  canvasMode,
33
32
  deviceType,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/editor-canvas.js"],"names":["classnames","__experimentalUseResizeCanvas","useResizeCanvas","__unstableEditorStyles","EditorStyles","__unstableIframe","Iframe","__unstableUseMouseMoveTypingReset","useMouseMoveTypingReset","store","blockEditorStore","useSelect","useDispatch","ENTER","SPACE","useState","useEffect","__","unlock","editSiteStore","EditorCanvas","enableResizing","settings","children","props","canvasMode","deviceType","isZoomOutMode","select","__experimentalGetPreviewDeviceType","__unstableGetEditorMode","getCanvasMode","setCanvasMode","deviceStyles","mouseMoveTypingRef","isFocused","setIsFocused","viewModeProps","role","tabIndex","onFocus","onBlur","onKeyDown","event","keyCode","preventDefault","onClick","readonly","undefined","styles"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;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,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAT,EAAgBC,KAAhB,QAA6B,qBAA7B;AACA,SAASC,QAAT,EAAmBC,SAAnB,QAAoC,oBAApC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAAST,KAAK,IAAIU,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,UAAd;AAA0BC,IAAAA;AAA1B,MAA4ChB,SAAS,CACxDiB,MAAF,KAAgB;AACfF,IAAAA,UAAU,EACTE,MAAM,CAAET,aAAF,CAAN,CAAwBU,kCAAxB,EAFc;AAGfF,IAAAA,aAAa,EACZC,MAAM,CAAElB,gBAAF,CAAN,CAA2BoB,uBAA3B,OACA,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Aa,IAAI,IAAnB,IAA6BqB,SAFtC;AAGC,IAAA,SAAS,EAAGrB,aAAa,GAAG,GAAH,GAASqB,SAHnC;AAIC,IAAA,KAAK,EAAG3B,cAAc,GAAG,EAAH,GAAQY,YAJ/B;AAKC,IAAA,GAAG,EAAGC,kBALP;AAMC,IAAA,IAAI,EAAC,eANN;AAOC,IAAA,SAAS,EAAGlC,UAAU,CAAE,wCAAF,EAA4C;AACjE,oBAAcmC,SAAS,IAAIV,UAAU,KAAK;AADuB,KAA5C;AAPvB,KAUMD,KAVN,EAWQC,UAAU,KAAK,MAAf,GAAwBY,aAAxB,GAAwC,EAXhD,GAaC,cAAC,YAAD;AAAc,IAAA,MAAM,EAAGf,QAAQ,CAAC2B;AAAhC,IAbD,EAcC,6BACC;AACA;AACC,0CACA;AACA;AACA5B,EAAAA,cAAc,GAAG,yBAAH,GAA+B,EAC7C,4BACAI,UAAU,KAAK,MAAf,GAAwB,kBAAxB,GAA6C,EAC7C,IATF,CAdD,EAyBGF,QAzBH,CADD;AA6BA;;AAED,eAAeH,YAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\nimport { useState, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\nfunction EditorCanvas( { enableResizing, settings, children, ...props } ) {\n\tconst { canvasMode, deviceType, isZoomOutMode } = useSelect(\n\t\t( select ) => ( {\n\t\t\tdeviceType:\n\t\t\t\tselect( editSiteStore ).__experimentalGetPreviewDeviceType(),\n\t\t\tisZoomOutMode:\n\t\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() ===\n\t\t\t\t'zoom-out',\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst mouseMoveTypingRef = useMouseMoveTypingReset();\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( canvasMode === 'edit' ) {\n\t\t\tsetIsFocused( false );\n\t\t}\n\t}, [ canvasMode ] );\n\n\tconst viewModeProps = {\n\t\t'aria-label': __( 'Editor Canvas' ),\n\t\trole: 'button',\n\t\ttabIndex: 0,\n\t\tonFocus: () => setIsFocused( true ),\n\t\tonBlur: () => setIsFocused( false ),\n\t\tonKeyDown: ( event ) => {\n\t\t\tconst { keyCode } = event;\n\t\t\tif ( keyCode === ENTER || keyCode === SPACE ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t}\n\t\t},\n\t\tonClick: () => setCanvasMode( 'edit' ),\n\t\treadonly: true,\n\t};\n\n\treturn (\n\t\t<Iframe\n\t\t\texpand={ isZoomOutMode }\n\t\t\tscale={ ( isZoomOutMode && 0.45 ) || undefined }\n\t\t\tframeSize={ isZoomOutMode ? 100 : undefined }\n\t\t\tstyle={ enableResizing ? {} : deviceStyles }\n\t\t\tref={ mouseMoveTypingRef }\n\t\t\tname=\"editor-canvas\"\n\t\t\tclassName={ classnames( 'edit-site-visual-editor__editor-canvas', {\n\t\t\t\t'is-focused': isFocused && canvasMode === 'view',\n\t\t\t} ) }\n\t\t\t{ ...props }\n\t\t\t{ ...( canvasMode === 'view' ? viewModeProps : {} ) }\n\t\t>\n\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t<style>{\n\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t`.is-root-container{display:flow-root;${\n\t\t\t\t\t// Some themes will have `min-height: 100vh` for the root container,\n\t\t\t\t\t// which isn't a requirement in auto resize mode.\n\t\t\t\t\tenableResizing ? 'min-height:0!important;' : ''\n\t\t\t\t}}body{position:relative; ${\n\t\t\t\t\tcanvasMode === 'view' ? 'cursor: pointer;' : ''\n\t\t\t\t}}}`\n\t\t\t}</style>\n\t\t\t{ children }\n\t\t</Iframe>\n\t);\n}\n\nexport default EditorCanvas;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/editor-canvas.js"],"names":["classnames","__experimentalUseResizeCanvas","useResizeCanvas","__unstableEditorStyles","EditorStyles","__unstableIframe","Iframe","__unstableUseMouseMoveTypingReset","useMouseMoveTypingReset","store","blockEditorStore","useSelect","useDispatch","ENTER","SPACE","useState","useEffect","__","unlock","editSiteStore","EditorCanvas","enableResizing","settings","children","props","canvasMode","deviceType","isZoomOutMode","select","__experimentalGetPreviewDeviceType","__unstableGetEditorMode","getCanvasMode","setCanvasMode","deviceStyles","mouseMoveTypingRef","isFocused","setIsFocused","viewModeProps","role","tabIndex","onFocus","onBlur","onKeyDown","event","keyCode","preventDefault","onClick","readonly","undefined","styles"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;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,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAT,EAAgBC,KAAhB,QAA6B,qBAA7B;AACA,SAASC,QAAT,EAAmBC,SAAnB,QAAoC,oBAApC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AA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BK,IAAAA,MAAM,EAAE,MAAML,YAAY,CAAE,KAAF,CALL;AAMrBM,IAAAA,SAAS,EAAIC,KAAF,IAAa;AACvB,YAAM;AAAEC,QAAAA;AAAF,UAAcD,KAApB;;AACA,UAAKC,OAAO,KAAK/B,KAAZ,IAAqB+B,OAAO,KAAK9B,KAAtC,EAA8C;AAC7C6B,QAAAA,KAAK,CAACE,cAAN;AACAb,QAAAA,aAAa,CAAE,MAAF,CAAb;AACA;AACD,KAZoB;AAarBc,IAAAA,OAAO,EAAE,MAAMd,aAAa,CAAE,MAAF,CAbP;AAcrBe,IAAAA,QAAQ,EAAE;AAdW,GAAtB;AAiBA,SACC,cAAC,MAAD;AACC,IAAA,MAAM,EAAGpB,aADV;AAEC,IAAA,KAAK,EAAKA,aAAa,IAAI,IAAnB,IAA6BqB,SAFtC;AAGC,IAAA,SAAS,EAAGrB,aAAa,GAAG,GAAH,GAASqB,SAHnC;AAIC,IAAA,KAAK,EAAG3B,cAAc,GAAG,EAAH,GAAQY,YAJ/B;AAKC,IAAA,GAAG,EAAGC,kBALP;AAMC,IAAA,IAAI,EAAC,eANN;AAOC,IAAA,SAAS,EAAGlC,UAAU,CAAE,wCAAF,EAA4C;AACjE,oBAAcmC,SAAS,IAAIV,UAAU,KAAK;AADuB,KAA5C;AAPvB,KAUMD,KAVN,EAWQC,UAAU,KAAK,MAAf,GAAwBY,aAAxB,GAAwC,EAXhD,GAaC,cAAC,YAAD;AAAc,IAAA,MAAM,EAAGf,QAAQ,CAAC2B;AAAhC,IAbD,EAcC,6BACC;AACA;AACC,0CACA;AACA;AACA5B,EAAAA,cAAc,GAAG,yBAAH,GAA+B,EAC7C,4BACAI,UAAU,KAAK,MAAf,GAAwB,kBAAxB,GAA6C,EAC7C,IATF,CAdD,EAyBGF,QAzBH,CADD;AA6BA;;AAED,eAAeH,YAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\nimport { useState, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\nfunction EditorCanvas( { enableResizing, settings, children, ...props } ) {\n\tconst { canvasMode, deviceType, isZoomOutMode } = useSelect(\n\t\t( select ) => ( {\n\t\t\tdeviceType:\n\t\t\t\tselect( editSiteStore ).__experimentalGetPreviewDeviceType(),\n\t\t\tisZoomOutMode:\n\t\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() ===\n\t\t\t\t'zoom-out',\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst mouseMoveTypingRef = useMouseMoveTypingReset();\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( canvasMode === 'edit' ) {\n\t\t\tsetIsFocused( false );\n\t\t}\n\t}, [ canvasMode ] );\n\n\tconst viewModeProps = {\n\t\t'aria-label': __( 'Editor Canvas' ),\n\t\trole: 'button',\n\t\ttabIndex: 0,\n\t\tonFocus: () => setIsFocused( true ),\n\t\tonBlur: () => setIsFocused( false ),\n\t\tonKeyDown: ( event ) => {\n\t\t\tconst { keyCode } = event;\n\t\t\tif ( keyCode === ENTER || keyCode === SPACE ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t}\n\t\t},\n\t\tonClick: () => setCanvasMode( 'edit' ),\n\t\treadonly: true,\n\t};\n\n\treturn (\n\t\t<Iframe\n\t\t\texpand={ isZoomOutMode }\n\t\t\tscale={ ( isZoomOutMode && 0.45 ) || undefined }\n\t\t\tframeSize={ isZoomOutMode ? 100 : undefined }\n\t\t\tstyle={ enableResizing ? {} : deviceStyles }\n\t\t\tref={ mouseMoveTypingRef }\n\t\t\tname=\"editor-canvas\"\n\t\t\tclassName={ classnames( 'edit-site-visual-editor__editor-canvas', {\n\t\t\t\t'is-focused': isFocused && canvasMode === 'view',\n\t\t\t} ) }\n\t\t\t{ ...props }\n\t\t\t{ ...( canvasMode === 'view' ? viewModeProps : {} ) }\n\t\t>\n\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t<style>{\n\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t`.is-root-container{display:flow-root;${\n\t\t\t\t\t// Some themes will have `min-height: 100vh` for the root container,\n\t\t\t\t\t// which isn't a requirement in auto resize mode.\n\t\t\t\t\tenableResizing ? 'min-height:0!important;' : ''\n\t\t\t\t}}body{position:relative; ${\n\t\t\t\t\tcanvasMode === 'view' ? 'cursor: pointer;' : ''\n\t\t\t\t}}}`\n\t\t\t}</style>\n\t\t\t{ children }\n\t\t</Iframe>\n\t);\n}\n\nexport default EditorCanvas;\n"]}
@@ -27,6 +27,7 @@ import ResizableEditor from './resizable-editor';
27
27
  import EditorCanvas from './editor-canvas';
28
28
  import { unlock } from '../../private-apis';
29
29
  import EditorCanvasContainer from '../editor-canvas-container';
30
+ import { PageContentLock, usePageContentLockNotifications } from '../page-content-lock';
30
31
  const {
31
32
  ExperimentalBlockEditorProvider
32
33
  } = unlock(blockEditorPrivateApis);
@@ -44,17 +45,20 @@ export default function BlockEditor() {
44
45
  const {
45
46
  storedSettings,
46
47
  templateType,
47
- canvasMode
48
+ canvasMode,
49
+ hasPageContentLock
48
50
  } = useSelect(select => {
49
51
  const {
50
52
  getSettings,
51
53
  getEditedPostType,
52
- getCanvasMode
54
+ getCanvasMode,
55
+ hasPageContentLock: _hasPageContentLock
53
56
  } = unlock(select(editSiteStore));
54
57
  return {
55
58
  storedSettings: getSettings(setIsInserterOpened),
56
59
  templateType: getEditedPostType(),
57
- canvasMode: getCanvasMode()
60
+ canvasMode: getCanvasMode(),
61
+ hasPageContentLock: _hasPageContentLock()
58
62
  };
59
63
  }, [setIsInserterOpened]);
60
64
  const settingsBlockPatterns = (_storedSettings$__exp = storedSettings.__experimentalAdditionalBlockPatterns) !== null && _storedSettings$__exp !== void 0 ? _storedSettings$__exp : // WP 6.0
@@ -70,10 +74,9 @@ export default function BlockEditor() {
70
74
  restBlockPatterns: select(coreStore).getBlockPatterns(),
71
75
  restBlockPatternCategories: select(coreStore).getBlockPatternCategories()
72
76
  }), []);
73
- const blockPatterns = useMemo(() => [...(settingsBlockPatterns || []), ...(restBlockPatterns || [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)).filter(_ref => {
74
- let {
75
- postTypes
76
- } = _ref;
77
+ const blockPatterns = useMemo(() => [...(settingsBlockPatterns || []), ...(restBlockPatterns || [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)).filter(({
78
+ postTypes
79
+ }) => {
77
80
  return !postTypes || Array.isArray(postTypes) && postTypes.includes(templateType);
78
81
  }), [settingsBlockPatterns, restBlockPatterns, templateType]);
79
82
  const blockPatternCategories = useMemo(() => [...(settingsBlockPatternCategories || []), ...(restBlockPatternCategories || [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)), [settingsBlockPatternCategories, restBlockPatternCategories]);
@@ -91,7 +94,7 @@ export default function BlockEditor() {
91
94
  }, [storedSettings, blockPatterns, blockPatternCategories]);
92
95
  const [blocks, onInput, onChange] = useEntityBlockEditor('postType', templateType);
93
96
  const contentRef = useRef();
94
- const mergedRefs = useMergeRefs([contentRef, useClipboardHandler(), useTypingObserver()]);
97
+ const mergedRefs = useMergeRefs([contentRef, useClipboardHandler(), useTypingObserver(), usePageContentLockNotifications()]);
95
98
  const isMobileViewport = useViewportMatch('small', '<');
96
99
  const {
97
100
  clearSelectedBlock
@@ -109,10 +112,9 @@ export default function BlockEditor() {
109
112
  onInput: onInput,
110
113
  onChange: onChange,
111
114
  useSubRegistry: false
112
- }, createElement(TemplatePartConverter, null), createElement(SidebarInspectorFill, null, createElement(BlockInspector, null)), createElement(EditorCanvasContainer.Slot, null, _ref2 => {
115
+ }, hasPageContentLock && createElement(PageContentLock, null), createElement(TemplatePartConverter, null), createElement(SidebarInspectorFill, null, createElement(BlockInspector, null)), createElement(EditorCanvasContainer.Slot, null, ([editorCanvasView]) => {
113
116
  var _sizes$height;
114
117
 
115
- let [editorCanvasView] = _ref2;
116
118
  return editorCanvasView ? createElement("div", {
117
119
  className: "edit-site-visual-editor is-focus-mode"
118
120
  }, editorCanvasView) : createElement(BlockTools, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["classnames","useSelect","useDispatch","useMemo","useRef","useEntityBlockEditor","store","coreStore","BlockList","BlockInspector","BlockTools","__unstableUseClipboardHandler","useClipboardHandler","__unstableUseTypingObserver","useTypingObserver","BlockEditorKeyboardShortcuts","blockEditorStore","privateApis","blockEditorPrivateApis","useMergeRefs","useViewportMatch","useResizeObserver","ReusableBlocksMenuItems","inserterMediaCategories","TemplatePartConverter","SidebarInspectorFill","editSiteStore","BackButton","ResizableEditor","EditorCanvas","unlock","EditorCanvasContainer","ExperimentalBlockEditorProvider","LAYOUT","type","alignments","BlockEditor","setIsInserterOpened","storedSettings","templateType","canvasMode","select","getSettings","getEditedPostType","getCanvasMode","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","blocks","onInput","onChange","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","resizeObserver","sizes","isTemplatePart","hasBlocks","length","enableResizing","isViewMode","showBlockAppender","undefined","editorCanvasView","event","target","currentTarget","height"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,OAAT,EAAkBC,MAAlB,QAAgC,oBAAhC;AACA,SAASC,oBAAT,EAA+BC,KAAK,IAAIC,SAAxC,QAAyD,sBAAzD;AACA,SACCC,SADD,EAECC,cAFD,EAGCC,UAHD,EAICC,6BAA6B,IAAIC,mBAJlC,EAKCC,2BAA2B,IAAIC,iBALhC,EAMCC,4BAND,EAOCT,KAAK,IAAIU,gBAPV,EAQCC,WAAW,IAAIC,sBARhB,QASO,yBATP;AAUA,SACCC,YADD,EAECC,gBAFD,EAGCC,iBAHD,QAIO,oBAJP;AAKA,SAASC,uBAAT,QAAwC,4BAAxC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,6BAApC;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,SAASC,oBAAT,QAAqC,sBAArC;AACA,SAASnB,KAAK,IAAIoB,aAAlB,QAAuC,aAAvC;AACA,OAAOC,UAAP,MAAuB,eAAvB;AACA,OAAOC,eAAP,MAA4B,oBAA5B;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAsCF,MAAM,CAAEZ,sBAAF,CAAlD;AAEA,MAAMe,MAAM,GAAG;AACdC,EAAAA,IAAI,EAAE,SADQ;AAEd;AACAC,EAAAA,UAAU,EAAE;AAHE,CAAf;AAMA,eAAe,SAASC,WAAT,GAAuB;AAAA;;AACrC,QAAM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,OAAO,EAAKc,KAAF,IAAa;AACtB;AACA,YAAKA,KAAK,CAACC,MAAN,KAAiBD,KAAK,CAACE,aAA5B,EAA4C;AAC3Cb,UAAAA,kBAAkB;AAClB;AACD;AAZF,OAcC,cAAC,4BAAD,CAA8B,QAA9B,OAdD,EAeC,cAAC,UAAD,OAfD,EAgBC,cAAC,eAAD;AACC,MAAA,cAAc,EAAGM,cADlB;AAEC,MAAA,MAAM,mBAAGJ,KAAK,CAACY,MAAT,yDAAmB;AAF1B,OAIC,cAAC,YAAD;AACC,MAAA,cAAc,EAAGR,cADlB;AAEC,MAAA,QAAQ,EAAGd,QAFZ;AAGC,MAAA,UAAU,EAAGM,UAHd;AAIC,MAAA,QAAQ,EAAGlC,UAAU,KAAK;AAJ3B,OAMGqC,cANH,EAOC,cAAC,SAAD;AACC,MAAA,SAAS,EAAC,mDADX;AAEC,MAAA,oBAAoB,EAAG5C,MAFxB;AAGC,MAAA,cAAc,EAAGmD;AAHlB,MAPD,CAJD,CAhBD,CANA;AAAA,GADH,CAXD,EAwDC,cAAC,uBAAD,OAxDD,CADD;AA4DA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo, useRef } from '@wordpress/element';\nimport { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data';\nimport {\n\tBlockList,\n\tBlockInspector,\n\tBlockTools,\n\t__unstableUseClipboardHandler as useClipboardHandler,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tBlockEditorKeyboardShortcuts,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tuseMergeRefs,\n\tuseViewportMatch,\n\tuseResizeObserver,\n} from '@wordpress/compose';\nimport { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';\n\n/**\n * Internal dependencies\n */\nimport inserterMediaCategories from './inserter-media-categories';\nimport TemplatePartConverter from '../template-part-converter';\nimport { SidebarInspectorFill } from '../sidebar-edit-mode';\nimport { store as editSiteStore } from '../../store';\nimport BackButton from './back-button';\nimport ResizableEditor from './resizable-editor';\nimport EditorCanvas from './editor-canvas';\nimport { unlock } from '../../private-apis';\nimport EditorCanvasContainer from '../editor-canvas-container';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\n\nconst LAYOUT = {\n\ttype: 'default',\n\t// At the root level of the site editor, no alignments should be allowed.\n\talignments: [],\n};\n\nexport default function BlockEditor() {\n\tconst { setIsInserterOpened } = useDispatch( editSiteStore );\n\tconst { storedSettings, templateType, canvasMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, getEditedPostType, getCanvasMode } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tstoredSettings: getSettings( setIsInserterOpened ),\n\t\t\t\ttemplateType: getEditedPostType(),\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t};\n\t\t},\n\t\t[ setIsInserterOpened ]\n\t);\n\n\tconst settingsBlockPatterns =\n\t\tstoredSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tstoredSettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories:\n\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( templateType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, templateType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst settings = useMemo( () => {\n\t\tconst {\n\t\t\t__experimentalAdditionalBlockPatterns,\n\t\t\t__experimentalAdditionalBlockPatternCategories,\n\t\t\t...restStoredSettings\n\t\t} = storedSettings;\n\n\t\treturn {\n\t\t\t...restStoredSettings,\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t};\n\t}, [ storedSettings, blockPatterns, blockPatternCategories ] );\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplateType\n\t);\n\n\tconst contentRef = useRef();\n\tconst mergedRefs = useMergeRefs( [\n\t\tcontentRef,\n\t\tuseClipboardHandler(),\n\t\tuseTypingObserver(),\n\t] );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\n\tconst isTemplatePart = templateType === 'wp_template_part';\n\n\tconst hasBlocks = blocks.length !== 0;\n\tconst enableResizing =\n\t\tisTemplatePart &&\n\t\tcanvasMode !== 'view' &&\n\t\t// Disable resizing in mobile viewport.\n\t\t! isMobileViewport;\n\tconst isViewMode = canvasMode === 'view';\n\tconst showBlockAppender =\n\t\t( isTemplatePart && hasBlocks ) || isViewMode ? false : undefined;\n\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tsettings={ settings }\n\t\t\tvalue={ blocks }\n\t\t\tonInput={ onInput }\n\t\t\tonChange={ onChange }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t<TemplatePartConverter />\n\t\t\t<SidebarInspectorFill>\n\t\t\t\t<BlockInspector />\n\t\t\t</SidebarInspectorFill>\n\t\t\t<EditorCanvasContainer.Slot>\n\t\t\t\t{ ( [ editorCanvasView ] ) =>\n\t\t\t\t\teditorCanvasView ? (\n\t\t\t\t\t\t<div className=\"edit-site-visual-editor is-focus-mode\">\n\t\t\t\t\t\t\t{ editorCanvasView }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<BlockTools\n\t\t\t\t\t\t\tclassName={ classnames( 'edit-site-visual-editor', {\n\t\t\t\t\t\t\t\t'is-focus-mode':\n\t\t\t\t\t\t\t\t\tisTemplatePart || !! editorCanvasView,\n\t\t\t\t\t\t\t\t'is-view-mode': isViewMode,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t__unstableContentRef={ contentRef }\n\t\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\t\t// Clear selected block when clicking on the gray background.\n\t\t\t\t\t\t\t\tif ( event.target === event.currentTarget ) {\n\t\t\t\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t\t\t\t\t<BackButton />\n\t\t\t\t\t\t\t<ResizableEditor\n\t\t\t\t\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\t\t\t\t\theight={ sizes.height ?? '100%' }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<EditorCanvas\n\t\t\t\t\t\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\t\tcontentRef={ mergedRefs }\n\t\t\t\t\t\t\t\t\treadonly={ canvasMode === 'view' }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ resizeObserver }\n\t\t\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-block-editor__block-list wp-site-blocks\"\n\t\t\t\t\t\t\t\t\t\t__experimentalLayout={ LAYOUT }\n\t\t\t\t\t\t\t\t\t\trenderAppender={ showBlockAppender }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</EditorCanvas>\n\t\t\t\t\t\t\t</ResizableEditor>\n\t\t\t\t\t\t</BlockTools>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t</EditorCanvasContainer.Slot>\n\t\t\t<ReusableBlocksMenuItems />\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["classnames","useSelect","useDispatch","useMemo","useRef","useEntityBlockEditor","store","coreStore","BlockList","BlockInspector","BlockTools","__unstableUseClipboardHandler","useClipboardHandler","__unstableUseTypingObserver","useTypingObserver","BlockEditorKeyboardShortcuts","blockEditorStore","privateApis","blockEditorPrivateApis","useMergeRefs","useViewportMatch","useResizeObserver","ReusableBlocksMenuItems","inserterMediaCategories","TemplatePartConverter","SidebarInspectorFill","editSiteStore","BackButton","ResizableEditor","EditorCanvas","unlock","EditorCanvasContainer","PageContentLock","usePageContentLockNotifications","ExperimentalBlockEditorProvider","LAYOUT","type","alignments","BlockEditor","setIsInserterOpened","storedSettings","templateType","canvasMode","hasPageContentLock","select","getSettings","getEditedPostType","getCanvasMode","_hasPageContentLock","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","blocks","onInput","onChange","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","resizeObserver","sizes","isTemplatePart","hasBlocks","length","enableResizing","isViewMode","showBlockAppender","undefined","editorCanvasView","event","target","currentTarget","height"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,OAAT,EAAkBC,MAAlB,QAAgC,oBAAhC;AACA,SAASC,oBAAT,EAA+BC,KAAK,IAAIC,SAAxC,QAAyD,sBAAzD;AACA,SACCC,SADD,EAECC,cAFD,EAGCC,UAHD,EAICC,6BAA6B,IAAIC,mBAJlC,EAKCC,2BAA2B,IAAIC,iBALhC,EAMCC,4BAND,EAOCT,KAAK,IAAIU,gBAPV,EAQCC,WAAW,IAAIC,sBARhB,QASO,yBATP;AAUA,SACCC,YADD,EAECC,gBAFD,EAGCC,iBAHD,QAIO,oBAJP;AAKA,SAASC,uBAAT,QAAwC,4BAAxC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,6BAApC;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,SAASC,oBAAT,QAAqC,sBAArC;AACA,SAASnB,KAAK,IAAIoB,aAAlB,QAAuC,aAAvC;AACA,OAAOC,UAAP,MAAuB,eAAvB;AACA,OAAOC,eAAP,MAA4B,oBAA5B;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,SACCC,eADD,EAECC,+BA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BAAD,QACC,cAAC,cAAD,OADD,CATD,EAYC,cAAC,qBAAD,CAAuB,IAAvB,QACG,CAAE,CAAE+C,gBAAF,CAAF;AAAA;;AAAA,WACDA,gBAAgB,GACf;AAAK,MAAA,SAAS,EAAC;AAAf,OACGA,gBADH,CADe,GAKf,cAAC,UAAD;AACC,MAAA,SAAS,EAAG1F,UAAU,CAAE,yBAAF,EAA6B;AAClD,yBACCmF,cAAc,IAAI,CAAC,CAAEO,gBAF4B;AAGlD,wBAAgBH;AAHkC,OAA7B,CADvB;AAMC,MAAA,oBAAoB,EAAGV,UANxB;AAOC,MAAA,OAAO,EAAKc,KAAF,IAAa;AACtB;AACA,YAAKA,KAAK,CAACC,MAAN,KAAiBD,KAAK,CAACE,aAA5B,EAA4C;AAC3Cb,UAAAA,kBAAkB;AAClB;AACD;AAZF,OAcC,cAAC,4BAAD,CAA8B,QAA9B,OAdD,EAeC,cAAC,UAAD,OAfD,EAgBC,cAAC,eAAD;AACC,MAAA,cAAc,EAAGM,cADlB;AAEC,MAAA,MAAM,mBAAGJ,KAAK,CAACY,MAAT,yDAAmB;AAF1B,OAIC,cAAC,YAAD;AACC,MAAA,cAAc,EAAGR,cADlB;AAEC,MAAA,QAAQ,EAAGd,QAFZ;AAGC,MAAA,UAAU,EAAGM,UAHd;AAIC,MAAA,QAAQ,EAAGpC,UAAU,KAAK;AAJ3B,OAMGuC,cANH,EAOC,cAAC,SAAD;AACC,MAAA,SAAS,EAAC,mDADX;AAEC,MAAA,oBAAoB,EAAG9C,MAFxB;AAGC,MAAA,cAAc,EAAGqD;AAHlB,MAPD,CAJD,CAhBD,CANA;AAAA,GADH,CAZD,EAyDC,cAAC,uBAAD,OAzDD,CADD;AA6DA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo, useRef } from '@wordpress/element';\nimport { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data';\nimport {\n\tBlockList,\n\tBlockInspector,\n\tBlockTools,\n\t__unstableUseClipboardHandler as useClipboardHandler,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tBlockEditorKeyboardShortcuts,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tuseMergeRefs,\n\tuseViewportMatch,\n\tuseResizeObserver,\n} from '@wordpress/compose';\nimport { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';\n\n/**\n * Internal dependencies\n */\nimport inserterMediaCategories from './inserter-media-categories';\nimport TemplatePartConverter from '../template-part-converter';\nimport { SidebarInspectorFill } from '../sidebar-edit-mode';\nimport { store as editSiteStore } from '../../store';\nimport BackButton from './back-button';\nimport ResizableEditor from './resizable-editor';\nimport EditorCanvas from './editor-canvas';\nimport { unlock } from '../../private-apis';\nimport EditorCanvasContainer from '../editor-canvas-container';\nimport {\n\tPageContentLock,\n\tusePageContentLockNotifications,\n} from '../page-content-lock';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\n\nconst LAYOUT = {\n\ttype: 'default',\n\t// At the root level of the site editor, no alignments should be allowed.\n\talignments: [],\n};\n\nexport default function BlockEditor() {\n\tconst { setIsInserterOpened } = useDispatch( editSiteStore );\n\tconst { storedSettings, templateType, canvasMode, hasPageContentLock } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetSettings,\n\t\t\t\t\tgetEditedPostType,\n\t\t\t\t\tgetCanvasMode,\n\t\t\t\t\thasPageContentLock: _hasPageContentLock,\n\t\t\t\t} = unlock( select( editSiteStore ) );\n\n\t\t\t\treturn {\n\t\t\t\t\tstoredSettings: getSettings( setIsInserterOpened ),\n\t\t\t\t\ttemplateType: getEditedPostType(),\n\t\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t\t\thasPageContentLock: _hasPageContentLock(),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ setIsInserterOpened ]\n\t\t);\n\n\tconst settingsBlockPatterns =\n\t\tstoredSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tstoredSettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories:\n\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( templateType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, templateType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst settings = useMemo( () => {\n\t\tconst {\n\t\t\t__experimentalAdditionalBlockPatterns,\n\t\t\t__experimentalAdditionalBlockPatternCategories,\n\t\t\t...restStoredSettings\n\t\t} = storedSettings;\n\n\t\treturn {\n\t\t\t...restStoredSettings,\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t};\n\t}, [ storedSettings, blockPatterns, blockPatternCategories ] );\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplateType\n\t);\n\n\tconst contentRef = useRef();\n\tconst mergedRefs = useMergeRefs( [\n\t\tcontentRef,\n\t\tuseClipboardHandler(),\n\t\tuseTypingObserver(),\n\t\tusePageContentLockNotifications(),\n\t] );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\n\tconst isTemplatePart = templateType === 'wp_template_part';\n\n\tconst hasBlocks = blocks.length !== 0;\n\tconst enableResizing =\n\t\tisTemplatePart &&\n\t\tcanvasMode !== 'view' &&\n\t\t// Disable resizing in mobile viewport.\n\t\t! isMobileViewport;\n\tconst isViewMode = canvasMode === 'view';\n\tconst showBlockAppender =\n\t\t( isTemplatePart && hasBlocks ) || isViewMode ? false : undefined;\n\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tsettings={ settings }\n\t\t\tvalue={ blocks }\n\t\t\tonInput={ onInput }\n\t\t\tonChange={ onChange }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t{ hasPageContentLock && <PageContentLock /> }\n\t\t\t<TemplatePartConverter />\n\t\t\t<SidebarInspectorFill>\n\t\t\t\t<BlockInspector />\n\t\t\t</SidebarInspectorFill>\n\t\t\t<EditorCanvasContainer.Slot>\n\t\t\t\t{ ( [ editorCanvasView ] ) =>\n\t\t\t\t\teditorCanvasView ? (\n\t\t\t\t\t\t<div className=\"edit-site-visual-editor is-focus-mode\">\n\t\t\t\t\t\t\t{ editorCanvasView }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<BlockTools\n\t\t\t\t\t\t\tclassName={ classnames( 'edit-site-visual-editor', {\n\t\t\t\t\t\t\t\t'is-focus-mode':\n\t\t\t\t\t\t\t\t\tisTemplatePart || !! editorCanvasView,\n\t\t\t\t\t\t\t\t'is-view-mode': isViewMode,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t__unstableContentRef={ contentRef }\n\t\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\t\t// Clear selected block when clicking on the gray background.\n\t\t\t\t\t\t\t\tif ( event.target === event.currentTarget ) {\n\t\t\t\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t\t\t\t\t<BackButton />\n\t\t\t\t\t\t\t<ResizableEditor\n\t\t\t\t\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\t\t\t\t\theight={ sizes.height ?? '100%' }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<EditorCanvas\n\t\t\t\t\t\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\t\tcontentRef={ mergedRefs }\n\t\t\t\t\t\t\t\t\treadonly={ canvasMode === 'view' }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ resizeObserver }\n\t\t\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-block-editor__block-list wp-site-blocks\"\n\t\t\t\t\t\t\t\t\t\t__experimentalLayout={ LAYOUT }\n\t\t\t\t\t\t\t\t\t\trenderAppender={ showBlockAppender }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</EditorCanvas>\n\t\t\t\t\t\t\t</ResizableEditor>\n\t\t\t\t\t\t</BlockTools>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t</EditorCanvasContainer.Slot>\n\t\t\t<ReusableBlocksMenuItems />\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n"]}
@@ -99,21 +99,16 @@ const getOpenverseCaption = item => {
99
99
  return _caption.replace(/\s{2}/g, ' ');
100
100
  };
101
101
 
102
- const coreMediaFetch = async function () {
103
- let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
102
+ const coreMediaFetch = async (query = {}) => {
104
103
  const mediaItems = await resolveSelect(coreStore).getMediaItems({ ...query,
105
- orderBy: !!(query !== null && query !== void 0 && query.search) ? 'relevance' : 'date'
106
- });
107
- return mediaItems.map(mediaItem => {
108
- var _mediaItem$media_deta, _mediaItem$media_deta2, _mediaItem$media_deta3, _mediaItem$caption;
109
-
110
- return { ...mediaItem,
111
- alt: mediaItem.alt_text,
112
- url: mediaItem.source_url,
113
- previewUrl: (_mediaItem$media_deta = mediaItem.media_details) === null || _mediaItem$media_deta === void 0 ? void 0 : (_mediaItem$media_deta2 = _mediaItem$media_deta.sizes) === null || _mediaItem$media_deta2 === void 0 ? void 0 : (_mediaItem$media_deta3 = _mediaItem$media_deta2.medium) === null || _mediaItem$media_deta3 === void 0 ? void 0 : _mediaItem$media_deta3.source_url,
114
- caption: (_mediaItem$caption = mediaItem.caption) === null || _mediaItem$caption === void 0 ? void 0 : _mediaItem$caption.raw
115
- };
104
+ orderBy: !!query?.search ? 'relevance' : 'date'
116
105
  });
106
+ return mediaItems.map(mediaItem => ({ ...mediaItem,
107
+ alt: mediaItem.alt_text,
108
+ url: mediaItem.source_url,
109
+ previewUrl: mediaItem.media_details?.sizes?.medium?.source_url,
110
+ caption: mediaItem.caption?.raw
111
+ }));
117
112
  };
118
113
  /** @type {InserterMediaCategory[]} */
119
114
 
@@ -126,8 +121,7 @@ const inserterMediaCategories = [{
126
121
  },
127
122
  mediaType: 'image',
128
123
 
129
- async fetch() {
130
- let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
124
+ async fetch(query = {}) {
131
125
  return coreMediaFetch({ ...query,
132
126
  media_type: 'image'
133
127
  });
@@ -141,8 +135,7 @@ const inserterMediaCategories = [{
141
135
  },
142
136
  mediaType: 'video',
143
137
 
144
- async fetch() {
145
- let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
138
+ async fetch(query = {}) {
146
139
  return coreMediaFetch({ ...query,
147
140
  media_type: 'video'
148
141
  });
@@ -156,8 +149,7 @@ const inserterMediaCategories = [{
156
149
  },
157
150
  mediaType: 'audio',
158
151
 
159
- async fetch() {
160
- let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
152
+ async fetch(query = {}) {
161
153
  return coreMediaFetch({ ...query,
162
154
  media_type: 'audio'
163
155
  });
@@ -171,8 +163,7 @@ const inserterMediaCategories = [{
171
163
  },
172
164
  mediaType: 'image',
173
165
 
174
- async fetch() {
175
- let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
166
+ async fetch(query = {}) {
176
167
  const defaultArgs = {
177
168
  mature: false,
178
169
  excluded_source: 'flickr,inaturalist,wikimedia',
@@ -186,8 +177,7 @@ const inserterMediaCategories = [{
186
177
  search: 'q'
187
178
  };
188
179
  const url = new URL('https://api.openverse.engineering/v1/images/');
189
- Object.entries(finalQuery).forEach(_ref => {
190
- let [key, value] = _ref;
180
+ Object.entries(finalQuery).forEach(([key, value]) => {
191
181
  const queryKey = mapFromInserterMediaRequest[key] || key;
192
182
  url.searchParams.set(queryKey, value);
193
183
  });
@@ -198,27 +188,20 @@ const inserterMediaCategories = [{
198
188
  });
199
189
  const jsonResponse = await response.json();
200
190
  const results = jsonResponse.results;
201
- return results.map(result => {
202
- var _result$title;
203
-
204
- return { ...result,
205
- // This is a temp solution for better titles, until Openverse API
206
- // completes the cleaning up of some titles of their upstream data.
207
- title: (_result$title = result.title) !== null && _result$title !== void 0 && _result$title.toLowerCase().startsWith('file:') ? result.title.slice(5) : result.title,
208
- sourceId: result.id,
209
- id: undefined,
210
- caption: getOpenverseCaption(result),
211
- previewUrl: result.thumbnail
212
- };
213
- });
191
+ return results.map(result => ({ ...result,
192
+ // This is a temp solution for better titles, until Openverse API
193
+ // completes the cleaning up of some titles of their upstream data.
194
+ title: result.title?.toLowerCase().startsWith('file:') ? result.title.slice(5) : result.title,
195
+ sourceId: result.id,
196
+ id: undefined,
197
+ caption: getOpenverseCaption(result),
198
+ previewUrl: result.thumbnail
199
+ }));
214
200
  },
215
201
 
216
- getReportUrl: _ref2 => {
217
- let {
218
- sourceId
219
- } = _ref2;
220
- return `https://wordpress.org/openverse/image/${sourceId}/report/`;
221
- },
202
+ getReportUrl: ({
203
+ sourceId
204
+ }) => `https://wordpress.org/openverse/image/${sourceId}/report/`,
222
205
  isExternalResource: true
223
206
  }];
224
207
  export default inserterMediaCategories;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/inserter-media-categories.js"],"names":["__","sprintf","_x","resolveSelect","decodeEntities","store","coreStore","getExternalLink","url","text","getExternalLinkAttributes","getOpenverseLicense","license","licenseVersion","licenseName","trim","toUpperCase","replace","includes","getOpenverseCaption","item","title","foreign_landing_url","foreignLandingUrl","creator","creator_url","creatorUrl","license_version","license_url","licenseUrl","fullLicense","_creator","_caption","coreMediaFetch","query","mediaItems","getMediaItems","orderBy","search","map","mediaItem","alt","alt_text","source_url","previewUrl","media_details","sizes","medium","caption","raw","inserterMediaCategories","name","labels","search_items","mediaType","fetch","media_type","defaultArgs","mature","excluded_source","finalQuery","mapFromInserterMediaRequest","per_page","URL","Object","entries","forEach","key","value","queryKey","searchParams","set","response","window","headers","jsonResponse","json","results","result","toLowerCase","startsWith","slice","sourceId","id","undefined","thumbnail","getReportUrl","isExternalResource"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,EAAsBC,EAAtB,QAAgC,iBAAhC;AACA,SAASC,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;AA6CCC,EAAAA,YAAY,EAAE;AAAA,QAAE;AAAEJ,MAAAA;AAAF,KAAF;AAAA,WACZ,yCAAyCA,QAAU,UADvC;AAAA,GA7Cf;AA+CCK,EAAAA,kBAAkB,EAAE;AA/CrB,CAlC+B,CAAhC;AAqFA,eAAerC,uBAAf","sourcesContent":["/**\n * The `edit-site` settings here need to be in sync with the corresponding ones in `site-editor` package.\n * See `packages/edit-site/src/components/block-editor/inserter-media-categories.js`.\n *\n * In the future we could consider creating an Openvese package that can be used in both `editor` and `site-editor`.\n * The rest of the settings would still need to be in sync though.\n */\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf, _x } from '@wordpress/i18n';\nimport { resolveSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\n\n/** @typedef {import('@wordpress/block-editor').InserterMediaRequest} InserterMediaRequest */\n/** @typedef {import('@wordpress/block-editor').InserterMediaItem} InserterMediaItem */\n/**\n * Interface for inserter media category labels.\n *\n * @typedef {Object} InserterMediaCategoryLabels\n * @property {string} name General name of the media category. It's used in the inserter media items list.\n * @property {string} [search_items='Search'] Label for searching items. Default is ‘Search Posts’ / ‘Search Pages’.\n */\n/**\n * Interface for inserter media category.\n *\n * @typedef {Object} InserterMediaCategory\n * @property {string} name The name of the media category, that should be unique among all media categories.\n * @property {InserterMediaCategoryLabels} labels Labels for the media category.\n * @property {('image'|'audio'|'video')} mediaType The media type of the media category.\n * @property {(InserterMediaRequest) => Promise<InserterMediaItem[]>} fetch The function to fetch media items for the category.\n * @property {(InserterMediaItem) => string} [getReportUrl] If the media category supports reporting media items, this function should return\n * the report url for the media item. It accepts the `InserterMediaItem` as an argument.\n * @property {boolean} [isExternalResource] If the media category is an external resource, this should be set to true.\n * This is used to avoid making a request to the external resource when the user\n * opens the inserter for the first time.\n */\n\nconst getExternalLink = ( url, text ) =>\n\t`<a ${ getExternalLinkAttributes( url ) }>${ text }</a>`;\n\nconst getExternalLinkAttributes = ( url ) =>\n\t`href=\"${ url }\" target=\"_blank\" rel=\"noreferrer noopener\"`;\n\nconst getOpenverseLicense = ( license, licenseVersion ) => {\n\tlet licenseName = license.trim();\n\t// PDM has no abbreviation\n\tif ( license !== 'pdm' ) {\n\t\tlicenseName = license.toUpperCase().replace( 'SAMPLING', 'Sampling' );\n\t}\n\t// If version is known, append version to the name.\n\t// The license has to have a version to be valid. Only\n\t// PDM (public domain mark) doesn't have a version.\n\tif ( licenseVersion ) {\n\t\tlicenseName += ` ${ licenseVersion }`;\n\t}\n\t// For licenses other than public-domain marks, prepend 'CC' to the name.\n\tif ( ! [ 'pdm', 'cc0' ].includes( license ) ) {\n\t\tlicenseName = `CC ${ licenseName }`;\n\t}\n\treturn licenseName;\n};\n\nconst getOpenverseCaption = ( item ) => {\n\tconst {\n\t\ttitle,\n\t\tforeign_landing_url: foreignLandingUrl,\n\t\tcreator,\n\t\tcreator_url: creatorUrl,\n\t\tlicense,\n\t\tlicense_version: licenseVersion,\n\t\tlicense_url: licenseUrl,\n\t} = item;\n\tconst fullLicense = getOpenverseLicense( license, licenseVersion );\n\tconst _creator = decodeEntities( creator );\n\tlet _caption;\n\tif ( _creator ) {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Name of the work's creator; %3s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\" by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Name of the work's creator; %3s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a> by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t} else {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\"/ %2$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a>/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t}\n\treturn _caption.replace( /\\s{2}/g, ' ' );\n};\n\nconst coreMediaFetch = async ( query = {} ) => {\n\tconst mediaItems = await resolveSelect( coreStore ).getMediaItems( {\n\t\t...query,\n\t\torderBy: !! query?.search ? 'relevance' : 'date',\n\t} );\n\treturn mediaItems.map( ( mediaItem ) => ( {\n\t\t...mediaItem,\n\t\talt: mediaItem.alt_text,\n\t\turl: mediaItem.source_url,\n\t\tpreviewUrl: mediaItem.media_details?.sizes?.medium?.source_url,\n\t\tcaption: mediaItem.caption?.raw,\n\t} ) );\n};\n\n/** @type {InserterMediaCategory[]} */\nconst inserterMediaCategories = [\n\t{\n\t\tname: 'images',\n\t\tlabels: {\n\t\t\tname: __( 'Images' ),\n\t\t\tsearch_items: __( 'Search images' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'image' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'videos',\n\t\tlabels: {\n\t\t\tname: __( 'Videos' ),\n\t\t\tsearch_items: __( 'Search videos' ),\n\t\t},\n\t\tmediaType: 'video',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'video' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'audio',\n\t\tlabels: {\n\t\t\tname: __( 'Audio' ),\n\t\t\tsearch_items: __( 'Search audio' ),\n\t\t},\n\t\tmediaType: 'audio',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'audio' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'openverse',\n\t\tlabels: {\n\t\t\tname: __( 'Openverse' ),\n\t\t\tsearch_items: __( 'Search Openverse' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\tconst defaultArgs = {\n\t\t\t\tmature: false,\n\t\t\t\texcluded_source: 'flickr,inaturalist,wikimedia',\n\t\t\t\tlicense: 'pdm,cc0',\n\t\t\t};\n\t\t\tconst finalQuery = { ...query, ...defaultArgs };\n\t\t\tconst mapFromInserterMediaRequest = {\n\t\t\t\tper_page: 'page_size',\n\t\t\t\tsearch: 'q',\n\t\t\t};\n\t\t\tconst url = new URL(\n\t\t\t\t'https://api.openverse.engineering/v1/images/'\n\t\t\t);\n\t\t\tObject.entries( finalQuery ).forEach( ( [ key, value ] ) => {\n\t\t\t\tconst queryKey = mapFromInserterMediaRequest[ key ] || key;\n\t\t\t\turl.searchParams.set( queryKey, value );\n\t\t\t} );\n\t\t\tconst response = await window.fetch( url, {\n\t\t\t\theaders: {\n\t\t\t\t\t'User-Agent': 'WordPress/inserter-media-fetch',\n\t\t\t\t},\n\t\t\t} );\n\t\t\tconst jsonResponse = await response.json();\n\t\t\tconst results = jsonResponse.results;\n\t\t\treturn results.map( ( result ) => ( {\n\t\t\t\t...result,\n\t\t\t\t// This is a temp solution for better titles, until Openverse API\n\t\t\t\t// completes the cleaning up of some titles of their upstream data.\n\t\t\t\ttitle: result.title?.toLowerCase().startsWith( 'file:' )\n\t\t\t\t\t? result.title.slice( 5 )\n\t\t\t\t\t: result.title,\n\t\t\t\tsourceId: result.id,\n\t\t\t\tid: undefined,\n\t\t\t\tcaption: getOpenverseCaption( result ),\n\t\t\t\tpreviewUrl: result.thumbnail,\n\t\t\t} ) );\n\t\t},\n\t\tgetReportUrl: ( { sourceId } ) =>\n\t\t\t`https://wordpress.org/openverse/image/${ sourceId }/report/`,\n\t\tisExternalResource: true,\n\t},\n];\n\nexport default inserterMediaCategories;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/inserter-media-categories.js"],"names":["__","sprintf","_x","resolveSelect","decodeEntities","store","coreStore","getExternalLink","url","text","getExternalLinkAttributes","getOpenverseLicense","license","licenseVersion","licenseName","trim","toUpperCase","replace","includes","getOpenverseCaption","item","title","foreign_landing_url","foreignLandingUrl","creator","creator_url","creatorUrl","license_version","license_url","licenseUrl","fullLicense","_creator","_caption","coreMediaFetch","query","mediaItems","getMediaItems","orderBy","search","map","mediaItem","alt","alt_text","source_url","previewUrl","media_details","sizes","medium","caption","raw","inserterMediaCategories","name","labels","search_items","mediaType","fetch","media_type","defaultArgs","mature","excluded_source","finalQuery","mapFromInserterMediaRequest","per_page","URL","Object","entries","forEach","key","value","queryKey","searchParams","set","response","window","headers","jsonResponse","json","results","result","toLowerCase","startsWith","slice","sourceId","id","undefined","thumbnail","getReportUrl","isExternalResource"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,EAAsBC,EAAtB,QAAgC,iBAAhC;AACA,SAASC,aAAT,QAA8B,iBAA9B;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMC,eAAe,GAAG,CAAEC,GAAF,EAAOC,IAAP,KACtB,MAAMC,yBAAyB,CAAEF,GAAF,CAAS,IAAIC,IAAM,MADpD;;AAGA,MAAMC,yBAAyB,GAAKF,GAAF,IAChC,SAASA,GAAK,6CADhB;;AAGA,MAAMG,mBAAmB,GAAG,CAAEC,OAAF,EAAWC,cAAX,KAA+B;AAC1D,MAAIC,WAAW,GAAGF,OAAO,CAACG,IAAR,EAAlB,CAD0D,CAE1D;;AACA,MAAKH,OAAO,KAAK,KAAjB,EAAyB;AACxBE,IAAAA,WAAW,GAAGF,OAAO,CAACI,WAAR,GAAsBC,OAAtB,CAA+B,UAA/B,EAA2C,UAA3C,CAAd;AACA,GALyD,CAM1D;AACA;AACA;;;AACA,MAAKJ,cAAL,EAAsB;AACrBC,IAAAA,WAAW,IA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JF,MAAM,CAACzD,KAAP,CAAa4D,KAAb,CAAoB,CAApB,CADI,GAEJH,MAAM,CAACzD,KANyB;AAOnC6D,MAAAA,QAAQ,EAAEJ,MAAM,CAACK,EAPkB;AAQnCA,MAAAA,EAAE,EAAEC,SAR+B;AASnCpC,MAAAA,OAAO,EAAE7B,mBAAmB,CAAE2D,MAAF,CATO;AAUnClC,MAAAA,UAAU,EAAEkC,MAAM,CAACO;AAVgB,KAAhB,CAAb,CAAP;AAYA,GA5CF;;AA6CCC,EAAAA,YAAY,EAAE,CAAE;AAAEJ,IAAAA;AAAF,GAAF,KACZ,yCAAyCA,QAAU,UA9CtD;AA+CCK,EAAAA,kBAAkB,EAAE;AA/CrB,CAlC+B,CAAhC;AAqFA,eAAerC,uBAAf","sourcesContent":["/**\n * The `edit-site` settings here need to be in sync with the corresponding ones in `site-editor` package.\n * See `packages/edit-site/src/components/block-editor/inserter-media-categories.js`.\n *\n * In the future we could consider creating an Openvese package that can be used in both `editor` and `site-editor`.\n * The rest of the settings would still need to be in sync though.\n */\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf, _x } from '@wordpress/i18n';\nimport { resolveSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\n\n/** @typedef {import('@wordpress/block-editor').InserterMediaRequest} InserterMediaRequest */\n/** @typedef {import('@wordpress/block-editor').InserterMediaItem} InserterMediaItem */\n/**\n * Interface for inserter media category labels.\n *\n * @typedef {Object} InserterMediaCategoryLabels\n * @property {string} name General name of the media category. It's used in the inserter media items list.\n * @property {string} [search_items='Search'] Label for searching items. Default is ‘Search Posts’ / ‘Search Pages’.\n */\n/**\n * Interface for inserter media category.\n *\n * @typedef {Object} InserterMediaCategory\n * @property {string} name The name of the media category, that should be unique among all media categories.\n * @property {InserterMediaCategoryLabels} labels Labels for the media category.\n * @property {('image'|'audio'|'video')} mediaType The media type of the media category.\n * @property {(InserterMediaRequest) => Promise<InserterMediaItem[]>} fetch The function to fetch media items for the category.\n * @property {(InserterMediaItem) => string} [getReportUrl] If the media category supports reporting media items, this function should return\n * the report url for the media item. It accepts the `InserterMediaItem` as an argument.\n * @property {boolean} [isExternalResource] If the media category is an external resource, this should be set to true.\n * This is used to avoid making a request to the external resource when the user\n * opens the inserter for the first time.\n */\n\nconst getExternalLink = ( url, text ) =>\n\t`<a ${ getExternalLinkAttributes( url ) }>${ text }</a>`;\n\nconst getExternalLinkAttributes = ( url ) =>\n\t`href=\"${ url }\" target=\"_blank\" rel=\"noreferrer noopener\"`;\n\nconst getOpenverseLicense = ( license, licenseVersion ) => {\n\tlet licenseName = license.trim();\n\t// PDM has no abbreviation\n\tif ( license !== 'pdm' ) {\n\t\tlicenseName = license.toUpperCase().replace( 'SAMPLING', 'Sampling' );\n\t}\n\t// If version is known, append version to the name.\n\t// The license has to have a version to be valid. Only\n\t// PDM (public domain mark) doesn't have a version.\n\tif ( licenseVersion ) {\n\t\tlicenseName += ` ${ licenseVersion }`;\n\t}\n\t// For licenses other than public-domain marks, prepend 'CC' to the name.\n\tif ( ! [ 'pdm', 'cc0' ].includes( license ) ) {\n\t\tlicenseName = `CC ${ licenseName }`;\n\t}\n\treturn licenseName;\n};\n\nconst getOpenverseCaption = ( item ) => {\n\tconst {\n\t\ttitle,\n\t\tforeign_landing_url: foreignLandingUrl,\n\t\tcreator,\n\t\tcreator_url: creatorUrl,\n\t\tlicense,\n\t\tlicense_version: licenseVersion,\n\t\tlicense_url: licenseUrl,\n\t} = item;\n\tconst fullLicense = getOpenverseLicense( license, licenseVersion );\n\tconst _creator = decodeEntities( creator );\n\tlet _caption;\n\tif ( _creator ) {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Name of the work's creator; %3s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\" by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Name of the work's creator; %3s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a> by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t} else {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\"/ %2$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a>/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t}\n\treturn _caption.replace( /\\s{2}/g, ' ' );\n};\n\nconst coreMediaFetch = async ( query = {} ) => {\n\tconst mediaItems = await resolveSelect( coreStore ).getMediaItems( {\n\t\t...query,\n\t\torderBy: !! query?.search ? 'relevance' : 'date',\n\t} );\n\treturn mediaItems.map( ( mediaItem ) => ( {\n\t\t...mediaItem,\n\t\talt: mediaItem.alt_text,\n\t\turl: mediaItem.source_url,\n\t\tpreviewUrl: mediaItem.media_details?.sizes?.medium?.source_url,\n\t\tcaption: mediaItem.caption?.raw,\n\t} ) );\n};\n\n/** @type {InserterMediaCategory[]} */\nconst inserterMediaCategories = [\n\t{\n\t\tname: 'images',\n\t\tlabels: {\n\t\t\tname: __( 'Images' ),\n\t\t\tsearch_items: __( 'Search images' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'image' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'videos',\n\t\tlabels: {\n\t\t\tname: __( 'Videos' ),\n\t\t\tsearch_items: __( 'Search videos' ),\n\t\t},\n\t\tmediaType: 'video',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'video' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'audio',\n\t\tlabels: {\n\t\t\tname: __( 'Audio' ),\n\t\t\tsearch_items: __( 'Search audio' ),\n\t\t},\n\t\tmediaType: 'audio',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'audio' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'openverse',\n\t\tlabels: {\n\t\t\tname: __( 'Openverse' ),\n\t\t\tsearch_items: __( 'Search Openverse' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\tconst defaultArgs = {\n\t\t\t\tmature: false,\n\t\t\t\texcluded_source: 'flickr,inaturalist,wikimedia',\n\t\t\t\tlicense: 'pdm,cc0',\n\t\t\t};\n\t\t\tconst finalQuery = { ...query, ...defaultArgs };\n\t\t\tconst mapFromInserterMediaRequest = {\n\t\t\t\tper_page: 'page_size',\n\t\t\t\tsearch: 'q',\n\t\t\t};\n\t\t\tconst url = new URL(\n\t\t\t\t'https://api.openverse.engineering/v1/images/'\n\t\t\t);\n\t\t\tObject.entries( finalQuery ).forEach( ( [ key, value ] ) => {\n\t\t\t\tconst queryKey = mapFromInserterMediaRequest[ key ] || key;\n\t\t\t\turl.searchParams.set( queryKey, value );\n\t\t\t} );\n\t\t\tconst response = await window.fetch( url, {\n\t\t\t\theaders: {\n\t\t\t\t\t'User-Agent': 'WordPress/inserter-media-fetch',\n\t\t\t\t},\n\t\t\t} );\n\t\t\tconst jsonResponse = await response.json();\n\t\t\tconst results = jsonResponse.results;\n\t\t\treturn results.map( ( result ) => ( {\n\t\t\t\t...result,\n\t\t\t\t// This is a temp solution for better titles, until Openverse API\n\t\t\t\t// completes the cleaning up of some titles of their upstream data.\n\t\t\t\ttitle: result.title?.toLowerCase().startsWith( 'file:' )\n\t\t\t\t\t? result.title.slice( 5 )\n\t\t\t\t\t: result.title,\n\t\t\t\tsourceId: result.id,\n\t\t\t\tid: undefined,\n\t\t\t\tcaption: getOpenverseCaption( result ),\n\t\t\t\tpreviewUrl: result.thumbnail,\n\t\t\t} ) );\n\t\t},\n\t\tgetReportUrl: ( { sourceId } ) =>\n\t\t\t`https://wordpress.org/openverse/image/${ sourceId }/report/`,\n\t\tisExternalResource: true,\n\t},\n];\n\nexport default inserterMediaCategories;\n"]}
@@ -23,12 +23,11 @@ const HANDLE_STYLES_OVERRIDE = {
23
23
  left: undefined
24
24
  };
25
25
 
26
- function ResizableEditor(_ref) {
27
- let {
28
- enableResizing,
29
- height,
30
- children
31
- } = _ref;
26
+ function ResizableEditor({
27
+ enableResizing,
28
+ height,
29
+ children
30
+ }) {
32
31
  const [width, setWidth] = useState('100%');
33
32
  const resizableRef = useRef();
34
33
  const resizeWidthBy = useCallback(deltaPixels => {
@@ -38,7 +37,7 @@ function ResizableEditor(_ref) {
38
37
  }, []);
39
38
  return createElement(ResizableBox, {
40
39
  ref: api => {
41
- resizableRef.current = api === null || api === void 0 ? void 0 : api.resizable;
40
+ resizableRef.current = api?.resizable;
42
41
  },
43
42
  size: {
44
43
  width: enableResizing ? width : '100%',
@@ -1 +1 @@
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,K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EAAGA,cAlBd,CAmBC;AACA;AACA;AArBD;AAsBC,IAAA,WAAW,EAAG,CAtBf;AAuBC,IAAA,eAAe,EAAG;AACjBF,MAAAA,IAAI,EACH,cAAC,YAAD;AACC,QAAA,SAAS,EAAC,MADX;AAEC,QAAA,aAAa,EAAGM;AAFjB,QAFgB;AAOjBR,MAAAA,KAAK,EACJ,cAAC,YAAD;AACC,QAAA,SAAS,EAAC,OADX;AAEC,QAAA,aAAa,EAAGQ;AAFjB;AARgB,KAvBnB;AAqCC,IAAA,aAAa,EAAGd,SArCjB;AAsCC,IAAA,YAAY,EAAG;AACdQ,MAAAA,IAAI,EAAEV,sBADQ;AAEdQ,MAAAA,KAAK,EAAER;AAFO;AAtChB,KA2CGa,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"]}
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,iBAAz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KAAhB,CAAR;AACA,KAVF;AAWC,IAAA,QAAQ,EAAG,GAXZ;AAYC,IAAA,QAAQ,EAAC,MAZV;AAaC,IAAA,SAAS,EAAC,MAbX;AAcC,IAAA,MAAM,EAAG;AACRG,MAAAA,KAAK,EAAEI,cADC;AAERF,MAAAA,IAAI,EAAEE;AAFE,KAdV;AAkBC,IAAA,UAAU,EAAGA,cAlBd,CAmBC;AACA;AACA;AArBD;AAsBC,IAAA,WAAW,EAAG,CAtBf;AAuBC,IAAA,eAAe,EAAG;AACjBF,MAAAA,IAAI,EACH,cAAC,YAAD;AACC,QAAA,SAAS,EAAC,MADX;AAEC,QAAA,aAAa,EAAGM;AAFjB,QAFgB;AAOjBR,MAAAA,KAAK,EACJ,cAAC,YAAD;AACC,QAAA,SAAS,EAAC,OADX;AAEC,QAAA,aAAa,EAAGQ;AAFjB;AARgB,KAvBnB;AAqCC,IAAA,aAAa,EAAGd,SArCjB;AAsCC,IAAA,YAAY,EAAG;AACdQ,MAAAA,IAAI,EAAEV,sBADQ;AAEdQ,MAAAA,KAAK,EAAER;AAFO;AAtChB,KA2CGa,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"]}
@@ -8,13 +8,11 @@ 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(_ref) {
12
- let {
13
- variation = 'default',
14
- direction,
15
- resizeWidthBy
16
- } = _ref;
17
-
11
+ export default function ResizeHandle({
12
+ variation = 'default',
13
+ direction,
14
+ resizeWidthBy
15
+ }) {
18
16
  function handleKeyDown(event) {
19
17
  const {
20
18
  keyCode
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/resize-handle.js"],"names":["__","LEFT","RIGHT","VisuallyHidden","DELTA_DISTANCE","ResizeHandle","variation","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,OAIX;AAAA,MAJkC;AACrCC,IAAAA,SAAS,GAAG,SADyB;AAErCC,IAAAA,SAFqC;AAGrCC,IAAAA;AAHqC,GAIlC;;AACH,WAASC,aAAT,CAAwBC,KAAxB,EAAgC;AAC/B,UAAM;AAAEC,MAAAA;AAAF,QAAcD,KAApB;;AAEA,QACGH,SAAS,KAAK,MAAd,IAAwBI,OAAO,KAAKV,IAAtC,IACEM,SAAS,KAAK,OAAd,IAAyBI,OAAO,KAAKT,KAFxC,EAGE;AACDM,MAAAA,aAAa,CAAEJ,cAAF,CAAb;AACA,KALD,MAKO,IACJG,SAAS,KAAK,MAAd,IAAwBI,OAAO,KAAKT,KAAtC,IACEK,SAAS,KAAK,OAAd,IAAyBI,OAAO,KAAKV,IAFjC,EAGL;AACDO,MAAAA,aAAa,CAAE,CAACJ,cAAH,CAAb;AACA;AACD;;AAED,SACC,8BACC;AACC,IAAA,SAAS,EAAI,oCAAoCG,SAAW,iBAAiBD,SAAW,EADzF;AAEC,kBAAaN,EAAE,CAAE,gBAAF,CAFhB;AAGC,wBAAoB,iCAAiCO,SAAW,EAHjE;AAIC,IAAA,SAAS,EAAGE;AAJb,IADD,EAOC,cAAC,cAAD;AACC,IAAA,EAAE,EAAI,iCAAiCF,SAAW;AADnD,KAGGP,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( {\n\tvariation = 'default',\n\tdirection,\n\tresizeWidthBy,\n} ) {\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 } is-variation-${ variation }` }\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","variation","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;AACrCC,EAAAA,SAAS,GAAG,SADyB;AAErCC,EAAAA,SAFqC;AAGrCC,EAAAA;AAHqC,CAAvB,EAIX;AACH,WAASC,aAAT,CAAwBC,KAAxB,EAAgC;AAC/B,UAAM;AAAEC,MAAAA;AAAF,QAAcD,KAApB;;AAEA,QACGH,SAAS,KAAK,MAAd,IAAwBI,OAAO,KAAKV,IAAtC,IACEM,SAAS,KAAK,OAAd,IAAyBI,OAAO,KAAKT,KAFxC,EAGE;AACDM,MAAAA,aAAa,CAAEJ,cAAF,CAAb;AACA,KALD,MAKO,IACJG,SAAS,KAAK,MAAd,IAAwBI,OAAO,KAAKT,KAAtC,IACEK,SAAS,KAAK,OAAd,IAAyBI,OAAO,KAAKV,IAFjC,EAGL;AACDO,MAAAA,aAAa,CAAE,CAACJ,cAAH,CAAb;AACA;AACD;;AAED,SACC,8BACC;AACC,IAAA,SAAS,EAAI,oCAAoCG,SAAW,iBAAiBD,SAAW,EADzF;AAEC,kBAAaN,EAAE,CAAE,gBAAF,CAFhB;AAGC,wBAAoB,iCAAiCO,SAAW,EAHjE;AAIC,IAAA,SAAS,EAAGE;AAJb,IADD,EAOC,cAAC,cAAD;AACC,IAAA,EAAE,EAAI,iCAAiCF,SAAW;AADnD,KAGGP,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( {\n\tvariation = 'default',\n\tdirection,\n\tresizeWidthBy,\n} ) {\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 } is-variation-${ variation }` }\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"]}
@@ -12,12 +12,11 @@ import { __ } from '@wordpress/i18n';
12
12
  import { useEffect, useState, useRef } from '@wordpress/element';
13
13
  import { useInstanceId } from '@wordpress/compose';
14
14
  import { VisuallyHidden } from '@wordpress/components';
15
- export default function CodeEditorTextArea(_ref) {
16
- let {
17
- value,
18
- onChange,
19
- onInput
20
- } = _ref;
15
+ export default function CodeEditorTextArea({
16
+ value,
17
+ onChange,
18
+ onInput
19
+ }) {
21
20
  const [stateValue, setStateValue] = useState(value);
22
21
  const [isDirty, setIsDirty] = useState(false);
23
22
  const instanceId = useInstanceId(CodeEditorTextArea);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/code-editor/code-editor-text-area.js"],"names":["Textarea","__","useEffect","useState","useRef","useInstanceId","VisuallyHidden","CodeEditorTextArea","value","onChange","onInput","stateValue","setStateValue","isDirty","setIsDirty","instanceId","valueRef","onCh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,CAyC1E;;;AACAZ,EAAAA,SAAS,CAAE,MAAM;AAChB,WAAO,MAAM;AACZ,UAAKc,QAAQ,CAACK,OAAd,EAAwB;AACvBZ,QAAAA,QAAQ,CAAEO,QAAQ,CAACK,OAAX,CAAR;AACA;AACD,KAJD;AAKA,GANQ,EAMN,EANM,CAAT;AAQA,SACC,8BACC,cAAC,cAAD;AACC,IAAA,EAAE,EAAC,OADJ;AAEC,IAAA,OAAO,EAAI,yBAAyBN,UAAY;AAFjD,KAIGd,EAAE,CAAE,mBAAF,CAJL,CADD,EAOC,cAAC,QAAD;AACC,IAAA,YAAY,EAAC,KADd;AAEC,IAAA,GAAG,EAAC,MAFL;AAGC,IAAA,KAAK,EAAGU,UAHT;AAIC,IAAA,QAAQ,EAAGM,eAJZ;AAKC,IAAA,MAAM,EAAGK,WALV;AAMC,IAAA,SAAS,EAAC,iCANX;AAOC,IAAA,EAAE,EAAI,yBAAyBP,UAAY,EAP5C;AAQC,IAAA,WAAW,EAAGd,EAAE,CAAE,iCAAF;AARjB,IAPD,CADD;AAoBA","sourcesContent":["/**\n * External dependencies\n */\nimport Textarea from 'react-autosize-textarea';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect, useState, useRef } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { VisuallyHidden } from '@wordpress/components';\n\nexport default function CodeEditorTextArea( { value, onChange, onInput } ) {\n\tconst [ stateValue, setStateValue ] = useState( value );\n\tconst [ isDirty, setIsDirty ] = useState( false );\n\tconst instanceId = useInstanceId( CodeEditorTextArea );\n\tconst valueRef = useRef();\n\n\tif ( ! isDirty && stateValue !== value ) {\n\t\tsetStateValue( value );\n\t}\n\n\t/**\n\t * Handles a textarea change event to notify the onChange prop callback and\n\t * reflect the new value in the component's own state. This marks the start\n\t * of the user's edits, if not already changed, preventing future props\n\t * changes to value from replacing the rendered value. This is expected to\n\t * be followed by a reset to dirty state via `stopEditing`.\n\t *\n\t * @see stopEditing\n\t *\n\t * @param {Event} event Change event.\n\t */\n\tconst onChangeHandler = ( event ) => {\n\t\tconst newValue = event.target.value;\n\t\tonInput( newValue );\n\t\tsetStateValue( newValue );\n\t\tsetIsDirty( true );\n\t\tvalueRef.current = newValue;\n\t};\n\n\t/**\n\t * Function called when the user has completed their edits, responsible for\n\t * ensuring that changes, if made, are surfaced to the onPersist prop\n\t * callback and resetting dirty state.\n\t */\n\tconst stopEditing = () => {\n\t\tif ( isDirty ) {\n\t\t\tonChange( stateValue );\n\t\t\tsetIsDirty( false );\n\t\t}\n\t};\n\n\t// Ensure changes aren't lost when component unmounts.\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tif ( valueRef.current ) {\n\t\t\t\tonChange( valueRef.current );\n\t\t\t}\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t<VisuallyHidden\n\t\t\t\tas=\"label\"\n\t\t\t\thtmlFor={ `code-editor-text-area-${ instanceId }` }\n\t\t\t>\n\t\t\t\t{ __( 'Type text or HTML' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t<Textarea\n\t\t\t\tautoComplete=\"off\"\n\t\t\t\tdir=\"auto\"\n\t\t\t\tvalue={ stateValue }\n\t\t\t\tonChange={ onChangeHandler }\n\t\t\t\tonBlur={ stopEditing }\n\t\t\t\tclassName=\"edit-site-code-editor-text-area\"\n\t\t\t\tid={ `code-editor-text-area-${ instanceId }` }\n\t\t\t\tplaceholder={ __( 'Start writing with text or HTML' ) }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/code-editor/code-editor-text-area.js"],"names":["Textarea","__","useEffect","useState","useRef","useInstanceId","VisuallyHidden","CodeEditorTextArea","value","onChange","onInput","stateValue","setStateValue","isDirty","setIsDirty","instanceId","valueRef","onChangeHandler","event","newValue","target","current","stopEditing"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,QAAP,MAAqB,yBAArB;AAEA;AACA;AAC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ACvBZ,QAAAA,QAAQ,CAAEO,QAAQ,CAACK,OAAX,CAAR;AACA;AACD,KAJD;AAKA,GANQ,EAMN,EANM,CAAT;AAQA,SACC,8BACC,cAAC,cAAD;AACC,IAAA,EAAE,EAAC,OADJ;AAEC,IAAA,OAAO,EAAI,yBAAyBN,UAAY;AAFjD,KAIGd,EAAE,CAAE,mBAAF,CAJL,CADD,EAOC,cAAC,QAAD;AACC,IAAA,YAAY,EAAC,KADd;AAEC,IAAA,GAAG,EAAC,MAFL;AAGC,IAAA,KAAK,EAAGU,UAHT;AAIC,IAAA,QAAQ,EAAGM,eAJZ;AAKC,IAAA,MAAM,EAAGK,WALV;AAMC,IAAA,SAAS,EAAC,iCANX;AAOC,IAAA,EAAE,EAAI,yBAAyBP,UAAY,EAP5C;AAQC,IAAA,WAAW,EAAGd,EAAE,CAAE,iCAAF;AARjB,IAPD,CADD;AAoBA","sourcesContent":["/**\n * External dependencies\n */\nimport Textarea from 'react-autosize-textarea';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect, useState, useRef } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { VisuallyHidden } from '@wordpress/components';\n\nexport default function CodeEditorTextArea( { value, onChange, onInput } ) {\n\tconst [ stateValue, setStateValue ] = useState( value );\n\tconst [ isDirty, setIsDirty ] = useState( false );\n\tconst instanceId = useInstanceId( CodeEditorTextArea );\n\tconst valueRef = useRef();\n\n\tif ( ! isDirty && stateValue !== value ) {\n\t\tsetStateValue( value );\n\t}\n\n\t/**\n\t * Handles a textarea change event to notify the onChange prop callback and\n\t * reflect the new value in the component's own state. This marks the start\n\t * of the user's edits, if not already changed, preventing future props\n\t * changes to value from replacing the rendered value. This is expected to\n\t * be followed by a reset to dirty state via `stopEditing`.\n\t *\n\t * @see stopEditing\n\t *\n\t * @param {Event} event Change event.\n\t */\n\tconst onChangeHandler = ( event ) => {\n\t\tconst newValue = event.target.value;\n\t\tonInput( newValue );\n\t\tsetStateValue( newValue );\n\t\tsetIsDirty( true );\n\t\tvalueRef.current = newValue;\n\t};\n\n\t/**\n\t * Function called when the user has completed their edits, responsible for\n\t * ensuring that changes, if made, are surfaced to the onPersist prop\n\t * callback and resetting dirty state.\n\t */\n\tconst stopEditing = () => {\n\t\tif ( isDirty ) {\n\t\t\tonChange( stateValue );\n\t\t\tsetIsDirty( false );\n\t\t}\n\t};\n\n\t// Ensure changes aren't lost when component unmounts.\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tif ( valueRef.current ) {\n\t\t\t\tonChange( valueRef.current );\n\t\t\t}\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t<VisuallyHidden\n\t\t\t\tas=\"label\"\n\t\t\t\thtmlFor={ `code-editor-text-area-${ instanceId }` }\n\t\t\t>\n\t\t\t\t{ __( 'Type text or HTML' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t<Textarea\n\t\t\t\tautoComplete=\"off\"\n\t\t\t\tdir=\"auto\"\n\t\t\t\tvalue={ stateValue }\n\t\t\t\tonChange={ onChangeHandler }\n\t\t\t\tonBlur={ stopEditing }\n\t\t\t\tclassName=\"edit-site-code-editor-text-area\"\n\t\t\t\tid={ `code-editor-text-area-${ instanceId }` }\n\t\t\t\tplaceholder={ __( 'Start writing with text or HTML' ) }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"]}