@wordpress/block-editor 9.0.0 → 9.3.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 (685) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +1 -0
  3. package/build/autocompleters/block.js +3 -1
  4. package/build/autocompleters/block.js.map +1 -1
  5. package/build/components/block-actions/index.js.map +1 -1
  6. package/build/components/block-alignment-control/ui.js.map +1 -1
  7. package/build/components/block-alignment-matrix-control/index.js +4 -13
  8. package/build/components/block-alignment-matrix-control/index.js.map +1 -1
  9. package/build/components/block-breadcrumb/index.js.map +1 -1
  10. package/build/components/block-content-overlay/index.js +4 -82
  11. package/build/components/block-content-overlay/index.js.map +1 -1
  12. package/build/components/block-context/index.js.map +1 -1
  13. package/build/components/block-controls/hook.js.map +1 -1
  14. package/build/components/block-draggable/draggable-chip.native.js +65 -0
  15. package/build/components/block-draggable/draggable-chip.native.js.map +1 -0
  16. package/build/components/block-draggable/dropping-insertion-point.native.js +157 -0
  17. package/build/components/block-draggable/dropping-insertion-point.native.js.map +1 -0
  18. package/build/components/block-draggable/index.js.map +1 -1
  19. package/build/components/block-draggable/index.native.js +488 -0
  20. package/build/components/block-draggable/index.native.js.map +1 -0
  21. package/build/components/block-draggable/use-scroll-when-dragging.native.js +130 -0
  22. package/build/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -0
  23. package/build/components/block-list/block-list-context.native.js +195 -0
  24. package/build/components/block-list/block-list-context.native.js.map +1 -0
  25. package/build/components/block-list/block-list-item-cell.native.js +67 -0
  26. package/build/components/block-list/block-list-item-cell.native.js.map +1 -0
  27. package/build/components/block-list/block-list-item.native.js +12 -9
  28. package/build/components/block-list/block-list-item.native.js.map +1 -1
  29. package/build/components/block-list/block-selection-button.native.js.map +1 -1
  30. package/build/components/block-list/block.js.map +1 -1
  31. package/build/components/block-list/block.native.js +27 -5
  32. package/build/components/block-list/block.native.js.map +1 -1
  33. package/build/components/block-list/index.js +34 -32
  34. package/build/components/block-list/index.js.map +1 -1
  35. package/build/components/block-list/index.native.js +75 -23
  36. package/build/components/block-list/index.native.js.map +1 -1
  37. package/build/components/block-list/use-block-props/index.js +8 -4
  38. package/build/components/block-list/use-block-props/index.js.map +1 -1
  39. package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +1 -1
  40. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  41. package/build/components/block-list/use-in-between-inserter.js +1 -1
  42. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  43. package/build/components/block-list-appender/index.js.map +1 -1
  44. package/build/components/block-list-appender/index.native.js.map +1 -1
  45. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  46. package/build/components/block-mobile-toolbar/index.native.js +10 -3
  47. package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
  48. package/build/components/block-mover/button.js.map +1 -1
  49. package/build/components/block-mover/index.native.js +17 -4
  50. package/build/components/block-mover/index.native.js.map +1 -1
  51. package/build/components/block-parent-selector/index.js.map +1 -1
  52. package/build/components/block-pattern-setup/index.js +1 -1
  53. package/build/components/block-pattern-setup/index.js.map +1 -1
  54. package/build/components/block-popover/inbetween.js +19 -8
  55. package/build/components/block-popover/inbetween.js.map +1 -1
  56. package/build/components/block-popover/index.js +5 -16
  57. package/build/components/block-popover/index.js.map +1 -1
  58. package/build/components/block-preview/auto.js.map +1 -1
  59. package/build/components/block-preview/index.js +1 -1
  60. package/build/components/block-preview/index.js.map +1 -1
  61. package/build/components/block-selection-clearer/index.js.map +1 -1
  62. package/build/components/block-settings-menu/block-mode-toggle.js +3 -7
  63. package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  64. package/build/components/block-settings-menu/block-settings-dropdown.js +6 -3
  65. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  66. package/build/components/block-styles/index.js +6 -3
  67. package/build/components/block-styles/index.js.map +1 -1
  68. package/build/components/block-styles/menu-items.js +3 -7
  69. package/build/components/block-styles/menu-items.js.map +1 -1
  70. package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
  71. package/build/components/block-toolbar/index.native.js.map +1 -1
  72. package/build/components/block-toolbar/utils.js +5 -8
  73. package/build/components/block-toolbar/utils.js.map +1 -1
  74. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  75. package/build/components/block-tools/block-selection-button.js +1 -0
  76. package/build/components/block-tools/block-selection-button.js.map +1 -1
  77. package/build/components/block-tools/index.js.map +1 -1
  78. package/build/components/block-tools/selected-block-popover.js +1 -29
  79. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  80. package/build/components/block-types-list/index.native.js.map +1 -1
  81. package/build/components/block-variation-transforms/index.js +16 -2
  82. package/build/components/block-variation-transforms/index.js.map +1 -1
  83. package/build/components/border-radius-control/input-controls.js +10 -3
  84. package/build/components/border-radius-control/input-controls.js.map +1 -1
  85. package/build/components/color-style-selector/index.js.map +1 -1
  86. package/build/components/colors/with-colors.js.map +1 -1
  87. package/build/components/colors-gradients/dropdown.js +122 -41
  88. package/build/components/colors-gradients/dropdown.js.map +1 -1
  89. package/build/components/colors-gradients/panel-color-gradient-settings.js +35 -60
  90. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  91. package/build/components/convert-to-group-buttons/toolbar.js +22 -5
  92. package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
  93. package/build/components/copy-handler/index.js +17 -1
  94. package/build/components/copy-handler/index.js.map +1 -1
  95. package/build/components/default-block-appender/index.js.map +1 -1
  96. package/build/components/default-block-appender/index.native.js.map +1 -1
  97. package/build/components/default-style-picker/index.js.map +1 -1
  98. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  99. package/build/components/iframe/index.js +51 -50
  100. package/build/components/iframe/index.js.map +1 -1
  101. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  102. package/build/components/image-editor/use-save-image.js +3 -1
  103. package/build/components/image-editor/use-save-image.js.map +1 -1
  104. package/build/components/image-size-control/index.js +3 -1
  105. package/build/components/image-size-control/index.js.map +1 -1
  106. package/build/components/index.js +31 -13
  107. package/build/components/index.js.map +1 -1
  108. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  109. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  110. package/build/components/inserter/block-types-tab.native.js.map +1 -1
  111. package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  112. package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
  113. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  114. package/build/components/inserter/index.js.map +1 -1
  115. package/build/components/inserter/index.native.js +1 -1
  116. package/build/components/inserter/index.native.js.map +1 -1
  117. package/build/components/inserter/library.js +3 -7
  118. package/build/components/inserter/library.js.map +1 -1
  119. package/build/components/inserter/menu.js.map +1 -1
  120. package/build/components/inserter/menu.native.js.map +1 -1
  121. package/build/components/inserter/no-results.native.js.map +1 -1
  122. package/build/components/inserter/quick-inserter.js.map +1 -1
  123. package/build/components/inserter/search-items.js +1 -1
  124. package/build/components/inserter/search-items.js.map +1 -1
  125. package/build/components/inserter/search-results.native.js.map +1 -1
  126. package/build/components/inspector-popover-header/index.js +56 -0
  127. package/build/components/inspector-popover-header/index.js.map +1 -0
  128. package/build/components/line-height-control/index.js.map +1 -1
  129. package/build/components/link-control/constants.js +11 -1
  130. package/build/components/link-control/constants.js.map +1 -1
  131. package/build/components/link-control/index.js +4 -4
  132. package/build/components/link-control/index.js.map +1 -1
  133. package/build/components/link-control/search-create-button.js +1 -3
  134. package/build/components/link-control/search-create-button.js.map +1 -1
  135. package/build/components/link-control/search-input.js +5 -3
  136. package/build/components/link-control/search-input.js.map +1 -1
  137. package/build/components/link-control/search-results.js +4 -3
  138. package/build/components/link-control/search-results.js.map +1 -1
  139. package/build/components/link-control/settings-drawer.js +3 -7
  140. package/build/components/link-control/settings-drawer.js.map +1 -1
  141. package/build/components/link-control/use-search-handler.js +4 -4
  142. package/build/components/link-control/use-search-handler.js.map +1 -1
  143. package/build/components/list-view/block-contents.js.map +1 -1
  144. package/build/components/list-view/branch.js.map +1 -1
  145. package/build/components/list-view/drop-indicator.js +0 -1
  146. package/build/components/list-view/drop-indicator.js.map +1 -1
  147. package/build/components/list-view/index.js.map +1 -1
  148. package/build/components/list-view/use-block-selection.js.map +1 -1
  149. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  150. package/build/components/list-view/utils.js +1 -7
  151. package/build/components/list-view/utils.js.map +1 -1
  152. package/build/components/media-placeholder/index.js +4 -6
  153. package/build/components/media-placeholder/index.js.map +1 -1
  154. package/build/components/media-replace-flow/index.js +20 -7
  155. package/build/components/media-replace-flow/index.js.map +1 -1
  156. package/build/components/media-upload/index.native.js +10 -4
  157. package/build/components/media-upload/index.native.js.map +1 -1
  158. package/build/components/navigable-toolbar/index.js +12 -2
  159. package/build/components/navigable-toolbar/index.js.map +1 -1
  160. package/build/components/plain-text/index.native.js +62 -7
  161. package/build/components/plain-text/index.native.js.map +1 -1
  162. package/build/components/preview-options/index.js +4 -0
  163. package/build/components/preview-options/index.js.map +1 -1
  164. package/build/components/provider/use-block-sync.js +5 -3
  165. package/build/components/provider/use-block-sync.js.map +1 -1
  166. package/build/components/publish-date-time-picker/index.js +53 -0
  167. package/build/components/publish-date-time-picker/index.js.map +1 -0
  168. package/build/components/rich-text/embed-handler-picker.native.js +4 -8
  169. package/build/components/rich-text/embed-handler-picker.native.js.map +1 -1
  170. package/build/components/rich-text/format-toolbar-container.js +0 -1
  171. package/build/components/rich-text/format-toolbar-container.js.map +1 -1
  172. package/build/components/rich-text/index.js +2 -2
  173. package/build/components/rich-text/index.js.map +1 -1
  174. package/build/components/rich-text/index.native.js +5 -1
  175. package/build/components/rich-text/index.native.js.map +1 -1
  176. package/build/components/rich-text/use-format-types.js.map +1 -1
  177. package/build/components/rich-text/use-mark-persistent.js.map +1 -1
  178. package/build/components/skip-to-selected-block/index.js.map +1 -1
  179. package/build/components/ungroup-button/index.native.js +3 -7
  180. package/build/components/ungroup-button/index.native.js.map +1 -1
  181. package/build/components/url-input/index.js +18 -4
  182. package/build/components/url-input/index.js.map +1 -1
  183. package/build/components/use-block-display-information/index.js.map +1 -1
  184. package/build/components/use-block-drop-zone/index.js.map +1 -1
  185. package/build/components/use-block-drop-zone/index.native.js +167 -0
  186. package/build/components/use-block-drop-zone/index.native.js.map +1 -0
  187. package/build/components/use-display-block-controls/index.native.js.map +1 -1
  188. package/build/components/use-on-block-drop/index.js.map +1 -1
  189. package/build/components/use-on-block-drop/index.native.js +95 -0
  190. package/build/components/use-on-block-drop/index.native.js.map +1 -0
  191. package/build/components/use-setting/index.js.map +1 -1
  192. package/build/components/warning/index.js +6 -1
  193. package/build/components/warning/index.js.map +1 -1
  194. package/build/components/writing-flow/use-arrow-nav.js +12 -12
  195. package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
  196. package/build/components/writing-flow/use-click-selection.js.map +1 -1
  197. package/build/components/writing-flow/use-drag-selection.js.map +1 -1
  198. package/build/components/writing-flow/use-input.js +15 -0
  199. package/build/components/writing-flow/use-input.js.map +1 -1
  200. package/build/components/writing-flow/use-multi-selection.js.map +1 -1
  201. package/build/components/writing-flow/use-select-all.js.map +1 -1
  202. package/build/components/writing-flow/use-selection-observer.js.map +1 -1
  203. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  204. package/build/elements/index.js +9 -0
  205. package/build/elements/index.js.map +1 -0
  206. package/build/hooks/anchor.js.map +1 -1
  207. package/build/hooks/border.js +2 -7
  208. package/build/hooks/border.js.map +1 -1
  209. package/build/hooks/color-panel.js +14 -7
  210. package/build/hooks/color-panel.js.map +1 -1
  211. package/build/hooks/color-panel.native.js.map +1 -1
  212. package/build/hooks/color.js +8 -88
  213. package/build/hooks/color.js.map +1 -1
  214. package/build/hooks/dimensions.js +14 -4
  215. package/build/hooks/dimensions.js.map +1 -1
  216. package/build/hooks/font-family.js.map +1 -1
  217. package/build/hooks/gap.js.map +1 -1
  218. package/build/hooks/layout.js +38 -1
  219. package/build/hooks/layout.js.map +1 -1
  220. package/build/hooks/style.js +14 -13
  221. package/build/hooks/style.js.map +1 -1
  222. package/build/hooks/typography.js +6 -2
  223. package/build/hooks/typography.js.map +1 -1
  224. package/build/index.js +14 -0
  225. package/build/index.js.map +1 -1
  226. package/build/layouts/flex.js +5 -2
  227. package/build/layouts/flex.js.map +1 -1
  228. package/build/store/actions.js +14 -0
  229. package/build/store/actions.js.map +1 -1
  230. package/build/store/reducer.js +17 -2
  231. package/build/store/reducer.js.map +1 -1
  232. package/build/store/selectors.js +30 -2
  233. package/build/store/selectors.js.map +1 -1
  234. package/build/utils/pasting.js.map +1 -1
  235. package/build/utils/transform-styles/transforms/wrap.js.map +1 -1
  236. package/build-module/autocompleters/block.js +4 -1
  237. package/build-module/autocompleters/block.js.map +1 -1
  238. package/build-module/components/block-actions/index.js.map +1 -1
  239. package/build-module/components/block-alignment-control/ui.js.map +1 -1
  240. package/build-module/components/block-alignment-matrix-control/index.js +3 -11
  241. package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
  242. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  243. package/build-module/components/block-content-overlay/index.js +3 -78
  244. package/build-module/components/block-content-overlay/index.js.map +1 -1
  245. package/build-module/components/block-context/index.js.map +1 -1
  246. package/build-module/components/block-controls/hook.js.map +1 -1
  247. package/build-module/components/block-draggable/draggable-chip.native.js +51 -0
  248. package/build-module/components/block-draggable/draggable-chip.native.js.map +1 -0
  249. package/build-module/components/block-draggable/dropping-insertion-point.native.js +137 -0
  250. package/build-module/components/block-draggable/dropping-insertion-point.native.js.map +1 -0
  251. package/build-module/components/block-draggable/index.js.map +1 -1
  252. package/build-module/components/block-draggable/index.native.js +453 -0
  253. package/build-module/components/block-draggable/index.native.js.map +1 -0
  254. package/build-module/components/block-draggable/use-scroll-when-dragging.native.js +120 -0
  255. package/build-module/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -0
  256. package/build-module/components/block-list/block-list-context.native.js +179 -0
  257. package/build-module/components/block-list/block-list-context.native.js.map +1 -0
  258. package/build-module/components/block-list/block-list-item-cell.native.js +59 -0
  259. package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -0
  260. package/build-module/components/block-list/block-list-item.native.js +12 -9
  261. package/build-module/components/block-list/block-list-item.native.js.map +1 -1
  262. package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
  263. package/build-module/components/block-list/block.js.map +1 -1
  264. package/build-module/components/block-list/block.native.js +26 -5
  265. package/build-module/components/block-list/block.native.js.map +1 -1
  266. package/build-module/components/block-list/index.js +35 -33
  267. package/build-module/components/block-list/index.js.map +1 -1
  268. package/build-module/components/block-list/index.native.js +72 -23
  269. package/build-module/components/block-list/index.native.js.map +1 -1
  270. package/build-module/components/block-list/use-block-props/index.js +9 -5
  271. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  272. package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +1 -1
  273. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  274. package/build-module/components/block-list/use-in-between-inserter.js +1 -1
  275. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  276. package/build-module/components/block-list-appender/index.js.map +1 -1
  277. package/build-module/components/block-list-appender/index.native.js.map +1 -1
  278. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  279. package/build-module/components/block-mobile-toolbar/index.native.js +9 -3
  280. package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
  281. package/build-module/components/block-mover/button.js.map +1 -1
  282. package/build-module/components/block-mover/index.native.js +18 -5
  283. package/build-module/components/block-mover/index.native.js.map +1 -1
  284. package/build-module/components/block-parent-selector/index.js.map +1 -1
  285. package/build-module/components/block-pattern-setup/index.js +1 -1
  286. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  287. package/build-module/components/block-popover/inbetween.js +19 -8
  288. package/build-module/components/block-popover/inbetween.js.map +1 -1
  289. package/build-module/components/block-popover/index.js +5 -15
  290. package/build-module/components/block-popover/index.js.map +1 -1
  291. package/build-module/components/block-preview/auto.js.map +1 -1
  292. package/build-module/components/block-preview/index.js +1 -1
  293. package/build-module/components/block-preview/index.js.map +1 -1
  294. package/build-module/components/block-selection-clearer/index.js.map +1 -1
  295. package/build-module/components/block-settings-menu/block-mode-toggle.js +3 -5
  296. package/build-module/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  297. package/build-module/components/block-settings-menu/block-settings-dropdown.js +9 -3
  298. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  299. package/build-module/components/block-styles/index.js +5 -2
  300. package/build-module/components/block-styles/index.js.map +1 -1
  301. package/build-module/components/block-styles/menu-items.js +3 -5
  302. package/build-module/components/block-styles/menu-items.js.map +1 -1
  303. package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
  304. package/build-module/components/block-toolbar/index.native.js.map +1 -1
  305. package/build-module/components/block-toolbar/utils.js +3 -5
  306. package/build-module/components/block-toolbar/utils.js.map +1 -1
  307. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  308. package/build-module/components/block-tools/block-selection-button.js +1 -0
  309. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  310. package/build-module/components/block-tools/index.js.map +1 -1
  311. package/build-module/components/block-tools/selected-block-popover.js +2 -29
  312. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  313. package/build-module/components/block-types-list/index.native.js.map +1 -1
  314. package/build-module/components/block-variation-transforms/index.js +13 -2
  315. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  316. package/build-module/components/border-radius-control/input-controls.js +11 -4
  317. package/build-module/components/border-radius-control/input-controls.js.map +1 -1
  318. package/build-module/components/color-style-selector/index.js.map +1 -1
  319. package/build-module/components/colors/with-colors.js.map +1 -1
  320. package/build-module/components/colors-gradients/dropdown.js +124 -43
  321. package/build-module/components/colors-gradients/dropdown.js.map +1 -1
  322. package/build-module/components/colors-gradients/panel-color-gradient-settings.js +36 -64
  323. package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  324. package/build-module/components/convert-to-group-buttons/toolbar.js +23 -6
  325. package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
  326. package/build-module/components/copy-handler/index.js +18 -2
  327. package/build-module/components/copy-handler/index.js.map +1 -1
  328. package/build-module/components/default-block-appender/index.js.map +1 -1
  329. package/build-module/components/default-block-appender/index.native.js.map +1 -1
  330. package/build-module/components/default-style-picker/index.js.map +1 -1
  331. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  332. package/build-module/components/iframe/index.js +52 -51
  333. package/build-module/components/iframe/index.js.map +1 -1
  334. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  335. package/build-module/components/image-editor/use-save-image.js +2 -1
  336. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  337. package/build-module/components/image-size-control/index.js +4 -1
  338. package/build-module/components/image-size-control/index.js.map +1 -1
  339. package/build-module/components/index.js +4 -2
  340. package/build-module/components/index.js.map +1 -1
  341. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  342. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  343. package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
  344. package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  345. package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
  346. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  347. package/build-module/components/inserter/index.js.map +1 -1
  348. package/build-module/components/inserter/index.native.js +1 -1
  349. package/build-module/components/inserter/index.native.js.map +1 -1
  350. package/build-module/components/inserter/library.js +2 -5
  351. package/build-module/components/inserter/library.js.map +1 -1
  352. package/build-module/components/inserter/menu.js.map +1 -1
  353. package/build-module/components/inserter/menu.native.js.map +1 -1
  354. package/build-module/components/inserter/no-results.native.js.map +1 -1
  355. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  356. package/build-module/components/inserter/search-items.js +2 -2
  357. package/build-module/components/inserter/search-items.js.map +1 -1
  358. package/build-module/components/inserter/search-results.native.js.map +1 -1
  359. package/build-module/components/inspector-popover-header/index.js +46 -0
  360. package/build-module/components/inspector-popover-header/index.js.map +1 -0
  361. package/build-module/components/line-height-control/index.js.map +1 -1
  362. package/build-module/components/link-control/constants.js +5 -0
  363. package/build-module/components/link-control/constants.js.map +1 -1
  364. package/build-module/components/link-control/index.js +2 -1
  365. package/build-module/components/link-control/index.js.map +1 -1
  366. package/build-module/components/link-control/search-create-button.js +1 -2
  367. package/build-module/components/link-control/search-create-button.js.map +1 -1
  368. package/build-module/components/link-control/search-input.js +3 -1
  369. package/build-module/components/link-control/search-input.js.map +1 -1
  370. package/build-module/components/link-control/search-results.js +3 -4
  371. package/build-module/components/link-control/search-results.js.map +1 -1
  372. package/build-module/components/link-control/settings-drawer.js +2 -5
  373. package/build-module/components/link-control/settings-drawer.js.map +1 -1
  374. package/build-module/components/link-control/use-search-handler.js +5 -5
  375. package/build-module/components/link-control/use-search-handler.js.map +1 -1
  376. package/build-module/components/list-view/block-contents.js.map +1 -1
  377. package/build-module/components/list-view/branch.js.map +1 -1
  378. package/build-module/components/list-view/drop-indicator.js +0 -1
  379. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  380. package/build-module/components/list-view/index.js.map +1 -1
  381. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  382. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  383. package/build-module/components/list-view/utils.js +1 -6
  384. package/build-module/components/list-view/utils.js.map +1 -1
  385. package/build-module/components/media-placeholder/index.js +2 -3
  386. package/build-module/components/media-placeholder/index.js.map +1 -1
  387. package/build-module/components/media-replace-flow/index.js +22 -9
  388. package/build-module/components/media-replace-flow/index.js.map +1 -1
  389. package/build-module/components/media-upload/index.native.js +8 -3
  390. package/build-module/components/media-upload/index.native.js.map +1 -1
  391. package/build-module/components/navigable-toolbar/index.js +12 -2
  392. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  393. package/build-module/components/plain-text/index.native.js +63 -8
  394. package/build-module/components/plain-text/index.native.js.map +1 -1
  395. package/build-module/components/preview-options/index.js +4 -0
  396. package/build-module/components/preview-options/index.js.map +1 -1
  397. package/build-module/components/provider/use-block-sync.js +4 -1
  398. package/build-module/components/provider/use-block-sync.js.map +1 -1
  399. package/build-module/components/publish-date-time-picker/index.js +40 -0
  400. package/build-module/components/publish-date-time-picker/index.js.map +1 -0
  401. package/build-module/components/rich-text/embed-handler-picker.native.js +3 -5
  402. package/build-module/components/rich-text/embed-handler-picker.native.js.map +1 -1
  403. package/build-module/components/rich-text/format-toolbar-container.js +0 -1
  404. package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
  405. package/build-module/components/rich-text/index.js +2 -2
  406. package/build-module/components/rich-text/index.js.map +1 -1
  407. package/build-module/components/rich-text/index.native.js +5 -1
  408. package/build-module/components/rich-text/index.native.js.map +1 -1
  409. package/build-module/components/rich-text/use-format-types.js.map +1 -1
  410. package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
  411. package/build-module/components/skip-to-selected-block/index.js.map +1 -1
  412. package/build-module/components/ungroup-button/index.native.js +3 -5
  413. package/build-module/components/ungroup-button/index.native.js.map +1 -1
  414. package/build-module/components/url-input/index.js +15 -2
  415. package/build-module/components/url-input/index.js.map +1 -1
  416. package/build-module/components/use-block-display-information/index.js.map +1 -1
  417. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  418. package/build-module/components/use-block-drop-zone/index.native.js +148 -0
  419. package/build-module/components/use-block-drop-zone/index.native.js.map +1 -0
  420. package/build-module/components/use-display-block-controls/index.native.js.map +1 -1
  421. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  422. package/build-module/components/use-on-block-drop/index.native.js +83 -0
  423. package/build-module/components/use-on-block-drop/index.native.js.map +1 -0
  424. package/build-module/components/use-setting/index.js.map +1 -1
  425. package/build-module/components/warning/index.js +6 -1
  426. package/build-module/components/warning/index.js.map +1 -1
  427. package/build-module/components/writing-flow/use-arrow-nav.js +12 -11
  428. package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
  429. package/build-module/components/writing-flow/use-click-selection.js.map +1 -1
  430. package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
  431. package/build-module/components/writing-flow/use-input.js +15 -0
  432. package/build-module/components/writing-flow/use-input.js.map +1 -1
  433. package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
  434. package/build-module/components/writing-flow/use-select-all.js.map +1 -1
  435. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
  436. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  437. package/build-module/elements/index.js +2 -0
  438. package/build-module/elements/index.js.map +1 -0
  439. package/build-module/hooks/anchor.js.map +1 -1
  440. package/build-module/hooks/border.js +2 -7
  441. package/build-module/hooks/border.js.map +1 -1
  442. package/build-module/hooks/color-panel.js +11 -6
  443. package/build-module/hooks/color-panel.js.map +1 -1
  444. package/build-module/hooks/color-panel.native.js.map +1 -1
  445. package/build-module/hooks/color.js +8 -88
  446. package/build-module/hooks/color.js.map +1 -1
  447. package/build-module/hooks/dimensions.js +14 -4
  448. package/build-module/hooks/dimensions.js.map +1 -1
  449. package/build-module/hooks/font-family.js.map +1 -1
  450. package/build-module/hooks/gap.js.map +1 -1
  451. package/build-module/hooks/layout.js +39 -2
  452. package/build-module/hooks/layout.js.map +1 -1
  453. package/build-module/hooks/style.js +15 -14
  454. package/build-module/hooks/style.js.map +1 -1
  455. package/build-module/hooks/typography.js +6 -2
  456. package/build-module/hooks/typography.js.map +1 -1
  457. package/build-module/index.js +1 -0
  458. package/build-module/index.js.map +1 -1
  459. package/build-module/layouts/flex.js +4 -2
  460. package/build-module/layouts/flex.js.map +1 -1
  461. package/build-module/store/actions.js +12 -0
  462. package/build-module/store/actions.js.map +1 -1
  463. package/build-module/store/reducer.js +17 -2
  464. package/build-module/store/reducer.js.map +1 -1
  465. package/build-module/store/selectors.js +25 -2
  466. package/build-module/store/selectors.js.map +1 -1
  467. package/build-module/utils/pasting.js.map +1 -1
  468. package/build-module/utils/transform-styles/transforms/wrap.js.map +1 -1
  469. package/build-style/style-rtl.css +79 -197
  470. package/build-style/style.css +79 -197
  471. package/package.json +30 -30
  472. package/src/autocompleters/block.js +2 -1
  473. package/src/components/block-actions/index.js +2 -3
  474. package/src/components/block-alignment-control/ui.js +4 -6
  475. package/src/components/block-alignment-matrix-control/index.js +3 -9
  476. package/src/components/block-breadcrumb/index.js +2 -5
  477. package/src/components/block-compare/test/block-view.js +2 -1
  478. package/src/components/block-content-overlay/index.js +10 -100
  479. package/src/components/block-content-overlay/style.scss +2 -11
  480. package/src/components/block-context/index.js +4 -4
  481. package/src/components/block-controls/hook.js +2 -3
  482. package/src/components/block-draggable/draggable-chip.native.js +49 -0
  483. package/src/components/block-draggable/dropping-insertion-point.native.js +181 -0
  484. package/src/components/block-draggable/dropping-insertion-point.native.scss +8 -0
  485. package/src/components/block-draggable/index.js +6 -13
  486. package/src/components/block-draggable/index.native.js +454 -0
  487. package/src/components/block-draggable/style.native.scss +19 -0
  488. package/src/components/block-draggable/test/__snapshots__/index.native.js.snap +73 -0
  489. package/src/components/block-draggable/test/helpers.native.js +183 -0
  490. package/src/components/block-draggable/test/index.native.js +493 -0
  491. package/src/components/block-draggable/use-scroll-when-dragging.native.js +135 -0
  492. package/src/components/block-edit/test/edit.js +2 -1
  493. package/src/components/block-list/block-list-context.native.js +175 -0
  494. package/src/components/block-list/block-list-item-cell.native.js +49 -0
  495. package/src/components/block-list/block-list-item.native.js +11 -23
  496. package/src/components/block-list/block-selection-button.native.js +2 -3
  497. package/src/components/block-list/block.js +8 -10
  498. package/src/components/block-list/block.native.js +47 -23
  499. package/src/components/block-list/index.js +46 -47
  500. package/src/components/block-list/index.native.js +63 -31
  501. package/src/components/block-list/test/block-list-context.native.js +245 -0
  502. package/src/components/block-list/test/fixtures/block-list-context.native.js +79 -0
  503. package/src/components/block-list/use-block-props/index.js +16 -8
  504. package/src/components/block-list/use-block-props/use-block-custom-class-name.js +2 -3
  505. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +2 -3
  506. package/src/components/block-list/use-in-between-inserter.js +3 -4
  507. package/src/components/block-list-appender/index.js +2 -5
  508. package/src/components/block-list-appender/index.native.js +2 -3
  509. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +4 -6
  510. package/src/components/block-mobile-toolbar/index.native.js +9 -1
  511. package/src/components/block-mover/button.js +2 -3
  512. package/src/components/block-mover/index.native.js +26 -12
  513. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +10 -0
  514. package/src/components/block-parent-selector/index.js +2 -3
  515. package/src/components/block-pattern-setup/index.js +3 -5
  516. package/src/components/block-popover/inbetween.js +21 -8
  517. package/src/components/block-popover/index.js +2 -16
  518. package/src/components/block-popover/style.scss +1 -0
  519. package/src/components/block-preview/auto.js +4 -8
  520. package/src/components/block-preview/index.js +1 -4
  521. package/src/components/block-selection-clearer/index.js +2 -3
  522. package/src/components/block-settings-menu/block-mode-toggle.js +4 -8
  523. package/src/components/block-settings-menu/block-settings-dropdown.js +9 -9
  524. package/src/components/block-styles/index.js +3 -1
  525. package/src/components/block-styles/menu-items.js +2 -5
  526. package/src/components/block-switcher/block-transformations-menu.js +2 -4
  527. package/src/components/block-switcher/style.scss +2 -39
  528. package/src/components/block-toolbar/index.native.js +2 -5
  529. package/src/components/block-toolbar/utils.js +3 -11
  530. package/src/components/block-tools/block-contextual-toolbar.js +2 -5
  531. package/src/components/block-tools/block-selection-button.js +1 -0
  532. package/src/components/block-tools/index.js +2 -3
  533. package/src/components/block-tools/selected-block-popover.js +1 -36
  534. package/src/components/block-tools/style.scss +1 -12
  535. package/src/components/block-types-list/index.native.js +2 -4
  536. package/src/components/block-variation-transforms/index.js +10 -8
  537. package/src/components/border-radius-control/input-controls.js +16 -8
  538. package/src/components/border-radius-control/style.scss +3 -2
  539. package/src/components/color-palette/test/control.js +2 -1
  540. package/src/components/color-style-selector/index.js +27 -28
  541. package/src/components/colors/test/with-colors.js +14 -14
  542. package/src/components/colors/with-colors.js +8 -12
  543. package/src/components/colors-gradients/dropdown.js +135 -62
  544. package/src/components/colors-gradients/panel-color-gradient-settings.js +30 -76
  545. package/src/components/colors-gradients/style.scss +52 -50
  546. package/src/components/colors-gradients/test/control.js +10 -10
  547. package/src/components/convert-to-group-buttons/toolbar.js +32 -19
  548. package/src/components/copy-handler/README.md +7 -2
  549. package/src/components/copy-handler/index.js +26 -6
  550. package/src/components/default-block-appender/index.js +4 -6
  551. package/src/components/default-block-appender/index.native.js +4 -9
  552. package/src/components/default-style-picker/index.js +20 -21
  553. package/src/components/duotone-control/style.scss +1 -7
  554. package/src/components/font-sizes/with-font-sizes.js +2 -3
  555. package/src/components/iframe/index.js +62 -54
  556. package/src/components/image-editor/aspect-ratio-dropdown.js +2 -6
  557. package/src/components/image-editor/use-save-image.js +2 -1
  558. package/src/components/image-size-control/index.js +4 -7
  559. package/src/components/index.js +4 -2
  560. package/src/components/inner-blocks/use-inner-block-template-sync.js +2 -3
  561. package/src/components/inner-blocks/use-nested-settings-update.js +6 -9
  562. package/src/components/inserter/block-types-tab.native.js +2 -3
  563. package/src/components/inserter/hooks/use-block-type-impressions.native.js +2 -3
  564. package/src/components/inserter/hooks/use-insertion-point.js +3 -2
  565. package/src/components/inserter/hooks/use-patterns-state.js +4 -5
  566. package/src/components/inserter/index.js +4 -6
  567. package/src/components/inserter/index.native.js +7 -12
  568. package/src/components/inserter/library.js +2 -5
  569. package/src/components/inserter/menu.js +14 -19
  570. package/src/components/inserter/menu.native.js +8 -6
  571. package/src/components/inserter/no-results.native.js +2 -1
  572. package/src/components/inserter/quick-inserter.js +2 -3
  573. package/src/components/inserter/search-items.js +6 -6
  574. package/src/components/inserter/search-results.native.js +4 -6
  575. package/src/components/inserter/style.scss +2 -1
  576. package/src/components/inspector-popover-header/README.md +76 -0
  577. package/src/components/inspector-popover-header/index.js +56 -0
  578. package/src/components/inspector-popover-header/style.scss +16 -0
  579. package/src/components/line-height-control/index.js +1 -2
  580. package/src/components/link-control/constants.js +11 -0
  581. package/src/components/link-control/index.js +4 -4
  582. package/src/components/link-control/search-create-button.js +4 -2
  583. package/src/components/link-control/search-input.js +3 -1
  584. package/src/components/link-control/search-results.js +4 -5
  585. package/src/components/link-control/settings-drawer.js +2 -5
  586. package/src/components/link-control/test/fixtures/index.js +3 -4
  587. package/src/components/link-control/test/index.js +24 -36
  588. package/src/components/link-control/use-search-handler.js +13 -7
  589. package/src/components/list-view/block-contents.js +2 -4
  590. package/src/components/list-view/branch.js +22 -23
  591. package/src/components/list-view/drop-indicator.js +0 -1
  592. package/src/components/list-view/index.js +4 -8
  593. package/src/components/list-view/style.scss +2 -1
  594. package/src/components/list-view/use-block-selection.js +5 -5
  595. package/src/components/list-view/use-list-view-drop-zone.js +2 -1
  596. package/src/components/list-view/utils.js +1 -6
  597. package/src/components/media-placeholder/index.js +2 -3
  598. package/src/components/media-replace-flow/index.js +77 -48
  599. package/src/components/media-upload/index.native.js +6 -2
  600. package/src/components/media-upload/test/index.native.js +31 -6
  601. package/src/components/navigable-toolbar/index.js +13 -4
  602. package/src/components/panel-color-settings/test/index.js +2 -1
  603. package/src/components/plain-text/index.native.js +60 -8
  604. package/src/components/preview-options/index.js +4 -0
  605. package/src/components/preview-options/style.scss +0 -4
  606. package/src/components/provider/use-block-sync.js +5 -2
  607. package/src/components/publish-date-time-picker/README.md +52 -0
  608. package/src/components/publish-date-time-picker/index.js +39 -0
  609. package/src/components/responsive-block-control/test/index.js +3 -2
  610. package/src/components/rich-text/embed-handler-picker.native.js +2 -5
  611. package/src/components/rich-text/format-toolbar-container.js +0 -1
  612. package/src/components/rich-text/index.js +10 -5
  613. package/src/components/rich-text/index.native.js +4 -0
  614. package/src/components/rich-text/style.scss +2 -8
  615. package/src/components/rich-text/use-format-types.js +16 -16
  616. package/src/components/rich-text/use-mark-persistent.js +2 -3
  617. package/src/components/skip-to-selected-block/index.js +2 -3
  618. package/src/components/ungroup-button/index.native.js +4 -8
  619. package/src/components/url-input/index.js +24 -21
  620. package/src/components/use-block-display-information/index.js +4 -6
  621. package/src/components/use-block-drop-zone/index.js +2 -3
  622. package/src/components/use-block-drop-zone/index.native.js +171 -0
  623. package/src/components/use-block-drop-zone/test/index.js +22 -23
  624. package/src/components/use-display-block-controls/index.native.js +2 -3
  625. package/src/components/use-no-recursive-renders/test/use-no-recursive-renders.js +2 -3
  626. package/src/components/use-on-block-drop/index.js +2 -5
  627. package/src/components/use-on-block-drop/index.native.js +115 -0
  628. package/src/components/use-setting/index.js +8 -6
  629. package/src/components/warning/index.js +47 -42
  630. package/src/components/warning/test/__snapshots__/index.js.snap +15 -6
  631. package/src/components/warning/test/index.js +1 -1
  632. package/src/components/writing-flow/test/index.js +22 -4
  633. package/src/components/writing-flow/use-arrow-nav.js +22 -10
  634. package/src/components/writing-flow/use-click-selection.js +2 -5
  635. package/src/components/writing-flow/use-drag-selection.js +6 -9
  636. package/src/components/writing-flow/use-input.js +12 -0
  637. package/src/components/writing-flow/use-multi-selection.js +2 -4
  638. package/src/components/writing-flow/use-select-all.js +2 -5
  639. package/src/components/writing-flow/use-selection-observer.js +4 -6
  640. package/src/components/writing-flow/use-tab-nav.js +2 -5
  641. package/src/elements/index.js +1 -0
  642. package/src/hooks/anchor.js +1 -1
  643. package/src/hooks/border.js +2 -11
  644. package/src/hooks/border.scss +0 -48
  645. package/src/hooks/color-panel.js +17 -13
  646. package/src/hooks/color-panel.native.js +2 -2
  647. package/src/hooks/color.js +7 -76
  648. package/src/hooks/color.scss +5 -58
  649. package/src/hooks/dimensions.js +11 -3
  650. package/src/hooks/font-family.js +4 -2
  651. package/src/hooks/gap.js +2 -3
  652. package/src/hooks/layout.js +54 -4
  653. package/src/hooks/style.js +25 -39
  654. package/src/hooks/test/align.js +2 -1
  655. package/src/hooks/test/generated-class-name.js +2 -5
  656. package/src/hooks/test/utils.js +2 -5
  657. package/src/hooks/typography.js +2 -0
  658. package/src/index.js +1 -0
  659. package/src/layouts/flex.js +11 -3
  660. package/src/store/actions.js +784 -728
  661. package/src/store/reducer.js +202 -178
  662. package/src/store/selectors.js +82 -54
  663. package/src/store/test/actions.js +2 -1
  664. package/src/store/test/reducer.js +8 -1
  665. package/src/store/test/selectors.js +17 -21
  666. package/src/style.scss +1 -1
  667. package/src/utils/pasting.js +3 -3
  668. package/src/utils/transform-styles/transforms/wrap.js +30 -28
  669. package/tsconfig.tsbuildinfo +1 -1
  670. package/build/components/colors/color-panel.js +0 -82
  671. package/build/components/colors/color-panel.js.map +0 -1
  672. package/build/components/colors/color-panel.native.js +0 -11
  673. package/build/components/colors/color-panel.native.js.map +0 -1
  674. package/build/components/colors-gradients/tools-panel-color-dropdown.js +0 -89
  675. package/build/components/colors-gradients/tools-panel-color-dropdown.js.map +0 -1
  676. package/build-module/components/colors/color-panel.js +0 -70
  677. package/build-module/components/colors/color-panel.js.map +0 -1
  678. package/build-module/components/colors/color-panel.native.js +0 -4
  679. package/build-module/components/colors/color-panel.native.js.map +0 -1
  680. package/build-module/components/colors-gradients/tools-panel-color-dropdown.js +0 -75
  681. package/build-module/components/colors-gradients/tools-panel-color-dropdown.js.map +0 -1
  682. package/src/components/block-alignment-matrix-control/style.scss +0 -10
  683. package/src/components/colors/color-panel.js +0 -91
  684. package/src/components/colors/color-panel.native.js +0 -3
  685. package/src/components/colors-gradients/tools-panel-color-dropdown.js +0 -85
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/use-arrow-nav.js"],"names":["isNavigationCandidate","element","keyCode","hasModifier","isVertical","UP","DOWN","tagName","getClosestTabbable","target","isReverse","containerElement","onlyVertical","focusableNodes","focus","focusable","find","slice","indexOf","targetRect","getBoundingClientRect","isTabCandidate","node","tabbable","isTabbableIndex","isContentEditable","contentEditable","nodeRect","left","right","useArrowNav","getSelectedBlockClientId","getMultiSelectedBlocksEndClientId","getPreviousBlockClientId","getNextBlockClientId","getSettings","hasMultiSelection","blockEditorStore","verticalRect","onMouseDown","isTabbableEdge","closestTabbable","onKeyDown","event","isUp","isDown","isLeft","LEFT","isRight","RIGHT","isHorizontal","isNav","isShift","shiftKey","ctrlKey","altKey","metaKey","isNavEdge","isVerticalEdge","isHorizontalEdge","ownerDocument","defaultView","defaultPrevented","isReverseDir","keepCaretInsideBlock","selectedBlockClientId","selectionEndClientId","selectionBeforeEndClientId","selectionAfterEndClientId","preventDefault","getSelection","isCollapsed","addEventListener","removeEventListener"],"mappings":";;;;;;;;;AAGA;;AAKA;;AASA;;AACA;;AACA;;AAKA;;AACA;;AAzBA;AACA;AACA;;AAGA;AACA;AACA;;AAcA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,qBAAT,CAAgCC,OAAhC,EAAyCC,OAAzC,EAAkDC,WAAlD,EAAgE;AACtE,QAAMC,UAAU,GAAGF,OAAO,KAAKG,YAAZ,IAAkBH,OAAO,KAAKI,cAAjD,CADsE,CAGtE;;AACA,MAAKF,UAAU,IAAI,CAAED,WAArB,EAAmC;AAClC,WAAO,IAAP;AACA,GANqE,CAQtE;;;AACA,QAAM;AAAEI,IAAAA;AAAF,MAAcN,OAApB;AACA,SAAOM,OAAO,KAAK,OAAZ,IAAuBA,OAAO,KAAK,UAA1C;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,kBAAT,CACNC,MADM,EAENC,SAFM,EAGNC,gBAHM,EAINC,YAJM,EAKL;AACD;AACA;AACA,MAAIC,cAAc,GAAGC,WAAMC,SAAN,CAAgBC,IAAhB,CAAsBL,gBAAtB,CAArB;;AAEA,MAAKD,SAAL,EAAiB;AAChBG,IAAAA,cAAc,GAAG,qBAASA,cAAT,CAAjB;AACA,GAPA,CASD;AACA;AACA;;;AACAA,EAAAA,cAAc,GAAGA,cAAc,CAACI,KAAf,CAChBJ,cAAc,CAACK,OAAf,CAAwBT,MAAxB,IAAmC,CADnB,CAAjB;AAIA,MAAIU,UAAJ;;AAEA,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YAA1B,CAFA,IAGA,CAAEC,oBAJI,EAKL;AACD,cAAMvB,eAAe,GAAGjC,kBAAkB,CACzCC,MADyC,EAEzCsD,YAFyC,EAGzCzC,IAHyC,CAA1C;AAKA,6CAA4BmB,eAA5B,EAA6C/B,SAA7C;AACAiC,QAAAA,KAAK,CAAC0B,cAAN;AACA;AACD;;AAED/C,IAAAA,IAAI,CAACkD,gBAAL,CAAuB,WAAvB,EAAoCjC,WAApC;AACAjB,IAAAA,IAAI,CAACkD,gBAAL,CAAuB,SAAvB,EAAkC9B,SAAlC;AACA,WAAO,MAAM;AACZpB,MAAAA,IAAI,CAACmD,mBAAL,CAA0B,WAA1B,EAAuClC,WAAvC;AACAjB,MAAAA,IAAI,CAACmD,mBAAL,CAA0B,SAA1B,EAAqC/B,SAArC;AACA,KAHD;AAIA,GAtJM,EAsJJ,EAtJI,CAAP;AAuJA","sourcesContent":["/**\n * External dependencies\n */\nimport { find, reverse } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcomputeCaretRect,\n\tfocus,\n\tisHorizontalEdge,\n\tisVerticalEdge,\n\tplaceCaretAtHorizontalEdge,\n\tplaceCaretAtVerticalEdge,\n\tisRTL,\n} from '@wordpress/dom';\nimport { UP, DOWN, LEFT, RIGHT } from '@wordpress/keycodes';\nimport { useSelect } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { isInSameBlock } from '../../utils/dom';\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Returns true if the element should consider edge navigation upon a keyboard\n * event of the given directional key code, or false otherwise.\n *\n * @param {Element} element HTML element to test.\n * @param {number} keyCode KeyboardEvent keyCode to test.\n * @param {boolean} hasModifier Whether a modifier is pressed.\n *\n * @return {boolean} Whether element should consider edge navigation.\n */\nexport function isNavigationCandidate( element, keyCode, hasModifier ) {\n\tconst isVertical = keyCode === UP || keyCode === DOWN;\n\n\t// Currently, all elements support unmodified vertical navigation.\n\tif ( isVertical && ! hasModifier ) {\n\t\treturn true;\n\t}\n\n\t// Native inputs should not navigate horizontally.\n\tconst { tagName } = element;\n\treturn tagName !== 'INPUT' && tagName !== 'TEXTAREA';\n}\n\n/**\n * Returns the optimal tab target from the given focused element in the desired\n * direction. A preference is made toward text fields, falling back to the block\n * focus stop if no other candidates exist for the block.\n *\n * @param {Element} target Currently focused text field.\n * @param {boolean} isReverse True if considering as the first field.\n * @param {Element} containerElement Element containing all blocks.\n * @param {boolean} onlyVertical Whether to only consider tabbable elements\n * that are visually above or under the\n * target.\n *\n * @return {?Element} Optimal tab target, if one exists.\n */\nexport function getClosestTabbable(\n\ttarget,\n\tisReverse,\n\tcontainerElement,\n\tonlyVertical\n) {\n\t// Since the current focus target is not guaranteed to be a text field, find\n\t// all focusables. Tabbability is considered later.\n\tlet focusableNodes = focus.focusable.find( containerElement );\n\n\tif ( isReverse ) {\n\t\tfocusableNodes = reverse( focusableNodes );\n\t}\n\n\t// Consider as candidates those focusables after the current target. It's\n\t// assumed this can only be reached if the target is focusable (on its\n\t// keydown event), so no need to verify it exists in the set.\n\tfocusableNodes = focusableNodes.slice(\n\t\tfocusableNodes.indexOf( target ) + 1\n\t);\n\n\tlet targetRect;\n\n\tif ( onlyVertical ) {\n\t\ttargetRect = target.getBoundingClientRect();\n\t}\n\n\tfunction isTabCandidate( node ) {\n\t\t// Not a candidate if the node is not tabbable.\n\t\tif ( ! focus.tabbable.isTabbableIndex( node ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Skip focusable elements such as links within content editable nodes.\n\t\tif ( node.isContentEditable && node.contentEditable !== 'true' ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ( onlyVertical ) {\n\t\t\tconst nodeRect = node.getBoundingClientRect();\n\n\t\t\tif (\n\t\t\t\tnodeRect.left >= targetRect.right ||\n\t\t\t\tnodeRect.right <= targetRect.left\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\treturn find( focusableNodes, isTabCandidate );\n}\n\nexport default function useArrowNav() {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetMultiSelectedBlocksEndClientId,\n\t\tgetPreviousBlockClientId,\n\t\tgetNextBlockClientId,\n\t\tgetSettings,\n\t\thasMultiSelection,\n\t} = useSelect( blockEditorStore );\n\treturn useRefEffect( ( node ) => {\n\t\t// Here a DOMRect is stored while moving the caret vertically so\n\t\t// vertical position of the start position can be restored. This is to\n\t\t// recreate browser behaviour across blocks.\n\t\tlet verticalRect;\n\n\t\tfunction onMouseDown() {\n\t\t\tverticalRect = null;\n\t\t}\n\n\t\t/**\n\t\t * Returns true if the given target field is the last in its block which\n\t\t * can be considered for tab transition. For example, in a block with\n\t\t * two text fields, this would return true when reversing from the first\n\t\t * of the two fields, but false when reversing from the second.\n\t\t *\n\t\t * @param {Element} target Currently focused text field.\n\t\t * @param {boolean} isReverse True if considering as the first field.\n\t\t *\n\t\t * @return {boolean} Whether field is at edge for tab transition.\n\t\t */\n\t\tfunction isTabbableEdge( target, isReverse ) {\n\t\t\tconst closestTabbable = getClosestTabbable(\n\t\t\t\ttarget,\n\t\t\t\tisReverse,\n\t\t\t\tnode\n\t\t\t);\n\t\t\treturn (\n\t\t\t\t! closestTabbable || ! isInSameBlock( target, closestTabbable )\n\t\t\t);\n\t\t}\n\n\t\tfunction onKeyDown( event ) {\n\t\t\tconst { keyCode, target } = event;\n\t\t\tconst isUp = keyCode === UP;\n\t\t\tconst isDown = keyCode === DOWN;\n\t\t\tconst isLeft = keyCode === LEFT;\n\t\t\tconst isRight = keyCode === RIGHT;\n\t\t\tconst isReverse = isUp || isLeft;\n\t\t\tconst isHorizontal = isLeft || isRight;\n\t\t\tconst isVertical = isUp || isDown;\n\t\t\tconst isNav = isHorizontal || isVertical;\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst hasModifier =\n\t\t\t\tisShift || event.ctrlKey || event.altKey || event.metaKey;\n\t\t\tconst isNavEdge = isVertical ? isVerticalEdge : isHorizontalEdge;\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\tif ( hasMultiSelection() ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// When presing any key other than up or down, the initial vertical\n\t\t\t// position must ALWAYS be reset. The vertical position is saved so\n\t\t\t// it can be restored as well as possible on sebsequent vertical\n\t\t\t// arrow key presses. It may not always be possible to restore the\n\t\t\t// exact same position (such as at an empty line), so it wouldn't be\n\t\t\t// good to compute the position right before any vertical arrow key\n\t\t\t// press.\n\t\t\tif ( ! isVertical ) {\n\t\t\t\tverticalRect = null;\n\t\t\t} else if ( ! verticalRect ) {\n\t\t\t\tverticalRect = computeCaretRect( defaultView );\n\t\t\t}\n\n\t\t\t// Abort if navigation has already been handled (e.g. RichText\n\t\t\t// inline boundaries).\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! isNav ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Abort if our current target is not a candidate for navigation\n\t\t\t// (e.g. preserve native input behaviors).\n\t\t\tif ( ! isNavigationCandidate( target, keyCode, hasModifier ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// In the case of RTL scripts, right means previous and left means\n\t\t\t// next, which is the exact reverse of LTR.\n\t\t\tconst isReverseDir = isRTL( target ) ? ! isReverse : isReverse;\n\t\t\tconst { keepCaretInsideBlock } = getSettings();\n\t\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\n\t\t\tif ( isShift ) {\n\t\t\t\tconst selectionEndClientId = getMultiSelectedBlocksEndClientId();\n\t\t\t\tconst selectionBeforeEndClientId = getPreviousBlockClientId(\n\t\t\t\t\tselectionEndClientId || selectedBlockClientId\n\t\t\t\t);\n\t\t\t\tconst selectionAfterEndClientId = getNextBlockClientId(\n\t\t\t\t\tselectionEndClientId || selectedBlockClientId\n\t\t\t\t);\n\n\t\t\t\tif (\n\t\t\t\t\t// Ensure that there is a target block.\n\t\t\t\t\t( ( isReverse && selectionBeforeEndClientId ) ||\n\t\t\t\t\t\t( ! isReverse && selectionAfterEndClientId ) ) &&\n\t\t\t\t\tisTabbableEdge( target, isReverse ) &&\n\t\t\t\t\tisNavEdge( target, isReverse )\n\t\t\t\t) {\n\t\t\t\t\tnode.contentEditable = true;\n\t\t\t\t\t// Firefox doesn't automatically move focus.\n\t\t\t\t\tnode.focus();\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tisVertical &&\n\t\t\t\tisVerticalEdge( target, isReverse ) &&\n\t\t\t\t! keepCaretInsideBlock\n\t\t\t) {\n\t\t\t\tconst closestTabbable = getClosestTabbable(\n\t\t\t\t\ttarget,\n\t\t\t\t\tisReverse,\n\t\t\t\t\tnode,\n\t\t\t\t\ttrue\n\t\t\t\t);\n\n\t\t\t\tif ( closestTabbable ) {\n\t\t\t\t\tplaceCaretAtVerticalEdge(\n\t\t\t\t\t\tclosestTabbable,\n\t\t\t\t\t\tisReverse,\n\t\t\t\t\t\tverticalRect\n\t\t\t\t\t);\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tisHorizontal &&\n\t\t\t\tdefaultView.getSelection().isCollapsed &&\n\t\t\t\tisHorizontalEdge( target, isReverseDir ) &&\n\t\t\t\t! keepCaretInsideBlock\n\t\t\t) {\n\t\t\t\tconst closestTabbable = getClosestTabbable(\n\t\t\t\t\ttarget,\n\t\t\t\t\tisReverseDir,\n\t\t\t\t\tnode\n\t\t\t\t);\n\t\t\t\tplaceCaretAtHorizontalEdge( closestTabbable, isReverse );\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\n\t\tnode.addEventListener( 'mousedown', onMouseDown );\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\treturn () => {\n\t\t\tnode.removeEventListener( 'mousedown', onMouseDown );\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t};\n\t}, [] );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/use-arrow-nav.js"],"names":["isNavigationCandidate","element","keyCode","hasModifier","isVertical","UP","DOWN","tagName","simpleInputTypes","includes","getAttribute","getClosestTabbable","target","isReverse","containerElement","onlyVertical","focusableNodes","focus","focusable","find","reverse","slice","indexOf","targetRect","getBoundingClientRect","isTabCandidate","node","tabbable","isTabbableIndex","isContentEditable","contentEditable","nodeRect","left","right","useArrowNav","getSelectedBlockClientId","getMultiSelectedBlocksEndClientId","getPreviousBlockClientId","getNextBlockClientId","getSettings","hasMultiSelection","blockEditorStore","verticalRect","onMouseDown","isTabbableEdge","closestTabbable","onKeyDown","event","isUp","isDown","isLeft","LEFT","isRight","RIGHT","isHorizontal","isNav","isShift","shiftKey","ctrlKey","altKey","metaKey","isNavEdge","isVerticalEdge","isHorizontalEdge","ownerDocument","defaultView","defaultPrevented","isReverseDir","keepCaretInsideBlock","selectedBlockClientId","selectionEndClientId","selectionBeforeEndClientId","selectionAfterEndClientId","preventDefault","getSelection","isCollapsed","addEventListener","removeEventListener"],"mappings":";;;;;;;;;AAGA;;AASA;;AACA;;AACA;;AAKA;;AACA;;AApBA;AACA;AACA;;AAcA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,qBAAT,CAAgCC,OAAhC,EAAyCC,OAAzC,EAAkDC,WAAlD,EAAgE;AACtE,QAAMC,UAAU,GAAGF,OAAO,KAAKG,YAAZ,IAAkBH,OAAO,KAAKI,cAAjD,CADsE,CAGtE;;AACA,MAAKF,UAAU,IAAI,CAAED,WAArB,EAAmC;AAClC,WAAO,IAAP;AACA;;AAED,QAAM;AAAEI,IAAAA;AAAF,MAAcN,OAApB,CARsE,CAUtE;;AACA,MAAKM,OAAO,KAAK,OAAjB,EAA2B;AAC1B,UAAMC,gBAAgB,GAAG,CACxB,QADwB,EAExB,UAFwB,EAGxB,OAHwB,EAIxB,MAJwB,EAKxB,OALwB,EA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nimport {\n\tcomputeCaretRect,\n\tfocus,\n\tisHorizontalEdge,\n\tisVerticalEdge,\n\tplaceCaretAtHorizontalEdge,\n\tplaceCaretAtVerticalEdge,\n\tisRTL,\n} from '@wordpress/dom';\nimport { UP, DOWN, LEFT, RIGHT } from '@wordpress/keycodes';\nimport { useSelect } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { isInSameBlock } from '../../utils/dom';\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Returns true if the element should consider edge navigation upon a keyboard\n * event of the given directional key code, or false otherwise.\n *\n * @param {Element} element HTML element to test.\n * @param {number} keyCode KeyboardEvent keyCode to test.\n * @param {boolean} hasModifier Whether a modifier is pressed.\n *\n * @return {boolean} Whether element should consider edge navigation.\n */\nexport function isNavigationCandidate( element, keyCode, hasModifier ) {\n\tconst isVertical = keyCode === UP || keyCode === DOWN;\n\n\t// Currently, all elements support unmodified vertical navigation.\n\tif ( isVertical && ! hasModifier ) {\n\t\treturn true;\n\t}\n\n\tconst { tagName } = element;\n\n\t// Native inputs should not navigate horizontally, unless they are simple types that don't need left/right arrow keys.\n\tif ( tagName === 'INPUT' ) {\n\t\tconst simpleInputTypes = [\n\t\t\t'button',\n\t\t\t'checkbox',\n\t\t\t'color',\n\t\t\t'file',\n\t\t\t'image',\n\t\t\t'radio',\n\t\t\t'reset',\n\t\t\t'submit',\n\t\t];\n\t\treturn simpleInputTypes.includes( element.getAttribute( 'type' ) );\n\t}\n\n\t// Native textareas should not navigate horizontally.\n\treturn tagName !== 'TEXTAREA';\n}\n\n/**\n * Returns the optimal tab target from the given focused element in the desired\n * direction. A preference is made toward text fields, falling back to the block\n * focus stop if no other candidates exist for the block.\n *\n * @param {Element} target Currently focused text field.\n * @param {boolean} isReverse True if considering as the first field.\n * @param {Element} containerElement Element containing all blocks.\n * @param {boolean} onlyVertical Whether to only consider tabbable elements\n * that are visually above or under the\n * target.\n *\n * @return {?Element} Optimal tab target, if one exists.\n */\nexport function getClosestTabbable(\n\ttarget,\n\tisReverse,\n\tcontainerElement,\n\tonlyVertical\n) {\n\t// Since the current focus target is not guaranteed to be a text field, find\n\t// all focusables. Tabbability is considered later.\n\tlet focusableNodes = focus.focusable.find( containerElement );\n\n\tif ( isReverse ) {\n\t\tfocusableNodes.reverse();\n\t}\n\n\t// Consider as candidates those focusables after the current target. It's\n\t// assumed this can only be reached if the target is focusable (on its\n\t// keydown event), so no need to verify it exists in the set.\n\tfocusableNodes = focusableNodes.slice(\n\t\tfocusableNodes.indexOf( target ) + 1\n\t);\n\n\tlet targetRect;\n\n\tif ( onlyVertical ) {\n\t\ttargetRect = target.getBoundingClientRect();\n\t}\n\n\tfunction isTabCandidate( node ) {\n\t\t// Not a candidate if the node is not tabbable.\n\t\tif ( ! focus.tabbable.isTabbableIndex( node ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Skip focusable elements such as links within content editable nodes.\n\t\tif ( node.isContentEditable && node.contentEditable !== 'true' ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ( onlyVertical ) {\n\t\t\tconst nodeRect = node.getBoundingClientRect();\n\n\t\t\tif (\n\t\t\t\tnodeRect.left >= targetRect.right ||\n\t\t\t\tnodeRect.right <= targetRect.left\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\treturn focusableNodes.find( isTabCandidate );\n}\n\nexport default function useArrowNav() {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetMultiSelectedBlocksEndClientId,\n\t\tgetPreviousBlockClientId,\n\t\tgetNextBlockClientId,\n\t\tgetSettings,\n\t\thasMultiSelection,\n\t} = useSelect( blockEditorStore );\n\treturn useRefEffect( ( node ) => {\n\t\t// Here a DOMRect is stored while moving the caret vertically so\n\t\t// vertical position of the start position can be restored. This is to\n\t\t// recreate browser behaviour across blocks.\n\t\tlet verticalRect;\n\n\t\tfunction onMouseDown() {\n\t\t\tverticalRect = null;\n\t\t}\n\n\t\t/**\n\t\t * Returns true if the given target field is the last in its block which\n\t\t * can be considered for tab transition. For example, in a block with\n\t\t * two text fields, this would return true when reversing from the first\n\t\t * of the two fields, but false when reversing from the second.\n\t\t *\n\t\t * @param {Element} target Currently focused text field.\n\t\t * @param {boolean} isReverse True if considering as the first field.\n\t\t *\n\t\t * @return {boolean} Whether field is at edge for tab transition.\n\t\t */\n\t\tfunction isTabbableEdge( target, isReverse ) {\n\t\t\tconst closestTabbable = getClosestTabbable(\n\t\t\t\ttarget,\n\t\t\t\tisReverse,\n\t\t\t\tnode\n\t\t\t);\n\t\t\treturn (\n\t\t\t\t! closestTabbable || ! isInSameBlock( target, closestTabbable )\n\t\t\t);\n\t\t}\n\n\t\tfunction onKeyDown( event ) {\n\t\t\tconst { keyCode, target } = event;\n\t\t\tconst isUp = keyCode === UP;\n\t\t\tconst isDown = keyCode === DOWN;\n\t\t\tconst isLeft = keyCode === LEFT;\n\t\t\tconst isRight = keyCode === RIGHT;\n\t\t\tconst isReverse = isUp || isLeft;\n\t\t\tconst isHorizontal = isLeft || isRight;\n\t\t\tconst isVertical = isUp || isDown;\n\t\t\tconst isNav = isHorizontal || isVertical;\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst hasModifier =\n\t\t\t\tisShift || event.ctrlKey || event.altKey || event.metaKey;\n\t\t\tconst isNavEdge = isVertical ? isVerticalEdge : isHorizontalEdge;\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\tif ( hasMultiSelection() ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// When presing any key other than up or down, the initial vertical\n\t\t\t// position must ALWAYS be reset. The vertical position is saved so\n\t\t\t// it can be restored as well as possible on sebsequent vertical\n\t\t\t// arrow key presses. It may not always be possible to restore the\n\t\t\t// exact same position (such as at an empty line), so it wouldn't be\n\t\t\t// good to compute the position right before any vertical arrow key\n\t\t\t// press.\n\t\t\tif ( ! isVertical ) {\n\t\t\t\tverticalRect = null;\n\t\t\t} else if ( ! verticalRect ) {\n\t\t\t\tverticalRect = computeCaretRect( defaultView );\n\t\t\t}\n\n\t\t\t// Abort if navigation has already been handled (e.g. RichText\n\t\t\t// inline boundaries).\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! isNav ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Abort if our current target is not a candidate for navigation\n\t\t\t// (e.g. preserve native input behaviors).\n\t\t\tif ( ! isNavigationCandidate( target, keyCode, hasModifier ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// In the case of RTL scripts, right means previous and left means\n\t\t\t// next, which is the exact reverse of LTR.\n\t\t\tconst isReverseDir = isRTL( target ) ? ! isReverse : isReverse;\n\t\t\tconst { keepCaretInsideBlock } = getSettings();\n\t\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\n\t\t\tif ( isShift ) {\n\t\t\t\tconst selectionEndClientId =\n\t\t\t\t\tgetMultiSelectedBlocksEndClientId();\n\t\t\t\tconst selectionBeforeEndClientId = getPreviousBlockClientId(\n\t\t\t\t\tselectionEndClientId || selectedBlockClientId\n\t\t\t\t);\n\t\t\t\tconst selectionAfterEndClientId = getNextBlockClientId(\n\t\t\t\t\tselectionEndClientId || selectedBlockClientId\n\t\t\t\t);\n\n\t\t\t\tif (\n\t\t\t\t\t// Ensure that there is a target block.\n\t\t\t\t\t( ( isReverse && selectionBeforeEndClientId ) ||\n\t\t\t\t\t\t( ! isReverse && selectionAfterEndClientId ) ) &&\n\t\t\t\t\tisTabbableEdge( target, isReverse ) &&\n\t\t\t\t\tisNavEdge( target, isReverse )\n\t\t\t\t) {\n\t\t\t\t\tnode.contentEditable = true;\n\t\t\t\t\t// Firefox doesn't automatically move focus.\n\t\t\t\t\tnode.focus();\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tisVertical &&\n\t\t\t\tisVerticalEdge( target, isReverse ) &&\n\t\t\t\t! keepCaretInsideBlock\n\t\t\t) {\n\t\t\t\tconst closestTabbable = getClosestTabbable(\n\t\t\t\t\ttarget,\n\t\t\t\t\tisReverse,\n\t\t\t\t\tnode,\n\t\t\t\t\ttrue\n\t\t\t\t);\n\n\t\t\t\tif ( closestTabbable ) {\n\t\t\t\t\tplaceCaretAtVerticalEdge(\n\t\t\t\t\t\tclosestTabbable,\n\t\t\t\t\t\tisReverse,\n\t\t\t\t\t\tverticalRect\n\t\t\t\t\t);\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tisHorizontal &&\n\t\t\t\tdefaultView.getSelection().isCollapsed &&\n\t\t\t\tisHorizontalEdge( target, isReverseDir ) &&\n\t\t\t\t! keepCaretInsideBlock\n\t\t\t) {\n\t\t\t\tconst closestTabbable = getClosestTabbable(\n\t\t\t\t\ttarget,\n\t\t\t\t\tisReverseDir,\n\t\t\t\t\tnode\n\t\t\t\t);\n\t\t\t\tplaceCaretAtHorizontalEdge( closestTabbable, isReverse );\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\n\t\tnode.addEventListener( 'mousedown', onMouseDown );\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\treturn () => {\n\t\t\tnode.removeEventListener( 'mousedown', onMouseDown );\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t};\n\t}, [] );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/use-click-selection.js"],"names":["useClickSelection","selectBlock","blockEditorStore","isSelectionEnabled","getBlockSelectionStart","hasMultiSelection","node","onMouseDown","event","button","startClientId","clickedClientId","target","shiftKey","contentEditable","focus","addEventListener","removeEventListener"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIe,SAASA,iBAAT,GAA6B;AAC3C,QAAM;AAAEC,IAAAA;AAAF,MAAkB,uBAAaC,YAAb,CAAxB;AACA,QAAM;AACLC,IAAAA,kBADK;AAELC,IAAAA,sBAFK;AAGLC,IAAAA;AAHK,MAIF,qBAAWH,YAAX,CAJJ;AAKA,SAAO,2BACJI,IAAF,IAAY;AACX,aAASC,WAAT,CAAsBC,KAAtB,EAA8B;AAC7B;AACA;AACA,UAAK,CAAEL,kBAAkB,EAApB,IAA0BK,KAAK,CAACC,MAAN,KAAiB,CAAhD,EAAoD;AACnD;AACA;;AAED,YAAMC,aAAa,GAAGN,sBAAsB,EAA5C;AACA,YAAMO,eAAe,GAAG,2BAAkBH,KAAK,CAACI,MAAxB,CAAxB;;AAEA,UAAKJ,KAAK,CAACK,QAAX,EAAsB;AACrB,YAAKH,aAAa,KAAKC,eAAvB,EAAyC;AACxCL,UAAAA,IAAI,CAACQ,eAAL,GAAuB,IAAvB,CADwC,CAExC;;AACAR,UAAAA,IAAI,CAACS,KAAL;AACA;AACD,OAND,MAMO,IAAKV,iBAAiB,EAAtB,EAA2B;AACjC;AACA;AACA;AACA;AACA;AACA;AACAJ,QAAAA,WAAW,CAAEU,eAAF,CAAX;AACA;AACD;;AAEDL,IAAAA,IAAI,CAACU,gBAAL,CAAuB,WAAvB,EAAoCT,WAApC;AAEA,WAAO,MAAM;AACZD,MAAAA,IAAI,CAACW,mBAAL,CAA0B,WAA1B,EAAuCV,WAAvC;AACA,KAFD;AAGA,GAlCK,EAmCN,CACCN,WADD,EAECE,kBAFD,EAGCC,sBAHD,EAICC,iBAJD,CAnCM,CAAP;AA0CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { getBlockClientId } from '../../utils/dom';\n\nexport default function useClickSelection() {\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst {\n\t\tisSelectionEnabled,\n\t\tgetBlockSelectionStart,\n\t\thasMultiSelection,\n\t} = useSelect( blockEditorStore );\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tfunction onMouseDown( event ) {\n\t\t\t\t// The main button.\n\t\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button\n\t\t\t\tif ( ! isSelectionEnabled() || event.button !== 0 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst startClientId = getBlockSelectionStart();\n\t\t\t\tconst clickedClientId = getBlockClientId( event.target );\n\n\t\t\t\tif ( event.shiftKey ) {\n\t\t\t\t\tif ( startClientId !== clickedClientId ) {\n\t\t\t\t\t\tnode.contentEditable = true;\n\t\t\t\t\t\t// Firefox doesn't automatically move focus.\n\t\t\t\t\t\tnode.focus();\n\t\t\t\t\t}\n\t\t\t\t} else if ( hasMultiSelection() ) {\n\t\t\t\t\t// Allow user to escape out of a multi-selection to a\n\t\t\t\t\t// singular selection of a block via click. This is handled\n\t\t\t\t\t// here since focus handling excludes blocks when there is\n\t\t\t\t\t// multiselection, as focus can be incurred by starting a\n\t\t\t\t\t// multiselection (focus moved to first block's multi-\n\t\t\t\t\t// controls).\n\t\t\t\t\tselectBlock( clickedClientId );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'mousedown', onMouseDown );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'mousedown', onMouseDown );\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tselectBlock,\n\t\t\tisSelectionEnabled,\n\t\t\tgetBlockSelectionStart,\n\t\t\thasMultiSelection,\n\t\t]\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/use-click-selection.js"],"names":["useClickSelection","selectBlock","blockEditorStore","isSelectionEnabled","getBlockSelectionStart","hasMultiSelection","node","onMouseDown","event","button","startClientId","clickedClientId","target","shiftKey","contentEditable","focus","addEventListener","removeEventListener"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIe,SAASA,iBAAT,GAA6B;AAC3C,QAAM;AAAEC,IAAAA;AAAF,MAAkB,uBAAaC,YAAb,CAAxB;AACA,QAAM;AAAEC,IAAAA,kBAAF;AAAsBC,IAAAA,sBAAtB;AAA8CC,IAAAA;AAA9C,MACL,qBAAWH,YAAX,CADD;AAEA,SAAO,2BACJI,IAAF,IAAY;AACX,aAASC,WAAT,CAAsBC,KAAtB,EAA8B;AAC7B;AACA;AACA,UAAK,CAAEL,kBAAkB,EAApB,IAA0BK,KAAK,CAACC,MAAN,KAAiB,CAAhD,EAAoD;AACnD;AACA;;AAED,YAAMC,aAAa,GAAGN,sBAAsB,EAA5C;AACA,YAAMO,eAAe,GAAG,2BAAkBH,KAAK,CAACI,MAAxB,CAAxB;;AAEA,UAAKJ,KAAK,CAACK,QAAX,EAAsB;AACrB,YAAKH,aAAa,KAAKC,eAAvB,EAAyC;AACxCL,UAAAA,IAAI,CAACQ,eAAL,GAAuB,IAAvB,CADwC,CAExC;;AACAR,UAAAA,IAAI,CAACS,KAAL;AACA;AACD,OAND,MAMO,IAAKV,iBAAiB,EAAtB,EAA2B;AACjC;AACA;AACA;AACA;AACA;AACA;AACAJ,QAAAA,WAAW,CAAEU,eAAF,CAAX;AACA;AACD;;AAEDL,IAAAA,IAAI,CAACU,gBAAL,CAAuB,WAAvB,EAAoCT,WAApC;AAEA,WAAO,MAAM;AACZD,MAAAA,IAAI,CAACW,mBAAL,CAA0B,WAA1B,EAAuCV,WAAvC;AACA,KAFD;AAGA,GAlCK,EAmCN,CACCN,WADD,EAECE,kBAFD,EAGCC,sBAHD,EAICC,iBAJD,CAnCM,CAAP;AA0CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { getBlockClientId } from '../../utils/dom';\n\nexport default function useClickSelection() {\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst { isSelectionEnabled, getBlockSelectionStart, hasMultiSelection } =\n\t\tuseSelect( blockEditorStore );\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tfunction onMouseDown( event ) {\n\t\t\t\t// The main button.\n\t\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button\n\t\t\t\tif ( ! isSelectionEnabled() || event.button !== 0 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst startClientId = getBlockSelectionStart();\n\t\t\t\tconst clickedClientId = getBlockClientId( event.target );\n\n\t\t\t\tif ( event.shiftKey ) {\n\t\t\t\t\tif ( startClientId !== clickedClientId ) {\n\t\t\t\t\t\tnode.contentEditable = true;\n\t\t\t\t\t\t// Firefox doesn't automatically move focus.\n\t\t\t\t\t\tnode.focus();\n\t\t\t\t\t}\n\t\t\t\t} else if ( hasMultiSelection() ) {\n\t\t\t\t\t// Allow user to escape out of a multi-selection to a\n\t\t\t\t\t// singular selection of a block via click. This is handled\n\t\t\t\t\t// here since focus handling excludes blocks when there is\n\t\t\t\t\t// multiselection, as focus can be incurred by starting a\n\t\t\t\t\t// multiselection (focus moved to first block's multi-\n\t\t\t\t\t// controls).\n\t\t\t\t\tselectBlock( clickedClientId );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'mousedown', onMouseDown );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'mousedown', onMouseDown );\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tselectBlock,\n\t\t\tisSelectionEnabled,\n\t\t\tgetBlockSelectionStart,\n\t\t\thasMultiSelection,\n\t\t]\n\t);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/use-drag-selection.js"],"names":["setContentEditableWrapper","node","value","contentEditable","focus","useDragSelection","startMultiSelect","stopMultiSelect","blockEditorStore","isSelectionEnabled","hasMultiSelection","ownerDocument","defaultView","anchorElement","rafId","onMouseUp","removeEventListener","requestAnimationFrame","selection","getSelection","rangeCount","commonAncestorContainer","getRangeAt","contains","onMouseLeave","buttons","target","getAttribute","activeElement","addEventListener","cancelAnimationFrame"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,yBAAT,CAAoCC,IAApC,EAA0CC,KAA1C,EAAkD;AACjDD,EAAAA,IAAI,CAACE,eAAL,GAAuBD,KAAvB,CADiD,CAEjD;;AACA,MAAKA,KAAL,EAAaD,IAAI,CAACG,KAAL;AACb;AAED;AACA;AACA;;;AACe,SAASC,gBAAT,GAA4B;AAC1C,QAAM;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,MAAwC,uBAC7CC,YAD6C,CAA9C;AAGA,QAAM;AAAEC,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,MAA4C,qBACjDF,YADiD,CAAlD;AAGA,SAAO,2BACJP,IAAF,IAAY;AACX,UAAM;AAAEU,MAAAA;AAAF,QAAoBV,IAA1B;AACA,UAAM;AAAEW,MAAAA;AAAF,QAAkBD,aAAxB;AAEA,QAAIE,aAAJ;AACA,QAAIC,KAAJ;;AAEA,aAASC,SAAT,GAAqB;AACpBR,MAAAA,eAAe,GADK,CAEpB;;AACAK,MAAAA,WAAW,CAACI,mBAAZ,CAAiC,SAAjC,EAA4CD,SAA5C,EAHoB,CAIpB;AACA;AACA;;AACAD,MAAAA,KAAK,GAAGF,WAAW,CAACK,qBAAZ,CAAmC,MAAM;AAChD,YAAKP,iBAAiB,EAAtB,EAA2B;AAC1B;AACA,SAH+C,CAKhD;AACA;AACA;AACA;AACA;;;AACAV,QAAAA,yBAAyB,CAAEC,IAAF,EAAQ,KAAR,CAAzB;AAEA,cAAMiB,SAAS,GAAGN,WAAW,CAACO,YAAZ,EAAlB;;AAEA,YAAKD,SAAS,CAACE,UAAf,EAA4B;AAC3B,gBAAM;AACLC,YAAAA;AADK,cAEFH,SAAS,CAACI,UAAV,CAAsB,CAAtB,CAFJ;;AAIA,cACCT,aAAa,CAACU,QAAd,CAAwBF,uBAAxB,CADD,EAEE;AACDR,YAAAA,aAAa,CAACT,KAAd;AACA;AACD;AACD,OAzBO,CAAR;AA0BA;;AAED,aAASoB,YAAT,OAA6C;AAAA,UAAtB;AAAEC,QAAAA,OAAF;AAAWC,QAAAA;AAAX,OAAsB;;AAC5C;AACA;AACA,UAAKD,OAAO,KAAK,CAAjB,EAAqB;AACpB;AACA,OAL2C,CAO5C;AACA;AACA;AACA;;;AACA,UAAK,CAAEC,MAAM,CAACC,YAAP,CAAqB,iBAArB,CAAP,EAAkD;AACjD;AACA;;AAED,UAAK,CAAElB,kBAAkB,EAAzB,EAA8B;AAC7B;AACA;;AAEDI,MAAAA,aAAa,GAAGF,aAAa,CAACiB,aAA9B;AACAtB,MAAAA,gBAAgB,GApB4B,CAsB5C;AACA;AACA;;AACAM,MAAAA,WAAW,CAACiB,gBAAZ,CAA8B,SAA9B,EAAyCd,SAAzC,EAzB4C,CA2B5C;AACA;AACA;AACA;;AACAf,MAAAA,yBAAyB,CAAEC,IAAF,EAAQ,IAAR,CAAzB;AACA;;AAEDA,IAAAA,IAAI,CAAC4B,gBAAL,CAAuB,UAAvB,EAAmCL,YAAnC;AAEA,WAAO,MAAM;AACZvB,MAAAA,IAAI,CAACe,mBAAL,CAA0B,UAA1B,EAAsCQ,YAAtC;AACAZ,MAAAA,WAAW,CAACI,mBAAZ,CAAiC,SAAjC,EAA4CD,SAA5C;AACAH,MAAAA,WAAW,CAACkB,oBAAZ,CAAkChB,KAAlC;AACA,KAJD;AAKA,GApFK,EAqFN,CACCR,gBADD,EAECC,eAFD,EAGCE,kBAHD,EAICC,iBAJD,CArFM,CAAP;AA4FA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Sets the `contenteditable` wrapper element to `value`.\n *\n * @param {HTMLElement} node Block element.\n * @param {boolean} value `contentEditable` value (true or false)\n */\nfunction setContentEditableWrapper( node, value ) {\n\tnode.contentEditable = value;\n\t// Firefox doesn't automatically move focus.\n\tif ( value ) node.focus();\n}\n\n/**\n * Sets a multi-selection based on the native selection across blocks.\n */\nexport default function useDragSelection() {\n\tconst { startMultiSelect, stopMultiSelect } = useDispatch(\n\t\tblockEditorStore\n\t);\n\tconst { isSelectionEnabled, hasMultiSelection } = useSelect(\n\t\tblockEditorStore\n\t);\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\tlet anchorElement;\n\t\t\tlet rafId;\n\n\t\t\tfunction onMouseUp() {\n\t\t\t\tstopMultiSelect();\n\t\t\t\t// Equivalent to attaching the listener once.\n\t\t\t\tdefaultView.removeEventListener( 'mouseup', onMouseUp );\n\t\t\t\t// The browser selection won't have updated yet at this point,\n\t\t\t\t// so wait until the next animation frame to get the browser\n\t\t\t\t// selection.\n\t\t\t\trafId = defaultView.requestAnimationFrame( () => {\n\t\t\t\t\tif ( hasMultiSelection() ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// If the selection is complete (on mouse up), and no\n\t\t\t\t\t// multiple blocks have been selected, set focus back to the\n\t\t\t\t\t// anchor element. if the anchor element contains the\n\t\t\t\t\t// selection. Additionally, the contentEditable wrapper can\n\t\t\t\t\t// now be disabled again.\n\t\t\t\t\tsetContentEditableWrapper( node, false );\n\n\t\t\t\t\tconst selection = defaultView.getSelection();\n\n\t\t\t\t\tif ( selection.rangeCount ) {\n\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\tcommonAncestorContainer,\n\t\t\t\t\t\t} = selection.getRangeAt( 0 );\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tanchorElement.contains( commonAncestorContainer )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tanchorElement.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tfunction onMouseLeave( { buttons, target } ) {\n\t\t\t\t// The primary button must be pressed to initiate selection.\n\t\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons\n\t\t\t\tif ( buttons !== 1 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Check the attribute, not the contentEditable attribute. All\n\t\t\t\t// child elements of the content editable wrapper are editable\n\t\t\t\t// and return true for this property. We only want to start\n\t\t\t\t// multi selecting when the mouse leaves the wrapper.\n\t\t\t\tif ( ! target.getAttribute( 'contenteditable' ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( ! isSelectionEnabled() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tanchorElement = ownerDocument.activeElement;\n\t\t\t\tstartMultiSelect();\n\n\t\t\t\t// `onSelectionStart` is called after `mousedown` and\n\t\t\t\t// `mouseleave` (from a block). The selection ends when\n\t\t\t\t// `mouseup` happens anywhere in the window.\n\t\t\t\tdefaultView.addEventListener( 'mouseup', onMouseUp );\n\n\t\t\t\t// Allow cross contentEditable selection by temporarily making\n\t\t\t\t// all content editable. We can't rely on using the store and\n\t\t\t\t// React because re-rending happens too slowly. We need to be\n\t\t\t\t// able to select across instances immediately.\n\t\t\t\tsetContentEditableWrapper( node, true );\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'mouseout', onMouseLeave );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'mouseout', onMouseLeave );\n\t\t\t\tdefaultView.removeEventListener( 'mouseup', onMouseUp );\n\t\t\t\tdefaultView.cancelAnimationFrame( rafId );\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tstartMultiSelect,\n\t\t\tstopMultiSelect,\n\t\t\tisSelectionEnabled,\n\t\t\thasMultiSelection,\n\t\t]\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/use-drag-selection.js"],"names":["setContentEditableWrapper","node","value","contentEditable","focus","useDragSelection","startMultiSelect","stopMultiSelect","blockEditorStore","isSelectionEnabled","hasMultiSelection","ownerDocument","defaultView","anchorElement","rafId","onMouseUp","removeEventListener","requestAnimationFrame","selection","getSelection","rangeCount","commonAncestorContainer","getRangeAt","contains","onMouseLeave","buttons","target","getAttribute","activeElement","addEventListener","cancelAnimationFrame"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,yBAAT,CAAoCC,IAApC,EAA0CC,KAA1C,EAAkD;AACjDD,EAAAA,IAAI,CAACE,eAAL,GAAuBD,KAAvB,CADiD,CAEjD;;AACA,MAAKA,KAAL,EAAaD,IAAI,CAACG,KAAL;AACb;AAED;AACA;AACA;;;AACe,SAASC,gBAAT,GAA4B;AAC1C,QAAM;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,MACL,uBAAaC,YAAb,CADD;AAEA,QAAM;AAAEC,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,MACL,qBAAWF,YAAX,CADD;AAEA,SAAO,2BACJP,IAAF,IAAY;AACX,UAAM;AAAEU,MAAAA;AAAF,QAAoBV,IAA1B;AACA,UAAM;AAAEW,MAAAA;AAAF,QAAkBD,aAAxB;AAEA,QAAIE,aAAJ;AACA,QAAIC,KAAJ;;AAEA,aAASC,SAAT,GAAqB;AACpBR,MAAAA,eAAe,GADK,CAEpB;;AACAK,MAAAA,WAAW,CAACI,mBAAZ,CAAiC,SAAjC,EAA4CD,SAA5C,EAHoB,CAIpB;AACA;AACA;;AACAD,MAAAA,KAAK,GAAGF,WAAW,CAACK,qBAAZ,CAAmC,MAAM;AAChD,YAAKP,iBAAiB,EAAtB,EAA2B;AAC1B;AACA,SAH+C,CAKhD;A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oFN,CACCR,gBADD,EAECC,eAFD,EAGCE,kBAHD,EAICC,iBAJD,CApFM,CAAP;AA2FA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Sets the `contenteditable` wrapper element to `value`.\n *\n * @param {HTMLElement} node Block element.\n * @param {boolean} value `contentEditable` value (true or false)\n */\nfunction setContentEditableWrapper( node, value ) {\n\tnode.contentEditable = value;\n\t// Firefox doesn't automatically move focus.\n\tif ( value ) node.focus();\n}\n\n/**\n * Sets a multi-selection based on the native selection across blocks.\n */\nexport default function useDragSelection() {\n\tconst { startMultiSelect, stopMultiSelect } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { isSelectionEnabled, hasMultiSelection } =\n\t\tuseSelect( blockEditorStore );\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\tlet anchorElement;\n\t\t\tlet rafId;\n\n\t\t\tfunction onMouseUp() {\n\t\t\t\tstopMultiSelect();\n\t\t\t\t// Equivalent to attaching the listener once.\n\t\t\t\tdefaultView.removeEventListener( 'mouseup', onMouseUp );\n\t\t\t\t// The browser selection won't have updated yet at this point,\n\t\t\t\t// so wait until the next animation frame to get the browser\n\t\t\t\t// selection.\n\t\t\t\trafId = defaultView.requestAnimationFrame( () => {\n\t\t\t\t\tif ( hasMultiSelection() ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// If the selection is complete (on mouse up), and no\n\t\t\t\t\t// multiple blocks have been selected, set focus back to the\n\t\t\t\t\t// anchor element. if the anchor element contains the\n\t\t\t\t\t// selection. Additionally, the contentEditable wrapper can\n\t\t\t\t\t// now be disabled again.\n\t\t\t\t\tsetContentEditableWrapper( node, false );\n\n\t\t\t\t\tconst selection = defaultView.getSelection();\n\n\t\t\t\t\tif ( selection.rangeCount ) {\n\t\t\t\t\t\tconst { commonAncestorContainer } =\n\t\t\t\t\t\t\tselection.getRangeAt( 0 );\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tanchorElement.contains( commonAncestorContainer )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tanchorElement.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tfunction onMouseLeave( { buttons, target } ) {\n\t\t\t\t// The primary button must be pressed to initiate selection.\n\t\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons\n\t\t\t\tif ( buttons !== 1 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Check the attribute, not the contentEditable attribute. All\n\t\t\t\t// child elements of the content editable wrapper are editable\n\t\t\t\t// and return true for this property. We only want to start\n\t\t\t\t// multi selecting when the mouse leaves the wrapper.\n\t\t\t\tif ( ! target.getAttribute( 'contenteditable' ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( ! isSelectionEnabled() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tanchorElement = ownerDocument.activeElement;\n\t\t\t\tstartMultiSelect();\n\n\t\t\t\t// `onSelectionStart` is called after `mousedown` and\n\t\t\t\t// `mouseleave` (from a block). The selection ends when\n\t\t\t\t// `mouseup` happens anywhere in the window.\n\t\t\t\tdefaultView.addEventListener( 'mouseup', onMouseUp );\n\n\t\t\t\t// Allow cross contentEditable selection by temporarily making\n\t\t\t\t// all content editable. We can't rely on using the store and\n\t\t\t\t// React because re-rending happens too slowly. We need to be\n\t\t\t\t// able to select across instances immediately.\n\t\t\t\tsetContentEditableWrapper( node, true );\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'mouseout', onMouseLeave );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'mouseout', onMouseLeave );\n\t\t\t\tdefaultView.removeEventListener( 'mouseup', onMouseUp );\n\t\t\t\tdefaultView.cancelAnimationFrame( rafId );\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tstartMultiSelect,\n\t\t\tstopMultiSelect,\n\t\t\tisSelectionEnabled,\n\t\t\thasMultiSelection,\n\t\t]\n\t);\n}\n"]}
@@ -41,6 +41,19 @@ function useInput() {
41
41
  __unstableExpandSelection
42
42
  } = (0, _data.useDispatch)(_store.store);
43
43
  return (0, _compose.useRefEffect)(node => {
44
+ function onBeforeInput(event) {
45
+ var _event$inputType;
46
+
47
+ if (!hasMultiSelection()) {
48
+ return;
49
+ } // Prevent the browser to format something when we have multiselection.
50
+
51
+
52
+ if ((_event$inputType = event.inputType) !== null && _event$inputType !== void 0 && _event$inputType.startsWith('format')) {
53
+ event.preventDefault();
54
+ }
55
+ }
56
+
44
57
  function onKeyDown(event) {
45
58
  if (event.defaultPrevented) {
46
59
  return;
@@ -105,9 +118,11 @@ function useInput() {
105
118
  }
106
119
  }
107
120
 
121
+ node.addEventListener('beforeinput', onBeforeInput);
108
122
  node.addEventListener('keydown', onKeyDown);
109
123
  node.addEventListener('compositionstart', onCompositionStart);
110
124
  return () => {
125
+ node.removeEventListener('beforeinput', onBeforeInput);
111
126
  node.removeEventListener('keydown', onKeyDown);
112
127
  node.removeEventListener('compositionstart', onCompositionStart);
113
128
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/use-input.js"],"names":["useInput","__unstableIsFullySelected","getSelectedBlockClientIds","__unstableIsSelectionMergeable","hasMultiSelection","blockEditorStore","replaceBlocks","__unstableSplitSelection","removeBlocks","__unstableDeleteSelection","__unstableExpandSelection","node","onKeyDown","event","defaultPrevented","keyCode","ENTER","contentEditable","preventDefault","BACKSPACE","DELETE","key","length","metaKey","ctrlKey","ownerDocument","defaultView","getSelection","removeAllRanges","onCompositionStart","addEventListener","removeEventListener"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;A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B;AACD,OAbM,MAaA,KACN;AACA;AACAG,MAAAA,KAAK,CAACQ,GAAN,CAAUC,MAAV,KAAqB,CAArB,IACA,EAAIT,KAAK,CAACU,OAAN,IAAiBV,KAAK,CAACW,OAA3B,CAJM,EAKL;AACDb,QAAAA,IAAI,CAACM,eAAL,GAAuB,KAAvB;;AACA,YAAKd,8BAA8B,EAAnC,EAAwC;AACvCM,UAAAA,yBAAyB,CAAEI,KAAK,CAACE,OAAN,KAAkBK,gBAApB,CAAzB;AACA,SAFD,MAEO;AACNP,UAAAA,KAAK,CAACK,cAAN,GADM,CAEN;AACA;AACA;;AACAP,UAAAA,IAAI,CAACc,aAAL,CAAmBC,WAAnB,CACEC,YADF,GAEEC,eAFF;AAGA;AACD;AACD;;AAED,aAASC,kBAAT,CAA6BhB,KAA7B,EAAqC;AACpC,UAAK,CAAET,iBAAiB,EAAxB,EAA6B;AAC5B;AACA;;AAEDO,MAAAA,IAAI,CAACM,eAAL,GAAuB,KAAvB;;AAEA,UAAKd,8BAA8B,EAAnC,EAAwC;AACvCM,QAAAA,yBAAyB;AACzB,OAFD,MAEO;AACNI,QAAAA,KAAK,CAACK,cAAN,GADM,CAEN;AACA;AACA;;AACAP,QAAAA,IAAI,CAACc,aAAL,CAAmBC,WAAnB,CAA+BC,YAA/B,GAA8CC,eAA9C;AACA;AACD;;AAEDjB,IAAAA,IAAI,CAACmB,gBAAL,CAAuB,SAAvB,EAAkClB,SAAlC;AACAD,IAAAA,IAAI,CAACmB,gBAAL,CAAuB,kBAAvB,EAA2CD,kBAA3C;AACA,WAAO,MAAM;AACZlB,MAAAA,IAAI,CAACoB,mBAAL,CAA0B,SAA1B,EAAqCnB,SAArC;AACAD,MAAAA,IAAI,CAACoB,mBAAL,CAA0B,kBAA1B,EAA8CF,kBAA9C;AACA,KAHD;AAIA,GA/EM,EA+EJ,EA/EI,CAAP;AAgFA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\nimport { ENTER, BACKSPACE, DELETE } from '@wordpress/keycodes';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Handles input for selections across blocks.\n */\nexport default function useInput() {\n\tconst {\n\t\t__unstableIsFullySelected,\n\t\tgetSelectedBlockClientIds,\n\t\t__unstableIsSelectionMergeable,\n\t\thasMultiSelection,\n\t} = useSelect( blockEditorStore );\n\tconst {\n\t\treplaceBlocks,\n\t\t__unstableSplitSelection,\n\t\tremoveBlocks,\n\t\t__unstableDeleteSelection,\n\t\t__unstableExpandSelection,\n\t} = useDispatch( blockEditorStore );\n\n\treturn useRefEffect( ( node ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! hasMultiSelection() ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.keyCode === ENTER ) {\n\t\t\t\tnode.contentEditable = false;\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif ( __unstableIsFullySelected() ) {\n\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\tgetSelectedBlockClientIds(),\n\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\t__unstableSplitSelection();\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tevent.keyCode === BACKSPACE ||\n\t\t\t\tevent.keyCode === DELETE\n\t\t\t) {\n\t\t\t\tnode.contentEditable = false;\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif ( __unstableIsFullySelected() ) {\n\t\t\t\t\tremoveBlocks( getSelectedBlockClientIds() );\n\t\t\t\t} else if ( __unstableIsSelectionMergeable() ) {\n\t\t\t\t\t__unstableDeleteSelection( event.keyCode === DELETE );\n\t\t\t\t} else {\n\t\t\t\t\t__unstableExpandSelection();\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\t// If key.length is longer than 1, it's a control key that doesn't\n\t\t\t\t// input anything.\n\t\t\t\tevent.key.length === 1 &&\n\t\t\t\t! ( event.metaKey || event.ctrlKey )\n\t\t\t) {\n\t\t\t\tnode.contentEditable = false;\n\t\t\t\tif ( __unstableIsSelectionMergeable() ) {\n\t\t\t\t\t__unstableDeleteSelection( event.keyCode === DELETE );\n\t\t\t\t} else {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t// Safari does not stop default behaviour with either\n\t\t\t\t\t// event.preventDefault() or node.contentEditable = false, so\n\t\t\t\t\t// remove the selection to stop browser manipulation.\n\t\t\t\t\tnode.ownerDocument.defaultView\n\t\t\t\t\t\t.getSelection()\n\t\t\t\t\t\t.removeAllRanges();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction onCompositionStart( event ) {\n\t\t\tif ( ! hasMultiSelection() ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tnode.contentEditable = false;\n\n\t\t\tif ( __unstableIsSelectionMergeable() ) {\n\t\t\t\t__unstableDeleteSelection();\n\t\t\t} else {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t// Safari does not stop default behaviour with either\n\t\t\t\t// event.preventDefault() or node.contentEditable = false, so\n\t\t\t\t// remove the selection to stop browser manipulation.\n\t\t\t\tnode.ownerDocument.defaultView.getSelection().removeAllRanges();\n\t\t\t}\n\t\t}\n\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\tnode.addEventListener( 'compositionstart', onCompositionStart );\n\t\treturn () => {\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t\tnode.removeEventListener( 'compositionstart', onCompositionStart );\n\t\t};\n\t}, [] );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/use-input.js"],"names":["useInput","__unstableIsFullySelected","getSelectedBlockClientIds","__unstableIsSelectionMergeable","hasMultiSelection","blockEditorStore","replaceBlocks","__unstableSplitSelection","removeBlocks","__unstableDeleteSelection","__unstableExpandSelection","node","onBeforeInput","event","inputType","startsWith","preventDefault","onKeyDown","defaultPrevented","keyCode","ENTER","contentEditable","BACKSPACE","DELETE","key","length","metaKey","ctrlKey","ownerDocument","defaultView","getSelection","removeAllRanges","onCompositionStart","addEventListener","removeEventListener"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;;AAGA;AACA;AACA;AACe,SAASA,QAAT,GAAoB;AAClC,QAAM;AACLC,IAAAA,yBADK;AAELC,IAAAA,yBAFK;AAGLC,IAAAA,8BAHK;AAILC,IAAAA;AAJK,MAKF,qBAAWC,YAAX,CALJ;AAMA,QAAM;AACLC,IAAAA,aADK;AAELC,IAAAA,wBAFK;AAGLC,IAAAA,YAHK;AAILC,IAAAA,yBAJK;AAKLC,IAAAA;AALK,MAMF,uBAAaL,YAAb,CANJ;AAQA,SAAO,2BAAgBM,IAAF,IAAY;AAChC,aAASC,aAAT,CAAwBC,KAAxB,EAAgC;AAAA;;AAC/B,UAAK,CAAET,iBAAiB,EAAxB,EAA6B;AAC5B;AACA,OAH8B,CAI/B;;;AACA,8BAAKS,KAAK,CAACC,SAAX,6CAAK,iBAAiBC,UAAjB,CAA6B,QAA7B,CAAL,EAA+C;AAC9CF,QAAAA,KAAK,CAACG,cAAN;AACA;AACD;;AAED,aAASC,SAAT,CAAoBJ,KAApB,EAA4B;AAC3B,UAAKA,KAAK,CAACK,gBAAX,EAA8B;AAC7B;AACA;;AAED,UAAK,CAAEd,iBAAiB,EAAxB,EAA6B;AAC5B;AACA;;AAED,UAAKS,KAAK,CAACM,OAAN,KAAkBC,eAAvB,EAA+B;AAC9BT,QAAAA,IAAI,CAACU,eAAL,GAAuB,KAAvB;AACAR,QAAAA,KAAK,CAACG,cAAN;;AACA,YAAKf,yBAAyB,EAA9B,EAAmC;AAClCK,UAAAA,aAAa,CACZJ,yBAAyB,EADb,EAEZ,yBAAa,k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A;AACA;;AACAL,QAAAA,IAAI,CAACiB,aAAL,CAAmBC,WAAnB,CAA+BC,YAA/B,GAA8CC,eAA9C;AACA;AACD;;AAEDpB,IAAAA,IAAI,CAACsB,gBAAL,CAAuB,aAAvB,EAAsCrB,aAAtC;AACAD,IAAAA,IAAI,CAACsB,gBAAL,CAAuB,SAAvB,EAAkChB,SAAlC;AACAN,IAAAA,IAAI,CAACsB,gBAAL,CAAuB,kBAAvB,EAA2CD,kBAA3C;AACA,WAAO,MAAM;AACZrB,MAAAA,IAAI,CAACuB,mBAAL,CAA0B,aAA1B,EAAyCtB,aAAzC;AACAD,MAAAA,IAAI,CAACuB,mBAAL,CAA0B,SAA1B,EAAqCjB,SAArC;AACAN,MAAAA,IAAI,CAACuB,mBAAL,CAA0B,kBAA1B,EAA8CF,kBAA9C;AACA,KAJD;AAKA,GA3FM,EA2FJ,EA3FI,CAAP;AA4FA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\nimport { ENTER, BACKSPACE, DELETE } from '@wordpress/keycodes';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Handles input for selections across blocks.\n */\nexport default function useInput() {\n\tconst {\n\t\t__unstableIsFullySelected,\n\t\tgetSelectedBlockClientIds,\n\t\t__unstableIsSelectionMergeable,\n\t\thasMultiSelection,\n\t} = useSelect( blockEditorStore );\n\tconst {\n\t\treplaceBlocks,\n\t\t__unstableSplitSelection,\n\t\tremoveBlocks,\n\t\t__unstableDeleteSelection,\n\t\t__unstableExpandSelection,\n\t} = useDispatch( blockEditorStore );\n\n\treturn useRefEffect( ( node ) => {\n\t\tfunction onBeforeInput( event ) {\n\t\t\tif ( ! hasMultiSelection() ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Prevent the browser to format something when we have multiselection.\n\t\t\tif ( event.inputType?.startsWith( 'format' ) ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! hasMultiSelection() ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.keyCode === ENTER ) {\n\t\t\t\tnode.contentEditable = false;\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif ( __unstableIsFullySelected() ) {\n\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\tgetSelectedBlockClientIds(),\n\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\t__unstableSplitSelection();\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tevent.keyCode === BACKSPACE ||\n\t\t\t\tevent.keyCode === DELETE\n\t\t\t) {\n\t\t\t\tnode.contentEditable = false;\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif ( __unstableIsFullySelected() ) {\n\t\t\t\t\tremoveBlocks( getSelectedBlockClientIds() );\n\t\t\t\t} else if ( __unstableIsSelectionMergeable() ) {\n\t\t\t\t\t__unstableDeleteSelection( event.keyCode === DELETE );\n\t\t\t\t} else {\n\t\t\t\t\t__unstableExpandSelection();\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\t// If key.length is longer than 1, it's a control key that doesn't\n\t\t\t\t// input anything.\n\t\t\t\tevent.key.length === 1 &&\n\t\t\t\t! ( event.metaKey || event.ctrlKey )\n\t\t\t) {\n\t\t\t\tnode.contentEditable = false;\n\t\t\t\tif ( __unstableIsSelectionMergeable() ) {\n\t\t\t\t\t__unstableDeleteSelection( event.keyCode === DELETE );\n\t\t\t\t} else {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t// Safari does not stop default behaviour with either\n\t\t\t\t\t// event.preventDefault() or node.contentEditable = false, so\n\t\t\t\t\t// remove the selection to stop browser manipulation.\n\t\t\t\t\tnode.ownerDocument.defaultView\n\t\t\t\t\t\t.getSelection()\n\t\t\t\t\t\t.removeAllRanges();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction onCompositionStart( event ) {\n\t\t\tif ( ! hasMultiSelection() ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tnode.contentEditable = false;\n\n\t\t\tif ( __unstableIsSelectionMergeable() ) {\n\t\t\t\t__unstableDeleteSelection();\n\t\t\t} else {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t// Safari does not stop default behaviour with either\n\t\t\t\t// event.preventDefault() or node.contentEditable = false, so\n\t\t\t\t// remove the selection to stop browser manipulation.\n\t\t\t\tnode.ownerDocument.defaultView.getSelection().removeAllRanges();\n\t\t\t}\n\t\t}\n\n\t\tnode.addEventListener( 'beforeinput', onBeforeInput );\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\tnode.addEventListener( 'compositionstart', onCompositionStart );\n\t\treturn () => {\n\t\t\tnode.removeEventListener( 'beforeinput', onBeforeInput );\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t\tnode.removeEventListener( 'compositionstart', onCompositionStart );\n\t\t};\n\t}, [] );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/use-multi-selection.js"],"names":["selector","select","isMultiSelecting","getMultiSelectedBlockClientIds","hasMultiSelection","getSelectedBlockClientId","getSelectedBlocksInitialCaretPosition","__unstableIsFullySelected","blockEditorStore","multiSelectedBlockClientIds","selectedBlockClientId","initialPosition","isFullSelection","useMultiSelection","selectedRef","startRef","endRef","node","ownerDocument","defaultView","undefined","selection","getSelection","rangeCount","isCollapsed","blockNode","current","startContainer","endContainer","getRangeAt","contains","removeAllRanges","length","contentEditable","focus","range","createRange","setStartBefore","setEndAfter","addRange"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;A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BAFD,EAGCO,2BAHD,EAICC,qBAJD,EAKCC,eALD,EAMCC,eAND,CA1EM,CAAP;AAmFA","sourcesContent":["/**\n * External dependencies\n */\nimport { first, last } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { __unstableUseBlockRef as useBlockRef } from '../block-list/use-block-props/use-block-refs';\n\nfunction selector( select ) {\n\tconst {\n\t\tisMultiSelecting,\n\t\tgetMultiSelectedBlockClientIds,\n\t\thasMultiSelection,\n\t\tgetSelectedBlockClientId,\n\t\tgetSelectedBlocksInitialCaretPosition,\n\t\t__unstableIsFullySelected,\n\t} = select( blockEditorStore );\n\n\treturn {\n\t\tisMultiSelecting: isMultiSelecting(),\n\t\tmultiSelectedBlockClientIds: getMultiSelectedBlockClientIds(),\n\t\thasMultiSelection: hasMultiSelection(),\n\t\tselectedBlockClientId: getSelectedBlockClientId(),\n\t\tinitialPosition: getSelectedBlocksInitialCaretPosition(),\n\t\tisFullSelection: __unstableIsFullySelected(),\n\t};\n}\n\nexport default function useMultiSelection() {\n\tconst {\n\t\tinitialPosition,\n\t\tisMultiSelecting,\n\t\tmultiSelectedBlockClientIds,\n\t\thasMultiSelection,\n\t\tselectedBlockClientId,\n\t\tisFullSelection,\n\t} = useSelect( selector, [] );\n\tconst selectedRef = useBlockRef( selectedBlockClientId );\n\t// These must be in the right DOM order.\n\tconst startRef = useBlockRef( first( multiSelectedBlockClientIds ) );\n\tconst endRef = useBlockRef( last( multiSelectedBlockClientIds ) );\n\n\t/**\n\t * When the component updates, and there is multi selection, we need to\n\t * select the entire block contents.\n\t */\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\t// Allow initialPosition to bypass focus behavior. This is useful\n\t\t\t// for the list view or other areas where we don't want to transfer\n\t\t\t// focus to the editor canvas.\n\t\t\tif ( initialPosition === undefined || initialPosition === null ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! hasMultiSelection || isMultiSelecting ) {\n\t\t\t\tif ( ! selectedBlockClientId || isMultiSelecting ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst selection = defaultView.getSelection();\n\n\t\t\t\tif ( selection.rangeCount && ! selection.isCollapsed ) {\n\t\t\t\t\tconst blockNode = selectedRef.current;\n\t\t\t\t\tconst {\n\t\t\t\t\t\tstartContainer,\n\t\t\t\t\t\tendContainer,\n\t\t\t\t\t} = selection.getRangeAt( 0 );\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t!! blockNode &&\n\t\t\t\t\t\t( ! blockNode.contains( startContainer ) ||\n\t\t\t\t\t\t\t! blockNode.contains( endContainer ) )\n\t\t\t\t\t) {\n\t\t\t\t\t\tselection.removeAllRanges();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { length } = multiSelectedBlockClientIds;\n\n\t\t\tif ( length < 2 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! isFullSelection ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Allow cross contentEditable selection by temporarily making\n\t\t\t// all content editable. We can't rely on using the store and\n\t\t\t// React because re-rending happens too slowly. We need to be\n\t\t\t// able to select across instances immediately.\n\t\t\tnode.contentEditable = true;\n\n\t\t\t// For some browsers, like Safari, it is important that focus happens\n\t\t\t// BEFORE selection.\n\t\t\tnode.focus();\n\n\t\t\t// The block refs might not be immediately available\n\t\t\t// when dragging blocks into another block.\n\t\t\tif ( ! startRef.current || ! endRef.current ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst selection = defaultView.getSelection();\n\t\t\tconst range = ownerDocument.createRange();\n\n\t\t\t// These must be in the right DOM order.\n\t\t\trange.setStartBefore( startRef.current );\n\t\t\trange.setEndAfter( endRef.current );\n\n\t\t\tselection.removeAllRanges();\n\t\t\tselection.addRange( range );\n\t\t},\n\t\t[\n\t\t\thasMultiSelection,\n\t\t\tisMultiSelecting,\n\t\t\tmultiSelectedBlockClientIds,\n\t\t\tselectedBlockClientId,\n\t\t\tinitialPosition,\n\t\t\tisFullSelection,\n\t\t]\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/use-multi-selection.js"],"names":["selector","select","isMultiSelecting","getMultiSelectedBlockClientIds","hasMultiSelection","getSelectedBlockClientId","getSelectedBlocksInitialCaretPosition","__unstableIsFullySelected","blockEditorStore","multiSelectedBlockClientIds","selectedBlockClientId","initialPosition","isFullSelection","useMultiSelection","selectedRef","startRef","endRef","node","ownerDocument","defaultView","undefined","selection","getSelection","rangeCount","isCollapsed","blockNode","current","startContainer","endContainer","getRangeAt","contains","removeAllRanges","length","contentEditable","focus","range","createRange","setStartBefore","setEndAfter","addRange"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAIA,SAASA,QAAT,CAAmBC,MAAnB,EAA4B;AAC3B,QAAM;AACLC,IAAAA,gBADK;AAELC,IAAAA,8BAFK;AAGLC,IAAAA,iBAHK;AAILC,IAAAA,wBAJK;AAKLC,IAAAA,qCALK;AAMLC,IAAAA;AANK,MAOFN,MAAM,CAAEO,YAAF,CAPV;AASA,SAAO;AACNN,IAAAA,gBAAgB,EAAEA,gBAAgB,EAD5B;AAENO,IAAAA,2BAA2B,EAAEN,8BAA8B,EAFrD;AAGNC,IAAAA,iBAAiB,EAAEA,iBAAiB,EAH9B;AAINM,IAAAA,qBAAqB,EAAEL,wBAAwB,EAJzC;AAKNM,IAAAA,eAAe,EAAEL,qCAAqC,EALhD;AAMNM,IAAAA,eAAe,EAAEL,yBAAyB;AANpC,GAAP;AAQA;;AAEc,SAASM,iBAAT,GAA6B;AAC3C,QAAM;AAC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uB,MAAM,GAAG,CAAd,EAAkB;AACjB;AACA;;AAED,QAAK,CAAEpB,eAAP,EAAyB;AACxB;AACA,KA3CU,CA6CX;AACA;AACA;AACA;;;AACAK,IAAAA,IAAI,CAACgB,eAAL,GAAuB,IAAvB,CAjDW,CAmDX;AACA;;AACAhB,IAAAA,IAAI,CAACiB,KAAL,GArDW,CAuDX;AACA;;AACA,QAAK,CAAEnB,QAAQ,CAACW,OAAX,IAAsB,CAAEV,MAAM,CAACU,OAApC,EAA8C;AAC7C;AACA;;AAED,UAAML,SAAS,GAAGF,WAAW,CAACG,YAAZ,EAAlB;AACA,UAAMa,KAAK,GAAGjB,aAAa,CAACkB,WAAd,EAAd,CA9DW,CAgEX;;AACAD,IAAAA,KAAK,CAACE,cAAN,CAAsBtB,QAAQ,CAACW,OAA/B;AACAS,IAAAA,KAAK,CAACG,WAAN,CAAmBtB,MAAM,CAACU,OAA1B;AAEAL,IAAAA,SAAS,CAACU,eAAV;AACAV,IAAAA,SAAS,CAACkB,QAAV,CAAoBJ,KAApB;AACA,GAvEK,EAwEN,CACC/B,iBADD,EAECF,gBAFD,EAGCO,2BAHD,EAICC,qBAJD,EAKCC,eALD,EAMCC,eAND,CAxEM,CAAP;AAiFA","sourcesContent":["/**\n * External dependencies\n */\nimport { first, last } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { __unstableUseBlockRef as useBlockRef } from '../block-list/use-block-props/use-block-refs';\n\nfunction selector( select ) {\n\tconst {\n\t\tisMultiSelecting,\n\t\tgetMultiSelectedBlockClientIds,\n\t\thasMultiSelection,\n\t\tgetSelectedBlockClientId,\n\t\tgetSelectedBlocksInitialCaretPosition,\n\t\t__unstableIsFullySelected,\n\t} = select( blockEditorStore );\n\n\treturn {\n\t\tisMultiSelecting: isMultiSelecting(),\n\t\tmultiSelectedBlockClientIds: getMultiSelectedBlockClientIds(),\n\t\thasMultiSelection: hasMultiSelection(),\n\t\tselectedBlockClientId: getSelectedBlockClientId(),\n\t\tinitialPosition: getSelectedBlocksInitialCaretPosition(),\n\t\tisFullSelection: __unstableIsFullySelected(),\n\t};\n}\n\nexport default function useMultiSelection() {\n\tconst {\n\t\tinitialPosition,\n\t\tisMultiSelecting,\n\t\tmultiSelectedBlockClientIds,\n\t\thasMultiSelection,\n\t\tselectedBlockClientId,\n\t\tisFullSelection,\n\t} = useSelect( selector, [] );\n\tconst selectedRef = useBlockRef( selectedBlockClientId );\n\t// These must be in the right DOM order.\n\tconst startRef = useBlockRef( first( multiSelectedBlockClientIds ) );\n\tconst endRef = useBlockRef( last( multiSelectedBlockClientIds ) );\n\n\t/**\n\t * When the component updates, and there is multi selection, we need to\n\t * select the entire block contents.\n\t */\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\t// Allow initialPosition to bypass focus behavior. This is useful\n\t\t\t// for the list view or other areas where we don't want to transfer\n\t\t\t// focus to the editor canvas.\n\t\t\tif ( initialPosition === undefined || initialPosition === null ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! hasMultiSelection || isMultiSelecting ) {\n\t\t\t\tif ( ! selectedBlockClientId || isMultiSelecting ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst selection = defaultView.getSelection();\n\n\t\t\t\tif ( selection.rangeCount && ! selection.isCollapsed ) {\n\t\t\t\t\tconst blockNode = selectedRef.current;\n\t\t\t\t\tconst { startContainer, endContainer } =\n\t\t\t\t\t\tselection.getRangeAt( 0 );\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t!! blockNode &&\n\t\t\t\t\t\t( ! blockNode.contains( startContainer ) ||\n\t\t\t\t\t\t\t! blockNode.contains( endContainer ) )\n\t\t\t\t\t) {\n\t\t\t\t\t\tselection.removeAllRanges();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { length } = multiSelectedBlockClientIds;\n\n\t\t\tif ( length < 2 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! isFullSelection ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Allow cross contentEditable selection by temporarily making\n\t\t\t// all content editable. We can't rely on using the store and\n\t\t\t// React because re-rending happens too slowly. We need to be\n\t\t\t// able to select across instances immediately.\n\t\t\tnode.contentEditable = true;\n\n\t\t\t// For some browsers, like Safari, it is important that focus happens\n\t\t\t// BEFORE selection.\n\t\t\tnode.focus();\n\n\t\t\t// The block refs might not be immediately available\n\t\t\t// when dragging blocks into another block.\n\t\t\tif ( ! startRef.current || ! endRef.current ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst selection = defaultView.getSelection();\n\t\t\tconst range = ownerDocument.createRange();\n\n\t\t\t// These must be in the right DOM order.\n\t\t\trange.setStartBefore( startRef.current );\n\t\t\trange.setEndAfter( endRef.current );\n\n\t\t\tselection.removeAllRanges();\n\t\t\tselection.addRange( range );\n\t\t},\n\t\t[\n\t\t\thasMultiSelection,\n\t\t\tisMultiSelecting,\n\t\t\tmultiSelectedBlockClientIds,\n\t\t\tselectedBlockClientId,\n\t\t\tinitialPosition,\n\t\t\tisFullSelection,\n\t\t]\n\t);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/use-select-all.js"],"names":["useSelectAll","getBlockOrder","getSelectedBlockClientIds","getBlockRootClientId","blockEditorStore","multiSelect","isMatch","node","onKeyDown","event","selectedClientIds","length","target","firstSelectedClientId","rootClientId","blockClientIds","firstClientId","lastClientId","preventDefault","addEventListener","removeEventListener"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAGe,SAASA,YAA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A,GA3CM,EA2CJ,EA3CI,CAAP;AA4CA","sourcesContent":["/**\n * External dependencies\n */\nimport { first, last } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { isEntirelySelected } from '@wordpress/dom';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nexport default function useSelectAll() {\n\tconst {\n\t\tgetBlockOrder,\n\t\tgetSelectedBlockClientIds,\n\t\tgetBlockRootClientId,\n\t} = useSelect( blockEditorStore );\n\tconst { multiSelect } = useDispatch( blockEditorStore );\n\tconst isMatch = useShortcutEventMatch();\n\n\treturn useRefEffect( ( node ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( ! isMatch( 'core/block-editor/select-all', event ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst selectedClientIds = getSelectedBlockClientIds();\n\n\t\t\tif (\n\t\t\t\tselectedClientIds.length < 2 &&\n\t\t\t\t! isEntirelySelected( event.target )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst [ firstSelectedClientId ] = selectedClientIds;\n\t\t\tconst rootClientId = getBlockRootClientId( firstSelectedClientId );\n\t\t\tlet blockClientIds = getBlockOrder( rootClientId );\n\n\t\t\t// If we have selected all sibling nested blocks, try selecting up a\n\t\t\t// level. See: https://github.com/WordPress/gutenberg/pull/31859/\n\t\t\tif ( selectedClientIds.length === blockClientIds.length ) {\n\t\t\t\tblockClientIds = getBlockOrder(\n\t\t\t\t\tgetBlockRootClientId( rootClientId )\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst firstClientId = first( blockClientIds );\n\t\t\tconst lastClientId = last( blockClientIds );\n\n\t\t\tif ( firstClientId === lastClientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tmultiSelect( firstClientId, lastClientId );\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\n\t\treturn () => {\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t};\n\t}, [] );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/use-select-all.js"],"names":["useSelectAll","getBlockOrder","getSelectedBlockClientIds","getBlockRootClientId","blockEditorStore","multiSelect","isMatch","node","onKeyDown","event","selectedClientIds","length","target","firstSelectedClientId","rootClientId","blockClientIds","firstClientId","lastClientId","preventDefault","addEventListener","removeEventListener"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAGe,SAASA,YAAT,GAAwB;AACtC,QAAM;AAAEC,IAAAA,aAAF;AAAiBC,IAAAA,yBAAjB;AAA4CC,IAAAA;AAA5C,MACL,qBAAWC,YAAX,CADD;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAAkB,uBAAaD,YAAb,CAAxB;AACA,QAAME,OAAO,GAAG,yDAAhB;AAEA,SAAO,2BAAgBC,IAAF,IAAY;AAChC,aAASC,SAAT,CAAoBC,KAApB,EAA4B;AAC3B,UAAK,CAAEH,OAAO,CAAE,8BAAF,EAAkCG,KAAlC,CAAd,EAA0D;AACzD;AACA;;AAED,YAAMC,iBAAiB,GAAGR,yBAAyB,EAAnD;;AAEA,UACCQ,iBAAiB,CAACC,MAAlB,GAA2B,CAA3B,IACA,CAAE,6BAAoBF,KAAK,CAACG,MAA1B,CAFH,EAGE;AACD;AACA;;AAED,YAAM,CAAEC,qBAAF,IAA4BH,iBAAlC;AACA,YAAMI,YAAY,GAAGX,oBAAoB,CAAEU,qBAAF,CAAzC;AACA,UAAIE,cAAc,GAAGd,aAAa,CAAEa,YAAF,CAAlC,CAhB2B,CAkB3B;AACA;;AACA,UAAKJ,iBAAiB,CAACC,MAAlB,KAA6BI,cAAc,CAACJ,MAAjD,EAA0D;AACzDI,QAAAA,cAAc,GAAGd,aAAa,CAC7BE,oBAAoB,CAAEW,YAAF,CADS,CAA9B;AAGA;;AAED,YAAME,aAAa,GAAG,mBAAOD,cAAP,CAAtB;AACA,YAAME,YAAY,GAAG,kBAAMF,cAAN,CAArB;;AAEA,UAAKC,aAAa,KAAKC,YAAvB,EAAsC;AACrC;AACA;;AAEDZ,MAAAA,WAAW,CAAEW,aAAF,EAAiBC,YAAjB,CAAX;AACAR,MAAAA,KAAK,CAACS,cAAN;AACA;;AAEDX,IAAAA,IAAI,CAACY,gBAAL,CAAuB,SAAvB,EAAkCX,SAAlC;AAEA,WAAO,MAAM;AACZD,MAAAA,IAAI,CAACa,mBAAL,CAA0B,SAA1B,EAAqCZ,SAArC;AACA,KAFD;AAGA,GA3CM,EA2CJ,EA3CI,CAAP;AA4CA","sourcesContent":["/**\n * External dependencies\n */\nimport { first, last } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { isEntirelySelected } from '@wordpress/dom';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nexport default function useSelectAll() {\n\tconst { getBlockOrder, getSelectedBlockClientIds, getBlockRootClientId } =\n\t\tuseSelect( blockEditorStore );\n\tconst { multiSelect } = useDispatch( blockEditorStore );\n\tconst isMatch = useShortcutEventMatch();\n\n\treturn useRefEffect( ( node ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( ! isMatch( 'core/block-editor/select-all', event ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst selectedClientIds = getSelectedBlockClientIds();\n\n\t\t\tif (\n\t\t\t\tselectedClientIds.length < 2 &&\n\t\t\t\t! isEntirelySelected( event.target )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst [ firstSelectedClientId ] = selectedClientIds;\n\t\t\tconst rootClientId = getBlockRootClientId( firstSelectedClientId );\n\t\t\tlet blockClientIds = getBlockOrder( rootClientId );\n\n\t\t\t// If we have selected all sibling nested blocks, try selecting up a\n\t\t\t// level. See: https://github.com/WordPress/gutenberg/pull/31859/\n\t\t\tif ( selectedClientIds.length === blockClientIds.length ) {\n\t\t\t\tblockClientIds = getBlockOrder(\n\t\t\t\t\tgetBlockRootClientId( rootClientId )\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst firstClientId = first( blockClientIds );\n\t\t\tconst lastClientId = last( blockClientIds );\n\n\t\t\tif ( firstClientId === lastClientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tmultiSelect( firstClientId, lastClientId );\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\n\t\treturn () => {\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t};\n\t}, [] );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/use-selection-observer.js"],"names":["extractSelectionStartNode","selection","anchorNode","anchorOffset","nodeType","TEXT_NODE","childNodes","extractSelectionEndNode","focusNode","focusOffset","findDepth","a","b","depth","setContentEditableWrapper","node","value","contentEditable","focus","useSelectionObserver","multiSelect","selectBlock","selectionChange","blockEditorStore","getBlockParents","getBlockSelectionStart","ownerDocument","defaultView","onSelectionChange","event","getSelection","rangeCount","isClickShift","shiftKey","type","isCollapsed","startClientId","endClientId","selectedClientId","clickedClientId","target","focusNodeIsNonSelectable","undefined","isSingularSelection","startPath","endPath","addListeners","addEventListener","removeListeners","removeEventListener","resetListeners"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,yBAAT,CAAoCC,SAApC,EAAgD;AAC/C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C,WAAf,EAA4BC,eAA5B,EAA6CE,eAA7C,CAlHM,CAAP;AAoHA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { getBlockClientId } from '../../utils/dom';\n\n/**\n * Extract the selection start node from the selection. When the anchor node is\n * not a text node, the selection offset is the index of a child node.\n *\n * @param {Selection} selection The selection.\n *\n * @return {Element} The selection start node.\n */\nfunction extractSelectionStartNode( selection ) {\n\tconst { anchorNode, anchorOffset } = selection;\n\n\tif ( anchorNode.nodeType === anchorNode.TEXT_NODE ) {\n\t\treturn anchorNode;\n\t}\n\n\treturn anchorNode.childNodes[ anchorOffset ];\n}\n\n/**\n * Extract the selection end node from the selection. When the focus node is not\n * a text node, the selection offset is the index of a child node. The selection\n * reaches up to but excluding that child node.\n *\n * @param {Selection} selection The selection.\n *\n * @return {Element} The selection start node.\n */\nfunction extractSelectionEndNode( selection ) {\n\tconst { focusNode, focusOffset } = selection;\n\n\tif ( focusNode.nodeType === focusNode.TEXT_NODE ) {\n\t\treturn focusNode;\n\t}\n\n\treturn focusNode.childNodes[ focusOffset - 1 ];\n}\n\nfunction findDepth( a, b ) {\n\tlet depth = 0;\n\n\twhile ( a[ depth ] === b[ depth ] ) {\n\t\tdepth++;\n\t}\n\n\treturn depth;\n}\n\n/**\n * Sets the `contenteditable` wrapper element to `value`.\n *\n * @param {HTMLElement} node Block element.\n * @param {boolean} value `contentEditable` value (true or false)\n */\nfunction setContentEditableWrapper( node, value ) {\n\tnode.contentEditable = value;\n\t// Firefox doesn't automatically move focus.\n\tif ( value ) node.focus();\n}\n\n/**\n * Sets a multi-selection based on the native selection across blocks.\n */\nexport default function useSelectionObserver() {\n\tconst { multiSelect, selectBlock, selectionChange } = useDispatch(\n\t\tblockEditorStore\n\t);\n\tconst { getBlockParents, getBlockSelectionStart } = useSelect(\n\t\tblockEditorStore\n\t);\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\tfunction onSelectionChange( event ) {\n\t\t\t\tconst selection = defaultView.getSelection();\n\t\t\t\t// If no selection is found, end multi selection and disable the\n\t\t\t\t// contentEditable wrapper.\n\t\t\t\tif ( ! selection.rangeCount ) {\n\t\t\t\t\tsetContentEditableWrapper( node, false );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// If selection is collapsed and we haven't used `shift+click`,\n\t\t\t\t// end multi selection and disable the contentEditable wrapper.\n\t\t\t\t// We have to check about `shift+click` case because elements\n\t\t\t\t// that don't support text selection might be involved, and we might\n\t\t\t\t// update the clientIds to multi-select blocks.\n\t\t\t\t// For now we check if the event is a `mouse` event.\n\t\t\t\tconst isClickShift = event.shiftKey && event.type === 'mouseup';\n\t\t\t\tif ( selection.isCollapsed && ! isClickShift ) {\n\t\t\t\t\tsetContentEditableWrapper( node, false );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet startClientId = getBlockClientId(\n\t\t\t\t\textractSelectionStartNode( selection )\n\t\t\t\t);\n\t\t\t\tlet endClientId = getBlockClientId(\n\t\t\t\t\textractSelectionEndNode( selection )\n\t\t\t\t);\n\t\t\t\t// If the selection has changed and we had pressed `shift+click`,\n\t\t\t\t// we need to check if in an element that doesn't support\n\t\t\t\t// text selection has been clicked.\n\t\t\t\tif ( isClickShift ) {\n\t\t\t\t\tconst selectedClientId = getBlockSelectionStart();\n\t\t\t\t\tconst clickedClientId = getBlockClientId( event.target );\n\t\t\t\t\t// `endClientId` is not defined if we end the selection by clicking a non-selectable block.\n\t\t\t\t\t// We need to check if there was already a selection with a non-selectable focusNode.\n\t\t\t\t\tconst focusNodeIsNonSelectable =\n\t\t\t\t\t\tclickedClientId !== endClientId;\n\t\t\t\t\tif (\n\t\t\t\t\t\t( startClientId === endClientId &&\n\t\t\t\t\t\t\tselection.isCollapsed ) ||\n\t\t\t\t\t\t! endClientId ||\n\t\t\t\t\t\tfocusNodeIsNonSelectable\n\t\t\t\t\t) {\n\t\t\t\t\t\tendClientId = clickedClientId;\n\t\t\t\t\t}\n\t\t\t\t\t// Handle the case when we have a non-selectable block\n\t\t\t\t\t// selected and click another one.\n\t\t\t\t\tif ( startClientId !== selectedClientId ) {\n\t\t\t\t\t\tstartClientId = selectedClientId;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If the selection did not involve a block, return.\n\t\t\t\tif (\n\t\t\t\t\tstartClientId === undefined &&\n\t\t\t\t\tendClientId === undefined\n\t\t\t\t) {\n\t\t\t\t\tsetContentEditableWrapper( node, false );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst isSingularSelection = startClientId === endClientId;\n\t\t\t\tif ( isSingularSelection ) {\n\t\t\t\t\tselectBlock( startClientId );\n\t\t\t\t} else {\n\t\t\t\t\tconst startPath = [\n\t\t\t\t\t\t...getBlockParents( startClientId ),\n\t\t\t\t\t\tstartClientId,\n\t\t\t\t\t];\n\t\t\t\t\tconst endPath = [\n\t\t\t\t\t\t...getBlockParents( endClientId ),\n\t\t\t\t\t\tendClientId,\n\t\t\t\t\t];\n\t\t\t\t\tconst depth = findDepth( startPath, endPath );\n\n\t\t\t\t\tmultiSelect( startPath[ depth ], endPath[ depth ] );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction addListeners() {\n\t\t\t\townerDocument.addEventListener(\n\t\t\t\t\t'selectionchange',\n\t\t\t\t\tonSelectionChange\n\t\t\t\t);\n\t\t\t\tdefaultView.addEventListener( 'mouseup', onSelectionChange );\n\t\t\t}\n\n\t\t\tfunction removeListeners() {\n\t\t\t\townerDocument.removeEventListener(\n\t\t\t\t\t'selectionchange',\n\t\t\t\t\tonSelectionChange\n\t\t\t\t);\n\t\t\t\tdefaultView.removeEventListener( 'mouseup', onSelectionChange );\n\t\t\t}\n\n\t\t\tfunction resetListeners() {\n\t\t\t\tremoveListeners();\n\t\t\t\taddListeners();\n\t\t\t}\n\n\t\t\taddListeners();\n\t\t\t// We must allow rich text to set selection first. This ensures that\n\t\t\t// our `selectionchange` listener is always reset to be called after\n\t\t\t// the rich text one.\n\t\t\tnode.addEventListener( 'focusin', resetListeners );\n\t\t\treturn () => {\n\t\t\t\tremoveListeners();\n\t\t\t\tnode.removeEventListener( 'focusin', resetListeners );\n\t\t\t};\n\t\t},\n\t\t[ multiSelect, selectBlock, selectionChange, getBlockParents ]\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/use-selection-observer.js"],"names":["extractSelectionStartNode","selection","anchorNode","anchorOffset","nodeType","TEXT_NODE","childNodes","extractSelectionEndNode","focusNode","focusOffset","findDepth","a","b","depth","setContentEditableWrapper","node","value","contentEditable","focus","useSelectionObserver","multiSelect","selectBlock","selectionChange","blockEditorStore","getBlockParents","getBlockSelectionStart","ownerDocument","defaultView","onSelectionChange","event","getSelection","rangeCount","isClickShift","shiftKey","type","isCollapsed","startClientId","endClientId","selectedClientId","clickedClientId","target","focusNodeIsNonSelectable","undefined","isSingularSelection","startPath","endPath","addListeners","addEventListener","removeListeners","removeEventListener","resetListeners"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,yBAAT,CAAoCC,SAApC,EAAgD;AAC/C,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAA+BF,SAArC;;AAEA,MAAKC,UAAU,CAACE,QAAX,KAAwBF,UAAU,CAACG,SAAxC,EAAoD;AACnD,WAAOH,UAAP;AACA;;AAED,SAAOA,UAAU,CAACI,UAAX,CAAuBH,YAAvB,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASI,uBAAT,CAAkCN,SAAlC,EAA8C;AAC7C,QAAM;A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AMS,OAAO,GAAG,CACf,GAAGrB,eAAe,CAAEa,WAAF,CADH,EAEfA,WAFe,CAAhB;AAIA,cAAMxB,KAAK,GAAGH,SAAS,CAAEkC,SAAF,EAAaC,OAAb,CAAvB;AAEAzB,QAAAA,WAAW,CAAEwB,SAAS,CAAE/B,KAAF,CAAX,EAAsBgC,OAAO,CAAEhC,KAAF,CAA7B,CAAX;AACA;AACD;;AAED,aAASiC,YAAT,GAAwB;AACvBpB,MAAAA,aAAa,CAACqB,gBAAd,CACC,iBADD,EAECnB,iBAFD;AAIAD,MAAAA,WAAW,CAACoB,gBAAZ,CAA8B,SAA9B,EAAyCnB,iBAAzC;AACA;;AAED,aAASoB,eAAT,GAA2B;AAC1BtB,MAAAA,aAAa,CAACuB,mBAAd,CACC,iBADD,EAECrB,iBAFD;AAIAD,MAAAA,WAAW,CAACsB,mBAAZ,CAAiC,SAAjC,EAA4CrB,iBAA5C;AACA;;AAED,aAASsB,cAAT,GAA0B;AACzBF,MAAAA,eAAe;AACfF,MAAAA,YAAY;AACZ;;AAEDA,IAAAA,YAAY,GAvGD,CAwGX;AACA;AACA;;AACA/B,IAAAA,IAAI,CAACgC,gBAAL,CAAuB,SAAvB,EAAkCG,cAAlC;AACA,WAAO,MAAM;AACZF,MAAAA,eAAe;AACfjC,MAAAA,IAAI,CAACkC,mBAAL,CAA0B,SAA1B,EAAqCC,cAArC;AACA,KAHD;AAIA,GAjHK,EAkHN,CAAE9B,WAAF,EAAeC,WAAf,EAA4BC,eAA5B,EAA6CE,eAA7C,CAlHM,CAAP;AAoHA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { getBlockClientId } from '../../utils/dom';\n\n/**\n * Extract the selection start node from the selection. When the anchor node is\n * not a text node, the selection offset is the index of a child node.\n *\n * @param {Selection} selection The selection.\n *\n * @return {Element} The selection start node.\n */\nfunction extractSelectionStartNode( selection ) {\n\tconst { anchorNode, anchorOffset } = selection;\n\n\tif ( anchorNode.nodeType === anchorNode.TEXT_NODE ) {\n\t\treturn anchorNode;\n\t}\n\n\treturn anchorNode.childNodes[ anchorOffset ];\n}\n\n/**\n * Extract the selection end node from the selection. When the focus node is not\n * a text node, the selection offset is the index of a child node. The selection\n * reaches up to but excluding that child node.\n *\n * @param {Selection} selection The selection.\n *\n * @return {Element} The selection start node.\n */\nfunction extractSelectionEndNode( selection ) {\n\tconst { focusNode, focusOffset } = selection;\n\n\tif ( focusNode.nodeType === focusNode.TEXT_NODE ) {\n\t\treturn focusNode;\n\t}\n\n\treturn focusNode.childNodes[ focusOffset - 1 ];\n}\n\nfunction findDepth( a, b ) {\n\tlet depth = 0;\n\n\twhile ( a[ depth ] === b[ depth ] ) {\n\t\tdepth++;\n\t}\n\n\treturn depth;\n}\n\n/**\n * Sets the `contenteditable` wrapper element to `value`.\n *\n * @param {HTMLElement} node Block element.\n * @param {boolean} value `contentEditable` value (true or false)\n */\nfunction setContentEditableWrapper( node, value ) {\n\tnode.contentEditable = value;\n\t// Firefox doesn't automatically move focus.\n\tif ( value ) node.focus();\n}\n\n/**\n * Sets a multi-selection based on the native selection across blocks.\n */\nexport default function useSelectionObserver() {\n\tconst { multiSelect, selectBlock, selectionChange } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { getBlockParents, getBlockSelectionStart } =\n\t\tuseSelect( blockEditorStore );\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\tfunction onSelectionChange( event ) {\n\t\t\t\tconst selection = defaultView.getSelection();\n\t\t\t\t// If no selection is found, end multi selection and disable the\n\t\t\t\t// contentEditable wrapper.\n\t\t\t\tif ( ! selection.rangeCount ) {\n\t\t\t\t\tsetContentEditableWrapper( node, false );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// If selection is collapsed and we haven't used `shift+click`,\n\t\t\t\t// end multi selection and disable the contentEditable wrapper.\n\t\t\t\t// We have to check about `shift+click` case because elements\n\t\t\t\t// that don't support text selection might be involved, and we might\n\t\t\t\t// update the clientIds to multi-select blocks.\n\t\t\t\t// For now we check if the event is a `mouse` event.\n\t\t\t\tconst isClickShift = event.shiftKey && event.type === 'mouseup';\n\t\t\t\tif ( selection.isCollapsed && ! isClickShift ) {\n\t\t\t\t\tsetContentEditableWrapper( node, false );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet startClientId = getBlockClientId(\n\t\t\t\t\textractSelectionStartNode( selection )\n\t\t\t\t);\n\t\t\t\tlet endClientId = getBlockClientId(\n\t\t\t\t\textractSelectionEndNode( selection )\n\t\t\t\t);\n\t\t\t\t// If the selection has changed and we had pressed `shift+click`,\n\t\t\t\t// we need to check if in an element that doesn't support\n\t\t\t\t// text selection has been clicked.\n\t\t\t\tif ( isClickShift ) {\n\t\t\t\t\tconst selectedClientId = getBlockSelectionStart();\n\t\t\t\t\tconst clickedClientId = getBlockClientId( event.target );\n\t\t\t\t\t// `endClientId` is not defined if we end the selection by clicking a non-selectable block.\n\t\t\t\t\t// We need to check if there was already a selection with a non-selectable focusNode.\n\t\t\t\t\tconst focusNodeIsNonSelectable =\n\t\t\t\t\t\tclickedClientId !== endClientId;\n\t\t\t\t\tif (\n\t\t\t\t\t\t( startClientId === endClientId &&\n\t\t\t\t\t\t\tselection.isCollapsed ) ||\n\t\t\t\t\t\t! endClientId ||\n\t\t\t\t\t\tfocusNodeIsNonSelectable\n\t\t\t\t\t) {\n\t\t\t\t\t\tendClientId = clickedClientId;\n\t\t\t\t\t}\n\t\t\t\t\t// Handle the case when we have a non-selectable block\n\t\t\t\t\t// selected and click another one.\n\t\t\t\t\tif ( startClientId !== selectedClientId ) {\n\t\t\t\t\t\tstartClientId = selectedClientId;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If the selection did not involve a block, return.\n\t\t\t\tif (\n\t\t\t\t\tstartClientId === undefined &&\n\t\t\t\t\tendClientId === undefined\n\t\t\t\t) {\n\t\t\t\t\tsetContentEditableWrapper( node, false );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst isSingularSelection = startClientId === endClientId;\n\t\t\t\tif ( isSingularSelection ) {\n\t\t\t\t\tselectBlock( startClientId );\n\t\t\t\t} else {\n\t\t\t\t\tconst startPath = [\n\t\t\t\t\t\t...getBlockParents( startClientId ),\n\t\t\t\t\t\tstartClientId,\n\t\t\t\t\t];\n\t\t\t\t\tconst endPath = [\n\t\t\t\t\t\t...getBlockParents( endClientId ),\n\t\t\t\t\t\tendClientId,\n\t\t\t\t\t];\n\t\t\t\t\tconst depth = findDepth( startPath, endPath );\n\n\t\t\t\t\tmultiSelect( startPath[ depth ], endPath[ depth ] );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction addListeners() {\n\t\t\t\townerDocument.addEventListener(\n\t\t\t\t\t'selectionchange',\n\t\t\t\t\tonSelectionChange\n\t\t\t\t);\n\t\t\t\tdefaultView.addEventListener( 'mouseup', onSelectionChange );\n\t\t\t}\n\n\t\t\tfunction removeListeners() {\n\t\t\t\townerDocument.removeEventListener(\n\t\t\t\t\t'selectionchange',\n\t\t\t\t\tonSelectionChange\n\t\t\t\t);\n\t\t\t\tdefaultView.removeEventListener( 'mouseup', onSelectionChange );\n\t\t\t}\n\n\t\t\tfunction resetListeners() {\n\t\t\t\tremoveListeners();\n\t\t\t\taddListeners();\n\t\t\t}\n\n\t\t\taddListeners();\n\t\t\t// We must allow rich text to set selection first. This ensures that\n\t\t\t// our `selectionchange` listener is always reset to be called after\n\t\t\t// the rich text one.\n\t\t\tnode.addEventListener( 'focusin', resetListeners );\n\t\t\treturn () => {\n\t\t\t\tremoveListeners();\n\t\t\t\tnode.removeEventListener( 'focusin', resetListeners );\n\t\t\t};\n\t\t},\n\t\t[ multiSelect, selectBlock, selectionChange, getBlockParents ]\n\t);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/use-tab-nav.js"],"names":["useTabNav","container","focusCaptureBeforeRef","focusCaptureAfterRef","lastFocus","hasMultiSelection","getSelectedBlockClientId","getBlockCount","blockEditorStore","setNavigationMode","isNavigationMode","select","focusCaptureTabIndex","undefined","noCapture","onFocusCapture","event","current","focus","isBefore","target","compareDocumentPosition","DOCUMENT_POSITION_FOLLOWING","action","tabbable","before","after","ref","node","onKeyDown","defaultPrevented","keyCode","ESCAPE","preventDefault","TAB","isShift","shiftKey","direction","getAttribute","next","preventScroll","onFocusOut","ownerDocument","relatedTarget","activeElement","body","preventScrollOnTab","defaultView","addEventListener","removeEventListener","mergedRefs"],"mappings":";;;;;;;AAOA;;AAJA;;AACA;;AACA;;AACA;;AAMA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;AAGe,SAASA,SAAT,GAAqB;AACnC,QAAMC,SAAS,GAAG,sBAAlB;AACA,QAAMC,qBAAqB,GAAG,sBAA9B;AACA,QAAMC,oBAAoB,GAAG,sBAA7B;AACA,QAAMC,SAAS,GAAG,sBAAlB;AACA,QAAM;AACLC,IAAAA,iBADK;AAELC,IAAAA,wBAFK;AAGLC,IAAAA;AAHK,MAIF,qBAAWC,YAAX,CAJJ;AAKA,QAAM;AAAEC,IAAAA;AAAF,MAAwB,uBAAaD,YAAb,CAA9B;AACA,QAAME,gBAAgB,GAAG,qBACtBC,MAAF,IAAcA,MAAM,CAAEH,YAAF,CAAN,CAA2BE,gBAA3B,EADU,EAExB,EAFwB,CAAzB,CAXmC,CAgBnC;;AACA,QAAME,oBAAoB,GAAG,CAAEF,gBAAF,GAAqB,GAArB,GAA2BG,SAAxD,CAjBmC,CAmBnC;AACA;;AACA,QAAMC,SAAS,GAAG,sBAAlB;;AAEA,WAASC,cAAT,CAAyBC,KAAzB,EAAiC;AAChC;AACA,QAAKF,SAAS,CAACG,OAAf,EAAyB;AACxBH,MAAAA,SAAS,CAACG,OA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D;AAKA,GA5HW,EA4HT,EA5HS,CAAZ;AA8HA,QAAMS,UAAU,GAAG,2BAAc,CAAEjD,SAAF,EAAa0B,GAAb,CAAd,CAAnB;AAEA,SAAO,CAAEF,MAAF,EAAUyB,UAAV,EAAsBxB,KAAtB,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { focus, isFormElement } from '@wordpress/dom';\nimport { TAB, ESCAPE } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect, useMergeRefs } from '@wordpress/compose';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nexport default function useTabNav() {\n\tconst container = useRef();\n\tconst focusCaptureBeforeRef = useRef();\n\tconst focusCaptureAfterRef = useRef();\n\tconst lastFocus = useRef();\n\tconst {\n\t\thasMultiSelection,\n\t\tgetSelectedBlockClientId,\n\t\tgetBlockCount,\n\t} = useSelect( blockEditorStore );\n\tconst { setNavigationMode } = useDispatch( blockEditorStore );\n\tconst isNavigationMode = useSelect(\n\t\t( select ) => select( blockEditorStore ).isNavigationMode(),\n\t\t[]\n\t);\n\n\t// Don't allow tabbing to this element in Navigation mode.\n\tconst focusCaptureTabIndex = ! isNavigationMode ? '0' : undefined;\n\n\t// Reference that holds the a flag for enabling or disabling\n\t// capturing on the focus capture elements.\n\tconst noCapture = useRef();\n\n\tfunction onFocusCapture( event ) {\n\t\t// Do not capture incoming focus if set by us in WritingFlow.\n\t\tif ( noCapture.current ) {\n\t\t\tnoCapture.current = null;\n\t\t} else if ( hasMultiSelection() ) {\n\t\t\tcontainer.current.focus();\n\t\t} else if ( getSelectedBlockClientId() ) {\n\t\t\tlastFocus.current.focus();\n\t\t} else {\n\t\t\tsetNavigationMode( true );\n\n\t\t\tconst isBefore =\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tevent.target.compareDocumentPosition( container.current ) &\n\t\t\t\tevent.target.DOCUMENT_POSITION_FOLLOWING;\n\t\t\tconst action = isBefore ? 'findNext' : 'findPrevious';\n\n\t\t\tfocus.tabbable[ action ]( event.target ).focus();\n\t\t}\n\t}\n\n\tconst before = (\n\t\t<div\n\t\t\tref={ focusCaptureBeforeRef }\n\t\t\ttabIndex={ focusCaptureTabIndex }\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst after = (\n\t\t<div\n\t\t\tref={ focusCaptureAfterRef }\n\t\t\ttabIndex={ focusCaptureTabIndex }\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst ref = useRefEffect( ( node ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.keyCode === ESCAPE && ! hasMultiSelection() ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetNavigationMode( true );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// In Edit mode, Tab should focus the first tabbable element after\n\t\t\t// the content, which is normally the sidebar (with block controls)\n\t\t\t// and Shift+Tab should focus the first tabbable element before the\n\t\t\t// content, which is normally the block toolbar.\n\t\t\t// Arrow keys can be used, and Tab and arrow keys can be used in\n\t\t\t// Navigation mode (press Esc), to navigate through blocks.\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\n\t\t\tif ( ! hasMultiSelection() && ! getSelectedBlockClientId() ) {\n\t\t\t\t// Preserve the behaviour of entering navigation mode when\n\t\t\t\t// tabbing into the content without a block selection.\n\t\t\t\t// `onFocusCapture` already did this previously, but we need to\n\t\t\t\t// do it again here because after clearing block selection,\n\t\t\t\t// focus land on the writing flow container and pressing Tab\n\t\t\t\t// will no longer send focus through the focus capture element.\n\t\t\t\tif ( event.target === node ) setNavigationMode( true );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Allow tabbing from the block wrapper to a form element,\n\t\t\t// and between form elements rendered in a block,\n\t\t\t// such as inside a placeholder. Form elements are generally\n\t\t\t// meant to be UI rather than part of the content. Ideally\n\t\t\t// these are not rendered in the content and perhaps in the\n\t\t\t// future they can be rendered in an iframe or shadow DOM.\n\t\t\tif (\n\t\t\t\t( isFormElement( event.target ) ||\n\t\t\t\t\tevent.target.getAttribute( 'data-block' ) ===\n\t\t\t\t\t\tgetSelectedBlockClientId() ) &&\n\t\t\t\tisFormElement( focus.tabbable[ direction ]( event.target ) )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst next = isShift ? focusCaptureBeforeRef : focusCaptureAfterRef;\n\n\t\t\t// Disable focus capturing on the focus capture element, so it\n\t\t\t// doesn't refocus this block and so it allows default behaviour\n\t\t\t// (moving focus to the next tabbable element).\n\t\t\tnoCapture.current = true;\n\n\t\t\t// Focusing the focus capture element, which is located above and\n\t\t\t// below the editor, should not scroll the page all the way up or\n\t\t\t// down.\n\t\t\tnext.current.focus( { preventScroll: true } );\n\t\t}\n\n\t\tfunction onFocusOut( event ) {\n\t\t\tlastFocus.current = event.target;\n\n\t\t\tconst { ownerDocument } = node;\n\n\t\t\t// If focus disappears due to there being no blocks, move focus to\n\t\t\t// the writing flow wrapper.\n\t\t\tif (\n\t\t\t\t! event.relatedTarget &&\n\t\t\t\townerDocument.activeElement === ownerDocument.body &&\n\t\t\t\tgetBlockCount() === 0\n\t\t\t) {\n\t\t\t\tnode.focus();\n\t\t\t}\n\t\t}\n\n\t\t// When tabbing back to an element in block list, this event handler prevents scrolling if the\n\t\t// focus capture divs (before/after) are outside of the viewport. (For example shift+tab back to a paragraph\n\t\t// when focus is on a sidebar element. This prevents the scrollable writing area from jumping either to the\n\t\t// top or bottom of the document.\n\t\t//\n\t\t// Note that it isn't possible to disable scrolling in the onFocus event. We need to intercept this\n\t\t// earlier in the keypress handler, and call focus( { preventScroll: true } ) instead.\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus#parameters\n\t\tfunction preventScrollOnTab( event ) {\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.target?.getAttribute( 'role' ) === 'region' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( container.current === event.target ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\t\t\tconst target = focus.tabbable[ direction ]( event.target );\n\t\t\t// Only do something when the next tabbable is a focus capture div (before/after)\n\t\t\tif (\n\t\t\t\ttarget === focusCaptureBeforeRef.current ||\n\t\t\t\ttarget === focusCaptureAfterRef.current\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttarget.focus( { preventScroll: true } );\n\t\t\t}\n\t\t}\n\n\t\tconst { ownerDocument } = node;\n\t\tconst { defaultView } = ownerDocument;\n\t\tdefaultView.addEventListener( 'keydown', preventScrollOnTab );\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\tnode.addEventListener( 'focusout', onFocusOut );\n\t\treturn () => {\n\t\t\tdefaultView.removeEventListener( 'keydown', preventScrollOnTab );\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t\tnode.removeEventListener( 'focusout', onFocusOut );\n\t\t};\n\t}, [] );\n\n\tconst mergedRefs = useMergeRefs( [ container, ref ] );\n\n\treturn [ before, mergedRefs, after ];\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/use-tab-nav.js"],"names":["useTabNav","container","focusCaptureBeforeRef","focusCaptureAfterRef","lastFocus","hasMultiSelection","getSelectedBlockClientId","getBlockCount","blockEditorStore","setNavigationMode","isNavigationMode","select","focusCaptureTabIndex","undefined","noCapture","onFocusCapture","event","current","focus","isBefore","target","compareDocumentPosition","DOCUMENT_POSITION_FOLLOWING","action","tabbable","before","after","ref","node","onKeyDown","defaultPrevented","keyCode","ESCAPE","preventDefault","TAB","isShift","shiftKey","direction","getAttribute","next","preventScroll","onFocusOut","ownerDocument","relatedTarget","activeElement","body","preventScrollOnTab","defaultView","addEventListener","removeEventListener","mergedRefs"],"mappings":";;;;;;;AAOA;;AAJA;;AACA;;AACA;;AACA;;AAMA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;AAGe,SAASA,SAAT,GAAqB;AACnC,QAAMC,SAAS,GAAG,sBAAlB;AACA,QAAMC,qBAAqB,GAAG,sBAA9B;AACA,QAAMC,oBAAoB,GAAG,sBAA7B;AACA,QAAMC,SAAS,GAAG,sBAAlB;AACA,QAAM;AAAEC,IAAAA,iBAAF;AAAqBC,IAAAA,wBAArB;AAA+CC,IAAAA;AAA/C,MACL,qBAAWC,YAAX,CADD;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAAwB,uBAAaD,YAAb,CAA9B;AACA,QAAME,gBAAgB,GAAG,qBACtBC,MAAF,IAAcA,MAAM,CAAEH,YAAF,CAAN,CAA2BE,gBAA3B,EADU,EAExB,EAFwB,CAAzB,CARmC,CAanC;;AACA,QAAME,oBAAoB,GAAG,CAAEF,gBAAF,GAAqB,GAArB,GAA2BG,SAAxD,CAdmC,CAgBnC;AACA;;AACA,QAAMC,SAAS,GAAG,sBAAlB;;AAEA,WAASC,cAAT,CAAyBC,KAAzB,EAAiC;AAChC;AACA,QAAKF,SAAS,CAACG,OAAf,EAAyB;AACxBH,MAAAA,SAAS,CAACG,OAAV,GAAoB,IAApB;AACA,KAFD,MAEO,IAAKZ,iBAAiB,EAAtB,EAA2B;AACjCJ,MAAAA,SAAS,CAACgB,OAAV,CAAkBC,KAAlB;AACA,KAFM,MAEA,IAAKZ,wBAAwB,EAA7B,EAAkC;AACxCF,MAAAA,SAAS,CAACa,OAAV,CAAkBC,KAAlB;AACA,KAFM,MAEA;AACNT,MAAAA,iBAAiB,CAAE,IAAF,CAAjB;AAEA,YAAMU,QAAQ,GACb;AACAH,MAAA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OAAO,GAAGnB,KAAK,CAACoB,QAAtB;AACA,YAAMC,SAAS,GAAGF,OAAO,GAAG,cAAH,GAAoB,UAA7C;;AACA,YAAMf,MAAM,GAAGF,WAAMM,QAAN,CAAgBa,SAAhB,EAA6BrB,KAAK,CAACI,MAAnC,CAAf,CAfoC,CAgBpC;;;AACA,UACCA,MAAM,KAAKlB,qBAAqB,CAACe,OAAjC,IACAG,MAAM,KAAKjB,oBAAoB,CAACc,OAFjC,EAGE;AACDD,QAAAA,KAAK,CAACiB,cAAN;AACAb,QAAAA,MAAM,CAACF,KAAP,CAAc;AAAEsB,UAAAA,aAAa,EAAE;AAAjB,SAAd;AACA;AACD;;AAED,UAAM;AAAEE,MAAAA;AAAF,QAAoBd,IAA1B;AACA,UAAM;AAAEmB,MAAAA;AAAF,QAAkBL,aAAxB;AACAK,IAAAA,WAAW,CAACC,gBAAZ,CAA8B,SAA9B,EAAyCF,kBAAzC;AACAlB,IAAAA,IAAI,CAACoB,gBAAL,CAAuB,SAAvB,EAAkCnB,SAAlC;AACAD,IAAAA,IAAI,CAACoB,gBAAL,CAAuB,UAAvB,EAAmCP,UAAnC;AACA,WAAO,MAAM;AACZM,MAAAA,WAAW,CAACE,mBAAZ,CAAiC,SAAjC,EAA4CH,kBAA5C;AACAlB,MAAAA,IAAI,CAACqB,mBAAL,CAA0B,SAA1B,EAAqCpB,SAArC;AACAD,MAAAA,IAAI,CAACqB,mBAAL,CAA0B,UAA1B,EAAsCR,UAAtC;AACA,KAJD;AAKA,GA5HW,EA4HT,EA5HS,CAAZ;AA8HA,QAAMS,UAAU,GAAG,2BAAc,CAAEjD,SAAF,EAAa0B,GAAb,CAAd,CAAnB;AAEA,SAAO,CAAEF,MAAF,EAAUyB,UAAV,EAAsBxB,KAAtB,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { focus, isFormElement } from '@wordpress/dom';\nimport { TAB, ESCAPE } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect, useMergeRefs } from '@wordpress/compose';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nexport default function useTabNav() {\n\tconst container = useRef();\n\tconst focusCaptureBeforeRef = useRef();\n\tconst focusCaptureAfterRef = useRef();\n\tconst lastFocus = useRef();\n\tconst { hasMultiSelection, getSelectedBlockClientId, getBlockCount } =\n\t\tuseSelect( blockEditorStore );\n\tconst { setNavigationMode } = useDispatch( blockEditorStore );\n\tconst isNavigationMode = useSelect(\n\t\t( select ) => select( blockEditorStore ).isNavigationMode(),\n\t\t[]\n\t);\n\n\t// Don't allow tabbing to this element in Navigation mode.\n\tconst focusCaptureTabIndex = ! isNavigationMode ? '0' : undefined;\n\n\t// Reference that holds the a flag for enabling or disabling\n\t// capturing on the focus capture elements.\n\tconst noCapture = useRef();\n\n\tfunction onFocusCapture( event ) {\n\t\t// Do not capture incoming focus if set by us in WritingFlow.\n\t\tif ( noCapture.current ) {\n\t\t\tnoCapture.current = null;\n\t\t} else if ( hasMultiSelection() ) {\n\t\t\tcontainer.current.focus();\n\t\t} else if ( getSelectedBlockClientId() ) {\n\t\t\tlastFocus.current.focus();\n\t\t} else {\n\t\t\tsetNavigationMode( true );\n\n\t\t\tconst isBefore =\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tevent.target.compareDocumentPosition( container.current ) &\n\t\t\t\tevent.target.DOCUMENT_POSITION_FOLLOWING;\n\t\t\tconst action = isBefore ? 'findNext' : 'findPrevious';\n\n\t\t\tfocus.tabbable[ action ]( event.target ).focus();\n\t\t}\n\t}\n\n\tconst before = (\n\t\t<div\n\t\t\tref={ focusCaptureBeforeRef }\n\t\t\ttabIndex={ focusCaptureTabIndex }\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst after = (\n\t\t<div\n\t\t\tref={ focusCaptureAfterRef }\n\t\t\ttabIndex={ focusCaptureTabIndex }\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst ref = useRefEffect( ( node ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.keyCode === ESCAPE && ! hasMultiSelection() ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetNavigationMode( true );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// In Edit mode, Tab should focus the first tabbable element after\n\t\t\t// the content, which is normally the sidebar (with block controls)\n\t\t\t// and Shift+Tab should focus the first tabbable element before the\n\t\t\t// content, which is normally the block toolbar.\n\t\t\t// Arrow keys can be used, and Tab and arrow keys can be used in\n\t\t\t// Navigation mode (press Esc), to navigate through blocks.\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\n\t\t\tif ( ! hasMultiSelection() && ! getSelectedBlockClientId() ) {\n\t\t\t\t// Preserve the behaviour of entering navigation mode when\n\t\t\t\t// tabbing into the content without a block selection.\n\t\t\t\t// `onFocusCapture` already did this previously, but we need to\n\t\t\t\t// do it again here because after clearing block selection,\n\t\t\t\t// focus land on the writing flow container and pressing Tab\n\t\t\t\t// will no longer send focus through the focus capture element.\n\t\t\t\tif ( event.target === node ) setNavigationMode( true );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Allow tabbing from the block wrapper to a form element,\n\t\t\t// and between form elements rendered in a block,\n\t\t\t// such as inside a placeholder. Form elements are generally\n\t\t\t// meant to be UI rather than part of the content. Ideally\n\t\t\t// these are not rendered in the content and perhaps in the\n\t\t\t// future they can be rendered in an iframe or shadow DOM.\n\t\t\tif (\n\t\t\t\t( isFormElement( event.target ) ||\n\t\t\t\t\tevent.target.getAttribute( 'data-block' ) ===\n\t\t\t\t\t\tgetSelectedBlockClientId() ) &&\n\t\t\t\tisFormElement( focus.tabbable[ direction ]( event.target ) )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst next = isShift ? focusCaptureBeforeRef : focusCaptureAfterRef;\n\n\t\t\t// Disable focus capturing on the focus capture element, so it\n\t\t\t// doesn't refocus this block and so it allows default behaviour\n\t\t\t// (moving focus to the next tabbable element).\n\t\t\tnoCapture.current = true;\n\n\t\t\t// Focusing the focus capture element, which is located above and\n\t\t\t// below the editor, should not scroll the page all the way up or\n\t\t\t// down.\n\t\t\tnext.current.focus( { preventScroll: true } );\n\t\t}\n\n\t\tfunction onFocusOut( event ) {\n\t\t\tlastFocus.current = event.target;\n\n\t\t\tconst { ownerDocument } = node;\n\n\t\t\t// If focus disappears due to there being no blocks, move focus to\n\t\t\t// the writing flow wrapper.\n\t\t\tif (\n\t\t\t\t! event.relatedTarget &&\n\t\t\t\townerDocument.activeElement === ownerDocument.body &&\n\t\t\t\tgetBlockCount() === 0\n\t\t\t) {\n\t\t\t\tnode.focus();\n\t\t\t}\n\t\t}\n\n\t\t// When tabbing back to an element in block list, this event handler prevents scrolling if the\n\t\t// focus capture divs (before/after) are outside of the viewport. (For example shift+tab back to a paragraph\n\t\t// when focus is on a sidebar element. This prevents the scrollable writing area from jumping either to the\n\t\t// top or bottom of the document.\n\t\t//\n\t\t// Note that it isn't possible to disable scrolling in the onFocus event. We need to intercept this\n\t\t// earlier in the keypress handler, and call focus( { preventScroll: true } ) instead.\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus#parameters\n\t\tfunction preventScrollOnTab( event ) {\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.target?.getAttribute( 'role' ) === 'region' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( container.current === event.target ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\t\t\tconst target = focus.tabbable[ direction ]( event.target );\n\t\t\t// Only do something when the next tabbable is a focus capture div (before/after)\n\t\t\tif (\n\t\t\t\ttarget === focusCaptureBeforeRef.current ||\n\t\t\t\ttarget === focusCaptureAfterRef.current\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttarget.focus( { preventScroll: true } );\n\t\t\t}\n\t\t}\n\n\t\tconst { ownerDocument } = node;\n\t\tconst { defaultView } = ownerDocument;\n\t\tdefaultView.addEventListener( 'keydown', preventScrollOnTab );\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\tnode.addEventListener( 'focusout', onFocusOut );\n\t\treturn () => {\n\t\t\tdefaultView.removeEventListener( 'keydown', preventScrollOnTab );\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t\tnode.removeEventListener( 'focusout', onFocusOut );\n\t\t};\n\t}, [] );\n\n\tconst mergedRefs = useMergeRefs( [ container, ref ] );\n\n\treturn [ before, mergedRefs, after ];\n}\n"]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.__experimentalElementButtonClassName = void 0;
7
+ const __experimentalElementButtonClassName = 'wp-element-button';
8
+ exports.__experimentalElementButtonClassName = __experimentalElementButtonClassName;
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/elements/index.js"],"names":["__experimentalElementButtonClassName"],"mappings":";;;;;;AAAO,MAAMA,oCAAoC,GAAG,mBAA7C","sourcesContent":["export const __experimentalElementButtonClassName = 'wp-element-button';\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/anchor.js"],"names":["ANCHOR_REGEX","ANCHOR_SCHEMA","type","source","attribute","selector","addAttribute","settings","attributes","anchor","withInspectorControl","BlockEdit","props","hasAnchor","name","isSelected","isWeb","Platform","OS","textControl","nextValue","replace","setAttributes","addSaveProps","extraPro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CAACC,MAA7D;AACA;;AAED,SAAOe,UAAP;AACA;;AAED,sBAAW,0BAAX,EAAuC,uBAAvC,EAAgElB,YAAhE;AACA,sBACC,kBADD,EAEC,2CAFD,EAGCI,oBAHD;AAKA,sBACC,kCADD,EAEC,wBAFD,EAGCa,YAHD","sourcesContent":["/**\n * External dependencies\n */\nimport { has } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { PanelBody, TextControl, ExternalLink } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { InspectorControls } from '../components';\n\n/**\n * Regular expression matching invalid anchor characters for replacement.\n *\n * @type {RegExp}\n */\nconst ANCHOR_REGEX = /[\\s#]/g;\n\nconst ANCHOR_SCHEMA = {\n\ttype: 'string',\n\tsource: 'attribute',\n\tattribute: 'id',\n\tselector: '*',\n};\n\n/**\n * Filters registered block settings, extending attributes with anchor using ID\n * of the first node.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( has( settings.attributes, [ 'anchor', 'type' ] ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'anchor' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tanchor: ANCHOR_SCHEMA,\n\t\t};\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include a new block inspector control for\n * assigning the anchor ID, if block supports anchor.\n *\n * @param {WPComponent} BlockEdit Original component.\n *\n * @return {WPComponent} Wrapped component.\n */\nexport const withInspectorControl = createHigherOrderComponent(\n\t( BlockEdit ) => {\n\t\treturn ( props ) => {\n\t\t\tconst hasAnchor = hasBlockSupport( props.name, 'anchor' );\n\n\t\t\tif ( hasAnchor && props.isSelected ) {\n\t\t\t\tconst isWeb = Platform.OS === 'web';\n\t\t\t\tconst textControl = (\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tclassName=\"html-anchor-control\"\n\t\t\t\t\t\tlabel={ __( 'HTML anchor' ) }\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.'\n\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t{ isWeb && (\n\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/support/article/page-jumps/'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Learn more about anchors' ) }\n\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ props.attributes.anchor || '' }\n\t\t\t\t\t\tplaceholder={ ! isWeb ? __( 'Add an anchor' ) : null }\n\t\t\t\t\t\tonChange={ ( nextValue ) => {\n\t\t\t\t\t\t\tnextValue = nextValue.replace( ANCHOR_REGEX, '-' );\n\t\t\t\t\t\t\tprops.setAttributes( {\n\t\t\t\t\t\t\t\tanchor: nextValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tautoCapitalize=\"none\"\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t\t\t{ isWeb && (\n\t\t\t\t\t\t\t<InspectorControls __experimentalGroup=\"advanced\">\n\t\t\t\t\t\t\t\t{ textControl }\n\t\t\t\t\t\t\t</InspectorControls>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ /*\n\t\t\t\t\t\t * We plan to remove scoping anchors to 'core/heading' to support\n\t\t\t\t\t\t * anchors for all eligble blocks. Additionally we plan to explore\n\t\t\t\t\t\t * leveraging InspectorAdvancedControls instead of a custom\n\t\t\t\t\t\t * PanelBody title. https://git.io/Jtcov\n\t\t\t\t\t\t */ }\n\t\t\t\t\t\t{ ! isWeb && props.name === 'core/heading' && (\n\t\t\t\t\t\t\t<InspectorControls>\n\t\t\t\t\t\t\t\t<PanelBody title={ __( 'Heading settings' ) }>\n\t\t\t\t\t\t\t\t\t{ textControl }\n\t\t\t\t\t\t\t\t</PanelBody>\n\t\t\t\t\t\t\t</InspectorControls>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn <BlockEdit { ...props } />;\n\t\t};\n\t},\n\t'withInspectorControl'\n);\n\n/**\n * Override props assigned to save component to inject anchor ID, if block\n * supports anchor. This is only applied if the block's save result is an\n * element and not a markup string.\n *\n * @param {Object} extraProps Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Current block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( extraProps, blockType, attributes ) {\n\tif ( hasBlockSupport( blockType, 'anchor' ) ) {\n\t\textraProps.id = attributes.anchor === '' ? null : attributes.anchor;\n\t}\n\n\treturn extraProps;\n}\n\naddFilter( 'blocks.registerBlockType', 'core/anchor/attribute', addAttribute );\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/anchor/with-inspector-control',\n\twithInspectorControl\n);\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/anchor/save-props',\n\taddSaveProps\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/anchor.js"],"names":["ANCHOR_REGEX","ANCHOR_SCHEMA","type","source","attribute","selector","addAttribute","settings","attributes","anchor","withInspectorControl","BlockEdit","props","hasAnchor","name","isSelected","isWeb","Platform","OS","textControl","nextValue","replace","setAttributes","addSaveProps","extraProps","blockType","id"],"mappings":";;;;;;;;;AAaA;;AAVA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA,MAAMA,YAAY,GAAG,QAArB;AAEA,MAAMC,aAAa,GAAG;AACrBC,EAAAA,IAAI,EAAE,QADe;AAErBC,EAAAA,MAAM,EAAE,WAFa;AAGrBC,EAAAA,SAAS,EAAE,IAHU;AAIrBC,EAAAA,QAAQ,EAAE;AAJW,CAAtB;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,YAAT,CAAuBC,QAAvB,EAAkC;AACxC;AACA,MAAK,iBAAKA,QAAQ,CAACC,UAAd,EAA0B,CAAE,QAAF,EAAY,MAAZ,CAA1B,CAAL,EAAwD;AACvD,WAAOD,QAAP;AACA;;AACD,MAAK,6BAAiBA,QAAjB,EAA2B,QAA3B,CAAL,EAA6C;AAC5C;AACAA,IAAAA,QAAQ,CAACC,UAAT,GAAsB,EACrB,GAAGD,QAAQ,CAACC,UADS;AAErBC,MAAAA,MAAM,EAAER;AAFa,KAAtB;AAIA;;AAED,SAAOM,QAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMG,oBAAoB,GAAG,yCACjCC,SAAF,IAAiB;AAChB,SAASC,KAAF,IAAa;AACnB,UAAMC,SAAS,GAAG,6BAAiBD,KAAK,CAACE,IAAvB,EAA6B,QAA7B,CAAlB;;AAEA,QAAKD,SAAS,IAAID,KAAK,CAACG,UAAxB,EAAqC;AACpC,YAAMC,KAAK,GAAGC,kBAASC,EAAT,KAAgB,KAA9B;AACA,YAAMC,WAAW,GAChB,4BAAC,uBAAD;AACC,QAAA,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B,QAA5B,CAAL,EAA8C;AAC7CD,IAAAA,UAAU,CAACE,EAAX,GAAgBlB,UAAU,CAACC,MAAX,KAAsB,EAAtB,GAA2B,IAA3B,GAAkCD,UAAU,CAACC,MAA7D;AACA;;AAED,SAAOe,UAAP;AACA;;AAED,sBAAW,0BAAX,EAAuC,uBAAvC,EAAgElB,YAAhE;AACA,sBACC,kBADD,EAEC,2CAFD,EAGCI,oBAHD;AAKA,sBACC,kCADD,EAEC,wBAFD,EAGCa,YAHD","sourcesContent":["/**\n * External dependencies\n */\nimport { has } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { PanelBody, TextControl, ExternalLink } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { InspectorControls } from '../components';\n\n/**\n * Regular expression matching invalid anchor characters for replacement.\n *\n * @type {RegExp}\n */\nconst ANCHOR_REGEX = /[\\s#]/g;\n\nconst ANCHOR_SCHEMA = {\n\ttype: 'string',\n\tsource: 'attribute',\n\tattribute: 'id',\n\tselector: '*',\n};\n\n/**\n * Filters registered block settings, extending attributes with anchor using ID\n * of the first node.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( has( settings.attributes, [ 'anchor', 'type' ] ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'anchor' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tanchor: ANCHOR_SCHEMA,\n\t\t};\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include a new block inspector control for\n * assigning the anchor ID, if block supports anchor.\n *\n * @param {WPComponent} BlockEdit Original component.\n *\n * @return {WPComponent} Wrapped component.\n */\nexport const withInspectorControl = createHigherOrderComponent(\n\t( BlockEdit ) => {\n\t\treturn ( props ) => {\n\t\t\tconst hasAnchor = hasBlockSupport( props.name, 'anchor' );\n\n\t\t\tif ( hasAnchor && props.isSelected ) {\n\t\t\t\tconst isWeb = Platform.OS === 'web';\n\t\t\t\tconst textControl = (\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tclassName=\"html-anchor-control\"\n\t\t\t\t\t\tlabel={ __( 'HTML anchor' ) }\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.'\n\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t\t{ isWeb && (\n\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/support/article/page-jumps/'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Learn more about anchors' ) }\n\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ props.attributes.anchor || '' }\n\t\t\t\t\t\tplaceholder={ ! isWeb ? __( 'Add an anchor' ) : null }\n\t\t\t\t\t\tonChange={ ( nextValue ) => {\n\t\t\t\t\t\t\tnextValue = nextValue.replace( ANCHOR_REGEX, '-' );\n\t\t\t\t\t\t\tprops.setAttributes( {\n\t\t\t\t\t\t\t\tanchor: nextValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tautoCapitalize=\"none\"\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t\t\t{ isWeb && (\n\t\t\t\t\t\t\t<InspectorControls __experimentalGroup=\"advanced\">\n\t\t\t\t\t\t\t\t{ textControl }\n\t\t\t\t\t\t\t</InspectorControls>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ /*\n\t\t\t\t\t\t * We plan to remove scoping anchors to 'core/heading' to support\n\t\t\t\t\t\t * anchors for all eligble blocks. Additionally we plan to explore\n\t\t\t\t\t\t * leveraging InspectorAdvancedControls instead of a custom\n\t\t\t\t\t\t * PanelBody title. https://github.com/WordPress/gutenberg/issues/28363\n\t\t\t\t\t\t */ }\n\t\t\t\t\t\t{ ! isWeb && props.name === 'core/heading' && (\n\t\t\t\t\t\t\t<InspectorControls>\n\t\t\t\t\t\t\t\t<PanelBody title={ __( 'Heading settings' ) }>\n\t\t\t\t\t\t\t\t\t{ textControl }\n\t\t\t\t\t\t\t\t</PanelBody>\n\t\t\t\t\t\t\t</InspectorControls>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn <BlockEdit { ...props } />;\n\t\t};\n\t},\n\t'withInspectorControl'\n);\n\n/**\n * Override props assigned to save component to inject anchor ID, if block\n * supports anchor. This is only applied if the block's save result is an\n * element and not a markup string.\n *\n * @param {Object} extraProps Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Current block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( extraProps, blockType, attributes ) {\n\tif ( hasBlockSupport( blockType, 'anchor' ) ) {\n\t\textraProps.id = attributes.anchor === '' ? null : attributes.anchor;\n\t}\n\n\treturn extraProps;\n}\n\naddFilter( 'blocks.registerBlockType', 'core/anchor/attribute', addAttribute );\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/anchor/with-inspector-control',\n\twithInspectorControl\n);\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/anchor/save-props',\n\taddSaveProps\n);\n"]}
@@ -320,13 +320,8 @@ function BorderPanel(props) {
320
320
  colors: colors,
321
321
  enableAlpha: true,
322
322
  onChange: onBorderChange,
323
- popoverClassNames: {
324
- linked: 'block-editor__border-box-control__popover',
325
- top: 'block-editor__border-box-control__popover-top',
326
- right: 'block-editor__border-box-control__popover-right',
327
- bottom: 'block-editor__border-box-control__popover-bottom',
328
- left: 'block-editor__border-box-control__popover-left'
329
- },
323
+ popoverPlacement: "left-start",
324
+ popoverOffset: 40,
330
325
  showStyle: isStyleSupported,
331
326
  value: hydratedBorder,
332
327
  __experimentalHasMultipleOrigins: true,