@wordpress/block-editor 12.18.2 → 12.19.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 (870) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/autocompleters/block.js +1 -2
  3. package/build/autocompleters/block.js.map +1 -1
  4. package/build/autocompleters/link.js +1 -2
  5. package/build/autocompleters/link.js.map +1 -1
  6. package/build/components/alignment-control/ui.js +1 -2
  7. package/build/components/alignment-control/ui.js.map +1 -1
  8. package/build/components/autocomplete/index.js +1 -2
  9. package/build/components/autocomplete/index.js.map +1 -1
  10. package/build/components/block-alignment-control/constants.js +2 -4
  11. package/build/components/block-alignment-control/constants.js.map +1 -1
  12. package/build/components/block-alignment-control/ui.js +1 -2
  13. package/build/components/block-alignment-control/ui.js.map +1 -1
  14. package/build/components/block-alignment-control/ui.native.js +1 -2
  15. package/build/components/block-alignment-control/ui.native.js.map +1 -1
  16. package/build/components/block-alignment-matrix-control/index.js +1 -2
  17. package/build/components/block-alignment-matrix-control/index.js.map +1 -1
  18. package/build/components/block-breadcrumb/index.js +1 -2
  19. package/build/components/block-breadcrumb/index.js.map +1 -1
  20. package/build/components/block-canvas/index.js +1 -2
  21. package/build/components/block-canvas/index.js.map +1 -1
  22. package/build/components/block-caption/index.native.js +1 -2
  23. package/build/components/block-caption/index.native.js.map +1 -1
  24. package/build/components/block-card/index.js +1 -2
  25. package/build/components/block-card/index.js.map +1 -1
  26. package/build/components/block-compare/index.js +1 -2
  27. package/build/components/block-compare/index.js.map +1 -1
  28. package/build/components/block-context/index.js +1 -2
  29. package/build/components/block-context/index.js.map +1 -1
  30. package/build/components/block-controls/groups.js +1 -2
  31. package/build/components/block-controls/groups.js.map +1 -1
  32. package/build/components/block-controls/index.js +1 -2
  33. package/build/components/block-controls/index.js.map +1 -1
  34. package/build/components/block-draggable/dropping-insertion-point.native.js +2 -2
  35. package/build/components/block-draggable/dropping-insertion-point.native.js.map +1 -1
  36. package/build/components/block-draggable/index.js +1 -2
  37. package/build/components/block-draggable/index.js.map +1 -1
  38. package/build/components/block-draggable/index.native.js +3 -4
  39. package/build/components/block-draggable/index.native.js.map +1 -1
  40. package/build/components/block-edit/context.js +4 -8
  41. package/build/components/block-edit/context.js.map +1 -1
  42. package/build/components/block-edit/edit.js +1 -2
  43. package/build/components/block-edit/edit.js.map +1 -1
  44. package/build/components/block-edit/edit.native.js +1 -2
  45. package/build/components/block-edit/edit.native.js.map +1 -1
  46. package/build/components/block-full-height-alignment-control/index.js +1 -2
  47. package/build/components/block-full-height-alignment-control/index.js.map +1 -1
  48. package/build/components/block-icon/index.js +1 -2
  49. package/build/components/block-icon/index.js.map +1 -1
  50. package/build/components/block-icon/index.native.js +1 -2
  51. package/build/components/block-icon/index.native.js.map +1 -1
  52. package/build/components/block-info-slot-fill/index.js +1 -2
  53. package/build/components/block-info-slot-fill/index.js.map +1 -1
  54. package/build/components/block-inspector/index.js +11 -9
  55. package/build/components/block-inspector/index.js.map +1 -1
  56. package/build/components/block-list/block-crash-boundary.js +1 -2
  57. package/build/components/block-list/block-crash-boundary.js.map +1 -1
  58. package/build/components/block-list/block-html.js +1 -2
  59. package/build/components/block-list/block-html.js.map +1 -1
  60. package/build/components/block-list/block-list-context.native.js +1 -2
  61. package/build/components/block-list/block-list-context.native.js.map +1 -1
  62. package/build/components/block-list/block-list-item-cell.native.js +1 -2
  63. package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
  64. package/build/components/block-list/block-list-item.native.js +1 -2
  65. package/build/components/block-list/block-list-item.native.js.map +1 -1
  66. package/build/components/block-list/block-outline.native.js +1 -2
  67. package/build/components/block-list/block-outline.native.js.map +1 -1
  68. package/build/components/block-list/block-selection-button.native.js +1 -2
  69. package/build/components/block-list/block-selection-button.native.js.map +1 -1
  70. package/build/components/block-list/block.js +32 -21
  71. package/build/components/block-list/block.js.map +1 -1
  72. package/build/components/block-list/block.native.js +7 -6
  73. package/build/components/block-list/block.native.js.map +1 -1
  74. package/build/components/block-list/grid-item.native.js +1 -2
  75. package/build/components/block-list/grid-item.native.js.map +1 -1
  76. package/build/components/block-list/index.js +19 -9
  77. package/build/components/block-list/index.js.map +1 -1
  78. package/build/components/block-list/insertion-point.native.js +1 -2
  79. package/build/components/block-list/insertion-point.native.js.map +1 -1
  80. package/build/components/block-list/layout.js +2 -4
  81. package/build/components/block-list/layout.js.map +1 -1
  82. package/build/components/block-list/private-block-context.js +1 -2
  83. package/build/components/block-list/private-block-context.js.map +1 -1
  84. package/build/components/block-list/subdirectory-icon.js +1 -2
  85. package/build/components/block-list/subdirectory-icon.js.map +1 -1
  86. package/build/components/block-list/use-block-props/index.js +8 -1
  87. package/build/components/block-list/use-block-props/index.js.map +1 -1
  88. package/build/components/block-list/use-scroll-upon-insertion.native.js +1 -2
  89. package/build/components/block-list/use-scroll-upon-insertion.native.js.map +1 -1
  90. package/build/components/block-list-appender/index.js +5 -52
  91. package/build/components/block-list-appender/index.js.map +1 -1
  92. package/build/components/block-media-update-progress/index.native.js +11 -22
  93. package/build/components/block-media-update-progress/index.native.js.map +1 -1
  94. package/build/components/block-mover/button.js +2 -4
  95. package/build/components/block-mover/button.js.map +1 -1
  96. package/build/components/block-mover/index.js +1 -2
  97. package/build/components/block-mover/index.js.map +1 -1
  98. package/build/components/block-mover/index.native.js +3 -6
  99. package/build/components/block-mover/index.native.js.map +1 -1
  100. package/build/components/block-mover/mover-description.native.js +0 -2
  101. package/build/components/block-mover/mover-description.native.js.map +1 -1
  102. package/build/components/block-navigation/dropdown.js +1 -2
  103. package/build/components/block-navigation/dropdown.js.map +1 -1
  104. package/build/components/block-pattern-setup/constants.js +1 -2
  105. package/build/components/block-pattern-setup/constants.js.map +1 -1
  106. package/build/components/block-pattern-setup/index.js +1 -2
  107. package/build/components/block-pattern-setup/index.js.map +1 -1
  108. package/build/components/block-pattern-setup/setup-toolbar.js +1 -2
  109. package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  110. package/build/components/block-pattern-setup/use-patterns-setup.js +1 -2
  111. package/build/components/block-pattern-setup/use-patterns-setup.js.map +1 -1
  112. package/build/components/block-patterns-list/index.js +1 -2
  113. package/build/components/block-patterns-list/index.js.map +1 -1
  114. package/build/components/block-popover/drop-zone.js +1 -2
  115. package/build/components/block-popover/drop-zone.js.map +1 -1
  116. package/build/components/block-popover/inbetween.js +2 -4
  117. package/build/components/block-popover/inbetween.js.map +1 -1
  118. package/build/components/block-popover/index.js +1 -2
  119. package/build/components/block-popover/index.js.map +1 -1
  120. package/build/components/block-popover/use-popover-scroll.js +1 -2
  121. package/build/components/block-popover/use-popover-scroll.js.map +1 -1
  122. package/build/components/block-preview/auto.js +2 -1
  123. package/build/components/block-preview/auto.js.map +1 -1
  124. package/build/components/block-preview/index.js +1 -2
  125. package/build/components/block-preview/index.js.map +1 -1
  126. package/build/components/block-removal-warning-modal/index.js +4 -2
  127. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  128. package/build/components/block-settings/button.native.js +1 -2
  129. package/build/components/block-settings/button.native.js.map +1 -1
  130. package/build/components/block-settings/container.native.js +1 -2
  131. package/build/components/block-settings/container.native.js.map +1 -1
  132. package/build/components/block-settings/index.native.js +2 -2
  133. package/build/components/block-settings/index.native.js.map +1 -1
  134. package/build/components/block-settings-menu/block-html-convert-button.js +1 -2
  135. package/build/components/block-settings-menu/block-html-convert-button.js.map +1 -1
  136. package/build/components/block-settings-menu/block-mode-toggle.js +1 -2
  137. package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  138. package/build/components/block-settings-menu/block-settings-dropdown.js +1 -2
  139. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  140. package/build/components/block-settings-menu/block-settings-menu-first-item.js +1 -2
  141. package/build/components/block-settings-menu/block-settings-menu-first-item.js.map +1 -1
  142. package/build/components/block-settings-menu/index.js +1 -2
  143. package/build/components/block-settings-menu/index.js.map +1 -1
  144. package/build/components/block-settings-menu-controls/index.js +1 -2
  145. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  146. package/build/components/block-styles/index.js +1 -2
  147. package/build/components/block-styles/index.js.map +1 -1
  148. package/build/components/block-styles/index.native.js +1 -2
  149. package/build/components/block-styles/index.native.js.map +1 -1
  150. package/build/components/block-styles/preview.native.js +1 -2
  151. package/build/components/block-styles/preview.native.js.map +1 -1
  152. package/build/components/block-switcher/block-transformations-menu.js +1 -2
  153. package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
  154. package/build/components/block-switcher/block-transformations-menu.native.js +1 -2
  155. package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
  156. package/build/components/block-switcher/block-variation-transformations.js +1 -2
  157. package/build/components/block-switcher/block-variation-transformations.js.map +1 -1
  158. package/build/components/block-switcher/index.js +13 -11
  159. package/build/components/block-switcher/index.js.map +1 -1
  160. package/build/components/block-switcher/pattern-transformations-menu.js +1 -2
  161. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  162. package/build/components/block-switcher/use-transformed-patterns.js +1 -2
  163. package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
  164. package/build/components/block-title/use-block-display-title.js +21 -28
  165. package/build/components/block-title/use-block-display-title.js.map +1 -1
  166. package/build/components/block-toolbar/block-name-context.js +1 -2
  167. package/build/components/block-toolbar/block-name-context.js.map +1 -1
  168. package/build/components/block-toolbar/block-toolbar-last-item.js +1 -2
  169. package/build/components/block-toolbar/block-toolbar-last-item.js.map +1 -1
  170. package/build/components/block-toolbar/block-toolbar-menu.native.js +1 -2
  171. package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  172. package/build/components/block-tools/block-selection-button.js +20 -18
  173. package/build/components/block-tools/block-selection-button.js.map +1 -1
  174. package/build/components/block-tools/index.js +4 -12
  175. package/build/components/block-tools/index.js.map +1 -1
  176. package/build/components/block-tools/insertion-point.js +1 -2
  177. package/build/components/block-tools/insertion-point.js.map +1 -1
  178. package/build/components/block-tools/zoom-out-mode-inserters.js +1 -2
  179. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  180. package/build/components/block-types-list/index.js +1 -2
  181. package/build/components/block-types-list/index.js.map +1 -1
  182. package/build/components/block-variation-picker/index.js +1 -2
  183. package/build/components/block-variation-picker/index.js.map +1 -1
  184. package/build/components/block-variation-picker/index.native.js +1 -2
  185. package/build/components/block-variation-picker/index.native.js.map +1 -1
  186. package/build/components/block-variation-transforms/index.js +1 -2
  187. package/build/components/block-variation-transforms/index.js.map +1 -1
  188. package/build/components/block-vertical-alignment-control/icons.js +5 -10
  189. package/build/components/block-vertical-alignment-control/icons.js.map +1 -1
  190. package/build/components/block-vertical-alignment-control/ui.js +1 -2
  191. package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
  192. package/build/components/button-block-appender/index.js +2 -4
  193. package/build/components/button-block-appender/index.js.map +1 -1
  194. package/build/components/button-block-appender/index.native.js +1 -2
  195. package/build/components/button-block-appender/index.native.js.map +1 -1
  196. package/build/components/caption/index.native.js +1 -2
  197. package/build/components/caption/index.native.js.map +1 -1
  198. package/build/components/color-palette/index.js +1 -2
  199. package/build/components/color-palette/index.js.map +1 -1
  200. package/build/components/color-palette/with-color-context.js +1 -2
  201. package/build/components/color-palette/with-color-context.js.map +1 -1
  202. package/build/components/color-style-selector/index.js +1 -2
  203. package/build/components/color-style-selector/index.js.map +1 -1
  204. package/build/components/colors/index.js +2 -2
  205. package/build/components/colors/index.js.map +1 -1
  206. package/build/components/colors-gradients/control.js +1 -3
  207. package/build/components/colors-gradients/control.js.map +1 -1
  208. package/build/components/colors-gradients/panel-color-gradient-settings.js +1 -2
  209. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  210. package/build/components/contrast-checker/index.js +1 -2
  211. package/build/components/contrast-checker/index.js.map +1 -1
  212. package/build/components/contrast-checker/index.native.js +1 -2
  213. package/build/components/contrast-checker/index.native.js.map +1 -1
  214. package/build/components/convert-to-group-buttons/toolbar.js +1 -2
  215. package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
  216. package/build/components/default-block-appender/index.js +31 -40
  217. package/build/components/default-block-appender/index.js.map +1 -1
  218. package/build/components/default-block-appender/index.native.js +1 -2
  219. package/build/components/default-block-appender/index.native.js.map +1 -1
  220. package/build/components/dimensions-tool/aspect-ratio-tool.js +2 -2
  221. package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -1
  222. package/build/components/dimensions-tool/index.js +1 -2
  223. package/build/components/dimensions-tool/index.js.map +1 -1
  224. package/build/components/duotone-control/index.js +1 -2
  225. package/build/components/duotone-control/index.js.map +1 -1
  226. package/build/components/editable-text/index.js +1 -2
  227. package/build/components/editable-text/index.js.map +1 -1
  228. package/build/components/floating-toolbar/index.native.js +1 -2
  229. package/build/components/floating-toolbar/index.native.js.map +1 -1
  230. package/build/components/floating-toolbar/nav-up-icon.js +1 -2
  231. package/build/components/floating-toolbar/nav-up-icon.js.map +1 -1
  232. package/build/components/font-sizes/font-size-picker.js +1 -2
  233. package/build/components/font-sizes/font-size-picker.js.map +1 -1
  234. package/build/components/global-styles/border-panel.js +56 -8
  235. package/build/components/global-styles/border-panel.js.map +1 -1
  236. package/build/components/global-styles/color-panel.native.js +1 -2
  237. package/build/components/global-styles/color-panel.native.js.map +1 -1
  238. package/build/components/global-styles/context.js +2 -4
  239. package/build/components/global-styles/context.js.map +1 -1
  240. package/build/components/global-styles/get-global-styles-changes.js +2 -4
  241. package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
  242. package/build/components/global-styles/index.js +2 -15
  243. package/build/components/global-styles/index.js.map +1 -1
  244. package/build/components/global-styles/shadow-panel-components.js +133 -0
  245. package/build/components/global-styles/shadow-panel-components.js.map +1 -0
  246. package/build/components/global-styles/typography-panel.js +6 -7
  247. package/build/components/global-styles/typography-panel.js.map +1 -1
  248. package/build/components/global-styles/use-global-styles-output.js +1 -1
  249. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  250. package/build/components/global-styles/utils.js +38 -14
  251. package/build/components/global-styles/utils.js.map +1 -1
  252. package/build/components/iframe/index.js +1 -2
  253. package/build/components/iframe/index.js.map +1 -1
  254. package/build/components/image-editor/constants.js +3 -6
  255. package/build/components/image-editor/constants.js.map +1 -1
  256. package/build/components/image-link-destinations/index.native.js +1 -2
  257. package/build/components/image-link-destinations/index.native.js.map +1 -1
  258. package/build/components/index.js +2 -2
  259. package/build/components/index.js.map +1 -1
  260. package/build/components/index.native.js +2 -2
  261. package/build/components/index.native.js.map +1 -1
  262. package/build/components/inner-blocks/button-block-appender.js +1 -2
  263. package/build/components/inner-blocks/button-block-appender.js.map +1 -1
  264. package/build/components/inner-blocks/constants.native.js +1 -2
  265. package/build/components/inner-blocks/constants.native.js.map +1 -1
  266. package/build/components/inner-blocks/default-block-appender.js +1 -2
  267. package/build/components/inner-blocks/default-block-appender.js.map +1 -1
  268. package/build/components/inner-blocks/index.js +33 -30
  269. package/build/components/inner-blocks/index.js.map +1 -1
  270. package/build/components/inner-blocks/index.native.js +2 -6
  271. package/build/components/inner-blocks/index.native.js.map +1 -1
  272. package/build/components/inner-blocks/use-inner-block-template-sync.js +2 -3
  273. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  274. package/build/components/inner-blocks/warning-max-depth-exceeded.native.js +1 -2
  275. package/build/components/inner-blocks/warning-max-depth-exceeded.native.js.map +1 -1
  276. package/build/components/inner-blocks/with-client-id.js +1 -2
  277. package/build/components/inner-blocks/with-client-id.js.map +1 -1
  278. package/build/components/inserter/block-patterns-explorer/index.js +1 -2
  279. package/build/components/inserter/block-patterns-explorer/index.js.map +1 -1
  280. package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +1 -2
  281. package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
  282. package/build/components/inserter/block-patterns-explorer/pattern-list.js +1 -2
  283. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  284. package/build/components/inserter/block-patterns-tab/index.js +1 -2
  285. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  286. package/build/components/inserter/block-patterns-tab/patterns-filter.js +4 -4
  287. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  288. package/build/components/inserter/block-patterns-tab/utils.js +5 -9
  289. package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
  290. package/build/components/inserter/block-types-tab.js +1 -2
  291. package/build/components/inserter/block-types-tab.js.map +1 -1
  292. package/build/components/inserter/block-types-tab.native.js +1 -2
  293. package/build/components/inserter/block-types-tab.native.js.map +1 -1
  294. package/build/components/inserter/hooks/use-block-type-impressions.native.js +1 -2
  295. package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  296. package/build/components/inserter/hooks/use-block-types-state.js +1 -2
  297. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  298. package/build/components/inserter/hooks/use-insertion-point.js +1 -2
  299. package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
  300. package/build/components/inserter/hooks/use-patterns-state.js +1 -2
  301. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  302. package/build/components/inserter/index.js +2 -4
  303. package/build/components/inserter/index.js.map +1 -1
  304. package/build/components/inserter/index.native.js +1 -2
  305. package/build/components/inserter/index.native.js.map +1 -1
  306. package/build/components/inserter/library.js +1 -2
  307. package/build/components/inserter/library.js.map +1 -1
  308. package/build/components/inserter/media-tab/media-list.js +1 -2
  309. package/build/components/inserter/media-tab/media-list.js.map +1 -1
  310. package/build/components/inserter/media-tab/media-tab.js +1 -2
  311. package/build/components/inserter/media-tab/media-tab.js.map +1 -1
  312. package/build/components/inserter/menu.js +1 -2
  313. package/build/components/inserter/menu.js.map +1 -1
  314. package/build/components/inserter/menu.native.js +1 -2
  315. package/build/components/inserter/menu.native.js.map +1 -1
  316. package/build/components/inserter/no-results.js +1 -2
  317. package/build/components/inserter/no-results.js.map +1 -1
  318. package/build/components/inserter/no-results.native.js +1 -2
  319. package/build/components/inserter/no-results.native.js.map +1 -1
  320. package/build/components/inserter/panel.js +1 -2
  321. package/build/components/inserter/panel.js.map +1 -1
  322. package/build/components/inserter/preview-panel.js +1 -2
  323. package/build/components/inserter/preview-panel.js.map +1 -1
  324. package/build/components/inserter/quick-inserter.js +3 -2
  325. package/build/components/inserter/quick-inserter.js.map +1 -1
  326. package/build/components/inserter/reusable-blocks-tab.native.js +1 -2
  327. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  328. package/build/components/inserter/search-items.js +0 -1
  329. package/build/components/inserter/search-items.js.map +1 -1
  330. package/build/components/inserter/search-results.js +1 -2
  331. package/build/components/inserter/search-results.js.map +1 -1
  332. package/build/components/inserter/search-results.native.js +1 -2
  333. package/build/components/inserter/search-results.native.js.map +1 -1
  334. package/build/components/inserter/tabs.js +1 -2
  335. package/build/components/inserter/tabs.js.map +1 -1
  336. package/build/components/inserter/tabs.native.js +1 -2
  337. package/build/components/inserter/tabs.native.js.map +1 -1
  338. package/build/components/inserter/tips.js +1 -2
  339. package/build/components/inserter/tips.js.map +1 -1
  340. package/build/components/inserter-button/index.native.js +1 -2
  341. package/build/components/inserter-button/index.native.js.map +1 -1
  342. package/build/components/inserter-button/sparkles.js +1 -2
  343. package/build/components/inserter-button/sparkles.js.map +1 -1
  344. package/build/components/inserter-draggable-blocks/index.js +11 -2
  345. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  346. package/build/components/inserter-list-item/index.js +1 -2
  347. package/build/components/inserter-list-item/index.js.map +1 -1
  348. package/build/components/inserter-listbox/context.js +1 -2
  349. package/build/components/inserter-listbox/context.js.map +1 -1
  350. package/build/components/inserter-listbox/group.js +1 -2
  351. package/build/components/inserter-listbox/group.js.map +1 -1
  352. package/build/components/inserter-listbox/index.js +1 -2
  353. package/build/components/inserter-listbox/index.js.map +1 -1
  354. package/build/components/inserter-listbox/item.js +1 -2
  355. package/build/components/inserter-listbox/item.js.map +1 -1
  356. package/build/components/inserter-listbox/row.js +1 -2
  357. package/build/components/inserter-listbox/row.js.map +1 -1
  358. package/build/components/inserter-menu-extension/index.js +1 -2
  359. package/build/components/inserter-menu-extension/index.js.map +1 -1
  360. package/build/components/inspector-controls/groups.js +1 -2
  361. package/build/components/inspector-controls/groups.js.map +1 -1
  362. package/build/components/inspector-controls/index.js +1 -2
  363. package/build/components/inspector-controls/index.js.map +1 -1
  364. package/build/components/inspector-controls-tabs/advanced-controls-panel.js +3 -4
  365. package/build/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -1
  366. package/build/components/inspector-controls-tabs/position-controls-panel.js +1 -2
  367. package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
  368. package/build/components/inspector-controls-tabs/settings-tab.js +1 -2
  369. package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
  370. package/build/components/inspector-controls-tabs/styles-tab.js +6 -6
  371. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  372. package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +1 -2
  373. package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -1
  374. package/build/components/inspector-controls-tabs/utils.js +3 -6
  375. package/build/components/inspector-controls-tabs/utils.js.map +1 -1
  376. package/build/components/justify-content-control/ui.js +1 -2
  377. package/build/components/justify-content-control/ui.js.map +1 -1
  378. package/build/components/keyboard-shortcuts/index.js +1 -2
  379. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  380. package/build/components/line-height-control/index.js +1 -2
  381. package/build/components/line-height-control/index.js.map +1 -1
  382. package/build/components/line-height-control/utils.js +4 -8
  383. package/build/components/line-height-control/utils.js.map +1 -1
  384. package/build/components/link-control/constants.js +7 -14
  385. package/build/components/link-control/constants.js.map +1 -1
  386. package/build/components/link-control/index.js +2 -16
  387. package/build/components/link-control/index.js.map +1 -1
  388. package/build/components/link-control/link-preview.js +13 -15
  389. package/build/components/link-control/link-preview.js.map +1 -1
  390. package/build/components/link-control/search-create-button.js +1 -2
  391. package/build/components/link-control/search-create-button.js.map +1 -1
  392. package/build/components/link-control/search-input.js +1 -2
  393. package/build/components/link-control/search-input.js.map +1 -1
  394. package/build/components/link-control/search-item.js +1 -2
  395. package/build/components/link-control/search-item.js.map +1 -1
  396. package/build/components/link-control/settings-drawer.js +1 -2
  397. package/build/components/link-control/settings-drawer.js.map +1 -1
  398. package/build/components/link-control/settings.js +1 -2
  399. package/build/components/link-control/settings.js.map +1 -1
  400. package/build/components/link-control/use-create-page.js +0 -1
  401. package/build/components/link-control/use-create-page.js.map +1 -1
  402. package/build/components/link-control/use-rich-url-data.js +1 -2
  403. package/build/components/link-control/use-rich-url-data.js.map +1 -1
  404. package/build/components/link-control/viewer-slot.js +1 -2
  405. package/build/components/link-control/viewer-slot.js.map +1 -1
  406. package/build/components/list-view/appender.js +1 -2
  407. package/build/components/list-view/appender.js.map +1 -1
  408. package/build/components/list-view/block-contents.js +1 -2
  409. package/build/components/list-view/block-contents.js.map +1 -1
  410. package/build/components/list-view/block-select-button.js +1 -2
  411. package/build/components/list-view/block-select-button.js.map +1 -1
  412. package/build/components/list-view/block.js +33 -28
  413. package/build/components/list-view/block.js.map +1 -1
  414. package/build/components/list-view/branch.js +1 -2
  415. package/build/components/list-view/branch.js.map +1 -1
  416. package/build/components/list-view/context.js +1 -2
  417. package/build/components/list-view/context.js.map +1 -1
  418. package/build/components/list-view/index.js +20 -17
  419. package/build/components/list-view/index.js.map +1 -1
  420. package/build/components/list-view/leaf.js +1 -2
  421. package/build/components/list-view/leaf.js.map +1 -1
  422. package/build/components/list-view/use-clipboard-handler.js +159 -0
  423. package/build/components/list-view/use-clipboard-handler.js.map +1 -0
  424. package/build/components/list-view/use-list-view-drop-zone.js +1 -2
  425. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  426. package/build/components/list-view/utils.js +4 -4
  427. package/build/components/list-view/utils.js.map +1 -1
  428. package/build/components/media-placeholder/index.js +1 -2
  429. package/build/components/media-placeholder/index.js.map +1 -1
  430. package/build/components/media-placeholder/index.native.js +1 -2
  431. package/build/components/media-placeholder/index.native.js.map +1 -1
  432. package/build/components/media-replace-flow/index.js +1 -2
  433. package/build/components/media-replace-flow/index.js.map +1 -1
  434. package/build/components/media-replace-flow/index.native.js +1 -2
  435. package/build/components/media-replace-flow/index.native.js.map +1 -1
  436. package/build/components/media-upload/check.js +1 -2
  437. package/build/components/media-upload/check.js.map +1 -1
  438. package/build/components/media-upload/constants.native.js +8 -16
  439. package/build/components/media-upload/constants.native.js.map +1 -1
  440. package/build/components/media-upload/index.js +1 -2
  441. package/build/components/media-upload/index.js.map +1 -1
  442. package/build/components/media-upload/index.native.js +1 -2
  443. package/build/components/media-upload/index.native.js.map +1 -1
  444. package/build/components/media-upload-progress/constants.js +6 -12
  445. package/build/components/media-upload-progress/constants.js.map +1 -1
  446. package/build/components/media-upload-progress/index.native.js +1 -2
  447. package/build/components/media-upload-progress/index.native.js.map +1 -1
  448. package/build/components/multi-selection-inspector/index.js +1 -2
  449. package/build/components/multi-selection-inspector/index.js.map +1 -1
  450. package/build/components/navigable-toolbar/index.js +5 -2
  451. package/build/components/navigable-toolbar/index.js.map +1 -1
  452. package/build/components/observe-typing/index.js +1 -2
  453. package/build/components/observe-typing/index.js.map +1 -1
  454. package/build/components/panel-color-settings/index.js +1 -2
  455. package/build/components/panel-color-settings/index.js.map +1 -1
  456. package/build/components/plain-text/index.js +1 -2
  457. package/build/components/plain-text/index.js.map +1 -1
  458. package/build/components/provider/block-refs-provider.js +1 -2
  459. package/build/components/provider/block-refs-provider.js.map +1 -1
  460. package/build/components/provider/index.js +3 -5
  461. package/build/components/provider/index.js.map +1 -1
  462. package/build/components/provider/index.native.js +2 -4
  463. package/build/components/provider/index.native.js.map +1 -1
  464. package/build/components/provider/with-registry-provider.js +1 -2
  465. package/build/components/provider/with-registry-provider.js.map +1 -1
  466. package/build/components/publish-date-time-picker/index.js +1 -2
  467. package/build/components/publish-date-time-picker/index.js.map +1 -1
  468. package/build/components/responsive-block-control/index.js +3 -7
  469. package/build/components/responsive-block-control/index.js.map +1 -1
  470. package/build/components/rich-text/embed-handler-picker.native.js +1 -2
  471. package/build/components/rich-text/embed-handler-picker.native.js.map +1 -1
  472. package/build/components/rich-text/format-edit.js +1 -2
  473. package/build/components/rich-text/format-edit.js.map +1 -1
  474. package/build/components/rich-text/format-toolbar/index.js +1 -2
  475. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  476. package/build/components/rich-text/format-toolbar/index.native.js +1 -2
  477. package/build/components/rich-text/format-toolbar/index.native.js.map +1 -1
  478. package/build/components/rich-text/format-toolbar-container.js +1 -2
  479. package/build/components/rich-text/format-toolbar-container.js.map +1 -1
  480. package/build/components/rich-text/format-toolbar-container.native.js +1 -2
  481. package/build/components/rich-text/format-toolbar-container.native.js.map +1 -1
  482. package/build/components/rich-text/index.js +6 -7
  483. package/build/components/rich-text/index.js.map +1 -1
  484. package/build/components/rich-text/index.native.js +1 -2
  485. package/build/components/rich-text/index.native.js.map +1 -1
  486. package/build/components/rich-text/multiline.js +1 -2
  487. package/build/components/rich-text/multiline.js.map +1 -1
  488. package/build/components/rich-text/native/index.native.js +1 -6
  489. package/build/components/rich-text/native/index.native.js.map +1 -1
  490. package/build/components/rich-text/native/toolbar-button-with-options.native.js +1 -2
  491. package/build/components/rich-text/native/toolbar-button-with-options.native.js.map +1 -1
  492. package/build/components/skip-to-selected-block/index.js +1 -2
  493. package/build/components/skip-to-selected-block/index.js.map +1 -1
  494. package/build/components/spacing-sizes-control/index.js +3 -1
  495. package/build/components/spacing-sizes-control/index.js.map +1 -1
  496. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
  497. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  498. package/build/components/spacing-sizes-control/utils.js +5 -10
  499. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  500. package/build/components/tool-selector/index.js +1 -2
  501. package/build/components/tool-selector/index.js.map +1 -1
  502. package/build/components/typewriter/index.js +1 -2
  503. package/build/components/typewriter/index.js.map +1 -1
  504. package/build/components/ungroup-button/index.native.js +1 -2
  505. package/build/components/ungroup-button/index.native.js.map +1 -1
  506. package/build/components/unsupported-block-details/index.native.js +1 -2
  507. package/build/components/unsupported-block-details/index.native.js.map +1 -1
  508. package/build/components/url-input/button.js +1 -2
  509. package/build/components/url-input/button.js.map +1 -1
  510. package/build/components/url-input/index.js +1 -2
  511. package/build/components/url-input/index.js.map +1 -1
  512. package/build/components/url-popover/image-url-input-ui.js +18 -8
  513. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  514. package/build/components/url-popover/index.js +5 -5
  515. package/build/components/url-popover/index.js.map +1 -1
  516. package/build/components/use-block-drop-zone/index.js +15 -5
  517. package/build/components/use-block-drop-zone/index.js.map +1 -1
  518. package/build/components/use-flash-editable-blocks/index.js +60 -0
  519. package/build/components/use-flash-editable-blocks/index.js.map +1 -0
  520. package/build/components/use-moving-animation/index.js +1 -2
  521. package/build/components/use-moving-animation/index.js.map +1 -1
  522. package/build/components/use-on-block-drop/index.js +4 -4
  523. package/build/components/use-on-block-drop/index.js.map +1 -1
  524. package/build/components/use-settings/index.js +3 -162
  525. package/build/components/use-settings/index.js.map +1 -1
  526. package/build/components/video-player/gridicon-play.native.js +1 -2
  527. package/build/components/video-player/gridicon-play.native.js.map +1 -1
  528. package/build/components/video-player/index.native.js +2 -4
  529. package/build/components/video-player/index.native.js.map +1 -1
  530. package/build/components/warning/index.js +1 -2
  531. package/build/components/warning/index.js.map +1 -1
  532. package/build/components/warning/index.native.js +1 -2
  533. package/build/components/warning/index.native.js.map +1 -1
  534. package/build/components/writing-flow/index.js +1 -2
  535. package/build/components/writing-flow/index.js.map +1 -1
  536. package/build/components/writing-flow/use-clipboard-handler.js +3 -48
  537. package/build/components/writing-flow/use-clipboard-handler.js.map +1 -1
  538. package/build/components/writing-flow/use-drag-selection.js +13 -2
  539. package/build/components/writing-flow/use-drag-selection.js.map +1 -1
  540. package/build/components/writing-flow/utils.js +86 -0
  541. package/build/components/writing-flow/utils.js.map +1 -0
  542. package/build/hooks/align.js +1 -2
  543. package/build/hooks/align.js.map +1 -1
  544. package/build/hooks/align.native.js +2 -2
  545. package/build/hooks/align.native.js.map +1 -1
  546. package/build/hooks/anchor.js +1 -2
  547. package/build/hooks/anchor.js.map +1 -1
  548. package/build/hooks/aria-label.js +1 -2
  549. package/build/hooks/aria-label.js.map +1 -1
  550. package/build/hooks/background.js +52 -14
  551. package/build/hooks/background.js.map +1 -1
  552. package/build/hooks/block-hooks.js +1 -2
  553. package/build/hooks/block-hooks.js.map +1 -1
  554. package/build/hooks/block-renaming.js +1 -2
  555. package/build/hooks/block-renaming.js.map +1 -1
  556. package/build/hooks/border.js +42 -7
  557. package/build/hooks/border.js.map +1 -1
  558. package/build/hooks/color.js +4 -6
  559. package/build/hooks/color.js.map +1 -1
  560. package/build/hooks/content-lock-ui.js +1 -2
  561. package/build/hooks/content-lock-ui.js.map +1 -1
  562. package/build/hooks/custom-class-name.js +1 -2
  563. package/build/hooks/custom-class-name.js.map +1 -1
  564. package/build/hooks/custom-class-name.native.js +1 -2
  565. package/build/hooks/custom-class-name.native.js.map +1 -1
  566. package/build/hooks/dimensions.js +5 -10
  567. package/build/hooks/dimensions.js.map +1 -1
  568. package/build/hooks/duotone.js +1 -3
  569. package/build/hooks/duotone.js.map +1 -1
  570. package/build/hooks/font-family.js +2 -4
  571. package/build/hooks/font-family.js.map +1 -1
  572. package/build/hooks/font-size.js +25 -31
  573. package/build/hooks/font-size.js.map +1 -1
  574. package/build/hooks/index.js +2 -2
  575. package/build/hooks/index.js.map +1 -1
  576. package/build/hooks/layout-child.js +1 -2
  577. package/build/hooks/layout-child.js.map +1 -1
  578. package/build/hooks/layout.js +2 -4
  579. package/build/hooks/layout.js.map +1 -1
  580. package/build/hooks/line-height.js +1 -2
  581. package/build/hooks/line-height.js.map +1 -1
  582. package/build/hooks/position.js +1 -2
  583. package/build/hooks/position.js.map +1 -1
  584. package/build/hooks/style.js +3 -8
  585. package/build/hooks/style.js.map +1 -1
  586. package/build/hooks/typography.js +4 -6
  587. package/build/hooks/typography.js.map +1 -1
  588. package/build/hooks/typography.native.js +3 -6
  589. package/build/hooks/typography.native.js.map +1 -1
  590. package/build/hooks/use-bindings-attributes.js +10 -9
  591. package/build/hooks/use-bindings-attributes.js.map +1 -1
  592. package/build/layouts/constrained.js +1 -2
  593. package/build/layouts/constrained.js.map +1 -1
  594. package/build/layouts/definitions.js +1 -2
  595. package/build/layouts/definitions.js.map +1 -1
  596. package/build/layouts/flex.js +1 -2
  597. package/build/layouts/flex.js.map +1 -1
  598. package/build/layouts/flow.js +1 -2
  599. package/build/layouts/flow.js.map +1 -1
  600. package/build/layouts/grid.js +1 -2
  601. package/build/layouts/grid.js.map +1 -1
  602. package/build/private-apis.js +8 -5
  603. package/build/private-apis.js.map +1 -1
  604. package/build/private-apis.native.js +3 -4
  605. package/build/private-apis.native.js.map +1 -1
  606. package/build/store/actions.js +2 -4
  607. package/build/store/actions.js.map +1 -1
  608. package/build/store/constants.js +1 -2
  609. package/build/store/constants.js.map +1 -1
  610. package/build/store/defaults.js +2 -4
  611. package/build/store/defaults.js.map +1 -1
  612. package/build/store/defaults.native.js +1 -2
  613. package/build/store/defaults.native.js.map +1 -1
  614. package/build/store/get-block-settings.js +180 -0
  615. package/build/store/get-block-settings.js.map +1 -0
  616. package/build/store/index.js +4 -6
  617. package/build/store/index.js.map +1 -1
  618. package/build/store/private-actions.js +37 -3
  619. package/build/store/private-actions.js.map +1 -1
  620. package/build/store/private-selectors.js +55 -29
  621. package/build/store/private-selectors.js.map +1 -1
  622. package/build/store/reducer.js +27 -6
  623. package/build/store/reducer.js.map +1 -1
  624. package/build/store/selectors.js +98 -102
  625. package/build/store/selectors.js.map +1 -1
  626. package/build/store/undo-ignore.js +1 -2
  627. package/build/store/undo-ignore.js.map +1 -1
  628. package/build/utils/selection.js +1 -2
  629. package/build/utils/selection.js.map +1 -1
  630. package/build/utils/transform-styles/index.js +3 -4
  631. package/build/utils/transform-styles/index.js.map +1 -1
  632. package/build-module/components/block-breadcrumb/index.js +0 -1
  633. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  634. package/build-module/components/block-inspector/index.js +10 -7
  635. package/build-module/components/block-inspector/index.js.map +1 -1
  636. package/build-module/components/block-list/block.js +32 -20
  637. package/build-module/components/block-list/block.js.map +1 -1
  638. package/build-module/components/block-list/block.native.js +6 -4
  639. package/build-module/components/block-list/block.native.js.map +1 -1
  640. package/build-module/components/block-list/index.js +18 -7
  641. package/build-module/components/block-list/index.js.map +1 -1
  642. package/build-module/components/block-list/use-block-props/index.js +8 -1
  643. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  644. package/build-module/components/block-list-appender/index.js +5 -51
  645. package/build-module/components/block-list-appender/index.js.map +1 -1
  646. package/build-module/components/block-mover/mover-description.native.js +0 -2
  647. package/build-module/components/block-mover/mover-description.native.js.map +1 -1
  648. package/build-module/components/block-popover/inbetween.js +0 -1
  649. package/build-module/components/block-popover/inbetween.js.map +1 -1
  650. package/build-module/components/block-preview/auto.js +2 -1
  651. package/build-module/components/block-preview/auto.js.map +1 -1
  652. package/build-module/components/block-removal-warning-modal/index.js +4 -2
  653. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  654. package/build-module/components/block-switcher/index.js +12 -9
  655. package/build-module/components/block-switcher/index.js.map +1 -1
  656. package/build-module/components/block-title/use-block-display-title.js +22 -28
  657. package/build-module/components/block-title/use-block-display-title.js.map +1 -1
  658. package/build-module/components/block-tools/block-selection-button.js +20 -17
  659. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  660. package/build-module/components/block-tools/index.js +2 -10
  661. package/build-module/components/block-tools/index.js.map +1 -1
  662. package/build-module/components/colors-gradients/control.js +0 -1
  663. package/build-module/components/colors-gradients/control.js.map +1 -1
  664. package/build-module/components/default-block-appender/index.js +30 -37
  665. package/build-module/components/default-block-appender/index.js.map +1 -1
  666. package/build-module/components/global-styles/border-panel.js +57 -9
  667. package/build-module/components/global-styles/border-panel.js.map +1 -1
  668. package/build-module/components/global-styles/get-global-styles-changes.js +2 -4
  669. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
  670. package/build-module/components/global-styles/index.js +0 -1
  671. package/build-module/components/global-styles/index.js.map +1 -1
  672. package/build-module/components/global-styles/shadow-panel-components.js +121 -0
  673. package/build-module/components/global-styles/shadow-panel-components.js.map +1 -0
  674. package/build-module/components/global-styles/typography-panel.js +2 -3
  675. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  676. package/build-module/components/global-styles/use-global-styles-output.js +2 -2
  677. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  678. package/build-module/components/global-styles/utils.js +30 -1
  679. package/build-module/components/global-styles/utils.js.map +1 -1
  680. package/build-module/components/inner-blocks/index.js +33 -29
  681. package/build-module/components/inner-blocks/index.js.map +1 -1
  682. package/build-module/components/inner-blocks/index.native.js +1 -4
  683. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  684. package/build-module/components/inner-blocks/use-inner-block-template-sync.js +2 -3
  685. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  686. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +4 -4
  687. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  688. package/build-module/components/inserter/block-patterns-tab/utils.js +2 -2
  689. package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
  690. package/build-module/components/inserter/quick-inserter.js +3 -2
  691. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  692. package/build-module/components/inserter/search-items.js +0 -1
  693. package/build-module/components/inserter/search-items.js.map +1 -1
  694. package/build-module/components/inserter-draggable-blocks/index.js +12 -1
  695. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  696. package/build-module/components/inspector-controls-tabs/styles-tab.js +5 -4
  697. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  698. package/build-module/components/link-control/index.js +1 -14
  699. package/build-module/components/link-control/index.js.map +1 -1
  700. package/build-module/components/link-control/link-preview.js +16 -18
  701. package/build-module/components/link-control/link-preview.js.map +1 -1
  702. package/build-module/components/link-control/use-create-page.js +0 -1
  703. package/build-module/components/link-control/use-create-page.js.map +1 -1
  704. package/build-module/components/list-view/block.js +32 -26
  705. package/build-module/components/list-view/block.js.map +1 -1
  706. package/build-module/components/list-view/index.js +17 -11
  707. package/build-module/components/list-view/index.js.map +1 -1
  708. package/build-module/components/list-view/use-clipboard-handler.js +153 -0
  709. package/build-module/components/list-view/use-clipboard-handler.js.map +1 -0
  710. package/build-module/components/list-view/utils.js +4 -4
  711. package/build-module/components/list-view/utils.js.map +1 -1
  712. package/build-module/components/navigable-toolbar/index.js +5 -2
  713. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  714. package/build-module/components/provider/index.js +1 -1
  715. package/build-module/components/provider/index.js.map +1 -1
  716. package/build-module/components/responsive-block-control/index.js +3 -6
  717. package/build-module/components/responsive-block-control/index.js.map +1 -1
  718. package/build-module/components/rich-text/index.js +3 -1
  719. package/build-module/components/rich-text/index.js.map +1 -1
  720. package/build-module/components/rich-text/native/index.native.js +0 -4
  721. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  722. package/build-module/components/spacing-sizes-control/index.js +4 -2
  723. package/build-module/components/spacing-sizes-control/index.js.map +1 -1
  724. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
  725. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  726. package/build-module/components/url-popover/image-url-input-ui.js +21 -11
  727. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  728. package/build-module/components/url-popover/index.js +5 -4
  729. package/build-module/components/url-popover/index.js.map +1 -1
  730. package/build-module/components/use-block-drop-zone/index.js +15 -5
  731. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  732. package/build-module/components/use-flash-editable-blocks/index.js +53 -0
  733. package/build-module/components/use-flash-editable-blocks/index.js.map +1 -0
  734. package/build-module/components/use-on-block-drop/index.js +4 -4
  735. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  736. package/build-module/components/use-settings/index.js +3 -159
  737. package/build-module/components/use-settings/index.js.map +1 -1
  738. package/build-module/components/writing-flow/use-clipboard-handler.js +4 -49
  739. package/build-module/components/writing-flow/use-clipboard-handler.js.map +1 -1
  740. package/build-module/components/writing-flow/use-drag-selection.js +13 -2
  741. package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
  742. package/build-module/components/writing-flow/utils.js +79 -0
  743. package/build-module/components/writing-flow/utils.js.map +1 -0
  744. package/build-module/hooks/background.js +48 -10
  745. package/build-module/hooks/background.js.map +1 -1
  746. package/build-module/hooks/border.js +38 -3
  747. package/build-module/hooks/border.js.map +1 -1
  748. package/build-module/hooks/duotone.js +0 -1
  749. package/build-module/hooks/duotone.js.map +1 -1
  750. package/build-module/hooks/font-size.js +23 -27
  751. package/build-module/hooks/font-size.js.map +1 -1
  752. package/build-module/hooks/style.js +3 -7
  753. package/build-module/hooks/style.js.map +1 -1
  754. package/build-module/hooks/use-bindings-attributes.js +8 -11
  755. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  756. package/build-module/private-apis.js +5 -1
  757. package/build-module/private-apis.js.map +1 -1
  758. package/build-module/store/get-block-settings.js +171 -0
  759. package/build-module/store/get-block-settings.js.map +1 -0
  760. package/build-module/store/private-actions.js +35 -3
  761. package/build-module/store/private-actions.js.map +1 -1
  762. package/build-module/store/private-selectors.js +42 -19
  763. package/build-module/store/private-selectors.js.map +1 -1
  764. package/build-module/store/reducer.js +24 -2
  765. package/build-module/store/reducer.js.map +1 -1
  766. package/build-module/store/selectors.js +65 -34
  767. package/build-module/store/selectors.js.map +1 -1
  768. package/build-style/content-rtl.css +23 -15
  769. package/build-style/content.css +23 -15
  770. package/build-style/style-rtl.css +66 -53
  771. package/build-style/style.css +66 -53
  772. package/package.json +31 -31
  773. package/src/components/block-canvas/style.scss +1 -1
  774. package/src/components/block-card/style.scss +3 -1
  775. package/src/components/block-controls/README.md +2 -2
  776. package/src/components/block-inspector/index.js +11 -9
  777. package/src/components/block-list/block.js +45 -20
  778. package/src/components/block-list/block.native.js +7 -4
  779. package/src/components/block-list/content.scss +23 -28
  780. package/src/components/block-list/index.js +49 -25
  781. package/src/components/block-list/use-block-props/index.js +8 -0
  782. package/src/components/block-list-appender/index.js +7 -74
  783. package/src/components/block-mover/style.scss +4 -3
  784. package/src/components/block-preview/auto.js +2 -1
  785. package/src/components/block-removal-warning-modal/index.js +17 -10
  786. package/src/components/block-switcher/index.js +22 -13
  787. package/src/components/block-title/test/index.js +86 -85
  788. package/src/components/block-title/use-block-display-title.js +25 -36
  789. package/src/components/block-toolbar/style.scss +8 -1
  790. package/src/components/block-tools/block-selection-button.js +23 -26
  791. package/src/components/block-tools/index.js +2 -12
  792. package/src/components/colors-gradients/control.js +0 -1
  793. package/src/components/default-block-appender/index.js +26 -38
  794. package/src/components/default-block-appender/test/index.js +24 -16
  795. package/src/components/font-sizes/README.MD +0 -9
  796. package/src/components/global-styles/border-panel.js +72 -1
  797. package/src/components/global-styles/get-global-styles-changes.js +2 -8
  798. package/src/components/global-styles/index.js +0 -1
  799. package/src/components/global-styles/shadow-panel-components.js +125 -0
  800. package/src/components/global-styles/style.scss +8 -9
  801. package/src/components/global-styles/test/get-global-styles-changes.js +3 -3
  802. package/src/components/global-styles/test/use-global-styles-output.js +1 -1
  803. package/src/components/global-styles/test/utils.js +86 -0
  804. package/src/components/global-styles/typography-panel.js +1 -2
  805. package/src/components/global-styles/use-global-styles-output.js +5 -1
  806. package/src/components/global-styles/utils.js +36 -0
  807. package/src/components/inner-blocks/index.js +31 -32
  808. package/src/components/inner-blocks/index.native.js +3 -9
  809. package/src/components/inner-blocks/use-inner-block-template-sync.js +1 -3
  810. package/src/components/inserter/block-patterns-tab/patterns-filter.js +4 -10
  811. package/src/components/inserter/block-patterns-tab/utils.js +2 -2
  812. package/src/components/inserter/quick-inserter.js +4 -2
  813. package/src/components/inserter/style.scss +3 -13
  814. package/src/components/inserter-draggable-blocks/index.js +12 -1
  815. package/src/components/inspector-controls-tabs/styles-tab.js +4 -2
  816. package/src/components/link-control/index.js +1 -20
  817. package/src/components/link-control/link-preview.js +19 -24
  818. package/src/components/link-control/style.scss +5 -11
  819. package/src/components/link-control/test/index.js +11 -90
  820. package/src/components/list-view/block.js +49 -41
  821. package/src/components/list-view/index.js +22 -9
  822. package/src/components/list-view/use-clipboard-handler.js +199 -0
  823. package/src/components/list-view/utils.js +4 -4
  824. package/src/components/media-replace-flow/style.scss +1 -1
  825. package/src/components/media-replace-flow/test/index.js +1 -1
  826. package/src/components/navigable-toolbar/index.js +8 -4
  827. package/src/components/provider/index.js +1 -1
  828. package/src/components/responsive-block-control/index.js +3 -5
  829. package/src/components/rich-text/index.js +3 -1
  830. package/src/components/spacing-sizes-control/index.js +2 -1
  831. package/src/components/url-input/style.scss +4 -2
  832. package/src/components/url-popover/image-url-input-ui.js +22 -10
  833. package/src/components/url-popover/index.js +75 -69
  834. package/src/components/url-popover/style.scss +12 -21
  835. package/src/components/use-block-drop-zone/index.js +17 -3
  836. package/src/components/use-flash-editable-blocks/index.js +62 -0
  837. package/src/components/use-on-block-drop/index.js +11 -4
  838. package/src/components/use-settings/index.js +9 -232
  839. package/src/components/writing-flow/use-clipboard-handler.js +6 -78
  840. package/src/components/writing-flow/use-drag-selection.js +12 -3
  841. package/src/components/writing-flow/utils.js +103 -0
  842. package/src/hooks/background.js +53 -8
  843. package/src/hooks/border.js +47 -6
  844. package/src/hooks/font-size.js +33 -33
  845. package/src/hooks/style.js +5 -9
  846. package/src/hooks/test/background.js +50 -0
  847. package/src/hooks/test/font-size.js +164 -0
  848. package/src/hooks/use-bindings-attributes.js +8 -18
  849. package/src/private-apis.js +4 -0
  850. package/src/store/get-block-settings.js +225 -0
  851. package/src/store/private-actions.js +44 -2
  852. package/src/store/private-selectors.js +53 -38
  853. package/src/store/reducer.js +29 -1
  854. package/src/store/selectors.js +74 -48
  855. package/src/store/test/get-block-settings.js +90 -0
  856. package/src/store/test/private-actions.js +18 -0
  857. package/src/store/test/private-selectors.js +19 -0
  858. package/src/store/test/reducer.js +19 -0
  859. package/build/components/global-styles/effects-panel.js +0 -219
  860. package/build/components/global-styles/effects-panel.js.map +0 -1
  861. package/build/hooks/effects.js +0 -66
  862. package/build/hooks/effects.js.map +0 -1
  863. package/build-module/components/global-styles/effects-panel.js +0 -210
  864. package/build-module/components/global-styles/effects-panel.js.map +0 -1
  865. package/build-module/hooks/effects.js +0 -51
  866. package/build-module/hooks/effects.js.map +0 -1
  867. package/src/components/global-styles/effects-panel.js +0 -244
  868. package/src/components/use-settings/test/index.js +0 -141
  869. package/src/hooks/effects.js +0 -57
  870. package/src/hooks/test/effects.js +0 -39
@@ -1 +1 @@
1
- {"version":3,"names":["useCallback","cloneBlock","createBlock","findTransform","getBlockTransforms","pasteHandler","store","blocksStore","useDispatch","useSelect","useRegistry","getFilesFromDataTransfer","blockEditorStore","parseDropEvent","event","result","srcRootClientId","srcClientIds","srcIndex","type","blocks","dataTransfer","Object","assign","JSON","parse","getData","err","onBlockDrop","targetRootClientId","targetBlockIndex","getBlockIndex","getClientIdsOfDescendants","moveBlocks","insertOrReplaceBlocks","clearSelectedBlock","operation","getBlock","sourceRootClientId","sourceClientIds","dropType","blocksToInsert","map","block","sourceBlockIndex","includes","some","id","clientId","isAtSameLevel","draggedBlockCount","length","insertIndex","onFilesDrop","getSettings","updateBlockAttributes","canInsertBlockType","files","mediaUpload","transformation","transform","blockName","isMatch","onHTMLDrop","HTML","mode","useOnBlockDrop","options","nearestSide","getBlockOrder","getBlocksByClientId","isGroupable","getBlockType","getGroupingBlockName","insertBlocks","moveBlocksToPosition","replaceBlocks","removeBlocks","registry","updateSelection","initialPosition","clientIdsToReplace","clientIds","blocksClientIds","areGroupableBlocks","undefined","targetBlock","push","unshift","groupInnerBlocks","name","attributes","innerBlocks","areAllImages","every","galleryBlock","wrappedBlocks","layout","flexWrap","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\tcreateBlock,\n\tfindTransform,\n\tgetBlockTransforms,\n\tpasteHandler,\n\tstore as blocksStore,\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 * @param {string} operation The type of operation to perform on drop. Could be `insert` or `replace` or `group`.\n * @param {Function} getBlock A function that returns a block given its client id.\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\toperation,\n\tgetBlock\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\t// If the user is dropping a block over another block, replace both blocks\n\t\t\t// with a group block containing them\n\t\t\tif ( operation === 'group' ) {\n\t\t\t\tconst blocksToInsert = sourceClientIds.map( ( clientId ) =>\n\t\t\t\t\tgetBlock( clientId )\n\t\t\t\t);\n\t\t\t\tinsertOrReplaceBlocks(\n\t\t\t\t\tblocksToInsert,\n\t\t\t\t\ttrue,\n\t\t\t\t\tnull,\n\t\t\t\t\tsourceClientIds\n\t\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 {Function} getSettings A function that gets the block editor settings.\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\tgetSettings,\n\tupdateBlockAttributes,\n\tcanInsertBlockType,\n\tinsertOrReplaceBlocks\n) {\n\treturn ( files ) => {\n\t\tif ( ! getSettings().mediaUpload ) {\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 {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( insertOrReplaceBlocks ) {\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', nearestSide = 'right' } = options;\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetBlockIndex,\n\t\tgetClientIdsOfDescendants,\n\t\tgetBlockOrder,\n\t\tgetBlocksByClientId,\n\t\tgetSettings,\n\t\tgetBlock,\n\t\tisGroupable,\n\t} = useSelect( blockEditorStore );\n\tconst { getBlockType, getGroupingBlockName } = useSelect( blocksStore );\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(\n\t\t\tblocks,\n\t\t\tupdateSelection = true,\n\t\t\tinitialPosition = 0,\n\t\t\tclientIdsToReplace = []\n\t\t) => {\n\t\t\tconst clientIds = getBlockOrder( targetRootClientId );\n\t\t\tconst clientId = clientIds[ targetBlockIndex ];\n\t\t\tconst blocksClientIds = blocks.map( ( block ) => block.clientId );\n\t\t\tconst areGroupableBlocks = isGroupable( [\n\t\t\t\t...blocksClientIds,\n\t\t\t\tclientId,\n\t\t\t] );\n\t\t\tif ( operation === 'replace' ) {\n\t\t\t\treplaceBlocks( clientId, blocks, undefined, initialPosition );\n\t\t\t} else if ( operation === 'group' && areGroupableBlocks ) {\n\t\t\t\tconst targetBlock = getBlock( clientId );\n\t\t\t\tif ( nearestSide === 'left' ) {\n\t\t\t\t\tblocks.push( targetBlock );\n\t\t\t\t} else {\n\t\t\t\t\tblocks.unshift( targetBlock );\n\t\t\t\t}\n\n\t\t\t\tconst groupInnerBlocks = blocks.map( ( block ) => {\n\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\tblock.attributes,\n\t\t\t\t\t\tblock.innerBlocks\n\t\t\t\t\t);\n\t\t\t\t} );\n\n\t\t\t\tconst areAllImages = blocks.every( ( block ) => {\n\t\t\t\t\treturn block.name === 'core/image';\n\t\t\t\t} );\n\n\t\t\t\tconst galleryBlock = !! getBlockType( 'core/gallery' );\n\n\t\t\t\tconst wrappedBlocks = createBlock(\n\t\t\t\t\tareAllImages && galleryBlock\n\t\t\t\t\t\t? 'core/gallery'\n\t\t\t\t\t\t: getGroupingBlockName(),\n\t\t\t\t\t{\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\ttype: 'flex',\n\t\t\t\t\t\t\tflexWrap: areAllImages ? null : 'nowrap',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tgroupInnerBlocks\n\t\t\t\t);\n\t\t\t\t// Need to make sure both the target block and the block being dragged are replaced\n\t\t\t\t// otherwise the dragged block will be duplicated.\n\t\t\t\treplaceBlocks(\n\t\t\t\t\t[ clientId, ...clientIdsToReplace ],\n\t\t\t\t\twrappedBlocks,\n\t\t\t\t\tundefined,\n\t\t\t\t\tinitialPosition\n\t\t\t\t);\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\tgetBlockOrder,\n\t\t\ttargetRootClientId,\n\t\t\ttargetBlockIndex,\n\t\t\toperation,\n\t\t\treplaceBlocks,\n\t\t\tgetBlock,\n\t\t\tnearestSide,\n\t\t\tgetBlockType,\n\t\t\tgetGroupingBlockName,\n\t\t\tinsertBlocks,\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\tmoveBlocksToPosition,\n\t\t\tregistry,\n\t\t\tremoveBlocks,\n\t\t\treplaceBlocks,\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\toperation,\n\t\tgetBlock\n\t);\n\tconst _onFilesDrop = onFilesDrop(\n\t\ttargetRootClientId,\n\t\tgetSettings,\n\t\tupdateBlockAttributes,\n\t\tcanInsertBlockType,\n\t\tinsertOrReplaceBlocks\n\t);\n\tconst _onHTMLDrop = onHTMLDrop( insertOrReplaceBlocks );\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,WAAW,EACXC,aAAa,EACbC,kBAAkB,EAClBC,YAAY,EACZC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASC,WAAW,EAAEC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACrE,SAASC,wBAAwB,QAAQ,gBAAgB;;AAEzD;AACA;AACA;AACA,SAASL,KAAK,IAAIM,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,IA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AAkB,EAClBC,SAAS,EACTC,QACD,CAAC;EACD,MAAMmE,YAAY,GAAGnD,WAAW,CAC/BxB,kBAAkB,EAClByB,WAAW,EACXC,qBAAqB,EACrBC,kBAAkB,EAClBtB,qBACD,CAAC;EACD,MAAMuE,WAAW,GAAG1C,UAAU,CAAE7B,qBAAsB,CAAC;EAEvD,OAASpB,KAAK,IAAM;IACnB,MAAM2C,KAAK,GAAG9C,wBAAwB,CAAEG,KAAK,CAACO,YAAa,CAAC;IAC5D,MAAMqF,IAAI,GAAG5F,KAAK,CAACO,YAAY,CAACK,OAAO,CAAE,WAAY,CAAC;;IAEtD;AACF;AACA;AACA;IACE,IAAKgF,IAAI,EAAG;MACXD,WAAW,CAAEC,IAAK,CAAC;IACpB,CAAC,MAAM,IAAKjD,KAAK,CAACN,MAAM,EAAG;MAC1BqD,YAAY,CAAE/C,KAAM,CAAC;IACtB,CAAC,MAAM;MACN8C,OAAO,CAAEzF,KAAM,CAAC;IACjB;EACD,CAAC;AACF"}
1
+ {"version":3,"names":["useCallback","cloneBlock","createBlock","findTransform","getBlockTransforms","pasteHandler","store","blocksStore","useDispatch","useSelect","useRegistry","getFilesFromDataTransfer","blockEditorStore","parseDropEvent","event","result","srcRootClientId","srcClientIds","srcIndex","type","blocks","dataTransfer","Object","assign","JSON","parse","getData","err","onBlockDrop","targetRootClientId","targetBlockIndex","getBlockIndex","getClientIdsOfDescendants","moveBlocks","insertOrReplaceBlocks","clearSelectedBlock","operation","getBlock","sourceRootClientId","sourceClientIds","dropType","blocksToInsert","map","block","sourceBlockIndex","includes","some","id","clientId","isAtSameLevel","draggedBlockCount","length","insertIndex","onFilesDrop","getSettings","updateBlockAttributes","canInsertBlockType","files","mediaUpload","transformation","transform","blockName","isMatch","onHTMLDrop","HTML","mode","useOnBlockDrop","options","nearestSide","getBlockOrder","getBlocksByClientId","isGroupable","getGroupingBlockName","insertBlocks","moveBlocksToPosition","replaceBlocks","removeBlocks","registry","updateSelection","initialPosition","clientIdsToReplace","Array","isArray","clientIds","blocksClientIds","areGroupableBlocks","undefined","targetBlock","push","unshift","groupInnerBlocks","name","attributes","innerBlocks","areAllImages","every","galleryBlock","wrappedBlocks","layout","flexWrap","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\tcreateBlock,\n\tfindTransform,\n\tgetBlockTransforms,\n\tpasteHandler,\n\tstore as blocksStore,\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 * @param {string} operation The type of operation to perform on drop. Could be `insert` or `replace` or `group`.\n * @param {Function} getBlock A function that returns a block given its client id.\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\toperation,\n\tgetBlock\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\t// If the user is dropping a block over another block, replace both blocks\n\t\t\t// with a group block containing them\n\t\t\tif ( operation === 'group' ) {\n\t\t\t\tconst blocksToInsert = sourceClientIds.map( ( clientId ) =>\n\t\t\t\t\tgetBlock( clientId )\n\t\t\t\t);\n\t\t\t\tinsertOrReplaceBlocks(\n\t\t\t\t\tblocksToInsert,\n\t\t\t\t\ttrue,\n\t\t\t\t\tnull,\n\t\t\t\t\tsourceClientIds\n\t\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 {Function} getSettings A function that gets the block editor settings.\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\tgetSettings,\n\tupdateBlockAttributes,\n\tcanInsertBlockType,\n\tinsertOrReplaceBlocks\n) {\n\treturn ( files ) => {\n\t\tif ( ! getSettings().mediaUpload ) {\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 {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( insertOrReplaceBlocks ) {\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', nearestSide = 'right' } = options;\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetBlockIndex,\n\t\tgetClientIdsOfDescendants,\n\t\tgetBlockOrder,\n\t\tgetBlocksByClientId,\n\t\tgetSettings,\n\t\tgetBlock,\n\t\tisGroupable,\n\t} = useSelect( blockEditorStore );\n\tconst { getGroupingBlockName } = useSelect( blocksStore );\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(\n\t\t\tblocks,\n\t\t\tupdateSelection = true,\n\t\t\tinitialPosition = 0,\n\t\t\tclientIdsToReplace = []\n\t\t) => {\n\t\t\tif ( ! Array.isArray( blocks ) ) blocks = [ blocks ];\n\n\t\t\tconst clientIds = getBlockOrder( targetRootClientId );\n\t\t\tconst clientId = clientIds[ targetBlockIndex ];\n\t\t\tconst blocksClientIds = blocks.map( ( block ) => block.clientId );\n\t\t\tconst areGroupableBlocks = isGroupable( [\n\t\t\t\t...blocksClientIds,\n\t\t\t\tclientId,\n\t\t\t] );\n\t\t\tif ( operation === 'replace' ) {\n\t\t\t\treplaceBlocks( clientId, blocks, undefined, initialPosition );\n\t\t\t} else if ( operation === 'group' && areGroupableBlocks ) {\n\t\t\t\tconst targetBlock = getBlock( clientId );\n\t\t\t\tif ( nearestSide === 'left' ) {\n\t\t\t\t\tblocks.push( targetBlock );\n\t\t\t\t} else {\n\t\t\t\t\tblocks.unshift( targetBlock );\n\t\t\t\t}\n\n\t\t\t\tconst groupInnerBlocks = blocks.map( ( block ) => {\n\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\tblock.attributes,\n\t\t\t\t\t\tblock.innerBlocks\n\t\t\t\t\t);\n\t\t\t\t} );\n\n\t\t\t\tconst areAllImages = blocks.every( ( block ) => {\n\t\t\t\t\treturn block.name === 'core/image';\n\t\t\t\t} );\n\n\t\t\t\tconst galleryBlock = canInsertBlockType(\n\t\t\t\t\t'core/gallery',\n\t\t\t\t\ttargetRootClientId\n\t\t\t\t);\n\n\t\t\t\tconst wrappedBlocks = createBlock(\n\t\t\t\t\tareAllImages && galleryBlock\n\t\t\t\t\t\t? 'core/gallery'\n\t\t\t\t\t\t: getGroupingBlockName(),\n\t\t\t\t\t{\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\ttype: 'flex',\n\t\t\t\t\t\t\tflexWrap:\n\t\t\t\t\t\t\t\tareAllImages && galleryBlock ? null : 'nowrap',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tgroupInnerBlocks\n\t\t\t\t);\n\t\t\t\t// Need to make sure both the target block and the block being dragged are replaced\n\t\t\t\t// otherwise the dragged block will be duplicated.\n\t\t\t\treplaceBlocks(\n\t\t\t\t\t[ clientId, ...clientIdsToReplace ],\n\t\t\t\t\twrappedBlocks,\n\t\t\t\t\tundefined,\n\t\t\t\t\tinitialPosition\n\t\t\t\t);\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\tgetBlockOrder,\n\t\t\ttargetRootClientId,\n\t\t\ttargetBlockIndex,\n\t\t\tisGroupable,\n\t\t\toperation,\n\t\t\treplaceBlocks,\n\t\t\tgetBlock,\n\t\t\tnearestSide,\n\t\t\tcanInsertBlockType,\n\t\t\tgetGroupingBlockName,\n\t\t\tinsertBlocks,\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\tmoveBlocksToPosition,\n\t\t\tregistry,\n\t\t\tremoveBlocks,\n\t\t\treplaceBlocks,\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\toperation,\n\t\tgetBlock\n\t);\n\tconst _onFilesDrop = onFilesDrop(\n\t\ttargetRootClientId,\n\t\tgetSettings,\n\t\tupdateBlockAttributes,\n\t\tcanInsertBlockType,\n\t\tinsertOrReplaceBlocks\n\t);\n\tconst _onHTMLDrop = onHTMLDrop( insertOrReplaceBlocks );\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,WAAW,EACXC,aAAa,EACbC,kBAAkB,EAClBC,YAAY,EACZC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASC,WAAW,EAAEC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACrE,SAASC,wBAAwB,QAAQ,gBAAgB;;AAEzD;AAC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AAM,CAAC;QACtC;QACAoC,aAAa,CACZ2B,mBAAmB,EACnBF,YAAY,EACZd,SAAS,EACT,CACD,CAAC;MACF,CAAE,CAAC;IACJ,CAAC,MAAM;MACNZ,oBAAoB,CACnBnC,eAAe,EACfD,kBAAkB,EAClBT,kBAAkB,EAClBuB,WACD,CAAC;IACF;EACD,CAAC,EACD,CACChB,SAAS,EACTiC,aAAa,EACbC,mBAAmB,EACnBI,oBAAoB,EACpBG,QAAQ,EACRD,YAAY,EACZD,aAAa,EACb7C,gBAAgB,EAChBD,kBAAkB,CAEpB,CAAC;EAED,MAAM2E,OAAO,GAAG5E,WAAW,CAC1BC,kBAAkB,EAClBC,gBAAgB,EAChBC,aAAa,EACbC,yBAAyB,EACzBC,UAAU,EACVC,qBAAqB,EACrBC,kBAAkB,EAClBC,SAAS,EACTC,QACD,CAAC;EACD,MAAMoE,YAAY,GAAGpD,WAAW,CAC/BxB,kBAAkB,EAClByB,WAAW,EACXC,qBAAqB,EACrBC,kBAAkB,EAClBtB,qBACD,CAAC;EACD,MAAMwE,WAAW,GAAG3C,UAAU,CAAE7B,qBAAsB,CAAC;EAEvD,OAASpB,KAAK,IAAM;IACnB,MAAM2C,KAAK,GAAG9C,wBAAwB,CAAEG,KAAK,CAACO,YAAa,CAAC;IAC5D,MAAMsF,IAAI,GAAG7F,KAAK,CAACO,YAAY,CAACK,OAAO,CAAE,WAAY,CAAC;;IAEtD;AACF;AACA;AACA;IACE,IAAKiF,IAAI,EAAG;MACXD,WAAW,CAAEC,IAAK,CAAC;IACpB,CAAC,MAAM,IAAKlD,KAAK,CAACN,MAAM,EAAG;MAC1BsD,YAAY,CAAEhD,KAAM,CAAC;IACtB,CAAC,MAAM;MACN+C,OAAO,CAAE1F,KAAM,CAAC;IACjB;EACD,CAAC;AACF"}
@@ -1,109 +1,15 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { __EXPERIMENTAL_PATHS_WITH_MERGE as PATHS_WITH_MERGE, hasBlockSupport } from '@wordpress/blocks';
5
4
  import { useSelect } from '@wordpress/data';
6
5
  import deprecated from '@wordpress/deprecated';
7
- import { useMemo } from '@wordpress/element';
8
- import { applyFilters } from '@wordpress/hooks';
9
6
 
10
7
  /**
11
8
  * Internal dependencies
12
9
  */
13
10
  import { useBlockEditContext } from '../block-edit';
14
11
  import { store as blockEditorStore } from '../../store';
15
- import { getValueFromObjectPath } from '../../utils/object';
16
- const blockedPaths = ['color', 'border', 'dimensions', 'typography', 'spacing'];
17
- const deprecatedFlags = {
18
- 'color.palette': settings => settings.colors,
19
- 'color.gradients': settings => settings.gradients,
20
- 'color.custom': settings => settings.disableCustomColors === undefined ? undefined : !settings.disableCustomColors,
21
- 'color.customGradient': settings => settings.disableCustomGradients === undefined ? undefined : !settings.disableCustomGradients,
22
- 'typography.fontSizes': settings => settings.fontSizes,
23
- 'typography.customFontSize': settings => settings.disableCustomFontSizes === undefined ? undefined : !settings.disableCustomFontSizes,
24
- 'typography.lineHeight': settings => settings.enableCustomLineHeight,
25
- 'spacing.units': settings => {
26
- if (settings.enableCustomUnits === undefined) {
27
- return;
28
- }
29
- if (settings.enableCustomUnits === true) {
30
- return ['px', 'em', 'rem', 'vh', 'vw', '%'];
31
- }
32
- return settings.enableCustomUnits;
33
- },
34
- 'spacing.padding': settings => settings.enableCustomSpacing
35
- };
36
- const prefixedFlags = {
37
- /*
38
- * These were only available in the plugin
39
- * and can be removed when the minimum WordPress version
40
- * for the plugin is 5.9.
41
- */
42
- 'border.customColor': 'border.color',
43
- 'border.customStyle': 'border.style',
44
- 'border.customWidth': 'border.width',
45
- 'typography.customFontStyle': 'typography.fontStyle',
46
- 'typography.customFontWeight': 'typography.fontWeight',
47
- 'typography.customLetterSpacing': 'typography.letterSpacing',
48
- 'typography.customTextDecorations': 'typography.textDecoration',
49
- 'typography.customTextTransforms': 'typography.textTransform',
50
- /*
51
- * These were part of WordPress 5.8 and we need to keep them.
52
- */
53
- 'border.customRadius': 'border.radius',
54
- 'spacing.customMargin': 'spacing.margin',
55
- 'spacing.customPadding': 'spacing.padding',
56
- 'typography.customLineHeight': 'typography.lineHeight'
57
- };
58
-
59
- /**
60
- * Remove `custom` prefixes for flags that did not land in 5.8.
61
- *
62
- * This provides continued support for `custom` prefixed properties. It will
63
- * be removed once third party devs have had sufficient time to update themes,
64
- * plugins, etc.
65
- *
66
- * @see https://github.com/WordPress/gutenberg/pull/34485
67
- *
68
- * @param {string} path Path to desired value in settings.
69
- * @return {string} The value for defined setting.
70
- */
71
- const removeCustomPrefixes = path => {
72
- return prefixedFlags[path] || path;
73
- };
74
-
75
- /**
76
- * For settings like `color.palette`, which have a value that is an object
77
- * with `default`, `theme`, `custom`, with field values that are arrays of
78
- * items, merge these three arrays into one and return it. The calculation
79
- * is memoized so that identical input values produce identical output.
80
- * @param {Object} value Object to merge
81
- * @return {Array} Array of merged items
82
- */
83
- export function mergeOrigins(value) {
84
- let result = mergeCache.get(value);
85
- if (!result) {
86
- result = ['default', 'theme', 'custom'].flatMap(key => {
87
- var _value$key;
88
- return (_value$key = value[key]) !== null && _value$key !== void 0 ? _value$key : [];
89
- });
90
- mergeCache.set(value, result);
91
- }
92
- return result;
93
- }
94
- const mergeCache = new WeakMap();
95
-
96
- /**
97
- * For settings like `color.palette`, which have a value that is an object
98
- * with `default`, `theme`, `custom`, with field values that are arrays of
99
- * items, see if any of the three origins have values.
100
- *
101
- * @param {Object} value Object to check
102
- * @return {boolean} Whether the object has values in any of the three origins
103
- */
104
- export function hasMergedOrigins(value) {
105
- return ['default', 'theme', 'custom'].some(key => value?.[key]?.length);
106
- }
12
+ import { unlock } from '../../lock-unlock';
107
13
 
108
14
  /**
109
15
  * Hook that retrieves the given settings for the block instance in use.
@@ -120,73 +26,11 @@ export function hasMergedOrigins(value) {
120
26
  */
121
27
  export function useSettings(...paths) {
122
28
  const {
123
- name: blockName,
124
29
  clientId = null
125
30
  } = useBlockEditContext();
126
-
31
+ return useSelect(select => unlock(select(blockEditorStore)).getBlockSettings(clientId, ...paths),
127
32
  // eslint-disable-next-line react-hooks/exhaustive-deps
128
- paths = useMemo(() => paths, paths);
129
- return useSelect(select => {
130
- const candidates = clientId ? [clientId, ...select(blockEditorStore).getBlockParents(clientId, /* ascending */true)].filter(candidateClientId => {
131
- const candidateBlockName = select(blockEditorStore).getBlockName(candidateClientId);
132
- return hasBlockSupport(candidateBlockName, '__experimentalSettings', false);
133
- }) : [];
134
- return paths.map(path => {
135
- if (blockedPaths.includes(path)) {
136
- // eslint-disable-next-line no-console
137
- console.warn('Top level useSetting paths are disabled. Please use a subpath to query the information needed.');
138
- return undefined;
139
- }
140
-
141
- // 0. Allow third parties to filter the block's settings at runtime.
142
- let result = applyFilters('blockEditor.useSetting.before', undefined, path, clientId, blockName);
143
- if (undefined !== result) {
144
- return result;
145
- }
146
- const normalizedPath = removeCustomPrefixes(path);
147
-
148
- // 1. Take settings from the block instance or its ancestors.
149
- // Start from the current block and work our way up the ancestors.
150
- for (const candidateClientId of candidates) {
151
- var _getValueFromObjectPa;
152
- const candidateAtts = select(blockEditorStore).getBlockAttributes(candidateClientId);
153
- result = (_getValueFromObjectPa = getValueFromObjectPath(candidateAtts.settings?.blocks?.[blockName], normalizedPath)) !== null && _getValueFromObjectPa !== void 0 ? _getValueFromObjectPa : getValueFromObjectPath(candidateAtts.settings, normalizedPath);
154
- if (result !== undefined) {
155
- // Stop the search for more distant ancestors and move on.
156
- break;
157
- }
158
- }
159
-
160
- // 2. Fall back to the settings from the block editor store (__experimentalFeatures).
161
- const settings = select(blockEditorStore).getSettings();
162
- if (result === undefined && blockName) {
163
- result = getValueFromObjectPath(settings.__experimentalFeatures?.blocks?.[blockName], normalizedPath);
164
- }
165
- if (result === undefined) {
166
- result = getValueFromObjectPath(settings.__experimentalFeatures, normalizedPath);
167
- }
168
-
169
- // Return if the setting was found in either the block instance or the store.
170
- if (result !== undefined) {
171
- if (PATHS_WITH_MERGE[normalizedPath]) {
172
- return mergeOrigins(result);
173
- }
174
- return result;
175
- }
176
-
177
- // 3. Otherwise, use deprecated settings.
178
- const deprecatedSettingsValue = deprecatedFlags[normalizedPath]?.(settings);
179
- if (deprecatedSettingsValue !== undefined) {
180
- return deprecatedSettingsValue;
181
- }
182
-
183
- // 4. Fallback for typography.dropCap:
184
- // This is only necessary to support typography.dropCap.
185
- // when __experimentalFeatures are not present (core without plugin).
186
- // To remove when __experimentalFeatures are ported to core.
187
- return normalizedPath === 'typography.dropCap' ? true : undefined;
188
- });
189
- }, [blockName, clientId, paths]);
33
+ [clientId, ...paths]);
190
34
  }
191
35
 
192
36
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["__EXPERIMENTAL_PATHS_WITH_MERGE","PATHS_WITH_MERGE","hasBlockSupport","useSelect","deprecated","useMemo","applyFilters","useBlockEditContext","store","blockEditorStore","getValueFromObjectPath","blockedPaths","deprecatedFlags","settings","colors","gradients","disableCustomColors","undefined","disableCustomGradients","fontSizes","disableCustomFontSizes","enableCustomLineHeight","enableCustomUnits","enableCustomSpacing","prefixedFlags","removeCustomPrefixes","path","mergeOrigins","value","result","mergeCache","get","flatMap","key","_value$key","set","WeakMap","hasMergedOrigins","some","length","useSettings","paths","name","blockName","clientId","select","candidates","getBlockParents","filter","candidateClientId","candidateBlockName","getBlockName","map","includes","console","warn","normalizedPath","_getValueFromObjectPa","candidateAtts","getBlockAttributes","blocks","getSettings","__experimentalFeatures","deprecatedSettingsValue","useSetting","since","alternative","note"],"sources":["@wordpress/block-editor/src/components/use-settings/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__EXPERIMENTAL_PATHS_WITH_MERGE as PATHS_WITH_MERGE,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { useMemo } from '@wordpress/element';\nimport { applyFilters } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit';\nimport { store as blockEditorStore } from '../../store';\nimport { getValueFromObjectPath } from '../../utils/object';\n\nconst blockedPaths = [\n\t'color',\n\t'border',\n\t'dimensions',\n\t'typography',\n\t'spacing',\n];\n\nconst deprecatedFlags = {\n\t'color.palette': ( settings ) => settings.colors,\n\t'color.gradients': ( settings ) => settings.gradients,\n\t'color.custom': ( settings ) =>\n\t\tsettings.disableCustomColors === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomColors,\n\t'color.customGradient': ( settings ) =>\n\t\tsettings.disableCustomGradients === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomGradients,\n\t'typography.fontSizes': ( settings ) => settings.fontSizes,\n\t'typography.customFontSize': ( settings ) =>\n\t\tsettings.disableCustomFontSizes === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomFontSizes,\n\t'typography.lineHeight': ( settings ) => settings.enableCustomLineHeight,\n\t'spacing.units': ( settings ) => {\n\t\tif ( settings.enableCustomUnits === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( settings.enableCustomUnits === true ) {\n\t\t\treturn [ 'px', 'em', 'rem', 'vh', 'vw', '%' ];\n\t\t}\n\n\t\treturn settings.enableCustomUnits;\n\t},\n\t'spacing.padding': ( settings ) => settings.enableCustomSpacing,\n};\n\nconst prefixedFlags = {\n\t/*\n\t * These were only available in the plugin\n\t * and can be removed when the minimum WordPress version\n\t * for the plugin is 5.9.\n\t */\n\t'border.customColor': 'border.color',\n\t'border.customStyle': 'border.style',\n\t'border.customWidth': 'border.width',\n\t'typography.customFontStyle': 'typography.fontStyle',\n\t'typography.customFontWeight': 'typography.fontWeight',\n\t'typography.customLetterSpacing': 'typography.letterSpacing',\n\t'typography.customTextDecorations': 'typography.textDecoration',\n\t'typography.customTextTransforms': 'typography.textTransform',\n\t/*\n\t * These were part of WordPress 5.8 and we need to keep them.\n\t */\n\t'border.customRadius': 'border.radius',\n\t'spacing.customMargin': 'spacing.margin',\n\t'spacing.customPadding': 'spacing.padding',\n\t'typography.customLineHeight': 'typography.lineHeight',\n};\n\n/**\n * Remove `custom` prefixes for flags that did not land in 5.8.\n *\n * This provides continued support for `custom` prefixed properties. It will\n * be removed once third party devs have had sufficient time to update themes,\n * plugins, etc.\n *\n * @see https://github.com/WordPress/gutenberg/pull/34485\n *\n * @param {string} path Path to desired value in settings.\n * @return {string} The value for defined setting.\n */\nconst removeCustomPrefixes = ( path ) => {\n\treturn prefixedFlags[ path ] || path;\n};\n\n/**\n * For settings like `color.palette`, which have a value that is an object\n * with `default`, `theme`, `custom`, with field values that are arrays of\n * items, merge these three arrays into one and return it. The calculation\n * is memoized so that identical input values produce identical output.\n * @param {Object} value Object to merge\n * @return {Array} Array of merged items\n */\nexport function mergeOrigins( value ) {\n\tlet result = mergeCache.get( value );\n\tif ( ! result ) {\n\t\tresult = [ 'default', 'theme', 'custom' ].flatMap(\n\t\t\t( key ) => value[ key ] ?? []\n\t\t);\n\t\tmergeCache.set( value, result );\n\t}\n\treturn result;\n}\nconst mergeCache = new WeakMap();\n\n/**\n * For settings like `color.palette`, which have a value that is an object\n * with `default`, `theme`, `custom`, with field values that are arrays of\n * items, see if any of the three origins have values.\n *\n * @param {Object} value Object to check\n * @return {boolean} Whether the object has values in any of the three origins\n */\nexport function hasMergedOrigins( value ) {\n\treturn [ 'default', 'theme', 'custom' ].some(\n\t\t( key ) => value?.[ key ]?.length\n\t);\n}\n\n/**\n * Hook that retrieves the given settings for the block instance in use.\n *\n * It looks up the settings first in the block instance hierarchy.\n * If none are found, it'll look them up in the block editor settings.\n *\n * @param {string[]} paths The paths to the settings.\n * @return {any[]} Returns the values defined for the settings.\n * @example\n * ```js\n * const [ fixed, sticky ] = useSettings( 'position.fixed', 'position.sticky' );\n * ```\n */\nexport function useSettings( ...paths ) {\n\tconst { name: blockName, clientId = null } = useBlockEditContext();\n\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tpaths = useMemo( () => paths, paths );\n\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst candidates = clientId\n\t\t\t\t? [\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t...select( blockEditorStore ).getBlockParents(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t/* ascending */ true\n\t\t\t\t\t\t),\n\t\t\t\t ].filter( ( candidateClientId ) => {\n\t\t\t\t\t\tconst candidateBlockName =\n\t\t\t\t\t\t\tselect( blockEditorStore ).getBlockName(\n\t\t\t\t\t\t\t\tcandidateClientId\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\treturn hasBlockSupport(\n\t\t\t\t\t\t\tcandidateBlockName,\n\t\t\t\t\t\t\t'__experimentalSettings',\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t);\n\t\t\t\t } )\n\t\t\t\t: [];\n\n\t\t\treturn paths.map( ( path ) => {\n\t\t\t\tif ( blockedPaths.includes( path ) ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t'Top level useSetting paths are disabled. Please use a subpath to query the information needed.'\n\t\t\t\t\t);\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\t// 0. Allow third parties to filter the block's settings at runtime.\n\t\t\t\tlet result = applyFilters(\n\t\t\t\t\t'blockEditor.useSetting.before',\n\t\t\t\t\tundefined,\n\t\t\t\t\tpath,\n\t\t\t\t\tclientId,\n\t\t\t\t\tblockName\n\t\t\t\t);\n\n\t\t\t\tif ( undefined !== result ) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tconst normalizedPath = removeCustomPrefixes( path );\n\n\t\t\t\t// 1. Take settings from the block instance or its ancestors.\n\t\t\t\t// Start from the current block and work our way up the ancestors.\n\t\t\t\tfor ( const candidateClientId of candidates ) {\n\t\t\t\t\tconst candidateAtts =\n\t\t\t\t\t\tselect( blockEditorStore ).getBlockAttributes(\n\t\t\t\t\t\t\tcandidateClientId\n\t\t\t\t\t\t);\n\t\t\t\t\tresult =\n\t\t\t\t\t\tgetValueFromObjectPath(\n\t\t\t\t\t\t\tcandidateAtts.settings?.blocks?.[ blockName ],\n\t\t\t\t\t\t\tnormalizedPath\n\t\t\t\t\t\t) ??\n\t\t\t\t\t\tgetValueFromObjectPath(\n\t\t\t\t\t\t\tcandidateAtts.settings,\n\t\t\t\t\t\t\tnormalizedPath\n\t\t\t\t\t\t);\n\t\t\t\t\tif ( result !== undefined ) {\n\t\t\t\t\t\t// Stop the search for more distant ancestors and move on.\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// 2. Fall back to the settings from the block editor store (__experimentalFeatures).\n\t\t\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\t\t\tif ( result === undefined && blockName ) {\n\t\t\t\t\tresult = getValueFromObjectPath(\n\t\t\t\t\t\tsettings.__experimentalFeatures?.blocks?.[ blockName ],\n\t\t\t\t\t\tnormalizedPath\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif ( result === undefined ) {\n\t\t\t\t\tresult = getValueFromObjectPath(\n\t\t\t\t\t\tsettings.__experimentalFeatures,\n\t\t\t\t\t\tnormalizedPath\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Return if the setting was found in either the block instance or the store.\n\t\t\t\tif ( result !== undefined ) {\n\t\t\t\t\tif ( PATHS_WITH_MERGE[ normalizedPath ] ) {\n\t\t\t\t\t\treturn mergeOrigins( result );\n\t\t\t\t\t}\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\t// 3. Otherwise, use deprecated settings.\n\t\t\t\tconst deprecatedSettingsValue =\n\t\t\t\t\tdeprecatedFlags[ normalizedPath ]?.( settings );\n\t\t\t\tif ( deprecatedSettingsValue !== undefined ) {\n\t\t\t\t\treturn deprecatedSettingsValue;\n\t\t\t\t}\n\n\t\t\t\t// 4. Fallback for typography.dropCap:\n\t\t\t\t// This is only necessary to support typography.dropCap.\n\t\t\t\t// when __experimentalFeatures are not present (core without plugin).\n\t\t\t\t// To remove when __experimentalFeatures are ported to core.\n\t\t\t\treturn normalizedPath === 'typography.dropCap'\n\t\t\t\t\t? true\n\t\t\t\t\t: undefined;\n\t\t\t} );\n\t\t},\n\t\t[ blockName, clientId, paths ]\n\t);\n}\n\n/**\n * Hook that retrieves the given setting for the block instance in use.\n *\n * It looks up the setting first in the block instance hierarchy.\n * If none is found, it'll look it up in the block editor settings.\n *\n * @param {string} path The path to the setting.\n * @return {any} Returns the value defined for the setting.\n * @deprecated 6.5.0 Use useSettings instead.\n * @example\n * ```js\n * const isEnabled = useSetting( 'typography.dropCap' );\n * ```\n */\nexport function useSetting( path ) {\n\tdeprecated( 'wp.blockEditor.useSetting', {\n\t\tsince: '6.5',\n\t\talternative: 'wp.blockEditor.useSettings',\n\t\tnote: 'The new useSettings function can retrieve multiple settings at once, with better performance.',\n\t} );\n\n\tconst [ value ] = useSettings( path );\n\treturn value;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,+BAA+B,IAAIC,gBAAgB,EACnDC,eAAe,QACT,mBAAmB;AAC1B,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,YAAY,QAAQ,kBAAkB;;AAE/C;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,sBAAsB,QAAQ,oBAAoB;AAE3D,MAAMC,YAAY,GAAG,CACpB,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,SAAS,CACT;AAED,MAAMC,eAAe,GAAG;EACvB,eAAe,EAAIC,QAAQ,IAAMA,QAAQ,CAACC,MAAM;EAChD,iBAAiB,EAAID,QAAQ,IAAMA,QAAQ,CAACE,SAAS;EACrD,cAAc,EAAIF,QAAQ,IACzBA,QAAQ,CAACG,mBAAmB,KAAKC,SAAS,GACvCA,SAAS,GACT,CAAEJ,QAAQ,CAACG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oD,WAAW,CAAC,CAAC;MACzD,IAAKhC,MAAM,KAAKZ,SAAS,IAAI0B,SAAS,EAAG;QACxCd,MAAM,GAAGnB,sBAAsB,CAC9BG,QAAQ,CAACiD,sBAAsB,EAAEF,MAAM,GAAIjB,SAAS,CAAE,EACtDa,cACD,CAAC;MACF;MAEA,IAAK3B,MAAM,KAAKZ,SAAS,EAAG;QAC3BY,MAAM,GAAGnB,sBAAsB,CAC9BG,QAAQ,CAACiD,sBAAsB,EAC/BN,cACD,CAAC;MACF;;MAEA;MACA,IAAK3B,MAAM,KAAKZ,SAAS,EAAG;QAC3B,IAAKhB,gBAAgB,CAAEuD,cAAc,CAAE,EAAG;UACzC,OAAO7B,YAAY,CAAEE,MAAO,CAAC;QAC9B;QACA,OAAOA,MAAM;MACd;;MAEA;MACA,MAAMkC,uBAAuB,GAC5BnD,eAAe,CAAE4C,cAAc,CAAE,GAAI3C,QAAS,CAAC;MAChD,IAAKkD,uBAAuB,KAAK9C,SAAS,EAAG;QAC5C,OAAO8C,uBAAuB;MAC/B;;MAEA;MACA;MACA;MACA;MACA,OAAOP,cAAc,KAAK,oBAAoB,GAC3C,IAAI,GACJvC,SAAS;IACb,CAAE,CAAC;EACJ,CAAC,EACD,CAAE0B,SAAS,EAAEC,QAAQ,EAAEH,KAAK,CAC7B,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASuB,UAAUA,CAAEtC,IAAI,EAAG;EAClCtB,UAAU,CAAE,2BAA2B,EAAE;IACxC6D,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE,4BAA4B;IACzCC,IAAI,EAAE;EACP,CAAE,CAAC;EAEH,MAAM,CAAEvC,KAAK,CAAE,GAAGY,WAAW,CAAEd,IAAK,CAAC;EACrC,OAAOE,KAAK;AACb"}
1
+ {"version":3,"names":["useSelect","deprecated","useBlockEditContext","store","blockEditorStore","unlock","useSettings","paths","clientId","select","getBlockSettings","useSetting","path","since","alternative","note","value"],"sources":["@wordpress/block-editor/src/components/use-settings/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Hook that retrieves the given settings for the block instance in use.\n *\n * It looks up the settings first in the block instance hierarchy.\n * If none are found, it'll look them up in the block editor settings.\n *\n * @param {string[]} paths The paths to the settings.\n * @return {any[]} Returns the values defined for the settings.\n * @example\n * ```js\n * const [ fixed, sticky ] = useSettings( 'position.fixed', 'position.sticky' );\n * ```\n */\nexport function useSettings( ...paths ) {\n\tconst { clientId = null } = useBlockEditContext();\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tunlock( select( blockEditorStore ) ).getBlockSettings(\n\t\t\t\tclientId,\n\t\t\t\t...paths\n\t\t\t),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ clientId, ...paths ]\n\t);\n}\n\n/**\n * Hook that retrieves the given setting for the block instance in use.\n *\n * It looks up the setting first in the block instance hierarchy.\n * If none is found, it'll look it up in the block editor settings.\n *\n * @param {string} path The path to the setting.\n * @return {any} Returns the value defined for the setting.\n * @deprecated 6.5.0 Use useSettings instead.\n * @example\n * ```js\n * const isEnabled = useSetting( 'typography.dropCap' );\n * ```\n */\nexport function useSetting( path ) {\n\tdeprecated( 'wp.blockEditor.useSetting', {\n\t\tsince: '6.5',\n\t\talternative: 'wp.blockEditor.useSettings',\n\t\tnote: 'The new useSettings function can retrieve multiple settings at once, with better performance.',\n\t} );\n\n\tconst [ value ] = useSettings( path );\n\treturn value;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAE,GAAGC,KAAK,EAAG;EACvC,MAAM;IAAEC,QAAQ,GAAG;EAAK,CAAC,GAAGN,mBAAmB,CAAC,CAAC;EACjD,OAAOF,SAAS,CACbS,MAAM,IACPJ,MAAM,CAAEI,MAAM,CAAEL,gBAAiB,CAAE,CAAC,CAACM,gBAAgB,CACpDF,QAAQ,EACR,GAAGD,KACJ,CAAC;EACF;EACA,CAAEC,QAAQ,EAAE,GAAGD,KAAK,CACrB,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,UAAUA,CAAEC,IAAI,EAAG;EAClCX,UAAU,CAAE,2BAA2B,EAAE;IACxCY,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE,4BAA4B;IACzCC,IAAI,EAAE;EACP,CAAE,CAAC;EAEH,MAAM,CAAEC,KAAK,CAAE,GAAGV,WAAW,CAAEM,IAAK,CAAC;EACrC,OAAOI,KAAK;AACb"}
@@ -1,17 +1,16 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { serialize, pasteHandler, createBlock, findTransform, getBlockTransforms } from '@wordpress/blocks';
5
- import { documentHasSelection, documentHasUncollapsedSelection, __unstableStripHTML as stripHTML } from '@wordpress/dom';
4
+ import { documentHasSelection, documentHasUncollapsedSelection } from '@wordpress/dom';
6
5
  import { useDispatch, useSelect } from '@wordpress/data';
7
6
  import { useRefEffect } from '@wordpress/compose';
8
7
 
9
8
  /**
10
9
  * Internal dependencies
11
10
  */
12
- import { getPasteEventData } from '../../utils/pasting';
13
11
  import { store as blockEditorStore } from '../../store';
14
12
  import { useNotifyCopy } from '../../utils/use-notify-copy';
13
+ import { getPasteBlocks, setClipboardBlocks } from './utils';
15
14
  export default function useClipboardHandler() {
16
15
  const {
17
16
  getBlocksByClientId,
@@ -87,13 +86,7 @@ export default function useClipboardHandler() {
87
86
  const inBetweenBlocks = getBlocksByClientId(selectedBlockClientIds.slice(1, selectedBlockClientIds.length - 1));
88
87
  blocks = [head, ...inBetweenBlocks, tail];
89
88
  }
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);
89
+ setClipboardBlocks(event, blocks);
97
90
  }
98
91
  }
99
92
  if (event.type === 'cut') {
@@ -110,29 +103,7 @@ export default function useClipboardHandler() {
110
103
  const {
111
104
  __experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML
112
105
  } = 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
- }
106
+ const blocks = getPasteBlocks(event, canUserUseUnfilteredHTML);
136
107
  if (selectedBlockClientIds.length === 1) {
137
108
  const [selectedBlockClientId] = selectedBlockClientIds;
138
109
  if (blocks.every(block => canInsertBlockType(block.name, selectedBlockClientId))) {
@@ -153,20 +124,4 @@ export default function useClipboardHandler() {
153
124
  };
154
125
  }, []);
155
126
  }
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
127
  //# sourceMappingURL=use-clipboard-handler.js.map
@@ -1 +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;IACXC,yBAAyB;IACzBC,8BAA8B;IAC9BC,8BAA8B;IAC9BC,+CAA+C;IAC/CC;EACD,CAAC,GAAGf,SAAS,CAAEI,gBAAiB,CAAC;EACjC,MAAM;IACLY,UAAU;IACVC,YAAY;IACZC,aAAa;IACbC,yBAAyB;IACzBC,yBAAyB;IACzBC;EACD,CAAC,GAAGtB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CACD,CAAC,EACA;YACDhD,YAAY,CACXkB,MAAM,EACNkC,SAAS,EACTJ,qBACD,CAAC;YACD;UACD;QACD;QAEAnD,aAAa,CACZS,sBAAsB,EACtBY,MAAM,EACNA,MAAM,CAACX,MAAM,GAAG,CAAC,EACjB,CAAC,CACF,CAAC;MACF;IACD;IAEAL,IAAI,CAACO,aAAa,CAAC4C,gBAAgB,CAAE,MAAM,EAAElD,OAAQ,CAAC;IACtDD,IAAI,CAACO,aAAa,CAAC4C,gBAAgB,CAAE,KAAK,EAAElD,OAAQ,CAAC;IACrDD,IAAI,CAACO,aAAa,CAAC4C,gBAAgB,CAAE,OAAO,EAAElD,OAAQ,CAAC;IAEvD,OAAO,MAAM;MACZD,IAAI,CAACO,aAAa,CAAC6C,mBAAmB,CAAE,MAAM,EAAEnD,OAAQ,CAAC;MACzDD,IAAI,CAACO,aAAa,CAAC6C,mBAAmB,CAAE,KAAK,EAAEnD,OAAQ,CAAC;MACxDD,IAAI,CAACO,aAAa,CAAC6C,mBAAmB,CAAE,OAAO,EAAEnD,OAAQ,CAAC;IAC3D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS2B,WAAWA,CAAEK,IAAI,EAAG;EAC5B;EACAA,IAAI,GAAGA,IAAI,CAACoB,OAAO,CAAE,OAAO,EAAE,IAAK,CAAC;EAEpC,MAAMrB,SAAS,GAAGzD,SAAS,CAAE0D,IAAK,CAAC,CAACqB,IAAI,CAAC,CAAC;;EAE1C;EACA,OAAOtB,SAAS,CAACqB,OAAO,CAAE,QAAQ,EAAE,MAAO,CAAC;AAC7C"}
1
+ {"version":3,"names":["documentHasSelection","documentHasUncollapsedSelection","useDispatch","useSelect","useRefEffect","store","blockEditorStore","useNotifyCopy","getPasteBlocks","setClipboardBlocks","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","contentEditable","__experimentalCanUserUseUnfilteredHTML","canUserUseUnfilteredHTML","selectedBlockClientId","every","block","name","undefined","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-clipboard-handler.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tdocumentHasSelection,\n\tdocumentHasUncollapsedSelection,\n} from '@wordpress/dom';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useNotifyCopy } from '../../utils/use-notify-copy';\nimport { getPasteBlocks, setClipboardBlocks } from './utils';\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\tsetClipboardBlocks( event, blocks );\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 blocks = getPasteBlocks(\n\t\t\t\t\tevent,\n\t\t\t\t\tcanUserUseUnfilteredHTML\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"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,oBAAoB,EACpBC,+BAA+B,QACzB,gBAAgB;AACvB,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,oBAAoB;;AAEjD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,aAAa,QAAQ,6BAA6B;AAC3D,SAASC,cAAc,EAAEC,kBAAkB,QAAQ,SAAS;AAE5D,eAAe,SAASC,mBAAmBA,CAAA,EAAG;EAC7C,MAAM;IACLC,mBAAmB;IACnBC,yBAAyB;IACzBC,iBAAiB;IACjBC,WAAW;IACXC,yBAAyB;IACzBC,8BAA8B;IAC9BC,8BAA8B;IAC9BC,+CAA+C;IAC/CC;EACD,CAAC,GAAGhB,SAAS,CAAEG,gBAAiB,CAAC;EACjC,MAAM;IACLc,UAAU;IACVC,YAAY;IACZC,aAAa;IACbC,yBAAyB;IACzBC,y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B;UAExD,IACCY,MAAM,CAACS,KAAK,CAAIC,KAAK,IACpBlC,kBAAkB,CACjBkC,KAAK,CAACC,IAAI,EACVH,qBACD,CACD,CAAC,EACA;YACD1B,YAAY,CACXkB,MAAM,EACNY,SAAS,EACTJ,qBACD,CAAC;YACD;UACD;QACD;QAEA7B,aAAa,CACZS,sBAAsB,EACtBY,MAAM,EACNA,MAAM,CAACX,MAAM,GAAG,CAAC,EACjB,CAAC,CACF,CAAC;MACF;IACD;IAEAL,IAAI,CAACO,aAAa,CAACsB,gBAAgB,CAAE,MAAM,EAAE5B,OAAQ,CAAC;IACtDD,IAAI,CAACO,aAAa,CAACsB,gBAAgB,CAAE,KAAK,EAAE5B,OAAQ,CAAC;IACrDD,IAAI,CAACO,aAAa,CAACsB,gBAAgB,CAAE,OAAO,EAAE5B,OAAQ,CAAC;IAEvD,OAAO,MAAM;MACZD,IAAI,CAACO,aAAa,CAACuB,mBAAmB,CAAE,MAAM,EAAE7B,OAAQ,CAAC;MACzDD,IAAI,CAACO,aAAa,CAACuB,mBAAmB,CAAE,KAAK,EAAE7B,OAAQ,CAAC;MACxDD,IAAI,CAACO,aAAa,CAACuB,mBAAmB,CAAE,OAAO,EAAE7B,OAAQ,CAAC;IAC3D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR"}
@@ -64,19 +64,30 @@ export default function useDragSelection() {
64
64
  setContentEditableWrapper(node, false);
65
65
  const selection = defaultView.getSelection();
66
66
  if (selection.rangeCount) {
67
+ const range = selection.getRangeAt(0);
67
68
  const {
68
69
  commonAncestorContainer
69
- } = selection.getRangeAt(0);
70
+ } = range;
71
+ const clonedRange = range.cloneRange();
70
72
  if (anchorElement.contains(commonAncestorContainer)) {
71
73
  anchorElement.focus();
74
+ selection.removeAllRanges();
75
+ selection.addRange(clonedRange);
72
76
  }
73
77
  }
74
78
  });
75
79
  }
76
80
  function onMouseLeave({
77
81
  buttons,
78
- target
82
+ target,
83
+ relatedTarget
79
84
  }) {
85
+ // If we're moving into a child element, ignore. We're tracking
86
+ // the mouse leaving the element to a parent, no a child.
87
+ if (target.contains(relatedTarget)) {
88
+ return;
89
+ }
90
+
80
91
  // Avoid triggering a multi-selection if the user is already
81
92
  // dragging blocks.
82
93
  if (isDraggingBlocks()) {
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","useRefEffect","store","blockEditorStore","setContentEditableWrapper","node","value","contentEditable","focus","useDragSelection","startMultiSelect","stopMultiSelect","isSelectionEnabled","hasSelectedBlock","isDraggingBlocks","isMultiSelecting","ownerDocument","defaultView","anchorElement","rafId","onMouseUp","removeEventListener","requestAnimationFrame","selection","getSelection","rangeCount","commonAncestorContainer","getRangeAt","contains","onMouseLeave","buttons","target","getAttribute","addEventListener","cancelAnimationFrame"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-drag-selection.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Sets the `contenteditable` wrapper element to `value`.\n *\n * @param {HTMLElement} node Block element.\n * @param {boolean} value `contentEditable` value (true or false)\n */\nfunction setContentEditableWrapper( node, value ) {\n\tnode.contentEditable = value;\n\t// Firefox doesn't automatically move focus.\n\tif ( value ) node.focus();\n}\n\n/**\n * Sets a multi-selection based on the native selection across blocks.\n */\nexport default function useDragSelection() {\n\tconst { startMultiSelect, stopMultiSelect } =\n\t\tuseDispatch( blockEditorStore );\n\tconst {\n\t\tisSelectionEnabled,\n\t\thasSelectedBlock,\n\t\tisDraggingBlocks,\n\t\tisMultiSelecting,\n\t} = useSelect( blockEditorStore );\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\tlet anchorElement;\n\t\t\tlet rafId;\n\n\t\t\tfunction onMouseUp() {\n\t\t\t\tstopMultiSelect();\n\t\t\t\t// Equivalent to attaching the listener once.\n\t\t\t\tdefaultView.removeEventListener( 'mouseup', onMouseUp );\n\t\t\t\t// The browser selection won't have updated yet at this point,\n\t\t\t\t// so wait until the next animation frame to get the browser\n\t\t\t\t// selection.\n\t\t\t\trafId = defaultView.requestAnimationFrame( () => {\n\t\t\t\t\tif ( ! hasSelectedBlock() ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// If the selection is complete (on mouse up), and no\n\t\t\t\t\t// multiple blocks have been selected, set focus back to the\n\t\t\t\t\t// anchor element. if the anchor element contains the\n\t\t\t\t\t// selection. Additionally, the contentEditable wrapper can\n\t\t\t\t\t// now be disabled again.\n\t\t\t\t\tsetContentEditableWrapper( node, false );\n\n\t\t\t\t\tconst selection = defaultView.getSelection();\n\n\t\t\t\t\tif ( selection.rangeCount ) {\n\t\t\t\t\t\tconst { commonAncestorContainer } =\n\t\t\t\t\t\t\tselection.getRangeAt( 0 );\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tanchorElement.contains( commonAncestorContainer )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tanchorElement.focus();\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\tfunction onMouseLeave( { buttons, target } ) {\n\t\t\t\t// Avoid triggering a multi-selection if the user is already\n\t\t\t\t// dragging blocks.\n\t\t\t\tif ( isDraggingBlocks() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// The primary button must be pressed to initiate selection.\n\t\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons\n\t\t\t\tif ( buttons !== 1 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Abort if we are already multi-selecting.\n\t\t\t\tif ( isMultiSelecting() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Abort if selection is leaving writing flow.\n\t\t\t\tif ( node === target ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Check the attribute, not the contentEditable attribute. All\n\t\t\t\t// child elements of the content editable wrapper are editable\n\t\t\t\t// and return true for this property. We only want to start\n\t\t\t\t// multi selecting when the mouse leaves the wrapper.\n\t\t\t\tif ( target.getAttribute( 'contenteditable' ) !== 'true' ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( ! isSelectionEnabled() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Do not rely on the active element because it may change after\n\t\t\t\t// the mouse leaves for the first time. See\n\t\t\t\t// https://github.com/WordPress/gutenberg/issues/48747.\n\t\t\t\tanchorElement = target;\n\n\t\t\t\tstartMultiSelect();\n\n\t\t\t\t// `onSelectionStart` is called after `mousedown` and\n\t\t\t\t// `mouseleave` (from a block). The selection ends when\n\t\t\t\t// `mouseup` happens anywhere in the window.\n\t\t\t\tdefaultView.addEventListener( 'mouseup', onMouseUp );\n\n\t\t\t\t// Allow cross contentEditable selection by temporarily making\n\t\t\t\t// all content editable. We can't rely on using the store and\n\t\t\t\t// React because re-rending happens too slowly. We need to be\n\t\t\t\t// able to select across instances immediately.\n\t\t\t\tsetContentEditableWrapper( node, true );\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'mouseout', onMouseLeave );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'mouseout', onMouseLeave );\n\t\t\t\tdefaultView.removeEventListener( 'mouseup', onMouseUp );\n\t\t\t\tdefaultView.cancelAnimationFrame( rafId );\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tstartMultiSelect,\n\t\t\tstopMultiSelect,\n\t\t\tisSelectionEnabled,\n\t\t\thasSelectedBlock,\n\t\t]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,oBAAoB;;AAEjD;AACA;AACA;AACA,SAASC,KAA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QACD;MACD,CAAE,CAAC;IACJ;IAEA,SAASqB,YAAYA,CAAE;MAAEC,OAAO;MAAEC;IAAO,CAAC,EAAG;MAC5C;MACA;MACA,IAAKjB,gBAAgB,CAAC,CAAC,EAAG;QACzB;MACD;;MAEA;MACA;MACA,IAAKgB,OAAO,KAAK,CAAC,EAAG;QACpB;MACD;;MAEA;MACA,IAAKf,gBAAgB,CAAC,CAAC,EAAG;QACzB;MACD;;MAEA;MACA,IAAKV,IAAI,KAAK0B,MAAM,EAAG;QACtB;MACD;;MAEA;MACA;MACA;MACA;MACA,IAAKA,MAAM,CAACC,YAAY,CAAE,iBAAkB,CAAC,KAAK,MAAM,EAAG;QAC1D;MACD;MAEA,IAAK,CAAEpB,kBAAkB,CAAC,CAAC,EAAG;QAC7B;MACD;;MAEA;MACA;MACA;MACAM,aAAa,GAAGa,MAAM;MAEtBrB,gBAAgB,CAAC,CAAC;;MAElB;MACA;MACA;MACAO,WAAW,CAACgB,gBAAgB,CAAE,SAAS,EAAEb,SAAU,CAAC;;MAEpD;MACA;MACA;MACA;MACAhB,yBAAyB,CAAEC,IAAI,EAAE,IAAK,CAAC;IACxC;IAEAA,IAAI,CAAC4B,gBAAgB,CAAE,UAAU,EAAEJ,YAAa,CAAC;IAEjD,OAAO,MAAM;MACZxB,IAAI,CAACgB,mBAAmB,CAAE,UAAU,EAAEQ,YAAa,CAAC;MACpDZ,WAAW,CAACI,mBAAmB,CAAE,SAAS,EAAED,SAAU,CAAC;MACvDH,WAAW,CAACiB,oBAAoB,CAAEf,KAAM,CAAC;IAC1C,CAAC;EACF,CAAC,EACD,CACCT,gBAAgB,EAChBC,eAAe,EACfC,kBAAkB,EAClBC,gBAAgB,CAElB,CAAC;AACF"}
1
+ {"version":3,"names":["useSelect","useDispatch","useRefEffect","store","blockEditorStore","setContentEditableWrapper","node","value","contentEditable","focus","useDragSelection","startMultiSelect","stopMultiSelect","isSelectionEnabled","hasSelectedBlock","isDraggingBlocks","isMultiSelecting","ownerDocument","defaultView","anchorElement","rafId","onMouseUp","removeEventListener","requestAnimationFrame","selection","getSelection","rangeCount","range","getRangeAt","commonAncestorContainer","clonedRange","cloneRange","contains","removeAllRanges","addRange","onMouseLeave","buttons","target","relatedTarget","getAttribute","addEventListener","cancelAnimationFrame"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-drag-selection.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Sets the `contenteditable` wrapper element to `value`.\n *\n * @param {HTMLElement} node Block element.\n * @param {boolean} value `contentEditable` value (true or false)\n */\nfunction setContentEditableWrapper( node, value ) {\n\tnode.contentEditable = value;\n\t// Firefox doesn't automatically move focus.\n\tif ( value ) node.focus();\n}\n\n/**\n * Sets a multi-selection based on the native selection across blocks.\n */\nexport default function useDragSelection() {\n\tconst { startMultiSelect, stopMultiSelect } =\n\t\tuseDispatch( blockEditorStore );\n\tconst {\n\t\tisSelectionEnabled,\n\t\thasSelectedBlock,\n\t\tisDraggingBlocks,\n\t\tisMultiSelecting,\n\t} = useSelect( blockEditorStore );\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\tlet anchorElement;\n\t\t\tlet rafId;\n\n\t\t\tfunction onMouseUp() {\n\t\t\t\tstopMultiSelect();\n\t\t\t\t// Equivalent to attaching the listener once.\n\t\t\t\tdefaultView.removeEventListener( 'mouseup', onMouseUp );\n\t\t\t\t// The browser selection won't have updated yet at this point,\n\t\t\t\t// so wait until the next animation frame to get the browser\n\t\t\t\t// selection.\n\t\t\t\trafId = defaultView.requestAnimationFrame( () => {\n\t\t\t\t\tif ( ! hasSelectedBlock() ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// If the selection is complete (on mouse up), and no\n\t\t\t\t\t// multiple blocks have been selected, set focus back to the\n\t\t\t\t\t// anchor element. if the anchor element contains the\n\t\t\t\t\t// selection. Additionally, the contentEditable wrapper can\n\t\t\t\t\t// now be disabled again.\n\t\t\t\t\tsetContentEditableWrapper( node, false );\n\n\t\t\t\t\tconst selection = defaultView.getSelection();\n\n\t\t\t\t\tif ( selection.rangeCount ) {\n\t\t\t\t\t\tconst range = selection.getRangeAt( 0 );\n\t\t\t\t\t\tconst { commonAncestorContainer } = range;\n\t\t\t\t\t\tconst clonedRange = range.cloneRange();\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tanchorElement.contains( commonAncestorContainer )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tanchorElement.focus();\n\t\t\t\t\t\t\tselection.removeAllRanges();\n\t\t\t\t\t\t\tselection.addRange( clonedRange );\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\tfunction onMouseLeave( { buttons, target, relatedTarget } ) {\n\t\t\t\t// If we're moving into a child element, ignore. We're tracking\n\t\t\t\t// the mouse leaving the element to a parent, no a child.\n\t\t\t\tif ( target.contains( relatedTarget ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Avoid triggering a multi-selection if the user is already\n\t\t\t\t// dragging blocks.\n\t\t\t\tif ( isDraggingBlocks() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// The primary button must be pressed to initiate selection.\n\t\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons\n\t\t\t\tif ( buttons !== 1 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Abort if we are already multi-selecting.\n\t\t\t\tif ( isMultiSelecting() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Abort if selection is leaving writing flow.\n\t\t\t\tif ( node === target ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Check the attribute, not the contentEditable attribute. All\n\t\t\t\t// child elements of the content editable wrapper are editable\n\t\t\t\t// and return true for this property. We only want to start\n\t\t\t\t// multi selecting when the mouse leaves the wrapper.\n\t\t\t\tif ( target.getAttribute( 'contenteditable' ) !== 'true' ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( ! isSelectionEnabled() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Do not rely on the active element because it may change after\n\t\t\t\t// the mouse leaves for the first time. See\n\t\t\t\t// https://github.com/WordPress/gutenberg/issues/48747.\n\t\t\t\tanchorElement = target;\n\n\t\t\t\tstartMultiSelect();\n\n\t\t\t\t// `onSelectionStart` is called after `mousedown` and\n\t\t\t\t// `mouseleave` (from a block). The selection ends when\n\t\t\t\t// `mouseup` happens anywhere in the window.\n\t\t\t\tdefaultView.addEventListener( 'mouseup', onMouseUp );\n\n\t\t\t\t// Allow cross contentEditable selection by temporarily making\n\t\t\t\t// all content editable. We can't rely on using the store and\n\t\t\t\t// React because re-rending happens too slowly. We need to be\n\t\t\t\t// able to select across instances immediately.\n\t\t\t\tsetContentEditableWrapper( node, true );\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'mouseout', onMouseLeave );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'mouseout', onMouseLeave );\n\t\t\t\tdefaultView.removeEventListener( 'mouseup', onMouseUp );\n\t\t\t\tdefaultView.cancelAnimationFrame( rafId );\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tstartMultiSelect,\n\t\t\tstopMultiSelect,\n\t\t\tisSelectionEnabled,\n\t\t\thasSelectedBlock,\n\t\t]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,oBAAoB;;AAEjD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;;AAEvD;AACA;AAC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