@wordpress/block-editor 12.10.3 → 12.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1253) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +13 -11
  3. package/build/autocompleters/block.js +3 -2
  4. package/build/autocompleters/block.js.map +1 -1
  5. package/build/autocompleters/link.js +3 -3
  6. package/build/autocompleters/link.js.map +1 -1
  7. package/build/components/alignment-control/index.js +3 -3
  8. package/build/components/alignment-control/index.js.map +1 -1
  9. package/build/components/alignment-control/ui.js +2 -2
  10. package/build/components/alignment-control/ui.js.map +1 -1
  11. package/build/components/autocomplete/index.js +3 -2
  12. package/build/components/autocomplete/index.js.map +1 -1
  13. package/build/components/block-actions/index.js +2 -2
  14. package/build/components/block-actions/index.js.map +1 -1
  15. package/build/components/block-alignment-control/index.js +3 -3
  16. package/build/components/block-alignment-control/index.js.map +1 -1
  17. package/build/components/block-alignment-control/ui.js +4 -4
  18. package/build/components/block-alignment-control/ui.js.map +1 -1
  19. package/build/components/block-alignment-control/ui.native.js +2 -2
  20. package/build/components/block-alignment-control/ui.native.js.map +1 -1
  21. package/build/components/block-alignment-matrix-control/index.js +5 -5
  22. package/build/components/block-alignment-matrix-control/index.js.map +1 -1
  23. package/build/components/block-breadcrumb/index.js +12 -12
  24. package/build/components/block-breadcrumb/index.js.map +1 -1
  25. package/build/components/block-canvas/index.js +13 -15
  26. package/build/components/block-canvas/index.js.map +1 -1
  27. package/build/components/block-caption/index.native.js +3 -3
  28. package/build/components/block-caption/index.native.js.map +1 -1
  29. package/build/components/block-card/index.js +7 -7
  30. package/build/components/block-card/index.js.map +1 -1
  31. package/build/components/block-compare/block-view.js +9 -8
  32. package/build/components/block-compare/block-view.js.map +1 -1
  33. package/build/components/block-compare/index.js +5 -5
  34. package/build/components/block-compare/index.js.map +1 -1
  35. package/build/components/block-context/index.js +2 -1
  36. package/build/components/block-context/index.js.map +1 -1
  37. package/build/components/block-controls/fill.js +5 -5
  38. package/build/components/block-controls/fill.js.map +1 -1
  39. package/build/components/block-controls/index.js +3 -3
  40. package/build/components/block-controls/index.js.map +1 -1
  41. package/build/components/block-controls/slot.js +3 -2
  42. package/build/components/block-controls/slot.js.map +1 -1
  43. package/build/components/block-controls/slot.native.js +4 -4
  44. package/build/components/block-controls/slot.native.js.map +1 -1
  45. package/build/components/block-draggable/draggable-chip.js +6 -6
  46. package/build/components/block-draggable/draggable-chip.js.map +1 -1
  47. package/build/components/block-draggable/draggable-chip.native.js +4 -4
  48. package/build/components/block-draggable/draggable-chip.native.js.map +1 -1
  49. package/build/components/block-draggable/dropping-insertion-point.native.js +2 -2
  50. package/build/components/block-draggable/dropping-insertion-point.native.js.map +1 -1
  51. package/build/components/block-draggable/index.js +4 -3
  52. package/build/components/block-draggable/index.js.map +1 -1
  53. package/build/components/block-draggable/index.native.js +9 -8
  54. package/build/components/block-draggable/index.native.js.map +1 -1
  55. package/build/components/block-edit/edit.js +5 -4
  56. package/build/components/block-edit/edit.js.map +1 -1
  57. package/build/components/block-edit/edit.native.js +3 -2
  58. package/build/components/block-edit/edit.native.js.map +1 -1
  59. package/build/components/block-edit/index.js +3 -2
  60. package/build/components/block-edit/index.js.map +1 -1
  61. package/build/components/block-edit-visually-button/index.js +2 -2
  62. package/build/components/block-edit-visually-button/index.js.map +1 -1
  63. package/build/components/block-full-height-alignment-control/index.js +2 -2
  64. package/build/components/block-full-height-alignment-control/index.js.map +1 -1
  65. package/build/components/block-heading-level-dropdown/heading-level-icon.js +4 -4
  66. package/build/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -1
  67. package/build/components/block-heading-level-dropdown/index.js +6 -6
  68. package/build/components/block-heading-level-dropdown/index.js.map +1 -1
  69. package/build/components/block-heading-level-dropdown/index.native.js +6 -6
  70. package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
  71. package/build/components/block-icon/index.js +4 -3
  72. package/build/components/block-icon/index.js.map +1 -1
  73. package/build/components/block-icon/index.native.js +3 -3
  74. package/build/components/block-icon/index.native.js.map +1 -1
  75. package/build/components/block-info-slot-fill/index.js +3 -3
  76. package/build/components/block-info-slot-fill/index.js.map +1 -1
  77. package/build/components/block-inspector/index.js +34 -34
  78. package/build/components/block-inspector/index.js.map +1 -1
  79. package/build/components/block-list/block-crash-warning.js +2 -2
  80. package/build/components/block-list/block-crash-warning.js.map +1 -1
  81. package/build/components/block-list/block-html.js +3 -2
  82. package/build/components/block-list/block-html.js.map +1 -1
  83. package/build/components/block-list/block-invalid-warning.js +6 -5
  84. package/build/components/block-list/block-invalid-warning.js.map +1 -1
  85. package/build/components/block-list/block-invalid-warning.native.js +3 -3
  86. package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
  87. package/build/components/block-list/block-list-item-cell.native.js +3 -2
  88. package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
  89. package/build/components/block-list/block-list-item.native.js +10 -10
  90. package/build/components/block-list/block-list-item.native.js.map +1 -1
  91. package/build/components/block-list/block-outline.native.js +2 -2
  92. package/build/components/block-list/block-outline.native.js.map +1 -1
  93. package/build/components/block-list/block-selection-button.native.js +9 -9
  94. package/build/components/block-list/block-selection-button.native.js.map +1 -1
  95. package/build/components/block-list/block.js +16 -15
  96. package/build/components/block-list/block.js.map +1 -1
  97. package/build/components/block-list/block.native.js +10 -9
  98. package/build/components/block-list/block.native.js.map +1 -1
  99. package/build/components/block-list/grid-item.native.js +2 -2
  100. package/build/components/block-list/grid-item.native.js.map +1 -1
  101. package/build/components/block-list/index.js +14 -13
  102. package/build/components/block-list/index.js.map +1 -1
  103. package/build/components/block-list/index.native.js +21 -20
  104. package/build/components/block-list/index.native.js.map +1 -1
  105. package/build/components/block-list/insertion-point.native.js +5 -5
  106. package/build/components/block-list/insertion-point.native.js.map +1 -1
  107. package/build/components/block-list/layout.js +3 -2
  108. package/build/components/block-list/layout.js.map +1 -1
  109. package/build/components/block-list/subdirectory-icon.js +3 -3
  110. package/build/components/block-list/subdirectory-icon.js.map +1 -1
  111. package/build/components/block-list-appender/index.js +5 -5
  112. package/build/components/block-list-appender/index.js.map +1 -1
  113. package/build/components/block-list-appender/index.native.js +4 -4
  114. package/build/components/block-list-appender/index.native.js.map +1 -1
  115. package/build/components/block-lock/menu-item.js +4 -3
  116. package/build/components/block-lock/menu-item.js.map +1 -1
  117. package/build/components/block-lock/modal.js +21 -20
  118. package/build/components/block-lock/modal.js.map +1 -1
  119. package/build/components/block-lock/toolbar.js +5 -4
  120. package/build/components/block-lock/toolbar.js.map +1 -1
  121. package/build/components/block-media-update-progress/index.native.js +5 -4
  122. package/build/components/block-media-update-progress/index.native.js.map +1 -1
  123. package/build/components/block-mover/button.js +6 -5
  124. package/build/components/block-mover/button.js.map +1 -1
  125. package/build/components/block-mover/index.js +7 -7
  126. package/build/components/block-mover/index.js.map +1 -1
  127. package/build/components/block-mover/index.native.js +5 -4
  128. package/build/components/block-mover/index.native.js.map +1 -1
  129. package/build/components/block-navigation/dropdown.js +8 -7
  130. package/build/components/block-navigation/dropdown.js.map +1 -1
  131. package/build/components/block-parent-selector/index.js +6 -5
  132. package/build/components/block-parent-selector/index.js.map +1 -1
  133. package/build/components/block-pattern-setup/index.js +20 -19
  134. package/build/components/block-pattern-setup/index.js.map +1 -1
  135. package/build/components/block-pattern-setup/setup-toolbar.js +12 -12
  136. package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  137. package/build/components/block-patterns-list/index.js +19 -18
  138. package/build/components/block-patterns-list/index.js.map +1 -1
  139. package/build/components/block-patterns-paging/index.js +12 -12
  140. package/build/components/block-patterns-paging/index.js.map +1 -1
  141. package/build/components/block-popover/drop-zone.js +3 -3
  142. package/build/components/block-popover/drop-zone.js.map +1 -1
  143. package/build/components/block-popover/inbetween.js +4 -3
  144. package/build/components/block-popover/inbetween.js.map +1 -1
  145. package/build/components/block-popover/index.js +4 -3
  146. package/build/components/block-popover/index.js.map +1 -1
  147. package/build/components/block-preview/auto.js +9 -8
  148. package/build/components/block-preview/auto.js.map +1 -1
  149. package/build/components/block-preview/index.js +7 -6
  150. package/build/components/block-preview/index.js.map +1 -1
  151. package/build/components/block-quick-navigation/index.js +7 -7
  152. package/build/components/block-quick-navigation/index.js.map +1 -1
  153. package/build/components/block-removal-warning-modal/index.js +7 -6
  154. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  155. package/build/components/block-selection-clearer/index.js +2 -2
  156. package/build/components/block-selection-clearer/index.js.map +1 -1
  157. package/build/components/block-settings/button.native.js +3 -3
  158. package/build/components/block-settings/button.native.js.map +1 -1
  159. package/build/components/block-settings/container.native.js +12 -12
  160. package/build/components/block-settings/container.native.js.map +1 -1
  161. package/build/components/block-settings-menu/block-html-convert-button.js +21 -17
  162. package/build/components/block-settings-menu/block-html-convert-button.js.map +1 -1
  163. package/build/components/block-settings-menu/block-mode-toggle.js +2 -2
  164. package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  165. package/build/components/block-settings-menu/block-settings-dropdown.js +17 -16
  166. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  167. package/build/components/block-settings-menu/index.js +2 -2
  168. package/build/components/block-settings-menu/index.js.map +1 -1
  169. package/build/components/block-settings-menu-controls/index.js +9 -9
  170. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  171. package/build/components/block-styles/index.js +9 -8
  172. package/build/components/block-styles/index.js.map +1 -1
  173. package/build/components/block-styles/index.native.js +4 -3
  174. package/build/components/block-styles/index.native.js.map +1 -1
  175. package/build/components/block-styles/menu-items.js +4 -4
  176. package/build/components/block-styles/menu-items.js.map +1 -1
  177. package/build/components/block-styles/preview-panel.js +3 -2
  178. package/build/components/block-styles/preview-panel.js.map +1 -1
  179. package/build/components/block-styles/preview.native.js +8 -7
  180. package/build/components/block-styles/preview.native.js.map +1 -1
  181. package/build/components/block-switcher/block-styles-menu.js +3 -3
  182. package/build/components/block-switcher/block-styles-menu.js.map +1 -1
  183. package/build/components/block-switcher/block-transformations-menu.js +11 -10
  184. package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
  185. package/build/components/block-switcher/block-transformations-menu.native.js +2 -2
  186. package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
  187. package/build/components/block-switcher/block-variation-transformations.js +6 -5
  188. package/build/components/block-switcher/block-variation-transformations.js.map +1 -1
  189. package/build/components/block-switcher/index.js +17 -17
  190. package/build/components/block-switcher/index.js.map +1 -1
  191. package/build/components/block-switcher/pattern-transformations-menu.js +18 -17
  192. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  193. package/build/components/block-switcher/preview-block-popover.js +7 -7
  194. package/build/components/block-switcher/preview-block-popover.js.map +1 -1
  195. package/build/components/block-toolbar/block-toolbar-menu.native.js +6 -5
  196. package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  197. package/build/components/block-toolbar/index.js +16 -15
  198. package/build/components/block-toolbar/index.js.map +1 -1
  199. package/build/components/block-toolbar/index.native.js +8 -7
  200. package/build/components/block-toolbar/index.native.js.map +1 -1
  201. package/build/components/block-tools/back-compat.js +3 -2
  202. package/build/components/block-tools/back-compat.js.map +1 -1
  203. package/build/components/block-tools/block-contextual-toolbar.js +6 -5
  204. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  205. package/build/components/block-tools/block-selection-button.js +11 -10
  206. package/build/components/block-tools/block-selection-button.js.map +1 -1
  207. package/build/components/block-tools/index.js +10 -9
  208. package/build/components/block-tools/index.js.map +1 -1
  209. package/build/components/block-tools/insertion-point.js +9 -8
  210. package/build/components/block-tools/insertion-point.js.map +1 -1
  211. package/build/components/block-tools/selected-block-popover.js +9 -8
  212. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  213. package/build/components/block-tools/zoom-out-mode-inserters.js +5 -4
  214. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  215. package/build/components/block-types-list/index.js +4 -4
  216. package/build/components/block-types-list/index.js.map +1 -1
  217. package/build/components/block-types-list/index.native.js +11 -10
  218. package/build/components/block-types-list/index.native.js.map +1 -1
  219. package/build/components/block-variation-picker/index.js +8 -8
  220. package/build/components/block-variation-picker/index.js.map +1 -1
  221. package/build/components/block-variation-picker/index.native.js +8 -8
  222. package/build/components/block-variation-picker/index.native.js.map +1 -1
  223. package/build/components/block-variation-transforms/index.js +10 -9
  224. package/build/components/block-variation-transforms/index.js.map +1 -1
  225. package/build/components/block-vertical-alignment-control/icons.js +11 -11
  226. package/build/components/block-vertical-alignment-control/icons.js.map +1 -1
  227. package/build/components/block-vertical-alignment-control/index.js +3 -3
  228. package/build/components/block-vertical-alignment-control/index.js.map +1 -1
  229. package/build/components/block-vertical-alignment-control/ui.js +2 -2
  230. package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
  231. package/build/components/border-radius-control/all-input-control.js +2 -2
  232. package/build/components/border-radius-control/all-input-control.js.map +1 -1
  233. package/build/components/border-radius-control/index.js +10 -9
  234. package/build/components/border-radius-control/index.js.map +1 -1
  235. package/build/components/border-radius-control/input-controls.js +5 -5
  236. package/build/components/border-radius-control/input-controls.js.map +1 -1
  237. package/build/components/border-radius-control/linked-button.js +3 -3
  238. package/build/components/border-radius-control/linked-button.js.map +1 -1
  239. package/build/components/button-block-appender/index.js +7 -6
  240. package/build/components/button-block-appender/index.js.map +1 -1
  241. package/build/components/button-block-appender/index.native.js +5 -5
  242. package/build/components/button-block-appender/index.native.js.map +1 -1
  243. package/build/components/caption/index.native.js +3 -3
  244. package/build/components/caption/index.native.js.map +1 -1
  245. package/build/components/child-layout-control/index.js +8 -7
  246. package/build/components/child-layout-control/index.js.map +1 -1
  247. package/build/components/color-palette/control.js +2 -2
  248. package/build/components/color-palette/control.js.map +1 -1
  249. package/build/components/color-palette/with-color-context.js +2 -2
  250. package/build/components/color-palette/with-color-context.js.map +1 -1
  251. package/build/components/color-style-selector/index.js +9 -9
  252. package/build/components/color-style-selector/index.js.map +1 -1
  253. package/build/components/colors/with-colors.js +5 -4
  254. package/build/components/colors/with-colors.js.map +1 -1
  255. package/build/components/colors-gradients/control.js +12 -12
  256. package/build/components/colors-gradients/control.js.map +1 -1
  257. package/build/components/colors-gradients/dropdown.js +13 -13
  258. package/build/components/colors-gradients/dropdown.js.map +1 -1
  259. package/build/components/colors-gradients/panel-color-gradient-settings.js +7 -7
  260. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  261. package/build/components/colors-gradients/panel-color-gradient-settings.native.js +5 -4
  262. package/build/components/colors-gradients/panel-color-gradient-settings.native.js.map +1 -1
  263. package/build/components/contrast-checker/index.js +3 -3
  264. package/build/components/contrast-checker/index.js.map +1 -1
  265. package/build/components/contrast-checker/index.native.js +6 -5
  266. package/build/components/contrast-checker/index.native.js.map +1 -1
  267. package/build/components/convert-to-group-buttons/index.js +3 -3
  268. package/build/components/convert-to-group-buttons/index.js.map +1 -1
  269. package/build/components/convert-to-group-buttons/toolbar.js +4 -4
  270. package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
  271. package/build/components/copy-handler/index.js +29 -209
  272. package/build/components/copy-handler/index.js.map +1 -1
  273. package/build/components/date-format-picker/index.js +9 -8
  274. package/build/components/date-format-picker/index.js.map +1 -1
  275. package/build/components/default-block-appender/index.js +4 -4
  276. package/build/components/default-block-appender/index.js.map +1 -1
  277. package/build/components/default-block-appender/index.native.js +4 -4
  278. package/build/components/default-block-appender/index.native.js.map +1 -1
  279. package/build/components/default-style-picker/index.js +4 -3
  280. package/build/components/default-style-picker/index.js.map +1 -1
  281. package/build/components/dimensions-tool/aspect-ratio-tool.js +3 -3
  282. package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -1
  283. package/build/components/dimensions-tool/index.js +5 -4
  284. package/build/components/dimensions-tool/index.js.map +1 -1
  285. package/build/components/dimensions-tool/scale-tool.js +6 -5
  286. package/build/components/dimensions-tool/scale-tool.js.map +1 -1
  287. package/build/components/dimensions-tool/width-height-tool.js +7 -7
  288. package/build/components/dimensions-tool/width-height-tool.js.map +1 -1
  289. package/build/components/duotone-control/index.js +18 -10
  290. package/build/components/duotone-control/index.js.map +1 -1
  291. package/build/components/editable-text/index.js +3 -2
  292. package/build/components/editable-text/index.js.map +1 -1
  293. package/build/components/editor-styles/index.js +5 -4
  294. package/build/components/editor-styles/index.js.map +1 -1
  295. package/build/components/floating-toolbar/index.native.js +8 -7
  296. package/build/components/floating-toolbar/index.native.js.map +1 -1
  297. package/build/components/floating-toolbar/nav-up-icon.js +4 -4
  298. package/build/components/floating-toolbar/nav-up-icon.js.map +1 -1
  299. package/build/components/font-appearance-control/index.js +4 -3
  300. package/build/components/font-appearance-control/index.js.map +1 -1
  301. package/build/components/font-family/index.js +2 -2
  302. package/build/components/font-family/index.js.map +1 -1
  303. package/build/components/font-sizes/font-size-picker.js +2 -2
  304. package/build/components/font-sizes/font-size-picker.js.map +1 -1
  305. package/build/components/font-sizes/with-font-sizes.js +4 -3
  306. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  307. package/build/components/global-styles/advanced-panel.js +7 -6
  308. package/build/components/global-styles/advanced-panel.js.map +1 -1
  309. package/build/components/global-styles/border-panel.js +8 -7
  310. package/build/components/global-styles/border-panel.js.map +1 -1
  311. package/build/components/global-styles/color-panel.js +21 -20
  312. package/build/components/global-styles/color-panel.js.map +1 -1
  313. package/build/components/global-styles/color-panel.native.js +4 -3
  314. package/build/components/global-styles/color-panel.native.js.map +1 -1
  315. package/build/components/global-styles/dimensions-panel.js +27 -26
  316. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  317. package/build/components/global-styles/effects-panel.js +23 -22
  318. package/build/components/global-styles/effects-panel.js.map +1 -1
  319. package/build/components/global-styles/filters-panel.js +17 -16
  320. package/build/components/global-styles/filters-panel.js.map +1 -1
  321. package/build/components/global-styles/image-settings-panel.js +4 -4
  322. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  323. package/build/components/global-styles/typography-panel.js +22 -21
  324. package/build/components/global-styles/typography-panel.js.map +1 -1
  325. package/build/components/gradients/with-gradient.js +2 -2
  326. package/build/components/gradients/with-gradient.js.map +1 -1
  327. package/build/components/height-control/index.js +9 -8
  328. package/build/components/height-control/index.js.map +1 -1
  329. package/build/components/iframe/index.js +6 -5
  330. package/build/components/iframe/index.js.map +1 -1
  331. package/build/components/image-editor/aspect-ratio-dropdown.js +7 -7
  332. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  333. package/build/components/image-editor/context.js +2 -1
  334. package/build/components/image-editor/context.js.map +1 -1
  335. package/build/components/image-editor/cropper.js +4 -4
  336. package/build/components/image-editor/cropper.js.map +1 -1
  337. package/build/components/image-editor/form-controls.js +3 -3
  338. package/build/components/image-editor/form-controls.js.map +1 -1
  339. package/build/components/image-editor/index.js +5 -5
  340. package/build/components/image-editor/index.js.map +1 -1
  341. package/build/components/image-editor/rotation-button.js +2 -2
  342. package/build/components/image-editor/rotation-button.js.map +1 -1
  343. package/build/components/image-editor/zoom-dropdown.js +4 -4
  344. package/build/components/image-editor/zoom-dropdown.js.map +1 -1
  345. package/build/components/image-size-control/index.js +9 -9
  346. package/build/components/image-size-control/index.js.map +1 -1
  347. package/build/components/index.js +1 -1
  348. package/build/components/index.js.map +1 -1
  349. package/build/components/inner-blocks/button-block-appender.js +2 -2
  350. package/build/components/inner-blocks/button-block-appender.js.map +1 -1
  351. package/build/components/inner-blocks/constants.native.js +13 -0
  352. package/build/components/inner-blocks/constants.native.js.map +1 -0
  353. package/build/components/inner-blocks/default-block-appender.js +2 -2
  354. package/build/components/inner-blocks/default-block-appender.js.map +1 -1
  355. package/build/components/inner-blocks/index.js +9 -8
  356. package/build/components/inner-blocks/index.js.map +1 -1
  357. package/build/components/inner-blocks/index.native.js +21 -8
  358. package/build/components/inner-blocks/index.native.js.map +1 -1
  359. package/build/components/inner-blocks/warning-max-depth-exceeded.native.js +95 -0
  360. package/build/components/inner-blocks/warning-max-depth-exceeded.native.js.map +1 -0
  361. package/build/components/inner-blocks/with-client-id.js +2 -2
  362. package/build/components/inner-blocks/with-client-id.js.map +1 -1
  363. package/build/components/inserter/block-patterns-explorer/explorer.js +7 -6
  364. package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
  365. package/build/components/inserter/block-patterns-explorer/patterns-list.js +6 -5
  366. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  367. package/build/components/inserter/block-patterns-explorer/sidebar.js +8 -8
  368. package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  369. package/build/components/inserter/block-patterns-filter.js +21 -19
  370. package/build/components/inserter/block-patterns-filter.js.map +1 -1
  371. package/build/components/inserter/block-patterns-tab.js +19 -18
  372. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  373. package/build/components/inserter/block-types-tab.js +10 -9
  374. package/build/components/inserter/block-types-tab.js.map +1 -1
  375. package/build/components/inserter/block-types-tab.native.js +2 -1
  376. package/build/components/inserter/block-types-tab.native.js.map +1 -1
  377. package/build/components/inserter/index.js +9 -8
  378. package/build/components/inserter/index.js.map +1 -1
  379. package/build/components/inserter/index.native.js +11 -10
  380. package/build/components/inserter/index.native.js.map +1 -1
  381. package/build/components/inserter/library.js +3 -2
  382. package/build/components/inserter/library.js.map +1 -1
  383. package/build/components/inserter/media-tab/hooks.js +4 -33
  384. package/build/components/inserter/media-tab/hooks.js.map +1 -1
  385. package/build/components/inserter/media-tab/media-list.js +3 -3
  386. package/build/components/inserter/media-tab/media-list.js.map +1 -1
  387. package/build/components/inserter/media-tab/media-panel.js +7 -6
  388. package/build/components/inserter/media-tab/media-panel.js.map +1 -1
  389. package/build/components/inserter/media-tab/media-preview.js +18 -17
  390. package/build/components/inserter/media-tab/media-preview.js.map +1 -1
  391. package/build/components/inserter/media-tab/media-tab.js +12 -11
  392. package/build/components/inserter/media-tab/media-tab.js.map +1 -1
  393. package/build/components/inserter/media-tab/utils.js +2 -2
  394. package/build/components/inserter/media-tab/utils.js.map +1 -1
  395. package/build/components/inserter/menu.js +19 -18
  396. package/build/components/inserter/menu.js.map +1 -1
  397. package/build/components/inserter/menu.native.js +9 -8
  398. package/build/components/inserter/menu.native.js.map +1 -1
  399. package/build/components/inserter/mobile-tab-navigation.js +12 -12
  400. package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
  401. package/build/components/inserter/no-results.js +4 -4
  402. package/build/components/inserter/no-results.js.map +1 -1
  403. package/build/components/inserter/no-results.native.js +4 -4
  404. package/build/components/inserter/no-results.native.js.map +1 -1
  405. package/build/components/inserter/panel.js +5 -5
  406. package/build/components/inserter/panel.js.map +1 -1
  407. package/build/components/inserter/preview-panel.js +8 -7
  408. package/build/components/inserter/preview-panel.js.map +1 -1
  409. package/build/components/inserter/quick-inserter.js +7 -6
  410. package/build/components/inserter/quick-inserter.js.map +1 -1
  411. package/build/components/inserter/reusable-block-rename-hint.js +5 -4
  412. package/build/components/inserter/reusable-block-rename-hint.js.map +1 -1
  413. package/build/components/inserter/reusable-blocks-tab.native.js +3 -2
  414. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  415. package/build/components/inserter/search-results.js +11 -10
  416. package/build/components/inserter/search-results.js.map +1 -1
  417. package/build/components/inserter/search-results.native.js +4 -3
  418. package/build/components/inserter/search-results.native.js.map +1 -1
  419. package/build/components/inserter/tabs.js +2 -1
  420. package/build/components/inserter/tabs.js.map +1 -1
  421. package/build/components/inserter/tabs.native.js +7 -6
  422. package/build/components/inserter/tabs.native.js.map +1 -1
  423. package/build/components/inserter/tips.js +6 -5
  424. package/build/components/inserter/tips.js.map +1 -1
  425. package/build/components/inserter-draggable-blocks/index.js +3 -3
  426. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  427. package/build/components/inserter-list-item/index.js +9 -8
  428. package/build/components/inserter-list-item/index.js.map +1 -1
  429. package/build/components/inserter-listbox/group.js +2 -1
  430. package/build/components/inserter-listbox/group.js.map +1 -1
  431. package/build/components/inserter-listbox/index.js +2 -2
  432. package/build/components/inserter-listbox/index.js.map +1 -1
  433. package/build/components/inserter-listbox/item.js +5 -4
  434. package/build/components/inserter-listbox/item.js.map +1 -1
  435. package/build/components/inserter-listbox/row.js +2 -1
  436. package/build/components/inserter-listbox/row.js.map +1 -1
  437. package/build/components/inspector-controls/block-support-slot-container.js +3 -2
  438. package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
  439. package/build/components/inspector-controls/block-support-tools-panel.js +3 -2
  440. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  441. package/build/components/inspector-controls/fill.js +7 -6
  442. package/build/components/inspector-controls/fill.js.map +1 -1
  443. package/build/components/inspector-controls/fill.native.js +4 -3
  444. package/build/components/inspector-controls/fill.native.js.map +1 -1
  445. package/build/components/inspector-controls/index.js +3 -3
  446. package/build/components/inspector-controls/index.js.map +1 -1
  447. package/build/components/inspector-controls/slot.js +5 -4
  448. package/build/components/inspector-controls/slot.js.map +1 -1
  449. package/build/components/inspector-controls/slot.native.js +2 -2
  450. package/build/components/inspector-controls/slot.native.js.map +1 -1
  451. package/build/components/inspector-controls-tabs/advanced-controls-panel.js +3 -3
  452. package/build/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -1
  453. package/build/components/inspector-controls-tabs/index.js +5 -5
  454. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  455. package/build/components/inspector-controls-tabs/position-controls-panel.js +5 -4
  456. package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
  457. package/build/components/inspector-controls-tabs/settings-tab-hint.js +5 -4
  458. package/build/components/inspector-controls-tabs/settings-tab-hint.js.map +1 -1
  459. package/build/components/inspector-controls-tabs/settings-tab.js +2 -2
  460. package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
  461. package/build/components/inspector-controls-tabs/styles-tab.js +11 -11
  462. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  463. package/build/components/inspector-popover-header/index.js +8 -8
  464. package/build/components/inspector-popover-header/index.js.map +1 -1
  465. package/build/components/justify-content-control/index.js +3 -3
  466. package/build/components/justify-content-control/index.js.map +1 -1
  467. package/build/components/justify-content-control/ui.js +2 -2
  468. package/build/components/justify-content-control/ui.js.map +1 -1
  469. package/build/components/letter-spacing-control/index.js +3 -3
  470. package/build/components/letter-spacing-control/index.js.map +1 -1
  471. package/build/components/line-height-control/index.js +3 -3
  472. package/build/components/line-height-control/index.js.map +1 -1
  473. package/build/components/line-height-control/index.native.js +2 -2
  474. package/build/components/line-height-control/index.native.js.map +1 -1
  475. package/build/components/link-control/index.js +18 -17
  476. package/build/components/link-control/index.js.map +1 -1
  477. package/build/components/link-control/link-preview.js +20 -20
  478. package/build/components/link-control/link-preview.js.map +1 -1
  479. package/build/components/link-control/search-create-button.js +4 -3
  480. package/build/components/link-control/search-create-button.js.map +1 -1
  481. package/build/components/link-control/search-input.js +5 -4
  482. package/build/components/link-control/search-input.js.map +1 -1
  483. package/build/components/link-control/search-item.js +5 -5
  484. package/build/components/link-control/search-item.js.map +1 -1
  485. package/build/components/link-control/search-results.js +7 -7
  486. package/build/components/link-control/search-results.js.map +1 -1
  487. package/build/components/link-control/settings-drawer.js +5 -4
  488. package/build/components/link-control/settings-drawer.js.map +1 -1
  489. package/build/components/link-control/settings.js +4 -4
  490. package/build/components/link-control/settings.js.map +1 -1
  491. package/build/components/list-view/appender.js +5 -4
  492. package/build/components/list-view/appender.js.map +1 -1
  493. package/build/components/list-view/aria-referenced-text.js +2 -1
  494. package/build/components/list-view/aria-referenced-text.js.map +1 -1
  495. package/build/components/list-view/block-contents.js +5 -4
  496. package/build/components/list-view/block-contents.js.map +1 -1
  497. package/build/components/list-view/block-select-button.js +16 -15
  498. package/build/components/list-view/block-select-button.js.map +1 -1
  499. package/build/components/list-view/block.js +15 -45
  500. package/build/components/list-view/block.js.map +1 -1
  501. package/build/components/list-view/branch.js +17 -9
  502. package/build/components/list-view/branch.js.map +1 -1
  503. package/build/components/list-view/drop-indicator.js +4 -3
  504. package/build/components/list-view/drop-indicator.js.map +1 -1
  505. package/build/components/list-view/expander.js +3 -3
  506. package/build/components/list-view/expander.js.map +1 -1
  507. package/build/components/list-view/index.js +16 -10
  508. package/build/components/list-view/index.js.map +1 -1
  509. package/build/components/list-view/leaf.js +3 -2
  510. package/build/components/list-view/leaf.js.map +1 -1
  511. package/build/components/list-view/utils.js +35 -0
  512. package/build/components/list-view/utils.js.map +1 -1
  513. package/build/components/media-placeholder/index.js +22 -21
  514. package/build/components/media-placeholder/index.js.map +1 -1
  515. package/build/components/media-placeholder/index.native.js +13 -12
  516. package/build/components/media-placeholder/index.native.js.map +1 -1
  517. package/build/components/media-replace-flow/index.js +14 -13
  518. package/build/components/media-replace-flow/index.js.map +1 -1
  519. package/build/components/media-replace-flow/index.native.js +2 -2
  520. package/build/components/media-replace-flow/index.native.js.map +1 -1
  521. package/build/components/media-upload/{constants.js → constants.native.js} +2 -4
  522. package/build/components/media-upload/constants.native.js.map +1 -0
  523. package/build/components/media-upload/index.js +1 -1
  524. package/build/components/media-upload/index.js.map +1 -1
  525. package/build/components/media-upload/index.native.js +12 -11
  526. package/build/components/media-upload/index.native.js.map +1 -1
  527. package/build/components/media-upload-progress/index.native.js +5 -4
  528. package/build/components/media-upload-progress/index.native.js.map +1 -1
  529. package/build/components/multi-selection-inspector/index.js +6 -6
  530. package/build/components/multi-selection-inspector/index.js.map +1 -1
  531. package/build/components/navigable-toolbar/index.js +4 -3
  532. package/build/components/navigable-toolbar/index.js.map +1 -1
  533. package/build/components/observe-typing/index.js +2 -2
  534. package/build/components/observe-typing/index.js.map +1 -1
  535. package/build/components/panel-color-settings/index.js +2 -2
  536. package/build/components/panel-color-settings/index.js.map +1 -1
  537. package/build/components/plain-text/index.js +4 -3
  538. package/build/components/plain-text/index.js.map +1 -1
  539. package/build/components/plain-text/index.native.js +4 -3
  540. package/build/components/plain-text/index.native.js.map +1 -1
  541. package/build/components/preview-options/index.js +5 -5
  542. package/build/components/preview-options/index.js.map +1 -1
  543. package/build/components/provider/block-refs-provider.js +2 -1
  544. package/build/components/provider/block-refs-provider.js.map +1 -1
  545. package/build/components/provider/index.js +4 -3
  546. package/build/components/provider/index.js.map +1 -1
  547. package/build/components/provider/index.native.js +3 -2
  548. package/build/components/provider/index.native.js.map +1 -1
  549. package/build/components/provider/use-block-sync.js +1 -1
  550. package/build/components/provider/use-block-sync.js.map +1 -1
  551. package/build/components/provider/with-registry-provider.js +4 -3
  552. package/build/components/provider/with-registry-provider.js.map +1 -1
  553. package/build/components/publish-date-time-picker/index.js +5 -4
  554. package/build/components/publish-date-time-picker/index.js.map +1 -1
  555. package/build/components/recursion-provider/index.js +2 -1
  556. package/build/components/recursion-provider/index.js.map +1 -1
  557. package/build/components/resizable-box-popover/index.js +3 -3
  558. package/build/components/resizable-box-popover/index.js.map +1 -1
  559. package/build/components/resolution-tool/index.js +3 -3
  560. package/build/components/resolution-tool/index.js.map +1 -1
  561. package/build/components/responsive-block-control/index.js +10 -9
  562. package/build/components/responsive-block-control/index.js.map +1 -1
  563. package/build/components/responsive-block-control/label.js +3 -3
  564. package/build/components/responsive-block-control/label.js.map +1 -1
  565. package/build/components/rich-text/content.js +3 -2
  566. package/build/components/rich-text/content.js.map +1 -1
  567. package/build/components/rich-text/embed-handler-picker.native.js +2 -1
  568. package/build/components/rich-text/embed-handler-picker.native.js.map +1 -1
  569. package/build/components/rich-text/format-edit.js +4 -3
  570. package/build/components/rich-text/format-edit.js.map +1 -1
  571. package/build/components/rich-text/format-toolbar/index.js +4 -4
  572. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  573. package/build/components/rich-text/format-toolbar/index.native.js +3 -3
  574. package/build/components/rich-text/format-toolbar/index.native.js.map +1 -1
  575. package/build/components/rich-text/format-toolbar-container.js +9 -9
  576. package/build/components/rich-text/format-toolbar-container.js.map +1 -1
  577. package/build/components/rich-text/format-toolbar-container.native.js +3 -3
  578. package/build/components/rich-text/format-toolbar-container.native.js.map +1 -1
  579. package/build/components/rich-text/get-rich-text-values.js +2 -1
  580. package/build/components/rich-text/get-rich-text-values.js.map +1 -1
  581. package/build/components/rich-text/index.js +9 -8
  582. package/build/components/rich-text/index.js.map +1 -1
  583. package/build/components/rich-text/index.native.js +8 -15
  584. package/build/components/rich-text/index.native.js.map +1 -1
  585. package/build/components/rich-text/multiline.js +3 -2
  586. package/build/components/rich-text/multiline.js.map +1 -1
  587. package/build/components/rich-text/toolbar-button.js +3 -3
  588. package/build/components/rich-text/toolbar-button.js.map +1 -1
  589. package/build/components/rich-text/use-paste-handler.js +5 -87
  590. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  591. package/build/components/rich-text/utils.js +2 -5
  592. package/build/components/rich-text/utils.js.map +1 -1
  593. package/build/components/skip-to-selected-block/index.js +2 -2
  594. package/build/components/skip-to-selected-block/index.js.map +1 -1
  595. package/build/components/spacing-sizes-control/index.js +9 -8
  596. package/build/components/spacing-sizes-control/index.js.map +1 -1
  597. package/build/components/spacing-sizes-control/input-controls/axial.js +3 -3
  598. package/build/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
  599. package/build/components/spacing-sizes-control/input-controls/separated.js +3 -3
  600. package/build/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
  601. package/build/components/spacing-sizes-control/input-controls/single.js +2 -2
  602. package/build/components/spacing-sizes-control/input-controls/single.js.map +1 -1
  603. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +9 -8
  604. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  605. package/build/components/spacing-sizes-control/sides-dropdown/index.js +6 -6
  606. package/build/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
  607. package/build/components/text-decoration-control/index.js +6 -6
  608. package/build/components/text-decoration-control/index.js.map +1 -1
  609. package/build/components/text-transform-control/index.js +6 -6
  610. package/build/components/text-transform-control/index.js.map +1 -1
  611. package/build/components/tool-selector/index.js +11 -10
  612. package/build/components/tool-selector/index.js.map +1 -1
  613. package/build/components/typewriter/index.js +3 -3
  614. package/build/components/typewriter/index.js.map +1 -1
  615. package/build/components/ungroup-button/index.native.js +2 -2
  616. package/build/components/ungroup-button/index.native.js.map +1 -1
  617. package/build/components/unit-control/index.js +2 -2
  618. package/build/components/unit-control/index.js.map +1 -1
  619. package/build/components/unsupported-block-details/index.native.js +127 -0
  620. package/build/components/unsupported-block-details/index.native.js.map +1 -0
  621. package/build/components/url-input/button.js +9 -8
  622. package/build/components/url-input/button.js.map +1 -1
  623. package/build/components/url-input/index.js +9 -8
  624. package/build/components/url-input/index.js.map +1 -1
  625. package/build/components/url-input/index.native.js +2 -2
  626. package/build/components/url-input/index.native.js.map +1 -1
  627. package/build/components/url-popover/image-url-input-ui.js +19 -18
  628. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  629. package/build/components/url-popover/index.js +8 -7
  630. package/build/components/url-popover/index.js.map +1 -1
  631. package/build/components/url-popover/link-editor.js +4 -4
  632. package/build/components/url-popover/link-editor.js.map +1 -1
  633. package/build/components/url-popover/link-viewer-url.js +3 -3
  634. package/build/components/url-popover/link-viewer-url.js.map +1 -1
  635. package/build/components/url-popover/link-viewer.js +4 -4
  636. package/build/components/url-popover/link-viewer.js.map +1 -1
  637. package/build/components/use-on-block-drop/index.js +2 -2
  638. package/build/components/use-on-block-drop/index.js.map +1 -1
  639. package/build/components/use-unsupported-block-editor/index.native.js +57 -0
  640. package/build/components/use-unsupported-block-editor/index.native.js.map +1 -0
  641. package/build/components/video-player/gridicon-play.native.js +3 -3
  642. package/build/components/video-player/gridicon-play.native.js.map +1 -1
  643. package/build/components/video-player/index.native.js +6 -5
  644. package/build/components/video-player/index.native.js.map +1 -1
  645. package/build/components/warning/index.js +10 -9
  646. package/build/components/warning/index.js.map +1 -1
  647. package/build/components/warning/index.native.js +6 -6
  648. package/build/components/warning/index.native.js.map +1 -1
  649. package/build/components/writing-flow/index.js +7 -5
  650. package/build/components/writing-flow/index.js.map +1 -1
  651. package/build/components/writing-flow/use-clipboard-handler.js +179 -0
  652. package/build/components/writing-flow/use-clipboard-handler.js.map +1 -0
  653. package/build/components/writing-flow/use-tab-nav.js +4 -3
  654. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  655. package/build/components/writing-mode-control/index.js +6 -6
  656. package/build/components/writing-mode-control/index.js.map +1 -1
  657. package/build/hooks/align.js +6 -6
  658. package/build/hooks/align.js.map +1 -1
  659. package/build/hooks/anchor.js +10 -9
  660. package/build/hooks/anchor.js.map +1 -1
  661. package/build/hooks/background.js +17 -16
  662. package/build/hooks/background.js.map +1 -1
  663. package/build/hooks/block-hooks.js +11 -10
  664. package/build/hooks/block-hooks.js.map +1 -1
  665. package/build/hooks/block-rename-ui.js +17 -16
  666. package/build/hooks/block-rename-ui.js.map +1 -1
  667. package/build/hooks/border.js +6 -5
  668. package/build/hooks/border.js.map +1 -1
  669. package/build/hooks/color.js +7 -6
  670. package/build/hooks/color.js.map +1 -1
  671. package/build/hooks/content-lock-ui.js +9 -8
  672. package/build/hooks/content-lock-ui.js.map +1 -1
  673. package/build/hooks/contrast-checker.js +2 -1
  674. package/build/hooks/contrast-checker.js.map +1 -1
  675. package/build/hooks/custom-class-name.js +7 -7
  676. package/build/hooks/custom-class-name.js.map +1 -1
  677. package/build/hooks/custom-fields.js +8 -8
  678. package/build/hooks/custom-fields.js.map +1 -1
  679. package/build/hooks/dimensions.js +5 -4
  680. package/build/hooks/dimensions.js.map +1 -1
  681. package/build/hooks/duotone.js +10 -9
  682. package/build/hooks/duotone.js.map +1 -1
  683. package/build/hooks/font-size.js +5 -5
  684. package/build/hooks/font-size.js.map +1 -1
  685. package/build/hooks/layout.js +14 -13
  686. package/build/hooks/layout.js.map +1 -1
  687. package/build/hooks/line-height.js +3 -3
  688. package/build/hooks/line-height.js.map +1 -1
  689. package/build/hooks/margin.js +3 -2
  690. package/build/hooks/margin.js.map +1 -1
  691. package/build/hooks/padding.js +3 -2
  692. package/build/hooks/padding.js.map +1 -1
  693. package/build/hooks/position.js +10 -9
  694. package/build/hooks/position.js.map +1 -1
  695. package/build/hooks/style.js +11 -10
  696. package/build/hooks/style.js.map +1 -1
  697. package/build/hooks/typography.js +4 -3
  698. package/build/hooks/typography.js.map +1 -1
  699. package/build/hooks/typography.native.js +4 -4
  700. package/build/hooks/typography.native.js.map +1 -1
  701. package/build/layouts/constrained.js +11 -11
  702. package/build/layouts/constrained.js.map +1 -1
  703. package/build/layouts/flex.js +18 -18
  704. package/build/layouts/flex.js.map +1 -1
  705. package/build/layouts/grid.js +10 -10
  706. package/build/layouts/grid.js.map +1 -1
  707. package/build/private-apis.js +2 -0
  708. package/build/private-apis.js.map +1 -1
  709. package/build/store/actions.js +8 -12
  710. package/build/store/actions.js.map +1 -1
  711. package/build/store/private-selectors.js +55 -1
  712. package/build/store/private-selectors.js.map +1 -1
  713. package/build/store/reducer.js +19 -1
  714. package/build/store/reducer.js.map +1 -1
  715. package/build/store/selectors.js +1 -1
  716. package/build/store/selectors.js.map +1 -1
  717. package/build/utils/pasting.js +46 -0
  718. package/build/utils/pasting.js.map +1 -1
  719. package/build/utils/transform-styles/transforms/wrap.js +5 -0
  720. package/build/utils/transform-styles/transforms/wrap.js.map +1 -1
  721. package/build/utils/use-notify-copy.js +53 -0
  722. package/build/utils/use-notify-copy.js.map +1 -0
  723. package/build-module/autocompleters/block.js +1 -1
  724. package/build-module/autocompleters/link.js +1 -1
  725. package/build-module/components/alignment-control/index.js +1 -1
  726. package/build-module/components/alignment-control/ui.js +1 -1
  727. package/build-module/components/autocomplete/index.js +1 -1
  728. package/build-module/components/block-actions/index.js +1 -1
  729. package/build-module/components/block-actions/index.js.map +1 -1
  730. package/build-module/components/block-alignment-control/index.js +1 -1
  731. package/build-module/components/block-alignment-control/ui.js +1 -1
  732. package/build-module/components/block-alignment-control/ui.native.js +1 -1
  733. package/build-module/components/block-alignment-matrix-control/index.js +1 -1
  734. package/build-module/components/block-breadcrumb/index.js +2 -2
  735. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  736. package/build-module/components/block-canvas/index.js +7 -9
  737. package/build-module/components/block-canvas/index.js.map +1 -1
  738. package/build-module/components/block-caption/index.native.js +1 -1
  739. package/build-module/components/block-card/index.js +1 -1
  740. package/build-module/components/block-compare/block-view.js +1 -1
  741. package/build-module/components/block-compare/index.js +1 -1
  742. package/build-module/components/block-context/index.js +1 -1
  743. package/build-module/components/block-controls/fill.js +1 -1
  744. package/build-module/components/block-controls/index.js +1 -1
  745. package/build-module/components/block-controls/slot.js +1 -1
  746. package/build-module/components/block-controls/slot.native.js +1 -1
  747. package/build-module/components/block-draggable/draggable-chip.js +1 -1
  748. package/build-module/components/block-draggable/draggable-chip.native.js +1 -1
  749. package/build-module/components/block-draggable/dropping-insertion-point.native.js +1 -1
  750. package/build-module/components/block-draggable/index.js +1 -1
  751. package/build-module/components/block-draggable/index.native.js +1 -1
  752. package/build-module/components/block-edit/edit.js +1 -1
  753. package/build-module/components/block-edit/edit.native.js +1 -1
  754. package/build-module/components/block-edit/index.js +1 -1
  755. package/build-module/components/block-edit-visually-button/index.js +1 -1
  756. package/build-module/components/block-full-height-alignment-control/index.js +1 -1
  757. package/build-module/components/block-heading-level-dropdown/heading-level-icon.js +3 -3
  758. package/build-module/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -1
  759. package/build-module/components/block-heading-level-dropdown/index.js +3 -3
  760. package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
  761. package/build-module/components/block-heading-level-dropdown/index.native.js +3 -3
  762. package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
  763. package/build-module/components/block-icon/index.js +1 -1
  764. package/build-module/components/block-icon/index.native.js +1 -1
  765. package/build-module/components/block-info-slot-fill/index.js +1 -1
  766. package/build-module/components/block-inspector/index.js +1 -1
  767. package/build-module/components/block-list/block-crash-warning.js +1 -1
  768. package/build-module/components/block-list/block-html.js +1 -1
  769. package/build-module/components/block-list/block-invalid-warning.js +1 -1
  770. package/build-module/components/block-list/block-invalid-warning.native.js +1 -1
  771. package/build-module/components/block-list/block-list-item-cell.native.js +1 -1
  772. package/build-module/components/block-list/block-list-item.native.js +3 -3
  773. package/build-module/components/block-list/block-list-item.native.js.map +1 -1
  774. package/build-module/components/block-list/block-outline.native.js +1 -1
  775. package/build-module/components/block-list/block-selection-button.native.js +1 -1
  776. package/build-module/components/block-list/block.js +1 -1
  777. package/build-module/components/block-list/block.native.js +1 -1
  778. package/build-module/components/block-list/grid-item.native.js +1 -1
  779. package/build-module/components/block-list/index.js +1 -1
  780. package/build-module/components/block-list/index.native.js +1 -1
  781. package/build-module/components/block-list/insertion-point.native.js +1 -1
  782. package/build-module/components/block-list/layout.js +1 -1
  783. package/build-module/components/block-list/subdirectory-icon.js +1 -1
  784. package/build-module/components/block-list-appender/index.js +1 -1
  785. package/build-module/components/block-list-appender/index.native.js +1 -1
  786. package/build-module/components/block-lock/menu-item.js +1 -1
  787. package/build-module/components/block-lock/modal.js +1 -1
  788. package/build-module/components/block-lock/toolbar.js +1 -1
  789. package/build-module/components/block-media-update-progress/index.native.js +1 -1
  790. package/build-module/components/block-mover/button.js +1 -1
  791. package/build-module/components/block-mover/index.js +1 -1
  792. package/build-module/components/block-mover/index.native.js +1 -1
  793. package/build-module/components/block-navigation/dropdown.js +1 -1
  794. package/build-module/components/block-parent-selector/index.js +2 -2
  795. package/build-module/components/block-parent-selector/index.js.map +1 -1
  796. package/build-module/components/block-pattern-setup/index.js +1 -1
  797. package/build-module/components/block-pattern-setup/setup-toolbar.js +1 -1
  798. package/build-module/components/block-patterns-list/index.js +1 -1
  799. package/build-module/components/block-patterns-paging/index.js +1 -1
  800. package/build-module/components/block-popover/drop-zone.js +1 -1
  801. package/build-module/components/block-popover/inbetween.js +1 -1
  802. package/build-module/components/block-popover/index.js +1 -1
  803. package/build-module/components/block-preview/auto.js +1 -1
  804. package/build-module/components/block-preview/index.js +2 -2
  805. package/build-module/components/block-preview/index.js.map +1 -1
  806. package/build-module/components/block-quick-navigation/index.js +1 -1
  807. package/build-module/components/block-removal-warning-modal/index.js +1 -1
  808. package/build-module/components/block-selection-clearer/index.js +1 -1
  809. package/build-module/components/block-settings/button.native.js +1 -1
  810. package/build-module/components/block-settings/container.native.js +1 -1
  811. package/build-module/components/block-settings-menu/block-html-convert-button.js +20 -17
  812. package/build-module/components/block-settings-menu/block-html-convert-button.js.map +1 -1
  813. package/build-module/components/block-settings-menu/block-mode-toggle.js +1 -1
  814. package/build-module/components/block-settings-menu/block-settings-dropdown.js +1 -1
  815. package/build-module/components/block-settings-menu/index.js +1 -1
  816. package/build-module/components/block-settings-menu-controls/index.js +2 -2
  817. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  818. package/build-module/components/block-styles/index.js +1 -1
  819. package/build-module/components/block-styles/index.native.js +1 -1
  820. package/build-module/components/block-styles/menu-items.js +1 -1
  821. package/build-module/components/block-styles/preview-panel.js +1 -1
  822. package/build-module/components/block-styles/preview.native.js +1 -1
  823. package/build-module/components/block-switcher/block-styles-menu.js +1 -1
  824. package/build-module/components/block-switcher/block-transformations-menu.js +1 -1
  825. package/build-module/components/block-switcher/block-transformations-menu.native.js +1 -1
  826. package/build-module/components/block-switcher/block-variation-transformations.js +1 -1
  827. package/build-module/components/block-switcher/index.js +6 -6
  828. package/build-module/components/block-switcher/index.js.map +1 -1
  829. package/build-module/components/block-switcher/pattern-transformations-menu.js +1 -1
  830. package/build-module/components/block-switcher/preview-block-popover.js +1 -1
  831. package/build-module/components/block-toolbar/block-toolbar-menu.native.js +1 -1
  832. package/build-module/components/block-toolbar/index.js +1 -1
  833. package/build-module/components/block-toolbar/index.native.js +1 -1
  834. package/build-module/components/block-tools/back-compat.js +1 -1
  835. package/build-module/components/block-tools/block-contextual-toolbar.js +1 -1
  836. package/build-module/components/block-tools/block-selection-button.js +2 -2
  837. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  838. package/build-module/components/block-tools/index.js +1 -1
  839. package/build-module/components/block-tools/insertion-point.js +1 -1
  840. package/build-module/components/block-tools/selected-block-popover.js +1 -1
  841. package/build-module/components/block-tools/zoom-out-mode-inserters.js +1 -1
  842. package/build-module/components/block-types-list/index.js +1 -1
  843. package/build-module/components/block-types-list/index.native.js +1 -1
  844. package/build-module/components/block-variation-picker/index.js +1 -1
  845. package/build-module/components/block-variation-picker/index.native.js +1 -1
  846. package/build-module/components/block-variation-transforms/index.js +1 -1
  847. package/build-module/components/block-vertical-alignment-control/icons.js +1 -1
  848. package/build-module/components/block-vertical-alignment-control/index.js +1 -1
  849. package/build-module/components/block-vertical-alignment-control/ui.js +1 -1
  850. package/build-module/components/border-radius-control/all-input-control.js +1 -1
  851. package/build-module/components/border-radius-control/index.js +2 -2
  852. package/build-module/components/border-radius-control/index.js.map +1 -1
  853. package/build-module/components/border-radius-control/input-controls.js +1 -1
  854. package/build-module/components/border-radius-control/linked-button.js +1 -1
  855. package/build-module/components/button-block-appender/index.js +1 -1
  856. package/build-module/components/button-block-appender/index.native.js +1 -1
  857. package/build-module/components/caption/index.native.js +1 -1
  858. package/build-module/components/child-layout-control/index.js +2 -2
  859. package/build-module/components/child-layout-control/index.js.map +1 -1
  860. package/build-module/components/color-palette/control.js +1 -1
  861. package/build-module/components/color-palette/with-color-context.js +1 -1
  862. package/build-module/components/color-style-selector/index.js +1 -1
  863. package/build-module/components/colors/with-colors.js +2 -2
  864. package/build-module/components/colors/with-colors.js.map +1 -1
  865. package/build-module/components/colors-gradients/control.js +1 -1
  866. package/build-module/components/colors-gradients/dropdown.js +1 -1
  867. package/build-module/components/colors-gradients/panel-color-gradient-settings.js +1 -1
  868. package/build-module/components/colors-gradients/panel-color-gradient-settings.native.js +1 -1
  869. package/build-module/components/contrast-checker/index.js +1 -1
  870. package/build-module/components/contrast-checker/index.native.js +1 -1
  871. package/build-module/components/convert-to-group-buttons/index.js +1 -1
  872. package/build-module/components/convert-to-group-buttons/toolbar.js +1 -1
  873. package/build-module/components/copy-handler/index.js +25 -205
  874. package/build-module/components/copy-handler/index.js.map +1 -1
  875. package/build-module/components/date-format-picker/index.js +1 -1
  876. package/build-module/components/default-block-appender/index.js +1 -1
  877. package/build-module/components/default-block-appender/index.native.js +1 -1
  878. package/build-module/components/default-style-picker/index.js +1 -1
  879. package/build-module/components/dimensions-tool/aspect-ratio-tool.js +1 -1
  880. package/build-module/components/dimensions-tool/index.js +2 -2
  881. package/build-module/components/dimensions-tool/index.js.map +1 -1
  882. package/build-module/components/dimensions-tool/scale-tool.js +2 -2
  883. package/build-module/components/dimensions-tool/scale-tool.js.map +1 -1
  884. package/build-module/components/dimensions-tool/width-height-tool.js +3 -3
  885. package/build-module/components/dimensions-tool/width-height-tool.js.map +1 -1
  886. package/build-module/components/duotone-control/index.js +10 -2
  887. package/build-module/components/duotone-control/index.js.map +1 -1
  888. package/build-module/components/editable-text/index.js +1 -1
  889. package/build-module/components/editor-styles/index.js +1 -1
  890. package/build-module/components/floating-toolbar/index.native.js +1 -1
  891. package/build-module/components/floating-toolbar/nav-up-icon.js +1 -1
  892. package/build-module/components/font-appearance-control/index.js +2 -2
  893. package/build-module/components/font-appearance-control/index.js.map +1 -1
  894. package/build-module/components/font-family/index.js +1 -1
  895. package/build-module/components/font-sizes/font-size-picker.js +1 -1
  896. package/build-module/components/font-sizes/with-font-sizes.js +1 -1
  897. package/build-module/components/global-styles/advanced-panel.js +1 -1
  898. package/build-module/components/global-styles/border-panel.js +1 -1
  899. package/build-module/components/global-styles/color-panel.js +1 -1
  900. package/build-module/components/global-styles/color-panel.native.js +1 -1
  901. package/build-module/components/global-styles/dimensions-panel.js +1 -1
  902. package/build-module/components/global-styles/effects-panel.js +1 -1
  903. package/build-module/components/global-styles/filters-panel.js +1 -1
  904. package/build-module/components/global-styles/image-settings-panel.js +1 -1
  905. package/build-module/components/global-styles/typography-panel.js +1 -1
  906. package/build-module/components/gradients/with-gradient.js +1 -1
  907. package/build-module/components/height-control/index.js +2 -2
  908. package/build-module/components/height-control/index.js.map +1 -1
  909. package/build-module/components/iframe/index.js +1 -1
  910. package/build-module/components/image-editor/aspect-ratio-dropdown.js +1 -1
  911. package/build-module/components/image-editor/context.js +1 -1
  912. package/build-module/components/image-editor/cropper.js +1 -1
  913. package/build-module/components/image-editor/form-controls.js +1 -1
  914. package/build-module/components/image-editor/index.js +1 -1
  915. package/build-module/components/image-editor/rotation-button.js +1 -1
  916. package/build-module/components/image-editor/zoom-dropdown.js +1 -1
  917. package/build-module/components/image-size-control/index.js +1 -1
  918. package/build-module/components/index.js +1 -1
  919. package/build-module/components/index.js.map +1 -1
  920. package/build-module/components/inner-blocks/button-block-appender.js +1 -1
  921. package/build-module/components/inner-blocks/constants.native.js +6 -0
  922. package/build-module/components/inner-blocks/constants.native.js.map +1 -0
  923. package/build-module/components/inner-blocks/default-block-appender.js +1 -1
  924. package/build-module/components/inner-blocks/index.js +1 -1
  925. package/build-module/components/inner-blocks/index.native.js +13 -1
  926. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  927. package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js +86 -0
  928. package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js.map +1 -0
  929. package/build-module/components/inner-blocks/with-client-id.js +1 -1
  930. package/build-module/components/inserter/block-patterns-explorer/explorer.js +1 -1
  931. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +1 -1
  932. package/build-module/components/inserter/block-patterns-explorer/sidebar.js +1 -1
  933. package/build-module/components/inserter/block-patterns-filter.js +14 -13
  934. package/build-module/components/inserter/block-patterns-filter.js.map +1 -1
  935. package/build-module/components/inserter/block-patterns-tab.js +2 -2
  936. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  937. package/build-module/components/inserter/block-types-tab.js +1 -1
  938. package/build-module/components/inserter/block-types-tab.native.js +1 -1
  939. package/build-module/components/inserter/index.js +3 -3
  940. package/build-module/components/inserter/index.js.map +1 -1
  941. package/build-module/components/inserter/index.native.js +3 -3
  942. package/build-module/components/inserter/index.native.js.map +1 -1
  943. package/build-module/components/inserter/library.js +1 -1
  944. package/build-module/components/inserter/media-tab/hooks.js +5 -34
  945. package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
  946. package/build-module/components/inserter/media-tab/media-list.js +1 -1
  947. package/build-module/components/inserter/media-tab/media-panel.js +1 -1
  948. package/build-module/components/inserter/media-tab/media-preview.js +1 -1
  949. package/build-module/components/inserter/media-tab/media-tab.js +1 -1
  950. package/build-module/components/inserter/media-tab/utils.js +1 -1
  951. package/build-module/components/inserter/menu.js +1 -1
  952. package/build-module/components/inserter/menu.native.js +1 -1
  953. package/build-module/components/inserter/mobile-tab-navigation.js +1 -1
  954. package/build-module/components/inserter/no-results.js +1 -1
  955. package/build-module/components/inserter/no-results.native.js +1 -1
  956. package/build-module/components/inserter/panel.js +1 -1
  957. package/build-module/components/inserter/preview-panel.js +1 -1
  958. package/build-module/components/inserter/quick-inserter.js +1 -1
  959. package/build-module/components/inserter/reusable-block-rename-hint.js +1 -1
  960. package/build-module/components/inserter/reusable-blocks-tab.native.js +1 -1
  961. package/build-module/components/inserter/search-results.js +1 -1
  962. package/build-module/components/inserter/search-results.native.js +1 -1
  963. package/build-module/components/inserter/tabs.js +1 -1
  964. package/build-module/components/inserter/tabs.native.js +1 -1
  965. package/build-module/components/inserter/tips.js +1 -1
  966. package/build-module/components/inserter-draggable-blocks/index.js +1 -1
  967. package/build-module/components/inserter-list-item/index.js +1 -1
  968. package/build-module/components/inserter-listbox/group.js +1 -1
  969. package/build-module/components/inserter-listbox/index.js +1 -1
  970. package/build-module/components/inserter-listbox/item.js +1 -1
  971. package/build-module/components/inserter-listbox/row.js +1 -1
  972. package/build-module/components/inspector-controls/block-support-slot-container.js +1 -1
  973. package/build-module/components/inspector-controls/block-support-tools-panel.js +1 -1
  974. package/build-module/components/inspector-controls/fill.js +1 -1
  975. package/build-module/components/inspector-controls/fill.native.js +1 -1
  976. package/build-module/components/inspector-controls/index.js +1 -1
  977. package/build-module/components/inspector-controls/slot.js +1 -1
  978. package/build-module/components/inspector-controls/slot.native.js +1 -1
  979. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js +1 -1
  980. package/build-module/components/inspector-controls-tabs/index.js +1 -1
  981. package/build-module/components/inspector-controls-tabs/position-controls-panel.js +1 -1
  982. package/build-module/components/inspector-controls-tabs/settings-tab-hint.js +1 -1
  983. package/build-module/components/inspector-controls-tabs/settings-tab.js +1 -1
  984. package/build-module/components/inspector-controls-tabs/styles-tab.js +1 -1
  985. package/build-module/components/inspector-popover-header/index.js +1 -1
  986. package/build-module/components/justify-content-control/index.js +1 -1
  987. package/build-module/components/justify-content-control/ui.js +1 -1
  988. package/build-module/components/letter-spacing-control/index.js +2 -2
  989. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  990. package/build-module/components/line-height-control/index.js +1 -1
  991. package/build-module/components/line-height-control/index.native.js +1 -1
  992. package/build-module/components/link-control/index.js +1 -1
  993. package/build-module/components/link-control/link-preview.js +1 -1
  994. package/build-module/components/link-control/search-create-button.js +1 -1
  995. package/build-module/components/link-control/search-input.js +1 -1
  996. package/build-module/components/link-control/search-item.js +1 -1
  997. package/build-module/components/link-control/search-results.js +1 -1
  998. package/build-module/components/link-control/settings-drawer.js +1 -1
  999. package/build-module/components/link-control/settings.js +1 -1
  1000. package/build-module/components/list-view/appender.js +1 -1
  1001. package/build-module/components/list-view/aria-referenced-text.js +1 -1
  1002. package/build-module/components/list-view/block-contents.js +1 -1
  1003. package/build-module/components/list-view/block-select-button.js +1 -1
  1004. package/build-module/components/list-view/block.js +4 -35
  1005. package/build-module/components/list-view/block.js.map +1 -1
  1006. package/build-module/components/list-view/branch.js +9 -2
  1007. package/build-module/components/list-view/branch.js.map +1 -1
  1008. package/build-module/components/list-view/drop-indicator.js +1 -1
  1009. package/build-module/components/list-view/expander.js +1 -1
  1010. package/build-module/components/list-view/index.js +9 -4
  1011. package/build-module/components/list-view/index.js.map +1 -1
  1012. package/build-module/components/list-view/leaf.js +1 -1
  1013. package/build-module/components/list-view/utils.js +34 -0
  1014. package/build-module/components/list-view/utils.js.map +1 -1
  1015. package/build-module/components/media-placeholder/index.js +1 -1
  1016. package/build-module/components/media-placeholder/index.native.js +1 -1
  1017. package/build-module/components/media-replace-flow/index.js +1 -1
  1018. package/build-module/components/media-replace-flow/index.native.js +1 -1
  1019. package/build-module/components/media-upload/{constants.js → constants.native.js} +1 -2
  1020. package/build-module/components/media-upload/constants.native.js.map +1 -0
  1021. package/build-module/components/media-upload/index.js +1 -1
  1022. package/build-module/components/media-upload/index.js.map +1 -1
  1023. package/build-module/components/media-upload/index.native.js +7 -7
  1024. package/build-module/components/media-upload/index.native.js.map +1 -1
  1025. package/build-module/components/media-upload-progress/index.native.js +1 -1
  1026. package/build-module/components/multi-selection-inspector/index.js +1 -1
  1027. package/build-module/components/navigable-toolbar/index.js +1 -1
  1028. package/build-module/components/observe-typing/index.js +1 -1
  1029. package/build-module/components/panel-color-settings/index.js +1 -1
  1030. package/build-module/components/plain-text/index.js +1 -1
  1031. package/build-module/components/plain-text/index.native.js +1 -1
  1032. package/build-module/components/preview-options/index.js +1 -1
  1033. package/build-module/components/provider/block-refs-provider.js +1 -1
  1034. package/build-module/components/provider/index.js +1 -1
  1035. package/build-module/components/provider/index.native.js +1 -1
  1036. package/build-module/components/provider/use-block-sync.js +1 -1
  1037. package/build-module/components/provider/use-block-sync.js.map +1 -1
  1038. package/build-module/components/provider/with-registry-provider.js +1 -1
  1039. package/build-module/components/publish-date-time-picker/index.js +1 -1
  1040. package/build-module/components/recursion-provider/index.js +1 -1
  1041. package/build-module/components/resizable-box-popover/index.js +1 -1
  1042. package/build-module/components/resolution-tool/index.js +1 -1
  1043. package/build-module/components/responsive-block-control/index.js +1 -1
  1044. package/build-module/components/responsive-block-control/label.js +1 -1
  1045. package/build-module/components/rich-text/content.js +1 -1
  1046. package/build-module/components/rich-text/embed-handler-picker.native.js +1 -1
  1047. package/build-module/components/rich-text/format-edit.js +1 -1
  1048. package/build-module/components/rich-text/format-toolbar/index.js +1 -1
  1049. package/build-module/components/rich-text/format-toolbar/index.native.js +1 -1
  1050. package/build-module/components/rich-text/format-toolbar-container.js +1 -1
  1051. package/build-module/components/rich-text/format-toolbar-container.native.js +1 -1
  1052. package/build-module/components/rich-text/get-rich-text-values.js +1 -1
  1053. package/build-module/components/rich-text/index.js +1 -1
  1054. package/build-module/components/rich-text/index.native.js +2 -10
  1055. package/build-module/components/rich-text/index.native.js.map +1 -1
  1056. package/build-module/components/rich-text/multiline.js +1 -1
  1057. package/build-module/components/rich-text/toolbar-button.js +1 -1
  1058. package/build-module/components/rich-text/use-paste-handler.js +7 -89
  1059. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  1060. package/build-module/components/rich-text/utils.js +1 -3
  1061. package/build-module/components/rich-text/utils.js.map +1 -1
  1062. package/build-module/components/skip-to-selected-block/index.js +1 -1
  1063. package/build-module/components/spacing-sizes-control/index.js +1 -1
  1064. package/build-module/components/spacing-sizes-control/input-controls/axial.js +1 -1
  1065. package/build-module/components/spacing-sizes-control/input-controls/separated.js +1 -1
  1066. package/build-module/components/spacing-sizes-control/input-controls/single.js +1 -1
  1067. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  1068. package/build-module/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
  1069. package/build-module/components/text-decoration-control/index.js +2 -2
  1070. package/build-module/components/text-decoration-control/index.js.map +1 -1
  1071. package/build-module/components/text-transform-control/index.js +2 -2
  1072. package/build-module/components/text-transform-control/index.js.map +1 -1
  1073. package/build-module/components/tool-selector/index.js +1 -1
  1074. package/build-module/components/typewriter/index.js +2 -2
  1075. package/build-module/components/typewriter/index.js.map +1 -1
  1076. package/build-module/components/ungroup-button/index.native.js +1 -1
  1077. package/build-module/components/unit-control/index.js +1 -1
  1078. package/build-module/components/unsupported-block-details/index.native.js +118 -0
  1079. package/build-module/components/unsupported-block-details/index.native.js.map +1 -0
  1080. package/build-module/components/url-input/button.js +1 -1
  1081. package/build-module/components/url-input/index.js +1 -1
  1082. package/build-module/components/url-input/index.native.js +1 -1
  1083. package/build-module/components/url-popover/image-url-input-ui.js +1 -1
  1084. package/build-module/components/url-popover/index.js +1 -1
  1085. package/build-module/components/url-popover/link-editor.js +1 -1
  1086. package/build-module/components/url-popover/link-viewer-url.js +1 -1
  1087. package/build-module/components/url-popover/link-viewer.js +1 -1
  1088. package/build-module/components/use-on-block-drop/index.js +2 -2
  1089. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  1090. package/build-module/components/use-unsupported-block-editor/index.native.js +51 -0
  1091. package/build-module/components/use-unsupported-block-editor/index.native.js.map +1 -0
  1092. package/build-module/components/video-player/gridicon-play.native.js +1 -1
  1093. package/build-module/components/video-player/index.native.js +1 -1
  1094. package/build-module/components/warning/index.js +1 -1
  1095. package/build-module/components/warning/index.native.js +1 -1
  1096. package/build-module/components/writing-flow/index.js +5 -4
  1097. package/build-module/components/writing-flow/index.js.map +1 -1
  1098. package/build-module/components/writing-flow/use-clipboard-handler.js +172 -0
  1099. package/build-module/components/writing-flow/use-clipboard-handler.js.map +1 -0
  1100. package/build-module/components/writing-flow/use-tab-nav.js +1 -1
  1101. package/build-module/components/writing-mode-control/index.js +2 -2
  1102. package/build-module/components/writing-mode-control/index.js.map +1 -1
  1103. package/build-module/hooks/align.js +1 -1
  1104. package/build-module/hooks/anchor.js +3 -3
  1105. package/build-module/hooks/anchor.js.map +1 -1
  1106. package/build-module/hooks/background.js +1 -1
  1107. package/build-module/hooks/block-hooks.js +1 -1
  1108. package/build-module/hooks/block-rename-ui.js +1 -1
  1109. package/build-module/hooks/border.js +1 -1
  1110. package/build-module/hooks/color.js +1 -1
  1111. package/build-module/hooks/content-lock-ui.js +1 -1
  1112. package/build-module/hooks/contrast-checker.js +1 -1
  1113. package/build-module/hooks/custom-class-name.js +3 -3
  1114. package/build-module/hooks/custom-class-name.js.map +1 -1
  1115. package/build-module/hooks/custom-fields.js +3 -3
  1116. package/build-module/hooks/custom-fields.js.map +1 -1
  1117. package/build-module/hooks/dimensions.js +1 -1
  1118. package/build-module/hooks/duotone.js +1 -1
  1119. package/build-module/hooks/font-size.js +2 -2
  1120. package/build-module/hooks/font-size.js.map +1 -1
  1121. package/build-module/hooks/layout.js +1 -1
  1122. package/build-module/hooks/line-height.js +2 -2
  1123. package/build-module/hooks/line-height.js.map +1 -1
  1124. package/build-module/hooks/margin.js +1 -1
  1125. package/build-module/hooks/padding.js +1 -1
  1126. package/build-module/hooks/position.js +3 -3
  1127. package/build-module/hooks/position.js.map +1 -1
  1128. package/build-module/hooks/style.js +1 -1
  1129. package/build-module/hooks/typography.js +1 -1
  1130. package/build-module/hooks/typography.native.js +1 -1
  1131. package/build-module/layouts/constrained.js +1 -1
  1132. package/build-module/layouts/flex.js +1 -1
  1133. package/build-module/layouts/grid.js +1 -1
  1134. package/build-module/private-apis.js +2 -0
  1135. package/build-module/private-apis.js.map +1 -1
  1136. package/build-module/store/actions.js +8 -12
  1137. package/build-module/store/actions.js.map +1 -1
  1138. package/build-module/store/private-selectors.js +52 -0
  1139. package/build-module/store/private-selectors.js.map +1 -1
  1140. package/build-module/store/reducer.js +18 -1
  1141. package/build-module/store/reducer.js.map +1 -1
  1142. package/build-module/store/selectors.js +1 -1
  1143. package/build-module/store/selectors.js.map +1 -1
  1144. package/build-module/utils/pasting.js +47 -0
  1145. package/build-module/utils/pasting.js.map +1 -1
  1146. package/build-module/utils/transform-styles/transforms/wrap.js +5 -0
  1147. package/build-module/utils/transform-styles/transforms/wrap.js.map +1 -1
  1148. package/build-module/utils/use-notify-copy.js +46 -0
  1149. package/build-module/utils/use-notify-copy.js.map +1 -0
  1150. package/build-style/content-rtl.css +10 -11
  1151. package/build-style/content.css +10 -11
  1152. package/build-style/default-editor-styles-rtl.css +1 -1
  1153. package/build-style/default-editor-styles.css +1 -1
  1154. package/build-style/style-rtl.css +11 -12
  1155. package/build-style/style.css +11 -12
  1156. package/package.json +31 -32
  1157. package/src/components/block-actions/index.js +1 -1
  1158. package/src/components/block-breadcrumb/index.js +1 -1
  1159. package/src/components/block-canvas/index.js +6 -12
  1160. package/src/components/block-context/README.md +1 -1
  1161. package/src/components/block-heading-level-dropdown/heading-level-icon.js +2 -2
  1162. package/src/components/block-heading-level-dropdown/index.js +2 -2
  1163. package/src/components/block-heading-level-dropdown/index.native.js +2 -2
  1164. package/src/components/block-list/block-list-item.native.js +2 -2
  1165. package/src/components/block-parent-selector/index.js +1 -1
  1166. package/src/components/block-preview/index.js +1 -1
  1167. package/src/components/block-settings-menu/block-html-convert-button.js +28 -19
  1168. package/src/components/block-settings-menu-controls/index.js +1 -1
  1169. package/src/components/block-switcher/index.js +17 -18
  1170. package/src/components/block-switcher/test/__snapshots__/index.js.snap +2 -2
  1171. package/src/components/block-tools/block-selection-button.js +1 -1
  1172. package/src/components/border-radius-control/index.js +1 -1
  1173. package/src/components/child-layout-control/index.js +1 -1
  1174. package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
  1175. package/src/components/colors/with-colors.js +1 -1
  1176. package/src/components/copy-handler/README.md +2 -0
  1177. package/src/components/copy-handler/index.js +21 -291
  1178. package/src/components/dimensions-tool/index.js +1 -1
  1179. package/src/components/dimensions-tool/scale-tool.js +1 -1
  1180. package/src/components/dimensions-tool/width-height-tool.js +1 -1
  1181. package/src/components/duotone-control/index.js +14 -2
  1182. package/src/components/editable-text/README.md +2 -2
  1183. package/src/components/font-appearance-control/index.js +1 -1
  1184. package/src/components/font-family/README.md +1 -1
  1185. package/src/components/height-control/README.md +1 -1
  1186. package/src/components/height-control/index.js +1 -1
  1187. package/src/components/image-size-control/README.md +2 -2
  1188. package/src/components/index.js +1 -1
  1189. package/src/components/inner-blocks/constants.native.js +5 -0
  1190. package/src/components/inner-blocks/index.native.js +15 -0
  1191. package/src/components/inner-blocks/warning-max-depth-exceeded.native.js +100 -0
  1192. package/src/components/inserter/block-patterns-filter.js +22 -10
  1193. package/src/components/inserter/block-patterns-tab.js +0 -3
  1194. package/src/components/inserter/index.js +2 -2
  1195. package/src/components/inserter/index.native.js +2 -2
  1196. package/src/components/inserter/media-tab/hooks.js +10 -44
  1197. package/src/components/inserter/style.scss +1 -1
  1198. package/src/components/letter-spacing-control/index.js +1 -1
  1199. package/src/components/list-view/block.js +3 -43
  1200. package/src/components/list-view/branch.js +11 -1
  1201. package/src/components/list-view/index.js +8 -4
  1202. package/src/components/list-view/utils.js +37 -0
  1203. package/src/components/media-placeholder/README.md +3 -3
  1204. package/src/components/media-upload/{constants.js → constants.native.js} +0 -1
  1205. package/src/components/media-upload/index.js +1 -1
  1206. package/src/components/media-upload/index.native.js +9 -5
  1207. package/src/components/panel-color-settings/README.md +5 -1
  1208. package/src/components/plain-text/README.md +1 -1
  1209. package/src/components/provider/README.md +1 -1
  1210. package/src/components/provider/use-block-sync.js +1 -1
  1211. package/src/components/publish-date-time-picker/README.md +1 -1
  1212. package/src/components/responsive-block-control/README.md +1 -3
  1213. package/src/components/rich-text/README.md +3 -3
  1214. package/src/components/rich-text/index.native.js +0 -13
  1215. package/src/components/rich-text/use-paste-handler.js +5 -99
  1216. package/src/components/rich-text/utils.js +0 -3
  1217. package/src/components/text-decoration-control/index.js +1 -1
  1218. package/src/components/text-transform-control/index.js +1 -1
  1219. package/src/components/typewriter/index.js +1 -1
  1220. package/src/components/unit-control/README.md +1 -1
  1221. package/src/components/unsupported-block-details/index.native.js +183 -0
  1222. package/src/components/unsupported-block-details/style.native.scss +56 -0
  1223. package/src/components/url-input/README.md +4 -4
  1224. package/src/components/use-on-block-drop/index.js +2 -2
  1225. package/src/components/use-unsupported-block-editor/index.native.js +59 -0
  1226. package/src/components/writing-flow/index.js +4 -2
  1227. package/src/components/writing-flow/use-clipboard-handler.js +242 -0
  1228. package/src/components/writing-mode-control/index.js +1 -1
  1229. package/src/hooks/anchor.js +2 -2
  1230. package/src/hooks/custom-class-name.js +2 -2
  1231. package/src/hooks/custom-fields.js +2 -2
  1232. package/src/hooks/font-size.js +1 -1
  1233. package/src/hooks/line-height.js +1 -1
  1234. package/src/hooks/position.js +2 -2
  1235. package/src/private-apis.js +2 -0
  1236. package/src/store/actions.js +7 -11
  1237. package/src/store/private-selectors.js +72 -0
  1238. package/src/store/reducer.js +17 -0
  1239. package/src/store/selectors.js +1 -1
  1240. package/src/store/test/actions.js +10 -16
  1241. package/src/utils/pasting.js +51 -0
  1242. package/src/utils/transform-styles/transforms/test/__snapshots__/wrap.js.snap +13 -6
  1243. package/src/utils/transform-styles/transforms/test/wrap.js +9 -0
  1244. package/src/utils/transform-styles/transforms/wrap.js +5 -0
  1245. package/src/utils/use-notify-copy.js +63 -0
  1246. package/tsconfig.tsbuildinfo +1 -1
  1247. package/build/components/block-settings-menu/block-convert-button.js +0 -27
  1248. package/build/components/block-settings-menu/block-convert-button.js.map +0 -1
  1249. package/build/components/media-upload/constants.js.map +0 -1
  1250. package/build-module/components/block-settings-menu/block-convert-button.js +0 -20
  1251. package/build-module/components/block-settings-menu/block-convert-button.js.map +0 -1
  1252. package/build-module/components/media-upload/constants.js.map +0 -1
  1253. package/src/components/block-settings-menu/block-convert-button.js +0 -14
@@ -1 +1 @@
1
- {"version":3,"names":["useCallback","cloneBlock","findTransform","getBlockTransforms","pasteHandler","useDispatch","useSelect","useRegistry","getFilesFromDataTransfer","store","blockEditorStore","parseDropEvent","event","result","srcRootClientId","srcClientIds","srcIndex","type","blocks","dataTransfer","Object","assign","JSON","parse","getData","err","onBlockDrop","targetRootClientId","targetBlockIndex","getBlockIndex","getClientIdsOfDescendants","moveBlocks","insertOrReplaceBlocks","clearSelectedBlock","sourceRootClientId","sourceClientIds","dropType","blocksToInsert","map","block","sourceBlockIndex","includes","some","id","isAtSameLevel","draggedBlockCount","length","insertIndex","onFilesDrop","hasUploadPermissions","updateBlockAttributes","canInsertBlockType","files","transformation","transform","blockName","isMatch","onHTMLDrop","HTML","mode","useOnBlockDrop","options","operation","select","getSettings","mediaUpload","getBlockOrder","getBlocksByClientId","insertBlocks","moveBlocksToPosition","replaceBlocks","removeBlocks","registry","updateSelection","initialPosition","clientIds","clientId","undefined","sourceBlocks","targetBlockClientIds","targetBlockClientId","batch","_onDrop","_onFilesDrop","_onHTMLDrop","html"],"sources":["@wordpress/block-editor/src/components/use-on-block-drop/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport {\n\tcloneBlock,\n\tfindTransform,\n\tgetBlockTransforms,\n\tpasteHandler,\n} from '@wordpress/blocks';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('@wordpress/element').WPSyntheticEvent} WPSyntheticEvent */\n/** @typedef {import('./types').WPDropOperation} WPDropOperation */\n\n/**\n * Retrieve the data for a block drop event.\n *\n * @param {WPSyntheticEvent} event The drop event.\n *\n * @return {Object} An object with block drag and drop data.\n */\nexport function parseDropEvent( event ) {\n\tlet result = {\n\t\tsrcRootClientId: null,\n\t\tsrcClientIds: null,\n\t\tsrcIndex: null,\n\t\ttype: null,\n\t\tblocks: null,\n\t};\n\n\tif ( ! event.dataTransfer ) {\n\t\treturn result;\n\t}\n\n\ttry {\n\t\tresult = Object.assign(\n\t\t\tresult,\n\t\t\tJSON.parse( event.dataTransfer.getData( 'wp-blocks' ) )\n\t\t);\n\t} catch ( err ) {\n\t\treturn result;\n\t}\n\n\treturn result;\n}\n\n/**\n * A function that returns an event handler function for block drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {Function} getBlockIndex A function that gets the index of a block.\n * @param {Function} getClientIdsOfDescendants A function that gets the client ids of descendant blocks.\n * @param {Function} moveBlocks A function that moves blocks.\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n * @param {Function} clearSelectedBlock A function that clears block selection.\n * @return {Function} The event handler for a block drop event.\n */\nexport function onBlockDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\tgetBlockIndex,\n\tgetClientIdsOfDescendants,\n\tmoveBlocks,\n\tinsertOrReplaceBlocks,\n\tclearSelectedBlock\n) {\n\treturn ( event ) => {\n\t\tconst {\n\t\t\tsrcRootClientId: sourceRootClientId,\n\t\t\tsrcClientIds: sourceClientIds,\n\t\t\ttype: dropType,\n\t\t\tblocks,\n\t\t} = parseDropEvent( event );\n\n\t\t// If the user is inserting a block.\n\t\tif ( dropType === 'inserter' ) {\n\t\t\tclearSelectedBlock();\n\t\t\tconst blocksToInsert = blocks.map( ( block ) =>\n\t\t\t\tcloneBlock( block )\n\t\t\t);\n\t\t\tinsertOrReplaceBlocks( blocksToInsert, true, null );\n\t\t}\n\n\t\t// If the user is moving a block.\n\t\tif ( dropType === 'block' ) {\n\t\t\tconst sourceBlockIndex = getBlockIndex( sourceClientIds[ 0 ] );\n\n\t\t\t// If the user is dropping to the same position, return early.\n\t\t\tif (\n\t\t\t\tsourceRootClientId === targetRootClientId &&\n\t\t\t\tsourceBlockIndex === targetBlockIndex\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the user is attempting to drop a block within its own\n\t\t\t// nested blocks, return early as this would create infinite\n\t\t\t// recursion.\n\t\t\tif (\n\t\t\t\tsourceClientIds.includes( targetRootClientId ) ||\n\t\t\t\tgetClientIdsOfDescendants( sourceClientIds ).some(\n\t\t\t\t\t( id ) => id === targetRootClientId\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isAtSameLevel = sourceRootClientId === targetRootClientId;\n\t\t\tconst draggedBlockCount = sourceClientIds.length;\n\n\t\t\t// If the block is kept at the same level and moved downwards,\n\t\t\t// subtract to take into account that the blocks being dragged\n\t\t\t// were removed from the block list above the insertion point.\n\t\t\tconst insertIndex =\n\t\t\t\tisAtSameLevel && sourceBlockIndex < targetBlockIndex\n\t\t\t\t\t? targetBlockIndex - draggedBlockCount\n\t\t\t\t\t: targetBlockIndex;\n\n\t\t\tmoveBlocks( sourceClientIds, sourceRootClientId, insertIndex );\n\t\t}\n\t};\n}\n\n/**\n * A function that returns an event handler function for block-related file drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {boolean} hasUploadPermissions Whether the user has upload permissions.\n * @param {Function} updateBlockAttributes A function that updates a block's attributes.\n * @param {Function} canInsertBlockType A function that returns checks whether a block type can be inserted.\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n *\n * @return {Function} The event handler for a block-related file drop event.\n */\nexport function onFilesDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\thasUploadPermissions,\n\tupdateBlockAttributes,\n\tcanInsertBlockType,\n\tinsertOrReplaceBlocks\n) {\n\treturn ( files ) => {\n\t\tif ( ! hasUploadPermissions ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst transformation = findTransform(\n\t\t\tgetBlockTransforms( 'from' ),\n\t\t\t( transform ) =>\n\t\t\t\ttransform.type === 'files' &&\n\t\t\t\tcanInsertBlockType( transform.blockName, targetRootClientId ) &&\n\t\t\t\ttransform.isMatch( files )\n\t\t);\n\n\t\tif ( transformation ) {\n\t\t\tconst blocks = transformation.transform(\n\t\t\t\tfiles,\n\t\t\t\tupdateBlockAttributes\n\t\t\t);\n\t\t\tinsertOrReplaceBlocks( blocks );\n\t\t}\n\t};\n}\n\n/**\n * A function that returns an event handler function for block-related HTML drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n *\n * @return {Function} The event handler for a block-related HTML drop event.\n */\nexport function onHTMLDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\tinsertOrReplaceBlocks\n) {\n\treturn ( HTML ) => {\n\t\tconst blocks = pasteHandler( { HTML, mode: 'BLOCKS' } );\n\n\t\tif ( blocks.length ) {\n\t\t\tinsertOrReplaceBlocks( blocks );\n\t\t}\n\t};\n}\n\n/**\n * A React hook for handling block drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {Object} options The optional options.\n * @param {WPDropOperation} [options.operation] The type of operation to perform on drop. Could be `insert` or `replace` for now.\n *\n * @return {Function} A function to be passed to the onDrop handler.\n */\nexport default function useOnBlockDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\toptions = {}\n) {\n\tconst { operation = 'insert' } = options;\n\tconst hasUploadPermissions = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings().mediaUpload,\n\t\t[]\n\t);\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetBlockIndex,\n\t\tgetClientIdsOfDescendants,\n\t\tgetBlockOrder,\n\t\tgetBlocksByClientId,\n\t} = useSelect( blockEditorStore );\n\tconst {\n\t\tinsertBlocks,\n\t\tmoveBlocksToPosition,\n\t\tupdateBlockAttributes,\n\t\tclearSelectedBlock,\n\t\treplaceBlocks,\n\t\tremoveBlocks,\n\t} = useDispatch( blockEditorStore );\n\tconst registry = useRegistry();\n\n\tconst insertOrReplaceBlocks = useCallback(\n\t\t( blocks, updateSelection = true, initialPosition = 0 ) => {\n\t\t\tif ( operation === 'replace' ) {\n\t\t\t\tconst clientIds = getBlockOrder( targetRootClientId );\n\t\t\t\tconst clientId = clientIds[ targetBlockIndex ];\n\n\t\t\t\treplaceBlocks( clientId, blocks, undefined, initialPosition );\n\t\t\t} else {\n\t\t\t\tinsertBlocks(\n\t\t\t\t\tblocks,\n\t\t\t\t\ttargetBlockIndex,\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\tupdateSelection,\n\t\t\t\t\tinitialPosition\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\toperation,\n\t\t\tgetBlockOrder,\n\t\t\tinsertBlocks,\n\t\t\treplaceBlocks,\n\t\t\ttargetBlockIndex,\n\t\t\ttargetRootClientId,\n\t\t]\n\t);\n\n\tconst moveBlocks = useCallback(\n\t\t( sourceClientIds, sourceRootClientId, insertIndex ) => {\n\t\t\tif ( operation === 'replace' ) {\n\t\t\t\tconst sourceBlocks = getBlocksByClientId( sourceClientIds );\n\t\t\t\tconst targetBlockClientIds =\n\t\t\t\t\tgetBlockOrder( targetRootClientId );\n\t\t\t\tconst targetBlockClientId =\n\t\t\t\t\ttargetBlockClientIds[ targetBlockIndex ];\n\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t// Remove the source blocks.\n\t\t\t\t\tremoveBlocks( sourceClientIds, false );\n\t\t\t\t\t// Replace the target block with the source blocks.\n\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\ttargetBlockClientId,\n\t\t\t\t\t\tsourceBlocks,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t0\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\tsourceClientIds,\n\t\t\t\t\tsourceRootClientId,\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\tinsertIndex\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\toperation,\n\t\t\tgetBlockOrder,\n\t\t\tgetBlocksByClientId,\n\t\t\tinsertBlocks,\n\t\t\tmoveBlocksToPosition,\n\t\t\tremoveBlocks,\n\t\t\ttargetBlockIndex,\n\t\t\ttargetRootClientId,\n\t\t]\n\t);\n\n\tconst _onDrop = onBlockDrop(\n\t\ttargetRootClientId,\n\t\ttargetBlockIndex,\n\t\tgetBlockIndex,\n\t\tgetClientIdsOfDescendants,\n\t\tmoveBlocks,\n\t\tinsertOrReplaceBlocks,\n\t\tclearSelectedBlock\n\t);\n\tconst _onFilesDrop = onFilesDrop(\n\t\ttargetRootClientId,\n\t\ttargetBlockIndex,\n\t\thasUploadPermissions,\n\t\tupdateBlockAttributes,\n\t\tcanInsertBlockType,\n\t\tinsertOrReplaceBlocks\n\t);\n\tconst _onHTMLDrop = onHTMLDrop(\n\t\ttargetRootClientId,\n\t\ttargetBlockIndex,\n\t\tinsertOrReplaceBlocks\n\t);\n\n\treturn ( event ) => {\n\t\tconst files = getFilesFromDataTransfer( event.dataTransfer );\n\t\tconst html = event.dataTransfer.getData( 'text/html' );\n\n\t\t/**\n\t\t * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.\n\t\t * The order of the checks is important to recognise the HTML drop.\n\t\t */\n\t\tif ( html ) {\n\t\t\t_onHTMLDrop( html );\n\t\t} else if ( files.length ) {\n\t\t\t_onFilesDrop( files );\n\t\t} else {\n\t\t\t_onDrop( event );\n\t\t}\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,oBAAoB;AAChD,SACCC,UAAU,EACVC,aAAa,EACbC,kBAAkB,EAClBC,YAAY,QACN,mBAAmB;AAC1B,SAASC,WAAW,EAAEC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACrE,SAASC,wBAAwB,QAAQ,gBAAgB;;AAEzD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;;AAEvD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAEC,KAAK,EAAG;EACvC,IAAIC,MAAM,GAAG;IACZC,eAAe,EAAE,IAAI;IACrBC,YAAY,EAAE,IAAI;IAClBC,QAAQ,EAAE,IAAI;IACdC,IAAI,EAAE,IAAI;IACVC,MAAM,EAAE;EACT,CAAC;EAED,IAAK,CAAEN,KAAK,CAACO,YAAY,EAAG;IAC3B,OAAON,MAAM;EACd;EAEA,IAAI;IACHA,MAAM,GAAGO,MAAM,CAACC,MAAM,CACrBR,MAAM,EACNS,IAAI,CAACC,KAAK,CAAEX,KAAK,CAACO,YAAY,CAACK,OAAO,CAAE,WAAY,CAAE,CACvD,CAAC;EACF,CAAC,CAAC,OAAQC,GAAG,EAAG;IACf,OAAOZ,MAAM;EACd;EAEA,OAAOA,MAAM;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASa,WAAWA,CAC1BC,kBAAkB,EAClBC,gBAAgB,EAChBC,aAAa,EACbC,yBAAyB,EACzBC,UAAU,EACVC,qBAAqB,EACrBC,kB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AAE,MAAM;QACrB;QACAV,YAAY,CAAEpC,eAAe,EAAE,KAAM,CAAC;QACtC;QACAmC,aAAa,CACZU,mBAAmB,EACnBF,YAAY,EACZD,SAAS,EACT,CACD,CAAC;MACF,CAAE,CAAC;IACJ,CAAC,MAAM;MACNR,oBAAoB,CACnBlC,eAAe,EACfD,kBAAkB,EAClBP,kBAAkB,EAClBoB,WACD,CAAC;IACF;EACD,CAAC,EACD,CACCe,SAAS,EACTI,aAAa,EACbC,mBAAmB,EACnBC,YAAY,EACZC,oBAAoB,EACpBE,YAAY,EACZ3C,gBAAgB,EAChBD,kBAAkB,CAEpB,CAAC;EAED,MAAMuD,OAAO,GAAGxD,WAAW,CAC1BC,kBAAkB,EAClBC,gBAAgB,EAChBC,aAAa,EACbC,yBAAyB,EACzBC,UAAU,EACVC,qBAAqB,EACrBC,kBACD,CAAC;EACD,MAAMkD,YAAY,GAAGnC,WAAW,CAC/BrB,kBAAkB,EAClBC,gBAAgB,EAChBqB,oBAAoB,EACpBC,qBAAqB,EACrBC,kBAAkB,EAClBnB,qBACD,CAAC;EACD,MAAMoD,WAAW,GAAG3B,UAAU,CAC7B9B,kBAAkB,EAClBC,gBAAgB,EAChBI,qBACD,CAAC;EAED,OAASpB,KAAK,IAAM;IACnB,MAAMwC,KAAK,GAAG5C,wBAAwB,CAAEI,KAAK,CAACO,YAAa,CAAC;IAC5D,MAAMkE,IAAI,GAAGzE,KAAK,CAACO,YAAY,CAACK,OAAO,CAAE,WAAY,CAAC;;IAEtD;AACF;AACA;AACA;IACE,IAAK6D,IAAI,EAAG;MACXD,WAAW,CAAEC,IAAK,CAAC;IACpB,CAAC,MAAM,IAAKjC,KAAK,CAACN,MAAM,EAAG;MAC1BqC,YAAY,CAAE/B,KAAM,CAAC;IACtB,CAAC,MAAM;MACN8B,OAAO,CAAEtE,KAAM,CAAC;IACjB;EACD,CAAC;AACF"}
1
+ {"version":3,"names":["useCallback","cloneBlock","findTransform","getBlockTransforms","pasteHandler","useDispatch","useSelect","useRegistry","getFilesFromDataTransfer","store","blockEditorStore","parseDropEvent","event","result","srcRootClientId","srcClientIds","srcIndex","type","blocks","dataTransfer","Object","assign","JSON","parse","getData","err","onBlockDrop","targetRootClientId","targetBlockIndex","getBlockIndex","getClientIdsOfDescendants","moveBlocks","insertOrReplaceBlocks","clearSelectedBlock","sourceRootClientId","sourceClientIds","dropType","blocksToInsert","map","block","sourceBlockIndex","includes","some","id","isAtSameLevel","draggedBlockCount","length","insertIndex","onFilesDrop","hasUploadPermissions","updateBlockAttributes","canInsertBlockType","files","transformation","transform","blockName","isMatch","onHTMLDrop","HTML","mode","useOnBlockDrop","options","operation","select","getSettings","mediaUpload","getBlockOrder","getBlocksByClientId","insertBlocks","moveBlocksToPosition","replaceBlocks","removeBlocks","registry","updateSelection","initialPosition","clientIds","clientId","undefined","sourceBlocks","targetBlockClientIds","targetBlockClientId","batch","_onDrop","_onFilesDrop","_onHTMLDrop","html"],"sources":["@wordpress/block-editor/src/components/use-on-block-drop/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport {\n\tcloneBlock,\n\tfindTransform,\n\tgetBlockTransforms,\n\tpasteHandler,\n} from '@wordpress/blocks';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('react').SyntheticEvent} SyntheticEvent */\n/** @typedef {import('./types').WPDropOperation} WPDropOperation */\n\n/**\n * Retrieve the data for a block drop event.\n *\n * @param {SyntheticEvent} event The drop event.\n *\n * @return {Object} An object with block drag and drop data.\n */\nexport function parseDropEvent( event ) {\n\tlet result = {\n\t\tsrcRootClientId: null,\n\t\tsrcClientIds: null,\n\t\tsrcIndex: null,\n\t\ttype: null,\n\t\tblocks: null,\n\t};\n\n\tif ( ! event.dataTransfer ) {\n\t\treturn result;\n\t}\n\n\ttry {\n\t\tresult = Object.assign(\n\t\t\tresult,\n\t\t\tJSON.parse( event.dataTransfer.getData( 'wp-blocks' ) )\n\t\t);\n\t} catch ( err ) {\n\t\treturn result;\n\t}\n\n\treturn result;\n}\n\n/**\n * A function that returns an event handler function for block drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {Function} getBlockIndex A function that gets the index of a block.\n * @param {Function} getClientIdsOfDescendants A function that gets the client ids of descendant blocks.\n * @param {Function} moveBlocks A function that moves blocks.\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n * @param {Function} clearSelectedBlock A function that clears block selection.\n * @return {Function} The event handler for a block drop event.\n */\nexport function onBlockDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\tgetBlockIndex,\n\tgetClientIdsOfDescendants,\n\tmoveBlocks,\n\tinsertOrReplaceBlocks,\n\tclearSelectedBlock\n) {\n\treturn ( event ) => {\n\t\tconst {\n\t\t\tsrcRootClientId: sourceRootClientId,\n\t\t\tsrcClientIds: sourceClientIds,\n\t\t\ttype: dropType,\n\t\t\tblocks,\n\t\t} = parseDropEvent( event );\n\n\t\t// If the user is inserting a block.\n\t\tif ( dropType === 'inserter' ) {\n\t\t\tclearSelectedBlock();\n\t\t\tconst blocksToInsert = blocks.map( ( block ) =>\n\t\t\t\tcloneBlock( block )\n\t\t\t);\n\t\t\tinsertOrReplaceBlocks( blocksToInsert, true, null );\n\t\t}\n\n\t\t// If the user is moving a block.\n\t\tif ( dropType === 'block' ) {\n\t\t\tconst sourceBlockIndex = getBlockIndex( sourceClientIds[ 0 ] );\n\n\t\t\t// If the user is dropping to the same position, return early.\n\t\t\tif (\n\t\t\t\tsourceRootClientId === targetRootClientId &&\n\t\t\t\tsourceBlockIndex === targetBlockIndex\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the user is attempting to drop a block within its own\n\t\t\t// nested blocks, return early as this would create infinite\n\t\t\t// recursion.\n\t\t\tif (\n\t\t\t\tsourceClientIds.includes( targetRootClientId ) ||\n\t\t\t\tgetClientIdsOfDescendants( sourceClientIds ).some(\n\t\t\t\t\t( id ) => id === targetRootClientId\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isAtSameLevel = sourceRootClientId === targetRootClientId;\n\t\t\tconst draggedBlockCount = sourceClientIds.length;\n\n\t\t\t// If the block is kept at the same level and moved downwards,\n\t\t\t// subtract to take into account that the blocks being dragged\n\t\t\t// were removed from the block list above the insertion point.\n\t\t\tconst insertIndex =\n\t\t\t\tisAtSameLevel && sourceBlockIndex < targetBlockIndex\n\t\t\t\t\t? targetBlockIndex - draggedBlockCount\n\t\t\t\t\t: targetBlockIndex;\n\n\t\t\tmoveBlocks( sourceClientIds, sourceRootClientId, insertIndex );\n\t\t}\n\t};\n}\n\n/**\n * A function that returns an event handler function for block-related file drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {boolean} hasUploadPermissions Whether the user has upload permissions.\n * @param {Function} updateBlockAttributes A function that updates a block's attributes.\n * @param {Function} canInsertBlockType A function that returns checks whether a block type can be inserted.\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n *\n * @return {Function} The event handler for a block-related file drop event.\n */\nexport function onFilesDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\thasUploadPermissions,\n\tupdateBlockAttributes,\n\tcanInsertBlockType,\n\tinsertOrReplaceBlocks\n) {\n\treturn ( files ) => {\n\t\tif ( ! hasUploadPermissions ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst transformation = findTransform(\n\t\t\tgetBlockTransforms( 'from' ),\n\t\t\t( transform ) =>\n\t\t\t\ttransform.type === 'files' &&\n\t\t\t\tcanInsertBlockType( transform.blockName, targetRootClientId ) &&\n\t\t\t\ttransform.isMatch( files )\n\t\t);\n\n\t\tif ( transformation ) {\n\t\t\tconst blocks = transformation.transform(\n\t\t\t\tfiles,\n\t\t\t\tupdateBlockAttributes\n\t\t\t);\n\t\t\tinsertOrReplaceBlocks( blocks );\n\t\t}\n\t};\n}\n\n/**\n * A function that returns an event handler function for block-related HTML drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n *\n * @return {Function} The event handler for a block-related HTML drop event.\n */\nexport function onHTMLDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\tinsertOrReplaceBlocks\n) {\n\treturn ( HTML ) => {\n\t\tconst blocks = pasteHandler( { HTML, mode: 'BLOCKS' } );\n\n\t\tif ( blocks.length ) {\n\t\t\tinsertOrReplaceBlocks( blocks );\n\t\t}\n\t};\n}\n\n/**\n * A React hook for handling block drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {Object} options The optional options.\n * @param {WPDropOperation} [options.operation] The type of operation to perform on drop. Could be `insert` or `replace` for now.\n *\n * @return {Function} A function to be passed to the onDrop handler.\n */\nexport default function useOnBlockDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\toptions = {}\n) {\n\tconst { operation = 'insert' } = options;\n\tconst hasUploadPermissions = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings().mediaUpload,\n\t\t[]\n\t);\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetBlockIndex,\n\t\tgetClientIdsOfDescendants,\n\t\tgetBlockOrder,\n\t\tgetBlocksByClientId,\n\t} = useSelect( blockEditorStore );\n\tconst {\n\t\tinsertBlocks,\n\t\tmoveBlocksToPosition,\n\t\tupdateBlockAttributes,\n\t\tclearSelectedBlock,\n\t\treplaceBlocks,\n\t\tremoveBlocks,\n\t} = useDispatch( blockEditorStore );\n\tconst registry = useRegistry();\n\n\tconst insertOrReplaceBlocks = useCallback(\n\t\t( blocks, updateSelection = true, initialPosition = 0 ) => {\n\t\t\tif ( operation === 'replace' ) {\n\t\t\t\tconst clientIds = getBlockOrder( targetRootClientId );\n\t\t\t\tconst clientId = clientIds[ targetBlockIndex ];\n\n\t\t\t\treplaceBlocks( clientId, blocks, undefined, initialPosition );\n\t\t\t} else {\n\t\t\t\tinsertBlocks(\n\t\t\t\t\tblocks,\n\t\t\t\t\ttargetBlockIndex,\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\tupdateSelection,\n\t\t\t\t\tinitialPosition\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\toperation,\n\t\t\tgetBlockOrder,\n\t\t\tinsertBlocks,\n\t\t\treplaceBlocks,\n\t\t\ttargetBlockIndex,\n\t\t\ttargetRootClientId,\n\t\t]\n\t);\n\n\tconst moveBlocks = useCallback(\n\t\t( sourceClientIds, sourceRootClientId, insertIndex ) => {\n\t\t\tif ( operation === 'replace' ) {\n\t\t\t\tconst sourceBlocks = getBlocksByClientId( sourceClientIds );\n\t\t\t\tconst targetBlockClientIds =\n\t\t\t\t\tgetBlockOrder( targetRootClientId );\n\t\t\t\tconst targetBlockClientId =\n\t\t\t\t\ttargetBlockClientIds[ targetBlockIndex ];\n\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t// Remove the source blocks.\n\t\t\t\t\tremoveBlocks( sourceClientIds, false );\n\t\t\t\t\t// Replace the target block with the source blocks.\n\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\ttargetBlockClientId,\n\t\t\t\t\t\tsourceBlocks,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t0\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\tsourceClientIds,\n\t\t\t\t\tsourceRootClientId,\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\tinsertIndex\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\toperation,\n\t\t\tgetBlockOrder,\n\t\t\tgetBlocksByClientId,\n\t\t\tinsertBlocks,\n\t\t\tmoveBlocksToPosition,\n\t\t\tremoveBlocks,\n\t\t\ttargetBlockIndex,\n\t\t\ttargetRootClientId,\n\t\t]\n\t);\n\n\tconst _onDrop = onBlockDrop(\n\t\ttargetRootClientId,\n\t\ttargetBlockIndex,\n\t\tgetBlockIndex,\n\t\tgetClientIdsOfDescendants,\n\t\tmoveBlocks,\n\t\tinsertOrReplaceBlocks,\n\t\tclearSelectedBlock\n\t);\n\tconst _onFilesDrop = onFilesDrop(\n\t\ttargetRootClientId,\n\t\ttargetBlockIndex,\n\t\thasUploadPermissions,\n\t\tupdateBlockAttributes,\n\t\tcanInsertBlockType,\n\t\tinsertOrReplaceBlocks\n\t);\n\tconst _onHTMLDrop = onHTMLDrop(\n\t\ttargetRootClientId,\n\t\ttargetBlockIndex,\n\t\tinsertOrReplaceBlocks\n\t);\n\n\treturn ( event ) => {\n\t\tconst files = getFilesFromDataTransfer( event.dataTransfer );\n\t\tconst html = event.dataTransfer.getData( 'text/html' );\n\n\t\t/**\n\t\t * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.\n\t\t * The order of the checks is important to recognise the HTML drop.\n\t\t */\n\t\tif ( html ) {\n\t\t\t_onHTMLDrop( html );\n\t\t} else if ( files.length ) {\n\t\t\t_onFilesDrop( files );\n\t\t} else {\n\t\t\t_onDrop( event );\n\t\t}\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,oBAAoB;AAChD,SACCC,UAAU,EACVC,aAAa,EACbC,kBAAkB,EAClBC,YAAY,QACN,mBAAmB;AAC1B,SAASC,WAAW,EAAEC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACrE,SAASC,wBAAwB,QAAQ,gBAAgB;;AAEzD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;;AAEvD;AACA;;AAEA;A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C,kBACD,CAAC;EACD,MAAMkD,YAAY,GAAGnC,WAAW,CAC/BrB,kBAAkB,EAClBC,gBAAgB,EAChBqB,oBAAoB,EACpBC,qBAAqB,EACrBC,kBAAkB,EAClBnB,qBACD,CAAC;EACD,MAAMoD,WAAW,GAAG3B,UAAU,CAC7B9B,kBAAkB,EAClBC,gBAAgB,EAChBI,qBACD,CAAC;EAED,OAASpB,KAAK,IAAM;IACnB,MAAMwC,KAAK,GAAG5C,wBAAwB,CAAEI,KAAK,CAACO,YAAa,CAAC;IAC5D,MAAMkE,IAAI,GAAGzE,KAAK,CAACO,YAAY,CAACK,OAAO,CAAE,WAAY,CAAC;;IAEtD;AACF;AACA;AACA;IACE,IAAK6D,IAAI,EAAG;MACXD,WAAW,CAAEC,IAAK,CAAC;IACpB,CAAC,MAAM,IAAKjC,KAAK,CAACN,MAAM,EAAG;MAC1BqC,YAAY,CAAE/B,KAAM,CAAC;IACtB,CAAC,MAAM;MACN8B,OAAO,CAAEtE,KAAM,CAAC;IACjB;EACD,CAAC;AACF"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useSelect } from '@wordpress/data';
5
+ import { serialize } from '@wordpress/blocks';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { store as blockEditorStore } from '../../store';
11
+
12
+ // Blocks that can't be edited through the Unsupported block editor identified by their name.
13
+ const UBE_INCOMPATIBLE_BLOCKS = ['core/block'];
14
+
15
+ /**
16
+ * Hook that retrieves the settings to determine if the
17
+ * Unsupported Block Editor can be used in a specific block.
18
+ *
19
+ * @param {string} clientId Client ID of block.
20
+ * @return {Object} Unsupported block editor settings.
21
+ */
22
+ export default function useUnsupportedBlockEditor(clientId) {
23
+ return useSelect(select => {
24
+ const {
25
+ getBlock,
26
+ getSettings
27
+ } = select(blockEditorStore);
28
+ const {
29
+ capabilities
30
+ } = getSettings();
31
+ const block = getBlock(clientId);
32
+ const blockAttributes = block?.attributes || {};
33
+ const blockDetails = {
34
+ blockName: block?.name,
35
+ blockContent: serialize(block ? [block] : [])
36
+ };
37
+
38
+ // If the block is unsupported, use the `original` attributes to identify the block's name.
39
+ if (blockDetails.blockName === 'core/missing') {
40
+ blockDetails.blockName = blockAttributes.originalName;
41
+ blockDetails.blockContent = blockDetails.blockName === 'core/freeform' ? blockAttributes.content : block?.originalContent;
42
+ }
43
+ return {
44
+ isUnsupportedBlockEditorSupported: capabilities?.unsupportedBlockEditor === true,
45
+ canEnableUnsupportedBlockEditor: capabilities?.canEnableUnsupportedBlockEditor === true,
46
+ isEditableInUnsupportedBlockEditor: !UBE_INCOMPATIBLE_BLOCKS.includes(blockDetails.blockName),
47
+ ...blockDetails
48
+ };
49
+ }, [clientId]);
50
+ }
51
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useSelect","serialize","store","blockEditorStore","UBE_INCOMPATIBLE_BLOCKS","useUnsupportedBlockEditor","clientId","select","getBlock","getSettings","capabilities","block","blockAttributes","attributes","blockDetails","blockName","name","blockContent","originalName","content","originalContent","isUnsupportedBlockEditorSupported","unsupportedBlockEditor","canEnableUnsupportedBlockEditor","isEditableInUnsupportedBlockEditor","includes"],"sources":["@wordpress/block-editor/src/components/use-unsupported-block-editor/index.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { serialize } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n// Blocks that can't be edited through the Unsupported block editor identified by their name.\nconst UBE_INCOMPATIBLE_BLOCKS = [ 'core/block' ];\n\n/**\n * Hook that retrieves the settings to determine if the\n * Unsupported Block Editor can be used in a specific block.\n *\n * @param {string} clientId Client ID of block.\n * @return {Object} Unsupported block editor settings.\n */\nexport default function useUnsupportedBlockEditor( clientId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, getSettings } = select( blockEditorStore );\n\t\t\tconst { capabilities } = getSettings();\n\n\t\t\tconst block = getBlock( clientId );\n\t\t\tconst blockAttributes = block?.attributes || {};\n\n\t\t\tconst blockDetails = {\n\t\t\t\tblockName: block?.name,\n\t\t\t\tblockContent: serialize( block ? [ block ] : [] ),\n\t\t\t};\n\n\t\t\t// If the block is unsupported, use the `original` attributes to identify the block's name.\n\t\t\tif ( blockDetails.blockName === 'core/missing' ) {\n\t\t\t\tblockDetails.blockName = blockAttributes.originalName;\n\t\t\t\tblockDetails.blockContent =\n\t\t\t\t\tblockDetails.blockName === 'core/freeform'\n\t\t\t\t\t\t? blockAttributes.content\n\t\t\t\t\t\t: block?.originalContent;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tisUnsupportedBlockEditorSupported:\n\t\t\t\t\tcapabilities?.unsupportedBlockEditor === true,\n\t\t\t\tcanEnableUnsupportedBlockEditor:\n\t\t\t\t\tcapabilities?.canEnableUnsupportedBlockEditor === true,\n\t\t\t\tisEditableInUnsupportedBlockEditor:\n\t\t\t\t\t! UBE_INCOMPATIBLE_BLOCKS.includes(\n\t\t\t\t\t\tblockDetails.blockName\n\t\t\t\t\t),\n\t\t\t\t...blockDetails,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,SAAS,QAAQ,mBAAmB;;AAE7C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;;AAEvD;AACA,MAAMC,uBAAuB,GAAG,CAAE,YAAY,CAAE;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,yBAAyBA,CAAEC,QAAQ,EAAG;EAC7D,OAAON,SAAS,CACbO,MAAM,IAAM;IACb,MAAM;MAAEC,QAAQ;MAAEC;IAAY,CAAC,GAAGF,MAAM,CAAEJ,gBAAiB,CAAC;IAC5D,MAAM;MAAEO;IAAa,CAAC,GAAGD,WAAW,CAAC,CAAC;IAEtC,MAAME,KAAK,GAAGH,QAAQ,CAAEF,QAAS,CAAC;IAClC,MAAMM,eAAe,GAAGD,KAAK,EAAEE,UAAU,IAAI,CAAC,CAAC;IAE/C,MAAMC,YAAY,GAAG;MACpBC,SAAS,EAAEJ,KAAK,EAAEK,IAAI;MACtBC,YAAY,EAAEhB,SAAS,CAAEU,KAAK,GAAG,CAAEA,KAAK,CAAE,GAAG,EAAG;IACjD,CAAC;;IAED;IACA,IAAKG,YAAY,CAACC,SAAS,KAAK,cAAc,EAAG;MAChDD,YAAY,CAACC,SAAS,GAAGH,eAAe,CAACM,YAAY;MACrDJ,YAAY,CAACG,YAAY,GACxBH,YAAY,CAACC,SAAS,KAAK,eAAe,GACvCH,eAAe,CAACO,OAAO,GACvBR,KAAK,EAAES,eAAe;IAC3B;IAEA,OAAO;MACNC,iCAAiC,EAChCX,YAAY,EAAEY,sBAAsB,KAAK,IAAI;MAC9CC,+BAA+B,EAC9Bb,YAAY,EAAEa,+BAA+B,KAAK,IAAI;MACvDC,kCAAkC,EACjC,CAAEpB,uBAAuB,CAACqB,QAAQ,CACjCX,YAAY,CAACC,SACd,CAAC;MACF,GAAGD;IACJ,CAAC;EACF,CAAC,EACD,CAAER,QAAQ,CACX,CAAC;AACF"}
@@ -1,4 +1,4 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement } from "react";
2
2
  /**
3
3
  * WordPress dependencies
4
4
  */
@@ -1,4 +1,4 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement } from "react";
2
2
  /**
3
3
  * WordPress dependencies
4
4
  */
@@ -1,4 +1,4 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement } from "react";
2
2
  /**
3
3
  * External dependencies
4
4
  */
@@ -1,4 +1,4 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement } from "react";
2
2
  /**
3
3
  * External dependencies
4
4
  */
@@ -1,4 +1,4 @@
1
- import { createElement, Fragment } from "@wordpress/element";
1
+ import { createElement, Fragment } from "react";
2
2
  /**
3
3
  * External dependencies
4
4
  */
@@ -23,11 +23,12 @@ import useDragSelection from './use-drag-selection';
23
23
  import useSelectionObserver from './use-selection-observer';
24
24
  import useClickSelection from './use-click-selection';
25
25
  import useInput from './use-input';
26
+ import useClipboardHandler from './use-clipboard-handler';
26
27
  import { store as blockEditorStore } from '../../store';
27
28
  export function useWritingFlow() {
28
29
  const [before, ref, after] = useTabNav();
29
30
  const hasMultiSelection = useSelect(select => select(blockEditorStore).hasMultiSelection(), []);
30
- return [before, useMergeRefs([ref, useInput(), useDragSelection(), useSelectionObserver(), useClickSelection(), useMultiSelection(), useSelectAll(), useArrowNav(), useRefEffect(node => {
31
+ return [before, useMergeRefs([ref, useClipboardHandler(), useInput(), useDragSelection(), useSelectionObserver(), useClickSelection(), useMultiSelection(), useSelectAll(), useArrowNav(), useRefEffect(node => {
31
32
  node.tabIndex = 0;
32
33
  node.contentEditable = hasMultiSelection;
33
34
  if (!hasMultiSelection) {
@@ -57,8 +58,8 @@ function WritingFlow({
57
58
  * Handles selection and navigation across blocks. This component should be
58
59
  * wrapped around BlockList.
59
60
  *
60
- * @param {Object} props Component properties.
61
- * @param {WPElement} props.children Children to be rendered.
61
+ * @param {Object} props Component properties.
62
+ * @param {Element} props.children Children to be rendered.
62
63
  */
63
64
  export default forwardRef(WritingFlow);
64
65
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["classNames","useSelect","__","useMergeRefs","useRefEffect","forwardRef","useMultiSelection","useTabNav","useArrowNav","useSelectAll","useDragSelection","useSelectionObserver","useClickSelection","useInput","store","blockEditorStore","useWritingFlow","before","ref","after","hasMultiSelection","select","node","tabIndex","contentEditable","classList","add","setAttribute","remove","removeAttribute","WritingFlow","children","props","forwardedRef","createElement","Fragment","className"],"sources":["@wordpress/block-editor/src/components/writing-flow/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { useMergeRefs, useRefEffect } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useMultiSelection from './use-multi-selection';\nimport useTabNav from './use-tab-nav';\nimport useArrowNav from './use-arrow-nav';\nimport useSelectAll from './use-select-all';\nimport useDragSelection from './use-drag-selection';\nimport useSelectionObserver from './use-selection-observer';\nimport useClickSelection from './use-click-selection';\nimport useInput from './use-input';\nimport { store as blockEditorStore } from '../../store';\n\nexport function useWritingFlow() {\n\tconst [ before, ref, after ] = useTabNav();\n\tconst hasMultiSelection = useSelect(\n\t\t( select ) => select( blockEditorStore ).hasMultiSelection(),\n\t\t[]\n\t);\n\n\treturn [\n\t\tbefore,\n\t\tuseMergeRefs( [\n\t\t\tref,\n\t\t\tuseInput(),\n\t\t\tuseDragSelection(),\n\t\t\tuseSelectionObserver(),\n\t\t\tuseClickSelection(),\n\t\t\tuseMultiSelection(),\n\t\t\tuseSelectAll(),\n\t\t\tuseArrowNav(),\n\t\t\tuseRefEffect(\n\t\t\t\t( node ) => {\n\t\t\t\t\tnode.tabIndex = 0;\n\t\t\t\t\tnode.contentEditable = hasMultiSelection;\n\n\t\t\t\t\tif ( ! hasMultiSelection ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tnode.classList.add( 'has-multi-selection' );\n\t\t\t\t\tnode.setAttribute(\n\t\t\t\t\t\t'aria-label',\n\t\t\t\t\t\t__( 'Multiple selected blocks' )\n\t\t\t\t\t);\n\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\tnode.classList.remove( 'has-multi-selection' );\n\t\t\t\t\t\tnode.removeAttribute( 'aria-label' );\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\t[ hasMultiSelection ]\n\t\t\t),\n\t\t] ),\n\t\tafter,\n\t];\n}\n\nfunction WritingFlow( { children, ...props }, forwardedRef ) {\n\tconst [ before, ref, after ] = useWritingFlow();\n\treturn (\n\t\t<>\n\t\t\t{ before }\n\t\t\t<div\n\t\t\t\t{ ...props }\n\t\t\t\tref={ useMergeRefs( [ ref, forwardedRef ] ) }\n\t\t\t\tclassName={ classNames(\n\t\t\t\t\tprops.className,\n\t\t\t\t\t'block-editor-writing-flow'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t\t{ after }\n\t\t</>\n\t);\n}\n\n/**\n * Handles selection and navigation across blocks. This component should be\n * wrapped around BlockList.\n *\n * @param {Object} props Component properties.\n * @param {WPElement} props.children Children to be rendered.\n */\nexport default forwardRef( WritingFlow );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,EAAEC,YAAY,QAAQ,oBAAoB;AAC/D,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,OAAOC,iBAAiB,MAAM,uBAAuB;AACrD,OAAOC,SAAS,MAAM,eAAe;AACrC,OAAOC,WAAW,MAAM,iBAAiB;AACzC,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,OAAOC,oBAAoB,MAAM,0BAA0B;AAC3D,OAAOC,iBAAiB,MAAM,uBAAuB;AACrD,OAAOC,QAAQ,MAAM,aAAa;AAClC,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAEvD,OAAO,SAASC,cAAcA,CAAA,EAAG;EAChC,MAAM,CAAEC,MAAM,EAAEC,GAAG,EAAEC,KAAK,CAAE,GAAGZ,SAAS,CAAC,CAAC;EAC1C,MAAMa,iBAAiB,GAAGnB,SAAS,CAChCoB,MAAM,IAAMA,MAAM,CAAEN,gBAAiB,CAAC,CAACK,iBAAiB,CAAC,CAAC,EAC5D,EACD,CAAC;EAED,OAAO,CACNH,MAAM,E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,"names":["classNames","useSelect","__","useMergeRefs","useRefEffect","forwardRef","useMultiSelection","useTabNav","useArrowNav","useSelectAll","useDragSelection","useSelectionObserver","useClickSelection","useInput","useClipboardHandler","store","blockEditorStore","useWritingFlow","before","ref","after","hasMultiSelection","select","node","tabIndex","contentEditable","classList","add","setAttribute","remove","removeAttribute","WritingFlow","children","props","forwardedRef","createElement","Fragment","className"],"sources":["@wordpress/block-editor/src/components/writing-flow/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { useMergeRefs, useRefEffect } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useMultiSelection from './use-multi-selection';\nimport useTabNav from './use-tab-nav';\nimport useArrowNav from './use-arrow-nav';\nimport useSelectAll from './use-select-all';\nimport useDragSelection from './use-drag-selection';\nimport useSelectionObserver from './use-selection-observer';\nimport useClickSelection from './use-click-selection';\nimport useInput from './use-input';\nimport useClipboardHandler from './use-clipboard-handler';\nimport { store as blockEditorStore } from '../../store';\n\nexport function useWritingFlow() {\n\tconst [ before, ref, after ] = useTabNav();\n\tconst hasMultiSelection = useSelect(\n\t\t( select ) => select( blockEditorStore ).hasMultiSelection(),\n\t\t[]\n\t);\n\n\treturn [\n\t\tbefore,\n\t\tuseMergeRefs( [\n\t\t\tref,\n\t\t\tuseClipboardHandler(),\n\t\t\tuseInput(),\n\t\t\tuseDragSelection(),\n\t\t\tuseSelectionObserver(),\n\t\t\tuseClickSelection(),\n\t\t\tuseMultiSelection(),\n\t\t\tuseSelectAll(),\n\t\t\tuseArrowNav(),\n\t\t\tuseRefEffect(\n\t\t\t\t( node ) => {\n\t\t\t\t\tnode.tabIndex = 0;\n\t\t\t\t\tnode.contentEditable = hasMultiSelection;\n\n\t\t\t\t\tif ( ! hasMultiSelection ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tnode.classList.add( 'has-multi-selection' );\n\t\t\t\t\tnode.setAttribute(\n\t\t\t\t\t\t'aria-label',\n\t\t\t\t\t\t__( 'Multiple selected blocks' )\n\t\t\t\t\t);\n\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\tnode.classList.remove( 'has-multi-selection' );\n\t\t\t\t\t\tnode.removeAttribute( 'aria-label' );\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\t[ hasMultiSelection ]\n\t\t\t),\n\t\t] ),\n\t\tafter,\n\t];\n}\n\nfunction WritingFlow( { children, ...props }, forwardedRef ) {\n\tconst [ before, ref, after ] = useWritingFlow();\n\treturn (\n\t\t<>\n\t\t\t{ before }\n\t\t\t<div\n\t\t\t\t{ ...props }\n\t\t\t\tref={ useMergeRefs( [ ref, forwardedRef ] ) }\n\t\t\t\tclassName={ classNames(\n\t\t\t\t\tprops.className,\n\t\t\t\t\t'block-editor-writing-flow'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t\t{ after }\n\t\t</>\n\t);\n}\n\n/**\n * Handles selection and navigation across blocks. This component should be\n * wrapped around BlockList.\n *\n * @param {Object} props Component properties.\n * @param {Element} props.children Children to be rendered.\n */\nexport default forwardRef( WritingFlow );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,EAAEC,YAAY,QAAQ,oBAAoB;AAC/D,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,OAAOC,iBAAiB,MAAM,uBAAuB;AACrD,OAAOC,SAAS,MAAM,eAAe;AACrC,OAAOC,WAAW,MAAM,iBAAiB;AACzC,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,OAAOC,o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;EAAE,GAAGC;AAAM,CAAC,EAAEC,YAAY,EAAG;EAC5D,MAAM,CAAEhB,MAAM,EAAEC,GAAG,EAAEC,KAAK,CAAE,GAAGH,cAAc,CAAC,CAAC;EAC/C,OACCkB,aAAA,CAAAC,QAAA,QACGlB,MAAM,EACRiB,aAAA;IAAA,GACMF,KAAK;IACVd,GAAG,EAAGhB,YAAY,CAAE,CAAEgB,GAAG,EAAEe,YAAY,CAAG,CAAG;IAC7CG,SAAS,EAAGrC,UAAU,CACrBiC,KAAK,CAACI,SAAS,EACf,2BACD;EAAG,GAEDL,QACE,CAAC,EACJZ,KACD,CAAC;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAef,UAAU,CAAE0B,WAAY,CAAC"}
@@ -0,0 +1,172 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { serialize, pasteHandler, createBlock, findTransform, getBlockTransforms } from '@wordpress/blocks';
5
+ import { documentHasSelection, documentHasUncollapsedSelection, __unstableStripHTML as stripHTML } from '@wordpress/dom';
6
+ import { useDispatch, useSelect } from '@wordpress/data';
7
+ import { useRefEffect } from '@wordpress/compose';
8
+
9
+ /**
10
+ * Internal dependencies
11
+ */
12
+ import { getPasteEventData } from '../../utils/pasting';
13
+ import { store as blockEditorStore } from '../../store';
14
+ import { useNotifyCopy } from '../../utils/use-notify-copy';
15
+ export default function useClipboardHandler() {
16
+ const {
17
+ getBlocksByClientId,
18
+ getSelectedBlockClientIds,
19
+ hasMultiSelection,
20
+ getSettings,
21
+ __unstableIsFullySelected,
22
+ __unstableIsSelectionCollapsed,
23
+ __unstableIsSelectionMergeable,
24
+ __unstableGetSelectedBlocksWithPartialSelection,
25
+ canInsertBlockType
26
+ } = useSelect(blockEditorStore);
27
+ const {
28
+ flashBlock,
29
+ removeBlocks,
30
+ replaceBlocks,
31
+ __unstableDeleteSelection,
32
+ __unstableExpandSelection,
33
+ insertBlocks
34
+ } = useDispatch(blockEditorStore);
35
+ const notifyCopy = useNotifyCopy();
36
+ return useRefEffect(node => {
37
+ function handler(event) {
38
+ if (event.defaultPrevented) {
39
+ // This was likely already handled in rich-text/use-paste-handler.js.
40
+ return;
41
+ }
42
+ const selectedBlockClientIds = getSelectedBlockClientIds();
43
+ if (selectedBlockClientIds.length === 0) {
44
+ return;
45
+ }
46
+
47
+ // Always handle multiple selected blocks.
48
+ if (!hasMultiSelection()) {
49
+ const {
50
+ target
51
+ } = event;
52
+ const {
53
+ ownerDocument
54
+ } = target;
55
+ // If copying, only consider actual text selection as selection.
56
+ // Otherwise, any focus on an input field is considered.
57
+ const hasSelection = event.type === 'copy' || event.type === 'cut' ? documentHasUncollapsedSelection(ownerDocument) : documentHasSelection(ownerDocument);
58
+
59
+ // Let native copy behaviour take over in input fields.
60
+ if (hasSelection) {
61
+ return;
62
+ }
63
+ }
64
+ if (!node.contains(event.target.ownerDocument.activeElement)) {
65
+ return;
66
+ }
67
+ event.preventDefault();
68
+ const isSelectionMergeable = __unstableIsSelectionMergeable();
69
+ const shouldHandleWholeBlocks = __unstableIsSelectionCollapsed() || __unstableIsFullySelected();
70
+ const expandSelectionIsNeeded = !shouldHandleWholeBlocks && !isSelectionMergeable;
71
+ if (event.type === 'copy' || event.type === 'cut') {
72
+ if (selectedBlockClientIds.length === 1) {
73
+ flashBlock(selectedBlockClientIds[0]);
74
+ }
75
+ // If we have a partial selection that is not mergeable, just
76
+ // expand the selection to the whole blocks.
77
+ if (expandSelectionIsNeeded) {
78
+ __unstableExpandSelection();
79
+ } else {
80
+ notifyCopy(event.type, selectedBlockClientIds);
81
+ let blocks;
82
+ // Check if we have partial selection.
83
+ if (shouldHandleWholeBlocks) {
84
+ blocks = getBlocksByClientId(selectedBlockClientIds);
85
+ } else {
86
+ const [head, tail] = __unstableGetSelectedBlocksWithPartialSelection();
87
+ const inBetweenBlocks = getBlocksByClientId(selectedBlockClientIds.slice(1, selectedBlockClientIds.length - 1));
88
+ blocks = [head, ...inBetweenBlocks, tail];
89
+ }
90
+ const wrapperBlockName = event.clipboardData.getData('__unstableWrapperBlockName');
91
+ if (wrapperBlockName) {
92
+ blocks = createBlock(wrapperBlockName, JSON.parse(event.clipboardData.getData('__unstableWrapperBlockAttributes')), blocks);
93
+ }
94
+ const serialized = serialize(blocks);
95
+ event.clipboardData.setData('text/plain', toPlainText(serialized));
96
+ event.clipboardData.setData('text/html', serialized);
97
+ }
98
+ }
99
+ if (event.type === 'cut') {
100
+ // We need to also check if at the start we needed to
101
+ // expand the selection, as in this point we might have
102
+ // programmatically fully selected the blocks above.
103
+ if (shouldHandleWholeBlocks && !expandSelectionIsNeeded) {
104
+ removeBlocks(selectedBlockClientIds);
105
+ } else {
106
+ event.target.ownerDocument.activeElement.contentEditable = false;
107
+ __unstableDeleteSelection();
108
+ }
109
+ } else if (event.type === 'paste') {
110
+ const {
111
+ __experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML
112
+ } = getSettings();
113
+ const {
114
+ plainText,
115
+ html,
116
+ files
117
+ } = getPasteEventData(event);
118
+ let blocks = [];
119
+ if (files.length) {
120
+ const fromTransforms = getBlockTransforms('from');
121
+ blocks = files.reduce((accumulator, file) => {
122
+ const transformation = findTransform(fromTransforms, transform => transform.type === 'files' && transform.isMatch([file]));
123
+ if (transformation) {
124
+ accumulator.push(transformation.transform([file]));
125
+ }
126
+ return accumulator;
127
+ }, []).flat();
128
+ } else {
129
+ blocks = pasteHandler({
130
+ HTML: html,
131
+ plainText,
132
+ mode: 'BLOCKS',
133
+ canUserUseUnfilteredHTML
134
+ });
135
+ }
136
+ if (selectedBlockClientIds.length === 1) {
137
+ const [selectedBlockClientId] = selectedBlockClientIds;
138
+ if (blocks.every(block => canInsertBlockType(block.name, selectedBlockClientId))) {
139
+ insertBlocks(blocks, undefined, selectedBlockClientId);
140
+ return;
141
+ }
142
+ }
143
+ replaceBlocks(selectedBlockClientIds, blocks, blocks.length - 1, -1);
144
+ }
145
+ }
146
+ node.ownerDocument.addEventListener('copy', handler);
147
+ node.ownerDocument.addEventListener('cut', handler);
148
+ node.ownerDocument.addEventListener('paste', handler);
149
+ return () => {
150
+ node.ownerDocument.removeEventListener('copy', handler);
151
+ node.ownerDocument.removeEventListener('cut', handler);
152
+ node.ownerDocument.removeEventListener('paste', handler);
153
+ };
154
+ }, []);
155
+ }
156
+
157
+ /**
158
+ * Given a string of HTML representing serialized blocks, returns the plain
159
+ * text extracted after stripping the HTML of any tags and fixing line breaks.
160
+ *
161
+ * @param {string} html Serialized blocks.
162
+ * @return {string} The plain-text content with any html removed.
163
+ */
164
+ function toPlainText(html) {
165
+ // Manually handle BR tags as line breaks prior to `stripHTML` call
166
+ html = html.replace(/<br>/g, '\n');
167
+ const plainText = stripHTML(html).trim();
168
+
169
+ // Merge any consecutive line breaks
170
+ return plainText.replace(/\n\n+/g, '\n\n');
171
+ }
172
+ //# sourceMappingURL=use-clipboard-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["serialize","pasteHandler","createBlock","findTransform","getBlockTransforms","documentHasSelection","documentHasUncollapsedSelection","__unstableStripHTML","stripHTML","useDispatch","useSelect","useRefEffect","getPasteEventData","store","blockEditorStore","useNotifyCopy","useClipboardHandler","getBlocksByClientId","getSelectedBlockClientIds","hasMultiSelection","getSettings","__unstableIsFullySelected","__unstableIsSelectionCollapsed","__unstableIsSelectionMergeable","__unstableGetSelectedBlocksWithPartialSelection","canInsertBlockType","flashBlock","removeBlocks","replaceBlocks","__unstableDeleteSelection","__unstableExpandSelection","insertBlocks","notifyCopy","node","handler","event","defaultPrevented","selectedBlockClientIds","length","target","ownerDocument","hasSelection","type","contains","activeElement","preventDefault","isSelectionMergeable","shouldHandleWholeBlocks","expandSelectionIsNeeded","blocks","head","tail","inBetweenBlocks","slice","wrapperBlockName","clipboardData","getData","JSON","parse","serialized","setData","toPlainText","contentEditable","__experimentalCanUserUseUnfilteredHTML","canUserUseUnfilteredHTML","plainText","html","files","fromTransforms","reduce","accumulator","file","transformation","transform","isMatch","push","flat","HTML","mode","selectedBlockClientId","every","block","name","undefined","addEventListener","removeEventListener","replace","trim"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-clipboard-handler.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tserialize,\n\tpasteHandler,\n\tcreateBlock,\n\tfindTransform,\n\tgetBlockTransforms,\n} from '@wordpress/blocks';\nimport {\n\tdocumentHasSelection,\n\tdocumentHasUncollapsedSelection,\n\t__unstableStripHTML as stripHTML,\n} from '@wordpress/dom';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { getPasteEventData } from '../../utils/pasting';\nimport { store as blockEditorStore } from '../../store';\nimport { useNotifyCopy } from '../../utils/use-notify-copy';\n\nexport default function useClipboardHandler() {\n\tconst {\n\t\tgetBlocksByClientId,\n\t\tgetSelectedBlockClientIds,\n\t\thasMultiSelection,\n\t\tgetSettings,\n\t\t__unstableIsFullySelected,\n\t\t__unstableIsSelectionCollapsed,\n\t\t__unstableIsSelectionMergeable,\n\t\t__unstableGetSelectedBlocksWithPartialSelection,\n\t\tcanInsertBlockType,\n\t} = useSelect( blockEditorStore );\n\tconst {\n\t\tflashBlock,\n\t\tremoveBlocks,\n\t\treplaceBlocks,\n\t\t__unstableDeleteSelection,\n\t\t__unstableExpandSelection,\n\t\tinsertBlocks,\n\t} = useDispatch( blockEditorStore );\n\tconst notifyCopy = useNotifyCopy();\n\n\treturn useRefEffect( ( node ) => {\n\t\tfunction handler( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\t// This was likely already handled in rich-text/use-paste-handler.js.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\n\t\t\tif ( selectedBlockClientIds.length === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Always handle multiple selected blocks.\n\t\t\tif ( ! hasMultiSelection() ) {\n\t\t\t\tconst { target } = event;\n\t\t\t\tconst { ownerDocument } = target;\n\t\t\t\t// If copying, only consider actual text selection as selection.\n\t\t\t\t// Otherwise, any focus on an input field is considered.\n\t\t\t\tconst hasSelection =\n\t\t\t\t\tevent.type === 'copy' || event.type === 'cut'\n\t\t\t\t\t\t? documentHasUncollapsedSelection( ownerDocument )\n\t\t\t\t\t\t: documentHasSelection( ownerDocument );\n\n\t\t\t\t// Let native copy behaviour take over in input fields.\n\t\t\t\tif ( hasSelection ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( ! node.contains( event.target.ownerDocument.activeElement ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tevent.preventDefault();\n\n\t\t\tconst isSelectionMergeable = __unstableIsSelectionMergeable();\n\t\t\tconst shouldHandleWholeBlocks =\n\t\t\t\t__unstableIsSelectionCollapsed() || __unstableIsFullySelected();\n\t\t\tconst expandSelectionIsNeeded =\n\t\t\t\t! shouldHandleWholeBlocks && ! isSelectionMergeable;\n\t\t\tif ( event.type === 'copy' || event.type === 'cut' ) {\n\t\t\t\tif ( selectedBlockClientIds.length === 1 ) {\n\t\t\t\t\tflashBlock( selectedBlockClientIds[ 0 ] );\n\t\t\t\t}\n\t\t\t\t// If we have a partial selection that is not mergeable, just\n\t\t\t\t// expand the selection to the whole blocks.\n\t\t\t\tif ( expandSelectionIsNeeded ) {\n\t\t\t\t\t__unstableExpandSelection();\n\t\t\t\t} else {\n\t\t\t\t\tnotifyCopy( event.type, selectedBlockClientIds );\n\t\t\t\t\tlet blocks;\n\t\t\t\t\t// Check if we have partial selection.\n\t\t\t\t\tif ( shouldHandleWholeBlocks ) {\n\t\t\t\t\t\tblocks = getBlocksByClientId( selectedBlockClientIds );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst [ head, tail ] =\n\t\t\t\t\t\t\t__unstableGetSelectedBlocksWithPartialSelection();\n\t\t\t\t\t\tconst inBetweenBlocks = getBlocksByClientId(\n\t\t\t\t\t\t\tselectedBlockClientIds.slice(\n\t\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\t\tselectedBlockClientIds.length - 1\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t\tblocks = [ head, ...inBetweenBlocks, tail ];\n\t\t\t\t\t}\n\n\t\t\t\t\tconst wrapperBlockName = event.clipboardData.getData(\n\t\t\t\t\t\t'__unstableWrapperBlockName'\n\t\t\t\t\t);\n\n\t\t\t\t\tif ( wrapperBlockName ) {\n\t\t\t\t\t\tblocks = createBlock(\n\t\t\t\t\t\t\twrapperBlockName,\n\t\t\t\t\t\t\tJSON.parse(\n\t\t\t\t\t\t\t\tevent.clipboardData.getData(\n\t\t\t\t\t\t\t\t\t'__unstableWrapperBlockAttributes'\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tblocks\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst serialized = serialize( blocks );\n\n\t\t\t\t\tevent.clipboardData.setData(\n\t\t\t\t\t\t'text/plain',\n\t\t\t\t\t\ttoPlainText( serialized )\n\t\t\t\t\t);\n\t\t\t\t\tevent.clipboardData.setData( 'text/html', serialized );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( event.type === 'cut' ) {\n\t\t\t\t// We need to also check if at the start we needed to\n\t\t\t\t// expand the selection, as in this point we might have\n\t\t\t\t// programmatically fully selected the blocks above.\n\t\t\t\tif ( shouldHandleWholeBlocks && ! expandSelectionIsNeeded ) {\n\t\t\t\t\tremoveBlocks( selectedBlockClientIds );\n\t\t\t\t} else {\n\t\t\t\t\tevent.target.ownerDocument.activeElement.contentEditable = false;\n\t\t\t\t\t__unstableDeleteSelection();\n\t\t\t\t}\n\t\t\t} else if ( event.type === 'paste' ) {\n\t\t\t\tconst {\n\t\t\t\t\t__experimentalCanUserUseUnfilteredHTML:\n\t\t\t\t\t\tcanUserUseUnfilteredHTML,\n\t\t\t\t} = getSettings();\n\t\t\t\tconst { plainText, html, files } = getPasteEventData( event );\n\t\t\t\tlet blocks = [];\n\n\t\t\t\tif ( files.length ) {\n\t\t\t\t\tconst fromTransforms = getBlockTransforms( 'from' );\n\t\t\t\t\tblocks = files\n\t\t\t\t\t\t.reduce( ( accumulator, file ) => {\n\t\t\t\t\t\t\tconst transformation = findTransform(\n\t\t\t\t\t\t\t\tfromTransforms,\n\t\t\t\t\t\t\t\t( transform ) =>\n\t\t\t\t\t\t\t\t\ttransform.type === 'files' &&\n\t\t\t\t\t\t\t\t\ttransform.isMatch( [ file ] )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif ( transformation ) {\n\t\t\t\t\t\t\t\taccumulator.push(\n\t\t\t\t\t\t\t\t\ttransformation.transform( [ file ] )\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t\t}, [] )\n\t\t\t\t\t\t.flat();\n\t\t\t\t} else {\n\t\t\t\t\tblocks = pasteHandler( {\n\t\t\t\t\t\tHTML: html,\n\t\t\t\t\t\tplainText,\n\t\t\t\t\t\tmode: 'BLOCKS',\n\t\t\t\t\t\tcanUserUseUnfilteredHTML,\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\tif ( selectedBlockClientIds.length === 1 ) {\n\t\t\t\t\tconst [ selectedBlockClientId ] = selectedBlockClientIds;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tblocks.every( ( block ) =>\n\t\t\t\t\t\t\tcanInsertBlockType(\n\t\t\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\t\t\tselectedBlockClientId\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\tinsertBlocks(\n\t\t\t\t\t\t\tblocks,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tselectedBlockClientId\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treplaceBlocks(\n\t\t\t\t\tselectedBlockClientIds,\n\t\t\t\t\tblocks,\n\t\t\t\t\tblocks.length - 1,\n\t\t\t\t\t-1\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tnode.ownerDocument.addEventListener( 'copy', handler );\n\t\tnode.ownerDocument.addEventListener( 'cut', handler );\n\t\tnode.ownerDocument.addEventListener( 'paste', handler );\n\n\t\treturn () => {\n\t\t\tnode.ownerDocument.removeEventListener( 'copy', handler );\n\t\t\tnode.ownerDocument.removeEventListener( 'cut', handler );\n\t\t\tnode.ownerDocument.removeEventListener( 'paste', handler );\n\t\t};\n\t}, [] );\n}\n\n/**\n * Given a string of HTML representing serialized blocks, returns the plain\n * text extracted after stripping the HTML of any tags and fixing line breaks.\n *\n * @param {string} html Serialized blocks.\n * @return {string} The plain-text content with any html removed.\n */\nfunction toPlainText( html ) {\n\t// Manually handle BR tags as line breaks prior to `stripHTML` call\n\thtml = html.replace( /<br>/g, '\\n' );\n\n\tconst plainText = stripHTML( html ).trim();\n\n\t// Merge any consecutive line breaks\n\treturn plainText.replace( /\\n\\n+/g, '\\n\\n' );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,SAAS,EACTC,YAAY,EACZC,WAAW,EACXC,aAAa,EACbC,kBAAkB,QACZ,mBAAmB;AAC1B,SACCC,oBAAoB,EACpBC,+BAA+B,EAC/BC,mBAAmB,IAAIC,SAAS,QAC1B,gBAAgB;AACvB,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,oBAAoB;;AAEjD;AACA;AACA;AACA,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,aAAa,QAAQ,6BAA6B;AAE3D,eAAe,SAASC,mBAAmBA,CAAA,EAAG;EAC7C,MAAM;IACLC,mBAAmB;IACnBC,yBAAyB;IACzBC,iBAAiB;IACjBC,WAAW;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AAO,CAAC;AAC7C"}
@@ -1,4 +1,4 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement } from "react";
2
2
  /**
3
3
  * WordPress dependencies
4
4
  */
@@ -1,4 +1,4 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement } from "react";
2
2
  /**
3
3
  * External dependencies
4
4
  */
@@ -28,7 +28,7 @@ const WRITING_MODES = [{
28
28
  * @param {string} props.value Currently selected writing mode.
29
29
  * @param {Function} props.onChange Handles change in the writing mode selection.
30
30
  *
31
- * @return {WPElement} Writing Mode control.
31
+ * @return {Element} Writing Mode control.
32
32
  */
33
33
  export default function WritingModeControl({
34
34
  className,
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","BaseControl","Button","__","isRTL","textHorizontal","textVertical","WRITING_MODES","name","value","icon","WritingModeControl","className","onChange","createElement","VisualLabel","as","map","writingMode","key","label","isPressed","onClick","undefined"],"sources":["@wordpress/block-editor/src/components/writing-mode-control/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, isRTL } from '@wordpress/i18n';\nimport { textHorizontal, textVertical } from '@wordpress/icons';\n\nconst WRITING_MODES = [\n\t{\n\t\tname: __( 'Horizontal' ),\n\t\tvalue: 'horizontal-tb',\n\t\ticon: textHorizontal,\n\t},\n\t{\n\t\tname: __( 'Vertical' ),\n\t\tvalue: isRTL() ? 'vertical-lr' : 'vertical-rl',\n\t\ticon: textVertical,\n\t},\n];\n\n/**\n * Control to facilitate writing mode selections.\n *\n * @param {Object} props Component props.\n * @param {string} props.className Class name to add to the control.\n * @param {string} props.value Currently selected writing mode.\n * @param {Function} props.onChange Handles change in the writing mode selection.\n *\n * @return {WPElement} Writing Mode control.\n */\nexport default function WritingModeControl( { className, value, onChange } ) {\n\treturn (\n\t\t<fieldset\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-writing-mode-control',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t{ __( 'Orientation' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<div className=\"block-editor-writing-mode-control__buttons\">\n\t\t\t\t{ WRITING_MODES.map( ( writingMode ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey={ writingMode.value }\n\t\t\t\t\t\t\ticon={ writingMode.icon }\n\t\t\t\t\t\t\tlabel={ writingMode.name }\n\t\t\t\t\t\t\tisPressed={ writingMode.value === value }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\twritingMode.value === value\n\t\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t\t: writingMode.value\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);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t</fieldset>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,WAAW,EAAEC,MAAM,QAAQ,uBAAuB;AAC3D,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,cAAc,EAAEC,YAAY,QAAQ,kBAAkB;AAE/D,MAAMC,aAAa,GAAG,CACrB;EACCC,IAAI,EAAEL,EAAE,CAAE,YAAa,CAAC;EACxBM,KAAK,EAAE,eAAe;EACtBC,IAAI,EAAEL;AACP,CAAC,EACD;EACCG,IAAI,EAAEL,EAAE,CAAE,UAAW,CAAC;EACtBM,KAAK,EAAEL,KAAK,CAAC,CAAC,GAAG,aAAa,GAAG,aAAa;EAC9CM,IAAI,EAAEJ;AACP,CAAC,CACD;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASK,kBAAkBA,CAAE;EAAEC,SAAS;EAAEH,KAAK;EAAEI;AAAS,CAAC,EAAG;EAC5E,OACCC,aAAA;IACCF,SAAS,EAAGZ,UAAU,CACrB,mCAAmC,EACnCY,SACD;EAAG,GAEHE,aAAA,CAACb,WAAW,CAACc,WAAW;IAACC,EAAE,EAAC;EAAQ,GACjCb,EAAE,CAAE,aAAc,CACI,CAAC,EAC1BW,aAAA;IAAKF,SAAS,EAAC;EAA4C,GACxDL,aAAa,CAACU,GAAG,CAAIC,WAAW,IAAM;IACvC,OACCJ,aAAA,CAACZ,MAAM;MACNiB,GAAG,EAAGD,WAAW,CAACT,KAAO;MACzBC,IAAI,EAAGQ,WAAW,CAACR,IAAM;MACzBU,KAAK,EAAGF,WAAW,CAACV,IAAM;MAC1Ba,SAAS,EAAGH,WAAW,CAACT,KAAK,KAAKA,KAAO;MACzCa,OAAO,EAAGA,CAAA,KAAM;QACfT,QAAQ,CACPK,WAAW,CAACT,KAAK,KAAKA,KAAK,GACxBc,SAAS,GACTL,WAAW,CAACT,KAChB,CAAC;MACF;IAAG,CACH,CAAC;EAEJ,CAAE,CACE,CACI,CAAC;AAEb"}
1
+ {"version":3,"names":["classnames","BaseControl","Button","__","isRTL","textHorizontal","textVertical","WRITING_MODES","name","value","icon","WritingModeControl","className","onChange","createElement","VisualLabel","as","map","writingMode","key","label","isPressed","onClick","undefined"],"sources":["@wordpress/block-editor/src/components/writing-mode-control/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, isRTL } from '@wordpress/i18n';\nimport { textHorizontal, textVertical } from '@wordpress/icons';\n\nconst WRITING_MODES = [\n\t{\n\t\tname: __( 'Horizontal' ),\n\t\tvalue: 'horizontal-tb',\n\t\ticon: textHorizontal,\n\t},\n\t{\n\t\tname: __( 'Vertical' ),\n\t\tvalue: isRTL() ? 'vertical-lr' : 'vertical-rl',\n\t\ticon: textVertical,\n\t},\n];\n\n/**\n * Control to facilitate writing mode selections.\n *\n * @param {Object} props Component props.\n * @param {string} props.className Class name to add to the control.\n * @param {string} props.value Currently selected writing mode.\n * @param {Function} props.onChange Handles change in the writing mode selection.\n *\n * @return {Element} Writing Mode control.\n */\nexport default function WritingModeControl( { className, value, onChange } ) {\n\treturn (\n\t\t<fieldset\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-writing-mode-control',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t{ __( 'Orientation' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<div className=\"block-editor-writing-mode-control__buttons\">\n\t\t\t\t{ WRITING_MODES.map( ( writingMode ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey={ writingMode.value }\n\t\t\t\t\t\t\ticon={ writingMode.icon }\n\t\t\t\t\t\t\tlabel={ writingMode.name }\n\t\t\t\t\t\t\tisPressed={ writingMode.value === value }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\twritingMode.value === value\n\t\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t\t: writingMode.value\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);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t</fieldset>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,WAAW,EAAEC,MAAM,QAAQ,uBAAuB;AAC3D,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,cAAc,EAAEC,YAAY,QAAQ,kBAAkB;AAE/D,MAAMC,aAAa,GAAG,CACrB;EACCC,IAAI,EAAEL,EAAE,CAAE,YAAa,CAAC;EACxBM,KAAK,EAAE,eAAe;EACtBC,IAAI,EAAEL;AACP,CAAC,EACD;EACCG,IAAI,EAAEL,EAAE,CAAE,UAAW,CAAC;EACtBM,KAAK,EAAEL,KAAK,CAAC,CAAC,GAAG,aAAa,GAAG,aAAa;EAC9CM,IAAI,EAAEJ;AACP,CAAC,CACD;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASK,kBAAkBA,CAAE;EAAEC,SAAS;EAAEH,KAAK;EAAEI;AAAS,CAAC,EAAG;EAC5E,OACCC,aAAA;IACCF,SAAS,EAAGZ,UAAU,CACrB,mCAAmC,EACnCY,SACD;EAAG,GAEHE,aAAA,CAACb,WAAW,CAACc,WAAW;IAACC,EAAE,EAAC;EAAQ,GACjCb,EAAE,CAAE,aAAc,CACI,CAAC,EAC1BW,aAAA;IAAKF,SAAS,EAAC;EAA4C,GACxDL,aAAa,CAACU,GAAG,CAAIC,WAAW,IAAM;IACvC,OACCJ,aAAA,CAACZ,MAAM;MACNiB,GAAG,EAAGD,WAAW,CAACT,KAAO;MACzBC,IAAI,EAAGQ,WAAW,CAACR,IAAM;MACzBU,KAAK,EAAGF,WAAW,CAACV,IAAM;MAC1Ba,SAAS,EAAGH,WAAW,CAACT,KAAK,KAAKA,KAAO;MACzCa,OAAO,EAAGA,CAAA,KAAM;QACfT,QAAQ,CACPK,WAAW,CAACT,KAAK,KAAKA,KAAK,GACxBc,SAAS,GACTL,WAAW,CAACT,KAChB,CAAC;MACF;IAAG,CACH,CAAC;EAEJ,CAAE,CACE,CACI,CAAC;AAEb"}
@@ -1,4 +1,4 @@
1
- import { createElement, Fragment } from "@wordpress/element";
1
+ import { createElement, Fragment } from "react";
2
2
  /**
3
3
  * External dependencies
4
4
  */
@@ -1,4 +1,4 @@
1
- import { createElement, Fragment } from "@wordpress/element";
1
+ import { createElement, Fragment } from "react";
2
2
  /**
3
3
  * WordPress dependencies
4
4
  */
@@ -56,9 +56,9 @@ export function addAttribute(settings) {
56
56
  * Override the default edit UI to include a new block inspector control for
57
57
  * assigning the anchor ID, if block supports anchor.
58
58
  *
59
- * @param {WPComponent} BlockEdit Original component.
59
+ * @param {Component} BlockEdit Original component.
60
60
  *
61
- * @return {WPComponent} Wrapped component.
61
+ * @return {Component} Wrapped component.
62
62
  */
63
63
  export const withInspectorControl = createHigherOrderComponent(BlockEdit => {
64
64
  return props => {
@@ -1 +1 @@
1
- {"version":3,"names":["addFilter","PanelBody","TextControl","ExternalLink","__","hasBlockSupport","createHigherOrderComponent","Platform","InspectorControls","useBlockEditingMode","ANCHOR_REGEX","ANCHOR_SCHEMA","type","source","attribute","selector","addAttribute","settings","_settings$attributes$","attributes","anchor","withInspectorControl","BlockEdit","props","hasAnchor","name","blockEditingMode","isSelected","isWeb","OS","textControl","createElement","__nextHasNoMarginBottom","className","label","help","Fragment","href","value","placeholder","onChange","nextValue","replace","setAttributes","autoCapitalize","autoComplete","group","title","addSaveProps","extraProps","blockType","id"],"sources":["@wordpress/block-editor/src/hooks/anchor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { PanelBody, TextControl, ExternalLink } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { InspectorControls } from '../components';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\n/**\n * Regular expression matching invalid anchor characters for replacement.\n *\n * @type {RegExp}\n */\nconst ANCHOR_REGEX = /[\\s#]/g;\n\nconst ANCHOR_SCHEMA = {\n\ttype: 'string',\n\tsource: 'attribute',\n\tattribute: 'id',\n\tselector: '*',\n};\n\n/**\n * Filters registered block settings, extending attributes with anchor using ID\n * of the first node.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( 'type' in ( settings.attributes?.anchor ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'anchor' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tanchor: ANCHOR_SCHEMA,\n\t\t};\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include a new block inspector control for\n * assigning the anchor ID, if block supports anchor.\n *\n * @param {WPComponent} BlockEdit Original component.\n *\n * @return {WPComponent} Wrapped component.\n */\nexport const withInspectorControl = createHigherOrderComponent(\n\t( BlockEdit ) => {\n\t\treturn ( props ) => {\n\t\t\tconst hasAnchor = hasBlockSupport( props.name, 'anchor' );\n\t\t\tconst blockEditingMode = useBlockEditingMode();\n\n\t\t\tif ( hasAnchor && props.isSelected ) {\n\t\t\t\tconst isWeb = Platform.OS === 'web';\n\t\t\t\tconst textControl = (\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tclassName=\"html-anchor-control\"\n\t\t\t\t\t\tlabel={ __( 'HTML anchor' ) }\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.'\n\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t{ isWeb && (\n\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-jumps/'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Learn more about anchors' ) }\n\t\t\t\t\t\t\t\t\t</ExternalLink>\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\tvalue={ props.attributes.anchor || '' }\n\t\t\t\t\t\tplaceholder={ ! isWeb ? __( 'Add an anchor' ) : null }\n\t\t\t\t\t\tonChange={ ( nextValue ) => {\n\t\t\t\t\t\t\tnextValue = nextValue.replace( ANCHOR_REGEX, '-' );\n\t\t\t\t\t\t\tprops.setAttributes( {\n\t\t\t\t\t\t\t\tanchor: nextValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tautoCapitalize=\"none\"\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t\t\t{ isWeb && blockEditingMode === 'default' && (\n\t\t\t\t\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t\t\t\t\t{ textControl }\n\t\t\t\t\t\t\t</InspectorControls>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ /*\n\t\t\t\t\t\t * We plan to remove scoping anchors to 'core/heading' to support\n\t\t\t\t\t\t * anchors for all eligble blocks. Additionally we plan to explore\n\t\t\t\t\t\t * leveraging InspectorAdvancedControls instead of a custom\n\t\t\t\t\t\t * PanelBody title. https://github.com/WordPress/gutenberg/issues/28363\n\t\t\t\t\t\t */ }\n\t\t\t\t\t\t{ ! isWeb && props.name === 'core/heading' && (\n\t\t\t\t\t\t\t<InspectorControls>\n\t\t\t\t\t\t\t\t<PanelBody title={ __( 'Heading settings' ) }>\n\t\t\t\t\t\t\t\t\t{ textControl }\n\t\t\t\t\t\t\t\t</PanelBody>\n\t\t\t\t\t\t\t</InspectorControls>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn <BlockEdit { ...props } />;\n\t\t};\n\t},\n\t'withInspectorControl'\n);\n\n/**\n * Override props assigned to save component to inject anchor ID, if block\n * supports anchor. This is only applied if the block's save result is an\n * element and not a markup string.\n *\n * @param {Object} extraProps Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Current block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( extraProps, blockType, attributes ) {\n\tif ( hasBlockSupport( blockType, 'anchor' ) ) {\n\t\textraProps.id = attributes.anchor === '' ? null : attributes.anchor;\n\t}\n\n\treturn extraProps;\n}\n\naddFilter( 'blocks.registerBlockType', 'core/anchor/attribute', addAttribute );\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/anchor/with-inspector-control',\n\twithInspectorControl\n);\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/anchor/save-props',\n\taddSaveProps\n);\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,SAAS,EAAEC,WAAW,EAAEC,YAAY,QAAQ,uBAAuB;AAC5E,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,0BAA0B,QAAQ,oBAAoB;AAC/D,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,SAASC,iBAAiB,QAAQ,eAAe;AACjD,SAASC,mBAAmB,QAAQ,kCAAkC;;AAEtE;AACA;AACA;AACA;AACA;AACA,MAAMC,YAAY,GAAG,QAAQ;AAE7B,MAAMC,aAAa,GAAG;EACrBC,IAAI,EAAE,QAAQ;EACdC,MAAM,EAAE,WAAW;EACnBC,SAAS,EAAE,IAAI;EACfC,QAAQ,EAAE;AACX,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAEC,QAAQ,EAAG;EAAA,IAAAC,qBAAA;EACxC;EACA,IAAK,MAAM,MAAAA,qBAAA,GAAMD,QAAQ,CAACE,UAAU,EAAEC,MAAM,cAAAF,qBAAA,cAAAA,qBAAA,GAAI,CAAC,CAA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M,EAAEqB;UACT,CAAE,CAAC;QACJ,CAAG;QACHG,cAAc,EAAC,MAAM;QACrBC,YAAY,EAAC;MAAK,CAClB,CACD;MAED,OACCd,aAAA,CAAAK,QAAA,QACCL,aAAA,CAACT,SAAS;QAAA,GAAMC;MAAK,CAAI,CAAC,EACxBK,KAAK,IAAIF,gBAAgB,KAAK,SAAS,IACxCK,aAAA,CAACvB,iBAAiB;QAACsC,KAAK,EAAC;MAAU,GAChChB,WACgB,CACnB,EAOC,CAAEF,KAAK,IAAIL,KAAK,CAACE,IAAI,KAAK,cAAc,IACzCM,aAAA,CAACvB,iBAAiB,QACjBuB,aAAA,CAAC9B,SAAS;QAAC8C,KAAK,EAAG3C,EAAE,CAAE,kBAAmB;MAAG,GAC1C0B,WACQ,CACO,CAEnB,CAAC;IAEL;IAEA,OAAOC,aAAA,CAACT,SAAS;MAAA,GAAMC;IAAK,CAAI,CAAC;EAClC,CAAC;AACF,CAAC,EACD,sBACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASyB,YAAYA,CAAEC,UAAU,EAAEC,SAAS,EAAE/B,UAAU,EAAG;EACjE,IAAKd,eAAe,CAAE6C,SAAS,EAAE,QAAS,CAAC,EAAG;IAC7CD,UAAU,CAACE,EAAE,GAAGhC,UAAU,CAACC,MAAM,KAAK,EAAE,GAAG,IAAI,GAAGD,UAAU,CAACC,MAAM;EACpE;EAEA,OAAO6B,UAAU;AAClB;AAEAjD,SAAS,CAAE,0BAA0B,EAAE,uBAAuB,EAAEgB,YAAa,CAAC;AAC9EhB,SAAS,CACR,kBAAkB,EAClB,2CAA2C,EAC3CqB,oBACD,CAAC;AACDrB,SAAS,CACR,kCAAkC,EAClC,wBAAwB,EACxBgD,YACD,CAAC"}
1
+ {"version":3,"names":["addFilter","PanelBody","TextControl","ExternalLink","__","hasBlockSupport","createHigherOrderComponent","Platform","InspectorControls","useBlockEditingMode","ANCHOR_REGEX","ANCHOR_SCHEMA","type","source","attribute","selector","addAttribute","settings","_settings$attributes$","attributes","anchor","withInspectorControl","BlockEdit","props","hasAnchor","name","blockEditingMode","isSelected","isWeb","OS","textControl","createElement","__nextHasNoMarginBottom","className","label","help","Fragment","href","value","placeholder","onChange","nextValue","replace","setAttributes","autoCapitalize","autoComplete","group","title","addSaveProps","extraProps","blockType","id"],"sources":["@wordpress/block-editor/src/hooks/anchor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { PanelBody, TextControl, ExternalLink } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { InspectorControls } from '../components';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\n/**\n * Regular expression matching invalid anchor characters for replacement.\n *\n * @type {RegExp}\n */\nconst ANCHOR_REGEX = /[\\s#]/g;\n\nconst ANCHOR_SCHEMA = {\n\ttype: 'string',\n\tsource: 'attribute',\n\tattribute: 'id',\n\tselector: '*',\n};\n\n/**\n * Filters registered block settings, extending attributes with anchor using ID\n * of the first node.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( 'type' in ( settings.attributes?.anchor ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'anchor' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tanchor: ANCHOR_SCHEMA,\n\t\t};\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include a new block inspector control for\n * assigning the anchor ID, if block supports anchor.\n *\n * @param {Component} BlockEdit Original component.\n *\n * @return {Component} Wrapped component.\n */\nexport const withInspectorControl = createHigherOrderComponent(\n\t( BlockEdit ) => {\n\t\treturn ( props ) => {\n\t\t\tconst hasAnchor = hasBlockSupport( props.name, 'anchor' );\n\t\t\tconst blockEditingMode = useBlockEditingMode();\n\n\t\t\tif ( hasAnchor && props.isSelected ) {\n\t\t\t\tconst isWeb = Platform.OS === 'web';\n\t\t\t\tconst textControl = (\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tclassName=\"html-anchor-control\"\n\t\t\t\t\t\tlabel={ __( 'HTML anchor' ) }\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.'\n\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t{ isWeb && (\n\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-jumps/'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Learn more about anchors' ) }\n\t\t\t\t\t\t\t\t\t</ExternalLink>\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\tvalue={ props.attributes.anchor || '' }\n\t\t\t\t\t\tplaceholder={ ! isWeb ? __( 'Add an anchor' ) : null }\n\t\t\t\t\t\tonChange={ ( nextValue ) => {\n\t\t\t\t\t\t\tnextValue = nextValue.replace( ANCHOR_REGEX, '-' );\n\t\t\t\t\t\t\tprops.setAttributes( {\n\t\t\t\t\t\t\t\tanchor: nextValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tautoCapitalize=\"none\"\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t\t\t{ isWeb && blockEditingMode === 'default' && (\n\t\t\t\t\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t\t\t\t\t{ textControl }\n\t\t\t\t\t\t\t</InspectorControls>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ /*\n\t\t\t\t\t\t * We plan to remove scoping anchors to 'core/heading' to support\n\t\t\t\t\t\t * anchors for all eligble blocks. Additionally we plan to explore\n\t\t\t\t\t\t * leveraging InspectorAdvancedControls instead of a custom\n\t\t\t\t\t\t * PanelBody title. https://github.com/WordPress/gutenberg/issues/28363\n\t\t\t\t\t\t */ }\n\t\t\t\t\t\t{ ! isWeb && props.name === 'core/heading' && (\n\t\t\t\t\t\t\t<InspectorControls>\n\t\t\t\t\t\t\t\t<PanelBody title={ __( 'Heading settings' ) }>\n\t\t\t\t\t\t\t\t\t{ textControl }\n\t\t\t\t\t\t\t\t</PanelBody>\n\t\t\t\t\t\t\t</InspectorControls>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn <BlockEdit { ...props } />;\n\t\t};\n\t},\n\t'withInspectorControl'\n);\n\n/**\n * Override props assigned to save component to inject anchor ID, if block\n * supports anchor. This is only applied if the block's save result is an\n * element and not a markup string.\n *\n * @param {Object} extraProps Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Current block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( extraProps, blockType, attributes ) {\n\tif ( hasBlockSupport( blockType, 'anchor' ) ) {\n\t\textraProps.id = attributes.anchor === '' ? null : attributes.anchor;\n\t}\n\n\treturn extraProps;\n}\n\naddFilter( 'blocks.registerBlockType', 'core/anchor/attribute', addAttribute );\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/anchor/with-inspector-control',\n\twithInspectorControl\n);\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/anchor/save-props',\n\taddSaveProps\n);\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,SAAS,EAAEC,WAAW,EAAEC,YAAY,QAAQ,uBAAuB;AAC5E,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,0BAA0B,QAAQ,oBAAoB;AAC/D,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,SAASC,iBAAiB,QAAQ,eAAe;AACjD,SAASC,mBAAmB,QAAQ,kCAAkC;;AAEtE;AACA;AACA;AACA;AACA;AACA,MAAMC,YAAY,GAAG,QAAQ;AAE7B,MAAMC,aAAa,GAAG;EACrBC,IAAI,EAAE,QAAQ;EACdC,MAAM,EAAE,WAAW;EACnBC,SAAS,EAAE,IAAI;EACfC,QAAQ,EAAE;AACX,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAEC,QAAQ,EAAG;EAAA,IAAAC,qBAAA;EACxC;EACA,IAAK,MAAM,MAAAA,qBAAA,GAAMD,QAAQ,CAACE,UAAU,EAAEC,MAAM,cAAAF,qBAAA,cAAAA,qBAAA,GAAI,CAAC,CAAC,CAAE,EAAG;IACtD,OAAOD,QAAQ;EAChB;EACA,IAAKZ,eAAe,CAAEY,QAAQ,EAAE,QAAS,CAAC,EAAG;IAC5C;IACAA,QAAQ,CAACE,UAAU,GAAG;MACrB,GAAGF,QAAQ,CAACE,UAAU;MACtBC,MAAM,EAAET;IACT,CAAC;EACF;EAEA,OAAOM,QAAQ;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,oBAAoB,GAAGf,0BAA0B,CAC3DgB,SAAS,IAAM;EAChB,OAASC,KAAK,IAAM;IACnB,MAAMC,SAAS,GAAGnB,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jBuB,aAAA,CAAC9B,SAAS;QAAC8C,KAAK,EAAG3C,EAAE,CAAE,kBAAmB;MAAG,GAC1C0B,WACQ,CACO,CAEnB,CAAC;IAEL;IAEA,OAAOC,aAAA,CAACT,SAAS;MAAA,GAAMC;IAAK,CAAI,CAAC;EAClC,CAAC;AACF,CAAC,EACD,sBACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASyB,YAAYA,CAAEC,UAAU,EAAEC,SAAS,EAAE/B,UAAU,EAAG;EACjE,IAAKd,eAAe,CAAE6C,SAAS,EAAE,QAAS,CAAC,EAAG;IAC7CD,UAAU,CAACE,EAAE,GAAGhC,UAAU,CAACC,MAAM,KAAK,EAAE,GAAG,IAAI,GAAGD,UAAU,CAACC,MAAM;EACpE;EAEA,OAAO6B,UAAU;AAClB;AAEAjD,SAAS,CAAE,0BAA0B,EAAE,uBAAuB,EAAEgB,YAAa,CAAC;AAC9EhB,SAAS,CACR,kBAAkB,EAClB,2CAA2C,EAC3CqB,oBACD,CAAC;AACDrB,SAAS,CACR,kCAAkC,EAClC,wBAAwB,EACxBgD,YACD,CAAC"}
@@ -1,4 +1,4 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement } from "react";
2
2
  /**
3
3
  * External dependencies
4
4
  */
@@ -1,4 +1,4 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement } from "react";
2
2
  /**
3
3
  * WordPress dependencies
4
4
  */
@@ -1,4 +1,4 @@
1
- import { createElement, Fragment } from "@wordpress/element";
1
+ import { createElement, Fragment } from "react";
2
2
  /**
3
3
  * WordPress dependencies
4
4
  */
@@ -1,4 +1,4 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement } from "react";
2
2
  /**
3
3
  * External dependencies
4
4
  */
@@ -1,4 +1,4 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement } from "react";
2
2
  /**
3
3
  * External dependencies
4
4
  */
@@ -1,4 +1,4 @@
1
- import { createElement, Fragment } from "@wordpress/element";
1
+ import { createElement, Fragment } from "react";
2
2
  /**
3
3
  * WordPress dependencies
4
4
  */
@@ -1,4 +1,4 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement } from "react";
2
2
  /**
3
3
  * WordPress dependencies
4
4
  */