@wordpress/block-editor 12.24.0 → 12.25.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 (510) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +1 -1
  3. package/build/components/alignment-control/ui.js +3 -1
  4. package/build/components/alignment-control/ui.js.map +1 -1
  5. package/build/components/block-inspector/index.js +1 -1
  6. package/build/components/block-inspector/index.js.map +1 -1
  7. package/build/components/block-list/block.js +0 -9
  8. package/build/components/block-list/block.js.map +1 -1
  9. package/build/components/block-list/index.js +4 -3
  10. package/build/components/block-list/index.js.map +1 -1
  11. package/build/components/block-list/index.native.js +1 -9
  12. package/build/components/block-list/index.native.js.map +1 -1
  13. package/build/components/block-list/use-block-props/index.js +6 -6
  14. package/build/components/block-list/use-block-props/index.js.map +1 -1
  15. package/build/components/block-list/use-block-props/use-block-refs.js +17 -46
  16. package/build/components/block-list/use-block-props/use-block-refs.js.map +1 -1
  17. package/build/components/block-list/use-block-props/use-is-hovered.js +10 -14
  18. package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  19. package/build/components/block-mover/index.native.js +3 -1
  20. package/build/components/block-mover/index.native.js.map +1 -1
  21. package/build/components/block-settings-menu/block-settings-dropdown.js +0 -25
  22. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  23. package/build/components/block-switcher/pattern-transformations-menu.js +3 -1
  24. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  25. package/build/components/block-switcher/use-transformed-patterns.js +6 -2
  26. package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
  27. package/build/components/block-switcher/utils.js +15 -5
  28. package/build/components/block-switcher/utils.js.map +1 -1
  29. package/build/components/block-toolbar/use-has-block-toolbar.js +14 -9
  30. package/build/components/block-toolbar/use-has-block-toolbar.js.map +1 -1
  31. package/build/components/block-tools/index.js +3 -1
  32. package/build/components/block-tools/index.js.map +1 -1
  33. package/build/components/block-tools/use-show-block-tools.js +2 -5
  34. package/build/components/block-tools/use-show-block-tools.js.map +1 -1
  35. package/build/components/block-tools/zoom-out-mode-inserters.js +5 -1
  36. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  37. package/build/components/block-variation-picker/index.js +3 -2
  38. package/build/components/block-variation-picker/index.js.map +1 -1
  39. package/build/components/block-variation-transforms/index.js +3 -1
  40. package/build/components/block-variation-transforms/index.js.map +1 -1
  41. package/build/components/floating-toolbar/index.native.js +9 -5
  42. package/build/components/floating-toolbar/index.native.js.map +1 -1
  43. package/build/components/global-styles/background-panel.js +1 -1
  44. package/build/components/global-styles/background-panel.js.map +1 -1
  45. package/build/components/global-styles/color-panel.js +3 -1
  46. package/build/components/global-styles/color-panel.js.map +1 -1
  47. package/build/components/global-styles/dimensions-panel.js +16 -0
  48. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  49. package/build/components/global-styles/hooks.js +3 -2
  50. package/build/components/global-styles/hooks.js.map +1 -1
  51. package/build/components/global-styles/typography-panel.js +23 -23
  52. package/build/components/global-styles/typography-panel.js.map +1 -1
  53. package/build/components/global-styles/use-global-styles-output.js +149 -132
  54. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  55. package/build/components/global-styles/utils.js +45 -0
  56. package/build/components/global-styles/utils.js.map +1 -1
  57. package/build/components/inner-blocks/index.js +16 -2
  58. package/build/components/inner-blocks/index.js.map +1 -1
  59. package/build/components/inserter/block-patterns-tab/index.js +12 -31
  60. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  61. package/build/components/inserter/block-types-tab.js +4 -0
  62. package/build/components/inserter/block-types-tab.js.map +1 -1
  63. package/build/components/inserter/category-tabs/index.js +56 -0
  64. package/build/components/inserter/category-tabs/index.js.map +1 -0
  65. package/build/components/inserter/media-tab/index.js +2 -2
  66. package/build/components/inserter/media-tab/index.js.map +1 -1
  67. package/build/components/inserter/media-tab/media-panel.js +0 -25
  68. package/build/components/inserter/media-tab/media-panel.js.map +1 -1
  69. package/build/components/inserter/media-tab/media-preview.js +13 -3
  70. package/build/components/inserter/media-tab/media-preview.js.map +1 -1
  71. package/build/components/inserter/media-tab/media-tab.js +15 -29
  72. package/build/components/inserter/media-tab/media-tab.js.map +1 -1
  73. package/build/components/inserter/menu.js +59 -69
  74. package/build/components/inserter/menu.js.map +1 -1
  75. package/build/components/inserter/tabs.js +6 -6
  76. package/build/components/inserter/tabs.js.map +1 -1
  77. package/build/components/line-height-control/index.js +6 -2
  78. package/build/components/line-height-control/index.js.map +1 -1
  79. package/build/components/link-control/search-item.js +9 -3
  80. package/build/components/link-control/search-item.js.map +1 -1
  81. package/build/components/list-view/block-select-button.js +5 -170
  82. package/build/components/list-view/block-select-button.js.map +1 -1
  83. package/build/components/list-view/block.js +166 -14
  84. package/build/components/list-view/block.js.map +1 -1
  85. package/build/components/list-view/index.js +1 -1
  86. package/build/components/list-view/index.js.map +1 -1
  87. package/build/components/list-view/use-list-view-drop-zone.js +1 -1
  88. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  89. package/build/components/list-view/utils.js +3 -1
  90. package/build/components/list-view/utils.js.map +1 -1
  91. package/build/components/media-placeholder/index.js +3 -3
  92. package/build/components/media-placeholder/index.js.map +1 -1
  93. package/build/components/navigable-toolbar/index.js +3 -1
  94. package/build/components/navigable-toolbar/index.js.map +1 -1
  95. package/build/components/provider/block-refs-provider.js +3 -4
  96. package/build/components/provider/block-refs-provider.js.map +1 -1
  97. package/build/components/provider/use-block-sync.js +3 -12
  98. package/build/components/provider/use-block-sync.js.map +1 -1
  99. package/build/components/rich-text/event-listeners/before-input-rules.js +93 -0
  100. package/build/components/rich-text/event-listeners/before-input-rules.js.map +1 -0
  101. package/build/components/rich-text/event-listeners/delete.js +58 -0
  102. package/build/components/rich-text/event-listeners/delete.js.map +1 -0
  103. package/build/components/rich-text/event-listeners/enter.js +98 -0
  104. package/build/components/rich-text/event-listeners/enter.js.map +1 -0
  105. package/build/components/rich-text/event-listeners/firefox-compat.js +36 -0
  106. package/build/components/rich-text/event-listeners/firefox-compat.js.map +1 -0
  107. package/build/components/rich-text/event-listeners/index.js +44 -0
  108. package/build/components/rich-text/event-listeners/index.js.map +1 -0
  109. package/build/components/rich-text/event-listeners/input-events.js +22 -0
  110. package/build/components/rich-text/event-listeners/input-events.js.map +1 -0
  111. package/build/components/rich-text/event-listeners/input-rules.js +135 -0
  112. package/build/components/rich-text/event-listeners/input-rules.js.map +1 -0
  113. package/build/components/rich-text/event-listeners/insert-replacement-text.js +33 -0
  114. package/build/components/rich-text/event-listeners/insert-replacement-text.js.map +1 -0
  115. package/build/components/rich-text/event-listeners/paste-handler.js +146 -0
  116. package/build/components/rich-text/event-listeners/paste-handler.js.map +1 -0
  117. package/build/components/rich-text/event-listeners/remove-browser-shortcuts.js +27 -0
  118. package/build/components/rich-text/event-listeners/remove-browser-shortcuts.js.map +1 -0
  119. package/build/components/rich-text/event-listeners/shortcuts.js +22 -0
  120. package/build/components/rich-text/event-listeners/shortcuts.js.map +1 -0
  121. package/build/components/rich-text/event-listeners/undo-automatic-change.js +51 -0
  122. package/build/components/rich-text/event-listeners/undo-automatic-change.js.map +1 -0
  123. package/build/components/rich-text/index.js +11 -31
  124. package/build/components/rich-text/index.js.map +1 -1
  125. package/build/components/rich-text/index.native.js +13 -3
  126. package/build/components/rich-text/index.native.js.map +1 -1
  127. package/build/components/rich-text/multiline.js +6 -2
  128. package/build/components/rich-text/multiline.js.map +1 -1
  129. package/build/components/rich-text/native/index.native.js +12 -0
  130. package/build/components/rich-text/native/index.native.js.map +1 -1
  131. package/build/components/rich-text/use-format-types.js +8 -4
  132. package/build/components/rich-text/use-format-types.js.map +1 -1
  133. package/build/components/segmented-text-control/index.js +62 -0
  134. package/build/components/segmented-text-control/index.js.map +1 -0
  135. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +16 -2
  136. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  137. package/build/components/text-alignment-control/index.js +76 -0
  138. package/build/components/text-alignment-control/index.js.map +1 -0
  139. package/build/components/text-decoration-control/index.js +21 -25
  140. package/build/components/text-decoration-control/index.js.map +1 -1
  141. package/build/components/text-transform-control/index.js +18 -22
  142. package/build/components/text-transform-control/index.js.map +1 -1
  143. package/build/components/use-block-display-information/index.js +9 -3
  144. package/build/components/use-block-display-information/index.js.map +1 -1
  145. package/build/components/use-on-block-drop/index.js +3 -1
  146. package/build/components/use-on-block-drop/index.js.map +1 -1
  147. package/build/components/writing-flow/use-drag-selection.js +3 -1
  148. package/build/components/writing-flow/use-drag-selection.js.map +1 -1
  149. package/build/components/writing-flow/use-tab-nav.js +3 -1
  150. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  151. package/build/components/writing-mode-control/index.js +16 -20
  152. package/build/components/writing-mode-control/index.js.map +1 -1
  153. package/build/hooks/duotone.js +3 -1
  154. package/build/hooks/duotone.js.map +1 -1
  155. package/build/hooks/utils.js +11 -6
  156. package/build/hooks/utils.js.map +1 -1
  157. package/build/private-apis.js +4 -2
  158. package/build/private-apis.js.map +1 -1
  159. package/build/store/actions.js +32 -8
  160. package/build/store/actions.js.map +1 -1
  161. package/build/store/private-selectors.js +27 -6
  162. package/build/store/private-selectors.js.map +1 -1
  163. package/build/store/reducer.js +11 -8
  164. package/build/store/reducer.js.map +1 -1
  165. package/build/store/selectors.js +21 -7
  166. package/build/store/selectors.js.map +1 -1
  167. package/build/utils/object.js +17 -0
  168. package/build/utils/object.js.map +1 -1
  169. package/build/utils/order-inserter-block-items.js +6 -2
  170. package/build/utils/order-inserter-block-items.js.map +1 -1
  171. package/build/utils/pasting.js +6 -2
  172. package/build/utils/pasting.js.map +1 -1
  173. package/build-module/components/alignment-control/ui.js +3 -1
  174. package/build-module/components/alignment-control/ui.js.map +1 -1
  175. package/build-module/components/block-inspector/index.js +1 -1
  176. package/build-module/components/block-inspector/index.js.map +1 -1
  177. package/build-module/components/block-list/block.js +0 -9
  178. package/build-module/components/block-list/block.js.map +1 -1
  179. package/build-module/components/block-list/index.js +4 -3
  180. package/build-module/components/block-list/index.js.map +1 -1
  181. package/build-module/components/block-list/index.native.js +1 -9
  182. package/build-module/components/block-list/index.native.js.map +1 -1
  183. package/build-module/components/block-list/use-block-props/index.js +6 -6
  184. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  185. package/build-module/components/block-list/use-block-props/use-block-refs.js +19 -48
  186. package/build-module/components/block-list/use-block-props/use-block-refs.js.map +1 -1
  187. package/build-module/components/block-list/use-block-props/use-is-hovered.js +10 -14
  188. package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  189. package/build-module/components/block-mover/index.native.js +3 -1
  190. package/build-module/components/block-mover/index.native.js.map +1 -1
  191. package/build-module/components/block-settings-menu/block-settings-dropdown.js +1 -26
  192. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  193. package/build-module/components/block-switcher/pattern-transformations-menu.js +3 -1
  194. package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  195. package/build-module/components/block-switcher/use-transformed-patterns.js +6 -2
  196. package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
  197. package/build-module/components/block-switcher/utils.js +15 -5
  198. package/build-module/components/block-switcher/utils.js.map +1 -1
  199. package/build-module/components/block-toolbar/use-has-block-toolbar.js +14 -9
  200. package/build-module/components/block-toolbar/use-has-block-toolbar.js.map +1 -1
  201. package/build-module/components/block-tools/index.js +3 -1
  202. package/build-module/components/block-tools/index.js.map +1 -1
  203. package/build-module/components/block-tools/use-show-block-tools.js +2 -5
  204. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
  205. package/build-module/components/block-tools/zoom-out-mode-inserters.js +5 -1
  206. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  207. package/build-module/components/block-variation-picker/index.js +3 -2
  208. package/build-module/components/block-variation-picker/index.js.map +1 -1
  209. package/build-module/components/block-variation-transforms/index.js +3 -1
  210. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  211. package/build-module/components/floating-toolbar/index.native.js +9 -5
  212. package/build-module/components/floating-toolbar/index.native.js.map +1 -1
  213. package/build-module/components/global-styles/background-panel.js +1 -1
  214. package/build-module/components/global-styles/background-panel.js.map +1 -1
  215. package/build-module/components/global-styles/color-panel.js +3 -1
  216. package/build-module/components/global-styles/color-panel.js.map +1 -1
  217. package/build-module/components/global-styles/dimensions-panel.js +17 -1
  218. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  219. package/build-module/components/global-styles/hooks.js +3 -2
  220. package/build-module/components/global-styles/hooks.js.map +1 -1
  221. package/build-module/components/global-styles/typography-panel.js +24 -24
  222. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  223. package/build-module/components/global-styles/use-global-styles-output.js +149 -132
  224. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  225. package/build-module/components/global-styles/utils.js +44 -0
  226. package/build-module/components/global-styles/utils.js.map +1 -1
  227. package/build-module/components/inner-blocks/index.js +16 -2
  228. package/build-module/components/inner-blocks/index.js.map +1 -1
  229. package/build-module/components/inserter/block-patterns-tab/index.js +13 -32
  230. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
  231. package/build-module/components/inserter/block-types-tab.js +4 -0
  232. package/build-module/components/inserter/block-types-tab.js.map +1 -1
  233. package/build-module/components/inserter/category-tabs/index.js +49 -0
  234. package/build-module/components/inserter/category-tabs/index.js.map +1 -0
  235. package/build-module/components/inserter/media-tab/index.js +1 -1
  236. package/build-module/components/inserter/media-tab/index.js.map +1 -1
  237. package/build-module/components/inserter/media-tab/media-panel.js +0 -24
  238. package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
  239. package/build-module/components/inserter/media-tab/media-preview.js +13 -3
  240. package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
  241. package/build-module/components/inserter/media-tab/media-tab.js +17 -31
  242. package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
  243. package/build-module/components/inserter/menu.js +61 -71
  244. package/build-module/components/inserter/menu.js.map +1 -1
  245. package/build-module/components/inserter/tabs.js +6 -6
  246. package/build-module/components/inserter/tabs.js.map +1 -1
  247. package/build-module/components/line-height-control/index.js +6 -2
  248. package/build-module/components/line-height-control/index.js.map +1 -1
  249. package/build-module/components/link-control/search-item.js +9 -3
  250. package/build-module/components/link-control/search-item.js.map +1 -1
  251. package/build-module/components/list-view/block-select-button.js +7 -172
  252. package/build-module/components/list-view/block-select-button.js.map +1 -1
  253. package/build-module/components/list-view/block.js +167 -15
  254. package/build-module/components/list-view/block.js.map +1 -1
  255. package/build-module/components/list-view/index.js +1 -1
  256. package/build-module/components/list-view/index.js.map +1 -1
  257. package/build-module/components/list-view/use-list-view-drop-zone.js +1 -1
  258. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  259. package/build-module/components/list-view/utils.js +3 -1
  260. package/build-module/components/list-view/utils.js.map +1 -1
  261. package/build-module/components/media-placeholder/index.js +3 -3
  262. package/build-module/components/media-placeholder/index.js.map +1 -1
  263. package/build-module/components/navigable-toolbar/index.js +3 -1
  264. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  265. package/build-module/components/provider/block-refs-provider.js +3 -4
  266. package/build-module/components/provider/block-refs-provider.js.map +1 -1
  267. package/build-module/components/provider/use-block-sync.js +4 -13
  268. package/build-module/components/provider/use-block-sync.js.map +1 -1
  269. package/build-module/components/rich-text/event-listeners/before-input-rules.js +86 -0
  270. package/build-module/components/rich-text/event-listeners/before-input-rules.js.map +1 -0
  271. package/build-module/components/rich-text/event-listeners/delete.js +51 -0
  272. package/build-module/components/rich-text/event-listeners/delete.js.map +1 -0
  273. package/build-module/components/rich-text/event-listeners/enter.js +92 -0
  274. package/build-module/components/rich-text/event-listeners/enter.js.map +1 -0
  275. package/build-module/components/rich-text/event-listeners/firefox-compat.js +29 -0
  276. package/build-module/components/rich-text/event-listeners/firefox-compat.js.map +1 -0
  277. package/build-module/components/rich-text/event-listeners/index.js +36 -0
  278. package/build-module/components/rich-text/event-listeners/index.js.map +1 -0
  279. package/build-module/components/rich-text/event-listeners/input-events.js +15 -0
  280. package/build-module/components/rich-text/event-listeners/input-events.js.map +1 -0
  281. package/build-module/components/rich-text/event-listeners/input-rules.js +127 -0
  282. package/build-module/components/rich-text/event-listeners/input-rules.js.map +1 -0
  283. package/build-module/components/rich-text/event-listeners/insert-replacement-text.js +27 -0
  284. package/build-module/components/rich-text/event-listeners/insert-replacement-text.js.map +1 -0
  285. package/build-module/components/rich-text/event-listeners/paste-handler.js +142 -0
  286. package/build-module/components/rich-text/event-listeners/paste-handler.js.map +1 -0
  287. package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.js +21 -0
  288. package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.js.map +1 -0
  289. package/build-module/components/rich-text/event-listeners/shortcuts.js +15 -0
  290. package/build-module/components/rich-text/event-listeners/shortcuts.js.map +1 -0
  291. package/build-module/components/rich-text/event-listeners/undo-automatic-change.js +45 -0
  292. package/build-module/components/rich-text/event-listeners/undo-automatic-change.js.map +1 -0
  293. package/build-module/components/rich-text/index.js +12 -32
  294. package/build-module/components/rich-text/index.js.map +1 -1
  295. package/build-module/components/rich-text/index.native.js +13 -3
  296. package/build-module/components/rich-text/index.native.js.map +1 -1
  297. package/build-module/components/rich-text/multiline.js +6 -2
  298. package/build-module/components/rich-text/multiline.js.map +1 -1
  299. package/build-module/components/rich-text/native/index.native.js +12 -0
  300. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  301. package/build-module/components/rich-text/use-format-types.js +8 -4
  302. package/build-module/components/rich-text/use-format-types.js.map +1 -1
  303. package/build-module/components/segmented-text-control/index.js +55 -0
  304. package/build-module/components/segmented-text-control/index.js.map +1 -0
  305. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +16 -2
  306. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  307. package/build-module/components/text-alignment-control/index.js +68 -0
  308. package/build-module/components/text-alignment-control/index.js.map +1 -0
  309. package/build-module/components/text-decoration-control/index.js +21 -25
  310. package/build-module/components/text-decoration-control/index.js.map +1 -1
  311. package/build-module/components/text-transform-control/index.js +18 -22
  312. package/build-module/components/text-transform-control/index.js.map +1 -1
  313. package/build-module/components/use-block-display-information/index.js +9 -3
  314. package/build-module/components/use-block-display-information/index.js.map +1 -1
  315. package/build-module/components/use-on-block-drop/index.js +3 -1
  316. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  317. package/build-module/components/writing-flow/use-drag-selection.js +3 -1
  318. package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
  319. package/build-module/components/writing-flow/use-tab-nav.js +3 -1
  320. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  321. package/build-module/components/writing-mode-control/index.js +16 -20
  322. package/build-module/components/writing-mode-control/index.js.map +1 -1
  323. package/build-module/hooks/duotone.js +3 -1
  324. package/build-module/hooks/duotone.js.map +1 -1
  325. package/build-module/hooks/utils.js +11 -6
  326. package/build-module/hooks/utils.js.map +1 -1
  327. package/build-module/private-apis.js +4 -2
  328. package/build-module/private-apis.js.map +1 -1
  329. package/build-module/store/actions.js +32 -8
  330. package/build-module/store/actions.js.map +1 -1
  331. package/build-module/store/private-selectors.js +27 -5
  332. package/build-module/store/private-selectors.js.map +1 -1
  333. package/build-module/store/reducer.js +11 -8
  334. package/build-module/store/reducer.js.map +1 -1
  335. package/build-module/store/selectors.js +21 -7
  336. package/build-module/store/selectors.js.map +1 -1
  337. package/build-module/utils/object.js +16 -0
  338. package/build-module/utils/object.js.map +1 -1
  339. package/build-module/utils/order-inserter-block-items.js +6 -2
  340. package/build-module/utils/order-inserter-block-items.js.map +1 -1
  341. package/build-module/utils/pasting.js +6 -2
  342. package/build-module/utils/pasting.js.map +1 -1
  343. package/build-style/content-rtl.css +41 -68
  344. package/build-style/content.css +41 -68
  345. package/build-style/style-rtl.css +100 -199
  346. package/build-style/style.css +100 -199
  347. package/package.json +31 -31
  348. package/src/components/alignment-control/ui.js +3 -1
  349. package/src/components/block-bindings-toolbar-indicator/style.scss +1 -4
  350. package/src/components/block-canvas/style.scss +1 -3
  351. package/src/components/block-draggable/test/helpers.native.js +8 -8
  352. package/src/components/block-inspector/index.js +1 -2
  353. package/src/components/block-list/block.js +2 -13
  354. package/src/components/block-list/content.scss +9 -1
  355. package/src/components/block-list/index.js +4 -4
  356. package/src/components/block-list/index.native.js +1 -6
  357. package/src/components/block-list/use-block-props/index.js +12 -4
  358. package/src/components/block-list/use-block-props/use-block-refs.js +17 -57
  359. package/src/components/block-list/use-block-props/use-is-hovered.js +11 -16
  360. package/src/components/block-mover/index.native.js +3 -1
  361. package/src/components/block-patterns-list/style.scss +1 -3
  362. package/src/components/block-preview/style.scss +13 -15
  363. package/src/components/block-settings-menu/block-settings-dropdown.js +1 -51
  364. package/src/components/block-switcher/pattern-transformations-menu.js +3 -1
  365. package/src/components/block-switcher/use-transformed-patterns.js +6 -2
  366. package/src/components/block-switcher/utils.js +14 -5
  367. package/src/components/block-toolbar/style.scss +8 -11
  368. package/src/components/block-toolbar/use-has-block-toolbar.js +21 -16
  369. package/src/components/block-tools/index.js +3 -1
  370. package/src/components/block-tools/use-show-block-tools.js +36 -48
  371. package/src/components/block-tools/zoom-out-mode-inserters.js +5 -1
  372. package/src/components/block-variation-picker/content.scss +22 -72
  373. package/src/components/block-variation-picker/index.js +3 -2
  374. package/src/components/block-variation-transforms/index.js +3 -1
  375. package/src/components/floating-toolbar/index.native.js +5 -2
  376. package/src/components/global-styles/background-panel.js +1 -3
  377. package/src/components/global-styles/color-panel.js +3 -1
  378. package/src/components/global-styles/dimensions-panel.js +18 -1
  379. package/src/components/global-styles/hooks.js +2 -0
  380. package/src/components/global-styles/test/utils.js +21 -0
  381. package/src/components/global-styles/typography-panel.js +27 -23
  382. package/src/components/global-styles/use-global-styles-output.js +211 -187
  383. package/src/components/global-styles/utils.js +55 -0
  384. package/src/components/inner-blocks/index.js +14 -1
  385. package/src/components/inserter/block-patterns-tab/index.js +15 -65
  386. package/src/components/inserter/block-types-tab.js +5 -0
  387. package/src/components/inserter/category-tabs/index.js +74 -0
  388. package/src/components/inserter/media-tab/index.js +1 -1
  389. package/src/components/inserter/media-tab/media-panel.js +0 -22
  390. package/src/components/inserter/media-tab/media-preview.js +15 -7
  391. package/src/components/inserter/media-tab/media-tab.js +44 -83
  392. package/src/components/inserter/menu.js +139 -117
  393. package/src/components/inserter/style.scss +90 -170
  394. package/src/components/inserter/tabs.js +5 -13
  395. package/src/components/line-height-control/index.js +6 -2
  396. package/src/components/link-control/search-item.js +9 -3
  397. package/src/components/list-view/block-select-button.js +73 -266
  398. package/src/components/list-view/block.js +218 -28
  399. package/src/components/list-view/index.js +1 -1
  400. package/src/components/list-view/style.scss +20 -28
  401. package/src/components/list-view/use-list-view-drop-zone.js +1 -1
  402. package/src/components/list-view/utils.js +3 -1
  403. package/src/components/media-placeholder/content.scss +0 -11
  404. package/src/components/media-placeholder/index.js +3 -3
  405. package/src/components/navigable-toolbar/index.js +3 -1
  406. package/src/components/provider/block-refs-provider.js +3 -8
  407. package/src/components/provider/test/use-block-sync.js +7 -0
  408. package/src/components/provider/use-block-sync.js +3 -20
  409. package/src/components/rich-text/event-listeners/before-input-rules.js +92 -0
  410. package/src/components/rich-text/event-listeners/delete.js +53 -0
  411. package/src/components/rich-text/event-listeners/enter.js +104 -0
  412. package/src/components/rich-text/event-listeners/firefox-compat.js +31 -0
  413. package/src/components/rich-text/event-listeners/index.js +56 -0
  414. package/src/components/rich-text/event-listeners/input-events.js +13 -0
  415. package/src/components/rich-text/event-listeners/input-rules.js +146 -0
  416. package/src/components/rich-text/event-listeners/insert-replacement-text.js +28 -0
  417. package/src/components/rich-text/event-listeners/paste-handler.js +169 -0
  418. package/src/components/rich-text/event-listeners/remove-browser-shortcuts.js +24 -0
  419. package/src/components/rich-text/event-listeners/shortcuts.js +13 -0
  420. package/src/components/rich-text/event-listeners/undo-automatic-change.js +45 -0
  421. package/src/components/rich-text/index.js +7 -34
  422. package/src/components/rich-text/index.native.js +11 -0
  423. package/src/components/rich-text/multiline.js +6 -2
  424. package/src/components/rich-text/native/index.native.js +11 -0
  425. package/src/components/rich-text/use-format-types.js +6 -2
  426. package/src/components/segmented-text-control/index.js +63 -0
  427. package/src/components/{writing-mode-control → segmented-text-control}/style.scss +2 -5
  428. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +16 -1
  429. package/src/components/text-alignment-control/index.js +91 -0
  430. package/src/components/text-alignment-control/stories/index.story.js +39 -0
  431. package/src/components/text-decoration-control/index.js +20 -33
  432. package/src/components/text-transform-control/index.js +17 -30
  433. package/src/components/use-block-display-information/index.js +9 -3
  434. package/src/components/use-on-block-drop/index.js +3 -1
  435. package/src/components/writing-flow/use-drag-selection.js +3 -1
  436. package/src/components/writing-flow/use-tab-nav.js +3 -1
  437. package/src/components/writing-mode-control/index.js +15 -28
  438. package/src/hooks/duotone.js +3 -1
  439. package/src/hooks/utils.js +16 -2
  440. package/src/private-apis.js +4 -2
  441. package/src/store/actions.js +36 -12
  442. package/src/store/private-selectors.js +28 -4
  443. package/src/store/reducer.js +13 -23
  444. package/src/store/selectors.js +20 -7
  445. package/src/style.scss +1 -2
  446. package/src/utils/object.js +16 -0
  447. package/src/utils/order-inserter-block-items.js +6 -2
  448. package/src/utils/pasting.js +6 -2
  449. package/build/components/block-list/use-block-props/use-block-moving-mode-class-names.js +0 -54
  450. package/build/components/block-list/use-block-props/use-block-moving-mode-class-names.js.map +0 -1
  451. package/build/components/rich-text/use-before-input-rules.js +0 -98
  452. package/build/components/rich-text/use-before-input-rules.js.map +0 -1
  453. package/build/components/rich-text/use-delete.js +0 -64
  454. package/build/components/rich-text/use-delete.js.map +0 -1
  455. package/build/components/rich-text/use-enter.js +0 -109
  456. package/build/components/rich-text/use-enter.js.map +0 -1
  457. package/build/components/rich-text/use-firefox-compat.js +0 -44
  458. package/build/components/rich-text/use-firefox-compat.js.map +0 -1
  459. package/build/components/rich-text/use-input-events.js +0 -25
  460. package/build/components/rich-text/use-input-events.js.map +0 -1
  461. package/build/components/rich-text/use-input-rules.js +0 -139
  462. package/build/components/rich-text/use-input-rules.js.map +0 -1
  463. package/build/components/rich-text/use-insert-replacement-text.js +0 -38
  464. package/build/components/rich-text/use-insert-replacement-text.js.map +0 -1
  465. package/build/components/rich-text/use-paste-handler.js +0 -158
  466. package/build/components/rich-text/use-paste-handler.js.map +0 -1
  467. package/build/components/rich-text/use-remove-browser-shortcuts.js +0 -32
  468. package/build/components/rich-text/use-remove-browser-shortcuts.js.map +0 -1
  469. package/build/components/rich-text/use-shortcuts.js +0 -25
  470. package/build/components/rich-text/use-shortcuts.js.map +0 -1
  471. package/build/components/rich-text/use-undo-automatic-change.js +0 -53
  472. package/build/components/rich-text/use-undo-automatic-change.js.map +0 -1
  473. package/build-module/components/block-list/use-block-props/use-block-moving-mode-class-names.js +0 -47
  474. package/build-module/components/block-list/use-block-props/use-block-moving-mode-class-names.js.map +0 -1
  475. package/build-module/components/rich-text/use-before-input-rules.js +0 -92
  476. package/build-module/components/rich-text/use-before-input-rules.js.map +0 -1
  477. package/build-module/components/rich-text/use-delete.js +0 -57
  478. package/build-module/components/rich-text/use-delete.js.map +0 -1
  479. package/build-module/components/rich-text/use-enter.js +0 -102
  480. package/build-module/components/rich-text/use-enter.js.map +0 -1
  481. package/build-module/components/rich-text/use-firefox-compat.js +0 -37
  482. package/build-module/components/rich-text/use-firefox-compat.js.map +0 -1
  483. package/build-module/components/rich-text/use-input-events.js +0 -18
  484. package/build-module/components/rich-text/use-input-events.js.map +0 -1
  485. package/build-module/components/rich-text/use-input-rules.js +0 -132
  486. package/build-module/components/rich-text/use-input-rules.js.map +0 -1
  487. package/build-module/components/rich-text/use-insert-replacement-text.js +0 -32
  488. package/build-module/components/rich-text/use-insert-replacement-text.js.map +0 -1
  489. package/build-module/components/rich-text/use-paste-handler.js +0 -152
  490. package/build-module/components/rich-text/use-paste-handler.js.map +0 -1
  491. package/build-module/components/rich-text/use-remove-browser-shortcuts.js +0 -26
  492. package/build-module/components/rich-text/use-remove-browser-shortcuts.js.map +0 -1
  493. package/build-module/components/rich-text/use-shortcuts.js +0 -18
  494. package/build-module/components/rich-text/use-shortcuts.js.map +0 -1
  495. package/build-module/components/rich-text/use-undo-automatic-change.js +0 -46
  496. package/build-module/components/rich-text/use-undo-automatic-change.js.map +0 -1
  497. package/src/components/block-list/use-block-props/use-block-moving-mode-class-names.js +0 -55
  498. package/src/components/rich-text/use-before-input-rules.js +0 -99
  499. package/src/components/rich-text/use-delete.js +0 -59
  500. package/src/components/rich-text/use-enter.js +0 -110
  501. package/src/components/rich-text/use-firefox-compat.js +0 -39
  502. package/src/components/rich-text/use-input-events.js +0 -19
  503. package/src/components/rich-text/use-input-rules.js +0 -150
  504. package/src/components/rich-text/use-insert-replacement-text.js +0 -31
  505. package/src/components/rich-text/use-paste-handler.js +0 -180
  506. package/src/components/rich-text/use-remove-browser-shortcuts.js +0 -29
  507. package/src/components/rich-text/use-shortcuts.js +0 -19
  508. package/src/components/rich-text/use-undo-automatic-change.js +0 -46
  509. package/src/components/text-decoration-control/style.scss +0 -18
  510. package/src/components/text-transform-control/style.scss +0 -18
@@ -1 +1 @@
1
- {"version":3,"names":["_deprecated","_interopRequireDefault","require","_i18n","_components","_utils","LineHeightControl","value","lineHeight","onChange","__nextHasNoMarginBottom","__unstableInputWidth","otherProps","isDefined","isLineHeightDefined","adjustNextValue","nextValue","wasTypedOrPasted","spin","STEP","SPIN_FACTOR","BASE_DEFAULT_VALUE","stateReducer","state","action","includes","payload","event","nativeEvent","inputType","RESET_VALUE","deprecated","since","version","hint","deprecatedStyles","undefined","marginBottom","handleOnChange","type","_react","createElement","className","style","__experimentalNumberControl","__unstableStateReducer","label","__","placeholder","step","spinFactor","min","spinControls","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/line-height-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalNumberControl as NumberControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBASE_DEFAULT_VALUE,\n\tRESET_VALUE,\n\tSTEP,\n\tSPIN_FACTOR,\n\tisLineHeightDefined,\n} from './utils';\n\nconst LineHeightControl = ( {\n\tvalue: lineHeight,\n\tonChange,\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMarginBottom = false,\n\t__unstableInputWidth = '60px',\n\t...otherProps\n} ) => {\n\tconst isDefined = isLineHeightDefined( lineHeight );\n\n\tconst adjustNextValue = ( nextValue, wasTypedOrPasted ) => {\n\t\t// Set the next value without modification if lineHeight has been defined.\n\t\tif ( isDefined ) return nextValue;\n\n\t\t/**\n\t\t * The following logic handles the initial spin up/down action\n\t\t * (from an undefined value state) so that the next values are better suited for\n\t\t * line-height rendering. For example, the first spin up should immediately\n\t\t * go to 1.6, rather than the normally expected 0.1.\n\t\t *\n\t\t * Spin up/down actions can be triggered by keydowns of the up/down arrow keys,\n\t\t * dragging the input or by clicking the spin buttons.\n\t\t */\n\t\tconst spin = STEP * SPIN_FACTOR;\n\t\tswitch ( `${ nextValue }` ) {\n\t\t\tcase `${ spin }`:\n\t\t\t\t// Increment by spin value.\n\t\t\t\treturn BASE_DEFAULT_VALUE + spin;\n\t\t\tcase '0': {\n\t\t\t\t// This means the user explicitly input '0', rather than using the\n\t\t\t\t// spin down action from an undefined value state.\n\t\t\t\tif ( wasTypedOrPasted ) return nextValue;\n\t\t\t\t// Decrement by spin value.\n\t\t\t\treturn BASE_DEFAULT_VALUE - spin;\n\t\t\t}\n\t\t\tcase '':\n\t\t\t\treturn BASE_DEFAULT_VALUE;\n\t\t\tdefault:\n\t\t\t\treturn nextValue;\n\t\t}\n\t};\n\n\tconst stateReducer = ( state, action ) => {\n\t\t// Be careful when changing this — cross-browser behavior of the\n\t\t// `inputType` field in `input` events are inconsistent.\n\t\t// For example, Firefox emits an input event with inputType=\"insertReplacementText\"\n\t\t// on spin button clicks, while other browsers do not even emit an input event.\n\t\tconst wasTypedOrPasted = [ 'insertText', 'insertFromPaste' ].includes(\n\t\t\taction.payload.event.nativeEvent?.inputType\n\t\t);\n\t\tconst value = adjustNextValue( state.value, wasTypedOrPasted );\n\t\treturn { ...state, value };\n\t};\n\n\tconst value = isDefined ? lineHeight : RESET_VALUE;\n\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\tdeprecated(\n\t\t\t'Bottom margin styles for wp.blockEditor.LineHeightControl',\n\t\t\t{\n\t\t\t\tsince: '6.0',\n\t\t\t\tversion: '6.4',\n\t\t\t\thint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version',\n\t\t\t}\n\t\t);\n\t}\n\tconst deprecatedStyles = __nextHasNoMarginBottom\n\t\t? undefined\n\t\t: { marginBottom: 24 };\n\n\tconst handleOnChange = ( nextValue, { event } ) => {\n\t\tif ( nextValue === '' ) {\n\t\t\tonChange();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( event.type === 'click' ) {\n\t\t\tonChange( adjustNextValue( `${ nextValue }`, false ) );\n\t\t\treturn;\n\t\t}\n\n\t\tonChange( `${ nextValue }` );\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"block-editor-line-height-control\"\n\t\t\tstyle={ deprecatedStyles }\n\t\t>\n\t\t\t<NumberControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\t__unstableInputWidth={ __unstableInputWidth }\n\t\t\t\t__unstableStateReducer={ stateReducer }\n\t\t\t\tonChange={ handleOnChange }\n\t\t\t\tlabel={ __( 'Line height' ) }\n\t\t\t\tplaceholder={ BASE_DEFAULT_VALUE }\n\t\t\t\tstep={ STEP }\n\t\t\t\tspinFactor={ SPIN_FACTOR }\n\t\t\t\tvalue={ value }\n\t\t\t\tmin={ 0 }\n\t\t\t\tspinControls=\"custom\"\n\t\t\t/>\n\t\t</div>\n\t);\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/line-height-control/README.md\n */\nexport default LineHeightControl;\n"],"mappings":";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ACA;AACA;AAFA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAGejD,iBAAiB","ignoreList":[]}
1
+ {"version":3,"names":["_deprecated","_interopRequireDefault","require","_i18n","_components","_utils","LineHeightControl","value","lineHeight","onChange","__nextHasNoMarginBottom","__unstableInputWidth","otherProps","isDefined","isLineHeightDefined","adjustNextValue","nextValue","wasTypedOrPasted","spin","STEP","SPIN_FACTOR","BASE_DEFAULT_VALUE","stateReducer","state","action","includes","payload","event","nativeEvent","inputType","RESET_VALUE","deprecated","since","version","hint","deprecatedStyles","undefined","marginBottom","handleOnChange","type","_react","createElement","className","style","__experimentalNumberControl","__unstableStateReducer","label","__","placeholder","step","spinFactor","min","spinControls","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/line-height-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalNumberControl as NumberControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBASE_DEFAULT_VALUE,\n\tRESET_VALUE,\n\tSTEP,\n\tSPIN_FACTOR,\n\tisLineHeightDefined,\n} from './utils';\n\nconst LineHeightControl = ( {\n\tvalue: lineHeight,\n\tonChange,\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMarginBottom = false,\n\t__unstableInputWidth = '60px',\n\t...otherProps\n} ) => {\n\tconst isDefined = isLineHeightDefined( lineHeight );\n\n\tconst adjustNextValue = ( nextValue, wasTypedOrPasted ) => {\n\t\t// Set the next value without modification if lineHeight has been defined.\n\t\tif ( isDefined ) {\n\t\t\treturn nextValue;\n\t\t}\n\n\t\t/**\n\t\t * The following logic handles the initial spin up/down action\n\t\t * (from an undefined value state) so that the next values are better suited for\n\t\t * line-height rendering. For example, the first spin up should immediately\n\t\t * go to 1.6, rather than the normally expected 0.1.\n\t\t *\n\t\t * Spin up/down actions can be triggered by keydowns of the up/down arrow keys,\n\t\t * dragging the input or by clicking the spin buttons.\n\t\t */\n\t\tconst spin = STEP * SPIN_FACTOR;\n\t\tswitch ( `${ nextValue }` ) {\n\t\t\tcase `${ spin }`:\n\t\t\t\t// Increment by spin value.\n\t\t\t\treturn BASE_DEFAULT_VALUE + spin;\n\t\t\tcase '0': {\n\t\t\t\t// This means the user explicitly input '0', rather than using the\n\t\t\t\t// spin down action from an undefined value state.\n\t\t\t\tif ( wasTypedOrPasted ) {\n\t\t\t\t\treturn nextValue;\n\t\t\t\t}\n\t\t\t\t// Decrement by spin value.\n\t\t\t\treturn BASE_DEFAULT_VALUE - spin;\n\t\t\t}\n\t\t\tcase '':\n\t\t\t\treturn BASE_DEFAULT_VALUE;\n\t\t\tdefault:\n\t\t\t\treturn nextValue;\n\t\t}\n\t};\n\n\tconst stateReducer = ( state, action ) => {\n\t\t// Be careful when changing this — cross-browser behavior of the\n\t\t// `inputType` field in `input` events are inconsistent.\n\t\t// For example, Firefox emits an input event with inputType=\"insertReplacementText\"\n\t\t// on spin button clicks, while other browsers do not even emit an input event.\n\t\tconst wasTypedOrPasted = [ 'insertText', 'insertFromPaste' ].includes(\n\t\t\taction.payload.event.nativeEvent?.inputType\n\t\t);\n\t\tconst value = adjustNextValue( state.value, wasTypedOrPasted );\n\t\treturn { ...state, value };\n\t};\n\n\tconst value = isDefined ? lineHeight : RESET_VALUE;\n\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\tdeprecated(\n\t\t\t'Bottom margin styles for wp.blockEditor.LineHeightControl',\n\t\t\t{\n\t\t\t\tsince: '6.0',\n\t\t\t\tversion: '6.4',\n\t\t\t\thint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version',\n\t\t\t}\n\t\t);\n\t}\n\tconst deprecatedStyles = __nextHasNoMarginBottom\n\t\t? undefined\n\t\t: { marginBottom: 24 };\n\n\tconst handleOnChange = ( nextValue, { event } ) => {\n\t\tif ( nextValue === '' ) {\n\t\t\tonChange();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( event.type === 'click' ) {\n\t\t\tonChange( adjustNextValue( `${ nextValue }`, false ) );\n\t\t\treturn;\n\t\t}\n\n\t\tonChange( `${ nextValue }` );\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"block-editor-line-height-control\"\n\t\t\tstyle={ deprecatedStyles }\n\t\t>\n\t\t\t<NumberControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\t__unstableInputWidth={ __unstableInputWidth }\n\t\t\t\t__unstableStateReducer={ stateReducer }\n\t\t\t\tonChange={ handleOnChange }\n\t\t\t\tlabel={ __( 'Line height' ) }\n\t\t\t\tplaceholder={ BASE_DEFAULT_VALUE }\n\t\t\t\tstep={ STEP }\n\t\t\t\tspinFactor={ SPIN_FACTOR }\n\t\t\t\tvalue={ value }\n\t\t\t\tmin={ 0 }\n\t\t\t\tspinControls=\"custom\"\n\t\t\t/>\n\t\t</div>\n\t);\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/line-height-control/README.md\n */\nexport default LineHeightControl;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AASA,MAAMI,iBAAiB,GAAGA,CAAE;EAC3BC,KAAK,EAAEC,UAAU;EACjBC,QAAQ;EACR;EACAC,uBAAuB,GAAG,KAAK;EAC/BC,oBAAoB,GAAG,MAAM;EAC7B,GAAGC;AACJ,CAAC,KAAM;EACN,MAAMC,SAAS,GAAG,IAAAC,0BAAmB,EAAEN,UAAW,CAAC;EAEnD,MAAMO,eAAe,GAAGA,CAAEC,SAAS,EAAEC,gBAAgB,KAAM;IAC1D;IACA,IAAKJ,SAAS,EAAG;MAChB,OAAOG,SAAS;IACjB;;IAEA;AACF;AACA;AACA;AACA;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AAI,KAAK,OAAO,EAAG;MAC7B9B,QAAQ,CAAEM,eAAe,CAAG,GAAGC,SAAW,EAAC,EAAE,KAAM,CAAE,CAAC;MACtD;IACD;IAEAP,QAAQ,CAAG,GAAGO,SAAW,EAAE,CAAC;EAC7B,CAAC;EAED,OACC,IAAAwB,MAAA,CAAAC,aAAA;IACCC,SAAS,EAAC,kCAAkC;IAC5CC,KAAK,EAAGR;EAAkB,GAE1B,IAAAK,MAAA,CAAAC,aAAA,EAACrC,WAAA,CAAAwC,2BAAa;IAAA,GACRhC,UAAU;IACfD,oBAAoB,EAAGA,oBAAsB;IAC7CkC,sBAAsB,EAAGvB,YAAc;IACvCb,QAAQ,EAAG6B,cAAgB;IAC3BQ,KAAK,EAAG,IAAAC,QAAE,EAAE,aAAc,CAAG;IAC7BC,WAAW,EAAG3B,yBAAoB;IAClC4B,IAAI,EAAG9B,WAAM;IACb+B,UAAU,EAAG9B,kBAAa;IAC1Bb,KAAK,EAAGA,KAAO;IACf4C,GAAG,EAAG,CAAG;IACTC,YAAY,EAAC;EAAQ,CACrB,CACG,CAAC;AAER,CAAC;;AAED;AACA;AACA;AAFA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAGejD,iBAAiB","ignoreList":[]}
@@ -56,12 +56,16 @@ function SearchItemIcon({
56
56
  */
57
57
  function addLeadingSlash(url) {
58
58
  const trimmedURL = url?.trim();
59
- if (!trimmedURL?.length) return url;
59
+ if (!trimmedURL?.length) {
60
+ return url;
61
+ }
60
62
  return url?.replace(/^\/?/, '/');
61
63
  }
62
64
  function removeTrailingSlash(url) {
63
65
  const trimmedURL = url?.trim();
64
- if (!trimmedURL?.length) return url;
66
+ if (!trimmedURL?.length) {
67
+ return url;
68
+ }
65
69
  return url?.replace(/\/$/, '');
66
70
  }
67
71
  const partialRight = (fn, ...partialArgs) => (...args) => fn(...args, ...partialArgs);
@@ -79,7 +83,9 @@ const defaultTo = d => v => {
79
83
  * @return {string} the processed url to display.
80
84
  */
81
85
  function getURLForDisplay(url) {
82
- if (!url) return url;
86
+ if (!url) {
87
+ return url;
88
+ }
83
89
  return (0, _compose.pipe)(_url.safeDecodeURI, _url.getPath, defaultTo(''), partialRight(_url.filterURLForDisplay, 24), removeTrailingSlash, addLeadingSlash)(url);
84
90
  }
85
91
  const LinkControlSearchItem = ({
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_icons","_dom","_url","_compose","ICONS_MAP","post","postList","page","post_tag","tag","category","attachment","file","SearchItemIcon","isURL","suggestion","icon","globe","type","isFrontPage","home","isBlogHome","verse","_react","createElement","Icon","className","addLeadingSlash","url","trimmedURL","trim","length","replace","removeTrailingSlash","partialRight","fn","partialArgs","args","defaultTo","d","v","undefined","getURLForDisplay","pipe","safeDecodeURI","getPath","filterURLForDisplay","LinkControlSearchItem","itemProps","searchTerm","onClick","shouldShowType","info","__","MenuItem","iconPosition","shortcut","getVisualTypeName","TextHighlight","text","stripHTML","title","highlight","exports","_default","default"],"sources":["@wordpress/block-editor/src/components/link-control/search-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem, TextHighlight } from '@wordpress/components';\nimport {\n\tIcon,\n\tglobe,\n\tpage,\n\ttag,\n\tpostList,\n\tcategory,\n\tfile,\n\thome,\n\tverse,\n} from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { safeDecodeURI, filterURLForDisplay, getPath } from '@wordpress/url';\nimport { pipe } from '@wordpress/compose';\n\nconst ICONS_MAP = {\n\tpost: postList,\n\tpage,\n\tpost_tag: tag,\n\tcategory,\n\tattachment: file,\n};\n\nfunction SearchItemIcon( { isURL, suggestion } ) {\n\tlet icon = null;\n\n\tif ( isURL ) {\n\t\ticon = globe;\n\t} else if ( suggestion.type in ICONS_MAP ) {\n\t\ticon = ICONS_MAP[ suggestion.type ];\n\t\tif ( suggestion.type === 'page' ) {\n\t\t\tif ( suggestion.isFrontPage ) {\n\t\t\t\ticon = home;\n\t\t\t}\n\t\t\tif ( suggestion.isBlogHome ) {\n\t\t\t\ticon = verse;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( icon ) {\n\t\treturn (\n\t\t\t<Icon\n\t\t\t\tclassName=\"block-editor-link-control__search-item-icon\"\n\t\t\t\ticon={ icon }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn null;\n}\n\n/**\n * Adds a leading slash to a url if it doesn't already have one.\n * @param {string} url the url to add a leading slash to.\n * @return {string} the url with a leading slash.\n */\nfunction addLeadingSlash( url ) {\n\tconst trimmedURL = url?.trim();\n\n\tif ( ! trimmedURL?.length ) return url;\n\n\treturn url?.replace( /^\\/?/, '/' );\n}\n\nfunction removeTrailingSlash( url ) {\n\tconst trimmedURL = url?.trim();\n\n\tif ( ! trimmedURL?.length ) return url;\n\n\treturn url?.replace( /\\/$/, '' );\n}\n\nconst partialRight =\n\t( fn, ...partialArgs ) =>\n\t( ...args ) =>\n\t\tfn( ...args, ...partialArgs );\n\nconst defaultTo = ( d ) => ( v ) => {\n\treturn v === null || v === undefined || v !== v ? d : v;\n};\n\n/**\n * Prepares a URL for display in the UI.\n * - decodes the URL.\n * - filters it (removes protocol, www, etc.).\n * - truncates it if necessary.\n * - adds a leading slash.\n * @param {string} url the url.\n * @return {string} the processed url to display.\n */\nfunction getURLForDisplay( url ) {\n\tif ( ! url ) return url;\n\n\treturn pipe(\n\t\tsafeDecodeURI,\n\t\tgetPath,\n\t\tdefaultTo( '' ),\n\t\tpartialRight( filterURLForDisplay, 24 ),\n\t\tremoveTrailingSlash,\n\t\taddLeadingSlash\n\t)( url );\n}\n\nexport const LinkControlSearchItem = ( {\n\titemProps,\n\tsuggestion,\n\tsearchTerm,\n\tonClick,\n\tisURL = false,\n\tshouldShowType = false,\n} ) => {\n\tconst info = isURL\n\t\t? __( 'Press ENTER to add this link' )\n\t\t: getURLForDisplay( suggestion.url );\n\n\treturn (\n\t\t<MenuItem\n\t\t\t{ ...itemProps }\n\t\t\tinfo={ info }\n\t\t\ticonPosition=\"left\"\n\t\t\ticon={\n\t\t\t\t<SearchItemIcon suggestion={ suggestion } isURL={ isURL } />\n\t\t\t}\n\t\t\tonClick={ onClick }\n\t\t\tshortcut={ shouldShowType && getVisualTypeName( suggestion ) }\n\t\t\tclassName=\"block-editor-link-control__search-item\"\n\t\t>\n\t\t\t<TextHighlight\n\t\t\t\t// The component expects a plain text string.\n\t\t\t\ttext={ stripHTML( suggestion.title ) }\n\t\t\t\thighlight={ searchTerm }\n\t\t\t/>\n\t\t</MenuItem>\n\t);\n};\n\nfunction getVisualTypeName( suggestion ) {\n\tif ( suggestion.isFrontPage ) {\n\t\treturn 'front page';\n\t}\n\n\tif ( suggestion.isBlogHome ) {\n\t\treturn 'blog home';\n\t}\n\n\t// Rename 'post_tag' to 'tag'. Ideally, the API would return the localised CPT or taxonomy label.\n\treturn suggestion.type === 'post_tag' ? 'tag' : suggestion.type;\n}\n\nexport default LinkControlSearchItem;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAWA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAlBA;AACA;AACA;;AAkBA,MAAMM,SAAS,GAAG;EACjBC,IAAI,EAAEC,eAAQ;EACdC,IAAI,EAAJA,WAAI;EACJC,QAAQ,EAAEC,UAAG;EACbC,QAAQ,EAARA,eAAQ;EACRC,UAAU,EAAEC;AACb,CAAC;AAED,SAASC,cAAcA,CAAE;EAAEC,KAAK;EAAEC;AAAW,CAAC,EAAG;EAChD,IAAIC,IAAI,GAAG,IAAI;EAEf,IAAKF,KAAK,EAAG;IACZE,IAAI,GAAGC,YAAK;EACb,CAAC,MAAM,IAAKF,UAAU,CAACG,IAAI,IAAId,SAAS,EAAG;IAC1CY,IAAI,GAAGZ,SAAS,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W,EAAG;IAC7B,OAAO,YAAY;EACpB;EAEA,IAAKJ,UAAU,CAACM,UAAU,EAAG;IAC5B,OAAO,WAAW;EACnB;;EAEA;EACA,OAAON,UAAU,CAACG,IAAI,KAAK,UAAU,GAAG,KAAK,GAAGH,UAAU,CAACG,IAAI;AAChE;AAAC,IAAA8C,QAAA,GAAAD,OAAA,CAAAE,OAAA,GAEclB,qBAAqB","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_components","_icons","_dom","_url","_compose","ICONS_MAP","post","postList","page","post_tag","tag","category","attachment","file","SearchItemIcon","isURL","suggestion","icon","globe","type","isFrontPage","home","isBlogHome","verse","_react","createElement","Icon","className","addLeadingSlash","url","trimmedURL","trim","length","replace","removeTrailingSlash","partialRight","fn","partialArgs","args","defaultTo","d","v","undefined","getURLForDisplay","pipe","safeDecodeURI","getPath","filterURLForDisplay","LinkControlSearchItem","itemProps","searchTerm","onClick","shouldShowType","info","__","MenuItem","iconPosition","shortcut","getVisualTypeName","TextHighlight","text","stripHTML","title","highlight","exports","_default","default"],"sources":["@wordpress/block-editor/src/components/link-control/search-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem, TextHighlight } from '@wordpress/components';\nimport {\n\tIcon,\n\tglobe,\n\tpage,\n\ttag,\n\tpostList,\n\tcategory,\n\tfile,\n\thome,\n\tverse,\n} from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { safeDecodeURI, filterURLForDisplay, getPath } from '@wordpress/url';\nimport { pipe } from '@wordpress/compose';\n\nconst ICONS_MAP = {\n\tpost: postList,\n\tpage,\n\tpost_tag: tag,\n\tcategory,\n\tattachment: file,\n};\n\nfunction SearchItemIcon( { isURL, suggestion } ) {\n\tlet icon = null;\n\n\tif ( isURL ) {\n\t\ticon = globe;\n\t} else if ( suggestion.type in ICONS_MAP ) {\n\t\ticon = ICONS_MAP[ suggestion.type ];\n\t\tif ( suggestion.type === 'page' ) {\n\t\t\tif ( suggestion.isFrontPage ) {\n\t\t\t\ticon = home;\n\t\t\t}\n\t\t\tif ( suggestion.isBlogHome ) {\n\t\t\t\ticon = verse;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( icon ) {\n\t\treturn (\n\t\t\t<Icon\n\t\t\t\tclassName=\"block-editor-link-control__search-item-icon\"\n\t\t\t\ticon={ icon }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn null;\n}\n\n/**\n * Adds a leading slash to a url if it doesn't already have one.\n * @param {string} url the url to add a leading slash to.\n * @return {string} the url with a leading slash.\n */\nfunction addLeadingSlash( url ) {\n\tconst trimmedURL = url?.trim();\n\n\tif ( ! trimmedURL?.length ) {\n\t\treturn url;\n\t}\n\n\treturn url?.replace( /^\\/?/, '/' );\n}\n\nfunction removeTrailingSlash( url ) {\n\tconst trimmedURL = url?.trim();\n\n\tif ( ! trimmedURL?.length ) {\n\t\treturn url;\n\t}\n\n\treturn url?.replace( /\\/$/, '' );\n}\n\nconst partialRight =\n\t( fn, ...partialArgs ) =>\n\t( ...args ) =>\n\t\tfn( ...args, ...partialArgs );\n\nconst defaultTo = ( d ) => ( v ) => {\n\treturn v === null || v === undefined || v !== v ? d : v;\n};\n\n/**\n * Prepares a URL for display in the UI.\n * - decodes the URL.\n * - filters it (removes protocol, www, etc.).\n * - truncates it if necessary.\n * - adds a leading slash.\n * @param {string} url the url.\n * @return {string} the processed url to display.\n */\nfunction getURLForDisplay( url ) {\n\tif ( ! url ) {\n\t\treturn url;\n\t}\n\n\treturn pipe(\n\t\tsafeDecodeURI,\n\t\tgetPath,\n\t\tdefaultTo( '' ),\n\t\tpartialRight( filterURLForDisplay, 24 ),\n\t\tremoveTrailingSlash,\n\t\taddLeadingSlash\n\t)( url );\n}\n\nexport const LinkControlSearchItem = ( {\n\titemProps,\n\tsuggestion,\n\tsearchTerm,\n\tonClick,\n\tisURL = false,\n\tshouldShowType = false,\n} ) => {\n\tconst info = isURL\n\t\t? __( 'Press ENTER to add this link' )\n\t\t: getURLForDisplay( suggestion.url );\n\n\treturn (\n\t\t<MenuItem\n\t\t\t{ ...itemProps }\n\t\t\tinfo={ info }\n\t\t\ticonPosition=\"left\"\n\t\t\ticon={\n\t\t\t\t<SearchItemIcon suggestion={ suggestion } isURL={ isURL } />\n\t\t\t}\n\t\t\tonClick={ onClick }\n\t\t\tshortcut={ shouldShowType && getVisualTypeName( suggestion ) }\n\t\t\tclassName=\"block-editor-link-control__search-item\"\n\t\t>\n\t\t\t<TextHighlight\n\t\t\t\t// The component expects a plain text string.\n\t\t\t\ttext={ stripHTML( suggestion.title ) }\n\t\t\t\thighlight={ searchTerm }\n\t\t\t/>\n\t\t</MenuItem>\n\t);\n};\n\nfunction getVisualTypeName( suggestion ) {\n\tif ( suggestion.isFrontPage ) {\n\t\treturn 'front page';\n\t}\n\n\tif ( suggestion.isBlogHome ) {\n\t\treturn 'blog home';\n\t}\n\n\t// Rename 'post_tag' to 'tag'. Ideally, the API would return the localised CPT or taxonomy label.\n\treturn suggestion.type === 'post_tag' ? 'tag' : suggestion.type;\n}\n\nexport default LinkControlSearchItem;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAWA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAlBA;AACA;AACA;;AAkBA,MAAMM,SAAS,GAAG;EACjBC,IAAI,EAAEC,eAAQ;EACdC,IAAI,EAAJA,WAAI;EACJC,QAAQ,EAAEC,UAAG;EACbC,QAAQ,EAARA,eAAQ;EACRC,UAAU,EAAEC;AACb,CAAC;AAED,SAASC,cAAcA,CAAE;EAAEC,KAAK;EAAEC;AAAW,CAAC,EAAG;EAChD,IAAIC,IAAI,GAAG,IAAI;EAEf,IAAKF,KAAK,EAAG;IACZE,IAAI,GAAGC,YA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AEb,CAAC;AAACc,OAAA,CAAAhB,qBAAA,GAAAA,qBAAA;AAEF,SAASU,iBAAiBA,CAAE1C,UAAU,EAAG;EACxC,IAAKA,UAAU,CAACI,WAAW,EAAG;IAC7B,OAAO,YAAY;EACpB;EAEA,IAAKJ,UAAU,CAACM,UAAU,EAAG;IAC5B,OAAO,WAAW;EACnB;;EAEA;EACA,OAAON,UAAU,CAACG,IAAI,KAAK,UAAU,GAAG,KAAK,GAAGH,UAAU,CAACG,IAAI;AAChE;AAAC,IAAA8C,QAAA,GAAAD,OAAA,CAAAE,OAAA,GAEclB,qBAAqB","ignoreList":[]}
@@ -7,23 +7,17 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _react = require("react");
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
- var _blocks = require("@wordpress/blocks");
11
10
  var _components = require("@wordpress/components");
12
11
  var _element = require("@wordpress/element");
13
12
  var _icons = require("@wordpress/icons");
14
13
  var _keycodes = require("@wordpress/keycodes");
15
- var _data = require("@wordpress/data");
16
- var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
17
14
  var _i18n = require("@wordpress/i18n");
18
- var _isShallowEqual = _interopRequireDefault(require("@wordpress/is-shallow-equal"));
19
15
  var _blockIcon = _interopRequireDefault(require("../block-icon"));
20
16
  var _useBlockDisplayInformation = _interopRequireDefault(require("../use-block-display-information"));
21
17
  var _useBlockDisplayTitle = _interopRequireDefault(require("../block-title/use-block-display-title"));
22
18
  var _expander = _interopRequireDefault(require("./expander"));
23
19
  var _blockLock = require("../block-lock");
24
- var _store = require("../../store");
25
20
  var _useListViewImages = _interopRequireDefault(require("./use-list-view-images"));
26
- var _context = require("./context");
27
21
  /**
28
22
  * External dependencies
29
23
  */
@@ -51,8 +45,7 @@ function ListViewBlockSelectButton({
51
45
  onDragEnd,
52
46
  draggable,
53
47
  isExpanded,
54
- ariaDescribedBy,
55
- updateFocusAndSelection
48
+ ariaDescribedBy
56
49
  }, ref) {
57
50
  const blockInformation = (0, _useBlockDisplayInformation.default)(clientId);
58
51
  const blockTitle = (0, _useBlockDisplayTitle.default)({
@@ -62,34 +55,11 @@ function ListViewBlockSelectButton({
62
55
  const {
63
56
  isLocked
64
57
  } = (0, _blockLock.useBlockLock)(clientId);
65
- const {
66
- canInsertBlockType,
67
- getSelectedBlockClientIds,
68
- getPreviousBlockClientId,
69
- getBlockRootClientId,
70
- getBlockOrder,
71
- getBlockParents,
72
- getBlocksByClientId,
73
- canRemoveBlocks
74
- } = (0, _data.useSelect)(_store.store);
75
- const {
76
- duplicateBlocks,
77
- multiSelect,
78
- removeBlocks,
79
- insertAfterBlock,
80
- insertBeforeBlock
81
- } = (0, _data.useDispatch)(_store.store);
82
- const isMatch = (0, _keyboardShortcuts.__unstableUseShortcutEventMatch)();
83
58
  const isSticky = blockInformation?.positionType === 'sticky';
84
59
  const images = (0, _useListViewImages.default)({
85
60
  clientId,
86
61
  isExpanded
87
62
  });
88
- const {
89
- collapseAll,
90
- expand,
91
- rootClientId
92
- } = (0, _context.useListViewContext)();
93
63
  const positionLabel = blockInformation?.positionLabel ? (0, _i18n.sprintf)(
94
64
  // translators: 1: Position of selected block, e.g. "Sticky" or "Fixed".
95
65
  (0, _i18n.__)('Position: %1$s'), blockInformation.positionLabel) : '';
@@ -103,154 +73,19 @@ function ListViewBlockSelectButton({
103
73
  onDragStart?.(event);
104
74
  };
105
75
 
106
- // Determine which blocks to update:
107
- // If the current (focused) block is part of the block selection, use the whole selection.
108
- // If the focused block is not part of the block selection, only update the focused block.
109
- function getBlocksToUpdate() {
110
- const selectedBlockClientIds = getSelectedBlockClientIds();
111
- const isUpdatingSelectedBlocks = selectedBlockClientIds.includes(clientId);
112
- const firstBlockClientId = isUpdatingSelectedBlocks ? selectedBlockClientIds[0] : clientId;
113
- const firstBlockRootClientId = getBlockRootClientId(firstBlockClientId);
114
- const blocksToUpdate = isUpdatingSelectedBlocks ? selectedBlockClientIds : [clientId];
115
- return {
116
- blocksToUpdate,
117
- firstBlockClientId,
118
- firstBlockRootClientId,
119
- selectedBlockClientIds
120
- };
121
- }
122
-
123
76
  /**
124
77
  * @param {KeyboardEvent} event
125
78
  */
126
- async function onKeyDownHandler(event) {
79
+ function onKeyDown(event) {
127
80
  if (event.keyCode === _keycodes.ENTER || event.keyCode === _keycodes.SPACE) {
128
81
  onClick(event);
129
- } else if (event.keyCode === _keycodes.BACKSPACE || event.keyCode === _keycodes.DELETE || isMatch('core/block-editor/remove', event)) {
130
- var _getPreviousBlockClie;
131
- const {
132
- blocksToUpdate: blocksToDelete,
133
- firstBlockClientId,
134
- firstBlockRootClientId,
135
- selectedBlockClientIds
136
- } = getBlocksToUpdate();
137
-
138
- // Don't update the selection if the blocks cannot be deleted.
139
- if (!canRemoveBlocks(blocksToDelete, firstBlockRootClientId)) {
140
- return;
141
- }
142
- let blockToFocus = (_getPreviousBlockClie = getPreviousBlockClientId(firstBlockClientId)) !== null && _getPreviousBlockClie !== void 0 ? _getPreviousBlockClie :
143
- // If the previous block is not found (when the first block is deleted),
144
- // fallback to focus the parent block.
145
- firstBlockRootClientId;
146
- removeBlocks(blocksToDelete, false);
147
-
148
- // Update the selection if the original selection has been removed.
149
- const shouldUpdateSelection = selectedBlockClientIds.length > 0 && getSelectedBlockClientIds().length === 0;
150
-
151
- // If there's no previous block nor parent block, focus the first block.
152
- if (!blockToFocus) {
153
- blockToFocus = getBlockOrder()[0];
154
- }
155
- updateFocusAndSelection(blockToFocus, shouldUpdateSelection);
156
- } else if (isMatch('core/block-editor/duplicate', event)) {
157
- if (event.defaultPrevented) {
158
- return;
159
- }
160
- event.preventDefault();
161
- const {
162
- blocksToUpdate,
163
- firstBlockRootClientId
164
- } = getBlocksToUpdate();
165
- const canDuplicate = getBlocksByClientId(blocksToUpdate).every(block => {
166
- return !!block && (0, _blocks.hasBlockSupport)(block.name, 'multiple', true) && canInsertBlockType(block.name, firstBlockRootClientId);
167
- });
168
- if (canDuplicate) {
169
- const updatedBlocks = await duplicateBlocks(blocksToUpdate, false);
170
- if (updatedBlocks?.length) {
171
- // If blocks have been duplicated, focus the first duplicated block.
172
- updateFocusAndSelection(updatedBlocks[0], false);
173
- }
174
- }
175
- } else if (isMatch('core/block-editor/insert-before', event)) {
176
- if (event.defaultPrevented) {
177
- return;
178
- }
179
- event.preventDefault();
180
- const {
181
- blocksToUpdate
182
- } = getBlocksToUpdate();
183
- await insertBeforeBlock(blocksToUpdate[0]);
184
- const newlySelectedBlocks = getSelectedBlockClientIds();
185
-
186
- // Focus the first block of the newly inserted blocks, to keep focus within the list view.
187
- updateFocusAndSelection(newlySelectedBlocks[0], false);
188
- } else if (isMatch('core/block-editor/insert-after', event)) {
189
- if (event.defaultPrevented) {
190
- return;
191
- }
192
- event.preventDefault();
193
- const {
194
- blocksToUpdate
195
- } = getBlocksToUpdate();
196
- await insertAfterBlock(blocksToUpdate.at(-1));
197
- const newlySelectedBlocks = getSelectedBlockClientIds();
198
-
199
- // Focus the first block of the newly inserted blocks, to keep focus within the list view.
200
- updateFocusAndSelection(newlySelectedBlocks[0], false);
201
- } else if (isMatch('core/block-editor/select-all', event)) {
202
- if (event.defaultPrevented) {
203
- return;
204
- }
205
- event.preventDefault();
206
- const {
207
- firstBlockRootClientId,
208
- selectedBlockClientIds
209
- } = getBlocksToUpdate();
210
- const blockClientIds = getBlockOrder(firstBlockRootClientId);
211
- if (!blockClientIds.length) {
212
- return;
213
- }
214
-
215
- // If we have selected all sibling nested blocks, try selecting up a level.
216
- // This is a similar implementation to that used by `useSelectAll`.
217
- // `isShallowEqual` is used for the list view instead of a length check,
218
- // as the array of siblings of the currently focused block may be a different
219
- // set of blocks from the current block selection if the user is focused
220
- // on a different part of the list view from the block selection.
221
- if ((0, _isShallowEqual.default)(selectedBlockClientIds, blockClientIds)) {
222
- // Only select up a level if the first block is not the root block.
223
- // This ensures that the block selection can't break out of the root block
224
- // used by the list view, if the list view is only showing a partial hierarchy.
225
- if (firstBlockRootClientId && firstBlockRootClientId !== rootClientId) {
226
- updateFocusAndSelection(firstBlockRootClientId, true);
227
- return;
228
- }
229
- }
230
-
231
- // Select all while passing `null` to skip focusing to the editor canvas,
232
- // and retain focus within the list view.
233
- multiSelect(blockClientIds[0], blockClientIds[blockClientIds.length - 1], null);
234
- } else if (isMatch('core/block-editor/collapse-list-view', event)) {
235
- if (event.defaultPrevented) {
236
- return;
237
- }
238
- event.preventDefault();
239
- const {
240
- firstBlockClientId
241
- } = getBlocksToUpdate();
242
- const blockParents = getBlockParents(firstBlockClientId, false);
243
- // Collapse all blocks.
244
- collapseAll();
245
- // Expand all parents of the current block.
246
- expand(blockParents);
247
82
  }
248
83
  }
249
- return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.Button, {
84
+ return (0, _react.createElement)(_components.Button, {
250
85
  className: (0, _classnames.default)('block-editor-list-view-block-select-button', className),
251
86
  onClick: onClick,
252
87
  onContextMenu: onContextMenu,
253
- onKeyDown: onKeyDownHandler,
88
+ onKeyDown: onKeyDown,
254
89
  onMouseDown: onMouseDown,
255
90
  ref: ref,
256
91
  tabIndex: tabIndex,
@@ -299,7 +134,7 @@ function ListViewBlockSelectButton({
299
134
  className: "block-editor-list-view-block-select-button__lock"
300
135
  }, (0, _react.createElement)(_icons.Icon, {
301
136
  icon: _icons.lockSmall
302
- })))));
137
+ }))));
303
138
  }
304
139
  var _default = exports.default = (0, _element.forwardRef)(ListViewBlockSelectButton);
305
140
  //# sourceMappingURL=block-select-button.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_blocks","_components","_element","_icons","_keycodes","_data","_keyboardShortcuts","_i18n","_isShallowEqual","_blockIcon","_useBlockDisplayInformation","_useBlockDisplayTitle","_expander","_blockLock","_store","_useListViewImages","_context","ListViewBlockSelectButton","className","block","clientId","onClick","onContextMenu","onMouseDown","onToggleExpanded","tabIndex","onFocus","onDragStart","onDragEnd","draggable","isExpanded","ariaDescribedBy","updateFocusAndSelection","ref","blockInformation","useBlockDisplayInformation","blockTitle","useBlockDisplayTitle","context","isLocked","useBlockLock","canInsertBlockType","getSelectedBlockClientIds","getPreviousBlockClientId","getBlockRootClientId","getBlockOrder","getBlockParents","getBlocksByClientId","canRemoveBlocks","useSelect","blockEditorStore","duplicateBlocks","multiSelect","removeBlocks","insertAfterBlock","insertBeforeBlock","useDispatch","isMatch","useShortcutEventMatch","isSticky","positionType","images","useListViewImages","collapseAll","expand","rootClientId","useListViewContext","positionLabel","sprintf","__","onDragStartHandler","event","dataTransfer","clearData","getBlocksToUpdate","selectedBlockClientIds","isUpdatingSelectedBlocks","includes","firstBlockClientId","firstBlockRootClientId","blocksToUpdate","onKeyDownHandler","keyCode","ENTER","SPACE","BACKSPACE","DELETE","_getPreviousBlockClie","blocksToDelete","blockToFocus","shouldUpdateSelection","length","defaultPrevented","preventDefault","canDuplicate","every","hasBlockSupport","name","updatedBlocks","newlySelectedBlocks","at","blockClientIds","isShallowEqual","blockParents","_react","createElement","Fragment","Button","classnames","onKeyDown","href","default","icon","showColors","__experimentalHStack","alignment","justify","spacing","__experimentalTruncate","ellipsizeMode","anchor","Tooltip","text","Icon","pinSmall","map","image","index","key","style","backgroundImage","url","zIndex","lock","_default","exports","forwardRef"],"sources":["@wordpress/block-editor/src/components/list-view/block-select-button.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport {\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n\tTooltip,\n} from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\nimport { Icon, lockSmall as lock, pinSmall } from '@wordpress/icons';\nimport { SPACE, ENTER, BACKSPACE, DELETE } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { __, sprintf } from '@wordpress/i18n';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport ListViewExpander from './expander';\nimport { useBlockLock } from '../block-lock';\nimport { store as blockEditorStore } from '../../store';\nimport useListViewImages from './use-list-view-images';\nimport { useListViewContext } from './context';\n\nfunction ListViewBlockSelectButton(\n\t{\n\t\tclassName,\n\t\tblock: { clientId },\n\t\tonClick,\n\t\tonContextMenu,\n\t\tonMouseDown,\n\t\tonToggleExpanded,\n\t\ttabIndex,\n\t\tonFocus,\n\t\tonDragStart,\n\t\tonDragEnd,\n\t\tdraggable,\n\t\tisExpanded,\n\t\tariaDescribedBy,\n\t\tupdateFocusAndSelection,\n\t},\n\tref\n) {\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId,\n\t\tcontext: 'list-view',\n\t} );\n\tconst { isLocked } = useBlockLock( clientId );\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetSelectedBlockClientIds,\n\t\tgetPreviousBlockClientId,\n\t\tgetBlockRootClientId,\n\t\tgetBlockOrder,\n\t\tgetBlockParents,\n\t\tgetBlocksByClientId,\n\t\tcanRemoveBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst {\n\t\tduplicateBlocks,\n\t\tmultiSelect,\n\t\tremoveBlocks,\n\t\tinsertAfterBlock,\n\t\tinsertBeforeBlock,\n\t} = useDispatch( blockEditorStore );\n\tconst isMatch = useShortcutEventMatch();\n\tconst isSticky = blockInformation?.positionType === 'sticky';\n\tconst images = useListViewImages( { clientId, isExpanded } );\n\tconst { collapseAll, expand, rootClientId } = useListViewContext();\n\n\tconst positionLabel = blockInformation?.positionLabel\n\t\t? sprintf(\n\t\t\t\t// translators: 1: Position of selected block, e.g. \"Sticky\" or \"Fixed\".\n\t\t\t\t__( 'Position: %1$s' ),\n\t\t\t\tblockInformation.positionLabel\n\t\t )\n\t\t: '';\n\n\t// The `href` attribute triggers the browser's native HTML drag operations.\n\t// When the link is dragged, the element's outerHTML is set in DataTransfer object as text/html.\n\t// We need to clear any HTML drag data to prevent `pasteHandler` from firing\n\t// inside the `useOnBlockDrop` hook.\n\tconst onDragStartHandler = ( event ) => {\n\t\tevent.dataTransfer.clearData();\n\t\tonDragStart?.( event );\n\t};\n\n\t// Determine which blocks to update:\n\t// If the current (focused) block is part of the block selection, use the whole selection.\n\t// If the focused block is not part of the block selection, only update the focused block.\n\tfunction getBlocksToUpdate() {\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst isUpdatingSelectedBlocks =\n\t\t\tselectedBlockClientIds.includes( clientId );\n\t\tconst firstBlockClientId = isUpdatingSelectedBlocks\n\t\t\t? selectedBlockClientIds[ 0 ]\n\t\t\t: clientId;\n\t\tconst firstBlockRootClientId =\n\t\t\tgetBlockRootClientId( firstBlockClientId );\n\n\t\tconst blocksToUpdate = isUpdatingSelectedBlocks\n\t\t\t? selectedBlockClientIds\n\t\t\t: [ clientId ];\n\n\t\treturn {\n\t\t\tblocksToUpdate,\n\t\t\tfirstBlockClientId,\n\t\t\tfirstBlockRootClientId,\n\t\t\tselectedBlockClientIds,\n\t\t};\n\t}\n\n\t/**\n\t * @param {KeyboardEvent} event\n\t */\n\tasync function onKeyDownHandler( event ) {\n\t\tif ( event.keyCode === ENTER || event.keyCode === SPACE ) {\n\t\t\tonClick( event );\n\t\t} else if (\n\t\t\tevent.keyCode === BACKSPACE ||\n\t\t\tevent.keyCode === DELETE ||\n\t\t\tisMatch( 'core/block-editor/remove', event )\n\t\t) {\n\t\t\tconst {\n\t\t\t\tblocksToUpdate: blocksToDelete,\n\t\t\t\tfirstBlockClientId,\n\t\t\t\tfirstBlockRootClientId,\n\t\t\t\tselectedBlockClientIds,\n\t\t\t} = getBlocksToUpdate();\n\n\t\t\t// Don't update the selection if the blocks cannot be deleted.\n\t\t\tif ( ! canRemoveBlocks( blocksToDelete, firstBlockRootClientId ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet blockToFocus =\n\t\t\t\tgetPreviousBlockClientId( firstBlockClientId ) ??\n\t\t\t\t// If the previous block is not found (when the first block is deleted),\n\t\t\t\t// fallback to focus the parent block.\n\t\t\t\tfirstBlockRootClientId;\n\n\t\t\tremoveBlocks( blocksToDelete, false );\n\n\t\t\t// Update the selection if the original selection has been removed.\n\t\t\tconst shouldUpdateSelection =\n\t\t\t\tselectedBlockClientIds.length > 0 &&\n\t\t\t\tgetSelectedBlockClientIds().length === 0;\n\n\t\t\t// If there's no previous block nor parent block, focus the first block.\n\t\t\tif ( ! blockToFocus ) {\n\t\t\t\tblockToFocus = getBlockOrder()[ 0 ];\n\t\t\t}\n\n\t\t\tupdateFocusAndSelection( blockToFocus, shouldUpdateSelection );\n\t\t} else if ( isMatch( 'core/block-editor/duplicate', event ) ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\n\t\t\tconst { blocksToUpdate, firstBlockRootClientId } =\n\t\t\t\tgetBlocksToUpdate();\n\n\t\t\tconst canDuplicate = getBlocksByClientId( blocksToUpdate ).every(\n\t\t\t\t( block ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t!! block &&\n\t\t\t\t\t\thasBlockSupport( block.name, 'multiple', true ) &&\n\t\t\t\t\t\tcanInsertBlockType( block.name, firstBlockRootClientId )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif ( canDuplicate ) {\n\t\t\t\tconst updatedBlocks = await duplicateBlocks(\n\t\t\t\t\tblocksToUpdate,\n\t\t\t\t\tfalse\n\t\t\t\t);\n\n\t\t\t\tif ( updatedBlocks?.length ) {\n\t\t\t\t\t// If blocks have been duplicated, focus the first duplicated block.\n\t\t\t\t\tupdateFocusAndSelection( updatedBlocks[ 0 ], false );\n\t\t\t\t}\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-before', event ) ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\n\t\t\tconst { blocksToUpdate } = getBlocksToUpdate();\n\t\t\tawait insertBeforeBlock( blocksToUpdate[ 0 ] );\n\t\t\tconst newlySelectedBlocks = getSelectedBlockClientIds();\n\n\t\t\t// Focus the first block of the newly inserted blocks, to keep focus within the list view.\n\t\t\tupdateFocusAndSelection( newlySelectedBlocks[ 0 ], false );\n\t\t} else if ( isMatch( 'core/block-editor/insert-after', event ) ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\n\t\t\tconst { blocksToUpdate } = getBlocksToUpdate();\n\t\t\tawait insertAfterBlock( blocksToUpdate.at( -1 ) );\n\t\t\tconst newlySelectedBlocks = getSelectedBlockClientIds();\n\n\t\t\t// Focus the first block of the newly inserted blocks, to keep focus within the list view.\n\t\t\tupdateFocusAndSelection( newlySelectedBlocks[ 0 ], false );\n\t\t} else if ( isMatch( 'core/block-editor/select-all', event ) ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\n\t\t\tconst { firstBlockRootClientId, selectedBlockClientIds } =\n\t\t\t\tgetBlocksToUpdate();\n\t\t\tconst blockClientIds = getBlockOrder( firstBlockRootClientId );\n\t\t\tif ( ! blockClientIds.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If we have selected all sibling nested blocks, try selecting up a level.\n\t\t\t// This is a similar implementation to that used by `useSelectAll`.\n\t\t\t// `isShallowEqual` is used for the list view instead of a length check,\n\t\t\t// as the array of siblings of the currently focused block may be a different\n\t\t\t// set of blocks from the current block selection if the user is focused\n\t\t\t// on a different part of the list view from the block selection.\n\t\t\tif ( isShallowEqual( selectedBlockClientIds, blockClientIds ) ) {\n\t\t\t\t// Only select up a level if the first block is not the root block.\n\t\t\t\t// This ensures that the block selection can't break out of the root block\n\t\t\t\t// used by the list view, if the list view is only showing a partial hierarchy.\n\t\t\t\tif (\n\t\t\t\t\tfirstBlockRootClientId &&\n\t\t\t\t\tfirstBlockRootClientId !== rootClientId\n\t\t\t\t) {\n\t\t\t\t\tupdateFocusAndSelection( firstBlockRootClientId, true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Select all while passing `null` to skip focusing to the editor canvas,\n\t\t\t// and retain focus within the list view.\n\t\t\tmultiSelect(\n\t\t\t\tblockClientIds[ 0 ],\n\t\t\t\tblockClientIds[ blockClientIds.length - 1 ],\n\t\t\t\tnull\n\t\t\t);\n\t\t} else if ( isMatch( 'core/block-editor/collapse-list-view', event ) ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\tconst { firstBlockClientId } = getBlocksToUpdate();\n\t\t\tconst blockParents = getBlockParents( firstBlockClientId, false );\n\t\t\t// Collapse all blocks.\n\t\t\tcollapseAll();\n\t\t\t// Expand all parents of the current block.\n\t\t\texpand( blockParents );\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-list-view-block-select-button',\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tonContextMenu={ onContextMenu }\n\t\t\t\tonKeyDown={ onKeyDownHandler }\n\t\t\t\tonMouseDown={ onMouseDown }\n\t\t\t\tref={ ref }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\tonFocus={ onFocus }\n\t\t\t\tonDragStart={ onDragStartHandler }\n\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\tdraggable={ draggable }\n\t\t\t\thref={ `#block-${ clientId }` }\n\t\t\t\taria-describedby={ ariaDescribedBy }\n\t\t\t\taria-expanded={ isExpanded }\n\t\t\t>\n\t\t\t\t<ListViewExpander onClick={ onToggleExpanded } />\n\t\t\t\t<BlockIcon\n\t\t\t\t\ticon={ blockInformation?.icon }\n\t\t\t\t\tshowColors\n\t\t\t\t\tcontext=\"list-view\"\n\t\t\t\t/>\n\t\t\t\t<HStack\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__label-wrapper\"\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tspacing={ 1 }\n\t\t\t\t>\n\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__title\">\n\t\t\t\t\t\t<Truncate ellipsizeMode=\"auto\">{ blockTitle }</Truncate>\n\t\t\t\t\t</span>\n\t\t\t\t\t{ blockInformation?.anchor && (\n\t\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__anchor-wrapper\">\n\t\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__anchor\"\n\t\t\t\t\t\t\t\tellipsizeMode=\"auto\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ blockInformation.anchor }\n\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ positionLabel && isSticky && (\n\t\t\t\t\t\t<Tooltip text={ positionLabel }>\n\t\t\t\t\t\t\t<Icon icon={ pinSmall } />\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t) }\n\t\t\t\t\t{ images.length ? (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__images\"\n\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ images.map( ( image, index ) => (\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__image\"\n\t\t\t\t\t\t\t\t\tkey={ image.clientId }\n\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\tbackgroundImage: `url(${ image.url })`,\n\t\t\t\t\t\t\t\t\t\tzIndex: images.length - index, // Ensure the first image is on top, and subsequent images are behind.\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : null }\n\t\t\t\t\t{ isLocked && (\n\t\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__lock\">\n\t\t\t\t\t\t\t<Icon icon={ lock } />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t</Button>\n\t\t</>\n\t);\n}\n\nexport default forwardRef( ListViewBlockSelectButton );\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAMA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,kBAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AACA,IAAAS,eAAA,GAAAV,sBAAA,CAAAC,OAAA;AAKA,IAAAU,UAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,2BAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,qBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,SAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,UAAA,GAAAd,OAAA;AACA,IAAAe,MAAA,GAAAf,OAAA;AACA,IAAAgB,kBAAA,GAAAjB,sBAAA,CAAAC,OAAA;AACA,IAAAiB,QAAA,GAAAjB,OAAA;AAjCA;AACA;AACA;;AAGA;AACA;AACA;;AAgBA;AACA;AACA;;AAUA,SAASkB,yBAAyBA,CACjC;EACCC,SAAS;EACTC,KA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IAC7D8G,GAAG,EAAGF,KAAK,CAAC1G,QAAU;IACtB6G,KAAK,EAAG;MACPC,eAAe,EAAG,OAAOJ,KAAK,CAACK,GAAK,GAAE;MACtCC,MAAM,EAAEvE,MAAM,CAAC8B,MAAM,GAAGoC,KAAK,CAAE;IAChC;EAAG,CACH,CACA,CACG,CAAC,GACJ,IAAI,EACNxF,QAAQ,IACT,IAAAiE,MAAA,CAAAC,aAAA;IAAMvF,SAAS,EAAC;EAAkD,GACjE,IAAAsF,MAAA,CAAAC,aAAA,EAACtG,MAAA,CAAAwH,IAAI;IAACX,IAAI,EAAGqB;EAAM,CAAE,CAChB,CAEA,CACD,CACP,CAAC;AAEL;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAxB,OAAA,GAEc,IAAAyB,mBAAU,EAAEvH,yBAA0B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_components","_element","_icons","_keycodes","_i18n","_blockIcon","_useBlockDisplayInformation","_useBlockDisplayTitle","_expander","_blockLock","_useListViewImages","ListViewBlockSelectButton","className","block","clientId","onClick","onContextMenu","onMouseDown","onToggleExpanded","tabIndex","onFocus","onDragStart","onDragEnd","draggable","isExpanded","ariaDescribedBy","ref","blockInformation","useBlockDisplayInformation","blockTitle","useBlockDisplayTitle","context","isLocked","useBlockLock","isSticky","positionType","images","useListViewImages","positionLabel","sprintf","__","onDragStartHandler","event","dataTransfer","clearData","onKeyDown","keyCode","ENTER","SPACE","_react","createElement","Button","classnames","href","default","icon","showColors","__experimentalHStack","alignment","justify","spacing","__experimentalTruncate","ellipsizeMode","anchor","Tooltip","text","Icon","pinSmall","length","map","image","index","key","style","backgroundImage","url","zIndex","lock","_default","exports","forwardRef"],"sources":["@wordpress/block-editor/src/components/list-view/block-select-button.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n\tTooltip,\n} from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\nimport { Icon, lockSmall as lock, pinSmall } from '@wordpress/icons';\nimport { SPACE, ENTER } from '@wordpress/keycodes';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport ListViewExpander from './expander';\nimport { useBlockLock } from '../block-lock';\nimport useListViewImages from './use-list-view-images';\n\nfunction ListViewBlockSelectButton(\n\t{\n\t\tclassName,\n\t\tblock: { clientId },\n\t\tonClick,\n\t\tonContextMenu,\n\t\tonMouseDown,\n\t\tonToggleExpanded,\n\t\ttabIndex,\n\t\tonFocus,\n\t\tonDragStart,\n\t\tonDragEnd,\n\t\tdraggable,\n\t\tisExpanded,\n\t\tariaDescribedBy,\n\t},\n\tref\n) {\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId,\n\t\tcontext: 'list-view',\n\t} );\n\tconst { isLocked } = useBlockLock( clientId );\n\tconst isSticky = blockInformation?.positionType === 'sticky';\n\tconst images = useListViewImages( { clientId, isExpanded } );\n\n\tconst positionLabel = blockInformation?.positionLabel\n\t\t? sprintf(\n\t\t\t\t// translators: 1: Position of selected block, e.g. \"Sticky\" or \"Fixed\".\n\t\t\t\t__( 'Position: %1$s' ),\n\t\t\t\tblockInformation.positionLabel\n\t\t )\n\t\t: '';\n\n\t// The `href` attribute triggers the browser's native HTML drag operations.\n\t// When the link is dragged, the element's outerHTML is set in DataTransfer object as text/html.\n\t// We need to clear any HTML drag data to prevent `pasteHandler` from firing\n\t// inside the `useOnBlockDrop` hook.\n\tconst onDragStartHandler = ( event ) => {\n\t\tevent.dataTransfer.clearData();\n\t\tonDragStart?.( event );\n\t};\n\n\t/**\n\t * @param {KeyboardEvent} event\n\t */\n\tfunction onKeyDown( event ) {\n\t\tif ( event.keyCode === ENTER || event.keyCode === SPACE ) {\n\t\t\tonClick( event );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-list-view-block-select-button',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\tonClick={ onClick }\n\t\t\tonContextMenu={ onContextMenu }\n\t\t\tonKeyDown={ onKeyDown }\n\t\t\tonMouseDown={ onMouseDown }\n\t\t\tref={ ref }\n\t\t\ttabIndex={ tabIndex }\n\t\t\tonFocus={ onFocus }\n\t\t\tonDragStart={ onDragStartHandler }\n\t\t\tonDragEnd={ onDragEnd }\n\t\t\tdraggable={ draggable }\n\t\t\thref={ `#block-${ clientId }` }\n\t\t\taria-describedby={ ariaDescribedBy }\n\t\t\taria-expanded={ isExpanded }\n\t\t>\n\t\t\t<ListViewExpander onClick={ onToggleExpanded } />\n\t\t\t<BlockIcon\n\t\t\t\ticon={ blockInformation?.icon }\n\t\t\t\tshowColors\n\t\t\t\tcontext=\"list-view\"\n\t\t\t/>\n\t\t\t<HStack\n\t\t\t\talignment=\"center\"\n\t\t\t\tclassName=\"block-editor-list-view-block-select-button__label-wrapper\"\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tspacing={ 1 }\n\t\t\t>\n\t\t\t\t<span className=\"block-editor-list-view-block-select-button__title\">\n\t\t\t\t\t<Truncate ellipsizeMode=\"auto\">{ blockTitle }</Truncate>\n\t\t\t\t</span>\n\t\t\t\t{ blockInformation?.anchor && (\n\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__anchor-wrapper\">\n\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__anchor\"\n\t\t\t\t\t\t\tellipsizeMode=\"auto\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ blockInformation.anchor }\n\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t{ positionLabel && isSticky && (\n\t\t\t\t\t<Tooltip text={ positionLabel }>\n\t\t\t\t\t\t<Icon icon={ pinSmall } />\n\t\t\t\t\t</Tooltip>\n\t\t\t\t) }\n\t\t\t\t{ images.length ? (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__images\"\n\t\t\t\t\t\taria-hidden\n\t\t\t\t\t>\n\t\t\t\t\t\t{ images.map( ( image, index ) => (\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__image\"\n\t\t\t\t\t\t\t\tkey={ image.clientId }\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\tbackgroundImage: `url(${ image.url })`,\n\t\t\t\t\t\t\t\t\tzIndex: images.length - index, // Ensure the first image is on top, and subsequent images are behind.\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</span>\n\t\t\t\t) : null }\n\t\t\t\t{ isLocked && (\n\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__lock\">\n\t\t\t\t\t\t<Icon icon={ lock } />\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t</Button>\n\t);\n}\n\nexport default forwardRef( ListViewBlockSelectButton );\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAMA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,UAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,2BAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,qBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,SAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAA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