@wordpress/block-editor 12.16.0 → 12.17.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 (646) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/README.md +3 -6
  4. package/build/components/block-canvas/index.js +0 -2
  5. package/build/components/block-canvas/index.js.map +1 -1
  6. package/build/components/block-card/index.js +1 -1
  7. package/build/components/block-card/index.js.map +1 -1
  8. package/build/components/block-draggable/draggable-chip.js +6 -1
  9. package/build/components/block-draggable/draggable-chip.js.map +1 -1
  10. package/build/components/block-draggable/index.js +76 -6
  11. package/build/components/block-draggable/index.js.map +1 -1
  12. package/build/components/block-draggable/index.native.js +0 -6
  13. package/build/components/block-draggable/index.native.js.map +1 -1
  14. package/build/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
  15. package/build/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
  16. package/build/components/block-editing-mode/index.js +2 -3
  17. package/build/components/block-editing-mode/index.js.map +1 -1
  18. package/build/components/block-inspector/index.js +1 -1
  19. package/build/components/block-inspector/index.js.map +1 -1
  20. package/build/components/block-list/block-list-item-cell.native.js +1 -0
  21. package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
  22. package/build/components/block-list/block.js +245 -102
  23. package/build/components/block-list/block.js.map +1 -1
  24. package/build/components/block-list/block.native.js +46 -20
  25. package/build/components/block-list/block.native.js.map +1 -1
  26. package/build/components/block-list/index.native.js +3 -5
  27. package/build/components/block-list/index.native.js.map +1 -1
  28. package/build/components/block-list/private-block-context.js +14 -0
  29. package/build/components/block-list/private-block-context.js.map +1 -0
  30. package/build/components/block-list/use-block-props/index.js +33 -96
  31. package/build/components/block-list/use-block-props/index.js.map +1 -1
  32. package/build/components/block-list/use-in-between-inserter.js +3 -2
  33. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  34. package/build/components/block-list/use-scroll-upon-insertion.native.js +41 -0
  35. package/build/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
  36. package/build/components/block-lock/toolbar.js +15 -27
  37. package/build/components/block-lock/toolbar.js.map +1 -1
  38. package/build/components/block-mover/index.js +2 -1
  39. package/build/components/block-mover/index.js.map +1 -1
  40. package/build/components/block-patterns-list/index.js +4 -4
  41. package/build/components/block-patterns-list/index.js.map +1 -1
  42. package/build/components/block-switcher/index.js +4 -4
  43. package/build/components/block-switcher/index.js.map +1 -1
  44. package/build/components/block-toolbar/index.js +1 -2
  45. package/build/components/block-toolbar/index.js.map +1 -1
  46. package/build/components/block-tools/block-toolbar-popover.js +0 -2
  47. package/build/components/block-tools/block-toolbar-popover.js.map +1 -1
  48. package/build/components/block-variation-transforms/index.js +29 -2
  49. package/build/components/block-variation-transforms/index.js.map +1 -1
  50. package/build/components/border-radius-control/linked-button.js +1 -1
  51. package/build/components/border-radius-control/linked-button.js.map +1 -1
  52. package/build/components/colors/utils.js +10 -2
  53. package/build/components/colors/utils.js.map +1 -1
  54. package/build/components/colors/with-colors.js +6 -2
  55. package/build/components/colors/with-colors.js.map +1 -1
  56. package/build/components/font-sizes/utils.js +10 -2
  57. package/build/components/font-sizes/utils.js.map +1 -1
  58. package/build/components/global-styles/border-panel.js +2 -1
  59. package/build/components/global-styles/border-panel.js.map +1 -1
  60. package/build/components/global-styles/color-panel.js +2 -1
  61. package/build/components/global-styles/color-panel.js.map +1 -1
  62. package/build/components/global-styles/dimensions-panel.js +4 -3
  63. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  64. package/build/components/global-styles/effects-panel.js +2 -1
  65. package/build/components/global-styles/effects-panel.js.map +1 -1
  66. package/build/components/global-styles/filters-panel.js +1 -4
  67. package/build/components/global-styles/filters-panel.js.map +1 -1
  68. package/build/components/global-styles/get-global-styles-changes.js +192 -0
  69. package/build/components/global-styles/get-global-styles-changes.js.map +1 -0
  70. package/build/components/global-styles/hooks.js +1 -1
  71. package/build/components/global-styles/hooks.js.map +1 -1
  72. package/build/components/global-styles/image-settings-panel.js +7 -1
  73. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  74. package/build/components/global-styles/index.js +7 -0
  75. package/build/components/global-styles/index.js.map +1 -1
  76. package/build/components/global-styles/typography-panel.js +2 -1
  77. package/build/components/global-styles/typography-panel.js.map +1 -1
  78. package/build/components/global-styles/use-global-styles-output.js +22 -8
  79. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  80. package/build/components/global-styles/utils.js +8 -1
  81. package/build/components/global-styles/utils.js.map +1 -1
  82. package/build/components/height-control/index.js +6 -2
  83. package/build/components/height-control/index.js.map +1 -1
  84. package/build/components/image-size-control/index.js +2 -2
  85. package/build/components/image-size-control/index.js.map +1 -1
  86. package/build/components/index.native.js +6 -5
  87. package/build/components/index.native.js.map +1 -1
  88. package/build/components/inner-blocks/index.js +61 -22
  89. package/build/components/inner-blocks/index.js.map +1 -1
  90. package/build/components/inner-blocks/index.native.js +18 -4
  91. package/build/components/inner-blocks/index.native.js.map +1 -1
  92. package/build/components/inner-blocks/use-inner-block-template-sync.js +5 -6
  93. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  94. package/build/components/inner-blocks/use-nested-settings-update.js +5 -9
  95. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  96. package/build/components/inserter/block-patterns-explorer/pattern-list.js +1 -1
  97. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  98. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +10 -9
  99. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  100. package/build/components/inserter/block-patterns-tab/patterns-filter.js +10 -10
  101. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  102. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +9 -9
  103. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  104. package/build/components/inserter/block-patterns-tab/utils.js +10 -14
  105. package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
  106. package/build/components/inserter/hooks/use-block-types-state.js +4 -14
  107. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  108. package/build/components/inserter/hooks/use-patterns-state.js +1 -1
  109. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  110. package/build/components/inserter/index.js +1 -2
  111. package/build/components/inserter/index.js.map +1 -1
  112. package/build/components/inserter/library.js +3 -7
  113. package/build/components/inserter/library.js.map +1 -1
  114. package/build/components/inserter/menu.js +14 -28
  115. package/build/components/inserter/menu.js.map +1 -1
  116. package/build/components/inserter/tabs.js +21 -21
  117. package/build/components/inserter/tabs.js.map +1 -1
  118. package/build/components/inserter-draggable-blocks/index.js +1 -1
  119. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  120. package/build/components/inserter-list-item/index.js +2 -4
  121. package/build/components/inserter-list-item/index.js.map +1 -1
  122. package/build/components/inspector-controls/block-support-tools-panel.js +3 -1
  123. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  124. package/build/components/inspector-controls-tabs/index.js +34 -23
  125. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  126. package/build/components/list-view/block-select-button.js +4 -0
  127. package/build/components/list-view/block-select-button.js.map +1 -1
  128. package/build/components/list-view/block.js +57 -3
  129. package/build/components/list-view/block.js.map +1 -1
  130. package/build/components/media-upload-progress/constants.js +19 -0
  131. package/build/components/media-upload-progress/constants.js.map +1 -0
  132. package/build/components/media-upload-progress/index.native.js +42 -17
  133. package/build/components/media-upload-progress/index.native.js.map +1 -1
  134. package/build/components/navigable-toolbar/index.js +9 -14
  135. package/build/components/navigable-toolbar/index.js.map +1 -1
  136. package/build/components/plain-text/index.native.js +8 -3
  137. package/build/components/plain-text/index.native.js.map +1 -1
  138. package/build/components/provider/index.js +3 -1
  139. package/build/components/provider/index.js.map +1 -1
  140. package/build/components/provider/use-block-sync.js +7 -1
  141. package/build/components/provider/use-block-sync.js.map +1 -1
  142. package/build/components/rich-text/index.js +17 -7
  143. package/build/components/rich-text/index.js.map +1 -1
  144. package/build/components/rich-text/native/index.native.js +16 -24
  145. package/build/components/rich-text/native/index.native.js.map +1 -1
  146. package/build/components/rich-text/use-input-rules.js +2 -2
  147. package/build/components/rich-text/use-input-rules.js.map +1 -1
  148. package/build/components/rich-text/use-mark-persistent.js +1 -1
  149. package/build/components/rich-text/use-mark-persistent.js.map +1 -1
  150. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  151. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  152. package/build/components/url-input/index.js +9 -6
  153. package/build/components/url-input/index.js.map +1 -1
  154. package/build/components/use-block-commands/index.js +14 -18
  155. package/build/components/use-block-commands/index.js.map +1 -1
  156. package/build/components/use-block-drop-zone/index.js +51 -22
  157. package/build/components/use-block-drop-zone/index.js.map +1 -1
  158. package/build/components/use-moving-animation/index.js +100 -92
  159. package/build/components/use-moving-animation/index.js.map +1 -1
  160. package/build/components/use-on-block-drop/index.js +8 -11
  161. package/build/components/use-on-block-drop/index.js.map +1 -1
  162. package/build/components/writing-flow/index.js +0 -1
  163. package/build/components/writing-flow/index.js.map +1 -1
  164. package/build/components/writing-flow/use-drag-selection.js +15 -4
  165. package/build/components/writing-flow/use-drag-selection.js.map +1 -1
  166. package/build/components/writing-flow/use-selection-observer.js +73 -27
  167. package/build/components/writing-flow/use-selection-observer.js.map +1 -1
  168. package/build/components/writing-flow/use-tab-nav.js +7 -4
  169. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  170. package/build/hooks/align.js +1 -1
  171. package/build/hooks/align.js.map +1 -1
  172. package/build/hooks/anchor.js +1 -1
  173. package/build/hooks/anchor.js.map +1 -1
  174. package/build/hooks/aria-label.js +9 -1
  175. package/build/hooks/aria-label.js.map +1 -1
  176. package/build/hooks/background.js +185 -20
  177. package/build/hooks/background.js.map +1 -1
  178. package/build/hooks/border.js +5 -10
  179. package/build/hooks/border.js.map +1 -1
  180. package/build/hooks/color.js +13 -11
  181. package/build/hooks/color.js.map +1 -1
  182. package/build/hooks/custom-class-name.js +1 -1
  183. package/build/hooks/custom-class-name.js.map +1 -1
  184. package/build/hooks/custom-class-name.native.js +9 -1
  185. package/build/hooks/custom-class-name.native.js.map +1 -1
  186. package/build/hooks/dimensions.js +4 -9
  187. package/build/hooks/dimensions.js.map +1 -1
  188. package/build/hooks/font-family.js +7 -3
  189. package/build/hooks/font-family.js.map +1 -1
  190. package/build/hooks/font-size.js +1 -1
  191. package/build/hooks/font-size.js.map +1 -1
  192. package/build/hooks/index.js +4 -3
  193. package/build/hooks/index.js.map +1 -1
  194. package/build/hooks/index.native.js +5 -3
  195. package/build/hooks/index.native.js.map +1 -1
  196. package/build/hooks/layout.js +10 -4
  197. package/build/hooks/layout.js.map +1 -1
  198. package/build/hooks/style.js +1 -1
  199. package/build/hooks/style.js.map +1 -1
  200. package/build/hooks/typography.js +4 -9
  201. package/build/hooks/typography.js.map +1 -1
  202. package/build/hooks/typography.native.js +43 -18
  203. package/build/hooks/typography.native.js.map +1 -1
  204. package/build/hooks/use-typography-props.js +10 -2
  205. package/build/hooks/use-typography-props.js.map +1 -1
  206. package/build/hooks/utils.js +44 -4
  207. package/build/hooks/utils.js.map +1 -1
  208. package/build/private-apis.js +2 -4
  209. package/build/private-apis.js.map +1 -1
  210. package/build/private-apis.native.js +0 -2
  211. package/build/private-apis.native.js.map +1 -1
  212. package/build/store/actions.js +0 -16
  213. package/build/store/actions.js.map +1 -1
  214. package/build/store/private-actions.js +51 -5
  215. package/build/store/private-actions.js.map +1 -1
  216. package/build/store/private-selectors.js +12 -0
  217. package/build/store/private-selectors.js.map +1 -1
  218. package/build/store/reducer.js +14 -6
  219. package/build/store/reducer.js.map +1 -1
  220. package/build/store/selectors.js +1 -13
  221. package/build/store/selectors.js.map +1 -1
  222. package/build/store/undo-ignore.js +12 -0
  223. package/build/store/undo-ignore.js.map +1 -0
  224. package/build/store/utils.js +1 -1
  225. package/build/store/utils.js.map +1 -1
  226. package/build/utils/get-px-from-css-unit.js +16 -0
  227. package/build/utils/get-px-from-css-unit.js.map +1 -0
  228. package/build/utils/index.js +2 -2
  229. package/build/utils/index.js.map +1 -1
  230. package/build/utils/object.js +0 -38
  231. package/build/utils/object.js.map +1 -1
  232. package/build/utils/use-can-block-toolbar-be-focused.js +46 -0
  233. package/build/utils/use-can-block-toolbar-be-focused.js.map +1 -0
  234. package/build-module/components/block-canvas/index.js +0 -2
  235. package/build-module/components/block-canvas/index.js.map +1 -1
  236. package/build-module/components/block-card/index.js +1 -1
  237. package/build-module/components/block-card/index.js.map +1 -1
  238. package/build-module/components/block-draggable/draggable-chip.js +6 -1
  239. package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
  240. package/build-module/components/block-draggable/index.js +76 -6
  241. package/build-module/components/block-draggable/index.js.map +1 -1
  242. package/build-module/components/block-draggable/index.native.js +1 -7
  243. package/build-module/components/block-draggable/index.native.js.map +1 -1
  244. package/build-module/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
  245. package/build-module/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
  246. package/build-module/components/block-editing-mode/index.js +3 -4
  247. package/build-module/components/block-editing-mode/index.js.map +1 -1
  248. package/build-module/components/block-inspector/index.js +1 -1
  249. package/build-module/components/block-inspector/index.js.map +1 -1
  250. package/build-module/components/block-list/block-list-item-cell.native.js +1 -0
  251. package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
  252. package/build-module/components/block-list/block.js +249 -106
  253. package/build-module/components/block-list/block.js.map +1 -1
  254. package/build-module/components/block-list/block.native.js +48 -22
  255. package/build-module/components/block-list/block.native.js.map +1 -1
  256. package/build-module/components/block-list/index.native.js +3 -5
  257. package/build-module/components/block-list/index.native.js.map +1 -1
  258. package/build-module/components/block-list/private-block-context.js +6 -0
  259. package/build-module/components/block-list/private-block-context.js.map +1 -0
  260. package/build-module/components/block-list/use-block-props/index.js +34 -97
  261. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  262. package/build-module/components/block-list/use-in-between-inserter.js +3 -2
  263. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  264. package/build-module/components/block-list/use-scroll-upon-insertion.native.js +33 -0
  265. package/build-module/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
  266. package/build-module/components/block-lock/toolbar.js +16 -28
  267. package/build-module/components/block-lock/toolbar.js.map +1 -1
  268. package/build-module/components/block-mover/index.js +2 -1
  269. package/build-module/components/block-mover/index.js.map +1 -1
  270. package/build-module/components/block-patterns-list/index.js +5 -5
  271. package/build-module/components/block-patterns-list/index.js.map +1 -1
  272. package/build-module/components/block-switcher/index.js +4 -4
  273. package/build-module/components/block-switcher/index.js.map +1 -1
  274. package/build-module/components/block-toolbar/index.js +1 -2
  275. package/build-module/components/block-toolbar/index.js.map +1 -1
  276. package/build-module/components/block-tools/block-toolbar-popover.js +0 -2
  277. package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -1
  278. package/build-module/components/block-variation-transforms/index.js +30 -3
  279. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  280. package/build-module/components/border-radius-control/linked-button.js +1 -1
  281. package/build-module/components/border-radius-control/linked-button.js.map +1 -1
  282. package/build-module/components/colors/utils.js +9 -1
  283. package/build-module/components/colors/utils.js.map +1 -1
  284. package/build-module/components/colors/with-colors.js +5 -1
  285. package/build-module/components/colors/with-colors.js.map +1 -1
  286. package/build-module/components/font-sizes/utils.js +9 -1
  287. package/build-module/components/font-sizes/utils.js.map +1 -1
  288. package/build-module/components/global-styles/border-panel.js +3 -2
  289. package/build-module/components/global-styles/border-panel.js.map +1 -1
  290. package/build-module/components/global-styles/color-panel.js +3 -2
  291. package/build-module/components/global-styles/color-panel.js.map +1 -1
  292. package/build-module/components/global-styles/dimensions-panel.js +5 -4
  293. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  294. package/build-module/components/global-styles/effects-panel.js +3 -2
  295. package/build-module/components/global-styles/effects-panel.js.map +1 -1
  296. package/build-module/components/global-styles/filters-panel.js +2 -5
  297. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  298. package/build-module/components/global-styles/get-global-styles-changes.js +184 -0
  299. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -0
  300. package/build-module/components/global-styles/hooks.js +1 -1
  301. package/build-module/components/global-styles/hooks.js.map +1 -1
  302. package/build-module/components/global-styles/image-settings-panel.js +7 -1
  303. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  304. package/build-module/components/global-styles/index.js +1 -0
  305. package/build-module/components/global-styles/index.js.map +1 -1
  306. package/build-module/components/global-styles/typography-panel.js +3 -2
  307. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  308. package/build-module/components/global-styles/use-global-styles-output.js +15 -1
  309. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  310. package/build-module/components/global-styles/utils.js +7 -0
  311. package/build-module/components/global-styles/utils.js.map +1 -1
  312. package/build-module/components/height-control/index.js +6 -2
  313. package/build-module/components/height-control/index.js.map +1 -1
  314. package/build-module/components/image-size-control/index.js +2 -2
  315. package/build-module/components/image-size-control/index.js.map +1 -1
  316. package/build-module/components/index.native.js +2 -1
  317. package/build-module/components/index.native.js.map +1 -1
  318. package/build-module/components/inner-blocks/index.js +62 -23
  319. package/build-module/components/inner-blocks/index.js.map +1 -1
  320. package/build-module/components/inner-blocks/index.native.js +18 -4
  321. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  322. package/build-module/components/inner-blocks/use-inner-block-template-sync.js +5 -6
  323. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  324. package/build-module/components/inner-blocks/use-nested-settings-update.js +6 -10
  325. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  326. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  327. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  328. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +11 -10
  329. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  330. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +11 -11
  331. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  332. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +11 -11
  333. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  334. package/build-module/components/inserter/block-patterns-tab/utils.js +7 -11
  335. package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
  336. package/build-module/components/inserter/hooks/use-block-types-state.js +4 -14
  337. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  338. package/build-module/components/inserter/hooks/use-patterns-state.js +2 -2
  339. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  340. package/build-module/components/inserter/index.js +1 -2
  341. package/build-module/components/inserter/index.js.map +1 -1
  342. package/build-module/components/inserter/library.js +3 -7
  343. package/build-module/components/inserter/library.js.map +1 -1
  344. package/build-module/components/inserter/menu.js +14 -28
  345. package/build-module/components/inserter/menu.js.map +1 -1
  346. package/build-module/components/inserter/tabs.js +22 -22
  347. package/build-module/components/inserter/tabs.js.map +1 -1
  348. package/build-module/components/inserter-draggable-blocks/index.js +2 -2
  349. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  350. package/build-module/components/inserter-list-item/index.js +2 -4
  351. package/build-module/components/inserter-list-item/index.js.map +1 -1
  352. package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -1
  353. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  354. package/build-module/components/inspector-controls-tabs/index.js +35 -24
  355. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  356. package/build-module/components/list-view/block-select-button.js +4 -0
  357. package/build-module/components/list-view/block-select-button.js.map +1 -1
  358. package/build-module/components/list-view/block.js +58 -4
  359. package/build-module/components/list-view/block.js.map +1 -1
  360. package/build-module/components/media-upload-progress/constants.js +7 -0
  361. package/build-module/components/media-upload-progress/constants.js.map +1 -0
  362. package/build-module/components/media-upload-progress/index.native.js +37 -8
  363. package/build-module/components/media-upload-progress/index.native.js.map +1 -1
  364. package/build-module/components/navigable-toolbar/index.js +9 -14
  365. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  366. package/build-module/components/plain-text/index.native.js +6 -1
  367. package/build-module/components/plain-text/index.native.js.map +1 -1
  368. package/build-module/components/provider/index.js +3 -1
  369. package/build-module/components/provider/index.js.map +1 -1
  370. package/build-module/components/provider/use-block-sync.js +7 -1
  371. package/build-module/components/provider/use-block-sync.js.map +1 -1
  372. package/build-module/components/rich-text/index.js +17 -7
  373. package/build-module/components/rich-text/index.js.map +1 -1
  374. package/build-module/components/rich-text/native/index.native.js +16 -23
  375. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  376. package/build-module/components/rich-text/use-input-rules.js +2 -2
  377. package/build-module/components/rich-text/use-input-rules.js.map +1 -1
  378. package/build-module/components/rich-text/use-mark-persistent.js +1 -1
  379. package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
  380. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  381. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  382. package/build-module/components/url-input/index.js +9 -6
  383. package/build-module/components/url-input/index.js.map +1 -1
  384. package/build-module/components/use-block-commands/index.js +14 -18
  385. package/build-module/components/use-block-commands/index.js.map +1 -1
  386. package/build-module/components/use-block-drop-zone/index.js +51 -23
  387. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  388. package/build-module/components/use-moving-animation/index.js +102 -94
  389. package/build-module/components/use-moving-animation/index.js.map +1 -1
  390. package/build-module/components/use-on-block-drop/index.js +8 -11
  391. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  392. package/build-module/components/writing-flow/index.js +0 -1
  393. package/build-module/components/writing-flow/index.js.map +1 -1
  394. package/build-module/components/writing-flow/use-drag-selection.js +15 -4
  395. package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
  396. package/build-module/components/writing-flow/use-selection-observer.js +73 -27
  397. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
  398. package/build-module/components/writing-flow/use-tab-nav.js +7 -4
  399. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  400. package/build-module/hooks/align.js +1 -1
  401. package/build-module/hooks/align.js.map +1 -1
  402. package/build-module/hooks/anchor.js +1 -1
  403. package/build-module/hooks/anchor.js.map +1 -1
  404. package/build-module/hooks/aria-label.js +7 -1
  405. package/build-module/hooks/aria-label.js.map +1 -1
  406. package/build-module/hooks/background.js +181 -19
  407. package/build-module/hooks/background.js.map +1 -1
  408. package/build-module/hooks/border.js +2 -8
  409. package/build-module/hooks/border.js.map +1 -1
  410. package/build-module/hooks/color.js +11 -9
  411. package/build-module/hooks/color.js.map +1 -1
  412. package/build-module/hooks/custom-class-name.js +1 -1
  413. package/build-module/hooks/custom-class-name.js.map +1 -1
  414. package/build-module/hooks/custom-class-name.native.js +7 -1
  415. package/build-module/hooks/custom-class-name.native.js.map +1 -1
  416. package/build-module/hooks/dimensions.js +1 -7
  417. package/build-module/hooks/dimensions.js.map +1 -1
  418. package/build-module/hooks/font-family.js +6 -2
  419. package/build-module/hooks/font-family.js.map +1 -1
  420. package/build-module/hooks/font-size.js +1 -1
  421. package/build-module/hooks/font-size.js.map +1 -1
  422. package/build-module/hooks/index.js +5 -4
  423. package/build-module/hooks/index.js.map +1 -1
  424. package/build-module/hooks/index.native.js +6 -4
  425. package/build-module/hooks/index.native.js.map +1 -1
  426. package/build-module/hooks/layout.js +9 -3
  427. package/build-module/hooks/layout.js.map +1 -1
  428. package/build-module/hooks/style.js +1 -1
  429. package/build-module/hooks/style.js.map +1 -1
  430. package/build-module/hooks/typography.js +1 -7
  431. package/build-module/hooks/typography.js.map +1 -1
  432. package/build-module/hooks/typography.native.js +43 -17
  433. package/build-module/hooks/typography.native.js.map +1 -1
  434. package/build-module/hooks/use-typography-props.js +9 -1
  435. package/build-module/hooks/use-typography-props.js.map +1 -1
  436. package/build-module/hooks/utils.js +43 -4
  437. package/build-module/hooks/utils.js.map +1 -1
  438. package/build-module/private-apis.js +2 -4
  439. package/build-module/private-apis.js.map +1 -1
  440. package/build-module/private-apis.native.js +0 -2
  441. package/build-module/private-apis.native.js.map +1 -1
  442. package/build-module/store/actions.js +0 -15
  443. package/build-module/store/actions.js.map +1 -1
  444. package/build-module/store/private-actions.js +49 -4
  445. package/build-module/store/private-actions.js.map +1 -1
  446. package/build-module/store/private-selectors.js +11 -0
  447. package/build-module/store/private-selectors.js.map +1 -1
  448. package/build-module/store/reducer.js +14 -6
  449. package/build-module/store/reducer.js.map +1 -1
  450. package/build-module/store/selectors.js +1 -12
  451. package/build-module/store/selectors.js.map +1 -1
  452. package/build-module/store/undo-ignore.js +5 -0
  453. package/build-module/store/undo-ignore.js.map +1 -0
  454. package/build-module/store/utils.js +2 -2
  455. package/build-module/store/utils.js.map +1 -1
  456. package/build-module/utils/get-px-from-css-unit.js +9 -0
  457. package/build-module/utils/get-px-from-css-unit.js.map +1 -0
  458. package/build-module/utils/index.js +1 -1
  459. package/build-module/utils/index.js.map +1 -1
  460. package/build-module/utils/object.js +0 -37
  461. package/build-module/utils/object.js.map +1 -1
  462. package/build-module/utils/use-can-block-toolbar-be-focused.js +40 -0
  463. package/build-module/utils/use-can-block-toolbar-be-focused.js.map +1 -0
  464. package/build-style/content-rtl.css +7 -6
  465. package/build-style/content.css +7 -6
  466. package/build-style/style-rtl.css +51 -8
  467. package/build-style/style.css +51 -8
  468. package/package.json +31 -31
  469. package/src/components/alignment-control/README.md +0 -5
  470. package/src/components/block-alignment-control/README.md +0 -5
  471. package/src/components/block-alignment-matrix-control/README.md +0 -10
  472. package/src/components/block-breadcrumb/README.md +0 -5
  473. package/src/components/block-canvas/index.js +0 -2
  474. package/src/components/block-canvas/style.scss +6 -0
  475. package/src/components/block-caption/README.md +0 -5
  476. package/src/components/block-card/README.md +0 -5
  477. package/src/components/block-card/index.js +1 -1
  478. package/src/components/block-draggable/draggable-chip.js +11 -1
  479. package/src/components/block-draggable/index.js +116 -4
  480. package/src/components/block-draggable/index.native.js +0 -5
  481. package/src/components/block-draggable/style.scss +35 -0
  482. package/src/components/block-draggable/test/helpers.native.js +8 -7
  483. package/src/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
  484. package/src/components/block-editing-mode/index.js +3 -3
  485. package/src/components/block-icon/README.md +0 -5
  486. package/src/components/block-inspector/README.md +0 -5
  487. package/src/components/block-inspector/index.js +3 -1
  488. package/src/components/block-list/block-list-item-cell.native.js +5 -1
  489. package/src/components/block-list/block.js +290 -119
  490. package/src/components/block-list/block.native.js +55 -21
  491. package/src/components/block-list/content.scss +14 -10
  492. package/src/components/block-list/index.native.js +3 -5
  493. package/src/components/block-list/{block-list-block-context.js → private-block-context.js} +1 -1
  494. package/src/components/block-list/use-block-props/index.js +32 -128
  495. package/src/components/block-list/use-in-between-inserter.js +4 -1
  496. package/src/components/block-list/use-scroll-upon-insertion.native.js +52 -0
  497. package/src/components/block-lock/toolbar.js +15 -34
  498. package/src/components/block-mover/README.md +0 -5
  499. package/src/components/block-mover/index.js +1 -1
  500. package/src/components/block-parent-selector/README.md +0 -5
  501. package/src/components/block-patterns-list/README.md +0 -5
  502. package/src/components/block-patterns-list/index.js +8 -5
  503. package/src/components/block-switcher/index.js +49 -59
  504. package/src/components/block-toolbar/README.md +0 -5
  505. package/src/components/block-toolbar/index.js +1 -2
  506. package/src/components/block-tools/block-toolbar-popover.js +4 -10
  507. package/src/components/block-types-list/README.md +0 -5
  508. package/src/components/block-variation-picker/README.md +0 -5
  509. package/src/components/block-variation-transforms/README.md +0 -5
  510. package/src/components/block-variation-transforms/index.js +49 -3
  511. package/src/components/border-radius-control/linked-button.js +1 -1
  512. package/src/components/caption/README.md +0 -5
  513. package/src/components/color-palette/test/__snapshots__/control.js.snap +0 -1
  514. package/src/components/colors/utils.js +8 -1
  515. package/src/components/colors/with-colors.js +3 -1
  516. package/src/components/contrast-checker/README.md +0 -4
  517. package/src/components/copy-handler/README.md +0 -10
  518. package/src/components/font-sizes/utils.js +7 -1
  519. package/src/components/global-styles/border-panel.js +2 -1
  520. package/src/components/global-styles/color-panel.js +2 -1
  521. package/src/components/global-styles/dimensions-panel.js +4 -3
  522. package/src/components/global-styles/effects-panel.js +2 -1
  523. package/src/components/global-styles/filters-panel.js +2 -5
  524. package/src/components/global-styles/get-global-styles-changes.js +210 -0
  525. package/src/components/global-styles/hooks.js +3 -0
  526. package/src/components/global-styles/image-settings-panel.js +6 -0
  527. package/src/components/global-styles/index.js +1 -0
  528. package/src/components/global-styles/test/get-global-styles-changes.js +234 -0
  529. package/src/components/global-styles/typography-panel.js +2 -1
  530. package/src/components/global-styles/use-global-styles-output.js +9 -5
  531. package/src/components/global-styles/utils.js +7 -0
  532. package/src/components/height-control/README.md +2 -7
  533. package/src/components/height-control/index.js +4 -0
  534. package/src/components/image-size-control/index.js +5 -2
  535. package/src/components/index.native.js +2 -2
  536. package/src/components/inner-blocks/index.js +68 -29
  537. package/src/components/inner-blocks/index.native.js +19 -7
  538. package/src/components/inner-blocks/use-inner-block-template-sync.js +5 -7
  539. package/src/components/inner-blocks/use-nested-settings-update.js +6 -13
  540. package/src/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  541. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +15 -15
  542. package/src/components/inserter/block-patterns-tab/patterns-filter.js +15 -13
  543. package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +15 -18
  544. package/src/components/inserter/block-patterns-tab/utils.js +11 -12
  545. package/src/components/inserter/hooks/use-block-types-state.js +9 -11
  546. package/src/components/inserter/hooks/use-patterns-state.js +2 -2
  547. package/src/components/inserter/index.js +0 -1
  548. package/src/components/inserter/library.js +2 -8
  549. package/src/components/inserter/menu.js +13 -31
  550. package/src/components/inserter/style.scss +6 -4
  551. package/src/components/inserter/tabs.js +34 -25
  552. package/src/components/inserter-draggable-blocks/index.js +2 -2
  553. package/src/components/inserter-list-item/index.js +6 -6
  554. package/src/components/inspector-controls/block-support-tools-panel.js +2 -0
  555. package/src/components/inspector-controls-tabs/index.js +39 -28
  556. package/src/components/inspector-controls-tabs/style.scss +3 -2
  557. package/src/components/letter-spacing-control/README.md +0 -5
  558. package/src/components/line-height-control/README.md +0 -5
  559. package/src/components/list-view/README.md +0 -5
  560. package/src/components/list-view/block-select-button.js +4 -0
  561. package/src/components/list-view/block.js +73 -2
  562. package/src/components/list-view/style.scss +6 -0
  563. package/src/components/media-upload-progress/constants.js +6 -0
  564. package/src/components/media-upload-progress/index.native.js +66 -14
  565. package/src/components/media-upload-progress/test/index.native.js +2 -2
  566. package/src/components/multi-selection-inspector/README.md +0 -5
  567. package/src/components/navigable-toolbar/index.js +13 -11
  568. package/src/components/plain-text/index.native.js +6 -1
  569. package/src/components/provider/index.js +1 -1
  570. package/src/components/provider/test/use-block-sync.js +20 -17
  571. package/src/components/provider/use-block-sync.js +6 -0
  572. package/src/components/rich-text/index.js +18 -6
  573. package/src/components/rich-text/native/index.native.js +16 -24
  574. package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +3 -3
  575. package/src/components/rich-text/native/test/index.native.js +72 -5
  576. package/src/components/rich-text/use-input-rules.js +2 -2
  577. package/src/components/rich-text/use-mark-persistent.js +1 -2
  578. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  579. package/src/components/text-decoration-control/README.md +40 -0
  580. package/src/components/text-transform-control/README.md +0 -4
  581. package/src/components/ungroup-button/README.md +0 -5
  582. package/src/components/unit-control/README.md +0 -4
  583. package/src/components/url-input/index.js +11 -11
  584. package/src/components/use-block-commands/index.js +18 -21
  585. package/src/components/use-block-drop-zone/index.js +85 -34
  586. package/src/components/use-moving-animation/index.js +107 -103
  587. package/src/components/use-on-block-drop/index.js +7 -23
  588. package/src/components/use-on-block-drop/test/index.js +12 -26
  589. package/src/components/use-resize-canvas/README.md +0 -4
  590. package/src/components/use-settings/README.md +0 -4
  591. package/src/components/writing-flow/index.js +0 -1
  592. package/src/components/writing-flow/use-drag-selection.js +18 -4
  593. package/src/components/writing-flow/use-selection-observer.js +99 -37
  594. package/src/components/writing-flow/use-tab-nav.js +7 -7
  595. package/src/hooks/align.js +1 -5
  596. package/src/hooks/anchor.js +1 -5
  597. package/src/hooks/aria-label.js +8 -5
  598. package/src/hooks/background.js +253 -21
  599. package/src/hooks/border.js +2 -13
  600. package/src/hooks/color.js +19 -14
  601. package/src/hooks/custom-class-name.js +1 -5
  602. package/src/hooks/custom-class-name.native.js +8 -5
  603. package/src/hooks/dimensions.js +1 -7
  604. package/src/hooks/font-family.js +4 -7
  605. package/src/hooks/font-size.js +1 -6
  606. package/src/hooks/index.js +19 -3
  607. package/src/hooks/index.native.js +17 -4
  608. package/src/hooks/layout.js +5 -2
  609. package/src/hooks/style.js +1 -6
  610. package/src/hooks/test/anchor.js +4 -9
  611. package/src/hooks/test/custom-class-name.js +3 -8
  612. package/src/hooks/test/style.js +4 -14
  613. package/src/hooks/typography.js +1 -7
  614. package/src/hooks/typography.native.js +31 -33
  615. package/src/hooks/use-typography-props.js +7 -1
  616. package/src/hooks/utils.js +60 -2
  617. package/src/private-apis.js +2 -4
  618. package/src/private-apis.native.js +0 -2
  619. package/src/store/actions.js +0 -15
  620. package/src/store/private-actions.js +44 -4
  621. package/src/store/private-selectors.js +11 -0
  622. package/src/store/reducer.js +16 -5
  623. package/src/store/selectors.js +5 -13
  624. package/src/store/undo-ignore.js +4 -0
  625. package/src/store/utils.js +2 -2
  626. package/src/style.scss +1 -0
  627. package/src/utils/get-px-from-css-unit.js +8 -0
  628. package/src/utils/index.js +1 -1
  629. package/src/utils/object.js +0 -35
  630. package/src/utils/test/object.js +1 -96
  631. package/src/utils/use-can-block-toolbar-be-focused.js +48 -0
  632. package/build/components/block-list/block-list-block-context.js +0 -14
  633. package/build/components/block-list/block-list-block-context.js.map +0 -1
  634. package/build/utils/parse-css-unit-to-px.js +0 -302
  635. package/build/utils/parse-css-unit-to-px.js.map +0 -1
  636. package/build/utils/use-should-contextual-toolbar-show.js +0 -63
  637. package/build/utils/use-should-contextual-toolbar-show.js.map +0 -1
  638. package/build-module/components/block-list/block-list-block-context.js +0 -6
  639. package/build-module/components/block-list/block-list-block-context.js.map +0 -1
  640. package/build-module/utils/parse-css-unit-to-px.js +0 -294
  641. package/build-module/utils/parse-css-unit-to-px.js.map +0 -1
  642. package/build-module/utils/use-should-contextual-toolbar-show.js +0 -57
  643. package/build-module/utils/use-should-contextual-toolbar-show.js.map +0 -1
  644. package/src/utils/parse-css-unit-to-px.js +0 -329
  645. package/src/utils/test/parse-css-unit-to-px.js +0 -172
  646. package/src/utils/use-should-contextual-toolbar-show.js +0 -85
@@ -8,16 +8,15 @@ import classnames from 'classnames';
8
8
  */
9
9
  import { useContext } from '@wordpress/element';
10
10
  import { __, sprintf } from '@wordpress/i18n';
11
- import { __unstableGetBlockProps as getBlockProps, getBlockType, isReusableBlock, getBlockDefaultClassName, store as blocksStore } from '@wordpress/blocks';
11
+ import { __unstableGetBlockProps as getBlockProps } from '@wordpress/blocks';
12
12
  import { useMergeRefs, useDisabled } from '@wordpress/compose';
13
- import { useSelect } from '@wordpress/data';
14
13
  import warning from '@wordpress/warning';
15
14
 
16
15
  /**
17
16
  * Internal dependencies
18
17
  */
19
18
  import useMovingAnimation from '../../use-moving-animation';
20
- import { BlockListBlockContext } from '../block-list-block-context';
19
+ import { PrivateBlockContext } from '../private-block-context';
21
20
  import { useFocusFirstElement } from './use-focus-first-element';
22
21
  import { useIsHovered } from './use-is-hovered';
23
22
  import { useBlockEditContext } from '../../block-edit/context';
@@ -26,14 +25,6 @@ import { useEventHandlers } from './use-selected-block-event-handlers';
26
25
  import { useNavModeExit } from './use-nav-mode-exit';
27
26
  import { useBlockRefProvider } from './use-block-refs';
28
27
  import { useIntersectionObserver } from './use-intersection-observer';
29
- import { store as blockEditorStore } from '../../../store';
30
- import { unlock } from '../../../lock-unlock';
31
-
32
- /**
33
- * If the block count exceeds the threshold, we disable the reordering animation
34
- * to avoid laginess.
35
- */
36
- const BLOCK_ANIMATION_THRESHOLD = 200;
37
28
 
38
29
  /**
39
30
  * This hook is used to lightly mark an element as a block element. The element
@@ -84,95 +75,31 @@ export function useBlockProps(props = {}, {
84
75
  clientId,
85
76
  className,
86
77
  wrapperProps = {},
87
- isAligned
88
- } = useContext(BlockListBlockContext);
89
- const {
78
+ isAligned,
90
79
  index,
91
80
  mode,
92
81
  name,
93
82
  blockApiVersion,
94
83
  blockTitle,
95
84
  isSelected,
96
- isPartOfSelection,
97
- adjustScrolling,
98
- enableAnimation,
99
85
  isSubtreeDisabled,
100
86
  isOutlineEnabled,
101
87
  hasOverlay,
102
88
  initialPosition,
103
- classNames
104
- } = useSelect(select => {
105
- const {
106
- getBlockAttributes,
107
- getBlockIndex,
108
- getBlockMode,
109
- getBlockName,
110
- isTyping,
111
- getGlobalBlockCount,
112
- isBlockSelected,
113
- isBlockMultiSelected,
114
- isAncestorMultiSelected,
115
- isFirstMultiSelectedBlock,
116
- isBlockSubtreeDisabled,
117
- getSettings,
118
- isBlockHighlighted,
119
- __unstableIsFullySelected,
120
- __unstableSelectionHasUnmergeableBlock,
121
- isBlockBeingDragged,
122
- hasSelectedInnerBlock,
123
- hasBlockMovingClientId,
124
- canInsertBlockType,
125
- getBlockRootClientId,
126
- __unstableHasActiveBlockOverlayActive,
127
- __unstableGetEditorMode,
128
- getSelectedBlocksInitialCaretPosition
129
- } = unlock(select(blockEditorStore));
130
- const {
131
- getActiveBlockVariation
132
- } = select(blocksStore);
133
- const _isSelected = isBlockSelected(clientId);
134
- const isPartOfMultiSelection = isBlockMultiSelected(clientId) || isAncestorMultiSelected(clientId);
135
- const blockName = getBlockName(clientId);
136
- const blockType = getBlockType(blockName);
137
- const attributes = getBlockAttributes(clientId);
138
- const match = getActiveBlockVariation(blockName, attributes);
139
- const {
140
- outlineMode
141
- } = getSettings();
142
- const isMultiSelected = isBlockMultiSelected(clientId);
143
- const checkDeep = true;
144
- const isAncestorOfSelectedBlock = hasSelectedInnerBlock(clientId, checkDeep);
145
- const typing = isTyping();
146
- const hasLightBlockWrapper = blockType?.apiVersion > 1;
147
- const movingClientId = hasBlockMovingClientId();
148
- return {
149
- index: getBlockIndex(clientId),
150
- mode: getBlockMode(clientId),
151
- name: blockName,
152
- blockApiVersion: blockType?.apiVersion || 1,
153
- blockTitle: match?.title || blockType?.title,
154
- isSelected: _isSelected,
155
- isPartOfSelection: _isSelected || isPartOfMultiSelection,
156
- adjustScrolling: _isSelected || isFirstMultiSelectedBlock(clientId),
157
- enableAnimation: !typing && getGlobalBlockCount() <= BLOCK_ANIMATION_THRESHOLD,
158
- isSubtreeDisabled: isBlockSubtreeDisabled(clientId),
159
- isOutlineEnabled: outlineMode,
160
- hasOverlay: __unstableHasActiveBlockOverlayActive(clientId),
161
- initialPosition: _isSelected && __unstableGetEditorMode() === 'edit' ? getSelectedBlocksInitialCaretPosition() : undefined,
162
- classNames: classnames({
163
- 'is-selected': _isSelected,
164
- 'is-highlighted': isBlockHighlighted(clientId),
165
- 'is-multi-selected': isMultiSelected,
166
- 'is-partially-selected': isMultiSelected && !__unstableIsFullySelected() && !__unstableSelectionHasUnmergeableBlock(),
167
- 'is-reusable': isReusableBlock(blockType),
168
- 'is-dragging': isBlockBeingDragged(clientId),
169
- 'has-child-selected': isAncestorOfSelectedBlock,
170
- 'remove-outline': _isSelected && outlineMode && typing,
171
- 'is-block-moving-mode': !!movingClientId,
172
- 'can-insert-moving-block': movingClientId && canInsertBlockType(getBlockName(movingClientId), getBlockRootClientId(clientId))
173
- }, hasLightBlockWrapper ? attributes.className : undefined, hasLightBlockWrapper ? getBlockDefaultClassName(blockName) : undefined)
174
- };
175
- }, [clientId]);
89
+ blockEditingMode,
90
+ isHighlighted,
91
+ isMultiSelected,
92
+ isPartiallySelected,
93
+ isReusable,
94
+ isDragging,
95
+ hasChildSelected,
96
+ removeOutline,
97
+ isBlockMovingMode,
98
+ canInsertMovingBlock,
99
+ isEditingDisabled,
100
+ isTemporarilyEditingAsBlocks,
101
+ defaultClassName
102
+ } = useContext(PrivateBlockContext);
176
103
 
177
104
  // translators: %s: Type of block (i.e. Text, Image etc)
178
105
  const blockLabel = sprintf(__('Block: %s'), blockTitle);
@@ -186,10 +113,8 @@ export function useBlockProps(props = {}, {
186
113
  }), useNavModeExit(clientId), useIsHovered({
187
114
  isEnabled: isOutlineEnabled
188
115
  }), useIntersectionObserver(), useMovingAnimation({
189
- isSelected: isPartOfSelection,
190
- adjustScrolling,
191
- enableAnimation,
192
- triggerAnimationOnChange: index
116
+ triggerAnimationOnChange: index,
117
+ clientId
193
118
  }), useDisabled({
194
119
  isDisabled: !hasOverlay
195
120
  })]);
@@ -199,7 +124,7 @@ export function useBlockProps(props = {}, {
199
124
  typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? warning(`Block type "${name}" must support API version 2 or higher to work correctly with "useBlockProps" method.`) : void 0;
200
125
  }
201
126
  return {
202
- tabIndex: 0,
127
+ tabIndex: blockEditingMode === 'disabled' ? -1 : 0,
203
128
  ...wrapperProps,
204
129
  ...props,
205
130
  ref: mergedRefs,
@@ -213,8 +138,20 @@ export function useBlockProps(props = {}, {
213
138
  className: classnames('block-editor-block-list__block', {
214
139
  // The wp-block className is important for editor styles.
215
140
  'wp-block': !isAligned,
216
- 'has-block-overlay': hasOverlay
217
- }, className, props.className, wrapperProps.className, classNames),
141
+ 'has-block-overlay': hasOverlay,
142
+ 'is-selected': isSelected,
143
+ 'is-highlighted': isHighlighted,
144
+ 'is-multi-selected': isMultiSelected,
145
+ 'is-partially-selected': isPartiallySelected,
146
+ 'is-reusable': isReusable,
147
+ 'is-dragging': isDragging,
148
+ 'has-child-selected': hasChildSelected,
149
+ 'remove-outline': removeOutline,
150
+ 'is-block-moving-mode': isBlockMovingMode,
151
+ 'can-insert-moving-block': canInsertMovingBlock,
152
+ 'is-editing-disabled': isEditingDisabled,
153
+ 'is-content-locked-temporarily-editing-as-blocks': isTemporarilyEditingAsBlocks
154
+ }, className, props.className, wrapperProps.className, defaultClassName),
218
155
  style: {
219
156
  ...wrapperProps.style,
220
157
  ...props.style
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","useContext","__","sprintf","__unstableGetBlockProps","getBlockProps","getBlockType","isReusableBlock","getBlockDefaultClassName","store","blocksStore","useMergeRefs","useDisabled","useSelect","warning","useMovingAnimation","BlockListBlockContext","useFocusFirstElement","useIsHovered","useBlockEditContext","useFocusHandler","useEventHandlers","useNavModeExit","useBlockRefProvider","useIntersectionObserver","blockEditorStore","unlock","BLOCK_ANIMATION_THRESHOLD","useBlockProps","props","__unstableIsHtml","clientId","className","wrapperProps","isAligned","index","mode","name","blockApiVersion","blockTitle","isSelected","isPartOfSelection","adjustScrolling","enableAnimation","isSubtreeDisabled","isOutlineEnabled","hasOverlay","initialPosition","classNames","select","getBlockAttributes","getBlockIndex","getBlockMode","getBlockName","isTyping","getGlobalBlockCount","isBlockSelected","isBlockMultiSelected","isAncestorMultiSelected","isFirstMultiSelectedBlock","isBlockSubtreeDisabled","getSettings","isBlockHighlighted","__unstableIsFullySelected","__unstableSelectionHasUnmergeableBlock","isBlockBeingDragged","hasSelectedInnerBlock","hasBlockMovingClientId","canInsertBlockType","getBlockRootClientId","__unstableHasActiveBlockOverlayActive","__unstableGetEditorMode","getSelectedBlocksInitialCaretPosition","getActiveBlockVariation","_isSelected","isPartOfMultiSelection","blockName","blockType","attributes","match","outlineMode","isMultiSelected","checkDeep","isAncestorOfSelectedBlock","typing","hasLightBlockWrapper","apiVersion","movingClientId","title","undefined","blockLabel","htmlSuffix","mergedRefs","ref","isEnabled","triggerAnimationOnChange","isDisabled","blockEditContext","SCRIPT_DEBUG","tabIndex","id","role","inert","style","save"],"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\tisReusableBlock,\n\tgetBlockDefaultClassName,\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 { 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 { 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\tisSelected,\n\t\tisPartOfSelection,\n\t\tadjustScrolling,\n\t\tenableAnimation,\n\t\tisSubtreeDisabled,\n\t\tisOutlineEnabled,\n\t\thasOverlay,\n\t\tinitialPosition,\n\t\tclassNames,\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\tgetSettings,\n\t\t\t\tisBlockHighlighted,\n\t\t\t\t__unstableIsFullySelected,\n\t\t\t\t__unstableSelectionHasUnmergeableBlock,\n\t\t\t\tisBlockBeingDragged,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\thasBlockMovingClientId,\n\t\t\t\tcanInsertBlockType,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\t__unstableHasActiveBlockOverlayActive,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t\tgetSelectedBlocksInitialCaretPosition,\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\t\t\tconst { outlineMode } = getSettings();\n\t\t\tconst isMultiSelected = isBlockMultiSelected( clientId );\n\t\t\tconst checkDeep = true;\n\t\t\tconst isAncestorOfSelectedBlock = hasSelectedInnerBlock(\n\t\t\t\tclientId,\n\t\t\t\tcheckDeep\n\t\t\t);\n\t\t\tconst typing = isTyping();\n\t\t\tconst hasLightBlockWrapper = blockType?.apiVersion > 1;\n\t\t\tconst movingClientId = hasBlockMovingClientId();\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\tisSelected: _isSelected,\n\t\t\t\tisPartOfSelection: _isSelected || isPartOfMultiSelection,\n\t\t\t\tadjustScrolling:\n\t\t\t\t\t_isSelected || isFirstMultiSelectedBlock( clientId ),\n\t\t\t\tenableAnimation:\n\t\t\t\t\t! typing &&\n\t\t\t\t\tgetGlobalBlockCount() <= BLOCK_ANIMATION_THRESHOLD,\n\t\t\t\tisSubtreeDisabled: isBlockSubtreeDisabled( clientId ),\n\t\t\t\tisOutlineEnabled: outlineMode,\n\t\t\t\thasOverlay: __unstableHasActiveBlockOverlayActive( clientId ),\n\t\t\t\tinitialPosition:\n\t\t\t\t\t_isSelected && __unstableGetEditorMode() === 'edit'\n\t\t\t\t\t\t? getSelectedBlocksInitialCaretPosition()\n\t\t\t\t\t\t: undefined,\n\t\t\t\tclassNames: classnames(\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-selected': _isSelected,\n\t\t\t\t\t\t'is-highlighted': isBlockHighlighted( clientId ),\n\t\t\t\t\t\t'is-multi-selected': isMultiSelected,\n\t\t\t\t\t\t'is-partially-selected':\n\t\t\t\t\t\t\tisMultiSelected &&\n\t\t\t\t\t\t\t! __unstableIsFullySelected() &&\n\t\t\t\t\t\t\t! __unstableSelectionHasUnmergeableBlock(),\n\t\t\t\t\t\t'is-reusable': isReusableBlock( blockType ),\n\t\t\t\t\t\t'is-dragging': isBlockBeingDragged( clientId ),\n\t\t\t\t\t\t'has-child-selected': isAncestorOfSelectedBlock,\n\t\t\t\t\t\t'remove-outline': _isSelected && outlineMode && typing,\n\t\t\t\t\t\t'is-block-moving-mode': !! movingClientId,\n\t\t\t\t\t\t'can-insert-moving-block':\n\t\t\t\t\t\t\tmovingClientId &&\n\t\t\t\t\t\t\tcanInsertBlockType(\n\t\t\t\t\t\t\t\tgetBlockName( movingClientId ),\n\t\t\t\t\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\thasLightBlockWrapper ? attributes.className : undefined,\n\t\t\t\t\thasLightBlockWrapper\n\t\t\t\t\t\t? getBlockDefaultClassName( blockName )\n\t\t\t\t\t\t: undefined\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\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( {\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'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},\n\t\t\tclassName,\n\t\t\tprops.className,\n\t\t\twrapperProps.className,\n\t\t\tclassNames\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":"AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SACCC,uBAAuB,IAAIC,aAAa,EACxCC,YAAY,EACZC,eAAe,EACfC,wBAAwB,EACxBC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASC,YAAY,EAAEC,WAAW,QAAQ,oBAAoB;AAC9D,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,OAAOC,OAAO,MAAM,oBAAoB;;AAExC;AACA;AACA;AACA,OAAOC,kBAAkB,MAAM,4BAA4B;AAC3D,SAASC,qBAAqB,QAAQ,6BAA6B;AACnE,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,YAAY,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AI,EAAE,UAAU;IAChB,YAAY,EAAEX,UAAU;IACxB,YAAY,EAAE3D,QAAQ;IACtB,WAAW,EAAEM,IAAI;IACjB,YAAY,EAAEE,UAAU;IACxB+D,KAAK,EAAE1D,iBAAiB,GAAG,MAAM,GAAG6C,SAAS;IAC7CzD,SAAS,EAAEhC,UAAU,CACpB,gCAAgC,EAChC;MACC;MACA,UAAU,EAAE,CAAEkC,SAAS;MACvB,mBAAmB,EAAEY;IACtB,CAAC,EACDd,SAAS,EACTH,KAAK,CAACG,SAAS,EACfC,YAAY,CAACD,SAAS,EACtBgB,UACD,CAAC;IACDuD,KAAK,EAAE;MAAE,GAAGtE,YAAY,CAACsE,KAAK;MAAE,GAAG1E,KAAK,CAAC0E;IAAM;EAChD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA3E,aAAa,CAAC4E,IAAI,GAAGnG,aAAa"}
1
+ {"version":3,"names":["classnames","useContext","__","sprintf","__unstableGetBlockProps","getBlockProps","useMergeRefs","useDisabled","warning","useMovingAnimation","PrivateBlockContext","useFocusFirstElement","useIsHovered","useBlockEditContext","useFocusHandler","useEventHandlers","useNavModeExit","useBlockRefProvider","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","blockLabel","htmlSuffix","mergedRefs","ref","isEnabled","triggerAnimationOnChange","isDisabled","blockEditContext","SCRIPT_DEBUG","tabIndex","id","role","inert","undefined","style","save"],"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":"AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,uBAAuB,IAAIC,aAAa,QAAQ,mBAAmB;AAC5E,SAASC,YAAY,EAAEC,WAAW,QAAQ,oBAAoB;AAC9D,OAAOC,OAAO,MAAM,oBAAoB;;AAExC;AACA;AACA;AACA,OAAOC,kBAAkB,MAAM,4BAA4B;AAC3D,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,mBAAmB,QAAQ,0BAA0B;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;MACpC,uBAAuB,EAAEC,mBAAmB;MAC5C,aAAa,EAAEC,UAAU;MACzB,aAAa,EAAEC,UAAU;MACzB,oBAAoB,EAAEC,gBAAgB;MACtC,gBAAgB,EAAEC,aAAa;MAC/B,sBAAsB,EAAEC,iBAAiB;MACzC,yBAAyB,EAAEC,oBAAoB;MAC/C,qBAAqB,EAAEC,iBAAiB;MACxC,iDAAiD,EAChDC;IACF,CAAC,EACDxB,SAAS,EACTH,KAAK,CAACG,SAAS,EACfC,YAAY,CAACD,SAAS,EACtByB,gBACD,CAAC;IACDe,KAAK,EAAE;MAAE,GAAGvC,YAAY,CAACuC,KAAK;MAAE,GAAG3C,KAAK,CAAC2C;IAAM;EAChD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA5C,aAAa,CAAC6C,IAAI,GAAG3D,aAAa"}
@@ -21,7 +21,8 @@ export function useInBetweenInserter() {
21
21
  getSelectedBlockClientIds,
22
22
  getTemplateLock,
23
23
  __unstableIsWithinBlockOverlay,
24
- getBlockEditingMode
24
+ getBlockEditingMode,
25
+ getBlockName
25
26
  } = useSelect(blockEditorStore);
26
27
  const {
27
28
  showInsertionPoint,
@@ -52,7 +53,7 @@ export function useInBetweenInserter() {
52
53
  const blockElement = !!event.target.getAttribute('data-block') ? event.target : event.target.closest('[data-block]');
53
54
  rootClientId = blockElement.getAttribute('data-block');
54
55
  }
55
- if (getTemplateLock(rootClientId) || getBlockEditingMode(rootClientId) === 'disabled') {
56
+ if (getTemplateLock(rootClientId) || getBlockEditingMode(rootClientId) === 'disabled' || getBlockName(rootClientId) === 'core/block' && window.__experimentalPatternPartialSyncing) {
56
57
  return;
57
58
  }
58
59
  const orientation = getBlockListSettings(rootClientId)?.orientation || 'vertical';
@@ -1 +1 @@
1
- {"version":3,"names":["useRefEffect","useSelect","useDispatch","useContext","isRTL","store","blockEditorStore","InsertionPointOpenRef","useInBetweenInserter","openRef","isInBetweenInserterDisabled","select","getSettings","isDistractionFree","__unstableGetEditorMode","getBlockListSettings","getBlockIndex","isMultiSelecting","getSelectedBlockClientIds","getTemplateLock","__unstableIsWithinBlockOverlay","getBlockEditingMode","showInsertionPoint","hideInsertionPoint","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","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\tgetSelectedBlockClientIds,\n\t\t\tisInBetweenInserterDisabled,\n\t\t]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,oBAAoB;AACjD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,KAAK,QAAQ,iBAAiB;;AAEvC;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,qBAAqB,QAAQ,gCAAgC;AAEtE,OAAO,SAASC,oBAAoBA,CAAA,EAAG;EACtC,MAAMC,OAAO,GAAGN,UAAU,CAAEI,qBAAsB,CAAC;EACnD,MAAMG,2BAA2B,GAAGT,SAAS,CAC1CU,MAAM,IACPA,MAAM,CAAEL,gBAAiB,CAAC,CAACM,WAAW,CAAC,CAAC,CAACC,iBAAiB,IAC1DF,MAAM,CAAEL,gBAAiB,CAAC,CAACQ,uBAAuB,CAAC,CAAC,KAAK,UAAU,EACpE,EACD,CAAC;EACD,MAAM;IACLC,oBAAoB;IACpBC,aAAa;IACbC,gBAAgB;IAChBC,yBAAyB;IACzBC,eAAe;IACfC,8BAA8B;IAC9BC;EACD,CAAC,GAAGpB,SAAS,CAAEK,g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AK,CAACe,OAAO,GAAGkB,WAAW,CAACR,KAAK,IAClCzB,KAAK,CAACe,OAAO,GAAGkB,WAAW,CAACP,IAAI,CAAI,EACrC;QACD7B,kBAAkB,CAAC,CAAC;QACpB;MACD;MAEA,MAAMsC,KAAK,GAAG7C,aAAa,CAAEuC,QAAS,CAAC;;MAEvC;MACA;MACA,IAAKM,KAAK,KAAK,CAAC,EAAG;QAClBtC,kBAAkB,CAAC,CAAC;QACpB;MACD;MAEAD,kBAAkB,CAAEW,YAAY,EAAE4B,KAAK,EAAE;QACxCC,sBAAsB,EAAE;MACzB,CAAE,CAAC;IACJ;IAEAtC,IAAI,CAACuC,gBAAgB,CAAE,WAAW,EAAEtC,WAAY,CAAC;IAEjD,OAAO,MAAM;MACZD,IAAI,CAACwC,mBAAmB,CAAE,WAAW,EAAEvC,WAAY,CAAC;IACrD,CAAC;EACF,CAAC,EACD,CACChB,OAAO,EACPM,oBAAoB,EACpBC,aAAa,EACbC,gBAAgB,EAChBK,kBAAkB,EAClBC,kBAAkB,EAClBL,yBAAyB,EACzBR,2BAA2B,CAE7B,CAAC;AACF"}
1
+ {"version":3,"names":["useRefEffect","useSelect","useDispatch","useContext","isRTL","store","blockEditorStore","InsertionPointOpenRef","useInBetweenInserter","openRef","isInBetweenInserterDisabled","select","getSettings","isDistractionFree","__unstableGetEditorMode","getBlockListSettings","getBlockIndex","isMultiSelecting","getSelectedBlockClientIds","getTemplateLock","__unstableIsWithinBlockOverlay","getBlockEditingMode","getBlockName","showInsertionPoint","hideInsertionPoint","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","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":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,oBAAoB;AACjD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,KAAK,QAAQ,iBAAiB;;AAEvC;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,qBAAqB,QAAQ,gCAAgC;AAEtE,OAAO,SAASC,oBAAoBA,CAAA,EAAG;EACtC,MAAMC,OAAO,GAAGN,UAAU,CAAEI,qBAAsB,CAAC;EACnD,MAAMG,2BAA2B,GAAGT,SAAS,CAC1CU,MAAM,IACPA,MAAM,CAAEL,gBAAiB,CAAC,CAACM,WAAW,CAAC,CAAC,CAACC,iBAAiB,IAC1DF,MAAM,CAAEL,gBAAiB,CAAC,CAACQ,uBAAuB,CAAC,CAAC,KAAK,UAAU,EACpE,EACD,CAAC;EACD,MAAM;IACLC,oBAAoB;IACpBC,aAAa;IACbC,gBAAgB;IAChBC,yBAAyB;IACzBC,eAAe;IACfC,8BAA8B;IAC9BC,mBAAmB;IACnBC;EACD,CAAC,GAAGrB,SAAS,CAAEK,gBAAiB,CAAC;EACjC,MAAM;IAAEiB,kBAAkB;IAAEC;EAAmB,CAAC,GAC/CtB,WAAW,CAAEI,gBAAiB,CAAC;EAEhC,OAAON,YAAY,CAChByB,IAAI,IAAM;IACX,IAAKf,2BAA2B,EAAG;MAClC;IACD;IAEA,SAASgB,WAAWA,CAAEC,KAAK,EAAG;MAC7B,IAAKlB,OAAO,CAACmB,OAAO,EAA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GAAGhD,aAAa,CAAE0C,QAAS,CAAC;;MAEvC;MACA;MACA,IAAKM,KAAK,KAAK,CAAC,EAAG;QAClBxC,kBAAkB,CAAC,CAAC;QACpB;MACD;MAEAD,kBAAkB,CAAEW,YAAY,EAAE8B,KAAK,EAAE;QACxCC,sBAAsB,EAAE;MACzB,CAAE,CAAC;IACJ;IAEAxC,IAAI,CAACyC,gBAAgB,CAAE,WAAW,EAAExC,WAAY,CAAC;IAEjD,OAAO,MAAM;MACZD,IAAI,CAAC0C,mBAAmB,CAAE,WAAW,EAAEzC,WAAY,CAAC;IACrD,CAAC;EACF,CAAC,EACD,CACCjB,OAAO,EACPM,oBAAoB,EACpBC,aAAa,EACbC,gBAAgB,EAChBM,kBAAkB,EAClBC,kBAAkB,EAClBN,yBAAyB,EACzBR,2BAA2B,CAE7B,CAAC;AACF"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useEffect } from '@wordpress/element';
5
+ import { useSelect } from '@wordpress/data';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { useBlockListContext } from './block-list-context';
11
+ import { store as blockEditorStore } from '../../store';
12
+ const useScrollUponInsertion = ({
13
+ clientId,
14
+ isSelected,
15
+ isLayoutCalculated,
16
+ elementRef
17
+ }) => {
18
+ const {
19
+ scrollRef
20
+ } = useBlockListContext();
21
+ const wasBlockJustInserted = useSelect(select => !!select(blockEditorStore).wasBlockJustInserted(clientId, 'inserter_menu'), [clientId]);
22
+ useEffect(() => {
23
+ const lastScrollTo = scrollRef?.lastScrollTo.current;
24
+ const alreadyScrolledTo = lastScrollTo?.clientId === clientId;
25
+ if (alreadyScrolledTo || !isSelected || !scrollRef || !wasBlockJustInserted || !isLayoutCalculated) {
26
+ return;
27
+ }
28
+ scrollRef.scrollToElement(elementRef);
29
+ lastScrollTo.clientId = clientId;
30
+ }, [isSelected, scrollRef, wasBlockJustInserted, elementRef, isLayoutCalculated, clientId]);
31
+ };
32
+ export default useScrollUponInsertion;
33
+ //# sourceMappingURL=use-scroll-upon-insertion.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useSelect","useBlockListContext","store","blockEditorStore","useScrollUponInsertion","clientId","isSelected","isLayoutCalculated","elementRef","scrollRef","wasBlockJustInserted","select","lastScrollTo","current","alreadyScrolledTo","scrollToElement"],"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":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,sBAAsB;AAC1D,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAEvD,MAAMC,sBAAsB,GAAGA,CAAE;EAChCC,QAAQ;EACRC,UAAU;EACVC,kBAAkB;EAClBC;AACD,CAAC,KAAM;EACN,MAAM;IAAEC;EAAU,CAAC,GAAGR,mBAAmB,CAAC,CAAC;EAC3C,MAAMS,oBAAoB,GAAGV,SAAS,CACnCW,MAAM,IACP,CAAC,CAAEA,MAAM,CAAER,gBAAiB,CAAC,CAACO,oBAAoB,CACjDL,QAAQ,EACR,eACD,CAAC,EACF,CAAEA,QAAQ,CACX,CAAC;EACDN,SAAS,CAAE,MAAM;IAChB,MAAMa,YAAY,GAAGH,SAAS,EAAEG,YAAY,CAACC,OAAO;IACpD,MAAMC,iBAAiB,GAAGF,YAAY,EAAEP,QAAQ,KAAKA,QAAQ;IAC7D,IACCS,iBAAiB,IACjB,CAAER,UAAU,IACZ,CAAEG,SAAS,IACX,CAAEC,oBAAoB,IACtB,CAAEH,kBAAkB,EACnB;MACD;IACD;IACAE,SAAS,CAACM,eAAe,CAAEP,UAAW,CAAC;IACvCI,YAAY,CAACP,QAAQ,GAAGA,QAAQ;EACjC,CAAC,EAAE,CACFC,UAAU,EACVG,SAAS,EACTC,oBAAoB,EACpBF,UAAU,EACVD,kBAAkB,EAClBF,QAAQ,CACP,CAAC;AACJ,CAAC;AAED,eAAeD,sBAAsB"}
@@ -4,9 +4,8 @@ import { createElement, Fragment } from "react";
4
4
  */
5
5
  import { __ } from '@wordpress/i18n';
6
6
  import { ToolbarButton, ToolbarGroup } from '@wordpress/components';
7
- import { focus } from '@wordpress/dom';
8
7
  import { useReducer, useRef, useEffect } from '@wordpress/element';
9
- import { lock } from '@wordpress/icons';
8
+ import { lock, unlock } from '@wordpress/icons';
10
9
 
11
10
  /**
12
11
  * Internal dependencies
@@ -14,44 +13,33 @@ import { lock } from '@wordpress/icons';
14
13
  import BlockLockModal from './modal';
15
14
  import useBlockLock from './use-block-lock';
16
15
  export default function BlockLockToolbar({
17
- clientId,
18
- wrapperRef
16
+ clientId
19
17
  }) {
20
18
  const {
21
- canEdit,
22
- canMove,
23
- canRemove,
24
- canLock
19
+ canLock,
20
+ isLocked
25
21
  } = useBlockLock(clientId);
26
22
  const [isModalOpen, toggleModal] = useReducer(isActive => !isActive, false);
27
- const lockButtonRef = useRef(null);
28
- const isFirstRender = useRef(true);
29
- const shouldHideBlockLockUI = !canLock || canEdit && canMove && canRemove;
23
+ const hasLockButtonShown = useRef(false);
30
24
 
31
- // Restore focus manually on the first focusable element in the toolbar
32
- // when the block lock modal is closed and the block is not locked anymore.
33
- // See https://github.com/WordPress/gutenberg/issues/51447
25
+ // If the block lock button has been shown, we don't want to remove it
26
+ // from the toolbar until the toolbar is rendered again without it.
27
+ // Removing it beforehand can cause focus loss issues, such as when
28
+ // unlocking the block from the modal. It needs to return focus from
29
+ // whence it came, and to do that, we need to leave the button in the toolbar.
34
30
  useEffect(() => {
35
- if (isFirstRender.current) {
36
- isFirstRender.current = false;
37
- return;
31
+ if (isLocked) {
32
+ hasLockButtonShown.current = true;
38
33
  }
39
- if (!isModalOpen && shouldHideBlockLockUI) {
40
- focus.focusable.find(wrapperRef.current, {
41
- sequential: false
42
- }).find(element => element.tagName === 'BUTTON' && element !== lockButtonRef.current)?.focus();
43
- }
44
- // wrapperRef is a reference object and should be stable
45
- }, [isModalOpen, shouldHideBlockLockUI, wrapperRef]);
46
- if (shouldHideBlockLockUI) {
34
+ }, [isLocked]);
35
+ if (!canLock || !isLocked && !hasLockButtonShown.current) {
47
36
  return null;
48
37
  }
49
38
  return createElement(Fragment, null, createElement(ToolbarGroup, {
50
39
  className: "block-editor-block-lock-toolbar"
51
40
  }, createElement(ToolbarButton, {
52
- ref: lockButtonRef,
53
- icon: lock,
54
- label: __('Unlock'),
41
+ icon: isLocked ? lock : unlock,
42
+ label: isLocked ? __('Unlock') : __('Lock'),
55
43
  onClick: toggleModal,
56
44
  "aria-expanded": isModalOpen,
57
45
  "aria-haspopup": "dialog"
@@ -1 +1 @@
1
- {"version":3,"names":["__","ToolbarButton","ToolbarGroup","focus","useReducer","useRef","useEffect","lock","BlockLockModal","useBlockLock","BlockLockToolbar","clientId","wrapperRef","canEdit","canMove","canRemove","canLock","isModalOpen","toggleModal","isActive","lockButtonRef","isFirstRender","shouldHideBlockLockUI","current","focusable","find","sequential","element","tagName","createElement","Fragment","className","ref","icon","label","onClick","onClose"],"sources":["@wordpress/block-editor/src/components/block-lock/toolbar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { focus } from '@wordpress/dom';\nimport { useReducer, useRef, useEffect } from '@wordpress/element';\nimport { lock } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockLockModal from './modal';\nimport useBlockLock from './use-block-lock';\n\nexport default function BlockLockToolbar( { clientId, wrapperRef } ) {\n\tconst { canEdit, canMove, canRemove, canLock } = useBlockLock( clientId );\n\n\tconst [ isModalOpen, toggleModal ] = useReducer(\n\t\t( isActive ) => ! isActive,\n\t\tfalse\n\t);\n\n\tconst lockButtonRef = useRef( null );\n\tconst isFirstRender = useRef( true );\n\n\tconst shouldHideBlockLockUI =\n\t\t! canLock || ( canEdit && canMove && canRemove );\n\n\t// Restore focus manually on the first focusable element in the toolbar\n\t// when the block lock modal is closed and the block is not locked anymore.\n\t// See https://github.com/WordPress/gutenberg/issues/51447\n\tuseEffect( () => {\n\t\tif ( isFirstRender.current ) {\n\t\t\tisFirstRender.current = false;\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! isModalOpen && shouldHideBlockLockUI ) {\n\t\t\tfocus.focusable\n\t\t\t\t.find( wrapperRef.current, {\n\t\t\t\t\tsequential: false,\n\t\t\t\t} )\n\t\t\t\t.find(\n\t\t\t\t\t( element ) =>\n\t\t\t\t\t\telement.tagName === 'BUTTON' &&\n\t\t\t\t\t\telement !== lockButtonRef.current\n\t\t\t\t)\n\t\t\t\t?.focus();\n\t\t}\n\t\t// wrapperRef is a reference object and should be stable\n\t}, [ isModalOpen, shouldHideBlockLockUI, wrapperRef ] );\n\n\tif ( shouldHideBlockLockUI ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarGroup className=\"block-editor-block-lock-toolbar\">\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tref={ lockButtonRef }\n\t\t\t\t\ticon={ lock }\n\t\t\t\t\tlabel={ __( 'Unlock' ) }\n\t\t\t\t\tonClick={ toggleModal }\n\t\t\t\t\taria-expanded={ isModalOpen }\n\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<BlockLockModal clientId={ clientId } onClose={ toggleModal } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,aAAa,EAAEC,YAAY,QAAQ,uBAAuB;AACnE,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SAASC,UAAU,EAAEC,MAAM,EAAEC,SAAS,QAAQ,oBAAoB;AAClE,SAASC,IAAI,QAAQ,kBAAkB;;AAEvC;AACA;AACA;AACA,OAAOC,cAAc,MAAM,SAAS;AACpC,OAAOC,YAAY,MAAM,kBAAkB;AAE3C,eAAe,SAASC,gBAAgBA,CAAE;EAAEC,QAAQ;EAAEC;AAAW,CAAC,EAAG;EACpE,MAAM;IAAEC,OAAO;IAAEC,OAAO;IAAEC,SAAS;IAAEC;EAAQ,CAAC,GAAGP,YAAY,CAAEE,QAAS,CAAC;EAEzE,MAAM,CAAEM,WAAW,EAAEC,WAAW,CAAE,GAAGd,UAAU,CAC5Ce,QAAQ,IAAM,CAAEA,QAAQ,EAC1B,KACD,CAAC;EAED,MAAMC,aAAa,GAAGf,MAAM,CAAE,IAAK,CAAC;EACpC,MAAMgB,aAAa,GAAGhB,MAAM,CAAE,IAAK,CAAC;EAEpC,MAAMiB,qBAAqB,GAC1B,CAAEN,OAAO,IAAMH,OAAO,IAAIC,OAAO,IAAIC,SAAW;;EAEjD;EACA;EACA;EACAT,SAAS,CAAE,MAAM;IAChB,IAAKe,aAAa,CAACE,OAAO,EAAG;MAC5BF,aAAa,CAACE,OAAO,GAAG,KAAK;MAC7B;IACD;IAEA,IAAK,CAAEN,WAAW,IAAIK,qBAAqB,EAAG;MAC7CnB,KAAK,CAACqB,SAAS,CACbC,IAAI,CAAEb,UAAU,CAACW,OAAO,EAAE;QAC1BG,UAAU,EAAE;MACb,CAAE,CAAC,CACFD,IAAI,CACFE,OAAO,IACRA,OAAO,CAACC,OAAO,KAAK,QAAQ,IAC5BD,OAAO,KAAKP,aAAa,CAACG,OAC5B,CAAC,EACCpB,KAAK,CAAC,CAAC;IACX;IACA;EACD,CAAC,EAAE,CAAEc,WAAW,EAAEK,qBAAqB,EAAEV,UAAU,CAAG,CAAC;EAEvD,IAAKU,qBAAqB,EAAG;IAC5B,OAAO,IAAI;EACZ;EAEA,OACCO,aAAA,CAAAC,QAAA,QACCD,aAAA,CAAC3B,YAAY;IAAC6B,SAAS,EAAC;EAAiC,GACxDF,aAAA,CAAC5B,aAAa;IACb+B,GAAG,EAAGZ,aAAe;IACrBa,IAAI,EAAG1B,IAAM;IACb2B,KAAK,EAAGlC,EAAE,CAAE,QAAS,CAAG;IACxBmC,OAAO,EAAGjB,WAAa;IACvB,iBAAgBD,WAAa;IAC7B,iBAAc;EAAQ,CACtB,CACY,CAAC,EACbA,WAAW,IACZY,aAAA,CAACrB,cAAc;IAACG,QAAQ,EAAGA,QAAU;IAACyB,OAAO,EAAGlB;EAAa,CAAE,CAE/D,CAAC;AAEL"}
1
+ {"version":3,"names":["__","ToolbarButton","ToolbarGroup","useReducer","useRef","useEffect","lock","unlock","BlockLockModal","useBlockLock","BlockLockToolbar","clientId","canLock","isLocked","isModalOpen","toggleModal","isActive","hasLockButtonShown","current","createElement","Fragment","className","icon","label","onClick","onClose"],"sources":["@wordpress/block-editor/src/components/block-lock/toolbar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { useReducer, useRef, useEffect } from '@wordpress/element';\nimport { lock, unlock } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockLockModal from './modal';\nimport useBlockLock from './use-block-lock';\n\nexport default function BlockLockToolbar( { clientId } ) {\n\tconst { canLock, isLocked } = useBlockLock( clientId );\n\n\tconst [ isModalOpen, toggleModal ] = useReducer(\n\t\t( isActive ) => ! isActive,\n\t\tfalse\n\t);\n\n\tconst hasLockButtonShown = useRef( false );\n\n\t// If the block lock button has been shown, we don't want to remove it\n\t// from the toolbar until the toolbar is rendered again without it.\n\t// Removing it beforehand can cause focus loss issues, such as when\n\t// unlocking the block from the modal. It needs to return focus from\n\t// whence it came, and to do that, we need to leave the button in the toolbar.\n\tuseEffect( () => {\n\t\tif ( isLocked ) {\n\t\t\thasLockButtonShown.current = true;\n\t\t}\n\t}, [ isLocked ] );\n\n\tif ( ! canLock || ( ! isLocked && ! hasLockButtonShown.current ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarGroup className=\"block-editor-block-lock-toolbar\">\n\t\t\t\t<ToolbarButton\n\t\t\t\t\ticon={ isLocked ? lock : unlock }\n\t\t\t\t\tlabel={ isLocked ? __( 'Unlock' ) : __( 'Lock' ) }\n\t\t\t\t\tonClick={ toggleModal }\n\t\t\t\t\taria-expanded={ isModalOpen }\n\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<BlockLockModal clientId={ clientId } onClose={ toggleModal } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AAC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G,QAAQ,EAAGA,QAAU;IAACc,OAAO,EAAGV;EAAa,CAAE,CAE/D,CAAC;AAEL"}
@@ -60,7 +60,8 @@ function BlockMover({
60
60
  'is-horizontal': orientation === 'horizontal'
61
61
  })
62
62
  }, !hideDragHandle && createElement(BlockDraggable, {
63
- clientIds: clientIds
63
+ clientIds: clientIds,
64
+ fadeWhenDisabled: true
64
65
  }, draggableProps => createElement(Button, {
65
66
  icon: dragHandle,
66
67
  className: "block-editor-block-mover__drag-handle",
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","dragHandle","ToolbarGroup","ToolbarItem","Button","useSelect","__","BlockDraggable","BlockMoverUpButton","BlockMoverDownButton","store","blockEditorStore","BlockMover","clientIds","hideDragHandle","canMove","rootClientId","isFirst","isLast","orientation","select","getBlockIndex","getBlockListSettings","canMoveBlocks","getBlockOrder","getBlockRootClientId","normalizedClientIds","Array","isArray","firstClientId","_rootClientId","firstIndex","lastIndex","length","blockOrder","dragHandleLabel","createElement","className","draggableProps","icon","label","tabIndex","itemProps"],"sources":["@wordpress/block-editor/src/components/block-mover/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\n\nimport { dragHandle } from '@wordpress/icons';\nimport { ToolbarGroup, ToolbarItem, Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockDraggable from '../block-draggable';\nimport { BlockMoverUpButton, BlockMoverDownButton } from './button';\nimport { store as blockEditorStore } from '../../store';\n\nfunction BlockMover( { clientIds, hideDragHandle } ) {\n\tconst { canMove, rootClientId, isFirst, isLast, orientation } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockListSettings,\n\t\t\t\tcanMoveBlocks,\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst normalizedClientIds = Array.isArray( clientIds )\n\t\t\t\t? clientIds\n\t\t\t\t: [ clientIds ];\n\t\t\tconst firstClientId = normalizedClientIds[ 0 ];\n\t\t\tconst _rootClientId = getBlockRootClientId( firstClientId );\n\t\t\tconst firstIndex = getBlockIndex( firstClientId );\n\t\t\tconst lastIndex = getBlockIndex(\n\t\t\t\tnormalizedClientIds[ normalizedClientIds.length - 1 ]\n\t\t\t);\n\t\t\tconst blockOrder = getBlockOrder( _rootClientId );\n\n\t\t\treturn {\n\t\t\t\tcanMove: canMoveBlocks( clientIds, _rootClientId ),\n\t\t\t\trootClientId: _rootClientId,\n\t\t\t\tisFirst: firstIndex === 0,\n\t\t\t\tisLast: lastIndex === blockOrder.length - 1,\n\t\t\t\torientation: getBlockListSettings( _rootClientId )?.orientation,\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\tif ( ! canMove || ( isFirst && isLast && ! rootClientId ) ) {\n\t\treturn null;\n\t}\n\n\tconst dragHandleLabel = __( 'Drag' );\n\n\treturn (\n\t\t<ToolbarGroup\n\t\t\tclassName={ classnames( 'block-editor-block-mover', {\n\t\t\t\t'is-horizontal': orientation === 'horizontal',\n\t\t\t} ) }\n\t\t>\n\t\t\t{ ! hideDragHandle && (\n\t\t\t\t<BlockDraggable clientIds={ clientIds }>\n\t\t\t\t\t{ ( draggableProps ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ dragHandle }\n\t\t\t\t\t\t\tclassName=\"block-editor-block-mover__drag-handle\"\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\tlabel={ dragHandleLabel }\n\t\t\t\t\t\t\t// Should not be able to tab to drag handle as this\n\t\t\t\t\t\t\t// button can only be used with a pointer device.\n\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t{ ...draggableProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockDraggable>\n\t\t\t) }\n\t\t\t<div className=\"block-editor-block-mover__move-button-container\">\n\t\t\t\t<ToolbarItem>\n\t\t\t\t\t{ ( itemProps ) => (\n\t\t\t\t\t\t<BlockMoverUpButton\n\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t{ ...itemProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarItem>\n\t\t\t\t<ToolbarItem>\n\t\t\t\t\t{ ( itemProps ) => (\n\t\t\t\t\t\t<BlockMoverDownButton\n\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t{ ...itemProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarItem>\n\t\t\t</div>\n\t\t</ToolbarGroup>\n\t);\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-mover/README.md\n */\nexport default BlockMover;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;;AAEA,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,YAAY,EAAEC,WAAW,EAAEC,MAAM,QAAQ,uBAAuB;AACzE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,cAAc,MAAM,oBAAoB;AAC/C,SAASC,kBAAkB,EAAEC,oBAAoB,QAAQ,UAAU;AACnE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAEvD,SAASC,UAAUA,CAAE;EAAEC,SAAS;EAAEC;AAAe,CAAC,EAAG;EACpD,MAAM;IAAEC,OAAO;IAAEC,YAAY;IAAEC,OAAO;IAAEC,MAAM;IAAEC;EAAY,CAAC,GAAGd,SAAS,CACtEe,MAAM,IAAM;IACb,MAAM;MACLC,aAAa;MACbC,oBAAoB;MACpBC,aAAa;MACbC,aAAa;MACbC;IACD,CAAC,GAAGL,MAAM,CAA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,KAAK,EAAGL;IACR;IACA;IAAA;IACAM,QAAQ,EAAC,IAAI;IAAA,GACRH;EAAc,CACnB,CAEa,CAChB,EACDF,aAAA;IAAKC,SAAS,EAAC;EAAiD,GAC/DD,aAAA,CAACjC,WAAW,QACPuC,SAAS,IACZN,aAAA,CAAC5B,kBAAkB;IAClBK,SAAS,EAAGA,SAAW;IAAA,GAClB6B;EAAS,CACd,CAEU,CAAC,EACdN,aAAA,CAACjC,WAAW,QACPuC,SAAS,IACZN,aAAA,CAAC3B,oBAAoB;IACpBI,SAAS,EAAGA,SAAW;IAAA,GAClB6B;EAAS,CACd,CAEU,CACT,CACQ,CAAC;AAEjB;;AAEA;AACA;AACA;AACA,eAAe9B,UAAU"}
1
+ {"version":3,"names":["classnames","dragHandle","ToolbarGroup","ToolbarItem","Button","useSelect","__","BlockDraggable","BlockMoverUpButton","BlockMoverDownButton","store","blockEditorStore","BlockMover","clientIds","hideDragHandle","canMove","rootClientId","isFirst","isLast","orientation","select","getBlockIndex","getBlockListSettings","canMoveBlocks","getBlockOrder","getBlockRootClientId","normalizedClientIds","Array","isArray","firstClientId","_rootClientId","firstIndex","lastIndex","length","blockOrder","dragHandleLabel","createElement","className","fadeWhenDisabled","draggableProps","icon","label","tabIndex","itemProps"],"sources":["@wordpress/block-editor/src/components/block-mover/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\n\nimport { dragHandle } from '@wordpress/icons';\nimport { ToolbarGroup, ToolbarItem, Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockDraggable from '../block-draggable';\nimport { BlockMoverUpButton, BlockMoverDownButton } from './button';\nimport { store as blockEditorStore } from '../../store';\n\nfunction BlockMover( { clientIds, hideDragHandle } ) {\n\tconst { canMove, rootClientId, isFirst, isLast, orientation } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockListSettings,\n\t\t\t\tcanMoveBlocks,\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst normalizedClientIds = Array.isArray( clientIds )\n\t\t\t\t? clientIds\n\t\t\t\t: [ clientIds ];\n\t\t\tconst firstClientId = normalizedClientIds[ 0 ];\n\t\t\tconst _rootClientId = getBlockRootClientId( firstClientId );\n\t\t\tconst firstIndex = getBlockIndex( firstClientId );\n\t\t\tconst lastIndex = getBlockIndex(\n\t\t\t\tnormalizedClientIds[ normalizedClientIds.length - 1 ]\n\t\t\t);\n\t\t\tconst blockOrder = getBlockOrder( _rootClientId );\n\n\t\t\treturn {\n\t\t\t\tcanMove: canMoveBlocks( clientIds, _rootClientId ),\n\t\t\t\trootClientId: _rootClientId,\n\t\t\t\tisFirst: firstIndex === 0,\n\t\t\t\tisLast: lastIndex === blockOrder.length - 1,\n\t\t\t\torientation: getBlockListSettings( _rootClientId )?.orientation,\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\tif ( ! canMove || ( isFirst && isLast && ! rootClientId ) ) {\n\t\treturn null;\n\t}\n\n\tconst dragHandleLabel = __( 'Drag' );\n\n\treturn (\n\t\t<ToolbarGroup\n\t\t\tclassName={ classnames( 'block-editor-block-mover', {\n\t\t\t\t'is-horizontal': orientation === 'horizontal',\n\t\t\t} ) }\n\t\t>\n\t\t\t{ ! hideDragHandle && (\n\t\t\t\t<BlockDraggable clientIds={ clientIds } fadeWhenDisabled>\n\t\t\t\t\t{ ( draggableProps ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ dragHandle }\n\t\t\t\t\t\t\tclassName=\"block-editor-block-mover__drag-handle\"\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\tlabel={ dragHandleLabel }\n\t\t\t\t\t\t\t// Should not be able to tab to drag handle as this\n\t\t\t\t\t\t\t// button can only be used with a pointer device.\n\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t{ ...draggableProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockDraggable>\n\t\t\t) }\n\t\t\t<div className=\"block-editor-block-mover__move-button-container\">\n\t\t\t\t<ToolbarItem>\n\t\t\t\t\t{ ( itemProps ) => (\n\t\t\t\t\t\t<BlockMoverUpButton\n\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t{ ...itemProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarItem>\n\t\t\t\t<ToolbarItem>\n\t\t\t\t\t{ ( itemProps ) => (\n\t\t\t\t\t\t<BlockMoverDownButton\n\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t{ ...itemProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarItem>\n\t\t\t</div>\n\t\t</ToolbarGroup>\n\t);\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-mover/README.md\n */\nexport default BlockMover;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;;AAEA,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,YAAY,EAAEC,WAAW,EAAEC,MAAM,QAAQ,uBAAuB;AACzE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,cAAc,MAAM,oBAAoB;AAC/C,SAASC,kBAAkB,EAAEC,oBAAoB,QAAQ,UAAU;AACnE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAEvD,SAASC,UAAUA,CAAE;EAAEC,SAAS;EAAEC;AAAe,CAAC,EAAG;EACpD,MAAM;IAAEC,OAAO;IAAEC,YAAY;IAAEC,OAAO;IAAEC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B,cAAc;IAACM,SAAS,EAAGA,SAAW;IAACyB,gBAAgB;EAAA,GACnDC,cAAc,IACjBH,aAAA,CAAChC,MAAM;IACNoC,IAAI,EAAGvC,UAAY;IACnBoC,SAAS,EAAC,uCAAuC;IACjD,eAAY,MAAM;IAClBI,KAAK,EAAGN;IACR;IACA;IAAA;IACAO,QAAQ,EAAC,IAAI;IAAA,GACRH;EAAc,CACnB,CAEa,CAChB,EACDH,aAAA;IAAKC,SAAS,EAAC;EAAiD,GAC/DD,aAAA,CAACjC,WAAW,QACPwC,SAAS,IACZP,aAAA,CAAC5B,kBAAkB;IAClBK,SAAS,EAAGA,SAAW;IAAA,GAClB8B;EAAS,CACd,CAEU,CAAC,EACdP,aAAA,CAACjC,WAAW,QACPwC,SAAS,IACZP,aAAA,CAAC3B,oBAAoB;IACpBI,SAAS,EAAGA,SAAW;IAAA,GAClB8B;EAAS,CACd,CAEU,CACT,CACQ,CAAC;AAEjB;;AAEA;AACA;AACA;AACA,eAAe/B,UAAU"}
@@ -20,7 +20,7 @@ import { unlock } from '../../lock-unlock';
20
20
  import BlockPreview from '../block-preview';
21
21
  import InserterDraggableBlocks from '../inserter-draggable-blocks';
22
22
  import BlockPatternsPaging from '../block-patterns-paging';
23
- import { PATTERN_TYPES } from '../inserter/block-patterns-tab/utils';
23
+ import { INSERTER_PATTERN_TYPES } from '../inserter/block-patterns-tab/utils';
24
24
  const {
25
25
  CompositeV2: Composite,
26
26
  CompositeItemV2: CompositeItem,
@@ -78,7 +78,7 @@ function BlockPattern({
78
78
  }
79
79
  }
80
80
  }, createElement(WithToolTip, {
81
- showTooltip: showTooltip && !pattern.type !== PATTERN_TYPES.user,
81
+ showTooltip: showTooltip && !pattern.type !== INSERTER_PATTERN_TYPES.user,
82
82
  title: pattern.title
83
83
  }, createElement(CompositeItem, {
84
84
  render: createElement("div", {
@@ -86,7 +86,7 @@ function BlockPattern({
86
86
  "aria-label": pattern.title,
87
87
  "aria-describedby": pattern.description ? descriptionId : undefined,
88
88
  className: classnames('block-editor-block-patterns-list__item', {
89
- 'block-editor-block-patterns-list__list-item-synced': pattern.type === PATTERN_TYPES.user && !pattern.syncStatus
89
+ 'block-editor-block-patterns-list__list-item-synced': pattern.type === INSERTER_PATTERN_TYPES.user && !pattern.syncStatus
90
90
  })
91
91
  }),
92
92
  id: id,
@@ -106,12 +106,12 @@ function BlockPattern({
106
106
  viewportWidth: viewportWidth
107
107
  }), createElement(HStack, {
108
108
  className: "block-editor-patterns__pattern-details"
109
- }, pattern.type === PATTERN_TYPES.user && !pattern.syncStatus && createElement("div", {
109
+ }, pattern.type === INSERTER_PATTERN_TYPES.user && !pattern.syncStatus && createElement("div", {
110
110
  className: "block-editor-patterns__pattern-icon-wrapper"
111
111
  }, createElement(Icon, {
112
112
  className: "block-editor-patterns__pattern-icon",
113
113
  icon: symbol
114
- })), (!showTooltip || pattern.type === PATTERN_TYPES.user) && createElement("div", {
114
+ })), (!showTooltip || pattern.type === INSERTER_PATTERN_TYPES.user) && createElement("div", {
115
115
  className: "block-editor-block-patterns-list__item-title"
116
116
  }, pattern.title)), !!pattern.description && createElement(VisuallyHidden, {
117
117
  id: descriptionId