@wordpress/block-editor 9.2.0 → 9.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (453) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/autocompleters/block.js +3 -1
  3. package/build/autocompleters/block.js.map +1 -1
  4. package/build/components/block-actions/index.js.map +1 -1
  5. package/build/components/block-alignment-control/ui.js.map +1 -1
  6. package/build/components/block-alignment-matrix-control/index.js +3 -7
  7. package/build/components/block-alignment-matrix-control/index.js.map +1 -1
  8. package/build/components/block-breadcrumb/index.js.map +1 -1
  9. package/build/components/block-content-overlay/index.js.map +1 -1
  10. package/build/components/block-context/index.js.map +1 -1
  11. package/build/components/block-controls/hook.js.map +1 -1
  12. package/build/components/block-draggable/index.js.map +1 -1
  13. package/build/components/block-draggable/index.native.js.map +1 -1
  14. package/build/components/block-list/block-list-item.native.js.map +1 -1
  15. package/build/components/block-list/block-selection-button.native.js.map +1 -1
  16. package/build/components/block-list/block.js.map +1 -1
  17. package/build/components/block-list/block.native.js.map +1 -1
  18. package/build/components/block-list/index.js.map +1 -1
  19. package/build/components/block-list/index.native.js.map +1 -1
  20. package/build/components/block-list/use-block-props/index.js.map +1 -1
  21. package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +1 -1
  22. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  23. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  24. package/build/components/block-list-appender/index.js.map +1 -1
  25. package/build/components/block-list-appender/index.native.js.map +1 -1
  26. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  27. package/build/components/block-mover/button.js.map +1 -1
  28. package/build/components/block-mover/index.native.js.map +1 -1
  29. package/build/components/block-parent-selector/index.js.map +1 -1
  30. package/build/components/block-pattern-setup/index.js +1 -1
  31. package/build/components/block-pattern-setup/index.js.map +1 -1
  32. package/build/components/block-preview/auto.js.map +1 -1
  33. package/build/components/block-selection-clearer/index.js.map +1 -1
  34. package/build/components/block-settings-menu/block-mode-toggle.js +3 -7
  35. package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  36. package/build/components/block-settings-menu/block-settings-dropdown.js +6 -3
  37. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  38. package/build/components/block-styles/index.js +6 -3
  39. package/build/components/block-styles/index.js.map +1 -1
  40. package/build/components/block-styles/menu-items.js +3 -7
  41. package/build/components/block-styles/menu-items.js.map +1 -1
  42. package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
  43. package/build/components/block-toolbar/index.native.js.map +1 -1
  44. package/build/components/block-toolbar/utils.js +5 -8
  45. package/build/components/block-toolbar/utils.js.map +1 -1
  46. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  47. package/build/components/block-tools/index.js.map +1 -1
  48. package/build/components/block-types-list/index.native.js.map +1 -1
  49. package/build/components/block-variation-transforms/index.js.map +1 -1
  50. package/build/components/color-style-selector/index.js.map +1 -1
  51. package/build/components/colors/with-colors.js.map +1 -1
  52. package/build/components/colors-gradients/dropdown.js.map +1 -1
  53. package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
  54. package/build/components/copy-handler/index.js +17 -1
  55. package/build/components/copy-handler/index.js.map +1 -1
  56. package/build/components/default-block-appender/index.js.map +1 -1
  57. package/build/components/default-block-appender/index.native.js.map +1 -1
  58. package/build/components/default-style-picker/index.js.map +1 -1
  59. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  60. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  61. package/build/components/image-size-control/index.js +3 -1
  62. package/build/components/image-size-control/index.js.map +1 -1
  63. package/build/components/index.js +18 -0
  64. package/build/components/index.js.map +1 -1
  65. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  66. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  67. package/build/components/inserter/block-types-tab.native.js.map +1 -1
  68. package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  69. package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
  70. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  71. package/build/components/inserter/index.js.map +1 -1
  72. package/build/components/inserter/index.native.js.map +1 -1
  73. package/build/components/inserter/library.js +3 -7
  74. package/build/components/inserter/library.js.map +1 -1
  75. package/build/components/inserter/menu.js.map +1 -1
  76. package/build/components/inserter/menu.native.js.map +1 -1
  77. package/build/components/inserter/no-results.native.js.map +1 -1
  78. package/build/components/inserter/quick-inserter.js.map +1 -1
  79. package/build/components/inserter/search-items.js +1 -1
  80. package/build/components/inserter/search-items.js.map +1 -1
  81. package/build/components/inserter/search-results.native.js.map +1 -1
  82. package/build/components/inspector-popover-header/index.js +56 -0
  83. package/build/components/inspector-popover-header/index.js.map +1 -0
  84. package/build/components/line-height-control/index.js.map +1 -1
  85. package/build/components/link-control/index.js +4 -4
  86. package/build/components/link-control/index.js.map +1 -1
  87. package/build/components/link-control/search-create-button.js +1 -3
  88. package/build/components/link-control/search-create-button.js.map +1 -1
  89. package/build/components/link-control/search-input.js +5 -3
  90. package/build/components/link-control/search-input.js.map +1 -1
  91. package/build/components/link-control/settings-drawer.js +3 -7
  92. package/build/components/link-control/settings-drawer.js.map +1 -1
  93. package/build/components/link-control/use-search-handler.js.map +1 -1
  94. package/build/components/list-view/block-contents.js.map +1 -1
  95. package/build/components/list-view/branch.js.map +1 -1
  96. package/build/components/list-view/index.js.map +1 -1
  97. package/build/components/list-view/use-block-selection.js.map +1 -1
  98. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  99. package/build/components/list-view/utils.js +1 -7
  100. package/build/components/list-view/utils.js.map +1 -1
  101. package/build/components/media-placeholder/index.js +4 -4
  102. package/build/components/media-placeholder/index.js.map +1 -1
  103. package/build/components/media-replace-flow/index.js +20 -5
  104. package/build/components/media-replace-flow/index.js.map +1 -1
  105. package/build/components/media-upload/index.native.js +1 -1
  106. package/build/components/media-upload/index.native.js.map +1 -1
  107. package/build/components/navigable-toolbar/index.js.map +1 -1
  108. package/build/components/plain-text/index.native.js.map +1 -1
  109. package/build/components/preview-options/index.js +4 -0
  110. package/build/components/preview-options/index.js.map +1 -1
  111. package/build/components/provider/use-block-sync.js +5 -3
  112. package/build/components/provider/use-block-sync.js.map +1 -1
  113. package/build/components/publish-date-time-picker/index.js +14 -16
  114. package/build/components/publish-date-time-picker/index.js.map +1 -1
  115. package/build/components/rich-text/embed-handler-picker.native.js +4 -8
  116. package/build/components/rich-text/embed-handler-picker.native.js.map +1 -1
  117. package/build/components/rich-text/index.js.map +1 -1
  118. package/build/components/rich-text/use-format-types.js.map +1 -1
  119. package/build/components/rich-text/use-mark-persistent.js.map +1 -1
  120. package/build/components/skip-to-selected-block/index.js.map +1 -1
  121. package/build/components/ungroup-button/index.native.js +3 -7
  122. package/build/components/ungroup-button/index.native.js.map +1 -1
  123. package/build/components/url-input/index.js +14 -3
  124. package/build/components/url-input/index.js.map +1 -1
  125. package/build/components/use-block-display-information/index.js.map +1 -1
  126. package/build/components/use-block-drop-zone/index.js.map +1 -1
  127. package/build/components/use-block-drop-zone/index.native.js.map +1 -1
  128. package/build/components/use-display-block-controls/index.native.js.map +1 -1
  129. package/build/components/use-on-block-drop/index.js.map +1 -1
  130. package/build/components/use-on-block-drop/index.native.js.map +1 -1
  131. package/build/components/use-setting/index.js.map +1 -1
  132. package/build/components/writing-flow/use-arrow-nav.js +12 -12
  133. package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
  134. package/build/components/writing-flow/use-click-selection.js.map +1 -1
  135. package/build/components/writing-flow/use-drag-selection.js.map +1 -1
  136. package/build/components/writing-flow/use-multi-selection.js.map +1 -1
  137. package/build/components/writing-flow/use-select-all.js.map +1 -1
  138. package/build/components/writing-flow/use-selection-observer.js.map +1 -1
  139. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  140. package/build/hooks/color-panel.js.map +1 -1
  141. package/build/hooks/color-panel.native.js.map +1 -1
  142. package/build/hooks/color.js.map +1 -1
  143. package/build/hooks/font-family.js.map +1 -1
  144. package/build/hooks/gap.js.map +1 -1
  145. package/build/hooks/layout.js +38 -1
  146. package/build/hooks/layout.js.map +1 -1
  147. package/build/store/actions.js.map +1 -1
  148. package/build/store/reducer.js.map +1 -1
  149. package/build/store/selectors.js +1 -1
  150. package/build/store/selectors.js.map +1 -1
  151. package/build/utils/pasting.js.map +1 -1
  152. package/build/utils/transform-styles/transforms/wrap.js.map +1 -1
  153. package/build-module/autocompleters/block.js +4 -1
  154. package/build-module/autocompleters/block.js.map +1 -1
  155. package/build-module/components/block-actions/index.js.map +1 -1
  156. package/build-module/components/block-alignment-control/ui.js.map +1 -1
  157. package/build-module/components/block-alignment-matrix-control/index.js +2 -5
  158. package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
  159. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  160. package/build-module/components/block-content-overlay/index.js.map +1 -1
  161. package/build-module/components/block-context/index.js.map +1 -1
  162. package/build-module/components/block-controls/hook.js.map +1 -1
  163. package/build-module/components/block-draggable/index.js.map +1 -1
  164. package/build-module/components/block-draggable/index.native.js.map +1 -1
  165. package/build-module/components/block-list/block-list-item.native.js.map +1 -1
  166. package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
  167. package/build-module/components/block-list/block.js.map +1 -1
  168. package/build-module/components/block-list/block.native.js.map +1 -1
  169. package/build-module/components/block-list/index.js.map +1 -1
  170. package/build-module/components/block-list/index.native.js.map +1 -1
  171. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  172. package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +1 -1
  173. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  174. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  175. package/build-module/components/block-list-appender/index.js.map +1 -1
  176. package/build-module/components/block-list-appender/index.native.js.map +1 -1
  177. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  178. package/build-module/components/block-mover/button.js.map +1 -1
  179. package/build-module/components/block-mover/index.native.js.map +1 -1
  180. package/build-module/components/block-parent-selector/index.js.map +1 -1
  181. package/build-module/components/block-pattern-setup/index.js +1 -1
  182. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  183. package/build-module/components/block-preview/auto.js.map +1 -1
  184. package/build-module/components/block-selection-clearer/index.js.map +1 -1
  185. package/build-module/components/block-settings-menu/block-mode-toggle.js +3 -5
  186. package/build-module/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  187. package/build-module/components/block-settings-menu/block-settings-dropdown.js +9 -3
  188. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  189. package/build-module/components/block-styles/index.js +5 -2
  190. package/build-module/components/block-styles/index.js.map +1 -1
  191. package/build-module/components/block-styles/menu-items.js +3 -5
  192. package/build-module/components/block-styles/menu-items.js.map +1 -1
  193. package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
  194. package/build-module/components/block-toolbar/index.native.js.map +1 -1
  195. package/build-module/components/block-toolbar/utils.js +3 -5
  196. package/build-module/components/block-toolbar/utils.js.map +1 -1
  197. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  198. package/build-module/components/block-tools/index.js.map +1 -1
  199. package/build-module/components/block-types-list/index.native.js.map +1 -1
  200. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  201. package/build-module/components/color-style-selector/index.js.map +1 -1
  202. package/build-module/components/colors/with-colors.js.map +1 -1
  203. package/build-module/components/colors-gradients/dropdown.js.map +1 -1
  204. package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
  205. package/build-module/components/copy-handler/index.js +18 -2
  206. package/build-module/components/copy-handler/index.js.map +1 -1
  207. package/build-module/components/default-block-appender/index.js.map +1 -1
  208. package/build-module/components/default-block-appender/index.native.js.map +1 -1
  209. package/build-module/components/default-style-picker/index.js.map +1 -1
  210. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  211. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  212. package/build-module/components/image-size-control/index.js +4 -1
  213. package/build-module/components/image-size-control/index.js.map +1 -1
  214. package/build-module/components/index.js +2 -0
  215. package/build-module/components/index.js.map +1 -1
  216. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  217. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  218. package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
  219. package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  220. package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
  221. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  222. package/build-module/components/inserter/index.js.map +1 -1
  223. package/build-module/components/inserter/index.native.js.map +1 -1
  224. package/build-module/components/inserter/library.js +2 -5
  225. package/build-module/components/inserter/library.js.map +1 -1
  226. package/build-module/components/inserter/menu.js.map +1 -1
  227. package/build-module/components/inserter/menu.native.js.map +1 -1
  228. package/build-module/components/inserter/no-results.native.js.map +1 -1
  229. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  230. package/build-module/components/inserter/search-items.js +2 -2
  231. package/build-module/components/inserter/search-items.js.map +1 -1
  232. package/build-module/components/inserter/search-results.native.js.map +1 -1
  233. package/build-module/components/inspector-popover-header/index.js +46 -0
  234. package/build-module/components/inspector-popover-header/index.js.map +1 -0
  235. package/build-module/components/line-height-control/index.js.map +1 -1
  236. package/build-module/components/link-control/index.js +2 -1
  237. package/build-module/components/link-control/index.js.map +1 -1
  238. package/build-module/components/link-control/search-create-button.js +1 -2
  239. package/build-module/components/link-control/search-create-button.js.map +1 -1
  240. package/build-module/components/link-control/search-input.js +3 -1
  241. package/build-module/components/link-control/search-input.js.map +1 -1
  242. package/build-module/components/link-control/settings-drawer.js +2 -5
  243. package/build-module/components/link-control/settings-drawer.js.map +1 -1
  244. package/build-module/components/link-control/use-search-handler.js.map +1 -1
  245. package/build-module/components/list-view/block-contents.js.map +1 -1
  246. package/build-module/components/list-view/branch.js.map +1 -1
  247. package/build-module/components/list-view/index.js.map +1 -1
  248. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  249. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  250. package/build-module/components/list-view/utils.js +1 -6
  251. package/build-module/components/list-view/utils.js.map +1 -1
  252. package/build-module/components/media-placeholder/index.js +2 -1
  253. package/build-module/components/media-placeholder/index.js.map +1 -1
  254. package/build-module/components/media-replace-flow/index.js +22 -7
  255. package/build-module/components/media-replace-flow/index.js.map +1 -1
  256. package/build-module/components/media-upload/index.native.js +1 -1
  257. package/build-module/components/media-upload/index.native.js.map +1 -1
  258. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  259. package/build-module/components/plain-text/index.native.js.map +1 -1
  260. package/build-module/components/preview-options/index.js +4 -0
  261. package/build-module/components/preview-options/index.js.map +1 -1
  262. package/build-module/components/provider/use-block-sync.js +4 -1
  263. package/build-module/components/provider/use-block-sync.js.map +1 -1
  264. package/build-module/components/publish-date-time-picker/index.js +14 -16
  265. package/build-module/components/publish-date-time-picker/index.js.map +1 -1
  266. package/build-module/components/rich-text/embed-handler-picker.native.js +3 -5
  267. package/build-module/components/rich-text/embed-handler-picker.native.js.map +1 -1
  268. package/build-module/components/rich-text/index.js.map +1 -1
  269. package/build-module/components/rich-text/use-format-types.js.map +1 -1
  270. package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
  271. package/build-module/components/skip-to-selected-block/index.js.map +1 -1
  272. package/build-module/components/ungroup-button/index.native.js +3 -5
  273. package/build-module/components/ungroup-button/index.native.js.map +1 -1
  274. package/build-module/components/url-input/index.js +11 -1
  275. package/build-module/components/url-input/index.js.map +1 -1
  276. package/build-module/components/use-block-display-information/index.js.map +1 -1
  277. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  278. package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
  279. package/build-module/components/use-display-block-controls/index.native.js.map +1 -1
  280. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  281. package/build-module/components/use-on-block-drop/index.native.js.map +1 -1
  282. package/build-module/components/use-setting/index.js.map +1 -1
  283. package/build-module/components/writing-flow/use-arrow-nav.js +12 -11
  284. package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
  285. package/build-module/components/writing-flow/use-click-selection.js.map +1 -1
  286. package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
  287. package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
  288. package/build-module/components/writing-flow/use-select-all.js.map +1 -1
  289. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
  290. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  291. package/build-module/hooks/color-panel.js.map +1 -1
  292. package/build-module/hooks/color-panel.native.js.map +1 -1
  293. package/build-module/hooks/color.js.map +1 -1
  294. package/build-module/hooks/font-family.js.map +1 -1
  295. package/build-module/hooks/gap.js.map +1 -1
  296. package/build-module/hooks/layout.js +39 -2
  297. package/build-module/hooks/layout.js.map +1 -1
  298. package/build-module/store/actions.js.map +1 -1
  299. package/build-module/store/reducer.js.map +1 -1
  300. package/build-module/store/selectors.js +2 -2
  301. package/build-module/store/selectors.js.map +1 -1
  302. package/build-module/utils/pasting.js.map +1 -1
  303. package/build-module/utils/transform-styles/transforms/wrap.js.map +1 -1
  304. package/build-style/style-rtl.css +16 -23
  305. package/build-style/style.css +16 -23
  306. package/package.json +28 -28
  307. package/src/autocompleters/block.js +2 -1
  308. package/src/components/block-actions/index.js +2 -3
  309. package/src/components/block-alignment-control/ui.js +4 -6
  310. package/src/components/block-alignment-matrix-control/index.js +2 -4
  311. package/src/components/block-breadcrumb/index.js +2 -5
  312. package/src/components/block-compare/test/block-view.js +2 -1
  313. package/src/components/block-content-overlay/index.js +2 -5
  314. package/src/components/block-context/index.js +4 -4
  315. package/src/components/block-controls/hook.js +2 -3
  316. package/src/components/block-draggable/index.js +6 -13
  317. package/src/components/block-draggable/index.native.js +6 -14
  318. package/src/components/block-draggable/test/index.native.js +12 -15
  319. package/src/components/block-edit/test/edit.js +2 -1
  320. package/src/components/block-list/block-list-item.native.js +4 -12
  321. package/src/components/block-list/block-selection-button.native.js +2 -3
  322. package/src/components/block-list/block.js +8 -10
  323. package/src/components/block-list/block.native.js +10 -15
  324. package/src/components/block-list/index.js +2 -3
  325. package/src/components/block-list/index.native.js +12 -21
  326. package/src/components/block-list/test/block-list-context.native.js +8 -16
  327. package/src/components/block-list/use-block-props/index.js +6 -3
  328. package/src/components/block-list/use-block-props/use-block-custom-class-name.js +2 -3
  329. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +2 -3
  330. package/src/components/block-list/use-in-between-inserter.js +2 -3
  331. package/src/components/block-list-appender/index.js +2 -5
  332. package/src/components/block-list-appender/index.native.js +2 -3
  333. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +4 -6
  334. package/src/components/block-mover/button.js +2 -3
  335. package/src/components/block-mover/index.native.js +4 -6
  336. package/src/components/block-parent-selector/index.js +2 -3
  337. package/src/components/block-pattern-setup/index.js +3 -5
  338. package/src/components/block-preview/auto.js +4 -8
  339. package/src/components/block-selection-clearer/index.js +2 -3
  340. package/src/components/block-settings-menu/block-mode-toggle.js +4 -8
  341. package/src/components/block-settings-menu/block-settings-dropdown.js +9 -9
  342. package/src/components/block-styles/index.js +3 -1
  343. package/src/components/block-styles/menu-items.js +2 -5
  344. package/src/components/block-switcher/block-transformations-menu.js +2 -4
  345. package/src/components/block-toolbar/index.native.js +2 -5
  346. package/src/components/block-toolbar/utils.js +3 -11
  347. package/src/components/block-tools/block-contextual-toolbar.js +2 -5
  348. package/src/components/block-tools/index.js +2 -3
  349. package/src/components/block-types-list/index.native.js +2 -4
  350. package/src/components/block-variation-transforms/index.js +4 -6
  351. package/src/components/color-palette/test/control.js +2 -1
  352. package/src/components/color-style-selector/index.js +27 -28
  353. package/src/components/colors/test/with-colors.js +14 -14
  354. package/src/components/colors/with-colors.js +8 -12
  355. package/src/components/colors-gradients/dropdown.js +21 -16
  356. package/src/components/colors-gradients/test/control.js +10 -10
  357. package/src/components/convert-to-group-buttons/toolbar.js +2 -6
  358. package/src/components/copy-handler/README.md +7 -2
  359. package/src/components/copy-handler/index.js +26 -6
  360. package/src/components/default-block-appender/index.js +4 -6
  361. package/src/components/default-block-appender/index.native.js +4 -9
  362. package/src/components/default-style-picker/index.js +20 -21
  363. package/src/components/font-sizes/with-font-sizes.js +2 -3
  364. package/src/components/image-editor/aspect-ratio-dropdown.js +2 -6
  365. package/src/components/image-size-control/index.js +4 -7
  366. package/src/components/index.js +2 -0
  367. package/src/components/inner-blocks/use-inner-block-template-sync.js +2 -3
  368. package/src/components/inner-blocks/use-nested-settings-update.js +6 -9
  369. package/src/components/inserter/block-types-tab.native.js +2 -3
  370. package/src/components/inserter/hooks/use-block-type-impressions.native.js +2 -3
  371. package/src/components/inserter/hooks/use-insertion-point.js +3 -2
  372. package/src/components/inserter/hooks/use-patterns-state.js +4 -5
  373. package/src/components/inserter/index.js +4 -6
  374. package/src/components/inserter/index.native.js +6 -11
  375. package/src/components/inserter/library.js +2 -5
  376. package/src/components/inserter/menu.js +14 -19
  377. package/src/components/inserter/menu.native.js +8 -6
  378. package/src/components/inserter/no-results.native.js +2 -1
  379. package/src/components/inserter/quick-inserter.js +2 -3
  380. package/src/components/inserter/search-items.js +6 -6
  381. package/src/components/inserter/search-results.native.js +4 -6
  382. package/src/components/inspector-popover-header/README.md +76 -0
  383. package/src/components/inspector-popover-header/index.js +56 -0
  384. package/src/components/inspector-popover-header/style.scss +16 -0
  385. package/src/components/line-height-control/index.js +1 -2
  386. package/src/components/link-control/index.js +4 -4
  387. package/src/components/link-control/search-create-button.js +4 -2
  388. package/src/components/link-control/search-input.js +3 -1
  389. package/src/components/link-control/settings-drawer.js +2 -5
  390. package/src/components/link-control/test/fixtures/index.js +3 -4
  391. package/src/components/link-control/test/index.js +24 -36
  392. package/src/components/link-control/use-search-handler.js +2 -2
  393. package/src/components/list-view/block-contents.js +2 -4
  394. package/src/components/list-view/branch.js +22 -23
  395. package/src/components/list-view/index.js +4 -8
  396. package/src/components/list-view/use-block-selection.js +5 -5
  397. package/src/components/list-view/use-list-view-drop-zone.js +2 -1
  398. package/src/components/list-view/utils.js +1 -6
  399. package/src/components/media-placeholder/index.js +2 -1
  400. package/src/components/media-replace-flow/index.js +77 -46
  401. package/src/components/media-upload/index.native.js +1 -1
  402. package/src/components/navigable-toolbar/index.js +1 -2
  403. package/src/components/panel-color-settings/test/index.js +2 -1
  404. package/src/components/plain-text/index.native.js +2 -6
  405. package/src/components/preview-options/index.js +4 -0
  406. package/src/components/provider/use-block-sync.js +5 -2
  407. package/src/components/publish-date-time-picker/README.md +1 -1
  408. package/src/components/publish-date-time-picker/index.js +16 -27
  409. package/src/components/responsive-block-control/test/index.js +3 -2
  410. package/src/components/rich-text/embed-handler-picker.native.js +2 -5
  411. package/src/components/rich-text/index.js +7 -4
  412. package/src/components/rich-text/use-format-types.js +16 -16
  413. package/src/components/rich-text/use-mark-persistent.js +2 -3
  414. package/src/components/skip-to-selected-block/index.js +2 -3
  415. package/src/components/ungroup-button/index.native.js +4 -8
  416. package/src/components/url-input/index.js +21 -20
  417. package/src/components/use-block-display-information/index.js +4 -6
  418. package/src/components/use-block-drop-zone/index.js +2 -3
  419. package/src/components/use-block-drop-zone/index.native.js +2 -4
  420. package/src/components/use-block-drop-zone/test/index.js +22 -23
  421. package/src/components/use-display-block-controls/index.native.js +2 -3
  422. package/src/components/use-no-recursive-renders/test/use-no-recursive-renders.js +2 -3
  423. package/src/components/use-on-block-drop/index.js +2 -5
  424. package/src/components/use-on-block-drop/index.native.js +4 -8
  425. package/src/components/use-setting/index.js +8 -6
  426. package/src/components/writing-flow/test/index.js +22 -4
  427. package/src/components/writing-flow/use-arrow-nav.js +22 -10
  428. package/src/components/writing-flow/use-click-selection.js +2 -5
  429. package/src/components/writing-flow/use-drag-selection.js +6 -9
  430. package/src/components/writing-flow/use-multi-selection.js +2 -4
  431. package/src/components/writing-flow/use-select-all.js +2 -5
  432. package/src/components/writing-flow/use-selection-observer.js +4 -6
  433. package/src/components/writing-flow/use-tab-nav.js +2 -5
  434. package/src/hooks/color-panel.js +4 -4
  435. package/src/hooks/color-panel.native.js +2 -2
  436. package/src/hooks/color.js +2 -2
  437. package/src/hooks/font-family.js +4 -2
  438. package/src/hooks/gap.js +2 -3
  439. package/src/hooks/layout.js +54 -4
  440. package/src/hooks/test/align.js +2 -1
  441. package/src/hooks/test/generated-class-name.js +2 -5
  442. package/src/hooks/test/utils.js +2 -5
  443. package/src/store/actions.js +772 -728
  444. package/src/store/reducer.js +188 -177
  445. package/src/store/selectors.js +54 -54
  446. package/src/store/test/actions.js +2 -1
  447. package/src/store/test/reducer.js +3 -1
  448. package/src/store/test/selectors.js +17 -21
  449. package/src/style.scss +1 -1
  450. package/src/utils/pasting.js +3 -3
  451. package/src/utils/transform-styles/transforms/wrap.js +30 -28
  452. package/tsconfig.tsbuildinfo +1 -1
  453. package/src/components/publish-date-time-picker/style.scss +0 -20
@@ -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","prioritizePatterns","filterValue","setFilterValue","destinationRootClientId","onInsertBlocks","blockTypes","patterns","setInserterIsOpened","insertionIndex","select","getSettings","getBlockIndex","getBlockCount","blockEditorStore","settings","index","blockCount","__experimentalSetIsInserterOpened","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,M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;AATtB,IADD,CAlBD,EAgCGO,mBAAmB,IACpB,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,8CADX;AAEC,IAAA,OAAO,EAAGc,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\tprioritizePatterns,\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 { setInserterIsOpened, insertionIndex } = 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\tinsertionIndex: index === -1 ? blockCount : index,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\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","prioritizePatterns","filterValue","setFilterValue","destinationRootClientId","onInsertBlocks","blockTypes","patterns","setInserterIsOpened","insertionIndex","select","getSettings","getBlockIndex","getBlockCount","blockEditorStore","settings","index","blockCount","__experimentalSetIsInserterOpened","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,OAMX;AAAA,MANmC;AACtCC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C,8CADX;AAEC,IAAA,OAAO,EAAGc,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\tprioritizePatterns,\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 { setInserterIsOpened, insertionIndex } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, getBlockIndex, getBlockCount } =\n\t\t\t\tselect( blockEditorStore );\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\tinsertionIndex: index === -1 ? blockCount : index,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\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"]}
@@ -63,7 +63,7 @@ const getNormalizedSearchTerms = function () {
63
63
  exports.getNormalizedSearchTerms = getNormalizedSearchTerms;
64
64
 
65
65
  const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => {
66
- return (0, _lodash.differenceWith)(unmatchedTerms, getNormalizedSearchTerms(unprocessedTerms), (unmatchedTerm, unprocessedTerm) => unprocessedTerm.includes(unmatchedTerm));
66
+ return unmatchedTerms.filter(term => !getNormalizedSearchTerms(unprocessedTerms).some(unprocessedTerm => unprocessedTerm.includes(term)));
67
67
  };
68
68
 
69
69
  const searchBlockItems = (items, categories, collections, searchInput) => {
@@ -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,gBAAlB,KAAwC;AACnE,SAAO,4BACND,cADM,EAENF,wBAAwB,CAAEG,gBAAF,CAFlB,EAGN,CAAEC,aAAF,EAAiBC,eAAjB,KACCA,eAAe,CAACC,QAAhB,CAA0BF,aAA1B,CAJK,CAAP;AAMA,CAPD;;AASO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kE,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","filter","term","some","unprocessedTerm","includes","searchBlockItems","items","categories","collections","searchInput","normalizedSearchTerms","length","config","getCategory","slug","getCollection","split","searchItems","rankedItems","map","getItemSearchRank","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,WAA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;;AACAhB,IAAAA,IAAI,IAAIe,oBAAoB,GAAG,CAAH,GAAO,CAAnC;AACA;;AAED,SAAOf,IAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { deburr, 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 unmatchedTerms.filter(\n\t\t( term ) =>\n\t\t\t! getNormalizedSearchTerms( unprocessedTerms ).some(\n\t\t\t\t( unprocessedTerm ) => unprocessedTerm.includes( term )\n\t\t\t)\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 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/search-results.native.js"],"names":["InserterSearchResults","filterValue","onSelect","listProps","rootClientId","isFullScreen","blockTypes","select","allItems","blockEditorStore","getInserterItems","availableItems","allowReusable","filteredItems","items","trackBlockTypeSelected","length","handleSelect"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;AAQA,SAASA,qBAAT,OAMI;AAAA,MAN4B;AAC/BC,IAAAA,WAD+B;AAE/BC,IAAAA,QAF+B;AAG/BC,IAAAA,SAH+B;AAI/BC,IAAAA,YAJ+B;AAK/BC,IAAAA;AAL+B,GAM5B;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAiB,qBACpBC,MAAF,IAAc;AACb,UAAMC,QAAQ,GAAGD,MAAM,CAAEE,YAAF,CAAN,CAA2BC,gBAA3B,CAChBN,YADgB,CAAjB;AAIA,UAAMO,cAAc,GAAG,gCAAqBH,QAArB,EAA+B;AACrDI,MAAAA,aAAa,EAAE;AADsC,KAA/B,CAAvB;AAGA,UAAMC,aAAa,GAAG,8BAAaF,cAAb,EAA6BV,WAA7B,CAAtB;AAEA,WAAO;AAAEK,MAAAA,UAAU,EAAEO;AAAd,KAAP;AACA,GAZqB,EAatB,CAAET,YAAF,EAAgBH,WAAhB,CAbsB,CAAvB;AAgBA,QAAM;AAAEa,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAoC,sCACzCT,UADyC,CAA1C;;AAIA,MAAK,CAAEQ,KAAF,IAAW,CAAAA,KAAK,SAAL,IAAAA,KAAK,WAAL,YAAAA,KAAK,CAAEE,MAAP,MAAkB,CAAlC,EAAsC;AACrC,WAAO,4BAAC,kBAAD,OAAP;AACA;;AAED,QAAMC,YAAY,GAAG,YAAe;AACnCF,IAAAA,sBAAsB,CAAE,YAAF,CAAtB;AACAb,IAAAA,QAAQ,CAAE,YAAF,CAAR;AACA,GAHD;;AAKA,SACC,4BAAC,uBAAD;AACC,IAAA,IAAI,EAAC,QADN;AAEC,IAAA,kBAAkB,EAAGG,YAAY,GAAG,EAAH,GAAQ,CAF1C;AAGQS,IAAAA,KAHR;AAGeZ,IAAAA,QAAQ,EAAEe,YAHzB;AAGuCd,IAAAA;AAHvC,IADD;AAOA;;eAEcH,qB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { searchItems } from './search-items';\nimport BlockTypesList from '../block-types-list';\nimport InserterNoResults from './no-results';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockTypeImpressions from './hooks/use-block-type-impressions';\nimport { filterInserterItems } from './utils';\n\nfunction InserterSearchResults( {\n\tfilterValue,\n\tonSelect,\n\tlistProps,\n\trootClientId,\n\tisFullScreen,\n} ) {\n\tconst { blockTypes } = useSelect(\n\t\t( select ) => {\n\t\t\tconst allItems = select( blockEditorStore ).getInserterItems(\n\t\t\t\trootClientId\n\t\t\t);\n\n\t\t\tconst availableItems = filterInserterItems( allItems, {\n\t\t\t\tallowReusable: true,\n\t\t\t} );\n\t\t\tconst filteredItems = searchItems( availableItems, filterValue );\n\n\t\t\treturn { blockTypes: filteredItems };\n\t\t},\n\t\t[ rootClientId, filterValue ]\n\t);\n\n\tconst { items, trackBlockTypeSelected } = useBlockTypeImpressions(\n\t\tblockTypes\n\t);\n\n\tif ( ! items || items?.length === 0 ) {\n\t\treturn <InserterNoResults />;\n\t}\n\n\tconst handleSelect = ( ...args ) => {\n\t\ttrackBlockTypeSelected( ...args );\n\t\tonSelect( ...args );\n\t};\n\n\treturn (\n\t\t<BlockTypesList\n\t\t\tname=\"Blocks\"\n\t\t\tinitialNumToRender={ isFullScreen ? 10 : 3 }\n\t\t\t{ ...{ items, onSelect: handleSelect, listProps } }\n\t\t/>\n\t);\n}\n\nexport default InserterSearchResults;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/search-results.native.js"],"names":["InserterSearchResults","filterValue","onSelect","listProps","rootClientId","isFullScreen","blockTypes","select","allItems","blockEditorStore","getInserterItems","availableItems","allowReusable","filteredItems","items","trackBlockTypeSelected","length","handleSelect"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;AAQA,SAASA,qBAAT,OAMI;AAAA,MAN4B;AAC/BC,IAAAA,WAD+B;AAE/BC,IAAAA,QAF+B;AAG/BC,IAAAA,SAH+B;AAI/BC,IAAAA,YAJ+B;AAK/BC,IAAAA;AAL+B,GAM5B;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAiB,qBACpBC,MAAF,IAAc;AACb,UAAMC,QAAQ,GACbD,MAAM,CAAEE,YAAF,CAAN,CAA2BC,gBAA3B,CAA6CN,YAA7C,CADD;AAGA,UAAMO,cAAc,GAAG,gCAAqBH,QAArB,EAA+B;AACrDI,MAAAA,aAAa,EAAE;AADsC,KAA/B,CAAvB;AAGA,UAAMC,aAAa,GAAG,8BAAaF,cAAb,EAA6BV,WAA7B,CAAtB;AAEA,WAAO;AAAEK,MAAAA,UAAU,EAAEO;AAAd,KAAP;AACA,GAXqB,EAYtB,CAAET,YAAF,EAAgBH,WAAhB,CAZsB,CAAvB;AAeA,QAAM;AAAEa,IAAAA,KAAF;AAASC,IAAAA;AAAT,MACL,sCAAyBT,UAAzB,CADD;;AAGA,MAAK,CAAEQ,KAAF,IAAW,CAAAA,KAAK,SAAL,IAAAA,KAAK,WAAL,YAAAA,KAAK,CAAEE,MAAP,MAAkB,CAAlC,EAAsC;AACrC,WAAO,4BAAC,kBAAD,OAAP;AACA;;AAED,QAAMC,YAAY,GAAG,YAAe;AACnCF,IAAAA,sBAAsB,CAAE,YAAF,CAAtB;AACAb,IAAAA,QAAQ,CAAE,YAAF,CAAR;AACA,GAHD;;AAKA,SACC,4BAAC,uBAAD;AACC,IAAA,IAAI,EAAC,QADN;AAEC,IAAA,kBAAkB,EAAGG,YAAY,GAAG,EAAH,GAAQ,CAF1C;AAGQS,IAAAA,KAHR;AAGeZ,IAAAA,QAAQ,EAAEe,YAHzB;AAGuCd,IAAAA;AAHvC,IADD;AAOA;;eAEcH,qB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { searchItems } from './search-items';\nimport BlockTypesList from '../block-types-list';\nimport InserterNoResults from './no-results';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockTypeImpressions from './hooks/use-block-type-impressions';\nimport { filterInserterItems } from './utils';\n\nfunction InserterSearchResults( {\n\tfilterValue,\n\tonSelect,\n\tlistProps,\n\trootClientId,\n\tisFullScreen,\n} ) {\n\tconst { blockTypes } = useSelect(\n\t\t( select ) => {\n\t\t\tconst allItems =\n\t\t\t\tselect( blockEditorStore ).getInserterItems( rootClientId );\n\n\t\t\tconst availableItems = filterInserterItems( allItems, {\n\t\t\t\tallowReusable: true,\n\t\t\t} );\n\t\t\tconst filteredItems = searchItems( availableItems, filterValue );\n\n\t\t\treturn { blockTypes: filteredItems };\n\t\t},\n\t\t[ rootClientId, filterValue ]\n\t);\n\n\tconst { items, trackBlockTypeSelected } =\n\t\tuseBlockTypeImpressions( blockTypes );\n\n\tif ( ! items || items?.length === 0 ) {\n\t\treturn <InserterNoResults />;\n\t}\n\n\tconst handleSelect = ( ...args ) => {\n\t\ttrackBlockTypeSelected( ...args );\n\t\tonSelect( ...args );\n\t};\n\n\treturn (\n\t\t<BlockTypesList\n\t\t\tname=\"Blocks\"\n\t\t\tinitialNumToRender={ isFullScreen ? 10 : 3 }\n\t\t\t{ ...{ items, onSelect: handleSelect, listProps } }\n\t\t/>\n\t);\n}\n\nexport default InserterSearchResults;\n"]}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = InspectorPopoverHeader;
7
+
8
+ var _element = require("@wordpress/element");
9
+
10
+ var _components = require("@wordpress/components");
11
+
12
+ var _icons = require("@wordpress/icons");
13
+
14
+ var _i18n = require("@wordpress/i18n");
15
+
16
+ /**
17
+ * WordPress dependencies
18
+ */
19
+ function InspectorPopoverHeader(_ref) {
20
+ let {
21
+ title,
22
+ help,
23
+ actions = [],
24
+ onClose
25
+ } = _ref;
26
+ return (0, _element.createElement)(_components.__experimentalVStack, {
27
+ className: "block-editor-inspector-popover-header",
28
+ spacing: 4
29
+ }, (0, _element.createElement)(_components.__experimentalHStack, {
30
+ alignment: "center"
31
+ }, (0, _element.createElement)(_components.__experimentalHeading, {
32
+ className: "block-editor-inspector-popover-header__heading",
33
+ level: 2,
34
+ size: 13
35
+ }, title), (0, _element.createElement)(_components.__experimentalSpacer, null), actions.map(_ref2 => {
36
+ let {
37
+ label,
38
+ icon,
39
+ onClick
40
+ } = _ref2;
41
+ return (0, _element.createElement)(_components.Button, {
42
+ key: label,
43
+ className: "block-editor-inspector-popover-header__action",
44
+ label: label,
45
+ icon: icon,
46
+ variant: !icon && 'tertiary',
47
+ onClick: onClick
48
+ }, !icon && label);
49
+ }), onClose && (0, _element.createElement)(_components.Button, {
50
+ className: "block-editor-inspector-popover-header__action",
51
+ label: (0, _i18n.__)('Close'),
52
+ icon: _icons.closeSmall,
53
+ onClick: onClose
54
+ })), help && (0, _element.createElement)(_components.__experimentalText, null, help));
55
+ }
56
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inspector-popover-header/index.js"],"names":["InspectorPopoverHeader","title","help","actions","onClose","map","label","icon","onClick","closeSmall"],"mappings":";;;;;;;;;AAGA;;AAQA;;AACA;;AAZA;AACA;AACA;AAYe,SAASA,sBAAT,OAKX;AAAA,MAL4C;AAC/CC,IAAAA,KAD+C;AAE/CC,IAAAA,IAF+C;AAG/CC,IAAAA,OAAO,GAAG,EAHqC;AAI/CC,IAAAA;AAJ+C,GAK5C;AACH,SACC,4BAAC,gCAAD;AAAQ,IAAA,SAAS,EAAC,uCAAlB;AAA0D,IAAA,OAAO,EAAG;AAApE,KACC,4BAAC,gCAAD;AAAQ,IAAA,SAAS,EAAC;AAAlB,KACC,4BAAC,iCAAD;AACC,IAAA,SAAS,EAAC,gDADX;AAEC,IAAA,KAAK,EAAG,CAFT;AAGC,IAAA,IAAI,EAAG;AAHR,KAKGH,KALH,CADD,EAQC,4BAAC,gCAAD,OARD,EASGE,OAAO,CAACE,GAAR,CAAa;AAAA,QAAE;AAAEC,MAAAA,KAAF;AAASC,MAAAA,IAAT;AAAeC,MAAAA;AAAf,KAAF;AAAA,WACd,4BAAC,kBAAD;AACC,MAAA,GAAG,EAAGF,KADP;AAEC,MAAA,SAAS,EAAC,+CAFX;AAGC,MAAA,KAAK,EAAGA,KAHT;AAIC,MAAA,IAAI,EAAGC,IAJR;AAKC,MAAA,OAAO,EAAG,CAAEA,IAAF,IAAU,UALrB;AAMC,MAAA,OAAO,EAAGC;AANX,OAQG,CAAED,IAAF,IAAUD,KARb,CADc;AAAA,GAAb,CATH,EAqBGF,OAAO,IACR,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,+CADX;AAEC,IAAA,KAAK,EAAG,cAAI,OAAJ,CAFT;AAGC,IAAA,IAAI,EAAGK,iBAHR;AAIC,IAAA,OAAO,EAAGL;AAJX,IAtBF,CADD,EA+BGF,IAAI,IAAI,4BAAC,8BAAD,QAAQA,IAAR,CA/BX,CADD;AAmCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\t__experimentalHeading as Heading,\n\t__experimentalSpacer as Spacer,\n\tButton,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { closeSmall } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\nexport default function InspectorPopoverHeader( {\n\ttitle,\n\thelp,\n\tactions = [],\n\tonClose,\n} ) {\n\treturn (\n\t\t<VStack className=\"block-editor-inspector-popover-header\" spacing={ 4 }>\n\t\t\t<HStack alignment=\"center\">\n\t\t\t\t<Heading\n\t\t\t\t\tclassName=\"block-editor-inspector-popover-header__heading\"\n\t\t\t\t\tlevel={ 2 }\n\t\t\t\t\tsize={ 13 }\n\t\t\t\t>\n\t\t\t\t\t{ title }\n\t\t\t\t</Heading>\n\t\t\t\t<Spacer />\n\t\t\t\t{ actions.map( ( { label, icon, onClick } ) => (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\tclassName=\"block-editor-inspector-popover-header__action\"\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\tvariant={ ! icon && 'tertiary' }\n\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! icon && label }\n\t\t\t\t\t</Button>\n\t\t\t\t) ) }\n\t\t\t\t{ onClose && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"block-editor-inspector-popover-header__action\"\n\t\t\t\t\t\tlabel={ __( 'Close' ) }\n\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t\t{ help && <Text>{ help }</Text> }\n\t\t</VStack>\n\t);\n}\n"]}
@@ -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;AAQA,MAAMA,iBAAiB,GAAG,QAMnB;AAAA,MANqB;AAC3BC,IAAAA,KAAK,EAAEC,UADoB;AAE3BC,IAAAA,QAF2B;;AAG3B;AACAC,IAAAA,uBAAuB,GAAG,KAJC;AAK3BC,IAAAA,oBAAoB,GAAG;AALI,GAMrB;AACN,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,YAAU,GAAGA,SAAW,EAAxB;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;AAGA,UAAMlB,KAAK,GAAGM,eAAe,CAAEM,KAAK,CAACZ,KAAR,EAAeQ,gBAAf,CAA7B;AACA,WAAO,EAAE,GAAGI,KAAL;AAAYZ,MAAAA;AAAZ,KAAP;AACA,GAVD;;AAYA,QAAMA,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,CAtFD;AAwFA;AACA;AACA;;;eACeD,iB","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\nconst LineHeightControl = ( {\n\tvalue: lineHeight,\n\tonChange,\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMarginBottom = false,\n\t__unstableInputWidth = '60px',\n} ) => {\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\tconst value = adjustNextValue( state.value, wasTypedOrPasted );\n\t\treturn { ...state, value };\n\t};\n\n\tconst value = isDefined ? lineHeight : RESET_VALUE;\n\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\tdeprecated(\n\t\t\t'Bottom margin styles for wp.blockEditor.LineHeightControl',\n\t\t\t{\n\t\t\t\tsince: '6.0',\n\t\t\t\tversion: '6.4',\n\t\t\t\thint:\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\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/line-height-control/README.md\n */\nexport default LineHeightControl;\n"]}
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;AAQA,MAAMA,iBAAiB,GAAG,QAMnB;AAAA,MANqB;AAC3BC,IAAAA,KAAK,EAAEC,UADoB;AAE3BC,IAA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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,CArFD;AAuFA;AACA;AACA;;;eACeD,iB","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\nconst LineHeightControl = ( {\n\tvalue: lineHeight,\n\tonChange,\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMarginBottom = false,\n\t__unstableInputWidth = '60px',\n} ) => {\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\tconst value = adjustNextValue( state.value, wasTypedOrPasted );\n\t\treturn { ...state, value };\n\t};\n\n\tconst value = isDefined ? lineHeight : RESET_VALUE;\n\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\tdeprecated(\n\t\t\t'Bottom margin styles for wp.blockEditor.LineHeightControl',\n\t\t\t{\n\t\t\t\tsince: '6.0',\n\t\t\t\tversion: '6.4',\n\t\t\t\thint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version',\n\t\t\t}\n\t\t);\n\t}\n\tconst deprecatedStyles = __nextHasNoMarginBottom\n\t\t? undefined\n\t\t: { marginBottom: 24 };\n\n\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\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/line-height-control/README.md\n */\nexport default LineHeightControl;\n"]}
@@ -9,8 +9,6 @@ exports.default = void 0;
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
12
- var _lodash = require("lodash");
13
-
14
12
  var _classnames = _interopRequireDefault(require("classnames"));
15
13
 
16
14
  var _components = require("@wordpress/components");
@@ -121,7 +119,7 @@ var _constants = require("./constants");
121
119
  * @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion.
122
120
  * @property {Function} renderControlBottom Optional controls to be rendered at the bottom of the component.
123
121
  */
124
-
122
+ const noop = () => {};
125
123
  /**
126
124
  * Renders a link control. A link control is a controlled input which maintains
127
125
  * a value associated with a link (HTML anchor element) and relevant settings
@@ -129,6 +127,8 @@ var _constants = require("./constants");
129
127
  *
130
128
  * @param {WPLinkControlProps} props Component props.
131
129
  */
130
+
131
+
132
132
  function LinkControl(_ref) {
133
133
  var _currentInputValue$tr, _value$url, _value$url$trim;
134
134
 
@@ -136,7 +136,7 @@ function LinkControl(_ref) {
136
136
  searchInputPlaceholder,
137
137
  value,
138
138
  settings = _constants.DEFAULT_LINK_SETTINGS,
139
- onChange = _lodash.noop,
139
+ onChange = noop,
140
140
  onRemove,
141
141
  noDirectEntry = false,
142
142
  showSuggestions = true,
@@ -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","createPage","isCreatingPage","errorMessage","current","whichFocusTargetIndex","nextFocusTarget","focus","focusable","find","stopEditing","contains","ownerDocument","activeElement","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,o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';\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\tconst { createPage, isCreatingPage, errorMessage } = useCreatePage(\n\t\tcreateSuggestion\n\t);\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, isCreatingPage ] );\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 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":["noop","LinkControl","searchInputPlaceholder","value","settings","DEFAULT_LINK_SETTINGS","onChange","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","createPage","isCreatingPage","errorMessage","current","whichFocusTargetIndex","nextFocusTarget","focus","focusable","find","stopEditing","contains","ownerDocument","activeElement","handleSelectSuggestion","updatedValue","handleSubmit","handleSubmitWithEnter","event","keyCode","ENTER","preventDefault","shownUnlinkControl","showSettingsDrawer","showTextControl","keyboardReturn","ViewerFill"],"mappings":";;;;;;;;;AAWA;;AARA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvBA;AACA;AACA;;AAGA;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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KAFT;AAGC,IAAA,WAAW,EAAG,MAAM+B,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,EAAG1D,KADT;AAEC,IAAA,QAAQ,EAAGC,QAFZ;AAGC,IAAA,QAAQ,EAAGE;AAHZ,IADD,CApFF,EA4FGe,mBAAmB,IAAIA,mBAAmB,EA5F7C,CADD;AAgGA;;AAEDpB,WAAW,CAAC+D,UAAZ,GAAyBA,sBAAzB;eAEe/D,W","sourcesContent":["/**\n * External dependencies\n */\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\nconst noop = () => {};\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\tconst { createPage, isCreatingPage, errorMessage } =\n\t\tuseCreatePage( createSuggestion );\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, isCreatingPage ] );\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 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"]}
@@ -13,8 +13,6 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
13
13
 
14
14
  var _classnames = _interopRequireDefault(require("classnames"));
15
15
 
16
- var _lodash = require("lodash");
17
-
18
16
  var _i18n = require("@wordpress/i18n");
19
17
 
20
18
  var _components = require("@wordpress/components");
@@ -44,7 +42,7 @@ const LinkControlSearchCreate = _ref => {
44
42
  let text;
45
43
 
46
44
  if (buttonText) {
47
- text = (0, _lodash.isFunction)(buttonText) ? buttonText(searchTerm) : buttonText;
45
+ text = typeof buttonText === 'function' ? buttonText(searchTerm) : buttonText;
48
46
  } else {
49
47
  text = (0, _element.createInterpolateElement)((0, _i18n.sprintf)(
50
48
  /* translators: %s: search term. */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-create-button.js"],"names":["LinkControlSearchCreate","searchTerm","onClick","itemProps","isSelected","buttonText","text","mark","plus"],"mappings":";;;;;;;;;AAWA;;;;AARA;;AACA;;AAKA;;AACA;;AAEA;;AAZA;AACA;AACA;;AAIA;AACA;AACA;AAMO,MAAMA,uBAAuB,GAAG,QAMhC;AAAA,MANkC;AACxCC,IAAAA,UADwC;AAExCC,IAAAA,OAFwC;AAGxCC,IAAAA,SAHwC;AAIxCC,IAAAA,UAJwC;AAKxCC,IAAAA;AALwC,GAMlC;;AACN,MAAK,CAAEJ,UAAP,EAAoB;AACnB,WAAO,IAAP;AACA;;AAED,MAAIK,IAAJ;;AACA,MAAKD,UAAL,EAAkB;AACjBC,IAAAA,IAAI,GAAG,wBAAYD,UAAZ,IAA2BA,UAAU,CAAEJ,UAAF,CAArC,GAAsDI,UAA7D;AACA,GAFD,MAEO;AACNC,IAAAA,IAAI,GAAG,uCACN;AACC;AACA,kBAAI,yBAAJ,CAFD,EAGCL,UAHD,CADM,EAMN;AAAEM,MAAAA,IAAI,EAAE;AAAR,KANM,CAAP;AAQA;;AAED,SACC,4BAAC,kBAAD,6BACMJ,SADN;AAEC,IAAA,SAAS,EAAG,yBACX,iFADW,EAEX;AACC,qBAAeC;AADhB,KAFW,CAFb;AAQC,IAAA,OAAO,EAAGF;AARX,MAUC,4BAAC,WAAD;AACC,IAAA,SAAS,EAAC,6CADX;AAEC,IAAA,IAAI,EAAGM;AAFR,IAVD,EAeC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGF,IADH,CADD,CAfD,CADD;AAuBA,CAhDM;;;eAkDQN,uB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { isFunction } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { Icon, plus } from '@wordpress/icons';\n\nexport const LinkControlSearchCreate = ( {\n\tsearchTerm,\n\tonClick,\n\titemProps,\n\tisSelected,\n\tbuttonText,\n} ) => {\n\tif ( ! searchTerm ) {\n\t\treturn null;\n\t}\n\n\tlet text;\n\tif ( buttonText ) {\n\t\ttext = isFunction( buttonText ) ? buttonText( searchTerm ) : buttonText;\n\t} else {\n\t\ttext = createInterpolateElement(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t__( 'Create: <mark>%s</mark>' ),\n\t\t\t\tsearchTerm\n\t\t\t),\n\t\t\t{ mark: <mark /> }\n\t\t);\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\t{ ...itemProps }\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-link-control__search-create block-editor-link-control__search-item',\n\t\t\t\t{\n\t\t\t\t\t'is-selected': isSelected,\n\t\t\t\t}\n\t\t\t) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t<Icon\n\t\t\t\tclassName=\"block-editor-link-control__search-item-icon\"\n\t\t\t\ticon={ plus }\n\t\t\t/>\n\n\t\t\t<span className=\"block-editor-link-control__search-item-header\">\n\t\t\t\t<span className=\"block-editor-link-control__search-item-title\">\n\t\t\t\t\t{ text }\n\t\t\t\t</span>\n\t\t\t</span>\n\t\t</Button>\n\t);\n};\n\nexport default LinkControlSearchCreate;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-create-button.js"],"names":["LinkControlSearchCreate","searchTerm","onClick","itemProps","isSelected","buttonText","text","mark","plus"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AAKA;;AACA;;AAEA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;AAMO,MAAMA,uBAAuB,GAAG,QAMhC;AAAA,MANkC;AACxCC,IAAAA,UADwC;AAExCC,IAAAA,OAFwC;AAGxCC,IAAAA,SAHwC;AAIxCC,IAAAA,UAJwC;AAKxCC,IAAAA;AALwC,GAMlC;;AACN,MAAK,CAAEJ,UAAP,EAAoB;AACnB,WAAO,IAAP;AACA;;AAED,MAAIK,IAAJ;;AACA,MAAKD,UAAL,EAAkB;AACjBC,IAAAA,IAAI,GACH,OAAOD,UAAP,KAAsB,UAAtB,GACGA,UAAU,CAAEJ,UAAF,CADb,GAEGI,UAHJ;AAIA,GALD,MAKO;AACNC,IAAAA,IAAI,GAAG,uCACN;AACC;AACA,kBAAI,yBAAJ,CAFD,EAGCL,UAHD,CADM,EAMN;AAAEM,MAAAA,IAAI,EAAE;AAAR,KANM,CAAP;AAQA;;AAED,SACC,4BAAC,kBAAD,6BACMJ,SADN;AAEC,IAAA,SAAS,EAAG,yBACX,iFADW,EAEX;AACC,qBAAeC;AADhB,KAFW,CAFb;AAQC,IAAA,OAAO,EAAGF;AARX,MAUC,4BAAC,WAAD;AACC,IAAA,SAAS,EAAC,6CADX;AAEC,IAAA,IAAI,EAAGM;AAFR,IAVD,EAeC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGF,IADH,CADD,CAfD,CADD;AAuBA,CAnDM;;;eAqDQN,uB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { Icon, plus } from '@wordpress/icons';\n\nexport const LinkControlSearchCreate = ( {\n\tsearchTerm,\n\tonClick,\n\titemProps,\n\tisSelected,\n\tbuttonText,\n} ) => {\n\tif ( ! searchTerm ) {\n\t\treturn null;\n\t}\n\n\tlet text;\n\tif ( buttonText ) {\n\t\ttext =\n\t\t\ttypeof buttonText === 'function'\n\t\t\t\t? buttonText( searchTerm )\n\t\t\t\t: buttonText;\n\t} else {\n\t\ttext = createInterpolateElement(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t__( 'Create: <mark>%s</mark>' ),\n\t\t\t\tsearchTerm\n\t\t\t),\n\t\t\t{ mark: <mark /> }\n\t\t);\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\t{ ...itemProps }\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-link-control__search-create block-editor-link-control__search-item',\n\t\t\t\t{\n\t\t\t\t\t'is-selected': isSelected,\n\t\t\t\t}\n\t\t\t) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t<Icon\n\t\t\t\tclassName=\"block-editor-link-control__search-item-icon\"\n\t\t\t\ticon={ plus }\n\t\t\t/>\n\n\t\t\t<span className=\"block-editor-link-control__search-item-header\">\n\t\t\t\t<span className=\"block-editor-link-control__search-item-title\">\n\t\t\t\t\t{ text }\n\t\t\t\t</span>\n\t\t\t</span>\n\t\t</Button>\n\t);\n};\n\nexport default LinkControlSearchCreate;\n"]}
@@ -41,6 +41,8 @@ var _useSearchHandler = _interopRequireDefault(require("./use-search-handler"));
41
41
  // which will cause an unintended http request.
42
42
  const noopSearchHandler = () => Promise.resolve([]);
43
43
 
44
+ const noop = () => {};
45
+
44
46
  const LinkControlSearchInput = (0, _element.forwardRef)((_ref, ref) => {
45
47
  let {
46
48
  value,
@@ -49,9 +51,9 @@ const LinkControlSearchInput = (0, _element.forwardRef)((_ref, ref) => {
49
51
  className = null,
50
52
  placeholder = null,
51
53
  withCreateSuggestion = false,
52
- onCreateSuggestion = _lodash.noop,
53
- onChange = _lodash.noop,
54
- onSelect = _lodash.noop,
54
+ onCreateSuggestion = noop,
55
+ onChange = noop,
56
+ onSelect = noop,
55
57
  showSuggestions = true,
56
58
  renderSuggestions = props => (0, _element.createElement)(_searchResults.default, props),
57
59
  fetchSuggestions = null,
@@ -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,+BAC5B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AG,EAAEpC;AAAP,SADE,CAApB;AAGA;AACD,KA1BF;AA2BC,IAAA,GAAG,EAAGD;AA3BP,IADD,EA8BGE,QA9BH,CADD;AAkCA,CArI6B,CAA/B;eAwIeH,sB","sourcesContent":["/**\n * External 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"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-input.js"],"names":["noopSearchHandler","Promise","resolve","noop","LinkControlSearchInput","ref","value","children","currentLink","className","placeholder","withCreateSuggestion","onCreateSuggestion","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,IAAI,GAAG,MAAM,CAAE,CAArB;;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,GAAGT,IAPtB;AAQCU,IAAAA,QAAQ,GAAGV,IARZ;AASCW,IAAAA,QAAQ,GAAGX,IATZ;AAUCY,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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DG,QAAAA,KAAK,CAACG,cAAN;AACA,OAFD,MAEO;AACNf,QAAAA,oBAAoB,CACnBa,aAAa,IAAI;AAAER,UAAAA,GAAG,EAAEnC;AAAP,SADE,CAApB;AAGA;AACD,KA1BF;AA2BC,IAAA,GAAG,EAAGD;AA3BP,IADD,EA8BGE,QA9BH,CADD;AAkCA,CArI6B,CAA/B;eAwIeH,sB","sourcesContent":["/**\n * External dependencies\n */\nimport { 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 noop = () => {};\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"]}
@@ -7,23 +7,19 @@ exports.default = void 0;
7
7
 
8
8
  var _element = require("@wordpress/element");
9
9
 
10
- var _lodash = require("lodash");
11
-
12
10
  var _i18n = require("@wordpress/i18n");
13
11
 
14
12
  var _components = require("@wordpress/components");
15
13
 
16
- /**
17
- * External dependencies
18
- */
19
-
20
14
  /**
21
15
  * WordPress dependencies
22
16
  */
17
+ const noop = () => {};
18
+
23
19
  const LinkControlSettingsDrawer = _ref => {
24
20
  let {
25
21
  value,
26
- onChange = _lodash.noop,
22
+ onChange = noop,
27
23
  settings
28
24
  } = _ref;
29
25
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/settings-drawer.js"],"names":["LinkControlSettingsDrawer","value","onChange","noop","settings","length","handleSettingChange","setting","newValue","id","theSettings","map","title"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIA,MAAMA,yBAAyB,GAAG,QAA4C;AAAA,MAA1C;AAAEC,IAAAA,KAAF;AAASC,IAAAA,QAAQ,GAAGC,YAApB;AAA0BC,IAAAA;AAA1B,GAA0C;;AAC7E,MAAK,CAAEA,QAAF,IAAc,CAAEA,QAAQ,CAACC,MAA9B,EAAuC;AACtC,WAAO,IAAP;AACA;;AAED,QAAMC,mBAAmB,GAAKC,OAAF,IAAiBC,QAAF,IAAgB;AAC1DN,IAAAA,QAAQ,CAAE,EACT,GAAGD,KADM;AAET,OAAEM,OAAO,CAACE,EAAV,GAAgBD;AAFP,KAAF,CAAR;AAIA,GALD;;AAOA,QAAME,WAAW,GAAGN,QAAQ,CAACO,GAAT,CAAgBJ,OAAF,IACjC,4BAAC,yBAAD;AACC,IAAA,SAAS,EAAC,oCADX;AAEC,IAAA,GAAG,EAAGA,OAAO,CAACE,EAFf;AAGC,IAAA,KAAK,EAAGF,OAAO,CAACK,KAHjB;AAIC,IAAA,QAAQ,EAAGN,mBAAmB,CAAEC,OAAF,CAJ/B;AAKC,IAAA,OAAO,EAAGN,KAAK,GAAG,CAAC,CAAEA,KAAK,CAAEM,OAAO,CAACE,EAAV,CAAX,GAA4B;AAL5C,IADmB,CAApB;AAUA,SACC;AAAU,IAAA,SAAS,EAAC;AAApB,KACC,4BAAC,0BAAD;AAAgB,IAAA,EAAE,EAAC;AAAnB,KACG,cAAI,kCAAJ,CADH,CADD,EAIGC,WAJH,CADD;AAQA,CA9BD;;eAgCeV,yB","sourcesContent":["/**\n * External dependencies\n */\nimport { noop } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ToggleControl, VisuallyHidden } from '@wordpress/components';\n\nconst LinkControlSettingsDrawer = ( { value, onChange = noop, settings } ) => {\n\tif ( ! settings || ! settings.length ) {\n\t\treturn null;\n\t}\n\n\tconst handleSettingChange = ( setting ) => ( newValue ) => {\n\t\tonChange( {\n\t\t\t...value,\n\t\t\t[ setting.id ]: newValue,\n\t\t} );\n\t};\n\n\tconst theSettings = settings.map( ( setting ) => (\n\t\t<ToggleControl\n\t\t\tclassName=\"block-editor-link-control__setting\"\n\t\t\tkey={ setting.id }\n\t\t\tlabel={ setting.title }\n\t\t\tonChange={ handleSettingChange( setting ) }\n\t\t\tchecked={ value ? !! value[ setting.id ] : false }\n\t\t/>\n\t) );\n\n\treturn (\n\t\t<fieldset className=\"block-editor-link-control__settings\">\n\t\t\t<VisuallyHidden as=\"legend\">\n\t\t\t\t{ __( 'Currently selected link settings' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t{ theSettings }\n\t\t</fieldset>\n\t);\n};\n\nexport default LinkControlSettingsDrawer;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/settings-drawer.js"],"names":["noop","LinkControlSettingsDrawer","value","onChange","settings","length","handleSettingChange","setting","newValue","id","theSettings","map","title"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,MAAMC,yBAAyB,GAAG,QAA4C;AAAA,MAA1C;AAAEC,IAAAA,KAAF;AAASC,IAAAA,QAAQ,GAAGH,IAApB;AAA0BI,IAAAA;AAA1B,GAA0C;;AAC7E,MAAK,CAAEA,QAAF,IAAc,CAAEA,QAAQ,CAACC,MAA9B,EAAuC;AACtC,WAAO,IAAP;AACA;;AAED,QAAMC,mBAAmB,GAAKC,OAAF,IAAiBC,QAAF,IAAgB;AAC1DL,IAAAA,QAAQ,CAAE,EACT,GAAGD,KADM;AAET,OAAEK,OAAO,CAACE,EAAV,GAAgBD;AAFP,KAAF,CAAR;AAIA,GALD;;AAOA,QAAME,WAAW,GAAGN,QAAQ,CAACO,GAAT,CAAgBJ,OAAF,IACjC,4BAAC,yBAAD;AACC,IAAA,SAAS,EAAC,oCADX;AAEC,IAAA,GAAG,EAAGA,OAAO,CAACE,EAFf;AAGC,IAAA,KAAK,EAAGF,OAAO,CAACK,KAHjB;AAIC,IAAA,QAAQ,EAAGN,mBAAmB,CAAEC,OAAF,CAJ/B;AAKC,IAAA,OAAO,EAAGL,KAAK,GAAG,CAAC,CAAEA,KAAK,CAAEK,OAAO,CAACE,EAAV,CAAX,GAA4B;AAL5C,IADmB,CAApB;AAUA,SACC;AAAU,IAAA,SAAS,EAAC;AAApB,KACC,4BAAC,0BAAD;AAAgB,IAAA,EAAE,EAAC;AAAnB,KACG,cAAI,kCAAJ,CADH,CADD,EAIGC,WAJH,CADD;AAQA,CA9BD;;eAgCeT,yB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ToggleControl, VisuallyHidden } from '@wordpress/components';\n\nconst noop = () => {};\n\nconst LinkControlSettingsDrawer = ( { value, onChange = noop, settings } ) => {\n\tif ( ! settings || ! settings.length ) {\n\t\treturn null;\n\t}\n\n\tconst handleSettingChange = ( setting ) => ( newValue ) => {\n\t\tonChange( {\n\t\t\t...value,\n\t\t\t[ setting.id ]: newValue,\n\t\t} );\n\t};\n\n\tconst theSettings = settings.map( ( setting ) => (\n\t\t<ToggleControl\n\t\t\tclassName=\"block-editor-link-control__setting\"\n\t\t\tkey={ setting.id }\n\t\t\tlabel={ setting.title }\n\t\t\tonChange={ handleSettingChange( setting ) }\n\t\t\tchecked={ value ? !! value[ setting.id ] : false }\n\t\t/>\n\t) );\n\n\treturn (\n\t\t<fieldset className=\"block-editor-link-control__settings\">\n\t\t\t<VisuallyHidden as=\"legend\">\n\t\t\t\t{ __( 'Currently selected link settings' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t{ theSettings }\n\t\t</fieldset>\n\t);\n};\n\nexport default LinkControlSettingsDrawer;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/use-search-handler.js"],"names":["handleNoop","Promise","resolve","handleDirectEntry","val","type","URL_TYPE","protocol","includes","MAILTO_TYPE","TEL_TYPE","INTERNAL_TYPE","id","title","url","handleEntitySearch","suggestionsQuery","fetchSearchSuggestions","directEntryHandler","withCreateSuggestion","withURLSuggestion","pageOnFront","isInitialSuggestions","resultsIncludeFrontPage","results","all","map","result","Number","isFrontPage","couldBeURL","concat","CREATE_TYPE","useSearchHandler","allowDirectEntry","select","getSettings","blockEditorStore","__experimentalFetchLinkSuggestions"],"mappings":";;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAKA;;AACA;;AAOA;;AAvBA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AAWO,MAAMA,UAAU,GAAG,MAAMC,OAAO,CAACC,OAAR,CAAiB,EAAjB,CAAzB;;;;AAEA,MAAMC,iBAAiB,GAAKC,GAAF,IAAW;AAC3C,MAAIC,IAAI,GAAGC,mBAAX;AAEA,QAAMC,QAAQ,GAAG,sBAAaH,GAAb,KAAsB,EAAvC;;AAEA,MAAKG,QAAQ,CAACC,QAAT,CAAmB,QAAnB,CAAL,EAAqC;AACpCH,IAAAA,IAAI,GAAGI,sBAAP;AACA;;AAED,MAAKF,QAAQ,CAACC,QAA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,GAAF,EAAO;AAAEkB,MAAAA;AAAF,KAAP,CADd,GAEJP,kBAAkB,CAClBX,GADkB,EAElB,EAAE,GAAGY,gBAAL;AAAuBM,MAAAA;AAAvB,KAFkB,EAGlBL,sBAHkB,EAIlBC,kBAJkB,EAKlBC,oBALkB,EAMlBC,iBANkB,EAOlBC,WAPkB,CAFrB;AAWA,GAbK,EAcN,CAAEH,kBAAF,EAAsBD,sBAAtB,EAA8CE,oBAA9C,CAdM,CAAP;AAgBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getProtocol, prependHTTP } from '@wordpress/url';\nimport { useCallback } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * External dependencies\n */\nimport { startsWith } from 'lodash';\n\n/**\n * Internal dependencies\n */\nimport isURLLike from './is-url-like';\nimport {\n\tCREATE_TYPE,\n\tTEL_TYPE,\n\tMAILTO_TYPE,\n\tINTERNAL_TYPE,\n\tURL_TYPE,\n} from './constants';\nimport { store as blockEditorStore } from '../../store';\n\nexport const handleNoop = () => Promise.resolve( [] );\n\nexport const handleDirectEntry = ( val ) => {\n\tlet type = URL_TYPE;\n\n\tconst protocol = getProtocol( val ) || '';\n\n\tif ( protocol.includes( 'mailto' ) ) {\n\t\ttype = MAILTO_TYPE;\n\t}\n\n\tif ( protocol.includes( 'tel' ) ) {\n\t\ttype = TEL_TYPE;\n\t}\n\n\tif ( startsWith( val, '#' ) ) {\n\t\ttype = INTERNAL_TYPE;\n\t}\n\n\treturn Promise.resolve( [\n\t\t{\n\t\t\tid: val,\n\t\t\ttitle: val,\n\t\t\turl: type === 'URL' ? prependHTTP( val ) : val,\n\t\t\ttype,\n\t\t},\n\t] );\n};\n\nconst handleEntitySearch = async (\n\tval,\n\tsuggestionsQuery,\n\tfetchSearchSuggestions,\n\tdirectEntryHandler,\n\twithCreateSuggestion,\n\twithURLSuggestion,\n\tpageOnFront\n) => {\n\tconst { isInitialSuggestions } = suggestionsQuery;\n\tlet resultsIncludeFrontPage = false;\n\n\tlet results = await Promise.all( [\n\t\tfetchSearchSuggestions( val, suggestionsQuery ),\n\t\tdirectEntryHandler( val ),\n\t] );\n\n\t// Identify front page and update type to match.\n\tresults[ 0 ] = results[ 0 ].map( ( result ) => {\n\t\tif ( Number( result.id ) === pageOnFront ) {\n\t\t\tresultsIncludeFrontPage = true;\n\t\t\tresult.isFrontPage = true;\n\t\t\treturn result;\n\t\t}\n\n\t\treturn result;\n\t} );\n\n\tconst couldBeURL = ! val.includes( ' ' );\n\n\t// If it's potentially a URL search then concat on a URL search suggestion\n\t// just for good measure. That way once the actual results run out we always\n\t// have a URL option to fallback on.\n\tif (\n\t\t! resultsIncludeFrontPage &&\n\t\tcouldBeURL &&\n\t\twithURLSuggestion &&\n\t\t! isInitialSuggestions\n\t) {\n\t\tresults = results[ 0 ].concat( results[ 1 ] );\n\t} else {\n\t\tresults = results[ 0 ];\n\t}\n\n\t// If displaying initial suggestions just return plain results.\n\tif ( isInitialSuggestions ) {\n\t\treturn results;\n\t}\n\n\t// Here we append a faux suggestion to represent a \"CREATE\" option. This\n\t// is detected in the rendering of the search results and handled as a\n\t// special case. This is currently necessary because the suggestions\n\t// dropdown will only appear if there are valid suggestions and\n\t// therefore unless the create option is a suggestion it will not\n\t// display in scenarios where there are no results returned from the\n\t// API. In addition promoting CREATE to a first class suggestion affords\n\t// the a11y benefits afforded by `URLInput` to all suggestions (eg:\n\t// keyboard handling, ARIA roles...etc).\n\t//\n\t// Note also that the value of the `title` and `url` properties must correspond\n\t// to the text value of the `<input>`. This is because `title` is used\n\t// when creating the suggestion. Similarly `url` is used when using keyboard to select\n\t// the suggestion (the <form> `onSubmit` handler falls-back to `url`).\n\treturn isURLLike( val ) || ! withCreateSuggestion\n\t\t? results\n\t\t: results.concat( {\n\t\t\t\t// the `id` prop is intentionally ommitted here because it\n\t\t\t\t// is never exposed as part of the component's public API.\n\t\t\t\t// see: https://github.com/WordPress/gutenberg/pull/19775#discussion_r378931316.\n\t\t\t\ttitle: val, // Must match the existing `<input>`s text value.\n\t\t\t\turl: val, // Must match the existing `<input>`s text value.\n\t\t\t\ttype: CREATE_TYPE,\n\t\t } );\n};\n\nexport default function useSearchHandler(\n\tsuggestionsQuery,\n\tallowDirectEntry,\n\twithCreateSuggestion,\n\twithURLSuggestion\n) {\n\tconst { fetchSearchSuggestions, pageOnFront } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\n\t\treturn {\n\t\t\tpageOnFront: getSettings().pageOnFront,\n\t\t\tfetchSearchSuggestions: getSettings()\n\t\t\t\t.__experimentalFetchLinkSuggestions,\n\t\t};\n\t}, [] );\n\n\tconst directEntryHandler = allowDirectEntry\n\t\t? handleDirectEntry\n\t\t: handleNoop;\n\n\treturn useCallback(\n\t\t( val, { isInitialSuggestions } ) => {\n\t\t\treturn isURLLike( val )\n\t\t\t\t? directEntryHandler( val, { isInitialSuggestions } )\n\t\t\t\t: handleEntitySearch(\n\t\t\t\t\t\tval,\n\t\t\t\t\t\t{ ...suggestionsQuery, isInitialSuggestions },\n\t\t\t\t\t\tfetchSearchSuggestions,\n\t\t\t\t\t\tdirectEntryHandler,\n\t\t\t\t\t\twithCreateSuggestion,\n\t\t\t\t\t\twithURLSuggestion,\n\t\t\t\t\t\tpageOnFront\n\t\t\t\t );\n\t\t},\n\t\t[ directEntryHandler, fetchSearchSuggestions, withCreateSuggestion ]\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/use-search-handler.js"],"names":["handleNoop","Promise","resolve","handleDirectEntry","val","type","URL_TYPE","protocol","includes","MAILTO_TYPE","TEL_TYPE","INTERNAL_TYPE","id","title","url","handleEntitySearch","suggestionsQuery","fetchSearchSuggestions","directEntryHandler","withCreateSuggestion","withURLSuggestion","pageOnFront","isInitialSuggestions","resultsIncludeFrontPage","results","all","map","result","Number","isFrontPage","couldBeURL","concat","CREATE_TYPE","useSearchHandler","allowDirectEntry","select","getSettings","blockEditorStore","__experimentalFetchLinkSugg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,IAAAA;AAA1B,MAA0C,qBAAac,MAAF,IAAc;AACxE,UAAM;AAAEC,MAAAA;AAAF,QAAkBD,MAAM,CAAEE,YAAF,CAA9B;AAEA,WAAO;AACNhB,MAAAA,WAAW,EAAEe,WAAW,GAAGf,WADrB;AAENJ,MAAAA,sBAAsB,EACrBmB,WAAW,GAAGE;AAHT,KAAP;AAKA,GAR+C,EAQ7C,EAR6C,CAAhD;AAUA,QAAMpB,kBAAkB,GAAGgB,gBAAgB,GACxC/B,iBADwC,GAExCH,UAFH;AAIA,SAAO,0BACN,CAAEI,GAAF,WAAqC;AAAA,QAA9B;AAAEkB,MAAAA;AAAF,KAA8B;AACpC,WAAO,wBAAWlB,GAAX,IACJc,kBAAkB,CAAEd,GAAF,EAAO;AAAEkB,MAAAA;AAAF,KAAP,CADd,GAEJP,kBAAkB,CAClBX,GADkB,EAElB,EAAE,GAAGY,gBAAL;AAAuBM,MAAAA;AAAvB,KAFkB,EAGlBL,sBAHkB,EAIlBC,kBAJkB,EAKlBC,oBALkB,EAMlBC,iBANkB,EAOlBC,WAPkB,CAFrB;AAWA,GAbK,EAcN,CAAEH,kBAAF,EAAsBD,sBAAtB,EAA8CE,oBAA9C,CAdM,CAAP;AAgBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getProtocol, prependHTTP } from '@wordpress/url';\nimport { useCallback } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * External dependencies\n */\nimport { startsWith } from 'lodash';\n\n/**\n * Internal dependencies\n */\nimport isURLLike from './is-url-like';\nimport {\n\tCREATE_TYPE,\n\tTEL_TYPE,\n\tMAILTO_TYPE,\n\tINTERNAL_TYPE,\n\tURL_TYPE,\n} from './constants';\nimport { store as blockEditorStore } from '../../store';\n\nexport const handleNoop = () => Promise.resolve( [] );\n\nexport const handleDirectEntry = ( val ) => {\n\tlet type = URL_TYPE;\n\n\tconst protocol = getProtocol( val ) || '';\n\n\tif ( protocol.includes( 'mailto' ) ) {\n\t\ttype = MAILTO_TYPE;\n\t}\n\n\tif ( protocol.includes( 'tel' ) ) {\n\t\ttype = TEL_TYPE;\n\t}\n\n\tif ( startsWith( val, '#' ) ) {\n\t\ttype = INTERNAL_TYPE;\n\t}\n\n\treturn Promise.resolve( [\n\t\t{\n\t\t\tid: val,\n\t\t\ttitle: val,\n\t\t\turl: type === 'URL' ? prependHTTP( val ) : val,\n\t\t\ttype,\n\t\t},\n\t] );\n};\n\nconst handleEntitySearch = async (\n\tval,\n\tsuggestionsQuery,\n\tfetchSearchSuggestions,\n\tdirectEntryHandler,\n\twithCreateSuggestion,\n\twithURLSuggestion,\n\tpageOnFront\n) => {\n\tconst { isInitialSuggestions } = suggestionsQuery;\n\tlet resultsIncludeFrontPage = false;\n\n\tlet results = await Promise.all( [\n\t\tfetchSearchSuggestions( val, suggestionsQuery ),\n\t\tdirectEntryHandler( val ),\n\t] );\n\n\t// Identify front page and update type to match.\n\tresults[ 0 ] = results[ 0 ].map( ( result ) => {\n\t\tif ( Number( result.id ) === pageOnFront ) {\n\t\t\tresultsIncludeFrontPage = true;\n\t\t\tresult.isFrontPage = true;\n\t\t\treturn result;\n\t\t}\n\n\t\treturn result;\n\t} );\n\n\tconst couldBeURL = ! val.includes( ' ' );\n\n\t// If it's potentially a URL search then concat on a URL search suggestion\n\t// just for good measure. That way once the actual results run out we always\n\t// have a URL option to fallback on.\n\tif (\n\t\t! resultsIncludeFrontPage &&\n\t\tcouldBeURL &&\n\t\twithURLSuggestion &&\n\t\t! isInitialSuggestions\n\t) {\n\t\tresults = results[ 0 ].concat( results[ 1 ] );\n\t} else {\n\t\tresults = results[ 0 ];\n\t}\n\n\t// If displaying initial suggestions just return plain results.\n\tif ( isInitialSuggestions ) {\n\t\treturn results;\n\t}\n\n\t// Here we append a faux suggestion to represent a \"CREATE\" option. This\n\t// is detected in the rendering of the search results and handled as a\n\t// special case. This is currently necessary because the suggestions\n\t// dropdown will only appear if there are valid suggestions and\n\t// therefore unless the create option is a suggestion it will not\n\t// display in scenarios where there are no results returned from the\n\t// API. In addition promoting CREATE to a first class suggestion affords\n\t// the a11y benefits afforded by `URLInput` to all suggestions (eg:\n\t// keyboard handling, ARIA roles...etc).\n\t//\n\t// Note also that the value of the `title` and `url` properties must correspond\n\t// to the text value of the `<input>`. This is because `title` is used\n\t// when creating the suggestion. Similarly `url` is used when using keyboard to select\n\t// the suggestion (the <form> `onSubmit` handler falls-back to `url`).\n\treturn isURLLike( val ) || ! withCreateSuggestion\n\t\t? results\n\t\t: results.concat( {\n\t\t\t\t// the `id` prop is intentionally ommitted here because it\n\t\t\t\t// is never exposed as part of the component's public API.\n\t\t\t\t// see: https://github.com/WordPress/gutenberg/pull/19775#discussion_r378931316.\n\t\t\t\ttitle: val, // Must match the existing `<input>`s text value.\n\t\t\t\turl: val, // Must match the existing `<input>`s text value.\n\t\t\t\ttype: CREATE_TYPE,\n\t\t } );\n};\n\nexport default function useSearchHandler(\n\tsuggestionsQuery,\n\tallowDirectEntry,\n\twithCreateSuggestion,\n\twithURLSuggestion\n) {\n\tconst { fetchSearchSuggestions, pageOnFront } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\n\t\treturn {\n\t\t\tpageOnFront: getSettings().pageOnFront,\n\t\t\tfetchSearchSuggestions:\n\t\t\t\tgetSettings().__experimentalFetchLinkSuggestions,\n\t\t};\n\t}, [] );\n\n\tconst directEntryHandler = allowDirectEntry\n\t\t? handleDirectEntry\n\t\t: handleNoop;\n\n\treturn useCallback(\n\t\t( val, { isInitialSuggestions } ) => {\n\t\t\treturn isURLLike( val )\n\t\t\t\t? directEntryHandler( val, { isInitialSuggestions } )\n\t\t\t\t: handleEntitySearch(\n\t\t\t\t\t\tval,\n\t\t\t\t\t\t{ ...suggestionsQuery, isInitialSuggestions },\n\t\t\t\t\t\tfetchSearchSuggestions,\n\t\t\t\t\t\tdirectEntryHandler,\n\t\t\t\t\t\twithCreateSuggestion,\n\t\t\t\t\t\twithURLSuggestion,\n\t\t\t\t\t\tpageOnFront\n\t\t\t\t );\n\t\t},\n\t\t[ directEntryHandler, fetchSearchSuggestions, withCreateSuggestion ]\n\t);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block-contents.js"],"names":["ListViewBlockContents","ref","onClick","onToggleExpanded","block","isSelected","position","siblingBlockCount","level","isExpanded","selectedClientIds","props","clientId","blockMovingClientId","selectedBlockInBlockEditor","select","hasBlockMovingClientId","getSelectedBlockClientId","blockEditorStore","isBlockMoveTarget","className","draggableClientIds","includes","draggable","onDragStart","onDragEnd"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAKA;;AAMA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAKA,MAAMA,qBAAqB,GAAG,yBAC7B,OAaCC,GAbD,KAcK;AAAA,MAbJ;AACCC,IAAAA,OADD;AAECC,IAAAA,gBAFD;AAGCC,IAAAA,KAHD;AAICC,IAAAA,UAJD;AAKCC,IAAAA,QALD;AAMCC,IAAAA,iBAND;AAOCC,IAAAA,KAPD;AAQCC,IAAAA,UARD;AASCC,IAAAA,iBATD;AAUC,OAAGC;AAVJ,GAaI;AACJ,QAAM;AAAEC,IAAAA;AAAF,MAAeR,KAArB;AAEA,QAAM;AAAES,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,MAAsD,qBACzDC,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,sBADK;AAELC,MAAAA;AAFK,QAGFF,MAAM,CAAEG,YAAF,CAHV;AAIA,WAAO;AACNL,MAAAA,mBAAmB,EAAEG,sBAAsB,EADrC;AAENF,MAAAA,0BAA0B,EAAEG,wBAAwB;AAF9C,KAAP;AAIA,GAV0D,EAW3D,CAAEL,QAAF,CAX2D,CAA5D;AAcA,QAAMO,iBAAiB,GACtBN,mBAAmB,IAAIC,0BAA0B,KAAKF,QADvD;AAGA,QAAMQ,SAAS,GAAG,yBAAY,uCAAZ,EAAqD;AACtE,0BAAsBD;AADgD,GAArD,CAAlB,CApBI,CAwBJ;AACA;AACA;AACA;;AACA,QAAME,kBAAkB,GAAGX,iBAAiB,CAACY,QAAlB,CAA4BV,QAA5B,IACxBF,iBADwB,GAExB,CAAEE,QAAF,CAFH;AAIA,SACC,4BAAC,uBAAD;AAAgB,IAAA,SAAS,EAAGS;AAA5B,KACG;AAAA,QAAE;AAAEE,MAAAA,SAAF;AAAaC,MAAAA,WAAb;AAA0BC,MAAAA;AAA1B,KAAF;AAAA,WACD,4BAAC,0BAAD;AACC,MAAA,GAAG,EAAGxB,GADP;AAEC,MAAA,SAAS,EAAGmB,SAFb;AAGC,MAAA,KAAK,EAAGhB,KAHT;AAIC,MAAA,OAAO,EAAGF,OAJX;AAKC,MAAA,gBAAgB,EAAGC,gBALpB;AAMC,MAAA,UAAU,EAAGE,UANd;AAOC,MAAA,QAAQ,EAAGC,QAPZ;AAQC,MAAA,iBAAiB,EAAGC,iBARrB;AASC,MAAA,KAAK,EAAGC,KATT;AAUC,MAAA,SAAS,EAAGe,SAVb;AAWC,MAAA,WAAW,EAAGC,WAXf;AAYC,MAAA,SAAS,EAAGC,SAZb;AAaC,MAAA,UAAU,EAAGhB;AAbd,OAcME,KAdN,EADC;AAAA,GADH,CADD;AAsBA,CArE4B,CAA9B;eAwEeX,qB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ListViewBlockSelectButton from './block-select-button';\nimport BlockDraggable from '../block-draggable';\nimport { store as blockEditorStore } from '../../store';\n\nconst ListViewBlockContents = forwardRef(\n\t(\n\t\t{\n\t\t\tonClick,\n\t\t\tonToggleExpanded,\n\t\t\tblock,\n\t\t\tisSelected,\n\t\t\tposition,\n\t\t\tsiblingBlockCount,\n\t\t\tlevel,\n\t\t\tisExpanded,\n\t\t\tselectedClientIds,\n\t\t\t...props\n\t\t},\n\t\tref\n\t) => {\n\t\tconst { clientId } = block;\n\n\t\tconst { blockMovingClientId, selectedBlockInBlockEditor } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\thasBlockMovingClientId,\n\t\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\t} = select( blockEditorStore );\n\t\t\t\treturn {\n\t\t\t\t\tblockMovingClientId: hasBlockMovingClientId(),\n\t\t\t\t\tselectedBlockInBlockEditor: getSelectedBlockClientId(),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\n\t\tconst isBlockMoveTarget =\n\t\t\tblockMovingClientId && selectedBlockInBlockEditor === clientId;\n\n\t\tconst className = classnames( 'block-editor-list-view-block-contents', {\n\t\t\t'is-dropping-before': isBlockMoveTarget,\n\t\t} );\n\n\t\t// Only include all selected blocks if the currently clicked on block\n\t\t// is one of the selected blocks. This ensures that if a user attempts\n\t\t// to drag a block that isn't part of the selection, they're still able\n\t\t// to drag it and rearrange its position.\n\t\tconst draggableClientIds = selectedClientIds.includes( clientId )\n\t\t\t? selectedClientIds\n\t\t\t: [ clientId ];\n\n\t\treturn (\n\t\t\t<BlockDraggable clientIds={ draggableClientIds }>\n\t\t\t\t{ ( { draggable, onDragStart, onDragEnd } ) => (\n\t\t\t\t\t<ListViewBlockSelectButton\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\tonToggleExpanded={ onToggleExpanded }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\tdraggable={ draggable }\n\t\t\t\t\t\tonDragStart={ onDragStart }\n\t\t\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockDraggable>\n\t\t);\n\t}\n);\n\nexport default ListViewBlockContents;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block-contents.js"],"names":["ListViewBlockContents","ref","onClick","onToggleExpanded","block","isSelected","position","siblingBlockCount","level","isExpanded","selectedClientIds","props","clientId","blockMovingClientId","selectedBlockInBlockEditor","select","hasBlockMovingClientId","getSelectedBlockClientId","blockEditorStore","isBlockMoveTarget","className","draggableClientIds","includes","draggable","onDragStart","onDragEnd"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAKA;;AAMA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAKA,MAAMA,qBAAqB,GAAG,yBAC7B,OAaCC,GAbD,KAcK;AAAA,MAbJ;AACCC,IAAAA,OADD;AAECC,IAAAA,gBAFD;AAGCC,IAAAA,KAHD;AAICC,IAAAA,UAJD;AAKCC,IAAAA,QALD;AAMCC,IAAAA,iBAND;AAOCC,IAAAA,KAPD;AAQCC,IAAAA,UARD;AASCC,IAAAA,iBATD;AAUC,OAAGC;AAVJ,GAaI;AACJ,QAAM;AAAEC,IAAAA;AAAF,MAAeR,KAArB;AAEA,QAAM;AAAES,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,MAAsD,qBACzDC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,sBAAF;AAA0BC,MAAAA;AAA1B,QACLF,MAAM,CAAEG,YAAF,CADP;AAEA,WAAO;AACNL,MAAAA,mBAAmB,EAAEG,sBAAsB,EADrC;AAENF,MAAAA,0BAA0B,EAAEG,wBAAwB;AAF9C,KAAP;AAIA,GAR0D,EAS3D,CAAEL,QAAF,CAT2D,CAA5D;AAYA,QAAMO,iBAAiB,GACtBN,mBAAmB,IAAIC,0BAA0B,KAAKF,QADvD;AAGA,QAAMQ,SAAS,GAAG,yBAAY,uCAAZ,EAAqD;AACtE,0BAAsBD;AADgD,GAArD,CAAlB,CAlBI,CAsBJ;AACA;AACA;AACA;;AACA,QAAME,kBAAkB,GAAGX,iBAAiB,CAACY,QAAlB,CAA4BV,QAA5B,IACxBF,iBADwB,GAExB,CAAEE,QAAF,CAFH;AAIA,SACC,4BAAC,uBAAD;AAAgB,IAAA,SAAS,EAAGS;AAA5B,KACG;AAAA,QAAE;AAAEE,MAAAA,SAAF;AAAaC,MAAAA,WAAb;AAA0BC,MAAAA;AAA1B,KAAF;AAAA,WACD,4BAAC,0BAAD;AACC,MAAA,GAAG,EAAGxB,GADP;AAEC,MAAA,SAAS,EAAGmB,SAFb;AAGC,MAAA,KAAK,EAAGhB,KAHT;AAIC,MAAA,OAAO,EAAGF,OAJX;AAKC,MAAA,gBAAgB,EAAGC,gBALpB;AAMC,MAAA,UAAU,EAAGE,UANd;AAOC,MAAA,QAAQ,EAAGC,QAPZ;AAQC,MAAA,iBAAiB,EAAGC,iBARrB;AASC,MAAA,KAAK,EAAGC,KATT;AAUC,MAAA,SAAS,EAAGe,SAVb;AAWC,MAAA,WAAW,EAAGC,WAXf;AAYC,MAAA,SAAS,EAAGC,SAZb;AAaC,MAAA,UAAU,EAAGhB;AAbd,OAcME,KAdN,EADC;AAAA,GADH,CADD;AAsBA,CAnE4B,CAA9B;eAsEeX,qB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ListViewBlockSelectButton from './block-select-button';\nimport BlockDraggable from '../block-draggable';\nimport { store as blockEditorStore } from '../../store';\n\nconst ListViewBlockContents = forwardRef(\n\t(\n\t\t{\n\t\t\tonClick,\n\t\t\tonToggleExpanded,\n\t\t\tblock,\n\t\t\tisSelected,\n\t\t\tposition,\n\t\t\tsiblingBlockCount,\n\t\t\tlevel,\n\t\t\tisExpanded,\n\t\t\tselectedClientIds,\n\t\t\t...props\n\t\t},\n\t\tref\n\t) => {\n\t\tconst { clientId } = block;\n\n\t\tconst { blockMovingClientId, selectedBlockInBlockEditor } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { hasBlockMovingClientId, getSelectedBlockClientId } =\n\t\t\t\t\tselect( blockEditorStore );\n\t\t\t\treturn {\n\t\t\t\t\tblockMovingClientId: hasBlockMovingClientId(),\n\t\t\t\t\tselectedBlockInBlockEditor: getSelectedBlockClientId(),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\n\t\tconst isBlockMoveTarget =\n\t\t\tblockMovingClientId && selectedBlockInBlockEditor === clientId;\n\n\t\tconst className = classnames( 'block-editor-list-view-block-contents', {\n\t\t\t'is-dropping-before': isBlockMoveTarget,\n\t\t} );\n\n\t\t// Only include all selected blocks if the currently clicked on block\n\t\t// is one of the selected blocks. This ensures that if a user attempts\n\t\t// to drag a block that isn't part of the selection, they're still able\n\t\t// to drag it and rearrange its position.\n\t\tconst draggableClientIds = selectedClientIds.includes( clientId )\n\t\t\t? selectedClientIds\n\t\t\t: [ clientId ];\n\n\t\treturn (\n\t\t\t<BlockDraggable clientIds={ draggableClientIds }>\n\t\t\t\t{ ( { draggable, onDragStart, onDragEnd } ) => (\n\t\t\t\t\t<ListViewBlockSelectButton\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\tonToggleExpanded={ onToggleExpanded }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\tdraggable={ draggable }\n\t\t\t\t\t\tonDragStart={ onDragStart }\n\t\t\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockDraggable>\n\t\t);\n\t}\n);\n\nexport default ListViewBlockContents;\n"]}