@wordpress/block-editor 8.2.0 → 8.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (481) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +6 -2
  3. package/build/autocompleters/link.js +78 -0
  4. package/build/autocompleters/link.js.map +1 -0
  5. package/build/components/autocomplete/index.js +3 -1
  6. package/build/components/autocomplete/index.js.map +1 -1
  7. package/build/components/block-actions/index.js +1 -1
  8. package/build/components/block-actions/index.js.map +1 -1
  9. package/build/components/block-breadcrumb/index.js +4 -2
  10. package/build/components/block-breadcrumb/index.js.map +1 -1
  11. package/build/components/block-compare/index.js +2 -2
  12. package/build/components/block-compare/index.js.map +1 -1
  13. package/build/components/block-controls/index.js +1 -1
  14. package/build/components/block-controls/index.js.map +1 -1
  15. package/build/components/block-draggable/index.js +1 -1
  16. package/build/components/block-draggable/index.js.map +1 -1
  17. package/build/components/block-edit/edit.js +1 -1
  18. package/build/components/block-edit/edit.js.map +1 -1
  19. package/build/components/block-list/block-html.js +1 -1
  20. package/build/components/block-list/block-html.js.map +1 -1
  21. package/build/components/block-list/block-invalid-warning.js +1 -1
  22. package/build/components/block-list/block-invalid-warning.js.map +1 -1
  23. package/build/components/block-list/block-list-item.native.js +4 -4
  24. package/build/components/block-list/block-list-item.native.js.map +1 -1
  25. package/build/components/block-list/block-selection-button.native.js +4 -3
  26. package/build/components/block-list/block-selection-button.native.js.map +1 -1
  27. package/build/components/block-list/block.js +1 -1
  28. package/build/components/block-list/block.js.map +1 -1
  29. package/build/components/block-list/block.native.js +5 -5
  30. package/build/components/block-list/block.native.js.map +1 -1
  31. package/build/components/block-list/index.native.js +5 -5
  32. package/build/components/block-list/index.native.js.map +1 -1
  33. package/build/components/block-list/use-block-props/use-block-class-names.js +1 -1
  34. package/build/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
  35. package/build/components/block-media-update-progress/index.native.js +4 -4
  36. package/build/components/block-media-update-progress/index.native.js.map +1 -1
  37. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +3 -3
  38. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  39. package/build/components/block-mobile-toolbar/index.native.js +1 -1
  40. package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
  41. package/build/components/block-mover/mover-description.js +4 -4
  42. package/build/components/block-mover/mover-description.js.map +1 -1
  43. package/build/components/block-mover/mover-description.native.js +5 -5
  44. package/build/components/block-mover/mover-description.native.js.map +1 -1
  45. package/build/components/block-settings-menu/block-settings-dropdown.js +7 -12
  46. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  47. package/build/components/block-styles/preview.native.js +1 -1
  48. package/build/components/block-styles/preview.native.js.map +1 -1
  49. package/build/components/block-switcher/index.js +2 -1
  50. package/build/components/block-switcher/index.js.map +1 -1
  51. package/build/components/block-switcher/use-transformed-patterns.js +0 -1
  52. package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
  53. package/build/components/block-title/index.js +7 -62
  54. package/build/components/block-title/index.js.map +1 -1
  55. package/build/components/block-title/use-block-display-title.js +94 -0
  56. package/build/components/block-title/use-block-display-title.js.map +1 -0
  57. package/build/components/block-toolbar/utils.js +9 -1
  58. package/build/components/block-toolbar/utils.js.map +1 -1
  59. package/build/components/block-tools/block-popover.js +1 -1
  60. package/build/components/block-tools/block-popover.js.map +1 -1
  61. package/build/components/block-tools/block-selection-button.js +2 -1
  62. package/build/components/block-tools/block-selection-button.js.map +1 -1
  63. package/build/components/block-types-list/index.native.js +1 -1
  64. package/build/components/block-types-list/index.native.js.map +1 -1
  65. package/build/components/border-radius-control/index.js +2 -2
  66. package/build/components/border-radius-control/index.js.map +1 -1
  67. package/build/components/border-radius-control/utils.js +10 -6
  68. package/build/components/border-radius-control/utils.js.map +1 -1
  69. package/build/components/contrast-checker/index.js +3 -3
  70. package/build/components/contrast-checker/index.js.map +1 -1
  71. package/build/components/convert-to-group-buttons/index.js +1 -1
  72. package/build/components/convert-to-group-buttons/index.js.map +1 -1
  73. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +1 -3
  74. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  75. package/build/components/copy-handler/index.js +3 -3
  76. package/build/components/copy-handler/index.js.map +1 -1
  77. package/build/components/font-sizes/with-font-sizes.js +3 -3
  78. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  79. package/build/components/index.native.js +29 -1
  80. package/build/components/index.native.js.map +1 -1
  81. package/build/components/inserter/block-patterns-tab.js +1 -1
  82. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  83. package/build/components/inserter/block-types-tab.js +1 -1
  84. package/build/components/inserter/block-types-tab.js.map +1 -1
  85. package/build/components/inserter/hooks/use-block-type-impressions.native.js +2 -2
  86. package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  87. package/build/components/inserter/index.js +3 -3
  88. package/build/components/inserter/index.js.map +1 -1
  89. package/build/components/inserter/index.native.js +7 -7
  90. package/build/components/inserter/index.native.js.map +1 -1
  91. package/build/components/inserter/menu.js.map +1 -1
  92. package/build/components/inserter/menu.native.js +3 -3
  93. package/build/components/inserter/menu.native.js.map +1 -1
  94. package/build/components/inserter/quick-inserter.js +1 -1
  95. package/build/components/inserter/quick-inserter.js.map +1 -1
  96. package/build/components/inserter/search-items.js +1 -1
  97. package/build/components/inserter/search-items.js.map +1 -1
  98. package/build/components/inserter/search-results.js +1 -1
  99. package/build/components/inserter/search-results.js.map +1 -1
  100. package/build/components/keyboard-shortcuts/index.js +1 -1
  101. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  102. package/build/components/letter-spacing-control/index.js +3 -3
  103. package/build/components/letter-spacing-control/index.js.map +1 -1
  104. package/build/components/line-height-control/index.js +4 -4
  105. package/build/components/line-height-control/index.js.map +1 -1
  106. package/build/components/line-height-control/index.native.js +3 -1
  107. package/build/components/line-height-control/index.native.js.map +1 -1
  108. package/build/components/link-control/index.js +2 -2
  109. package/build/components/link-control/index.js.map +1 -1
  110. package/build/components/link-control/search-input.js +1 -1
  111. package/build/components/link-control/search-input.js.map +1 -1
  112. package/build/components/link-control/search-results.js +2 -2
  113. package/build/components/link-control/search-results.js.map +1 -1
  114. package/build/components/link-control/use-rich-url-data.js +1 -1
  115. package/build/components/link-control/use-rich-url-data.js.map +1 -1
  116. package/build/components/link-control/use-search-handler.js +2 -2
  117. package/build/components/link-control/use-search-handler.js.map +1 -1
  118. package/build/components/list-view/block-select-button.js +2 -1
  119. package/build/components/list-view/block-select-button.js.map +1 -1
  120. package/build/components/list-view/block.js +1 -1
  121. package/build/components/list-view/block.js.map +1 -1
  122. package/build/components/media-placeholder/index.native.js +7 -5
  123. package/build/components/media-placeholder/index.native.js.map +1 -1
  124. package/build/components/media-replace-flow/index.js +20 -24
  125. package/build/components/media-replace-flow/index.js.map +1 -1
  126. package/build/components/media-upload/index.native.js +4 -3
  127. package/build/components/media-upload/index.native.js.map +1 -1
  128. package/build/components/media-upload-progress/index.native.js +2 -2
  129. package/build/components/media-upload-progress/index.native.js.map +1 -1
  130. package/build/components/navigable-toolbar/index.js +3 -3
  131. package/build/components/navigable-toolbar/index.js.map +1 -1
  132. package/build/components/plain-text/index.native.js +3 -3
  133. package/build/components/plain-text/index.native.js.map +1 -1
  134. package/build/components/rich-text/format-toolbar-container.js +2 -2
  135. package/build/components/rich-text/format-toolbar-container.js.map +1 -1
  136. package/build/components/rich-text/format-toolbar-container.native.js +1 -1
  137. package/build/components/rich-text/format-toolbar-container.native.js.map +1 -1
  138. package/build/components/rich-text/index.native.js +3 -3
  139. package/build/components/rich-text/index.native.js.map +1 -1
  140. package/build/components/rich-text/use-paste-handler.js +7 -11
  141. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  142. package/build/components/url-input/index.js +11 -11
  143. package/build/components/url-input/index.js.map +1 -1
  144. package/build/components/use-moving-animation/index.js +1 -1
  145. package/build/components/use-moving-animation/index.js.map +1 -1
  146. package/build/components/use-on-block-drop/index.js +2 -2
  147. package/build/components/use-on-block-drop/index.js.map +1 -1
  148. package/build/components/writing-flow/use-tab-nav.js +4 -3
  149. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  150. package/build/hooks/align.js +1 -1
  151. package/build/hooks/align.js.map +1 -1
  152. package/build/hooks/anchor.js +1 -1
  153. package/build/hooks/anchor.js.map +1 -1
  154. package/build/hooks/border.js +2 -14
  155. package/build/hooks/border.js.map +1 -1
  156. package/build/hooks/color.js +2 -2
  157. package/build/hooks/color.js.map +1 -1
  158. package/build/hooks/duotone.js +22 -4
  159. package/build/hooks/duotone.js.map +1 -1
  160. package/build/hooks/generated-class-name.js +3 -3
  161. package/build/hooks/generated-class-name.js.map +1 -1
  162. package/build/hooks/lock.js +1 -1
  163. package/build/hooks/lock.js.map +1 -1
  164. package/build/hooks/style.js +5 -2
  165. package/build/hooks/style.js.map +1 -1
  166. package/build/store/actions.js +4 -4
  167. package/build/store/actions.js.map +1 -1
  168. package/build/store/defaults.js +1 -1
  169. package/build/store/defaults.js.map +1 -1
  170. package/build/store/reducer.js +11 -11
  171. package/build/store/reducer.js.map +1 -1
  172. package/build/store/selectors.js +6 -6
  173. package/build/store/selectors.js.map +1 -1
  174. package/build/utils/parse-css-unit-to-px.js +3 -3
  175. package/build/utils/parse-css-unit-to-px.js.map +1 -1
  176. package/build/utils/pasting.js +91 -0
  177. package/build/utils/pasting.js.map +1 -0
  178. package/build/utils/transform-styles/ast/parse.js +5 -5
  179. package/build/utils/transform-styles/ast/parse.js.map +1 -1
  180. package/build/utils/transform-styles/transforms/url-rewrite.js +2 -2
  181. package/build/utils/transform-styles/transforms/url-rewrite.js.map +1 -1
  182. package/build-module/autocompleters/link.js +64 -0
  183. package/build-module/autocompleters/link.js.map +1 -0
  184. package/build-module/components/autocomplete/index.js +2 -1
  185. package/build-module/components/autocomplete/index.js.map +1 -1
  186. package/build-module/components/block-actions/index.js +1 -1
  187. package/build-module/components/block-actions/index.js.map +1 -1
  188. package/build-module/components/block-breadcrumb/index.js +4 -2
  189. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  190. package/build-module/components/block-compare/index.js +2 -2
  191. package/build-module/components/block-compare/index.js.map +1 -1
  192. package/build-module/components/block-controls/index.js +1 -1
  193. package/build-module/components/block-controls/index.js.map +1 -1
  194. package/build-module/components/block-draggable/index.js +1 -1
  195. package/build-module/components/block-draggable/index.js.map +1 -1
  196. package/build-module/components/block-edit/edit.js +1 -1
  197. package/build-module/components/block-edit/edit.js.map +1 -1
  198. package/build-module/components/block-list/block-html.js +1 -1
  199. package/build-module/components/block-list/block-html.js.map +1 -1
  200. package/build-module/components/block-list/block-invalid-warning.js +1 -1
  201. package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
  202. package/build-module/components/block-list/block-list-item.native.js +4 -4
  203. package/build-module/components/block-list/block-list-item.native.js.map +1 -1
  204. package/build-module/components/block-list/block-selection-button.native.js +4 -3
  205. package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
  206. package/build-module/components/block-list/block.js +1 -1
  207. package/build-module/components/block-list/block.js.map +1 -1
  208. package/build-module/components/block-list/block.native.js +5 -5
  209. package/build-module/components/block-list/block.native.js.map +1 -1
  210. package/build-module/components/block-list/index.native.js +5 -5
  211. package/build-module/components/block-list/index.native.js.map +1 -1
  212. package/build-module/components/block-list/use-block-props/use-block-class-names.js +1 -1
  213. package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
  214. package/build-module/components/block-media-update-progress/index.native.js +4 -4
  215. package/build-module/components/block-media-update-progress/index.native.js.map +1 -1
  216. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +3 -3
  217. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  218. package/build-module/components/block-mobile-toolbar/index.native.js +1 -1
  219. package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
  220. package/build-module/components/block-mover/mover-description.js +4 -4
  221. package/build-module/components/block-mover/mover-description.js.map +1 -1
  222. package/build-module/components/block-mover/mover-description.native.js +5 -5
  223. package/build-module/components/block-mover/mover-description.native.js.map +1 -1
  224. package/build-module/components/block-settings-menu/block-settings-dropdown.js +7 -13
  225. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  226. package/build-module/components/block-styles/preview.native.js +1 -1
  227. package/build-module/components/block-styles/preview.native.js.map +1 -1
  228. package/build-module/components/block-switcher/index.js +2 -1
  229. package/build-module/components/block-switcher/index.js.map +1 -1
  230. package/build-module/components/block-switcher/use-transformed-patterns.js +0 -1
  231. package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
  232. package/build-module/components/block-title/index.js +7 -58
  233. package/build-module/components/block-title/index.js.map +1 -1
  234. package/build-module/components/block-title/use-block-display-title.js +80 -0
  235. package/build-module/components/block-title/use-block-display-title.js.map +1 -0
  236. package/build-module/components/block-toolbar/utils.js +9 -1
  237. package/build-module/components/block-toolbar/utils.js.map +1 -1
  238. package/build-module/components/block-tools/block-popover.js +1 -1
  239. package/build-module/components/block-tools/block-popover.js.map +1 -1
  240. package/build-module/components/block-tools/block-selection-button.js +2 -1
  241. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  242. package/build-module/components/block-types-list/index.native.js +1 -1
  243. package/build-module/components/block-types-list/index.native.js.map +1 -1
  244. package/build-module/components/border-radius-control/index.js +3 -3
  245. package/build-module/components/border-radius-control/index.js.map +1 -1
  246. package/build-module/components/border-radius-control/utils.js +11 -7
  247. package/build-module/components/border-radius-control/utils.js.map +1 -1
  248. package/build-module/components/contrast-checker/index.js +3 -3
  249. package/build-module/components/contrast-checker/index.js.map +1 -1
  250. package/build-module/components/convert-to-group-buttons/index.js +1 -1
  251. package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
  252. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +1 -3
  253. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  254. package/build-module/components/copy-handler/index.js +2 -2
  255. package/build-module/components/copy-handler/index.js.map +1 -1
  256. package/build-module/components/font-sizes/with-font-sizes.js +3 -3
  257. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  258. package/build-module/components/index.native.js +4 -4
  259. package/build-module/components/index.native.js.map +1 -1
  260. package/build-module/components/inserter/block-patterns-tab.js +1 -1
  261. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  262. package/build-module/components/inserter/block-types-tab.js +1 -1
  263. package/build-module/components/inserter/block-types-tab.js.map +1 -1
  264. package/build-module/components/inserter/hooks/use-block-type-impressions.native.js +2 -2
  265. package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  266. package/build-module/components/inserter/index.js +3 -3
  267. package/build-module/components/inserter/index.js.map +1 -1
  268. package/build-module/components/inserter/index.native.js +7 -7
  269. package/build-module/components/inserter/index.native.js.map +1 -1
  270. package/build-module/components/inserter/menu.js.map +1 -1
  271. package/build-module/components/inserter/menu.native.js +3 -3
  272. package/build-module/components/inserter/menu.native.js.map +1 -1
  273. package/build-module/components/inserter/quick-inserter.js +1 -1
  274. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  275. package/build-module/components/inserter/search-items.js +1 -1
  276. package/build-module/components/inserter/search-items.js.map +1 -1
  277. package/build-module/components/inserter/search-results.js +1 -1
  278. package/build-module/components/inserter/search-results.js.map +1 -1
  279. package/build-module/components/keyboard-shortcuts/index.js +1 -1
  280. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  281. package/build-module/components/letter-spacing-control/index.js +3 -3
  282. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  283. package/build-module/components/line-height-control/index.js +4 -4
  284. package/build-module/components/line-height-control/index.js.map +1 -1
  285. package/build-module/components/line-height-control/index.native.js +3 -1
  286. package/build-module/components/line-height-control/index.native.js.map +1 -1
  287. package/build-module/components/link-control/index.js +2 -2
  288. package/build-module/components/link-control/index.js.map +1 -1
  289. package/build-module/components/link-control/search-input.js +1 -1
  290. package/build-module/components/link-control/search-input.js.map +1 -1
  291. package/build-module/components/link-control/search-results.js +2 -2
  292. package/build-module/components/link-control/search-results.js.map +1 -1
  293. package/build-module/components/link-control/use-rich-url-data.js +1 -1
  294. package/build-module/components/link-control/use-rich-url-data.js.map +1 -1
  295. package/build-module/components/link-control/use-search-handler.js +2 -2
  296. package/build-module/components/link-control/use-search-handler.js.map +1 -1
  297. package/build-module/components/list-view/block-select-button.js +2 -1
  298. package/build-module/components/list-view/block-select-button.js.map +1 -1
  299. package/build-module/components/list-view/block.js +1 -1
  300. package/build-module/components/list-view/block.js.map +1 -1
  301. package/build-module/components/media-placeholder/index.native.js +7 -5
  302. package/build-module/components/media-placeholder/index.native.js.map +1 -1
  303. package/build-module/components/media-replace-flow/index.js +22 -27
  304. package/build-module/components/media-replace-flow/index.js.map +1 -1
  305. package/build-module/components/media-upload/index.native.js +4 -3
  306. package/build-module/components/media-upload/index.native.js.map +1 -1
  307. package/build-module/components/media-upload-progress/index.native.js +2 -2
  308. package/build-module/components/media-upload-progress/index.native.js.map +1 -1
  309. package/build-module/components/navigable-toolbar/index.js +3 -3
  310. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  311. package/build-module/components/plain-text/index.native.js +3 -3
  312. package/build-module/components/plain-text/index.native.js.map +1 -1
  313. package/build-module/components/rich-text/format-toolbar-container.js +2 -2
  314. package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
  315. package/build-module/components/rich-text/format-toolbar-container.native.js +1 -1
  316. package/build-module/components/rich-text/format-toolbar-container.native.js.map +1 -1
  317. package/build-module/components/rich-text/index.native.js +3 -3
  318. package/build-module/components/rich-text/index.native.js.map +1 -1
  319. package/build-module/components/rich-text/use-paste-handler.js +6 -11
  320. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  321. package/build-module/components/url-input/index.js +11 -11
  322. package/build-module/components/url-input/index.js.map +1 -1
  323. package/build-module/components/use-moving-animation/index.js +1 -1
  324. package/build-module/components/use-moving-animation/index.js.map +1 -1
  325. package/build-module/components/use-on-block-drop/index.js +2 -2
  326. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  327. package/build-module/components/writing-flow/use-tab-nav.js +4 -3
  328. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  329. package/build-module/hooks/align.js +1 -1
  330. package/build-module/hooks/align.js.map +1 -1
  331. package/build-module/hooks/anchor.js +1 -1
  332. package/build-module/hooks/anchor.js.map +1 -1
  333. package/build-module/hooks/border.js +2 -14
  334. package/build-module/hooks/border.js.map +1 -1
  335. package/build-module/hooks/color.js +2 -2
  336. package/build-module/hooks/color.js.map +1 -1
  337. package/build-module/hooks/duotone.js +23 -5
  338. package/build-module/hooks/duotone.js.map +1 -1
  339. package/build-module/hooks/generated-class-name.js +3 -3
  340. package/build-module/hooks/generated-class-name.js.map +1 -1
  341. package/build-module/hooks/lock.js +1 -1
  342. package/build-module/hooks/lock.js.map +1 -1
  343. package/build-module/hooks/style.js +5 -2
  344. package/build-module/hooks/style.js.map +1 -1
  345. package/build-module/store/actions.js +4 -4
  346. package/build-module/store/actions.js.map +1 -1
  347. package/build-module/store/defaults.js +1 -1
  348. package/build-module/store/defaults.js.map +1 -1
  349. package/build-module/store/reducer.js +11 -11
  350. package/build-module/store/reducer.js.map +1 -1
  351. package/build-module/store/selectors.js +6 -6
  352. package/build-module/store/selectors.js.map +1 -1
  353. package/build-module/utils/parse-css-unit-to-px.js +3 -3
  354. package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
  355. package/build-module/utils/pasting.js +80 -0
  356. package/build-module/utils/pasting.js.map +1 -0
  357. package/build-module/utils/transform-styles/ast/parse.js +5 -5
  358. package/build-module/utils/transform-styles/ast/parse.js.map +1 -1
  359. package/build-module/utils/transform-styles/transforms/url-rewrite.js +2 -2
  360. package/build-module/utils/transform-styles/transforms/url-rewrite.js.map +1 -1
  361. package/build-style/style-rtl.css +7 -0
  362. package/build-style/style.css +7 -0
  363. package/package.json +27 -27
  364. package/src/autocompleters/link.js +62 -0
  365. package/src/autocompleters/style.scss +8 -0
  366. package/src/components/alignment-control/test/index.js +2 -2
  367. package/src/components/autocomplete/index.js +2 -0
  368. package/src/components/block-actions/index.js +1 -1
  369. package/src/components/block-alignment-control/test/index.js +1 -1
  370. package/src/components/block-breadcrumb/index.js +5 -2
  371. package/src/components/block-compare/index.js +2 -2
  372. package/src/components/block-controls/index.js +1 -1
  373. package/src/components/block-draggable/index.js +1 -1
  374. package/src/components/block-draggable/stories/index.js +1 -1
  375. package/src/components/block-edit/edit.js +1 -1
  376. package/src/components/block-list/block-html.js +1 -1
  377. package/src/components/block-list/block-invalid-warning.js +1 -1
  378. package/src/components/block-list/block-list-item.native.js +4 -4
  379. package/src/components/block-list/block-selection-button.native.js +3 -3
  380. package/src/components/block-list/block.js +1 -1
  381. package/src/components/block-list/block.native.js +5 -5
  382. package/src/components/block-list/index.native.js +5 -5
  383. package/src/components/block-list/use-block-props/use-block-class-names.js +1 -1
  384. package/src/components/block-media-update-progress/index.native.js +4 -4
  385. package/src/components/block-media-update-progress/test/index.native.js +2 -2
  386. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +3 -3
  387. package/src/components/block-mobile-toolbar/index.native.js +2 -2
  388. package/src/components/block-mover/mover-description.js +4 -4
  389. package/src/components/block-mover/mover-description.native.js +5 -5
  390. package/src/components/block-settings-menu/block-settings-dropdown.js +7 -8
  391. package/src/components/block-styles/preview.native.js +1 -1
  392. package/src/components/block-switcher/index.js +4 -1
  393. package/src/components/block-switcher/use-transformed-patterns.js +0 -1
  394. package/src/components/block-title/README.md +17 -1
  395. package/src/components/block-title/index.js +7 -62
  396. package/src/components/block-title/test/index.js +21 -3
  397. package/src/components/block-title/use-block-display-title.js +83 -0
  398. package/src/components/block-toolbar/utils.js +12 -2
  399. package/src/components/block-tools/block-popover.js +1 -1
  400. package/src/components/block-tools/block-selection-button.js +4 -1
  401. package/src/components/block-types-list/index.native.js +1 -1
  402. package/src/components/border-radius-control/index.js +5 -3
  403. package/src/components/border-radius-control/test/utils.js +10 -10
  404. package/src/components/border-radius-control/utils.js +10 -8
  405. package/src/components/contrast-checker/index.js +3 -3
  406. package/src/components/convert-to-group-buttons/index.js +1 -1
  407. package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +1 -6
  408. package/src/components/copy-handler/index.js +2 -2
  409. package/src/components/font-sizes/with-font-sizes.js +3 -3
  410. package/src/components/image-size-control/test/index.js +1 -1
  411. package/src/components/index.native.js +10 -4
  412. package/src/components/inserter/block-patterns-tab.js +1 -1
  413. package/src/components/inserter/block-types-tab.js +1 -1
  414. package/src/components/inserter/hooks/use-block-type-impressions.native.js +2 -2
  415. package/src/components/inserter/index.js +3 -3
  416. package/src/components/inserter/index.native.js +7 -7
  417. package/src/components/inserter/menu.js +1 -1
  418. package/src/components/inserter/menu.native.js +3 -3
  419. package/src/components/inserter/quick-inserter.js +1 -1
  420. package/src/components/inserter/search-items.js +1 -1
  421. package/src/components/inserter/search-results.js +1 -1
  422. package/src/components/inserter/test/fixtures/index.native.js +1 -1
  423. package/src/components/inserter/test/reusable-blocks-tab.js +2 -2
  424. package/src/components/justify-content-control/README.md +1 -1
  425. package/src/components/keyboard-shortcuts/index.js +1 -1
  426. package/src/components/letter-spacing-control/index.js +1 -1
  427. package/src/components/line-height-control/index.js +4 -4
  428. package/src/components/line-height-control/index.native.js +2 -0
  429. package/src/components/link-control/index.js +2 -2
  430. package/src/components/link-control/search-input.js +1 -1
  431. package/src/components/link-control/search-results.js +2 -2
  432. package/src/components/link-control/test/index.js +142 -144
  433. package/src/components/link-control/use-rich-url-data.js +1 -1
  434. package/src/components/link-control/use-search-handler.js +2 -2
  435. package/src/components/list-view/block-select-button.js +1 -1
  436. package/src/components/list-view/block.js +1 -1
  437. package/src/components/media-placeholder/index.native.js +11 -9
  438. package/src/components/media-replace-flow/README.md +7 -0
  439. package/src/components/media-replace-flow/index.js +20 -26
  440. package/src/components/media-replace-flow/test/index.js +100 -0
  441. package/src/components/media-upload/index.native.js +3 -2
  442. package/src/components/media-upload-progress/index.native.js +2 -2
  443. package/src/components/navigable-toolbar/index.js +3 -3
  444. package/src/components/plain-text/index.native.js +3 -3
  445. package/src/components/responsive-block-control/test/index.js +6 -6
  446. package/src/components/rich-text/format-toolbar-container.js +2 -2
  447. package/src/components/rich-text/format-toolbar-container.native.js +1 -1
  448. package/src/components/rich-text/index.native.js +3 -3
  449. package/src/components/rich-text/use-paste-handler.js +7 -13
  450. package/src/components/url-input/index.js +11 -11
  451. package/src/components/use-block-drop-zone/test/index.js +1 -1
  452. package/src/components/use-moving-animation/index.js +1 -1
  453. package/src/components/use-on-block-drop/index.js +2 -2
  454. package/src/components/writing-flow/use-tab-nav.js +6 -3
  455. package/src/hooks/align.js +1 -1
  456. package/src/hooks/anchor.js +1 -1
  457. package/src/hooks/border.js +8 -19
  458. package/src/hooks/color.js +2 -2
  459. package/src/hooks/duotone.js +27 -3
  460. package/src/hooks/generated-class-name.js +3 -3
  461. package/src/hooks/lock.js +1 -1
  462. package/src/hooks/style.js +5 -2
  463. package/src/hooks/test/align.js +1 -1
  464. package/src/store/actions.js +4 -4
  465. package/src/store/defaults.js +1 -2
  466. package/src/store/reducer.js +11 -11
  467. package/src/store/selectors.js +6 -6
  468. package/src/store/test/actions.js +1 -1
  469. package/src/store/test/reducer.js +1 -1
  470. package/src/store/test/selectors.js +1 -1
  471. package/src/utils/parse-css-unit-to-px.js +3 -3
  472. package/src/utils/pasting.js +77 -0
  473. package/src/utils/test/parse-css-unit-to-px.js +5 -5
  474. package/src/utils/test/pasting.js +84 -0
  475. package/src/utils/transform-styles/ast/parse.js +5 -5
  476. package/src/utils/transform-styles/transforms/url-rewrite.js +2 -2
  477. package/build/utils/get-paste-event-data.js +0 -56
  478. package/build/utils/get-paste-event-data.js.map +0 -1
  479. package/build-module/utils/get-paste-event-data.js +0 -47
  480. package/build-module/utils/get-paste-event-data.js.map +0 -1
  481. package/src/utils/get-paste-event-data.js +0 -42
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/menu.native.js"],"names":["MIN_ITEMS_FOR_SEARCH","InserterMenu","onSelect","onDismiss","rootClientId","clientId","isAppender","shouldReplaceBlock","insertionIndex","filterValue","setFilterValue","showTabs","setShowTabs","tabIndex","setTabIndex","isIOS","Platform","OS","showInsertionPoint","hideInsertionPoint","clearSelectedBlock","insertBlock","removeBlock","resetBlocks","insertDefaultBlock","blockEditorStore","items","destinationRootClientId","showReusableBlocks","select","getInserterItems","getBlockRootClientId","getBlockSelectionEnd","targetRootClientId","end","undefined","allItems","reusableBlockItems","onlyReusable","length","getBlockOrder","getBlockCount","count","blockToReplace","onClose","onInsert","item","name","initialAttributes","innerBlocks","newBlock","source","onSelectItem","AccessibilityInfo","isScreenReaderEnabled","then","enabled","timeout","setTimeout","onChangeSearch","value","onKeyboardShow","onKeyboardHide","showSearchForm","isFullScreen","styles","listProps"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AACA;;AASA;;AACA;;AACA;;AACA;;AACA;;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;AAOA,MAAMA,oBAAoB,GAAG,CAA7B;;AACA,SAASC,YAAT,OAQI;AAAA,MARmB;AACtBC,IAAAA,QADsB;AAEtBC,IAAAA,SAFsB;AAGtBC,IAAAA,YAHsB;AAItBC,IAAAA,QAJsB;AAKtBC,IAAAA,UALsB;AAMtBC,IAAAA,kBANsB;AAOtBC,IAAAA;AAPsB,GAQnB;AACH,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkC,uBAAU,EAAV,CAAxC;AACA,QAAM,CAAEC,QAAF,EAAYC,WAAZ,IAA4B,uBAAU,IAAV,CAAlC;AACA,QAAM,CAAEC,QAAF,EAAYC,WAAZ,IAA4B,uBAAU,CAAV,CAAlC;AAEA,QAAMC,KAAK,GAAGC,sBAASC,EAAT,KAAgB,KAA9B;AAEA,QAAM;AACLC,IAAAA,kBADK;AAELC,IAAAA,kBAFK;AAGLC,IAAAA,kBAHK;AAILC,IAAAA,WAJK;AAKLC,IAAAA,WALK;AAMLC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BC,IAAA,kBAAkB,EAAG;AAzBtB,KA2BC,4BAAC,+BAAD,QACG;AAAA,QAAE;AAAEE,MAAAA;AAAF,KAAF;AAAA,WACD,4BAAC,+BAAD;AACC,MAAA,UAAU,EAAG,KADd;AAEC,MAAA,KAAK,EAAGD,eAAQ,6BAAR;AAFT,OAIG,CAAEtD,QAAF,IAAcF,WAAd,GACD,4BAAC,sBAAD;AACC,MAAA,YAAY,EAAGL,YADhB;AAEC,MAAA,WAAW,EAAGK,WAFf;AAGC,MAAA,QAAQ,EAAG2C,YAHZ;AAIC,MAAA,SAAS,EAAGc,SAJb;AAKC,MAAA,YAAY,EAAGF;AALhB,MADC,GASD,4BAAC,aAAD;AACC,MAAA,YAAY,EAAG5D,YADhB;AAEC,MAAA,SAAS,EAAG8D,SAFb;AAGC,MAAA,QAAQ,EAAGrD,QAHZ;AAIC,MAAA,QAAQ,EAAGuC,YAJZ;AAKC,MAAA,kBAAkB,EAAGxB;AALtB,MAbF,CADC;AAAA,GADH,CA3BD,CADD;AAwDA;;eAEc3B,Y","sourcesContent":["/**\n * External dependencies\n */\nimport { AccessibilityInfo, TouchableHighlight, Platform } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useState, useCallback } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\tBottomSheet,\n\tBottomSheetConsumer,\n\tSearchControl,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport InserterSearchResults from './search-results';\nimport { store as blockEditorStore } from '../../store';\nimport InserterTabs from './tabs';\nimport styles from './style.scss';\nimport { filterInserterItems } from './utils';\n\nconst MIN_ITEMS_FOR_SEARCH = 2;\nfunction InserterMenu( {\n\tonSelect,\n\tonDismiss,\n\trootClientId,\n\tclientId,\n\tisAppender,\n\tshouldReplaceBlock,\n\tinsertionIndex,\n} ) {\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst [ showTabs, setShowTabs ] = useState( true );\n\tconst [ tabIndex, setTabIndex ] = useState( 0 );\n\n\tconst isIOS = Platform.OS === 'ios';\n\n\tconst {\n\t\tshowInsertionPoint,\n\t\thideInsertionPoint,\n\t\tclearSelectedBlock,\n\t\tinsertBlock,\n\t\tremoveBlock,\n\t\tresetBlocks,\n\t\tinsertDefaultBlock,\n\t} = useDispatch( blockEditorStore );\n\n\tconst { items, destinationRootClientId, showReusableBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetInserterItems,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockSelectionEnd,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tlet targetRootClientId = rootClientId;\n\t\t\tif ( ! targetRootClientId && ! clientId && ! isAppender ) {\n\t\t\t\tconst end = getBlockSelectionEnd();\n\t\t\t\tif ( end ) {\n\t\t\t\t\ttargetRootClientId =\n\t\t\t\t\t\tgetBlockRootClientId( end ) || undefined;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst allItems = getInserterItems( targetRootClientId );\n\t\t\tconst reusableBlockItems = filterInserterItems( allItems, {\n\t\t\t\tonlyReusable: true,\n\t\t\t} );\n\n\t\t\treturn {\n\t\t\t\titems: allItems,\n\t\t\t\tdestinationRootClientId: targetRootClientId,\n\t\t\t\tshowReusableBlocks: !! reusableBlockItems.length,\n\t\t\t};\n\t\t}\n\t);\n\n\tconst { getBlockOrder, getBlockCount } = useSelect( blockEditorStore );\n\n\tuseEffect( () => {\n\t\t// Show/Hide insertion point on Mount/Dismount\n\t\tif ( shouldReplaceBlock ) {\n\t\t\tconst count = getBlockCount();\n\t\t\t// Check if there is a rootClientId because that means it is a nested replaceable block\n\t\t\t// and we don't want to clear/reset all blocks.\n\t\t\tif ( count === 1 && ! rootClientId ) {\n\t\t\t\t// Removing the last block is not possilble with `removeBlock` action.\n\t\t\t\t// It always inserts a default block if the last of the blocks have been removed.\n\t\t\t\tclearSelectedBlock();\n\t\t\t\tresetBlocks( [] );\n\t\t\t} else {\n\t\t\t\tconst blockToReplace = getBlockOrder( destinationRootClientId )[\n\t\t\t\t\tinsertionIndex\n\t\t\t\t];\n\t\t\t\tremoveBlock( blockToReplace, false );\n\t\t\t}\n\t\t}\n\t\tshowInsertionPoint( destinationRootClientId, insertionIndex );\n\n\t\treturn hideInsertionPoint;\n\t}, [] );\n\n\tconst onClose = useCallback( () => {\n\t\t// if should replace but didn't insert any block\n\t\t// re-insert default block\n\t\tif ( shouldReplaceBlock ) {\n\t\t\tinsertDefaultBlock( {}, destinationRootClientId, insertionIndex );\n\t\t}\n\t\tonDismiss();\n\t}, [ shouldReplaceBlock, destinationRootClientId, insertionIndex ] );\n\n\tconst onInsert = useCallback(\n\t\t( item ) => {\n\t\t\tconst { name, initialAttributes, innerBlocks } = item;\n\n\t\t\tconst newBlock = createBlock(\n\t\t\t\tname,\n\t\t\t\tinitialAttributes,\n\t\t\t\tinnerBlocks\n\t\t\t);\n\n\t\t\tinsertBlock(\n\t\t\t\tnewBlock,\n\t\t\t\tinsertionIndex,\n\t\t\t\tdestinationRootClientId,\n\t\t\t\ttrue,\n\t\t\t\t{ source: 'inserter_menu' }\n\t\t\t);\n\t\t},\n\t\t[ insertBlock, destinationRootClientId, insertionIndex ]\n\t);\n\n\tconst onSelectItem = useCallback(\n\t\t( item ) => {\n\t\t\t// Avoid a focus loop, see https://github.com/WordPress/gutenberg/issues/30562\n\t\t\tif ( Platform.OS === 'ios' ) {\n\t\t\t\tAccessibilityInfo.isScreenReaderEnabled().then( ( enabled ) => {\n\t\t\t\t\t// In testing, the bug focus loop needed a longer timeout when VoiceOver was enabled\n\t\t\t\t\tconst timeout = enabled ? 200 : 100;\n\t\t\t\t\t// eslint-disable-next-line @wordpress/react-no-unsafe-timeout\n\t\t\t\t\tsetTimeout( () => {\n\t\t\t\t\t\tonInsert( item );\n\t\t\t\t\t}, timeout );\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tonInsert( item );\n\t\t\t}\n\t\t\tonSelect( item );\n\t\t},\n\t\t[ onInsert, onSelect ]\n\t);\n\n\tconst onChangeSearch = useCallback(\n\t\t( value ) => {\n\t\t\tsetFilterValue( value );\n\t\t},\n\t\t[ setFilterValue ]\n\t);\n\n\tconst onKeyboardShow = useCallback( () => setShowTabs( false ), [\n\t\tsetShowTabs,\n\t] );\n\n\tconst onKeyboardHide = useCallback( () => setShowTabs( true ), [\n\t\tsetShowTabs,\n\t] );\n\n\tconst showSearchForm = items.length > MIN_ITEMS_FOR_SEARCH;\n\tconst isFullScreen = ! isIOS && showSearchForm;\n\n\treturn (\n\t\t<BottomSheet\n\t\t\tisVisible={ true }\n\t\t\tonClose={ onClose }\n\t\t\tonKeyboardShow={ onKeyboardShow }\n\t\t\tonKeyboardHide={ onKeyboardHide }\n\t\t\theader={\n\t\t\t\t<>\n\t\t\t\t\t{ showSearchForm && (\n\t\t\t\t\t\t<SearchControl\n\t\t\t\t\t\t\tonChange={ onChangeSearch }\n\t\t\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showTabs && ! filterValue && (\n\t\t\t\t\t\t<InserterTabs.Control\n\t\t\t\t\t\t\tonChangeTab={ setTabIndex }\n\t\t\t\t\t\t\tshowReusableBlocks={ showReusableBlocks }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t\thasNavigation\n\t\t\tsetMinHeightToMaxHeight={ true }\n\t\t\tcontentStyle={ styles[ 'inserter-menu__list' ] }\n\t\t\tisFullScreen={ isFullScreen }\n\t\t\tallowDragIndicator={ true }\n\t\t>\n\t\t\t<BottomSheetConsumer>\n\t\t\t\t{ ( { listProps } ) => (\n\t\t\t\t\t<TouchableHighlight\n\t\t\t\t\t\taccessible={ false }\n\t\t\t\t\t\tstyle={ styles[ 'inserter-menu__list-wrapper' ] }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! showTabs || filterValue ? (\n\t\t\t\t\t\t\t<InserterSearchResults\n\t\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\t\tfilterValue={ filterValue }\n\t\t\t\t\t\t\t\tonSelect={ onSelectItem }\n\t\t\t\t\t\t\t\tlistProps={ listProps }\n\t\t\t\t\t\t\t\tisFullScreen={ isFullScreen }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<InserterTabs\n\t\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\t\tlistProps={ listProps }\n\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\tonSelect={ onSelectItem }\n\t\t\t\t\t\t\t\tshowReusableBlocks={ showReusableBlocks }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</TouchableHighlight>\n\t\t\t\t) }\n\t\t\t</BottomSheetConsumer>\n\t\t</BottomSheet>\n\t);\n}\n\nexport default InserterMenu;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/menu.native.js"],"names":["MIN_ITEMS_FOR_SEARCH","InserterMenu","onSelect","onDismiss","rootClientId","clientId","isAppender","shouldReplaceBlock","insertionIndex","filterValue","setFilterValue","showTabs","setShowTabs","tabIndex","setTabIndex","isIOS","Platform","OS","showInsertionPoint","hideInsertionPoint","clearSelectedBlock","insertBlock","removeBlock","resetBlocks","insertDefaultBlock","blockEditorStore","items","destinationRootClientId","showReusableBlocks","select","getInserterItems","getBlockRootClientId","getBlockSelectionEnd","targetRootClientId","end","undefined","allItems","reusableBlockItems","onlyReusable","length","getBlockOrder","getBlockCount","count","blockToReplace","onClose","onInsert","item","name","initialAttributes","innerBlocks","newBlock","source","onSelectItem","AccessibilityInfo","isScreenReaderEnabled","then","enabled","timeout","setTimeout","onChangeSearch","value","onKeyboardShow","onKeyboardHide","showSearchForm","isFullScreen","styles","listProps"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AACA;;A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AAGuC,YAJZ;AAKC,MAAA,kBAAkB,EAAGxB;AALtB,MAbF,CADC;AAAA,GADH,CA3BD,CADD;AAwDA;;eAEc3B,Y","sourcesContent":["/**\n * External dependencies\n */\nimport { AccessibilityInfo, TouchableHighlight, Platform } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useState, useCallback } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\tBottomSheet,\n\tBottomSheetConsumer,\n\tSearchControl,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport InserterSearchResults from './search-results';\nimport { store as blockEditorStore } from '../../store';\nimport InserterTabs from './tabs';\nimport styles from './style.scss';\nimport { filterInserterItems } from './utils';\n\nconst MIN_ITEMS_FOR_SEARCH = 2;\nfunction InserterMenu( {\n\tonSelect,\n\tonDismiss,\n\trootClientId,\n\tclientId,\n\tisAppender,\n\tshouldReplaceBlock,\n\tinsertionIndex,\n} ) {\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst [ showTabs, setShowTabs ] = useState( true );\n\tconst [ tabIndex, setTabIndex ] = useState( 0 );\n\n\tconst isIOS = Platform.OS === 'ios';\n\n\tconst {\n\t\tshowInsertionPoint,\n\t\thideInsertionPoint,\n\t\tclearSelectedBlock,\n\t\tinsertBlock,\n\t\tremoveBlock,\n\t\tresetBlocks,\n\t\tinsertDefaultBlock,\n\t} = useDispatch( blockEditorStore );\n\n\tconst { items, destinationRootClientId, showReusableBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetInserterItems,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockSelectionEnd,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tlet targetRootClientId = rootClientId;\n\t\t\tif ( ! targetRootClientId && ! clientId && ! isAppender ) {\n\t\t\t\tconst end = getBlockSelectionEnd();\n\t\t\t\tif ( end ) {\n\t\t\t\t\ttargetRootClientId =\n\t\t\t\t\t\tgetBlockRootClientId( end ) || undefined;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst allItems = getInserterItems( targetRootClientId );\n\t\t\tconst reusableBlockItems = filterInserterItems( allItems, {\n\t\t\t\tonlyReusable: true,\n\t\t\t} );\n\n\t\t\treturn {\n\t\t\t\titems: allItems,\n\t\t\t\tdestinationRootClientId: targetRootClientId,\n\t\t\t\tshowReusableBlocks: !! reusableBlockItems.length,\n\t\t\t};\n\t\t}\n\t);\n\n\tconst { getBlockOrder, getBlockCount } = useSelect( blockEditorStore );\n\n\tuseEffect( () => {\n\t\t// Show/Hide insertion point on Mount/Dismount\n\t\tif ( shouldReplaceBlock ) {\n\t\t\tconst count = getBlockCount();\n\t\t\t// Check if there is a rootClientId because that means it is a nested replaceable block\n\t\t\t// and we don't want to clear/reset all blocks.\n\t\t\tif ( count === 1 && ! rootClientId ) {\n\t\t\t\t// Removing the last block is not possilble with `removeBlock` action.\n\t\t\t\t// It always inserts a default block if the last of the blocks have been removed.\n\t\t\t\tclearSelectedBlock();\n\t\t\t\tresetBlocks( [] );\n\t\t\t} else {\n\t\t\t\tconst blockToReplace = getBlockOrder( destinationRootClientId )[\n\t\t\t\t\tinsertionIndex\n\t\t\t\t];\n\t\t\t\tremoveBlock( blockToReplace, false );\n\t\t\t}\n\t\t}\n\t\tshowInsertionPoint( destinationRootClientId, insertionIndex );\n\n\t\treturn hideInsertionPoint;\n\t}, [] );\n\n\tconst onClose = useCallback( () => {\n\t\t// If should replace but didn't insert any block\n\t\t// re-insert default block.\n\t\tif ( shouldReplaceBlock ) {\n\t\t\tinsertDefaultBlock( {}, destinationRootClientId, insertionIndex );\n\t\t}\n\t\tonDismiss();\n\t}, [ shouldReplaceBlock, destinationRootClientId, insertionIndex ] );\n\n\tconst onInsert = useCallback(\n\t\t( item ) => {\n\t\t\tconst { name, initialAttributes, innerBlocks } = item;\n\n\t\t\tconst newBlock = createBlock(\n\t\t\t\tname,\n\t\t\t\tinitialAttributes,\n\t\t\t\tinnerBlocks\n\t\t\t);\n\n\t\t\tinsertBlock(\n\t\t\t\tnewBlock,\n\t\t\t\tinsertionIndex,\n\t\t\t\tdestinationRootClientId,\n\t\t\t\ttrue,\n\t\t\t\t{ source: 'inserter_menu' }\n\t\t\t);\n\t\t},\n\t\t[ insertBlock, destinationRootClientId, insertionIndex ]\n\t);\n\n\tconst onSelectItem = useCallback(\n\t\t( item ) => {\n\t\t\t// Avoid a focus loop, see https://github.com/WordPress/gutenberg/issues/30562\n\t\t\tif ( Platform.OS === 'ios' ) {\n\t\t\t\tAccessibilityInfo.isScreenReaderEnabled().then( ( enabled ) => {\n\t\t\t\t\t// In testing, the bug focus loop needed a longer timeout when VoiceOver was enabled.\n\t\t\t\t\tconst timeout = enabled ? 200 : 100;\n\t\t\t\t\t// eslint-disable-next-line @wordpress/react-no-unsafe-timeout\n\t\t\t\t\tsetTimeout( () => {\n\t\t\t\t\t\tonInsert( item );\n\t\t\t\t\t}, timeout );\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tonInsert( item );\n\t\t\t}\n\t\t\tonSelect( item );\n\t\t},\n\t\t[ onInsert, onSelect ]\n\t);\n\n\tconst onChangeSearch = useCallback(\n\t\t( value ) => {\n\t\t\tsetFilterValue( value );\n\t\t},\n\t\t[ setFilterValue ]\n\t);\n\n\tconst onKeyboardShow = useCallback( () => setShowTabs( false ), [\n\t\tsetShowTabs,\n\t] );\n\n\tconst onKeyboardHide = useCallback( () => setShowTabs( true ), [\n\t\tsetShowTabs,\n\t] );\n\n\tconst showSearchForm = items.length > MIN_ITEMS_FOR_SEARCH;\n\tconst isFullScreen = ! isIOS && showSearchForm;\n\n\treturn (\n\t\t<BottomSheet\n\t\t\tisVisible={ true }\n\t\t\tonClose={ onClose }\n\t\t\tonKeyboardShow={ onKeyboardShow }\n\t\t\tonKeyboardHide={ onKeyboardHide }\n\t\t\theader={\n\t\t\t\t<>\n\t\t\t\t\t{ showSearchForm && (\n\t\t\t\t\t\t<SearchControl\n\t\t\t\t\t\t\tonChange={ onChangeSearch }\n\t\t\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showTabs && ! filterValue && (\n\t\t\t\t\t\t<InserterTabs.Control\n\t\t\t\t\t\t\tonChangeTab={ setTabIndex }\n\t\t\t\t\t\t\tshowReusableBlocks={ showReusableBlocks }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t\thasNavigation\n\t\t\tsetMinHeightToMaxHeight={ true }\n\t\t\tcontentStyle={ styles[ 'inserter-menu__list' ] }\n\t\t\tisFullScreen={ isFullScreen }\n\t\t\tallowDragIndicator={ true }\n\t\t>\n\t\t\t<BottomSheetConsumer>\n\t\t\t\t{ ( { listProps } ) => (\n\t\t\t\t\t<TouchableHighlight\n\t\t\t\t\t\taccessible={ false }\n\t\t\t\t\t\tstyle={ styles[ 'inserter-menu__list-wrapper' ] }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! showTabs || filterValue ? (\n\t\t\t\t\t\t\t<InserterSearchResults\n\t\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\t\tfilterValue={ filterValue }\n\t\t\t\t\t\t\t\tonSelect={ onSelectItem }\n\t\t\t\t\t\t\t\tlistProps={ listProps }\n\t\t\t\t\t\t\t\tisFullScreen={ isFullScreen }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<InserterTabs\n\t\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\t\tlistProps={ listProps }\n\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\tonSelect={ onSelectItem }\n\t\t\t\t\t\t\t\tshowReusableBlocks={ showReusableBlocks }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</TouchableHighlight>\n\t\t\t\t) }\n\t\t\t</BottomSheetConsumer>\n\t\t</BottomSheet>\n\t);\n}\n\nexport default InserterMenu;\n"]}
@@ -85,7 +85,7 @@ function QuickInserter(_ref) {
85
85
  setInserterIsOpened(false);
86
86
  }
87
87
  }, [setInserterIsOpened]); // When clicking Browse All select the appropriate block so as
88
- // the insertion point can work as expected
88
+ // the insertion point can work as expected.
89
89
 
90
90
  const onBrowseAll = () => {
91
91
  setInserterIsOpened({
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/quick-inserter.js"],"names":["SEARCH_THRESHOLD","SHOWN_BLOCK_TYPES","SHOWN_BLOCK_PATTERNS","SHOWN_BLOCK_PATTERNS_WITH_PRIORITIZATION","QuickInserter","onSelect","rootClientId","clientId","isAppender","filterValue","setFilterValue","destinationRootClientId","onInsertBlocks","blockTypes","patterns","setInserterIsOpened","insertionIndex","prioritizePatterns","select","getSettings","getBlockIndex","getBlockCount","blockEditorStore","settings","index","blockCount","__experimentalSetIsInserterOpened","__experimentalPreferPatternsOnRoot","showPatterns","length","showSearch","onBrowseAll","maxBlockPatterns","value"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AApBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAOA,MAAMA,gBAAgB,GAAG,CAAzB;AACA,MAAMC,iBAAiB,GAAG,CAA1B;AACA,MAAMC,oBAAoB,GAAG,CAA7B;AACA,MAAMC,wCAAwC,GAAG,CAAjD;;AAEe,SAASC,aAAT,OAKX;AAAA,MALmC;AACtCC,IAAAA,QADsC;AAEtCC,IAAAA,YAFsC;AAGtCC,IAAAA,QAHsC;AAItCC,IAAAA;AAJsC,GAKnC;AACH,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkC,uBAAU,EAAV,CAAxC;AACA,QAAM,CAAEC,uBAAF,EAA2BC,cAA3B,IAA8C,gCAAmB;AACtEP,IAAAA,QADsE;AAEtEC,IAAAA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I,YAAJ,CAPH,CAjCF,CADD;AA8CA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button, SearchControl } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport InserterSearchResults from './search-results';\nimport useInsertionPoint from './hooks/use-insertion-point';\nimport usePatternsState from './hooks/use-patterns-state';\nimport useBlockTypesState from './hooks/use-block-types-state';\nimport { store as blockEditorStore } from '../../store';\n\nconst SEARCH_THRESHOLD = 6;\nconst SHOWN_BLOCK_TYPES = 6;\nconst SHOWN_BLOCK_PATTERNS = 2;\nconst SHOWN_BLOCK_PATTERNS_WITH_PRIORITIZATION = 4;\n\nexport default function QuickInserter( {\n\tonSelect,\n\trootClientId,\n\tclientId,\n\tisAppender,\n} ) {\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst [ destinationRootClientId, onInsertBlocks ] = useInsertionPoint( {\n\t\tonSelect,\n\t\trootClientId,\n\t\tclientId,\n\t\tisAppender,\n\t} );\n\tconst [ blockTypes ] = useBlockTypesState(\n\t\tdestinationRootClientId,\n\t\tonInsertBlocks\n\t);\n\n\tconst [ patterns ] = usePatternsState(\n\t\tonInsertBlocks,\n\t\tdestinationRootClientId\n\t);\n\n\tconst {\n\t\tsetInserterIsOpened,\n\t\tinsertionIndex,\n\t\tprioritizePatterns,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, getBlockIndex, getBlockCount } = select(\n\t\t\t\tblockEditorStore\n\t\t\t);\n\t\t\tconst settings = getSettings();\n\t\t\tconst index = getBlockIndex( clientId );\n\t\t\tconst blockCount = getBlockCount();\n\n\t\t\treturn {\n\t\t\t\tsetInserterIsOpened: settings.__experimentalSetIsInserterOpened,\n\t\t\t\tprioritizePatterns:\n\t\t\t\t\tsettings.__experimentalPreferPatternsOnRoot &&\n\t\t\t\t\t! rootClientId &&\n\t\t\t\t\tindex > 0 &&\n\t\t\t\t\t( index < blockCount || blockCount === 0 ),\n\t\t\t\tinsertionIndex: index === -1 ? blockCount : index,\n\t\t\t};\n\t\t},\n\t\t[ clientId, rootClientId ]\n\t);\n\n\tconst showPatterns =\n\t\tpatterns.length && ( !! filterValue || prioritizePatterns );\n\tconst showSearch =\n\t\t( showPatterns && patterns.length > SEARCH_THRESHOLD ) ||\n\t\tblockTypes.length > SEARCH_THRESHOLD;\n\n\tuseEffect( () => {\n\t\tif ( setInserterIsOpened ) {\n\t\t\tsetInserterIsOpened( false );\n\t\t}\n\t}, [ setInserterIsOpened ] );\n\n\t// When clicking Browse All select the appropriate block so as\n\t// the insertion point can work as expected\n\tconst onBrowseAll = () => {\n\t\tsetInserterIsOpened( { rootClientId, insertionIndex, filterValue } );\n\t};\n\n\tlet maxBlockPatterns = 0;\n\tif ( showPatterns ) {\n\t\tmaxBlockPatterns = prioritizePatterns\n\t\t\t? SHOWN_BLOCK_PATTERNS_WITH_PRIORITIZATION\n\t\t\t: SHOWN_BLOCK_PATTERNS;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames( 'block-editor-inserter__quick-inserter', {\n\t\t\t\t'has-search': showSearch,\n\t\t\t\t'has-expand': setInserterIsOpened,\n\t\t\t} ) }\n\t\t>\n\t\t\t{ showSearch && (\n\t\t\t\t<SearchControl\n\t\t\t\t\tclassName=\"block-editor-inserter__search\"\n\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tsetFilterValue( value );\n\t\t\t\t\t} }\n\t\t\t\t\tlabel={ __( 'Search for blocks and patterns' ) }\n\t\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<div className=\"block-editor-inserter__quick-inserter-results\">\n\t\t\t\t<InserterSearchResults\n\t\t\t\t\tfilterValue={ filterValue }\n\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tisAppender={ isAppender }\n\t\t\t\t\tmaxBlockPatterns={ maxBlockPatterns }\n\t\t\t\t\tmaxBlockTypes={ SHOWN_BLOCK_TYPES }\n\t\t\t\t\tisDraggable={ false }\n\t\t\t\t\tprioritizePatterns={ prioritizePatterns }\n\t\t\t\t/>\n\t\t\t</div>\n\n\t\t\t{ setInserterIsOpened && (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"block-editor-inserter__quick-inserter-expand\"\n\t\t\t\t\tonClick={ onBrowseAll }\n\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t'Browse all. This will open the main inserter panel in the editor toolbar.'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Browse all' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/quick-inserter.js"],"names":["SEARCH_THRESHOLD","SHOWN_BLOCK_TYPES","SHOWN_BLOCK_PATTERNS","SHOWN_BLOCK_PATTERNS_WITH_PRIORITIZATION","QuickInserter","onSelect","rootClientId","clientId","isAppender","filterValue","setFilterValue","destinationRootClientId","onInsertBlocks","blockTypes","patterns","setInserterIsOpened","insertionIndex","prioritizePatterns","select","getSettings","getBlockIndex","getBlockCount","blockEditorStore","settings","index","blockCount","__experimentalSetIsInserterOpened","__experimentalPreferPatternsOnRoot","showPatterns","length","showSearch","onBrowseAll","maxBlockPatterns","value"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AApBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAOA,MAAMA,gBAAgB,GAAG,CAAzB;AACA,MAAMC,iBAAiB,GAAG,CAA1B;AACA,MAAMC,oBAAoB,GAAG,CAA7B;AACA,MAAMC,wCAAwC,GAAG,CAAjD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UALd;AAMC,IAAA,gBAAgB,EAAGwB,gBANpB;AAOC,IAAA,aAAa,EAAG/B,iBAPjB;AAQC,IAAA,WAAW,EAAG,KARf;AASC,IAAA,kBAAkB,EAAGgB;AATtB,IADD,CAlBD,EAgCGF,mBAAmB,IACpB,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,8CADX;AAEC,IAAA,OAAO,EAAGgB,WAFX;AAGC,kBAAa,cACZ,2EADY;AAHd,KAOG,cAAI,YAAJ,CAPH,CAjCF,CADD;AA8CA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button, SearchControl } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport InserterSearchResults from './search-results';\nimport useInsertionPoint from './hooks/use-insertion-point';\nimport usePatternsState from './hooks/use-patterns-state';\nimport useBlockTypesState from './hooks/use-block-types-state';\nimport { store as blockEditorStore } from '../../store';\n\nconst SEARCH_THRESHOLD = 6;\nconst SHOWN_BLOCK_TYPES = 6;\nconst SHOWN_BLOCK_PATTERNS = 2;\nconst SHOWN_BLOCK_PATTERNS_WITH_PRIORITIZATION = 4;\n\nexport default function QuickInserter( {\n\tonSelect,\n\trootClientId,\n\tclientId,\n\tisAppender,\n} ) {\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst [ destinationRootClientId, onInsertBlocks ] = useInsertionPoint( {\n\t\tonSelect,\n\t\trootClientId,\n\t\tclientId,\n\t\tisAppender,\n\t} );\n\tconst [ blockTypes ] = useBlockTypesState(\n\t\tdestinationRootClientId,\n\t\tonInsertBlocks\n\t);\n\n\tconst [ patterns ] = usePatternsState(\n\t\tonInsertBlocks,\n\t\tdestinationRootClientId\n\t);\n\n\tconst {\n\t\tsetInserterIsOpened,\n\t\tinsertionIndex,\n\t\tprioritizePatterns,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, getBlockIndex, getBlockCount } = select(\n\t\t\t\tblockEditorStore\n\t\t\t);\n\t\t\tconst settings = getSettings();\n\t\t\tconst index = getBlockIndex( clientId );\n\t\t\tconst blockCount = getBlockCount();\n\n\t\t\treturn {\n\t\t\t\tsetInserterIsOpened: settings.__experimentalSetIsInserterOpened,\n\t\t\t\tprioritizePatterns:\n\t\t\t\t\tsettings.__experimentalPreferPatternsOnRoot &&\n\t\t\t\t\t! rootClientId &&\n\t\t\t\t\tindex > 0 &&\n\t\t\t\t\t( index < blockCount || blockCount === 0 ),\n\t\t\t\tinsertionIndex: index === -1 ? blockCount : index,\n\t\t\t};\n\t\t},\n\t\t[ clientId, rootClientId ]\n\t);\n\n\tconst showPatterns =\n\t\tpatterns.length && ( !! filterValue || prioritizePatterns );\n\tconst showSearch =\n\t\t( showPatterns && patterns.length > SEARCH_THRESHOLD ) ||\n\t\tblockTypes.length > SEARCH_THRESHOLD;\n\n\tuseEffect( () => {\n\t\tif ( setInserterIsOpened ) {\n\t\t\tsetInserterIsOpened( false );\n\t\t}\n\t}, [ setInserterIsOpened ] );\n\n\t// When clicking Browse All select the appropriate block so as\n\t// the insertion point can work as expected.\n\tconst onBrowseAll = () => {\n\t\tsetInserterIsOpened( { rootClientId, insertionIndex, filterValue } );\n\t};\n\n\tlet maxBlockPatterns = 0;\n\tif ( showPatterns ) {\n\t\tmaxBlockPatterns = prioritizePatterns\n\t\t\t? SHOWN_BLOCK_PATTERNS_WITH_PRIORITIZATION\n\t\t\t: SHOWN_BLOCK_PATTERNS;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames( 'block-editor-inserter__quick-inserter', {\n\t\t\t\t'has-search': showSearch,\n\t\t\t\t'has-expand': setInserterIsOpened,\n\t\t\t} ) }\n\t\t>\n\t\t\t{ showSearch && (\n\t\t\t\t<SearchControl\n\t\t\t\t\tclassName=\"block-editor-inserter__search\"\n\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tsetFilterValue( value );\n\t\t\t\t\t} }\n\t\t\t\t\tlabel={ __( 'Search for blocks and patterns' ) }\n\t\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<div className=\"block-editor-inserter__quick-inserter-results\">\n\t\t\t\t<InserterSearchResults\n\t\t\t\t\tfilterValue={ filterValue }\n\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tisAppender={ isAppender }\n\t\t\t\t\tmaxBlockPatterns={ maxBlockPatterns }\n\t\t\t\t\tmaxBlockTypes={ SHOWN_BLOCK_TYPES }\n\t\t\t\t\tisDraggable={ false }\n\t\t\t\t\tprioritizePatterns={ prioritizePatterns }\n\t\t\t\t/>\n\t\t\t</div>\n\n\t\t\t{ setInserterIsOpened && (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"block-editor-inserter__quick-inserter-expand\"\n\t\t\t\t\tonClick={ onBrowseAll }\n\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t'Browse all. This will open the main inserter panel in the editor toolbar.'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Browse all' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"]}
@@ -11,7 +11,7 @@ var _lodash = require("lodash");
11
11
  /**
12
12
  * External dependencies
13
13
  */
14
- // Default search helpers
14
+ // Default search helpers.
15
15
  const defaultGetName = item => item.name || '';
16
16
 
17
17
  const defaultGetTitle = item => item.title;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/search-items.js"],"names":["defaultGetName","item","name","defaultGetTitle","title","defaultGetDescription","description","defaultGetKeywords","keywords","defaultGetCategory","category","defaultGetCollection","normalizeSearchInput","input","replace","toLowerCase","getNormalizedSearchTerms","removeMatchingTerms","unmatchedTerms","unprocessedTerms","unmatchedTerm","unprocessedTerm","includes","searchBlockItems","items","categories","collections","searchInput","normalizedSearchTerms","length","config","getCategory","slug","getCollection","split","searchItems","rankedItems","map","getItemSearchRank","filter","rank","sort","rank1","rank2","searchTerm","getName","getTitle","getDescription","getKeywords","collection","normalizedSearchInput","normalizedTitle","startsWith","terms","join","isCoreBlockVariation","id"],"mappings":";;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA;AACA,MAAMA,cAAc,GAAKC,IAAF,IAAYA,IAAI,CAACC,IAAL,IAAa,EAAhD;;AACA,MAAMC,eAAe,GAAKF,IAAF,IAAYA,IAAI,CAACG,KAAzC;;AACA,MAAMC,qBAAqB,GAAKJ,IAAF,IAAYA,IAAI,CAACK,WAAL,IAAoB,EAA9D;;AACA,MAAMC,kBAAkB,GAAKN,IAAF,IAAYA,IAAI,CAACO,QAAL,IAAiB,EAAxD;;AACA,MAAMC,kBAAkB,GAAKR,IAAF,IAAYA,IAAI,CAACS,QAA5C;;AACA,MAAMC,oBAAoB,GAAG,MAAM,IAAnC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,oBAAT,GAA4C;AAAA,MAAbC,KAAa,uEAAL,EAAK;AAC3C;AACA;AACAA,EAAAA,KAAK,GAAG,oBAAQA,KAAR,CAAR,CAH2C,CAK3C;AACA;;AACAA,EAAAA,KAAK,GAAGA,KAAK,CAACC,OAAN,CAAe,KAAf,EAAsB,EAAtB,CAAR,CAP2C,CAS3C;AACA;;AACAD,EAAAA,KAAK,GAAGA,KAAK,CAACE,WAAN,EAAR;AAEA,SAAOF,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMG,wBAAwB,GAAG,YAAkB;AAAA,MAAhBH,KAAgB,uEAAR,EAAQ;AACzD;AACA,SAAO,mBAAOD,oBAAoB,CAAEC,KAAF,CAA3B,CAAP;AACA,CAHM;;;;AAKP,MAAMI,mBAAmB,GAAG,CAAEC,cAAF,EAAkBC,gBAAl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CAAEhC,IAAF,CAAhC;AAEA,QAAMiD,qBAAqB,GAAGtC,oBAAoB,CAAEgC,UAAF,CAAlD;AACA,QAAMO,eAAe,GAAGvC,oBAAoB,CAAER,KAAF,CAA5C;AAEA,MAAIoC,IAAI,GAAG,CAAX,CApBkE,CAsBlE;AACA;AACA;;AACA,MAAKU,qBAAqB,KAAKC,eAA/B,EAAiD;AAChDX,IAAAA,IAAI,IAAI,EAAR;AACA,GAFD,MAEO,IAAKW,eAAe,CAACC,UAAhB,CAA4BF,qBAA5B,CAAL,EAA2D;AACjEV,IAAAA,IAAI,IAAI,EAAR;AACA,GAFM,MAEA;AACN,UAAMa,KAAK,GAAG,CACbnD,IADa,EAEbE,KAFa,EAGbE,WAHa,EAIb,GAAGE,QAJU,EAKbE,QALa,EAMbuC,UANa,EAOZK,IAPY,CAON,GAPM,CAAd;AAQA,UAAM1B,qBAAqB,GAAG,mBAAOsB,qBAAP,CAA9B;AACA,UAAMhC,cAAc,GAAGD,mBAAmB,CACzCW,qBADyC,EAEzCyB,KAFyC,CAA1C;;AAKA,QAAKnC,cAAc,CAACW,MAAf,KAA0B,CAA/B,EAAmC;AAClCW,MAAAA,IAAI,IAAI,EAAR;AACA;AACD,GA/CiE,CAiDlE;;;AACA,MAAKA,IAAI,KAAK,CAAT,IAActC,IAAI,CAACkD,UAAL,CAAiB,OAAjB,CAAnB,EAAgD;AAC/C,UAAMG,oBAAoB,GAAGrD,IAAI,KAAKD,IAAI,CAACuD,EAA3C,CAD+C,CAE/C;;AACAhB,IAAAA,IAAI,IAAIe,oBAAoB,GAAG,CAAH,GAAO,CAAnC;AACA;;AAED,SAAOf,IAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { deburr, differenceWith, find, words } from 'lodash';\n\n// Default search helpers\nconst defaultGetName = ( item ) => item.name || '';\nconst defaultGetTitle = ( item ) => item.title;\nconst defaultGetDescription = ( item ) => item.description || '';\nconst defaultGetKeywords = ( item ) => item.keywords || [];\nconst defaultGetCategory = ( item ) => item.category;\nconst defaultGetCollection = () => null;\n\n/**\n * Sanitizes the search input string.\n *\n * @param {string} input The search input to normalize.\n *\n * @return {string} The normalized search input.\n */\nfunction normalizeSearchInput( input = '' ) {\n\t// Disregard diacritics.\n\t// Input: \"média\"\n\tinput = deburr( input );\n\n\t// Accommodate leading slash, matching autocomplete expectations.\n\t// Input: \"/media\"\n\tinput = input.replace( /^\\//, '' );\n\n\t// Lowercase.\n\t// Input: \"MEDIA\"\n\tinput = input.toLowerCase();\n\n\treturn input;\n}\n\n/**\n * Converts the search term into a list of normalized terms.\n *\n * @param {string} input The search term to normalize.\n *\n * @return {string[]} The normalized list of search terms.\n */\nexport const getNormalizedSearchTerms = ( input = '' ) => {\n\t// Extract words.\n\treturn words( normalizeSearchInput( input ) );\n};\n\nconst removeMatchingTerms = ( unmatchedTerms, unprocessedTerms ) => {\n\treturn differenceWith(\n\t\tunmatchedTerms,\n\t\tgetNormalizedSearchTerms( unprocessedTerms ),\n\t\t( unmatchedTerm, unprocessedTerm ) =>\n\t\t\tunprocessedTerm.includes( unmatchedTerm )\n\t);\n};\n\nexport const searchBlockItems = (\n\titems,\n\tcategories,\n\tcollections,\n\tsearchInput\n) => {\n\tconst normalizedSearchTerms = getNormalizedSearchTerms( searchInput );\n\tif ( normalizedSearchTerms.length === 0 ) {\n\t\treturn items;\n\t}\n\n\tconst config = {\n\t\tgetCategory: ( item ) =>\n\t\t\tfind( categories, { slug: item.category } )?.title,\n\t\tgetCollection: ( item ) =>\n\t\t\tcollections[ item.name.split( '/' )[ 0 ] ]?.title,\n\t};\n\n\treturn searchItems( items, searchInput, config );\n};\n\n/**\n * Filters an item list given a search term.\n *\n * @param {Array} items Item list\n * @param {string} searchInput Search input.\n * @param {Object} config Search Config.\n *\n * @return {Array} Filtered item list.\n */\nexport const searchItems = ( items = [], searchInput = '', config = {} ) => {\n\tconst normalizedSearchTerms = getNormalizedSearchTerms( searchInput );\n\tif ( normalizedSearchTerms.length === 0 ) {\n\t\treturn items;\n\t}\n\n\tconst rankedItems = items\n\t\t.map( ( item ) => {\n\t\t\treturn [ item, getItemSearchRank( item, searchInput, config ) ];\n\t\t} )\n\t\t.filter( ( [ , rank ] ) => rank > 0 );\n\n\trankedItems.sort( ( [ , rank1 ], [ , rank2 ] ) => rank2 - rank1 );\n\treturn rankedItems.map( ( [ item ] ) => item );\n};\n\n/**\n * Get the search rank for a given item and a specific search term.\n * The better the match, the higher the rank.\n * If the rank equals 0, it should be excluded from the results.\n *\n * @param {Object} item Item to filter.\n * @param {string} searchTerm Search term.\n * @param {Object} config Search Config.\n *\n * @return {number} Search Rank.\n */\nexport function getItemSearchRank( item, searchTerm, config = {} ) {\n\tconst {\n\t\tgetName = defaultGetName,\n\t\tgetTitle = defaultGetTitle,\n\t\tgetDescription = defaultGetDescription,\n\t\tgetKeywords = defaultGetKeywords,\n\t\tgetCategory = defaultGetCategory,\n\t\tgetCollection = defaultGetCollection,\n\t} = config;\n\n\tconst name = getName( item );\n\tconst title = getTitle( item );\n\tconst description = getDescription( item );\n\tconst keywords = getKeywords( item );\n\tconst category = getCategory( item );\n\tconst collection = getCollection( item );\n\n\tconst normalizedSearchInput = normalizeSearchInput( searchTerm );\n\tconst normalizedTitle = normalizeSearchInput( title );\n\n\tlet rank = 0;\n\n\t// Prefers exact matches\n\t// Then prefers if the beginning of the title matches the search term\n\t// name, keywords, categories, collection, variations match come later.\n\tif ( normalizedSearchInput === normalizedTitle ) {\n\t\trank += 30;\n\t} else if ( normalizedTitle.startsWith( normalizedSearchInput ) ) {\n\t\trank += 20;\n\t} else {\n\t\tconst terms = [\n\t\t\tname,\n\t\t\ttitle,\n\t\t\tdescription,\n\t\t\t...keywords,\n\t\t\tcategory,\n\t\t\tcollection,\n\t\t].join( ' ' );\n\t\tconst normalizedSearchTerms = words( normalizedSearchInput );\n\t\tconst unmatchedTerms = removeMatchingTerms(\n\t\t\tnormalizedSearchTerms,\n\t\t\tterms\n\t\t);\n\n\t\tif ( unmatchedTerms.length === 0 ) {\n\t\t\trank += 10;\n\t\t}\n\t}\n\n\t// Give a better rank to \"core\" namespaced items.\n\tif ( rank !== 0 && name.startsWith( 'core/' ) ) {\n\t\tconst isCoreBlockVariation = name !== item.id;\n\t\t// Give a bit better rank to \"core\" blocks over \"core\" block variations.\n\t\trank += isCoreBlockVariation ? 1 : 2;\n\t}\n\n\treturn rank;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/search-items.js"],"names":["defaultGetName","item","name","defaultGetTitle","title","defaultGetDescription","description","defaultGetKeywords","keywords","defaultGetCategory","category","defaultGetCollection","normalizeSearchInput","input","replace","toLowerCase","getNormalizedSearchTerms","removeMatchingTerms","unmatchedTerms","unprocessedTerms","unmatchedTerm","unprocessedTerm","includes","searchBlockItems","items","categories","collections","searchInput","normalizedSearchTerms","length","config","getCategory","slug","getCollection","split","searchItems","rankedItems","map","getItemSearchRank","filter","rank","sort","rank1","rank2","searchTerm","getName","getTitle","getDescription","getKeywords","collection","normalizedSearchInput","normalizedTitle","startsWith","terms","join","isCoreBlockVariation","id"],"mappings":";;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA;AACA,MAAMA,cAAc,GAAKC,IAAF,IAAYA,IAAI,CAACC,IAAL,IAAa,EAAhD;;AACA,MAAMC,eAAe,GAAKF,IAAF,IAAYA,IAAI,CAACG,KAAzC;;AACA,MAAMC,qBAAqB,GAAKJ,IAAF,IAAYA,IAAI,CAACK,WAAL,IAAoB,EAA9D;;AACA,MAAMC,kBAAkB,GAAKN,IAAF,IAAYA,IAAI,CAACO,QAAL,IAAiB,EAAxD;;AACA,MAAMC,kBAAkB,GAAKR,IAAF,IAAYA,IAAI,CAACS,QAA5C;;AACA,MAAMC,oBAAoB,GAAG,MAAM,IAAnC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,oBAAT,GAA4C;AAAA,MAAbC,KAAa,uEAAL,EAAK;AAC3C;AACA;AACAA,EAAAA,KAAK,GAAG,oB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IAAI,KAAK,CAAT,IAActC,IAAI,CAACkD,UAAL,CAAiB,OAAjB,CAAnB,EAAgD;AAC/C,UAAMG,oBAAoB,GAAGrD,IAAI,KAAKD,IAAI,CAACuD,EAA3C,CAD+C,CAE/C;;AACAhB,IAAAA,IAAI,IAAIe,oBAAoB,GAAG,CAAH,GAAO,CAAnC;AACA;;AAED,SAAOf,IAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { deburr, differenceWith, find, words } from 'lodash';\n\n// Default search helpers.\nconst defaultGetName = ( item ) => item.name || '';\nconst defaultGetTitle = ( item ) => item.title;\nconst defaultGetDescription = ( item ) => item.description || '';\nconst defaultGetKeywords = ( item ) => item.keywords || [];\nconst defaultGetCategory = ( item ) => item.category;\nconst defaultGetCollection = () => null;\n\n/**\n * Sanitizes the search input string.\n *\n * @param {string} input The search input to normalize.\n *\n * @return {string} The normalized search input.\n */\nfunction normalizeSearchInput( input = '' ) {\n\t// Disregard diacritics.\n\t// Input: \"média\"\n\tinput = deburr( input );\n\n\t// Accommodate leading slash, matching autocomplete expectations.\n\t// Input: \"/media\"\n\tinput = input.replace( /^\\//, '' );\n\n\t// Lowercase.\n\t// Input: \"MEDIA\"\n\tinput = input.toLowerCase();\n\n\treturn input;\n}\n\n/**\n * Converts the search term into a list of normalized terms.\n *\n * @param {string} input The search term to normalize.\n *\n * @return {string[]} The normalized list of search terms.\n */\nexport const getNormalizedSearchTerms = ( input = '' ) => {\n\t// Extract words.\n\treturn words( normalizeSearchInput( input ) );\n};\n\nconst removeMatchingTerms = ( unmatchedTerms, unprocessedTerms ) => {\n\treturn differenceWith(\n\t\tunmatchedTerms,\n\t\tgetNormalizedSearchTerms( unprocessedTerms ),\n\t\t( unmatchedTerm, unprocessedTerm ) =>\n\t\t\tunprocessedTerm.includes( unmatchedTerm )\n\t);\n};\n\nexport const searchBlockItems = (\n\titems,\n\tcategories,\n\tcollections,\n\tsearchInput\n) => {\n\tconst normalizedSearchTerms = getNormalizedSearchTerms( searchInput );\n\tif ( normalizedSearchTerms.length === 0 ) {\n\t\treturn items;\n\t}\n\n\tconst config = {\n\t\tgetCategory: ( item ) =>\n\t\t\tfind( categories, { slug: item.category } )?.title,\n\t\tgetCollection: ( item ) =>\n\t\t\tcollections[ item.name.split( '/' )[ 0 ] ]?.title,\n\t};\n\n\treturn searchItems( items, searchInput, config );\n};\n\n/**\n * Filters an item list given a search term.\n *\n * @param {Array} items Item list\n * @param {string} searchInput Search input.\n * @param {Object} config Search Config.\n *\n * @return {Array} Filtered item list.\n */\nexport const searchItems = ( items = [], searchInput = '', config = {} ) => {\n\tconst normalizedSearchTerms = getNormalizedSearchTerms( searchInput );\n\tif ( normalizedSearchTerms.length === 0 ) {\n\t\treturn items;\n\t}\n\n\tconst rankedItems = items\n\t\t.map( ( item ) => {\n\t\t\treturn [ item, getItemSearchRank( item, searchInput, config ) ];\n\t\t} )\n\t\t.filter( ( [ , rank ] ) => rank > 0 );\n\n\trankedItems.sort( ( [ , rank1 ], [ , rank2 ] ) => rank2 - rank1 );\n\treturn rankedItems.map( ( [ item ] ) => item );\n};\n\n/**\n * Get the search rank for a given item and a specific search term.\n * The better the match, the higher the rank.\n * If the rank equals 0, it should be excluded from the results.\n *\n * @param {Object} item Item to filter.\n * @param {string} searchTerm Search term.\n * @param {Object} config Search Config.\n *\n * @return {number} Search Rank.\n */\nexport function getItemSearchRank( item, searchTerm, config = {} ) {\n\tconst {\n\t\tgetName = defaultGetName,\n\t\tgetTitle = defaultGetTitle,\n\t\tgetDescription = defaultGetDescription,\n\t\tgetKeywords = defaultGetKeywords,\n\t\tgetCategory = defaultGetCategory,\n\t\tgetCollection = defaultGetCollection,\n\t} = config;\n\n\tconst name = getName( item );\n\tconst title = getTitle( item );\n\tconst description = getDescription( item );\n\tconst keywords = getKeywords( item );\n\tconst category = getCategory( item );\n\tconst collection = getCollection( item );\n\n\tconst normalizedSearchInput = normalizeSearchInput( searchTerm );\n\tconst normalizedTitle = normalizeSearchInput( title );\n\n\tlet rank = 0;\n\n\t// Prefers exact matches\n\t// Then prefers if the beginning of the title matches the search term\n\t// name, keywords, categories, collection, variations match come later.\n\tif ( normalizedSearchInput === normalizedTitle ) {\n\t\trank += 30;\n\t} else if ( normalizedTitle.startsWith( normalizedSearchInput ) ) {\n\t\trank += 20;\n\t} else {\n\t\tconst terms = [\n\t\t\tname,\n\t\t\ttitle,\n\t\t\tdescription,\n\t\t\t...keywords,\n\t\t\tcategory,\n\t\t\tcollection,\n\t\t].join( ' ' );\n\t\tconst normalizedSearchTerms = words( normalizedSearchInput );\n\t\tconst unmatchedTerms = removeMatchingTerms(\n\t\t\tnormalizedSearchTerms,\n\t\t\tterms\n\t\t);\n\n\t\tif ( unmatchedTerms.length === 0 ) {\n\t\t\trank += 10;\n\t\t}\n\t}\n\n\t// Give a better rank to \"core\" namespaced items.\n\tif ( rank !== 0 && name.startsWith( 'core/' ) ) {\n\t\tconst isCoreBlockVariation = name !== item.id;\n\t\t// Give a bit better rank to \"core\" blocks over \"core\" block variations.\n\t\trank += isCoreBlockVariation ? 1 : 2;\n\t}\n\n\treturn rank;\n}\n"]}
@@ -108,7 +108,7 @@ function InserterSearchResults(_ref) {
108
108
 
109
109
  const results = (0, _searchItems.searchBlockItems)((0, _lodash.orderBy)(blockTypes, ['frecency'], ['desc']), blockTypeCategories, blockTypeCollections, filterValue);
110
110
  return maxBlockTypesToShow !== undefined ? results.slice(0, maxBlockTypesToShow) : results;
111
- }, [filterValue, blockTypes, blockTypeCategories, blockTypeCollections, maxBlockTypes]); // Announce search results on change
111
+ }, [filterValue, blockTypes, blockTypeCategories, blockTypeCollections, maxBlockTypes]); // Announce search results on change.
112
112
 
113
113
  (0, _element.useEffect)(() => {
114
114
  if (!filterValue) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/search-results.js"],"names":["INITIAL_INSERTER_RESULTS","EMPTY_ARRAY","InserterSearchResults","filterValue","onSelect","onHover","rootClientId","clientId","isAppender","__experimentalInsertionIndex","maxBlockPatterns","maxBlockTypes","showBlockDirectory","isDraggable","shouldFocusBlock","prioritizePatterns","debouncedSpeak","speak","destinationRootClientId","onInsertBlocks","insertionIndex","blockTypes","blockTypeCategories","blockTypeCollections","onSelectBlockType","patterns","onSelectBlockPattern","filteredBlockPatterns","results","undefined","slice","maxBlockTypesToShow","length","filteredBlockTypes","count","resultsFoundMessage","currentShownBlockTypes","step","currentShownPatterns","hasItems","blocksUI","patternsUI","fills"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA1BA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAYA,MAAMA,wBAAwB,GAAG,CAAjC;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,WAAW,GAAG,EAApB;;AAEA,SAASC,qBAAT,OAcI;AAAA,MAd4B;AAC/BC,IAAAA,WAD+B;AAE/BC,IAAAA,QAF+B;AAG/BC,IAAAA,OAH+B;AAI/BC,IAAAA,YAJ+B;AAK/BC,IAAAA,QAL+B;AAM/BC,IAAAA,UAN+B;AAO/BC,IAAAA,4BAP+B;AAQ/BC,IAAAA,gBAR+B;AAS/BC,IAAAA,aAT+B;AAU/BC,IAAAA,kBAAkB,GAAG,KAVU;AAW/BC,IAAAA,WAAW,GAAG,IAXiB;AAY/BC,IAAAA,gBAAgB,GAAG,IAZY;AAa/BC,IAAAA;AAb+B,GAc5B;AACH,QAAMC,cAAc,GAAG,0BAAaC,WAAb,EAAoB,GAApB,CAAvB;AAEA,QAAM,CAAEC,uBAAF,EAA2BC,cAA3B,IAA8C,gCAAmB;AACtEf,IAAAA,QADsE;AAEtEE,IAAAA,YAFsE;AAGtEC,IAAAA,QAHsE;AAItEC,IAAAA,UAJsE;AAKtEY,IAAAA,cAAc,EAAEX,4BALsD;AAMtEK,IAAAA;AANsE,GAAnB,CAApD;AAQA,QAAM,CAC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jB;AAGC,IAAA,cAAc,EAAGD,oBAHlB;AAIC,IAAA,WAAW,EAAGb;AAJf,IADD,CALD,CADD;AAiBA,SACC,4BAAC,wBAAD,QACG,CAAED,kBAAF,IAAwB,CAAE2B,QAA1B,IAAsC,4BAAC,kBAAD,OADzC,EAGGxB,kBAAkB,GAAG0B,UAAH,GAAgBD,QAHrC,EAKG,CAAC,CAAEP,kBAAkB,CAACD,MAAtB,IACD,CAAC,CAAEL,qBAAqB,CAACK,MADxB,IAEA;AAAK,IAAA,SAAS,EAAC;AAAf,IAPH,EAUGjB,kBAAkB,GAAGyB,QAAH,GAAcC,UAVnC,EAYG7B,kBAAkB,IACnB,4BAAC,8BAAD,CAAiC,IAAjC;AACC,IAAA,SAAS,EAAG;AACXR,MAAAA,QAAQ,EAAEoB,iBADC;AAEXnB,MAAAA,OAFW;AAGXF,MAAAA,WAHW;AAIXoC,MAAAA,QAJW;AAKXjC,MAAAA,YAAY,EAAEY;AALH;AADb,KASKwB,KAAF,IAAa;AACd,QAAKA,KAAK,CAACV,MAAX,EAAoB;AACnB,aAAOU,KAAP;AACA;;AACD,QAAK,CAAEH,QAAP,EAAkB;AACjB,aAAO,4BAAC,kBAAD,OAAP;AACA;;AACD,WAAO,IAAP;AACA,GAjBF,CAbF,CADD;AAoCA;;eAEcrC,qB","sourcesContent":["/**\n * External dependencies\n */\nimport { orderBy, isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useEffect } from '@wordpress/element';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { VisuallyHidden } from '@wordpress/components';\nimport { useDebounce, useAsyncList } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesList from '../block-types-list';\nimport BlockPatternsList from '../block-patterns-list';\nimport __unstableInserterMenuExtension from '../inserter-menu-extension';\nimport InserterPanel from './panel';\nimport InserterNoResults from './no-results';\nimport useInsertionPoint from './hooks/use-insertion-point';\nimport usePatternsState from './hooks/use-patterns-state';\nimport useBlockTypesState from './hooks/use-block-types-state';\nimport { searchBlockItems, searchItems } from './search-items';\nimport InserterListbox from '../inserter-listbox';\n\nconst INITIAL_INSERTER_RESULTS = 9;\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation and rerendering the component.\n *\n * @type {Array}\n */\nconst EMPTY_ARRAY = [];\n\nfunction InserterSearchResults( {\n\tfilterValue,\n\tonSelect,\n\tonHover,\n\trootClientId,\n\tclientId,\n\tisAppender,\n\t__experimentalInsertionIndex,\n\tmaxBlockPatterns,\n\tmaxBlockTypes,\n\tshowBlockDirectory = false,\n\tisDraggable = true,\n\tshouldFocusBlock = true,\n\tprioritizePatterns,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\n\tconst [ destinationRootClientId, onInsertBlocks ] = useInsertionPoint( {\n\t\tonSelect,\n\t\trootClientId,\n\t\tclientId,\n\t\tisAppender,\n\t\tinsertionIndex: __experimentalInsertionIndex,\n\t\tshouldFocusBlock,\n\t} );\n\tconst [\n\t\tblockTypes,\n\t\tblockTypeCategories,\n\t\tblockTypeCollections,\n\t\tonSelectBlockType,\n\t] = useBlockTypesState( destinationRootClientId, onInsertBlocks );\n\tconst [ patterns, , onSelectBlockPattern ] = usePatternsState(\n\t\tonInsertBlocks,\n\t\tdestinationRootClientId\n\t);\n\n\tconst filteredBlockPatterns = useMemo( () => {\n\t\tif ( maxBlockPatterns === 0 ) {\n\t\t\treturn [];\n\t\t}\n\t\tconst results = searchItems( patterns, filterValue );\n\t\treturn maxBlockPatterns !== undefined\n\t\t\t? results.slice( 0, maxBlockPatterns )\n\t\t\t: results;\n\t}, [ filterValue, patterns, maxBlockPatterns ] );\n\n\tlet maxBlockTypesToShow = maxBlockTypes;\n\tif ( prioritizePatterns && filteredBlockPatterns.length > 2 ) {\n\t\tmaxBlockTypesToShow = 0;\n\t}\n\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( maxBlockTypesToShow === 0 ) {\n\t\t\treturn [];\n\t\t}\n\t\tconst results = searchBlockItems(\n\t\t\torderBy( blockTypes, [ 'frecency' ], [ 'desc' ] ),\n\t\t\tblockTypeCategories,\n\t\t\tblockTypeCollections,\n\t\t\tfilterValue\n\t\t);\n\n\t\treturn maxBlockTypesToShow !== undefined\n\t\t\t? results.slice( 0, maxBlockTypesToShow )\n\t\t\t: results;\n\t}, [\n\t\tfilterValue,\n\t\tblockTypes,\n\t\tblockTypeCategories,\n\t\tblockTypeCollections,\n\t\tmaxBlockTypes,\n\t] );\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = filteredBlockTypes.length + filteredBlockPatterns.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ filterValue, debouncedSpeak ] );\n\n\tconst currentShownBlockTypes = useAsyncList( filteredBlockTypes, {\n\t\tstep: INITIAL_INSERTER_RESULTS,\n\t} );\n\tconst currentShownPatterns = useAsyncList(\n\t\tcurrentShownBlockTypes.length === filteredBlockTypes.length\n\t\t\t? filteredBlockPatterns\n\t\t\t: EMPTY_ARRAY\n\t);\n\n\tconst hasItems =\n\t\t! isEmpty( filteredBlockTypes ) || ! isEmpty( filteredBlockPatterns );\n\n\tconst blocksUI = !! filteredBlockTypes.length && (\n\t\t<InserterPanel\n\t\t\ttitle={ <VisuallyHidden>{ __( 'Blocks' ) }</VisuallyHidden> }\n\t\t>\n\t\t\t<BlockTypesList\n\t\t\t\titems={ currentShownBlockTypes }\n\t\t\t\tonSelect={ onSelectBlockType }\n\t\t\t\tonHover={ onHover }\n\t\t\t\tlabel={ __( 'Blocks' ) }\n\t\t\t\tisDraggable={ isDraggable }\n\t\t\t/>\n\t\t</InserterPanel>\n\t);\n\n\tconst patternsUI = !! filteredBlockPatterns.length && (\n\t\t<InserterPanel\n\t\t\ttitle={\n\t\t\t\t<VisuallyHidden>{ __( 'Block Patterns' ) }</VisuallyHidden>\n\t\t\t}\n\t\t>\n\t\t\t<div className=\"block-editor-inserter__quick-inserter-patterns\">\n\t\t\t\t<BlockPatternsList\n\t\t\t\t\tshownPatterns={ currentShownPatterns }\n\t\t\t\t\tblockPatterns={ filteredBlockPatterns }\n\t\t\t\t\tonClickPattern={ onSelectBlockPattern }\n\t\t\t\t\tisDraggable={ isDraggable }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</InserterPanel>\n\t);\n\n\treturn (\n\t\t<InserterListbox>\n\t\t\t{ ! showBlockDirectory && ! hasItems && <InserterNoResults /> }\n\n\t\t\t{ prioritizePatterns ? patternsUI : blocksUI }\n\n\t\t\t{ !! filteredBlockTypes.length &&\n\t\t\t\t!! filteredBlockPatterns.length && (\n\t\t\t\t\t<div className=\"block-editor-inserter__quick-inserter-separator\" />\n\t\t\t\t) }\n\n\t\t\t{ prioritizePatterns ? blocksUI : patternsUI }\n\n\t\t\t{ showBlockDirectory && (\n\t\t\t\t<__unstableInserterMenuExtension.Slot\n\t\t\t\t\tfillProps={ {\n\t\t\t\t\t\tonSelect: onSelectBlockType,\n\t\t\t\t\t\tonHover,\n\t\t\t\t\t\tfilterValue,\n\t\t\t\t\t\thasItems,\n\t\t\t\t\t\trootClientId: destinationRootClientId,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ ( fills ) => {\n\t\t\t\t\t\tif ( fills.length ) {\n\t\t\t\t\t\t\treturn fills;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( ! hasItems ) {\n\t\t\t\t\t\t\treturn <InserterNoResults />;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t} }\n\t\t\t\t</__unstableInserterMenuExtension.Slot>\n\t\t\t) }\n\t\t</InserterListbox>\n\t);\n}\n\nexport default InserterSearchResults;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/search-results.js"],"names":["INITIAL_INSERTER_RESULTS","EMPTY_ARRAY","InserterSearchResults","filterValue","onSelect","onHover","rootClientId","clientId","isAppender","__experimentalInsertionIndex","maxBlockPatterns","maxBlockTypes","showBlockDirectory","isDraggable","shouldFocusBlock","prioritizePatterns","debouncedSpeak","speak","destinationRootClientId","onInsertBlocks","insertionIndex","blockTypes","blockTypeCategories","blockTypeCollections","onSelectBlockType","patterns","onSelectBlockPattern","filteredBlockPatterns","results","undefined","slice","maxBlockTypesToShow","length","filteredBlockTypes","count","resultsFoundMessage","currentShownBlockTypes","step","currentShownPatterns","hasItems","blocksUI","patternsUI","fills"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA1BA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAYA,MAAMA,wBAAwB,GAAG,CAAjC;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,WAAW,GAAG,EAApB;;AAEA,SAASC,qBAAT,OAcI;AAAA,MAd4B;AAC/BC,IAAAA,WAD+B;AAE/BC,IAAAA,QAF+B;AAG/BC,IAAAA,OAH+B;AAI/BC,IAAAA,YAJ+B;AAK/BC,IAAAA,QAL+B;AAM/BC,IAAAA,UAN+B;AAO/BC,IAAAA,4BAP+B;AAQ/BC,IAAAA,gBAR+B;AAS/BC,IAAAA,aAT+B;AAU/BC,IAAAA,kBAAkB,GAAG,KAVU;AAW/BC,IAAAA,WAAW,GAAG,IAXiB;AAY/BC,IAAAA,gBAAgB,GAAG,IAZY;AAa/BC,IAAAA;AAb+B,GAc5B;AACH,QAAMC,cAAc,GAAG,0BAAaC,WAAb,EAAoB,GAApB,CAAvB;AAEA,QAAM,CAAEC,uBAAF,EAA2BC,cAA3B,IAA8C,gCAAmB;AACtEf,IAAAA,QADsE;AAEtEE,IAAAA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gBAAJ,CAAlB;AAFF,KAKC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,0BAAD;AACC,IAAA,aAAa,EAAGM,oBADjB;AAEC,IAAA,aAAa,EAAGX,qBAFjB;AAGC,IAAA,cAAc,EAAGD,oBAHlB;AAIC,IAAA,WAAW,EAAGb;AAJf,IADD,CALD,CADD;AAiBA,SACC,4BAAC,wBAAD,QACG,CAAED,kBAAF,IAAwB,CAAE2B,QAA1B,IAAsC,4BAAC,kBAAD,OADzC,EAGGxB,kBAAkB,GAAG0B,UAAH,GAAgBD,QAHrC,EAKG,CAAC,CAAEP,kBAAkB,CAACD,MAAtB,IACD,CAAC,CAAEL,qBAAqB,CAACK,MADxB,IAEA;AAAK,IAAA,SAAS,EAAC;AAAf,IAPH,EAUGjB,kBAAkB,GAAGyB,QAAH,GAAcC,UAVnC,EAYG7B,kBAAkB,IACnB,4BAAC,8BAAD,CAAiC,IAAjC;AACC,IAAA,SAAS,EAAG;AACXR,MAAAA,QAAQ,EAAEoB,iBADC;AAEXnB,MAAAA,OAFW;AAGXF,MAAAA,WAHW;AAIXoC,MAAAA,QAJW;AAKXjC,MAAAA,YAAY,EAAEY;AALH;AADb,KASKwB,KAAF,IAAa;AACd,QAAKA,KAAK,CAACV,MAAX,EAAoB;AACnB,aAAOU,KAAP;AACA;;AACD,QAAK,CAAEH,QAAP,EAAkB;AACjB,aAAO,4BAAC,kBAAD,OAAP;AACA;;AACD,WAAO,IAAP;AACA,GAjBF,CAbF,CADD;AAoCA;;eAEcrC,qB","sourcesContent":["/**\n * External dependencies\n */\nimport { orderBy, isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useEffect } from '@wordpress/element';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { VisuallyHidden } from '@wordpress/components';\nimport { useDebounce, useAsyncList } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesList from '../block-types-list';\nimport BlockPatternsList from '../block-patterns-list';\nimport __unstableInserterMenuExtension from '../inserter-menu-extension';\nimport InserterPanel from './panel';\nimport InserterNoResults from './no-results';\nimport useInsertionPoint from './hooks/use-insertion-point';\nimport usePatternsState from './hooks/use-patterns-state';\nimport useBlockTypesState from './hooks/use-block-types-state';\nimport { searchBlockItems, searchItems } from './search-items';\nimport InserterListbox from '../inserter-listbox';\n\nconst INITIAL_INSERTER_RESULTS = 9;\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation and rerendering the component.\n *\n * @type {Array}\n */\nconst EMPTY_ARRAY = [];\n\nfunction InserterSearchResults( {\n\tfilterValue,\n\tonSelect,\n\tonHover,\n\trootClientId,\n\tclientId,\n\tisAppender,\n\t__experimentalInsertionIndex,\n\tmaxBlockPatterns,\n\tmaxBlockTypes,\n\tshowBlockDirectory = false,\n\tisDraggable = true,\n\tshouldFocusBlock = true,\n\tprioritizePatterns,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\n\tconst [ destinationRootClientId, onInsertBlocks ] = useInsertionPoint( {\n\t\tonSelect,\n\t\trootClientId,\n\t\tclientId,\n\t\tisAppender,\n\t\tinsertionIndex: __experimentalInsertionIndex,\n\t\tshouldFocusBlock,\n\t} );\n\tconst [\n\t\tblockTypes,\n\t\tblockTypeCategories,\n\t\tblockTypeCollections,\n\t\tonSelectBlockType,\n\t] = useBlockTypesState( destinationRootClientId, onInsertBlocks );\n\tconst [ patterns, , onSelectBlockPattern ] = usePatternsState(\n\t\tonInsertBlocks,\n\t\tdestinationRootClientId\n\t);\n\n\tconst filteredBlockPatterns = useMemo( () => {\n\t\tif ( maxBlockPatterns === 0 ) {\n\t\t\treturn [];\n\t\t}\n\t\tconst results = searchItems( patterns, filterValue );\n\t\treturn maxBlockPatterns !== undefined\n\t\t\t? results.slice( 0, maxBlockPatterns )\n\t\t\t: results;\n\t}, [ filterValue, patterns, maxBlockPatterns ] );\n\n\tlet maxBlockTypesToShow = maxBlockTypes;\n\tif ( prioritizePatterns && filteredBlockPatterns.length > 2 ) {\n\t\tmaxBlockTypesToShow = 0;\n\t}\n\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( maxBlockTypesToShow === 0 ) {\n\t\t\treturn [];\n\t\t}\n\t\tconst results = searchBlockItems(\n\t\t\torderBy( blockTypes, [ 'frecency' ], [ 'desc' ] ),\n\t\t\tblockTypeCategories,\n\t\t\tblockTypeCollections,\n\t\t\tfilterValue\n\t\t);\n\n\t\treturn maxBlockTypesToShow !== undefined\n\t\t\t? results.slice( 0, maxBlockTypesToShow )\n\t\t\t: results;\n\t}, [\n\t\tfilterValue,\n\t\tblockTypes,\n\t\tblockTypeCategories,\n\t\tblockTypeCollections,\n\t\tmaxBlockTypes,\n\t] );\n\n\t// Announce search results on change.\n\tuseEffect( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = filteredBlockTypes.length + filteredBlockPatterns.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ filterValue, debouncedSpeak ] );\n\n\tconst currentShownBlockTypes = useAsyncList( filteredBlockTypes, {\n\t\tstep: INITIAL_INSERTER_RESULTS,\n\t} );\n\tconst currentShownPatterns = useAsyncList(\n\t\tcurrentShownBlockTypes.length === filteredBlockTypes.length\n\t\t\t? filteredBlockPatterns\n\t\t\t: EMPTY_ARRAY\n\t);\n\n\tconst hasItems =\n\t\t! isEmpty( filteredBlockTypes ) || ! isEmpty( filteredBlockPatterns );\n\n\tconst blocksUI = !! filteredBlockTypes.length && (\n\t\t<InserterPanel\n\t\t\ttitle={ <VisuallyHidden>{ __( 'Blocks' ) }</VisuallyHidden> }\n\t\t>\n\t\t\t<BlockTypesList\n\t\t\t\titems={ currentShownBlockTypes }\n\t\t\t\tonSelect={ onSelectBlockType }\n\t\t\t\tonHover={ onHover }\n\t\t\t\tlabel={ __( 'Blocks' ) }\n\t\t\t\tisDraggable={ isDraggable }\n\t\t\t/>\n\t\t</InserterPanel>\n\t);\n\n\tconst patternsUI = !! filteredBlockPatterns.length && (\n\t\t<InserterPanel\n\t\t\ttitle={\n\t\t\t\t<VisuallyHidden>{ __( 'Block Patterns' ) }</VisuallyHidden>\n\t\t\t}\n\t\t>\n\t\t\t<div className=\"block-editor-inserter__quick-inserter-patterns\">\n\t\t\t\t<BlockPatternsList\n\t\t\t\t\tshownPatterns={ currentShownPatterns }\n\t\t\t\t\tblockPatterns={ filteredBlockPatterns }\n\t\t\t\t\tonClickPattern={ onSelectBlockPattern }\n\t\t\t\t\tisDraggable={ isDraggable }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</InserterPanel>\n\t);\n\n\treturn (\n\t\t<InserterListbox>\n\t\t\t{ ! showBlockDirectory && ! hasItems && <InserterNoResults /> }\n\n\t\t\t{ prioritizePatterns ? patternsUI : blocksUI }\n\n\t\t\t{ !! filteredBlockTypes.length &&\n\t\t\t\t!! filteredBlockPatterns.length && (\n\t\t\t\t\t<div className=\"block-editor-inserter__quick-inserter-separator\" />\n\t\t\t\t) }\n\n\t\t\t{ prioritizePatterns ? blocksUI : patternsUI }\n\n\t\t\t{ showBlockDirectory && (\n\t\t\t\t<__unstableInserterMenuExtension.Slot\n\t\t\t\t\tfillProps={ {\n\t\t\t\t\t\tonSelect: onSelectBlockType,\n\t\t\t\t\t\tonHover,\n\t\t\t\t\t\tfilterValue,\n\t\t\t\t\t\thasItems,\n\t\t\t\t\t\trootClientId: destinationRootClientId,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ ( fills ) => {\n\t\t\t\t\t\tif ( fills.length ) {\n\t\t\t\t\t\t\treturn fills;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( ! hasItems ) {\n\t\t\t\t\t\t\treturn <InserterNoResults />;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t} }\n\t\t\t\t</__unstableInserterMenuExtension.Slot>\n\t\t\t) }\n\t\t</InserterListbox>\n\t);\n}\n\nexport default InserterSearchResults;\n"]}
@@ -21,7 +21,7 @@ function KeyboardShortcuts() {
21
21
  }
22
22
 
23
23
  function KeyboardShortcutsRegister() {
24
- // Registering the shortcuts
24
+ // Registering the shortcuts.
25
25
  const {
26
26
  registerShortcut
27
27
  } = (0, _data.useDispatch)(_keyboardShortcuts.store);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/keyboard-shortcuts/index.js"],"names":["KeyboardShortcuts","KeyboardShortcutsRegister","registerShortcut","keyboardShortcutsStore","name","category","description","keyCombination","modifier","character","aliases","Register"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AANA;AACA;AACA;AAMA,SAASA,iBAAT,GAA6B;AAC5B,SAAO,IAAP;AACA;;AAED,SAASC,yBAAT,GAAqC;AACpC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAuB,uBAAaC,wBAAb,CAA7B;AACA,0BAAW,MAAM;AAChBD,IAAAA,gBAAgB,CAAE;AACjBE,MAAAA,IAAI,EAAE,6BADW;AAEjBC,MAAAA,QAAQ,EAAE,OAFO;AAGjBC,MAAAA,WAAW,EAAE,cAAI,kCAAJ,CAHI;AAIjBC,MAAAA,cAAc,EAAE;AACfC,QAAAA,QAAQ,EAAE,cADK;AAEfC,QAAAA,SAAS,EAAE;AAFI;AAJC,KAAF,CAAhB;AAUAP,IAAAA,gBAAgB,CAAE;AACjBE,MAAAA,IAAI,EAAE,0BADW;AAEjBC,MAAAA,QAAQ,EAAE,OAFO;AAGjBC,MAAAA,WAAW,EAAE,cAAI,+BAAJ,CAHI;AAIjBC,MAAAA,cAAc,EAAE;AACfC,QAAAA,QAAQ,EAAE,QADK;AAEfC,QAAAA,SAAS,EAAE;AAFI;AAJC,KAAF,CAAhB;AAUAP,IAAAA,gBAAgB,CAAE;AACjBE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CAAhB;AASAP,IAAAA,gBAAgB,CAAE;AACjBE,MAAAA,IAAI,EAAE,iCADW;AAEjBC,MAAAA,QAAQ,EAAE,QAFO;AAGjBC,MAAAA,WAAW,EAAE,cAAI,kCAAJ,CAHI;AAIjBC,MAAAA,cAAc,EAAE;AACfC,QAAAA,QAAQ,EAAE,KADK;AAEfC,QAAAA,SAAS,EAAE;AAFI;AAJC,KAAF,CAAhB;AAUAP,IAAAA,gBAAgB,CAAE;AACjBE,MAAAA,IAAI,EAAE,2BADW;AAEjBC,MAAAA,QAAQ,EAAE,OAFO;AAGjBC,MAAAA,WAAW,EAAE,cAAI,gCAAJ,CAHI;AAIjBC,MAAAA,cAAc,EAAE;AACfC,QAAAA,QAAQ,EAAE,WADK;AAEfC,QAAAA,SAAS,EAAE;AAFI;AAJC,KAAF,CAAhB;AAUAP,IAAAA,gBAAgB,CAAE;AACjBE,MAAAA,IAAI,EAAE,6BADW;AAEjBC,MAAAA,QAAQ,EAAE,OAFO;AAGjBC,MAAAA,WAAW,EAAE,cAAI,kCAAJ,CAHI;AAIjBC,MAAAA,cAAc,EAAE;AACfC,QAAAA,QAAQ,EAAE,WADK;AAEfC,QAAAA,SAAS,EAAE;AAFI;AAJC,KAAF,CAAhB;AASA,GA7GD,EA6GG,CAAEP,gBAAF,CA7GH;AA+GA,SAAO,IAAP;AACA;;AAEDF,iBAAiB,CAACW,QAAlB,GAA6BV,yBAA7B;eAEeD,iB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\n\nfunction KeyboardShortcuts() {\n\treturn null;\n}\n\nfunction KeyboardShortcutsRegister() {\n\t// Registering the shortcuts\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/duplicate',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Duplicate the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'd',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/remove',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Remove the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/insert-before',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Insert a new block before the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 't',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/insert-after',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Insert a new block after the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 'y',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/delete-multi-selection',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Remove multiple selected blocks.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'del',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tcharacter: 'backspace',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/select-all',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __(\n\t\t\t\t'Select all text when typing. Press again to select all blocks.'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'a',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/unselect',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __( 'Clear selection.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'escape',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/focus-toolbar',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the nearest toolbar.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'alt',\n\t\t\t\tcharacter: 'F10',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/move-up',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Move the selected block(s) up.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 't',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/move-down',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Move the selected block(s) down.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 'y',\n\t\t\t},\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\treturn null;\n}\n\nKeyboardShortcuts.Register = KeyboardShortcutsRegister;\n\nexport default KeyboardShortcuts;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/keyboard-shortcuts/index.js"],"names":["KeyboardShortcuts","KeyboardShortcutsRegister","registerShortcut","keyboardShortcutsStore","name","category","description","keyCombination","modifier","character","aliases","Register"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AANA;AACA;AACA;AAMA,SAASA,iBAAT,GAA6B;AAC5B,SAAO,IAAP;AACA;;AAED,SAASC,yBAAT,GAAqC;AACpC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAuB,uBAAaC,wBAAb,CAA7B;AACA,0BAAW,MAAM;AAChBD,IAAAA,gBAAgB,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AAE,WADK;AAEfC,QAAAA,SAAS,EAAE;AAFI;AAJC,KAAF,CAAhB;AASA,GA7GD,EA6GG,CAAEP,gBAAF,CA7GH;AA+GA,SAAO,IAAP;AACA;;AAEDF,iBAAiB,CAACW,QAAlB,GAA6BV,yBAA7B;eAEeD,iB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\n\nfunction KeyboardShortcuts() {\n\treturn null;\n}\n\nfunction KeyboardShortcutsRegister() {\n\t// Registering the shortcuts.\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/duplicate',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Duplicate the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'd',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/remove',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Remove the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/insert-before',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Insert a new block before the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 't',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/insert-after',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Insert a new block after the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 'y',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/delete-multi-selection',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Remove multiple selected blocks.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'del',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tcharacter: 'backspace',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/select-all',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __(\n\t\t\t\t'Select all text when typing. Press again to select all blocks.'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'a',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/unselect',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __( 'Clear selection.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'escape',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/focus-toolbar',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the nearest toolbar.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'alt',\n\t\t\t\tcharacter: 'F10',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/move-up',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Move the selected block(s) up.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 't',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/move-down',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Move the selected block(s) down.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 'y',\n\t\t\t},\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\treturn null;\n}\n\nKeyboardShortcuts.Register = KeyboardShortcutsRegister;\n\nexport default KeyboardShortcuts;\n"]}
@@ -42,9 +42,9 @@ function LetterSpacingControl(_ref) {
42
42
  const units = (0, _components.__experimentalUseCustomUnits)({
43
43
  availableUnits: (0, _useSetting.default)('spacing.units') || ['px', 'em', 'rem'],
44
44
  defaultValues: {
45
- px: '2',
46
- em: '.2',
47
- rem: '.2'
45
+ px: 2,
46
+ em: 0.2,
47
+ rem: 0.2
48
48
  }
49
49
  });
50
50
  return (0, _element.createElement)(_components.__experimentalUnitControl, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/letter-spacing-control/index.js"],"names":["LetterSpacingControl","value","onChange","__unstableInputWidth","units","availableUnits","defaultValues","px","em","rem"],"mappings":";;;;;;;;;;;AAGA;;AAIA;;AAKA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,oBAAT,OAIX;AAAA,MAJ0C;AAC7CC,IAAAA,KAD6C;AAE7CC,IAAAA,QAF6C;AAG7CC,IAAAA,oBAAoB,GAAG;AAHsB,GAI1C;AACH,QAAMC,KAAK,GAAG,8CAAgB;AAC7BC,IAAAA,cAAc,EAAE,yBAAY,eAAZ,KAAiC,CAAE,IAAF,EAAQ,IAAR,EAAc,KAAd,CADpB;AAE7BC,IAAAA,aAAa,EAAE;AAAEC,MAAAA,EAAE,EAAE,GAAN;AAAWC,MAAAA,EAAE,EAAE,IAAf;AAAqBC,MAAAA,GAAG,EAAE;AAA1B;AAFc,GAAhB,CAAd;AAIA,SACC,4BAAC,qCAAD;AACC,IAAA,KAAK,EAAG,cAAI,gBAAJ,CADT;AAEC,IAAA,KAAK,EAAGR,KAFT;AAGC,IAAA,oBAAoB,EAAGE,oBAHxB;AAIC,IAAA,KAAK,EAAGC,KAJT;AAKC,IAAA,QAAQ,EAAGF;AALZ,IADD;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../../components/use-setting';\n\n/**\n * Control for letter-spacing.\n *\n * @param {Object} props Component props.\n * @param {string} props.value Currently selected letter-spacing.\n * @param {Function} props.onChange Handles change in letter-spacing selection.\n * @param {string|number|undefined} props.__unstableInputWidth Input width to pass through to inner UnitControl. Should be a valid CSS value.\n *\n * @return {WPElement} Letter-spacing control.\n */\nexport default function LetterSpacingControl( {\n\tvalue,\n\tonChange,\n\t__unstableInputWidth = '60px',\n} ) {\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [ 'px', 'em', 'rem' ],\n\t\tdefaultValues: { px: '2', em: '.2', rem: '.2' },\n\t} );\n\treturn (\n\t\t<UnitControl\n\t\t\tlabel={ __( 'Letter spacing' ) }\n\t\t\tvalue={ value }\n\t\t\t__unstableInputWidth={ __unstableInputWidth }\n\t\t\tunits={ units }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/letter-spacing-control/index.js"],"names":["LetterSpacingControl","value","onChange","__unstableInputWidth","units","availableUnits","defaultValues","px","em","rem"],"mappings":";;;;;;;;;;;AAGA;;AAIA;;AAKA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,oBAAT,OAIX;AAAA,MAJ0C;AAC7CC,IAAAA,KAD6C;AAE7CC,IAAAA,QAF6C;AAG7CC,IAAAA,oBAAoB,GAAG;AAHsB,GAI1C;AACH,QAAMC,KAAK,GAAG,8CAAgB;AAC7BC,IAAAA,cAAc,EAAE,yBAAY,eAAZ,KAAiC,CAAE,IAAF,EAAQ,IAAR,EAAc,KAAd,CADpB;AAE7BC,IAAAA,aAAa,EAAE;AAAEC,MAAAA,EAAE,EAAE,CAAN;AAASC,MAAAA,EAAE,EAAE,GAAb;AAAkBC,MAAAA,GAAG,EAAE;AAAvB;AAFc,GAAhB,CAAd;AAIA,SACC,4BAAC,qCAAD;AACC,IAAA,KAAK,EAAG,cAAI,gBAAJ,CADT;AAEC,IAAA,KAAK,EAAGR,KAFT;AAGC,IAAA,oBAAoB,EAAGE,oBAHxB;AAIC,IAAA,KAAK,EAAGC,KAJT;AAKC,IAAA,QAAQ,EAAGF;AALZ,IADD;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../../components/use-setting';\n\n/**\n * Control for letter-spacing.\n *\n * @param {Object} props Component props.\n * @param {string} props.value Currently selected letter-spacing.\n * @param {Function} props.onChange Handles change in letter-spacing selection.\n * @param {string|number|undefined} props.__unstableInputWidth Input width to pass through to inner UnitControl. Should be a valid CSS value.\n *\n * @return {WPElement} Letter-spacing control.\n */\nexport default function LetterSpacingControl( {\n\tvalue,\n\tonChange,\n\t__unstableInputWidth = '60px',\n} ) {\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [ 'px', 'em', 'rem' ],\n\t\tdefaultValues: { px: 2, em: 0.2, rem: 0.2 },\n\t} );\n\treturn (\n\t\t<UnitControl\n\t\t\tlabel={ __( 'Letter spacing' ) }\n\t\t\tvalue={ value }\n\t\t\t__unstableInputWidth={ __unstableInputWidth }\n\t\t\tunits={ units }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n"]}
@@ -36,7 +36,7 @@ function LineHeightControl(_ref) {
36
36
  const isDefined = (0, _utils.isLineHeightDefined)(lineHeight);
37
37
 
38
38
  const adjustNextValue = (nextValue, wasTypedOrPasted) => {
39
- // Set the next value without modification if lineHeight has been defined
39
+ // Set the next value without modification if lineHeight has been defined.
40
40
  if (isDefined) return nextValue;
41
41
  /**
42
42
  * The following logic handles the initial step up/down action
@@ -50,14 +50,14 @@ function LineHeightControl(_ref) {
50
50
 
51
51
  switch (nextValue) {
52
52
  case `${_utils.STEP}`:
53
- // Increment by step value
53
+ // Increment by step value.
54
54
  return _utils.BASE_DEFAULT_VALUE + _utils.STEP;
55
55
 
56
56
  case '0':
57
57
  {
58
58
  // This means the user explicitly input '0', rather than stepped down
59
- // from an undefined value state
60
- if (wasTypedOrPasted) return nextValue; // Decrement by step value
59
+ // from an undefined value state.
60
+ if (wasTypedOrPasted) return nextValue; // Decrement by step value.
61
61
 
62
62
  return _utils.BASE_DEFAULT_VALUE - _utils.STEP;
63
63
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/line-height-control/index.js"],"names":["LineHeightControl","value","lineHeight","onChange","__nextHasNoMarginBottom","__unstableInputWidth","isDefined","adjustNextValue","nextValue","wasTypedOrPasted","STEP","BASE_DEFAULT_VALUE","stateReducer","state","action","includes","payload","event","nativeEvent","inputType","RESET_VALUE","since","version","hint","deprecatedStyles","undefined","marginBottom"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;AAQe,SAASA,iBAAT,OAMX;AAAA,MANuC;AAC1CC,IAAAA,KAAK,EAAEC,UADmC;AAE1CC,IAAAA,QAF0C;;AAG1C;AACAC,IAAAA,uBAAuB,GAAG,KAJgB;AAK1CC,IAAAA,oBAAoB,GAAG;AALmB,GAMvC;AACH,QAAMC,SAAS,GAAG,gCAAqBJ,UAArB,CAAlB;;AAEA,QAAMK,eAAe,GAAG,CAAEC,SAAF,EAAaC,gBAAb,KAAmC;AAC1D;AACA,QAAKH,SAAL,EAAiB,OAAOE,SAAP;AAEjB;AACF;AACA;AACA;A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AJ,CAJT;AAKC,IAAA,WAAW,EAAGQ,yBALf;AAMC,IAAA,IAAI,EAAGD,WANR;AAOC,IAAA,KAAK,EAAGT,KAPT;AAQC,IAAA,GAAG,EAAG;AARP,IAJD,CADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalNumberControl as NumberControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBASE_DEFAULT_VALUE,\n\tRESET_VALUE,\n\tSTEP,\n\tisLineHeightDefined,\n} from './utils';\n\nexport default function LineHeightControl( {\n\tvalue: lineHeight,\n\tonChange,\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMarginBottom = false,\n\t__unstableInputWidth = '60px',\n} ) {\n\tconst isDefined = isLineHeightDefined( lineHeight );\n\n\tconst adjustNextValue = ( nextValue, wasTypedOrPasted ) => {\n\t\t// Set the next value without modification if lineHeight has been defined\n\t\tif ( isDefined ) return nextValue;\n\n\t\t/**\n\t\t * The following logic handles the initial step up/down action\n\t\t * (from an undefined value state) so that the next values are better suited for\n\t\t * line-height rendering. For example, the first step up should immediately\n\t\t * go to 1.6, rather than the normally expected 0.1.\n\t\t *\n\t\t * Step up/down actions can be triggered by keydowns of the up/down arrow keys,\n\t\t * or by clicking the spin buttons.\n\t\t */\n\t\tswitch ( nextValue ) {\n\t\t\tcase `${ STEP }`:\n\t\t\t\t// Increment by step value\n\t\t\t\treturn BASE_DEFAULT_VALUE + STEP;\n\t\t\tcase '0': {\n\t\t\t\t// This means the user explicitly input '0', rather than stepped down\n\t\t\t\t// from an undefined value state\n\t\t\t\tif ( wasTypedOrPasted ) return nextValue;\n\t\t\t\t// Decrement by step value\n\t\t\t\treturn BASE_DEFAULT_VALUE - STEP;\n\t\t\t}\n\t\t\tcase '':\n\t\t\t\treturn BASE_DEFAULT_VALUE;\n\t\t\tdefault:\n\t\t\t\treturn nextValue;\n\t\t}\n\t};\n\n\tconst stateReducer = ( state, action ) => {\n\t\t// Be careful when changing this — cross-browser behavior of the\n\t\t// `inputType` field in `input` events are inconsistent.\n\t\t// For example, Firefox emits an input event with inputType=\"insertReplacementText\"\n\t\t// on spin button clicks, while other browsers do not even emit an input event.\n\t\tconst wasTypedOrPasted = [ 'insertText', 'insertFromPaste' ].includes(\n\t\t\taction.payload.event.nativeEvent?.inputType\n\t\t);\n\t\tstate.value = adjustNextValue( state.value, wasTypedOrPasted );\n\t\treturn state;\n\t};\n\n\tconst value = isDefined ? lineHeight : RESET_VALUE;\n\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\tdeprecated(\n\t\t\t'Bottom margin styles for wp.blockEditor.LineHeightControl',\n\t\t\t{\n\t\t\t\tsince: '6.0',\n\t\t\t\tversion: '6.4',\n\t\t\t\thint:\n\t\t\t\t\t'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version',\n\t\t\t}\n\t\t);\n\t}\n\tconst deprecatedStyles = __nextHasNoMarginBottom\n\t\t? undefined\n\t\t: { marginBottom: 24 };\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"block-editor-line-height-control\"\n\t\t\tstyle={ deprecatedStyles }\n\t\t>\n\t\t\t<NumberControl\n\t\t\t\t__unstableInputWidth={ __unstableInputWidth }\n\t\t\t\t__unstableStateReducer={ stateReducer }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tlabel={ __( 'Line height' ) }\n\t\t\t\tplaceholder={ BASE_DEFAULT_VALUE }\n\t\t\t\tstep={ STEP }\n\t\t\t\tvalue={ value }\n\t\t\t\tmin={ 0 }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/line-height-control/index.js"],"names":["LineHeightControl","value","lineHeight","onChange","__nextHasNoMarginBottom","__unstableInputWidth","isDefined","adjustNextValue","nextValue","wasTypedOrPasted","STEP","BASE_DEFAULT_VALUE","stateReducer","state","action","includes","payload","event","nativeEvent","inputType","RESET_VALUE","since","version","hint","deprecatedStyles","undefined","marginBottom"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;AAQe,SAASA,iBAAT,OAMX;AAAA,MANuC;AAC1CC,IAAAA,KAAK,EAAEC,UADmC;AAE1CC,IAAAA,QAF0C;;AAG1C;AACAC,IAAAA,uBAAuB,GAAG,KAJgB;AAK1CC,IAAAA,oBAAoB,GAAG;AALmB,GAMvC;AACH,QAAMC,SAAS,GAAG,gCAAqBJ,UAArB,CAAlB;;AAEA,QAAMK,eAAe,GAAG,CAAEC,SAAF,EAAaC,gBAAb,KAAmC;AAC1D;AACA,QAAKH,SAAL,EAAiB,OAAOE,SAAP;AAEjB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACE,YAASA,SAAT;AACC,WAAM,GAAGE,WAAM,EAAf;AACC;AACA,eAAOC,4BAAqBD,WAA5B;;AACD,WAAK,GAAL;AAAU;AACT;AACA;AACA,cAAKD,gBAAL,EAAwB,OAAOD,SAAP,CAHf,CAIT;;AACA,iBAAOG,4BAAqBD,WAA5B;AACA;;AACD,WAAK,EAAL;AACC,eAAOC,yBAAP;;AACD;AACC,eAAOH,SAAP;AAdF;AAgBA,GA7BD;;AA+BA,QAAMI,YAAY,GAAG,CAAEC,KAAF,EAASC,MAAT,KAAqB;AAAA;;AACzC;AACA;AACA;AACA;AACA,UAAML,gBAAgB,GAAG,CAAE,YAAF,EAAgB,iBAAhB,EAAoCM,QAApC,0BACxBD,MAAM,CAACE,OAAP,CAAeC,KAAf,CAAqBC,WADG,0DACxB,sBAAkCC,SADV,CAAzB;AAGAN,IAAAA,KAAK,CAACZ,KAAN,GAAcM,eAAe,CAAEM,KAAK,CAACZ,KAAR,EAAeQ,gBAAf,CAA7B;AACA,WAAOI,KAAP;AACA,GAVD;;AAYA,QAAMZ,KAAK,GAAGK,SAAS,GAAGJ,UAAH,GAAgBkB,kBAAvC;;AAEA,MAAK,CAAEhB,uBAAP,EAAiC;AAChC,6BACC,2DADD,EAEC;AACCiB,MAAAA,KAAK,EAAE,KADR;AAECC,MAAAA,OAAO,EAAE,KAFV;AAGCC,MAAAA,IAAI,EACH;AAJF,KAFD;AASA;;AACD,QAAMC,gBAAgB,GAAGpB,uBAAuB,GAC7CqB,SAD6C,GAE7C;AAAEC,IAAAA,YAAY,EAAE;AAAhB,GAFH;AAIA,SACC;AACC,IAAA,SAAS,EAAC,kCADX;AAEC,IAAA,KAAK,EAAGF;AAFT,KAIC,4BAAC,uCAAD;AACC,IAAA,oBAAoB,EAAGnB,oBADxB;AAEC,IAAA,sBAAsB,EAAGO,YAF1B;AAGC,IAAA,QAAQ,EAAGT,QAHZ;AAIC,IAAA,KAAK,EAAG,cAAI,aAAJ,CAJT;AAKC,IAAA,WAAW,EAAGQ,yBALf;AAMC,IAAA,IAAI,EAAGD,WANR;AAOC,IAAA,KAAK,EAAGT,KAPT;AAQC,IAAA,GAAG,EAAG;AARP,IAJD,CADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalNumberControl as NumberControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBASE_DEFAULT_VALUE,\n\tRESET_VALUE,\n\tSTEP,\n\tisLineHeightDefined,\n} from './utils';\n\nexport default function LineHeightControl( {\n\tvalue: lineHeight,\n\tonChange,\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMarginBottom = false,\n\t__unstableInputWidth = '60px',\n} ) {\n\tconst isDefined = isLineHeightDefined( lineHeight );\n\n\tconst adjustNextValue = ( nextValue, wasTypedOrPasted ) => {\n\t\t// Set the next value without modification if lineHeight has been defined.\n\t\tif ( isDefined ) return nextValue;\n\n\t\t/**\n\t\t * The following logic handles the initial step up/down action\n\t\t * (from an undefined value state) so that the next values are better suited for\n\t\t * line-height rendering. For example, the first step up should immediately\n\t\t * go to 1.6, rather than the normally expected 0.1.\n\t\t *\n\t\t * Step up/down actions can be triggered by keydowns of the up/down arrow keys,\n\t\t * or by clicking the spin buttons.\n\t\t */\n\t\tswitch ( nextValue ) {\n\t\t\tcase `${ STEP }`:\n\t\t\t\t// Increment by step value.\n\t\t\t\treturn BASE_DEFAULT_VALUE + STEP;\n\t\t\tcase '0': {\n\t\t\t\t// This means the user explicitly input '0', rather than stepped down\n\t\t\t\t// from an undefined value state.\n\t\t\t\tif ( wasTypedOrPasted ) return nextValue;\n\t\t\t\t// Decrement by step value.\n\t\t\t\treturn BASE_DEFAULT_VALUE - STEP;\n\t\t\t}\n\t\t\tcase '':\n\t\t\t\treturn BASE_DEFAULT_VALUE;\n\t\t\tdefault:\n\t\t\t\treturn nextValue;\n\t\t}\n\t};\n\n\tconst stateReducer = ( state, action ) => {\n\t\t// Be careful when changing this — cross-browser behavior of the\n\t\t// `inputType` field in `input` events are inconsistent.\n\t\t// For example, Firefox emits an input event with inputType=\"insertReplacementText\"\n\t\t// on spin button clicks, while other browsers do not even emit an input event.\n\t\tconst wasTypedOrPasted = [ 'insertText', 'insertFromPaste' ].includes(\n\t\t\taction.payload.event.nativeEvent?.inputType\n\t\t);\n\t\tstate.value = adjustNextValue( state.value, wasTypedOrPasted );\n\t\treturn state;\n\t};\n\n\tconst value = isDefined ? lineHeight : RESET_VALUE;\n\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\tdeprecated(\n\t\t\t'Bottom margin styles for wp.blockEditor.LineHeightControl',\n\t\t\t{\n\t\t\t\tsince: '6.0',\n\t\t\t\tversion: '6.4',\n\t\t\t\thint:\n\t\t\t\t\t'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version',\n\t\t\t}\n\t\t);\n\t}\n\tconst deprecatedStyles = __nextHasNoMarginBottom\n\t\t? undefined\n\t\t: { marginBottom: 24 };\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"block-editor-line-height-control\"\n\t\t\tstyle={ deprecatedStyles }\n\t\t>\n\t\t\t<NumberControl\n\t\t\t\t__unstableInputWidth={ __unstableInputWidth }\n\t\t\t\t__unstableStateReducer={ stateReducer }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tlabel={ __( 'Line height' ) }\n\t\t\t\tplaceholder={ BASE_DEFAULT_VALUE }\n\t\t\t\tstep={ STEP }\n\t\t\t\tvalue={ value }\n\t\t\t\tmin={ 0 }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"]}
@@ -34,7 +34,9 @@ function LineHeightControl(_ref) {
34
34
  max: 5,
35
35
  step: _utils.STEP,
36
36
  value: value,
37
- onChange: onChange,
37
+ onChange: onChange // TODO: should be updated to avoid using `false`, in order to
38
+ // align with the web version of `UnitControl`
39
+ ,
38
40
  units: false
39
41
  });
40
42
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/line-height-control/index.native.js"],"names":["LineHeightControl","value","lineHeight","onChange","isDefined","BASE_DEFAULT_VALUE","STEP"],"mappings":";;;;;;;;;AAGA;;AACA;;AAIA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGe,SAASA,iBAAT,OAA8D;AAAA,MAAlC;AAAEC,IAAAA,KAAK,EAAEC,UAAT;AAAqBC,IAAAA;AAArB,GAAkC;AAC5E,QAAMC,SAAS,GAAG,gCAAqBF,UAArB,CAAlB;AACA,QAAMD,KAAK,GAAGG,SAAS,GAAGF,UAAH,GAAgBG,yBAAvC;AACA,SACC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,aAAJ,CADT,CAEC;AAFD;AAGC,IAAA,GAAG,EAAG,CAHP;AAIC,IAAA,GAAG,EAAG,CAJP;AAKC,IAAA,IAAI,EAAGC,WALR;AAMC,IAAA,KAAK,EAAGL,KANT;AAOC,IAAA,QAAQ,EAAGE,QAPZ;AAQC,IAAA,KAAK,EAAG;AART,IADD;AAYA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { UnitControl } from '@wordpress/components';\n/**\n * Internal dependencies\n */\nimport { BASE_DEFAULT_VALUE, STEP, isLineHeightDefined } from './utils';\n\nexport default function LineHeightControl( { value: lineHeight, onChange } ) {\n\tconst isDefined = isLineHeightDefined( lineHeight );\n\tconst value = isDefined ? lineHeight : BASE_DEFAULT_VALUE;\n\treturn (\n\t\t<UnitControl\n\t\t\tlabel={ __( 'Line Height' ) }\n\t\t\t// Set minimun value of 1 since lower values break on Android\n\t\t\tmin={ 1 }\n\t\t\tmax={ 5 }\n\t\t\tstep={ STEP }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tunits={ false }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/line-height-control/index.native.js"],"names":["LineHeightControl","value","lineHeight","onChange","isDefined","BASE_DEFAULT_VALUE","STEP"],"mappings":";;;;;;;;;AAGA;;AACA;;AAIA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGe,SAASA,iBAAT,OAA8D;AAAA,MAAlC;AAAEC,IAAAA,KAAK,EAAEC,UAAT;AAAqBC,IAAAA;AAArB,GAAkC;AAC5E,QAAMC,SAAS,GAAG,gCAAqBF,UAArB,CAAlB;AACA,QAAMD,KAAK,GAAGG,SAAS,GAAGF,UAAH,GAAgBG,yBAAvC;AACA,SACC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,aAAJ,CADT,CAEC;AAFD;AAGC,IAAA,GAAG,EAAG,CAHP;AAIC,IAAA,GAAG,EAAG,CAJP;AAKC,IAAA,IAAI,EAAGC,WALR;AAMC,IAAA,KAAK,EAAGL,KANT;AAOC,IAAA,QAAQ,EAAGE,QAPZ,CAQC;AACA;AATD;AAUC,IAAA,KAAK,EAAG;AAVT,IADD;AAcA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { UnitControl } from '@wordpress/components';\n/**\n * Internal dependencies\n */\nimport { BASE_DEFAULT_VALUE, STEP, isLineHeightDefined } from './utils';\n\nexport default function LineHeightControl( { value: lineHeight, onChange } ) {\n\tconst isDefined = isLineHeightDefined( lineHeight );\n\tconst value = isDefined ? lineHeight : BASE_DEFAULT_VALUE;\n\treturn (\n\t\t<UnitControl\n\t\t\tlabel={ __( 'Line Height' ) }\n\t\t\t// Set minimun value of 1 since lower values break on Android\n\t\t\tmin={ 1 }\n\t\t\tmax={ 5 }\n\t\t\tstep={ STEP }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\t// TODO: should be updated to avoid using `false`, in order to\n\t\t\t// align with the web version of `UnitControl`\n\t\t\tunits={ false }\n\t\t/>\n\t);\n}\n"]}
@@ -254,7 +254,7 @@ function LinkControl(_ref) {
254
254
  keyCode
255
255
  } = event;
256
256
 
257
- if (keyCode === _keycodes.ENTER && !currentInputIsEmpty // disallow submitting empty values.
257
+ if (keyCode === _keycodes.ENTER && !currentInputIsEmpty // Disallow submitting empty values.
258
258
  ) {
259
259
  event.preventDefault();
260
260
  handleSubmit();
@@ -308,7 +308,7 @@ function LinkControl(_ref) {
308
308
  label: (0, _i18n.__)('Submit'),
309
309
  icon: _icons.keyboardReturn,
310
310
  className: "block-editor-link-control__search-submit",
311
- disabled: currentInputIsEmpty // disallow submitting empty values.
311
+ disabled: currentInputIsEmpty // Disallow submitting empty values.
312
312
 
313
313
  })))), errorMessage && (0, _element.createElement)(_components.Notice, {
314
314
  className: "block-editor-link-control__search-error",
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/index.js"],"names":["LinkControl","searchInputPlaceholder","value","settings","DEFAULT_LINK_SETTINGS","onChange","noop","onRemove","noDirectEntry","showSuggestions","showInitialSuggestions","forceIsEditingLink","createSuggestion","withCreateSuggestion","inputValue","propInputValue","suggestionsQuery","noURLSuggestion","createSuggestionButtonText","hasRichPreviews","hasTextControl","renderControlBottom","undefined","isMounting","wrapperNode","textInputRef","internalInputValue","setInternalInputValue","url","internalTextValue","setInternalTextValue","title","currentInputValue","isEditingLink","setIsEditingLink","isEndingEditWithFocus","currentInputIsEmpty","trim","length","current","whichFocusTargetIndex","nextFocusTarget","focus","focusable","find","stopEditing","contains","ownerDocument","activeElement","createPage","isCreatingPage","errorMessage","handleSelectSuggestion","updatedValue","handleSubmit","handleSubmitWithEnter","event","keyCode","ENTER","preventDefault","shownUnlinkControl","showSettingsDrawer","showTextControl","keyboardReturn","ViewerFill"],"mappings":";;;;;;;;;AAYA;;AATA;;AACA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAxBA;AACA;AACA;;AAIA;AACA;AACA;;AAQA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA;AACA;AACA;AACA;AACA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,WAAT,OAmBI;AAAA;;AAAA,MAnBkB;AACrBC,IAAAA,sBADqB;AAErBC,IAAAA,KAFqB;AAGrBC,IAAAA,QAAQ,GAAGC,gCAHU;AAIrBC,IAAAA,QAAQ,GAAGC,YAJU;AAKrBC,IAAAA,QALqB;AAMrBC,IAAAA,aAAa,GAAG,KANK;AAOrBC,IAAAA,eAAe,GAAG,IAPG;AAQrBC,IAAAA,sBARqB;AASrBC,IAAAA,kBATqB;AAUrBC,IAAAA,gBAVqB;AAWrBC,IAAAA,oBAXqB;AAYrBC,IAAAA,UAAU,EAAEC,cAAc,GAAG,EAZR;AAarBC,IAAAA,gBAAgB,GAAG,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AG4C;AAjBZ,KAmBC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAGR,YADX;AAEC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAFT;AAGC,IAAA,IAAI,EAAGS,qBAHR;AAIC,IAAA,SAAS,EAAC,0CAJX;AAKC,IAAA,QAAQ,EAAG3B,mBALZ,CAKkC;;AALlC,IADD,CAnBD,CAjBD,CADD,EAgDGe,YAAY,IACb,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,yCADX;AAEC,IAAA,MAAM,EAAC,OAFR;AAGC,IAAA,aAAa,EAAG;AAHjB,KAKGA,YALH,CAjDF,CAZF,EAwEGjD,KAAK,IAAI,CAAE+B,aAAX,IAA4B,CAAEiB,cAA9B,IACD,4BAAC,oBAAD;AACC,IAAA,GAAG,EAAGhD,KAAH,aAAGA,KAAH,uBAAGA,KAAK,CAAE0B,GADd,CACoB;AADpB;AAEC,IAAA,KAAK,EAAG1B,KAFT;AAGC,IAAA,WAAW,EAAG,MAAMgC,gBAAgB,CAAE,IAAF,CAHrC;AAIC,IAAA,eAAe,EAAGf,eAJnB;AAKC,IAAA,gBAAgB,EAAGyC,kBALpB;AAMC,IAAA,QAAQ,EAAGrD;AANZ,IAzEF,EAmFGsD,kBAAkB,IACnB;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG3D,KADT;AAEC,IAAA,QAAQ,EAAGC,QAFZ;AAGC,IAAA,QAAQ,EAAGE;AAHZ,IADD,CApFF,EA4FGgB,mBAAmB,IAAIA,mBAAmB,EA5F7C,CADD;AAgGA;;AAEDrB,WAAW,CAACgE,UAAZ,GAAyBA,sBAAzB;eAEehE,W","sourcesContent":["/**\n * External dependencies\n */\nimport { noop } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Spinner, Notice, TextControl } from '@wordpress/components';\nimport { keyboardReturn } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useState, useEffect } from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\nimport { ENTER } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSettingsDrawer from './settings-drawer';\nimport LinkControlSearchInput from './search-input';\nimport LinkPreview from './link-preview';\nimport useCreatePage from './use-create-page';\nimport { ViewerFill } from './viewer-slot';\nimport { DEFAULT_LINK_SETTINGS } from './constants';\n\n/**\n * Default properties associated with a link control value.\n *\n * @typedef WPLinkControlDefaultValue\n *\n * @property {string} url Link URL.\n * @property {string=} title Link title.\n * @property {boolean=} opensInNewTab Whether link should open in a new browser\n * tab. This value is only assigned if not\n * providing a custom `settings` prop.\n */\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Custom settings values associated with a link.\n *\n * @typedef {{[setting:string]:any}} WPLinkControlSettingsValue\n */\n/* eslint-enable */\n\n/**\n * Custom settings values associated with a link.\n *\n * @typedef WPLinkControlSetting\n *\n * @property {string} id Identifier to use as property for setting value.\n * @property {string} title Human-readable label to show in user interface.\n */\n\n/**\n * Properties associated with a link control value, composed as a union of the\n * default properties and any custom settings values.\n *\n * @typedef {WPLinkControlDefaultValue&WPLinkControlSettingsValue} WPLinkControlValue\n */\n\n/** @typedef {(nextValue:WPLinkControlValue)=>void} WPLinkControlOnChangeProp */\n\n/**\n * Properties associated with a search suggestion used within the LinkControl.\n *\n * @typedef WPLinkControlSuggestion\n *\n * @property {string} id Identifier to use to uniquely identify the suggestion.\n * @property {string} type Identifies the type of the suggestion (eg: `post`,\n * `page`, `url`...etc)\n * @property {string} title Human-readable label to show in user interface.\n * @property {string} url A URL for the suggestion.\n */\n\n/** @typedef {(title:string)=>WPLinkControlSuggestion} WPLinkControlCreateSuggestionProp */\n\n/**\n * @typedef WPLinkControlProps\n *\n * @property {(WPLinkControlSetting[])=} settings An array of settings objects. Each object will used to\n * render a `ToggleControl` for that setting.\n * @property {boolean=} forceIsEditingLink If passed as either `true` or `false`, controls the\n * internal editing state of the component to respective\n * show or not show the URL input field.\n * @property {WPLinkControlValue=} value Current link value.\n * @property {WPLinkControlOnChangeProp=} onChange Value change handler, called with the updated value if\n * the user selects a new link or updates settings.\n * @property {boolean=} noDirectEntry Whether to allow turning a URL-like search query directly into a link.\n * @property {boolean=} showSuggestions Whether to present suggestions when typing the URL.\n * @property {boolean=} showInitialSuggestions Whether to present initial suggestions immediately.\n * @property {boolean=} withCreateSuggestion Whether to allow creation of link value from suggestion.\n * @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions.\n * @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL.\n * @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion.\n * @property {Function} renderControlBottom Optional controls to be rendered at the bottom of the component.\n */\n\n/**\n * Renders a link control. A link control is a controlled input which maintains\n * a value associated with a link (HTML anchor element) and relevant settings\n * for how that link is expected to behave.\n *\n * @param {WPLinkControlProps} props Component props.\n */\nfunction LinkControl( {\n\tsearchInputPlaceholder,\n\tvalue,\n\tsettings = DEFAULT_LINK_SETTINGS,\n\tonChange = noop,\n\tonRemove,\n\tnoDirectEntry = false,\n\tshowSuggestions = true,\n\tshowInitialSuggestions,\n\tforceIsEditingLink,\n\tcreateSuggestion,\n\twithCreateSuggestion,\n\tinputValue: propInputValue = '',\n\tsuggestionsQuery = {},\n\tnoURLSuggestion = false,\n\tcreateSuggestionButtonText,\n\thasRichPreviews = false,\n\thasTextControl = false,\n\trenderControlBottom = null,\n} ) {\n\tif ( withCreateSuggestion === undefined && createSuggestion ) {\n\t\twithCreateSuggestion = true;\n\t}\n\n\tconst isMounting = useRef( true );\n\tconst wrapperNode = useRef();\n\tconst textInputRef = useRef();\n\n\tconst [ internalInputValue, setInternalInputValue ] = useState(\n\t\tvalue?.url || ''\n\t);\n\tconst [ internalTextValue, setInternalTextValue ] = useState(\n\t\tvalue?.title || ''\n\t);\n\tconst currentInputValue = propInputValue || internalInputValue;\n\tconst [ isEditingLink, setIsEditingLink ] = useState(\n\t\tforceIsEditingLink !== undefined\n\t\t\t? forceIsEditingLink\n\t\t\t: ! value || ! value.url\n\t);\n\tconst isEndingEditWithFocus = useRef( false );\n\n\tconst currentInputIsEmpty = ! currentInputValue?.trim()?.length;\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tforceIsEditingLink !== undefined &&\n\t\t\tforceIsEditingLink !== isEditingLink\n\t\t) {\n\t\t\tsetIsEditingLink( forceIsEditingLink );\n\t\t}\n\t}, [ forceIsEditingLink ] );\n\n\tuseEffect( () => {\n\t\t// We don't auto focus into the Link UI on mount\n\t\t// because otherwise using the keyboard to select text\n\t\t// *within* the link format is not possible.\n\t\tif ( isMounting.current ) {\n\t\t\tisMounting.current = false;\n\t\t\treturn;\n\t\t}\n\t\t// Unless we are mounting, we always want to focus either:\n\t\t// - the URL input\n\t\t// - the first focusable element in the Link UI.\n\t\t// But in editing mode if there is a text input present then\n\t\t// the URL input is at index 1. If not then it is at index 0.\n\t\tconst whichFocusTargetIndex = textInputRef?.current ? 1 : 0;\n\n\t\t// Scenario - when:\n\t\t// - switching between editable and non editable LinkControl\n\t\t// - clicking on a link\n\t\t// ...then move focus to the *first* element to avoid focus loss\n\t\t// and to ensure focus is *within* the Link UI.\n\t\tconst nextFocusTarget =\n\t\t\tfocus.focusable.find( wrapperNode.current )[\n\t\t\t\twhichFocusTargetIndex\n\t\t\t] || wrapperNode.current;\n\n\t\tnextFocusTarget.focus();\n\n\t\tisEndingEditWithFocus.current = false;\n\t}, [ isEditingLink ] );\n\n\tuseEffect( () => {\n\t\t/**\n\t\t * If the value's `text` property changes then sync this\n\t\t * back up with state.\n\t\t */\n\t\tif ( value?.title && value.title !== internalTextValue ) {\n\t\t\tsetInternalTextValue( value.title );\n\t\t}\n\n\t\t/**\n\t\t * Update the state value internalInputValue if the url value changes\n\t\t * for example when clicking on another anchor\n\t\t */\n\t\tif ( value?.url ) {\n\t\t\tsetInternalInputValue( value.url );\n\t\t}\n\t}, [ value ] );\n\n\t/**\n\t * Cancels editing state and marks that focus may need to be restored after\n\t * the next render, if focus was within the wrapper when editing finished.\n\t */\n\tfunction stopEditing() {\n\t\tisEndingEditWithFocus.current = !! wrapperNode.current?.contains(\n\t\t\twrapperNode.current.ownerDocument.activeElement\n\t\t);\n\n\t\tsetIsEditingLink( false );\n\t}\n\n\tconst { createPage, isCreatingPage, errorMessage } = useCreatePage(\n\t\tcreateSuggestion\n\t);\n\n\tconst handleSelectSuggestion = ( updatedValue ) => {\n\t\tonChange( {\n\t\t\t...updatedValue,\n\t\t\ttitle: internalTextValue || updatedValue?.title,\n\t\t} );\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmit = () => {\n\t\tif (\n\t\t\tcurrentInputValue !== value?.url ||\n\t\t\tinternalTextValue !== value?.title\n\t\t) {\n\t\t\tonChange( {\n\t\t\t\turl: currentInputValue,\n\t\t\t\ttitle: internalTextValue,\n\t\t\t} );\n\t\t}\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmitWithEnter = ( event ) => {\n\t\tconst { keyCode } = event;\n\t\tif (\n\t\t\tkeyCode === ENTER &&\n\t\t\t! currentInputIsEmpty // disallow submitting empty values.\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\thandleSubmit();\n\t\t}\n\t};\n\n\tconst shownUnlinkControl =\n\t\tonRemove && value && ! isEditingLink && ! isCreatingPage;\n\n\tconst showSettingsDrawer = !! settings?.length;\n\n\t// Only show text control once a URL value has been committed\n\t// and it isn't just empty whitespace.\n\t// See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927.\n\tconst showTextControl = value?.url?.trim()?.length > 0 && hasTextControl;\n\n\treturn (\n\t\t<div\n\t\t\ttabIndex={ -1 }\n\t\t\tref={ wrapperNode }\n\t\t\tclassName=\"block-editor-link-control\"\n\t\t>\n\t\t\t{ isCreatingPage && (\n\t\t\t\t<div className=\"block-editor-link-control__loading\">\n\t\t\t\t\t<Spinner /> { __( 'Creating' ) }…\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ ( isEditingLink || ! value ) && ! isCreatingPage && (\n\t\t\t\t<>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames( {\n\t\t\t\t\t\t\t'block-editor-link-control__search-input-wrapper': true,\n\t\t\t\t\t\t\t'has-text-control': showTextControl,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ showTextControl && (\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tref={ textInputRef }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__text-content\"\n\t\t\t\t\t\t\t\tlabel=\"Text\"\n\t\t\t\t\t\t\t\tvalue={ internalTextValue }\n\t\t\t\t\t\t\t\tonChange={ setInternalTextValue }\n\t\t\t\t\t\t\t\tonKeyDown={ handleSubmitWithEnter }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t<LinkControlSearchInput\n\t\t\t\t\t\t\tcurrentLink={ value }\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__search-input\"\n\t\t\t\t\t\t\tplaceholder={ searchInputPlaceholder }\n\t\t\t\t\t\t\tvalue={ currentInputValue }\n\t\t\t\t\t\t\twithCreateSuggestion={ withCreateSuggestion }\n\t\t\t\t\t\t\tonCreateSuggestion={ createPage }\n\t\t\t\t\t\t\tonChange={ setInternalInputValue }\n\t\t\t\t\t\t\tonSelect={ handleSelectSuggestion }\n\t\t\t\t\t\t\tshowInitialSuggestions={ showInitialSuggestions }\n\t\t\t\t\t\t\tallowDirectEntry={ ! noDirectEntry }\n\t\t\t\t\t\t\tshowSuggestions={ showSuggestions }\n\t\t\t\t\t\t\tsuggestionsQuery={ suggestionsQuery }\n\t\t\t\t\t\t\twithURLSuggestion={ ! noURLSuggestion }\n\t\t\t\t\t\t\tcreateSuggestionButtonText={\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tuseLabel={ showTextControl }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"block-editor-link-control__search-actions\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tonClick={ handleSubmit }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Submit' ) }\n\t\t\t\t\t\t\t\t\ticon={ keyboardReturn }\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-submit\"\n\t\t\t\t\t\t\t\t\tdisabled={ currentInputIsEmpty } // disallow submitting empty values.\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</LinkControlSearchInput>\n\t\t\t\t\t</div>\n\t\t\t\t\t{ errorMessage && (\n\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-error\"\n\t\t\t\t\t\t\tstatus=\"error\"\n\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ errorMessage }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ value && ! isEditingLink && ! isCreatingPage && (\n\t\t\t\t<LinkPreview\n\t\t\t\t\tkey={ value?.url } // force remount when URL changes to avoid race conditions for rich previews\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonEditClick={ () => setIsEditingLink( true ) }\n\t\t\t\t\thasRichPreviews={ hasRichPreviews }\n\t\t\t\t\thasUnlinkControl={ shownUnlinkControl }\n\t\t\t\t\tonRemove={ onRemove }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ showSettingsDrawer && (\n\t\t\t\t<div className=\"block-editor-link-control__tools\">\n\t\t\t\t\t<LinkControlSettingsDrawer\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ renderControlBottom && renderControlBottom() }\n\t\t</div>\n\t);\n}\n\nLinkControl.ViewerFill = ViewerFill;\n\nexport default LinkControl;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/index.js"],"names":["LinkControl","searchInputPlaceholder","value","settings","DEFAULT_LINK_SETTINGS","onChange","noop","onRemove","noDirectEntry","showSuggestions","showInitialSuggestions","forceIsEditingLink","createSuggestion","withCreateSuggestion","inputValue","propInputValue","suggestionsQuery","noURLSuggestion","createSuggestionButtonText","hasRichPreviews","hasTextControl","renderControlBottom","undefined","isMounting","wrapperNode","textInputRef","internalInputValue","setInternalInputValue","url","internalTextValue","setInternalTextValue","title","currentInputValue","isEditingLink","setIsEditingLink","isEndingEditWithFocus","currentInputIsEmpty","trim","length","current","whichFocusTargetIndex","nextFocusTarget","focus","focusable","find","stopEditing","contains","ownerDocument","activeElement","createPage","isCreatingPage","errorMessage","handleSelectSuggestion","updatedValue","handleSubmit","handleSubmitWithEnter","event","keyCode","ENTER","preventDefault","shownUnlinkControl","showSettingsDrawer","showTextControl","keyboardReturn","ViewerFill"],"mappings":";;;;;;;;;AAYA;;AATA;;AACA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAxBA;AACA;AACA;;AAIA;AACA;AACA;;AAQA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA;AACA;AACA;AACA;AACA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AAC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IAzEF,EAmFGsD,kBAAkB,IACnB;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG3D,KADT;AAEC,IAAA,QAAQ,EAAGC,QAFZ;AAGC,IAAA,QAAQ,EAAGE;AAHZ,IADD,CApFF,EA4FGgB,mBAAmB,IAAIA,mBAAmB,EA5F7C,CADD;AAgGA;;AAEDrB,WAAW,CAACgE,UAAZ,GAAyBA,sBAAzB;eAEehE,W","sourcesContent":["/**\n * External dependencies\n */\nimport { noop } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Spinner, Notice, TextControl } from '@wordpress/components';\nimport { keyboardReturn } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useState, useEffect } from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\nimport { ENTER } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSettingsDrawer from './settings-drawer';\nimport LinkControlSearchInput from './search-input';\nimport LinkPreview from './link-preview';\nimport useCreatePage from './use-create-page';\nimport { ViewerFill } from './viewer-slot';\nimport { DEFAULT_LINK_SETTINGS } from './constants';\n\n/**\n * Default properties associated with a link control value.\n *\n * @typedef WPLinkControlDefaultValue\n *\n * @property {string} url Link URL.\n * @property {string=} title Link title.\n * @property {boolean=} opensInNewTab Whether link should open in a new browser\n * tab. This value is only assigned if not\n * providing a custom `settings` prop.\n */\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Custom settings values associated with a link.\n *\n * @typedef {{[setting:string]:any}} WPLinkControlSettingsValue\n */\n/* eslint-enable */\n\n/**\n * Custom settings values associated with a link.\n *\n * @typedef WPLinkControlSetting\n *\n * @property {string} id Identifier to use as property for setting value.\n * @property {string} title Human-readable label to show in user interface.\n */\n\n/**\n * Properties associated with a link control value, composed as a union of the\n * default properties and any custom settings values.\n *\n * @typedef {WPLinkControlDefaultValue&WPLinkControlSettingsValue} WPLinkControlValue\n */\n\n/** @typedef {(nextValue:WPLinkControlValue)=>void} WPLinkControlOnChangeProp */\n\n/**\n * Properties associated with a search suggestion used within the LinkControl.\n *\n * @typedef WPLinkControlSuggestion\n *\n * @property {string} id Identifier to use to uniquely identify the suggestion.\n * @property {string} type Identifies the type of the suggestion (eg: `post`,\n * `page`, `url`...etc)\n * @property {string} title Human-readable label to show in user interface.\n * @property {string} url A URL for the suggestion.\n */\n\n/** @typedef {(title:string)=>WPLinkControlSuggestion} WPLinkControlCreateSuggestionProp */\n\n/**\n * @typedef WPLinkControlProps\n *\n * @property {(WPLinkControlSetting[])=} settings An array of settings objects. Each object will used to\n * render a `ToggleControl` for that setting.\n * @property {boolean=} forceIsEditingLink If passed as either `true` or `false`, controls the\n * internal editing state of the component to respective\n * show or not show the URL input field.\n * @property {WPLinkControlValue=} value Current link value.\n * @property {WPLinkControlOnChangeProp=} onChange Value change handler, called with the updated value if\n * the user selects a new link or updates settings.\n * @property {boolean=} noDirectEntry Whether to allow turning a URL-like search query directly into a link.\n * @property {boolean=} showSuggestions Whether to present suggestions when typing the URL.\n * @property {boolean=} showInitialSuggestions Whether to present initial suggestions immediately.\n * @property {boolean=} withCreateSuggestion Whether to allow creation of link value from suggestion.\n * @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions.\n * @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL.\n * @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion.\n * @property {Function} renderControlBottom Optional controls to be rendered at the bottom of the component.\n */\n\n/**\n * Renders a link control. A link control is a controlled input which maintains\n * a value associated with a link (HTML anchor element) and relevant settings\n * for how that link is expected to behave.\n *\n * @param {WPLinkControlProps} props Component props.\n */\nfunction LinkControl( {\n\tsearchInputPlaceholder,\n\tvalue,\n\tsettings = DEFAULT_LINK_SETTINGS,\n\tonChange = noop,\n\tonRemove,\n\tnoDirectEntry = false,\n\tshowSuggestions = true,\n\tshowInitialSuggestions,\n\tforceIsEditingLink,\n\tcreateSuggestion,\n\twithCreateSuggestion,\n\tinputValue: propInputValue = '',\n\tsuggestionsQuery = {},\n\tnoURLSuggestion = false,\n\tcreateSuggestionButtonText,\n\thasRichPreviews = false,\n\thasTextControl = false,\n\trenderControlBottom = null,\n} ) {\n\tif ( withCreateSuggestion === undefined && createSuggestion ) {\n\t\twithCreateSuggestion = true;\n\t}\n\n\tconst isMounting = useRef( true );\n\tconst wrapperNode = useRef();\n\tconst textInputRef = useRef();\n\n\tconst [ internalInputValue, setInternalInputValue ] = useState(\n\t\tvalue?.url || ''\n\t);\n\tconst [ internalTextValue, setInternalTextValue ] = useState(\n\t\tvalue?.title || ''\n\t);\n\tconst currentInputValue = propInputValue || internalInputValue;\n\tconst [ isEditingLink, setIsEditingLink ] = useState(\n\t\tforceIsEditingLink !== undefined\n\t\t\t? forceIsEditingLink\n\t\t\t: ! value || ! value.url\n\t);\n\tconst isEndingEditWithFocus = useRef( false );\n\n\tconst currentInputIsEmpty = ! currentInputValue?.trim()?.length;\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tforceIsEditingLink !== undefined &&\n\t\t\tforceIsEditingLink !== isEditingLink\n\t\t) {\n\t\t\tsetIsEditingLink( forceIsEditingLink );\n\t\t}\n\t}, [ forceIsEditingLink ] );\n\n\tuseEffect( () => {\n\t\t// We don't auto focus into the Link UI on mount\n\t\t// because otherwise using the keyboard to select text\n\t\t// *within* the link format is not possible.\n\t\tif ( isMounting.current ) {\n\t\t\tisMounting.current = false;\n\t\t\treturn;\n\t\t}\n\t\t// Unless we are mounting, we always want to focus either:\n\t\t// - the URL input\n\t\t// - the first focusable element in the Link UI.\n\t\t// But in editing mode if there is a text input present then\n\t\t// the URL input is at index 1. If not then it is at index 0.\n\t\tconst whichFocusTargetIndex = textInputRef?.current ? 1 : 0;\n\n\t\t// Scenario - when:\n\t\t// - switching between editable and non editable LinkControl\n\t\t// - clicking on a link\n\t\t// ...then move focus to the *first* element to avoid focus loss\n\t\t// and to ensure focus is *within* the Link UI.\n\t\tconst nextFocusTarget =\n\t\t\tfocus.focusable.find( wrapperNode.current )[\n\t\t\t\twhichFocusTargetIndex\n\t\t\t] || wrapperNode.current;\n\n\t\tnextFocusTarget.focus();\n\n\t\tisEndingEditWithFocus.current = false;\n\t}, [ isEditingLink ] );\n\n\tuseEffect( () => {\n\t\t/**\n\t\t * If the value's `text` property changes then sync this\n\t\t * back up with state.\n\t\t */\n\t\tif ( value?.title && value.title !== internalTextValue ) {\n\t\t\tsetInternalTextValue( value.title );\n\t\t}\n\n\t\t/**\n\t\t * Update the state value internalInputValue if the url value changes\n\t\t * for example when clicking on another anchor\n\t\t */\n\t\tif ( value?.url ) {\n\t\t\tsetInternalInputValue( value.url );\n\t\t}\n\t}, [ value ] );\n\n\t/**\n\t * Cancels editing state and marks that focus may need to be restored after\n\t * the next render, if focus was within the wrapper when editing finished.\n\t */\n\tfunction stopEditing() {\n\t\tisEndingEditWithFocus.current = !! wrapperNode.current?.contains(\n\t\t\twrapperNode.current.ownerDocument.activeElement\n\t\t);\n\n\t\tsetIsEditingLink( false );\n\t}\n\n\tconst { createPage, isCreatingPage, errorMessage } = useCreatePage(\n\t\tcreateSuggestion\n\t);\n\n\tconst handleSelectSuggestion = ( updatedValue ) => {\n\t\tonChange( {\n\t\t\t...updatedValue,\n\t\t\ttitle: internalTextValue || updatedValue?.title,\n\t\t} );\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmit = () => {\n\t\tif (\n\t\t\tcurrentInputValue !== value?.url ||\n\t\t\tinternalTextValue !== value?.title\n\t\t) {\n\t\t\tonChange( {\n\t\t\t\turl: currentInputValue,\n\t\t\t\ttitle: internalTextValue,\n\t\t\t} );\n\t\t}\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmitWithEnter = ( event ) => {\n\t\tconst { keyCode } = event;\n\t\tif (\n\t\t\tkeyCode === ENTER &&\n\t\t\t! currentInputIsEmpty // Disallow submitting empty values.\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\thandleSubmit();\n\t\t}\n\t};\n\n\tconst shownUnlinkControl =\n\t\tonRemove && value && ! isEditingLink && ! isCreatingPage;\n\n\tconst showSettingsDrawer = !! settings?.length;\n\n\t// Only show text control once a URL value has been committed\n\t// and it isn't just empty whitespace.\n\t// See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927.\n\tconst showTextControl = value?.url?.trim()?.length > 0 && hasTextControl;\n\n\treturn (\n\t\t<div\n\t\t\ttabIndex={ -1 }\n\t\t\tref={ wrapperNode }\n\t\t\tclassName=\"block-editor-link-control\"\n\t\t>\n\t\t\t{ isCreatingPage && (\n\t\t\t\t<div className=\"block-editor-link-control__loading\">\n\t\t\t\t\t<Spinner /> { __( 'Creating' ) }…\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ ( isEditingLink || ! value ) && ! isCreatingPage && (\n\t\t\t\t<>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames( {\n\t\t\t\t\t\t\t'block-editor-link-control__search-input-wrapper': true,\n\t\t\t\t\t\t\t'has-text-control': showTextControl,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ showTextControl && (\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tref={ textInputRef }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__text-content\"\n\t\t\t\t\t\t\t\tlabel=\"Text\"\n\t\t\t\t\t\t\t\tvalue={ internalTextValue }\n\t\t\t\t\t\t\t\tonChange={ setInternalTextValue }\n\t\t\t\t\t\t\t\tonKeyDown={ handleSubmitWithEnter }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t<LinkControlSearchInput\n\t\t\t\t\t\t\tcurrentLink={ value }\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__search-input\"\n\t\t\t\t\t\t\tplaceholder={ searchInputPlaceholder }\n\t\t\t\t\t\t\tvalue={ currentInputValue }\n\t\t\t\t\t\t\twithCreateSuggestion={ withCreateSuggestion }\n\t\t\t\t\t\t\tonCreateSuggestion={ createPage }\n\t\t\t\t\t\t\tonChange={ setInternalInputValue }\n\t\t\t\t\t\t\tonSelect={ handleSelectSuggestion }\n\t\t\t\t\t\t\tshowInitialSuggestions={ showInitialSuggestions }\n\t\t\t\t\t\t\tallowDirectEntry={ ! noDirectEntry }\n\t\t\t\t\t\t\tshowSuggestions={ showSuggestions }\n\t\t\t\t\t\t\tsuggestionsQuery={ suggestionsQuery }\n\t\t\t\t\t\t\twithURLSuggestion={ ! noURLSuggestion }\n\t\t\t\t\t\t\tcreateSuggestionButtonText={\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tuseLabel={ showTextControl }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"block-editor-link-control__search-actions\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tonClick={ handleSubmit }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Submit' ) }\n\t\t\t\t\t\t\t\t\ticon={ keyboardReturn }\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-submit\"\n\t\t\t\t\t\t\t\t\tdisabled={ currentInputIsEmpty } // Disallow submitting empty values.\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</LinkControlSearchInput>\n\t\t\t\t\t</div>\n\t\t\t\t\t{ errorMessage && (\n\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-error\"\n\t\t\t\t\t\t\tstatus=\"error\"\n\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ errorMessage }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ value && ! isEditingLink && ! isCreatingPage && (\n\t\t\t\t<LinkPreview\n\t\t\t\t\tkey={ value?.url } // force remount when URL changes to avoid race conditions for rich previews\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonEditClick={ () => setIsEditingLink( true ) }\n\t\t\t\t\thasRichPreviews={ hasRichPreviews }\n\t\t\t\t\thasUnlinkControl={ shownUnlinkControl }\n\t\t\t\t\tonRemove={ onRemove }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ showSettingsDrawer && (\n\t\t\t\t<div className=\"block-editor-link-control__tools\">\n\t\t\t\t\t<LinkControlSettingsDrawer\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ renderControlBottom && renderControlBottom() }\n\t\t</div>\n\t);\n}\n\nLinkControl.ViewerFill = ViewerFill;\n\nexport default LinkControl;\n"]}
@@ -98,7 +98,7 @@ const LinkControlSearchInput = (0, _element.forwardRef)((_ref, ref) => {
98
98
  let suggestion = selectedSuggestion;
99
99
 
100
100
  if (_constants.CREATE_TYPE === selectedSuggestion.type) {
101
- // Create a new page and call onSelect with the output from the onCreateSuggestion callback
101
+ // Create a new page and call onSelect with the output from the onCreateSuggestion callback.
102
102
  try {
103
103
  var _suggestion;
104
104
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-input.js"],"names":["noopSearchHandler","Promise","resolve","LinkControlSearchInput","ref","value","children","currentLink","className","placeholder","withCreateSuggestion","onCreateSuggestion","noop","onChange","onSelect","showSuggestions","renderSuggestions","props","fetchSuggestions","allowDirectEntry","showInitialSuggestions","suggestionsQuery","withURLSuggestion","createSuggestionButtonText","useLabel","genericSearchHandler","searchHandler","instanceId","focusedSuggestion","setFocusedSuggestion","onInputChange","selection","suggestion","handleRenderSuggestions","currentInputValue","handleSuggestionClick","onSuggestionSelected","selectedSuggestion","CREATE_TYPE","type","title","url","e","Object","keys","length","inputClasses","undefined","event","hasSuggestion","trim","preventDefault"],"mappings":";;;;;;;;;AASA;;AANA;;AACA;;AAIA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AAMA;AACA;AACA;AACA,MAAMA,iBAAiB,GAAG,MAAMC,OAAO,CAACC,OAAR,CAAiB,EAAjB,CAAhC;;AAEA,MAAMC,sBAAsB,GAAG,yBAC9B,OAuBCC,GAvBD,KAwBK;AAAA,MAvBJ;AACCC,IAAAA,KADD;AAECC,IAAAA,QAFD;AAGCC,IAAAA,WAAW,GAAG,EAHf;AAICC,IAAAA,SAAS,GAAG,IAJb;AAKCC,IAAAA,WAAW,GAAG,IALf;AAMCC,IAAAA,oBAAoB,GAAG,KANxB;AAOCC,IAAAA,kBAAkB,GAAGC,YAPtB;AAQCC,IAAAA,QAAQ,GAAGD,YARZ;AASCE,IAAAA,QAAQ,GAAGF,YATZ;AAUCG,IAAAA,eAAe,GAAG,IAVnB;AAWCC,IAAAA,iBAAiB,GAAKC,KAAF,IACnB,4BAAC,sBAAD,EAA+BA,KAA/B,CAZF;AAcCC,IAAAA,gBAAgB,GAAG,IAdpB;AAeCC,IAAAA,gBAAgB,GAAG,IAfpB;AAgBCC,IAAAA,sBAAsB,GAAG,KAhB1B;AAiBCC,IAAAA,gBAAgB,GAAG,EAjBpB;AAkBCC,IAAAA,iBAAiB,GAAG,IAlBrB;AAmBCC,IAAAA,0BAnBD;AAoBCC,IAAAA,QAAQ,GAAG;AApBZ,GAuBI;AACJ,QAAMC,oBAAoB,GAAG,+BAC5BJ,gBAD4B,EAE5BF,gBAF4B,EAG5BT,oBAH4B,EAI5BY,iBAJ4B,CAA7B;AAOA,QAAMI,aAAa,GAAGX,eAAe,GAClCG,gBAAgB,IAAIO,oBADc,GAElCzB,iBAFH;AAIA,QAAM2B,UAAU,GAAG,4BAAexB,sBAAf,CAAnB;AACA,QAAM,CAAEy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Press dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { forwardRef, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { URLInput } from '../';\nimport LinkControlSearchResults from './search-results';\nimport { CREATE_TYPE } from './constants';\nimport useSearchHandler from './use-search-handler';\n\n// Must be a function as otherwise URLInput will default\n// to the fetchLinkSuggestions passed in block editor settings\n// which will cause an unintended http request.\nconst noopSearchHandler = () => Promise.resolve( [] );\n\nconst LinkControlSearchInput = forwardRef(\n\t(\n\t\t{\n\t\t\tvalue,\n\t\t\tchildren,\n\t\t\tcurrentLink = {},\n\t\t\tclassName = null,\n\t\t\tplaceholder = null,\n\t\t\twithCreateSuggestion = false,\n\t\t\tonCreateSuggestion = noop,\n\t\t\tonChange = noop,\n\t\t\tonSelect = noop,\n\t\t\tshowSuggestions = true,\n\t\t\trenderSuggestions = ( props ) => (\n\t\t\t\t<LinkControlSearchResults { ...props } />\n\t\t\t),\n\t\t\tfetchSuggestions = null,\n\t\t\tallowDirectEntry = true,\n\t\t\tshowInitialSuggestions = false,\n\t\t\tsuggestionsQuery = {},\n\t\t\twithURLSuggestion = true,\n\t\t\tcreateSuggestionButtonText,\n\t\t\tuseLabel = false,\n\t\t},\n\t\tref\n\t) => {\n\t\tconst genericSearchHandler = useSearchHandler(\n\t\t\tsuggestionsQuery,\n\t\t\tallowDirectEntry,\n\t\t\twithCreateSuggestion,\n\t\t\twithURLSuggestion\n\t\t);\n\n\t\tconst searchHandler = showSuggestions\n\t\t\t? fetchSuggestions || genericSearchHandler\n\t\t\t: noopSearchHandler;\n\n\t\tconst instanceId = useInstanceId( LinkControlSearchInput );\n\t\tconst [ focusedSuggestion, setFocusedSuggestion ] = useState();\n\n\t\t/**\n\t\t * Handles the user moving between different suggestions. Does not handle\n\t\t * choosing an individual item.\n\t\t *\n\t\t * @param {string} selection the url of the selected suggestion.\n\t\t * @param {Object} suggestion the suggestion object.\n\t\t */\n\t\tconst onInputChange = ( selection, suggestion ) => {\n\t\t\tonChange( selection );\n\t\t\tsetFocusedSuggestion( suggestion );\n\t\t};\n\n\t\tconst handleRenderSuggestions = ( props ) =>\n\t\t\trenderSuggestions( {\n\t\t\t\t...props,\n\t\t\t\tinstanceId,\n\t\t\t\twithCreateSuggestion,\n\t\t\t\tcurrentInputValue: value,\n\t\t\t\tcreateSuggestionButtonText,\n\t\t\t\tsuggestionsQuery,\n\t\t\t\thandleSuggestionClick: ( suggestion ) => {\n\t\t\t\t\tif ( props.handleSuggestionClick ) {\n\t\t\t\t\t\tprops.handleSuggestionClick( suggestion );\n\t\t\t\t\t}\n\t\t\t\t\tonSuggestionSelected( suggestion );\n\t\t\t\t},\n\t\t\t} );\n\n\t\tconst onSuggestionSelected = async ( selectedSuggestion ) => {\n\t\t\tlet suggestion = selectedSuggestion;\n\t\t\tif ( CREATE_TYPE === selectedSuggestion.type ) {\n\t\t\t\t// Create a new page and call onSelect with the output from the onCreateSuggestion callback\n\t\t\t\ttry {\n\t\t\t\t\tsuggestion = await onCreateSuggestion(\n\t\t\t\t\t\tselectedSuggestion.title\n\t\t\t\t\t);\n\t\t\t\t\tif ( suggestion?.url ) {\n\t\t\t\t\t\tonSelect( suggestion );\n\t\t\t\t\t}\n\t\t\t\t} catch ( e ) {}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tallowDirectEntry ||\n\t\t\t\t( suggestion && Object.keys( suggestion ).length >= 1 )\n\t\t\t) {\n\t\t\t\tonSelect(\n\t\t\t\t\t// Some direct entries don't have types or IDs, and we still need to clear the previous ones.\n\t\t\t\t\t{ ...omit( currentLink, 'id', 'url' ), ...suggestion },\n\t\t\t\t\tsuggestion\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\tconst inputClasses = classnames( className, {\n\t\t\t'has-no-label': ! useLabel,\n\t\t} );\n\n\t\treturn (\n\t\t\t<div className=\"block-editor-link-control__search-input-container\">\n\t\t\t\t<URLInput\n\t\t\t\t\tlabel={ useLabel ? 'URL' : undefined }\n\t\t\t\t\tclassName={ inputClasses }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onInputChange }\n\t\t\t\t\tplaceholder={ placeholder ?? __( 'Search or type url' ) }\n\t\t\t\t\t__experimentalRenderSuggestions={\n\t\t\t\t\t\tshowSuggestions ? handleRenderSuggestions : null\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalFetchLinkSuggestions={ searchHandler }\n\t\t\t\t\t__experimentalHandleURLSuggestions={ true }\n\t\t\t\t\t__experimentalShowInitialSuggestions={\n\t\t\t\t\t\tshowInitialSuggestions\n\t\t\t\t\t}\n\t\t\t\t\tonSubmit={ ( suggestion, event ) => {\n\t\t\t\t\t\tconst hasSuggestion = suggestion || focusedSuggestion;\n\n\t\t\t\t\t\t// If there is no suggestion and the value (ie: any manually entered URL) is empty\n\t\t\t\t\t\t// then don't allow submission otherwise we get empty links.\n\t\t\t\t\t\tif ( ! hasSuggestion && ! value?.trim()?.length ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tonSuggestionSelected(\n\t\t\t\t\t\t\t\thasSuggestion || { url: value }\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\tref={ ref }\n\t\t\t\t/>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nexport default LinkControlSearchInput;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-input.js"],"names":["noopSearchHandler","Promise","resolve","LinkControlSearchInput","ref","value","children","currentLink","className","placeholder","withCreateSuggestion","onCreateSuggestion","noop","onChange","onSelect","showSuggestions","renderSuggestions","props","fetchSuggestions","allowDirectEntry","showInitialSuggestions","suggestionsQuery","withURLSuggestion","createSuggestionButtonText","useLabel","genericSearchHandler","searchHandler","instanceId","focusedSuggestion","setFocusedSuggestion","onInputChange","selection","suggestion","handleRenderSuggestions","currentInputValue","handleSuggestionClick","onSuggestionSelected","selectedSuggestion","CREATE_TYPE","type","title","url","e","Object","keys","length","inputClasses","undefined","event","hasSuggestion","trim","preventDefault"],"mappings":";;;;;;;;;AASA;;AANA;;AACA;;AAIA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AAMA;AACA;AACA;AACA,MAAMA,iBAAiB,GAAG,MAAMC,OAAO,CAACC,OAAR,CAAiB,EAAjB,CAAhC;;AAEA,MAAMC,sBAAsB,GAAG,yBAC9B,OAuBCC,GAvBD,KAwBK;AAAA,MAvBJ;AACCC,IAAAA,KADD;AAECC,IAAAA,QAFD;AAGCC,IAAAA,WAAW,GAAG,EAHf;AAICC,IAAAA,SAAS,GAAG,IAJb;AAKCC,IAAAA,WAAW,GAAG,IALf;AAMCC,IAAAA,oBAAoB,GAAG,KANxB;AAOCC,IAAAA,kBAAkB,GAAGC,YAPtB;AAQCC,IAAAA,QAAQ,GAAGD,YARZ;AASCE,IAAAA,QAAQ,GAAGF,YATZ;AAUCG,IAAAA,eAAe,GAAG,IAVnB;AAWCC,IAAAA,iBAAiB,GAAKC,KAAF,IACnB,4BAAC,sBAAD,EAA+BA,KAA/B,CAZF;AAcCC,IAAAA,gBAAgB,GAAG,IAdpB;AAeCC,IAAAA,gBAAgB,GAAG,IAfpB;AAgBCC,IAAAA,sBAAsB,GAAG,KAhB1B;AAiBCC,IAAAA,gBAAgB,GAAG,EAjBpB;AAkBCC,IAAAA,iBAAiB,GAAG,IAlBrB;AAmBCC,IAAAA,0BAnBD;AAoBCC,IAAAA,QAAQ,GAAG;AApBZ,GAuBI;AACJ,QAAMC,oBAAoB,GAAG,+BAC5BJ,gBAD4B,EAE5BF,gBAF4B,EAG5BT,oBAH4B,EAI5BY,iBAJ4B,CAA7B;AAOA,QAAMI,aAAa,GAAGX,eAAe,GAClCG,gBAAgB,IAAIO,oBADc,GAElCzB,iBAFH;AAIA,QA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dependencies\n */\nimport { noop, omit } from 'lodash';\nimport classnames from 'classnames';\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { forwardRef, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { URLInput } from '../';\nimport LinkControlSearchResults from './search-results';\nimport { CREATE_TYPE } from './constants';\nimport useSearchHandler from './use-search-handler';\n\n// Must be a function as otherwise URLInput will default\n// to the fetchLinkSuggestions passed in block editor settings\n// which will cause an unintended http request.\nconst noopSearchHandler = () => Promise.resolve( [] );\n\nconst LinkControlSearchInput = forwardRef(\n\t(\n\t\t{\n\t\t\tvalue,\n\t\t\tchildren,\n\t\t\tcurrentLink = {},\n\t\t\tclassName = null,\n\t\t\tplaceholder = null,\n\t\t\twithCreateSuggestion = false,\n\t\t\tonCreateSuggestion = noop,\n\t\t\tonChange = noop,\n\t\t\tonSelect = noop,\n\t\t\tshowSuggestions = true,\n\t\t\trenderSuggestions = ( props ) => (\n\t\t\t\t<LinkControlSearchResults { ...props } />\n\t\t\t),\n\t\t\tfetchSuggestions = null,\n\t\t\tallowDirectEntry = true,\n\t\t\tshowInitialSuggestions = false,\n\t\t\tsuggestionsQuery = {},\n\t\t\twithURLSuggestion = true,\n\t\t\tcreateSuggestionButtonText,\n\t\t\tuseLabel = false,\n\t\t},\n\t\tref\n\t) => {\n\t\tconst genericSearchHandler = useSearchHandler(\n\t\t\tsuggestionsQuery,\n\t\t\tallowDirectEntry,\n\t\t\twithCreateSuggestion,\n\t\t\twithURLSuggestion\n\t\t);\n\n\t\tconst searchHandler = showSuggestions\n\t\t\t? fetchSuggestions || genericSearchHandler\n\t\t\t: noopSearchHandler;\n\n\t\tconst instanceId = useInstanceId( LinkControlSearchInput );\n\t\tconst [ focusedSuggestion, setFocusedSuggestion ] = useState();\n\n\t\t/**\n\t\t * Handles the user moving between different suggestions. Does not handle\n\t\t * choosing an individual item.\n\t\t *\n\t\t * @param {string} selection the url of the selected suggestion.\n\t\t * @param {Object} suggestion the suggestion object.\n\t\t */\n\t\tconst onInputChange = ( selection, suggestion ) => {\n\t\t\tonChange( selection );\n\t\t\tsetFocusedSuggestion( suggestion );\n\t\t};\n\n\t\tconst handleRenderSuggestions = ( props ) =>\n\t\t\trenderSuggestions( {\n\t\t\t\t...props,\n\t\t\t\tinstanceId,\n\t\t\t\twithCreateSuggestion,\n\t\t\t\tcurrentInputValue: value,\n\t\t\t\tcreateSuggestionButtonText,\n\t\t\t\tsuggestionsQuery,\n\t\t\t\thandleSuggestionClick: ( suggestion ) => {\n\t\t\t\t\tif ( props.handleSuggestionClick ) {\n\t\t\t\t\t\tprops.handleSuggestionClick( suggestion );\n\t\t\t\t\t}\n\t\t\t\t\tonSuggestionSelected( suggestion );\n\t\t\t\t},\n\t\t\t} );\n\n\t\tconst onSuggestionSelected = async ( selectedSuggestion ) => {\n\t\t\tlet suggestion = selectedSuggestion;\n\t\t\tif ( CREATE_TYPE === selectedSuggestion.type ) {\n\t\t\t\t// Create a new page and call onSelect with the output from the onCreateSuggestion callback.\n\t\t\t\ttry {\n\t\t\t\t\tsuggestion = await onCreateSuggestion(\n\t\t\t\t\t\tselectedSuggestion.title\n\t\t\t\t\t);\n\t\t\t\t\tif ( suggestion?.url ) {\n\t\t\t\t\t\tonSelect( suggestion );\n\t\t\t\t\t}\n\t\t\t\t} catch ( e ) {}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tallowDirectEntry ||\n\t\t\t\t( suggestion && Object.keys( suggestion ).length >= 1 )\n\t\t\t) {\n\t\t\t\tonSelect(\n\t\t\t\t\t// Some direct entries don't have types or IDs, and we still need to clear the previous ones.\n\t\t\t\t\t{ ...omit( currentLink, 'id', 'url' ), ...suggestion },\n\t\t\t\t\tsuggestion\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\tconst inputClasses = classnames( className, {\n\t\t\t'has-no-label': ! useLabel,\n\t\t} );\n\n\t\treturn (\n\t\t\t<div className=\"block-editor-link-control__search-input-container\">\n\t\t\t\t<URLInput\n\t\t\t\t\tlabel={ useLabel ? 'URL' : undefined }\n\t\t\t\t\tclassName={ inputClasses }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onInputChange }\n\t\t\t\t\tplaceholder={ placeholder ?? __( 'Search or type url' ) }\n\t\t\t\t\t__experimentalRenderSuggestions={\n\t\t\t\t\t\tshowSuggestions ? handleRenderSuggestions : null\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalFetchLinkSuggestions={ searchHandler }\n\t\t\t\t\t__experimentalHandleURLSuggestions={ true }\n\t\t\t\t\t__experimentalShowInitialSuggestions={\n\t\t\t\t\t\tshowInitialSuggestions\n\t\t\t\t\t}\n\t\t\t\t\tonSubmit={ ( suggestion, event ) => {\n\t\t\t\t\t\tconst hasSuggestion = suggestion || focusedSuggestion;\n\n\t\t\t\t\t\t// If there is no suggestion and the value (ie: any manually entered URL) is empty\n\t\t\t\t\t\t// then don't allow submission otherwise we get empty links.\n\t\t\t\t\t\tif ( ! hasSuggestion && ! value?.trim()?.length ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tonSuggestionSelected(\n\t\t\t\t\t\t\t\thasSuggestion || { url: value }\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\tref={ ref }\n\t\t\t\t/>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nexport default LinkControlSearchInput;\n"]}