@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":["BlockInspectorButton","onClick","shortcut","isBlockInspectorOpen","select","keyboardShortcutsStore","getShortcutRepresentation","interfaceStore","getActiveComplementaryArea","editSiteStore","name","SIDEBAR_BLOCK","enableComplementaryArea","disableComplementaryArea","label","STORE_NAME"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAfA;AACA;AACA;;AAQA;AACA;AACA;AAKe,SAASA,oBAAT,OAAwD;AAAA,MAAzB;AAAEC,IAAAA,OAAO,GAAG,MAAM,CAAE;AAApB,GAAyB;AACtE,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAqC,qBACxCC,MAAF,KAAgB;AACfF,IAAAA,QAAQ,EAAEE,MAAM,CACfC,wBADe,CAAN,CAERC,yBAFQ,CAGT,8CAHS,CADK;AAMfH,IAAAA,oBAAoB,EACnBC,MAAM,CAAEG,gBAAF,CAAN,CAAyBC,0BAAzB,CACCC,aAAcC,IADf,MAEMC;AATQ,GAAhB,CAD0C,EAY1C,EAZ0C,CAA3C;AAcA,QAAM;AAAEC,IAAAA,uBAAF;AAA2BC,IAAAA;AAA3B,MACL,uBAAaN,gBAAb,CADD;AAGA,QAAMO,KAAK,GAAGX,oBAAoB,GAC/B,cAAI,oBAAJ,CAD+B,GAE/B,cAAI,oBAAJ,CAFH;AAIA,SACC,4BAAC,oBAAD;AACC,IAAA,OAAO,EAAG,MAAM;AACf,UAAKA,oBAAL,EAA4B;AAC3BU,QAAAA,wBAAwB,CAAEE,qBAAF,CAAxB;AACA,yBAAO,cAAI,uBAAJ,CAAP;AACA,OAHD,MAGO;AACNH,QAAAA,uBAAuB,CAAEG,qBAAF,EAAcJ,yBAAd,CAAvB;AACA,yBACC,cACC,4EADD,CADD;AAKA,OAXc,CAYf;;;AACAV,MAAAA,OAAO;AACP,KAfF;AAgBC,IAAA,QAAQ,EAAGC;AAhBZ,KAkBGY,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":["BlockInspectorButton","onClick","shortcut","isBlockInspectorOpen","select","keyboardShortcutsStore","getShortcutRepresentation","interfaceStore","getActiveComplementaryArea","editSiteStore","name","SIDEBAR_BLOCK","enableComplementaryArea","disableComplementaryArea","label","STORE_NAME"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAfA;AACA;AACA;;AAQA;AACA;AACA;AAKe,SAASA,oBAAT,CAA+B;AAAEC,EAAAA,OAAO,GAAG,MAAM,CAAE;AAApB,CAA/B,EAAwD;AACtE,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAqC,qBACxCC,MAAF,KAAgB;AACfF,IAAAA,QAAQ,EAAEE,MAAM,CACfC,wBADe,CAAN,CAERC,yBAFQ,CAGT,8CAHS,CADK;AAMfH,IAAAA,oBAAoB,EACnBC,MAAM,CAAEG,gBAAF,CAAN,CAAyBC,0BAAzB,CACCC,aAAcC,IADf,MAEMC;AATQ,GAAhB,CAD0C,EAY1C,EAZ0C,CAA3C;AAcA,QAAM;AAAEC,IAAAA,uBAAF;AAA2BC,IAAAA;AAA3B,MACL,uBAAaN,gBAAb,CADD;AAGA,QAAMO,KAAK,GAAGX,oBAAoB,GAC/B,cAAI,oBAAJ,CAD+B,GAE/B,cAAI,oBAAJ,CAFH;AAIA,SACC,4BAAC,oBAAD;AACC,IAAA,OAAO,EAAG,MAAM;AACf,UAAKA,oBAAL,EAA4B;AAC3BU,QAAAA,wBAAwB,CAAEE,qBAAF,CAAxB;AACA,yBAAO,cAAI,uBAAJ,CAAP;AACA,OAHD,MAGO;AACNH,QAAAA,uBAAuB,CAAEG,qBAAF,EAAcJ,yBAAd,CAAvB;AACA,yBACC,cACC,4EADD,CADD;AAKA,OAXc,CAYf;;;AACAV,MAAAA,OAAO;AACP,KAfF;AAgBC,IAAA,QAAQ,EAAGC;AAhBZ,KAkBGY,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"]}
@@ -36,13 +36,12 @@ var _store = require("../../store");
36
36
  /**
37
37
  * Internal dependencies
38
38
  */
39
- function EditorCanvas(_ref) {
40
- let {
41
- enableResizing,
42
- settings,
43
- children,
44
- ...props
45
- } = _ref;
39
+ function EditorCanvas({
40
+ enableResizing,
41
+ settings,
42
+ children,
43
+ ...props
44
+ }) {
46
45
  const {
47
46
  canvasMode,
48
47
  deviceType,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/editor-canvas.js"],"names":["EditorCanvas","enableResizing","settings","children","props","canvasMode","deviceType","isZoomOutMode","select","editSiteStore","__experimentalGetPreviewDeviceType","blockEditorStore","__unstableGetEditorMode","getCanvasMode","setCanvasMode","deviceStyles","mouseMoveTypingRef","isFocused","setIsFocused","viewModeProps","role","tabIndex","onFocus","onBlur","onKeyDown","event","keyCode","ENTER","SPACE","preventDefault","onClick","readonly","undefined","styles"],"mappings":";;;;;;;;;AAiBA;;;;AAdA;;AAKA;;AAOA;;AACA;;AAEA;;AAKA;;AACA;;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;AAIA,SAASA,YAAT,OAA0E;AAAA,MAAnD;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,QAAlB;AAA4BC,IAAAA,QAA5B;AAAsC,OAAGC;AAAzC,GAAmD;AACzE,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,UAAd;AAA0BC,IAAAA;AAA1B,MAA4C,qBAC/CC,MAAF,KAAgB;AACfF,IAAAA,UAAU,EACTE,MAAM,CAAEC,YAAF,CAAN,CAAwBC,kCAAxB,EAFc;AAGfH,IAAAA,aAAa,EACZC,MAAM,CAAEG,kBAAF,CAAN,CAA2BC,uBAA3B,OACA,UALc;AAMfP,IAAAA,UAAU,EAAE,yBAAQG,MAAM,CAAEC,YAAF,CAAd,EAAkCI,aAAlC;AANG,GAAhB,CADiD,EASjD,EATiD,C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AAA,IAAI,EAAC,eANN;AAOC,IAAA,SAAS,EAAG,yBAAY,wCAAZ,EAAsD;AACjE,oBAAcC,SAAS,IAAIZ,UAAU,KAAK;AADuB,KAAtD;AAPb,KAUMD,KAVN,EAWQC,UAAU,KAAK,MAAf,GAAwBc,aAAxB,GAAwC,EAXhD,GAaC,4BAAC,mCAAD;AAAc,IAAA,MAAM,EAAGjB,QAAQ,CAAC+B;AAAhC,IAbD,EAcC,2CACC;AACA;AACC,0CACA;AACA;AACAhC,EAAAA,cAAc,GAAG,yBAAH,GAA+B,EAC7C,4BACAI,UAAU,KAAK,MAAf,GAAwB,kBAAxB,GAA6C,EAC7C,IATF,CAdD,EAyBGF,QAzBH,CADD;AA6BA;;eAEcH,Y","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\nimport { useState, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\nfunction EditorCanvas( { enableResizing, settings, children, ...props } ) {\n\tconst { canvasMode, deviceType, isZoomOutMode } = useSelect(\n\t\t( select ) => ( {\n\t\t\tdeviceType:\n\t\t\t\tselect( editSiteStore ).__experimentalGetPreviewDeviceType(),\n\t\t\tisZoomOutMode:\n\t\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() ===\n\t\t\t\t'zoom-out',\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst mouseMoveTypingRef = useMouseMoveTypingReset();\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( canvasMode === 'edit' ) {\n\t\t\tsetIsFocused( false );\n\t\t}\n\t}, [ canvasMode ] );\n\n\tconst viewModeProps = {\n\t\t'aria-label': __( 'Editor Canvas' ),\n\t\trole: 'button',\n\t\ttabIndex: 0,\n\t\tonFocus: () => setIsFocused( true ),\n\t\tonBlur: () => setIsFocused( false ),\n\t\tonKeyDown: ( event ) => {\n\t\t\tconst { keyCode } = event;\n\t\t\tif ( keyCode === ENTER || keyCode === SPACE ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t}\n\t\t},\n\t\tonClick: () => setCanvasMode( 'edit' ),\n\t\treadonly: true,\n\t};\n\n\treturn (\n\t\t<Iframe\n\t\t\texpand={ isZoomOutMode }\n\t\t\tscale={ ( isZoomOutMode && 0.45 ) || undefined }\n\t\t\tframeSize={ isZoomOutMode ? 100 : undefined }\n\t\t\tstyle={ enableResizing ? {} : deviceStyles }\n\t\t\tref={ mouseMoveTypingRef }\n\t\t\tname=\"editor-canvas\"\n\t\t\tclassName={ classnames( 'edit-site-visual-editor__editor-canvas', {\n\t\t\t\t'is-focused': isFocused && canvasMode === 'view',\n\t\t\t} ) }\n\t\t\t{ ...props }\n\t\t\t{ ...( canvasMode === 'view' ? viewModeProps : {} ) }\n\t\t>\n\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t<style>{\n\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t`.is-root-container{display:flow-root;${\n\t\t\t\t\t// Some themes will have `min-height: 100vh` for the root container,\n\t\t\t\t\t// which isn't a requirement in auto resize mode.\n\t\t\t\t\tenableResizing ? 'min-height:0!important;' : ''\n\t\t\t\t}}body{position:relative; ${\n\t\t\t\t\tcanvasMode === 'view' ? 'cursor: pointer;' : ''\n\t\t\t\t}}}`\n\t\t\t}</style>\n\t\t\t{ children }\n\t\t</Iframe>\n\t);\n}\n\nexport default EditorCanvas;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/editor-canvas.js"],"names":["EditorCanvas","enableResizing","settings","children","props","canvasMode","deviceType","isZoomOutMode","select","editSiteStore","__experimentalGetPreviewDeviceType","blockEditorStore","__unstableGetEditorMode","getCanvasMode","setCanvasMode","deviceStyles","mouseMoveTypingRef","isFocused","setIsFocused","viewModeProps","role","tabIndex","onFocus","onBlur","onKeyDown","event","keyCode","ENTER","SPACE","preventDefault","onClick","readonly","undefined","styles"],"mappings":";;;;;;;;;AAiBA;;;;AAdA;;AAKA;;AAOA;;AACA;;AAEA;;AAKA;;AACA;;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;AAIA,SAASA,YAAT,CAAuB;AAAEC,EAAAA,cAAF;AAAkBC,EAAAA,QAAlB;AAA4BC,EAAAA,QAA5B;AAAsC,KAAGC;AAAzC,CAAvB,EAA0E;AACzE,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,UAAd;AAA0BC,IAAAA;AAA1B,MAA4C,qBAC/CC,MAAF,KAAgB;AACfF,IAAAA,UAAU,EACTE,MAAM,CAAEC,YAAF,CAAN,CAAwBC,kCAAxB,EAFc;AAGfH,IAAAA,aAAa,EACZC,MAAM,CAAEG,kBAAF,CAAN,CAA2BC,uBAA3B,OACA,UALc;AAMfP,IAAAA,UAAU,EAAE,yBAAQG,MAAM,CAAEC,YAAF,CAAd,EAAkCI,aAAlC;AANG,GAAhB,CADiD,EASjD,EATiD,CAAlD;AAWA,QAAM;AAAEC,IAAAA;AAAF,MAAoB,yBAAQ,uBAAaL,YAAb,CAAR,CAA1B;AACA,QAAMM,YAAY,GAAG,gDAAiBT,UAAjB,CAArB;AACA,QA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KAVN,EAWQC,UAAU,KAAK,MAAf,GAAwBc,aAAxB,GAAwC,EAXhD,GAaC,4BAAC,mCAAD;AAAc,IAAA,MAAM,EAAGjB,QAAQ,CAAC+B;AAAhC,IAbD,EAcC,2CACC;AACA;AACC,0CACA;AACA;AACAhC,EAAAA,cAAc,GAAG,yBAAH,GAA+B,EAC7C,4BACAI,UAAU,KAAK,MAAf,GAAwB,kBAAxB,GAA6C,EAC7C,IATF,CAdD,EAyBGF,QAzBH,CADD;AA6BA;;eAEcH,Y","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\nimport { useState, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\nfunction EditorCanvas( { enableResizing, settings, children, ...props } ) {\n\tconst { canvasMode, deviceType, isZoomOutMode } = useSelect(\n\t\t( select ) => ( {\n\t\t\tdeviceType:\n\t\t\t\tselect( editSiteStore ).__experimentalGetPreviewDeviceType(),\n\t\t\tisZoomOutMode:\n\t\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() ===\n\t\t\t\t'zoom-out',\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst mouseMoveTypingRef = useMouseMoveTypingReset();\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( canvasMode === 'edit' ) {\n\t\t\tsetIsFocused( false );\n\t\t}\n\t}, [ canvasMode ] );\n\n\tconst viewModeProps = {\n\t\t'aria-label': __( 'Editor Canvas' ),\n\t\trole: 'button',\n\t\ttabIndex: 0,\n\t\tonFocus: () => setIsFocused( true ),\n\t\tonBlur: () => setIsFocused( false ),\n\t\tonKeyDown: ( event ) => {\n\t\t\tconst { keyCode } = event;\n\t\t\tif ( keyCode === ENTER || keyCode === SPACE ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t}\n\t\t},\n\t\tonClick: () => setCanvasMode( 'edit' ),\n\t\treadonly: true,\n\t};\n\n\treturn (\n\t\t<Iframe\n\t\t\texpand={ isZoomOutMode }\n\t\t\tscale={ ( isZoomOutMode && 0.45 ) || undefined }\n\t\t\tframeSize={ isZoomOutMode ? 100 : undefined }\n\t\t\tstyle={ enableResizing ? {} : deviceStyles }\n\t\t\tref={ mouseMoveTypingRef }\n\t\t\tname=\"editor-canvas\"\n\t\t\tclassName={ classnames( 'edit-site-visual-editor__editor-canvas', {\n\t\t\t\t'is-focused': isFocused && canvasMode === 'view',\n\t\t\t} ) }\n\t\t\t{ ...props }\n\t\t\t{ ...( canvasMode === 'view' ? viewModeProps : {} ) }\n\t\t>\n\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t<style>{\n\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t`.is-root-container{display:flow-root;${\n\t\t\t\t\t// Some themes will have `min-height: 100vh` for the root container,\n\t\t\t\t\t// which isn't a requirement in auto resize mode.\n\t\t\t\t\tenableResizing ? 'min-height:0!important;' : ''\n\t\t\t\t}}body{position:relative; ${\n\t\t\t\t\tcanvasMode === 'view' ? 'cursor: pointer;' : ''\n\t\t\t\t}}}`\n\t\t\t}</style>\n\t\t\t{ children }\n\t\t</Iframe>\n\t);\n}\n\nexport default EditorCanvas;\n"]}
@@ -39,6 +39,8 @@ var _privateApis = require("../../private-apis");
39
39
 
40
40
  var _editorCanvasContainer = _interopRequireDefault(require("../editor-canvas-container"));
41
41
 
42
+ var _pageContentLock = require("../page-content-lock");
43
+
42
44
  /**
43
45
  * External dependencies
44
46
  */
@@ -68,17 +70,20 @@ function BlockEditor() {
68
70
  const {
69
71
  storedSettings,
70
72
  templateType,
71
- canvasMode
73
+ canvasMode,
74
+ hasPageContentLock
72
75
  } = (0, _data.useSelect)(select => {
73
76
  const {
74
77
  getSettings,
75
78
  getEditedPostType,
76
- getCanvasMode
79
+ getCanvasMode,
80
+ hasPageContentLock: _hasPageContentLock
77
81
  } = (0, _privateApis.unlock)(select(_store.store));
78
82
  return {
79
83
  storedSettings: getSettings(setIsInserterOpened),
80
84
  templateType: getEditedPostType(),
81
- canvasMode: getCanvasMode()
85
+ canvasMode: getCanvasMode(),
86
+ hasPageContentLock: _hasPageContentLock()
82
87
  };
83
88
  }, [setIsInserterOpened]);
84
89
  const settingsBlockPatterns = (_storedSettings$__exp = storedSettings.__experimentalAdditionalBlockPatterns) !== null && _storedSettings$__exp !== void 0 ? _storedSettings$__exp : // WP 6.0
@@ -94,10 +99,9 @@ function BlockEditor() {
94
99
  restBlockPatterns: select(_coreData.store).getBlockPatterns(),
95
100
  restBlockPatternCategories: select(_coreData.store).getBlockPatternCategories()
96
101
  }), []);
97
- const blockPatterns = (0, _element.useMemo)(() => [...(settingsBlockPatterns || []), ...(restBlockPatterns || [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)).filter(_ref => {
98
- let {
99
- postTypes
100
- } = _ref;
102
+ const blockPatterns = (0, _element.useMemo)(() => [...(settingsBlockPatterns || []), ...(restBlockPatterns || [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)).filter(({
103
+ postTypes
104
+ }) => {
101
105
  return !postTypes || Array.isArray(postTypes) && postTypes.includes(templateType);
102
106
  }), [settingsBlockPatterns, restBlockPatterns, templateType]);
103
107
  const blockPatternCategories = (0, _element.useMemo)(() => [...(settingsBlockPatternCategories || []), ...(restBlockPatternCategories || [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)), [settingsBlockPatternCategories, restBlockPatternCategories]);
@@ -115,7 +119,7 @@ function BlockEditor() {
115
119
  }, [storedSettings, blockPatterns, blockPatternCategories]);
116
120
  const [blocks, onInput, onChange] = (0, _coreData.useEntityBlockEditor)('postType', templateType);
117
121
  const contentRef = (0, _element.useRef)();
118
- const mergedRefs = (0, _compose.useMergeRefs)([contentRef, (0, _blockEditor.__unstableUseClipboardHandler)(), (0, _blockEditor.__unstableUseTypingObserver)()]);
122
+ const mergedRefs = (0, _compose.useMergeRefs)([contentRef, (0, _blockEditor.__unstableUseClipboardHandler)(), (0, _blockEditor.__unstableUseTypingObserver)(), (0, _pageContentLock.usePageContentLockNotifications)()]);
119
123
  const isMobileViewport = (0, _compose.useViewportMatch)('small', '<');
120
124
  const {
121
125
  clearSelectedBlock
@@ -133,10 +137,9 @@ function BlockEditor() {
133
137
  onInput: onInput,
134
138
  onChange: onChange,
135
139
  useSubRegistry: false
136
- }, (0, _element.createElement)(_templatePartConverter.default, null), (0, _element.createElement)(_sidebarEditMode.SidebarInspectorFill, null, (0, _element.createElement)(_blockEditor.BlockInspector, null)), (0, _element.createElement)(_editorCanvasContainer.default.Slot, null, _ref2 => {
140
+ }, hasPageContentLock && (0, _element.createElement)(_pageContentLock.PageContentLock, null), (0, _element.createElement)(_templatePartConverter.default, null), (0, _element.createElement)(_sidebarEditMode.SidebarInspectorFill, null, (0, _element.createElement)(_blockEditor.BlockInspector, null)), (0, _element.createElement)(_editorCanvasContainer.default.Slot, null, ([editorCanvasView]) => {
137
141
  var _sizes$height;
138
142
 
139
- let [editorCanvasView] = _ref2;
140
143
  return editorCanvasView ? (0, _element.createElement)("div", {
141
144
  className: "edit-site-visual-editor is-focus-mode"
142
145
  }, editorCanvasView) : (0, _element.createElement)(_blockEditor.BlockTools, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["ExperimentalBlockEditorProvider","blockEditorPrivateApis","LAYOUT","type","alignments","BlockEditor","setIsInserterOpened","editSiteStore","storedSettings","templateType","canvasMode","select","getSettings","getEditedPostType","getCanvasMode","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","coreStore","getBlockPatterns","getBlockPatternCategories","blockPatterns","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","settings","restStoredSettings","inserterMediaCategories","blocks","onInput","onChange","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","blockEditorStore","resizeObserver","sizes","isTemplatePart","hasBlocks","length","enableResizing","isViewMode","showBlockAppender","undefined","editorCanvasView","event","target","currentTarget","height"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AAUA;;AAKA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvCA;AACA;AACA;;AAGA;AACA;AACA;;AAqBA;AACA;AACA;AAWA,MAAM;AAAEA,EAAAA;AAAF,IAAsC,yBAAQC,wBAAR,CAA5C;AAEA,MAAMC,MAAM,GAAG;AACdC,EAAAA,IAAI,EAAE,SADQ;AAEd;AACAC,EAAAA,UAAU,EAAE;AAHE,CAAf;;AAMe,SAASC,WAAT,GAAuB;AAAA;;AACrC,QAAM;AAAEC,IAAAA;AAAF,MAA0B,uBAAaC,YAAb,CAAhC;AACA,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,YAAlB;AAAgCC,IAAAA;AAAhC,MAA+C,qBAClDC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,WAAF;AAAeC,MAAAA,iBAAf;AAAkCC,MAAAA;AAAlC,QAAoD,yBACzDH,MAAM,CAA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AAA,QAAQ,EAAGhB,QAFZ;AAGC,MAAA,UAAU,EAAGO,UAHd;AAIC,MAAA,QAAQ,EAAGpC,UAAU,KAAK;AAJ3B,OAMGwC,cANH,EAOC,4BAAC,sBAAD;AACC,MAAA,SAAS,EAAC,mDADX;AAEC,MAAA,oBAAoB,EAAGhD,MAFxB;AAGC,MAAA,cAAc,EAAGuD;AAHlB,MAPD,CAJD,CAhBD,CANA;AAAA,GADH,CAXD,EAwDC,4BAAC,uCAAD,OAxDD,CADD;AA4DA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo, useRef } from '@wordpress/element';\nimport { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data';\nimport {\n\tBlockList,\n\tBlockInspector,\n\tBlockTools,\n\t__unstableUseClipboardHandler as useClipboardHandler,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tBlockEditorKeyboardShortcuts,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tuseMergeRefs,\n\tuseViewportMatch,\n\tuseResizeObserver,\n} from '@wordpress/compose';\nimport { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';\n\n/**\n * Internal dependencies\n */\nimport inserterMediaCategories from './inserter-media-categories';\nimport TemplatePartConverter from '../template-part-converter';\nimport { SidebarInspectorFill } from '../sidebar-edit-mode';\nimport { store as editSiteStore } from '../../store';\nimport BackButton from './back-button';\nimport ResizableEditor from './resizable-editor';\nimport EditorCanvas from './editor-canvas';\nimport { unlock } from '../../private-apis';\nimport EditorCanvasContainer from '../editor-canvas-container';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\n\nconst LAYOUT = {\n\ttype: 'default',\n\t// At the root level of the site editor, no alignments should be allowed.\n\talignments: [],\n};\n\nexport default function BlockEditor() {\n\tconst { setIsInserterOpened } = useDispatch( editSiteStore );\n\tconst { storedSettings, templateType, canvasMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, getEditedPostType, getCanvasMode } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tstoredSettings: getSettings( setIsInserterOpened ),\n\t\t\t\ttemplateType: getEditedPostType(),\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t};\n\t\t},\n\t\t[ setIsInserterOpened ]\n\t);\n\n\tconst settingsBlockPatterns =\n\t\tstoredSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tstoredSettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories:\n\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( templateType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, templateType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst settings = useMemo( () => {\n\t\tconst {\n\t\t\t__experimentalAdditionalBlockPatterns,\n\t\t\t__experimentalAdditionalBlockPatternCategories,\n\t\t\t...restStoredSettings\n\t\t} = storedSettings;\n\n\t\treturn {\n\t\t\t...restStoredSettings,\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t};\n\t}, [ storedSettings, blockPatterns, blockPatternCategories ] );\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplateType\n\t);\n\n\tconst contentRef = useRef();\n\tconst mergedRefs = useMergeRefs( [\n\t\tcontentRef,\n\t\tuseClipboardHandler(),\n\t\tuseTypingObserver(),\n\t] );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\n\tconst isTemplatePart = templateType === 'wp_template_part';\n\n\tconst hasBlocks = blocks.length !== 0;\n\tconst enableResizing =\n\t\tisTemplatePart &&\n\t\tcanvasMode !== 'view' &&\n\t\t// Disable resizing in mobile viewport.\n\t\t! isMobileViewport;\n\tconst isViewMode = canvasMode === 'view';\n\tconst showBlockAppender =\n\t\t( isTemplatePart && hasBlocks ) || isViewMode ? false : undefined;\n\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tsettings={ settings }\n\t\t\tvalue={ blocks }\n\t\t\tonInput={ onInput }\n\t\t\tonChange={ onChange }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t<TemplatePartConverter />\n\t\t\t<SidebarInspectorFill>\n\t\t\t\t<BlockInspector />\n\t\t\t</SidebarInspectorFill>\n\t\t\t<EditorCanvasContainer.Slot>\n\t\t\t\t{ ( [ editorCanvasView ] ) =>\n\t\t\t\t\teditorCanvasView ? (\n\t\t\t\t\t\t<div className=\"edit-site-visual-editor is-focus-mode\">\n\t\t\t\t\t\t\t{ editorCanvasView }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<BlockTools\n\t\t\t\t\t\t\tclassName={ classnames( 'edit-site-visual-editor', {\n\t\t\t\t\t\t\t\t'is-focus-mode':\n\t\t\t\t\t\t\t\t\tisTemplatePart || !! editorCanvasView,\n\t\t\t\t\t\t\t\t'is-view-mode': isViewMode,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t__unstableContentRef={ contentRef }\n\t\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\t\t// Clear selected block when clicking on the gray background.\n\t\t\t\t\t\t\t\tif ( event.target === event.currentTarget ) {\n\t\t\t\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t\t\t\t\t<BackButton />\n\t\t\t\t\t\t\t<ResizableEditor\n\t\t\t\t\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\t\t\t\t\theight={ sizes.height ?? '100%' }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<EditorCanvas\n\t\t\t\t\t\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\t\tcontentRef={ mergedRefs }\n\t\t\t\t\t\t\t\t\treadonly={ canvasMode === 'view' }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ resizeObserver }\n\t\t\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-block-editor__block-list wp-site-blocks\"\n\t\t\t\t\t\t\t\t\t\t__experimentalLayout={ LAYOUT }\n\t\t\t\t\t\t\t\t\t\trenderAppender={ showBlockAppender }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</EditorCanvas>\n\t\t\t\t\t\t\t</ResizableEditor>\n\t\t\t\t\t\t</BlockTools>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t</EditorCanvasContainer.Slot>\n\t\t\t<ReusableBlocksMenuItems />\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["ExperimentalBlockEditorProvider","blockEditorPrivateApis","LAYOUT","type","alignments","BlockEditor","setIsInserterOpened","editSiteStore","storedSettings","templateType","canvasMode","hasPageContentLock","select","getSettings","getEditedPostType","getCanvasMode","_hasPageContentLock","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","coreStore","getBlockPatterns","getBlockPatternCategories","blockPatterns","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","settings","restStoredSettings","inserterMediaCategories","blocks","onInput","onChange","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","blockEditorStore","resizeObserver","sizes","isTemplatePart","hasBlocks","length","enableResizing","isViewMode","showBlockAppender","undefined","editorCanvasView","event","target","currentTarget","height"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AAUA;;AAKA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAxCA;AACA;AACA;;AAGA;AACA;AACA;;AAqBA;AACA;AACA;AAeA,MAAM;AAAEA,EAAAA;AAAF,IAAsC,yBAAQC,wBAAR,CAA5C;AAEA,MAAMC,MAAM,GAAG;AACdC,EAAAA,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AAClD,yBACCP,cAAc,IAAI,CAAC,CAAEO,gBAF4B;AAGlD,wBAAgBH;AAHkC,OAAvC,CADb;AAMC,MAAA,oBAAoB,EAAGX,UANxB;AAOC,MAAA,OAAO,EAAKe,KAAF,IAAa;AACtB;AACA,YAAKA,KAAK,CAACC,MAAN,KAAiBD,KAAK,CAACE,aAA5B,EAA4C;AAC3Cd,UAAAA,kBAAkB;AAClB;AACD;AAZF,OAcC,4BAAC,yCAAD,CAA8B,QAA9B,OAdD,EAeC,4BAAC,mBAAD,OAfD,EAgBC,4BAAC,wBAAD;AACC,MAAA,cAAc,EAAGO,cADlB;AAEC,MAAA,MAAM,mBAAGJ,KAAK,CAACY,MAAT,yDAAmB;AAF1B,OAIC,4BAAC,qBAAD;AACC,MAAA,cAAc,EAAGR,cADlB;AAEC,MAAA,QAAQ,EAAGhB,QAFZ;AAGC,MAAA,UAAU,EAAGO,UAHd;AAIC,MAAA,QAAQ,EAAGtC,UAAU,KAAK;AAJ3B,OAMG0C,cANH,EAOC,4BAAC,sBAAD;AACC,MAAA,SAAS,EAAC,mDADX;AAEC,MAAA,oBAAoB,EAAGlD,MAFxB;AAGC,MAAA,cAAc,EAAGyD;AAHlB,MAPD,CAJD,CAhBD,CANA;AAAA,GADH,CAZD,EAyDC,4BAAC,uCAAD,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"]}
@@ -110,21 +110,16 @@ const getOpenverseCaption = item => {
110
110
  return _caption.replace(/\s{2}/g, ' ');
111
111
  };
112
112
 
113
- const coreMediaFetch = async function () {
114
- let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
113
+ const coreMediaFetch = async (query = {}) => {
115
114
  const mediaItems = await (0, _data.resolveSelect)(_coreData.store).getMediaItems({ ...query,
116
- orderBy: !!(query !== null && query !== void 0 && query.search) ? 'relevance' : 'date'
117
- });
118
- return mediaItems.map(mediaItem => {
119
- var _mediaItem$media_deta, _mediaItem$media_deta2, _mediaItem$media_deta3, _mediaItem$caption;
120
-
121
- return { ...mediaItem,
122
- alt: mediaItem.alt_text,
123
- url: mediaItem.source_url,
124
- 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,
125
- caption: (_mediaItem$caption = mediaItem.caption) === null || _mediaItem$caption === void 0 ? void 0 : _mediaItem$caption.raw
126
- };
115
+ orderBy: !!query?.search ? 'relevance' : 'date'
127
116
  });
117
+ return mediaItems.map(mediaItem => ({ ...mediaItem,
118
+ alt: mediaItem.alt_text,
119
+ url: mediaItem.source_url,
120
+ previewUrl: mediaItem.media_details?.sizes?.medium?.source_url,
121
+ caption: mediaItem.caption?.raw
122
+ }));
128
123
  };
129
124
  /** @type {InserterMediaCategory[]} */
130
125
 
@@ -137,8 +132,7 @@ const inserterMediaCategories = [{
137
132
  },
138
133
  mediaType: 'image',
139
134
 
140
- async fetch() {
141
- let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
135
+ async fetch(query = {}) {
142
136
  return coreMediaFetch({ ...query,
143
137
  media_type: 'image'
144
138
  });
@@ -152,8 +146,7 @@ const inserterMediaCategories = [{
152
146
  },
153
147
  mediaType: 'video',
154
148
 
155
- async fetch() {
156
- let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
149
+ async fetch(query = {}) {
157
150
  return coreMediaFetch({ ...query,
158
151
  media_type: 'video'
159
152
  });
@@ -167,8 +160,7 @@ const inserterMediaCategories = [{
167
160
  },
168
161
  mediaType: 'audio',
169
162
 
170
- async fetch() {
171
- let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
163
+ async fetch(query = {}) {
172
164
  return coreMediaFetch({ ...query,
173
165
  media_type: 'audio'
174
166
  });
@@ -182,8 +174,7 @@ const inserterMediaCategories = [{
182
174
  },
183
175
  mediaType: 'image',
184
176
 
185
- async fetch() {
186
- let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
177
+ async fetch(query = {}) {
187
178
  const defaultArgs = {
188
179
  mature: false,
189
180
  excluded_source: 'flickr,inaturalist,wikimedia',
@@ -197,8 +188,7 @@ const inserterMediaCategories = [{
197
188
  search: 'q'
198
189
  };
199
190
  const url = new URL('https://api.openverse.engineering/v1/images/');
200
- Object.entries(finalQuery).forEach(_ref => {
201
- let [key, value] = _ref;
191
+ Object.entries(finalQuery).forEach(([key, value]) => {
202
192
  const queryKey = mapFromInserterMediaRequest[key] || key;
203
193
  url.searchParams.set(queryKey, value);
204
194
  });
@@ -209,27 +199,20 @@ const inserterMediaCategories = [{
209
199
  });
210
200
  const jsonResponse = await response.json();
211
201
  const results = jsonResponse.results;
212
- return results.map(result => {
213
- var _result$title;
214
-
215
- return { ...result,
216
- // This is a temp solution for better titles, until Openverse API
217
- // completes the cleaning up of some titles of their upstream data.
218
- title: (_result$title = result.title) !== null && _result$title !== void 0 && _result$title.toLowerCase().startsWith('file:') ? result.title.slice(5) : result.title,
219
- sourceId: result.id,
220
- id: undefined,
221
- caption: getOpenverseCaption(result),
222
- previewUrl: result.thumbnail
223
- };
224
- });
202
+ return results.map(result => ({ ...result,
203
+ // This is a temp solution for better titles, until Openverse API
204
+ // completes the cleaning up of some titles of their upstream data.
205
+ title: result.title?.toLowerCase().startsWith('file:') ? result.title.slice(5) : result.title,
206
+ sourceId: result.id,
207
+ id: undefined,
208
+ caption: getOpenverseCaption(result),
209
+ previewUrl: result.thumbnail
210
+ }));
225
211
  },
226
212
 
227
- getReportUrl: _ref2 => {
228
- let {
229
- sourceId
230
- } = _ref2;
231
- return `https://wordpress.org/openverse/image/${sourceId}/report/`;
232
- },
213
+ getReportUrl: ({
214
+ sourceId
215
+ }) => `https://wordpress.org/openverse/image/${sourceId}/report/`,
233
216
  isExternalResource: true
234
217
  }];
235
218
  var _default = inserterMediaCategories;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/inserter-media-categories.js"],"names":["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","coreStore","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":";;;;;;;AAWA;;AACA;;AACA;;AAKA;;AAlBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAMA,eAAe,GAAG,CAAEC,GAAF,EAAOC,IAAP,KACtB,MAAMC,yBAAyB,CAAEF,GAAF,CAAS,IAAIC,IAAM,MADpD;;AAGA,MAAMC,yBAAyB,GAAKF,GAAF,IAChC,SAASA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AO,EAAE;AACR,sBAAc;AADN;AADgC,KAAnB,CAAvB;AAKA,UAAMC,YAAY,GAAG,MAAMH,QAAQ,CAACI,IAAT,EAA3B;AACA,UAAMC,OAAO,GAAGF,YAAY,CAACE,OAA7B;AACA,WAAOA,OAAO,CAACtC,GAAR,CAAeuC,MAAF;AAAA;;AAAA,aAAgB,EACnC,GAAGA,MADgC;AAEnC;AACA;AACA1D,QAAAA,KAAK,EAAE,iBAAA0D,MAAM,CAAC1D,KAAP,wDAAc2D,WAAd,GAA4BC,UAA5B,CAAwC,OAAxC,IACJF,MAAM,CAAC1D,KAAP,CAAa6D,KAAb,CAAoB,CAApB,CADI,GAEJH,MAAM,CAAC1D,KANyB;AAOnC8D,QAAAA,QAAQ,EAAEJ,MAAM,CAACK,EAPkB;AAQnCA,QAAAA,EAAE,EAAEC,SAR+B;AASnCpC,QAAAA,OAAO,EAAE9B,mBAAmB,CAAE4D,MAAF,CATO;AAUnClC,QAAAA,UAAU,EAAEkC,MAAM,CAACO;AAVgB,OAAhB;AAAA,KAAb,CAAP;AAYA,GA5CF;;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;eAqFerC,uB","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":["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","coreStore","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":";;;;;;;AAWA;;AACA;;AACA;;AAKA;;AAlBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAMA,eAAe,GAAG,CA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ACR,sBAAc;AADN;AADgC,KAAnB,CAAvB;AAKA,UAAMC,YAAY,GAAG,MAAMH,QAAQ,CAACI,IAAT,EAA3B;AACA,UAAMC,OAAO,GAAGF,YAAY,CAACE,OAA7B;AACA,WAAOA,OAAO,CAACtC,GAAR,CAAeuC,MAAF,KAAgB,EACnC,GAAGA,MADgC;AAEnC;AACA;AACA1D,MAAAA,KAAK,EAAE0D,MAAM,CAAC1D,KAAP,EAAc2D,WAAd,GAA4BC,UAA5B,CAAwC,OAAxC,IACJF,MAAM,CAAC1D,KAAP,CAAa6D,KAAb,CAAoB,CAApB,CADI,GAEJH,MAAM,CAAC1D,KANyB;AAOnC8D,MAAAA,QAAQ,EAAEJ,MAAM,CAACK,EAPkB;AAQnCA,MAAAA,EAAE,EAAEC,SAR+B;AASnCpC,MAAAA,OAAO,EAAE9B,mBAAmB,CAAE4D,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;eAqFerC,uB","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"]}
@@ -33,12 +33,11 @@ const HANDLE_STYLES_OVERRIDE = {
33
33
  left: undefined
34
34
  };
35
35
 
36
- function ResizableEditor(_ref) {
37
- let {
38
- enableResizing,
39
- height,
40
- children
41
- } = _ref;
36
+ function ResizableEditor({
37
+ enableResizing,
38
+ height,
39
+ children
40
+ }) {
42
41
  const [width, setWidth] = (0, _element.useState)('100%');
43
42
  const resizableRef = (0, _element.useRef)();
44
43
  const resizeWidthBy = (0, _element.useCallback)(deltaPixels => {
@@ -48,7 +47,7 @@ function ResizableEditor(_ref) {
48
47
  }, []);
49
48
  return (0, _element.createElement)(_components.ResizableBox, {
50
49
  ref: api => {
51
- resizableRef.current = api === null || api === void 0 ? void 0 : api.resizable;
50
+ resizableRef.current = api?.resizable;
52
51
  },
53
52
  size: {
54
53
  width: enableResizing ? width : '100%',
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/resizable-editor.js"],"names":["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":";;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGA;AACA,MAAMA,sBAAsB,GAAG;AAC9BC,EAAAA,QAA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AG,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,4BAAC,qBAAD;AACC,QAAA,SAAS,EAAC,MADX;AAEC,QAAA,aAAa,EAAGM;AAFjB,QAFgB;AAOjBR,MAAAA,KAAK,EACJ,4BAAC,qBAAD;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;;eAEcF,e","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":["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":";;;;;;;;;AA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C,KAAR,CAAcpB,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,4BAAC,qBAAD;AACC,QAAA,SAAS,EAAC,MADX;AAEC,QAAA,aAAa,EAAGM;AAFjB,QAFgB;AAOjBR,MAAAA,KAAK,EACJ,4BAAC,qBAAD;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;;eAEcF,e","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"]}
@@ -18,13 +18,11 @@ var _components = require("@wordpress/components");
18
18
  */
19
19
  const DELTA_DISTANCE = 20; // The distance to resize per keydown in pixels.
20
20
 
21
- function ResizeHandle(_ref) {
22
- let {
23
- variation = 'default',
24
- direction,
25
- resizeWidthBy
26
- } = _ref;
27
-
21
+ function ResizeHandle({
22
+ variation = 'default',
23
+ direction,
24
+ resizeWidthBy
25
+ }) {
28
26
  function handleKeyDown(event) {
29
27
  const {
30
28
  keyCode
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/resize-handle.js"],"names":["DELTA_DISTANCE","ResizeHandle","variation","direction","resizeWidthBy","handleKeyDown","event","keyCode","LEFT","RIGHT"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;AAKA,MAAMA,cAAc,GAAG,EAAvB,C,CAA2B;;AAEZ,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,KAAKC,cAAtC,IACEL,SAAS,KAAK,OAAd,IAAyBI,OAAO,KAAKE,eAFxC,EAGE;AACDL,MAAAA,aAAa,CAAEJ,cAAF,CAAb;AACA,KALD,MAKO,IACJG,SAAS,KAAK,MAAd,IAAwBI,OAAO,KAAKE,eAAtC,IACEN,SAAS,KAAK,OAAd,IAAyBI,OAAO,KAAKC,cAFjC,EAGL;AACDJ,MAAAA,aAAa,CAAE,CAACJ,cAAH,CAAb;AACA;AACD;;AAED,SACC,qDACC;AACC,IAAA,SAAS,EAAI,oCAAoCG,SAAW,iBAAiBD,SAAW,EADzF;AAEC,kBAAa,cAAI,gBAAJ,CAFd;AAGC,wBAAoB,iCAAiCC,SAAW,EAHjE;AAIC,IAAA,SAAS,EAAGE;AAJb,IADD,EAOC,4BAAC,0BAAD;AACC,IAAA,EAAE,EAAI,iCAAiCF,SAAW;AADnD,KAGG,cAAI,qDAAJ,CAHH,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":["DELTA_DISTANCE","ResizeHandle","variation","direction","resizeWidthBy","handleKeyDown","event","keyCode","LEFT","RIGHT"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;AAKA,MAAMA,cAAc,GAAG,EAAvB,C,CAA2B;;AAEZ,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,KAAKC,cAAtC,IACEL,SAAS,KAAK,OAAd,IAAyBI,OAAO,KAAKE,eAFxC,EAGE;AACDL,MAAAA,aAAa,CAAEJ,cAAF,CAAb;AACA,KALD,MAKO,IACJG,SAAS,KAAK,MAAd,IAAwBI,OAAO,KAAKE,eAAtC,IACEN,SAAS,KAAK,OAAd,IAAyBI,OAAO,KAAKC,cAFjC,EAGL;AACDJ,MAAAA,aAAa,CAAE,CAACJ,cAAH,CAAb;AACA;AACD;;AAED,SACC,qDACC;AACC,IAAA,SAAS,EAAI,oCAAoCG,SAAW,iBAAiBD,SAAW,EADzF;AAEC,kBAAa,cAAI,gBAAJ,CAFd;AAGC,wBAAoB,iCAAiCC,SAAW,EAHjE;AAIC,IAAA,SAAS,EAAGE;AAJb,IADD,EAOC,4BAAC,0BAAD;AACC,IAAA,EAAE,EAAI,iCAAiCF,SAAW;AADnD,KAGG,cAAI,qDAAJ,CAHH,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"]}
@@ -24,12 +24,11 @@ var _components = require("@wordpress/components");
24
24
  /**
25
25
  * WordPress dependencies
26
26
  */
27
- function CodeEditorTextArea(_ref) {
28
- let {
29
- value,
30
- onChange,
31
- onInput
32
- } = _ref;
27
+ function CodeEditorTextArea({
28
+ value,
29
+ onChange,
30
+ onInput
31
+ }) {
33
32
  const [stateValue, setStateValue] = (0, _element.useState)(value);
34
33
  const [isDirty, setIsDirty] = (0, _element.useState)(false);
35
34
  const instanceId = (0, _compose.useInstanceId)(CodeEditorTextArea);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/code-editor/code-editor-text-area.js"],"names":["CodeEditorTextArea","value","onChange","onInput","stateValue","setStateValue","isDirty","setIsDirty","instanceId","valueRef","onChangeHandler","event","newValue","target","current","stopEditing"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;AAMe,SAASA,kBAAT,OAA4D;AAAA,MAA/B;AAAEC,IAAAA,KAAF;AAASC,IAAAA,QAAT;AAAmBC,IAAAA;AAAnB,GAA+B;AAC1E,QAAM,CAAEC,UAAF,EAAcC,aAAd,IAAgC,uBAAUJ,KAAV,CAAtC;AACA,QAAM,CAAEK,OAAF,EAAWC,UAAX,IAA0B,uBAAU,KAA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C,IAAA,EAAE,EAAI,yBAAyBP,UAAY,EAP5C;AAQC,IAAA,WAAW,EAAG,cAAI,iCAAJ;AARf,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":["CodeEditorTextArea","value","onChange","onInput","stateValue","setStateValue","isDirty","setIsDirty","instanceId","valueRef","onChangeHandler","event","newValue","target","current","stopEditing"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;AAMe,SAASA,kBAAT,CAA6B;AAAEC,EAAAA,KAAF;AAASC,EAAAA,QAAT;AAAmBC,EAAAA;AAAnB,CAA7B,EAA4D;AAC1E,QAAM,CAAEC,UAAF,EAAcC,aAAd,IAAgC,uBAAUJ,KAAV,CAAtC;AACA,QAAM,CAAEK,OAAF,EAAWC,UAAX,IAA0B,uBAAU,KAAV,CAAhC;AACA,QAAMC,UAAU,GAAG,4BAAeR,kBAAf,CAAnB;AACA,QAAMS,QAAQ,GAAG,sBAAjB;;AAEA,MAAK,CAAEH,OAAF,IAAaF,UAAU,KAAKH,KAAjC,EAAyC;AACxCI,IAAAA,aAAa,CAAEJ,KAAF,CAAb;AACA;AAED;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACC,QAAMS,eAAe,GAAKC,KAAF,IAAa;AACpC,UAAMC,QAAQ,GAAGD,KAAK,CAACE,MAAN,CAAaZ,KAA9B;AACAE,IAAAA,OAAO,CAAES,QAAF,CAAP;AACAP,IAAAA,aAAa,CAAEO,QAAF,CAAb;AACAL,IAAAA,UAAU,CAAE,IAAF,CAAV;AACAE,IAAAA,QAAQ,CAACK,OAAT,GAAmBF,QAAnB;AACA,GAND;AAQA;AACD;AACA;AACA;AACA;;;AACC,QAAMG,WAAW,GAAG,MAAM;AACzB,QAAKT,OAAL,EAAe;AACdJ,MAAAA,QAAQ,CAAEE,UAAF,CAAR;AACAG,MAAAA,UAAU,CAAE,KAAF,CAAV;AACA;AACD,GALD,CAlC0E,CAyC1E;;;AACA,0BAAW,MAAM;AAChB,WAAO,MAAM;AACZ,UAAKE,QAAQ,CAACK,OAAd,EAAwB;AACvBZ,QAAAA,QAAQ,CAAEO,QAAQ,CAACK,OAAX,CAAR;AACA;AACD,KAJD;AAKA,GAND,EAMG,EANH;AAQA,SACC,qDACC,4BAAC,0BAAD;AACC,IAAA,EAAE,EAAC,OADJ;AAEC,IAAA,OAAO,EAAI,yBAAyBN,UAAY;AAFjD,KAIG,cAAI,mBAAJ,CAJH,CADD,EAOC,4BAAC,8BAAD;AACC,IAAA,YAAY,EAAC,KADd;AAEC,IAAA,GAAG,EAAC,MAFL;AAGC,IAAA,KAAK,EAAGJ,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,EAAG,cAAI,iCAAJ;AARf,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"]}
@@ -28,11 +28,10 @@ var _constants = require("../../store/constants");
28
28
  /**
29
29
  * Internal dependencies
30
30
  */
31
- function CreateTemplatePartModal(_ref) {
32
- let {
33
- closeModal,
34
- onCreate
35
- } = _ref;
31
+ function CreateTemplatePartModal({
32
+ closeModal,
33
+ onCreate
34
+ }) {
36
35
  const [title, setTitle] = (0, _element.useState)('');
37
36
  const [area, setArea] = (0, _element.useState)(_constants.TEMPLATE_PART_AREA_GENERAL);
38
37
  const [isSubmitting, setIsSubmitting] = (0, _element.useState)(false);
@@ -74,30 +73,27 @@ function CreateTemplatePartModal(_ref) {
74
73
  id: `edit-site-create-template-part-modal__area-selection-${instanceId}`,
75
74
  onChange: setArea,
76
75
  checked: area
77
- }, templatePartAreas.map(_ref2 => {
78
- let {
79
- icon,
80
- label,
81
- area: value,
82
- description
83
- } = _ref2;
84
- return (0, _element.createElement)(_components.__experimentalRadio, {
85
- key: label,
86
- value: value,
87
- className: "edit-site-create-template-part-modal__area-radio"
88
- }, (0, _element.createElement)(_components.Flex, {
89
- align: "start",
90
- justify: "start"
91
- }, (0, _element.createElement)(_components.FlexItem, null, (0, _element.createElement)(_components.Icon, {
92
- icon: icon
93
- })), (0, _element.createElement)(_components.FlexBlock, {
94
- className: "edit-site-create-template-part-modal__option-label"
95
- }, label, (0, _element.createElement)("div", null, description)), (0, _element.createElement)(_components.FlexItem, {
96
- className: "edit-site-create-template-part-modal__checkbox"
97
- }, area === value && (0, _element.createElement)(_components.Icon, {
98
- icon: _icons.check
99
- }))));
100
- }))), (0, _element.createElement)(_components.__experimentalHStack, {
76
+ }, templatePartAreas.map(({
77
+ icon,
78
+ label,
79
+ area: value,
80
+ description
81
+ }) => (0, _element.createElement)(_components.__experimentalRadio, {
82
+ key: label,
83
+ value: value,
84
+ className: "edit-site-create-template-part-modal__area-radio"
85
+ }, (0, _element.createElement)(_components.Flex, {
86
+ align: "start",
87
+ justify: "start"
88
+ }, (0, _element.createElement)(_components.FlexItem, null, (0, _element.createElement)(_components.Icon, {
89
+ icon: icon
90
+ })), (0, _element.createElement)(_components.FlexBlock, {
91
+ className: "edit-site-create-template-part-modal__option-label"
92
+ }, label, (0, _element.createElement)("div", null, description)), (0, _element.createElement)(_components.FlexItem, {
93
+ className: "edit-site-create-template-part-modal__checkbox"
94
+ }, area === value && (0, _element.createElement)(_components.Icon, {
95
+ icon: _icons.check
96
+ }))))))), (0, _element.createElement)(_components.__experimentalHStack, {
101
97
  justify: "right"
102
98
  }, (0, _element.createElement)(_components.Button, {
103
99
  variant: "tertiary",