@wordpress/block-editor 10.5.0 → 11.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (716) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +2 -1
  3. package/build/autocompleters/block.js +2 -6
  4. package/build/autocompleters/block.js.map +1 -1
  5. package/build/autocompleters/link.js +2 -0
  6. package/build/autocompleters/link.js.map +1 -1
  7. package/build/components/alignment-control/ui.js +1 -7
  8. package/build/components/alignment-control/ui.js.map +1 -1
  9. package/build/components/block-alignment-control/use-available-alignments.js +4 -3
  10. package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
  11. package/build/components/block-card/index.js +51 -3
  12. package/build/components/block-card/index.js.map +1 -1
  13. package/build/components/block-draggable/index.native.js +46 -39
  14. package/build/components/block-draggable/index.native.js.map +1 -1
  15. package/build/components/block-edit/edit.js +4 -3
  16. package/build/components/block-edit/edit.js.map +1 -1
  17. package/build/components/block-edit/edit.native.js +4 -7
  18. package/build/components/block-edit/edit.native.js.map +1 -1
  19. package/build/components/block-icon/index.js +4 -2
  20. package/build/components/block-icon/index.js.map +1 -1
  21. package/build/components/block-inspector/index.js +90 -37
  22. package/build/components/block-inspector/index.js.map +1 -1
  23. package/build/components/block-list/block-list-context.native.js +5 -8
  24. package/build/components/block-list/block-list-context.native.js.map +1 -1
  25. package/build/components/block-list/block.js +55 -24
  26. package/build/components/block-list/block.js.map +1 -1
  27. package/build/components/block-list/block.native.js +61 -28
  28. package/build/components/block-list/block.native.js.map +1 -1
  29. package/build/components/block-list-appender/index.js +46 -34
  30. package/build/components/block-list-appender/index.js.map +1 -1
  31. package/build/components/block-list-appender/index.native.js +39 -34
  32. package/build/components/block-list-appender/index.native.js.map +1 -1
  33. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +30 -22
  34. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  35. package/build/components/block-mobile-toolbar/index.native.js +1 -1
  36. package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
  37. package/build/components/block-pattern-setup/index.js +16 -8
  38. package/build/components/block-pattern-setup/index.js.map +1 -1
  39. package/build/components/block-patterns-list/index.js +33 -11
  40. package/build/components/block-patterns-list/index.js.map +1 -1
  41. package/build/components/block-preview/auto.js +9 -3
  42. package/build/components/block-preview/auto.js.map +1 -1
  43. package/build/components/block-preview/index.js +5 -9
  44. package/build/components/block-preview/index.js.map +1 -1
  45. package/build/components/block-settings-menu/block-settings-dropdown.js +5 -2
  46. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  47. package/build/components/block-styles/index.native.js +1 -3
  48. package/build/components/block-styles/index.native.js.map +1 -1
  49. package/build/components/block-styles/utils.js +7 -10
  50. package/build/components/block-styles/utils.js.map +1 -1
  51. package/build/components/block-toolbar/index.js +5 -1
  52. package/build/components/block-toolbar/index.js.map +1 -1
  53. package/build/components/block-toolbar/index.native.js +6 -8
  54. package/build/components/block-toolbar/index.native.js.map +1 -1
  55. package/build/components/block-tools/insertion-point.js +8 -49
  56. package/build/components/block-tools/insertion-point.js.map +1 -1
  57. package/build/components/block-tools/selected-block-popover.js +1 -3
  58. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  59. package/build/components/block-variation-picker/index.js +2 -3
  60. package/build/components/block-variation-picker/index.js.map +1 -1
  61. package/build/components/colors/utils.js +2 -6
  62. package/build/components/colors/utils.js.map +1 -1
  63. package/build/components/colors-gradients/control.js +0 -3
  64. package/build/components/colors-gradients/control.js.map +1 -1
  65. package/build/components/colors-gradients/dropdown.js +0 -2
  66. package/build/components/colors-gradients/dropdown.js.map +1 -1
  67. package/build/components/colors-gradients/panel-color-gradient-settings.js +2 -19
  68. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  69. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -3
  70. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  71. package/build/components/copy-handler/index.js +37 -9
  72. package/build/components/copy-handler/index.js.map +1 -1
  73. package/build/components/font-sizes/fluid-utils.js +5 -2
  74. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  75. package/build/components/font-sizes/utils.js +10 -4
  76. package/build/components/font-sizes/utils.js.map +1 -1
  77. package/build/components/font-sizes/with-font-sizes.js +11 -6
  78. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  79. package/build/components/gradients/use-gradient.js +2 -8
  80. package/build/components/gradients/use-gradient.js.map +1 -1
  81. package/build/components/height-control/index.js +115 -0
  82. package/build/components/height-control/index.js.map +1 -0
  83. package/build/components/iframe/index.js +22 -101
  84. package/build/components/iframe/index.js.map +1 -1
  85. package/build/components/iframe/use-compatibility-styles.js +93 -0
  86. package/build/components/iframe/use-compatibility-styles.js.map +1 -0
  87. package/build/components/image-editor/use-save-image.js +2 -0
  88. package/build/components/image-editor/use-save-image.js.map +1 -1
  89. package/build/components/image-editor/zoom-dropdown.js +1 -0
  90. package/build/components/image-editor/zoom-dropdown.js.map +1 -1
  91. package/build/components/index.js +9 -0
  92. package/build/components/index.js.map +1 -1
  93. package/build/components/inner-blocks/index.js +25 -7
  94. package/build/components/inner-blocks/index.js.map +1 -1
  95. package/build/components/inner-blocks/use-inner-block-template-sync.js +25 -10
  96. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  97. package/build/components/inserter/block-patterns-explorer/sidebar.js +1 -0
  98. package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  99. package/build/components/inserter/block-patterns-tab.js +25 -46
  100. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  101. package/build/components/inserter/block-types-tab.js +3 -1
  102. package/build/components/inserter/block-types-tab.js.map +1 -1
  103. package/build/components/inserter/hooks/use-debounced-input.js +27 -0
  104. package/build/components/inserter/hooks/use-debounced-input.js.map +1 -0
  105. package/build/components/inserter/hooks/use-insertion-point.js +4 -3
  106. package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
  107. package/build/components/inserter/index.js +20 -6
  108. package/build/components/inserter/index.js.map +1 -1
  109. package/build/components/inserter/index.native.js +3 -4
  110. package/build/components/inserter/index.native.js.map +1 -1
  111. package/build/components/inserter/media-tab/hooks.js +106 -0
  112. package/build/components/inserter/media-tab/hooks.js.map +1 -0
  113. package/build/components/inserter/media-tab/index.js +32 -0
  114. package/build/components/inserter/media-tab/index.js.map +1 -0
  115. package/build/components/inserter/media-tab/media-list.js +100 -0
  116. package/build/components/inserter/media-tab/media-list.js.map +1 -0
  117. package/build/components/inserter/media-tab/media-panel.js +96 -0
  118. package/build/components/inserter/media-tab/media-panel.js.map +1 -0
  119. package/build/components/inserter/media-tab/media-tab.js +120 -0
  120. package/build/components/inserter/media-tab/media-tab.js.map +1 -0
  121. package/build/components/inserter/media-tab/utils.js +54 -0
  122. package/build/components/inserter/media-tab/utils.js.map +1 -0
  123. package/build/components/inserter/menu.js +35 -12
  124. package/build/components/inserter/menu.js.map +1 -1
  125. package/build/components/inserter/mobile-tab-navigation.js +70 -0
  126. package/build/components/inserter/mobile-tab-navigation.js.map +1 -0
  127. package/build/components/inserter/quick-inserter.js +7 -3
  128. package/build/components/inserter/quick-inserter.js.map +1 -1
  129. package/build/components/inserter/search-items.js +15 -14
  130. package/build/components/inserter/search-items.js.map +1 -1
  131. package/build/components/inserter/search-results.js +7 -3
  132. package/build/components/inserter/search-results.js.map +1 -1
  133. package/build/components/inserter/tabs.js +16 -2
  134. package/build/components/inserter/tabs.js.map +1 -1
  135. package/build/components/inserter-list-item/index.js +4 -1
  136. package/build/components/inserter-list-item/index.js.map +1 -1
  137. package/build/components/inspector-controls/groups.js +2 -0
  138. package/build/components/inspector-controls/groups.js.map +1 -1
  139. package/build/components/inspector-controls-tabs/advanced-controls-panel.js +46 -0
  140. package/build/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -0
  141. package/build/components/inspector-controls-tabs/index.js +71 -0
  142. package/build/components/inspector-controls-tabs/index.js.map +1 -0
  143. package/build/components/inspector-controls-tabs/settings-tab.js +28 -0
  144. package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -0
  145. package/build/components/inspector-controls-tabs/styles-tab.js +61 -0
  146. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -0
  147. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +97 -0
  148. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -0
  149. package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +18 -0
  150. package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -0
  151. package/build/components/inspector-controls-tabs/utils.js +37 -0
  152. package/build/components/inspector-controls-tabs/utils.js.map +1 -0
  153. package/build/components/link-control/index.js +1 -0
  154. package/build/components/link-control/index.js.map +1 -1
  155. package/build/components/link-control/search-input.js +0 -1
  156. package/build/components/link-control/search-input.js.map +1 -1
  157. package/build/components/link-control/use-internal-input-value.js +3 -3
  158. package/build/components/link-control/use-internal-input-value.js.map +1 -1
  159. package/build/components/list-view/block-select-button.js +1 -1
  160. package/build/components/list-view/block-select-button.js.map +1 -1
  161. package/build/components/list-view/block.js +5 -2
  162. package/build/components/list-view/block.js.map +1 -1
  163. package/build/components/list-view/branch.js +13 -12
  164. package/build/components/list-view/branch.js.map +1 -1
  165. package/build/components/media-upload/index.native.js +2 -3
  166. package/build/components/media-upload/index.native.js.map +1 -1
  167. package/build/components/off-canvas-editor/appender.js +99 -0
  168. package/build/components/off-canvas-editor/appender.js.map +1 -0
  169. package/build/components/off-canvas-editor/block-edit-button.js +50 -0
  170. package/build/components/off-canvas-editor/block-edit-button.js.map +1 -0
  171. package/build/components/off-canvas-editor/block-select-button.js +3 -2
  172. package/build/components/off-canvas-editor/block-select-button.js.map +1 -1
  173. package/build/components/off-canvas-editor/block.js +82 -38
  174. package/build/components/off-canvas-editor/block.js.map +1 -1
  175. package/build/components/off-canvas-editor/branch.js +3 -5
  176. package/build/components/off-canvas-editor/branch.js.map +1 -1
  177. package/build/components/off-canvas-editor/index.js +24 -11
  178. package/build/components/off-canvas-editor/index.js.map +1 -1
  179. package/build/components/off-canvas-editor/leaf.js +1 -1
  180. package/build/components/off-canvas-editor/leaf.js.map +1 -1
  181. package/build/components/off-canvas-editor/link-ui.js +185 -0
  182. package/build/components/off-canvas-editor/link-ui.js.map +1 -0
  183. package/build/components/off-canvas-editor/update-attributes.js +108 -0
  184. package/build/components/off-canvas-editor/update-attributes.js.map +1 -0
  185. package/build/components/off-canvas-editor/use-inserted-block.js +58 -0
  186. package/build/components/off-canvas-editor/use-inserted-block.js.map +1 -0
  187. package/build/components/responsive-block-control/label.js.map +1 -1
  188. package/build/components/rich-text/format-edit.js +12 -10
  189. package/build/components/rich-text/format-edit.js.map +1 -1
  190. package/build/components/rich-text/format-toolbar/index.js +8 -4
  191. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  192. package/build/components/rich-text/index.js +3 -3
  193. package/build/components/rich-text/index.js.map +1 -1
  194. package/build/components/rich-text/index.native.js +0 -2
  195. package/build/components/rich-text/index.native.js.map +1 -1
  196. package/build/components/rich-text/use-insert-replacement-text.js +43 -0
  197. package/build/components/rich-text/use-insert-replacement-text.js.map +1 -0
  198. package/build/components/rich-text/use-paste-handler.js +21 -12
  199. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  200. package/build/components/rich-text/use-undo-automatic-change.js +9 -1
  201. package/build/components/rich-text/use-undo-automatic-change.js.map +1 -1
  202. package/build/components/rich-text/utils.js +1 -19
  203. package/build/components/rich-text/utils.js.map +1 -1
  204. package/build/components/spacing-sizes-control/index.js +0 -1
  205. package/build/components/spacing-sizes-control/index.js.map +1 -1
  206. package/build/components/spacing-sizes-control/spacing-input-control.js +12 -3
  207. package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  208. package/build/components/spacing-sizes-control/utils.js +1 -1
  209. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  210. package/build/components/typewriter/index.js +1 -1
  211. package/build/components/typewriter/index.js.map +1 -1
  212. package/build/components/ungroup-button/index.native.js +4 -2
  213. package/build/components/ungroup-button/index.native.js.map +1 -1
  214. package/build/components/url-input/index.js +46 -43
  215. package/build/components/url-input/index.js.map +1 -1
  216. package/build/components/url-popover/image-url-input-ui.js +2 -2
  217. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  218. package/build/components/use-block-display-information/index.js +8 -4
  219. package/build/components/use-block-display-information/index.js.map +1 -1
  220. package/build/components/use-setting/index.js +9 -1
  221. package/build/components/use-setting/index.js.map +1 -1
  222. package/build/components/writing-flow/index.js +1 -1
  223. package/build/components/writing-flow/index.js.map +1 -1
  224. package/build/hooks/border.js +0 -1
  225. package/build/hooks/border.js.map +1 -1
  226. package/build/hooks/child-layout.js +209 -0
  227. package/build/hooks/child-layout.js.map +1 -0
  228. package/build/hooks/color-panel.js +0 -1
  229. package/build/hooks/color-panel.js.map +1 -1
  230. package/build/hooks/color.js +1 -2
  231. package/build/hooks/color.js.map +1 -1
  232. package/build/hooks/content-lock-ui.js +1 -1
  233. package/build/hooks/content-lock-ui.js.map +1 -1
  234. package/build/hooks/dimensions.js +25 -7
  235. package/build/hooks/dimensions.js.map +1 -1
  236. package/build/hooks/font-family.js +4 -4
  237. package/build/hooks/font-family.js.map +1 -1
  238. package/build/hooks/font-size.js +5 -3
  239. package/build/hooks/font-size.js.map +1 -1
  240. package/build/hooks/layout.js +57 -1
  241. package/build/hooks/layout.js.map +1 -1
  242. package/build/hooks/min-height.js +4 -10
  243. package/build/hooks/min-height.js.map +1 -1
  244. package/build/hooks/use-typography-props.js +11 -8
  245. package/build/hooks/use-typography-props.js.map +1 -1
  246. package/build/store/reducer.js +411 -274
  247. package/build/store/reducer.js.map +1 -1
  248. package/build/store/selectors.js +58 -48
  249. package/build/store/selectors.js.map +1 -1
  250. package/build/utils/pasting.js +6 -11
  251. package/build/utils/pasting.js.map +1 -1
  252. package/build/utils/sorting.js +63 -0
  253. package/build/utils/sorting.js.map +1 -0
  254. package/build-module/autocompleters/block.js +2 -6
  255. package/build-module/autocompleters/block.js.map +1 -1
  256. package/build-module/autocompleters/link.js +2 -0
  257. package/build-module/autocompleters/link.js.map +1 -1
  258. package/build-module/components/alignment-control/ui.js +1 -6
  259. package/build-module/components/alignment-control/ui.js.map +1 -1
  260. package/build-module/components/block-alignment-control/use-available-alignments.js +4 -3
  261. package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
  262. package/build-module/components/block-card/index.js +45 -3
  263. package/build-module/components/block-card/index.js.map +1 -1
  264. package/build-module/components/block-draggable/index.native.js +40 -31
  265. package/build-module/components/block-draggable/index.native.js.map +1 -1
  266. package/build-module/components/block-edit/edit.js +4 -2
  267. package/build-module/components/block-edit/edit.js.map +1 -1
  268. package/build-module/components/block-edit/edit.native.js +4 -6
  269. package/build-module/components/block-edit/edit.native.js.map +1 -1
  270. package/build-module/components/block-icon/index.js +4 -2
  271. package/build-module/components/block-icon/index.js.map +1 -1
  272. package/build-module/components/block-inspector/index.js +87 -34
  273. package/build-module/components/block-inspector/index.js.map +1 -1
  274. package/build-module/components/block-list/block-list-context.native.js +5 -8
  275. package/build-module/components/block-list/block-list-context.native.js.map +1 -1
  276. package/build-module/components/block-list/block.js +55 -25
  277. package/build-module/components/block-list/block.js.map +1 -1
  278. package/build-module/components/block-list/block.native.js +61 -28
  279. package/build-module/components/block-list/block.native.js.map +1 -1
  280. package/build-module/components/block-list-appender/index.js +46 -34
  281. package/build-module/components/block-list-appender/index.js.map +1 -1
  282. package/build-module/components/block-list-appender/index.native.js +39 -32
  283. package/build-module/components/block-list-appender/index.native.js.map +1 -1
  284. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +31 -24
  285. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  286. package/build-module/components/block-mobile-toolbar/index.native.js +1 -1
  287. package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
  288. package/build-module/components/block-pattern-setup/index.js +16 -8
  289. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  290. package/build-module/components/block-patterns-list/index.js +35 -13
  291. package/build-module/components/block-patterns-list/index.js.map +1 -1
  292. package/build-module/components/block-preview/auto.js +9 -3
  293. package/build-module/components/block-preview/auto.js.map +1 -1
  294. package/build-module/components/block-preview/index.js +5 -8
  295. package/build-module/components/block-preview/index.js.map +1 -1
  296. package/build-module/components/block-settings-menu/block-settings-dropdown.js +5 -2
  297. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  298. package/build-module/components/block-styles/index.native.js +1 -2
  299. package/build-module/components/block-styles/index.native.js.map +1 -1
  300. package/build-module/components/block-styles/utils.js +7 -9
  301. package/build-module/components/block-styles/utils.js.map +1 -1
  302. package/build-module/components/block-toolbar/index.js +6 -2
  303. package/build-module/components/block-toolbar/index.js.map +1 -1
  304. package/build-module/components/block-toolbar/index.native.js +6 -8
  305. package/build-module/components/block-toolbar/index.native.js.map +1 -1
  306. package/build-module/components/block-tools/insertion-point.js +8 -49
  307. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  308. package/build-module/components/block-tools/selected-block-popover.js +1 -2
  309. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  310. package/build-module/components/block-variation-picker/index.js +2 -3
  311. package/build-module/components/block-variation-picker/index.js.map +1 -1
  312. package/build-module/components/colors/utils.js +3 -7
  313. package/build-module/components/colors/utils.js.map +1 -1
  314. package/build-module/components/colors-gradients/control.js +0 -3
  315. package/build-module/components/colors-gradients/control.js.map +1 -1
  316. package/build-module/components/colors-gradients/dropdown.js +0 -2
  317. package/build-module/components/colors-gradients/dropdown.js.map +1 -1
  318. package/build-module/components/colors-gradients/panel-color-gradient-settings.js +4 -19
  319. package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  320. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
  321. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  322. package/build-module/components/copy-handler/index.js +38 -10
  323. package/build-module/components/copy-handler/index.js.map +1 -1
  324. package/build-module/components/font-sizes/fluid-utils.js +5 -2
  325. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  326. package/build-module/components/font-sizes/utils.js +11 -5
  327. package/build-module/components/font-sizes/utils.js.map +1 -1
  328. package/build-module/components/font-sizes/with-font-sizes.js +12 -7
  329. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  330. package/build-module/components/gradients/use-gradient.js +2 -7
  331. package/build-module/components/gradients/use-gradient.js.map +1 -1
  332. package/build-module/components/height-control/index.js +103 -0
  333. package/build-module/components/height-control/index.js.map +1 -0
  334. package/build-module/components/iframe/index.js +21 -101
  335. package/build-module/components/iframe/index.js.map +1 -1
  336. package/build-module/components/iframe/use-compatibility-styles.js +85 -0
  337. package/build-module/components/iframe/use-compatibility-styles.js.map +1 -0
  338. package/build-module/components/image-editor/use-save-image.js +2 -0
  339. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  340. package/build-module/components/image-editor/zoom-dropdown.js +1 -0
  341. package/build-module/components/image-editor/zoom-dropdown.js.map +1 -1
  342. package/build-module/components/index.js +1 -0
  343. package/build-module/components/index.js.map +1 -1
  344. package/build-module/components/inner-blocks/index.js +27 -9
  345. package/build-module/components/inner-blocks/index.js.map +1 -1
  346. package/build-module/components/inner-blocks/use-inner-block-template-sync.js +23 -10
  347. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  348. package/build-module/components/inserter/block-patterns-explorer/sidebar.js +1 -0
  349. package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  350. package/build-module/components/inserter/block-patterns-tab.js +27 -49
  351. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  352. package/build-module/components/inserter/block-types-tab.js +3 -2
  353. package/build-module/components/inserter/block-types-tab.js.map +1 -1
  354. package/build-module/components/inserter/hooks/use-debounced-input.js +18 -0
  355. package/build-module/components/inserter/hooks/use-debounced-input.js.map +1 -0
  356. package/build-module/components/inserter/hooks/use-insertion-point.js +4 -3
  357. package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
  358. package/build-module/components/inserter/index.js +20 -6
  359. package/build-module/components/inserter/index.js.map +1 -1
  360. package/build-module/components/inserter/index.native.js +3 -5
  361. package/build-module/components/inserter/index.native.js.map +1 -1
  362. package/build-module/components/inserter/media-tab/hooks.js +92 -0
  363. package/build-module/components/inserter/media-tab/hooks.js.map +1 -0
  364. package/build-module/components/inserter/media-tab/index.js +4 -0
  365. package/build-module/components/inserter/media-tab/index.js.map +1 -0
  366. package/build-module/components/inserter/media-tab/media-list.js +86 -0
  367. package/build-module/components/inserter/media-tab/media-list.js.map +1 -0
  368. package/build-module/components/inserter/media-tab/media-panel.js +77 -0
  369. package/build-module/components/inserter/media-tab/media-panel.js.map +1 -0
  370. package/build-module/components/inserter/media-tab/media-tab.js +100 -0
  371. package/build-module/components/inserter/media-tab/media-tab.js.map +1 -0
  372. package/build-module/components/inserter/media-tab/utils.js +45 -0
  373. package/build-module/components/inserter/media-tab/utils.js.map +1 -0
  374. package/build-module/components/inserter/menu.js +33 -12
  375. package/build-module/components/inserter/menu.js.map +1 -1
  376. package/build-module/components/inserter/mobile-tab-navigation.js +61 -0
  377. package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -0
  378. package/build-module/components/inserter/quick-inserter.js +7 -3
  379. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  380. package/build-module/components/inserter/search-items.js +15 -13
  381. package/build-module/components/inserter/search-items.js.map +1 -1
  382. package/build-module/components/inserter/search-results.js +7 -4
  383. package/build-module/components/inserter/search-results.js.map +1 -1
  384. package/build-module/components/inserter/tabs.js +15 -2
  385. package/build-module/components/inserter/tabs.js.map +1 -1
  386. package/build-module/components/inserter-list-item/index.js +5 -2
  387. package/build-module/components/inserter-list-item/index.js.map +1 -1
  388. package/build-module/components/inspector-controls/groups.js +2 -0
  389. package/build-module/components/inspector-controls/groups.js.map +1 -1
  390. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js +32 -0
  391. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -0
  392. package/build-module/components/inspector-controls-tabs/index.js +56 -0
  393. package/build-module/components/inspector-controls-tabs/index.js.map +1 -0
  394. package/build-module/components/inspector-controls-tabs/settings-tab.js +17 -0
  395. package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -0
  396. package/build-module/components/inspector-controls-tabs/styles-tab.js +46 -0
  397. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -0
  398. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +81 -0
  399. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -0
  400. package/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +8 -0
  401. package/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -0
  402. package/build-module/components/inspector-controls-tabs/utils.js +26 -0
  403. package/build-module/components/inspector-controls-tabs/utils.js.map +1 -0
  404. package/build-module/components/link-control/index.js +1 -0
  405. package/build-module/components/link-control/index.js.map +1 -1
  406. package/build-module/components/link-control/search-input.js +0 -1
  407. package/build-module/components/link-control/search-input.js.map +1 -1
  408. package/build-module/components/link-control/use-internal-input-value.js +3 -3
  409. package/build-module/components/link-control/use-internal-input-value.js.map +1 -1
  410. package/build-module/components/list-view/block-select-button.js +1 -1
  411. package/build-module/components/list-view/block-select-button.js.map +1 -1
  412. package/build-module/components/list-view/block.js +5 -2
  413. package/build-module/components/list-view/block.js.map +1 -1
  414. package/build-module/components/list-view/branch.js +12 -11
  415. package/build-module/components/list-view/branch.js.map +1 -1
  416. package/build-module/components/media-upload/index.native.js +2 -4
  417. package/build-module/components/media-upload/index.native.js.map +1 -1
  418. package/build-module/components/off-canvas-editor/appender.js +83 -0
  419. package/build-module/components/off-canvas-editor/appender.js.map +1 -0
  420. package/build-module/components/off-canvas-editor/block-edit-button.js +35 -0
  421. package/build-module/components/off-canvas-editor/block-edit-button.js.map +1 -0
  422. package/build-module/components/off-canvas-editor/block-select-button.js +3 -2
  423. package/build-module/components/off-canvas-editor/block-select-button.js.map +1 -1
  424. package/build-module/components/off-canvas-editor/block.js +83 -41
  425. package/build-module/components/off-canvas-editor/block.js.map +1 -1
  426. package/build-module/components/off-canvas-editor/branch.js +3 -4
  427. package/build-module/components/off-canvas-editor/branch.js.map +1 -1
  428. package/build-module/components/off-canvas-editor/index.js +24 -12
  429. package/build-module/components/off-canvas-editor/index.js.map +1 -1
  430. package/build-module/components/off-canvas-editor/leaf.js +1 -1
  431. package/build-module/components/off-canvas-editor/leaf.js.map +1 -1
  432. package/build-module/components/off-canvas-editor/link-ui.js +165 -0
  433. package/build-module/components/off-canvas-editor/link-ui.js.map +1 -0
  434. package/build-module/components/off-canvas-editor/update-attributes.js +97 -0
  435. package/build-module/components/off-canvas-editor/update-attributes.js.map +1 -0
  436. package/build-module/components/off-canvas-editor/use-inserted-block.js +47 -0
  437. package/build-module/components/off-canvas-editor/use-inserted-block.js.map +1 -0
  438. package/build-module/components/responsive-block-control/label.js +1 -2
  439. package/build-module/components/responsive-block-control/label.js.map +1 -1
  440. package/build-module/components/rich-text/format-edit.js +12 -9
  441. package/build-module/components/rich-text/format-edit.js.map +1 -1
  442. package/build-module/components/rich-text/format-toolbar/index.js +6 -2
  443. package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
  444. package/build-module/components/rich-text/index.js +2 -3
  445. package/build-module/components/rich-text/index.js.map +1 -1
  446. package/build-module/components/rich-text/index.native.js +0 -2
  447. package/build-module/components/rich-text/index.native.js.map +1 -1
  448. package/build-module/components/rich-text/use-insert-replacement-text.js +33 -0
  449. package/build-module/components/rich-text/use-insert-replacement-text.js.map +1 -0
  450. package/build-module/components/rich-text/use-paste-handler.js +22 -12
  451. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  452. package/build-module/components/rich-text/use-undo-automatic-change.js +9 -1
  453. package/build-module/components/rich-text/use-undo-automatic-change.js.map +1 -1
  454. package/build-module/components/rich-text/utils.js +1 -16
  455. package/build-module/components/rich-text/utils.js.map +1 -1
  456. package/build-module/components/spacing-sizes-control/index.js +0 -1
  457. package/build-module/components/spacing-sizes-control/index.js.map +1 -1
  458. package/build-module/components/spacing-sizes-control/spacing-input-control.js +12 -3
  459. package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  460. package/build-module/components/spacing-sizes-control/utils.js +1 -1
  461. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  462. package/build-module/components/typewriter/index.js +1 -1
  463. package/build-module/components/typewriter/index.js.map +1 -1
  464. package/build-module/components/ungroup-button/index.native.js +3 -2
  465. package/build-module/components/ungroup-button/index.native.js.map +1 -1
  466. package/build-module/components/url-input/index.js +46 -43
  467. package/build-module/components/url-input/index.js.map +1 -1
  468. package/build-module/components/url-popover/image-url-input-ui.js +3 -3
  469. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  470. package/build-module/components/use-block-display-information/index.js +9 -5
  471. package/build-module/components/use-block-display-information/index.js.map +1 -1
  472. package/build-module/components/use-setting/index.js +8 -1
  473. package/build-module/components/use-setting/index.js.map +1 -1
  474. package/build-module/components/writing-flow/index.js +1 -1
  475. package/build-module/components/writing-flow/index.js.map +1 -1
  476. package/build-module/hooks/border.js +0 -1
  477. package/build-module/hooks/border.js.map +1 -1
  478. package/build-module/hooks/child-layout.js +189 -0
  479. package/build-module/hooks/child-layout.js.map +1 -0
  480. package/build-module/hooks/color-panel.js +0 -1
  481. package/build-module/hooks/color-panel.js.map +1 -1
  482. package/build-module/hooks/color.js +1 -2
  483. package/build-module/hooks/color.js.map +1 -1
  484. package/build-module/hooks/content-lock-ui.js +1 -1
  485. package/build-module/hooks/content-lock-ui.js.map +1 -1
  486. package/build-module/hooks/dimensions.js +25 -8
  487. package/build-module/hooks/dimensions.js.map +1 -1
  488. package/build-module/hooks/font-family.js +5 -5
  489. package/build-module/hooks/font-family.js.map +1 -1
  490. package/build-module/hooks/font-size.js +5 -3
  491. package/build-module/hooks/font-size.js.map +1 -1
  492. package/build-module/hooks/layout.js +55 -0
  493. package/build-module/hooks/layout.js.map +1 -1
  494. package/build-module/hooks/min-height.js +3 -9
  495. package/build-module/hooks/min-height.js.map +1 -1
  496. package/build-module/hooks/use-typography-props.js +11 -8
  497. package/build-module/hooks/use-typography-props.js.map +1 -1
  498. package/build-module/store/reducer.js +409 -274
  499. package/build-module/store/reducer.js.map +1 -1
  500. package/build-module/store/selectors.js +55 -48
  501. package/build-module/store/selectors.js.map +1 -1
  502. package/build-module/utils/pasting.js +6 -10
  503. package/build-module/utils/pasting.js.map +1 -1
  504. package/build-module/utils/sorting.js +56 -0
  505. package/build-module/utils/sorting.js.map +1 -0
  506. package/build-style/content-rtl.css +701 -0
  507. package/build-style/content.css +701 -0
  508. package/build-style/default-editor-styles-rtl.css +17 -3
  509. package/build-style/default-editor-styles.css +17 -3
  510. package/build-style/style-rtl.css +313 -665
  511. package/build-style/style.css +313 -665
  512. package/package.json +32 -30
  513. package/src/autocompleters/block.js +2 -6
  514. package/src/autocompleters/link.js +2 -0
  515. package/src/components/alignment-control/test/index.js +6 -1
  516. package/src/components/alignment-control/ui.js +1 -7
  517. package/src/components/block-alignment-control/test/index.js +6 -1
  518. package/src/components/block-alignment-control/use-available-alignments.js +4 -3
  519. package/src/components/block-card/index.js +46 -2
  520. package/src/components/block-card/style.scss +4 -0
  521. package/src/components/block-content-overlay/{style.scss → content.scss} +7 -1
  522. package/src/components/block-draggable/content.scss +20 -0
  523. package/src/components/block-draggable/index.native.js +54 -40
  524. package/src/components/block-draggable/style.scss +0 -21
  525. package/src/components/block-draggable/test/helpers.native.js +7 -9
  526. package/src/components/block-draggable/test/index.native.js +35 -45
  527. package/src/components/block-edit/edit.js +5 -2
  528. package/src/components/block-edit/edit.native.js +5 -6
  529. package/src/components/block-icon/index.js +4 -2
  530. package/src/components/block-icon/test/index.js +9 -5
  531. package/src/components/block-inspector/index.js +173 -85
  532. package/src/components/block-inspector/style.scss +16 -1
  533. package/src/components/block-list/block-list-context.native.js +5 -8
  534. package/src/components/block-list/block.js +74 -23
  535. package/src/components/block-list/block.native.js +78 -23
  536. package/src/components/block-list/{style.scss → content.scss} +1 -15
  537. package/src/components/block-list-appender/{style.scss → content.scss} +0 -0
  538. package/src/components/block-list-appender/index.js +65 -54
  539. package/src/components/block-list-appender/index.native.js +45 -34
  540. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +42 -28
  541. package/src/components/block-mobile-toolbar/index.native.js +1 -1
  542. package/src/components/block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap +125 -0
  543. package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +439 -0
  544. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +42 -2
  545. package/src/components/block-mover/test/index.native.js +157 -1
  546. package/src/components/block-pattern-setup/index.js +17 -7
  547. package/src/components/block-pattern-setup/style.scss +29 -1
  548. package/src/components/block-patterns-list/index.js +47 -24
  549. package/src/components/block-preview/README.md +15 -10
  550. package/src/components/block-preview/auto.js +7 -1
  551. package/src/components/block-preview/content.scss +4 -0
  552. package/src/components/block-preview/index.js +7 -12
  553. package/src/components/block-preview/style.scss +0 -7
  554. package/src/components/block-preview/test/index.js +18 -35
  555. package/src/components/block-selection-clearer/test/index.js +12 -12
  556. package/src/components/block-settings-menu/block-settings-dropdown.js +32 -20
  557. package/src/components/block-styles/index.native.js +1 -2
  558. package/src/components/block-styles/utils.js +5 -7
  559. package/src/components/block-switcher/test/index.js +6 -1
  560. package/src/components/block-toolbar/index.js +12 -5
  561. package/src/components/block-toolbar/index.native.js +8 -11
  562. package/src/components/block-toolbar/style.scss +10 -0
  563. package/src/components/block-tools/insertion-point.js +3 -47
  564. package/src/components/block-tools/selected-block-popover.js +1 -3
  565. package/src/components/block-tools/style.scss +12 -5
  566. package/src/components/block-variation-picker/index.js +6 -5
  567. package/src/components/block-vertical-alignment-control/test/index.js +6 -1
  568. package/src/components/colors/test/with-colors.js +2 -0
  569. package/src/components/colors/utils.js +5 -3
  570. package/src/components/colors-gradients/control.js +0 -7
  571. package/src/components/colors-gradients/dropdown.js +0 -2
  572. package/src/components/colors-gradients/panel-color-gradient-settings.js +4 -22
  573. package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
  574. package/src/components/copy-handler/index.js +53 -7
  575. package/src/components/default-block-appender/{style.scss → content.scss} +0 -0
  576. package/src/components/default-block-appender/test/index.js +2 -0
  577. package/src/components/font-sizes/fluid-utils.js +7 -1
  578. package/src/components/font-sizes/utils.js +5 -3
  579. package/src/components/font-sizes/with-font-sizes.js +4 -4
  580. package/src/components/gradients/use-gradient.js +2 -7
  581. package/src/components/height-control/index.js +123 -0
  582. package/src/components/height-control/stories/index.js +21 -0
  583. package/src/components/height-control/style.scss +5 -0
  584. package/src/components/iframe/index.js +33 -121
  585. package/src/components/iframe/use-compatibility-styles.js +95 -0
  586. package/src/components/image-editor/use-save-image.js +2 -0
  587. package/src/components/image-editor/zoom-dropdown.js +1 -0
  588. package/src/components/image-size-control/test/index.js +147 -79
  589. package/src/components/index.js +1 -0
  590. package/src/components/inner-blocks/{style.scss → content.scss} +0 -0
  591. package/src/components/inner-blocks/index.js +26 -7
  592. package/src/components/inner-blocks/use-inner-block-template-sync.js +28 -10
  593. package/src/components/inserter/block-patterns-explorer/sidebar.js +1 -0
  594. package/src/components/inserter/block-patterns-tab.js +28 -71
  595. package/src/components/inserter/block-types-tab.js +3 -2
  596. package/src/components/inserter/hooks/use-debounced-input.js +17 -0
  597. package/src/components/inserter/hooks/use-insertion-point.js +3 -2
  598. package/src/components/inserter/index.js +24 -3
  599. package/src/components/inserter/index.native.js +1 -1
  600. package/src/components/inserter/media-tab/hooks.js +89 -0
  601. package/src/components/inserter/media-tab/index.js +3 -0
  602. package/src/components/inserter/media-tab/media-list.js +93 -0
  603. package/src/components/inserter/media-tab/media-panel.js +83 -0
  604. package/src/components/inserter/media-tab/media-tab.js +135 -0
  605. package/src/components/inserter/media-tab/utils.js +37 -0
  606. package/src/components/inserter/menu.js +55 -13
  607. package/src/components/inserter/mobile-tab-navigation.js +85 -0
  608. package/src/components/inserter/quick-inserter.js +4 -0
  609. package/src/components/inserter/search-items.js +1 -2
  610. package/src/components/inserter/search-results.js +5 -2
  611. package/src/components/inserter/stories/index.js +1 -1
  612. package/src/components/inserter/stories/{fixtures.js → utils/fixtures.js} +0 -0
  613. package/src/components/inserter/style.scss +176 -11
  614. package/src/components/inserter/tabs.js +12 -1
  615. package/src/components/inserter-list-item/index.js +11 -1
  616. package/src/components/inserter-list-item/style.scss +26 -0
  617. package/src/components/inspector-controls/groups.js +2 -0
  618. package/src/components/inspector-controls-tabs/advanced-controls-panel.js +37 -0
  619. package/src/components/inspector-controls-tabs/index.js +62 -0
  620. package/src/components/inspector-controls-tabs/settings-tab.js +18 -0
  621. package/src/components/inspector-controls-tabs/styles-tab.js +51 -0
  622. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +89 -0
  623. package/src/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +9 -0
  624. package/src/components/inspector-controls-tabs/utils.js +28 -0
  625. package/src/components/line-height-control/test/index.js +5 -5
  626. package/src/components/link-control/README.md +1 -1
  627. package/src/components/link-control/index.js +1 -0
  628. package/src/components/link-control/search-input.js +0 -1
  629. package/src/components/link-control/test/index.js +204 -403
  630. package/src/components/link-control/use-internal-input-value.js +3 -3
  631. package/src/components/list-view/block-select-button.js +1 -1
  632. package/src/components/list-view/block.js +3 -0
  633. package/src/components/list-view/branch.js +10 -8
  634. package/src/components/list-view/style.scss +21 -16
  635. package/src/components/media-placeholder/{style.scss → content.scss} +0 -0
  636. package/src/components/media-replace-flow/test/index.js +39 -9
  637. package/src/components/media-upload/test/index.native.js +2 -0
  638. package/src/components/off-canvas-editor/appender.js +98 -0
  639. package/src/components/off-canvas-editor/block-edit-button.js +27 -0
  640. package/src/components/off-canvas-editor/block-select-button.js +6 -2
  641. package/src/components/off-canvas-editor/block.js +160 -77
  642. package/src/components/off-canvas-editor/branch.js +3 -5
  643. package/src/components/off-canvas-editor/index.js +68 -33
  644. package/src/components/off-canvas-editor/leaf.js +5 -1
  645. package/src/components/off-canvas-editor/link-ui.js +166 -0
  646. package/src/components/off-canvas-editor/style.scss +19 -386
  647. package/src/components/off-canvas-editor/test/use-inserted-block.js +108 -0
  648. package/src/components/off-canvas-editor/update-attributes.js +99 -0
  649. package/src/components/off-canvas-editor/use-inserted-block.js +47 -0
  650. package/src/components/plain-text/{style.scss → content.scss} +0 -0
  651. package/src/components/recursion-provider/test/index.js +27 -29
  652. package/src/components/responsive-block-control/label.js +2 -3
  653. package/src/components/responsive-block-control/test/index.js +4 -2
  654. package/src/components/rich-text/content.scss +42 -0
  655. package/src/components/rich-text/format-edit.js +6 -10
  656. package/src/components/rich-text/format-toolbar/index.js +6 -4
  657. package/src/components/rich-text/index.js +3 -2
  658. package/src/components/rich-text/index.native.js +0 -2
  659. package/src/components/rich-text/style.scss +0 -43
  660. package/src/components/rich-text/use-insert-replacement-text.js +31 -0
  661. package/src/components/rich-text/use-paste-handler.js +33 -14
  662. package/src/components/rich-text/use-undo-automatic-change.js +7 -1
  663. package/src/components/rich-text/utils.js +2 -21
  664. package/src/components/spacing-sizes-control/index.js +0 -1
  665. package/src/components/spacing-sizes-control/spacing-input-control.js +9 -0
  666. package/src/components/spacing-sizes-control/utils.js +1 -1
  667. package/src/components/typewriter/index.js +3 -1
  668. package/src/components/ungroup-button/index.native.js +6 -2
  669. package/src/components/url-input/index.js +57 -73
  670. package/src/components/url-input/test/button.js +2 -0
  671. package/src/components/url-popover/image-url-input-ui.js +5 -4
  672. package/src/components/url-popover/test/__snapshots__/index.js.snap +8 -6
  673. package/src/components/url-popover/test/index.js +37 -9
  674. package/src/components/use-block-display-information/index.js +14 -5
  675. package/src/components/use-setting/index.js +13 -1
  676. package/src/components/use-setting/test/index.js +99 -0
  677. package/src/components/warning/test/index.js +2 -0
  678. package/src/components/writing-flow/index.js +1 -1
  679. package/src/content.scss +10 -0
  680. package/src/hooks/border.js +0 -1
  681. package/src/hooks/child-layout.js +190 -0
  682. package/src/hooks/color-panel.js +0 -1
  683. package/src/hooks/color.js +0 -2
  684. package/src/hooks/content-lock-ui.js +1 -1
  685. package/src/hooks/dimensions.js +45 -7
  686. package/src/hooks/font-family.js +3 -5
  687. package/src/hooks/font-size.js +13 -4
  688. package/src/hooks/layout.js +60 -0
  689. package/src/hooks/min-height.js +2 -19
  690. package/src/hooks/test/use-typography-props.js +26 -0
  691. package/src/hooks/use-typography-props.js +15 -7
  692. package/src/store/reducer.js +471 -428
  693. package/src/store/selectors.js +57 -59
  694. package/src/store/test/performance.js +71 -0
  695. package/src/store/test/reducer.js +623 -491
  696. package/src/store/test/selectors.js +1820 -1306
  697. package/src/style.scss +4 -7
  698. package/src/utils/pasting.js +3 -9
  699. package/src/utils/sorting.js +54 -0
  700. package/src/utils/test/sorting.js +49 -0
  701. package/tsconfig.tsbuildinfo +1 -1
  702. package/build/components/block-preview/live.js +0 -30
  703. package/build/components/block-preview/live.js.map +0 -1
  704. package/build/components/colors-gradients/use-common-single-multiple-selects.js +0 -21
  705. package/build/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
  706. package/build/components/rich-text/file-paste-handler.js +0 -21
  707. package/build/components/rich-text/file-paste-handler.js.map +0 -1
  708. package/build-module/components/block-preview/live.js +0 -20
  709. package/build-module/components/block-preview/live.js.map +0 -1
  710. package/build-module/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
  711. package/build-module/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
  712. package/build-module/components/rich-text/file-paste-handler.js +0 -13
  713. package/build-module/components/rich-text/file-paste-handler.js.map +0 -1
  714. package/src/components/block-preview/live.js +0 -19
  715. package/src/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
  716. package/src/components/rich-text/file-paste-handler.js +0 -13
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/url-input/index.js"],"names":["classnames","scrollIntoView","__","sprintf","_n","Component","createRef","UP","DOWN","ENTER","TAB","BaseControl","Button","Spinner","withSpokenMessages","Popover","compose","debounce","withInstanceId","withSafeTimeout","withSelect","isURL","store","blockEditorStore","isFunction","maybeFunc","URLInput","constructor","props","onChange","bind","onFocus","onKeyDown","selectLink","handleOnClick","bindSuggestionNode","autocompleteRef","inputRef","updateSuggestions","suggestionNodes","isUpdatingSuggestions","state","suggestions","showSuggestions","selectedSuggestion","suggestionsListboxId","suggestionOptionIdPrefix","componentDidUpdate","prevProps","value","__experimentalShowInitialSuggestions","scrollingIntoView","current","onlyScrollIfNeeded","setTimeout","disableSuggestions","length","componentDidMount","shouldShowInitialSuggestions","componentWillUnmount","suggestionsRequest","cancel","index","ref","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalHandleURLSuggestions","handleURLSuggestions","isInitialSuggestions","trim","setState","loading","request","then","debouncedSpeak","catch","event","inputValue","target","keyCode","selectionStart","preventDefault","setSelectionRange","onSubmit","suggestion","previousIndex","nextIndex","speak","url","focus","getDerivedStateFromProps","instanceId","shouldShowSuggestions","hasValue","render","renderControl","renderSuggestions","label","className","isFullWidth","placeholder","__experimentalRenderControl","inputId","controlProps","id","inputProps","required","type","role","undefined","__experimentalRenderSuggestions","suggestionsListProps","buildSuggestionItemProps","tabIndex","isLoading","handleSuggestionClick","map","title","select","getSettings"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,OAAOC,cAAP,MAA2B,sBAA3B;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,EAAsBC,EAAtB,QAAgC,iBAAhC;AACA,SAASC,SAAT,EAAoBC,SAApB,QAAqC,oBAArC;AACA,SAASC,EAAT,EAAaC,IAAb,EAAmBC,KAAnB,EAA0BC,GAA1B,QAAqC,qBAArC;AACA,SACCC,WADD,EAECC,MAFD,EAGCC,OAHD,EAICC,kBAJD,EAKCC,OALD,QAMO,uBANP;AAOA,SACCC,OADD,EAECC,QAFD,EAGCC,cAHD,EAICC,eAJD,QAKO,oBALP;AAMA,SAASC,UAAT,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;;AACD,WAAO,IAAP;AACA;;AAxhB+B;AA2hBjC;AACA;AACA;;;AACA,eAAerG,OAAO,CACrBG,eADqB,EAErBL,kBAFqB,EAGrBI,cAHqB,EAIrBE,UAAU,CAAE,CAAEkG,MAAF,EAAU1F,KAAV,KAAqB;AAChC;AACA;AACA,MAAKJ,UAAU,CAAEI,KAAK,CAACoC,kCAAR,CAAf,EAA8D;AAC7D;AACA;;AACD,QAAM;AAAEuD,IAAAA;AAAF,MAAkBD,MAAM,CAAE/F,gBAAF,CAA9B;AACA,SAAO;AACNyC,IAAAA,kCAAkC,EACjCuD,WAAW,GAAGvD;AAFT,GAAP;AAIA,CAXS,CAJW,CAAP,CAgBZtC,QAhBY,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport scrollIntoView from 'dom-scroll-into-view';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport { Component, createRef } from '@wordpress/element';\nimport { UP, DOWN, ENTER, TAB } from '@wordpress/keycodes';\nimport {\n\tBaseControl,\n\tButton,\n\tSpinner,\n\twithSpokenMessages,\n\tPopover,\n} from '@wordpress/components';\nimport {\n\tcompose,\n\tdebounce,\n\twithInstanceId,\n\twithSafeTimeout,\n} from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\nimport { isURL } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Whether the argument is a function.\n *\n * @param {*} maybeFunc The argument to check.\n * @return {boolean} True if the argument is a function, false otherwise.\n */\nfunction isFunction( maybeFunc ) {\n\treturn typeof maybeFunc === 'function';\n}\n\nclass URLInput extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\n\t\tthis.onChange = this.onChange.bind( this );\n\t\tthis.onFocus = this.onFocus.bind( this );\n\t\tthis.onKeyDown = this.onKeyDown.bind( this );\n\t\tthis.selectLink = this.selectLink.bind( this );\n\t\tthis.handleOnClick = this.handleOnClick.bind( this );\n\t\tthis.bindSuggestionNode = this.bindSuggestionNode.bind( this );\n\t\tthis.autocompleteRef = props.autocompleteRef || createRef();\n\t\tthis.inputRef = createRef();\n\t\tthis.updateSuggestions = debounce(\n\t\t\tthis.updateSuggestions.bind( this ),\n\t\t\t200\n\t\t);\n\n\t\tthis.suggestionNodes = [];\n\n\t\tthis.isUpdatingSuggestions = false;\n\n\t\tthis.state = {\n\t\t\tsuggestions: [],\n\t\t\tshowSuggestions: false,\n\t\t\tselectedSuggestion: null,\n\n\t\t\tsuggestionsListboxId: '',\n\t\t\tsuggestionOptionIdPrefix: '',\n\t\t};\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tconst { showSuggestions, selectedSuggestion } = this.state;\n\t\tconst { value, __experimentalShowInitialSuggestions = false } =\n\t\t\tthis.props;\n\n\t\t// Only have to worry about scrolling selected suggestion into view\n\t\t// when already expanded.\n\t\tif (\n\t\t\tshowSuggestions &&\n\t\t\tselectedSuggestion !== null &&\n\t\t\tthis.suggestionNodes[ selectedSuggestion ] &&\n\t\t\t! this.scrollingIntoView\n\t\t) {\n\t\t\tthis.scrollingIntoView = true;\n\t\t\tscrollIntoView(\n\t\t\t\tthis.suggestionNodes[ selectedSuggestion ],\n\t\t\t\tthis.autocompleteRef.current,\n\t\t\t\t{\n\t\t\t\t\tonlyScrollIfNeeded: true,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tthis.props.setTimeout( () => {\n\t\t\t\tthis.scrollingIntoView = false;\n\t\t\t}, 100 );\n\t\t}\n\n\t\t// Update suggestions when the value changes.\n\t\tif (\n\t\t\tprevProps.value !== value &&\n\t\t\t! this.props.disableSuggestions &&\n\t\t\t! this.isUpdatingSuggestions\n\t\t) {\n\t\t\tif ( value?.length ) {\n\t\t\t\t// If the new value is not empty we need to update with suggestions for it.\n\t\t\t\tthis.updateSuggestions( value );\n\t\t\t} else if ( __experimentalShowInitialSuggestions ) {\n\t\t\t\t// If the new value is empty and we can show initial suggestions, then show initial suggestions.\n\t\t\t\tthis.updateSuggestions();\n\t\t\t}\n\t\t}\n\t}\n\n\tcomponentDidMount() {\n\t\tif ( this.shouldShowInitialSuggestions() ) {\n\t\t\tthis.updateSuggestions();\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\tthis.suggestionsRequest?.cancel?.();\n\t\tdelete this.suggestionsRequest;\n\t}\n\n\tbindSuggestionNode( index ) {\n\t\treturn ( ref ) => {\n\t\t\tthis.suggestionNodes[ index ] = ref;\n\t\t};\n\t}\n\n\tshouldShowInitialSuggestions() {\n\t\tconst { suggestions } = this.state;\n\t\tconst { __experimentalShowInitialSuggestions = false, value } =\n\t\t\tthis.props;\n\t\treturn (\n\t\t\t! this.isUpdatingSuggestions &&\n\t\t\t__experimentalShowInitialSuggestions &&\n\t\t\t! ( value && value.length ) &&\n\t\t\t! ( suggestions && suggestions.length )\n\t\t);\n\t}\n\n\tupdateSuggestions( value = '' ) {\n\t\tconst {\n\t\t\t__experimentalFetchLinkSuggestions: fetchLinkSuggestions,\n\t\t\t__experimentalHandleURLSuggestions: handleURLSuggestions,\n\t\t} = this.props;\n\n\t\tif ( ! fetchLinkSuggestions ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Initial suggestions may only show if there is no value\n\t\t// (note: this includes whitespace).\n\t\tconst isInitialSuggestions = ! value?.length;\n\n\t\t// Trim only now we've determined whether or not it originally had a \"length\"\n\t\t// (even if that value was all whitespace).\n\t\tvalue = value.trim();\n\n\t\t// Allow a suggestions request if:\n\t\t// - there are at least 2 characters in the search input (except manual searches where\n\t\t// search input length is not required to trigger a fetch)\n\t\t// - this is a direct entry (eg: a URL)\n\t\tif (\n\t\t\t! isInitialSuggestions &&\n\t\t\t( value.length < 2 || ( ! handleURLSuggestions && isURL( value ) ) )\n\t\t) {\n\t\t\tthis.setState( {\n\t\t\t\tshowSuggestions: false,\n\t\t\t\tselectedSuggestion: null,\n\t\t\t\tloading: false,\n\t\t\t} );\n\n\t\t\treturn;\n\t\t}\n\n\t\tthis.isUpdatingSuggestions = true;\n\n\t\tthis.setState( {\n\t\t\tselectedSuggestion: null,\n\t\t\tloading: true,\n\t\t} );\n\n\t\tconst request = fetchLinkSuggestions( value, {\n\t\t\tisInitialSuggestions,\n\t\t} );\n\n\t\trequest\n\t\t\t.then( ( suggestions ) => {\n\t\t\t\t// A fetch Promise doesn't have an abort option. It's mimicked by\n\t\t\t\t// comparing the request reference in on the instance, which is\n\t\t\t\t// reset or deleted on subsequent requests or unmounting.\n\t\t\t\tif ( this.suggestionsRequest !== request ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.setState( {\n\t\t\t\t\tsuggestions,\n\t\t\t\t\tloading: false,\n\t\t\t\t\tshowSuggestions: !! suggestions.length,\n\t\t\t\t} );\n\n\t\t\t\tif ( !! suggestions.length ) {\n\t\t\t\t\tthis.props.debouncedSpeak(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %s: number of results. */\n\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\t\tsuggestions.length\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tsuggestions.length\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'assertive'\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tthis.props.debouncedSpeak(\n\t\t\t\t\t\t__( 'No results.' ),\n\t\t\t\t\t\t'assertive'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthis.isUpdatingSuggestions = false;\n\t\t\t} )\n\t\t\t.catch( () => {\n\t\t\t\tif ( this.suggestionsRequest === request ) {\n\t\t\t\t\tthis.setState( {\n\t\t\t\t\t\tloading: false,\n\t\t\t\t\t} );\n\t\t\t\t\tthis.isUpdatingSuggestions = false;\n\t\t\t\t}\n\t\t\t} );\n\n\t\t// Note that this assignment is handled *before* the async search request\n\t\t// as a Promise always resolves on the next tick of the event loop.\n\t\tthis.suggestionsRequest = request;\n\t}\n\n\tonChange( event ) {\n\t\tconst inputValue = event.target.value;\n\n\t\tthis.props.onChange( inputValue );\n\t\tif ( ! this.props.disableSuggestions ) {\n\t\t\tthis.updateSuggestions( inputValue );\n\t\t}\n\t}\n\n\tonFocus() {\n\t\tconst { suggestions } = this.state;\n\t\tconst { disableSuggestions, value } = this.props;\n\n\t\t// When opening the link editor, if there's a value present, we want to load the suggestions pane with the results for this input search value\n\t\t// Don't re-run the suggestions on focus if there are already suggestions present (prevents searching again when tabbing between the input and buttons)\n\t\tif (\n\t\t\tvalue &&\n\t\t\t! disableSuggestions &&\n\t\t\t! this.isUpdatingSuggestions &&\n\t\t\t! ( suggestions && suggestions.length )\n\t\t) {\n\t\t\t// Ensure the suggestions are updated with the current input value.\n\t\t\tthis.updateSuggestions( value );\n\t\t}\n\t}\n\n\tonKeyDown( event ) {\n\t\tconst { showSuggestions, selectedSuggestion, suggestions, loading } =\n\t\t\tthis.state;\n\n\t\t// If the suggestions are not shown or loading, we shouldn't handle the arrow keys\n\t\t// We shouldn't preventDefault to allow block arrow keys navigation.\n\t\tif ( ! showSuggestions || ! suggestions.length || loading ) {\n\t\t\t// In the Windows version of Firefox the up and down arrows don't move the caret\n\t\t\t// within an input field like they do for Mac Firefox/Chrome/Safari. This causes\n\t\t\t// a form of focus trapping that is disruptive to the user experience. This disruption\n\t\t\t// only happens if the caret is not in the first or last position in the text input.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/5693#issuecomment-436684747\n\t\t\tswitch ( event.keyCode ) {\n\t\t\t\t// When UP is pressed, if the caret is at the start of the text, move it to the 0\n\t\t\t\t// position.\n\t\t\t\tcase UP: {\n\t\t\t\t\tif ( 0 !== event.target.selectionStart ) {\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t// Set the input caret to position 0.\n\t\t\t\t\t\tevent.target.setSelectionRange( 0, 0 );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// When DOWN is pressed, if the caret is not at the end of the text, move it to the\n\t\t\t\t// last position.\n\t\t\t\tcase DOWN: {\n\t\t\t\t\tif (\n\t\t\t\t\t\tthis.props.value.length !== event.target.selectionStart\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t// Set the input caret to the last position.\n\t\t\t\t\t\tevent.target.setSelectionRange(\n\t\t\t\t\t\t\tthis.props.value.length,\n\t\t\t\t\t\t\tthis.props.value.length\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t// Submitting while loading should trigger onSubmit.\n\t\t\t\tcase ENTER: {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tif ( this.props.onSubmit ) {\n\t\t\t\t\t\tthis.props.onSubmit( null, event );\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst suggestion =\n\t\t\tthis.state.suggestions[ this.state.selectedSuggestion ];\n\n\t\tswitch ( event.keyCode ) {\n\t\t\tcase UP: {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst previousIndex = ! selectedSuggestion\n\t\t\t\t\t? suggestions.length - 1\n\t\t\t\t\t: selectedSuggestion - 1;\n\t\t\t\tthis.setState( {\n\t\t\t\t\tselectedSuggestion: previousIndex,\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase DOWN: {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst nextIndex =\n\t\t\t\t\tselectedSuggestion === null ||\n\t\t\t\t\tselectedSuggestion === suggestions.length - 1\n\t\t\t\t\t\t? 0\n\t\t\t\t\t\t: selectedSuggestion + 1;\n\t\t\t\tthis.setState( {\n\t\t\t\t\tselectedSuggestion: nextIndex,\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase TAB: {\n\t\t\t\tif ( this.state.selectedSuggestion !== null ) {\n\t\t\t\t\tthis.selectLink( suggestion );\n\t\t\t\t\t// Announce a link has been selected when tabbing away from the input field.\n\t\t\t\t\tthis.props.speak( __( 'Link selected.' ) );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ENTER: {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif ( this.state.selectedSuggestion !== null ) {\n\t\t\t\t\tthis.selectLink( suggestion );\n\n\t\t\t\t\tif ( this.props.onSubmit ) {\n\t\t\t\t\t\tthis.props.onSubmit( suggestion, event );\n\t\t\t\t\t}\n\t\t\t\t} else if ( this.props.onSubmit ) {\n\t\t\t\t\tthis.props.onSubmit( null, event );\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tselectLink( suggestion ) {\n\t\tthis.props.onChange( suggestion.url, suggestion );\n\t\tthis.setState( {\n\t\t\tselectedSuggestion: null,\n\t\t\tshowSuggestions: false,\n\t\t} );\n\t}\n\n\thandleOnClick( suggestion ) {\n\t\tthis.selectLink( suggestion );\n\t\t// Move focus to the input field when a link suggestion is clicked.\n\t\tthis.inputRef.current.focus();\n\t}\n\n\tstatic getDerivedStateFromProps(\n\t\t{\n\t\t\tvalue,\n\t\t\tinstanceId,\n\t\t\tdisableSuggestions,\n\t\t\t__experimentalShowInitialSuggestions = false,\n\t\t},\n\t\t{ showSuggestions }\n\t) {\n\t\tlet shouldShowSuggestions = showSuggestions;\n\n\t\tconst hasValue = value && value.length;\n\n\t\tif ( ! __experimentalShowInitialSuggestions && ! hasValue ) {\n\t\t\tshouldShowSuggestions = false;\n\t\t}\n\n\t\tif ( disableSuggestions === true ) {\n\t\t\tshouldShowSuggestions = false;\n\t\t}\n\n\t\treturn {\n\t\t\tshowSuggestions: shouldShowSuggestions,\n\t\t\tsuggestionsListboxId: `block-editor-url-input-suggestions-${ instanceId }`,\n\t\t\tsuggestionOptionIdPrefix: `block-editor-url-input-suggestion-${ instanceId }`,\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ this.renderControl() }\n\t\t\t\t{ this.renderSuggestions() }\n\t\t\t</>\n\t\t);\n\t}\n\n\trenderControl() {\n\t\tconst {\n\t\t\tlabel = null,\n\t\t\tclassName,\n\t\t\tisFullWidth,\n\t\t\tinstanceId,\n\t\t\tplaceholder = __( 'Paste URL or type to search' ),\n\t\t\t__experimentalRenderControl: renderControl,\n\t\t\tvalue = '',\n\t\t} = this.props;\n\n\t\tconst {\n\t\t\tloading,\n\t\t\tshowSuggestions,\n\t\t\tselectedSuggestion,\n\t\t\tsuggestionsListboxId,\n\t\t\tsuggestionOptionIdPrefix,\n\t\t} = this.state;\n\n\t\tconst inputId = `url-input-control-${ instanceId }`;\n\n\t\tconst controlProps = {\n\t\t\tid: inputId, // Passes attribute to label for the for attribute\n\t\t\tlabel,\n\t\t\tclassName: classnames( 'block-editor-url-input', className, {\n\t\t\t\t'is-full-width': isFullWidth,\n\t\t\t} ),\n\t\t};\n\n\t\tconst inputProps = {\n\t\t\tid: inputId,\n\t\t\tvalue,\n\t\t\trequired: true,\n\t\t\tclassName: 'block-editor-url-input__input',\n\t\t\ttype: 'text',\n\t\t\tonChange: this.onChange,\n\t\t\tonFocus: this.onFocus,\n\t\t\tplaceholder,\n\t\t\tonKeyDown: this.onKeyDown,\n\t\t\trole: 'combobox',\n\t\t\t'aria-label': label ? undefined : __( 'URL' ), // Ensure input always has an accessible label\n\t\t\t'aria-expanded': showSuggestions,\n\t\t\t'aria-autocomplete': 'list',\n\t\t\t'aria-controls': suggestionsListboxId,\n\t\t\t'aria-activedescendant':\n\t\t\t\tselectedSuggestion !== null\n\t\t\t\t\t? `${ suggestionOptionIdPrefix }-${ selectedSuggestion }`\n\t\t\t\t\t: undefined,\n\t\t\tref: this.inputRef,\n\t\t};\n\n\t\tif ( renderControl ) {\n\t\t\treturn renderControl( controlProps, inputProps, loading );\n\t\t}\n\n\t\treturn (\n\t\t\t<BaseControl { ...controlProps }>\n\t\t\t\t<input { ...inputProps } />\n\t\t\t\t{ loading && <Spinner /> }\n\t\t\t</BaseControl>\n\t\t);\n\t}\n\n\trenderSuggestions() {\n\t\tconst {\n\t\t\tclassName,\n\t\t\t__experimentalRenderSuggestions: renderSuggestions,\n\t\t\tvalue = '',\n\t\t\t__experimentalShowInitialSuggestions = false,\n\t\t} = this.props;\n\n\t\tconst {\n\t\t\tshowSuggestions,\n\t\t\tsuggestions,\n\t\t\tselectedSuggestion,\n\t\t\tsuggestionsListboxId,\n\t\t\tsuggestionOptionIdPrefix,\n\t\t\tloading,\n\t\t} = this.state;\n\n\t\tconst suggestionsListProps = {\n\t\t\tid: suggestionsListboxId,\n\t\t\tref: this.autocompleteRef,\n\t\t\trole: 'listbox',\n\t\t};\n\n\t\tconst buildSuggestionItemProps = ( suggestion, index ) => {\n\t\t\treturn {\n\t\t\t\trole: 'option',\n\t\t\t\ttabIndex: '-1',\n\t\t\t\tid: `${ suggestionOptionIdPrefix }-${ index }`,\n\t\t\t\tref: this.bindSuggestionNode( index ),\n\t\t\t\t'aria-selected': index === selectedSuggestion,\n\t\t\t};\n\t\t};\n\n\t\tif (\n\t\t\tisFunction( renderSuggestions ) &&\n\t\t\tshowSuggestions &&\n\t\t\t!! suggestions.length\n\t\t) {\n\t\t\treturn renderSuggestions( {\n\t\t\t\tsuggestions,\n\t\t\t\tselectedSuggestion,\n\t\t\t\tsuggestionsListProps,\n\t\t\t\tbuildSuggestionItemProps,\n\t\t\t\tisLoading: loading,\n\t\t\t\thandleSuggestionClick: this.handleOnClick,\n\t\t\t\tisInitialSuggestions:\n\t\t\t\t\t__experimentalShowInitialSuggestions &&\n\t\t\t\t\t! ( value && value.length ),\n\t\t\t} );\n\t\t}\n\n\t\tif (\n\t\t\t! isFunction( renderSuggestions ) &&\n\t\t\tshowSuggestions &&\n\t\t\t!! suggestions.length\n\t\t) {\n\t\t\treturn (\n\t\t\t\t<Popover placement=\"bottom\" focusOnMount={ false }>\n\t\t\t\t\t<div\n\t\t\t\t\t\t{ ...suggestionsListProps }\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'block-editor-url-input__suggestions',\n\t\t\t\t\t\t\t`${ className }__suggestions`\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ suggestions.map( ( suggestion, index ) => (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t{ ...buildSuggestionItemProps(\n\t\t\t\t\t\t\t\t\tsuggestion,\n\t\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tkey={ suggestion.id }\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t'block-editor-url-input__suggestion',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'is-selected':\n\t\t\t\t\t\t\t\t\t\t\tindex === selectedSuggestion,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tthis.handleOnClick( suggestion )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ suggestion.title }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</div>\n\t\t\t\t</Popover>\n\t\t\t);\n\t\t}\n\t\treturn null;\n\t}\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-input/README.md\n */\nexport default compose(\n\twithSafeTimeout,\n\twithSpokenMessages,\n\twithInstanceId,\n\twithSelect( ( select, props ) => {\n\t\t// If a link suggestions handler is already provided then\n\t\t// bail.\n\t\tif ( isFunction( props.__experimentalFetchLinkSuggestions ) ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\t__experimentalFetchLinkSuggestions:\n\t\t\t\tgetSettings().__experimentalFetchLinkSuggestions,\n\t\t};\n\t} )\n)( URLInput );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/url-input/index.js"],"names":["classnames","scrollIntoView","__","sprintf","_n","Component","createRef","UP","DOWN","ENTER","TAB","BaseControl","Button","Spinner","withSpokenMessages","Popover","compose","debounce","withInstanceId","withSafeTimeout","withSelect","isURL","store","blockEditorStore","isFunction","maybeFunc","URLInput","constructor","props","onChange","bind","onFocus","onKeyDown","selectLink","handleOnClick","bindSuggestionNode","autocompleteRef","inputRef","updateSuggestions","suggestionNodes","suggestionsRequest","state","suggestions","showSuggestions","isUpdatingSuggestions","suggestionsValue","selectedSuggestion","suggestionsListboxId","suggestionOptionIdPrefix","componentDidUpdate","prevProps","value","__experimentalShowInitialSuggestions","scrollingIntoView","current","onlyScrollIfNeeded","setTimeout","disableSuggestions","length","componentDidMount","shouldShowInitialSuggestions","componentWillUnmount","cancel","index","ref","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalHandleURLSuggestions","handleURLSuggestions","isInitialSuggestions","trim","setState","loading","request","then","debouncedSpeak","catch","event","target","keyCode","selectionStart","preventDefault","setSelectionRange","onSubmit","suggestion","previousIndex","nextIndex","speak","url","focus","getDerivedStateFromProps","instanceId","shouldShowSuggestions","hasValue","render","renderControl","renderSuggestions","label","className","isFullWidth","placeholder","__experimentalRenderControl","inputId","controlProps","id","inputProps","required","type","role","undefined","__experimentalRenderSuggestions","suggestionsListProps","buildSuggestionItemProps","tabIndex","isLoading","handleSuggestionClick","currentInputValue","map","title","select","getSettings"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,OAAOC,cAAP,MAA2B,sBAA3B;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,EAAsBC,EAAtB,QAAgC,iBAAhC;AACA,SAASC,SAAT,EAAoBC,SAApB,QAA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AGqB,UAAU,CAACoB,EAFlB;AAGC,MAAA,SAAS,EAAGxG,UAAU,CACrB,oCADqB,EAErB;AACC,uBAAe+D,KAAK,KAAKjB;AAD1B,OAFqB,CAHvB;AASC,MAAA,OAAO,EAAG,MAAM,KAAKZ,aAAL,CAAoBkD,UAApB;AATjB,QAWGA,UAAU,CAACkC,KAXd,CADC,CAPH,CADD,CADD;AA2BA;;AAxgB+B;AA2gBjC;AACA;AACA;;;AACA,eAAetG,OAAO,CACrBG,eADqB,EAErBL,kBAFqB,EAGrBI,cAHqB,EAIrBE,UAAU,CAAE,CAAEmG,MAAF,EAAU3F,KAAV,KAAqB;AAChC;AACA;AACA,MAAKJ,UAAU,CAAEI,KAAK,CAACqC,kCAAR,CAAf,EAA8D;AAC7D;AACA;;AACD,QAAM;AAAEuD,IAAAA;AAAF,MAAkBD,MAAM,CAAEhG,gBAAF,CAA9B;AACA,SAAO;AACN0C,IAAAA,kCAAkC,EACjCuD,WAAW,GAAGvD;AAFT,GAAP;AAIA,CAXS,CAJW,CAAP,CAgBZvC,QAhBY,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport scrollIntoView from 'dom-scroll-into-view';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport { Component, createRef } from '@wordpress/element';\nimport { UP, DOWN, ENTER, TAB } from '@wordpress/keycodes';\nimport {\n\tBaseControl,\n\tButton,\n\tSpinner,\n\twithSpokenMessages,\n\tPopover,\n} from '@wordpress/components';\nimport {\n\tcompose,\n\tdebounce,\n\twithInstanceId,\n\twithSafeTimeout,\n} from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\nimport { isURL } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Whether the argument is a function.\n *\n * @param {*} maybeFunc The argument to check.\n * @return {boolean} True if the argument is a function, false otherwise.\n */\nfunction isFunction( maybeFunc ) {\n\treturn typeof maybeFunc === 'function';\n}\n\nclass URLInput extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\n\t\tthis.onChange = this.onChange.bind( this );\n\t\tthis.onFocus = this.onFocus.bind( this );\n\t\tthis.onKeyDown = this.onKeyDown.bind( this );\n\t\tthis.selectLink = this.selectLink.bind( this );\n\t\tthis.handleOnClick = this.handleOnClick.bind( this );\n\t\tthis.bindSuggestionNode = this.bindSuggestionNode.bind( this );\n\t\tthis.autocompleteRef = props.autocompleteRef || createRef();\n\t\tthis.inputRef = createRef();\n\t\tthis.updateSuggestions = debounce(\n\t\t\tthis.updateSuggestions.bind( this ),\n\t\t\t200\n\t\t);\n\n\t\tthis.suggestionNodes = [];\n\n\t\tthis.suggestionsRequest = null;\n\n\t\tthis.state = {\n\t\t\tsuggestions: [],\n\t\t\tshowSuggestions: false,\n\t\t\tisUpdatingSuggestions: false,\n\t\t\tsuggestionsValue: null,\n\t\t\tselectedSuggestion: null,\n\t\t\tsuggestionsListboxId: '',\n\t\t\tsuggestionOptionIdPrefix: '',\n\t\t};\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tconst { showSuggestions, selectedSuggestion } = this.state;\n\t\tconst { value, __experimentalShowInitialSuggestions = false } =\n\t\t\tthis.props;\n\n\t\t// Only have to worry about scrolling selected suggestion into view\n\t\t// when already expanded.\n\t\tif (\n\t\t\tshowSuggestions &&\n\t\t\tselectedSuggestion !== null &&\n\t\t\tthis.suggestionNodes[ selectedSuggestion ] &&\n\t\t\t! this.scrollingIntoView\n\t\t) {\n\t\t\tthis.scrollingIntoView = true;\n\t\t\tscrollIntoView(\n\t\t\t\tthis.suggestionNodes[ selectedSuggestion ],\n\t\t\t\tthis.autocompleteRef.current,\n\t\t\t\t{\n\t\t\t\t\tonlyScrollIfNeeded: true,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tthis.props.setTimeout( () => {\n\t\t\t\tthis.scrollingIntoView = false;\n\t\t\t}, 100 );\n\t\t}\n\n\t\t// Update suggestions when the value changes.\n\t\tif (\n\t\t\tprevProps.value !== value &&\n\t\t\t! this.props.disableSuggestions &&\n\t\t\t! this.state.isUpdatingSuggestions\n\t\t) {\n\t\t\tif ( value?.length ) {\n\t\t\t\t// If the new value is not empty we need to update with suggestions for it.\n\t\t\t\tthis.updateSuggestions( value );\n\t\t\t} else if ( __experimentalShowInitialSuggestions ) {\n\t\t\t\t// If the new value is empty and we can show initial suggestions, then show initial suggestions.\n\t\t\t\tthis.updateSuggestions();\n\t\t\t}\n\t\t}\n\t}\n\n\tcomponentDidMount() {\n\t\tif ( this.shouldShowInitialSuggestions() ) {\n\t\t\tthis.updateSuggestions();\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\tthis.suggestionsRequest?.cancel?.();\n\t\tthis.suggestionsRequest = null;\n\t}\n\n\tbindSuggestionNode( index ) {\n\t\treturn ( ref ) => {\n\t\t\tthis.suggestionNodes[ index ] = ref;\n\t\t};\n\t}\n\n\tshouldShowInitialSuggestions() {\n\t\tconst { __experimentalShowInitialSuggestions = false, value } =\n\t\t\tthis.props;\n\t\treturn (\n\t\t\t__experimentalShowInitialSuggestions && ! ( value && value.length )\n\t\t);\n\t}\n\n\tupdateSuggestions( value = '' ) {\n\t\tconst {\n\t\t\t__experimentalFetchLinkSuggestions: fetchLinkSuggestions,\n\t\t\t__experimentalHandleURLSuggestions: handleURLSuggestions,\n\t\t} = this.props;\n\n\t\tif ( ! fetchLinkSuggestions ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Initial suggestions may only show if there is no value\n\t\t// (note: this includes whitespace).\n\t\tconst isInitialSuggestions = ! value?.length;\n\n\t\t// Trim only now we've determined whether or not it originally had a \"length\"\n\t\t// (even if that value was all whitespace).\n\t\tvalue = value.trim();\n\n\t\t// Allow a suggestions request if:\n\t\t// - there are at least 2 characters in the search input (except manual searches where\n\t\t// search input length is not required to trigger a fetch)\n\t\t// - this is a direct entry (eg: a URL)\n\t\tif (\n\t\t\t! isInitialSuggestions &&\n\t\t\t( value.length < 2 || ( ! handleURLSuggestions && isURL( value ) ) )\n\t\t) {\n\t\t\tthis.suggestionsRequest?.cancel?.();\n\t\t\tthis.suggestionsRequest = null;\n\n\t\t\tthis.setState( {\n\t\t\t\tsuggestions: [],\n\t\t\t\tshowSuggestions: false,\n\t\t\t\tsuggestionsValue: value,\n\t\t\t\tselectedSuggestion: null,\n\t\t\t\tloading: false,\n\t\t\t} );\n\n\t\t\treturn;\n\t\t}\n\n\t\tthis.setState( {\n\t\t\tisUpdatingSuggestions: true,\n\t\t\tselectedSuggestion: null,\n\t\t\tloading: true,\n\t\t} );\n\n\t\tconst request = fetchLinkSuggestions( value, {\n\t\t\tisInitialSuggestions,\n\t\t} );\n\n\t\trequest\n\t\t\t.then( ( suggestions ) => {\n\t\t\t\t// A fetch Promise doesn't have an abort option. It's mimicked by\n\t\t\t\t// comparing the request reference in on the instance, which is\n\t\t\t\t// reset or deleted on subsequent requests or unmounting.\n\t\t\t\tif ( this.suggestionsRequest !== request ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.setState( {\n\t\t\t\t\tsuggestions,\n\t\t\t\t\tisUpdatingSuggestions: false,\n\t\t\t\t\tsuggestionsValue: value,\n\t\t\t\t\tloading: false,\n\t\t\t\t\tshowSuggestions: !! suggestions.length,\n\t\t\t\t} );\n\n\t\t\t\tif ( !! suggestions.length ) {\n\t\t\t\t\tthis.props.debouncedSpeak(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %s: number of results. */\n\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\t\tsuggestions.length\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tsuggestions.length\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'assertive'\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tthis.props.debouncedSpeak(\n\t\t\t\t\t\t__( 'No results.' ),\n\t\t\t\t\t\t'assertive'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( () => {\n\t\t\t\tif ( this.suggestionsRequest !== request ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.setState( {\n\t\t\t\t\tisUpdatingSuggestions: false,\n\t\t\t\t\tloading: false,\n\t\t\t\t} );\n\t\t\t} );\n\n\t\t// Note that this assignment is handled *before* the async search request\n\t\t// as a Promise always resolves on the next tick of the event loop.\n\t\tthis.suggestionsRequest = request;\n\t}\n\n\tonChange( event ) {\n\t\tthis.props.onChange( event.target.value );\n\t}\n\n\tonFocus() {\n\t\tconst { suggestions } = this.state;\n\t\tconst { disableSuggestions, value } = this.props;\n\n\t\t// When opening the link editor, if there's a value present, we want to load the suggestions pane with the results for this input search value\n\t\t// Don't re-run the suggestions on focus if there are already suggestions present (prevents searching again when tabbing between the input and buttons)\n\t\tif (\n\t\t\tvalue &&\n\t\t\t! disableSuggestions &&\n\t\t\t! this.state.isUpdatingSuggestions &&\n\t\t\t! ( suggestions && suggestions.length )\n\t\t) {\n\t\t\t// Ensure the suggestions are updated with the current input value.\n\t\t\tthis.updateSuggestions( value );\n\t\t}\n\t}\n\n\tonKeyDown( event ) {\n\t\tconst { showSuggestions, selectedSuggestion, suggestions, loading } =\n\t\t\tthis.state;\n\n\t\t// If the suggestions are not shown or loading, we shouldn't handle the arrow keys\n\t\t// We shouldn't preventDefault to allow block arrow keys navigation.\n\t\tif ( ! showSuggestions || ! suggestions.length || loading ) {\n\t\t\t// In the Windows version of Firefox the up and down arrows don't move the caret\n\t\t\t// within an input field like they do for Mac Firefox/Chrome/Safari. This causes\n\t\t\t// a form of focus trapping that is disruptive to the user experience. This disruption\n\t\t\t// only happens if the caret is not in the first or last position in the text input.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/5693#issuecomment-436684747\n\t\t\tswitch ( event.keyCode ) {\n\t\t\t\t// When UP is pressed, if the caret is at the start of the text, move it to the 0\n\t\t\t\t// position.\n\t\t\t\tcase UP: {\n\t\t\t\t\tif ( 0 !== event.target.selectionStart ) {\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t// Set the input caret to position 0.\n\t\t\t\t\t\tevent.target.setSelectionRange( 0, 0 );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// When DOWN is pressed, if the caret is not at the end of the text, move it to the\n\t\t\t\t// last position.\n\t\t\t\tcase DOWN: {\n\t\t\t\t\tif (\n\t\t\t\t\t\tthis.props.value.length !== event.target.selectionStart\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t// Set the input caret to the last position.\n\t\t\t\t\t\tevent.target.setSelectionRange(\n\t\t\t\t\t\t\tthis.props.value.length,\n\t\t\t\t\t\t\tthis.props.value.length\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t// Submitting while loading should trigger onSubmit.\n\t\t\t\tcase ENTER: {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tif ( this.props.onSubmit ) {\n\t\t\t\t\t\tthis.props.onSubmit( null, event );\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst suggestion =\n\t\t\tthis.state.suggestions[ this.state.selectedSuggestion ];\n\n\t\tswitch ( event.keyCode ) {\n\t\t\tcase UP: {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst previousIndex = ! selectedSuggestion\n\t\t\t\t\t? suggestions.length - 1\n\t\t\t\t\t: selectedSuggestion - 1;\n\t\t\t\tthis.setState( {\n\t\t\t\t\tselectedSuggestion: previousIndex,\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase DOWN: {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst nextIndex =\n\t\t\t\t\tselectedSuggestion === null ||\n\t\t\t\t\tselectedSuggestion === suggestions.length - 1\n\t\t\t\t\t\t? 0\n\t\t\t\t\t\t: selectedSuggestion + 1;\n\t\t\t\tthis.setState( {\n\t\t\t\t\tselectedSuggestion: nextIndex,\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase TAB: {\n\t\t\t\tif ( this.state.selectedSuggestion !== null ) {\n\t\t\t\t\tthis.selectLink( suggestion );\n\t\t\t\t\t// Announce a link has been selected when tabbing away from the input field.\n\t\t\t\t\tthis.props.speak( __( 'Link selected.' ) );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ENTER: {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif ( this.state.selectedSuggestion !== null ) {\n\t\t\t\t\tthis.selectLink( suggestion );\n\n\t\t\t\t\tif ( this.props.onSubmit ) {\n\t\t\t\t\t\tthis.props.onSubmit( suggestion, event );\n\t\t\t\t\t}\n\t\t\t\t} else if ( this.props.onSubmit ) {\n\t\t\t\t\tthis.props.onSubmit( null, event );\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tselectLink( suggestion ) {\n\t\tthis.props.onChange( suggestion.url, suggestion );\n\t\tthis.setState( {\n\t\t\tselectedSuggestion: null,\n\t\t\tshowSuggestions: false,\n\t\t} );\n\t}\n\n\thandleOnClick( suggestion ) {\n\t\tthis.selectLink( suggestion );\n\t\t// Move focus to the input field when a link suggestion is clicked.\n\t\tthis.inputRef.current.focus();\n\t}\n\n\tstatic getDerivedStateFromProps(\n\t\t{\n\t\t\tvalue,\n\t\t\tinstanceId,\n\t\t\tdisableSuggestions,\n\t\t\t__experimentalShowInitialSuggestions = false,\n\t\t},\n\t\t{ showSuggestions }\n\t) {\n\t\tlet shouldShowSuggestions = showSuggestions;\n\n\t\tconst hasValue = value && value.length;\n\n\t\tif ( ! __experimentalShowInitialSuggestions && ! hasValue ) {\n\t\t\tshouldShowSuggestions = false;\n\t\t}\n\n\t\tif ( disableSuggestions === true ) {\n\t\t\tshouldShowSuggestions = false;\n\t\t}\n\n\t\treturn {\n\t\t\tshowSuggestions: shouldShowSuggestions,\n\t\t\tsuggestionsListboxId: `block-editor-url-input-suggestions-${ instanceId }`,\n\t\t\tsuggestionOptionIdPrefix: `block-editor-url-input-suggestion-${ instanceId }`,\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ this.renderControl() }\n\t\t\t\t{ this.renderSuggestions() }\n\t\t\t</>\n\t\t);\n\t}\n\n\trenderControl() {\n\t\tconst {\n\t\t\tlabel = null,\n\t\t\tclassName,\n\t\t\tisFullWidth,\n\t\t\tinstanceId,\n\t\t\tplaceholder = __( 'Paste URL or type to search' ),\n\t\t\t__experimentalRenderControl: renderControl,\n\t\t\tvalue = '',\n\t\t} = this.props;\n\n\t\tconst {\n\t\t\tloading,\n\t\t\tshowSuggestions,\n\t\t\tselectedSuggestion,\n\t\t\tsuggestionsListboxId,\n\t\t\tsuggestionOptionIdPrefix,\n\t\t} = this.state;\n\n\t\tconst inputId = `url-input-control-${ instanceId }`;\n\n\t\tconst controlProps = {\n\t\t\tid: inputId, // Passes attribute to label for the for attribute\n\t\t\tlabel,\n\t\t\tclassName: classnames( 'block-editor-url-input', className, {\n\t\t\t\t'is-full-width': isFullWidth,\n\t\t\t} ),\n\t\t};\n\n\t\tconst inputProps = {\n\t\t\tid: inputId,\n\t\t\tvalue,\n\t\t\trequired: true,\n\t\t\tclassName: 'block-editor-url-input__input',\n\t\t\ttype: 'text',\n\t\t\tonChange: this.onChange,\n\t\t\tonFocus: this.onFocus,\n\t\t\tplaceholder,\n\t\t\tonKeyDown: this.onKeyDown,\n\t\t\trole: 'combobox',\n\t\t\t'aria-label': label ? undefined : __( 'URL' ), // Ensure input always has an accessible label\n\t\t\t'aria-expanded': showSuggestions,\n\t\t\t'aria-autocomplete': 'list',\n\t\t\t'aria-controls': suggestionsListboxId,\n\t\t\t'aria-activedescendant':\n\t\t\t\tselectedSuggestion !== null\n\t\t\t\t\t? `${ suggestionOptionIdPrefix }-${ selectedSuggestion }`\n\t\t\t\t\t: undefined,\n\t\t\tref: this.inputRef,\n\t\t};\n\n\t\tif ( renderControl ) {\n\t\t\treturn renderControl( controlProps, inputProps, loading );\n\t\t}\n\n\t\treturn (\n\t\t\t<BaseControl { ...controlProps }>\n\t\t\t\t<input { ...inputProps } />\n\t\t\t\t{ loading && <Spinner /> }\n\t\t\t</BaseControl>\n\t\t);\n\t}\n\n\trenderSuggestions() {\n\t\tconst {\n\t\t\tclassName,\n\t\t\t__experimentalRenderSuggestions: renderSuggestions,\n\t\t} = this.props;\n\n\t\tconst {\n\t\t\tshowSuggestions,\n\t\t\tsuggestions,\n\t\t\tsuggestionsValue,\n\t\t\tselectedSuggestion,\n\t\t\tsuggestionsListboxId,\n\t\t\tsuggestionOptionIdPrefix,\n\t\t\tloading,\n\t\t} = this.state;\n\n\t\tif ( ! showSuggestions || suggestions.length === 0 ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst suggestionsListProps = {\n\t\t\tid: suggestionsListboxId,\n\t\t\tref: this.autocompleteRef,\n\t\t\trole: 'listbox',\n\t\t};\n\n\t\tconst buildSuggestionItemProps = ( suggestion, index ) => {\n\t\t\treturn {\n\t\t\t\trole: 'option',\n\t\t\t\ttabIndex: '-1',\n\t\t\t\tid: `${ suggestionOptionIdPrefix }-${ index }`,\n\t\t\t\tref: this.bindSuggestionNode( index ),\n\t\t\t\t'aria-selected': index === selectedSuggestion,\n\t\t\t};\n\t\t};\n\n\t\tif ( isFunction( renderSuggestions ) ) {\n\t\t\treturn renderSuggestions( {\n\t\t\t\tsuggestions,\n\t\t\t\tselectedSuggestion,\n\t\t\t\tsuggestionsListProps,\n\t\t\t\tbuildSuggestionItemProps,\n\t\t\t\tisLoading: loading,\n\t\t\t\thandleSuggestionClick: this.handleOnClick,\n\t\t\t\tisInitialSuggestions: ! suggestionsValue?.length,\n\t\t\t\tcurrentInputValue: suggestionsValue,\n\t\t\t} );\n\t\t}\n\n\t\treturn (\n\t\t\t<Popover placement=\"bottom\" focusOnMount={ false }>\n\t\t\t\t<div\n\t\t\t\t\t{ ...suggestionsListProps }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'block-editor-url-input__suggestions',\n\t\t\t\t\t\t`${ className }__suggestions`\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ suggestions.map( ( suggestion, index ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t{ ...buildSuggestionItemProps( suggestion, index ) }\n\t\t\t\t\t\t\tkey={ suggestion.id }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-url-input__suggestion',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'is-selected': index === selectedSuggestion,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonClick={ () => this.handleOnClick( suggestion ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ suggestion.title }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) ) }\n\t\t\t\t</div>\n\t\t\t</Popover>\n\t\t);\n\t}\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-input/README.md\n */\nexport default compose(\n\twithSafeTimeout,\n\twithSpokenMessages,\n\twithInstanceId,\n\twithSelect( ( select, props ) => {\n\t\t// If a link suggestions handler is already provided then\n\t\t// bail.\n\t\tif ( isFunction( props.__experimentalFetchLinkSuggestions ) ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\t__experimentalFetchLinkSuggestions:\n\t\t\t\tgetSettings().__experimentalFetchLinkSuggestions,\n\t\t};\n\t} )\n)( URLInput );\n"]}
@@ -3,7 +3,7 @@ import { createElement, Fragment } from "@wordpress/element";
3
3
  /**
4
4
  * External dependencies
5
5
  */
6
- import { find, map } from 'lodash';
6
+ import { map } from 'lodash';
7
7
  /**
8
8
  * WordPress dependencies
9
9
  */
@@ -173,7 +173,7 @@ const ImageURLInputUI = _ref => {
173
173
  if (!value) {
174
174
  linkDestinationInput = LINK_DESTINATION_NONE;
175
175
  } else {
176
- linkDestinationInput = (find(linkDestinations, destination => {
176
+ linkDestinationInput = (linkDestinations.find(destination => {
177
177
  return destination.url === value;
178
178
  }) || {
179
179
  linkDestination: LINK_DESTINATION_CUSTOM
@@ -217,7 +217,7 @@ const ImageURLInputUI = _ref => {
217
217
  onChange: onSetLinkClass
218
218
  }));
219
219
  const linkEditorValue = urlInput !== null ? urlInput : url;
220
- const urlLabel = (find(getLinkDestinations(), ['linkDestination', linkDestination]) || {}).title;
220
+ const urlLabel = (getLinkDestinations().find(destination => destination.linkDestination === linkDestination) || {}).title;
221
221
  return createElement(Fragment, null, createElement(ToolbarButton, {
222
222
  icon: linkIcon,
223
223
  className: "components-toolbar__control",
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/url-popover/image-url-input-ui.js"],"names":["find","map","__","useRef","useState","useCallback","ToolbarButton","Button","NavigableMenu","MenuItem","ToggleControl","TextControl","SVG","Path","link","linkIcon","close","URLPopover","LINK_DESTINATION_NONE","LINK_DESTINATION_CUSTOM","LINK_DESTINATION_MEDIA","LINK_DESTINATION_ATTACHMENT","NEW_TAB_REL","icon","ImageURLInputUI","linkDestination","onChangeUrl","url","mediaType","mediaUrl","mediaLink","linkTarget","linkClass","rel","isOpen","setIsOpen","popoverAnchor","setPopoverAnchor","openLinkUI","isEditingLink","setIsEditingLink","urlInput","setUrlInput","autocompleteRef","startEditLink","stopEditLink","closeLinkUI","getUpdatedLinkTargetSettings","value","newLinkTarget","undefined","updatedRel","rels","split","forEach","relVal","includes","push","join","filter","length","onFocusOutside","event","autocompleteElement","current","contains","target","onSubmitLinkChange","selectedDestination","getLinkDestinations","destination","href","preventDefault","onLinkRemove","linkDestinations","title","onSetHref","linkDestinationInput","onSetNewTab","updatedLinkTarget","onSetLinkRel","onSetLinkClass","advancedOptions","linkEditorValue","urlLabel","__experimentalImageURLInputUI"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,GAAf,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,QAAjB,EAA2BC,WAA3B,QAA8C,oBAA9C;AACA,SACCC,aADD,EAECC,MAFD,EAGCC,aAHD,EAICC,QAJD,EAKCC,aALD,EAMCC,WAND,EAOCC,GAPD,EAQCC,IARD,QASO,uBATP;AAUA,SAASC,IAAI,IAAIC,QAAjB,EAA2BC,KAA3B,QAAwC,kBAAxC;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,SAAvB;AAEA,MAAMC,qBAAqB,GAAG,MAA9B;AACA,MAAMC,uBAAuB,GAAG,QAAhC;AACA,MAAMC,sBAAsB,GAAG,OAA/B;AACA,MAAMC,2BAA2B,GAAG,YAApC;AACA,MAAMC,WAAW,GAAG,CAAE,YAAF,EAAgB,UAAhB,CAApB;AAEA,MAAMC,IAAI,GACT,cAAC,GAAD;AAAK,EAAA,OAAO,EAAC,WAAb;AAAyB,EAAA,KAAK,EAAC;AAA/B,GACC,cAAC,IAAD;AAAM,EAAA,CAAC,EAAC,iBAAR;AAA0B,EAAA,IAAI,EAAC;AAA/B,EADD,EAEC,cAAC,IAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EAFD,EAGC,cAAC,IAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EAHD,CADD;;AAQA,MAAMC,eAAe,GAAG,QAUjB;AAAA,MAVmB;AACzBC,IAAAA,eADyB;AAEzBC,IAAAA,WAFyB;AAGzBC,IAAAA,GAHyB;AAIzBC,IAAAA,SAAS,GAAG,OAJa;AAKzBC,IAAAA,QALyB;AAMzBC,I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I,CAACW,eADZ;AAEC,MAAA,IAAI,EAAGX,IAAI,CAACS,IAFb;AAGC,MAAA,OAAO,EAAG,MAAM;AACfmB,QAAAA,WAAW,CAAE,IAAF,CAAX;AACAkC,QAAAA,SAAS,CAAE9D,IAAI,CAACa,GAAP,CAAT;AACAkB,QAAAA,YAAY;AACZ;AAPF,OASG/B,IAAI,CAAC6D,KATR,CADI,CADN;AAPH,KAyBG,CAAE,CAAEhD,GAAF,IAASY,aAAX,KACD,cAAC,UAAD,CAAY,UAAZ;AACC,IAAA,SAAS,EAAC,qDADX;AAEC,IAAA,KAAK,EAAG4C,eAFT;AAGC,IAAA,kBAAkB,EAAGzC,WAHtB;AAIC,IAAA,QAAQ,EAAGyB,kBAAkB,EAJ9B;AAKC,IAAA,eAAe,EAAGxB;AALnB,IA1BF,EAkCGhB,GAAG,IAAI,CAAEY,aAAT,IACD,8BACC,cAAC,UAAD,CAAY,UAAZ;AACC,IAAA,SAAS,EAAC,qDADX;AAEC,IAAA,GAAG,EAAGZ,GAFP;AAGC,IAAA,eAAe,EAAGiB,aAHnB;AAIC,IAAA,QAAQ,EAAGwC;AAJZ,IADD,EAOC,cAAC,MAAD;AACC,IAAA,IAAI,EAAGpE,KADR;AAEC,IAAA,KAAK,EAAGd,EAAE,CAAE,aAAF,CAFX;AAGC,IAAA,OAAO,EAAGuE;AAHX,IAPD,CAnCF,CAVF,CADD;AAgEA,CAzQD;;AA2QA,SAASjD,eAAe,IAAI6D,6BAA5B","sourcesContent":["/**\n * External dependencies\n */\nimport { find, map } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useState, useCallback } from '@wordpress/element';\nimport {\n\tToolbarButton,\n\tButton,\n\tNavigableMenu,\n\tMenuItem,\n\tToggleControl,\n\tTextControl,\n\tSVG,\n\tPath,\n} from '@wordpress/components';\nimport { link as linkIcon, close } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport URLPopover from './index';\n\nconst LINK_DESTINATION_NONE = 'none';\nconst LINK_DESTINATION_CUSTOM = 'custom';\nconst LINK_DESTINATION_MEDIA = 'media';\nconst LINK_DESTINATION_ATTACHMENT = 'attachment';\nconst NEW_TAB_REL = [ 'noreferrer', 'noopener' ];\n\nconst icon = (\n\t<SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t<Path d=\"M0,0h24v24H0V0z\" fill=\"none\" />\n\t\t<Path d=\"m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z\" />\n\t\t<Path d=\"m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z\" />\n\t</SVG>\n);\n\nconst ImageURLInputUI = ( {\n\tlinkDestination,\n\tonChangeUrl,\n\turl,\n\tmediaType = 'image',\n\tmediaUrl,\n\tmediaLink,\n\tlinkTarget,\n\tlinkClass,\n\trel,\n} ) => {\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst openLinkUI = useCallback( () => {\n\t\tsetIsOpen( true );\n\t} );\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState( false );\n\tconst [ urlInput, setUrlInput ] = useState( null );\n\n\tconst autocompleteRef = useRef( null );\n\n\tconst startEditLink = useCallback( () => {\n\t\tif (\n\t\t\tlinkDestination === LINK_DESTINATION_MEDIA ||\n\t\t\tlinkDestination === LINK_DESTINATION_ATTACHMENT\n\t\t) {\n\t\t\tsetUrlInput( '' );\n\t\t}\n\t\tsetIsEditingLink( true );\n\t} );\n\n\tconst stopEditLink = useCallback( () => {\n\t\tsetIsEditingLink( false );\n\t} );\n\n\tconst closeLinkUI = useCallback( () => {\n\t\tsetUrlInput( null );\n\t\tstopEditLink();\n\t\tsetIsOpen( false );\n\t} );\n\n\tconst getUpdatedLinkTargetSettings = ( value ) => {\n\t\tconst newLinkTarget = value ? '_blank' : undefined;\n\n\t\tlet updatedRel;\n\t\tif ( newLinkTarget ) {\n\t\t\tconst rels = ( rel ?? '' ).split( ' ' );\n\t\t\tNEW_TAB_REL.forEach( ( relVal ) => {\n\t\t\t\tif ( ! rels.includes( relVal ) ) {\n\t\t\t\t\trels.push( relVal );\n\t\t\t\t}\n\t\t\t} );\n\t\t\tupdatedRel = rels.join( ' ' );\n\t\t} else {\n\t\t\tconst rels = ( rel ?? '' )\n\t\t\t\t.split( ' ' )\n\t\t\t\t.filter(\n\t\t\t\t\t( relVal ) => NEW_TAB_REL.includes( relVal ) === false\n\t\t\t\t);\n\t\t\tupdatedRel = rels.length ? rels.join( ' ' ) : undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tlinkTarget: newLinkTarget,\n\t\t\trel: updatedRel,\n\t\t};\n\t};\n\n\tconst onFocusOutside = useCallback( () => {\n\t\treturn ( event ) => {\n\t\t\t// The autocomplete suggestions list renders in a separate popover (in a portal),\n\t\t\t// so onFocusOutside fails to detect that a click on a suggestion occurred in the\n\t\t\t// LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and\n\t\t\t// return to avoid the popover being closed.\n\t\t\tconst autocompleteElement = autocompleteRef.current;\n\t\t\tif (\n\t\t\t\tautocompleteElement &&\n\t\t\t\tautocompleteElement.contains( event.target )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsOpen( false );\n\t\t\tsetUrlInput( null );\n\t\t\tstopEditLink();\n\t\t};\n\t} );\n\n\tconst onSubmitLinkChange = useCallback( () => {\n\t\treturn ( event ) => {\n\t\t\tif ( urlInput ) {\n\t\t\t\t// It is possible the entered URL actually matches a named link destination.\n\t\t\t\t// This check will ensure our link destination is correct.\n\t\t\t\tconst selectedDestination =\n\t\t\t\t\tgetLinkDestinations().find(\n\t\t\t\t\t\t( destination ) => destination.url === urlInput\n\t\t\t\t\t)?.linkDestination || LINK_DESTINATION_CUSTOM;\n\n\t\t\t\tonChangeUrl( {\n\t\t\t\t\thref: urlInput,\n\t\t\t\t\tlinkDestination: selectedDestination,\n\t\t\t\t} );\n\t\t\t}\n\t\t\tstopEditLink();\n\t\t\tsetUrlInput( null );\n\t\t\tevent.preventDefault();\n\t\t};\n\t} );\n\n\tconst onLinkRemove = useCallback( () => {\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: LINK_DESTINATION_NONE,\n\t\t\thref: '',\n\t\t} );\n\t} );\n\n\tconst getLinkDestinations = () => {\n\t\tconst linkDestinations = [\n\t\t\t{\n\t\t\t\tlinkDestination: LINK_DESTINATION_MEDIA,\n\t\t\t\ttitle: __( 'Media File' ),\n\t\t\t\turl: mediaType === 'image' ? mediaUrl : undefined,\n\t\t\t\ticon,\n\t\t\t},\n\t\t];\n\t\tif ( mediaType === 'image' && mediaLink ) {\n\t\t\tlinkDestinations.push( {\n\t\t\t\tlinkDestination: LINK_DESTINATION_ATTACHMENT,\n\t\t\t\ttitle: __( 'Attachment Page' ),\n\t\t\t\turl: mediaType === 'image' ? mediaLink : undefined,\n\t\t\t\ticon: (\n\t\t\t\t\t<SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t\t\t\t\t<Path d=\"M0 0h24v24H0V0z\" fill=\"none\" />\n\t\t\t\t\t\t<Path d=\"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z\" />\n\t\t\t\t\t</SVG>\n\t\t\t\t),\n\t\t\t} );\n\t\t}\n\t\treturn linkDestinations;\n\t};\n\n\tconst onSetHref = ( value ) => {\n\t\tconst linkDestinations = getLinkDestinations();\n\t\tlet linkDestinationInput;\n\t\tif ( ! value ) {\n\t\t\tlinkDestinationInput = LINK_DESTINATION_NONE;\n\t\t} else {\n\t\t\tlinkDestinationInput = (\n\t\t\t\tfind( linkDestinations, ( destination ) => {\n\t\t\t\t\treturn destination.url === value;\n\t\t\t\t} ) || { linkDestination: LINK_DESTINATION_CUSTOM }\n\t\t\t).linkDestination;\n\t\t}\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: linkDestinationInput,\n\t\t\thref: value,\n\t\t} );\n\t};\n\n\tconst onSetNewTab = ( value ) => {\n\t\tconst updatedLinkTarget = getUpdatedLinkTargetSettings( value );\n\t\tonChangeUrl( updatedLinkTarget );\n\t};\n\n\tconst onSetLinkRel = ( value ) => {\n\t\tonChangeUrl( { rel: value } );\n\t};\n\n\tconst onSetLinkClass = ( value ) => {\n\t\tonChangeUrl( { linkClass: value } );\n\t};\n\n\tconst advancedOptions = (\n\t\t<>\n\t\t\t<ToggleControl\n\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\tonChange={ onSetNewTab }\n\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\tvalue={ rel ?? '' }\n\t\t\t\tonChange={ onSetLinkRel }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\tlabel={ __( 'Link CSS Class' ) }\n\t\t\t\tvalue={ linkClass || '' }\n\t\t\t\tonChange={ onSetLinkClass }\n\t\t\t/>\n\t\t</>\n\t);\n\n\tconst linkEditorValue = urlInput !== null ? urlInput : url;\n\n\tconst urlLabel = (\n\t\tfind( getLinkDestinations(), [ 'linkDestination', linkDestination ] ) ||\n\t\t{}\n\t).title;\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ linkIcon }\n\t\t\t\tclassName=\"components-toolbar__control\"\n\t\t\t\tlabel={ url ? __( 'Edit link' ) : __( 'Insert link' ) }\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t\tonClick={ openLinkUI }\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t/>\n\t\t\t{ isOpen && (\n\t\t\t\t<URLPopover\n\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\tonFocusOutside={ onFocusOutside() }\n\t\t\t\t\tonClose={ closeLinkUI }\n\t\t\t\t\trenderSettings={ () => advancedOptions }\n\t\t\t\t\tadditionalControls={\n\t\t\t\t\t\t! linkEditorValue && (\n\t\t\t\t\t\t\t<NavigableMenu>\n\t\t\t\t\t\t\t\t{ map( getLinkDestinations(), ( link ) => (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tkey={ link.linkDestination }\n\t\t\t\t\t\t\t\t\t\ticon={ link.icon }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetUrlInput( null );\n\t\t\t\t\t\t\t\t\t\t\tonSetHref( link.url );\n\t\t\t\t\t\t\t\t\t\t\tstopEditLink();\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{ link.title }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t</NavigableMenu>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ ( ! url || isEditingLink ) && (\n\t\t\t\t\t\t<URLPopover.LinkEditor\n\t\t\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\t\t\tvalue={ linkEditorValue }\n\t\t\t\t\t\t\tonChangeInputValue={ setUrlInput }\n\t\t\t\t\t\t\tonSubmit={ onSubmitLinkChange() }\n\t\t\t\t\t\t\tautocompleteRef={ autocompleteRef }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ url && ! isEditingLink && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<URLPopover.LinkViewer\n\t\t\t\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\tonEditLinkClick={ startEditLink }\n\t\t\t\t\t\t\t\turlLabel={ urlLabel }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ticon={ close }\n\t\t\t\t\t\t\t\tlabel={ __( 'Remove link' ) }\n\t\t\t\t\t\t\t\tonClick={ onLinkRemove }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</URLPopover>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\nexport { ImageURLInputUI as __experimentalImageURLInputUI };\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/url-popover/image-url-input-ui.js"],"names":["map","__","useRef","useState","useCallback","ToolbarButton","Button","NavigableMenu","MenuItem","ToggleControl","TextControl","SVG","Path","link","linkIcon","close","URLPopover","LINK_DESTINATION_NONE","LINK_DESTINATION_CUSTOM","LINK_DESTINATION_MEDIA","LINK_DESTINATION_ATTACHMENT","NEW_TAB_REL","icon","ImageURLInputUI","linkDestination","onChangeUrl","url","mediaType","mediaUrl","mediaLink","linkTarget","linkClass","rel","isOpen","setIsOpen","popoverAnchor","setPopoverAnchor","openLinkUI","isEditingLink","setIsEditingLink","urlInput","setUrlInput","autocompleteRef","startEditLink","stopEditLink","closeLinkUI","getUpdatedLinkTargetSettings","value","newLinkTarget","undefined","updatedRel","rels","split","forEach","relVal","includes","push","join","filter","length","onFocusOutside","event","autocompleteElement","current","contains","target","onSubmitLinkChange","selectedDestination","getLinkDestinations","find","destination","href","preventDefault","onLinkRemove","linkDestinations","title","onSetHref","linkDestinationInput","onSetNewTab","updatedLinkTarget","onSetLinkRel","onSetLinkClass","advancedOptions","linkEditorValue","urlLabel","__experimentalImageURLInputUI"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,QAAjB,EAA2BC,WAA3B,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EAAC,qDADX;AAEC,IAAA,KAAK,EAAG6C,eAFT;AAGC,IAAA,kBAAkB,EAAG1C,WAHtB;AAIC,IAAA,QAAQ,EAAGyB,kBAAkB,EAJ9B;AAKC,IAAA,eAAe,EAAGxB;AALnB,IA1BF,EAkCGhB,GAAG,IAAI,CAAEY,aAAT,IACD,8BACC,cAAC,UAAD,CAAY,UAAZ;AACC,IAAA,SAAS,EAAC,qDADX;AAEC,IAAA,GAAG,EAAGZ,GAFP;AAGC,IAAA,eAAe,EAAGiB,aAHnB;AAIC,IAAA,QAAQ,EAAGyC;AAJZ,IADD,EAOC,cAAC,MAAD;AACC,IAAA,IAAI,EAAGrE,KADR;AAEC,IAAA,KAAK,EAAGd,EAAE,CAAE,aAAF,CAFX;AAGC,IAAA,OAAO,EAAGwE;AAHX,IAPD,CAnCF,CAVF,CADD;AAgEA,CA1QD;;AA4QA,SAASlD,eAAe,IAAI8D,6BAA5B","sourcesContent":["/**\n * External dependencies\n */\nimport { map } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useState, useCallback } from '@wordpress/element';\nimport {\n\tToolbarButton,\n\tButton,\n\tNavigableMenu,\n\tMenuItem,\n\tToggleControl,\n\tTextControl,\n\tSVG,\n\tPath,\n} from '@wordpress/components';\nimport { link as linkIcon, close } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport URLPopover from './index';\n\nconst LINK_DESTINATION_NONE = 'none';\nconst LINK_DESTINATION_CUSTOM = 'custom';\nconst LINK_DESTINATION_MEDIA = 'media';\nconst LINK_DESTINATION_ATTACHMENT = 'attachment';\nconst NEW_TAB_REL = [ 'noreferrer', 'noopener' ];\n\nconst icon = (\n\t<SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t<Path d=\"M0,0h24v24H0V0z\" fill=\"none\" />\n\t\t<Path d=\"m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z\" />\n\t\t<Path d=\"m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z\" />\n\t</SVG>\n);\n\nconst ImageURLInputUI = ( {\n\tlinkDestination,\n\tonChangeUrl,\n\turl,\n\tmediaType = 'image',\n\tmediaUrl,\n\tmediaLink,\n\tlinkTarget,\n\tlinkClass,\n\trel,\n} ) => {\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst openLinkUI = useCallback( () => {\n\t\tsetIsOpen( true );\n\t} );\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState( false );\n\tconst [ urlInput, setUrlInput ] = useState( null );\n\n\tconst autocompleteRef = useRef( null );\n\n\tconst startEditLink = useCallback( () => {\n\t\tif (\n\t\t\tlinkDestination === LINK_DESTINATION_MEDIA ||\n\t\t\tlinkDestination === LINK_DESTINATION_ATTACHMENT\n\t\t) {\n\t\t\tsetUrlInput( '' );\n\t\t}\n\t\tsetIsEditingLink( true );\n\t} );\n\n\tconst stopEditLink = useCallback( () => {\n\t\tsetIsEditingLink( false );\n\t} );\n\n\tconst closeLinkUI = useCallback( () => {\n\t\tsetUrlInput( null );\n\t\tstopEditLink();\n\t\tsetIsOpen( false );\n\t} );\n\n\tconst getUpdatedLinkTargetSettings = ( value ) => {\n\t\tconst newLinkTarget = value ? '_blank' : undefined;\n\n\t\tlet updatedRel;\n\t\tif ( newLinkTarget ) {\n\t\t\tconst rels = ( rel ?? '' ).split( ' ' );\n\t\t\tNEW_TAB_REL.forEach( ( relVal ) => {\n\t\t\t\tif ( ! rels.includes( relVal ) ) {\n\t\t\t\t\trels.push( relVal );\n\t\t\t\t}\n\t\t\t} );\n\t\t\tupdatedRel = rels.join( ' ' );\n\t\t} else {\n\t\t\tconst rels = ( rel ?? '' )\n\t\t\t\t.split( ' ' )\n\t\t\t\t.filter(\n\t\t\t\t\t( relVal ) => NEW_TAB_REL.includes( relVal ) === false\n\t\t\t\t);\n\t\t\tupdatedRel = rels.length ? rels.join( ' ' ) : undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tlinkTarget: newLinkTarget,\n\t\t\trel: updatedRel,\n\t\t};\n\t};\n\n\tconst onFocusOutside = useCallback( () => {\n\t\treturn ( event ) => {\n\t\t\t// The autocomplete suggestions list renders in a separate popover (in a portal),\n\t\t\t// so onFocusOutside fails to detect that a click on a suggestion occurred in the\n\t\t\t// LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and\n\t\t\t// return to avoid the popover being closed.\n\t\t\tconst autocompleteElement = autocompleteRef.current;\n\t\t\tif (\n\t\t\t\tautocompleteElement &&\n\t\t\t\tautocompleteElement.contains( event.target )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsOpen( false );\n\t\t\tsetUrlInput( null );\n\t\t\tstopEditLink();\n\t\t};\n\t} );\n\n\tconst onSubmitLinkChange = useCallback( () => {\n\t\treturn ( event ) => {\n\t\t\tif ( urlInput ) {\n\t\t\t\t// It is possible the entered URL actually matches a named link destination.\n\t\t\t\t// This check will ensure our link destination is correct.\n\t\t\t\tconst selectedDestination =\n\t\t\t\t\tgetLinkDestinations().find(\n\t\t\t\t\t\t( destination ) => destination.url === urlInput\n\t\t\t\t\t)?.linkDestination || LINK_DESTINATION_CUSTOM;\n\n\t\t\t\tonChangeUrl( {\n\t\t\t\t\thref: urlInput,\n\t\t\t\t\tlinkDestination: selectedDestination,\n\t\t\t\t} );\n\t\t\t}\n\t\t\tstopEditLink();\n\t\t\tsetUrlInput( null );\n\t\t\tevent.preventDefault();\n\t\t};\n\t} );\n\n\tconst onLinkRemove = useCallback( () => {\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: LINK_DESTINATION_NONE,\n\t\t\thref: '',\n\t\t} );\n\t} );\n\n\tconst getLinkDestinations = () => {\n\t\tconst linkDestinations = [\n\t\t\t{\n\t\t\t\tlinkDestination: LINK_DESTINATION_MEDIA,\n\t\t\t\ttitle: __( 'Media File' ),\n\t\t\t\turl: mediaType === 'image' ? mediaUrl : undefined,\n\t\t\t\ticon,\n\t\t\t},\n\t\t];\n\t\tif ( mediaType === 'image' && mediaLink ) {\n\t\t\tlinkDestinations.push( {\n\t\t\t\tlinkDestination: LINK_DESTINATION_ATTACHMENT,\n\t\t\t\ttitle: __( 'Attachment Page' ),\n\t\t\t\turl: mediaType === 'image' ? mediaLink : undefined,\n\t\t\t\ticon: (\n\t\t\t\t\t<SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t\t\t\t\t<Path d=\"M0 0h24v24H0V0z\" fill=\"none\" />\n\t\t\t\t\t\t<Path d=\"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z\" />\n\t\t\t\t\t</SVG>\n\t\t\t\t),\n\t\t\t} );\n\t\t}\n\t\treturn linkDestinations;\n\t};\n\n\tconst onSetHref = ( value ) => {\n\t\tconst linkDestinations = getLinkDestinations();\n\t\tlet linkDestinationInput;\n\t\tif ( ! value ) {\n\t\t\tlinkDestinationInput = LINK_DESTINATION_NONE;\n\t\t} else {\n\t\t\tlinkDestinationInput = (\n\t\t\t\tlinkDestinations.find( ( destination ) => {\n\t\t\t\t\treturn destination.url === value;\n\t\t\t\t} ) || { linkDestination: LINK_DESTINATION_CUSTOM }\n\t\t\t).linkDestination;\n\t\t}\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: linkDestinationInput,\n\t\t\thref: value,\n\t\t} );\n\t};\n\n\tconst onSetNewTab = ( value ) => {\n\t\tconst updatedLinkTarget = getUpdatedLinkTargetSettings( value );\n\t\tonChangeUrl( updatedLinkTarget );\n\t};\n\n\tconst onSetLinkRel = ( value ) => {\n\t\tonChangeUrl( { rel: value } );\n\t};\n\n\tconst onSetLinkClass = ( value ) => {\n\t\tonChangeUrl( { linkClass: value } );\n\t};\n\n\tconst advancedOptions = (\n\t\t<>\n\t\t\t<ToggleControl\n\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\tonChange={ onSetNewTab }\n\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\tvalue={ rel ?? '' }\n\t\t\t\tonChange={ onSetLinkRel }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\tlabel={ __( 'Link CSS Class' ) }\n\t\t\t\tvalue={ linkClass || '' }\n\t\t\t\tonChange={ onSetLinkClass }\n\t\t\t/>\n\t\t</>\n\t);\n\n\tconst linkEditorValue = urlInput !== null ? urlInput : url;\n\n\tconst urlLabel = (\n\t\tgetLinkDestinations().find(\n\t\t\t( destination ) => destination.linkDestination === linkDestination\n\t\t) || {}\n\t).title;\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ linkIcon }\n\t\t\t\tclassName=\"components-toolbar__control\"\n\t\t\t\tlabel={ url ? __( 'Edit link' ) : __( 'Insert link' ) }\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t\tonClick={ openLinkUI }\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t/>\n\t\t\t{ isOpen && (\n\t\t\t\t<URLPopover\n\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\tonFocusOutside={ onFocusOutside() }\n\t\t\t\t\tonClose={ closeLinkUI }\n\t\t\t\t\trenderSettings={ () => advancedOptions }\n\t\t\t\t\tadditionalControls={\n\t\t\t\t\t\t! linkEditorValue && (\n\t\t\t\t\t\t\t<NavigableMenu>\n\t\t\t\t\t\t\t\t{ map( getLinkDestinations(), ( link ) => (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tkey={ link.linkDestination }\n\t\t\t\t\t\t\t\t\t\ticon={ link.icon }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetUrlInput( null );\n\t\t\t\t\t\t\t\t\t\t\tonSetHref( link.url );\n\t\t\t\t\t\t\t\t\t\t\tstopEditLink();\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{ link.title }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t</NavigableMenu>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ ( ! url || isEditingLink ) && (\n\t\t\t\t\t\t<URLPopover.LinkEditor\n\t\t\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\t\t\tvalue={ linkEditorValue }\n\t\t\t\t\t\t\tonChangeInputValue={ setUrlInput }\n\t\t\t\t\t\t\tonSubmit={ onSubmitLinkChange() }\n\t\t\t\t\t\t\tautocompleteRef={ autocompleteRef }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ url && ! isEditingLink && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<URLPopover.LinkViewer\n\t\t\t\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\tonEditLinkClick={ startEditLink }\n\t\t\t\t\t\t\t\turlLabel={ urlLabel }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ticon={ close }\n\t\t\t\t\t\t\t\tlabel={ __( 'Remove link' ) }\n\t\t\t\t\t\t\t\tonClick={ onLinkRemove }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</URLPopover>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\nexport { ImageURLInputUI as __experimentalImageURLInputUI };\n"]}
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { useSelect } from '@wordpress/data';
5
- import { store as blocksStore } from '@wordpress/blocks';
5
+ import { store as blocksStore, isReusableBlock, isTemplatePart } from '@wordpress/blocks';
6
6
  /**
7
7
  * Internal dependencies
8
8
  */
@@ -15,10 +15,11 @@ import { store as blockEditorStore } from '../../store';
15
15
  *
16
16
  * @typedef {Object} WPBlockDisplayInformation
17
17
  *
18
- * @property {string} title Human-readable block type label.
19
- * @property {WPIcon} icon Block type icon.
20
- * @property {string} description A detailed block type description.
21
- * @property {string} anchor HTML anchor.
18
+ * @property {boolean} isSynced True if is a reusable block or template part
19
+ * @property {string} title Human-readable block type label.
20
+ * @property {WPIcon} icon Block type icon.
21
+ * @property {string} description A detailed block type description.
22
+ * @property {string} anchor HTML anchor.
22
23
  */
23
24
 
24
25
  /**
@@ -52,7 +53,9 @@ export default function useBlockDisplayInformation(clientId) {
52
53
  if (!blockType) return null;
53
54
  const attributes = getBlockAttributes(clientId);
54
55
  const match = getActiveBlockVariation(blockName, attributes);
56
+ const isSynced = isReusableBlock(blockType) || isTemplatePart(blockType);
55
57
  const blockTypeInfo = {
58
+ isSynced,
56
59
  title: blockType.title,
57
60
  icon: blockType.icon,
58
61
  description: blockType.description,
@@ -60,6 +63,7 @@ export default function useBlockDisplayInformation(clientId) {
60
63
  };
61
64
  if (!match) return blockTypeInfo;
62
65
  return {
66
+ isSynced,
63
67
  title: match.title || blockType.title,
64
68
  icon: match.icon || blockType.icon,
65
69
  description: match.description || blockType.description,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/use-block-display-information/index.js"],"names":["useSelect","store","blocksStore","blockEditorStore","useBlockDisplayInformation","clientId","select","getBlockName","getBlockAttributes","getBlockType","getActiveBlockVariation","blockName","blockType","attributes","match","blockTypeInfo","title","icon","description","anchor"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SA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K,CAACG,IAAN,IAAcL,SAAS,CAACK,IAFxB;AAGNC,MAAAA,WAAW,EAAEJ,KAAK,CAACI,WAAN,IAAqBN,SAAS,CAACM,WAHtC;AAINC,MAAAA,MAAM,EAAEN,UAAF,aAAEA,UAAF,uBAAEA,UAAU,CAAEM;AAJd,KAAP;AAMA,GA1Bc,EA2Bf,CAAEd,QAAF,CA3Be,CAAhB;AA6BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as blocksStore } 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 {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 variaton 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 blockTypeInfo = {\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\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":["useSelect","store","blocksStore","isReusableBlock","isTemplatePart","blockEditorStore","useBlockDisplayInformation","clientId","select","getBlockName","getBlockAttributes","getBlockType","getActiveBlockVariation","blockName","blockType","attributes","match","isSynced","blockTypeInfo","title","icon","description","anchor"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SACCC,KAAK,IAAIC,WADV,EAECC,eAFD,EAGCC,cAHD,QAIO,mBAJP;AAMA;AACA;AACA;;AACA,SAASH,KAAK,IAAII,gBAAlB,QAA0C,aAA1C;AAEA;;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;;AAEA,eAAe,SAASC,0BAAT,CAAqCC,QAArC,EAAgD;AAC9D,SAAOP,SAAS,CACbQ,MAAF,IAAc;AACb,QAAK,CAAED,QAAP,EAAkB,OAAO,IAAP;AAClB,UAAM;AAAEE,MAAAA,YAAF;AAAgBC,MAAAA;AAAhB,QACLF,MAAM,CAAEH,gBAAF,CADP;AAEA,UAAM;AAAEM,MAAAA,YAAF;AAAgBC,MAAAA;AAAhB,QACLJ,MAAM,CAAEN,WAAF,CADP;AAEA,UAAMW,SAAS,GAAGJ,YAAY,CAAEF,QAAF,CAA9B;AACA,UAAMO,SAAS,GAAGH,YAAY,CAAEE,SAAF,CAA9B;AACA,QAAK,CAAEC,SAAP,EAAmB,OAAO,IAAP;AACnB,UAAMC,UAAU,GAAGL,kBAAkB,CAAEH,QAAF,CAArC;AACA,UAAMS,KAAK,GAAGJ,uBAAuB,CAAEC,SAAF,EAAaE,UAAb,CAArC;AACA,UAAME,QAAQ,GACbd,eAAe,CAAEW,SAAF,CAAf,IAAgCV,cAAc,CAAEU,SAAF,CAD/C;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,UAAF,aAAEA,UAAF,uBAAEA,UAAU,CAAEO;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,UAAF,aAAEA,UAAF,uBAAEA,UAAU,CAAEO;AALd,KAAP;AAOA,GA9Bc,EA+Bf,CAAEf,QAAF,CA/Be,CAAhB;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 variaton 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"]}
@@ -8,6 +8,7 @@ import { get } from 'lodash';
8
8
 
9
9
  import { useSelect } from '@wordpress/data';
10
10
  import { __EXPERIMENTAL_PATHS_WITH_MERGE as PATHS_WITH_MERGE, hasBlockSupport } from '@wordpress/blocks';
11
+ import { applyFilters } from '@wordpress/hooks';
11
12
  /**
12
13
  * Internal dependencies
13
14
  */
@@ -100,9 +101,15 @@ export default function useSetting(path) {
100
101
  // eslint-disable-next-line no-console
101
102
  console.warn('Top level useSetting paths are disabled. Please use a subpath to query the information needed.');
102
103
  return undefined;
104
+ } // 0. Allow third parties to filter the block's settings at runtime.
105
+
106
+
107
+ let result = applyFilters('blockEditor.useSetting.before', undefined, path, clientId, blockName);
108
+
109
+ if (undefined !== result) {
110
+ return result;
103
111
  }
104
112
 
105
- let result;
106
113
  const normalizedPath = removeCustomPrefixes(path); // 1. Take settings from the block instance or its ancestors.
107
114
  // Start from the current block and work our way up the ancestors.
108
115
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/use-setting/index.js"],"names":["get","useSelect","__EXPERIMENTAL_PATHS_WITH_MERGE","PATHS_WITH_MERGE","hasBlockSupport","useBlockEditContext","store","blockEditorStore","blockedPaths","deprecatedFlags","settings","colors","gradients","disableCustomColors","undefined","disableCustomGradients","fontSizes","disableCustomFontSizes","enableCustomLineHeight","enableCustomUnits","enableCustomSpacing","prefixedFlags","removeCustomPrefixes","path","useSetting","name","blockName","clientId","select","includes","console","warn","result","normalizedPath","candidates","getBlockParents","candidateClientId","candidateBlockName","getBlockName","candidateAtts","getBlockAttributes","getSettings","defaultsPath","blockPath","custom","theme","default","deprecatedSettingsValue"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,+BAA+B,IAAIC,gBADpC,EAECC,eAFD,QAGO,mBAHP;AAKA;AACA;AACA;;AACA,SAASC,mBAAT,QAAoC,eAApC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QA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AvB,CApFe,CAAhB;AAsFA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__EXPERIMENTAL_PATHS_WITH_MERGE as PATHS_WITH_MERGE,\n\thasBlockSupport,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit';\nimport { store as blockEditorStore } from '../../store';\n\nconst blockedPaths = [\n\t'color',\n\t'border',\n\t'dimensions',\n\t'typography',\n\t'spacing',\n];\n\nconst deprecatedFlags = {\n\t'color.palette': ( settings ) => settings.colors,\n\t'color.gradients': ( settings ) => settings.gradients,\n\t'color.custom': ( settings ) =>\n\t\tsettings.disableCustomColors === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomColors,\n\t'color.customGradient': ( settings ) =>\n\t\tsettings.disableCustomGradients === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomGradients,\n\t'typography.fontSizes': ( settings ) => settings.fontSizes,\n\t'typography.customFontSize': ( settings ) =>\n\t\tsettings.disableCustomFontSizes === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomFontSizes,\n\t'typography.lineHeight': ( settings ) => settings.enableCustomLineHeight,\n\t'spacing.units': ( settings ) => {\n\t\tif ( settings.enableCustomUnits === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( settings.enableCustomUnits === true ) {\n\t\t\treturn [ 'px', 'em', 'rem', 'vh', 'vw', '%' ];\n\t\t}\n\n\t\treturn settings.enableCustomUnits;\n\t},\n\t'spacing.padding': ( settings ) => settings.enableCustomSpacing,\n};\n\nconst prefixedFlags = {\n\t/*\n\t * These were only available in the plugin\n\t * and can be removed when the minimum WordPress version\n\t * for the plugin is 5.9.\n\t */\n\t'border.customColor': 'border.color',\n\t'border.customStyle': 'border.style',\n\t'border.customWidth': 'border.width',\n\t'typography.customFontStyle': 'typography.fontStyle',\n\t'typography.customFontWeight': 'typography.fontWeight',\n\t'typography.customLetterSpacing': 'typography.letterSpacing',\n\t'typography.customTextDecorations': 'typography.textDecoration',\n\t'typography.customTextTransforms': 'typography.textTransform',\n\t/*\n\t * These were part of WordPress 5.8 and we need to keep them.\n\t */\n\t'border.customRadius': 'border.radius',\n\t'spacing.customMargin': 'spacing.margin',\n\t'spacing.customPadding': 'spacing.padding',\n\t'typography.customLineHeight': 'typography.lineHeight',\n};\n\n/**\n * Remove `custom` prefixes for flags that did not land in 5.8.\n *\n * This provides continued support for `custom` prefixed properties. It will\n * be removed once third party devs have had sufficient time to update themes,\n * plugins, etc.\n *\n * @see https://github.com/WordPress/gutenberg/pull/34485\n *\n * @param {string} path Path to desired value in settings.\n * @return {string} The value for defined setting.\n */\nconst removeCustomPrefixes = ( path ) => {\n\treturn prefixedFlags[ path ] || path;\n};\n\n/**\n * Hook that retrieves the given setting for the block instance in use.\n *\n * It looks up the settings first in the block instance hierarchy.\n * If none is found, it'll look it up in the block editor store.\n *\n * @param {string} path The path to the setting.\n * @return {any} Returns the value defined for the setting.\n * @example\n * ```js\n * const isEnabled = useSetting( 'typography.dropCap' );\n * ```\n */\nexport default function useSetting( path ) {\n\tconst { name: blockName, clientId } = useBlockEditContext();\n\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tif ( blockedPaths.includes( path ) ) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'Top level useSetting paths are disabled. Please use a subpath to query the information needed.'\n\t\t\t\t);\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tlet result;\n\n\t\t\tconst normalizedPath = removeCustomPrefixes( path );\n\n\t\t\t// 1. Take settings from the block instance or its ancestors.\n\t\t\t// Start from the current block and work our way up the ancestors.\n\t\t\tconst candidates = [\n\t\t\t\tclientId,\n\t\t\t\t...select( blockEditorStore ).getBlockParents(\n\t\t\t\t\tclientId,\n\t\t\t\t\t/* ascending */ true\n\t\t\t\t),\n\t\t\t];\n\n\t\t\tfor ( const candidateClientId of candidates ) {\n\t\t\t\tconst candidateBlockName =\n\t\t\t\t\tselect( blockEditorStore ).getBlockName(\n\t\t\t\t\t\tcandidateClientId\n\t\t\t\t\t);\n\t\t\t\tif (\n\t\t\t\t\thasBlockSupport(\n\t\t\t\t\t\tcandidateBlockName,\n\t\t\t\t\t\t'__experimentalSettings',\n\t\t\t\t\t\tfalse\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tconst candidateAtts =\n\t\t\t\t\t\tselect( blockEditorStore ).getBlockAttributes(\n\t\t\t\t\t\t\tcandidateClientId\n\t\t\t\t\t\t);\n\t\t\t\t\tresult =\n\t\t\t\t\t\tget(\n\t\t\t\t\t\t\tcandidateAtts,\n\t\t\t\t\t\t\t`settings.blocks.${ blockName }.${ normalizedPath }`\n\t\t\t\t\t\t) ??\n\t\t\t\t\t\tget( candidateAtts, `settings.${ normalizedPath }` );\n\t\t\t\t\tif ( result !== undefined ) {\n\t\t\t\t\t\t// Stop the search for more distant ancestors and move on.\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// 2. Fall back to the settings from the block editor store (__experimentalFeatures).\n\t\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\t\tif ( result === undefined ) {\n\t\t\t\tconst defaultsPath = `__experimentalFeatures.${ normalizedPath }`;\n\t\t\t\tconst blockPath = `__experimentalFeatures.blocks.${ blockName }.${ normalizedPath }`;\n\t\t\t\tresult =\n\t\t\t\t\tget( settings, blockPath ) ?? get( settings, defaultsPath );\n\t\t\t}\n\n\t\t\t// Return if the setting was found in either the block instance or the store.\n\t\t\tif ( result !== undefined ) {\n\t\t\t\tif ( PATHS_WITH_MERGE[ normalizedPath ] ) {\n\t\t\t\t\treturn result.custom ?? result.theme ?? result.default;\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\t// 3. Otherwise, use deprecated settings.\n\t\t\tconst deprecatedSettingsValue = deprecatedFlags[ normalizedPath ]\n\t\t\t\t? deprecatedFlags[ normalizedPath ]( settings )\n\t\t\t\t: undefined;\n\t\t\tif ( deprecatedSettingsValue !== undefined ) {\n\t\t\t\treturn deprecatedSettingsValue;\n\t\t\t}\n\n\t\t\t// 4. Fallback for typography.dropCap:\n\t\t\t// This is only necessary to support typography.dropCap.\n\t\t\t// when __experimentalFeatures are not present (core without plugin).\n\t\t\t// To remove when __experimentalFeatures are ported to core.\n\t\t\treturn normalizedPath === 'typography.dropCap' ? true : undefined;\n\t\t},\n\t\t[ blockName, clientId, path ]\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/use-setting/index.js"],"names":["get","useSelect","__EXPERIMENTAL_PATHS_WITH_MERGE","PATHS_WITH_MERGE","hasBlockSupport","applyFilters","useBlockEditContext","store","blockEditorStore","blockedPaths","deprecatedFlags","settings","colors","gradients","disableCustomColors","undefined","disableCustomGradients","fontSizes","disableCustomFontSizes","enableCustomLineHeight","enableCustomUnits","enableCustomSpacing","prefixedFlags","removeCustomPrefixes","path","useSetting","name","blockName","clientId","select","includes","console","warn","result","normalizedPath","candidates","getBlockParents","candidateClientId","candidateBlockName","getBlockName","candidateAtts","getBlockAttributes","getSettings","defaultsPath","blockPath","custom","theme","default","deprecatedSettingsValue"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,+BAA+B,IAAIC,gBADpC,EAECC,eAFD,QAGO,mBAHP;AAIA,SAASC,YAAT,QAA6B,kBAA7B;AAEA;AACA;AACA;;AACA,SAASC,mBAAT,QAAoC,eAApC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,MAAMC,YAAY,GAAG,CACpB,OADoB,EAEpB,QAFoB,EAGpB,YAHoB,EAIpB,YAJoB,EAKpB,SALoB,CAArB;AAQA,MAAMC,eAAe,GAAG;AACvB,m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AAEY,SAAF,EAAaC,QAAb,EAAuBJ,IAAvB,CA/Fe,CAAhB;AAiGA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__EXPERIMENTAL_PATHS_WITH_MERGE as PATHS_WITH_MERGE,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { applyFilters } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit';\nimport { store as blockEditorStore } from '../../store';\n\nconst blockedPaths = [\n\t'color',\n\t'border',\n\t'dimensions',\n\t'typography',\n\t'spacing',\n];\n\nconst deprecatedFlags = {\n\t'color.palette': ( settings ) => settings.colors,\n\t'color.gradients': ( settings ) => settings.gradients,\n\t'color.custom': ( settings ) =>\n\t\tsettings.disableCustomColors === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomColors,\n\t'color.customGradient': ( settings ) =>\n\t\tsettings.disableCustomGradients === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomGradients,\n\t'typography.fontSizes': ( settings ) => settings.fontSizes,\n\t'typography.customFontSize': ( settings ) =>\n\t\tsettings.disableCustomFontSizes === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomFontSizes,\n\t'typography.lineHeight': ( settings ) => settings.enableCustomLineHeight,\n\t'spacing.units': ( settings ) => {\n\t\tif ( settings.enableCustomUnits === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( settings.enableCustomUnits === true ) {\n\t\t\treturn [ 'px', 'em', 'rem', 'vh', 'vw', '%' ];\n\t\t}\n\n\t\treturn settings.enableCustomUnits;\n\t},\n\t'spacing.padding': ( settings ) => settings.enableCustomSpacing,\n};\n\nconst prefixedFlags = {\n\t/*\n\t * These were only available in the plugin\n\t * and can be removed when the minimum WordPress version\n\t * for the plugin is 5.9.\n\t */\n\t'border.customColor': 'border.color',\n\t'border.customStyle': 'border.style',\n\t'border.customWidth': 'border.width',\n\t'typography.customFontStyle': 'typography.fontStyle',\n\t'typography.customFontWeight': 'typography.fontWeight',\n\t'typography.customLetterSpacing': 'typography.letterSpacing',\n\t'typography.customTextDecorations': 'typography.textDecoration',\n\t'typography.customTextTransforms': 'typography.textTransform',\n\t/*\n\t * These were part of WordPress 5.8 and we need to keep them.\n\t */\n\t'border.customRadius': 'border.radius',\n\t'spacing.customMargin': 'spacing.margin',\n\t'spacing.customPadding': 'spacing.padding',\n\t'typography.customLineHeight': 'typography.lineHeight',\n};\n\n/**\n * Remove `custom` prefixes for flags that did not land in 5.8.\n *\n * This provides continued support for `custom` prefixed properties. It will\n * be removed once third party devs have had sufficient time to update themes,\n * plugins, etc.\n *\n * @see https://github.com/WordPress/gutenberg/pull/34485\n *\n * @param {string} path Path to desired value in settings.\n * @return {string} The value for defined setting.\n */\nconst removeCustomPrefixes = ( path ) => {\n\treturn prefixedFlags[ path ] || path;\n};\n\n/**\n * Hook that retrieves the given setting for the block instance in use.\n *\n * It looks up the settings first in the block instance hierarchy.\n * If none is found, it'll look it up in the block editor store.\n *\n * @param {string} path The path to the setting.\n * @return {any} Returns the value defined for the setting.\n * @example\n * ```js\n * const isEnabled = useSetting( 'typography.dropCap' );\n * ```\n */\nexport default function useSetting( path ) {\n\tconst { name: blockName, clientId } = useBlockEditContext();\n\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tif ( blockedPaths.includes( path ) ) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'Top level useSetting paths are disabled. Please use a subpath to query the information needed.'\n\t\t\t\t);\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\t// 0. Allow third parties to filter the block's settings at runtime.\n\t\t\tlet result = applyFilters(\n\t\t\t\t'blockEditor.useSetting.before',\n\t\t\t\tundefined,\n\t\t\t\tpath,\n\t\t\t\tclientId,\n\t\t\t\tblockName\n\t\t\t);\n\n\t\t\tif ( undefined !== result ) {\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tconst normalizedPath = removeCustomPrefixes( path );\n\n\t\t\t// 1. Take settings from the block instance or its ancestors.\n\t\t\t// Start from the current block and work our way up the ancestors.\n\t\t\tconst candidates = [\n\t\t\t\tclientId,\n\t\t\t\t...select( blockEditorStore ).getBlockParents(\n\t\t\t\t\tclientId,\n\t\t\t\t\t/* ascending */ true\n\t\t\t\t),\n\t\t\t];\n\n\t\t\tfor ( const candidateClientId of candidates ) {\n\t\t\t\tconst candidateBlockName =\n\t\t\t\t\tselect( blockEditorStore ).getBlockName(\n\t\t\t\t\t\tcandidateClientId\n\t\t\t\t\t);\n\t\t\t\tif (\n\t\t\t\t\thasBlockSupport(\n\t\t\t\t\t\tcandidateBlockName,\n\t\t\t\t\t\t'__experimentalSettings',\n\t\t\t\t\t\tfalse\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tconst candidateAtts =\n\t\t\t\t\t\tselect( blockEditorStore ).getBlockAttributes(\n\t\t\t\t\t\t\tcandidateClientId\n\t\t\t\t\t\t);\n\t\t\t\t\tresult =\n\t\t\t\t\t\tget(\n\t\t\t\t\t\t\tcandidateAtts,\n\t\t\t\t\t\t\t`settings.blocks.${ blockName }.${ normalizedPath }`\n\t\t\t\t\t\t) ??\n\t\t\t\t\t\tget( candidateAtts, `settings.${ normalizedPath }` );\n\t\t\t\t\tif ( result !== undefined ) {\n\t\t\t\t\t\t// Stop the search for more distant ancestors and move on.\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// 2. Fall back to the settings from the block editor store (__experimentalFeatures).\n\t\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\t\tif ( result === undefined ) {\n\t\t\t\tconst defaultsPath = `__experimentalFeatures.${ normalizedPath }`;\n\t\t\t\tconst blockPath = `__experimentalFeatures.blocks.${ blockName }.${ normalizedPath }`;\n\t\t\t\tresult =\n\t\t\t\t\tget( settings, blockPath ) ?? get( settings, defaultsPath );\n\t\t\t}\n\n\t\t\t// Return if the setting was found in either the block instance or the store.\n\t\t\tif ( result !== undefined ) {\n\t\t\t\tif ( PATHS_WITH_MERGE[ normalizedPath ] ) {\n\t\t\t\t\treturn result.custom ?? result.theme ?? result.default;\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\t// 3. Otherwise, use deprecated settings.\n\t\t\tconst deprecatedSettingsValue = deprecatedFlags[ normalizedPath ]\n\t\t\t\t? deprecatedFlags[ normalizedPath ]( settings )\n\t\t\t\t: undefined;\n\t\t\tif ( deprecatedSettingsValue !== undefined ) {\n\t\t\t\treturn deprecatedSettingsValue;\n\t\t\t}\n\n\t\t\t// 4. Fallback for typography.dropCap:\n\t\t\t// This is only necessary to support typography.dropCap.\n\t\t\t// when __experimentalFeatures are not present (core without plugin).\n\t\t\t// To remove when __experimentalFeatures are ported to core.\n\t\t\treturn normalizedPath === 'typography.dropCap' ? true : undefined;\n\t\t},\n\t\t[ blockName, clientId, path ]\n\t);\n}\n"]}
@@ -30,7 +30,7 @@ export function useWritingFlow() {
30
30
  const [before, ref, after] = useTabNav();
31
31
  const hasMultiSelection = useSelect(select => select(blockEditorStore).hasMultiSelection(), []);
32
32
  return [before, useMergeRefs([ref, useInput(), useDragSelection(), useSelectionObserver(), useClickSelection(), useMultiSelection(), useSelectAll(), useArrowNav(), useRefEffect(node => {
33
- node.tabIndex = -1;
33
+ node.tabIndex = 0;
34
34
  node.contentEditable = hasMultiSelection;
35
35
 
36
36
  if (!hasMultiSelection) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/index.js"],"names":["classNames","useSelect","__","useMergeRefs","useRefEffect","forwardRef","useMultiSelection","useTabNav","useArrowNav","useSelectAll","useDragSelection","useSelectionObserver","useClickSelection","useInput","store","blockEditorStore","useWritingFlow","before","ref","after","hasMultiSelection","select","node","tabIndex","contentEditable","classList","add","setAttribute","remove","removeAttribute","WritingFlow","forwarded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ApB;AACAJ,IAAAA,IAAI,CAACK,YAAL,CACC,YADD,EAECzB,EAAE,CAAE,0BAAF,CAFH;AAKA,WAAO,MAAM;AACZoB,MAAAA,IAAI,CAACG,SAAL,CAAeG,MAAf,CAAuB,qBAAvB;AACAN,MAAAA,IAAI,CAACO,eAAL,CAAsB,YAAtB;AACA,KAHD;AAIA,GAnBU,EAoBX,CAAET,iBAAF,CApBW,CATC,CAAF,CAFN,EAkCND,KAlCM,CAAP;AAoCA;;AAED,SAASW,WAAT,OAA8CC,YAA9C,EAA6D;AAAA,MAAvC;AAAEC,IAAAA,QAAF;AAAY,OAAGC;AAAf,GAAuC;AAC5D,QAAM,CAAEhB,MAAF,EAAUC,GAAV,EAAeC,KAAf,IAAyBH,cAAc,EAA7C;AACA,SACC,8BACGC,MADH,EAEC,kCACMgB,KADN;AAEC,IAAA,GAAG,EAAG9B,YAAY,CAAE,CAAEe,GAAF,EAAOa,YAAP,CAAF,CAFnB;AAGC,IAAA,SAAS,EAAG/B,UAAU,CACrBiC,KAAK,CAACC,SADe,EAErB,2BAFqB;AAHvB,MAQGF,QARH,CAFD,EAYGb,KAZH,CADD;AAgBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,eAAed,UAAU,CAAEyB,WAAF,CAAzB","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 = -1;\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":["classNames","useSelect","__","useMergeRefs","useRefEffect","forwardRef","useMultiSelection","useTabNav","useArrowNav","useSelectAll","useDragSelection","useSelectionObserver","useClickSelection","useInput","store","blockEditorStore","useWritingFlow","before","ref","after","hasMultiSelection","select","node","tabIndex","contentEditable","classList","add","setAttribute","remove","removeAttribute","WritingFlow","forwardedRef","children","props","className"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,EAAuBC,YAAvB,QAA2C,oBAA3C;AACA,SAASC,UAAT,QAA2B,oBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,OAAOC,SAAP,MAAsB,eAAtB;AACA,OAAOC,WAAP,MAAwB,iBAAxB;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AACA,OAAOC,gBAAP,MAA6B,sBAA7B;AACA,OAAOC,oBAAP,MAAiC,0BAAjC;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,OAAOC,QAAP,MAAqB,aAArB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,OAAO,SAASC,cAAT,GAA0B;AAChC,QAAM,CAAEC,MAAF,EAAUC,GAAV,EAAeC,KAAf,IAAyBZ,SAAS,EAAxC;AACA,QAAMa,iBAAiB,GAAGnB,SAAS,CAChCoB,MAAF,IAAcA,MAAM,CAAEN,gBAAF,CAAN,CAA2BK,iBAA3B,EADoB,EAElC,EAFkC,CAAnC;AAKA,SAAO,CACNH,MADM,EAENd,YAAY,CAAE,CACbe,GADa,EAEbL,QAAQ,EAFK,EAGbH,gBAAgB,EAHH,EAIbC,oBAAoB,EAJP,EAKbC,iBAAiB,EALJ,EAMbN,iBAAiB,EANJ,EAObG,YAAY,EAPC,EAQbD,WAAW,EARE,EASbJ,YAAY,CACTkB,IAAF,IAAY;AACXA,IAAAA,IAAI,CAACC,QAAL,GAAgB,CAAhB;AACAD,IAAAA,IAAI,CAACE,eAAL,GAAuBJ,iBAAvB;;AAEA,QAAK,CAAEA,iBAAP,EAA2B;AAC1B;AACA;;AAEDE,IAAAA,IAAI,CAACG,SAAL,CAAeC,GAAf,CAAoB,qBAApB;AACAJ,IAAAA,IAAI,CAACK,YAAL,CACC,YADD,EAECzB,EAAE,CAAE,0BAAF,CAFH;AAKA,WAAO,MAAM;AACZoB,MAAAA,IAAI,CAACG,SAAL,CAAeG,MAAf,CAAuB,qBAAvB;AACAN,MAAAA,IAAI,CAACO,eAAL,CAAsB,YAAtB;AACA,KAHD;AAIA,GAnBU,EAoBX,CAAET,iBAAF,CApBW,CATC,CAAF,CAFN,EAkCND,KAlCM,CAAP;AAoCA;;AAED,SAASW,WAAT,OAA8CC,YAA9C,EAA6D;AAAA,MAAvC;AAAEC,IAAAA,QAAF;AAAY,OAAGC;AAAf,GAAuC;AAC5D,QAAM,CAAEhB,MAAF,EAAUC,GAAV,EAAeC,KAAf,IAAyBH,cAAc,EAA7C;AACA,SACC,8BACGC,MADH,EAEC,kCACMgB,KADN;AAEC,IAAA,GAAG,EAAG9B,YAAY,CAAE,CAAEe,GAAF,EAAOa,YAAP,CAAF,CAFnB;AAGC,IAAA,SAAS,EAAG/B,UAAU,CACrBiC,KAAK,CAACC,SADe,EAErB,2BAFqB;AAHvB,MAQGF,QARH,CAFD,EAYGb,KAZH,CADD;AAgBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,eAAed,UAAU,CAAEyB,WAAF,CAAzB","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"]}
@@ -295,7 +295,6 @@ export function BorderPanel(props) {
295
295
  popoverPlacement: "left-start",
296
296
  size: "__unstable-large",
297
297
  value: hydratedBorder,
298
- __experimentalHasMultipleOrigins: true,
299
298
  __experimentalIsRenderedInSidebar: true
300
299
  })), isRadiusSupported && createElement(ToolsPanelItem, {
301
300
  hasValue: () => hasBorderRadiusValue(props),