@wordpress/block-editor 12.1.0 → 12.2.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 (391) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/autocompleters/block.js +13 -5
  3. package/build/autocompleters/block.js.map +1 -1
  4. package/build/components/block-breadcrumb/index.js +6 -3
  5. package/build/components/block-breadcrumb/index.js.map +1 -1
  6. package/build/components/block-editing-mode/index.js +84 -0
  7. package/build/components/block-editing-mode/index.js.map +1 -0
  8. package/build/components/block-list/block-list-block-context.js +15 -0
  9. package/build/components/block-list/block-list-block-context.js.map +1 -0
  10. package/build/components/block-list/block.js +29 -37
  11. package/build/components/block-list/block.js.map +1 -1
  12. package/build/components/block-list/block.native.js +14 -22
  13. package/build/components/block-list/block.native.js.map +1 -1
  14. package/build/components/block-list/index.native.js +107 -108
  15. package/build/components/block-list/index.native.js.map +1 -1
  16. package/build/components/block-list/use-block-props/index.js +2 -2
  17. package/build/components/block-list/use-block-props/index.js.map +1 -1
  18. package/build/components/block-list/use-in-between-inserter.js +7 -5
  19. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  20. package/build/components/block-list-appender/index.js +15 -1
  21. package/build/components/block-list-appender/index.js.map +1 -1
  22. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +19 -4
  23. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  24. package/build/components/block-styles/preview-panel.js +1 -2
  25. package/build/components/block-styles/preview-panel.js.map +1 -1
  26. package/build/components/block-switcher/block-transformations-menu.js +8 -0
  27. package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
  28. package/build/components/block-switcher/block-variation-transformations.js +125 -0
  29. package/build/components/block-switcher/block-variation-transformations.js.map +1 -0
  30. package/build/components/block-switcher/index.js +34 -12
  31. package/build/components/block-switcher/index.js.map +1 -1
  32. package/build/components/block-switcher/pattern-transformations-menu.js +3 -3
  33. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  34. package/build/components/block-toolbar/index.js +9 -7
  35. package/build/components/block-toolbar/index.js.map +1 -1
  36. package/build/components/block-tools/block-contextual-toolbar.js +5 -3
  37. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  38. package/build/components/block-tools/insertion-point.js +11 -5
  39. package/build/components/block-tools/insertion-point.js.map +1 -1
  40. package/build/components/convert-to-group-buttons/index.js +7 -2
  41. package/build/components/convert-to-group-buttons/index.js.map +1 -1
  42. package/build/components/convert-to-group-buttons/index.native.js +87 -3
  43. package/build/components/convert-to-group-buttons/index.native.js.map +1 -1
  44. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +23 -37
  45. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  46. package/build/components/global-styles/dimensions-panel.js +3 -2
  47. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  48. package/build/components/iframe/index.js +14 -7
  49. package/build/components/iframe/index.js.map +1 -1
  50. package/build/components/inner-blocks/index.js +2 -1
  51. package/build/components/inner-blocks/index.js.map +1 -1
  52. package/build/components/inner-blocks/index.native.js +7 -7
  53. package/build/components/inner-blocks/index.native.js.map +1 -1
  54. package/build/components/inner-blocks/use-nested-settings-update.js +13 -5
  55. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  56. package/build/components/inserter/index.js +3 -7
  57. package/build/components/inserter/index.js.map +1 -1
  58. package/build/components/inserter/quick-inserter.js +2 -4
  59. package/build/components/inserter/quick-inserter.js.map +1 -1
  60. package/build/components/inserter/search-results.js +19 -6
  61. package/build/components/inserter/search-results.js.map +1 -1
  62. package/build/components/list-view/appender.js +6 -1
  63. package/build/components/list-view/appender.js.map +1 -1
  64. package/build/components/list-view/block-contents.js +4 -2
  65. package/build/components/list-view/block-contents.js.map +1 -1
  66. package/build/components/list-view/block.js +21 -25
  67. package/build/components/list-view/block.js.map +1 -1
  68. package/build/components/list-view/branch.js +1 -3
  69. package/build/components/list-view/branch.js.map +1 -1
  70. package/build/components/list-view/index.js +14 -7
  71. package/build/components/list-view/index.js.map +1 -1
  72. package/build/components/list-view/use-list-view-client-ids.js +27 -3
  73. package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
  74. package/build/components/publish-date-time-picker/index.js +0 -2
  75. package/build/components/publish-date-time-picker/index.js.map +1 -1
  76. package/build/components/url-input/index.js +3 -0
  77. package/build/components/url-input/index.js.map +1 -1
  78. package/build/components/use-block-drop-zone/index.js +25 -15
  79. package/build/components/use-block-drop-zone/index.js.map +1 -1
  80. package/build/components/use-resize-canvas/index.js +8 -1
  81. package/build/components/use-resize-canvas/index.js.map +1 -1
  82. package/build/components/writing-flow/use-arrow-nav.js +13 -7
  83. package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
  84. package/build/hooks/align.js +3 -7
  85. package/build/hooks/align.js.map +1 -1
  86. package/build/hooks/behaviors.js +115 -0
  87. package/build/hooks/behaviors.js.map +1 -0
  88. package/build/hooks/dimensions.js +0 -30
  89. package/build/hooks/dimensions.js.map +1 -1
  90. package/build/hooks/duotone.js +4 -8
  91. package/build/hooks/duotone.js.map +1 -1
  92. package/build/hooks/index.js +2 -0
  93. package/build/hooks/index.js.map +1 -1
  94. package/build/hooks/layout.js +8 -9
  95. package/build/hooks/layout.js.map +1 -1
  96. package/build/private-apis.js +4 -7
  97. package/build/private-apis.js.map +1 -1
  98. package/build/store/private-actions.js +46 -0
  99. package/build/store/private-actions.js.map +1 -1
  100. package/build/store/private-selectors.js +88 -0
  101. package/build/store/private-selectors.js.map +1 -1
  102. package/build/store/reducer.js +36 -1
  103. package/build/store/reducer.js.map +1 -1
  104. package/build/store/selectors.js +28 -18
  105. package/build/store/selectors.js.map +1 -1
  106. package/build/utils/order-inserter-block-items.js +41 -0
  107. package/build/utils/order-inserter-block-items.js.map +1 -0
  108. package/build-module/autocompleters/block.js +12 -5
  109. package/build-module/autocompleters/block.js.map +1 -1
  110. package/build-module/components/block-breadcrumb/index.js +5 -3
  111. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  112. package/build-module/components/block-editing-mode/index.js +72 -0
  113. package/build-module/components/block-editing-mode/index.js.map +1 -0
  114. package/build-module/components/block-list/block-list-block-context.js +6 -0
  115. package/build-module/components/block-list/block-list-block-context.js.map +1 -0
  116. package/build-module/components/block-list/block.js +26 -34
  117. package/build-module/components/block-list/block.js.map +1 -1
  118. package/build-module/components/block-list/block.native.js +14 -22
  119. package/build-module/components/block-list/block.native.js.map +1 -1
  120. package/build-module/components/block-list/index.native.js +108 -110
  121. package/build-module/components/block-list/index.native.js.map +1 -1
  122. package/build-module/components/block-list/use-block-props/index.js +1 -1
  123. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  124. package/build-module/components/block-list/use-in-between-inserter.js +6 -5
  125. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  126. package/build-module/components/block-list-appender/index.js +15 -1
  127. package/build-module/components/block-list-appender/index.js.map +1 -1
  128. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +18 -4
  129. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  130. package/build-module/components/block-styles/preview-panel.js +1 -2
  131. package/build-module/components/block-styles/preview-panel.js.map +1 -1
  132. package/build-module/components/block-switcher/block-transformations-menu.js +7 -0
  133. package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
  134. package/build-module/components/block-switcher/block-variation-transformations.js +108 -0
  135. package/build-module/components/block-switcher/block-variation-transformations.js.map +1 -0
  136. package/build-module/components/block-switcher/index.js +33 -12
  137. package/build-module/components/block-switcher/index.js.map +1 -1
  138. package/build-module/components/block-switcher/pattern-transformations-menu.js +3 -3
  139. package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  140. package/build-module/components/block-toolbar/index.js +8 -7
  141. package/build-module/components/block-toolbar/index.js.map +1 -1
  142. package/build-module/components/block-tools/block-contextual-toolbar.js +4 -3
  143. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  144. package/build-module/components/block-tools/insertion-point.js +11 -5
  145. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  146. package/build-module/components/convert-to-group-buttons/index.js +7 -2
  147. package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
  148. package/build-module/components/convert-to-group-buttons/index.native.js +76 -1
  149. package/build-module/components/convert-to-group-buttons/index.native.js.map +1 -1
  150. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +22 -36
  151. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  152. package/build-module/components/global-styles/dimensions-panel.js +3 -2
  153. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  154. package/build-module/components/iframe/index.js +15 -8
  155. package/build-module/components/iframe/index.js.map +1 -1
  156. package/build-module/components/inner-blocks/index.js +2 -1
  157. package/build-module/components/inner-blocks/index.js.map +1 -1
  158. package/build-module/components/inner-blocks/index.native.js +7 -6
  159. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  160. package/build-module/components/inner-blocks/use-nested-settings-update.js +13 -5
  161. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  162. package/build-module/components/inserter/index.js +3 -7
  163. package/build-module/components/inserter/index.js.map +1 -1
  164. package/build-module/components/inserter/quick-inserter.js +2 -4
  165. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  166. package/build-module/components/inserter/search-results.js +16 -6
  167. package/build-module/components/inserter/search-results.js.map +1 -1
  168. package/build-module/components/list-view/appender.js +6 -2
  169. package/build-module/components/list-view/appender.js.map +1 -1
  170. package/build-module/components/list-view/block-contents.js +4 -2
  171. package/build-module/components/list-view/block-contents.js.map +1 -1
  172. package/build-module/components/list-view/block.js +20 -25
  173. package/build-module/components/list-view/block.js.map +1 -1
  174. package/build-module/components/list-view/branch.js +1 -3
  175. package/build-module/components/list-view/branch.js.map +1 -1
  176. package/build-module/components/list-view/index.js +15 -8
  177. package/build-module/components/list-view/index.js.map +1 -1
  178. package/build-module/components/list-view/use-list-view-client-ids.js +26 -3
  179. package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
  180. package/build-module/components/publish-date-time-picker/index.js +0 -2
  181. package/build-module/components/publish-date-time-picker/index.js.map +1 -1
  182. package/build-module/components/url-input/index.js +3 -0
  183. package/build-module/components/url-input/index.js.map +1 -1
  184. package/build-module/components/use-block-drop-zone/index.js +25 -16
  185. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  186. package/build-module/components/use-resize-canvas/index.js +8 -1
  187. package/build-module/components/use-resize-canvas/index.js.map +1 -1
  188. package/build-module/components/writing-flow/use-arrow-nav.js +13 -7
  189. package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
  190. package/build-module/hooks/align.js +3 -6
  191. package/build-module/hooks/align.js.map +1 -1
  192. package/build-module/hooks/behaviors.js +97 -0
  193. package/build-module/hooks/behaviors.js.map +1 -0
  194. package/build-module/hooks/dimensions.js +0 -28
  195. package/build-module/hooks/dimensions.js.map +1 -1
  196. package/build-module/hooks/duotone.js +3 -6
  197. package/build-module/hooks/duotone.js.map +1 -1
  198. package/build-module/hooks/index.js +1 -0
  199. package/build-module/hooks/index.js.map +1 -1
  200. package/build-module/hooks/layout.js +7 -9
  201. package/build-module/hooks/layout.js.map +1 -1
  202. package/build-module/private-apis.js +3 -5
  203. package/build-module/private-apis.js.map +1 -1
  204. package/build-module/store/private-actions.js +42 -0
  205. package/build-module/store/private-actions.js.map +1 -1
  206. package/build-module/store/private-selectors.js +79 -0
  207. package/build-module/store/private-selectors.js.map +1 -1
  208. package/build-module/store/reducer.js +34 -1
  209. package/build-module/store/reducer.js.map +1 -1
  210. package/build-module/store/selectors.js +26 -17
  211. package/build-module/store/selectors.js.map +1 -1
  212. package/build-module/utils/order-inserter-block-items.js +32 -0
  213. package/build-module/utils/order-inserter-block-items.js.map +1 -0
  214. package/build-style/content-rtl.css +32 -13
  215. package/build-style/content.css +32 -13
  216. package/build-style/default-editor-styles-rtl.css +1 -1
  217. package/build-style/default-editor-styles.css +1 -1
  218. package/build-style/style-rtl.css +19 -64
  219. package/build-style/style.css +20 -64
  220. package/package.json +32 -31
  221. package/src/autocompleters/block.js +15 -7
  222. package/src/components/block-breadcrumb/index.js +11 -3
  223. package/src/components/block-editing-mode/index.js +71 -0
  224. package/src/components/block-list/block-list-block-context.js +6 -0
  225. package/src/components/block-list/block.js +38 -56
  226. package/src/components/block-list/block.native.js +30 -41
  227. package/src/components/block-list/content.scss +5 -5
  228. package/src/components/block-list/index.native.js +164 -153
  229. package/src/components/block-list/test/index.native.js +2 -2
  230. package/src/components/block-list/use-block-props/index.js +1 -1
  231. package/src/components/block-list/use-in-between-inserter.js +7 -3
  232. package/src/components/block-list-appender/index.js +22 -4
  233. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +23 -0
  234. package/src/components/block-mover/style.scss +1 -0
  235. package/src/components/block-styles/preview-panel.js +1 -3
  236. package/src/components/block-switcher/block-transformations-menu.js +12 -0
  237. package/src/components/block-switcher/block-variation-transformations.js +115 -0
  238. package/src/components/block-switcher/index.js +38 -5
  239. package/src/components/block-switcher/pattern-transformations-menu.js +5 -5
  240. package/src/components/block-switcher/style.scss +6 -5
  241. package/src/components/block-toolbar/index.js +10 -11
  242. package/src/components/block-tools/block-contextual-toolbar.js +4 -5
  243. package/src/components/block-tools/insertion-point.js +23 -9
  244. package/src/components/button-block-appender/content.scss +22 -0
  245. package/src/components/convert-to-group-buttons/index.js +9 -2
  246. package/src/components/convert-to-group-buttons/index.native.js +79 -1
  247. package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +32 -38
  248. package/src/components/global-styles/dimensions-panel.js +3 -2
  249. package/src/components/global-styles/style.scss +3 -0
  250. package/src/components/iframe/index.js +22 -12
  251. package/src/components/inner-blocks/README.md +5 -0
  252. package/src/components/inner-blocks/index.js +2 -0
  253. package/src/components/inner-blocks/index.native.js +16 -6
  254. package/src/components/inner-blocks/use-nested-settings-update.js +20 -3
  255. package/src/components/inserter/index.js +1 -9
  256. package/src/components/inserter/quick-inserter.js +0 -2
  257. package/src/components/inserter/search-results.js +32 -6
  258. package/src/components/list-view/appender.js +3 -2
  259. package/src/components/list-view/block-contents.js +8 -2
  260. package/src/components/list-view/block.js +29 -35
  261. package/src/components/list-view/branch.js +1 -7
  262. package/src/components/list-view/index.js +17 -4
  263. package/src/components/list-view/style.scss +2 -5
  264. package/src/components/list-view/use-list-view-client-ids.js +21 -4
  265. package/src/components/publish-date-time-picker/index.js +0 -2
  266. package/src/components/url-input/README.md +6 -0
  267. package/src/components/url-input/index.js +1 -0
  268. package/src/components/use-block-drop-zone/index.js +31 -17
  269. package/src/components/use-resize-canvas/index.js +9 -1
  270. package/src/components/writing-flow/test/index.js +15 -0
  271. package/src/components/writing-flow/use-arrow-nav.js +17 -4
  272. package/src/hooks/align.js +3 -11
  273. package/src/hooks/behaviors.js +104 -0
  274. package/src/hooks/dimensions.js +0 -40
  275. package/src/hooks/duotone.js +3 -11
  276. package/src/hooks/index.js +1 -0
  277. package/src/hooks/layout.js +10 -18
  278. package/src/private-apis.js +2 -4
  279. package/src/store/private-actions.js +39 -0
  280. package/src/store/private-selectors.js +95 -0
  281. package/src/store/reducer.js +27 -0
  282. package/src/store/selectors.js +25 -15
  283. package/src/store/test/private-actions.js +32 -1
  284. package/src/store/test/private-selectors.js +158 -0
  285. package/src/store/test/reducer.js +48 -0
  286. package/src/style.scss +0 -3
  287. package/src/utils/order-inserter-block-items.js +26 -0
  288. package/build/components/block-list/block-list-compact.native.js +0 -75
  289. package/build/components/block-list/block-list-compact.native.js.map +0 -1
  290. package/build/components/off-canvas-editor/appender.js +0 -125
  291. package/build/components/off-canvas-editor/appender.js.map +0 -1
  292. package/build/components/off-canvas-editor/block-contents.js +0 -141
  293. package/build/components/off-canvas-editor/block-contents.js.map +0 -1
  294. package/build/components/off-canvas-editor/block-select-button.js +0 -126
  295. package/build/components/off-canvas-editor/block-select-button.js.map +0 -1
  296. package/build/components/off-canvas-editor/block.js +0 -297
  297. package/build/components/off-canvas-editor/block.js.map +0 -1
  298. package/build/components/off-canvas-editor/branch.js +0 -197
  299. package/build/components/off-canvas-editor/branch.js.map +0 -1
  300. package/build/components/off-canvas-editor/context.js +0 -19
  301. package/build/components/off-canvas-editor/context.js.map +0 -1
  302. package/build/components/off-canvas-editor/drop-indicator.js +0 -118
  303. package/build/components/off-canvas-editor/drop-indicator.js.map +0 -1
  304. package/build/components/off-canvas-editor/expander.js +0 -41
  305. package/build/components/off-canvas-editor/expander.js.map +0 -1
  306. package/build/components/off-canvas-editor/index.js +0 -236
  307. package/build/components/off-canvas-editor/index.js.map +0 -1
  308. package/build/components/off-canvas-editor/leaf-more-menu.js +0 -148
  309. package/build/components/off-canvas-editor/leaf-more-menu.js.map +0 -1
  310. package/build/components/off-canvas-editor/leaf.js +0 -60
  311. package/build/components/off-canvas-editor/leaf.js.map +0 -1
  312. package/build/components/off-canvas-editor/link-ui.js +0 -186
  313. package/build/components/off-canvas-editor/link-ui.js.map +0 -1
  314. package/build/components/off-canvas-editor/update-attributes.js +0 -108
  315. package/build/components/off-canvas-editor/update-attributes.js.map +0 -1
  316. package/build/components/off-canvas-editor/use-block-selection.js +0 -139
  317. package/build/components/off-canvas-editor/use-block-selection.js.map +0 -1
  318. package/build/components/off-canvas-editor/use-inserted-block.js +0 -58
  319. package/build/components/off-canvas-editor/use-inserted-block.js.map +0 -1
  320. package/build/components/off-canvas-editor/use-list-view-client-ids.js +0 -33
  321. package/build/components/off-canvas-editor/use-list-view-client-ids.js.map +0 -1
  322. package/build/components/off-canvas-editor/use-list-view-drop-zone.js +0 -235
  323. package/build/components/off-canvas-editor/use-list-view-drop-zone.js.map +0 -1
  324. package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js +0 -60
  325. package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +0 -1
  326. package/build/components/off-canvas-editor/utils.js +0 -60
  327. package/build/components/off-canvas-editor/utils.js.map +0 -1
  328. package/build-module/components/block-list/block-list-compact.native.js +0 -60
  329. package/build-module/components/block-list/block-list-compact.native.js.map +0 -1
  330. package/build-module/components/off-canvas-editor/appender.js +0 -108
  331. package/build-module/components/off-canvas-editor/appender.js.map +0 -1
  332. package/build-module/components/off-canvas-editor/block-contents.js +0 -121
  333. package/build-module/components/off-canvas-editor/block-contents.js.map +0 -1
  334. package/build-module/components/off-canvas-editor/block-select-button.js +0 -107
  335. package/build-module/components/off-canvas-editor/block-select-button.js.map +0 -1
  336. package/build-module/components/off-canvas-editor/block.js +0 -273
  337. package/build-module/components/off-canvas-editor/block.js.map +0 -1
  338. package/build-module/components/off-canvas-editor/branch.js +0 -179
  339. package/build-module/components/off-canvas-editor/branch.js.map +0 -1
  340. package/build-module/components/off-canvas-editor/context.js +0 -7
  341. package/build-module/components/off-canvas-editor/context.js.map +0 -1
  342. package/build-module/components/off-canvas-editor/drop-indicator.js +0 -111
  343. package/build-module/components/off-canvas-editor/drop-indicator.js.map +0 -1
  344. package/build-module/components/off-canvas-editor/expander.js +0 -32
  345. package/build-module/components/off-canvas-editor/expander.js.map +0 -1
  346. package/build-module/components/off-canvas-editor/index.js +0 -213
  347. package/build-module/components/off-canvas-editor/index.js.map +0 -1
  348. package/build-module/components/off-canvas-editor/leaf-more-menu.js +0 -130
  349. package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +0 -1
  350. package/build-module/components/off-canvas-editor/leaf.js +0 -45
  351. package/build-module/components/off-canvas-editor/leaf.js.map +0 -1
  352. package/build-module/components/off-canvas-editor/link-ui.js +0 -166
  353. package/build-module/components/off-canvas-editor/link-ui.js.map +0 -1
  354. package/build-module/components/off-canvas-editor/update-attributes.js +0 -97
  355. package/build-module/components/off-canvas-editor/update-attributes.js.map +0 -1
  356. package/build-module/components/off-canvas-editor/use-block-selection.js +0 -124
  357. package/build-module/components/off-canvas-editor/use-block-selection.js.map +0 -1
  358. package/build-module/components/off-canvas-editor/use-inserted-block.js +0 -47
  359. package/build-module/components/off-canvas-editor/use-inserted-block.js.map +0 -1
  360. package/build-module/components/off-canvas-editor/use-list-view-client-ids.js +0 -24
  361. package/build-module/components/off-canvas-editor/use-list-view-client-ids.js.map +0 -1
  362. package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js +0 -220
  363. package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js.map +0 -1
  364. package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js +0 -50
  365. package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +0 -1
  366. package/build-module/components/off-canvas-editor/utils.js +0 -44
  367. package/build-module/components/off-canvas-editor/utils.js.map +0 -1
  368. package/src/components/block-list/block-list-compact.native.js +0 -63
  369. package/src/components/off-canvas-editor/README.md +0 -5
  370. package/src/components/off-canvas-editor/appender.js +0 -124
  371. package/src/components/off-canvas-editor/block-contents.js +0 -156
  372. package/src/components/off-canvas-editor/block-select-button.js +0 -128
  373. package/src/components/off-canvas-editor/block.js +0 -347
  374. package/src/components/off-canvas-editor/branch.js +0 -238
  375. package/src/components/off-canvas-editor/context.js +0 -8
  376. package/src/components/off-canvas-editor/drop-indicator.js +0 -126
  377. package/src/components/off-canvas-editor/expander.js +0 -26
  378. package/src/components/off-canvas-editor/index.js +0 -271
  379. package/src/components/off-canvas-editor/leaf-more-menu.js +0 -158
  380. package/src/components/off-canvas-editor/leaf.js +0 -52
  381. package/src/components/off-canvas-editor/link-ui.js +0 -167
  382. package/src/components/off-canvas-editor/style.scss +0 -34
  383. package/src/components/off-canvas-editor/test/use-inserted-block.js +0 -108
  384. package/src/components/off-canvas-editor/test/utils.js +0 -50
  385. package/src/components/off-canvas-editor/update-attributes.js +0 -99
  386. package/src/components/off-canvas-editor/use-block-selection.js +0 -169
  387. package/src/components/off-canvas-editor/use-inserted-block.js +0 -47
  388. package/src/components/off-canvas-editor/use-list-view-client-ids.js +0 -29
  389. package/src/components/off-canvas-editor/use-list-view-drop-zone.js +0 -260
  390. package/src/components/off-canvas-editor/use-list-view-expand-selected-item.js +0 -58
  391. package/src/components/off-canvas-editor/utils.js +0 -58
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inner-blocks/use-nested-settings-update.js"],"names":["pendingSettingsUpdates","WeakMap","useNestedSettingsUpdate","clientId","allowedBlocks","__experimentalDefaultBlock","__experimentalDirectInsert","templateLock","captureToolbars","orientation","layout","updateBlockListSettings","blockEditorStore","registry","blockListSettings","parentLock","select","rootClientId","getBlockRootClientId","getBlockListSettings","getTemplateLock","_allowedBlocks","newSettings","undefined","__experimentalCaptureToolbars","layoutType","type","getOrientation","get","set","push","window","queueMicrotask","length","batch","forEach","args"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;;AAKA;AACA;AACA;;AAIA;AAEA,MAAMA,sBAAsB,GAAG,IAAIC,OAAJ,EAA/B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASC,uBAAT,CACdC,QADc,EAEdC,aAFc,EAGdC,0BAHc,EAIdC,0BAJc,EAKdC,YALc,EAMdC,eANc,EAOdC,WAPc,EAQdC,MARc,EASb;AACD,QAAM;AAAEC,IAAAA;AAAF,MAA8B,uBAAaC,YAAb,CAApC;AACA,QAAMC,QAAQ,GAAG,wBAAjB;AAEA,QAAM;AAAEC,IAAAA,iBAAF;AAAqBC,IAAAA;AAArB,MAAoC,qBACvCC,MAAF,IAAc;AACb,UAAMC,YAAY,GACjBD,MAAM,CAAEJ,YAAF,CAAN,CAA2BM,oBAA3B,CAAiDf,QAAjD,CADD;AAEA,WAAO;AACNW,MAAAA,iBAAiB,EAChBE,MAAM,CAAEJ,YAAF,CAAN,CAA2BO,oBAA3B,CAAiDhB,QAAjD,CAFK;AAGNY,MAAAA,UAAU,EACTC,MAAM,CAAEJ,YAAF,CAAN,CAA2BQ,eAA3B,CAA4CH,YAA5C;AAJK,KAAP;AAMA,GAVwC,EAWzC,CAAEd,QAAF,CAXyC,CAA1C,CAJC,CAkBD;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,CAFR;AAGAS,MAAAA,MAAM,CAACC,cAAP,CAAuB,MAAM;AAAA;;AAC5B,qCAAKhC,sBAAsB,CAAC4B,GAAvB,CAA4Bf,QAA5B,CAAL,kDAAK,sBAAwCoB,MAA7C,EAAsD;AACrDpB,UAAAA,QAAQ,CAACqB,KAAT,CAAgB,MAAM;AACrBlC,YAAAA,sBAAsB,CACpB4B,GADF,CACOf,QADP,EAEEsB,OAFF,CAEaC,IAAF,IAAY;AACrBzB,cAAAA,uBAAuB,CAAE,GAAGyB,IAAL,CAAvB;AACA,aAJF;AAKApC,YAAAA,sBAAsB,CAAC6B,GAAvB,CAA4BhB,QAA5B,EAAsC,EAAtC;AACA,WAPD;AAQA;AACD,OAXD;AAYA;AACD,GA1DD,EA0DG,CACFV,QADE,EAEFW,iBAFE,EAGFO,cAHE,EAIFhB,0BAJE,EAKFC,0BALE,EAMFC,YANE,EAOFQ,UAPE,EAQFP,eARE,EASFC,WATE,EAUFE,uBAVE,EAWFD,MAXE,EAYFG,QAZE,CA1DH;AAwEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch, useRegistry } from '@wordpress/data';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { getLayoutType } from '../../layouts';\n\n/** @typedef {import('../../selectors').WPDirectInsertBlock } WPDirectInsertBlock */\n\nconst pendingSettingsUpdates = new WeakMap();\n\n/**\n * This hook is a side effect which updates the block-editor store when changes\n * happen to inner block settings. The given props are transformed into a\n * settings object, and if that is different from the current settings object in\n * the block-editor store, then the store is updated with the new settings which\n * came from props.\n *\n * @param {string} clientId The client ID of the block to update.\n * @param {string[]} allowedBlocks An array of block names which are permitted\n * in inner blocks.\n * @param {?WPDirectInsertBlock} __experimentalDefaultBlock The default block to insert: [ blockName, { blockAttributes } ].\n * @param {?Function|boolean} __experimentalDirectInsert If a default block should be inserted directly by the\n * appender.\n * @param {string} [templateLock] The template lock specified for the inner\n * blocks component. (e.g. \"all\")\n * @param {boolean} captureToolbars Whether or children toolbars should be shown\n * in the inner blocks component rather than on\n * the child block.\n * @param {string} orientation The direction in which the block\n * should face.\n * @param {Object} layout The layout object for the block container.\n */\nexport default function useNestedSettingsUpdate(\n\tclientId,\n\tallowedBlocks,\n\t__experimentalDefaultBlock,\n\t__experimentalDirectInsert,\n\ttemplateLock,\n\tcaptureToolbars,\n\torientation,\n\tlayout\n) {\n\tconst { updateBlockListSettings } = useDispatch( blockEditorStore );\n\tconst registry = useRegistry();\n\n\tconst { blockListSettings, parentLock } = useSelect(\n\t\t( select ) => {\n\t\t\tconst rootClientId =\n\t\t\t\tselect( blockEditorStore ).getBlockRootClientId( clientId );\n\t\t\treturn {\n\t\t\t\tblockListSettings:\n\t\t\t\t\tselect( blockEditorStore ).getBlockListSettings( clientId ),\n\t\t\t\tparentLock:\n\t\t\t\t\tselect( blockEditorStore ).getTemplateLock( rootClientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Memoize as inner blocks implementors often pass a new array on every\n\t// render.\n\tconst _allowedBlocks = useMemo( () => allowedBlocks, allowedBlocks );\n\n\tuseLayoutEffect( () => {\n\t\tconst newSettings = {\n\t\t\tallowedBlocks: _allowedBlocks,\n\t\t\ttemplateLock:\n\t\t\t\ttemplateLock === undefined || parentLock === 'contentOnly'\n\t\t\t\t\t? parentLock\n\t\t\t\t\t: templateLock,\n\t\t};\n\n\t\t// These values are not defined for RN, so only include them if they\n\t\t// are defined.\n\t\tif ( captureToolbars !== undefined ) {\n\t\t\tnewSettings.__experimentalCaptureToolbars = captureToolbars;\n\t\t}\n\n\t\t// Orientation depends on layout,\n\t\t// ideally the separate orientation prop should be deprecated.\n\t\tif ( orientation !== undefined ) {\n\t\t\tnewSettings.orientation = orientation;\n\t\t} else {\n\t\t\tconst layoutType = getLayoutType( layout?.type );\n\t\t\tnewSettings.orientation = layoutType.getOrientation( layout );\n\t\t}\n\n\t\tif ( __experimentalDefaultBlock !== undefined ) {\n\t\t\tnewSettings.__experimentalDefaultBlock = __experimentalDefaultBlock;\n\t\t}\n\n\t\tif ( __experimentalDirectInsert !== undefined ) {\n\t\t\tnewSettings.__experimentalDirectInsert = __experimentalDirectInsert;\n\t\t}\n\n\t\tif ( ! isShallowEqual( blockListSettings, newSettings ) ) {\n\t\t\t// Batch updates to block list settings to avoid triggering cascading renders\n\t\t\t// for each container block included in a tree and optimize initial render.\n\t\t\t// To avoid triggering updateBlockListSettings for each container block\n\t\t\t// causing X re-renderings for X container blocks,\n\t\t\t// we batch all the updatedBlockListSettings in a single \"data\" batch\n\t\t\t// which results in a single re-render.\n\t\t\tif ( ! pendingSettingsUpdates.get( registry ) ) {\n\t\t\t\tpendingSettingsUpdates.set( registry, [] );\n\t\t\t}\n\t\t\tpendingSettingsUpdates\n\t\t\t\t.get( registry )\n\t\t\t\t.push( [ clientId, newSettings ] );\n\t\t\twindow.queueMicrotask( () => {\n\t\t\t\tif ( pendingSettingsUpdates.get( registry )?.length ) {\n\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\tpendingSettingsUpdates\n\t\t\t\t\t\t\t.get( registry )\n\t\t\t\t\t\t\t.forEach( ( args ) => {\n\t\t\t\t\t\t\t\tupdateBlockListSettings( ...args );\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\tpendingSettingsUpdates.set( registry, [] );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t}, [\n\t\tclientId,\n\t\tblockListSettings,\n\t\t_allowedBlocks,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplateLock,\n\t\tparentLock,\n\t\tcaptureToolbars,\n\t\torientation,\n\t\tupdateBlockListSettings,\n\t\tlayout,\n\t\tregistry,\n\t] );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inner-blocks/use-nested-settings-update.js"],"names":["pendingSettingsUpdates","WeakMap","useNestedSettingsUpdate","clientId","allowedBlocks","prioritizedInserterBlocks","__experimentalDefaultBlock","__experimentalDirectInsert","templateLock","captureToolbars","orientation","layout","updateBlockListSettings","blockEditorStore","registry","blockListSettings","parentLock","select","rootClientId","getBlockRootClientId","getBlockListSettings","getTemplateLock","_allowedBlocks","_prioritizedInserterBlocks","newSettings","undefined","__experimentalCaptureToolbars","layoutType","type","getOrientation","get","set","push","window","queueMicrotask","length","batch","forEach","args"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;;AAKA;AACA;AACA;;AAIA;AAEA,MAAMA,sBAAsB,GAAG,IAAIC,OAAJ,EAA/B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASC,uBAAT,CACdC,QADc,EAEdC,aAFc,EAGdC,yBAHc,EAIdC,0BAJc,EAKdC,0BALc,EAMdC,YANc,EAOdC,eAPc,EAQdC,WARc,EASdC,MATc,EAUb;AACD,QAAM;AAAEC,IAAAA;AAAF,MAA8B,uBAAaC,YAAb,CAApC;AACA,QAAMC,QAAQ,GAAG,wBAAjB;AAEA,QAAM;AAAEC,IAAAA,iBAAF;AAAqBC,IAAAA;AAArB,MAAoC,qBACvCC,MAAF,IAAc;AACb,UAAMC,YAAY,GACjBD,MAAM,CAAEJ,YAAF,CAAN,CAA2BM,oBAA3B,CAAiDhB,QAAjD,CADD;AAEA,WAAO;AACNY,MAAAA,iBAAiB,EAChBE,MAAM,CAAEJ,YAAF,CAAN,CAA2BO,oBAA3B,CAAiDjB,QAAjD,CAFK;AAGNa,MAAAA,UAAU,EACTC,MAAM,CAAEJ,YAAF,CAAN,CAA2BQ,eAA3B,CAA4CH,YAA5C;AAJK,KAAP;AAMA,GAVwC,EAWzC,CAAEf,QAAF,CAXyC,CAA1C,CAJC,CAkBD;AACA;A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B,CAAC+B,GAAvB,CAA4BjB,QAA5B,EAAsC,EAAtC;AACA;;AACDd,MAAAA,sBAAsB,CACpB8B,GADF,CACOhB,QADP,EAEEkB,IAFF,CAEQ,CAAE7B,QAAF,EAAYqB,WAAZ,CAFR;AAGAS,MAAAA,MAAM,CAACC,cAAP,CAAuB,MAAM;AAAA;;AAC5B,qCAAKlC,sBAAsB,CAAC8B,GAAvB,CAA4BhB,QAA5B,CAAL,kDAAK,sBAAwCqB,MAA7C,EAAsD;AACrDrB,UAAAA,QAAQ,CAACsB,KAAT,CAAgB,MAAM;AACrBpC,YAAAA,sBAAsB,CACpB8B,GADF,CACOhB,QADP,EAEEuB,OAFF,CAEaC,IAAF,IAAY;AACrB1B,cAAAA,uBAAuB,CAAE,GAAG0B,IAAL,CAAvB;AACA,aAJF;AAKAtC,YAAAA,sBAAsB,CAAC+B,GAAvB,CAA4BjB,QAA5B,EAAsC,EAAtC;AACA,WAPD;AAQA;AACD,OAXD;AAYA;AACD,GA3DD,EA2DG,CACFX,QADE,EAEFY,iBAFE,EAGFO,cAHE,EAIFC,0BAJE,EAKFjB,0BALE,EAMFC,0BANE,EAOFC,YAPE,EAQFQ,UARE,EASFP,eATE,EAUFC,WAVE,EAWFE,uBAXE,EAYFD,MAZE,EAaFG,QAbE,CA3DH;AA0EA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch, useRegistry } from '@wordpress/data';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { getLayoutType } from '../../layouts';\n\n/** @typedef {import('../../selectors').WPDirectInsertBlock } WPDirectInsertBlock */\n\nconst pendingSettingsUpdates = new WeakMap();\n\n/**\n * This hook is a side effect which updates the block-editor store when changes\n * happen to inner block settings. The given props are transformed into a\n * settings object, and if that is different from the current settings object in\n * the block-editor store, then the store is updated with the new settings which\n * came from props.\n *\n * @param {string} clientId The client ID of the block to update.\n * @param {string[]} allowedBlocks An array of block names which are permitted\n * in inner blocks.\n * @param {string[]} prioritizedInserterBlocks Block names and/or block variations to be prioritized in the inserter, in the format {blockName}/{variationName}.\n * @param {?WPDirectInsertBlock} __experimentalDefaultBlock The default block to insert: [ blockName, { blockAttributes } ].\n * @param {?Function|boolean} __experimentalDirectInsert If a default block should be inserted directly by the\n * appender.\n * @param {string} [templateLock] The template lock specified for the inner\n * blocks component. (e.g. \"all\")\n * @param {boolean} captureToolbars Whether or children toolbars should be shown\n * in the inner blocks component rather than on\n * the child block.\n * @param {string} orientation The direction in which the block\n * should face.\n * @param {Object} layout The layout object for the block container.\n */\nexport default function useNestedSettingsUpdate(\n\tclientId,\n\tallowedBlocks,\n\tprioritizedInserterBlocks,\n\t__experimentalDefaultBlock,\n\t__experimentalDirectInsert,\n\ttemplateLock,\n\tcaptureToolbars,\n\torientation,\n\tlayout\n) {\n\tconst { updateBlockListSettings } = useDispatch( blockEditorStore );\n\tconst registry = useRegistry();\n\n\tconst { blockListSettings, parentLock } = useSelect(\n\t\t( select ) => {\n\t\t\tconst rootClientId =\n\t\t\t\tselect( blockEditorStore ).getBlockRootClientId( clientId );\n\t\t\treturn {\n\t\t\t\tblockListSettings:\n\t\t\t\t\tselect( blockEditorStore ).getBlockListSettings( clientId ),\n\t\t\t\tparentLock:\n\t\t\t\t\tselect( blockEditorStore ).getTemplateLock( rootClientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Memoize allowedBlocks and prioritisedInnerBlocks based on the contents\n\t// of the arrays. Implementors often pass a new array on every render,\n\t// and the contents of the arrays are just strings, so the entire array\n\t// can be passed as dependencies.\n\n\tconst _allowedBlocks = useMemo(\n\t\t() => allowedBlocks,\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\tallowedBlocks\n\t);\n\n\tconst _prioritizedInserterBlocks = useMemo(\n\t\t() => prioritizedInserterBlocks,\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\tprioritizedInserterBlocks\n\t);\n\n\tuseLayoutEffect( () => {\n\t\tconst newSettings = {\n\t\t\tallowedBlocks: _allowedBlocks,\n\t\t\tprioritizedInserterBlocks: _prioritizedInserterBlocks,\n\t\t\ttemplateLock:\n\t\t\t\ttemplateLock === undefined || parentLock === 'contentOnly'\n\t\t\t\t\t? parentLock\n\t\t\t\t\t: templateLock,\n\t\t};\n\n\t\t// These values are not defined for RN, so only include them if they\n\t\t// are defined.\n\t\tif ( captureToolbars !== undefined ) {\n\t\t\tnewSettings.__experimentalCaptureToolbars = captureToolbars;\n\t\t}\n\n\t\t// Orientation depends on layout,\n\t\t// ideally the separate orientation prop should be deprecated.\n\t\tif ( orientation !== undefined ) {\n\t\t\tnewSettings.orientation = orientation;\n\t\t} else {\n\t\t\tconst layoutType = getLayoutType( layout?.type );\n\t\t\tnewSettings.orientation = layoutType.getOrientation( layout );\n\t\t}\n\n\t\tif ( __experimentalDefaultBlock !== undefined ) {\n\t\t\tnewSettings.__experimentalDefaultBlock = __experimentalDefaultBlock;\n\t\t}\n\n\t\tif ( __experimentalDirectInsert !== undefined ) {\n\t\t\tnewSettings.__experimentalDirectInsert = __experimentalDirectInsert;\n\t\t}\n\n\t\tif ( ! isShallowEqual( blockListSettings, newSettings ) ) {\n\t\t\t// Batch updates to block list settings to avoid triggering cascading renders\n\t\t\t// for each container block included in a tree and optimize initial render.\n\t\t\t// To avoid triggering updateBlockListSettings for each container block\n\t\t\t// causing X re-renderings for X container blocks,\n\t\t\t// we batch all the updatedBlockListSettings in a single \"data\" batch\n\t\t\t// which results in a single re-render.\n\t\t\tif ( ! pendingSettingsUpdates.get( registry ) ) {\n\t\t\t\tpendingSettingsUpdates.set( registry, [] );\n\t\t\t}\n\t\t\tpendingSettingsUpdates\n\t\t\t\t.get( registry )\n\t\t\t\t.push( [ clientId, newSettings ] );\n\t\t\twindow.queueMicrotask( () => {\n\t\t\t\tif ( pendingSettingsUpdates.get( registry )?.length ) {\n\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\tpendingSettingsUpdates\n\t\t\t\t\t\t\t.get( registry )\n\t\t\t\t\t\t\t.forEach( ( args ) => {\n\t\t\t\t\t\t\t\tupdateBlockListSettings( ...args );\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\tpendingSettingsUpdates.set( registry, [] );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t}, [\n\t\tclientId,\n\t\tblockListSettings,\n\t\t_allowedBlocks,\n\t\t_prioritizedInserterBlocks,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplateLock,\n\t\tparentLock,\n\t\tcaptureToolbars,\n\t\torientation,\n\t\tupdateBlockListSettings,\n\t\tlayout,\n\t\tregistry,\n\t] );\n}\n"]}
@@ -174,8 +174,7 @@ class PrivateInserter extends _element.Component {
174
174
  __experimentalIsQuick: isQuick,
175
175
  prioritizePatterns,
176
176
  onSelectOrClose,
177
- selectBlockOnInsert,
178
- orderInitialBlockItems
177
+ selectBlockOnInsert
179
178
  } = this.props;
180
179
 
181
180
  if (isQuick) {
@@ -193,8 +192,7 @@ class PrivateInserter extends _element.Component {
193
192
  clientId: clientId,
194
193
  isAppender: isAppender,
195
194
  prioritizePatterns: prioritizePatterns,
196
- selectBlockOnInsert: selectBlockOnInsert,
197
- orderInitialBlockItems: orderInitialBlockItems
195
+ selectBlockOnInsert: selectBlockOnInsert
198
196
  });
199
197
  }
200
198
 
@@ -423,9 +421,7 @@ exports.ComposedPrivateInserter = ComposedPrivateInserter;
423
421
  const Inserter = (0, _element.forwardRef)((props, ref) => {
424
422
  return (0, _element.createElement)(ComposedPrivateInserter, (0, _extends2.default)({
425
423
  ref: ref
426
- }, props, {
427
- orderInitialBlockItems: undefined
428
- }));
424
+ }, props));
429
425
  });
430
426
  var _default = Inserter;
431
427
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/index.js"],"names":["defaultRenderToggle","onToggle","disabled","isOpen","blockTitle","hasSingleBlockType","toggleProps","prioritizePatterns","as","Wrapper","Button","label","labelProp","onClick","rest","handleClick","event","plus","PrivateInserter","Component","constructor","arguments","bind","renderToggle","renderContent","props","directInsertBlock","hasItems","onClose","rootClientId","clientId","isAppender","showInserterHelpPanel","__experimentalIsQuick","isQuick","onSelectOrClose","selectBlockOnInsert","orderInitialBlockItems","blocks","firstBlock","Array","isArray","length","render","position","insertOnlyAllowedBlock","shift","ComposedPrivateInserter","select","shouldDirectInsert","getBlockRootClientId","hasInserterItems","getAllowedBlocks","__experimentalGetDirectInsertBlock","getSettings","blockEditorStore","getBlockVariations","blocksStore","undefined","allowedBlocks","settings","name","allowedBlockType","title","__experimentalPreferPatternsOnRoot","dispatch","ownProps","getAdjacentBlockAttributes","attributesToCopy","getBlock","getPreviousBlockClientId","result","adjacentAttributes","parentBlock","innerBlocks","lastInnerBlock","attributes","currentBlock","previousBlock","forEach","attribute","hasOwnProperty","getInsertionIndex","getBlockIndex","getBlockSelectionEnd","getBlockOrder","end","insertBlock","blockToInsert","newAttributes","message","Inserter","ref"],"mappings":";;;;;;;;;AAWA;;;;AARA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;AAKA,MAAMA,mBAAmB,GAAG,QAQrB;AAAA,MARuB;AAC7BC,IAAAA,QAD6B;AAE7BC,IAAAA,QAF6B;AAG7BC,IAAAA,MAH6B;AAI7BC,IAAAA,UAJ6B;AAK7BC,IAAAA,kBAL6B;AAM7BC,IAAAA,WAAW,GAAG,EANe;AAO7BC,IAAAA;AAP6B,GAQvB;AACN,QAAM;AACLC,IAAAA,EAAE,EAAEC,OAAO,GAAGC,kBADT;AAELC,IAAAA,KAAK,EAAEC,SAFF;AAGLC,IAAAA,OAHK;AAIL,OAAGC;AAJE,MAKFR,WALJ;AAOA,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;AAKA,uBAAO2B,OAAP;AACA;;AA5IK,GAAP;AA8IA,CA/ID,CA/C+C,EA+L/C;AACA;AACA,0BACC;AAAA,MAAE;AAAE/D,IAAAA,QAAF;AAAYI,IAAAA,UAAZ;AAAwBF,IAAAA,YAAxB;AAAsCC,IAAAA;AAAtC,GAAF;AAAA,SACCH,QAAQ,IAAM,CAAEI,UAAF,IAAgB,CAAEF,YAAlB,IAAkC,CAAEC,QADnD;AAAA,CADD,CAjM+C,CAAT,EAqMlCZ,eArMkC,CAAhC;;AAuMP,MAAMyE,QAAQ,GAAG,yBAAY,CAAElE,KAAF,EAASmE,GAAT,KAAkB;AAC9C,SACC,4BAAC,uBAAD;AACC,IAAA,GAAG,EAAGA;AADP,KAEMnE,KAFN;AAGC,IAAA,sBAAsB,EAAGiC;AAH1B,KADD;AAOA,CARgB,CAAjB;eAUeiC,Q","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { forwardRef, Component } from '@wordpress/element';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose, ifCondition } from '@wordpress/compose';\nimport { createBlock, store as blocksStore } from '@wordpress/blocks';\nimport { plus } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport InserterMenu from './menu';\nimport QuickInserter from './quick-inserter';\nimport { store as blockEditorStore } from '../../store';\n\nconst defaultRenderToggle = ( {\n\tonToggle,\n\tdisabled,\n\tisOpen,\n\tblockTitle,\n\thasSingleBlockType,\n\ttoggleProps = {},\n\tprioritizePatterns,\n} ) => {\n\tconst {\n\t\tas: Wrapper = Button,\n\t\tlabel: labelProp,\n\t\tonClick,\n\t\t...rest\n\t} = toggleProps;\n\n\tlet label = labelProp;\n\tif ( ! label && hasSingleBlockType ) {\n\t\tlabel = sprintf(\n\t\t\t// translators: %s: the name of the block when there is only one\n\t\t\t_x( 'Add %s', 'directly add the only allowed block' ),\n\t\t\tblockTitle\n\t\t);\n\t} else if ( ! label && prioritizePatterns ) {\n\t\tlabel = __( 'Add pattern' );\n\t} else if ( ! label ) {\n\t\tlabel = _x( 'Add block', 'Generic label for block inserter button' );\n\t}\n\n\t// Handle both onClick functions from the toggle and the parent component.\n\tfunction handleClick( event ) {\n\t\tif ( onToggle ) {\n\t\t\tonToggle( event );\n\t\t}\n\t\tif ( onClick ) {\n\t\t\tonClick( event );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Wrapper\n\t\t\ticon={ plus }\n\t\t\tlabel={ label }\n\t\t\ttooltipPosition=\"bottom\"\n\t\t\tonClick={ handleClick }\n\t\t\tclassName=\"block-editor-inserter__toggle\"\n\t\t\taria-haspopup={ ! hasSingleBlockType ? 'true' : false }\n\t\t\taria-expanded={ ! hasSingleBlockType ? isOpen : false }\n\t\t\tdisabled={ disabled }\n\t\t\t{ ...rest }\n\t\t/>\n\t);\n};\n\nclass PrivateInserter extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.onToggle = this.onToggle.bind( this );\n\t\tthis.renderToggle = this.renderToggle.bind( this );\n\t\tthis.renderContent = this.renderContent.bind( this );\n\t}\n\n\tonToggle( isOpen ) {\n\t\tconst { onToggle } = this.props;\n\n\t\t// Surface toggle callback to parent component.\n\t\tif ( onToggle ) {\n\t\t\tonToggle( isOpen );\n\t\t}\n\t}\n\n\t/**\n\t * Render callback to display Dropdown toggle element.\n\t *\n\t * @param {Object} options\n\t * @param {Function} options.onToggle Callback to invoke when toggle is\n\t * pressed.\n\t * @param {boolean} options.isOpen Whether dropdown is currently open.\n\t *\n\t * @return {WPElement} Dropdown toggle element.\n\t */\n\trenderToggle( { onToggle, isOpen } ) {\n\t\tconst {\n\t\t\tdisabled,\n\t\t\tblockTitle,\n\t\t\thasSingleBlockType,\n\t\t\tdirectInsertBlock,\n\t\t\ttoggleProps,\n\t\t\thasItems,\n\t\t\trenderToggle = defaultRenderToggle,\n\t\t\tprioritizePatterns,\n\t\t} = this.props;\n\n\t\treturn renderToggle( {\n\t\t\tonToggle,\n\t\t\tisOpen,\n\t\t\tdisabled: disabled || ! hasItems,\n\t\t\tblockTitle,\n\t\t\thasSingleBlockType,\n\t\t\tdirectInsertBlock,\n\t\t\ttoggleProps,\n\t\t\tprioritizePatterns,\n\t\t} );\n\t}\n\n\t/**\n\t * Render callback to display Dropdown content element.\n\t *\n\t * @param {Object} options\n\t * @param {Function} options.onClose Callback to invoke when dropdown is\n\t * closed.\n\t *\n\t * @return {WPElement} Dropdown content element.\n\t */\n\trenderContent( { onClose } ) {\n\t\tconst {\n\t\t\trootClientId,\n\t\t\tclientId,\n\t\t\tisAppender,\n\t\t\tshowInserterHelpPanel,\n\n\t\t\t// This prop is experimental to give some time for the quick inserter to mature\n\t\t\t// Feel free to make them stable after a few releases.\n\t\t\t__experimentalIsQuick: isQuick,\n\t\t\tprioritizePatterns,\n\t\t\tonSelectOrClose,\n\t\t\tselectBlockOnInsert,\n\t\t\torderInitialBlockItems,\n\t\t} = this.props;\n\n\t\tif ( isQuick ) {\n\t\t\treturn (\n\t\t\t\t<QuickInserter\n\t\t\t\t\tonSelect={ ( blocks ) => {\n\t\t\t\t\t\tconst firstBlock =\n\t\t\t\t\t\t\tArray.isArray( blocks ) && blocks?.length\n\t\t\t\t\t\t\t\t? blocks[ 0 ]\n\t\t\t\t\t\t\t\t: blocks;\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tonSelectOrClose &&\n\t\t\t\t\t\t\ttypeof onSelectOrClose === 'function'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tonSelectOrClose( firstBlock );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\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\tprioritizePatterns={ prioritizePatterns }\n\t\t\t\t\tselectBlockOnInsert={ selectBlockOnInsert }\n\t\t\t\t\torderInitialBlockItems={ orderInitialBlockItems }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<InserterMenu\n\t\t\t\tonSelect={ () => {\n\t\t\t\t\tonClose();\n\t\t\t\t} }\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t\tclientId={ clientId }\n\t\t\t\tisAppender={ isAppender }\n\t\t\t\tshowInserterHelpPanel={ showInserterHelpPanel }\n\t\t\t\tprioritizePatterns={ prioritizePatterns }\n\t\t\t/>\n\t\t);\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tposition,\n\t\t\thasSingleBlockType,\n\t\t\tdirectInsertBlock,\n\t\t\tinsertOnlyAllowedBlock,\n\t\t\t__experimentalIsQuick: isQuick,\n\t\t\tonSelectOrClose,\n\t\t} = this.props;\n\n\t\tif ( hasSingleBlockType || directInsertBlock ) {\n\t\t\treturn this.renderToggle( { onToggle: insertOnlyAllowedBlock } );\n\t\t}\n\n\t\treturn (\n\t\t\t<Dropdown\n\t\t\t\tclassName=\"block-editor-inserter\"\n\t\t\t\tcontentClassName={ classnames(\n\t\t\t\t\t'block-editor-inserter__popover',\n\t\t\t\t\t{ 'is-quick': isQuick }\n\t\t\t\t) }\n\t\t\t\tpopoverProps={ { position, shift: true } }\n\t\t\t\tonToggle={ this.onToggle }\n\t\t\t\texpandOnMobile\n\t\t\t\theaderTitle={ __( 'Add a block' ) }\n\t\t\t\trenderToggle={ this.renderToggle }\n\t\t\t\trenderContent={ this.renderContent }\n\t\t\t\tonClose={ onSelectOrClose }\n\t\t\t/>\n\t\t);\n\t}\n}\n\nexport const ComposedPrivateInserter = compose( [\n\twithSelect(\n\t\t( select, { clientId, rootClientId, shouldDirectInsert = true } ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\thasInserterItems,\n\t\t\t\tgetAllowedBlocks,\n\t\t\t\t__experimentalGetDirectInsertBlock,\n\t\t\t\tgetSettings,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst { getBlockVariations } = select( blocksStore );\n\n\t\t\trootClientId =\n\t\t\t\trootClientId || getBlockRootClientId( clientId ) || undefined;\n\n\t\t\tconst allowedBlocks = getAllowedBlocks( rootClientId );\n\n\t\t\tconst directInsertBlock =\n\t\t\t\tshouldDirectInsert &&\n\t\t\t\t__experimentalGetDirectInsertBlock( rootClientId );\n\n\t\t\tconst settings = getSettings();\n\n\t\t\tconst hasSingleBlockType =\n\t\t\t\tallowedBlocks?.length === 1 &&\n\t\t\t\tgetBlockVariations( allowedBlocks[ 0 ].name, 'inserter' )\n\t\t\t\t\t?.length === 0;\n\n\t\t\tlet allowedBlockType = false;\n\t\t\tif ( hasSingleBlockType ) {\n\t\t\t\tallowedBlockType = allowedBlocks[ 0 ];\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\thasItems: hasInserterItems( rootClientId ),\n\t\t\t\thasSingleBlockType,\n\t\t\t\tblockTitle: allowedBlockType ? allowedBlockType.title : '',\n\t\t\t\tallowedBlockType,\n\t\t\t\tdirectInsertBlock,\n\t\t\t\trootClientId,\n\t\t\t\tprioritizePatterns:\n\t\t\t\t\tsettings.__experimentalPreferPatternsOnRoot &&\n\t\t\t\t\t! rootClientId,\n\t\t\t};\n\t\t}\n\t),\n\twithDispatch( ( dispatch, ownProps, { select } ) => {\n\t\treturn {\n\t\t\tinsertOnlyAllowedBlock() {\n\t\t\t\tconst {\n\t\t\t\t\trootClientId,\n\t\t\t\t\tclientId,\n\t\t\t\t\tisAppender,\n\t\t\t\t\thasSingleBlockType,\n\t\t\t\t\tallowedBlockType,\n\t\t\t\t\tdirectInsertBlock,\n\t\t\t\t\tonSelectOrClose,\n\t\t\t\t\tselectBlockOnInsert,\n\t\t\t\t} = ownProps;\n\n\t\t\t\tif ( ! hasSingleBlockType && ! directInsertBlock ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tfunction getAdjacentBlockAttributes( attributesToCopy ) {\n\t\t\t\t\tconst { getBlock, getPreviousBlockClientId } =\n\t\t\t\t\t\tselect( blockEditorStore );\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t! attributesToCopy ||\n\t\t\t\t\t\t( ! clientId && ! rootClientId )\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn {};\n\t\t\t\t\t}\n\n\t\t\t\t\tconst result = {};\n\t\t\t\t\tlet adjacentAttributes = {};\n\n\t\t\t\t\t// If there is no clientId, then attempt to get attributes\n\t\t\t\t\t// from the last block within innerBlocks of the root block.\n\t\t\t\t\tif ( ! clientId ) {\n\t\t\t\t\t\tconst parentBlock = getBlock( rootClientId );\n\n\t\t\t\t\t\tif ( parentBlock?.innerBlocks?.length ) {\n\t\t\t\t\t\t\tconst lastInnerBlock =\n\t\t\t\t\t\t\t\tparentBlock.innerBlocks[\n\t\t\t\t\t\t\t\t\tparentBlock.innerBlocks.length - 1\n\t\t\t\t\t\t\t\t];\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tdirectInsertBlock &&\n\t\t\t\t\t\t\t\tdirectInsertBlock?.name === lastInnerBlock.name\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tadjacentAttributes = lastInnerBlock.attributes;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Otherwise, attempt to get attributes from the\n\t\t\t\t\t\t// previous block relative to the current clientId.\n\t\t\t\t\t\tconst currentBlock = getBlock( clientId );\n\t\t\t\t\t\tconst previousBlock = getBlock(\n\t\t\t\t\t\t\tgetPreviousBlockClientId( clientId )\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif ( currentBlock?.name === previousBlock?.name ) {\n\t\t\t\t\t\t\tadjacentAttributes =\n\t\t\t\t\t\t\t\tpreviousBlock?.attributes || {};\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Copy over only those attributes flagged to be copied.\n\t\t\t\t\tattributesToCopy.forEach( ( attribute ) => {\n\t\t\t\t\t\tif ( adjacentAttributes.hasOwnProperty( attribute ) ) {\n\t\t\t\t\t\t\tresult[ attribute ] =\n\t\t\t\t\t\t\t\tadjacentAttributes[ attribute ];\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tfunction getInsertionIndex() {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tgetBlockIndex,\n\t\t\t\t\t\tgetBlockSelectionEnd,\n\t\t\t\t\t\tgetBlockOrder,\n\t\t\t\t\t\tgetBlockRootClientId,\n\t\t\t\t\t} = select( blockEditorStore );\n\n\t\t\t\t\t// If the clientId is defined, we insert at the position of the block.\n\t\t\t\t\tif ( clientId ) {\n\t\t\t\t\t\treturn getBlockIndex( clientId );\n\t\t\t\t\t}\n\n\t\t\t\t\t// If there a selected block, we insert after the selected block.\n\t\t\t\t\tconst end = getBlockSelectionEnd();\n\t\t\t\t\tif (\n\t\t\t\t\t\t! isAppender &&\n\t\t\t\t\t\tend &&\n\t\t\t\t\t\tgetBlockRootClientId( end ) === rootClientId\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn getBlockIndex( end ) + 1;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Otherwise, we insert at the end of the current rootClientId.\n\t\t\t\t\treturn getBlockOrder( rootClientId ).length;\n\t\t\t\t}\n\n\t\t\t\tconst { insertBlock } = dispatch( blockEditorStore );\n\n\t\t\t\tlet blockToInsert;\n\n\t\t\t\t// Attempt to augment the directInsertBlock with attributes from an adjacent block.\n\t\t\t\t// This ensures styling from nearby blocks is preserved in the newly inserted block.\n\t\t\t\t// See: https://github.com/WordPress/gutenberg/issues/37904\n\t\t\t\tif ( directInsertBlock ) {\n\t\t\t\t\tconst newAttributes = getAdjacentBlockAttributes(\n\t\t\t\t\t\tdirectInsertBlock.attributesToCopy\n\t\t\t\t\t);\n\n\t\t\t\t\tblockToInsert = createBlock( directInsertBlock.name, {\n\t\t\t\t\t\t...( directInsertBlock.attributes || {} ),\n\t\t\t\t\t\t...newAttributes,\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tblockToInsert = createBlock( allowedBlockType.name );\n\t\t\t\t}\n\n\t\t\t\tinsertBlock(\n\t\t\t\t\tblockToInsert,\n\t\t\t\t\tgetInsertionIndex(),\n\t\t\t\t\trootClientId,\n\t\t\t\t\tselectBlockOnInsert\n\t\t\t\t);\n\n\t\t\t\tif ( onSelectOrClose ) {\n\t\t\t\t\tonSelectOrClose( {\n\t\t\t\t\t\tclientId: blockToInsert?.clientId,\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\tconst message = sprintf(\n\t\t\t\t\t// translators: %s: the name of the block that has been added\n\t\t\t\t\t__( '%s block added' ),\n\t\t\t\t\tallowedBlockType.title\n\t\t\t\t);\n\t\t\t\tspeak( message );\n\t\t\t},\n\t\t};\n\t} ),\n\t// The global inserter should always be visible, we are using ( ! isAppender && ! rootClientId && ! clientId ) as\n\t// a way to detect the global Inserter.\n\tifCondition(\n\t\t( { hasItems, isAppender, rootClientId, clientId } ) =>\n\t\t\thasItems || ( ! isAppender && ! rootClientId && ! clientId )\n\t),\n] )( PrivateInserter );\n\nconst Inserter = forwardRef( ( props, ref ) => {\n\treturn (\n\t\t<ComposedPrivateInserter\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\torderInitialBlockItems={ undefined }\n\t\t/>\n\t);\n} );\n\nexport default Inserter;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/index.js"],"names":["defaultRenderToggle","onToggle","disabled","isOpen","blockTitle","hasSingleBlockType","toggleProps","prioritizePatterns","as","Wrapper","Button","label","labelProp","onClick","rest","handleClick","event","plus","PrivateInserter","Component","constructor","arguments","bind","renderToggle","renderContent","props","directInsertBlock","hasItems","onClose","rootClientId","clientId","isAppender","showInserterHelpPanel","__experimentalIsQuick","isQuick","onSelectOrClose","selectBlockOnInsert","blocks","firstBlock","Array","isArray","length","render","position","insertOnlyAllowedBlock","shift","ComposedPrivateInserter","select","shouldDirectInsert","getBlockRootClientId","hasInserterItems","getAllowedBlocks","__experimentalGetDirectInsertBlock","getSettings","blockEditorStore","getBlockVariations","blocksStore","undefined","allowedBlocks","settings","name","allowedBlockType","title","__experimentalPreferPatternsOnRoot","dispatch","ownProps","getAdjacentBlockAttributes","attributesToCopy","getBlock","getPreviousBlockClientId","result","adjacentAttributes","parentBlock","innerBlocks","lastInnerBlock","attributes","currentBlock","previousBlock","forEach","attribute","hasOwnProperty","getInsertionIndex","getBlockIndex","getBlockSelectionEnd","getBlockOrder","end","insertBlock","blockToInsert","newAttributes","message","Inserter","ref"],"mappings":";;;;;;;;;AAWA;;;;AARA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;AAKA,MAAMA,mBAAmB,GAAG,QAQrB;AAAA,MARuB;AAC7BC,IAAAA,QAD6B;AAE7BC,IAAAA,QAF6B;AAG7BC,IAAAA,MAH6B;AAI7BC,IAAAA,UAJ6B;AAK7BC,IAAAA,kBAL6B;AAM7BC,IAAAA,WAAW,GAAG,EANe;AAO7BC,IAAAA;AAP6B,GAQvB;AACN,QAAM;AACLC,IAAAA,EAAE,EAAEC,OAAO,GAAGC,kBADT;AAELC,IAAAA,KAAK,EAAEC,SAFF;AAGLC,IAAAA,OAHK;AAIL,OAAGC;AAJE,MAKFR,WALJ;AAOA,MAAIK,KAAK,GAAGC,SAAZ;;AACA,MAAK,CAAED,KAAF,IAAWN,kBAAhB,EAAqC;AACpCM,IAAAA,KAAK,GAAG,oBACP;AACA,kBAAI,QAAJ,EAAc,qCAAd,CAFO,EAGPP,UAHO,CAAR;AAKA,GAND,MAMO,IAAK,CAAEO,KAAF,IAAWJ,kBAAhB,EAAqC;AAC3CI,IAAAA,KAAK,GAAG,cAAI,aAAJ,CAAR;A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MAAMwE,QAAQ,GAAG,yBAAY,CAAEjE,KAAF,EAASkE,GAAT,KAAkB;AAC9C,SAAO,4BAAC,uBAAD;AAAyB,IAAA,GAAG,EAAGA;AAA/B,KAA0ClE,KAA1C,EAAP;AACA,CAFgB,CAAjB;eAIeiE,Q","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { forwardRef, Component } from '@wordpress/element';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose, ifCondition } from '@wordpress/compose';\nimport { createBlock, store as blocksStore } from '@wordpress/blocks';\nimport { plus } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport InserterMenu from './menu';\nimport QuickInserter from './quick-inserter';\nimport { store as blockEditorStore } from '../../store';\n\nconst defaultRenderToggle = ( {\n\tonToggle,\n\tdisabled,\n\tisOpen,\n\tblockTitle,\n\thasSingleBlockType,\n\ttoggleProps = {},\n\tprioritizePatterns,\n} ) => {\n\tconst {\n\t\tas: Wrapper = Button,\n\t\tlabel: labelProp,\n\t\tonClick,\n\t\t...rest\n\t} = toggleProps;\n\n\tlet label = labelProp;\n\tif ( ! label && hasSingleBlockType ) {\n\t\tlabel = sprintf(\n\t\t\t// translators: %s: the name of the block when there is only one\n\t\t\t_x( 'Add %s', 'directly add the only allowed block' ),\n\t\t\tblockTitle\n\t\t);\n\t} else if ( ! label && prioritizePatterns ) {\n\t\tlabel = __( 'Add pattern' );\n\t} else if ( ! label ) {\n\t\tlabel = _x( 'Add block', 'Generic label for block inserter button' );\n\t}\n\n\t// Handle both onClick functions from the toggle and the parent component.\n\tfunction handleClick( event ) {\n\t\tif ( onToggle ) {\n\t\t\tonToggle( event );\n\t\t}\n\t\tif ( onClick ) {\n\t\t\tonClick( event );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Wrapper\n\t\t\ticon={ plus }\n\t\t\tlabel={ label }\n\t\t\ttooltipPosition=\"bottom\"\n\t\t\tonClick={ handleClick }\n\t\t\tclassName=\"block-editor-inserter__toggle\"\n\t\t\taria-haspopup={ ! hasSingleBlockType ? 'true' : false }\n\t\t\taria-expanded={ ! hasSingleBlockType ? isOpen : false }\n\t\t\tdisabled={ disabled }\n\t\t\t{ ...rest }\n\t\t/>\n\t);\n};\n\nclass PrivateInserter extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.onToggle = this.onToggle.bind( this );\n\t\tthis.renderToggle = this.renderToggle.bind( this );\n\t\tthis.renderContent = this.renderContent.bind( this );\n\t}\n\n\tonToggle( isOpen ) {\n\t\tconst { onToggle } = this.props;\n\n\t\t// Surface toggle callback to parent component.\n\t\tif ( onToggle ) {\n\t\t\tonToggle( isOpen );\n\t\t}\n\t}\n\n\t/**\n\t * Render callback to display Dropdown toggle element.\n\t *\n\t * @param {Object} options\n\t * @param {Function} options.onToggle Callback to invoke when toggle is\n\t * pressed.\n\t * @param {boolean} options.isOpen Whether dropdown is currently open.\n\t *\n\t * @return {WPElement} Dropdown toggle element.\n\t */\n\trenderToggle( { onToggle, isOpen } ) {\n\t\tconst {\n\t\t\tdisabled,\n\t\t\tblockTitle,\n\t\t\thasSingleBlockType,\n\t\t\tdirectInsertBlock,\n\t\t\ttoggleProps,\n\t\t\thasItems,\n\t\t\trenderToggle = defaultRenderToggle,\n\t\t\tprioritizePatterns,\n\t\t} = this.props;\n\n\t\treturn renderToggle( {\n\t\t\tonToggle,\n\t\t\tisOpen,\n\t\t\tdisabled: disabled || ! hasItems,\n\t\t\tblockTitle,\n\t\t\thasSingleBlockType,\n\t\t\tdirectInsertBlock,\n\t\t\ttoggleProps,\n\t\t\tprioritizePatterns,\n\t\t} );\n\t}\n\n\t/**\n\t * Render callback to display Dropdown content element.\n\t *\n\t * @param {Object} options\n\t * @param {Function} options.onClose Callback to invoke when dropdown is\n\t * closed.\n\t *\n\t * @return {WPElement} Dropdown content element.\n\t */\n\trenderContent( { onClose } ) {\n\t\tconst {\n\t\t\trootClientId,\n\t\t\tclientId,\n\t\t\tisAppender,\n\t\t\tshowInserterHelpPanel,\n\n\t\t\t// This prop is experimental to give some time for the quick inserter to mature\n\t\t\t// Feel free to make them stable after a few releases.\n\t\t\t__experimentalIsQuick: isQuick,\n\t\t\tprioritizePatterns,\n\t\t\tonSelectOrClose,\n\t\t\tselectBlockOnInsert,\n\t\t} = this.props;\n\n\t\tif ( isQuick ) {\n\t\t\treturn (\n\t\t\t\t<QuickInserter\n\t\t\t\t\tonSelect={ ( blocks ) => {\n\t\t\t\t\t\tconst firstBlock =\n\t\t\t\t\t\t\tArray.isArray( blocks ) && blocks?.length\n\t\t\t\t\t\t\t\t? blocks[ 0 ]\n\t\t\t\t\t\t\t\t: blocks;\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tonSelectOrClose &&\n\t\t\t\t\t\t\ttypeof onSelectOrClose === 'function'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tonSelectOrClose( firstBlock );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\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\tprioritizePatterns={ prioritizePatterns }\n\t\t\t\t\tselectBlockOnInsert={ selectBlockOnInsert }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<InserterMenu\n\t\t\t\tonSelect={ () => {\n\t\t\t\t\tonClose();\n\t\t\t\t} }\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t\tclientId={ clientId }\n\t\t\t\tisAppender={ isAppender }\n\t\t\t\tshowInserterHelpPanel={ showInserterHelpPanel }\n\t\t\t\tprioritizePatterns={ prioritizePatterns }\n\t\t\t/>\n\t\t);\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tposition,\n\t\t\thasSingleBlockType,\n\t\t\tdirectInsertBlock,\n\t\t\tinsertOnlyAllowedBlock,\n\t\t\t__experimentalIsQuick: isQuick,\n\t\t\tonSelectOrClose,\n\t\t} = this.props;\n\n\t\tif ( hasSingleBlockType || directInsertBlock ) {\n\t\t\treturn this.renderToggle( { onToggle: insertOnlyAllowedBlock } );\n\t\t}\n\n\t\treturn (\n\t\t\t<Dropdown\n\t\t\t\tclassName=\"block-editor-inserter\"\n\t\t\t\tcontentClassName={ classnames(\n\t\t\t\t\t'block-editor-inserter__popover',\n\t\t\t\t\t{ 'is-quick': isQuick }\n\t\t\t\t) }\n\t\t\t\tpopoverProps={ { position, shift: true } }\n\t\t\t\tonToggle={ this.onToggle }\n\t\t\t\texpandOnMobile\n\t\t\t\theaderTitle={ __( 'Add a block' ) }\n\t\t\t\trenderToggle={ this.renderToggle }\n\t\t\t\trenderContent={ this.renderContent }\n\t\t\t\tonClose={ onSelectOrClose }\n\t\t\t/>\n\t\t);\n\t}\n}\n\nexport const ComposedPrivateInserter = compose( [\n\twithSelect(\n\t\t( select, { clientId, rootClientId, shouldDirectInsert = true } ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\thasInserterItems,\n\t\t\t\tgetAllowedBlocks,\n\t\t\t\t__experimentalGetDirectInsertBlock,\n\t\t\t\tgetSettings,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst { getBlockVariations } = select( blocksStore );\n\n\t\t\trootClientId =\n\t\t\t\trootClientId || getBlockRootClientId( clientId ) || undefined;\n\n\t\t\tconst allowedBlocks = getAllowedBlocks( rootClientId );\n\n\t\t\tconst directInsertBlock =\n\t\t\t\tshouldDirectInsert &&\n\t\t\t\t__experimentalGetDirectInsertBlock( rootClientId );\n\n\t\t\tconst settings = getSettings();\n\n\t\t\tconst hasSingleBlockType =\n\t\t\t\tallowedBlocks?.length === 1 &&\n\t\t\t\tgetBlockVariations( allowedBlocks[ 0 ].name, 'inserter' )\n\t\t\t\t\t?.length === 0;\n\n\t\t\tlet allowedBlockType = false;\n\t\t\tif ( hasSingleBlockType ) {\n\t\t\t\tallowedBlockType = allowedBlocks[ 0 ];\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\thasItems: hasInserterItems( rootClientId ),\n\t\t\t\thasSingleBlockType,\n\t\t\t\tblockTitle: allowedBlockType ? allowedBlockType.title : '',\n\t\t\t\tallowedBlockType,\n\t\t\t\tdirectInsertBlock,\n\t\t\t\trootClientId,\n\t\t\t\tprioritizePatterns:\n\t\t\t\t\tsettings.__experimentalPreferPatternsOnRoot &&\n\t\t\t\t\t! rootClientId,\n\t\t\t};\n\t\t}\n\t),\n\twithDispatch( ( dispatch, ownProps, { select } ) => {\n\t\treturn {\n\t\t\tinsertOnlyAllowedBlock() {\n\t\t\t\tconst {\n\t\t\t\t\trootClientId,\n\t\t\t\t\tclientId,\n\t\t\t\t\tisAppender,\n\t\t\t\t\thasSingleBlockType,\n\t\t\t\t\tallowedBlockType,\n\t\t\t\t\tdirectInsertBlock,\n\t\t\t\t\tonSelectOrClose,\n\t\t\t\t\tselectBlockOnInsert,\n\t\t\t\t} = ownProps;\n\n\t\t\t\tif ( ! hasSingleBlockType && ! directInsertBlock ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tfunction getAdjacentBlockAttributes( attributesToCopy ) {\n\t\t\t\t\tconst { getBlock, getPreviousBlockClientId } =\n\t\t\t\t\t\tselect( blockEditorStore );\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t! attributesToCopy ||\n\t\t\t\t\t\t( ! clientId && ! rootClientId )\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn {};\n\t\t\t\t\t}\n\n\t\t\t\t\tconst result = {};\n\t\t\t\t\tlet adjacentAttributes = {};\n\n\t\t\t\t\t// If there is no clientId, then attempt to get attributes\n\t\t\t\t\t// from the last block within innerBlocks of the root block.\n\t\t\t\t\tif ( ! clientId ) {\n\t\t\t\t\t\tconst parentBlock = getBlock( rootClientId );\n\n\t\t\t\t\t\tif ( parentBlock?.innerBlocks?.length ) {\n\t\t\t\t\t\t\tconst lastInnerBlock =\n\t\t\t\t\t\t\t\tparentBlock.innerBlocks[\n\t\t\t\t\t\t\t\t\tparentBlock.innerBlocks.length - 1\n\t\t\t\t\t\t\t\t];\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tdirectInsertBlock &&\n\t\t\t\t\t\t\t\tdirectInsertBlock?.name === lastInnerBlock.name\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tadjacentAttributes = lastInnerBlock.attributes;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Otherwise, attempt to get attributes from the\n\t\t\t\t\t\t// previous block relative to the current clientId.\n\t\t\t\t\t\tconst currentBlock = getBlock( clientId );\n\t\t\t\t\t\tconst previousBlock = getBlock(\n\t\t\t\t\t\t\tgetPreviousBlockClientId( clientId )\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif ( currentBlock?.name === previousBlock?.name ) {\n\t\t\t\t\t\t\tadjacentAttributes =\n\t\t\t\t\t\t\t\tpreviousBlock?.attributes || {};\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Copy over only those attributes flagged to be copied.\n\t\t\t\t\tattributesToCopy.forEach( ( attribute ) => {\n\t\t\t\t\t\tif ( adjacentAttributes.hasOwnProperty( attribute ) ) {\n\t\t\t\t\t\t\tresult[ attribute ] =\n\t\t\t\t\t\t\t\tadjacentAttributes[ attribute ];\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tfunction getInsertionIndex() {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tgetBlockIndex,\n\t\t\t\t\t\tgetBlockSelectionEnd,\n\t\t\t\t\t\tgetBlockOrder,\n\t\t\t\t\t\tgetBlockRootClientId,\n\t\t\t\t\t} = select( blockEditorStore );\n\n\t\t\t\t\t// If the clientId is defined, we insert at the position of the block.\n\t\t\t\t\tif ( clientId ) {\n\t\t\t\t\t\treturn getBlockIndex( clientId );\n\t\t\t\t\t}\n\n\t\t\t\t\t// If there a selected block, we insert after the selected block.\n\t\t\t\t\tconst end = getBlockSelectionEnd();\n\t\t\t\t\tif (\n\t\t\t\t\t\t! isAppender &&\n\t\t\t\t\t\tend &&\n\t\t\t\t\t\tgetBlockRootClientId( end ) === rootClientId\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn getBlockIndex( end ) + 1;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Otherwise, we insert at the end of the current rootClientId.\n\t\t\t\t\treturn getBlockOrder( rootClientId ).length;\n\t\t\t\t}\n\n\t\t\t\tconst { insertBlock } = dispatch( blockEditorStore );\n\n\t\t\t\tlet blockToInsert;\n\n\t\t\t\t// Attempt to augment the directInsertBlock with attributes from an adjacent block.\n\t\t\t\t// This ensures styling from nearby blocks is preserved in the newly inserted block.\n\t\t\t\t// See: https://github.com/WordPress/gutenberg/issues/37904\n\t\t\t\tif ( directInsertBlock ) {\n\t\t\t\t\tconst newAttributes = getAdjacentBlockAttributes(\n\t\t\t\t\t\tdirectInsertBlock.attributesToCopy\n\t\t\t\t\t);\n\n\t\t\t\t\tblockToInsert = createBlock( directInsertBlock.name, {\n\t\t\t\t\t\t...( directInsertBlock.attributes || {} ),\n\t\t\t\t\t\t...newAttributes,\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tblockToInsert = createBlock( allowedBlockType.name );\n\t\t\t\t}\n\n\t\t\t\tinsertBlock(\n\t\t\t\t\tblockToInsert,\n\t\t\t\t\tgetInsertionIndex(),\n\t\t\t\t\trootClientId,\n\t\t\t\t\tselectBlockOnInsert\n\t\t\t\t);\n\n\t\t\t\tif ( onSelectOrClose ) {\n\t\t\t\t\tonSelectOrClose( {\n\t\t\t\t\t\tclientId: blockToInsert?.clientId,\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\tconst message = sprintf(\n\t\t\t\t\t// translators: %s: the name of the block that has been added\n\t\t\t\t\t__( '%s block added' ),\n\t\t\t\t\tallowedBlockType.title\n\t\t\t\t);\n\t\t\t\tspeak( message );\n\t\t\t},\n\t\t};\n\t} ),\n\t// The global inserter should always be visible, we are using ( ! isAppender && ! rootClientId && ! clientId ) as\n\t// a way to detect the global Inserter.\n\tifCondition(\n\t\t( { hasItems, isAppender, rootClientId, clientId } ) =>\n\t\t\thasItems || ( ! isAppender && ! rootClientId && ! clientId )\n\t),\n] )( PrivateInserter );\n\nconst Inserter = forwardRef( ( props, ref ) => {\n\treturn <ComposedPrivateInserter ref={ ref } { ...props } />;\n} );\n\nexport default Inserter;\n"]}
@@ -50,8 +50,7 @@ function QuickInserter(_ref) {
50
50
  clientId,
51
51
  isAppender,
52
52
  prioritizePatterns,
53
- selectBlockOnInsert,
54
- orderInitialBlockItems
53
+ selectBlockOnInsert
55
54
  } = _ref;
56
55
  const [filterValue, setFilterValue] = (0, _element.useState)('');
57
56
  const [destinationRootClientId, onInsertBlocks] = (0, _useInsertionPoint.default)({
@@ -129,8 +128,7 @@ function QuickInserter(_ref) {
129
128
  maxBlockTypes: SHOWN_BLOCK_TYPES,
130
129
  isDraggable: false,
131
130
  prioritizePatterns: prioritizePatterns,
132
- selectBlockOnInsert: selectBlockOnInsert,
133
- orderInitialBlockItems: orderInitialBlockItems
131
+ selectBlockOnInsert: selectBlockOnInsert
134
132
  })), setInserterIsOpened && (0, _element.createElement)(_components.Button, {
135
133
  className: "block-editor-inserter__quick-inserter-expand",
136
134
  onClick: onBrowseAll,
@@ -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","selectBlockOnInsert","orderInitialBlockItems","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,OAQX;AAAA,MARmC;AACtCC,IAAAA,QADsC;AAEtCC,IAAAA,YAFsC;AAGtCC,IAAAA,QAHsC;AAItCC,IAAAA,UAJsC;AAKtCC,IAAAA,kBALsC;AAMtCC,IAAAA,mBANsC;AAOtCC,IAAAA;AAPsC,GAQnC;AACH,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkC,uBAAU,EAAV,CAAxC;AACA,QAAM,CAAEC,uBAAF,EAA2BC,cAA3B,IAA8C,gCAAmB;AACtEV,IAAAA,QADsE;AAEtEC,IAAAA,YAFsE;AAGtEC,IAAAA,QAHsE;AAItEC,IAAAA,UAJsE;AAKtEE,IAAAA;AALsE,GAAnB,CAApD;AAOA,QAAM,CAAEM,UAAF,IAAiB,iCACtBF,uBADsB,EAEtBC,cAFsB,CAAvB;AAKA,QAAM,CAAEE,QAAF,IAAe,+BACpBF,cADoB,EAEpBD,uBAFoB,CAArB;AAKA,QAAM;AAAEI,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,MAA0C,qBAC7CC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,WAAF;AAAeC,MAAAA,aAAf;AAA8BC,MAAAA;AAA9B,QACLH,MAAM,CAAEI,YAAF,CADP;AAEA,UAAMC,QA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EAAKsB,KAAF,IAAa;AACvBrB,MAAAA,cAAc,CAAEqB,KAAF,CAAd;AACA,KANF;AAOC,IAAA,KAAK,EAAG,cAAI,gCAAJ,CAPT;AAQC,IAAA,WAAW,EAAG,cAAI,QAAJ;AARf,IAPF,EAmBC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,sBAAD;AACC,IAAA,WAAW,EAAGtB,WADf;AAEC,IAAA,QAAQ,EAAGP,QAFZ;AAGC,IAAA,YAAY,EAAGC,YAHhB;AAIC,IAAA,QAAQ,EAAGC,QAJZ;AAKC,IAAA,UAAU,EAAGC,UALd;AAMC,IAAA,gBAAgB,EAAGyB,gBANpB;AAOC,IAAA,aAAa,EAAGhC,iBAPjB;AAQC,IAAA,WAAW,EAAG,KARf;AASC,IAAA,kBAAkB,EAAGQ,kBATtB;AAUC,IAAA,mBAAmB,EAAGC,mBAVvB;AAWC,IAAA,sBAAsB,EAAGC;AAX1B,IADD,CAnBD,EAmCGO,mBAAmB,IACpB,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,8CADX;AAEC,IAAA,OAAO,EAAGc,WAFX;AAGC,kBAAa,cACZ,2EADY;AAHd,KAOG,cAAI,YAAJ,CAPH,CApCF,CADD;AAiDA","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\tselectBlockOnInsert,\n\torderInitialBlockItems,\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\tselectBlockOnInsert,\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\t__nextHasNoMarginBottom\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\tselectBlockOnInsert={ selectBlockOnInsert }\n\t\t\t\t\torderInitialBlockItems={ orderInitialBlockItems }\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","selectBlockOnInsert","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,OAOX;AAAA,MAPmC;AACtCC,IAAAA,QADsC;AAEtCC,IAAAA,YAFsC;AAGtCC,IAAAA,QAHsC;AAItCC,IAAAA,UAJsC;AAKtCC,IAAAA,kBALsC;AAMtCC,IAAAA;AANsC,GAOnC;AACH,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkC,uBAAU,EAAV,CAAxC;AACA,QAAM,CAAEC,uBAAF,EAA2BC,cAA3B,IAA8C,gCAAmB;AACtET,IAAAA,QADsE;AAEtEC,IAAAA,YAFsE;AAGtEC,IAAAA,QAHsE;AAItEC,IAAAA,UAJsE;AAKtEE,IAAAA;AALsE,GAAnB,CAApD;AAOA,QAAM,CAAEK,UAAF,IAAiB,iCACtBF,uBADsB,EAEtBC,cAFsB,CAAvB;AAKA,QAAM,CAAEE,QAAF,IAAe,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C,IAAA,SAAS,EAAG,yBAAY,uCAAZ,EAAqD;AAChE,oBAAc4B,UADkD;AAEhE,oBAAcb;AAFkD,KAArD;AADb,KAMGa,UAAU,IACX,4BAAC,yBAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,SAAS,EAAC,+BAFX;AAGC,IAAA,KAAK,EAAGnB,WAHT;AAIC,IAAA,QAAQ,EAAKsB,KAAF,IAAa;AACvBrB,MAAAA,cAAc,CAAEqB,KAAF,CAAd;AACA,KANF;AAOC,IAAA,KAAK,EAAG,cAAI,gCAAJ,CAPT;AAQC,IAAA,WAAW,EAAG,cAAI,QAAJ;AARf,IAPF,EAmBC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,sBAAD;AACC,IAAA,WAAW,EAAGtB,WADf;AAEC,IAAA,QAAQ,EAAGN,QAFZ;AAGC,IAAA,YAAY,EAAGC,YAHhB;AAIC,IAAA,QAAQ,EAAGC,QAJZ;AAKC,IAAA,UAAU,EAAGC,UALd;AAMC,IAAA,gBAAgB,EAAGwB,gBANpB;AAOC,IAAA,aAAa,EAAG/B,iBAPjB;AAQC,IAAA,WAAW,EAAG,KARf;AASC,IAAA,kBAAkB,EAAGQ,kBATtB;AAUC,IAAA,mBAAmB,EAAGC;AAVvB,IADD,CAnBD,EAkCGO,mBAAmB,IACpB,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,8CADX;AAEC,IAAA,OAAO,EAAGc,WAFX;AAGC,kBAAa,cACZ,2EADY;AAHd,KAOG,cAAI,YAAJ,CAPH,CAnCF,CADD;AAgDA","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\tselectBlockOnInsert,\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\tselectBlockOnInsert,\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\t__nextHasNoMarginBottom\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\tselectBlockOnInsert={ selectBlockOnInsert }\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"]}
@@ -17,6 +17,8 @@ var _compose = require("@wordpress/compose");
17
17
 
18
18
  var _a11y = require("@wordpress/a11y");
19
19
 
20
+ var _data = require("@wordpress/data");
21
+
20
22
  var _blockTypesList = _interopRequireDefault(require("../block-types-list"));
21
23
 
22
24
  var _blockPatternsList = _interopRequireDefault(require("../block-patterns-list"));
@@ -39,6 +41,10 @@ var _inserterListbox = _interopRequireDefault(require("../inserter-listbox"));
39
41
 
40
42
  var _sorting = require("../../utils/sorting");
41
43
 
44
+ var _orderInserterBlockItems = require("../../utils/order-inserter-block-items");
45
+
46
+ var _store = require("../../store");
47
+
42
48
  /**
43
49
  * WordPress dependencies
44
50
  */
@@ -71,10 +77,17 @@ function InserterSearchResults(_ref) {
71
77
  isDraggable = true,
72
78
  shouldFocusBlock = true,
73
79
  prioritizePatterns,
74
- selectBlockOnInsert,
75
- orderInitialBlockItems
80
+ selectBlockOnInsert
76
81
  } = _ref;
77
82
  const debouncedSpeak = (0, _compose.useDebounce)(_a11y.speak, 500);
83
+ const {
84
+ prioritizedBlocks
85
+ } = (0, _data.useSelect)(select => {
86
+ const blockListSettings = select(_store.store).getBlockListSettings(rootClientId);
87
+ return {
88
+ prioritizedBlocks: (blockListSettings === null || blockListSettings === void 0 ? void 0 : blockListSettings.prioritizedInserterBlocks) || EMPTY_ARRAY
89
+ };
90
+ }, [rootClientId]);
78
91
  const [destinationRootClientId, onInsertBlocks] = (0, _useInsertionPoint.default)({
79
92
  onSelect,
80
93
  rootClientId,
@@ -107,13 +120,13 @@ function InserterSearchResults(_ref) {
107
120
 
108
121
  let orderedItems = (0, _sorting.orderBy)(blockTypes, 'frecency', 'desc');
109
122
 
110
- if (!filterValue && orderInitialBlockItems) {
111
- orderedItems = orderInitialBlockItems(orderedItems);
123
+ if (!filterValue && prioritizedBlocks.length) {
124
+ orderedItems = (0, _orderInserterBlockItems.orderInserterBlockItems)(orderedItems, prioritizedBlocks);
112
125
  }
113
126
 
114
127
  const results = (0, _searchItems.searchBlockItems)(orderedItems, blockTypeCategories, blockTypeCollections, filterValue);
115
128
  return maxBlockTypesToShow !== undefined ? results.slice(0, maxBlockTypesToShow) : results;
116
- }, [filterValue, blockTypes, blockTypeCategories, blockTypeCollections, maxBlockTypes, orderInitialBlockItems]); // Announce search results on change.
129
+ }, [filterValue, blockTypes, blockTypeCategories, blockTypeCollections, maxBlockTypesToShow, prioritizedBlocks]); // Announce search results on change.
117
130
 
118
131
  (0, _element.useEffect)(() => {
119
132
  if (!filterValue) {
@@ -125,7 +138,7 @@ function InserterSearchResults(_ref) {
125
138
  /* translators: %d: number of results. */
126
139
  (0, _i18n._n)('%d result found.', '%d results found.', count), count);
127
140
  debouncedSpeak(resultsFoundMessage);
128
- }, [filterValue, debouncedSpeak]);
141
+ }, [filterValue, debouncedSpeak, filteredBlockTypes, filteredBlockPatterns]);
129
142
  const currentShownBlockTypes = (0, _compose.useAsyncList)(filteredBlockTypes, {
130
143
  step: INITIAL_INSERTER_RESULTS
131
144
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/search-results.js"],"names":["INITIAL_INSERTER_RESULTS","EMPTY_ARRAY","InserterSearchResults","filterValue","onSelect","onHover","rootClientId","clientId","isAppender","__experimentalInsertionIndex","maxBlockPatterns","maxBlockTypes","showBlockDirectory","isDraggable","shouldFocusBlock","prioritizePatterns","selectBlockOnInsert","orderInitialBlockItems","debouncedSpeak","speak","destinationRootClientId","onInsertBlocks","insertionIndex","blockTypes","blockTypeCategories","blockTypeCollections","onSelectBlockType","patterns","onSelectBlockPattern","filteredBlockPatterns","results","undefined","slice","maxBlockTypesToShow","length","filteredBlockTypes","orderedItems","count","resultsFoundMessage","currentShownBlockTypes","step","currentShownPatterns","hasItems","blocksUI","patternsUI","fills"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAOA;AACA;AACA;AAaA,MAAMA,wBAAwB,GAAG,CAAjC;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,WAAW,GAAG,EAApB;;AAEA,SAASC,qBAAT,OAgBI;AAAA,MAhB4B;AAC/BC,IAAAA,WAD+B;AAE/BC,IAAAA,QAF+B;AAG/BC,IAAAA,OAH+B;AAI/BC,IAAAA,YAJ+B;AAK/BC,IAAAA,QAL+B;AAM/BC,IAAAA,UAN+B;AAO/BC,IAAAA,4BAP+B;AAQ/BC,IAAAA,gBAR+B;AAS/BC,IAAAA,aAT+B;AAU/BC,IAAAA,kBAAkB,GAAG,KAVU;AAW/BC,IAAAA,WAAW,GAAG,IAXiB;AAY/BC,IAAAA,gBAAgB,GAAG,IAZY;AAa/BC,IAAAA,kBAb+B;AAc/BC,IAAAA,mBAd+B;AAe/BC,IAAAA;AAf+B,GAgB5B;AACH,QAAMC,cAAc,GAAG,0BAAaC,WAAb,EAAoB,GAApB,CAAvB;AAEA,QAAM,CAAEC,uBAAF,EAA2BC,cAA3B,IAA8C,gCAAmB;AACtEjB,IAAAA,QADsE;AAEtEE,IAAAA,YAFsE;AAGtEC,IAAAA,QAHsE;AAItEC,IAAAA,UAJsE;AAKtEc,IAAAA,cAAc,EAAEb,4BALsD;AAMtEK,IAAAA,gBANsE;AAOtEE,IAAAA;AAPsE,GAAnB,CAApD;AASA,QAAM,CACLO,UADK,EAELC,mBAFK,EAGLC,oBAHK,EAILC,iBAJK,IAKF,iCAAoBN,uBAApB,EAA6CC,cAA7C,CALJ;AAMA,QAAM,CAAEM,QAAF,GAAcC,oBAAd,IAAuC,+BAC5CP,cAD4C,EAE5CD,uBAF4C,CA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AA,cAAc,EAAGD,oBAHlB;AAIC,IAAA,OAAO,EAAGvB,OAJX;AAKC,IAAA,WAAW,EAAGQ;AALf,IADD,CALD,CADD;AAkBA,SACC,4BAAC,wBAAD,QACG,CAAED,kBAAF,IAAwB,CAAE8B,QAA1B,IAAsC,4BAAC,kBAAD,OADzC,EAGG3B,kBAAkB,GAAG6B,UAAH,GAAgBD,QAHrC,EAKG,CAAC,CAAER,kBAAkB,CAACD,MAAtB,IACD,CAAC,CAAEL,qBAAqB,CAACK,MADxB,IAEA;AAAK,IAAA,SAAS,EAAC;AAAf,IAPH,EAUGnB,kBAAkB,GAAG4B,QAAH,GAAcC,UAVnC,EAYGhC,kBAAkB,IACnB,4BAAC,8BAAD,CAAiC,IAAjC;AACC,IAAA,SAAS,EAAG;AACXR,MAAAA,QAAQ,EAAEsB,iBADC;AAEXrB,MAAAA,OAFW;AAGXF,MAAAA,WAHW;AAIXuC,MAAAA,QAJW;AAKXpC,MAAAA,YAAY,EAAEc;AALH;AADb,KASKyB,KAAF,IAAa;AACd,QAAKA,KAAK,CAACX,MAAX,EAAoB;AACnB,aAAOW,KAAP;AACA;;AACD,QAAK,CAAEH,QAAP,EAAkB;AACjB,aAAO,4BAAC,kBAAD,OAAP;AACA;;AACD,WAAO,IAAP;AACA,GAjBF,CAbF,CADD;AAoCA;;eAEcxC,qB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useEffect } from '@wordpress/element';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { VisuallyHidden } from '@wordpress/components';\nimport { useDebounce, useAsyncList } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesList from '../block-types-list';\nimport BlockPatternsList from '../block-patterns-list';\nimport __unstableInserterMenuExtension from '../inserter-menu-extension';\nimport InserterPanel from './panel';\nimport InserterNoResults from './no-results';\nimport useInsertionPoint from './hooks/use-insertion-point';\nimport usePatternsState from './hooks/use-patterns-state';\nimport useBlockTypesState from './hooks/use-block-types-state';\nimport { searchBlockItems, searchItems } from './search-items';\nimport InserterListbox from '../inserter-listbox';\nimport { orderBy } from '../../utils/sorting';\n\nconst INITIAL_INSERTER_RESULTS = 9;\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation and rerendering the component.\n *\n * @type {Array}\n */\nconst EMPTY_ARRAY = [];\n\nfunction InserterSearchResults( {\n\tfilterValue,\n\tonSelect,\n\tonHover,\n\trootClientId,\n\tclientId,\n\tisAppender,\n\t__experimentalInsertionIndex,\n\tmaxBlockPatterns,\n\tmaxBlockTypes,\n\tshowBlockDirectory = false,\n\tisDraggable = true,\n\tshouldFocusBlock = true,\n\tprioritizePatterns,\n\tselectBlockOnInsert,\n\torderInitialBlockItems,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\n\tconst [ destinationRootClientId, onInsertBlocks ] = useInsertionPoint( {\n\t\tonSelect,\n\t\trootClientId,\n\t\tclientId,\n\t\tisAppender,\n\t\tinsertionIndex: __experimentalInsertionIndex,\n\t\tshouldFocusBlock,\n\t\tselectBlockOnInsert,\n\t} );\n\tconst [\n\t\tblockTypes,\n\t\tblockTypeCategories,\n\t\tblockTypeCollections,\n\t\tonSelectBlockType,\n\t] = useBlockTypesState( destinationRootClientId, onInsertBlocks );\n\tconst [ patterns, , onSelectBlockPattern ] = usePatternsState(\n\t\tonInsertBlocks,\n\t\tdestinationRootClientId\n\t);\n\n\tconst filteredBlockPatterns = useMemo( () => {\n\t\tif ( maxBlockPatterns === 0 ) {\n\t\t\treturn [];\n\t\t}\n\t\tconst results = searchItems( patterns, filterValue );\n\t\treturn maxBlockPatterns !== undefined\n\t\t\t? results.slice( 0, maxBlockPatterns )\n\t\t\t: results;\n\t}, [ filterValue, patterns, maxBlockPatterns ] );\n\n\tlet maxBlockTypesToShow = maxBlockTypes;\n\tif ( prioritizePatterns && filteredBlockPatterns.length > 2 ) {\n\t\tmaxBlockTypesToShow = 0;\n\t}\n\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( maxBlockTypesToShow === 0 ) {\n\t\t\treturn [];\n\t\t}\n\t\tlet orderedItems = orderBy( blockTypes, 'frecency', 'desc' );\n\t\tif ( ! filterValue && orderInitialBlockItems ) {\n\t\t\torderedItems = orderInitialBlockItems( orderedItems );\n\t\t}\n\t\tconst results = searchBlockItems(\n\t\t\torderedItems,\n\t\t\tblockTypeCategories,\n\t\t\tblockTypeCollections,\n\t\t\tfilterValue\n\t\t);\n\n\t\treturn maxBlockTypesToShow !== undefined\n\t\t\t? results.slice( 0, maxBlockTypesToShow )\n\t\t\t: results;\n\t}, [\n\t\tfilterValue,\n\t\tblockTypes,\n\t\tblockTypeCategories,\n\t\tblockTypeCollections,\n\t\tmaxBlockTypes,\n\t\torderInitialBlockItems,\n\t] );\n\n\t// Announce search results on change.\n\tuseEffect( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = filteredBlockTypes.length + filteredBlockPatterns.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ filterValue, debouncedSpeak ] );\n\n\tconst currentShownBlockTypes = useAsyncList( filteredBlockTypes, {\n\t\tstep: INITIAL_INSERTER_RESULTS,\n\t} );\n\tconst currentShownPatterns = useAsyncList(\n\t\tcurrentShownBlockTypes.length === filteredBlockTypes.length\n\t\t\t? filteredBlockPatterns\n\t\t\t: EMPTY_ARRAY\n\t);\n\n\tconst hasItems =\n\t\tfilteredBlockTypes.length > 0 || filteredBlockPatterns.length > 0;\n\n\tconst blocksUI = !! filteredBlockTypes.length && (\n\t\t<InserterPanel\n\t\t\ttitle={ <VisuallyHidden>{ __( 'Blocks' ) }</VisuallyHidden> }\n\t\t>\n\t\t\t<BlockTypesList\n\t\t\t\titems={ currentShownBlockTypes }\n\t\t\t\tonSelect={ onSelectBlockType }\n\t\t\t\tonHover={ onHover }\n\t\t\t\tlabel={ __( 'Blocks' ) }\n\t\t\t\tisDraggable={ isDraggable }\n\t\t\t/>\n\t\t</InserterPanel>\n\t);\n\n\tconst patternsUI = !! filteredBlockPatterns.length && (\n\t\t<InserterPanel\n\t\t\ttitle={\n\t\t\t\t<VisuallyHidden>{ __( 'Block Patterns' ) }</VisuallyHidden>\n\t\t\t}\n\t\t>\n\t\t\t<div className=\"block-editor-inserter__quick-inserter-patterns\">\n\t\t\t\t<BlockPatternsList\n\t\t\t\t\tshownPatterns={ currentShownPatterns }\n\t\t\t\t\tblockPatterns={ filteredBlockPatterns }\n\t\t\t\t\tonClickPattern={ onSelectBlockPattern }\n\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\tisDraggable={ isDraggable }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</InserterPanel>\n\t);\n\n\treturn (\n\t\t<InserterListbox>\n\t\t\t{ ! showBlockDirectory && ! hasItems && <InserterNoResults /> }\n\n\t\t\t{ prioritizePatterns ? patternsUI : blocksUI }\n\n\t\t\t{ !! filteredBlockTypes.length &&\n\t\t\t\t!! filteredBlockPatterns.length && (\n\t\t\t\t\t<div className=\"block-editor-inserter__quick-inserter-separator\" />\n\t\t\t\t) }\n\n\t\t\t{ prioritizePatterns ? blocksUI : patternsUI }\n\n\t\t\t{ showBlockDirectory && (\n\t\t\t\t<__unstableInserterMenuExtension.Slot\n\t\t\t\t\tfillProps={ {\n\t\t\t\t\t\tonSelect: onSelectBlockType,\n\t\t\t\t\t\tonHover,\n\t\t\t\t\t\tfilterValue,\n\t\t\t\t\t\thasItems,\n\t\t\t\t\t\trootClientId: destinationRootClientId,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ ( fills ) => {\n\t\t\t\t\t\tif ( fills.length ) {\n\t\t\t\t\t\t\treturn fills;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( ! hasItems ) {\n\t\t\t\t\t\t\treturn <InserterNoResults />;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t} }\n\t\t\t\t</__unstableInserterMenuExtension.Slot>\n\t\t\t) }\n\t\t</InserterListbox>\n\t);\n}\n\nexport default InserterSearchResults;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/search-results.js"],"names":["INITIAL_INSERTER_RESULTS","EMPTY_ARRAY","InserterSearchResults","filterValue","onSelect","onHover","rootClientId","clientId","isAppender","__experimentalInsertionIndex","maxBlockPatterns","maxBlockTypes","showBlockDirectory","isDraggable","shouldFocusBlock","prioritizePatterns","selectBlockOnInsert","debouncedSpeak","speak","prioritizedBlocks","select","blockListSettings","blockEditorStore","getBlockListSettings","prioritizedInserterBlocks","destinationRootClientId","onInsertBlocks","insertionIndex","blockTypes","blockTypeCategories","blockTypeCollections","onSelectBlockType","patterns","onSelectBlockPattern","filteredBlockPatterns","results","undefined","slice","maxBlockTypesToShow","length","filteredBlockTypes","orderedItems","count","resultsFoundMessage","currentShownBlockTypes","step","currentShownPatterns","hasItems","blocksUI","patternsUI","fills"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAQA;AACA;AACA;AAeA,MAAMA,wBAAwB,GAAG,CAAjC;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,WAAW,GAAG,EAApB;;AAEA,SAASC,qBAAT,OAeI;AAAA,MAf4B;AAC/BC,IAAAA,WAD+B;AAE/BC,IAAAA,QAF+B;AAG/BC,IAAAA,OAH+B;AAI/BC,IAAAA,YAJ+B;AAK/BC,IAAAA,QAL+B;AAM/BC,IAAAA,UAN+B;AAO/BC,IAAAA,4BAP+B;AAQ/BC,IAAAA,gBAR+B;AAS/BC,IAAAA,aAT+B;AAU/BC,IAAAA,kBAAkB,G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,kBAAkB,GAAGkC,UAAH,GAAgBD,QAHrC,EAKG,CAAC,CAAER,kBAAkB,CAACD,MAAtB,IACD,CAAC,CAAEL,qBAAqB,CAACK,MADxB,IAEA;AAAK,IAAA,SAAS,EAAC;AAAf,IAPH,EAUGxB,kBAAkB,GAAGiC,QAAH,GAAcC,UAVnC,EAYGrC,kBAAkB,IACnB,4BAAC,8BAAD,CAAiC,IAAjC;AACC,IAAA,SAAS,EAAG;AACXR,MAAAA,QAAQ,EAAE2B,iBADC;AAEX1B,MAAAA,OAFW;AAGXF,MAAAA,WAHW;AAIX4C,MAAAA,QAJW;AAKXzC,MAAAA,YAAY,EAAEmB;AALH;AADb,KASKyB,KAAF,IAAa;AACd,QAAKA,KAAK,CAACX,MAAX,EAAoB;AACnB,aAAOW,KAAP;AACA;;AACD,QAAK,CAAEH,QAAP,EAAkB;AACjB,aAAO,4BAAC,kBAAD,OAAP;AACA;;AACD,WAAO,IAAP;AACA,GAjBF,CAbF,CADD;AAoCA;;eAEc7C,qB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useEffect } from '@wordpress/element';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { VisuallyHidden } from '@wordpress/components';\nimport { useDebounce, useAsyncList } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesList from '../block-types-list';\nimport BlockPatternsList from '../block-patterns-list';\nimport __unstableInserterMenuExtension from '../inserter-menu-extension';\nimport InserterPanel from './panel';\nimport InserterNoResults from './no-results';\nimport useInsertionPoint from './hooks/use-insertion-point';\nimport usePatternsState from './hooks/use-patterns-state';\nimport useBlockTypesState from './hooks/use-block-types-state';\nimport { searchBlockItems, searchItems } from './search-items';\nimport InserterListbox from '../inserter-listbox';\nimport { orderBy } from '../../utils/sorting';\nimport { orderInserterBlockItems } from '../../utils/order-inserter-block-items';\nimport { store as blockEditorStore } from '../../store';\n\nconst INITIAL_INSERTER_RESULTS = 9;\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation and rerendering the component.\n *\n * @type {Array}\n */\nconst EMPTY_ARRAY = [];\n\nfunction InserterSearchResults( {\n\tfilterValue,\n\tonSelect,\n\tonHover,\n\trootClientId,\n\tclientId,\n\tisAppender,\n\t__experimentalInsertionIndex,\n\tmaxBlockPatterns,\n\tmaxBlockTypes,\n\tshowBlockDirectory = false,\n\tisDraggable = true,\n\tshouldFocusBlock = true,\n\tprioritizePatterns,\n\tselectBlockOnInsert,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\n\tconst { prioritizedBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst blockListSettings =\n\t\t\t\tselect( blockEditorStore ).getBlockListSettings( rootClientId );\n\n\t\t\treturn {\n\t\t\t\tprioritizedBlocks:\n\t\t\t\t\tblockListSettings?.prioritizedInserterBlocks || EMPTY_ARRAY,\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\n\tconst [ destinationRootClientId, onInsertBlocks ] = useInsertionPoint( {\n\t\tonSelect,\n\t\trootClientId,\n\t\tclientId,\n\t\tisAppender,\n\t\tinsertionIndex: __experimentalInsertionIndex,\n\t\tshouldFocusBlock,\n\t\tselectBlockOnInsert,\n\t} );\n\tconst [\n\t\tblockTypes,\n\t\tblockTypeCategories,\n\t\tblockTypeCollections,\n\t\tonSelectBlockType,\n\t] = useBlockTypesState( destinationRootClientId, onInsertBlocks );\n\tconst [ patterns, , onSelectBlockPattern ] = usePatternsState(\n\t\tonInsertBlocks,\n\t\tdestinationRootClientId\n\t);\n\n\tconst filteredBlockPatterns = useMemo( () => {\n\t\tif ( maxBlockPatterns === 0 ) {\n\t\t\treturn [];\n\t\t}\n\t\tconst results = searchItems( patterns, filterValue );\n\t\treturn maxBlockPatterns !== undefined\n\t\t\t? results.slice( 0, maxBlockPatterns )\n\t\t\t: results;\n\t}, [ filterValue, patterns, maxBlockPatterns ] );\n\n\tlet maxBlockTypesToShow = maxBlockTypes;\n\tif ( prioritizePatterns && filteredBlockPatterns.length > 2 ) {\n\t\tmaxBlockTypesToShow = 0;\n\t}\n\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( maxBlockTypesToShow === 0 ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tlet orderedItems = orderBy( blockTypes, 'frecency', 'desc' );\n\n\t\tif ( ! filterValue && prioritizedBlocks.length ) {\n\t\t\torderedItems = orderInserterBlockItems(\n\t\t\t\torderedItems,\n\t\t\t\tprioritizedBlocks\n\t\t\t);\n\t\t}\n\n\t\tconst results = searchBlockItems(\n\t\t\torderedItems,\n\t\t\tblockTypeCategories,\n\t\t\tblockTypeCollections,\n\t\t\tfilterValue\n\t\t);\n\n\t\treturn maxBlockTypesToShow !== undefined\n\t\t\t? results.slice( 0, maxBlockTypesToShow )\n\t\t\t: results;\n\t}, [\n\t\tfilterValue,\n\t\tblockTypes,\n\t\tblockTypeCategories,\n\t\tblockTypeCollections,\n\t\tmaxBlockTypesToShow,\n\t\tprioritizedBlocks,\n\t] );\n\n\t// Announce search results on change.\n\tuseEffect( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = filteredBlockTypes.length + filteredBlockPatterns.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [\n\t\tfilterValue,\n\t\tdebouncedSpeak,\n\t\tfilteredBlockTypes,\n\t\tfilteredBlockPatterns,\n\t] );\n\n\tconst currentShownBlockTypes = useAsyncList( filteredBlockTypes, {\n\t\tstep: INITIAL_INSERTER_RESULTS,\n\t} );\n\tconst currentShownPatterns = useAsyncList(\n\t\tcurrentShownBlockTypes.length === filteredBlockTypes.length\n\t\t\t? filteredBlockPatterns\n\t\t\t: EMPTY_ARRAY\n\t);\n\n\tconst hasItems =\n\t\tfilteredBlockTypes.length > 0 || filteredBlockPatterns.length > 0;\n\n\tconst blocksUI = !! filteredBlockTypes.length && (\n\t\t<InserterPanel\n\t\t\ttitle={ <VisuallyHidden>{ __( 'Blocks' ) }</VisuallyHidden> }\n\t\t>\n\t\t\t<BlockTypesList\n\t\t\t\titems={ currentShownBlockTypes }\n\t\t\t\tonSelect={ onSelectBlockType }\n\t\t\t\tonHover={ onHover }\n\t\t\t\tlabel={ __( 'Blocks' ) }\n\t\t\t\tisDraggable={ isDraggable }\n\t\t\t/>\n\t\t</InserterPanel>\n\t);\n\n\tconst patternsUI = !! filteredBlockPatterns.length && (\n\t\t<InserterPanel\n\t\t\ttitle={\n\t\t\t\t<VisuallyHidden>{ __( 'Block Patterns' ) }</VisuallyHidden>\n\t\t\t}\n\t\t>\n\t\t\t<div className=\"block-editor-inserter__quick-inserter-patterns\">\n\t\t\t\t<BlockPatternsList\n\t\t\t\t\tshownPatterns={ currentShownPatterns }\n\t\t\t\t\tblockPatterns={ filteredBlockPatterns }\n\t\t\t\t\tonClickPattern={ onSelectBlockPattern }\n\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\tisDraggable={ isDraggable }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</InserterPanel>\n\t);\n\n\treturn (\n\t\t<InserterListbox>\n\t\t\t{ ! showBlockDirectory && ! hasItems && <InserterNoResults /> }\n\n\t\t\t{ prioritizePatterns ? patternsUI : blocksUI }\n\n\t\t\t{ !! filteredBlockTypes.length &&\n\t\t\t\t!! filteredBlockPatterns.length && (\n\t\t\t\t\t<div className=\"block-editor-inserter__quick-inserter-separator\" />\n\t\t\t\t) }\n\n\t\t\t{ prioritizePatterns ? blocksUI : patternsUI }\n\n\t\t\t{ showBlockDirectory && (\n\t\t\t\t<__unstableInserterMenuExtension.Slot\n\t\t\t\t\tfillProps={ {\n\t\t\t\t\t\tonSelect: onSelectBlockType,\n\t\t\t\t\t\tonHover,\n\t\t\t\t\t\tfilterValue,\n\t\t\t\t\t\thasItems,\n\t\t\t\t\t\trootClientId: destinationRootClientId,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ ( fills ) => {\n\t\t\t\t\t\tif ( fills.length ) {\n\t\t\t\t\t\t\treturn fills;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( ! hasItems ) {\n\t\t\t\t\t\t\treturn <InserterNoResults />;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t} }\n\t\t\t\t</__unstableInserterMenuExtension.Slot>\n\t\t\t) }\n\t\t</InserterListbox>\n\t);\n}\n\nexport default InserterSearchResults;\n"]}
@@ -23,6 +23,8 @@ var _store = require("../../store");
23
23
 
24
24
  var _useBlockDisplayTitle = _interopRequireDefault(require("../block-title/use-block-display-title"));
25
25
 
26
+ var _context = require("./context");
27
+
26
28
  var _inserter = _interopRequireDefault(require("../inserter"));
27
29
 
28
30
  /**
@@ -39,7 +41,10 @@ const Appender = (0, _element.forwardRef)((_ref, ref) => {
39
41
  clientId,
40
42
  ...props
41
43
  } = _ref;
42
- const [insertedBlock, setInsertedBlock] = (0, _element.useState)(null);
44
+ const {
45
+ insertedBlock,
46
+ setInsertedBlock
47
+ } = (0, _context.useListViewContext)();
43
48
  const instanceId = (0, _compose.useInstanceId)(Appender);
44
49
  const {
45
50
  hideInserter
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/appender.js"],"names":["Appender","ref","nestingLevel","blockCount","clientId","props","insertedBlock","setInsertedBlock","instanceId","hideInserter","select","getTemplateLock","__unstableGetEditorMode","blockEditorStore","blockTitle","context","insertedBlockTitle","length","descriptionId","description","maybeInsertedBlock"],"mappings":";;;;;;;;;AAMA;;;;AAHA;;AACA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AAdA;AACA;AACA;;AAOA;AACA;AACA;AAKO,MAAMA,QAAQ,GAAG,yBACvB,OAAoDC,GAApD,KAA6D;AAAA,MAA3D;A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;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,iBAAD;AACC,IAAA,GAAG,EAAGD,GADP;AAEC,IAAA,YAAY,EAAGG,QAFhB;AAGC,IAAA,QAAQ,EAAC,cAHV;AAIC,IAAA,UAAU,MAJX;AAKC,IAAA,mBAAmB,EAAG,KALvB;AAMC,IAAA,kBAAkB,EAAG,KANtB;AAOC,IAAA,qBAAqB;AAPtB,KAQMC,KARN;AASC,IAAA,WAAW,EAAG;AAAE,0BAAoBa;AAAtB,KATf;AAUC,IAAA,eAAe,EAAKE,kBAAF,IAA0B;AAC3C,UAAKA,kBAAL,aAAKA,kBAAL,eAAKA,kBAAkB,CAAEhB,QAAzB,EAAoC;AACnCG,QAAAA,gBAAgB,CAAEa,kBAAF,CAAhB;AACA;AACD;AAdF,KADD,EAiBC;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,EAAE,EAAGF;AAFN,KAIGC,WAJH,CAjBD,CADD;AA0BA,CAnFsB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { useSelect } from '@wordpress/data';\nimport { forwardRef, useState, useEffect } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport Inserter from '../inserter';\n\nexport const Appender = forwardRef(\n\t( { nestingLevel, blockCount, clientId, ...props }, ref ) => {\n\t\tconst [ insertedBlock, setInsertedBlock ] = useState( null );\n\n\t\tconst instanceId = useInstanceId( Appender );\n\t\tconst { hideInserter } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { getTemplateLock, __unstableGetEditorMode } =\n\t\t\t\t\tselect( blockEditorStore );\n\n\t\t\t\treturn {\n\t\t\t\t\thideInserter:\n\t\t\t\t\t\t!! getTemplateLock( clientId ) ||\n\t\t\t\t\t\t__unstableGetEditorMode() === 'zoom-out',\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\n\t\tconst blockTitle = useBlockDisplayTitle( {\n\t\t\tclientId,\n\t\t\tcontext: 'list-view',\n\t\t} );\n\n\t\tconst insertedBlockTitle = useBlockDisplayTitle( {\n\t\t\tclientId: insertedBlock?.clientId,\n\t\t\tcontext: 'list-view',\n\t\t} );\n\n\t\tuseEffect( () => {\n\t\t\tif ( ! insertedBlockTitle?.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tspeak(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: name of block being inserted (i.e. Paragraph, Image, Group etc)\n\t\t\t\t\t__( '%s block inserted' ),\n\t\t\t\t\tinsertedBlockTitle\n\t\t\t\t),\n\t\t\t\t'assertive'\n\t\t\t);\n\t\t}, [ insertedBlockTitle ] );\n\n\t\tif ( hideInserter ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst descriptionId = `list-view-appender__${ instanceId }`;\n\t\tconst description = sprintf(\n\t\t\t/* translators: 1: The name of the block. 2: The numerical position of the block. 3: The level of nesting for the block. */\n\t\t\t__( 'Append to %1$s block at position %2$d, Level %3$d' ),\n\t\t\tblockTitle,\n\t\t\tblockCount + 1,\n\t\t\tnestingLevel\n\t\t);\n\n\t\treturn (\n\t\t\t<div className=\"list-view-appender\">\n\t\t\t\t<Inserter\n\t\t\t\t\tref={ ref }\n\t\t\t\t\trootClientId={ clientId }\n\t\t\t\t\tposition=\"bottom right\"\n\t\t\t\t\tisAppender\n\t\t\t\t\tselectBlockOnInsert={ false }\n\t\t\t\t\tshouldDirectInsert={ false }\n\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t{ ...props }\n\t\t\t\t\ttoggleProps={ { 'aria-describedby': descriptionId } }\n\t\t\t\t\tonSelectOrClose={ ( maybeInsertedBlock ) => {\n\t\t\t\t\t\tif ( maybeInsertedBlock?.clientId ) {\n\t\t\t\t\t\t\tsetInsertedBlock( maybeInsertedBlock );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"list-view-appender__description\"\n\t\t\t\t\tid={ descriptionId }\n\t\t\t\t>\n\t\t\t\t\t{ description }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/appender.js"],"names":["Appender","ref","nestingLevel","blockCount","clientId","props","insertedBlock","setInsertedBlock","instanceId","hideInserter","select","getTemplateLock","__unstableGetEditorMode","blockEditorStore","blockTitle","context","insertedBlockTitle","length","descriptionId","description","maybeInsertedBlock"],"mappings":";;;;;;;;;AAMA;;;;AAHA;;AACA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AAfA;AACA;AACA;;AAOA;AACA;AACA;AAMO,MAAMA,QAAQ,GAAG,yBACvB,OAAoDC,GAApD,KAA6D;AAAA,MAA3D;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,UAAhB;AAA4BC,IAAAA,QAA5B;AAAsC,OAAGC;AAAzC,GAA2D;AAC5D,QAAM;AAAEC,IAAAA,aAAF;AAAiBC,IAAAA;AAAjB,MAAsC,kCAA5C;AAEA,QAAMC,UAAU,GAAG,4BAAeR,QAAf,CAAnB;AACA,QAAM;AAAES,IAAAA;AAAF,MAAmB,qBACtBC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,eAAF;AAAmBC,MAAAA;AAAnB,QACLF,MAAM,CAAEG,YAAF,CADP;AAGA,WAAO;AACNJ,MAAAA,YAAY,EACX,CAAC,CAAEE,eAAe,CAAEP,QAAF,CAAlB,IACAQ,uBAAuB,OAAO;AAHzB,KAAP;AAKA,GAVuB,EAWxB,CAAER,QAAF,CAXwB,CAAzB;AAcA,QAAMU,UAAU,GAAG,mCAAsB;AACxCV,IAAAA,QADwC;AAExCW,IAAAA,OAAO,EAAE;AAF+B,GAAtB,CAAnB;AAKA,QAAMC,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**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { useSelect } from '@wordpress/data';\nimport { forwardRef, useEffect } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport { useListViewContext } from './context';\nimport Inserter from '../inserter';\n\nexport const Appender = forwardRef(\n\t( { nestingLevel, blockCount, clientId, ...props }, ref ) => {\n\t\tconst { insertedBlock, setInsertedBlock } = useListViewContext();\n\n\t\tconst instanceId = useInstanceId( Appender );\n\t\tconst { hideInserter } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { getTemplateLock, __unstableGetEditorMode } =\n\t\t\t\t\tselect( blockEditorStore );\n\n\t\t\t\treturn {\n\t\t\t\t\thideInserter:\n\t\t\t\t\t\t!! getTemplateLock( clientId ) ||\n\t\t\t\t\t\t__unstableGetEditorMode() === 'zoom-out',\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\n\t\tconst blockTitle = useBlockDisplayTitle( {\n\t\t\tclientId,\n\t\t\tcontext: 'list-view',\n\t\t} );\n\n\t\tconst insertedBlockTitle = useBlockDisplayTitle( {\n\t\t\tclientId: insertedBlock?.clientId,\n\t\t\tcontext: 'list-view',\n\t\t} );\n\n\t\tuseEffect( () => {\n\t\t\tif ( ! insertedBlockTitle?.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tspeak(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: name of block being inserted (i.e. Paragraph, Image, Group etc)\n\t\t\t\t\t__( '%s block inserted' ),\n\t\t\t\t\tinsertedBlockTitle\n\t\t\t\t),\n\t\t\t\t'assertive'\n\t\t\t);\n\t\t}, [ insertedBlockTitle ] );\n\n\t\tif ( hideInserter ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst descriptionId = `list-view-appender__${ instanceId }`;\n\t\tconst description = sprintf(\n\t\t\t/* translators: 1: The name of the block. 2: The numerical position of the block. 3: The level of nesting for the block. */\n\t\t\t__( 'Append to %1$s block at position %2$d, Level %3$d' ),\n\t\t\tblockTitle,\n\t\t\tblockCount + 1,\n\t\t\tnestingLevel\n\t\t);\n\n\t\treturn (\n\t\t\t<div className=\"list-view-appender\">\n\t\t\t\t<Inserter\n\t\t\t\t\tref={ ref }\n\t\t\t\t\trootClientId={ clientId }\n\t\t\t\t\tposition=\"bottom right\"\n\t\t\t\t\tisAppender\n\t\t\t\t\tselectBlockOnInsert={ false }\n\t\t\t\t\tshouldDirectInsert={ false }\n\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t{ ...props }\n\t\t\t\t\ttoggleProps={ { 'aria-describedby': descriptionId } }\n\t\t\t\t\tonSelectOrClose={ ( maybeInsertedBlock ) => {\n\t\t\t\t\t\tif ( maybeInsertedBlock?.clientId ) {\n\t\t\t\t\t\t\tsetInsertedBlock( maybeInsertedBlock );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"list-view-appender__description\"\n\t\t\t\t\tid={ descriptionId }\n\t\t\t\t>\n\t\t\t\t\t{ description }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n);\n"]}
@@ -64,7 +64,9 @@ const ListViewBlockContents = (0, _element.forwardRef)((_ref, ref) => {
64
64
  };
65
65
  }, [clientId]);
66
66
  const {
67
- renderAdditionalBlockUI
67
+ renderAdditionalBlockUI,
68
+ insertedBlock,
69
+ setInsertedBlock
68
70
  } = (0, _context.useListViewContext)();
69
71
  const isBlockMoveTarget = blockMovingClientId && selectedBlockInBlockEditor === clientId;
70
72
  const className = (0, _classnames.default)('block-editor-list-view-block-contents', {
@@ -75,7 +77,7 @@ const ListViewBlockContents = (0, _element.forwardRef)((_ref, ref) => {
75
77
  // to drag it and rearrange its position.
76
78
 
77
79
  const draggableClientIds = selectedClientIds.includes(clientId) ? selectedClientIds : [clientId];
78
- return (0, _element.createElement)(_element.Fragment, null, renderAdditionalBlockUI && renderAdditionalBlockUI(block), (0, _element.createElement)(_blockDraggable.default, {
80
+ return (0, _element.createElement)(_element.Fragment, null, renderAdditionalBlockUI && renderAdditionalBlockUI(block, insertedBlock, setInsertedBlock), (0, _element.createElement)(_blockDraggable.default, {
79
81
  clientIds: draggableClientIds
80
82
  }, _ref2 => {
81
83
  let {
@@ -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","renderAdditionalBlockUI","isBlockMoveTarget","className","draggableClientIds","includes","draggable","onDragStart","onDragEnd"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAKA;;AAMA;;AACA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAMA,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,QAAM;AAAEO,IAAAA;AAAF,MAA8B,kCAApC;AAEA,QAAMC,iBAAiB,GACtBP,mBAAmB,IAAIC,0BAA0B,KAAKF,QADvD;AAGA,QAAMS,SAAS,GAAG,yBAAY,uCAAZ,EAAqD;AACtE,0BAAsBD;AADgD,GAArD,CAAlB,CApBI,CAwBJ;AACA;AACA;AACA;;AACA,QAAME,kBAAkB,GAAGZ,iBAAiB,CAACa,QAAlB,CAA4BX,QAA5B,IACxBF,iBADwB,GAExB,CAAEE,QAAF,CAFH;AAIA,SACC,qDACGO,uBAAuB,IAAIA,uBAAuB,CAAEf,KAAF,CADrD,EAEC,4BAAC,uBAAD;AAAgB,IAAA,SAAS,EAAGkB;AAA5B,KACG;AAAA,QAAE;AAAEE,MAAAA,SAAF;AAAaC,MAAAA,WAAb;AAA0BC,MAAAA;AAA1B,KAAF;AAAA,WACD,4BAAC,0BAAD;AACC,MAAA,GAAG,EAAGzB,GADP;AAEC,MAAA,SAAS,EAAGoB,SAFb;AAGC,MAAA,KAAK,EAAGjB,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,EAAGgB,SAVb;AAWC,MAAA,WAAW,EAAGC,WAXf;AAYC,MAAA,SAAS,EAAGC,SAZb;AAaC,MAAA,UAAU,EAAGjB;AAbd,OAcME,KAdN,EADC;AAAA,GADH,CAFD,CADD;AAyBA,CAxE4B,CAA9B;eA2EeX,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';\nimport { useListViewContext } from './context';\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 { renderAdditionalBlockUI } = useListViewContext();\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<>\n\t\t\t\t{ renderAdditionalBlockUI && renderAdditionalBlockUI( block ) }\n\t\t\t\t<BlockDraggable clientIds={ draggableClientIds }>\n\t\t\t\t\t{ ( { draggable, onDragStart, onDragEnd } ) => (\n\t\t\t\t\t\t<ListViewBlockSelectButton\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\t\tonToggleExpanded={ onToggleExpanded }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\tdraggable={ draggable }\n\t\t\t\t\t\t\tonDragStart={ onDragStart }\n\t\t\t\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockDraggable>\n\t\t\t</>\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","renderAdditionalBlockUI","insertedBlock","setInsertedBlock","isBlockMoveTarget","className","draggableClientIds","includes","draggable","onDragStart","onDragEnd"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAKA;;AAMA;;AACA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAMA,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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AAGE,UANd;AAOC,MAAA,QAAQ,EAAGC,QAPZ;AAQC,MAAA,iBAAiB,EAAGC,iBARrB;AASC,MAAA,KAAK,EAAGC,KATT;AAUC,MAAA,SAAS,EAAGkB,SAVb;AAWC,MAAA,WAAW,EAAGC,WAXf;AAYC,MAAA,SAAS,EAAGC,SAZb;AAaC,MAAA,UAAU,EAAGnB;AAbd,OAcME,KAdN,EADC;AAAA,GADH,CAPD,CADD;AA8BA,CA9E4B,CAA9B;eAiFeX,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';\nimport { useListViewContext } from './context';\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 { renderAdditionalBlockUI, insertedBlock, setInsertedBlock } =\n\t\t\tuseListViewContext();\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<>\n\t\t\t\t{ renderAdditionalBlockUI &&\n\t\t\t\t\trenderAdditionalBlockUI(\n\t\t\t\t\t\tblock,\n\t\t\t\t\t\tinsertedBlock,\n\t\t\t\t\t\tsetInsertedBlock\n\t\t\t\t\t) }\n\t\t\t\t<BlockDraggable clientIds={ draggableClientIds }>\n\t\t\t\t\t{ ( { draggable, onDragStart, onDragEnd } ) => (\n\t\t\t\t\t\t<ListViewBlockSelectButton\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\t\tonToggleExpanded={ onToggleExpanded }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\tdraggable={ draggable }\n\t\t\t\t\t\t\tonDragStart={ onDragStart }\n\t\t\t\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockDraggable>\n\t\t\t</>\n\t\t);\n\t}\n);\n\nexport default ListViewBlockContents;\n"]}
@@ -41,6 +41,8 @@ var _useBlockDisplayInformation = _interopRequireDefault(require("../use-block-d
41
41
 
42
42
  var _blockLock = require("../block-lock");
43
43
 
44
+ var _lockUnlock = require("../../lock-unlock");
45
+
44
46
  /**
45
47
  * External dependencies
46
48
  */
@@ -76,34 +78,23 @@ function ListViewBlock(_ref) {
76
78
  const [isHovered, setIsHovered] = (0, _element.useState)(false);
77
79
  const {
78
80
  isLocked,
79
- isContentLocked,
80
81
  canEdit
81
82
  } = (0, _blockLock.useBlockLock)(clientId);
82
- const forceSelectionContentLock = (0, _data.useSelect)(select => {
83
- if (isSelected) {
84
- return false;
85
- }
86
-
87
- if (!isContentLocked) {
88
- return false;
89
- }
90
-
91
- return select(_store.store).hasSelectedInnerBlock(clientId, true);
92
- }, [isContentLocked, clientId, isSelected]);
93
- const canExpand = isContentLocked ? false : canEdit;
94
- const isFirstSelectedBlock = forceSelectionContentLock || isSelected && selectedClientIds[0] === clientId;
95
- const isLastSelectedBlock = forceSelectionContentLock || isSelected && selectedClientIds[selectedClientIds.length - 1] === clientId;
83
+ const isFirstSelectedBlock = isSelected && selectedClientIds[0] === clientId;
84
+ const isLastSelectedBlock = isSelected && selectedClientIds[selectedClientIds.length - 1] === clientId;
96
85
  const {
97
86
  toggleBlockHighlight
98
87
  } = (0, _data.useDispatch)(_store.store);
99
88
  const blockInformation = (0, _useBlockDisplayInformation.default)(clientId);
100
89
  const blockTitle = (blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.title) || (0, _i18n.__)('Untitled');
101
90
  const block = (0, _data.useSelect)(select => select(_store.store).getBlock(clientId), [clientId]);
102
- const blockName = (0, _data.useSelect)(select => select(_store.store).getBlockName(clientId), [clientId]); // When a block hides its toolbar it also hides the block settings menu,
91
+ const blockName = (0, _data.useSelect)(select => select(_store.store).getBlockName(clientId), [clientId]);
92
+ const blockEditingMode = (0, _data.useSelect)(select => (0, _lockUnlock.unlock)(select(_store.store)).getBlockEditingMode(clientId), [clientId]);
93
+ const showBlockActions = // When a block hides its toolbar it also hides the block settings menu,
103
94
  // since that menu is part of the toolbar in the editor canvas.
104
95
  // List View respects this by also hiding the block settings menu.
105
-
106
- const showBlockActions = (0, _blocks.hasBlockSupport)(blockName, '__experimentalToolbar', true);
96
+ (0, _blocks.hasBlockSupport)(blockName, '__experimentalToolbar', true) && // Don't show the settings menu if block is disabled or content only.
97
+ blockEditingMode === 'default';
107
98
  const instanceId = (0, _compose.useInstanceId)(ListViewBlock);
108
99
  const descriptionId = `list-view-block-select-button__${instanceId}`;
109
100
  const blockPositionDescription = (0, _utils.getBlockPositionDescription)(position, siblingBlockCount, level);
@@ -116,7 +107,9 @@ function ListViewBlock(_ref) {
116
107
  expand,
117
108
  collapse,
118
109
  BlockSettingsMenu,
119
- listViewInstanceId
110
+ listViewInstanceId,
111
+ expandedState,
112
+ setInsertedBlock
120
113
  } = (0, _context.useListViewContext)();
121
114
  const hasSiblings = siblingBlockCount > 0;
122
115
  const hasRenderedMovers = showBlockMovers && hasSiblings;
@@ -169,7 +162,7 @@ function ListViewBlock(_ref) {
169
162
  }
170
163
 
171
164
  const classes = (0, _classnames.default)({
172
- 'is-selected': isSelected || forceSelectionContentLock,
165
+ 'is-selected': isSelected,
173
166
  'is-first-selected': isFirstSelectedBlock,
174
167
  'is-last-selected': isLastSelectedBlock,
175
168
  'is-branch-selected': isBranchSelected,
@@ -205,13 +198,13 @@ function ListViewBlock(_ref) {
205
198
  path: path,
206
199
  id: `list-view-${listViewInstanceId}-block-${clientId}`,
207
200
  "data-block": clientId,
208
- "data-expanded": canExpand ? isExpanded : undefined,
201
+ "data-expanded": canEdit ? isExpanded : undefined,
209
202
  ref: rowRef
210
203
  }, (0, _element.createElement)(_components.__experimentalTreeGridCell, {
211
204
  className: "block-editor-list-view-block__contents-cell",
212
205
  colSpan: colSpan,
213
206
  ref: cellRef,
214
- "aria-selected": !!isSelected || forceSelectionContentLock
207
+ "aria-selected": !!isSelected
215
208
  }, _ref2 => {
216
209
  let {
217
210
  ref,
@@ -231,7 +224,7 @@ function ListViewBlock(_ref) {
231
224
  ref: ref,
232
225
  tabIndex: currentlyEditingBlockInCanvas ? 0 : tabIndex,
233
226
  onFocus: onFocus,
234
- isExpanded: canExpand ? isExpanded : undefined,
227
+ isExpanded: canEdit ? isExpanded : undefined,
235
228
  selectedClientIds: selectedClientIds,
236
229
  ariaLabel: blockAriaLabel,
237
230
  ariaDescribedBy: descriptionId
@@ -270,7 +263,7 @@ function ListViewBlock(_ref) {
270
263
  });
271
264
  }))), showBlockActions && BlockSettingsMenu && (0, _element.createElement)(_components.__experimentalTreeGridCell, {
272
265
  className: listViewBlockSettingsClassName,
273
- "aria-selected": !!isSelected || forceSelectionContentLock
266
+ "aria-selected": !!isSelected
274
267
  }, _ref5 => {
275
268
  let {
276
269
  ref,
@@ -289,7 +282,10 @@ function ListViewBlock(_ref) {
289
282
  onFocus
290
283
  },
291
284
  disableOpenOnArrowDown: true,
292
- __experimentalSelectBlock: updateSelection
285
+ __experimentalSelectBlock: updateSelection,
286
+ expand: expand,
287
+ expandedState: expandedState,
288
+ setInsertedBlock: setInsertedBlock
293
289
  });
294
290
  }));
295
291
  }