@wordpress/block-editor 12.15.0 → 12.16.1-next.79a6196f.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 (927) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/README.md +12 -10
  4. package/build/components/block-canvas/index.js +21 -7
  5. package/build/components/block-canvas/index.js.map +1 -1
  6. package/build/components/block-card/index.js +2 -2
  7. package/build/components/block-card/index.js.map +1 -1
  8. package/build/components/block-controls/hook.js +3 -23
  9. package/build/components/block-controls/hook.js.map +1 -1
  10. package/build/components/block-draggable/draggable-chip.js +6 -1
  11. package/build/components/block-draggable/draggable-chip.js.map +1 -1
  12. package/build/components/block-draggable/index.js +76 -6
  13. package/build/components/block-draggable/index.js.map +1 -1
  14. package/build/components/block-draggable/index.native.js +0 -6
  15. package/build/components/block-draggable/index.native.js.map +1 -1
  16. package/build/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
  17. package/build/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
  18. package/build/components/block-edit/context.js +5 -1
  19. package/build/components/block-edit/context.js.map +1 -1
  20. package/build/components/block-edit/index.js +18 -9
  21. package/build/components/block-edit/index.js.map +1 -1
  22. package/build/components/block-editing-mode/index.js +2 -3
  23. package/build/components/block-editing-mode/index.js.map +1 -1
  24. package/build/components/block-info-slot-fill/index.js +3 -4
  25. package/build/components/block-info-slot-fill/index.js.map +1 -1
  26. package/build/components/block-inspector/index.js +1 -1
  27. package/build/components/block-inspector/index.js.map +1 -1
  28. package/build/components/block-list/block-list-item-cell.native.js +1 -0
  29. package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
  30. package/build/components/block-list/block.js +257 -95
  31. package/build/components/block-list/block.js.map +1 -1
  32. package/build/components/block-list/block.native.js +58 -23
  33. package/build/components/block-list/block.native.js.map +1 -1
  34. package/build/components/block-list/index.native.js +3 -5
  35. package/build/components/block-list/index.native.js.map +1 -1
  36. package/build/components/block-list/private-block-context.js +14 -0
  37. package/build/components/block-list/private-block-context.js.map +1 -0
  38. package/build/components/block-list/use-block-props/index.js +49 -69
  39. package/build/components/block-list/use-block-props/index.js.map +1 -1
  40. package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -29
  41. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  42. package/build/components/block-list/use-block-props/use-is-hovered.js +4 -14
  43. package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  44. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
  45. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  46. package/build/components/block-list/use-in-between-inserter.js +3 -2
  47. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  48. package/build/components/block-list/use-scroll-upon-insertion.native.js +41 -0
  49. package/build/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
  50. package/build/components/block-lock/toolbar.js +21 -27
  51. package/build/components/block-lock/toolbar.js.map +1 -1
  52. package/build/components/block-mover/index.js +2 -1
  53. package/build/components/block-mover/index.js.map +1 -1
  54. package/build/components/block-patterns-list/index.js +5 -5
  55. package/build/components/block-patterns-list/index.js.map +1 -1
  56. package/build/components/block-removal-warning-modal/index.js +2 -9
  57. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  58. package/build/components/block-rename/modal.js +3 -0
  59. package/build/components/block-rename/modal.js.map +1 -1
  60. package/build/components/block-settings/container.native.js +6 -4
  61. package/build/components/block-settings/container.native.js.map +1 -1
  62. package/build/components/block-styles/index.js +1 -1
  63. package/build/components/block-styles/index.js.map +1 -1
  64. package/build/components/block-styles/index.native.js +3 -2
  65. package/build/components/block-styles/index.native.js.map +1 -1
  66. package/build/components/block-switcher/index.js +4 -4
  67. package/build/components/block-switcher/index.js.map +1 -1
  68. package/build/components/block-toolbar/index.js +90 -29
  69. package/build/components/block-toolbar/index.js.map +1 -1
  70. package/build/components/block-tools/block-toolbar-breadcrumb.js +49 -0
  71. package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
  72. package/build/components/block-tools/block-toolbar-popover.js +84 -0
  73. package/build/components/block-tools/block-toolbar-popover.js.map +1 -0
  74. package/build/components/block-tools/index.js +27 -24
  75. package/build/components/block-tools/index.js.map +1 -1
  76. package/build/components/block-types-list/index.native.js +4 -3
  77. package/build/components/block-types-list/index.native.js.map +1 -1
  78. package/build/components/block-variation-picker/index.native.js +2 -1
  79. package/build/components/block-variation-picker/index.native.js.map +1 -1
  80. package/build/components/block-variation-transforms/index.js +29 -2
  81. package/build/components/block-variation-transforms/index.js.map +1 -1
  82. package/build/components/border-radius-control/linked-button.js +1 -1
  83. package/build/components/border-radius-control/linked-button.js.map +1 -1
  84. package/build/components/colors/utils.js +10 -2
  85. package/build/components/colors/utils.js.map +1 -1
  86. package/build/components/colors/with-colors.js +6 -2
  87. package/build/components/colors/with-colors.js.map +1 -1
  88. package/build/components/colors-gradients/control.js +28 -17
  89. package/build/components/colors-gradients/control.js.map +1 -1
  90. package/build/components/duotone-control/index.js +1 -4
  91. package/build/components/duotone-control/index.js.map +1 -1
  92. package/build/components/font-sizes/utils.js +10 -2
  93. package/build/components/font-sizes/utils.js.map +1 -1
  94. package/build/components/global-styles/border-panel.js +2 -1
  95. package/build/components/global-styles/border-panel.js.map +1 -1
  96. package/build/components/global-styles/color-panel.js +24 -21
  97. package/build/components/global-styles/color-panel.js.map +1 -1
  98. package/build/components/global-styles/dimensions-panel.js +4 -3
  99. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  100. package/build/components/global-styles/effects-panel.js +2 -1
  101. package/build/components/global-styles/effects-panel.js.map +1 -1
  102. package/build/components/global-styles/filters-panel.js +6 -3
  103. package/build/components/global-styles/filters-panel.js.map +1 -1
  104. package/build/components/global-styles/get-global-styles-changes.js +192 -0
  105. package/build/components/global-styles/get-global-styles-changes.js.map +1 -0
  106. package/build/components/global-styles/hooks.js +3 -2
  107. package/build/components/global-styles/hooks.js.map +1 -1
  108. package/build/components/global-styles/image-settings-panel.js +7 -1
  109. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  110. package/build/components/global-styles/index.js +7 -0
  111. package/build/components/global-styles/index.js.map +1 -1
  112. package/build/components/global-styles/typography-panel.js +43 -36
  113. package/build/components/global-styles/typography-panel.js.map +1 -1
  114. package/build/components/global-styles/use-global-styles-output.js +22 -8
  115. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  116. package/build/components/global-styles/utils.js +8 -1
  117. package/build/components/global-styles/utils.js.map +1 -1
  118. package/build/components/height-control/index.js +6 -2
  119. package/build/components/height-control/index.js.map +1 -1
  120. package/build/components/image-link-destinations/index.native.js +118 -0
  121. package/build/components/image-link-destinations/index.native.js.map +1 -0
  122. package/build/components/image-size-control/index.js +2 -2
  123. package/build/components/image-size-control/index.js.map +1 -1
  124. package/build/components/index.native.js +14 -5
  125. package/build/components/index.native.js.map +1 -1
  126. package/build/components/inner-blocks/index.js +61 -22
  127. package/build/components/inner-blocks/index.js.map +1 -1
  128. package/build/components/inner-blocks/index.native.js +18 -4
  129. package/build/components/inner-blocks/index.native.js.map +1 -1
  130. package/build/components/inner-blocks/use-inner-block-template-sync.js +5 -6
  131. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  132. package/build/components/inner-blocks/use-nested-settings-update.js +5 -9
  133. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  134. package/build/components/inserter/block-patterns-explorer/pattern-list.js +1 -1
  135. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  136. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +10 -9
  137. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  138. package/build/components/inserter/block-patterns-tab/patterns-filter.js +10 -10
  139. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  140. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +9 -9
  141. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  142. package/build/components/inserter/block-patterns-tab/utils.js +10 -14
  143. package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
  144. package/build/components/inserter/hooks/use-block-types-state.js +4 -14
  145. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  146. package/build/components/inserter/hooks/use-patterns-state.js +1 -1
  147. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  148. package/build/components/inserter/index.js +1 -2
  149. package/build/components/inserter/index.js.map +1 -1
  150. package/build/components/inserter/library.js +3 -7
  151. package/build/components/inserter/library.js.map +1 -1
  152. package/build/components/inserter/media-tab/media-panel.js +2 -2
  153. package/build/components/inserter/media-tab/media-panel.js.map +1 -1
  154. package/build/components/inserter/menu.js +26 -33
  155. package/build/components/inserter/menu.js.map +1 -1
  156. package/build/components/inserter/preview-panel.js +2 -2
  157. package/build/components/inserter/preview-panel.js.map +1 -1
  158. package/build/components/inserter/tabs.js +21 -21
  159. package/build/components/inserter/tabs.js.map +1 -1
  160. package/build/components/inserter-button/index.native.js +98 -0
  161. package/build/components/inserter-button/index.native.js.map +1 -0
  162. package/build/components/inserter-button/sparkles.js +23 -0
  163. package/build/components/inserter-button/sparkles.js.map +1 -0
  164. package/build/components/inserter-draggable-blocks/index.js +8 -4
  165. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  166. package/build/components/inserter-list-item/index.js +2 -4
  167. package/build/components/inserter-list-item/index.js.map +1 -1
  168. package/build/components/inspector-controls/block-support-tools-panel.js +3 -1
  169. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  170. package/build/components/inspector-controls/fill.js +3 -3
  171. package/build/components/inspector-controls/fill.js.map +1 -1
  172. package/build/components/inspector-controls/fill.native.js +3 -3
  173. package/build/components/inspector-controls/fill.native.js.map +1 -1
  174. package/build/components/inspector-controls-tabs/index.js +34 -23
  175. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  176. package/build/components/list-view/block-select-button.js +4 -0
  177. package/build/components/list-view/block-select-button.js.map +1 -1
  178. package/build/components/list-view/block.js +57 -3
  179. package/build/components/list-view/block.js.map +1 -1
  180. package/build/components/media-upload-progress/constants.js +19 -0
  181. package/build/components/media-upload-progress/constants.js.map +1 -0
  182. package/build/components/media-upload-progress/index.native.js +42 -17
  183. package/build/components/media-upload-progress/index.native.js.map +1 -1
  184. package/build/components/navigable-toolbar/index.js +11 -16
  185. package/build/components/navigable-toolbar/index.js.map +1 -1
  186. package/build/components/plain-text/index.native.js +8 -3
  187. package/build/components/plain-text/index.native.js.map +1 -1
  188. package/build/components/preview-options/index.js +6 -62
  189. package/build/components/preview-options/index.js.map +1 -1
  190. package/build/components/provider/index.js +3 -1
  191. package/build/components/provider/index.js.map +1 -1
  192. package/build/components/provider/use-block-sync.js +7 -1
  193. package/build/components/provider/use-block-sync.js.map +1 -1
  194. package/build/components/rich-text/content.js +26 -23
  195. package/build/components/rich-text/content.js.map +1 -1
  196. package/build/components/rich-text/get-rich-text-values.js +2 -1
  197. package/build/components/rich-text/get-rich-text-values.js.map +1 -1
  198. package/build/components/rich-text/index.js +19 -37
  199. package/build/components/rich-text/index.js.map +1 -1
  200. package/build/components/rich-text/index.native.js +9 -16
  201. package/build/components/rich-text/index.native.js.map +1 -1
  202. package/build/components/rich-text/native/get-format-colors.native.js +22 -24
  203. package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
  204. package/build/components/rich-text/native/index.native.js +22 -57
  205. package/build/components/rich-text/native/index.native.js.map +1 -1
  206. package/build/components/rich-text/use-input-rules.js +7 -3
  207. package/build/components/rich-text/use-input-rules.js.map +1 -1
  208. package/build/components/rich-text/use-mark-persistent.js +1 -1
  209. package/build/components/rich-text/use-mark-persistent.js.map +1 -1
  210. package/build/components/rich-text/with-deprecations.js +50 -0
  211. package/build/components/rich-text/with-deprecations.js.map +1 -0
  212. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  213. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  214. package/build/components/url-input/index.js +9 -6
  215. package/build/components/url-input/index.js.map +1 -1
  216. package/build/components/use-block-commands/index.js +14 -18
  217. package/build/components/use-block-commands/index.js.map +1 -1
  218. package/build/components/use-block-drop-zone/index.js +108 -17
  219. package/build/components/use-block-drop-zone/index.js.map +1 -1
  220. package/build/components/use-moving-animation/index.js +100 -92
  221. package/build/components/use-moving-animation/index.js.map +1 -1
  222. package/build/components/use-on-block-drop/index.js +9 -12
  223. package/build/components/use-on-block-drop/index.js.map +1 -1
  224. package/build/components/use-resize-canvas/index.js +4 -1
  225. package/build/components/use-resize-canvas/index.js.map +1 -1
  226. package/build/components/use-settings/index.js +14 -0
  227. package/build/components/use-settings/index.js.map +1 -1
  228. package/build/components/writing-flow/index.js +0 -1
  229. package/build/components/writing-flow/index.js.map +1 -1
  230. package/build/components/writing-flow/use-drag-selection.js +15 -4
  231. package/build/components/writing-flow/use-drag-selection.js.map +1 -1
  232. package/build/components/writing-flow/use-selection-observer.js +73 -27
  233. package/build/components/writing-flow/use-selection-observer.js.map +1 -1
  234. package/build/components/writing-flow/use-tab-nav.js +7 -4
  235. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  236. package/build/hooks/align.js +21 -69
  237. package/build/hooks/align.js.map +1 -1
  238. package/build/hooks/align.native.js +11 -1
  239. package/build/hooks/align.native.js.map +1 -1
  240. package/build/hooks/anchor.js +14 -30
  241. package/build/hooks/anchor.js.map +1 -1
  242. package/build/hooks/aria-label.js +9 -1
  243. package/build/hooks/aria-label.js.map +1 -1
  244. package/build/hooks/background.js +198 -36
  245. package/build/hooks/background.js.map +1 -1
  246. package/build/hooks/block-hooks.js +24 -32
  247. package/build/hooks/block-hooks.js.map +1 -1
  248. package/build/hooks/block-renaming.js +18 -22
  249. package/build/hooks/block-renaming.js.map +1 -1
  250. package/build/hooks/border.js +53 -80
  251. package/build/hooks/border.js.map +1 -1
  252. package/build/hooks/color.js +79 -90
  253. package/build/hooks/color.js.map +1 -1
  254. package/build/hooks/content-lock-ui.js +29 -29
  255. package/build/hooks/content-lock-ui.js.map +1 -1
  256. package/build/hooks/custom-class-name.js +13 -30
  257. package/build/hooks/custom-class-name.js.map +1 -1
  258. package/build/hooks/custom-class-name.native.js +9 -1
  259. package/build/hooks/custom-class-name.native.js.map +1 -1
  260. package/build/hooks/dimensions.js +13 -14
  261. package/build/hooks/dimensions.js.map +1 -1
  262. package/build/hooks/duotone.js +31 -61
  263. package/build/hooks/duotone.js.map +1 -1
  264. package/build/hooks/font-family.js +23 -28
  265. package/build/hooks/font-family.js.map +1 -1
  266. package/build/hooks/font-size.js +52 -120
  267. package/build/hooks/font-size.js.map +1 -1
  268. package/build/hooks/index.js +27 -16
  269. package/build/hooks/index.js.map +1 -1
  270. package/build/hooks/index.native.js +15 -6
  271. package/build/hooks/index.native.js.map +1 -1
  272. package/build/hooks/layout-child.js +68 -0
  273. package/build/hooks/layout-child.js.map +1 -0
  274. package/build/hooks/layout.js +25 -104
  275. package/build/hooks/layout.js.map +1 -1
  276. package/build/hooks/padding.js +2 -2
  277. package/build/hooks/padding.js.map +1 -1
  278. package/build/hooks/position.js +40 -62
  279. package/build/hooks/position.js.map +1 -1
  280. package/build/hooks/style.js +52 -89
  281. package/build/hooks/style.js.map +1 -1
  282. package/build/hooks/typography.js +25 -10
  283. package/build/hooks/typography.js.map +1 -1
  284. package/build/hooks/typography.native.js +43 -18
  285. package/build/hooks/typography.native.js.map +1 -1
  286. package/build/hooks/use-typography-props.js +10 -2
  287. package/build/hooks/use-typography-props.js.map +1 -1
  288. package/build/hooks/utils.js +200 -10
  289. package/build/hooks/utils.js.map +1 -1
  290. package/build/private-apis.js +2 -6
  291. package/build/private-apis.js.map +1 -1
  292. package/build/private-apis.native.js +0 -2
  293. package/build/private-apis.native.js.map +1 -1
  294. package/build/store/actions.js +0 -16
  295. package/build/store/actions.js.map +1 -1
  296. package/build/store/private-actions.js +54 -0
  297. package/build/store/private-actions.js.map +1 -1
  298. package/build/store/private-selectors.js +46 -0
  299. package/build/store/private-selectors.js.map +1 -1
  300. package/build/store/reducer.js +18 -2
  301. package/build/store/reducer.js.map +1 -1
  302. package/build/store/selectors.js +11 -73
  303. package/build/store/selectors.js.map +1 -1
  304. package/build/store/undo-ignore.js +12 -0
  305. package/build/store/undo-ignore.js.map +1 -0
  306. package/build/store/utils.js +66 -0
  307. package/build/store/utils.js.map +1 -0
  308. package/build/utils/get-px-from-css-unit.js +16 -0
  309. package/build/utils/get-px-from-css-unit.js.map +1 -0
  310. package/build/utils/index.js +2 -2
  311. package/build/utils/index.js.map +1 -1
  312. package/build/utils/object.js +38 -99
  313. package/build/utils/object.js.map +1 -1
  314. package/build/utils/selection.js +9 -1
  315. package/build/utils/selection.js.map +1 -1
  316. package/build/utils/use-can-block-toolbar-be-focused.js +46 -0
  317. package/build/utils/use-can-block-toolbar-be-focused.js.map +1 -0
  318. package/build-module/components/block-canvas/index.js +22 -8
  319. package/build-module/components/block-canvas/index.js.map +1 -1
  320. package/build-module/components/block-card/index.js +2 -2
  321. package/build-module/components/block-card/index.js.map +1 -1
  322. package/build-module/components/block-controls/hook.js +4 -24
  323. package/build-module/components/block-controls/hook.js.map +1 -1
  324. package/build-module/components/block-draggable/draggable-chip.js +6 -1
  325. package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
  326. package/build-module/components/block-draggable/index.js +76 -6
  327. package/build-module/components/block-draggable/index.js.map +1 -1
  328. package/build-module/components/block-draggable/index.native.js +1 -7
  329. package/build-module/components/block-draggable/index.native.js.map +1 -1
  330. package/build-module/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
  331. package/build-module/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
  332. package/build-module/components/block-edit/context.js +2 -0
  333. package/build-module/components/block-edit/context.js.map +1 -1
  334. package/build-module/components/block-edit/index.js +19 -10
  335. package/build-module/components/block-edit/index.js.map +1 -1
  336. package/build-module/components/block-editing-mode/index.js +3 -4
  337. package/build-module/components/block-editing-mode/index.js.map +1 -1
  338. package/build-module/components/block-info-slot-fill/index.js +3 -3
  339. package/build-module/components/block-info-slot-fill/index.js.map +1 -1
  340. package/build-module/components/block-inspector/index.js +1 -1
  341. package/build-module/components/block-inspector/index.js.map +1 -1
  342. package/build-module/components/block-list/block-list-item-cell.native.js +1 -0
  343. package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
  344. package/build-module/components/block-list/block.js +261 -99
  345. package/build-module/components/block-list/block.js.map +1 -1
  346. package/build-module/components/block-list/block.native.js +60 -25
  347. package/build-module/components/block-list/block.native.js.map +1 -1
  348. package/build-module/components/block-list/index.native.js +3 -5
  349. package/build-module/components/block-list/index.native.js.map +1 -1
  350. package/build-module/components/block-list/private-block-context.js +6 -0
  351. package/build-module/components/block-list/private-block-context.js.map +1 -0
  352. package/build-module/components/block-list/use-block-props/index.js +50 -70
  353. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  354. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +4 -29
  355. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  356. package/build-module/components/block-list/use-block-props/use-is-hovered.js +4 -14
  357. package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  358. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
  359. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  360. package/build-module/components/block-list/use-in-between-inserter.js +3 -2
  361. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  362. package/build-module/components/block-list/use-scroll-upon-insertion.native.js +33 -0
  363. package/build-module/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
  364. package/build-module/components/block-lock/toolbar.js +22 -28
  365. package/build-module/components/block-lock/toolbar.js.map +1 -1
  366. package/build-module/components/block-mover/index.js +2 -1
  367. package/build-module/components/block-mover/index.js.map +1 -1
  368. package/build-module/components/block-patterns-list/index.js +6 -6
  369. package/build-module/components/block-patterns-list/index.js.map +1 -1
  370. package/build-module/components/block-removal-warning-modal/index.js +3 -10
  371. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  372. package/build-module/components/block-rename/modal.js +3 -0
  373. package/build-module/components/block-rename/modal.js.map +1 -1
  374. package/build-module/components/block-settings/container.native.js +4 -2
  375. package/build-module/components/block-settings/container.native.js.map +1 -1
  376. package/build-module/components/block-styles/index.js +1 -1
  377. package/build-module/components/block-styles/index.js.map +1 -1
  378. package/build-module/components/block-styles/index.native.js +3 -2
  379. package/build-module/components/block-styles/index.native.js.map +1 -1
  380. package/build-module/components/block-switcher/index.js +4 -4
  381. package/build-module/components/block-switcher/index.js.map +1 -1
  382. package/build-module/components/block-toolbar/index.js +89 -27
  383. package/build-module/components/block-toolbar/index.js.map +1 -1
  384. package/build-module/components/block-tools/block-toolbar-breadcrumb.js +41 -0
  385. package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
  386. package/build-module/components/block-tools/block-toolbar-popover.js +74 -0
  387. package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -0
  388. package/build-module/components/block-tools/index.js +27 -24
  389. package/build-module/components/block-tools/index.js.map +1 -1
  390. package/build-module/components/block-types-list/index.native.js +2 -1
  391. package/build-module/components/block-types-list/index.native.js.map +1 -1
  392. package/build-module/components/block-variation-picker/index.native.js +2 -1
  393. package/build-module/components/block-variation-picker/index.native.js.map +1 -1
  394. package/build-module/components/block-variation-transforms/index.js +30 -3
  395. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  396. package/build-module/components/border-radius-control/linked-button.js +1 -1
  397. package/build-module/components/border-radius-control/linked-button.js.map +1 -1
  398. package/build-module/components/colors/utils.js +9 -1
  399. package/build-module/components/colors/utils.js.map +1 -1
  400. package/build-module/components/colors/with-colors.js +5 -1
  401. package/build-module/components/colors/with-colors.js.map +1 -1
  402. package/build-module/components/colors-gradients/control.js +29 -18
  403. package/build-module/components/colors-gradients/control.js.map +1 -1
  404. package/build-module/components/duotone-control/index.js +1 -4
  405. package/build-module/components/duotone-control/index.js.map +1 -1
  406. package/build-module/components/font-sizes/utils.js +9 -1
  407. package/build-module/components/font-sizes/utils.js.map +1 -1
  408. package/build-module/components/global-styles/border-panel.js +3 -2
  409. package/build-module/components/global-styles/border-panel.js.map +1 -1
  410. package/build-module/components/global-styles/color-panel.js +26 -23
  411. package/build-module/components/global-styles/color-panel.js.map +1 -1
  412. package/build-module/components/global-styles/dimensions-panel.js +5 -4
  413. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  414. package/build-module/components/global-styles/effects-panel.js +3 -2
  415. package/build-module/components/global-styles/effects-panel.js.map +1 -1
  416. package/build-module/components/global-styles/filters-panel.js +8 -5
  417. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  418. package/build-module/components/global-styles/get-global-styles-changes.js +184 -0
  419. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -0
  420. package/build-module/components/global-styles/hooks.js +3 -2
  421. package/build-module/components/global-styles/hooks.js.map +1 -1
  422. package/build-module/components/global-styles/image-settings-panel.js +7 -1
  423. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  424. package/build-module/components/global-styles/index.js +1 -0
  425. package/build-module/components/global-styles/index.js.map +1 -1
  426. package/build-module/components/global-styles/typography-panel.js +45 -38
  427. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  428. package/build-module/components/global-styles/use-global-styles-output.js +15 -1
  429. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  430. package/build-module/components/global-styles/utils.js +7 -0
  431. package/build-module/components/global-styles/utils.js.map +1 -1
  432. package/build-module/components/height-control/index.js +6 -2
  433. package/build-module/components/height-control/index.js.map +1 -1
  434. package/build-module/components/image-link-destinations/index.native.js +109 -0
  435. package/build-module/components/image-link-destinations/index.native.js.map +1 -0
  436. package/build-module/components/image-size-control/index.js +2 -2
  437. package/build-module/components/image-size-control/index.js.map +1 -1
  438. package/build-module/components/index.native.js +3 -1
  439. package/build-module/components/index.native.js.map +1 -1
  440. package/build-module/components/inner-blocks/index.js +62 -23
  441. package/build-module/components/inner-blocks/index.js.map +1 -1
  442. package/build-module/components/inner-blocks/index.native.js +18 -4
  443. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  444. package/build-module/components/inner-blocks/use-inner-block-template-sync.js +5 -6
  445. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  446. package/build-module/components/inner-blocks/use-nested-settings-update.js +6 -10
  447. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  448. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  449. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  450. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +11 -10
  451. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  452. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +11 -11
  453. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  454. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +11 -11
  455. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  456. package/build-module/components/inserter/block-patterns-tab/utils.js +7 -11
  457. package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
  458. package/build-module/components/inserter/hooks/use-block-types-state.js +4 -14
  459. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  460. package/build-module/components/inserter/hooks/use-patterns-state.js +2 -2
  461. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  462. package/build-module/components/inserter/index.js +1 -2
  463. package/build-module/components/inserter/index.js.map +1 -1
  464. package/build-module/components/inserter/library.js +3 -7
  465. package/build-module/components/inserter/library.js.map +1 -1
  466. package/build-module/components/inserter/media-tab/media-panel.js +1 -1
  467. package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
  468. package/build-module/components/inserter/menu.js +26 -33
  469. package/build-module/components/inserter/menu.js.map +1 -1
  470. package/build-module/components/inserter/preview-panel.js +2 -2
  471. package/build-module/components/inserter/preview-panel.js.map +1 -1
  472. package/build-module/components/inserter/tabs.js +22 -22
  473. package/build-module/components/inserter/tabs.js.map +1 -1
  474. package/build-module/components/inserter-button/index.native.js +89 -0
  475. package/build-module/components/inserter-button/index.native.js.map +1 -0
  476. package/build-module/components/inserter-button/sparkles.js +15 -0
  477. package/build-module/components/inserter-button/sparkles.js.map +1 -0
  478. package/build-module/components/inserter-draggable-blocks/index.js +9 -5
  479. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  480. package/build-module/components/inserter-list-item/index.js +2 -4
  481. package/build-module/components/inserter-list-item/index.js.map +1 -1
  482. package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -1
  483. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  484. package/build-module/components/inspector-controls/fill.js +3 -3
  485. package/build-module/components/inspector-controls/fill.js.map +1 -1
  486. package/build-module/components/inspector-controls/fill.native.js +3 -3
  487. package/build-module/components/inspector-controls/fill.native.js.map +1 -1
  488. package/build-module/components/inspector-controls-tabs/index.js +35 -24
  489. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  490. package/build-module/components/list-view/block-select-button.js +4 -0
  491. package/build-module/components/list-view/block-select-button.js.map +1 -1
  492. package/build-module/components/list-view/block.js +58 -4
  493. package/build-module/components/list-view/block.js.map +1 -1
  494. package/build-module/components/media-upload-progress/constants.js +7 -0
  495. package/build-module/components/media-upload-progress/constants.js.map +1 -0
  496. package/build-module/components/media-upload-progress/index.native.js +37 -8
  497. package/build-module/components/media-upload-progress/index.native.js.map +1 -1
  498. package/build-module/components/navigable-toolbar/index.js +11 -16
  499. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  500. package/build-module/components/plain-text/index.native.js +6 -1
  501. package/build-module/components/plain-text/index.native.js.map +1 -1
  502. package/build-module/components/preview-options/index.js +6 -62
  503. package/build-module/components/preview-options/index.js.map +1 -1
  504. package/build-module/components/provider/index.js +3 -1
  505. package/build-module/components/provider/index.js.map +1 -1
  506. package/build-module/components/provider/use-block-sync.js +7 -1
  507. package/build-module/components/provider/use-block-sync.js.map +1 -1
  508. package/build-module/components/rich-text/content.js +25 -21
  509. package/build-module/components/rich-text/content.js.map +1 -1
  510. package/build-module/components/rich-text/get-rich-text-values.js +2 -1
  511. package/build-module/components/rich-text/get-rich-text-values.js.map +1 -1
  512. package/build-module/components/rich-text/index.js +21 -39
  513. package/build-module/components/rich-text/index.js.map +1 -1
  514. package/build-module/components/rich-text/index.native.js +10 -18
  515. package/build-module/components/rich-text/index.native.js.map +1 -1
  516. package/build-module/components/rich-text/native/get-format-colors.native.js +22 -24
  517. package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
  518. package/build-module/components/rich-text/native/index.native.js +22 -56
  519. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  520. package/build-module/components/rich-text/use-input-rules.js +7 -3
  521. package/build-module/components/rich-text/use-input-rules.js.map +1 -1
  522. package/build-module/components/rich-text/use-mark-persistent.js +1 -1
  523. package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
  524. package/build-module/components/rich-text/with-deprecations.js +42 -0
  525. package/build-module/components/rich-text/with-deprecations.js.map +1 -0
  526. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  527. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  528. package/build-module/components/url-input/index.js +9 -6
  529. package/build-module/components/url-input/index.js.map +1 -1
  530. package/build-module/components/use-block-commands/index.js +14 -18
  531. package/build-module/components/use-block-commands/index.js.map +1 -1
  532. package/build-module/components/use-block-drop-zone/index.js +107 -18
  533. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  534. package/build-module/components/use-moving-animation/index.js +102 -94
  535. package/build-module/components/use-moving-animation/index.js.map +1 -1
  536. package/build-module/components/use-on-block-drop/index.js +9 -12
  537. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  538. package/build-module/components/use-resize-canvas/index.js +4 -1
  539. package/build-module/components/use-resize-canvas/index.js.map +1 -1
  540. package/build-module/components/use-settings/index.js +13 -1
  541. package/build-module/components/use-settings/index.js.map +1 -1
  542. package/build-module/components/writing-flow/index.js +0 -1
  543. package/build-module/components/writing-flow/index.js.map +1 -1
  544. package/build-module/components/writing-flow/use-drag-selection.js +15 -4
  545. package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
  546. package/build-module/components/writing-flow/use-selection-observer.js +73 -27
  547. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
  548. package/build-module/components/writing-flow/use-tab-nav.js +7 -4
  549. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  550. package/build-module/hooks/align.js +20 -67
  551. package/build-module/hooks/align.js.map +1 -1
  552. package/build-module/hooks/align.native.js +1 -0
  553. package/build-module/hooks/align.native.js.map +1 -1
  554. package/build-module/hooks/anchor.js +12 -27
  555. package/build-module/hooks/anchor.js.map +1 -1
  556. package/build-module/hooks/aria-label.js +7 -1
  557. package/build-module/hooks/aria-label.js.map +1 -1
  558. package/build-module/hooks/background.js +197 -37
  559. package/build-module/hooks/background.js.map +1 -1
  560. package/build-module/hooks/block-hooks.js +22 -30
  561. package/build-module/hooks/block-hooks.js.map +1 -1
  562. package/build-module/hooks/block-renaming.js +17 -21
  563. package/build-module/hooks/block-renaming.js.map +1 -1
  564. package/build-module/hooks/border.js +52 -79
  565. package/build-module/hooks/border.js.map +1 -1
  566. package/build-module/hooks/color.js +78 -88
  567. package/build-module/hooks/color.js.map +1 -1
  568. package/build-module/hooks/content-lock-ui.js +27 -27
  569. package/build-module/hooks/content-lock-ui.js.map +1 -1
  570. package/build-module/hooks/custom-class-name.js +12 -28
  571. package/build-module/hooks/custom-class-name.js.map +1 -1
  572. package/build-module/hooks/custom-class-name.native.js +7 -1
  573. package/build-module/hooks/custom-class-name.native.js.map +1 -1
  574. package/build-module/hooks/dimensions.js +15 -16
  575. package/build-module/hooks/dimensions.js.map +1 -1
  576. package/build-module/hooks/duotone.js +30 -61
  577. package/build-module/hooks/duotone.js.map +1 -1
  578. package/build-module/hooks/font-family.js +20 -25
  579. package/build-module/hooks/font-family.js.map +1 -1
  580. package/build-module/hooks/font-size.js +50 -120
  581. package/build-module/hooks/font-size.js.map +1 -1
  582. package/build-module/hooks/index.js +20 -16
  583. package/build-module/hooks/index.js.map +1 -1
  584. package/build-module/hooks/index.native.js +10 -6
  585. package/build-module/hooks/index.native.js.map +1 -1
  586. package/build-module/hooks/layout-child.js +60 -0
  587. package/build-module/hooks/layout-child.js.map +1 -0
  588. package/build-module/hooks/layout.js +21 -100
  589. package/build-module/hooks/layout.js.map +1 -1
  590. package/build-module/hooks/padding.js +2 -2
  591. package/build-module/hooks/padding.js.map +1 -1
  592. package/build-module/hooks/position.js +38 -59
  593. package/build-module/hooks/position.js.map +1 -1
  594. package/build-module/hooks/style.js +52 -85
  595. package/build-module/hooks/style.js.map +1 -1
  596. package/build-module/hooks/typography.js +26 -11
  597. package/build-module/hooks/typography.js.map +1 -1
  598. package/build-module/hooks/typography.native.js +43 -17
  599. package/build-module/hooks/typography.native.js.map +1 -1
  600. package/build-module/hooks/use-typography-props.js +9 -1
  601. package/build-module/hooks/use-typography-props.js.map +1 -1
  602. package/build-module/hooks/utils.js +194 -9
  603. package/build-module/hooks/utils.js.map +1 -1
  604. package/build-module/private-apis.js +2 -6
  605. package/build-module/private-apis.js.map +1 -1
  606. package/build-module/private-apis.native.js +0 -2
  607. package/build-module/private-apis.native.js.map +1 -1
  608. package/build-module/store/actions.js +0 -15
  609. package/build-module/store/actions.js.map +1 -1
  610. package/build-module/store/private-actions.js +52 -0
  611. package/build-module/store/private-actions.js.map +1 -1
  612. package/build-module/store/private-selectors.js +44 -1
  613. package/build-module/store/private-selectors.js.map +1 -1
  614. package/build-module/store/reducer.js +18 -2
  615. package/build-module/store/reducer.js.map +1 -1
  616. package/build-module/store/selectors.js +4 -65
  617. package/build-module/store/selectors.js.map +1 -1
  618. package/build-module/store/undo-ignore.js +5 -0
  619. package/build-module/store/undo-ignore.js.map +1 -0
  620. package/build-module/store/utils.js +56 -0
  621. package/build-module/store/utils.js.map +1 -0
  622. package/build-module/utils/get-px-from-css-unit.js +9 -0
  623. package/build-module/utils/get-px-from-css-unit.js.map +1 -0
  624. package/build-module/utils/index.js +1 -1
  625. package/build-module/utils/index.js.map +1 -1
  626. package/build-module/utils/object.js +37 -97
  627. package/build-module/utils/object.js.map +1 -1
  628. package/build-module/utils/selection.js +9 -1
  629. package/build-module/utils/selection.js.map +1 -1
  630. package/build-module/utils/use-can-block-toolbar-be-focused.js +40 -0
  631. package/build-module/utils/use-can-block-toolbar-be-focused.js.map +1 -0
  632. package/build-style/content-rtl.css +7 -6
  633. package/build-style/content.css +7 -6
  634. package/build-style/style-rtl.css +164 -301
  635. package/build-style/style.css +164 -301
  636. package/package.json +31 -31
  637. package/src/components/alignment-control/README.md +0 -5
  638. package/src/components/block-alignment-control/README.md +0 -5
  639. package/src/components/block-alignment-matrix-control/README.md +0 -10
  640. package/src/components/block-breadcrumb/README.md +0 -5
  641. package/src/components/block-canvas/index.js +29 -17
  642. package/src/components/block-canvas/style.scss +6 -0
  643. package/src/components/block-caption/README.md +2 -7
  644. package/src/components/block-card/README.md +0 -5
  645. package/src/components/block-card/index.js +6 -4
  646. package/src/components/block-card/style.scss +7 -3
  647. package/src/components/block-controls/hook.js +8 -30
  648. package/src/components/block-controls/test/index.js +3 -3
  649. package/src/components/block-draggable/draggable-chip.js +11 -1
  650. package/src/components/block-draggable/index.js +116 -4
  651. package/src/components/block-draggable/index.native.js +0 -5
  652. package/src/components/block-draggable/style.scss +35 -0
  653. package/src/components/block-draggable/test/helpers.native.js +8 -7
  654. package/src/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
  655. package/src/components/block-edit/context.js +3 -0
  656. package/src/components/block-edit/index.js +36 -10
  657. package/src/components/block-editing-mode/index.js +3 -3
  658. package/src/components/block-icon/README.md +0 -5
  659. package/src/components/block-info-slot-fill/index.js +6 -3
  660. package/src/components/block-inspector/README.md +0 -5
  661. package/src/components/block-inspector/index.js +3 -1
  662. package/src/components/block-inspector/style.scss +0 -4
  663. package/src/components/block-list/block-list-item-cell.native.js +5 -1
  664. package/src/components/block-list/block.js +309 -104
  665. package/src/components/block-list/block.native.js +69 -21
  666. package/src/components/block-list/content.scss +14 -10
  667. package/src/components/block-list/index.native.js +3 -5
  668. package/src/components/block-list/{block-list-block-context.js → private-block-context.js} +1 -1
  669. package/src/components/block-list/use-block-props/index.js +43 -86
  670. package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -34
  671. package/src/components/block-list/use-block-props/use-is-hovered.js +2 -13
  672. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +1 -5
  673. package/src/components/block-list/use-in-between-inserter.js +4 -1
  674. package/src/components/block-list/use-scroll-upon-insertion.native.js +52 -0
  675. package/src/components/block-lock/toolbar.js +23 -34
  676. package/src/components/block-mover/README.md +0 -5
  677. package/src/components/block-mover/index.js +1 -1
  678. package/src/components/block-parent-selector/README.md +0 -5
  679. package/src/components/block-patterns-list/README.md +0 -5
  680. package/src/components/block-patterns-list/index.js +9 -6
  681. package/src/components/block-removal-warning-modal/index.js +7 -14
  682. package/src/components/block-rename/modal.js +7 -1
  683. package/src/components/block-settings/container.native.js +3 -5
  684. package/src/components/block-styles/index.js +1 -1
  685. package/src/components/block-styles/index.native.js +4 -2
  686. package/src/components/block-styles/style.scss +0 -11
  687. package/src/components/block-switcher/index.js +49 -59
  688. package/src/components/block-switcher/test/__snapshots__/index.js.snap +3 -1
  689. package/src/components/block-toolbar/README.md +0 -5
  690. package/src/components/block-toolbar/index.js +179 -95
  691. package/src/components/block-toolbar/style.scss +50 -66
  692. package/src/components/block-tools/block-toolbar-breadcrumb.js +46 -0
  693. package/src/components/block-tools/block-toolbar-popover.js +84 -0
  694. package/src/components/block-tools/index.js +42 -29
  695. package/src/components/block-tools/style.scss +60 -172
  696. package/src/components/block-types-list/README.md +0 -5
  697. package/src/components/block-types-list/index.native.js +2 -1
  698. package/src/components/block-variation-picker/README.md +0 -5
  699. package/src/components/block-variation-picker/index.native.js +1 -1
  700. package/src/components/block-variation-transforms/README.md +0 -5
  701. package/src/components/block-variation-transforms/index.js +49 -3
  702. package/src/components/border-radius-control/linked-button.js +1 -1
  703. package/src/components/caption/README.md +0 -5
  704. package/src/components/color-palette/test/__snapshots__/control.js.snap +0 -1
  705. package/src/components/colors/utils.js +8 -1
  706. package/src/components/colors/with-colors.js +3 -1
  707. package/src/components/colors-gradients/control.js +49 -30
  708. package/src/components/colors-gradients/style.scss +0 -7
  709. package/src/components/contrast-checker/README.md +0 -4
  710. package/src/components/copy-handler/README.md +0 -10
  711. package/src/components/duotone-control/index.js +2 -5
  712. package/src/components/duotone-control/style.scss +1 -6
  713. package/src/components/font-sizes/utils.js +7 -1
  714. package/src/components/global-styles/border-panel.js +2 -1
  715. package/src/components/global-styles/color-panel.js +36 -26
  716. package/src/components/global-styles/dimensions-panel.js +4 -3
  717. package/src/components/global-styles/effects-panel.js +2 -1
  718. package/src/components/global-styles/filters-panel.js +6 -5
  719. package/src/components/global-styles/get-global-styles-changes.js +210 -0
  720. package/src/components/global-styles/hooks.js +5 -0
  721. package/src/components/global-styles/image-settings-panel.js +6 -0
  722. package/src/components/global-styles/index.js +1 -0
  723. package/src/components/global-styles/test/get-global-styles-changes.js +234 -0
  724. package/src/components/global-styles/typography-panel.js +60 -47
  725. package/src/components/global-styles/use-global-styles-output.js +9 -5
  726. package/src/components/global-styles/utils.js +7 -0
  727. package/src/components/height-control/README.md +2 -7
  728. package/src/components/height-control/index.js +4 -0
  729. package/src/components/image-link-destinations/index.native.js +152 -0
  730. package/src/components/image-link-destinations/style.native.scss +16 -0
  731. package/src/components/image-size-control/index.js +5 -2
  732. package/src/components/index.native.js +3 -2
  733. package/src/components/inner-blocks/README.md +13 -2
  734. package/src/components/inner-blocks/index.js +68 -29
  735. package/src/components/inner-blocks/index.native.js +19 -7
  736. package/src/components/inner-blocks/use-inner-block-template-sync.js +5 -7
  737. package/src/components/inner-blocks/use-nested-settings-update.js +6 -13
  738. package/src/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  739. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +15 -15
  740. package/src/components/inserter/block-patterns-tab/patterns-filter.js +15 -13
  741. package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +15 -18
  742. package/src/components/inserter/block-patterns-tab/utils.js +11 -12
  743. package/src/components/inserter/hooks/use-block-types-state.js +9 -11
  744. package/src/components/inserter/hooks/use-patterns-state.js +2 -2
  745. package/src/components/inserter/index.js +0 -1
  746. package/src/components/inserter/library.js +2 -8
  747. package/src/components/inserter/media-tab/media-panel.js +1 -1
  748. package/src/components/inserter/menu.js +26 -36
  749. package/src/components/inserter/preview-panel.js +2 -2
  750. package/src/components/inserter/style.scss +21 -21
  751. package/src/components/inserter/tabs.js +34 -25
  752. package/src/components/inserter-button/README.md +62 -0
  753. package/src/components/inserter-button/index.native.js +116 -0
  754. package/src/components/inserter-button/sparkles.js +15 -0
  755. package/src/components/inserter-button/style.native.scss +72 -0
  756. package/src/components/inserter-draggable-blocks/index.js +18 -5
  757. package/src/components/inserter-list-item/index.js +6 -6
  758. package/src/components/inspector-controls/block-support-tools-panel.js +2 -0
  759. package/src/components/inspector-controls/fill.js +6 -3
  760. package/src/components/inspector-controls/fill.native.js +6 -3
  761. package/src/components/inspector-controls-tabs/index.js +39 -28
  762. package/src/components/inspector-controls-tabs/style.scss +3 -2
  763. package/src/components/letter-spacing-control/README.md +0 -5
  764. package/src/components/line-height-control/README.md +0 -5
  765. package/src/components/link-control/style.scss +1 -1
  766. package/src/components/link-control/test/index.js +1 -1
  767. package/src/components/list-view/README.md +0 -5
  768. package/src/components/list-view/block-select-button.js +4 -0
  769. package/src/components/list-view/block.js +73 -2
  770. package/src/components/list-view/style.scss +6 -0
  771. package/src/components/media-upload-progress/constants.js +6 -0
  772. package/src/components/media-upload-progress/index.native.js +66 -14
  773. package/src/components/media-upload-progress/test/index.native.js +2 -2
  774. package/src/components/multi-selection-inspector/README.md +0 -5
  775. package/src/components/navigable-toolbar/README.md +2 -0
  776. package/src/components/navigable-toolbar/index.js +15 -13
  777. package/src/components/plain-text/index.native.js +6 -1
  778. package/src/components/preview-options/index.js +6 -86
  779. package/src/components/provider/index.js +1 -1
  780. package/src/components/provider/test/use-block-sync.js +20 -17
  781. package/src/components/provider/use-block-sync.js +6 -0
  782. package/src/components/rich-text/content.js +27 -20
  783. package/src/components/rich-text/get-rich-text-values.js +6 -1
  784. package/src/components/rich-text/index.js +23 -52
  785. package/src/components/rich-text/index.native.js +8 -25
  786. package/src/components/rich-text/native/get-format-colors.native.js +33 -40
  787. package/src/components/rich-text/native/index.native.js +22 -71
  788. package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +3 -3
  789. package/src/components/rich-text/native/test/index.native.js +72 -5
  790. package/src/components/rich-text/use-input-rules.js +8 -3
  791. package/src/components/rich-text/use-mark-persistent.js +1 -2
  792. package/src/components/rich-text/with-deprecations.js +51 -0
  793. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  794. package/src/components/text-decoration-control/README.md +40 -0
  795. package/src/components/text-transform-control/README.md +0 -4
  796. package/src/components/ungroup-button/README.md +0 -5
  797. package/src/components/unit-control/README.md +0 -4
  798. package/src/components/url-input/index.js +11 -11
  799. package/src/components/use-block-commands/index.js +18 -21
  800. package/src/components/use-block-drop-zone/index.js +181 -30
  801. package/src/components/use-moving-animation/index.js +107 -103
  802. package/src/components/use-on-block-drop/index.js +9 -24
  803. package/src/components/use-on-block-drop/test/index.js +12 -26
  804. package/src/components/use-resize-canvas/README.md +3 -7
  805. package/src/components/use-resize-canvas/index.js +4 -1
  806. package/src/components/use-settings/README.md +0 -4
  807. package/src/components/use-settings/index.js +15 -1
  808. package/src/components/writing-flow/index.js +0 -1
  809. package/src/components/writing-flow/use-drag-selection.js +18 -4
  810. package/src/components/writing-flow/use-selection-observer.js +99 -37
  811. package/src/components/writing-flow/use-tab-nav.js +7 -7
  812. package/src/hooks/align.js +16 -81
  813. package/src/hooks/align.native.js +1 -0
  814. package/src/hooks/anchor.js +14 -38
  815. package/src/hooks/aria-label.js +8 -5
  816. package/src/hooks/background.js +269 -32
  817. package/src/hooks/block-hooks.js +22 -51
  818. package/src/hooks/block-renaming.js +23 -37
  819. package/src/hooks/border.js +62 -124
  820. package/src/hooks/color.js +111 -138
  821. package/src/hooks/content-lock-ui.js +110 -122
  822. package/src/hooks/custom-class-name.js +9 -45
  823. package/src/hooks/custom-class-name.native.js +8 -5
  824. package/src/hooks/dimensions.js +14 -16
  825. package/src/hooks/duotone.js +70 -127
  826. package/src/hooks/font-family.js +14 -36
  827. package/src/hooks/font-size.js +67 -168
  828. package/src/hooks/index.js +58 -16
  829. package/src/hooks/index.native.js +22 -6
  830. package/src/hooks/layout-child.js +53 -0
  831. package/src/hooks/layout.js +17 -103
  832. package/src/hooks/padding.js +2 -2
  833. package/src/hooks/position.js +50 -90
  834. package/src/hooks/style.js +118 -193
  835. package/src/hooks/test/align.js +1 -178
  836. package/src/hooks/test/anchor.js +4 -9
  837. package/src/hooks/test/custom-class-name.js +3 -8
  838. package/src/hooks/test/style.js +4 -14
  839. package/src/hooks/typography.js +14 -16
  840. package/src/hooks/typography.native.js +31 -33
  841. package/src/hooks/use-typography-props.js +7 -1
  842. package/src/hooks/utils.js +261 -10
  843. package/src/private-apis.js +2 -6
  844. package/src/private-apis.native.js +0 -2
  845. package/src/store/actions.js +0 -15
  846. package/src/store/private-actions.js +48 -0
  847. package/src/store/private-selectors.js +56 -0
  848. package/src/store/reducer.js +20 -1
  849. package/src/store/selectors.js +10 -82
  850. package/src/store/undo-ignore.js +4 -0
  851. package/src/store/utils.js +74 -0
  852. package/src/style.scss +1 -2
  853. package/src/utils/get-px-from-css-unit.js +8 -0
  854. package/src/utils/index.js +1 -1
  855. package/src/utils/object.js +34 -104
  856. package/src/utils/selection.js +9 -2
  857. package/src/utils/test/object.js +1 -96
  858. package/src/utils/use-can-block-toolbar-be-focused.js +48 -0
  859. package/build/components/block-list/block-list-block-context.js +0 -14
  860. package/build/components/block-list/block-list-block-context.js.map +0 -1
  861. package/build/components/block-list/use-block-props/use-block-class-names.js +0 -67
  862. package/build/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
  863. package/build/components/block-list/use-block-props/use-block-custom-class-name.js +0 -46
  864. package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
  865. package/build/components/block-list/use-block-props/use-block-default-class-name.js +0 -37
  866. package/build/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
  867. package/build/components/block-tools/back-compat.js +0 -45
  868. package/build/components/block-tools/back-compat.js.map +0 -1
  869. package/build/components/block-tools/block-contextual-toolbar.js +0 -91
  870. package/build/components/block-tools/block-contextual-toolbar.js.map +0 -1
  871. package/build/components/block-tools/selected-block-tools.js +0 -113
  872. package/build/components/block-tools/selected-block-tools.js.map +0 -1
  873. package/build/components/inserter/hooks/use-debounced-input.js +0 -22
  874. package/build/components/inserter/hooks/use-debounced-input.js.map +0 -1
  875. package/build/components/use-display-block-controls/index.js +0 -39
  876. package/build/components/use-display-block-controls/index.js.map +0 -1
  877. package/build/components/use-display-block-controls/index.native.js +0 -39
  878. package/build/components/use-display-block-controls/index.native.js.map +0 -1
  879. package/build/hooks/custom-fields.js +0 -120
  880. package/build/hooks/custom-fields.js.map +0 -1
  881. package/build/utils/parse-css-unit-to-px.js +0 -302
  882. package/build/utils/parse-css-unit-to-px.js.map +0 -1
  883. package/build/utils/use-should-contextual-toolbar-show.js +0 -63
  884. package/build/utils/use-should-contextual-toolbar-show.js.map +0 -1
  885. package/build-module/components/block-list/block-list-block-context.js +0 -6
  886. package/build-module/components/block-list/block-list-block-context.js.map +0 -1
  887. package/build-module/components/block-list/use-block-props/use-block-class-names.js +0 -60
  888. package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
  889. package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js +0 -40
  890. package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
  891. package/build-module/components/block-list/use-block-props/use-block-default-class-name.js +0 -31
  892. package/build-module/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
  893. package/build-module/components/block-tools/back-compat.js +0 -35
  894. package/build-module/components/block-tools/back-compat.js.map +0 -1
  895. package/build-module/components/block-tools/block-contextual-toolbar.js +0 -83
  896. package/build-module/components/block-tools/block-contextual-toolbar.js.map +0 -1
  897. package/build-module/components/block-tools/selected-block-tools.js +0 -105
  898. package/build-module/components/block-tools/selected-block-tools.js.map +0 -1
  899. package/build-module/components/inserter/hooks/use-debounced-input.js +0 -15
  900. package/build-module/components/inserter/hooks/use-debounced-input.js.map +0 -1
  901. package/build-module/components/use-display-block-controls/index.js +0 -32
  902. package/build-module/components/use-display-block-controls/index.js.map +0 -1
  903. package/build-module/components/use-display-block-controls/index.native.js +0 -32
  904. package/build-module/components/use-display-block-controls/index.native.js.map +0 -1
  905. package/build-module/hooks/custom-fields.js +0 -118
  906. package/build-module/hooks/custom-fields.js.map +0 -1
  907. package/build-module/utils/parse-css-unit-to-px.js +0 -294
  908. package/build-module/utils/parse-css-unit-to-px.js.map +0 -1
  909. package/build-module/utils/use-should-contextual-toolbar-show.js +0 -57
  910. package/build-module/utils/use-should-contextual-toolbar-show.js.map +0 -1
  911. package/src/components/block-list/use-block-props/use-block-class-names.js +0 -66
  912. package/src/components/block-list/use-block-props/use-block-custom-class-name.js +0 -44
  913. package/src/components/block-list/use-block-props/use-block-default-class-name.js +0 -35
  914. package/src/components/block-parent-selector/style.scss +0 -11
  915. package/src/components/block-tools/back-compat.js +0 -35
  916. package/src/components/block-tools/block-contextual-toolbar.js +0 -100
  917. package/src/components/block-tools/selected-block-tools.js +0 -127
  918. package/src/components/inserter/hooks/use-debounced-input.js +0 -18
  919. package/src/components/preview-options/README.md +0 -94
  920. package/src/components/preview-options/style.scss +0 -64
  921. package/src/components/use-display-block-controls/index.js +0 -36
  922. package/src/components/use-display-block-controls/index.native.js +0 -37
  923. package/src/hooks/custom-fields.js +0 -142
  924. package/src/hooks/test/color.js +0 -112
  925. package/src/utils/parse-css-unit-to-px.js +0 -329
  926. package/src/utils/test/parse-css-unit-to-px.js +0 -172
  927. package/src/utils/use-should-contextual-toolbar-show.js +0 -85
@@ -10,25 +10,17 @@ var _element = require("@wordpress/element");
10
10
  var _i18n = require("@wordpress/i18n");
11
11
  var _blocks = require("@wordpress/blocks");
12
12
  var _compose = require("@wordpress/compose");
13
- var _data = require("@wordpress/data");
14
13
  var _warning = _interopRequireDefault(require("@wordpress/warning"));
15
14
  var _useMovingAnimation = _interopRequireDefault(require("../../use-moving-animation"));
16
- var _blockListBlockContext = require("../block-list-block-context");
15
+ var _privateBlockContext = require("../private-block-context");
17
16
  var _useFocusFirstElement = require("./use-focus-first-element");
18
17
  var _useIsHovered = require("./use-is-hovered");
19
18
  var _context = require("../../block-edit/context");
20
- var _useBlockClassNames = require("./use-block-class-names");
21
- var _useBlockDefaultClassName = require("./use-block-default-class-name");
22
- var _useBlockCustomClassName = require("./use-block-custom-class-name");
23
- var _useBlockMovingModeClassNames = require("./use-block-moving-mode-class-names");
24
19
  var _useFocusHandler = require("./use-focus-handler");
25
20
  var _useSelectedBlockEventHandlers = require("./use-selected-block-event-handlers");
26
21
  var _useNavModeExit = require("./use-nav-mode-exit");
27
22
  var _useBlockRefs = require("./use-block-refs");
28
23
  var _useIntersectionObserver = require("./use-intersection-observer");
29
- var _store = require("../../../store");
30
- var _blockContentOverlay = _interopRequireDefault(require("../../block-content-overlay"));
31
- var _lockUnlock = require("../../../lock-unlock");
32
24
  /**
33
25
  * External dependencies
34
26
  */
@@ -41,12 +33,6 @@ var _lockUnlock = require("../../../lock-unlock");
41
33
  * Internal dependencies
42
34
  */
43
35
 
44
- /**
45
- * If the block count exceeds the threshold, we disable the reordering animation
46
- * to avoid laginess.
47
- */
48
- const BLOCK_ANIMATION_THRESHOLD = 200;
49
-
50
36
  /**
51
37
  * This hook is used to lightly mark an element as a block element. The element
52
38
  * should be the outermost element of a block. Call this hook and pass the
@@ -96,63 +82,46 @@ function useBlockProps(props = {}, {
96
82
  clientId,
97
83
  className,
98
84
  wrapperProps = {},
99
- isAligned
100
- } = (0, _element.useContext)(_blockListBlockContext.BlockListBlockContext);
101
- const {
85
+ isAligned,
102
86
  index,
103
87
  mode,
104
88
  name,
105
89
  blockApiVersion,
106
90
  blockTitle,
107
- isPartOfSelection,
108
- adjustScrolling,
109
- enableAnimation,
110
- isSubtreeDisabled
111
- } = (0, _data.useSelect)(select => {
112
- const {
113
- getBlockAttributes,
114
- getBlockIndex,
115
- getBlockMode,
116
- getBlockName,
117
- isTyping,
118
- getGlobalBlockCount,
119
- isBlockSelected,
120
- isBlockMultiSelected,
121
- isAncestorMultiSelected,
122
- isFirstMultiSelectedBlock,
123
- isBlockSubtreeDisabled
124
- } = (0, _lockUnlock.unlock)(select(_store.store));
125
- const {
126
- getActiveBlockVariation
127
- } = select(_blocks.store);
128
- const isSelected = isBlockSelected(clientId);
129
- const isPartOfMultiSelection = isBlockMultiSelected(clientId) || isAncestorMultiSelected(clientId);
130
- const blockName = getBlockName(clientId);
131
- const blockType = (0, _blocks.getBlockType)(blockName);
132
- const attributes = getBlockAttributes(clientId);
133
- const match = getActiveBlockVariation(blockName, attributes);
134
- return {
135
- index: getBlockIndex(clientId),
136
- mode: getBlockMode(clientId),
137
- name: blockName,
138
- blockApiVersion: blockType?.apiVersion || 1,
139
- blockTitle: match?.title || blockType?.title,
140
- isPartOfSelection: isSelected || isPartOfMultiSelection,
141
- adjustScrolling: isSelected || isFirstMultiSelectedBlock(clientId),
142
- enableAnimation: !isTyping() && getGlobalBlockCount() <= BLOCK_ANIMATION_THRESHOLD,
143
- isSubtreeDisabled: isBlockSubtreeDisabled(clientId)
144
- };
145
- }, [clientId]);
146
- const hasOverlay = (0, _blockContentOverlay.default)(clientId);
91
+ isSelected,
92
+ isSubtreeDisabled,
93
+ isOutlineEnabled,
94
+ hasOverlay,
95
+ initialPosition,
96
+ blockEditingMode,
97
+ isHighlighted,
98
+ isMultiSelected,
99
+ isPartiallySelected,
100
+ isReusable,
101
+ isDragging,
102
+ hasChildSelected,
103
+ removeOutline,
104
+ isBlockMovingMode,
105
+ canInsertMovingBlock,
106
+ isEditingDisabled,
107
+ isTemporarilyEditingAsBlocks,
108
+ defaultClassName
109
+ } = (0, _element.useContext)(_privateBlockContext.PrivateBlockContext);
147
110
 
148
111
  // translators: %s: Type of block (i.e. Text, Image etc)
149
112
  const blockLabel = (0, _i18n.sprintf)((0, _i18n.__)('Block: %s'), blockTitle);
150
113
  const htmlSuffix = mode === 'html' && !__unstableIsHtml ? '-visual' : '';
151
- const mergedRefs = (0, _compose.useMergeRefs)([props.ref, (0, _useFocusFirstElement.useFocusFirstElement)(clientId), (0, _useBlockRefs.useBlockRefProvider)(clientId), (0, _useFocusHandler.useFocusHandler)(clientId), (0, _useSelectedBlockEventHandlers.useEventHandlers)(clientId), (0, _useNavModeExit.useNavModeExit)(clientId), (0, _useIsHovered.useIsHovered)(), (0, _useIntersectionObserver.useIntersectionObserver)(), (0, _useMovingAnimation.default)({
152
- isSelected: isPartOfSelection,
153
- adjustScrolling,
154
- enableAnimation,
155
- triggerAnimationOnChange: index
114
+ const mergedRefs = (0, _compose.useMergeRefs)([props.ref, (0, _useFocusFirstElement.useFocusFirstElement)({
115
+ clientId,
116
+ initialPosition
117
+ }), (0, _useBlockRefs.useBlockRefProvider)(clientId), (0, _useFocusHandler.useFocusHandler)(clientId), (0, _useSelectedBlockEventHandlers.useEventHandlers)({
118
+ clientId,
119
+ isSelected
120
+ }), (0, _useNavModeExit.useNavModeExit)(clientId), (0, _useIsHovered.useIsHovered)({
121
+ isEnabled: isOutlineEnabled
122
+ }), (0, _useIntersectionObserver.useIntersectionObserver)(), (0, _useMovingAnimation.default)({
123
+ triggerAnimationOnChange: index,
124
+ clientId
156
125
  }), (0, _compose.useDisabled)({
157
126
  isDisabled: !hasOverlay
158
127
  })]);
@@ -162,7 +131,7 @@ function useBlockProps(props = {}, {
162
131
  typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? (0, _warning.default)(`Block type "${name}" must support API version 2 or higher to work correctly with "useBlockProps" method.`) : void 0;
163
132
  }
164
133
  return {
165
- tabIndex: 0,
134
+ tabIndex: blockEditingMode === 'disabled' ? -1 : 0,
166
135
  ...wrapperProps,
167
136
  ...props,
168
137
  ref: mergedRefs,
@@ -173,12 +142,23 @@ function useBlockProps(props = {}, {
173
142
  'data-type': name,
174
143
  'data-title': blockTitle,
175
144
  inert: isSubtreeDisabled ? 'true' : undefined,
176
- className: (0, _classnames.default)(
177
- // The wp-block className is important for editor styles.
178
- (0, _classnames.default)('block-editor-block-list__block', {
145
+ className: (0, _classnames.default)('block-editor-block-list__block', {
146
+ // The wp-block className is important for editor styles.
179
147
  'wp-block': !isAligned,
180
- 'has-block-overlay': hasOverlay
181
- }), className, props.className, wrapperProps.className, (0, _useBlockClassNames.useBlockClassNames)(clientId), (0, _useBlockDefaultClassName.useBlockDefaultClassName)(clientId), (0, _useBlockCustomClassName.useBlockCustomClassName)(clientId), (0, _useBlockMovingModeClassNames.useBlockMovingModeClassNames)(clientId)),
148
+ 'has-block-overlay': hasOverlay,
149
+ 'is-selected': isSelected,
150
+ 'is-highlighted': isHighlighted,
151
+ 'is-multi-selected': isMultiSelected,
152
+ 'is-partially-selected': isPartiallySelected,
153
+ 'is-reusable': isReusable,
154
+ 'is-dragging': isDragging,
155
+ 'has-child-selected': hasChildSelected,
156
+ 'remove-outline': removeOutline,
157
+ 'is-block-moving-mode': isBlockMovingMode,
158
+ 'can-insert-moving-block': canInsertMovingBlock,
159
+ 'is-editing-disabled': isEditingDisabled,
160
+ 'is-content-locked-temporarily-editing-as-blocks': isTemporarilyEditingAsBlocks
161
+ }, className, props.className, wrapperProps.className, defaultClassName),
182
162
  style: {
183
163
  ...wrapperProps.style,
184
164
  ...props.style
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_i18n","_blocks","_compose","_data","_warning","_useMovingAnimation","_blockListBlockContext","_useFocusFirstElement","_useIsHovered","_context","_useBlockClassNames","_useBlockDefaultClassName","_useBlockCustomClassName","_useBlockMovingModeClassNames","_useFocusHandler","_useSelectedBlockEventHandlers","_useNavModeExit","_useBlockRefs","_useIntersectionObserver","_store","_blockContentOverlay","_lockUnlock","BLOCK_ANIMATION_THRESHOLD","useBlockProps","props","__unstableIsHtml","clientId","className","wrapperProps","isAligned","useContext","BlockListBlockContext","index","mode","name","blockApiVersion","blockTitle","isPartOfSelection","adjustScrolling","enableAnimation","isSubtreeDisabled","useSelect","select","getBlockAttributes","getBlockIndex","getBlockMode","getBlockName","isTyping","getGlobalBlockCount","isBlockSelected","isBlockMultiSelected","isAncestorMultiSelected","isFirstMultiSelectedBlock","isBlockSubtreeDisabled","unlock","blockEditorStore","getActiveBlockVariation","blocksStore","isSelected","isPartOfMultiSelection","blockName","blockType","getBlockType","attributes","match","apiVersion","title","hasOverlay","useBlockOverlayActive","blockLabel","sprintf","__","htmlSuffix","mergedRefs","useMergeRefs","ref","useFocusFirstElement","useBlockRefProvider","useFocusHandler","useEventHandlers","useNavModeExit","useIsHovered","useIntersectionObserver","useMovingAnimation","triggerAnimationOnChange","useDisabled","isDisabled","blockEditContext","useBlockEditContext","SCRIPT_DEBUG","warning","tabIndex","id","role","inert","undefined","classnames","useBlockClassNames","useBlockDefaultClassName","useBlockCustomClassName","useBlockMovingModeClassNames","style","save","getBlockProps"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__unstableGetBlockProps as getBlockProps,\n\tgetBlockType,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useMergeRefs, useDisabled } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport useMovingAnimation from '../../use-moving-animation';\nimport { BlockListBlockContext } from '../block-list-block-context';\nimport { useFocusFirstElement } from './use-focus-first-element';\nimport { useIsHovered } from './use-is-hovered';\nimport { useBlockEditContext } from '../../block-edit/context';\nimport { useBlockClassNames } from './use-block-class-names';\nimport { useBlockDefaultClassName } from './use-block-default-class-name';\nimport { useBlockCustomClassName } from './use-block-custom-class-name';\nimport { useBlockMovingModeClassNames } from './use-block-moving-mode-class-names';\nimport { useFocusHandler } from './use-focus-handler';\nimport { useEventHandlers } from './use-selected-block-event-handlers';\nimport { useNavModeExit } from './use-nav-mode-exit';\nimport { useBlockRefProvider } from './use-block-refs';\nimport { useIntersectionObserver } from './use-intersection-observer';\nimport { store as blockEditorStore } from '../../../store';\nimport useBlockOverlayActive from '../../block-content-overlay';\nimport { unlock } from '../../../lock-unlock';\n\n/**\n * If the block count exceeds the threshold, we disable the reordering animation\n * to avoid laginess.\n */\nconst BLOCK_ANIMATION_THRESHOLD = 200;\n\n/**\n * This hook is used to lightly mark an element as a block element. The element\n * should be the outermost element of a block. Call this hook and pass the\n * returned props to the element to mark as a block. If you define a ref for the\n * element, it is important to pass the ref to this hook, which the hook in turn\n * will pass to the component through the props it returns. Optionally, you can\n * also pass any other props through this hook, and they will be merged and\n * returned.\n *\n * Use of this hook on the outermost element of a block is required if using API >= v2.\n *\n * @example\n * ```js\n * import { useBlockProps } from '@wordpress/block-editor';\n *\n * export default function Edit() {\n *\n * const blockProps = useBlockProps(\n * className: 'my-custom-class',\n * style: {\n * color: '#222222',\n * backgroundColor: '#eeeeee'\n * }\n * )\n *\n * return (\n *\t <div { ...blockProps }>\n *\n * </div>\n * )\n * }\n *\n * ```\n *\n *\n * @param {Object} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Options for internal use only.\n * @param {boolean} options.__unstableIsHtml\n *\n * @return {Object} Props to pass to the element to mark as a block.\n */\nexport function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {\n\tconst {\n\t\tclientId,\n\t\tclassName,\n\t\twrapperProps = {},\n\t\tisAligned,\n\t} = useContext( BlockListBlockContext );\n\tconst {\n\t\tindex,\n\t\tmode,\n\t\tname,\n\t\tblockApiVersion,\n\t\tblockTitle,\n\t\tisPartOfSelection,\n\t\tadjustScrolling,\n\t\tenableAnimation,\n\t\tisSubtreeDisabled,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockMode,\n\t\t\t\tgetBlockName,\n\t\t\t\tisTyping,\n\t\t\t\tgetGlobalBlockCount,\n\t\t\t\tisBlockSelected,\n\t\t\t\tisBlockMultiSelected,\n\t\t\t\tisAncestorMultiSelected,\n\t\t\t\tisFirstMultiSelectedBlock,\n\t\t\t\tisBlockSubtreeDisabled,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\tconst { getActiveBlockVariation } = select( blocksStore );\n\t\t\tconst isSelected = isBlockSelected( clientId );\n\t\t\tconst isPartOfMultiSelection =\n\t\t\t\tisBlockMultiSelected( clientId ) ||\n\t\t\t\tisAncestorMultiSelected( clientId );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\tconst match = getActiveBlockVariation( blockName, attributes );\n\n\t\t\treturn {\n\t\t\t\tindex: getBlockIndex( clientId ),\n\t\t\t\tmode: getBlockMode( clientId ),\n\t\t\t\tname: blockName,\n\t\t\t\tblockApiVersion: blockType?.apiVersion || 1,\n\t\t\t\tblockTitle: match?.title || blockType?.title,\n\t\t\t\tisPartOfSelection: isSelected || isPartOfMultiSelection,\n\t\t\t\tadjustScrolling:\n\t\t\t\t\tisSelected || isFirstMultiSelectedBlock( clientId ),\n\t\t\t\tenableAnimation:\n\t\t\t\t\t! isTyping() &&\n\t\t\t\t\tgetGlobalBlockCount() <= BLOCK_ANIMATION_THRESHOLD,\n\t\t\t\tisSubtreeDisabled: isBlockSubtreeDisabled( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst hasOverlay = useBlockOverlayActive( clientId );\n\n\t// translators: %s: Type of block (i.e. Text, Image etc)\n\tconst blockLabel = sprintf( __( 'Block: %s' ), blockTitle );\n\tconst htmlSuffix = mode === 'html' && ! __unstableIsHtml ? '-visual' : '';\n\tconst mergedRefs = useMergeRefs( [\n\t\tprops.ref,\n\t\tuseFocusFirstElement( clientId ),\n\t\tuseBlockRefProvider( clientId ),\n\t\tuseFocusHandler( clientId ),\n\t\tuseEventHandlers( clientId ),\n\t\tuseNavModeExit( clientId ),\n\t\tuseIsHovered(),\n\t\tuseIntersectionObserver(),\n\t\tuseMovingAnimation( {\n\t\t\tisSelected: isPartOfSelection,\n\t\t\tadjustScrolling,\n\t\t\tenableAnimation,\n\t\t\ttriggerAnimationOnChange: index,\n\t\t} ),\n\t\tuseDisabled( { isDisabled: ! hasOverlay } ),\n\t] );\n\n\tconst blockEditContext = useBlockEditContext();\n\t// Ensures it warns only inside the `edit` implementation for the block.\n\tif ( blockApiVersion < 2 && clientId === blockEditContext.clientId ) {\n\t\twarning(\n\t\t\t`Block type \"${ name }\" must support API version 2 or higher to work correctly with \"useBlockProps\" method.`\n\t\t);\n\t}\n\n\treturn {\n\t\ttabIndex: 0,\n\t\t...wrapperProps,\n\t\t...props,\n\t\tref: mergedRefs,\n\t\tid: `block-${ clientId }${ htmlSuffix }`,\n\t\trole: 'document',\n\t\t'aria-label': blockLabel,\n\t\t'data-block': clientId,\n\t\t'data-type': name,\n\t\t'data-title': blockTitle,\n\t\tinert: isSubtreeDisabled ? 'true' : undefined,\n\t\tclassName: classnames(\n\t\t\t// The wp-block className is important for editor styles.\n\t\t\tclassnames( 'block-editor-block-list__block', {\n\t\t\t\t'wp-block': ! isAligned,\n\t\t\t\t'has-block-overlay': hasOverlay,\n\t\t\t} ),\n\t\t\tclassName,\n\t\t\tprops.className,\n\t\t\twrapperProps.className,\n\t\t\tuseBlockClassNames( clientId ),\n\t\t\tuseBlockDefaultClassName( clientId ),\n\t\t\tuseBlockCustomClassName( clientId ),\n\t\t\tuseBlockMovingModeClassNames( clientId )\n\t\t),\n\t\tstyle: { ...wrapperProps.style, ...props.style },\n\t};\n}\n\n/**\n * Call within a save function to get the props for the block wrapper.\n *\n * @param {Object} props Optional. Props to pass to the element.\n */\nuseBlockProps.save = getBlockProps;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAKA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAP,sBAAA,CAAAC,OAAA;AAKA,IAAAO,mBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,sBAAA,GAAAR,OAAA;AACA,IAAAS,qBAAA,GAAAT,OAAA;AACA,IAAAU,aAAA,GAAAV,OAAA;AACA,IAAAW,QAAA,GAAAX,OAAA;AACA,IAAAY,mBAAA,GAAAZ,OAAA;AACA,IAAAa,yBAAA,GAAAb,OAAA;AACA,IAAAc,wBAAA,GAAAd,OAAA;AACA,IAAAe,6BAAA,GAAAf,OAAA;AACA,IAAAgB,gBAAA,GAAAhB,OAAA;AACA,IAAAiB,8BAAA,GAAAjB,OAAA;AACA,IAAAkB,eAAA,GAAAlB,OAAA;AACA,IAAAmB,aAAA,GAAAnB,OAAA;AACA,IAAAoB,wBAAA,GAAApB,OAAA;AACA,IAAAqB,MAAA,GAAArB,OAAA;AACA,IAAAsB,oBAAA,GAAAvB,sBAAA,CAAAC,OAAA;AACA,IAAAuB,WAAA,GAAAvB,OAAA;AAtCA;AACA;AACA;;AAGA;AACA;AACA;;AAYA;AACA;AACA;;AAmBA;AACA;AACA;AACA;AACA,MAAMwB,yBAAyB,GAAG,GAAG;;AAEr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AAE,GAAG7E,KAAK,CAAC6E;IAAM;EAChD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA9E,aAAa,CAAC+E,IAAI,GAAGC,+BAAa"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_i18n","_blocks","_compose","_warning","_useMovingAnimation","_privateBlockContext","_useFocusFirstElement","_useIsHovered","_context","_useFocusHandler","_useSelectedBlockEventHandlers","_useNavModeExit","_useBlockRefs","_useIntersectionObserver","useBlockProps","props","__unstableIsHtml","clientId","className","wrapperProps","isAligned","index","mode","name","blockApiVersion","blockTitle","isSelected","isSubtreeDisabled","isOutlineEnabled","hasOverlay","initialPosition","blockEditingMode","isHighlighted","isMultiSelected","isPartiallySelected","isReusable","isDragging","hasChildSelected","removeOutline","isBlockMovingMode","canInsertMovingBlock","isEditingDisabled","isTemporarilyEditingAsBlocks","defaultClassName","useContext","PrivateBlockContext","blockLabel","sprintf","__","htmlSuffix","mergedRefs","useMergeRefs","ref","useFocusFirstElement","useBlockRefProvider","useFocusHandler","useEventHandlers","useNavModeExit","useIsHovered","isEnabled","useIntersectionObserver","useMovingAnimation","triggerAnimationOnChange","useDisabled","isDisabled","blockEditContext","useBlockEditContext","SCRIPT_DEBUG","warning","tabIndex","id","role","inert","undefined","classnames","style","save","getBlockProps"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __unstableGetBlockProps as getBlockProps } from '@wordpress/blocks';\nimport { useMergeRefs, useDisabled } from '@wordpress/compose';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport useMovingAnimation from '../../use-moving-animation';\nimport { PrivateBlockContext } from '../private-block-context';\nimport { useFocusFirstElement } from './use-focus-first-element';\nimport { useIsHovered } from './use-is-hovered';\nimport { useBlockEditContext } from '../../block-edit/context';\nimport { useFocusHandler } from './use-focus-handler';\nimport { useEventHandlers } from './use-selected-block-event-handlers';\nimport { useNavModeExit } from './use-nav-mode-exit';\nimport { useBlockRefProvider } from './use-block-refs';\nimport { useIntersectionObserver } from './use-intersection-observer';\n\n/**\n * This hook is used to lightly mark an element as a block element. The element\n * should be the outermost element of a block. Call this hook and pass the\n * returned props to the element to mark as a block. If you define a ref for the\n * element, it is important to pass the ref to this hook, which the hook in turn\n * will pass to the component through the props it returns. Optionally, you can\n * also pass any other props through this hook, and they will be merged and\n * returned.\n *\n * Use of this hook on the outermost element of a block is required if using API >= v2.\n *\n * @example\n * ```js\n * import { useBlockProps } from '@wordpress/block-editor';\n *\n * export default function Edit() {\n *\n * const blockProps = useBlockProps(\n * className: 'my-custom-class',\n * style: {\n * color: '#222222',\n * backgroundColor: '#eeeeee'\n * }\n * )\n *\n * return (\n *\t <div { ...blockProps }>\n *\n * </div>\n * )\n * }\n *\n * ```\n *\n *\n * @param {Object} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Options for internal use only.\n * @param {boolean} options.__unstableIsHtml\n *\n * @return {Object} Props to pass to the element to mark as a block.\n */\nexport function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {\n\tconst {\n\t\tclientId,\n\t\tclassName,\n\t\twrapperProps = {},\n\t\tisAligned,\n\t\tindex,\n\t\tmode,\n\t\tname,\n\t\tblockApiVersion,\n\t\tblockTitle,\n\t\tisSelected,\n\t\tisSubtreeDisabled,\n\t\tisOutlineEnabled,\n\t\thasOverlay,\n\t\tinitialPosition,\n\t\tblockEditingMode,\n\t\tisHighlighted,\n\t\tisMultiSelected,\n\t\tisPartiallySelected,\n\t\tisReusable,\n\t\tisDragging,\n\t\thasChildSelected,\n\t\tremoveOutline,\n\t\tisBlockMovingMode,\n\t\tcanInsertMovingBlock,\n\t\tisEditingDisabled,\n\t\tisTemporarilyEditingAsBlocks,\n\t\tdefaultClassName,\n\t} = useContext( PrivateBlockContext );\n\n\t// translators: %s: Type of block (i.e. Text, Image etc)\n\tconst blockLabel = sprintf( __( 'Block: %s' ), blockTitle );\n\tconst htmlSuffix = mode === 'html' && ! __unstableIsHtml ? '-visual' : '';\n\tconst mergedRefs = useMergeRefs( [\n\t\tprops.ref,\n\t\tuseFocusFirstElement( { clientId, initialPosition } ),\n\t\tuseBlockRefProvider( clientId ),\n\t\tuseFocusHandler( clientId ),\n\t\tuseEventHandlers( { clientId, isSelected } ),\n\t\tuseNavModeExit( clientId ),\n\t\tuseIsHovered( { isEnabled: isOutlineEnabled } ),\n\t\tuseIntersectionObserver(),\n\t\tuseMovingAnimation( { triggerAnimationOnChange: index, clientId } ),\n\t\tuseDisabled( { isDisabled: ! hasOverlay } ),\n\t] );\n\n\tconst blockEditContext = useBlockEditContext();\n\t// Ensures it warns only inside the `edit` implementation for the block.\n\tif ( blockApiVersion < 2 && clientId === blockEditContext.clientId ) {\n\t\twarning(\n\t\t\t`Block type \"${ name }\" must support API version 2 or higher to work correctly with \"useBlockProps\" method.`\n\t\t);\n\t}\n\n\treturn {\n\t\ttabIndex: blockEditingMode === 'disabled' ? -1 : 0,\n\t\t...wrapperProps,\n\t\t...props,\n\t\tref: mergedRefs,\n\t\tid: `block-${ clientId }${ htmlSuffix }`,\n\t\trole: 'document',\n\t\t'aria-label': blockLabel,\n\t\t'data-block': clientId,\n\t\t'data-type': name,\n\t\t'data-title': blockTitle,\n\t\tinert: isSubtreeDisabled ? 'true' : undefined,\n\t\tclassName: classnames(\n\t\t\t'block-editor-block-list__block',\n\t\t\t{\n\t\t\t\t// The wp-block className is important for editor styles.\n\t\t\t\t'wp-block': ! isAligned,\n\t\t\t\t'has-block-overlay': hasOverlay,\n\t\t\t\t'is-selected': isSelected,\n\t\t\t\t'is-highlighted': isHighlighted,\n\t\t\t\t'is-multi-selected': isMultiSelected,\n\t\t\t\t'is-partially-selected': isPartiallySelected,\n\t\t\t\t'is-reusable': isReusable,\n\t\t\t\t'is-dragging': isDragging,\n\t\t\t\t'has-child-selected': hasChildSelected,\n\t\t\t\t'remove-outline': removeOutline,\n\t\t\t\t'is-block-moving-mode': isBlockMovingMode,\n\t\t\t\t'can-insert-moving-block': canInsertMovingBlock,\n\t\t\t\t'is-editing-disabled': isEditingDisabled,\n\t\t\t\t'is-content-locked-temporarily-editing-as-blocks':\n\t\t\t\t\tisTemporarilyEditingAsBlocks,\n\t\t\t},\n\t\t\tclassName,\n\t\t\tprops.className,\n\t\t\twrapperProps.className,\n\t\t\tdefaultClassName\n\t\t),\n\t\tstyle: { ...wrapperProps.style, ...props.style },\n\t};\n}\n\n/**\n * Call within a save function to get the props for the block wrapper.\n *\n * @param {Object} props Optional. Props to pass to the element.\n */\nuseBlockProps.save = getBlockProps;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAN,sBAAA,CAAAC,OAAA;AAKA,IAAAM,mBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,oBAAA,GAAAP,OAAA;AACA,IAAAQ,qBAAA,GAAAR,OAAA;AACA,IAAAS,aAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,gBAAA,GAAAX,OAAA;AACA,IAAAY,8BAAA,GAAAZ,OAAA;AACA,IAAAa,eAAA,GAAAb,OAAA;AACA,IAAAc,aAAA,GAAAd,OAAA;AACA,IAAAe,wBAAA,GAAAf,OAAA;AA1BA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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EC,iBAAiB;MACxC,iDAAiD,EAChDC;IACF,CAAC,EACDxB,SAAS,EACTH,KAAK,CAACG,SAAS,EACfC,YAAY,CAACD,SAAS,EACtByB,gBACD,CAAC;IACDgC,KAAK,EAAE;MAAE,GAAGxD,YAAY,CAACwD,KAAK;MAAE,GAAG5D,KAAK,CAAC4D;IAAM;EAChD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA7D,aAAa,CAAC8D,IAAI,GAAGC,+BAAa"}
@@ -19,33 +19,6 @@ var _store = require("../../../store");
19
19
 
20
20
  /** @typedef {import('@wordpress/element').RefObject} RefObject */
21
21
 
22
- /**
23
- * Returns the initial position if the block needs to be focussed, `undefined`
24
- * otherwise. The initial position is either 0 (start) or -1 (end).
25
- *
26
- * @param {string} clientId Block client ID.
27
- *
28
- * @return {number} The initial position, either 0 (start) or -1 (end).
29
- */
30
- function useInitialPosition(clientId) {
31
- return (0, _data.useSelect)(select => {
32
- const {
33
- getSelectedBlocksInitialCaretPosition,
34
- __unstableGetEditorMode,
35
- isBlockSelected
36
- } = select(_store.store);
37
- if (!isBlockSelected(clientId)) {
38
- return;
39
- }
40
- if (__unstableGetEditorMode() !== 'edit') {
41
- return;
42
- }
43
-
44
- // If there's no initial position, return 0 to focus the start.
45
- return getSelectedBlocksInitialCaretPosition();
46
- }, [clientId]);
47
- }
48
-
49
22
  /**
50
23
  * Transitions focus to the block or inner tabbable when the block becomes
51
24
  * selected and an initial position is set.
@@ -54,9 +27,11 @@ function useInitialPosition(clientId) {
54
27
  *
55
28
  * @return {RefObject} React ref with the block element.
56
29
  */
57
- function useFocusFirstElement(clientId) {
30
+ function useFocusFirstElement({
31
+ clientId,
32
+ initialPosition
33
+ }) {
58
34
  const ref = (0, _element.useRef)();
59
- const initialPosition = useInitialPosition(clientId);
60
35
  const {
61
36
  isBlockSelected,
62
37
  isMultiSelecting
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_dom","_data","_dom2","_store","useInitialPosition","clientId","useSelect","select","getSelectedBlocksInitialCaretPosition","__unstableGetEditorMode","isBlockSelected","blockEditorStore","useFocusFirstElement","ref","useRef","initialPosition","isMultiSelecting","useEffect","undefined","current","ownerDocument","isInsideRootBlock","activeElement","textInputs","focus","tabbable","find","filter","node","isTextField","isReverse","target","length","getAttribute","focusElement","findNext","isFormElement","placeCaretAtHorizontalEdge"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-focus-first-element.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport {\n\tfocus,\n\tisFormElement,\n\tisTextField,\n\tplaceCaretAtHorizontalEdge,\n} from '@wordpress/dom';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { isInsideRootBlock } from '../../../utils/dom';\nimport { store as blockEditorStore } from '../../../store';\n\n/** @typedef {import('@wordpress/element').RefObject} RefObject */\n\n/**\n * Returns the initial position if the block needs to be focussed, `undefined`\n * otherwise. The initial position is either 0 (start) or -1 (end).\n *\n * @param {string} clientId Block client ID.\n *\n * @return {number} The initial position, either 0 (start) or -1 (end).\n */\nfunction useInitialPosition( clientId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetSelectedBlocksInitialCaretPosition,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t\tisBlockSelected,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tif ( ! isBlockSelected( clientId ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( __unstableGetEditorMode() !== 'edit' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If there's no initial position, return 0 to focus the start.\n\t\t\treturn getSelectedBlocksInitialCaretPosition();\n\t\t},\n\t\t[ clientId ]\n\t);\n}\n\n/**\n * Transitions focus to the block or inner tabbable when the block becomes\n * selected and an initial position is set.\n *\n * @param {string} clientId Block client ID.\n *\n * @return {RefObject} React ref with the block element.\n */\nexport function useFocusFirstElement( clientId ) {\n\tconst ref = useRef();\n\tconst initialPosition = useInitialPosition( clientId );\n\tconst { isBlockSelected, isMultiSelecting } = useSelect( blockEditorStore );\n\n\tuseEffect( () => {\n\t\t// Check if the block is still selected at the time this effect runs.\n\t\tif ( ! isBlockSelected( clientId ) || isMultiSelecting() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( initialPosition === undefined || initialPosition === null ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { ownerDocument } = ref.current;\n\n\t\t// Do not focus the block if it already contains the active element.\n\t\tif ( isInsideRootBlock( ref.current, ownerDocument.activeElement ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Find all tabbables within node.\n\t\tconst textInputs = focus.tabbable\n\t\t\t.find( ref.current )\n\t\t\t.filter( ( node ) => isTextField( node ) );\n\n\t\t// If reversed (e.g. merge via backspace), use the last in the set of\n\t\t// tabbables.\n\t\tconst isReverse = -1 === initialPosition;\n\t\tconst target =\n\t\t\ttextInputs[ isReverse ? textInputs.length - 1 : 0 ] || ref.current;\n\n\t\tif ( ! isInsideRootBlock( ref.current, target ) ) {\n\t\t\tref.current.focus();\n\t\t\treturn;\n\t\t}\n\n\t\t// Check to see if element is focussable before a generic caret insert.\n\t\tif ( ! ref.current.getAttribute( 'contenteditable' ) ) {\n\t\t\tconst focusElement = focus.tabbable.findNext( ref.current );\n\t\t\t// Make sure focusElement is valid, contained in the same block, and a form field.\n\t\t\tif (\n\t\t\t\tfocusElement &&\n\t\t\t\tisInsideRootBlock( ref.current, focusElement ) &&\n\t\t\t\tisFormElement( focusElement )\n\t\t\t) {\n\t\t\t\tfocusElement.focus();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tplaceCaretAtHorizontalEdge( target, isReverse );\n\t}, [ initialPosition, clientId ] );\n\n\treturn ref;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GA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aAAa,CAACE,aAAc,CAAC,EAAG;MACpE;IACD;;IAEA;IACA,MAAMC,UAAU,GAAGC,UAAK,CAACC,QAAQ,CAC/BC,IAAI,CAAEb,GAAG,CAACM,OAAQ,CAAC,CACnBQ,MAAM,CAAIC,IAAI,IAAM,IAAAC,gBAAW,EAAED,IAAK,CAAE,CAAC;;IAE3C;IACA;IACA,MAAME,SAAS,GAAG,CAAC,CAAC,KAAKf,eAAe;IACxC,MAAMgB,MAAM,GACXR,UAAU,CAAEO,SAAS,GAAGP,UAAU,CAACS,MAAM,GAAG,CAAC,GAAG,CAAC,CAAE,IAAInB,GAAG,CAACM,OAAO;IAEnE,IAAK,CAAE,IAAAE,uBAAiB,EAAER,GAAG,CAACM,OAAO,EAAEY,MAAO,CAAC,EAAG;MACjDlB,GAAG,CAACM,OAAO,CAACK,KAAK,CAAC,CAAC;MACnB;IACD;;IAEA;IACA,IAAK,CAAEX,GAAG,CAACM,OAAO,CAACc,YAAY,CAAE,iBAAkB,CAAC,EAAG;MACtD,MAAMC,YAAY,GAAGV,UAAK,CAACC,QAAQ,CAACU,QAAQ,CAAEtB,GAAG,CAACM,OAAQ,CAAC;MAC3D;MACA,IACCe,YAAY,IACZ,IAAAb,uBAAiB,EAAER,GAAG,CAACM,OAAO,EAAEe,YAAa,CAAC,IAC9C,IAAAE,kBAAa,EAAEF,YAAa,CAAC,EAC5B;QACDA,YAAY,CAACV,KAAK,CAAC,CAAC;QACpB;MACD;IACD;IAEA,IAAAa,+BAA0B,EAAEN,MAAM,EAAED,SAAU,CAAC;EAChD,CAAC,EAAE,CAAEf,eAAe,EAAEV,QAAQ,CAAG,CAAC;EAElC,OAAOQ,GAAG;AACX"}
1
+ {"version":3,"names":["_element","require","_dom","_data","_dom2","_store","useFocusFirstElement","clientId","initialPosition","ref","useRef","isBlockSelected","isMultiSelecting","useSelect","blockEditorStore","useEffect","undefined","current","ownerDocument","isInsideRootBlock","activeElement","textInputs","focus","tabbable","find","filter","node","isTextField","isReverse","target","length","getAttribute","focusElement","findNext","isFormElement","placeCaretAtHorizontalEdge"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-focus-first-element.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport {\n\tfocus,\n\tisFormElement,\n\tisTextField,\n\tplaceCaretAtHorizontalEdge,\n} from '@wordpress/dom';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { isInsideRootBlock } from '../../../utils/dom';\nimport { store as blockEditorStore } from '../../../store';\n\n/** @typedef {import('@wordpress/element').RefObject} RefObject */\n\n/**\n * Transitions focus to the block or inner tabbable when the block becomes\n * selected and an initial position is set.\n *\n * @param {string} clientId Block client ID.\n *\n * @return {RefObject} React ref with the block element.\n */\nexport function useFocusFirstElement( { clientId, initialPosition } ) {\n\tconst ref = useRef();\n\tconst { isBlockSelected, isMultiSelecting } = useSelect( blockEditorStore );\n\n\tuseEffect( () => {\n\t\t// Check if the block is still selected at the time this effect runs.\n\t\tif ( ! isBlockSelected( clientId ) || isMultiSelecting() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( initialPosition === undefined || initialPosition === null ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { ownerDocument } = ref.current;\n\n\t\t// Do not focus the block if it already contains the active element.\n\t\tif ( isInsideRootBlock( ref.current, ownerDocument.activeElement ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Find all tabbables within node.\n\t\tconst textInputs = focus.tabbable\n\t\t\t.find( ref.current )\n\t\t\t.filter( ( node ) => isTextField( node ) );\n\n\t\t// If reversed (e.g. merge via backspace), use the last in the set of\n\t\t// tabbables.\n\t\tconst isReverse = -1 === initialPosition;\n\t\tconst target =\n\t\t\ttextInputs[ isReverse ? textInputs.length - 1 : 0 ] || ref.current;\n\n\t\tif ( ! isInsideRootBlock( ref.current, target ) ) {\n\t\t\tref.current.focus();\n\t\t\treturn;\n\t\t}\n\n\t\t// Check to see if element is focussable before a generic caret insert.\n\t\tif ( ! ref.current.getAttribute( 'contenteditable' ) ) {\n\t\t\tconst focusElement = focus.tabbable.findNext( ref.current );\n\t\t\t// Make sure focusElement is valid, contained in the same block, and a form field.\n\t\t\tif (\n\t\t\t\tfocusElement &&\n\t\t\t\tisInsideRootBlock( ref.current, focusElement ) &&\n\t\t\t\tisFormElement( focusElement )\n\t\t\t) {\n\t\t\t\tfocusElement.focus();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tplaceCaretAtHorizontalEdge( target, isReverse );\n\t}, [ initialPosition, clientId ] );\n\n\treturn ref;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAMA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAhBA;AACA;AACA;;AAUA;AACA;AACA;;AAIA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,oBAAoBA,CAAE;EAAEC,QAAQ;EAAEC;AAAgB,CAAC,EAAG;EACrE,MAAMC,GAAG,GAAG,IAAAC,eAAM,EAAC,CAAC;EACpB,MAAM;IAAEC,eAAe;IAAEC;EAAiB,CAAC,GAAG,IAAAC,eAAS,EAAEC,YAAiB,CAAC;EAE3E,IAAAC,kBAAS,EAAE,MAAM;IAChB;IACA,IAAK,CAAEJ,eAAe,CAAEJ,QAAS,CAAC,IAAIK,gBAAgB,CAAC,CAAC,EAAG;MAC1D;IACD;IAEA,IAAKJ,eAAe,KAAKQ,SAAS,IAAIR,eAAe,KAAK,IAAI,EAAG;MAChE;IACD;IAEA,IAAK,CAAEC,GAAG,CAACQ,OAAO,EAAG;MACpB;IACD;IAEA,MAAM;MAAEC;IAAc,CAAC,GAAGT,GAAG,CAACQ,OAAO;;IAErC;IACA,IAAK,IAAAE,uBAAiB,EAAEV,GAAG,CAACQ,OAAO,EAAEC,aAAa,CAACE,aAAc,CAAC,EAAG;MACpE;IACD;;IAEA;IACA,MAAMC,UAAU,GAAGC,UAAK,CAACC,QAAQ,CAC/BC,IAAI,CAAEf,GAAG,CAACQ,OAAQ,CAAC,CACnBQ,MAAM,CAAIC,IAAI,IAAM,IAAAC,gBAAW,EAAED,IAAK,CAAE,CAAC;;IAE3C;IACA;IACA,MAAME,SAAS,GAAG,CAAC,CAAC,KAAKpB,eAAe;IACxC,MAAMqB,MAAM,GACXR,UAAU,CAAEO,SAAS,GAAGP,UAAU,CAACS,MAAM,GAAG,CAAC,GAAG,CAAC,CAAE,IAAIrB,GAAG,CAACQ,OAAO;IAEnE,IAAK,CAAE,IAAAE,uBAAiB,EAAEV,GAAG,CAACQ,OAAO,EAAEY,MAAO,CAAC,EAAG;MACjDpB,GAAG,CAACQ,OAAO,CAACK,KAAK,CAAC,CAAC;MACnB;IACD;;IAEA;IACA,IAAK,CAAEb,GAAG,CAACQ,OAAO,CAACc,YAAY,CAAE,iBAAkB,CAAC,EAAG;MACtD,MAAMC,YAAY,GAAGV,UAAK,CAACC,QAAQ,CAACU,QAAQ,CAAExB,GAAG,CAACQ,OAAQ,CAAC;MAC3D;MACA,IACCe,YAAY,IACZ,IAAAb,uBAAiB,EAAEV,GAAG,CAACQ,OAAO,EAAEe,YAAa,CAAC,IAC9C,IAAAE,kBAAa,EAAEF,YAAa,CAAC,EAC5B;QACDA,YAAY,CAACV,KAAK,CAAC,CAAC;QACpB;MACD;IACD;IAEA,IAAAa,+BAA0B,EAAEN,MAAM,EAAED,SAAU,CAAC;EAChD,CAAC,EAAE,CAAEpB,eAAe,EAAED,QAAQ,CAAG,CAAC;EAElC,OAAOE,GAAG;AACX"}
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useIsHovered = useIsHovered;
7
- var _data = require("@wordpress/data");
8
7
  var _compose = require("@wordpress/compose");
9
- var _store = require("../../../store");
10
8
  /**
11
9
  * WordPress dependencies
12
10
  */
13
11
 
14
- /**
15
- * Internal dependencies
16
- */
17
-
18
12
  function listener(event) {
19
13
  if (event.defaultPrevented) {
20
14
  return;
@@ -24,17 +18,13 @@ function listener(event) {
24
18
  event.currentTarget.classList[action]('is-hovered');
25
19
  }
26
20
 
27
- /**
21
+ /*
28
22
  * Adds `is-hovered` class when the block is hovered and in navigation or
29
23
  * outline mode.
30
24
  */
31
- function useIsHovered() {
32
- const isEnabled = (0, _data.useSelect)(select => {
33
- const {
34
- getSettings
35
- } = select(_store.store);
36
- return getSettings().outlineMode;
37
- }, []);
25
+ function useIsHovered({
26
+ isEnabled
27
+ }) {
38
28
  return (0, _compose.useRefEffect)(node => {
39
29
  if (isEnabled) {
40
30
  node.addEventListener('mouseout', listener);
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_compose","_store","listener","event","defaultPrevented","action","type","preventDefault","currentTarget","classList","useIsHovered","isEnabled","useSelect","select","getSettings","blockEditorStore","outlineMode","useRefEffect","node","addEventListener","removeEventListener","remove"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-is-hovered.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\n\nfunction listener( event ) {\n\tif ( event.defaultPrevented ) {\n\t\treturn;\n\t}\n\n\tconst action = event.type === 'mouseover' ? 'add' : 'remove';\n\n\tevent.preventDefault();\n\tevent.currentTarget.classList[ action ]( 'is-hovered' );\n}\n\n/**\n * Adds `is-hovered` class when the block is hovered and in navigation or\n * outline mode.\n */\nexport function useIsHovered() {\n\tconst isEnabled = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().outlineMode;\n\t}, [] );\n\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tif ( isEnabled ) {\n\t\t\t\tnode.addEventListener( 'mouseout', listener );\n\t\t\t\tnode.addEventListener( 'mouseover', listener );\n\n\t\t\t\treturn () => {\n\t\t\t\t\tnode.removeEventListener( 'mouseout', listener );\n\t\t\t\t\tnode.removeEventListener( 'mouseover', listener );\n\n\t\t\t\t\t// Remove class in case it lingers.\n\t\t\t\t\tnode.classList.remove( 'is-hovered' );\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t\t[ isEnabled ]\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA,SAASG,QAAQA,CAAEC,KAAK,EAAG;EAC1B,IAAKA,KAAK,CAACC,gBAAgB,EAAG;IAC7B;EACD;EAEA,MAAMC,MAAM,GAAGF,KAAK,CAACG,IAAI,KAAK,WAAW,GAAG,KAAK,GAAG,QAAQ;EAE5DH,KAAK,CAACI,cAAc,CAAC,CAAC;EACtBJ,KAAK,CAACK,aAAa,CAACC,SAAS,CAAEJ,MAAM,CAAE,CAAE,YAAa,CAAC;AACxD;;AAEA;AACA;AACA;AACA;AACO,SAASK,YAAYA,CAAA,EAAG;EAC9B,MAAMC,SAAS,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC1C,MAAM;MAAEC;IAAY,CAAC,GAAGD,MAAM,CAAEE,YAAiB,CAAC;IAClD,OAAOD,WAAW,CAAC,CAAC,CAACE,WAAW;EACjC,CAAC,EAAE,EAAG,CAAC;EAEP,OAAO,IAAAC,qBAAY,EAChBC,IAAI,IAAM;IACX,IAAKP,SAAS,EAAG;MAChBO,IAAI,CAACC,gBAAgB,CAAE,UAAU,EAAEjB,QAAS,CAAC;MAC7CgB,IAAI,CAACC,gBAAgB,CAAE,WAAW,EAAEjB,QAAS,CAAC;MAE9C,OAAO,MAAM;QACZgB,IAAI,CAACE,mBAAmB,CAAE,UAAU,EAAElB,QAAS,CAAC;QAChDgB,IAAI,CAACE,mBAAmB,CAAE,WAAW,EAAElB,QAAS,CAAC;;QAEjD;QACAgB,IAAI,CAACT,SAAS,CAACY,MAAM,CAAE,YAAa,CAAC;MACtC,CAAC;IACF;EACD,CAAC,EACD,CAAEV,SAAS,CACZ,CAAC;AACF"}
1
+ {"version":3,"names":["_compose","require","listener","event","defaultPrevented","action","type","preventDefault","currentTarget","classList","useIsHovered","isEnabled","useRefEffect","node","addEventListener","removeEventListener","remove"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-is-hovered.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\n\nfunction listener( event ) {\n\tif ( event.defaultPrevented ) {\n\t\treturn;\n\t}\n\n\tconst action = event.type === 'mouseover' ? 'add' : 'remove';\n\n\tevent.preventDefault();\n\tevent.currentTarget.classList[ action ]( 'is-hovered' );\n}\n\n/*\n * Adds `is-hovered` class when the block is hovered and in navigation or\n * outline mode.\n */\nexport function useIsHovered( { isEnabled } ) {\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tif ( isEnabled ) {\n\t\t\t\tnode.addEventListener( 'mouseout', listener );\n\t\t\t\tnode.addEventListener( 'mouseover', listener );\n\n\t\t\t\treturn () => {\n\t\t\t\t\tnode.removeEventListener( 'mouseout', listener );\n\t\t\t\t\tnode.removeEventListener( 'mouseover', listener );\n\n\t\t\t\t\t// Remove class in case it lingers.\n\t\t\t\t\tnode.classList.remove( 'is-hovered' );\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t\t[ isEnabled ]\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,SAASC,QAAQA,CAAEC,KAAK,EAAG;EAC1B,IAAKA,KAAK,CAACC,gBAAgB,EAAG;IAC7B;EACD;EAEA,MAAMC,MAAM,GAAGF,KAAK,CAACG,IAAI,KAAK,WAAW,GAAG,KAAK,GAAG,QAAQ;EAE5DH,KAAK,CAACI,cAAc,CAAC,CAAC;EACtBJ,KAAK,CAACK,aAAa,CAACC,SAAS,CAAEJ,MAAM,CAAE,CAAE,YAAa,CAAC;AACxD;;AAEA;AACA;AACA;AACA;AACO,SAASK,YAAYA,CAAE;EAAEC;AAAU,CAAC,EAAG;EAC7C,OAAO,IAAAC,qBAAY,EAChBC,IAAI,IAAM;IACX,IAAKF,SAAS,EAAG;MAChBE,IAAI,CAACC,gBAAgB,CAAE,UAAU,EAAEZ,QAAS,CAAC;MAC7CW,IAAI,CAACC,gBAAgB,CAAE,WAAW,EAAEZ,QAAS,CAAC;MAE9C,OAAO,MAAM;QACZW,IAAI,CAACE,mBAAmB,CAAE,UAAU,EAAEb,QAAS,CAAC;QAChDW,IAAI,CAACE,mBAAmB,CAAE,WAAW,EAAEb,QAAS,CAAC;;QAEjD;QACAW,IAAI,CAACJ,SAAS,CAACO,MAAM,CAAE,YAAa,CAAC;MACtC,CAAC;IACF;EACD,CAAC,EACD,CAAEL,SAAS,CACZ,CAAC;AACF"}
@@ -25,8 +25,10 @@ var _store = require("../../../store");
25
25
  *
26
26
  * @param {string} clientId Block client ID.
27
27
  */
28
- function useEventHandlers(clientId) {
29
- const isSelected = (0, _data.useSelect)(select => select(_store.store).isBlockSelected(clientId), [clientId]);
28
+ function useEventHandlers({
29
+ clientId,
30
+ isSelected
31
+ }) {
30
32
  const {
31
33
  getBlockRootClientId,
32
34
  getBlockIndex
@@ -1 +1 @@
1
- {"version":3,"names":["_dom","require","_keycodes","_data","_compose","_store","useEventHandlers","clientId","isSelected","useSelect","select","blockEditorStore","isBlockSelected","getBlockRootClientId","getBlockIndex","insertDefaultBlock","removeBlock","useDispatch","useRefEffect","node","onKeyDown","event","keyCode","target","ENTER","BACKSPACE","DELETE","isTextField","preventDefault","onDragStart","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-selected-block-event-handlers.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { isTextField } from '@wordpress/dom';\nimport { ENTER, BACKSPACE, DELETE } from '@wordpress/keycodes';\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 * Adds block behaviour:\n * - Removes the block on BACKSPACE.\n * - Inserts a default block on ENTER.\n * - Disables dragging of block contents.\n *\n * @param {string} clientId Block client ID.\n */\nexport function useEventHandlers( clientId ) {\n\tconst isSelected = useSelect(\n\t\t( select ) => select( blockEditorStore ).isBlockSelected( clientId ),\n\t\t[ clientId ]\n\t);\n\tconst { getBlockRootClientId, getBlockIndex } =\n\t\tuseSelect( blockEditorStore );\n\tconst { insertDefaultBlock, removeBlock } = useDispatch( blockEditorStore );\n\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tif ( ! isSelected ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Interprets keydown event intent to remove or insert after block if\n\t\t\t * key event occurs on wrapper node. This can occur when the block has\n\t\t\t * no text fields of its own, particularly after initial insertion, to\n\t\t\t * allow for easy deletion and continuous writing flow to add additional\n\t\t\t * content.\n\t\t\t *\n\t\t\t * @param {KeyboardEvent} event Keydown event.\n\t\t\t */\n\t\t\tfunction onKeyDown( event ) {\n\t\t\t\tconst { keyCode, target } = event;\n\n\t\t\t\tif (\n\t\t\t\t\tkeyCode !== ENTER &&\n\t\t\t\t\tkeyCode !== BACKSPACE &&\n\t\t\t\t\tkeyCode !== DELETE\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( target !== node || isTextField( target ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tif ( keyCode === ENTER ) {\n\t\t\t\t\tinsertDefaultBlock(\n\t\t\t\t\t\t{},\n\t\t\t\t\t\tgetBlockRootClientId( clientId ),\n\t\t\t\t\t\tgetBlockIndex( clientId ) + 1\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tremoveBlock( clientId );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Prevents default dragging behavior within a block. To do: we must\n\t\t\t * handle this in the future and clean up the drag target.\n\t\t\t *\n\t\t\t * @param {DragEvent} event Drag event.\n\t\t\t */\n\t\t\tfunction onDragStart( event ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\t\tnode.addEventListener( 'dragstart', onDragStart );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t\t\tnode.removeEventListener( 'dragstart', onDragStart );\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tclientId,\n\t\t\tisSelected,\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockIndex,\n\t\t\tinsertDefaultBlock,\n\t\t\tremoveBlock,\n\t\t]\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAMA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,gBAAgBA,CAAEC,QAAQ,EAAG;EAC5C,MAAMC,UAAU,GAAG,IAAAC,eAAS,EACzBC,MAAM,IAAMA,MAAM,CAAEC,YAAiB,CAAC,CAACC,eAAe,CAAEL,QAAS,CAAC,EACpE,CAAEA,QAAQ,CACX,CAAC;EACD,MAAM;IAAEM,oBAAoB;IAAEC;EAAc,CAAC,GAC5C,IAAAL,eAAS,EAAEE,YAAiB,CAAC;EAC9B,MAAM;IAAEI,kBAAkB;IAAEC;EAAY,CAAC,GAAG,IAAAC,i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","_data","_compose","_store","useEventHandlers","clientId","isSelected","getBlockRootClientId","getBlockIndex","useSelect","blockEditorStore","insertDefaultBlock","removeBlock","useDispatch","useRefEffect","node","onKeyDown","event","keyCode","target","ENTER","BACKSPACE","DELETE","isTextField","preventDefault","onDragStart","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-selected-block-event-handlers.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { isTextField } from '@wordpress/dom';\nimport { ENTER, BACKSPACE, DELETE } from '@wordpress/keycodes';\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 * Adds block behaviour:\n * - Removes the block on BACKSPACE.\n * - Inserts a default block on ENTER.\n * - Disables dragging of block contents.\n *\n * @param {string} clientId Block client ID.\n */\nexport function useEventHandlers( { clientId, isSelected } ) {\n\tconst { getBlockRootClientId, getBlockIndex } =\n\t\tuseSelect( blockEditorStore );\n\tconst { insertDefaultBlock, removeBlock } = useDispatch( blockEditorStore );\n\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tif ( ! isSelected ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Interprets keydown event intent to remove or insert after block if\n\t\t\t * key event occurs on wrapper node. This can occur when the block has\n\t\t\t * no text fields of its own, particularly after initial insertion, to\n\t\t\t * allow for easy deletion and continuous writing flow to add additional\n\t\t\t * content.\n\t\t\t *\n\t\t\t * @param {KeyboardEvent} event Keydown event.\n\t\t\t */\n\t\t\tfunction onKeyDown( event ) {\n\t\t\t\tconst { keyCode, target } = event;\n\n\t\t\t\tif (\n\t\t\t\t\tkeyCode !== ENTER &&\n\t\t\t\t\tkeyCode !== BACKSPACE &&\n\t\t\t\t\tkeyCode !== DELETE\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( target !== node || isTextField( target ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tif ( keyCode === ENTER ) {\n\t\t\t\t\tinsertDefaultBlock(\n\t\t\t\t\t\t{},\n\t\t\t\t\t\tgetBlockRootClientId( clientId ),\n\t\t\t\t\t\tgetBlockIndex( clientId ) + 1\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tremoveBlock( clientId );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Prevents default dragging behavior within a block. To do: we must\n\t\t\t * handle this in the future and clean up the drag target.\n\t\t\t *\n\t\t\t * @param {DragEvent} event Drag event.\n\t\t\t */\n\t\t\tfunction onDragStart( event ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\t\tnode.addEventListener( 'dragstart', onDragStart );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t\t\tnode.removeEventListener( 'dragstart', onDragStart );\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tclientId,\n\t\t\tisSelected,\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockIndex,\n\t\t\tinsertDefaultBlock,\n\t\t\tremoveBlock,\n\t\t]\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAMA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,gBAAgBA,CAAE;EAAEC,QAAQ;EAAEC;AAAW,CAAC,EAAG;EAC5D,MAAM;IAAEC,oBAAoB;IAAEC;EAAc,CAAC,GAC5C,IAAAC,eAAS,EAAEC,YAAiB,CAAC;EAC9B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C,WAAW,CAEb,CAAC;AACF"}
@@ -28,7 +28,8 @@ function useInBetweenInserter() {
28
28
  getSelectedBlockClientIds,
29
29
  getTemplateLock,
30
30
  __unstableIsWithinBlockOverlay,
31
- getBlockEditingMode
31
+ getBlockEditingMode,
32
+ getBlockName
32
33
  } = (0, _data.useSelect)(_store.store);
33
34
  const {
34
35
  showInsertionPoint,
@@ -59,7 +60,7 @@ function useInBetweenInserter() {
59
60
  const blockElement = !!event.target.getAttribute('data-block') ? event.target : event.target.closest('[data-block]');
60
61
  rootClientId = blockElement.getAttribute('data-block');
61
62
  }
62
- if (getTemplateLock(rootClientId) || getBlockEditingMode(rootClientId) === 'disabled') {
63
+ if (getTemplateLock(rootClientId) || getBlockEditingMode(rootClientId) === 'disabled' || getBlockName(rootClientId) === 'core/block' && window.__experimentalPatternPartialSyncing) {
63
64
  return;
64
65
  }
65
66
  const orientation = getBlockListSettings(rootClientId)?.orientation || 'vertical';
@@ -1 +1 @@
1
- {"version":3,"names":["_compose","require","_data","_element","_i18n","_store","_insertionPoint","useInBetweenInserter","openRef","useContext","InsertionPointOpenRef","isInBetweenInserterDisabled","useSelect","select","blockEditorStore","getSettings","isDistractionFree","__unstableGetEditorMode","getBlockListSettings","getBlockIndex","isMultiSelecting","getSelectedBlockClientIds","getTemplateLock","__unstableIsWithinBlockOverlay","getBlockEditingMode","showInsertionPoint","hideInsertionPoint","useDispatch","useRefEffect","node","onMouseMove","event","current","target","nodeType","TEXT_NODE","classList","contains","rootClientId","blockElement","getAttribute","closest","orientation","offsetTop","clientY","offsetLeft","clientX","children","Array","from","element","find","blockEl","blockElRect","getBoundingClientRect","top","isRTL","right","left","id","firstElementChild","clientId","slice","length","includes","elementRect","bottom","index","__unstableWithInserter","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/block-list/use-in-between-inserter.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useContext } from '@wordpress/element';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { InsertionPointOpenRef } from '../block-tools/insertion-point';\n\nexport function useInBetweenInserter() {\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst isInBetweenInserterDisabled = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().isDistractionFree ||\n\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() === 'zoom-out',\n\t\t[]\n\t);\n\tconst {\n\t\tgetBlockListSettings,\n\t\tgetBlockIndex,\n\t\tisMultiSelecting,\n\t\tgetSelectedBlockClientIds,\n\t\tgetTemplateLock,\n\t\t__unstableIsWithinBlockOverlay,\n\t\tgetBlockEditingMode,\n\t} = useSelect( blockEditorStore );\n\tconst { showInsertionPoint, hideInsertionPoint } =\n\t\tuseDispatch( blockEditorStore );\n\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tif ( isInBetweenInserterDisabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfunction onMouseMove( event ) {\n\t\t\t\tif ( openRef.current ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Ignore text nodes sometimes detected in FireFox.\n\t\t\t\tif ( event.target.nodeType === event.target.TEXT_NODE ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( isMultiSelecting() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t! event.target.classList.contains(\n\t\t\t\t\t\t'block-editor-block-list__layout'\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet rootClientId;\n\t\t\t\tif (\n\t\t\t\t\t! event.target.classList.contains( 'is-root-container' )\n\t\t\t\t) {\n\t\t\t\t\tconst blockElement = !! event.target.getAttribute(\n\t\t\t\t\t\t'data-block'\n\t\t\t\t\t)\n\t\t\t\t\t\t? event.target\n\t\t\t\t\t\t: event.target.closest( '[data-block]' );\n\t\t\t\t\trootClientId = blockElement.getAttribute( 'data-block' );\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tgetTemplateLock( rootClientId ) ||\n\t\t\t\t\tgetBlockEditingMode( rootClientId ) === 'disabled'\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst orientation =\n\t\t\t\t\tgetBlockListSettings( rootClientId )?.orientation ||\n\t\t\t\t\t'vertical';\n\t\t\t\tconst offsetTop = event.clientY;\n\t\t\t\tconst offsetLeft = event.clientX;\n\n\t\t\t\tconst children = Array.from( event.target.children );\n\t\t\t\tlet element = children.find( ( blockEl ) => {\n\t\t\t\t\tconst blockElRect = blockEl.getBoundingClientRect();\n\t\t\t\t\treturn (\n\t\t\t\t\t\t( blockEl.classList.contains( 'wp-block' ) &&\n\t\t\t\t\t\t\torientation === 'vertical' &&\n\t\t\t\t\t\t\tblockElRect.top > offsetTop ) ||\n\t\t\t\t\t\t( blockEl.classList.contains( 'wp-block' ) &&\n\t\t\t\t\t\t\torientation === 'horizontal' &&\n\t\t\t\t\t\t\t( isRTL()\n\t\t\t\t\t\t\t\t? blockElRect.right < offsetLeft\n\t\t\t\t\t\t\t\t: blockElRect.left > offsetLeft ) )\n\t\t\t\t\t);\n\t\t\t\t} );\n\n\t\t\t\tif ( ! element ) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// The block may be in an alignment wrapper, so check the first direct\n\t\t\t\t// child if the element has no ID.\n\t\t\t\tif ( ! element.id ) {\n\t\t\t\t\telement = element.firstElementChild;\n\n\t\t\t\t\tif ( ! element ) {\n\t\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Don't show the insertion point if a parent block has an \"overlay\"\n\t\t\t\t// See https://github.com/WordPress/gutenberg/pull/34012#pullrequestreview-727762337\n\t\t\t\tconst clientId = element.id.slice( 'block-'.length );\n\t\t\t\tif (\n\t\t\t\t\t! clientId ||\n\t\t\t\t\t__unstableIsWithinBlockOverlay( clientId )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Don't show the inserter when hovering above (conflicts with\n\t\t\t\t// block toolbar) or inside selected block(s).\n\t\t\t\tif ( getSelectedBlockClientIds().includes( clientId ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst elementRect = element.getBoundingClientRect();\n\n\t\t\t\tif (\n\t\t\t\t\t( orientation === 'horizontal' &&\n\t\t\t\t\t\t( event.clientY > elementRect.bottom ||\n\t\t\t\t\t\t\tevent.clientY < elementRect.top ) ) ||\n\t\t\t\t\t( orientation === 'vertical' &&\n\t\t\t\t\t\t( event.clientX > elementRect.right ||\n\t\t\t\t\t\t\tevent.clientX < elementRect.left ) )\n\t\t\t\t) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst index = getBlockIndex( clientId );\n\n\t\t\t\t// Don't show the in-between inserter before the first block in\n\t\t\t\t// the list (preserves the original behaviour).\n\t\t\t\tif ( index === 0 ) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tshowInsertionPoint( rootClientId, index, {\n\t\t\t\t\t__unstableWithInserter: true,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'mousemove', onMouseMove );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'mousemove', onMouseMove );\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\topenRef,\n\t\t\tgetBlockListSettings,\n\t\t\tgetBlockIndex,\n\t\t\tisMultiSelecting,\n\t\t\tshowInsertionPoint,\n\t\t\thideInsertionPoint,\n\t\t\tgetSelectedBlockCl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M;MACZD,IAAI,CAACyC,mBAAmB,CAAE,WAAW,EAAExC,WAAY,CAAC;IACrD,CAAC;EACF,CAAC,EACD,CACCtB,OAAO,EACPU,oBAAoB,EACpBC,aAAa,EACbC,gBAAgB,EAChBK,kBAAkB,EAClBC,kBAAkB,EAClBL,yBAAyB,EACzBV,2BAA2B,CAE7B,CAAC;AACF"}
1
+ {"version":3,"names":["_compose","require","_data","_element","_i18n","_store","_insertionPoint","useInBetweenInserter","openRef","useContext","InsertionPointOpenRef","isInBetweenInserterDisabled","useSelect","select","blockEditorStore","getSettings","isDistractionFree","__unstableGetEditorMode","getBlockListSettings","getBlockIndex","isMultiSelecting","getSelectedBlockClientIds","getTemplateLock","__unstableIsWithinBlockOverlay","getBlockEditingMode","getBlockName","showInsertionPoint","hideInsertionPoint","useDispatch","useRefEffect","node","onMouseMove","event","current","target","nodeType","TEXT_NODE","classList","contains","rootClientId","blockElement","getAttribute","closest","window","__experimentalPatternPartialSyncing","orientation","offsetTop","clientY","offsetLeft","clientX","children","Array","from","element","find","blockEl","blockElRect","getBoundingClientRect","top","isRTL","right","left","id","firstElementChild","clientId","slice","length","includes","elementRect","bottom","index","__unstableWithInserter","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/block-list/use-in-between-inserter.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useContext } from '@wordpress/element';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { InsertionPointOpenRef } from '../block-tools/insertion-point';\n\nexport function useInBetweenInserter() {\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst isInBetweenInserterDisabled = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().isDistractionFree ||\n\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() === 'zoom-out',\n\t\t[]\n\t);\n\tconst {\n\t\tgetBlockListSettings,\n\t\tgetBlockIndex,\n\t\tisMultiSelecting,\n\t\tgetSelectedBlockClientIds,\n\t\tgetTemplateLock,\n\t\t__unstableIsWithinBlockOverlay,\n\t\tgetBlockEditingMode,\n\t\tgetBlockName,\n\t} = useSelect( blockEditorStore );\n\tconst { showInsertionPoint, hideInsertionPoint } =\n\t\tuseDispatch( blockEditorStore );\n\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tif ( isInBetweenInserterDisabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfunction onMouseMove( event ) {\n\t\t\t\tif ( openRef.current ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Ignore text nodes sometimes detected in FireFox.\n\t\t\t\tif ( event.target.nodeType === event.target.TEXT_NODE ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( isMultiSelecting() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t! event.target.classList.contains(\n\t\t\t\t\t\t'block-editor-block-list__layout'\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet rootClientId;\n\t\t\t\tif (\n\t\t\t\t\t! event.target.classList.contains( 'is-root-container' )\n\t\t\t\t) {\n\t\t\t\t\tconst blockElement = !! event.target.getAttribute(\n\t\t\t\t\t\t'data-block'\n\t\t\t\t\t)\n\t\t\t\t\t\t? event.target\n\t\t\t\t\t\t: event.target.closest( '[data-block]' );\n\t\t\t\t\trootClientId = blockElement.getAttribute( 'data-block' );\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tgetTemplateLock( rootClientId ) ||\n\t\t\t\t\tgetBlockEditingMode( rootClientId ) === 'disabled' ||\n\t\t\t\t\t( getBlockName( rootClientId ) === 'core/block' &&\n\t\t\t\t\t\twindow.__experimentalPatternPartialSyncing )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst orientation =\n\t\t\t\t\tgetBlockListSettings( rootClientId )?.orientation ||\n\t\t\t\t\t'vertical';\n\t\t\t\tconst offsetTop = event.clientY;\n\t\t\t\tconst offsetLeft = event.clientX;\n\n\t\t\t\tconst children = Array.from( event.target.children );\n\t\t\t\tlet element = children.find( ( blockEl ) => {\n\t\t\t\t\tconst blockElRect = blockEl.getBoundingClientRect();\n\t\t\t\t\treturn (\n\t\t\t\t\t\t( blockEl.classList.contains( 'wp-block' ) &&\n\t\t\t\t\t\t\torientation === 'vertical' &&\n\t\t\t\t\t\t\tblockElRect.top > offsetTop ) ||\n\t\t\t\t\t\t( blockEl.classList.contains( 'wp-block' ) &&\n\t\t\t\t\t\t\torientation === 'horizontal' &&\n\t\t\t\t\t\t\t( isRTL()\n\t\t\t\t\t\t\t\t? blockElRect.right < offsetLeft\n\t\t\t\t\t\t\t\t: blockElRect.left > offsetLeft ) )\n\t\t\t\t\t);\n\t\t\t\t} );\n\n\t\t\t\tif ( ! element ) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// The block may be in an alignment wrapper, so check the first direct\n\t\t\t\t// child if the element has no ID.\n\t\t\t\tif ( ! element.id ) {\n\t\t\t\t\telement = element.firstElementChild;\n\n\t\t\t\t\tif ( ! element ) {\n\t\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Don't show the insertion point if a parent block has an \"overlay\"\n\t\t\t\t// See https://github.com/WordPress/gutenberg/pull/34012#pullrequestreview-727762337\n\t\t\t\tconst clientId = element.id.slice( 'block-'.length );\n\t\t\t\tif (\n\t\t\t\t\t! clientId ||\n\t\t\t\t\t__unstableIsWithinBlockOverlay( clientId )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Don't show the inserter when hovering above (conflicts with\n\t\t\t\t// block toolbar) or inside selected block(s).\n\t\t\t\tif ( getSelectedBlockClientIds().includes( clientId ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst elementRect = element.getBoundingClientRect();\n\n\t\t\t\tif (\n\t\t\t\t\t( orientation === 'horizontal' &&\n\t\t\t\t\t\t( event.clientY > elementRect.bottom ||\n\t\t\t\t\t\t\tevent.clientY < elementRect.top ) ) ||\n\t\t\t\t\t( orientation === 'vertical' &&\n\t\t\t\t\t\t( event.clientX > elementRect.right ||\n\t\t\t\t\t\t\tevent.clientX < elementRect.left ) )\n\t\t\t\t) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst index = getBlockIndex( clientId );\n\n\t\t\t\t// Don't show the in-between inserter before the first block in\n\t\t\t\t// the list (preserves the original behaviour).\n\t\t\t\tif ( index === 0 ) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tshowInsertionPoint( rootClientId, index, {\n\t\t\t\t\t__unstableWithInserter: true,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'mousemove', onMouseMove );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'mousemove', onMouseMove );\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\topenRef,\n\t\t\tgetBlockListSettings,\n\t\t\tgetBlockIndex,\n\t\t\tisMultiSelecting,\n\t\t\tshowInsertionPoint,\n\t\t\thideInsertionPoint,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisInBetweenInserterDisabled,\n\t\t]\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,eAA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gB,EAChBM,kBAAkB,EAClBC,kBAAkB,EAClBN,yBAAyB,EACzBV,2BAA2B,CAE7B,CAAC;AACF"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _element = require("@wordpress/element");
8
+ var _data = require("@wordpress/data");
9
+ var _blockListContext = require("./block-list-context");
10
+ var _store = require("../../store");
11
+ /**
12
+ * WordPress dependencies
13
+ */
14
+
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+
19
+ const useScrollUponInsertion = ({
20
+ clientId,
21
+ isSelected,
22
+ isLayoutCalculated,
23
+ elementRef
24
+ }) => {
25
+ const {
26
+ scrollRef
27
+ } = (0, _blockListContext.useBlockListContext)();
28
+ const wasBlockJustInserted = (0, _data.useSelect)(select => !!select(_store.store).wasBlockJustInserted(clientId, 'inserter_menu'), [clientId]);
29
+ (0, _element.useEffect)(() => {
30
+ const lastScrollTo = scrollRef?.lastScrollTo.current;
31
+ const alreadyScrolledTo = lastScrollTo?.clientId === clientId;
32
+ if (alreadyScrolledTo || !isSelected || !scrollRef || !wasBlockJustInserted || !isLayoutCalculated) {
33
+ return;
34
+ }
35
+ scrollRef.scrollToElement(elementRef);
36
+ lastScrollTo.clientId = clientId;
37
+ }, [isSelected, scrollRef, wasBlockJustInserted, elementRef, isLayoutCalculated, clientId]);
38
+ };
39
+ var _default = useScrollUponInsertion;
40
+ exports.default = _default;
41
+ //# sourceMappingURL=use-scroll-upon-insertion.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_element","require","_data","_blockListContext","_store","useScrollUponInsertion","clientId","isSelected","isLayoutCalculated","elementRef","scrollRef","useBlockListContext","wasBlockJustInserted","useSelect","select","blockEditorStore","useEffect","lastScrollTo","current","alreadyScrolledTo","scrollToElement","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/block-list/use-scroll-upon-insertion.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockListContext } from './block-list-context';\nimport { store as blockEditorStore } from '../../store';\n\nconst useScrollUponInsertion = ( {\n\tclientId,\n\tisSelected,\n\tisLayoutCalculated,\n\telementRef,\n} ) => {\n\tconst { scrollRef } = useBlockListContext();\n\tconst wasBlockJustInserted = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( blockEditorStore ).wasBlockJustInserted(\n\t\t\t\tclientId,\n\t\t\t\t'inserter_menu'\n\t\t\t),\n\t\t[ clientId ]\n\t);\n\tuseEffect( () => {\n\t\tconst lastScrollTo = scrollRef?.lastScrollTo.current;\n\t\tconst alreadyScrolledTo = lastScrollTo?.clientId === clientId;\n\t\tif (\n\t\t\talreadyScrolledTo ||\n\t\t\t! isSelected ||\n\t\t\t! scrollRef ||\n\t\t\t! wasBlockJustInserted ||\n\t\t\t! isLayoutCalculated\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tscrollRef.scrollToElement( elementRef );\n\t\tlastScrollTo.clientId = clientId;\n\t}, [\n\t\tisSelected,\n\t\tscrollRef,\n\t\twasBlockJustInserted,\n\t\telementRef,\n\t\tisLayoutCalculated,\n\t\tclientId,\n\t] );\n};\n\nexport default useScrollUponInsertion;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA,MAAMI,sBAAsB,GAAGA,CAAE;EAChCC,QAAQ;EACRC,UAAU;EACVC,kBAAkB;EAClBC;AACD,CAAC,KAAM;EACN,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAC,qCAAmB,EAAC,CAAC;EAC3C,MAAMC,oBAAoB,GAAG,IAAAC,eAAS,EACnCC,MAAM,IACP,CAAC,CAAEA,MAAM,CAAEC,YAAiB,CAAC,CAACH,oBAAoB,CACjDN,QAAQ,EACR,eACD,CAAC,EACF,CAAEA,QAAQ,CACX,CAAC;EACD,IAAAU,kBAAS,EAAE,MAAM;IAChB,MAAMC,YAAY,GAAGP,SAAS,EAAEO,YAAY,CAACC,OAAO;IACpD,MAAMC,iBAAiB,GAAGF,YAAY,EAAEX,QAAQ,KAAKA,QAAQ;IAC7D,IACCa,iBAAiB,IACjB,CAAEZ,UAAU,IACZ,CAAEG,SAAS,IACX,CAAEE,oBAAoB,IACtB,CAAEJ,kBAAkB,EACnB;MACD;IACD;IACAE,SAAS,CAACU,eAAe,CAAEX,UAAW,CAAC;IACvCQ,YAAY,CAACX,QAAQ,GAAGA,QAAQ;EACjC,CAAC,EAAE,CACFC,UAAU,EACVG,SAAS,EACTE,oBAAoB,EACpBH,UAAU,EACVD,kBAAkB,EAClBF,QAAQ,CACP,CAAC;AACJ,CAAC;AAAC,IAAAe,QAAA,GAEahB,sBAAsB;AAAAiB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -8,7 +8,6 @@ exports.default = BlockLockToolbar;
8
8
  var _react = require("react");
9
9
  var _i18n = require("@wordpress/i18n");
10
10
  var _components = require("@wordpress/components");
11
- var _dom = require("@wordpress/dom");
12
11
  var _element = require("@wordpress/element");
13
12
  var _icons = require("@wordpress/icons");
14
13
  var _modal = _interopRequireDefault(require("./modal"));
@@ -22,44 +21,39 @@ var _useBlockLock = _interopRequireDefault(require("./use-block-lock"));
22
21
  */
23
22
 
24
23
  function BlockLockToolbar({
25
- clientId,
26
- wrapperRef
24
+ clientId
27
25
  }) {
28
26
  const {
29
- canEdit,
30
- canMove,
31
- canRemove,
32
- canLock
27
+ canLock,
28
+ isLocked
33
29
  } = (0, _useBlockLock.default)(clientId);
34
30
  const [isModalOpen, toggleModal] = (0, _element.useReducer)(isActive => !isActive, false);
35
- const lockButtonRef = (0, _element.useRef)(null);
36
- const isFirstRender = (0, _element.useRef)(true);
37
- const shouldHideBlockLockUI = !canLock || canEdit && canMove && canRemove;
31
+ const hasLockButtonShown = (0, _element.useRef)(false);
38
32
 
39
- // Restore focus manually on the first focusable element in the toolbar
40
- // when the block lock modal is closed and the block is not locked anymore.
41
- // See https://github.com/WordPress/gutenberg/issues/51447
33
+ // If the block lock button has been shown, we don't want to remove it
34
+ // from the toolbar until the toolbar is rendered again without it.
35
+ // Removing it beforehand can cause focus loss issues, such as when
36
+ // unlocking the block from the modal. It needs to return focus from
37
+ // whence it came, and to do that, we need to leave the button in the toolbar.
42
38
  (0, _element.useEffect)(() => {
43
- if (isFirstRender.current) {
44
- isFirstRender.current = false;
45
- return;
39
+ if (isLocked) {
40
+ hasLockButtonShown.current = true;
46
41
  }
47
- if (!isModalOpen && shouldHideBlockLockUI) {
48
- _dom.focus.focusable.find(wrapperRef.current, {
49
- sequential: false
50
- }).find(element => element.tagName === 'BUTTON' && element !== lockButtonRef.current)?.focus();
51
- }
52
- // wrapperRef is a reference object and should be stable
53
- }, [isModalOpen, shouldHideBlockLockUI, wrapperRef]);
54
- if (shouldHideBlockLockUI) {
42
+ }, [isLocked]);
43
+ if (!isLocked && !hasLockButtonShown.current) {
55
44
  return null;
56
45
  }
46
+ let label = isLocked ? (0, _i18n.__)('Unlock') : (0, _i18n.__)('Lock');
47
+ if (!canLock && isLocked) {
48
+ label = (0, _i18n.__)('Locked');
49
+ }
57
50
  return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.ToolbarGroup, {
58
51
  className: "block-editor-block-lock-toolbar"
59
52
  }, (0, _react.createElement)(_components.ToolbarButton, {
60
- ref: lockButtonRef,
61
- icon: _icons.lock,
62
- label: (0, _i18n.__)('Unlock'),
53
+ accessibleWhenDisabled: true,
54
+ disabled: !canLock,
55
+ icon: isLocked ? _icons.lock : _icons.unlock,
56
+ label: label,
63
57
  onClick: toggleModal,
64
58
  "aria-expanded": isModalOpen,
65
59
  "aria-haspopup": "dialog"