@wordpress/block-editor 12.3.0 → 12.3.1

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 (897) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +12 -0
  3. package/build/autocompleters/block.js +5 -3
  4. package/build/autocompleters/block.js.map +1 -1
  5. package/build/components/alignment-control/index.js +4 -6
  6. package/build/components/alignment-control/index.js.map +1 -1
  7. package/build/components/alignment-control/ui.js +5 -9
  8. package/build/components/alignment-control/ui.js.map +1 -1
  9. package/build/components/autocomplete/index.js +2 -4
  10. package/build/components/autocomplete/index.js.map +1 -1
  11. package/build/components/block-actions/index.js +4 -0
  12. package/build/components/block-actions/index.js.map +1 -1
  13. package/build/components/block-alignment-control/constants.js +1 -5
  14. package/build/components/block-alignment-control/constants.js.map +1 -1
  15. package/build/components/block-alignment-control/index.js +4 -6
  16. package/build/components/block-alignment-control/index.js.map +1 -1
  17. package/build/components/block-alignment-control/ui.js +3 -4
  18. package/build/components/block-alignment-control/ui.js.map +1 -1
  19. package/build/components/block-alignment-control/ui.native.js +3 -3
  20. package/build/components/block-alignment-control/ui.native.js.map +1 -1
  21. package/build/components/block-alignment-matrix-control/index.js +0 -1
  22. package/build/components/block-alignment-matrix-control/index.js.map +1 -1
  23. package/build/components/block-breadcrumb/index.js +2 -3
  24. package/build/components/block-breadcrumb/index.js.map +1 -1
  25. package/build/components/block-controls/fill.js +2 -1
  26. package/build/components/block-controls/fill.js.map +1 -1
  27. package/build/components/block-controls/index.js +8 -8
  28. package/build/components/block-controls/index.js.map +1 -1
  29. package/build/components/block-controls/slot.js +2 -4
  30. package/build/components/block-controls/slot.js.map +1 -1
  31. package/build/components/block-controls/slot.native.js +4 -2
  32. package/build/components/block-controls/slot.native.js.map +1 -1
  33. package/build/components/block-edit/edit.js +4 -6
  34. package/build/components/block-edit/edit.js.map +1 -1
  35. package/build/components/block-edit/edit.native.js +2 -4
  36. package/build/components/block-edit/edit.native.js.map +1 -1
  37. package/build/components/block-edit/index.js +3 -2
  38. package/build/components/block-edit/index.js.map +1 -1
  39. package/build/components/block-heading-level-dropdown/heading-level-icon.js +47 -0
  40. package/build/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -0
  41. package/build/components/block-heading-level-dropdown/index.js +83 -0
  42. package/build/components/block-heading-level-dropdown/index.js.map +1 -0
  43. package/build/components/block-heading-level-dropdown/index.native.js +72 -0
  44. package/build/components/block-heading-level-dropdown/index.native.js.map +1 -0
  45. package/build/components/block-icon/index.native.js +6 -7
  46. package/build/components/block-icon/index.native.js.map +1 -1
  47. package/build/components/block-info-slot-fill/index.js +4 -2
  48. package/build/components/block-info-slot-fill/index.js.map +1 -1
  49. package/build/components/block-inspector/index.js +20 -87
  50. package/build/components/block-inspector/index.js.map +1 -1
  51. package/build/components/block-list/block-list-item.native.js +4 -2
  52. package/build/components/block-list/block-list-item.native.js.map +1 -1
  53. package/build/components/block-list/block.js +6 -4
  54. package/build/components/block-list/block.js.map +1 -1
  55. package/build/components/block-list/block.native.js +1 -0
  56. package/build/components/block-list/block.native.js.map +1 -1
  57. package/build/components/block-list/index.js +7 -4
  58. package/build/components/block-list/index.js.map +1 -1
  59. package/build/components/block-list/index.native.js +8 -9
  60. package/build/components/block-list/index.native.js.map +1 -1
  61. package/build/components/block-list/subdirectory-icon.js +4 -7
  62. package/build/components/block-list/subdirectory-icon.js.map +1 -1
  63. package/build/components/block-list/use-in-between-inserter.js +1 -3
  64. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  65. package/build/components/block-list-appender/index.js +21 -19
  66. package/build/components/block-list-appender/index.js.map +1 -1
  67. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
  68. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  69. package/build/components/block-mover/button.js +12 -12
  70. package/build/components/block-mover/button.js.map +1 -1
  71. package/build/components/block-mover/index.js +11 -10
  72. package/build/components/block-mover/index.js.map +1 -1
  73. package/build/components/block-navigation/dropdown.js +4 -6
  74. package/build/components/block-navigation/dropdown.js.map +1 -1
  75. package/build/components/block-parent-selector/index.js +4 -5
  76. package/build/components/block-parent-selector/index.js.map +1 -1
  77. package/build/components/block-pattern-setup/index.js +6 -8
  78. package/build/components/block-pattern-setup/index.js.map +1 -1
  79. package/build/components/block-patterns-list/index.js +6 -8
  80. package/build/components/block-patterns-list/index.js.map +1 -1
  81. package/build/components/block-popover/inbetween.js +4 -6
  82. package/build/components/block-popover/inbetween.js.map +1 -1
  83. package/build/components/block-popover/index.js +4 -6
  84. package/build/components/block-popover/index.js.map +1 -1
  85. package/build/components/block-preview/auto.js +2 -4
  86. package/build/components/block-preview/auto.js.map +1 -1
  87. package/build/components/block-preview/index.js +7 -7
  88. package/build/components/block-preview/index.js.map +1 -1
  89. package/build/components/block-quick-navigation/index.js +83 -0
  90. package/build/components/block-quick-navigation/index.js.map +1 -0
  91. package/build/components/block-removal-warning-modal/index.js +90 -0
  92. package/build/components/block-removal-warning-modal/index.js.map +1 -0
  93. package/build/components/block-selection-clearer/index.js +4 -7
  94. package/build/components/block-selection-clearer/index.js.map +1 -1
  95. package/build/components/block-settings/button.native.js +2 -1
  96. package/build/components/block-settings/button.native.js.map +1 -1
  97. package/build/components/block-settings/container.native.js +6 -6
  98. package/build/components/block-settings/container.native.js.map +1 -1
  99. package/build/components/block-settings-menu/block-settings-dropdown.js +10 -11
  100. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  101. package/build/components/block-settings-menu/index.js +4 -5
  102. package/build/components/block-settings-menu/index.js.map +1 -1
  103. package/build/components/block-settings-menu-controls/index.js +4 -5
  104. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  105. package/build/components/block-switcher/index.js +1 -2
  106. package/build/components/block-switcher/index.js.map +1 -1
  107. package/build/components/block-switcher/pattern-transformations-menu.js +6 -8
  108. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  109. package/build/components/block-toolbar/index.js +4 -5
  110. package/build/components/block-toolbar/index.js.map +1 -1
  111. package/build/components/block-tools/block-contextual-toolbar.js +4 -5
  112. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  113. package/build/components/block-tools/block-selection-button.js +4 -5
  114. package/build/components/block-tools/block-selection-button.js.map +1 -1
  115. package/build/components/block-tools/index.js +13 -6
  116. package/build/components/block-tools/index.js.map +1 -1
  117. package/build/components/block-tools/insertion-point.js +5 -5
  118. package/build/components/block-tools/insertion-point.js.map +1 -1
  119. package/build/components/block-tools/selected-block-popover.js +8 -8
  120. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  121. package/build/components/block-types-list/index.native.js +4 -6
  122. package/build/components/block-types-list/index.native.js.map +1 -1
  123. package/build/components/block-vertical-alignment-control/index.js +4 -6
  124. package/build/components/block-vertical-alignment-control/index.js.map +1 -1
  125. package/build/components/block-vertical-alignment-control/ui.js +5 -12
  126. package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
  127. package/build/components/border-radius-control/all-input-control.js +2 -6
  128. package/build/components/border-radius-control/all-input-control.js.map +1 -1
  129. package/build/components/border-radius-control/input-controls.js +2 -6
  130. package/build/components/border-radius-control/input-controls.js.map +1 -1
  131. package/build/components/border-radius-control/linked-button.js +2 -6
  132. package/build/components/border-radius-control/linked-button.js.map +1 -1
  133. package/build/components/color-palette/control.js +2 -4
  134. package/build/components/color-palette/control.js.map +1 -1
  135. package/build/components/color-palette/with-color-context.js +2 -4
  136. package/build/components/color-palette/with-color-context.js.map +1 -1
  137. package/build/components/colors/utils.js +7 -3
  138. package/build/components/colors/utils.js.map +1 -1
  139. package/build/components/colors/with-colors.js +11 -16
  140. package/build/components/colors/with-colors.js.map +1 -1
  141. package/build/components/colors-gradients/control.js +7 -5
  142. package/build/components/colors-gradients/control.js.map +1 -1
  143. package/build/components/colors-gradients/dropdown.js +12 -11
  144. package/build/components/colors-gradients/dropdown.js.map +1 -1
  145. package/build/components/colors-gradients/panel-color-gradient-settings.js +7 -5
  146. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  147. package/build/components/copy-handler/index.js +5 -6
  148. package/build/components/copy-handler/index.js.map +1 -1
  149. package/build/components/duotone-control/index.js +1 -2
  150. package/build/components/duotone-control/index.js.map +1 -1
  151. package/build/components/editable-text/index.js +6 -7
  152. package/build/components/editable-text/index.js.map +1 -1
  153. package/build/components/font-appearance-control/index.js +2 -6
  154. package/build/components/font-appearance-control/index.js.map +1 -1
  155. package/build/components/font-family/index.js +4 -5
  156. package/build/components/font-family/index.js.map +1 -1
  157. package/build/components/font-sizes/font-size-picker.js +2 -4
  158. package/build/components/font-sizes/font-size-picker.js.map +1 -1
  159. package/build/components/font-sizes/utils.js +3 -3
  160. package/build/components/font-sizes/utils.js.map +1 -1
  161. package/build/components/font-sizes/with-font-sizes.js +7 -7
  162. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  163. package/build/components/global-styles/color-panel.js +15 -16
  164. package/build/components/global-styles/color-panel.js.map +1 -1
  165. package/build/components/global-styles/effects-panel.js +2 -1
  166. package/build/components/global-styles/effects-panel.js.map +1 -1
  167. package/build/components/global-styles/filters-panel.js +2 -1
  168. package/build/components/global-styles/filters-panel.js.map +1 -1
  169. package/build/components/global-styles/index.js +6 -0
  170. package/build/components/global-styles/index.js.map +1 -1
  171. package/build/components/global-styles/typography-panel.js +7 -7
  172. package/build/components/global-styles/typography-panel.js.map +1 -1
  173. package/build/components/global-styles/use-global-styles-output.js +19 -16
  174. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  175. package/build/components/gradients/with-gradient.js +2 -6
  176. package/build/components/gradients/with-gradient.js.map +1 -1
  177. package/build/components/iframe/index.js +5 -7
  178. package/build/components/iframe/index.js.map +1 -1
  179. package/build/components/image-editor/constants.js +1 -2
  180. package/build/components/image-editor/constants.js.map +1 -1
  181. package/build/components/index.js +9 -9
  182. package/build/components/index.js.map +1 -1
  183. package/build/components/index.native.js +9 -0
  184. package/build/components/index.native.js.map +1 -1
  185. package/build/components/inner-blocks/index.js +9 -8
  186. package/build/components/inner-blocks/index.js.map +1 -1
  187. package/build/components/inner-blocks/index.native.js +8 -7
  188. package/build/components/inner-blocks/index.native.js.map +1 -1
  189. package/build/components/inner-blocks/use-nested-settings-update.js +24 -30
  190. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  191. package/build/components/inner-blocks/with-client-id.js +2 -6
  192. package/build/components/inner-blocks/with-client-id.js.map +1 -1
  193. package/build/components/inserter/block-patterns-explorer/explorer.js +2 -1
  194. package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
  195. package/build/components/inserter/block-patterns-tab.js +33 -5
  196. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  197. package/build/components/inserter/hooks/use-block-types-state.js +4 -3
  198. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  199. package/build/components/inserter/hooks/use-insertion-point.js +1 -1
  200. package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
  201. package/build/components/inserter/index.js +8 -8
  202. package/build/components/inserter/index.js.map +1 -1
  203. package/build/components/inserter/index.native.js +4 -5
  204. package/build/components/inserter/index.native.js.map +1 -1
  205. package/build/components/inserter/library.js +1 -1
  206. package/build/components/inserter/library.js.map +1 -1
  207. package/build/components/inserter/media-tab/media-list.js +2 -6
  208. package/build/components/inserter/media-tab/media-list.js.map +1 -1
  209. package/build/components/inserter/media-tab/media-preview.js +4 -6
  210. package/build/components/inserter/media-tab/media-preview.js.map +1 -1
  211. package/build/components/inserter/media-tab/media-tab.js +1 -1
  212. package/build/components/inserter/media-tab/media-tab.js.map +1 -1
  213. package/build/components/inserter/reusable-blocks-tab.js +3 -3
  214. package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
  215. package/build/components/inserter/tabs.js +3 -3
  216. package/build/components/inserter/tabs.js.map +1 -1
  217. package/build/components/inserter-list-item/index.js +4 -5
  218. package/build/components/inserter-list-item/index.js.map +1 -1
  219. package/build/components/inserter-listbox/group.js +4 -7
  220. package/build/components/inserter-listbox/group.js.map +1 -1
  221. package/build/components/inserter-listbox/item.js +8 -7
  222. package/build/components/inserter-listbox/item.js.map +1 -1
  223. package/build/components/inserter-listbox/row.js +4 -5
  224. package/build/components/inserter-listbox/row.js.map +1 -1
  225. package/build/components/inspector-controls/block-support-slot-container.js +2 -6
  226. package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
  227. package/build/components/inspector-controls/fill.native.js +2 -1
  228. package/build/components/inspector-controls/fill.native.js.map +1 -1
  229. package/build/components/inspector-controls/index.js +4 -6
  230. package/build/components/inspector-controls/index.js.map +1 -1
  231. package/build/components/inspector-controls/slot.js +4 -6
  232. package/build/components/inspector-controls/slot.js.map +1 -1
  233. package/build/components/inspector-controls/slot.native.js +2 -1
  234. package/build/components/inspector-controls/slot.native.js.map +1 -1
  235. package/build/components/justify-content-control/index.js +4 -6
  236. package/build/components/justify-content-control/index.js.map +1 -1
  237. package/build/components/justify-content-control/ui.js +4 -7
  238. package/build/components/justify-content-control/ui.js.map +1 -1
  239. package/build/components/letter-spacing-control/index.js +2 -4
  240. package/build/components/letter-spacing-control/index.js.map +1 -1
  241. package/build/components/line-height-control/index.js +2 -4
  242. package/build/components/line-height-control/index.js.map +1 -1
  243. package/build/components/link-control/index.js +3 -9
  244. package/build/components/link-control/index.js.map +1 -1
  245. package/build/components/link-control/search-create-button.js +2 -4
  246. package/build/components/link-control/search-create-button.js.map +1 -1
  247. package/build/components/link-control/search-input.js +3 -1
  248. package/build/components/link-control/search-input.js.map +1 -1
  249. package/build/components/link-control/search-item.js +2 -4
  250. package/build/components/link-control/search-item.js.map +1 -1
  251. package/build/components/link-control/search-results.js +2 -4
  252. package/build/components/link-control/search-results.js.map +1 -1
  253. package/build/components/list-view/appender.js +4 -6
  254. package/build/components/list-view/appender.js.map +1 -1
  255. package/build/components/list-view/aria-referenced-text.js +4 -8
  256. package/build/components/list-view/aria-referenced-text.js.map +1 -1
  257. package/build/components/list-view/block-contents.js +4 -5
  258. package/build/components/list-view/block-contents.js.map +1 -1
  259. package/build/components/list-view/block-select-button.js +13 -2
  260. package/build/components/list-view/block-select-button.js.map +1 -1
  261. package/build/components/list-view/branch.js +9 -8
  262. package/build/components/list-view/branch.js.map +1 -1
  263. package/build/components/list-view/drop-indicator.js +62 -11
  264. package/build/components/list-view/drop-indicator.js.map +1 -1
  265. package/build/components/list-view/index.js +4 -6
  266. package/build/components/list-view/index.js.map +1 -1
  267. package/build/components/list-view/leaf.js +4 -5
  268. package/build/components/list-view/leaf.js.map +1 -1
  269. package/build/components/list-view/use-list-view-client-ids.js +2 -22
  270. package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
  271. package/build/components/list-view/use-list-view-drop-zone.js +46 -34
  272. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  273. package/build/components/media-placeholder/index.js +38 -13
  274. package/build/components/media-placeholder/index.js.map +1 -1
  275. package/build/components/media-replace-flow/index.js +1 -3
  276. package/build/components/media-replace-flow/index.js.map +1 -1
  277. package/build/components/navigable-toolbar/index.js +8 -8
  278. package/build/components/navigable-toolbar/index.js.map +1 -1
  279. package/build/components/panel-color-settings/index.js +4 -5
  280. package/build/components/panel-color-settings/index.js.map +1 -1
  281. package/build/components/plain-text/index.js +8 -8
  282. package/build/components/plain-text/index.js.map +1 -1
  283. package/build/components/plain-text/index.native.js +7 -6
  284. package/build/components/plain-text/index.native.js.map +1 -1
  285. package/build/components/preview-options/index.js +5 -4
  286. package/build/components/preview-options/index.js.map +1 -1
  287. package/build/components/provider/index.js +2 -4
  288. package/build/components/provider/index.js.map +1 -1
  289. package/build/components/provider/with-registry-provider.js +8 -10
  290. package/build/components/provider/with-registry-provider.js.map +1 -1
  291. package/build/components/publish-date-time-picker/index.js +4 -5
  292. package/build/components/publish-date-time-picker/index.js.map +1 -1
  293. package/build/components/resizable-box-popover/index.js +5 -5
  294. package/build/components/resizable-box-popover/index.js.map +1 -1
  295. package/build/components/rich-text/content.js +99 -0
  296. package/build/components/rich-text/content.js.map +1 -0
  297. package/build/components/rich-text/format-toolbar/index.js +1 -2
  298. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  299. package/build/components/rich-text/index.js +8 -42
  300. package/build/components/rich-text/index.js.map +1 -1
  301. package/build/components/rich-text/index.native.js +6 -34
  302. package/build/components/rich-text/index.native.js.map +1 -1
  303. package/build/components/rich-text/toolbar-button.js +2 -6
  304. package/build/components/rich-text/toolbar-button.js.map +1 -1
  305. package/build/components/spacing-sizes-control/index.js +8 -8
  306. package/build/components/spacing-sizes-control/index.js.map +1 -1
  307. package/build/components/tool-selector/index.js +2 -6
  308. package/build/components/tool-selector/index.js.map +1 -1
  309. package/build/components/unit-control/index.js +4 -5
  310. package/build/components/unit-control/index.js.map +1 -1
  311. package/build/components/url-input/index.js +8 -8
  312. package/build/components/url-input/index.js.map +1 -1
  313. package/build/components/url-input/index.native.js +4 -7
  314. package/build/components/url-input/index.native.js.map +1 -1
  315. package/build/components/url-popover/image-url-input-ui.js +21 -14
  316. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  317. package/build/components/url-popover/index.js +4 -5
  318. package/build/components/url-popover/index.js.map +1 -1
  319. package/build/components/url-popover/link-editor.js +4 -5
  320. package/build/components/url-popover/link-editor.js.map +1 -1
  321. package/build/components/url-popover/link-viewer.js +4 -5
  322. package/build/components/url-popover/link-viewer.js.map +1 -1
  323. package/build/components/use-block-display-information/index.js +30 -2
  324. package/build/components/use-block-display-information/index.js.map +1 -1
  325. package/build/components/video-player/index.native.js +2 -4
  326. package/build/components/video-player/index.native.js.map +1 -1
  327. package/build/components/warning/index.native.js +4 -5
  328. package/build/components/warning/index.native.js.map +1 -1
  329. package/build/components/writing-flow/index.js +2 -4
  330. package/build/components/writing-flow/index.js.map +1 -1
  331. package/build/components/writing-flow/use-drag-selection.js +1 -1
  332. package/build/components/writing-flow/use-drag-selection.js.map +1 -1
  333. package/build/components/writing-flow/use-tab-nav.js +32 -4
  334. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  335. package/build/hooks/align.js +8 -8
  336. package/build/hooks/align.js.map +1 -1
  337. package/build/hooks/anchor.js +4 -2
  338. package/build/hooks/anchor.js.map +1 -1
  339. package/build/hooks/behaviors.js +75 -37
  340. package/build/hooks/behaviors.js.map +1 -1
  341. package/build/hooks/border.js +4 -5
  342. package/build/hooks/border.js.map +1 -1
  343. package/build/hooks/color.js +4 -5
  344. package/build/hooks/color.js.map +1 -1
  345. package/build/hooks/content-lock-ui.js +8 -10
  346. package/build/hooks/content-lock-ui.js.map +1 -1
  347. package/build/hooks/custom-class-name.js +4 -2
  348. package/build/hooks/custom-class-name.js.map +1 -1
  349. package/build/hooks/dimensions.js +7 -7
  350. package/build/hooks/dimensions.js.map +1 -1
  351. package/build/hooks/duotone.js +5 -5
  352. package/build/hooks/duotone.js.map +1 -1
  353. package/build/hooks/font-family.js +2 -6
  354. package/build/hooks/font-family.js.map +1 -1
  355. package/build/hooks/font-size.js +10 -8
  356. package/build/hooks/font-size.js.map +1 -1
  357. package/build/hooks/layout.js +30 -28
  358. package/build/hooks/layout.js.map +1 -1
  359. package/build/hooks/position.js +24 -16
  360. package/build/hooks/position.js.map +1 -1
  361. package/build/hooks/style.js +8 -5
  362. package/build/hooks/style.js.map +1 -1
  363. package/build/hooks/supports.js +1 -1
  364. package/build/hooks/supports.js.map +1 -1
  365. package/build/hooks/typography.native.js +3 -1
  366. package/build/hooks/typography.native.js.map +1 -1
  367. package/build/hooks/use-typography-props.js +10 -17
  368. package/build/hooks/use-typography-props.js.map +1 -1
  369. package/build/index.js +0 -14
  370. package/build/index.js.map +1 -1
  371. package/build/layouts/constrained.js +3 -1
  372. package/build/layouts/constrained.js.map +1 -1
  373. package/build/layouts/definitions.js +154 -0
  374. package/build/layouts/definitions.js.map +1 -0
  375. package/build/layouts/flex.js +8 -5
  376. package/build/layouts/flex.js.map +1 -1
  377. package/build/layouts/flow.js +3 -1
  378. package/build/layouts/flow.js.map +1 -1
  379. package/build/layouts/grid.js +3 -1
  380. package/build/layouts/grid.js.map +1 -1
  381. package/build/layouts/utils.js +8 -2
  382. package/build/layouts/utils.js.map +1 -1
  383. package/build/private-apis.js +17 -1
  384. package/build/private-apis.js.map +1 -1
  385. package/build/store/actions.js +2 -62
  386. package/build/store/actions.js.map +1 -1
  387. package/build/store/private-actions.js +200 -0
  388. package/build/store/private-actions.js.map +1 -1
  389. package/build/store/private-selectors.js +72 -4
  390. package/build/store/private-selectors.js.map +1 -1
  391. package/build/store/reducer.js +52 -1
  392. package/build/store/reducer.js.map +1 -1
  393. package/build/store/selectors.js +42 -42
  394. package/build/store/selectors.js.map +1 -1
  395. package/build/utils/object.js +39 -0
  396. package/build/utils/object.js.map +1 -1
  397. package/build-module/autocompleters/block.js +5 -3
  398. package/build-module/autocompleters/block.js.map +1 -1
  399. package/build-module/components/alignment-control/index.js +4 -5
  400. package/build-module/components/alignment-control/index.js.map +1 -1
  401. package/build-module/components/alignment-control/ui.js +5 -6
  402. package/build-module/components/alignment-control/ui.js.map +1 -1
  403. package/build-module/components/autocomplete/index.js +2 -3
  404. package/build-module/components/autocomplete/index.js.map +1 -1
  405. package/build-module/components/block-actions/index.js +4 -0
  406. package/build-module/components/block-actions/index.js.map +1 -1
  407. package/build-module/components/block-alignment-control/constants.js +0 -3
  408. package/build-module/components/block-alignment-control/constants.js.map +1 -1
  409. package/build-module/components/block-alignment-control/index.js +4 -5
  410. package/build-module/components/block-alignment-control/index.js.map +1 -1
  411. package/build-module/components/block-alignment-control/ui.js +4 -4
  412. package/build-module/components/block-alignment-control/ui.js.map +1 -1
  413. package/build-module/components/block-alignment-control/ui.native.js +3 -2
  414. package/build-module/components/block-alignment-control/ui.native.js.map +1 -1
  415. package/build-module/components/block-alignment-matrix-control/index.js +0 -1
  416. package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
  417. package/build-module/components/block-breadcrumb/index.js +2 -3
  418. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  419. package/build-module/components/block-controls/fill.js +2 -1
  420. package/build-module/components/block-controls/fill.js.map +1 -1
  421. package/build-module/components/block-controls/index.js +8 -7
  422. package/build-module/components/block-controls/index.js.map +1 -1
  423. package/build-module/components/block-controls/slot.js +2 -3
  424. package/build-module/components/block-controls/slot.js.map +1 -1
  425. package/build-module/components/block-controls/slot.native.js +4 -2
  426. package/build-module/components/block-controls/slot.native.js.map +1 -1
  427. package/build-module/components/block-edit/edit.js +4 -5
  428. package/build-module/components/block-edit/edit.js.map +1 -1
  429. package/build-module/components/block-edit/edit.native.js +2 -3
  430. package/build-module/components/block-edit/edit.native.js.map +1 -1
  431. package/build-module/components/block-edit/index.js +3 -2
  432. package/build-module/components/block-edit/index.js.map +1 -1
  433. package/build-module/components/block-heading-level-dropdown/heading-level-icon.js +39 -0
  434. package/build-module/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -0
  435. package/build-module/components/block-heading-level-dropdown/index.js +71 -0
  436. package/build-module/components/block-heading-level-dropdown/index.js.map +1 -0
  437. package/build-module/components/block-heading-level-dropdown/index.native.js +60 -0
  438. package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -0
  439. package/build-module/components/block-icon/index.native.js +6 -6
  440. package/build-module/components/block-icon/index.native.js.map +1 -1
  441. package/build-module/components/block-info-slot-fill/index.js +4 -2
  442. package/build-module/components/block-info-slot-fill/index.js.map +1 -1
  443. package/build-module/components/block-inspector/index.js +20 -88
  444. package/build-module/components/block-inspector/index.js.map +1 -1
  445. package/build-module/components/block-list/block-list-item.native.js +4 -2
  446. package/build-module/components/block-list/block-list-item.native.js.map +1 -1
  447. package/build-module/components/block-list/block.js +6 -4
  448. package/build-module/components/block-list/block.js.map +1 -1
  449. package/build-module/components/block-list/block.native.js +1 -0
  450. package/build-module/components/block-list/block.native.js.map +1 -1
  451. package/build-module/components/block-list/index.js +7 -4
  452. package/build-module/components/block-list/index.js.map +1 -1
  453. package/build-module/components/block-list/index.native.js +8 -8
  454. package/build-module/components/block-list/index.native.js.map +1 -1
  455. package/build-module/components/block-list/subdirectory-icon.js +4 -4
  456. package/build-module/components/block-list/subdirectory-icon.js.map +1 -1
  457. package/build-module/components/block-list/use-in-between-inserter.js +1 -3
  458. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  459. package/build-module/components/block-list-appender/index.js +21 -19
  460. package/build-module/components/block-list-appender/index.js.map +1 -1
  461. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
  462. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  463. package/build-module/components/block-mover/button.js +12 -11
  464. package/build-module/components/block-mover/button.js.map +1 -1
  465. package/build-module/components/block-mover/index.js +11 -9
  466. package/build-module/components/block-mover/index.js.map +1 -1
  467. package/build-module/components/block-navigation/dropdown.js +4 -5
  468. package/build-module/components/block-navigation/dropdown.js.map +1 -1
  469. package/build-module/components/block-parent-selector/index.js +4 -4
  470. package/build-module/components/block-parent-selector/index.js.map +1 -1
  471. package/build-module/components/block-pattern-setup/index.js +6 -7
  472. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  473. package/build-module/components/block-patterns-list/index.js +6 -7
  474. package/build-module/components/block-patterns-list/index.js.map +1 -1
  475. package/build-module/components/block-popover/inbetween.js +4 -5
  476. package/build-module/components/block-popover/inbetween.js.map +1 -1
  477. package/build-module/components/block-popover/index.js +4 -5
  478. package/build-module/components/block-popover/index.js.map +1 -1
  479. package/build-module/components/block-preview/auto.js +2 -3
  480. package/build-module/components/block-preview/auto.js.map +1 -1
  481. package/build-module/components/block-preview/index.js +7 -7
  482. package/build-module/components/block-preview/index.js.map +1 -1
  483. package/build-module/components/block-quick-navigation/index.js +69 -0
  484. package/build-module/components/block-quick-navigation/index.js.map +1 -0
  485. package/build-module/components/block-removal-warning-modal/index.js +76 -0
  486. package/build-module/components/block-removal-warning-modal/index.js.map +1 -0
  487. package/build-module/components/block-selection-clearer/index.js +4 -4
  488. package/build-module/components/block-selection-clearer/index.js.map +1 -1
  489. package/build-module/components/block-settings/button.native.js +2 -1
  490. package/build-module/components/block-settings/button.native.js.map +1 -1
  491. package/build-module/components/block-settings/container.native.js +6 -5
  492. package/build-module/components/block-settings/container.native.js.map +1 -1
  493. package/build-module/components/block-settings-menu/block-settings-dropdown.js +10 -10
  494. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  495. package/build-module/components/block-settings-menu/index.js +4 -4
  496. package/build-module/components/block-settings-menu/index.js.map +1 -1
  497. package/build-module/components/block-settings-menu-controls/index.js +4 -4
  498. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  499. package/build-module/components/block-switcher/index.js +1 -2
  500. package/build-module/components/block-switcher/index.js.map +1 -1
  501. package/build-module/components/block-switcher/pattern-transformations-menu.js +6 -7
  502. package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  503. package/build-module/components/block-toolbar/index.js +4 -4
  504. package/build-module/components/block-toolbar/index.js.map +1 -1
  505. package/build-module/components/block-tools/block-contextual-toolbar.js +4 -4
  506. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  507. package/build-module/components/block-tools/block-selection-button.js +4 -4
  508. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  509. package/build-module/components/block-tools/index.js +13 -5
  510. package/build-module/components/block-tools/index.js.map +1 -1
  511. package/build-module/components/block-tools/insertion-point.js +5 -4
  512. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  513. package/build-module/components/block-tools/selected-block-popover.js +8 -7
  514. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  515. package/build-module/components/block-types-list/index.native.js +4 -5
  516. package/build-module/components/block-types-list/index.native.js.map +1 -1
  517. package/build-module/components/block-vertical-alignment-control/index.js +4 -5
  518. package/build-module/components/block-vertical-alignment-control/index.js.map +1 -1
  519. package/build-module/components/block-vertical-alignment-control/ui.js +5 -9
  520. package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
  521. package/build-module/components/border-radius-control/all-input-control.js +2 -3
  522. package/build-module/components/border-radius-control/all-input-control.js.map +1 -1
  523. package/build-module/components/border-radius-control/input-controls.js +2 -3
  524. package/build-module/components/border-radius-control/input-controls.js.map +1 -1
  525. package/build-module/components/border-radius-control/linked-button.js +2 -3
  526. package/build-module/components/border-radius-control/linked-button.js.map +1 -1
  527. package/build-module/components/color-palette/control.js +2 -3
  528. package/build-module/components/color-palette/control.js.map +1 -1
  529. package/build-module/components/color-palette/with-color-context.js +2 -3
  530. package/build-module/components/color-palette/with-color-context.js.map +1 -1
  531. package/build-module/components/colors/utils.js +5 -1
  532. package/build-module/components/colors/utils.js.map +1 -1
  533. package/build-module/components/colors/with-colors.js +10 -14
  534. package/build-module/components/colors/with-colors.js.map +1 -1
  535. package/build-module/components/colors-gradients/control.js +7 -4
  536. package/build-module/components/colors-gradients/control.js.map +1 -1
  537. package/build-module/components/colors-gradients/dropdown.js +12 -10
  538. package/build-module/components/colors-gradients/dropdown.js.map +1 -1
  539. package/build-module/components/colors-gradients/panel-color-gradient-settings.js +7 -4
  540. package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  541. package/build-module/components/copy-handler/index.js +5 -6
  542. package/build-module/components/copy-handler/index.js.map +1 -1
  543. package/build-module/components/duotone-control/index.js +1 -2
  544. package/build-module/components/duotone-control/index.js.map +1 -1
  545. package/build-module/components/editable-text/index.js +6 -6
  546. package/build-module/components/editable-text/index.js.map +1 -1
  547. package/build-module/components/font-appearance-control/index.js +2 -3
  548. package/build-module/components/font-appearance-control/index.js.map +1 -1
  549. package/build-module/components/font-family/index.js +4 -4
  550. package/build-module/components/font-family/index.js.map +1 -1
  551. package/build-module/components/font-sizes/font-size-picker.js +2 -3
  552. package/build-module/components/font-sizes/font-size-picker.js.map +1 -1
  553. package/build-module/components/font-sizes/utils.js +2 -2
  554. package/build-module/components/font-sizes/utils.js.map +1 -1
  555. package/build-module/components/font-sizes/with-font-sizes.js +7 -6
  556. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  557. package/build-module/components/global-styles/color-panel.js +15 -15
  558. package/build-module/components/global-styles/color-panel.js.map +1 -1
  559. package/build-module/components/global-styles/effects-panel.js +2 -1
  560. package/build-module/components/global-styles/effects-panel.js.map +1 -1
  561. package/build-module/components/global-styles/filters-panel.js +2 -1
  562. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  563. package/build-module/components/global-styles/index.js +1 -1
  564. package/build-module/components/global-styles/index.js.map +1 -1
  565. package/build-module/components/global-styles/typography-panel.js +7 -7
  566. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  567. package/build-module/components/global-styles/use-global-styles-output.js +11 -10
  568. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  569. package/build-module/components/gradients/with-gradient.js +2 -3
  570. package/build-module/components/gradients/with-gradient.js.map +1 -1
  571. package/build-module/components/iframe/index.js +5 -6
  572. package/build-module/components/iframe/index.js.map +1 -1
  573. package/build-module/components/image-editor/constants.js +1 -2
  574. package/build-module/components/image-editor/constants.js.map +1 -1
  575. package/build-module/components/index.js +1 -1
  576. package/build-module/components/index.js.map +1 -1
  577. package/build-module/components/index.native.js +1 -0
  578. package/build-module/components/index.native.js.map +1 -1
  579. package/build-module/components/inner-blocks/index.js +9 -7
  580. package/build-module/components/inner-blocks/index.js.map +1 -1
  581. package/build-module/components/inner-blocks/index.native.js +8 -6
  582. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  583. package/build-module/components/inner-blocks/use-nested-settings-update.js +24 -27
  584. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  585. package/build-module/components/inner-blocks/with-client-id.js +2 -3
  586. package/build-module/components/inner-blocks/with-client-id.js.map +1 -1
  587. package/build-module/components/inserter/block-patterns-explorer/explorer.js +2 -1
  588. package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
  589. package/build-module/components/inserter/block-patterns-tab.js +33 -7
  590. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  591. package/build-module/components/inserter/hooks/use-block-types-state.js +4 -3
  592. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  593. package/build-module/components/inserter/hooks/use-insertion-point.js +1 -1
  594. package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
  595. package/build-module/components/inserter/index.js +8 -7
  596. package/build-module/components/inserter/index.js.map +1 -1
  597. package/build-module/components/inserter/index.native.js +4 -4
  598. package/build-module/components/inserter/index.native.js.map +1 -1
  599. package/build-module/components/inserter/library.js +1 -1
  600. package/build-module/components/inserter/library.js.map +1 -1
  601. package/build-module/components/inserter/media-tab/media-list.js +2 -3
  602. package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
  603. package/build-module/components/inserter/media-tab/media-preview.js +4 -5
  604. package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
  605. package/build-module/components/inserter/media-tab/media-tab.js +3 -3
  606. package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
  607. package/build-module/components/inserter/reusable-blocks-tab.js +3 -3
  608. package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
  609. package/build-module/components/inserter/tabs.js +3 -3
  610. package/build-module/components/inserter/tabs.js.map +1 -1
  611. package/build-module/components/inserter-list-item/index.js +4 -4
  612. package/build-module/components/inserter-list-item/index.js.map +1 -1
  613. package/build-module/components/inserter-listbox/group.js +4 -4
  614. package/build-module/components/inserter-listbox/group.js.map +1 -1
  615. package/build-module/components/inserter-listbox/item.js +8 -6
  616. package/build-module/components/inserter-listbox/item.js.map +1 -1
  617. package/build-module/components/inserter-listbox/row.js +4 -4
  618. package/build-module/components/inserter-listbox/row.js.map +1 -1
  619. package/build-module/components/inspector-controls/block-support-slot-container.js +2 -3
  620. package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
  621. package/build-module/components/inspector-controls/fill.native.js +2 -1
  622. package/build-module/components/inspector-controls/fill.native.js.map +1 -1
  623. package/build-module/components/inspector-controls/index.js +4 -5
  624. package/build-module/components/inspector-controls/index.js.map +1 -1
  625. package/build-module/components/inspector-controls/slot.js +4 -5
  626. package/build-module/components/inspector-controls/slot.js.map +1 -1
  627. package/build-module/components/inspector-controls/slot.native.js +2 -1
  628. package/build-module/components/inspector-controls/slot.native.js.map +1 -1
  629. package/build-module/components/justify-content-control/index.js +4 -5
  630. package/build-module/components/justify-content-control/index.js.map +1 -1
  631. package/build-module/components/justify-content-control/ui.js +4 -4
  632. package/build-module/components/justify-content-control/ui.js.map +1 -1
  633. package/build-module/components/letter-spacing-control/index.js +2 -3
  634. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  635. package/build-module/components/line-height-control/index.js +2 -3
  636. package/build-module/components/line-height-control/index.js.map +1 -1
  637. package/build-module/components/link-control/index.js +3 -9
  638. package/build-module/components/link-control/index.js.map +1 -1
  639. package/build-module/components/link-control/search-create-button.js +2 -3
  640. package/build-module/components/link-control/search-create-button.js.map +1 -1
  641. package/build-module/components/link-control/search-input.js +3 -1
  642. package/build-module/components/link-control/search-input.js.map +1 -1
  643. package/build-module/components/link-control/search-item.js +2 -3
  644. package/build-module/components/link-control/search-item.js.map +1 -1
  645. package/build-module/components/link-control/search-results.js +2 -3
  646. package/build-module/components/link-control/search-results.js.map +1 -1
  647. package/build-module/components/list-view/appender.js +4 -5
  648. package/build-module/components/list-view/appender.js.map +1 -1
  649. package/build-module/components/list-view/aria-referenced-text.js +4 -5
  650. package/build-module/components/list-view/aria-referenced-text.js.map +1 -1
  651. package/build-module/components/list-view/block-contents.js +4 -4
  652. package/build-module/components/list-view/block-contents.js.map +1 -1
  653. package/build-module/components/list-view/block-select-button.js +14 -4
  654. package/build-module/components/list-view/block-select-button.js.map +1 -1
  655. package/build-module/components/list-view/branch.js +9 -7
  656. package/build-module/components/list-view/branch.js.map +1 -1
  657. package/build-module/components/list-view/drop-indicator.js +61 -11
  658. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  659. package/build-module/components/list-view/index.js +4 -5
  660. package/build-module/components/list-view/index.js.map +1 -1
  661. package/build-module/components/list-view/leaf.js +4 -4
  662. package/build-module/components/list-view/leaf.js.map +1 -1
  663. package/build-module/components/list-view/use-list-view-client-ids.js +2 -22
  664. package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
  665. package/build-module/components/list-view/use-list-view-drop-zone.js +45 -34
  666. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  667. package/build-module/components/media-placeholder/index.js +38 -13
  668. package/build-module/components/media-placeholder/index.js.map +1 -1
  669. package/build-module/components/media-replace-flow/index.js +1 -3
  670. package/build-module/components/media-replace-flow/index.js.map +1 -1
  671. package/build-module/components/navigable-toolbar/index.js +8 -7
  672. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  673. package/build-module/components/panel-color-settings/index.js +4 -4
  674. package/build-module/components/panel-color-settings/index.js.map +1 -1
  675. package/build-module/components/plain-text/index.js +8 -7
  676. package/build-module/components/plain-text/index.js.map +1 -1
  677. package/build-module/components/plain-text/index.native.js +7 -5
  678. package/build-module/components/plain-text/index.native.js.map +1 -1
  679. package/build-module/components/preview-options/index.js +5 -4
  680. package/build-module/components/preview-options/index.js.map +1 -1
  681. package/build-module/components/provider/index.js +2 -3
  682. package/build-module/components/provider/index.js.map +1 -1
  683. package/build-module/components/provider/with-registry-provider.js +8 -7
  684. package/build-module/components/provider/with-registry-provider.js.map +1 -1
  685. package/build-module/components/publish-date-time-picker/index.js +4 -4
  686. package/build-module/components/publish-date-time-picker/index.js.map +1 -1
  687. package/build-module/components/resizable-box-popover/index.js +5 -4
  688. package/build-module/components/resizable-box-popover/index.js.map +1 -1
  689. package/build-module/components/rich-text/content.js +85 -0
  690. package/build-module/components/rich-text/content.js.map +1 -0
  691. package/build-module/components/rich-text/format-toolbar/index.js +1 -2
  692. package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
  693. package/build-module/components/rich-text/index.js +8 -42
  694. package/build-module/components/rich-text/index.js.map +1 -1
  695. package/build-module/components/rich-text/index.native.js +6 -34
  696. package/build-module/components/rich-text/index.native.js.map +1 -1
  697. package/build-module/components/rich-text/toolbar-button.js +2 -3
  698. package/build-module/components/rich-text/toolbar-button.js.map +1 -1
  699. package/build-module/components/spacing-sizes-control/index.js +8 -7
  700. package/build-module/components/spacing-sizes-control/index.js.map +1 -1
  701. package/build-module/components/tool-selector/index.js +2 -3
  702. package/build-module/components/tool-selector/index.js.map +1 -1
  703. package/build-module/components/unit-control/index.js +4 -4
  704. package/build-module/components/unit-control/index.js.map +1 -1
  705. package/build-module/components/url-input/index.js +8 -7
  706. package/build-module/components/url-input/index.js.map +1 -1
  707. package/build-module/components/url-input/index.native.js +4 -4
  708. package/build-module/components/url-input/index.native.js.map +1 -1
  709. package/build-module/components/url-popover/image-url-input-ui.js +22 -15
  710. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  711. package/build-module/components/url-popover/index.js +4 -4
  712. package/build-module/components/url-popover/index.js.map +1 -1
  713. package/build-module/components/url-popover/link-editor.js +4 -4
  714. package/build-module/components/url-popover/link-editor.js.map +1 -1
  715. package/build-module/components/url-popover/link-viewer.js +4 -4
  716. package/build-module/components/url-popover/link-viewer.js.map +1 -1
  717. package/build-module/components/use-block-display-information/index.js +29 -2
  718. package/build-module/components/use-block-display-information/index.js.map +1 -1
  719. package/build-module/components/video-player/index.native.js +2 -3
  720. package/build-module/components/video-player/index.native.js.map +1 -1
  721. package/build-module/components/warning/index.native.js +4 -4
  722. package/build-module/components/warning/index.native.js.map +1 -1
  723. package/build-module/components/writing-flow/index.js +2 -3
  724. package/build-module/components/writing-flow/index.js.map +1 -1
  725. package/build-module/components/writing-flow/use-drag-selection.js +1 -1
  726. package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
  727. package/build-module/components/writing-flow/use-tab-nav.js +32 -5
  728. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  729. package/build-module/hooks/align.js +8 -7
  730. package/build-module/hooks/align.js.map +1 -1
  731. package/build-module/hooks/anchor.js +4 -2
  732. package/build-module/hooks/anchor.js.map +1 -1
  733. package/build-module/hooks/behaviors.js +76 -34
  734. package/build-module/hooks/behaviors.js.map +1 -1
  735. package/build-module/hooks/border.js +4 -4
  736. package/build-module/hooks/border.js.map +1 -1
  737. package/build-module/hooks/color.js +4 -4
  738. package/build-module/hooks/color.js.map +1 -1
  739. package/build-module/hooks/content-lock-ui.js +8 -7
  740. package/build-module/hooks/content-lock-ui.js.map +1 -1
  741. package/build-module/hooks/custom-class-name.js +4 -2
  742. package/build-module/hooks/custom-class-name.js.map +1 -1
  743. package/build-module/hooks/dimensions.js +7 -6
  744. package/build-module/hooks/dimensions.js.map +1 -1
  745. package/build-module/hooks/duotone.js +5 -4
  746. package/build-module/hooks/duotone.js.map +1 -1
  747. package/build-module/hooks/font-family.js +1 -5
  748. package/build-module/hooks/font-family.js.map +1 -1
  749. package/build-module/hooks/font-size.js +10 -9
  750. package/build-module/hooks/font-size.js.map +1 -1
  751. package/build-module/hooks/layout.js +26 -24
  752. package/build-module/hooks/layout.js.map +1 -1
  753. package/build-module/hooks/position.js +23 -15
  754. package/build-module/hooks/position.js.map +1 -1
  755. package/build-module/hooks/style.js +8 -4
  756. package/build-module/hooks/style.js.map +1 -1
  757. package/build-module/hooks/supports.js +1 -1
  758. package/build-module/hooks/supports.js.map +1 -1
  759. package/build-module/hooks/typography.native.js +3 -1
  760. package/build-module/hooks/typography.native.js.map +1 -1
  761. package/build-module/hooks/use-typography-props.js +8 -15
  762. package/build-module/hooks/use-typography-props.js.map +1 -1
  763. package/build-module/index.js +1 -1
  764. package/build-module/index.js.map +1 -1
  765. package/build-module/layouts/constrained.js +2 -1
  766. package/build-module/layouts/constrained.js.map +1 -1
  767. package/build-module/layouts/definitions.js +147 -0
  768. package/build-module/layouts/definitions.js.map +1 -0
  769. package/build-module/layouts/flex.js +8 -6
  770. package/build-module/layouts/flex.js.map +1 -1
  771. package/build-module/layouts/flow.js +2 -1
  772. package/build-module/layouts/flow.js.map +1 -1
  773. package/build-module/layouts/grid.js +2 -1
  774. package/build-module/layouts/grid.js.map +1 -1
  775. package/build-module/layouts/utils.js +7 -2
  776. package/build-module/layouts/utils.js.map +1 -1
  777. package/build-module/private-apis.js +12 -1
  778. package/build-module/private-apis.js.map +1 -1
  779. package/build-module/store/actions.js +2 -62
  780. package/build-module/store/actions.js.map +1 -1
  781. package/build-module/store/private-actions.js +186 -0
  782. package/build-module/store/private-actions.js.map +1 -1
  783. package/build-module/store/private-selectors.js +63 -3
  784. package/build-module/store/private-selectors.js.map +1 -1
  785. package/build-module/store/reducer.js +52 -1
  786. package/build-module/store/reducer.js.map +1 -1
  787. package/build-module/store/selectors.js +42 -42
  788. package/build-module/store/selectors.js.map +1 -1
  789. package/build-module/utils/object.js +37 -1
  790. package/build-module/utils/object.js.map +1 -1
  791. package/build-style/style-rtl.css +16 -21
  792. package/build-style/style.css +16 -21
  793. package/package.json +31 -31
  794. package/src/autocompleters/block.js +4 -2
  795. package/src/components/alignment-control/ui.js +1 -2
  796. package/src/components/block-actions/index.js +10 -0
  797. package/src/components/block-alignment-control/constants.js +0 -4
  798. package/src/components/block-alignment-control/ui.js +1 -6
  799. package/src/components/block-alignment-matrix-control/index.js +1 -1
  800. package/src/components/block-breadcrumb/index.js +2 -6
  801. package/src/components/block-edit/index.js +3 -5
  802. package/src/components/block-heading-level-dropdown/README.md +52 -0
  803. package/src/components/block-heading-level-dropdown/heading-level-icon.js +43 -0
  804. package/src/components/block-heading-level-dropdown/index.js +77 -0
  805. package/src/components/block-heading-level-dropdown/index.native.js +63 -0
  806. package/src/components/block-inspector/index.js +18 -92
  807. package/src/components/block-inspector/style.scss +0 -5
  808. package/src/components/block-list/block.native.js +1 -0
  809. package/src/components/block-list/index.js +1 -1
  810. package/src/components/block-list/use-in-between-inserter.js +0 -4
  811. package/src/components/block-list-appender/index.js +29 -22
  812. package/src/components/block-lock/style.scss +11 -4
  813. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
  814. package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +2 -2
  815. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +3 -3
  816. package/src/components/block-mover/test/index.native.js +1 -20
  817. package/src/components/block-preview/index.js +7 -14
  818. package/src/components/block-quick-navigation/index.js +81 -0
  819. package/src/components/block-removal-warning-modal/index.js +94 -0
  820. package/src/components/block-settings-menu/block-settings-dropdown.js +15 -13
  821. package/src/components/block-switcher/index.js +1 -2
  822. package/src/components/block-toolbar/style.scss +0 -4
  823. package/src/components/block-tools/index.js +10 -1
  824. package/src/components/block-vertical-alignment-control/ui.js +1 -3
  825. package/src/components/colors/utils.js +5 -1
  826. package/src/components/colors/with-colors.js +1 -5
  827. package/src/components/copy-handler/index.js +5 -5
  828. package/src/components/duotone-control/index.js +0 -1
  829. package/src/components/font-sizes/test/fluid-utils.js +97 -76
  830. package/src/components/font-sizes/utils.js +2 -2
  831. package/src/components/global-styles/color-panel.js +3 -3
  832. package/src/components/global-styles/index.js +1 -0
  833. package/src/components/global-styles/test/use-global-styles-output.js +14 -9
  834. package/src/components/global-styles/typography-panel.js +19 -16
  835. package/src/components/global-styles/use-global-styles-output.js +12 -12
  836. package/src/components/iframe/index.js +1 -1
  837. package/src/components/image-editor/constants.js +0 -1
  838. package/src/components/index.js +1 -1
  839. package/src/components/index.native.js +1 -0
  840. package/src/components/inner-blocks/index.js +4 -2
  841. package/src/components/inner-blocks/index.native.js +1 -1
  842. package/src/components/inner-blocks/use-nested-settings-update.js +31 -36
  843. package/src/components/inserter/block-patterns-tab.js +63 -8
  844. package/src/components/inserter/hooks/use-block-types-state.js +4 -3
  845. package/src/components/inserter/hooks/use-insertion-point.js +1 -0
  846. package/src/components/inserter/library.js +2 -1
  847. package/src/components/inserter/media-tab/media-tab.js +9 -3
  848. package/src/components/inserter/reusable-blocks-tab.js +3 -3
  849. package/src/components/inserter/tabs.js +3 -3
  850. package/src/components/link-control/index.js +2 -9
  851. package/src/components/link-control/search-input.js +1 -0
  852. package/src/components/link-control/test/index.js +40 -51
  853. package/src/components/list-view/block-select-button.js +19 -1
  854. package/src/components/list-view/branch.js +6 -3
  855. package/src/components/list-view/drop-indicator.js +94 -9
  856. package/src/components/list-view/style.scss +13 -12
  857. package/src/components/list-view/test/use-list-view-drop-zone.js +188 -93
  858. package/src/components/list-view/use-list-view-client-ids.js +3 -20
  859. package/src/components/list-view/use-list-view-drop-zone.js +97 -54
  860. package/src/components/media-placeholder/index.js +54 -20
  861. package/src/components/media-replace-flow/index.js +1 -3
  862. package/src/components/preview-options/index.js +3 -2
  863. package/src/components/provider/test/experimental-provider.js +9 -6
  864. package/src/components/rich-text/content.js +85 -0
  865. package/src/components/rich-text/format-toolbar/index.js +1 -2
  866. package/src/components/rich-text/index.js +2 -35
  867. package/src/components/rich-text/index.native.js +3 -33
  868. package/src/components/url-popover/image-url-input-ui.js +15 -15
  869. package/src/components/url-popover/test/__snapshots__/index.js.snap +3 -3
  870. package/src/components/use-block-display-information/index.js +26 -0
  871. package/src/components/writing-flow/use-drag-selection.js +1 -1
  872. package/src/components/writing-flow/use-tab-nav.js +42 -6
  873. package/src/hooks/behaviors.js +82 -39
  874. package/src/hooks/font-family.js +1 -5
  875. package/src/hooks/font-size.js +12 -17
  876. package/src/hooks/layout.js +17 -25
  877. package/src/hooks/position.js +24 -12
  878. package/src/hooks/supports.js +1 -1
  879. package/src/hooks/use-typography-props.js +14 -19
  880. package/src/index.js +0 -2
  881. package/src/layouts/constrained.js +2 -1
  882. package/src/layouts/definitions.js +174 -0
  883. package/src/layouts/flex.js +7 -5
  884. package/src/layouts/flow.js +2 -1
  885. package/src/layouts/grid.js +2 -1
  886. package/src/layouts/test/utils.js +2 -7
  887. package/src/layouts/utils.js +7 -2
  888. package/src/private-apis.js +11 -0
  889. package/src/store/actions.js +7 -56
  890. package/src/store/private-actions.js +193 -0
  891. package/src/store/private-selectors.js +108 -35
  892. package/src/store/reducer.js +44 -0
  893. package/src/store/selectors.js +61 -39
  894. package/src/store/test/private-selectors.js +269 -1
  895. package/src/store/test/selectors.js +18 -17
  896. package/src/utils/object.js +35 -0
  897. package/src/utils/test/object.js +96 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/use-block-display-information/index.js"],"names":["useBlockDisplayInformation","clientId","select","getBlockName","getBlockAttributes","blockEditorStore","getBlockType","getActiveBlockVariation","blocksStore","blockName","blockType","attributes","match","isSynced","blockTypeInfo","title","icon","description","anchor"],"mappings":";;;;;;;AAGA;;AACA;;AASA;;AAbA;AACA;AACA;;AAQA;AACA;AACA;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEe,SAASA,0BAAT,CAAqCC,QAArC,EAAgD;AAC9D,SAAO,qBACJC,MAAF,IAAc;AACb,QAAK,CAAED,QAAP,EAAkB,OAAO,IAAP;AAClB,UAAM;AAAEE,MAAAA,YAAF;AAAgBC,MAAAA;AAAhB,QACLF,MAAM,CAAEG,YAAF,CADP;AAEA,UAAM;AAAEC,MAAAA,YAAF;AAAgBC,MAAAA;AAAhB,QACLL,MAAM,CAAEM,aAAF,CADP;AAEA,UAAMC,SAAS,GAAGN,YAAY,CAAEF,QAAF,CAA9B;AACA,UAAMS,SAAS,GAAGJ,YAAY,CAAEG,SAAF,CAA9B;AACA,QAAK,CAAEC,SAAP,EAAmB,OAAO,IAAP;AACnB,UAAMC,UAAU,GAAGP,kBAAkB,CAAEH,QAAF,CAArC;AACA,UAAMW,KAAK,GAAGL,uBAAuB,CAAEE,SAAF,EAAaE,UAAb,CAArC;AACA,UAAME,QAAQ,GACb,6BAAiBH,SAAjB,KAAgC,4BAAgBA,SAAhB,CADjC;AAEA,UAAMI,aAAa,GAAG;AACrBD,MAAAA,QADqB;AAErBE,MAAAA,KAAK,EAAEL,SAAS,CAACK,KAFI;AAGrBC,MAAAA,IAAI,EAAEN,SAAS,CAACM,IAHK;AAIrBC,MAAAA,WAAW,EAAEP,SAAS,CAACO,WAJF;AAKrBC,MAAAA,MAAM,EAAEP,UAAU,EAAEO;AALC,KAAtB;AAOA,QAAK,CAAEN,KAAP,EAAe,OAAOE,aAAP;AAEf,WAAO;AACND,MAAAA,QADM;AAENE,MAAAA,KAAK,EAAEH,KAAK,CAACG,KAAN,IAAeL,SAAS,CAACK,KAF1B;AAGNC,MAAAA,IAAI,EAAEJ,KAAK,CAACI,IAAN,IAAcN,SAAS,CAACM,IAHxB;AAINC,MAAAA,WAAW,EAAEL,KAAK,CAACK,WAAN,IAAqBP,SAAS,CAACO,WAJtC;AAKNC,MAAAA,MAAM,EAAEP,UAAU,EAAEO;AALd,KAAP;AAOA,GA9BK,EA+BN,CAAEjB,QAAF,CA/BM,CAAP;AAiCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tstore as blocksStore,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('@wordpress/blocks').WPIcon} WPIcon */\n\n/**\n * Contains basic block's information for display reasons.\n *\n * @typedef {Object} WPBlockDisplayInformation\n *\n * @property {boolean} isSynced True if is a reusable block or template part\n * @property {string} title Human-readable block type label.\n * @property {WPIcon} icon Block type icon.\n * @property {string} description A detailed block type description.\n * @property {string} anchor HTML anchor.\n */\n\n/**\n * Hook used to try to find a matching block variation and return\n * the appropriate information for display reasons. In order to\n * to try to find a match we need to things:\n * 1. Block's client id to extract it's current attributes.\n * 2. A block variation should have set `isActive` prop to a proper function.\n *\n * If for any reason a block variation match cannot be found,\n * the returned information come from the Block Type.\n * If no blockType is found with the provided clientId, returns null.\n *\n * @param {string} clientId Block's client id.\n * @return {?WPBlockDisplayInformation} Block's display information, or `null` when the block or its type not found.\n */\n\nexport default function useBlockDisplayInformation( clientId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! clientId ) return null;\n\t\t\tconst { getBlockName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { getBlockType, getActiveBlockVariation } =\n\t\t\t\tselect( blocksStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tif ( ! blockType ) return null;\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\tconst match = getActiveBlockVariation( blockName, attributes );\n\t\t\tconst isSynced =\n\t\t\t\tisReusableBlock( blockType ) || isTemplatePart( blockType );\n\t\t\tconst blockTypeInfo = {\n\t\t\t\tisSynced,\n\t\t\t\ttitle: blockType.title,\n\t\t\t\ticon: blockType.icon,\n\t\t\t\tdescription: blockType.description,\n\t\t\t\tanchor: attributes?.anchor,\n\t\t\t};\n\t\t\tif ( ! match ) return blockTypeInfo;\n\n\t\t\treturn {\n\t\t\t\tisSynced,\n\t\t\t\ttitle: match.title || blockType.title,\n\t\t\t\ticon: match.icon || blockType.icon,\n\t\t\t\tdescription: match.description || blockType.description,\n\t\t\t\tanchor: attributes?.anchor,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/use-block-display-information/index.js"],"names":["getPositionTypeLabel","attributes","positionType","style","position","type","useBlockDisplayInformation","clientId","select","getBlockName","getBlockAttributes","blockEditorStore","getBlockType","getActiveBlockVariation","blocksStore","blockName","blockType","match","isSynced","positionLabel","blockTypeInfo","title","icon","description","anchor"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AAKA;;AAdA;AACA;AACA;;AASA;AACA;AACA;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,oBAAT,CAA+BC,UAA/B,EAA4C;AAC3C,QAAMC,YAAY,GAAGD,UAAU,EAAEE,KAAZ,EAAmBC,QAAnB,EAA6BC,IAAlD;;AAEA,MAAKH,YAAY,KAAK,QAAtB,EAAiC;AAChC,WAAO,cAAI,QAAJ,CAAP;AACA;;AAED,MAAKA,YAAY,KAAK,OAAtB,EAAgC;AAC/B,WAAO,cAAI,OAAJ,C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KAAK,CAACI,KAAN,IAAeL,SAAS,CAACK,KAF1B;AAGNC,MAAAA,IAAI,EAAEL,KAAK,CAACK,IAAN,IAAcN,SAAS,CAACM,IAHxB;AAINC,MAAAA,WAAW,EAAEN,KAAK,CAACM,WAAN,IAAqBP,SAAS,CAACO,WAJtC;AAKNC,MAAAA,MAAM,EAAEvB,UAAU,EAAEuB,MALd;AAMNL,MAAAA,aANM;AAONjB,MAAAA,YAAY,EAAED,UAAU,EAAEE,KAAZ,EAAmBC,QAAnB,EAA6BC;AAPrC,KAAP;AASA,GAnCK,EAoCN,CAAEE,QAAF,CApCM,CAAP;AAsCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tstore as blocksStore,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('@wordpress/blocks').WPIcon} WPIcon */\n\n/**\n * Contains basic block's information for display reasons.\n *\n * @typedef {Object} WPBlockDisplayInformation\n *\n * @property {boolean} isSynced True if is a reusable block or template part\n * @property {string} title Human-readable block type label.\n * @property {WPIcon} icon Block type icon.\n * @property {string} description A detailed block type description.\n * @property {string} anchor HTML anchor.\n */\n\n/**\n * Get the display label for a block's position type.\n *\n * @param {Object} attributes Block attributes.\n * @return {string} The position type label.\n */\nfunction getPositionTypeLabel( attributes ) {\n\tconst positionType = attributes?.style?.position?.type;\n\n\tif ( positionType === 'sticky' ) {\n\t\treturn __( 'Sticky' );\n\t}\n\n\tif ( positionType === 'fixed' ) {\n\t\treturn __( 'Fixed' );\n\t}\n\n\treturn null;\n}\n\n/**\n * Hook used to try to find a matching block variation and return\n * the appropriate information for display reasons. In order to\n * to try to find a match we need to things:\n * 1. Block's client id to extract it's current attributes.\n * 2. A block variation should have set `isActive` prop to a proper function.\n *\n * If for any reason a block variation match cannot be found,\n * the returned information come from the Block Type.\n * If no blockType is found with the provided clientId, returns null.\n *\n * @param {string} clientId Block's client id.\n * @return {?WPBlockDisplayInformation} Block's display information, or `null` when the block or its type not found.\n */\n\nexport default function useBlockDisplayInformation( clientId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! clientId ) return null;\n\t\t\tconst { getBlockName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { getBlockType, getActiveBlockVariation } =\n\t\t\t\tselect( blocksStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tif ( ! blockType ) return null;\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\tconst match = getActiveBlockVariation( blockName, attributes );\n\t\t\tconst isSynced =\n\t\t\t\tisReusableBlock( blockType ) || isTemplatePart( blockType );\n\t\t\tconst positionLabel = getPositionTypeLabel( attributes );\n\t\t\tconst blockTypeInfo = {\n\t\t\t\tisSynced,\n\t\t\t\ttitle: blockType.title,\n\t\t\t\ticon: blockType.icon,\n\t\t\t\tdescription: blockType.description,\n\t\t\t\tanchor: attributes?.anchor,\n\t\t\t\tpositionLabel,\n\t\t\t\tpositionType: attributes?.style?.position?.type,\n\t\t\t};\n\t\t\tif ( ! match ) return blockTypeInfo;\n\n\t\t\treturn {\n\t\t\t\tisSynced,\n\t\t\t\ttitle: match.title || blockType.title,\n\t\t\t\ticon: match.icon || blockType.icon,\n\t\t\t\tdescription: match.description || blockType.description,\n\t\t\t\tanchor: attributes?.anchor,\n\t\t\t\tpositionLabel,\n\t\t\t\tpositionType: attributes?.style?.position?.type,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n}\n"]}
@@ -9,8 +9,6 @@ exports.default = exports.VIDEO_ASPECT_RATIO = void 0;
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
12
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
-
14
12
  var _components = require("@wordpress/components");
15
13
 
16
14
  var _i18n = require("@wordpress/i18n");
@@ -107,7 +105,7 @@ class Video extends _element.Component {
107
105
  const showPlayButton = videoContainerHeight > 0;
108
106
  return (0, _element.createElement)(_reactNative.View, {
109
107
  style: _styles.default.videoContainer
110
- }, (0, _element.createElement)(_reactNativeVideo.default, (0, _extends2.default)({}, this.props, {
108
+ }, (0, _element.createElement)(_reactNativeVideo.default, { ...this.props,
111
109
  ref: ref => {
112
110
  this.player = ref;
113
111
  } // Using built-in player controls is messing up the layout on iOS.
@@ -128,7 +126,7 @@ class Video extends _element.Component {
128
126
  isFullScreen: false
129
127
  });
130
128
  }
131
- })), showPlayButton && // If we add the play icon as a subview to VideoPlayer then react-native-video decides to show control buttons
129
+ }), showPlayButton && // If we add the play icon as a subview to VideoPlayer then react-native-video decides to show control buttons
132
130
  // even if we set controls={ false }, so we are adding our play button as a sibling overlay view.
133
131
  (0, _element.createElement)(_reactNative.TouchableOpacity, {
134
132
  disabled: !isSelected,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/video-player/index.native.js"],"names":["VIDEO_ASPECT_RATIO","Video","Component","constructor","arguments","isIOS","Platform","OS","state","isFullScreen","videoContainerHeight","onPressPlay","bind","onVideoLayout","event","height","nativeEvent","layout","setState","player","presentFullscreenPlayer","source","props","uri","openURL","url","Linking","canOpenURL","then","supported","Alert","alert","window","console","warn","catch","err","error","render","isSelected","style","showPlayButton","styles","videoContainer","ref","overlayContainer","blackOverlay","PlayIcon","playIcon","size"],"mappings":";;;;;;;;;AAGA;;;;AACA;;AACA;;AAKA;;AACA;;AAKA;;AACA;;AAjBA;AACA;AACA;;AAKA;AACA;AACA;;AAIA;AACA;AACA;AAIA;AACO,MAAMA,kBAAkB,GAAG,KAAK,CAAhC;;;AAEP,MAAMC,KAAN,SAAoBC,kBAApB,CAA8B;AAC7BC,EAAAA,WAAW,GAAG;AACb,UAAO,GAAGC,SAAV;AACA,SAAKC,KAAL,GAAaC,sBAASC,EAAT,KAAgB,KAA7B;AACA,S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D;AACC,MAAA,IAAI,EAAGC,qBADR;AAEC,MAAA,KAAK,EAAGL,gBAAOM,QAFhB;AAGC,MAAA,IAAI,EAAGN,gBAAOM,QAAP,CAAgBC;AAHxB,MAND,CAvBF,CADD;AAuCA;;AA3G4B;;eA8GfhD,K","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { Icon } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * External dependencies\n */\nimport { View, TouchableOpacity, Platform, Linking, Alert } from 'react-native';\nimport { default as VideoPlayer } from 'react-native-video';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\nimport PlayIcon from './gridicon-play';\n\n// Default Video ratio 16:9\nexport const VIDEO_ASPECT_RATIO = 16 / 9;\n\nclass Video extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.isIOS = Platform.OS === 'ios';\n\t\tthis.state = {\n\t\t\tisFullScreen: false,\n\t\t\tvideoContainerHeight: 0,\n\t\t};\n\t\tthis.onPressPlay = this.onPressPlay.bind( this );\n\t\tthis.onVideoLayout = this.onVideoLayout.bind( this );\n\t}\n\n\tonVideoLayout( event ) {\n\t\tconst { height } = event.nativeEvent.layout;\n\t\tif ( height !== this.state.videoContainerHeight ) {\n\t\t\tthis.setState( { videoContainerHeight: height } );\n\t\t}\n\t}\n\n\tonPressPlay() {\n\t\tif ( this.isIOS ) {\n\t\t\tif ( this.player ) {\n\t\t\t\tthis.player.presentFullscreenPlayer();\n\t\t\t}\n\t\t} else {\n\t\t\tconst { source } = this.props;\n\t\t\tif ( source && source.uri ) {\n\t\t\t\tthis.openURL( source.uri );\n\t\t\t}\n\t\t}\n\t}\n\n\t// Tries opening the URL outside of the app\n\topenURL( url ) {\n\t\tLinking.canOpenURL( url )\n\t\t\t.then( ( supported ) => {\n\t\t\t\tif ( ! supported ) {\n\t\t\t\t\tAlert.alert(\n\t\t\t\t\t\t__( 'Problem opening the video' ),\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'No application can handle this request. Please install a Web browser.'\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\twindow.console.warn(\n\t\t\t\t\t\t'No application found that can open the video with URL: ' +\n\t\t\t\t\t\t\turl\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\treturn Linking.openURL( url );\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( ( err ) => {\n\t\t\t\tAlert.alert(\n\t\t\t\t\t__( 'Problem opening the video' ),\n\t\t\t\t\t__( 'An unknown error occurred. Please try again.' )\n\t\t\t\t);\n\t\t\t\twindow.console.error(\n\t\t\t\t\t'An error occurred while opening the video URL: ' + url,\n\t\t\t\t\terr\n\t\t\t\t);\n\t\t\t} );\n\t}\n\n\trender() {\n\t\tconst { isSelected, style } = this.props;\n\t\tconst { isFullScreen, videoContainerHeight } = this.state;\n\t\tconst showPlayButton = videoContainerHeight > 0;\n\n\t\treturn (\n\t\t\t<View style={ styles.videoContainer }>\n\t\t\t\t<VideoPlayer\n\t\t\t\t\t{ ...this.props }\n\t\t\t\t\tref={ ( ref ) => {\n\t\t\t\t\t\tthis.player = ref;\n\t\t\t\t\t} }\n\t\t\t\t\t// Using built-in player controls is messing up the layout on iOS.\n\t\t\t\t\t// So we are setting controls=false and adding a play button that\n\t\t\t\t\t// will trigger presentFullscreenPlayer()\n\t\t\t\t\tcontrols={ false }\n\t\t\t\t\tignoreSilentSwitch={ 'ignore' }\n\t\t\t\t\tpaused={ ! isFullScreen }\n\t\t\t\t\tonLayout={ this.onVideoLayout }\n\t\t\t\t\tonFullscreenPlayerWillPresent={ () => {\n\t\t\t\t\t\tthis.setState( { isFullScreen: true } );\n\t\t\t\t\t} }\n\t\t\t\t\tonFullscreenPlayerDidDismiss={ () => {\n\t\t\t\t\t\tthis.setState( { isFullScreen: false } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t{ showPlayButton && (\n\t\t\t\t\t// If we add the play icon as a subview to VideoPlayer then react-native-video decides to show control buttons\n\t\t\t\t\t// even if we set controls={ false }, so we are adding our play button as a sibling overlay view.\n\t\t\t\t\t<TouchableOpacity\n\t\t\t\t\t\tdisabled={ ! isSelected }\n\t\t\t\t\t\tonPress={ this.onPressPlay }\n\t\t\t\t\t\tstyle={ [ style, styles.overlayContainer ] }\n\t\t\t\t\t>\n\t\t\t\t\t\t<View style={ styles.blackOverlay } />\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\ticon={ PlayIcon }\n\t\t\t\t\t\t\tstyle={ styles.playIcon }\n\t\t\t\t\t\t\tsize={ styles.playIcon.size }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</TouchableOpacity>\n\t\t\t\t) }\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nexport default Video;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/video-player/index.native.js"],"names":["VIDEO_ASPECT_RATIO","Video","Component","constructor","arguments","isIOS","Platform","OS","state","isFullScreen","videoContainerHeight","onPressPlay","bind","onVideoLayout","event","height","nativeEvent","layout","setState","player","presentFullscreenPlayer","source","props","uri","openURL","url","Linking","canOpenURL","then","supported","Alert","alert","window","console","warn","catch","err","error","render","isSelected","style","showPlayButton","styles","videoContainer","ref","overlayContainer","blackOverlay","PlayIcon","playIcon","size"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AAKA;;AACA;;AAjBA;AACA;AACA;;AAKA;AACA;AACA;;AAIA;AACA;AACA;AAIA;AACO,MAAMA,kBAAkB,GAAG,KAAK,CAAhC;;;AAEP,MAAMC,KAAN,SAAoBC,kBAApB,CAA8B;AAC7BC,EAAAA,WAAW,GAAG;AACb,UAAO,GAAGC,SAAV;AACA,SAAKC,KAAL,GAAaC,sBAASC,EAAT,KAAgB,KAA7B;AACA,SAAKC,KAAL,GAAa;AACZC,MAAAA,YAAY,EAAE,KADF;AAEZC,MAAAA,oBAAoB,EAAE;AAFV,KAAb;AAIA,SAAKC,WAAL,GA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,CAAgBC;AAHxB,MAND,CAvBF,CADD;AAuCA;;AA3G4B;;eA8GfhD,K","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { Icon } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * External dependencies\n */\nimport { View, TouchableOpacity, Platform, Linking, Alert } from 'react-native';\nimport { default as VideoPlayer } from 'react-native-video';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\nimport PlayIcon from './gridicon-play';\n\n// Default Video ratio 16:9\nexport const VIDEO_ASPECT_RATIO = 16 / 9;\n\nclass Video extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.isIOS = Platform.OS === 'ios';\n\t\tthis.state = {\n\t\t\tisFullScreen: false,\n\t\t\tvideoContainerHeight: 0,\n\t\t};\n\t\tthis.onPressPlay = this.onPressPlay.bind( this );\n\t\tthis.onVideoLayout = this.onVideoLayout.bind( this );\n\t}\n\n\tonVideoLayout( event ) {\n\t\tconst { height } = event.nativeEvent.layout;\n\t\tif ( height !== this.state.videoContainerHeight ) {\n\t\t\tthis.setState( { videoContainerHeight: height } );\n\t\t}\n\t}\n\n\tonPressPlay() {\n\t\tif ( this.isIOS ) {\n\t\t\tif ( this.player ) {\n\t\t\t\tthis.player.presentFullscreenPlayer();\n\t\t\t}\n\t\t} else {\n\t\t\tconst { source } = this.props;\n\t\t\tif ( source && source.uri ) {\n\t\t\t\tthis.openURL( source.uri );\n\t\t\t}\n\t\t}\n\t}\n\n\t// Tries opening the URL outside of the app\n\topenURL( url ) {\n\t\tLinking.canOpenURL( url )\n\t\t\t.then( ( supported ) => {\n\t\t\t\tif ( ! supported ) {\n\t\t\t\t\tAlert.alert(\n\t\t\t\t\t\t__( 'Problem opening the video' ),\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'No application can handle this request. Please install a Web browser.'\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\twindow.console.warn(\n\t\t\t\t\t\t'No application found that can open the video with URL: ' +\n\t\t\t\t\t\t\turl\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\treturn Linking.openURL( url );\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( ( err ) => {\n\t\t\t\tAlert.alert(\n\t\t\t\t\t__( 'Problem opening the video' ),\n\t\t\t\t\t__( 'An unknown error occurred. Please try again.' )\n\t\t\t\t);\n\t\t\t\twindow.console.error(\n\t\t\t\t\t'An error occurred while opening the video URL: ' + url,\n\t\t\t\t\terr\n\t\t\t\t);\n\t\t\t} );\n\t}\n\n\trender() {\n\t\tconst { isSelected, style } = this.props;\n\t\tconst { isFullScreen, videoContainerHeight } = this.state;\n\t\tconst showPlayButton = videoContainerHeight > 0;\n\n\t\treturn (\n\t\t\t<View style={ styles.videoContainer }>\n\t\t\t\t<VideoPlayer\n\t\t\t\t\t{ ...this.props }\n\t\t\t\t\tref={ ( ref ) => {\n\t\t\t\t\t\tthis.player = ref;\n\t\t\t\t\t} }\n\t\t\t\t\t// Using built-in player controls is messing up the layout on iOS.\n\t\t\t\t\t// So we are setting controls=false and adding a play button that\n\t\t\t\t\t// will trigger presentFullscreenPlayer()\n\t\t\t\t\tcontrols={ false }\n\t\t\t\t\tignoreSilentSwitch={ 'ignore' }\n\t\t\t\t\tpaused={ ! isFullScreen }\n\t\t\t\t\tonLayout={ this.onVideoLayout }\n\t\t\t\t\tonFullscreenPlayerWillPresent={ () => {\n\t\t\t\t\t\tthis.setState( { isFullScreen: true } );\n\t\t\t\t\t} }\n\t\t\t\t\tonFullscreenPlayerDidDismiss={ () => {\n\t\t\t\t\t\tthis.setState( { isFullScreen: false } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t{ showPlayButton && (\n\t\t\t\t\t// If we add the play icon as a subview to VideoPlayer then react-native-video decides to show control buttons\n\t\t\t\t\t// even if we set controls={ false }, so we are adding our play button as a sibling overlay view.\n\t\t\t\t\t<TouchableOpacity\n\t\t\t\t\t\tdisabled={ ! isSelected }\n\t\t\t\t\t\tonPress={ this.onPressPlay }\n\t\t\t\t\t\tstyle={ [ style, styles.overlayContainer ] }\n\t\t\t\t\t>\n\t\t\t\t\t\t<View style={ styles.blackOverlay } />\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\ticon={ PlayIcon }\n\t\t\t\t\t\t\tstyle={ styles.playIcon }\n\t\t\t\t\t\t\tsize={ styles.playIcon.size }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</TouchableOpacity>\n\t\t\t\t) }\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nexport default Video;\n"]}
@@ -9,8 +9,6 @@ exports.default = void 0;
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
12
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
-
14
12
  var _reactNative = require("react-native");
15
13
 
16
14
  var _components = require("@wordpress/components");
@@ -45,9 +43,10 @@ function Warning({
45
43
  const internalIconClass = 'warning-icon' + '-' + preferredColorScheme;
46
44
  const titleStyle = getStylesFromColorScheme(_style.default.title, _style.default.titleDark);
47
45
  const messageStyle = getStylesFromColorScheme(_style.default.message, _style.default.messageDark);
48
- return (0, _element.createElement)(_reactNative.View, (0, _extends2.default)({
49
- style: getStylesFromColorScheme(_style.default.container, _style.default.containerDark)
50
- }, viewProps), icon && (0, _element.createElement)(_reactNative.View, {
46
+ return (0, _element.createElement)(_reactNative.View, {
47
+ style: getStylesFromColorScheme(_style.default.container, _style.default.containerDark),
48
+ ...viewProps
49
+ }, icon && (0, _element.createElement)(_reactNative.View, {
51
50
  style: _style.default.icon
52
51
  }, (0, _element.createElement)(_components.Icon, {
53
52
  className: iconClass || internalIconClass,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/warning/index.native.js"],"names":["Warning","title","message","icon","iconClass","preferredColorScheme","getStylesFromColorScheme","viewProps","internalIconClass","titleStyle","styles","titleDark","messageStyle","messageDark","container","containerDark","src"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAKA;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AAGA,SAASA,OAAT,CAAkB;AACjBC,EAAAA,KADiB;AAEjBC,EAAAA,OAFiB;AAGjBC,EAAAA,IAHiB;AAIjBC,EAAAA,SAJiB;AAKjBC,EAAAA,oBALiB;AAMjBC,EAAAA,wBANiB;AAOjB,KAAGC;AAPc,CAAlB,EAQI;AACHJ,EAAAA,IAAI,GAAGA,IAAI,IAAI,iCAAqBA,IAArB,CAAf;AACA,QAAMK,iBAAiB,GAAG,iBAAiB,GAAjB,GAAuBH,oBAAjD;AACA,QAAMI,UAAU,GAAGH,wBAAwB,CAC1CI,eAAOT,KADmC,EAE1CS,eAAOC,SAFmC,CAA3C;AAIA,QAAMC,YAAY,GAAGN,wBAAwB,CAC5CI,eAAOR,OADqC,EAE5CQ,eAAOG,WAFqC,CAA7C;AAKA,SACC,4BAAC,iBAAD;AACC,IAAA,KAAK,EAAGP,wBAAwB,CAC/BI,eAAOI,SADwB,EAE/BJ,eAAOK,aAFwB;AADjC,KAKMR,SALN,GAOGJ,IAAI,IACL,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGO,eAAOP;AAArB,KACC,4BAAC,gBAAD;AACC,IAAA,SAAS,EAAGC,SAAS,IAAII,iBAD1B;AAEC,IAAA,IAAI,EAAGL,IAAI,IAAIA,IAAI,CAACa,GAAb,GAAmBb,IAAI,CAACa,GAAxB,GAA8Bb;AAFtC,IADD,CARF,EAeGF,KAAK,IAAI,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGQ;AAAd,KAA6BR,KAA7B,CAfZ,EAgBGC,OAAO,IAAI,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGU;AAAd,KAA+BV,OAA/B,CAhBd,CADD;AAoBA;;eAEc,uCAA0BF,OAA1B,C","sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Icon } from '@wordpress/components';\nimport { withPreferredColorScheme } from '@wordpress/compose';\nimport { normalizeIconObject } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nfunction Warning( {\n\ttitle,\n\tmessage,\n\ticon,\n\ticonClass,\n\tpreferredColorScheme,\n\tgetStylesFromColorScheme,\n\t...viewProps\n} ) {\n\ticon = icon && normalizeIconObject( icon );\n\tconst internalIconClass = 'warning-icon' + '-' + preferredColorScheme;\n\tconst titleStyle = getStylesFromColorScheme(\n\t\tstyles.title,\n\t\tstyles.titleDark\n\t);\n\tconst messageStyle = getStylesFromColorScheme(\n\t\tstyles.message,\n\t\tstyles.messageDark\n\t);\n\n\treturn (\n\t\t<View\n\t\t\tstyle={ getStylesFromColorScheme(\n\t\t\t\tstyles.container,\n\t\t\t\tstyles.containerDark\n\t\t\t) }\n\t\t\t{ ...viewProps }\n\t\t>\n\t\t\t{ icon && (\n\t\t\t\t<View style={ styles.icon }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tclassName={ iconClass || internalIconClass }\n\t\t\t\t\t\ticon={ icon && icon.src ? icon.src : icon }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t\t{ title && <Text style={ titleStyle }>{ title }</Text> }\n\t\t\t{ message && <Text style={ messageStyle }>{ message }</Text> }\n\t\t</View>\n\t);\n}\n\nexport default withPreferredColorScheme( Warning );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/warning/index.native.js"],"names":["Warning","title","message","icon","iconClass","preferredColorScheme","getStylesFromColorScheme","viewProps","internalIconClass","titleStyle","styles","titleDark","messageStyle","messageDark","container","containerDark","src"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAKA;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AAGA,SAASA,OAAT,CAAkB;AACjBC,EAAAA,KADiB;AAEjBC,EAAAA,OAFiB;AAGjBC,EAAAA,IAHiB;AAIjBC,EAAAA,SAJiB;AAKjBC,EAAAA,oBALiB;AAMjBC,EAAAA,wBANiB;AAOjB,KAAGC;AAPc,CAAlB,EAQI;AACHJ,EAAAA,IAAI,GAAGA,IAAI,IAAI,iCAAqBA,IAArB,CAAf;AACA,QAAMK,iBAAiB,GAAG,iBAAiB,GAAjB,GAAuBH,oBAAjD;AACA,QAAMI,UAAU,GAAGH,wBAAwB,CAC1CI,eAAOT,KADmC,EAE1CS,eAAOC,SAFmC,CAA3C;AAIA,QAAMC,YAAY,GAAGN,wBAAwB,CAC5CI,eAAOR,OADqC,EAE5CQ,eAAOG,WAFqC,CAA7C;AAKA,SACC,4BAAC,iBAAD;AACC,IAAA,KAAK,EAAGP,wBAAwB,CAC/BI,eAAOI,SADwB,EAE/BJ,eAAOK,aAFwB,CADjC;AAAA,OAKMR;AALN,KAOGJ,IAAI,IACL,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGO,eAAOP;AAArB,KACC,4BAAC,gBAAD;AACC,IAAA,SAAS,EAAGC,SAAS,IAAII,iBAD1B;AAEC,IAAA,IAAI,EAAGL,IAAI,IAAIA,IAAI,CAACa,GAAb,GAAmBb,IAAI,CAACa,GAAxB,GAA8Bb;AAFtC,IADD,CARF,EAeGF,KAAK,IAAI,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGQ;AAAd,KAA6BR,KAA7B,CAfZ,EAgBGC,OAAO,IAAI,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGU;AAAd,KAA+BV,OAA/B,CAhBd,CADD;AAoBA;;eAEc,uCAA0BF,OAA1B,C","sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Icon } from '@wordpress/components';\nimport { withPreferredColorScheme } from '@wordpress/compose';\nimport { normalizeIconObject } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nfunction Warning( {\n\ttitle,\n\tmessage,\n\ticon,\n\ticonClass,\n\tpreferredColorScheme,\n\tgetStylesFromColorScheme,\n\t...viewProps\n} ) {\n\ticon = icon && normalizeIconObject( icon );\n\tconst internalIconClass = 'warning-icon' + '-' + preferredColorScheme;\n\tconst titleStyle = getStylesFromColorScheme(\n\t\tstyles.title,\n\t\tstyles.titleDark\n\t);\n\tconst messageStyle = getStylesFromColorScheme(\n\t\tstyles.message,\n\t\tstyles.messageDark\n\t);\n\n\treturn (\n\t\t<View\n\t\t\tstyle={ getStylesFromColorScheme(\n\t\t\t\tstyles.container,\n\t\t\t\tstyles.containerDark\n\t\t\t) }\n\t\t\t{ ...viewProps }\n\t\t>\n\t\t\t{ icon && (\n\t\t\t\t<View style={ styles.icon }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tclassName={ iconClass || internalIconClass }\n\t\t\t\t\t\ticon={ icon && icon.src ? icon.src : icon }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t\t{ title && <Text style={ titleStyle }>{ title }</Text> }\n\t\t\t{ message && <Text style={ messageStyle }>{ message }</Text> }\n\t\t</View>\n\t);\n}\n\nexport default withPreferredColorScheme( Warning );\n"]}
@@ -10,8 +10,6 @@ exports.useWritingFlow = useWritingFlow;
10
10
 
11
11
  var _element = require("@wordpress/element");
12
12
 
13
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
14
-
15
13
  var _classnames = _interopRequireDefault(require("classnames"));
16
14
 
17
15
  var _data = require("@wordpress/data");
@@ -74,10 +72,10 @@ function WritingFlow({
74
72
  ...props
75
73
  }, forwardedRef) {
76
74
  const [before, ref, after] = useWritingFlow();
77
- return (0, _element.createElement)(_element.Fragment, null, before, (0, _element.createElement)("div", (0, _extends2.default)({}, props, {
75
+ return (0, _element.createElement)(_element.Fragment, null, before, (0, _element.createElement)("div", { ...props,
78
76
  ref: (0, _compose.useMergeRefs)([ref, forwardedRef]),
79
77
  className: (0, _classnames.default)(props.className, 'block-editor-writing-flow')
80
- }), children), after);
78
+ }, children), after);
81
79
  }
82
80
  /**
83
81
  * Handles selection and navigation across blocks. This component should be
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/index.js"],"names":["useWritingFlow","before","ref","after","hasMultiSelection","select","blockEditorStore","node","tabIndex","contentEditable","classList","add","setAttribute","remove","removeAttribute","WritingFlow","children","props","forwardedRef","className"],"mappings":";;;;;;;;;;AAWA;;;;AARA;;AAKA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAWO,SAASA,cAAT,GAA0B;AAChC,QAAM,CAAEC,MAAF,EAAUC,GAAV,EAAeC,KAAf,IAAyB,yBAA/B;AACA,QAAMC,iBAAiB,GAAG,qBACvBC,MAAF,IAAcA,MAAM,CAAEC,YAAF,CAAN,CAA2BF,iBAA3B,EADW,EAEzB,EAFyB,CAA1B;AAKA,SAAO,CACNH,MADM,EAEN,2BAAc,CACbC,GADa,EAEb,wBAFa,EAGb,gCAHa,EAIb,oCAJa,EAKb,iCALa,EAMb,iCANa,EAOb,4BAPa,EAQb,2BARa,EASb,2BACGK,IAAF,IAAY;AACXA,IAAAA,IAAI,CAACC,QAAL,GAAgB,CAAhB;AACAD,IAAAA,IAAI,CAACE,eAAL,GAAuBL,iBAAvB;;AAEA,QAAK,CAAEA,iBAAP,EAA2B;AAC1B;AACA;;AAEDG,IAAAA,IAAI,CAACG,SAAL,CAAeC,GAAf,CAAoB,qBAApB;AACAJ,IAAAA,IAAI,CAACK,YAAL,CACC,YADD,EAEC,cAAI,0BAAJ,CAFD;AAKA,WAAO,MAAM;AACZL,MAAAA,IAAI,CAACG,SAAL,CAAeG,MAAf,CAAuB,qBAAvB;AACAN,MAAAA,IAAI,CAACO,eAAL,CAAsB,YAAtB;AACA,KAHD;AAIA,GAnBF,EAoBC,CAAEV,iBAAF,CApBD,CATa,CAAd,CAFM,EAkCND,KAlCM,CAAP;AAoCA;;AAED,SAASY,WAAT,CAAsB;AAAEC,EAAAA,QAAF;AAAY,KAAGC;AAAf,CAAtB,EAA8CC,YAA9C,EAA6D;AAC5D,QAAM,CAAEjB,MAAF,EAAUC,GAAV,EAAeC,KAAf,IAAyBH,cAAc,EAA7C;AACA,SACC,qDACGC,MADH,EAEC,8DACMgB,KADN;AAEC,IAAA,GAAG,EAAG,2BAAc,CAAEf,GAAF,EAAOgB,YAAP,CAAd,CAFP;AAGC,IAAA,SAAS,EAAG,yBACXD,KAAK,CAACE,SADK,EAEX,2BAFW;AAHb,MAQGH,QARH,CAFD,EAYGb,KAZH,CADD;AAgBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;eACe,yBAAYY,WAAZ,C","sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { useMergeRefs, useRefEffect } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useMultiSelection from './use-multi-selection';\nimport useTabNav from './use-tab-nav';\nimport useArrowNav from './use-arrow-nav';\nimport useSelectAll from './use-select-all';\nimport useDragSelection from './use-drag-selection';\nimport useSelectionObserver from './use-selection-observer';\nimport useClickSelection from './use-click-selection';\nimport useInput from './use-input';\nimport { store as blockEditorStore } from '../../store';\n\nexport function useWritingFlow() {\n\tconst [ before, ref, after ] = useTabNav();\n\tconst hasMultiSelection = useSelect(\n\t\t( select ) => select( blockEditorStore ).hasMultiSelection(),\n\t\t[]\n\t);\n\n\treturn [\n\t\tbefore,\n\t\tuseMergeRefs( [\n\t\t\tref,\n\t\t\tuseInput(),\n\t\t\tuseDragSelection(),\n\t\t\tuseSelectionObserver(),\n\t\t\tuseClickSelection(),\n\t\t\tuseMultiSelection(),\n\t\t\tuseSelectAll(),\n\t\t\tuseArrowNav(),\n\t\t\tuseRefEffect(\n\t\t\t\t( node ) => {\n\t\t\t\t\tnode.tabIndex = 0;\n\t\t\t\t\tnode.contentEditable = hasMultiSelection;\n\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\tnode.classList.add( 'has-multi-selection' );\n\t\t\t\t\tnode.setAttribute(\n\t\t\t\t\t\t'aria-label',\n\t\t\t\t\t\t__( 'Multiple selected blocks' )\n\t\t\t\t\t);\n\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\tnode.classList.remove( 'has-multi-selection' );\n\t\t\t\t\t\tnode.removeAttribute( 'aria-label' );\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\t[ hasMultiSelection ]\n\t\t\t),\n\t\t] ),\n\t\tafter,\n\t];\n}\n\nfunction WritingFlow( { children, ...props }, forwardedRef ) {\n\tconst [ before, ref, after ] = useWritingFlow();\n\treturn (\n\t\t<>\n\t\t\t{ before }\n\t\t\t<div\n\t\t\t\t{ ...props }\n\t\t\t\tref={ useMergeRefs( [ ref, forwardedRef ] ) }\n\t\t\t\tclassName={ classNames(\n\t\t\t\t\tprops.className,\n\t\t\t\t\t'block-editor-writing-flow'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t\t{ after }\n\t\t</>\n\t);\n}\n\n/**\n * Handles selection and navigation across blocks. This component should be\n * wrapped around BlockList.\n *\n * @param {Object} props Component properties.\n * @param {WPElement} props.children Children to be rendered.\n */\nexport default forwardRef( WritingFlow );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/index.js"],"names":["useWritingFlow","before","ref","after","hasMultiSelection","select","blockEditorStore","node","tabIndex","contentEditable","classList","add","setAttribute","remove","removeAttribute","WritingFlow","children","props","forwardedRef","className"],"mappings":";;;;;;;;;;AAWA;;AARA;;AAKA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAxBA;A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,EAEX,2BAFW;AAHb,KAQGH,QARH,CAFD,EAYGb,KAZH,CADD;AAgBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;eACe,yBAAYY,WAAZ,C","sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { useMergeRefs, useRefEffect } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useMultiSelection from './use-multi-selection';\nimport useTabNav from './use-tab-nav';\nimport useArrowNav from './use-arrow-nav';\nimport useSelectAll from './use-select-all';\nimport useDragSelection from './use-drag-selection';\nimport useSelectionObserver from './use-selection-observer';\nimport useClickSelection from './use-click-selection';\nimport useInput from './use-input';\nimport { store as blockEditorStore } from '../../store';\n\nexport function useWritingFlow() {\n\tconst [ before, ref, after ] = useTabNav();\n\tconst hasMultiSelection = useSelect(\n\t\t( select ) => select( blockEditorStore ).hasMultiSelection(),\n\t\t[]\n\t);\n\n\treturn [\n\t\tbefore,\n\t\tuseMergeRefs( [\n\t\t\tref,\n\t\t\tuseInput(),\n\t\t\tuseDragSelection(),\n\t\t\tuseSelectionObserver(),\n\t\t\tuseClickSelection(),\n\t\t\tuseMultiSelection(),\n\t\t\tuseSelectAll(),\n\t\t\tuseArrowNav(),\n\t\t\tuseRefEffect(\n\t\t\t\t( node ) => {\n\t\t\t\t\tnode.tabIndex = 0;\n\t\t\t\t\tnode.contentEditable = hasMultiSelection;\n\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\tnode.classList.add( 'has-multi-selection' );\n\t\t\t\t\tnode.setAttribute(\n\t\t\t\t\t\t'aria-label',\n\t\t\t\t\t\t__( 'Multiple selected blocks' )\n\t\t\t\t\t);\n\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\tnode.classList.remove( 'has-multi-selection' );\n\t\t\t\t\t\tnode.removeAttribute( 'aria-label' );\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\t[ hasMultiSelection ]\n\t\t\t),\n\t\t] ),\n\t\tafter,\n\t];\n}\n\nfunction WritingFlow( { children, ...props }, forwardedRef ) {\n\tconst [ before, ref, after ] = useWritingFlow();\n\treturn (\n\t\t<>\n\t\t\t{ before }\n\t\t\t<div\n\t\t\t\t{ ...props }\n\t\t\t\tref={ useMergeRefs( [ ref, forwardedRef ] ) }\n\t\t\t\tclassName={ classNames(\n\t\t\t\t\tprops.className,\n\t\t\t\t\t'block-editor-writing-flow'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t\t{ after }\n\t\t</>\n\t);\n}\n\n/**\n * Handles selection and navigation across blocks. This component should be\n * wrapped around BlockList.\n *\n * @param {Object} props Component properties.\n * @param {WPElement} props.children Children to be rendered.\n */\nexport default forwardRef( WritingFlow );\n"]}
@@ -107,7 +107,7 @@ function useDragSelection() {
107
107
  // multi selecting when the mouse leaves the wrapper.
108
108
 
109
109
 
110
- if (!target.getAttribute('contenteditable')) {
110
+ if (target.getAttribute('contenteditable') !== 'true') {
111
111
  return;
112
112
  }
113
113
 
@@ -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","isDraggingBlocks","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,KA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vB,EAA6C;AAC5C;AACA;AACA,UAAKhB,gBAAgB,EAArB,EAA0B;AACzB;AACA,OAL2C,CAO5C;AACA;;;AACA,UAAKe,OAAO,KAAK,CAAjB,EAAqB;AACpB;AACA,OAX2C,CAa5C;AACA;AACA;AACA;;;AACA,UAAK,CAAEC,MAAM,CAACC,YAAP,CAAqB,iBAArB,CAAP,EAAkD;AACjD;AACA;;AAED,UAAK,CAAEnB,kBAAkB,EAAzB,EAA8B;AAC7B;AACA;;AAEDK,MAAAA,aAAa,GAAGF,aAAa,CAACiB,aAA9B;AACAvB,MAAAA,gBAAgB,GA1B4B,CA4B5C;AACA;AACA;;AACAO,MAAAA,WAAW,CAACiB,gBAAZ,CAA8B,SAA9B,EAAyCd,SAAzC,EA/B4C,CAiC5C;AACA;AACA;AACA;;AACAhB,MAAAA,yBAAyB,CAAEC,IAAF,EAAQ,IAAR,CAAzB;AACA;;AAEDA,IAAAA,IAAI,CAAC6B,gBAAL,CAAuB,UAAvB,EAAmCL,YAAnC;AAEA,WAAO,MAAM;AACZxB,MAAAA,IAAI,CAACgB,mBAAL,CAA0B,UAA1B,EAAsCQ,YAAtC;AACAZ,MAAAA,WAAW,CAACI,mBAAZ,CAAiC,SAAjC,EAA4CD,SAA5C;AACAH,MAAAA,WAAW,CAACkB,oBAAZ,CAAkChB,KAAlC;AACA,KAJD;AAKA,GAzFK,EA0FN,CACCT,gBADD,EAECC,eAFD,EAGCE,kBAHD,EAICC,iBAJD,CA1FM,CAAP;AAiGA","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, isDraggingBlocks } =\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// Avoid triggering a multi-selection if the user is already\n\t\t\t\t// dragging blocks.\n\t\t\t\tif ( isDraggingBlocks() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// The primary button must be pressed to initiate selection.\n\t\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons\n\t\t\t\tif ( buttons !== 1 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// 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","isDraggingBlocks","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,iBAAtB;AAAyCC,IAAAA;AAAzC,MACL,qBAAWH,YAAX,CADD;AAEA,SAAO,2BACJP,IAAF,IAAY;AACX,UAAM;AAAEW,MAAAA;AAAF,QAAoBX,IAA1B;AACA,UAAM;AAAEY,MAAAA;AAAF,QAAkBD,aAAxB;AAEA,QAAIE,aAAJ;AACA,QAAIC,KAAJ;;AAEA,aAASC,SAAT,GAAqB;AACpBT,MAAAA,eAAe,GADK,CAEpB;;AACAM,MAAAA,WAAW,CAACI,mBAAZ,CAAiC,SAAjC,EAA4CD,SAA5C,EAHoB,CAIpB;AACA;AACA;;AACAD,MAAAA,KAAK,GAAGF,WAAW,CAACK,qBAAZ,CAAmC,MAAM;AAChD,YAAKR,iBAAiB,EAAtB,EAA2B;AAC1B;AACA,SAH+C,CAKhD;AACA;AACA;AACA;AACA;;;AACAV,QAAAA,yB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AAlC;AACA,KAJD;AAKA,GAzFK,EA0FN,CACCT,gBADD,EAECC,eAFD,EAGCE,kBAHD,EAICC,iBAJD,CA1FM,CAAP;AAiGA","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, isDraggingBlocks } =\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// Avoid triggering a multi-selection if the user is already\n\t\t\t\t// dragging blocks.\n\t\t\t\tif ( isDraggingBlocks() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// The primary button must be pressed to initiate selection.\n\t\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons\n\t\t\t\tif ( buttons !== 1 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Check the attribute, not the contentEditable attribute. All\n\t\t\t\t// child elements of the content editable wrapper are editable\n\t\t\t\t// and return true for this property. We only want to start\n\t\t\t\t// multi selecting when the mouse leaves the wrapper.\n\t\t\t\tif ( target.getAttribute( 'contenteditable' ) !== 'true' ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( ! isSelectionEnabled() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\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"]}
@@ -83,7 +83,7 @@ function useTabNav() {
83
83
  return;
84
84
  }
85
85
 
86
- if (event.keyCode === _keycodes.ESCAPE) {
86
+ if (event.keyCode === _keycodes.ESCAPE && !hasMultiSelection()) {
87
87
  event.preventDefault();
88
88
  setNavigationMode(true);
89
89
  return;
@@ -111,15 +111,43 @@ function useTabNav() {
111
111
  // will no longer send focus through the focus capture element.
112
112
  if (event.target === node) setNavigationMode(true);
113
113
  return;
114
- } // Allow tabbing from the block wrapper to a form element,
115
- // and between form elements rendered in a block,
114
+ } // We want to constrain the tabbing to the block and its child blocks.
115
+ // If the preceding form element is within a different block,
116
+ // such as two sibling image blocks in the placeholder state,
117
+ // we want shift + tab from the first form element to move to the image
118
+ // block toolbar and not the previous image block's form element.
119
+ // TODO: Should this become a utility function?
120
+
121
+ /**
122
+ * Determine whether an element is part of or is the selected block.
123
+ *
124
+ * @param {Object} selectedBlockElement
125
+ * @param {Object} element
126
+ * @return {boolean} Whether the element is part of or is the selected block.
127
+ */
128
+
129
+
130
+ const isElementPartOfSelectedBlock = (selectedBlockElement, element) => {
131
+ // Check if the element is or is within the selected block by finding the
132
+ // closest element with a data-block attribute and seeing if
133
+ // it matches our current selected block ID
134
+ const elementBlockId = element.closest('[data-block]')?.getAttribute('data-block');
135
+ const isElementSameBlock = elementBlockId === getSelectedBlockClientId(); // Check if the element is a child of the selected block. This could be a
136
+ // child block in a group or column block, etc.
137
+
138
+ const isElementChildOfBlock = selectedBlockElement.contains(element);
139
+ return isElementSameBlock || isElementChildOfBlock;
140
+ };
141
+
142
+ const nextTabbable = _dom.focus.tabbable[direction](event.target); // Allow tabbing from the block wrapper to a form element,
143
+ // and between form elements rendered in a block and its child blocks,
116
144
  // such as inside a placeholder. Form elements are generally
117
145
  // meant to be UI rather than part of the content. Ideally
118
146
  // these are not rendered in the content and perhaps in the
119
147
  // future they can be rendered in an iframe or shadow DOM.
120
148
 
121
149
 
122
- if (((0, _dom.isFormElement)(event.target) || event.target.getAttribute('data-block') === getSelectedBlockClientId()) && (0, _dom.isFormElement)(_dom.focus.tabbable[direction](event.target))) {
150
+ if ((0, _dom.isFormElement)(nextTabbable) && isElementPartOfSelectedBlock(event.target.closest('[data-block]'), nextTabbable)) {
123
151
  return;
124
152
  }
125
153
 
@@ -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","canvasElement","ownerDocument","target","defaultView","frameElement","isBefore","compareDocumentPosition","DOCUMENT_POSITION_FOLLOWING","tabbables","tabbable","find","length","next","before","after","ref","node","onKeyDown","defaultPrevented","keyCode","ESCAPE","preventDefault","TAB","isShift","shiftKey","direction","getAttribute","preventScroll","onFocusOut","relatedTarget","activeElement","body","preventScrollOnTab","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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G,cAAH,GAAoB,UAA7C;;AACA,YAAMrB,MAAM,GAAGH,WAAMU,QAAN,CAAgBgB,SAAhB,EAA6B5B,KAAK,CAACK,MAAnC,CAAf,CAfoC,CAgBpC;;;AACA,UACCA,MAAM,KAAKnB,qBAAqB,CAACe,OAAjC,IACAI,MAAM,KAAKlB,oBAAoB,CAACc,OAFjC,EAGE;AACDD,QAAAA,KAAK,CAACwB,cAAN;AACAnB,QAAAA,MAAM,CAACH,KAAP,CAAc;AAAE4B,UAAAA,aAAa,EAAE;AAAjB,SAAd;AACA;AACD;;AAED,UAAM;AAAE1B,MAAAA;AAAF,QAAoBe,IAA1B;AACA,UAAM;AAAEb,MAAAA;AAAF,QAAkBF,aAAxB;AACAE,IAAAA,WAAW,CAAC8B,gBAAZ,CAA8B,SAA9B,EAAyCD,kBAAzC;AACAhB,IAAAA,IAAI,CAACiB,gBAAL,CAAuB,SAAvB,EAAkChB,SAAlC;AACAD,IAAAA,IAAI,CAACiB,gBAAL,CAAuB,UAAvB,EAAmCL,UAAnC;AACA,WAAO,MAAM;AACZzB,MAAAA,WAAW,CAAC+B,mBAAZ,CAAiC,SAAjC,EAA4CF,kBAA5C;AACAhB,MAAAA,IAAI,CAACkB,mBAAL,CAA0B,SAA1B,EAAqCjB,SAArC;AACAD,MAAAA,IAAI,CAACkB,mBAAL,CAA0B,UAA1B,EAAsCN,UAAtC;AACA,KAJD;AAKA,GA5HW,EA4HT,EA5HS,CAAZ;AA8HA,QAAMO,UAAU,GAAG,2BAAc,CAAErD,SAAF,EAAaiC,GAAb,CAAd,CAAnB;AAEA,SAAO,CAAEF,MAAF,EAAUsB,UAAV,EAAsBrB,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 canvasElement =\n\t\t\t\tcontainer.current.ownerDocument === event.target.ownerDocument\n\t\t\t\t\t? container.current\n\t\t\t\t\t: container.current.ownerDocument.defaultView.frameElement;\n\n\t\t\tconst isBefore =\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tevent.target.compareDocumentPosition( canvasElement ) &\n\t\t\t\tevent.target.DOCUMENT_POSITION_FOLLOWING;\n\t\t\tconst tabbables = focus.tabbable.find( container.current );\n\n\t\t\tif ( tabbables.length ) {\n\t\t\t\tconst next = isBefore\n\t\t\t\t\t? tabbables[ 0 ]\n\t\t\t\t\t: tabbables[ tabbables.length - 1 ];\n\n\t\t\t\tnext.focus();\n\t\t\t}\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 ) {\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","canvasElement","ownerDocument","target","defaultView","frameElement","isBefore","compareDocumentPosition","DOCUMENT_POSITION_FOLLOWING","tabbables","tabbable","find","length","next","before","after","ref","node","onKeyDown","defaultPrevented","keyCode","ESCAPE","preventDefault","TAB","isShift","shiftKey","direction","isElementPartOfSelectedBlock","selectedBlockElement","element","elementBlockId","closest","getAttribute","isElementSameBlock","isElementChildOfBlock","contains","nextTabbable","preventScroll","onFocusOut","relatedTarget","activeElement","body","preventScrollOnTab","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,aAAa,GAClBlB,SAAS,CAACgB,OAAV,CAAkBG,aAAlB,KAAoCJ,KAAK,CAACK,MAAN,CAAaD,aAAjD,GACGn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AAxB;AACAE,IAAAA,WAAW,CAACuC,gBAAZ,CAA8B,SAA9B,EAAyCD,kBAAzC;AACAzB,IAAAA,IAAI,CAAC0B,gBAAL,CAAuB,SAAvB,EAAkCzB,SAAlC;AACAD,IAAAA,IAAI,CAAC0B,gBAAL,CAAuB,UAAvB,EAAmCL,UAAnC;AACA,WAAO,MAAM;AACZlC,MAAAA,WAAW,CAACwC,mBAAZ,CAAiC,SAAjC,EAA4CF,kBAA5C;AACAzB,MAAAA,IAAI,CAAC2B,mBAAL,CAA0B,SAA1B,EAAqC1B,SAArC;AACAD,MAAAA,IAAI,CAAC2B,mBAAL,CAA0B,UAA1B,EAAsCN,UAAtC;AACA,KAJD;AAKA,GAhKW,EAgKT,EAhKS,CAAZ;AAkKA,QAAMO,UAAU,GAAG,2BAAc,CAAE9D,SAAF,EAAaiC,GAAb,CAAd,CAAnB;AAEA,SAAO,CAAEF,MAAF,EAAU+B,UAAV,EAAsB9B,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 canvasElement =\n\t\t\t\tcontainer.current.ownerDocument === event.target.ownerDocument\n\t\t\t\t\t? container.current\n\t\t\t\t\t: container.current.ownerDocument.defaultView.frameElement;\n\n\t\t\tconst isBefore =\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tevent.target.compareDocumentPosition( canvasElement ) &\n\t\t\t\tevent.target.DOCUMENT_POSITION_FOLLOWING;\n\t\t\tconst tabbables = focus.tabbable.find( container.current );\n\n\t\t\tif ( tabbables.length ) {\n\t\t\t\tconst next = isBefore\n\t\t\t\t\t? tabbables[ 0 ]\n\t\t\t\t\t: tabbables[ tabbables.length - 1 ];\n\n\t\t\t\tnext.focus();\n\t\t\t}\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// We want to constrain the tabbing to the block and its child blocks.\n\t\t\t// If the preceding form element is within a different block,\n\t\t\t// such as two sibling image blocks in the placeholder state,\n\t\t\t// we want shift + tab from the first form element to move to the image\n\t\t\t// block toolbar and not the previous image block's form element.\n\t\t\t// TODO: Should this become a utility function?\n\t\t\t/**\n\t\t\t * Determine whether an element is part of or is the selected block.\n\t\t\t *\n\t\t\t * @param {Object} selectedBlockElement\n\t\t\t * @param {Object} element\n\t\t\t * @return {boolean} Whether the element is part of or is the selected block.\n\t\t\t */\n\t\t\tconst isElementPartOfSelectedBlock = (\n\t\t\t\tselectedBlockElement,\n\t\t\t\telement\n\t\t\t) => {\n\t\t\t\t// Check if the element is or is within the selected block by finding the\n\t\t\t\t// closest element with a data-block attribute and seeing if\n\t\t\t\t// it matches our current selected block ID\n\t\t\t\tconst elementBlockId = element\n\t\t\t\t\t.closest( '[data-block]' )\n\t\t\t\t\t?.getAttribute( 'data-block' );\n\t\t\t\tconst isElementSameBlock =\n\t\t\t\t\telementBlockId === getSelectedBlockClientId();\n\n\t\t\t\t// Check if the element is a child of the selected block. This could be a\n\t\t\t\t// child block in a group or column block, etc.\n\t\t\t\tconst isElementChildOfBlock =\n\t\t\t\t\tselectedBlockElement.contains( element );\n\n\t\t\t\treturn isElementSameBlock || isElementChildOfBlock;\n\t\t\t};\n\n\t\t\tconst nextTabbable = focus.tabbable[ direction ]( event.target );\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 and its child blocks,\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\tisFormElement( nextTabbable ) &&\n\t\t\t\tisElementPartOfSelectedBlock(\n\t\t\t\t\tevent.target.closest( '[data-block]' ),\n\t\t\t\t\tnextTabbable\n\t\t\t\t)\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"]}
@@ -12,8 +12,6 @@ exports.withToolbarControls = exports.withDataAlign = void 0;
12
12
 
13
13
  var _element = require("@wordpress/element");
14
14
 
15
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
16
-
17
15
  var _classnames = _interopRequireDefault(require("classnames"));
18
16
 
19
17
  var _compose = require("@wordpress/compose");
@@ -130,9 +128,10 @@ function addAttribute(settings) {
130
128
 
131
129
 
132
130
  const withToolbarControls = (0, _compose.createHigherOrderComponent)(BlockEdit => props => {
133
- const blockEdit = (0, _element.createElement)(BlockEdit, (0, _extends2.default)({
134
- key: "edit"
135
- }, props));
131
+ const blockEdit = (0, _element.createElement)(BlockEdit, {
132
+ key: "edit",
133
+ ...props
134
+ });
136
135
  const {
137
136
  name: blockName
138
137
  } = props; // Compute the block valid alignments by taking into account,
@@ -196,7 +195,8 @@ const withDataAlign = (0, _compose.createHigherOrderComponent)(BlockListBlock =>
196
195
  // effort to validate or assign its value.
197
196
 
198
197
  if (align === undefined) {
199
- return (0, _element.createElement)(BlockListBlock, props);
198
+ return (0, _element.createElement)(BlockListBlock, { ...props
199
+ });
200
200
  }
201
201
 
202
202
  let wrapperProps = props.wrapperProps;
@@ -207,9 +207,9 @@ const withDataAlign = (0, _compose.createHigherOrderComponent)(BlockListBlock =>
207
207
  };
208
208
  }
209
209
 
210
- return (0, _element.createElement)(BlockListBlock, (0, _extends2.default)({}, props, {
210
+ return (0, _element.createElement)(BlockListBlock, { ...props,
211
211
  wrapperProps: wrapperProps
212
- }));
212
+ });
213
213
  }, 'withDataAlign');
214
214
  /**
215
215
  * Override props assigned to save component to inject alignment class name if
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/align.js"],"names":["ALL_ALIGNMENTS","WIDE_ALIGNMENTS","getValidAlignments","blockAlign","hasWideBlockSupport","hasWideEnabled","validAlignments","Array","isArray","filter","value","includes","alignment","addAttribute","settings","attributes","align","type","enum","withToolbarControls","BlockEdit","props","blockEdit","name","blockName","blockAllowedAlignments","map","blockEditingMode","length","updateAlignment","nextAlign","blockType","blockDefaultAlign","default","setAttributes","withDataAlign","BlockListBlock","undefined","wrapperProps","some","addAssignedAlign","isAlignValid","className"],"mappings":";;;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AASA;;AACA;;AACA;;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAAc,GAAG,CAAE,MAAF,EAAU,QAAV,EAAoB,OAApB,EAA6B,MAA7B,EAAqC,MAArC,CAAvB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,eAAe,GAAG,CAAE,MAAF,EAAU,MAAV,CAAxB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,kBAAT,CACNC,UADM,EAENC,mBAAmB,GAAG,IAFhB,EAGNC,cAAc,GAAG,IAHX,EAIL;AACD,MAAIC,eAAJ;;AACA,MAAKC,KAAK,CAACC,OAAN,CAAeL,UAAf,CAAL,EAAmC;AAClCG,IAAAA,eAAe,GAAGN,cAAc,CAACS,MAAf,CAAyBC,KAAF,IACxCP,UAAU,CAACQ,QAAX,CAAqBD,KAArB,CADiB,CAAlB;AAGA,GAJD,MAIO,IAAKP,UAAU,KAAK,IAApB,EAA2B;AACjC;AACAG,IAAAA,eAAe,GAAG,CAAE,GAAGN,cAAL,CAAlB;AACA,GAHM,MAGA;AACNM,IAAAA,eAAe,GAAG,EAAlB;AACA;;AAED,MACC,CAAED,cAAF,IACEF,UAAU,KAAK,IAAf,IAAuB,CAAEC,mBAF5B,EAGE;AACD,WAAOE,eAAe,CAACG,MAAhB,CACJG,SAAF,IAAiB,CAAEX,eAAe,CAACU,QAAhB,CAA0BC,SAA1B,CADb,CAAP;AAGA;;AAED,SAAON,eAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASO,YAAT,CAAuBC,QAAvB,EAAkC;AAA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AEE;AACDsB,IAAAA,YAAY,GAAG,EAAE,GAAGA,YAAL;AAAmB,oBAActB;AAAjC,KAAf;AACA;;AAED,SAAO,4BAAC,cAAD,6BAAqBK,KAArB;AAA6B,IAAA,YAAY,EAAGiB;AAA5C,KAAP;AACA,CA1B2B,EA2B5B,eA3B4B,CAAtB;AA8BP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASE,gBAAT,CAA2BnB,KAA3B,EAAkCU,SAAlC,EAA6ChB,UAA7C,EAA0D;AAChE,QAAM;AAAEC,IAAAA;AAAF,MAAYD,UAAlB;AACA,QAAMZ,UAAU,GAAG,6BAAiB4B,SAAjB,EAA4B,OAA5B,CAAnB;AACA,QAAM3B,mBAAmB,GAAG,6BAAiB2B,SAAjB,EAA4B,WAA5B,EAAyC,IAAzC,CAA5B,CAHgE,CAKhE;AACA;AACA;;AACA,QAAMU,YAAY,GAAGvC,kBAAkB,CACtCC,UADsC,EAEtCC,mBAFsC,CAAlB,CAGnBO,QAHmB,CAGTK,KAHS,CAArB;;AAIA,MAAKyB,YAAL,EAAoB;AACnBpB,IAAAA,KAAK,CAACqB,SAAN,GAAkB,yBAAa,QAAQ1B,KAAO,EAA5B,EAA+BK,KAAK,CAACqB,SAArC,CAAlB;AACA;;AAED,SAAOrB,KAAP;AACA;;AAED,sBACC,0BADD,EAEC,yBAFD,EAGCR,YAHD;AAKA,sBACC,uBADD,EAEC,mCAFD,EAGCsB,aAHD;AAKA,sBACC,kBADD,EAEC,yCAFD,EAGChB,mBAHD;AAKA,sBACC,kCADD,EAEC,6BAFD,EAGCqB,gBAHD","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { BlockControls, BlockAlignmentControl } from '../components';\nimport useAvailableAlignments from '../components/block-alignment-control/use-available-alignments';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\n/**\n * An array which includes all possible valid alignments,\n * used to validate if an alignment is valid or not.\n *\n * @constant\n * @type {string[]}\n */\nconst ALL_ALIGNMENTS = [ 'left', 'center', 'right', 'wide', 'full' ];\n\n/**\n * An array which includes all wide alignments.\n * In order for this alignments to be valid they need to be supported by the block,\n * and by the theme.\n *\n * @constant\n * @type {string[]}\n */\nconst WIDE_ALIGNMENTS = [ 'wide', 'full' ];\n\n/**\n * Returns the valid alignments.\n * Takes into consideration the aligns supported by a block, if the block supports wide controls or not and if theme supports wide controls or not.\n * Exported just for testing purposes, not exported outside the module.\n *\n * @param {?boolean|string[]} blockAlign Aligns supported by the block.\n * @param {?boolean} hasWideBlockSupport True if block supports wide alignments. And False otherwise.\n * @param {?boolean} hasWideEnabled True if theme supports wide alignments. And False otherwise.\n *\n * @return {string[]} Valid alignments.\n */\nexport function getValidAlignments(\n\tblockAlign,\n\thasWideBlockSupport = true,\n\thasWideEnabled = true\n) {\n\tlet validAlignments;\n\tif ( Array.isArray( blockAlign ) ) {\n\t\tvalidAlignments = ALL_ALIGNMENTS.filter( ( value ) =>\n\t\t\tblockAlign.includes( value )\n\t\t);\n\t} else if ( blockAlign === true ) {\n\t\t// `true` includes all alignments...\n\t\tvalidAlignments = [ ...ALL_ALIGNMENTS ];\n\t} else {\n\t\tvalidAlignments = [];\n\t}\n\n\tif (\n\t\t! hasWideEnabled ||\n\t\t( blockAlign === true && ! hasWideBlockSupport )\n\t) {\n\t\treturn validAlignments.filter(\n\t\t\t( alignment ) => ! WIDE_ALIGNMENTS.includes( alignment )\n\t\t);\n\t}\n\n\treturn validAlignments;\n}\n\n/**\n * Filters registered block settings, extending attributes to include `align`.\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 ( 'type' in ( settings.attributes?.align ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'align' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\talign: {\n\t\t\t\ttype: 'string',\n\t\t\t\t// Allow for '' since it is used by updateAlignment function\n\t\t\t\t// in withToolbarControls for special cases with defined default values.\n\t\t\t\tenum: [ ...ALL_ALIGNMENTS, '' ],\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include new toolbar controls for block\n * alignment, if block defines support.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withToolbarControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst blockEdit = <BlockEdit key=\"edit\" { ...props } />;\n\t\tconst { name: blockName } = props;\n\t\t// Compute the block valid alignments by taking into account,\n\t\t// if the theme supports wide alignments or not and the layout's\n\t\t// availble alignments. We do that for conditionally rendering\n\t\t// Slot.\n\t\tconst blockAllowedAlignments = getValidAlignments(\n\t\t\tgetBlockSupport( blockName, 'align' ),\n\t\t\thasBlockSupport( blockName, 'alignWide', true )\n\t\t);\n\n\t\tconst validAlignments = useAvailableAlignments(\n\t\t\tblockAllowedAlignments\n\t\t).map( ( { name } ) => name );\n\t\tconst blockEditingMode = useBlockEditingMode();\n\t\tif ( ! validAlignments.length || blockEditingMode !== 'default' ) {\n\t\t\treturn blockEdit;\n\t\t}\n\n\t\tconst updateAlignment = ( nextAlign ) => {\n\t\t\tif ( ! nextAlign ) {\n\t\t\t\tconst blockType = getBlockType( props.name );\n\t\t\t\tconst blockDefaultAlign = blockType?.attributes?.align?.default;\n\t\t\t\tif ( blockDefaultAlign ) {\n\t\t\t\t\tnextAlign = '';\n\t\t\t\t}\n\t\t\t}\n\t\t\tprops.setAttributes( { align: nextAlign } );\n\t\t};\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t\t<BlockAlignmentControl\n\t\t\t\t\t\tvalue={ props.attributes.align }\n\t\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\t\tcontrols={ validAlignments }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t\t{ blockEdit }\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\n/**\n * Override the default block element to add alignment wrapper props.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withDataAlign = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst { align } = attributes;\n\t\tconst blockAllowedAlignments = getValidAlignments(\n\t\t\tgetBlockSupport( name, 'align' ),\n\t\t\thasBlockSupport( name, 'alignWide', true )\n\t\t);\n\t\tconst validAlignments = useAvailableAlignments(\n\t\t\tblockAllowedAlignments\n\t\t);\n\n\t\t// If an alignment is not assigned, there's no need to go through the\n\t\t// effort to validate or assign its value.\n\t\tif ( align === undefined ) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\n\t\tlet wrapperProps = props.wrapperProps;\n\t\tif (\n\t\t\tvalidAlignments.some( ( alignment ) => alignment.name === align )\n\t\t) {\n\t\t\twrapperProps = { ...wrapperProps, 'data-align': align };\n\t\t}\n\n\t\treturn <BlockListBlock { ...props } wrapperProps={ wrapperProps } />;\n\t},\n\t'withDataAlign'\n);\n\n/**\n * Override props assigned to save component to inject alignment class name if\n * block supports it.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addAssignedAlign( props, blockType, attributes ) {\n\tconst { align } = attributes;\n\tconst blockAlign = getBlockSupport( blockType, 'align' );\n\tconst hasWideBlockSupport = hasBlockSupport( blockType, 'alignWide', true );\n\n\t// Compute valid alignments without taking into account if\n\t// the theme supports wide alignments or not.\n\t// This way changing themes does not impact the block save.\n\tconst isAlignValid = getValidAlignments(\n\t\tblockAlign,\n\t\thasWideBlockSupport\n\t).includes( align );\n\tif ( isAlignValid ) {\n\t\tprops.className = classnames( `align${ align }`, props.className );\n\t}\n\n\treturn props;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/align/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/align/with-data-align',\n\twithDataAlign\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/align/with-toolbar-controls',\n\twithToolbarControls\n);\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/align/addAssignedAlign',\n\taddAssignedAlign\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/align.js"],"names":["ALL_ALIGNMENTS","WIDE_ALIGNMENTS","getValidAlignments","blockAlign","hasWideBlockSupport","hasWideEnabled","validAlignments","Array","isArray","filter","value","includes","alignment","addAttribute","settings","attributes","align","type","enum","withToolbarControls","BlockEdit","props","blockEdit","name","blockName","blockAllowedAlignments","map","blockEditingMode","length","updateAlignment","nextAlign","blockType","blockDefaultAlign","default","setAttributes","withDataAlign","BlockListBlock","undefined","wrapperProps","some","addAssignedAlign","isAlignValid","className"],"mappings":";;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AASA;;AACA;;AACA;;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAAc,GAAG,CAAE,MAAF,EAAU,QAAV,EAAoB,OAApB,EAA6B,MAA7B,EAAqC,MAArC,CAAvB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,eAAe,GAAG,CAAE,MAAF,EAAU,MAAV,CAAxB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,kBAA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zC,CAA5B,CAHgE,CAKhE;AACA;AACA;;AACA,QAAMU,YAAY,GAAGvC,kBAAkB,CACtCC,UADsC,EAEtCC,mBAFsC,CAAlB,CAGnBO,QAHmB,CAGTK,KAHS,CAArB;;AAIA,MAAKyB,YAAL,EAAoB;AACnBpB,IAAAA,KAAK,CAACqB,SAAN,GAAkB,yBAAa,QAAQ1B,KAAO,EAA5B,EAA+BK,KAAK,CAACqB,SAArC,CAAlB;AACA;;AAED,SAAOrB,KAAP;AACA;;AAED,sBACC,0BADD,EAEC,yBAFD,EAGCR,YAHD;AAKA,sBACC,uBADD,EAEC,mCAFD,EAGCsB,aAHD;AAKA,sBACC,kBADD,EAEC,yCAFD,EAGChB,mBAHD;AAKA,sBACC,kCADD,EAEC,6BAFD,EAGCqB,gBAHD","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { BlockControls, BlockAlignmentControl } from '../components';\nimport useAvailableAlignments from '../components/block-alignment-control/use-available-alignments';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\n/**\n * An array which includes all possible valid alignments,\n * used to validate if an alignment is valid or not.\n *\n * @constant\n * @type {string[]}\n */\nconst ALL_ALIGNMENTS = [ 'left', 'center', 'right', 'wide', 'full' ];\n\n/**\n * An array which includes all wide alignments.\n * In order for this alignments to be valid they need to be supported by the block,\n * and by the theme.\n *\n * @constant\n * @type {string[]}\n */\nconst WIDE_ALIGNMENTS = [ 'wide', 'full' ];\n\n/**\n * Returns the valid alignments.\n * Takes into consideration the aligns supported by a block, if the block supports wide controls or not and if theme supports wide controls or not.\n * Exported just for testing purposes, not exported outside the module.\n *\n * @param {?boolean|string[]} blockAlign Aligns supported by the block.\n * @param {?boolean} hasWideBlockSupport True if block supports wide alignments. And False otherwise.\n * @param {?boolean} hasWideEnabled True if theme supports wide alignments. And False otherwise.\n *\n * @return {string[]} Valid alignments.\n */\nexport function getValidAlignments(\n\tblockAlign,\n\thasWideBlockSupport = true,\n\thasWideEnabled = true\n) {\n\tlet validAlignments;\n\tif ( Array.isArray( blockAlign ) ) {\n\t\tvalidAlignments = ALL_ALIGNMENTS.filter( ( value ) =>\n\t\t\tblockAlign.includes( value )\n\t\t);\n\t} else if ( blockAlign === true ) {\n\t\t// `true` includes all alignments...\n\t\tvalidAlignments = [ ...ALL_ALIGNMENTS ];\n\t} else {\n\t\tvalidAlignments = [];\n\t}\n\n\tif (\n\t\t! hasWideEnabled ||\n\t\t( blockAlign === true && ! hasWideBlockSupport )\n\t) {\n\t\treturn validAlignments.filter(\n\t\t\t( alignment ) => ! WIDE_ALIGNMENTS.includes( alignment )\n\t\t);\n\t}\n\n\treturn validAlignments;\n}\n\n/**\n * Filters registered block settings, extending attributes to include `align`.\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 ( 'type' in ( settings.attributes?.align ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'align' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\talign: {\n\t\t\t\ttype: 'string',\n\t\t\t\t// Allow for '' since it is used by updateAlignment function\n\t\t\t\t// in withToolbarControls for special cases with defined default values.\n\t\t\t\tenum: [ ...ALL_ALIGNMENTS, '' ],\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include new toolbar controls for block\n * alignment, if block defines support.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withToolbarControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst blockEdit = <BlockEdit key=\"edit\" { ...props } />;\n\t\tconst { name: blockName } = props;\n\t\t// Compute the block valid alignments by taking into account,\n\t\t// if the theme supports wide alignments or not and the layout's\n\t\t// availble alignments. We do that for conditionally rendering\n\t\t// Slot.\n\t\tconst blockAllowedAlignments = getValidAlignments(\n\t\t\tgetBlockSupport( blockName, 'align' ),\n\t\t\thasBlockSupport( blockName, 'alignWide', true )\n\t\t);\n\n\t\tconst validAlignments = useAvailableAlignments(\n\t\t\tblockAllowedAlignments\n\t\t).map( ( { name } ) => name );\n\t\tconst blockEditingMode = useBlockEditingMode();\n\t\tif ( ! validAlignments.length || blockEditingMode !== 'default' ) {\n\t\t\treturn blockEdit;\n\t\t}\n\n\t\tconst updateAlignment = ( nextAlign ) => {\n\t\t\tif ( ! nextAlign ) {\n\t\t\t\tconst blockType = getBlockType( props.name );\n\t\t\t\tconst blockDefaultAlign = blockType?.attributes?.align?.default;\n\t\t\t\tif ( blockDefaultAlign ) {\n\t\t\t\t\tnextAlign = '';\n\t\t\t\t}\n\t\t\t}\n\t\t\tprops.setAttributes( { align: nextAlign } );\n\t\t};\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t\t<BlockAlignmentControl\n\t\t\t\t\t\tvalue={ props.attributes.align }\n\t\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\t\tcontrols={ validAlignments }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t\t{ blockEdit }\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\n/**\n * Override the default block element to add alignment wrapper props.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withDataAlign = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst { align } = attributes;\n\t\tconst blockAllowedAlignments = getValidAlignments(\n\t\t\tgetBlockSupport( name, 'align' ),\n\t\t\thasBlockSupport( name, 'alignWide', true )\n\t\t);\n\t\tconst validAlignments = useAvailableAlignments(\n\t\t\tblockAllowedAlignments\n\t\t);\n\n\t\t// If an alignment is not assigned, there's no need to go through the\n\t\t// effort to validate or assign its value.\n\t\tif ( align === undefined ) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\n\t\tlet wrapperProps = props.wrapperProps;\n\t\tif (\n\t\t\tvalidAlignments.some( ( alignment ) => alignment.name === align )\n\t\t) {\n\t\t\twrapperProps = { ...wrapperProps, 'data-align': align };\n\t\t}\n\n\t\treturn <BlockListBlock { ...props } wrapperProps={ wrapperProps } />;\n\t},\n\t'withDataAlign'\n);\n\n/**\n * Override props assigned to save component to inject alignment class name if\n * block supports it.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addAssignedAlign( props, blockType, attributes ) {\n\tconst { align } = attributes;\n\tconst blockAlign = getBlockSupport( blockType, 'align' );\n\tconst hasWideBlockSupport = hasBlockSupport( blockType, 'alignWide', true );\n\n\t// Compute valid alignments without taking into account if\n\t// the theme supports wide alignments or not.\n\t// This way changing themes does not impact the block save.\n\tconst isAlignValid = getValidAlignments(\n\t\tblockAlign,\n\t\thasWideBlockSupport\n\t).includes( align );\n\tif ( isAlignValid ) {\n\t\tprops.className = classnames( `align${ align }`, props.className );\n\t}\n\n\treturn props;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/align/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/align/with-data-align',\n\twithDataAlign\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/align/with-toolbar-controls',\n\twithToolbarControls\n);\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/align/addAssignedAlign',\n\taddAssignedAlign\n);\n"]}
@@ -104,14 +104,16 @@ const withInspectorControl = (0, _compose.createHigherOrderComponent)(BlockEdit
104
104
  autoCapitalize: "none",
105
105
  autoComplete: "off"
106
106
  });
107
- return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(BlockEdit, props), isWeb && blockEditingMode === 'default' && (0, _element.createElement)(_components2.InspectorControls, {
107
+ return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(BlockEdit, { ...props
108
+ }), isWeb && blockEditingMode === 'default' && (0, _element.createElement)(_components2.InspectorControls, {
108
109
  group: "advanced"
109
110
  }, textControl), !isWeb && props.name === 'core/heading' && (0, _element.createElement)(_components2.InspectorControls, null, (0, _element.createElement)(_components.PanelBody, {
110
111
  title: (0, _i18n.__)('Heading settings')
111
112
  }, textControl)));
112
113
  }
113
114
 
114
- return (0, _element.createElement)(BlockEdit, props);
115
+ return (0, _element.createElement)(BlockEdit, { ...props
116
+ });
115
117
  };
116
118
  }, 'withInspectorControl');
117
119
  /**
@@ -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","blockEditingMode","isSelected","isWeb","Platform","OS","textControl","nextValue","replace","setAttributes","addSaveProps","extraProps","blockType","id"],"mappings":";;;;;;;;;AAQA;;AALA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAdA;AACA;AACA;;AAQA;AACA;AACA;;AAIA;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;AAAA;;AACxC;AACA,MAAK,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N,CAAqB;AACpBd,YAAAA,MAAM,EAAEY;AADY,WAArB;AAGA,SA5BF;AA6BC,QAAA,cAAc,EAAC,MA7BhB;AA8BC,QAAA,YAAY,EAAC;AA9Bd,QADD;AAmCA,aACC,qDACC,4BAAC,SAAD,EAAgBT,KAAhB,CADD,EAEGK,KAAK,IAAIF,gBAAgB,KAAK,SAA9B,IACD,4BAAC,8BAAD;AAAmB,QAAA,KAAK,EAAC;AAAzB,SACGK,WADH,CAHF,EAaG,CAAEH,KAAF,IAAWL,KAAK,CAACE,IAAN,KAAe,cAA1B,IACD,4BAAC,8BAAD,QACC,4BAAC,qBAAD;AAAW,QAAA,KAAK,EAAG,cAAI,kBAAJ;AAAnB,SACGM,WADH,CADD,CAdF,CADD;AAuBA;;AAED,WAAO,4BAAC,SAAD,EAAgBR,KAAhB,CAAP;AACA,GAnED;AAoEA,CAtEkC,EAuEnC,sBAvEmC,CAA7B;AA0EP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASY,YAAT,CAAuBC,UAAvB,EAAmCC,SAAnC,EAA8ClB,UAA9C,EAA2D;AACjE,MAAK,6BAAiBkB,SAAjB,EAA4B,QAA5B,CAAL,EAA8C;AAC7CD,IAAAA,UAAU,CAACE,EAAX,GAAgBnB,UAAU,CAACC,MAAX,KAAsB,EAAtB,GAA2B,IAA3B,GAAkCD,UAAU,CAACC,MAA7D;AACA;;AAED,SAAOgB,UAAP;AACA;;AAED,sBAAW,0BAAX,EAAuC,uBAAvC,EAAgEnB,YAAhE;AACA,sBACC,kBADD,EAEC,2CAFD,EAGCI,oBAHD;AAKA,sBACC,kCADD,EAEC,wBAFD,EAGCc,YAHD","sourcesContent":["/**\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';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\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 ( 'type' in ( settings.attributes?.anchor ?? {} ) ) {\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\t\t\tconst blockEditingMode = useBlockEditingMode();\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\t__nextHasNoMarginBottom\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/documentation/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 && blockEditingMode === 'default' && (\n\t\t\t\t\t\t\t<InspectorControls group=\"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"]}
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","blockEditingMode","isSelected","isWeb","Platform","OS","textControl","nextValue","replace","setAttributes","addSaveProps","extraProps","blockType","id"],"mappings":";;;;;;;;;AAQA;;AALA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAdA;AACA;AACA;;AAQA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA,M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AvC,EAAgEnB,YAAhE;AACA,sBACC,kBADD,EAEC,2CAFD,EAGCI,oBAHD;AAKA,sBACC,kCADD,EAEC,wBAFD,EAGCc,YAHD","sourcesContent":["/**\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';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\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 ( 'type' in ( settings.attributes?.anchor ?? {} ) ) {\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\t\t\tconst blockEditingMode = useBlockEditingMode();\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\t__nextHasNoMarginBottom\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/documentation/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 && blockEditingMode === 'default' && (\n\t\t\t\t\t\t\t<InspectorControls group=\"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"]}