@wordpress/block-editor 12.4.0 → 12.6.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 (524) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +1 -0
  3. package/build/components/block-draggable/index.js +6 -3
  4. package/build/components/block-draggable/index.js.map +1 -1
  5. package/build/components/block-draggable/index.native.js +2 -2
  6. package/build/components/block-draggable/index.native.js.map +1 -1
  7. package/build/components/block-edit/edit.js +25 -13
  8. package/build/components/block-edit/edit.js.map +1 -1
  9. package/build/components/block-heading-level-dropdown/heading-level-icon.js +10 -2
  10. package/build/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -1
  11. package/build/components/block-heading-level-dropdown/index.native.js +4 -3
  12. package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
  13. package/build/components/block-list/block-outline.native.js +14 -18
  14. package/build/components/block-list/block-outline.native.js.map +1 -1
  15. package/build/components/block-list/block.native.js +21 -42
  16. package/build/components/block-list/block.native.js.map +1 -1
  17. package/build/components/block-lock/toolbar.js +25 -6
  18. package/build/components/block-lock/toolbar.js.map +1 -1
  19. package/build/components/block-mover/index.native.js +1 -1
  20. package/build/components/block-mover/index.native.js.map +1 -1
  21. package/build/components/block-parent-selector/index.js +8 -5
  22. package/build/components/block-parent-selector/index.js.map +1 -1
  23. package/build/components/block-removal-warning-modal/index.js +15 -25
  24. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  25. package/build/components/block-settings/button.native.js +2 -2
  26. package/build/components/block-settings/button.native.js.map +1 -1
  27. package/build/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +10 -11
  28. package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
  29. package/build/components/block-toolbar/index.js +12 -8
  30. package/build/components/block-toolbar/index.js.map +1 -1
  31. package/build/components/block-toolbar/index.native.js +62 -3
  32. package/build/components/block-toolbar/index.native.js.map +1 -1
  33. package/build/components/block-tools/block-contextual-toolbar.js +7 -11
  34. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  35. package/build/components/colors-gradients/control.js +4 -2
  36. package/build/components/colors-gradients/control.js.map +1 -1
  37. package/build/components/dimensions-tool/aspect-ratio-tool.js +99 -0
  38. package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
  39. package/build/components/dimensions-tool/index.js +207 -0
  40. package/build/components/dimensions-tool/index.js.map +1 -0
  41. package/build/components/dimensions-tool/scale-tool.js +111 -0
  42. package/build/components/dimensions-tool/scale-tool.js.map +1 -0
  43. package/build/components/dimensions-tool/width-height-tool.js +125 -0
  44. package/build/components/dimensions-tool/width-height-tool.js.map +1 -0
  45. package/build/components/global-styles/color-panel.js +22 -16
  46. package/build/components/global-styles/color-panel.js.map +1 -1
  47. package/build/components/global-styles/dimensions-panel.js +13 -2
  48. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  49. package/build/components/global-styles/filters-panel.js +1 -1
  50. package/build/components/global-styles/filters-panel.js.map +1 -1
  51. package/build/components/global-styles/get-block-css-selector.js +4 -8
  52. package/build/components/global-styles/get-block-css-selector.js.map +1 -1
  53. package/build/components/global-styles/hooks.js +15 -25
  54. package/build/components/global-styles/hooks.js.map +1 -1
  55. package/build/components/global-styles/typography-panel.js +52 -5
  56. package/build/components/global-styles/typography-panel.js.map +1 -1
  57. package/build/components/global-styles/use-global-styles-output.js +12 -18
  58. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  59. package/build/components/global-styles/utils.js +6 -6
  60. package/build/components/global-styles/utils.js.map +1 -1
  61. package/build/components/iframe/index.js +36 -48
  62. package/build/components/iframe/index.js.map +1 -1
  63. package/build/components/iframe/use-compatibility-styles.js +5 -0
  64. package/build/components/iframe/use-compatibility-styles.js.map +1 -1
  65. package/build/components/image-editor/aspect-ratio-dropdown.js +1 -1
  66. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  67. package/build/components/image-editor/use-save-image.js +1 -2
  68. package/build/components/image-editor/use-save-image.js.map +1 -1
  69. package/build/components/image-size-control/index.js +6 -0
  70. package/build/components/image-size-control/index.js.map +1 -1
  71. package/build/components/index.js +9 -0
  72. package/build/components/index.js.map +1 -1
  73. package/build/components/inner-blocks/index.js +3 -1
  74. package/build/components/inner-blocks/index.js.map +1 -1
  75. package/build/components/inner-blocks/index.native.js +3 -1
  76. package/build/components/inner-blocks/index.native.js.map +1 -1
  77. package/build/components/inner-blocks/use-nested-settings-update.js +33 -7
  78. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  79. package/build/components/inserter/block-patterns-explorer/patterns-list.js +2 -2
  80. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  81. package/build/components/inserter/block-patterns-tab.js +7 -35
  82. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  83. package/build/components/inserter/hooks/use-block-types-state.js +3 -4
  84. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  85. package/build/components/inserter/hooks/use-patterns-state.js +9 -3
  86. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  87. package/build/components/inserter/index.js +2 -4
  88. package/build/components/inserter/index.js.map +1 -1
  89. package/build/components/inserter/index.native.js +21 -32
  90. package/build/components/inserter/index.native.js.map +1 -1
  91. package/build/components/inserter/media-tab/hooks.js +2 -21
  92. package/build/components/inserter/media-tab/hooks.js.map +1 -1
  93. package/build/components/inserter/reusable-block-rename-hint.js +82 -0
  94. package/build/components/inserter/reusable-block-rename-hint.js.map +1 -0
  95. package/build/components/inserter/reusable-blocks-tab.js +6 -2
  96. package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
  97. package/build/components/inserter/reusable-blocks-tab.native.js +2 -2
  98. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  99. package/build/components/inserter/tabs.native.js +1 -1
  100. package/build/components/inserter/tabs.native.js.map +1 -1
  101. package/build/components/inserter-draggable-blocks/index.js +9 -1
  102. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  103. package/build/components/link-control/constants.js +1 -1
  104. package/build/components/link-control/constants.js.map +1 -1
  105. package/build/components/link-control/index.js +21 -16
  106. package/build/components/link-control/index.js.map +1 -1
  107. package/build/components/link-control/search-create-button.js +5 -21
  108. package/build/components/link-control/search-create-button.js.map +1 -1
  109. package/build/components/link-control/search-input.js +4 -4
  110. package/build/components/link-control/search-input.js.map +1 -1
  111. package/build/components/link-control/search-item.js +13 -30
  112. package/build/components/link-control/search-item.js.map +1 -1
  113. package/build/components/link-control/search-results.js +2 -2
  114. package/build/components/link-control/search-results.js.map +1 -1
  115. package/build/components/link-control/settings-drawer.js +2 -3
  116. package/build/components/link-control/settings-drawer.js.map +1 -1
  117. package/build/components/list-view/appender.js +2 -6
  118. package/build/components/list-view/appender.js.map +1 -1
  119. package/build/components/list-view/use-list-view-client-ids.js +2 -2
  120. package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
  121. package/build/components/media-placeholder/index.native.js +65 -31
  122. package/build/components/media-placeholder/index.native.js.map +1 -1
  123. package/build/components/preview-options/index.js +2 -2
  124. package/build/components/preview-options/index.js.map +1 -1
  125. package/build/components/provider/index.js +5 -2
  126. package/build/components/provider/index.js.map +1 -1
  127. package/build/components/provider/use-block-sync.js +21 -0
  128. package/build/components/provider/use-block-sync.js.map +1 -1
  129. package/build/components/resolution-tool/index.js +55 -0
  130. package/build/components/resolution-tool/index.js.map +1 -0
  131. package/build/components/rich-text/content.js +0 -36
  132. package/build/components/rich-text/content.js.map +1 -1
  133. package/build/components/rich-text/get-rich-text-values.js +118 -0
  134. package/build/components/rich-text/get-rich-text-values.js.map +1 -0
  135. package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
  136. package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
  137. package/build/components/spacing-sizes-control/input-controls/axial.js +6 -2
  138. package/build/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
  139. package/build/components/spacing-sizes-control/input-controls/separated.js +5 -1
  140. package/build/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
  141. package/build/components/spacing-sizes-control/input-controls/single.js +5 -1
  142. package/build/components/spacing-sizes-control/input-controls/single.js.map +1 -1
  143. package/build/components/spacing-sizes-control/utils.js +1 -1
  144. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  145. package/build/components/url-input/index.js +4 -2
  146. package/build/components/url-input/index.js.map +1 -1
  147. package/build/components/use-block-display-information/index.js +7 -3
  148. package/build/components/use-block-display-information/index.js.map +1 -1
  149. package/build/components/use-block-drop-zone/index.native.js +49 -8
  150. package/build/components/use-block-drop-zone/index.native.js.map +1 -1
  151. package/build/components/use-setting/index.js +5 -9
  152. package/build/components/use-setting/index.js.map +1 -1
  153. package/build/components/writing-flow/use-tab-nav.js +10 -27
  154. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  155. package/build/components/writing-mode-control/index.js +70 -0
  156. package/build/components/writing-mode-control/index.js.map +1 -0
  157. package/build/hooks/behaviors.js +25 -20
  158. package/build/hooks/behaviors.js.map +1 -1
  159. package/build/hooks/margin.js +1 -1
  160. package/build/hooks/margin.js.map +1 -1
  161. package/build/hooks/padding.js +1 -1
  162. package/build/hooks/padding.js.map +1 -1
  163. package/build/hooks/supports.js +7 -1
  164. package/build/hooks/supports.js.map +1 -1
  165. package/build/hooks/typography.js +2 -1
  166. package/build/hooks/typography.js.map +1 -1
  167. package/build/hooks/utils.js +5 -9
  168. package/build/hooks/utils.js.map +1 -1
  169. package/build/private-apis.js +16 -3
  170. package/build/private-apis.js.map +1 -1
  171. package/build/private-apis.native.js +3 -0
  172. package/build/private-apis.native.js.map +1 -1
  173. package/build/store/actions.js +196 -2
  174. package/build/store/actions.js.map +1 -1
  175. package/build/store/defaults.js +1 -0
  176. package/build/store/defaults.js.map +1 -1
  177. package/build/store/index.js +10 -1
  178. package/build/store/index.js.map +1 -1
  179. package/build/store/private-actions.js +46 -40
  180. package/build/store/private-actions.js.map +1 -1
  181. package/build/store/private-selectors.js +8 -9
  182. package/build/store/private-selectors.js.map +1 -1
  183. package/build/store/reducer.js +22 -9
  184. package/build/store/reducer.js.map +1 -1
  185. package/build/store/selectors.js +52 -23
  186. package/build/store/selectors.js.map +1 -1
  187. package/build/utils/object.js +38 -2
  188. package/build/utils/object.js.map +1 -1
  189. package/build-module/components/block-draggable/index.js +6 -3
  190. package/build-module/components/block-draggable/index.js.map +1 -1
  191. package/build-module/components/block-draggable/index.native.js +2 -2
  192. package/build-module/components/block-draggable/index.native.js.map +1 -1
  193. package/build-module/components/block-edit/edit.js +27 -10
  194. package/build-module/components/block-edit/edit.js.map +1 -1
  195. package/build-module/components/block-heading-level-dropdown/heading-level-icon.js +9 -2
  196. package/build-module/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -1
  197. package/build-module/components/block-heading-level-dropdown/index.native.js +4 -3
  198. package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
  199. package/build-module/components/block-list/block-outline.native.js +14 -18
  200. package/build-module/components/block-list/block-outline.native.js.map +1 -1
  201. package/build-module/components/block-list/block.native.js +24 -43
  202. package/build-module/components/block-list/block.native.js.map +1 -1
  203. package/build-module/components/block-lock/toolbar.js +25 -7
  204. package/build-module/components/block-lock/toolbar.js.map +1 -1
  205. package/build-module/components/block-mover/index.native.js +3 -3
  206. package/build-module/components/block-mover/index.native.js.map +1 -1
  207. package/build-module/components/block-parent-selector/index.js +7 -5
  208. package/build-module/components/block-parent-selector/index.js.map +1 -1
  209. package/build-module/components/block-removal-warning-modal/index.js +17 -24
  210. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  211. package/build-module/components/block-settings/button.native.js +3 -3
  212. package/build-module/components/block-settings/button.native.js.map +1 -1
  213. package/build-module/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +13 -13
  214. package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
  215. package/build-module/components/block-toolbar/index.js +12 -8
  216. package/build-module/components/block-toolbar/index.js.map +1 -1
  217. package/build-module/components/block-toolbar/index.native.js +60 -4
  218. package/build-module/components/block-toolbar/index.native.js.map +1 -1
  219. package/build-module/components/block-tools/block-contextual-toolbar.js +8 -11
  220. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  221. package/build-module/components/colors-gradients/control.js +3 -2
  222. package/build-module/components/colors-gradients/control.js.map +1 -1
  223. package/build-module/components/dimensions-tool/aspect-ratio-tool.js +87 -0
  224. package/build-module/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
  225. package/build-module/components/dimensions-tool/index.js +195 -0
  226. package/build-module/components/dimensions-tool/index.js.map +1 -0
  227. package/build-module/components/dimensions-tool/scale-tool.js +103 -0
  228. package/build-module/components/dimensions-tool/scale-tool.js.map +1 -0
  229. package/build-module/components/dimensions-tool/width-height-tool.js +122 -0
  230. package/build-module/components/dimensions-tool/width-height-tool.js.map +1 -0
  231. package/build-module/components/global-styles/color-panel.js +22 -16
  232. package/build-module/components/global-styles/color-panel.js.map +1 -1
  233. package/build-module/components/global-styles/dimensions-panel.js +13 -2
  234. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  235. package/build-module/components/global-styles/filters-panel.js +2 -2
  236. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  237. package/build-module/components/global-styles/get-block-css-selector.js +4 -8
  238. package/build-module/components/global-styles/get-block-css-selector.js.map +1 -1
  239. package/build-module/components/global-styles/hooks.js +14 -24
  240. package/build-module/components/global-styles/hooks.js.map +1 -1
  241. package/build-module/components/global-styles/typography-panel.js +51 -5
  242. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  243. package/build-module/components/global-styles/use-global-styles-output.js +13 -18
  244. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  245. package/build-module/components/global-styles/utils.js +5 -5
  246. package/build-module/components/global-styles/utils.js.map +1 -1
  247. package/build-module/components/iframe/index.js +37 -49
  248. package/build-module/components/iframe/index.js.map +1 -1
  249. package/build-module/components/iframe/use-compatibility-styles.js +5 -0
  250. package/build-module/components/iframe/use-compatibility-styles.js.map +1 -1
  251. package/build-module/components/image-editor/aspect-ratio-dropdown.js +1 -1
  252. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  253. package/build-module/components/image-editor/use-save-image.js +1 -2
  254. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  255. package/build-module/components/image-size-control/index.js +5 -0
  256. package/build-module/components/image-size-control/index.js.map +1 -1
  257. package/build-module/components/index.js +1 -0
  258. package/build-module/components/index.js.map +1 -1
  259. package/build-module/components/inner-blocks/index.js +3 -1
  260. package/build-module/components/inner-blocks/index.js.map +1 -1
  261. package/build-module/components/inner-blocks/index.native.js +3 -1
  262. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  263. package/build-module/components/inner-blocks/use-nested-settings-update.js +30 -7
  264. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  265. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +2 -2
  266. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  267. package/build-module/components/inserter/block-patterns-tab.js +7 -33
  268. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  269. package/build-module/components/inserter/hooks/use-block-types-state.js +3 -4
  270. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  271. package/build-module/components/inserter/hooks/use-patterns-state.js +9 -3
  272. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  273. package/build-module/components/inserter/index.js +2 -4
  274. package/build-module/components/inserter/index.js.map +1 -1
  275. package/build-module/components/inserter/index.native.js +22 -33
  276. package/build-module/components/inserter/index.native.js.map +1 -1
  277. package/build-module/components/inserter/media-tab/hooks.js +2 -21
  278. package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
  279. package/build-module/components/inserter/reusable-block-rename-hint.js +67 -0
  280. package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -0
  281. package/build-module/components/inserter/reusable-blocks-tab.js +5 -2
  282. package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
  283. package/build-module/components/inserter/reusable-blocks-tab.native.js +2 -2
  284. package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  285. package/build-module/components/inserter/tabs.native.js +1 -1
  286. package/build-module/components/inserter/tabs.native.js.map +1 -1
  287. package/build-module/components/inserter-draggable-blocks/index.js +9 -2
  288. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  289. package/build-module/components/link-control/constants.js +1 -1
  290. package/build-module/components/link-control/constants.js.map +1 -1
  291. package/build-module/components/link-control/index.js +21 -16
  292. package/build-module/components/link-control/index.js.map +1 -1
  293. package/build-module/components/link-control/search-create-button.js +7 -20
  294. package/build-module/components/link-control/search-create-button.js.map +1 -1
  295. package/build-module/components/link-control/search-input.js +4 -4
  296. package/build-module/components/link-control/search-input.js.map +1 -1
  297. package/build-module/components/link-control/search-item.js +14 -28
  298. package/build-module/components/link-control/search-item.js.map +1 -1
  299. package/build-module/components/link-control/search-results.js +3 -3
  300. package/build-module/components/link-control/search-results.js.map +1 -1
  301. package/build-module/components/link-control/settings-drawer.js +4 -5
  302. package/build-module/components/link-control/settings-drawer.js.map +1 -1
  303. package/build-module/components/list-view/appender.js +2 -6
  304. package/build-module/components/list-view/appender.js.map +1 -1
  305. package/build-module/components/list-view/use-list-view-client-ids.js +2 -2
  306. package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
  307. package/build-module/components/media-placeholder/index.native.js +66 -33
  308. package/build-module/components/media-placeholder/index.native.js.map +1 -1
  309. package/build-module/components/preview-options/index.js +2 -2
  310. package/build-module/components/preview-options/index.js.map +1 -1
  311. package/build-module/components/provider/index.js +5 -2
  312. package/build-module/components/provider/index.js.map +1 -1
  313. package/build-module/components/provider/use-block-sync.js +21 -0
  314. package/build-module/components/provider/use-block-sync.js.map +1 -1
  315. package/build-module/components/resolution-tool/index.js +45 -0
  316. package/build-module/components/resolution-tool/index.js.map +1 -0
  317. package/build-module/components/rich-text/content.js +1 -36
  318. package/build-module/components/rich-text/content.js.map +1 -1
  319. package/build-module/components/rich-text/get-rich-text-values.js +105 -0
  320. package/build-module/components/rich-text/get-rich-text-values.js.map +1 -0
  321. package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
  322. package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
  323. package/build-module/components/spacing-sizes-control/input-controls/axial.js +7 -3
  324. package/build-module/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
  325. package/build-module/components/spacing-sizes-control/input-controls/separated.js +6 -2
  326. package/build-module/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
  327. package/build-module/components/spacing-sizes-control/input-controls/single.js +6 -2
  328. package/build-module/components/spacing-sizes-control/input-controls/single.js.map +1 -1
  329. package/build-module/components/spacing-sizes-control/utils.js +1 -1
  330. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  331. package/build-module/components/url-input/index.js +4 -2
  332. package/build-module/components/url-input/index.js.map +1 -1
  333. package/build-module/components/use-block-display-information/index.js +7 -3
  334. package/build-module/components/use-block-display-information/index.js.map +1 -1
  335. package/build-module/components/use-block-drop-zone/index.native.js +50 -8
  336. package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
  337. package/build-module/components/use-setting/index.js +5 -9
  338. package/build-module/components/use-setting/index.js.map +1 -1
  339. package/build-module/components/writing-flow/use-tab-nav.js +8 -26
  340. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  341. package/build-module/components/writing-mode-control/index.js +57 -0
  342. package/build-module/components/writing-mode-control/index.js.map +1 -0
  343. package/build-module/hooks/behaviors.js +26 -20
  344. package/build-module/hooks/behaviors.js.map +1 -1
  345. package/build-module/hooks/margin.js +1 -1
  346. package/build-module/hooks/margin.js.map +1 -1
  347. package/build-module/hooks/padding.js +1 -1
  348. package/build-module/hooks/padding.js.map +1 -1
  349. package/build-module/hooks/supports.js +7 -1
  350. package/build-module/hooks/supports.js.map +1 -1
  351. package/build-module/hooks/typography.js +2 -1
  352. package/build-module/hooks/typography.js.map +1 -1
  353. package/build-module/hooks/utils.js +6 -9
  354. package/build-module/hooks/utils.js.map +1 -1
  355. package/build-module/private-apis.js +11 -2
  356. package/build-module/private-apis.js.map +1 -1
  357. package/build-module/private-apis.native.js +2 -0
  358. package/build-module/private-apis.native.js.map +1 -1
  359. package/build-module/store/actions.js +193 -3
  360. package/build-module/store/actions.js.map +1 -1
  361. package/build-module/store/defaults.js +1 -0
  362. package/build-module/store/defaults.js.map +1 -1
  363. package/build-module/store/index.js +10 -1
  364. package/build-module/store/index.js.map +1 -1
  365. package/build-module/store/private-actions.js +45 -36
  366. package/build-module/store/private-actions.js.map +1 -1
  367. package/build-module/store/private-selectors.js +5 -5
  368. package/build-module/store/private-selectors.js.map +1 -1
  369. package/build-module/store/reducer.js +22 -9
  370. package/build-module/store/reducer.js.map +1 -1
  371. package/build-module/store/selectors.js +49 -21
  372. package/build-module/store/selectors.js.map +1 -1
  373. package/build-module/utils/object.js +34 -2
  374. package/build-module/utils/object.js.map +1 -1
  375. package/build-style/content-rtl.css +4 -0
  376. package/build-style/content.css +4 -0
  377. package/build-style/style-rtl.css +137 -129
  378. package/build-style/style.css +137 -129
  379. package/package.json +33 -32
  380. package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -6
  381. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -5
  382. package/src/components/block-controls/README.md +89 -0
  383. package/src/components/block-draggable/index.js +13 -4
  384. package/src/components/block-draggable/index.native.js +7 -3
  385. package/src/components/block-draggable/style.scss +1 -0
  386. package/src/components/block-draggable/test/index.native.js +0 -54
  387. package/src/components/block-edit/edit.js +26 -9
  388. package/src/components/block-edit/test/edit.js +1 -1
  389. package/src/components/block-heading-level-dropdown/heading-level-icon.js +6 -1
  390. package/src/components/block-heading-level-dropdown/index.native.js +8 -4
  391. package/src/components/block-inspector/style.scss +2 -1
  392. package/src/components/block-list/block-outline.native.js +26 -25
  393. package/src/components/block-list/block.native.js +24 -38
  394. package/src/components/block-list/block.native.scss +18 -40
  395. package/src/components/block-list/style.native.scss +3 -3
  396. package/src/components/block-lock/toolbar.js +34 -6
  397. package/src/components/block-mover/index.native.js +3 -3
  398. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +16 -6
  399. package/src/components/block-parent-selector/index.js +13 -8
  400. package/src/components/block-removal-warning-modal/index.js +17 -33
  401. package/src/components/block-settings/button.native.js +12 -6
  402. package/src/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +19 -18
  403. package/src/components/block-toolbar/index.js +11 -9
  404. package/src/components/block-toolbar/index.native.js +86 -6
  405. package/src/components/{block-mobile-toolbar/test/block-actions-menu.native.js → block-toolbar/test/block-toolbar-menu.native.js} +20 -54
  406. package/src/components/block-toolbar/test/index.native.js +42 -0
  407. package/src/components/block-tools/block-contextual-toolbar.js +5 -11
  408. package/src/components/block-tools/style.scss +73 -26
  409. package/src/components/button-block-appender/styles.native.scss +2 -2
  410. package/src/components/caption/README.md +49 -0
  411. package/src/components/colors-gradients/control.js +3 -2
  412. package/src/components/default-block-appender/content.scss +11 -0
  413. package/src/components/dimensions-tool/aspect-ratio-tool.js +124 -0
  414. package/src/components/dimensions-tool/index.js +212 -0
  415. package/src/components/dimensions-tool/scale-tool.js +124 -0
  416. package/src/components/dimensions-tool/stories/aspect-ratio-tool.js +52 -0
  417. package/src/components/dimensions-tool/stories/index.js +54 -0
  418. package/src/components/dimensions-tool/stories/scale-tool.js +48 -0
  419. package/src/components/dimensions-tool/stories/width-height-tool.js +54 -0
  420. package/src/components/dimensions-tool/test/index.js +641 -0
  421. package/src/components/dimensions-tool/width-height-tool.js +113 -0
  422. package/src/components/font-family/README.md +71 -0
  423. package/src/components/global-styles/color-panel.js +24 -17
  424. package/src/components/global-styles/dimensions-panel.js +8 -2
  425. package/src/components/global-styles/filters-panel.js +2 -2
  426. package/src/components/global-styles/get-block-css-selector.js +5 -9
  427. package/src/components/global-styles/hooks.js +22 -26
  428. package/src/components/global-styles/typography-panel.js +57 -5
  429. package/src/components/global-styles/use-global-styles-output.js +36 -18
  430. package/src/components/global-styles/utils.js +15 -6
  431. package/src/components/iframe/index.js +30 -56
  432. package/src/components/iframe/use-compatibility-styles.js +5 -0
  433. package/src/components/image-editor/aspect-ratio-dropdown.js +1 -1
  434. package/src/components/image-editor/use-save-image.js +0 -1
  435. package/src/components/image-size-control/index.js +6 -0
  436. package/src/components/index.js +1 -0
  437. package/src/components/inner-blocks/README.md +10 -0
  438. package/src/components/inner-blocks/index.js +4 -0
  439. package/src/components/inner-blocks/index.native.js +4 -0
  440. package/src/components/inner-blocks/use-nested-settings-update.js +32 -5
  441. package/src/components/inserter/block-patterns-explorer/patterns-list.js +8 -2
  442. package/src/components/inserter/block-patterns-tab.js +8 -56
  443. package/src/components/inserter/hooks/use-block-types-state.js +3 -4
  444. package/src/components/inserter/hooks/use-patterns-state.js +35 -19
  445. package/src/components/inserter/index.js +2 -3
  446. package/src/components/inserter/index.native.js +17 -36
  447. package/src/components/inserter/media-tab/hooks.js +2 -22
  448. package/src/components/inserter/reusable-block-rename-hint.js +69 -0
  449. package/src/components/inserter/reusable-blocks-tab.js +5 -1
  450. package/src/components/inserter/reusable-blocks-tab.native.js +2 -2
  451. package/src/components/inserter/style.native.scss +10 -15
  452. package/src/components/inserter/style.scss +28 -0
  453. package/src/components/inserter/tabs.native.js +5 -1
  454. package/src/components/inserter-draggable-blocks/index.js +13 -2
  455. package/src/components/link-control/constants.js +1 -1
  456. package/src/components/link-control/index.js +36 -29
  457. package/src/components/link-control/search-create-button.js +8 -26
  458. package/src/components/link-control/search-input.js +4 -3
  459. package/src/components/link-control/search-item.js +21 -43
  460. package/src/components/link-control/search-results.js +48 -46
  461. package/src/components/link-control/settings-drawer.js +6 -5
  462. package/src/components/link-control/style.scss +58 -123
  463. package/src/components/link-control/test/index.js +161 -123
  464. package/src/components/list-view/appender.js +5 -6
  465. package/src/components/list-view/style.scss +1 -2
  466. package/src/components/list-view/use-list-view-client-ids.js +2 -2
  467. package/src/components/media-placeholder/index.native.js +108 -59
  468. package/src/components/media-placeholder/styles.native.scss +59 -24
  469. package/src/components/media-replace-flow/test/index.js +1 -1
  470. package/src/components/panel-color-settings/README.md +98 -0
  471. package/src/components/preview-options/README.md +18 -17
  472. package/src/components/preview-options/index.js +2 -2
  473. package/src/components/provider/index.js +9 -2
  474. package/src/components/provider/test/use-block-sync.js +21 -6
  475. package/src/components/provider/use-block-sync.js +19 -0
  476. package/src/components/recursion-provider/README.md +101 -0
  477. package/src/components/resolution-tool/index.js +56 -0
  478. package/src/components/resolution-tool/stories/index.js +48 -0
  479. package/src/components/rich-text/content.js +1 -46
  480. package/src/components/rich-text/get-rich-text-values.js +105 -0
  481. package/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
  482. package/src/components/spacing-sizes-control/input-controls/axial.js +17 -2
  483. package/src/components/spacing-sizes-control/input-controls/separated.js +17 -2
  484. package/src/components/spacing-sizes-control/input-controls/single.js +12 -2
  485. package/src/components/spacing-sizes-control/utils.js +1 -1
  486. package/src/components/text-transform-control/README.md +44 -0
  487. package/src/components/url-input/index.js +2 -0
  488. package/src/components/use-block-display-information/index.js +12 -5
  489. package/src/components/use-block-drop-zone/index.native.js +65 -28
  490. package/src/components/use-setting/index.js +8 -8
  491. package/src/components/writing-flow/use-tab-nav.js +10 -33
  492. package/src/components/writing-mode-control/index.js +68 -0
  493. package/src/components/writing-mode-control/style.scss +18 -0
  494. package/src/hooks/behaviors.js +25 -16
  495. package/src/hooks/margin.js +4 -1
  496. package/src/hooks/padding.js +4 -1
  497. package/src/hooks/supports.js +7 -0
  498. package/src/hooks/typography.js +2 -0
  499. package/src/hooks/utils.js +8 -7
  500. package/src/private-apis.js +13 -1
  501. package/src/private-apis.native.js +2 -0
  502. package/src/store/actions.js +195 -3
  503. package/src/store/defaults.js +1 -0
  504. package/src/store/index.js +10 -0
  505. package/src/store/private-actions.js +39 -39
  506. package/src/store/private-selectors.js +5 -8
  507. package/src/store/reducer.js +22 -9
  508. package/src/store/selectors.js +87 -25
  509. package/src/store/test/actions.js +114 -0
  510. package/src/store/test/private-actions.js +56 -0
  511. package/src/store/test/private-selectors.js +5 -5
  512. package/src/store/test/reducer.js +14 -7
  513. package/src/store/test/selectors.js +1 -1
  514. package/src/utils/object.js +32 -2
  515. package/src/utils/test/object.js +36 -0
  516. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +0 -1
  517. package/build/components/block-mobile-toolbar/index.native.js +0 -135
  518. package/build/components/block-mobile-toolbar/index.native.js.map +0 -1
  519. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +0 -1
  520. package/build-module/components/block-mobile-toolbar/index.native.js +0 -116
  521. package/build-module/components/block-mobile-toolbar/index.native.js.map +0 -1
  522. package/src/components/block-mobile-toolbar/index.native.js +0 -127
  523. package/src/components/block-mobile-toolbar/style.native.scss +0 -16
  524. /package/src/components/{block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap → block-toolbar/test/__snapshots__/block-toolbar-menu.native.js.snap} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-results.js"],"names":["LinkControlSearchResults","instanceId","withCreateSuggestion","currentInputValue","handleSuggestionClick","suggestionsListProps","buildSuggestionItemProps","suggestions","selectedSuggestion","isLoading","isInitialSuggestions","createSuggestionButtonText","suggestionsQuery","resultsListClasses","isSingleDirectEntryResult","length","LINK_ENTRY_TYPES","includes","type","shouldShowCreateSuggestion","shouldShowSuggestionsTypes","searchResultsLabelId","labelText","searchResultsLabel","map","suggestion","index","CREATE_TYPE","id","isFrontPage"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AAKA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AAKe,SAASA,wBAAT,CAAmC;AACjDC,EAAAA,UADiD;AAEjDC,EAAAA,oBAFiD;AAGjDC,EAAAA,iBAHiD;AAIjDC,EAAAA,qBAJiD;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EAAG,MACTP,qBAAqB,CAAEqB,UAAF,CAJvB,CAMC;AACA;AACA;AARD;AASC,QAAA,GAAG,EAAGA,UAAU,CAACP,IATlB;AAUC,QAAA,SAAS,EAAGZ,wBAAwB,CACnCmB,UADmC,EAEnCC,KAFmC,CAVrC;AAcC,QAAA,UAAU,EAAGA,KAAK,KAAKlB;AAdxB,QADD;AAkBA,KAvB0C,CAyB3C;AACA;;;AACA,QAAKmB,2BAAgBF,UAAU,CAACP,IAAhC,EAAuC;AACtC,aAAO,IAAP;AACA;;AAED,WACC,4BAAC,mBAAD;AACC,MAAA,GAAG,EAAI,GAAGO,UAAU,CAACG,EAAI,IAAIH,UAAU,CAACP,IAAM,EAD/C;AAEC,MAAA,SAAS,EAAGZ,wBAAwB,CACnCmB,UADmC,EAEnCC,KAFmC,CAFrC;AAMC,MAAA,UAAU,EAAGD,UANd;AAOC,MAAA,KAAK,EAAGC,KAPT;AAQC,MAAA,OAAO,EAAG,MAAM;AACftB,QAAAA,qBAAqB,CAAEqB,UAAF,CAArB;AACA,OAVF;AAWC,MAAA,UAAU,EAAGC,KAAK,KAAKlB,kBAXxB;AAYC,MAAA,KAAK,EAAGQ,4BAAiBC,QAAjB,CACPQ,UAAU,CAACP,IADJ,CAZT;AAeC,MAAA,UAAU,EAAGf,iBAfd;AAgBC,MAAA,cAAc,EAAGiB,0BAhBlB;AAiBC,MAAA,WAAW,EAAGK,UAAU,EAAEI;AAjB3B,MADD;AAqBA,GApDC,CALH,CAFD,CADD;AAgEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { VisuallyHidden } from '@wordpress/components';\n\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSearchCreate from './search-create-button';\nimport LinkControlSearchItem from './search-item';\nimport { CREATE_TYPE, LINK_ENTRY_TYPES } from './constants';\n\nexport default function LinkControlSearchResults( {\n\tinstanceId,\n\twithCreateSuggestion,\n\tcurrentInputValue,\n\thandleSuggestionClick,\n\tsuggestionsListProps,\n\tbuildSuggestionItemProps,\n\tsuggestions,\n\tselectedSuggestion,\n\tisLoading,\n\tisInitialSuggestions,\n\tcreateSuggestionButtonText,\n\tsuggestionsQuery,\n} ) {\n\tconst resultsListClasses = classnames(\n\t\t'block-editor-link-control__search-results',\n\t\t{\n\t\t\t'is-loading': isLoading,\n\t\t}\n\t);\n\n\tconst isSingleDirectEntryResult =\n\t\tsuggestions.length === 1 &&\n\t\tLINK_ENTRY_TYPES.includes( suggestions[ 0 ].type );\n\tconst shouldShowCreateSuggestion =\n\t\twithCreateSuggestion &&\n\t\t! isSingleDirectEntryResult &&\n\t\t! isInitialSuggestions;\n\t// If the query has a specified type, then we can skip showing them in the result. See #24839.\n\tconst shouldShowSuggestionsTypes = ! suggestionsQuery?.type;\n\n\t// According to guidelines aria-label should be added if the label\n\t// itself is not visible.\n\t// See: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role\n\tconst searchResultsLabelId = `block-editor-link-control-search-results-label-${ instanceId }`;\n\tconst labelText = isInitialSuggestions\n\t\t? __( 'Suggestions' )\n\t\t: sprintf(\n\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t__( 'Search results for \"%s\"' ),\n\t\t\t\tcurrentInputValue\n\t\t );\n\tconst searchResultsLabel = (\n\t\t<VisuallyHidden id={ searchResultsLabelId }>\n\t\t\t{ labelText }\n\t\t</VisuallyHidden>\n\t);\n\n\treturn (\n\t\t<div className=\"block-editor-link-control__search-results-wrapper\">\n\t\t\t{ searchResultsLabel }\n\t\t\t<div\n\t\t\t\t{ ...suggestionsListProps }\n\t\t\t\tclassName={ resultsListClasses }\n\t\t\t\taria-labelledby={ searchResultsLabelId }\n\t\t\t>\n\t\t\t\t{ suggestions.map( ( suggestion, index ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tshouldShowCreateSuggestion &&\n\t\t\t\t\t\tCREATE_TYPE === suggestion.type\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<LinkControlSearchCreate\n\t\t\t\t\t\t\t\tsearchTerm={ currentInputValue }\n\t\t\t\t\t\t\t\tbuttonText={ createSuggestionButtonText }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\thandleSuggestionClick( suggestion )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Intentionally only using `type` here as\n\t\t\t\t\t\t\t\t// the constant is enough to uniquely\n\t\t\t\t\t\t\t\t// identify the single \"CREATE\" suggestion.\n\t\t\t\t\t\t\t\tkey={ suggestion.type }\n\t\t\t\t\t\t\t\titemProps={ buildSuggestionItemProps(\n\t\t\t\t\t\t\t\t\tsuggestion,\n\t\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tisSelected={ index === selectedSuggestion }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// If we're not handling \"Create\" suggestions above then\n\t\t\t\t\t// we don't want them in the main results so exit early.\n\t\t\t\t\tif ( CREATE_TYPE === suggestion.type ) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<LinkControlSearchItem\n\t\t\t\t\t\t\tkey={ `${ suggestion.id }-${ suggestion.type }` }\n\t\t\t\t\t\t\titemProps={ buildSuggestionItemProps(\n\t\t\t\t\t\t\t\tsuggestion,\n\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tsuggestion={ suggestion }\n\t\t\t\t\t\t\tindex={ index }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\thandleSuggestionClick( suggestion );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisSelected={ index === selectedSuggestion }\n\t\t\t\t\t\t\tisURL={ LINK_ENTRY_TYPES.includes(\n\t\t\t\t\t\t\t\tsuggestion.type\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tsearchTerm={ currentInputValue }\n\t\t\t\t\t\t\tshouldShowType={ shouldShowSuggestionsTypes }\n\t\t\t\t\t\t\tisFrontPage={ suggestion?.isFrontPage }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-results.js"],"names":["LinkControlSearchResults","instanceId","withCreateSuggestion","currentInputValue","handleSuggestionClick","suggestionsListProps","buildSuggestionItemProps","suggestions","selectedSuggestion","isLoading","isInitialSuggestions","createSuggestionButtonText","suggestionsQuery","resultsListClasses","isSingleDirectEntryResult","length","LINK_ENTRY_TYPES","includes","type","shouldShowCreateSuggestion","shouldShowSuggestionsTypes","searchResultsLabelId","labelText","searchResultsLabel","map","suggestion","index","CREATE_TYPE","id","isFrontPage"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AAKA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AAKe,SAASA,wBAAT,CAAmC;AACjDC,EAAAA,UADiD;AAEjDC,EAAAA,oBAFiD;AAGjDC,EAAAA,iBAHiD;AAIjDC,EAAAA,qBAJiD;AAKjDC,EAAAA,oBALiD;AAMjDC,EAAAA,wBANiD;AAOjDC,EAAAA,WAPiD;AAQjDC,EAAAA,kBARiD;AASjDC,EAAAA,SATiD;AAUjDC,EAAAA,oBAViD;AAWjDC,EAAAA,0BAXiD;AAYjDC,EAAAA;AAZiD,CAAnC,EAaX;AACH,QAAMC,kBAAkB,GAAG,yBAC1B,2CAD0B,EAE1B;AACC,kBAAcJ;AADf,GAF0B,CAA3B;;AAOA,QAAMK,yBAAyB,GAC9BP,WAAW,CAACQ,MAAZ,KAAuB,CAAvB,IACAC,4BAAiBC,QAAjB,CAA2BV,WAAW,CAAE,CAAF,CAAX,CAAi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,UAAU,CAACG,EAAI,IAAIH,UAAU,CAACP,IAAM,EAD/C;AAEC,MAAA,SAAS,EAAGZ,wBAAwB,CACnCmB,UADmC,EAEnCC,KAFmC,CAFrC;AAMC,MAAA,UAAU,EAAGD,UANd;AAOC,MAAA,KAAK,EAAGC,KAPT;AAQC,MAAA,OAAO,EAAG,MAAM;AACftB,QAAAA,qBAAqB,CAAEqB,UAAF,CAArB;AACA,OAVF;AAWC,MAAA,UAAU,EAAGC,KAAK,KAAKlB,kBAXxB;AAYC,MAAA,KAAK,EAAGQ,4BAAiBC,QAAjB,CACPQ,UAAU,CAACP,IADJ,CAZT;AAeC,MAAA,UAAU,EAAGf,iBAfd;AAgBC,MAAA,cAAc,EAAGiB,0BAhBlB;AAiBC,MAAA,WAAW,EAAGK,UAAU,EAAEI;AAjB3B,MADD;AAqBA,GApDC,CADH,CALD,CAFD,CADD;AAkEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { VisuallyHidden, MenuGroup } from '@wordpress/components';\n\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSearchCreate from './search-create-button';\nimport LinkControlSearchItem from './search-item';\nimport { CREATE_TYPE, LINK_ENTRY_TYPES } from './constants';\n\nexport default function LinkControlSearchResults( {\n\tinstanceId,\n\twithCreateSuggestion,\n\tcurrentInputValue,\n\thandleSuggestionClick,\n\tsuggestionsListProps,\n\tbuildSuggestionItemProps,\n\tsuggestions,\n\tselectedSuggestion,\n\tisLoading,\n\tisInitialSuggestions,\n\tcreateSuggestionButtonText,\n\tsuggestionsQuery,\n} ) {\n\tconst resultsListClasses = classnames(\n\t\t'block-editor-link-control__search-results',\n\t\t{\n\t\t\t'is-loading': isLoading,\n\t\t}\n\t);\n\n\tconst isSingleDirectEntryResult =\n\t\tsuggestions.length === 1 &&\n\t\tLINK_ENTRY_TYPES.includes( suggestions[ 0 ].type );\n\tconst shouldShowCreateSuggestion =\n\t\twithCreateSuggestion &&\n\t\t! isSingleDirectEntryResult &&\n\t\t! isInitialSuggestions;\n\t// If the query has a specified type, then we can skip showing them in the result. See #24839.\n\tconst shouldShowSuggestionsTypes = ! suggestionsQuery?.type;\n\n\t// According to guidelines aria-label should be added if the label\n\t// itself is not visible.\n\t// See: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role\n\tconst searchResultsLabelId = `block-editor-link-control-search-results-label-${ instanceId }`;\n\tconst labelText = isInitialSuggestions\n\t\t? __( 'Suggestions' )\n\t\t: sprintf(\n\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t__( 'Search results for \"%s\"' ),\n\t\t\t\tcurrentInputValue\n\t\t );\n\tconst searchResultsLabel = (\n\t\t<VisuallyHidden id={ searchResultsLabelId }>\n\t\t\t{ labelText }\n\t\t</VisuallyHidden>\n\t);\n\n\treturn (\n\t\t<div className=\"block-editor-link-control__search-results-wrapper\">\n\t\t\t{ searchResultsLabel }\n\t\t\t<div\n\t\t\t\t{ ...suggestionsListProps }\n\t\t\t\tclassName={ resultsListClasses }\n\t\t\t\taria-labelledby={ searchResultsLabelId }\n\t\t\t>\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t{ suggestions.map( ( suggestion, index ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tshouldShowCreateSuggestion &&\n\t\t\t\t\t\t\tCREATE_TYPE === suggestion.type\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<LinkControlSearchCreate\n\t\t\t\t\t\t\t\t\tsearchTerm={ currentInputValue }\n\t\t\t\t\t\t\t\t\tbuttonText={ createSuggestionButtonText }\n\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\thandleSuggestionClick( suggestion )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t// Intentionally only using `type` here as\n\t\t\t\t\t\t\t\t\t// the constant is enough to uniquely\n\t\t\t\t\t\t\t\t\t// identify the single \"CREATE\" suggestion.\n\t\t\t\t\t\t\t\t\tkey={ suggestion.type }\n\t\t\t\t\t\t\t\t\titemProps={ buildSuggestionItemProps(\n\t\t\t\t\t\t\t\t\t\tsuggestion,\n\t\t\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tisSelected={ index === selectedSuggestion }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// If we're not handling \"Create\" suggestions above then\n\t\t\t\t\t\t// we don't want them in the main results so exit early.\n\t\t\t\t\t\tif ( CREATE_TYPE === suggestion.type ) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<LinkControlSearchItem\n\t\t\t\t\t\t\t\tkey={ `${ suggestion.id }-${ suggestion.type }` }\n\t\t\t\t\t\t\t\titemProps={ buildSuggestionItemProps(\n\t\t\t\t\t\t\t\t\tsuggestion,\n\t\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tsuggestion={ suggestion }\n\t\t\t\t\t\t\t\tindex={ index }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\thandleSuggestionClick( suggestion );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tisSelected={ index === selectedSuggestion }\n\t\t\t\t\t\t\t\tisURL={ LINK_ENTRY_TYPES.includes(\n\t\t\t\t\t\t\t\t\tsuggestion.type\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tsearchTerm={ currentInputValue }\n\t\t\t\t\t\t\t\tshouldShowType={ shouldShowSuggestionsTypes }\n\t\t\t\t\t\t\t\tisFrontPage={ suggestion?.isFrontPage }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</MenuGroup>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
@@ -32,10 +32,9 @@ function LinkSettingsDrawer({
32
32
  className: "block-editor-link-control__drawer-toggle",
33
33
  "aria-expanded": settingsOpen,
34
34
  onClick: () => setSettingsOpen(!settingsOpen),
35
- icon: _icons.settings,
36
- label: (0, _i18n.__)('Link Settings'),
35
+ icon: (0, _i18n.isRTL)() ? _icons.chevronLeftSmall : _icons.chevronRightSmall,
37
36
  "aria-controls": settingsDrawerId
38
- }), (0, _element.createElement)(MaybeAnimatePresence, null, settingsOpen && (0, _element.createElement)(MaybeMotionDiv, {
37
+ }, (0, _i18n._x)('Advanced', 'Additional link settings')), (0, _element.createElement)(MaybeAnimatePresence, null, settingsOpen && (0, _element.createElement)(MaybeMotionDiv, {
39
38
  className: "block-editor-link-control__drawer",
40
39
  hidden: !settingsOpen,
41
40
  id: settingsDrawerId,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/settings-drawer.js"],"names":["LinkSettingsDrawer","children","settingsOpen","setSettingsOpen","prefersReducedMotion","MaybeAnimatePresence","Fragment","AnimatePresence","MaybeMotionDiv","motion","div","id","settingsDrawerId","settingsIcon","open","opacity","height","collapsed","duration"],"mappings":";;;;;;;AAWA;;AARA;;AAKA;;AACA;;AACA;;AAVA;AACA;AACA;AAWA,SAASA,kBAAT,CAA6B;AAAEC,EAAAA,QAAF;AAAYC,EAAAA,YAAZ;AAA0BC,EAAAA;AAA1B,CAA7B,EAA2E;AAC1E,QAAMC,oBAAoB,GAAG,gCAA7B;AACA,QAAMC,oBAAoB,GAAGD,oBAAoB,GAC9CE,iBAD8C,GAE9CC,qCAFH;AAGA,QAAMC,cAAc,GAAGJ,oBAAoB,GAAG,KAAH,GAAWK,6BAAOC,GAA7D;AAEA,QAAMC,EAAE,GAAG,4BAAeX,kBAAf,CAAX;AAEA,QAAMY,gBAAgB,GAAI,gCAAgCD,EAAI,EAA9D;AAEA,SACC,qDACC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,qBAAgBT,YAFjB;AAGC,IAAA,OAAO,EAAG,MAAMC,eAAe,CAAE,CAAED,YAAJ,CAHhC;AAIC,IAAA,IAAI,EAAGW,eAJR;AAKC,IAAA,KAAK,EAAG,cAAI,eAAJ,CALT;AAMC,qBAAgBD;AANjB,IADD,EASC,4BAAC,oBAAD,QACGV,YAAY,IACb,4BAAC,cAAD;AACC,IAAA,SAAS,EAAC,mCADX;AAEC,IAAA,MAAM,EAAG,CAAEA,YAFZ;AAGC,IAAA,EAAE,EAAGU,gBAHN;AAIC,IAAA,OAAO,EAAC,WAJT;AAKC,IAAA,OAAO,EAAC,MALT;AAMC,IAAA,IAAI,EAAC,WANN;AAOC,IAAA,QAAQ,EAAG;AACVE,MAAAA,IAAI,EAAE;AAAEC,QAAAA,OAAO,EAAE,CAAX;AAAcC,QAAAA,MAAM,EAAE;AAAtB,OADI;AAEVC,MAAAA,SAAS,EAAE;AAAEF,QAAAA,OAAO,EAAE,CAAX;AAAcC,QAAAA,MAAM,EAAE;AAAtB;AAFD,KAPZ;AAWC,IAAA,UAAU,EAAG;AACZE,MAAAA,QAAQ,EAAE;AADE;AAXd,KAeC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGjB,QADH,CAfD,CAFF,CATD,CADD;AAmCA;;eAEcD,kB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { settings as settingsIcon } from '@wordpress/icons';\nimport { useReducedMotion, useInstanceId } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { Fragment } from '@wordpress/element';\n\nfunction LinkSettingsDrawer( { children, settingsOpen, setSettingsOpen } ) {\n\tconst prefersReducedMotion = useReducedMotion();\n\tconst MaybeAnimatePresence = prefersReducedMotion\n\t\t? Fragment\n\t\t: AnimatePresence;\n\tconst MaybeMotionDiv = prefersReducedMotion ? 'div' : motion.div;\n\n\tconst id = useInstanceId( LinkSettingsDrawer );\n\n\tconst settingsDrawerId = `link-control-settings-drawer-${ id }`;\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName=\"block-editor-link-control__drawer-toggle\"\n\t\t\t\taria-expanded={ settingsOpen }\n\t\t\t\tonClick={ () => setSettingsOpen( ! settingsOpen ) }\n\t\t\t\ticon={ settingsIcon }\n\t\t\t\tlabel={ __( 'Link Settings' ) }\n\t\t\t\taria-controls={ settingsDrawerId }\n\t\t\t/>\n\t\t\t<MaybeAnimatePresence>\n\t\t\t\t{ settingsOpen && (\n\t\t\t\t\t<MaybeMotionDiv\n\t\t\t\t\t\tclassName=\"block-editor-link-control__drawer\"\n\t\t\t\t\t\thidden={ ! settingsOpen }\n\t\t\t\t\t\tid={ settingsDrawerId }\n\t\t\t\t\t\tinitial=\"collapsed\"\n\t\t\t\t\t\tanimate=\"open\"\n\t\t\t\t\t\texit=\"collapsed\"\n\t\t\t\t\t\tvariants={ {\n\t\t\t\t\t\t\topen: { opacity: 1, height: 'auto' },\n\t\t\t\t\t\t\tcollapsed: { opacity: 0, height: 0 },\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\tduration: 0.1,\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"block-editor-link-control__drawer-inner\">\n\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</MaybeMotionDiv>\n\t\t\t\t) }\n\t\t\t</MaybeAnimatePresence>\n\t\t</>\n\t);\n}\n\nexport default LinkSettingsDrawer;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/settings-drawer.js"],"names":["LinkSettingsDrawer","children","settingsOpen","setSettingsOpen","prefersReducedMotion","MaybeAnimatePresence","Fragment","AnimatePresence","MaybeMotionDiv","motion","div","id","settingsDrawerId","chevronLeftSmall","chevronRightSmall","open","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A,QAAQ,EAAE;AADE;AAXd,KAeC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGlB,QADH,CAfD,CAFF,CAVD,CADD;AAoCA;;eAEcD,kB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { chevronLeftSmall, chevronRightSmall } from '@wordpress/icons';\nimport { useReducedMotion, useInstanceId } from '@wordpress/compose';\nimport { _x, isRTL } from '@wordpress/i18n';\nimport { Fragment } from '@wordpress/element';\n\nfunction LinkSettingsDrawer( { children, settingsOpen, setSettingsOpen } ) {\n\tconst prefersReducedMotion = useReducedMotion();\n\tconst MaybeAnimatePresence = prefersReducedMotion\n\t\t? Fragment\n\t\t: AnimatePresence;\n\tconst MaybeMotionDiv = prefersReducedMotion ? 'div' : motion.div;\n\n\tconst id = useInstanceId( LinkSettingsDrawer );\n\n\tconst settingsDrawerId = `link-control-settings-drawer-${ id }`;\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName=\"block-editor-link-control__drawer-toggle\"\n\t\t\t\taria-expanded={ settingsOpen }\n\t\t\t\tonClick={ () => setSettingsOpen( ! settingsOpen ) }\n\t\t\t\ticon={ isRTL() ? chevronLeftSmall : chevronRightSmall }\n\t\t\t\taria-controls={ settingsDrawerId }\n\t\t\t>\n\t\t\t\t{ _x( 'Advanced', 'Additional link settings' ) }\n\t\t\t</Button>\n\t\t\t<MaybeAnimatePresence>\n\t\t\t\t{ settingsOpen && (\n\t\t\t\t\t<MaybeMotionDiv\n\t\t\t\t\t\tclassName=\"block-editor-link-control__drawer\"\n\t\t\t\t\t\thidden={ ! settingsOpen }\n\t\t\t\t\t\tid={ settingsDrawerId }\n\t\t\t\t\t\tinitial=\"collapsed\"\n\t\t\t\t\t\tanimate=\"open\"\n\t\t\t\t\t\texit=\"collapsed\"\n\t\t\t\t\t\tvariants={ {\n\t\t\t\t\t\t\topen: { opacity: 1, height: 'auto' },\n\t\t\t\t\t\t\tcollapsed: { opacity: 0, height: 0 },\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\tduration: 0.1,\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"block-editor-link-control__drawer-inner\">\n\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</MaybeMotionDiv>\n\t\t\t\t) }\n\t\t\t</MaybeAnimatePresence>\n\t\t</>\n\t);\n}\n\nexport default LinkSettingsDrawer;\n"]}
@@ -45,16 +45,12 @@ const Appender = (0, _element.forwardRef)(({
45
45
  setInsertedBlock
46
46
  } = (0, _context.useListViewContext)();
47
47
  const instanceId = (0, _compose.useInstanceId)(Appender);
48
- const {
49
- hideInserter
50
- } = (0, _data.useSelect)(select => {
48
+ const hideInserter = (0, _data.useSelect)(select => {
51
49
  const {
52
50
  getTemplateLock,
53
51
  __unstableGetEditorMode
54
52
  } = select(_store.store);
55
- return {
56
- hideInserter: !!getTemplateLock(clientId) || __unstableGetEditorMode() === 'zoom-out'
57
- };
53
+ return !!getTemplateLock(clientId) || __unstableGetEditorMode() === 'zoom-out';
58
54
  }, [clientId]);
59
55
  const blockTitle = (0, _useBlockDisplayTitle.default)({
60
56
  clientId,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/appender.js"],"names":["Appender","nestingLevel","blockCount","clientId","props","ref","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;;AACA;;AAhBA;AACA;AACA;;AAOA;AACA;AACA;AAOO,MAAMA,QAAQ,GAAG,yBACvB,CAAE;AAAEC,EAAAA,YAAF;AAAgBC,EAAAA,UAA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EC,IAAA,YAAY,EAAGF,QAFhB;AAGC,IAAA,QAAQ,EAAC,cAHV;AAIC,IAAA,UAAU,MAJX;AAKC,IAAA,mBAAmB,EAAG,KALvB;AAMC,IAAA,kBAAkB,EAAG,KANtB;AAOC,IAAA,qBAAqB,MAPtB;AAAA,OAQMC,KARN;AASC,IAAA,WAAW,EAAG;AAAE,0BAAoBc;AAAtB,KATf;AAUC,IAAA,eAAe,EAAKE,kBAAF,IAA0B;AAC3C,UAAKA,kBAAkB,EAAEjB,QAAzB,EAAoC;AACnCI,QAAAA,gBAAgB,CAAEa,kBAAF,CAAhB;AACA;AACD;AAdF,IADD,EAiBC,4BAAC,2BAAD;AAAoB,IAAA,EAAE,EAAGF;AAAzB,KACGC,WADH,CAjBD,CADD;AAuBA,CAhFsB,CAAjB","sourcesContent":["/**\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';\nimport AriaReferencedText from './aria-referenced-text';\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<AriaReferencedText id={ descriptionId }>\n\t\t\t\t\t{ description }\n\t\t\t\t</AriaReferencedText>\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","nestingLevel","blockCount","clientId","props","ref","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;;AACA;;AAhBA;AACA;AACA;;AAOA;AACA;AACA;AAOO,MAAMA,QAAQ,GAAG,yBACvB,CAAE;AAAEC,EAAAA,YAAF;AAAgBC,EAAAA,UAAhB;AAA4BC,EAAAA,QAA5B;AAAsC,KAAGC;AAAzC,CAAF,EAAoDC,GAApD,KAA6D;AAC5D,QAAM;AAAEC,IAAAA,aAAF;AAAiBC,IAAAA;AAAjB,MAAsC,kCAA5C;AAEA,QAAMC,UAAU,GAAG,4BAAeR,QAAf,CAAnB;AACA,QAAMS,YAAY,GAAG,qBAClBC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,eAAF;AAAmBC,MAAAA;AAAnB,QACLF,MAAM,CAAEG,YAAF,CADP;AAGA,WACC,CAAC,CAAEF,eAAe,CAAER,QAAF,CAAlB,IACAS,uBAAuB,OAAO,UAF/B;AAIA,GATmB,EAUpB,CAAET,QAAF,CAVoB,CAArB;AAaA,QAAMW,UAAU,GAAG,mCAAsB;AACxCX,IAAAA,QADwC;AAExCY,IAAAA,OAAO,EAAE;AAF+B,GAAtB,CAAnB;AAKA,QAAMC,kBAAkB,GAAG,mCAAsB;AAChDb,IAAAA,QAAQ,EAAEG,aAAa,EAAEH,QADuB;AAEhDY,IAAAA,OAAO,EAAE;AAFuC,GAAtB,CAA3B;AAKA,0BAAW,MAAM;AAChB,QAAK,CAAEC,kBAAkB,EAAEC,MAA3B,EAAoC;AACnC;AACA;;AAED,qBACC,oBACC;AACA,kBAAI,mBAAJ,CAFD,EAGCD,kBAHD,CADD,EAMC,WAND;AAQA,GAbD,EAaG,CAAEA,kBAAF,CAbH;;AAeA,MAAKP,YAAL,EAAoB;AACnB,WAAO,IAAP;AACA;;AAED,QAAMS,aAAa,GAAI,uBAAuBV,UAAY,EAA1D;AACA,QAAMW,WAAW,GAAG;AACnB;AACA,gBAAI,mDAAJ,CAFmB,EAGnBL,UAHmB,EAInBZ,UAAU,GAAG,CAJM,EAKnBD,YALmB,CAApB;AAQA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,iBAAD;AACC,IAAA,GAAG,EAAGI,GADP;AAEC,IAAA,YAAY,EAAGF,QAFhB;AAGC,IAAA,QAAQ,EAAC,cAHV;AAIC,IAAA,UAAU,MAJX;AAKC,IAAA,mBAAmB,EAAG,KALvB;AAMC,IAAA,kBAAkB,EAAG,KANtB;AAOC,IAAA,qBAAqB,MAPtB;AAAA,OAQMC,KARN;AASC,IAAA,WAAW,EAAG;AAAE,0BAAoBc;AAAtB,KATf;AAUC,IAAA,eAAe,EAAKE,kBAAF,IAA0B;AAC3C,UAAKA,kBAAkB,EAAEjB,QAAzB,EAAoC;AACnCI,QAAAA,gBAAgB,CAAEa,kBAAF,CAAhB;AACA;AACD;AAdF,IADD,EAiBC,4BAAC,2BAAD;AAAoB,IAAA,EAAE,EAAGF;AAAzB,KACGC,WADH,CAjBD,CADD;AAuBA,CA/EsB,CAAjB","sourcesContent":["/**\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';\nimport AriaReferencedText from './aria-referenced-text';\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\t!! getTemplateLock( clientId ) ||\n\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<AriaReferencedText id={ descriptionId }>\n\t\t\t\t\t{ description }\n\t\t\t\t</AriaReferencedText>\n\t\t\t</div>\n\t\t);\n\t}\n);\n"]}
@@ -26,12 +26,12 @@ function useListViewClientIds({
26
26
  const {
27
27
  getDraggedBlockClientIds,
28
28
  getSelectedBlockClientIds,
29
- getListViewClientIdsTree
29
+ getEnabledClientIdsTree
30
30
  } = (0, _lockUnlock.unlock)(select(_store.store));
31
31
  return {
32
32
  selectedClientIds: getSelectedBlockClientIds(),
33
33
  draggedClientIds: getDraggedBlockClientIds(),
34
- clientIdsTree: blocks !== null && blocks !== void 0 ? blocks : getListViewClientIdsTree(rootClientId)
34
+ clientIdsTree: blocks !== null && blocks !== void 0 ? blocks : getEnabledClientIdsTree(rootClientId)
35
35
  };
36
36
  }, [blocks, rootClientId]);
37
37
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/use-list-view-client-ids.js"],"names":["useListViewClientIds","blocks","rootClientId","select","getDraggedBlockClientIds","getSelectedBlockClientIds","getListViewClientIdsTree","blockEditorStore","selectedClientIds","draggedClientIds","clientIdsTree"],"mappings":";;;;;;;AAIA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIe,SAASA,oBAAT,CAA+B;AAAEC,EAAAA,MAAF;AAAUC,EAAAA;AAAV,CAA/B,EAA0D;AACxE,SAAO,qBACJC,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,wBADK;AAELC,MAAAA,yBAFK;AAGLC,MAAAA;AAHK,QAIF,wBAAQH,MAAM,CAAEI,YAAF,CAAd,CAJJ;AAMA,WAAO;AACNC,MAAAA,iBAAiB,EAAEH,yBAAyB,EADtC;AAENI,MAAAA,gBAAgB,EAAEL,wBAAwB,EAFpC;AAGNM,MAAAA,aAAa,EACZT,MADY,aACZA,MADY,cACZA,MADY,GACFK,wBAAwB,CAAEJ,YAAF;AAJ7B,KAAP;AAMA,GAdK,EAeN,CAAED,MAAF,EAAUC,YAAV,CAfM,CAAP;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport default function useListViewClientIds( { blocks, rootClientId } ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetDraggedBlockClientIds,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tgetListViewClientIdsTree,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\treturn {\n\t\t\t\tselectedClientIds: getSelectedBlockClientIds(),\n\t\t\t\tdraggedClientIds: getDraggedBlockClientIds(),\n\t\t\t\tclientIdsTree:\n\t\t\t\t\tblocks ?? getListViewClientIdsTree( rootClientId ),\n\t\t\t};\n\t\t},\n\t\t[ blocks, rootClientId ]\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/use-list-view-client-ids.js"],"names":["useListViewClientIds","blocks","rootClientId","select","getDraggedBlockClientIds","getSelectedBlockClientIds","getEnabledClientIdsTree","blockEditorStore","selectedClientIds","draggedClientIds","clientIdsTree"],"mappings":";;;;;;;AAIA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIe,SAASA,oBAAT,CAA+B;AAAEC,EAAAA,MAAF;AAAUC,EAAAA;AAAV,CAA/B,EAA0D;AACxE,SAAO,qBACJC,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,wBADK;AAELC,MAAAA,yBAFK;AAGLC,MAAAA;AAHK,QAIF,wBAAQH,MAAM,CAAEI,YAAF,CAAd,CAJJ;AAMA,WAAO;AACNC,MAAAA,iBAAiB,EAAEH,yBAAyB,EADtC;AAENI,MAAAA,gBAAgB,EAAEL,wBAAwB,EAFpC;AAGNM,MAAAA,aAAa,EACZT,MADY,aACZA,MADY,cACZA,MADY,GACFK,uBAAuB,CAAEJ,YAAF;AAJ5B,KAAP;AAMA,GAdK,EAeN,CAAED,MAAF,EAAUC,YAAV,CAfM,CAAP;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport default function useListViewClientIds( { blocks, rootClientId } ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetDraggedBlockClientIds,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tgetEnabledClientIdsTree,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\treturn {\n\t\t\t\tselectedClientIds: getSelectedBlockClientIds(),\n\t\t\t\tdraggedClientIds: getDraggedBlockClientIds(),\n\t\t\t\tclientIdsTree:\n\t\t\t\t\tblocks ?? getEnabledClientIdsTree( rootClientId ),\n\t\t\t};\n\t\t},\n\t\t[ blocks, rootClientId ]\n\t);\n}\n"]}
@@ -11,6 +11,8 @@ var _element = require("@wordpress/element");
11
11
 
12
12
  var _reactNative = require("react-native");
13
13
 
14
+ var _changeCase = require("change-case");
15
+
14
16
  var _i18n = require("@wordpress/i18n");
15
17
 
16
18
  var _blockEditor = require("@wordpress/block-editor");
@@ -21,6 +23,8 @@ var _icons = require("@wordpress/icons");
21
23
 
22
24
  var _styles = _interopRequireDefault(require("./styles.scss"));
23
25
 
26
+ var _context = require("../block-edit/context");
27
+
24
28
  /**
25
29
  * External dependencies
26
30
  */
@@ -37,10 +41,18 @@ const isMediaEqual = (media1, media2) => media1.id === media2.id || media1.url =
37
41
 
38
42
  const dedupMedia = media => media.reduce((dedupedMedia, mediaItem) => dedupedMedia.some(item => isMediaEqual(item, mediaItem)) ? dedupedMedia : [...dedupedMedia, mediaItem], []);
39
43
 
44
+ const hitSlop = {
45
+ top: 22,
46
+ bottom: 22,
47
+ left: 22,
48
+ right: 22
49
+ };
50
+
40
51
  function MediaPlaceholder(props) {
41
52
  const {
42
53
  addToGallery,
43
54
  allowedTypes = [],
55
+ className = '',
44
56
  labels = {},
45
57
  icon,
46
58
  onSelect,
@@ -48,7 +60,6 @@ function MediaPlaceholder(props) {
48
60
  __experimentalOnlyMediaLibrary,
49
61
  isAppender,
50
62
  disableMediaButtons,
51
- getStylesFromColorScheme,
52
63
  multiple,
53
64
  value = [],
54
65
  children,
@@ -60,7 +71,12 @@ function MediaPlaceholder(props) {
60
71
  } = props; // Use ref to keep media array current for callbacks during rerenders.
61
72
 
62
73
  const mediaRef = (0, _element.useRef)(value);
63
- mediaRef.current = value; // Append and deduplicate media array for gallery use case.
74
+ mediaRef.current = value;
75
+ const blockEditContext = (0, _context.useBlockEditContext)();
76
+ const onButtonPress = (0, _element.useCallback)(open => event => {
77
+ onFocus?.(event);
78
+ open();
79
+ }, [onFocus]); // Append and deduplicate media array for gallery use case.
64
80
 
65
81
  const setMedia = multiple && addToGallery ? selected => onSelect(dedupMedia([...mediaRef.current, ...selected])) : onSelect;
66
82
  const isOneType = allowedTypes.length === 1;
@@ -105,36 +121,65 @@ function MediaPlaceholder(props) {
105
121
  accessibilityHint = (0, _i18n.__)('Double tap to select an audio file');
106
122
  }
107
123
 
108
- const emptyStateTitleStyle = getStylesFromColorScheme(_styles.default.emptyStateTitle, _styles.default.emptyStateTitleDark);
109
- const addMediaButtonStyle = getStylesFromColorScheme(_styles.default.addMediaButton, _styles.default.addMediaButtonDark);
110
-
111
- const renderContent = () => {
124
+ const titleStyles = (0, _compose.usePreferredColorSchemeStyle)(_styles.default['media-placeholder__header-title'], _styles.default['media-placeholder__header-title--dark']);
125
+ const addMediaButtonStyle = (0, _compose.usePreferredColorSchemeStyle)(_styles.default.addMediaButton, _styles.default.addMediaButtonDark);
126
+ const buttonStyles = (0, _compose.usePreferredColorSchemeStyle)(_styles.default['media-placeholder__button'], _styles.default['media-placeholder__button--dark']);
127
+ const emptyStateDescriptionStyles = (0, _compose.usePreferredColorSchemeStyle)(_styles.default.emptyStateDescription, _styles.default.emptyStateDescriptionDark);
128
+ const iconStyles = (0, _compose.usePreferredColorSchemeStyle)(_styles.default['media-placeholder__header-icon'], _styles.default['media-placeholder__header-icon--dark']);
129
+ const placeholderIcon = (0, _element.cloneElement)(icon, {
130
+ fill: iconStyles.fill
131
+ });
132
+ const accessibilityLabel = (0, _i18n.sprintf)(
133
+ /* translators: accessibility text for the media block empty state. %s: media type */
134
+ (0, _i18n.__)('%s block. Empty'), placeholderTitle);
135
+
136
+ const renderContent = open => {
112
137
  if (isAppender === undefined || !isAppender) {
113
138
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_reactNative.View, {
114
- style: _styles.default.modalIcon
115
- }, icon), (0, _element.createElement)(_reactNative.Text, {
116
- style: emptyStateTitleStyle
117
- }, placeholderTitle), children, (0, _element.createElement)(_reactNative.Text, {
118
- style: _styles.default.emptyStateDescription
119
- }, instructions));
139
+ style: _styles.default['media-placeholder__header']
140
+ }, (0, _element.createElement)(_reactNative.View, {
141
+ style: iconStyles
142
+ }, placeholderIcon), (0, _element.createElement)(_reactNative.Text, {
143
+ style: titleStyles
144
+ }, placeholderTitle)), children, (0, _element.createElement)(_reactNative.TouchableOpacity, {
145
+ activeOpacity: 0.5,
146
+ accessibilityLabel: accessibilityLabel,
147
+ style: buttonStyles,
148
+ accessibilityRole: 'button',
149
+ accessibilityHint: accessibilityHint,
150
+ hitSlop: hitSlop,
151
+ onPress: onButtonPress(open)
152
+ }, (0, _element.createElement)(_reactNative.Text, {
153
+ style: emptyStateDescriptionStyles
154
+ }, (0, _changeCase.sentenceCase)(instructions))));
120
155
  } else if (isAppender && !disableMediaButtons) {
121
- return (0, _element.createElement)(_reactNative.View, {
156
+ return (0, _element.createElement)(_reactNative.TouchableOpacity, {
157
+ activeOpacity: 0.5,
158
+ accessibilityLabel: accessibilityLabel,
159
+ style: _styles.default['media-placeholder__appender'],
160
+ accessibilityRole: 'button',
161
+ accessibilityHint: accessibilityHint,
162
+ hitSlop: hitSlop,
163
+ onPress: onButtonPress(open)
164
+ }, (0, _element.createElement)(_reactNative.View, {
122
165
  testID: "media-placeholder-appender-icon"
123
166
  }, (0, _element.createElement)(_icons.Icon, {
124
167
  icon: _icons.plusCircleFilled,
125
168
  style: addMediaButtonStyle,
126
169
  color: addMediaButtonStyle.color,
127
170
  size: addMediaButtonStyle.size
128
- }));
171
+ })));
129
172
  }
130
173
  };
131
174
 
175
+ const appenderStyle = (0, _compose.usePreferredColorSchemeStyle)(_styles.default.appender, _styles.default.appenderDark);
176
+ const containerSelectedStyle = (0, _compose.usePreferredColorSchemeStyle)(_styles.default['media-placeholder__container-selected'], _styles.default['media-placeholder__container-selected--dark']);
177
+ const containerStyle = [(0, _compose.usePreferredColorSchemeStyle)(_styles.default['media-placeholder__container'], _styles.default['media-placeholder__container--dark']), blockEditContext?.isSelected && !className.includes('no-block-outline') && containerSelectedStyle];
178
+
132
179
  if (isAppender && disableMediaButtons) {
133
180
  return null;
134
181
  }
135
182
 
136
- const appenderStyle = getStylesFromColorScheme(_styles.default.appender, _styles.default.appenderDark);
137
- const emptyStateContainerStyle = getStylesFromColorScheme(_styles.default.emptyStateContainer, _styles.default.emptyStateContainerDark);
138
183
  return (0, _element.createElement)(_reactNative.View, {
139
184
  style: {
140
185
  flex: 1
@@ -151,28 +196,17 @@ function MediaPlaceholder(props) {
151
196
  open,
152
197
  getMediaOptions
153
198
  }) => {
154
- return (0, _element.createElement)(_reactNative.TouchableWithoutFeedback, {
155
- accessibilityLabel: (0, _i18n.sprintf)(
156
- /* translators: accessibility text for the media block empty state. %s: media type */
157
- (0, _i18n.__)('%s block. Empty'), placeholderTitle),
158
- accessibilityRole: 'button',
159
- accessibilityHint: accessibilityHint,
160
- onPress: event => {
161
- onFocus?.(event);
162
- open();
163
- }
164
- }, (0, _element.createElement)(_reactNative.View, {
165
- style: [[emptyStateContainerStyle, height && {
199
+ return (0, _element.createElement)(_reactNative.View, {
200
+ style: [[containerStyle, height && {
166
201
  height
167
202
  }, backgroundColor && {
168
203
  backgroundColor
169
204
  }], isAppender && appenderStyle]
170
- }, getMediaOptions(), !hideContent && renderContent()));
205
+ }, getMediaOptions(), !hideContent && renderContent(open));
171
206
  }
172
207
  }));
173
208
  }
174
209
 
175
- var _default = (0, _compose.withPreferredColorScheme)(MediaPlaceholder);
176
-
210
+ var _default = MediaPlaceholder;
177
211
  exports.default = _default;
178
212
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/media-placeholder/index.native.js"],"names":["isMediaEqual","media1","media2","id","url","dedupMedia","media","reduce","dedupedMedia","mediaItem","some","item","MediaPlaceholder","props","addToGallery","allowedTypes","labels","icon","onSelect","onFocus","__experimentalOnlyMediaLibrary","isAppender","disableMediaButtons","getStylesFromColorScheme","multiple","value","children","height","backgroundColor","hideContent","autoOpenMediaUpload","onSelectURL","mediaRef","current","setMedia","selected","isOneType","length","isImage","includes","MEDIA_TYPE_IMAGE","isVideo","MEDIA_TYPE_VIDEO","isAudio","MEDIA_TYPE_AUDIO","placeholderTitle","title","undefined","instructions","accessibilityHint","emptyStateTitleStyle","styles","emptyStateTitle","emptyStateTitleDark","addMediaButtonStyle","addMediaButton","addMediaButtonDark","renderContent","modalIcon","emptyStateDescription","plusCircleFilled","color","size","appenderStyle","appender","appenderDark","emptyStateContainerStyle","emptyStateContainer","emptyStateContainerDark","flex","open","getMediaOptions","event"],"mappings":";;;;;;;;;AAgBA;;AAbA;;AAKA;;AACA;;AAMA;;AAEA;;AAKA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;;AAYA;AACA;AACA;AAGA,MAAMA,YAAY,GAAG,CAAEC,MAAF,EAAUC,MAAV,KACpBD,MAAM,CAACE,EAAP,KAAcD,MAAM,CAACC,EAArB,IAA2BF,MAAM,CAACG,GAAP,KAAeF,MAAM,CAACE,GADlD,C,CAGA;;;AACA,MAAMC,UAAU,GAAKC,KAAF,IAClBA,KAAK,CAACC,MAAN,CACC,CAAEC,YAAF,EAAgBC,SAAhB,KACCD,YAAY,CAACE,IAAb,CAAqBC,IAAF,IAAYX,YAAY,CAAEW,IAAF,EAAQF,SAAR,CAA3C,IACGD,YADH,GAEG,CAAE,GAAGA,YAAL,EAAmBC,SAAnB,CAJL,EAKC,EALD,CADD;;AASA,SAASG,gBAAT,CAA2BC,KAA3B,EAAmC;AAClC,QAAM;AACLC,IAAAA,YADK;AAELC,IAAAA,YAAY,GAAG,EAFV;AAGLC,IAAAA,MAAM,GAAG,EAHJ;AAILC,IAAAA,IAJK;AAKLC,IAAAA,QALK;AAMLC,IAAAA,OANK;AAOLC,IAAAA,8BAPK;AAQLC,IAAAA,UARK;AASLC,IAAAA,mBATK;AAULC,IAAAA,wBAVK;AAWLC,IAAAA,QAXK;AAYLC,IAAAA,KAAK,GAAG,EAZH;AAaLC,IAAAA,QAbK;AAcLC,IAAAA,MAdK;AAeLC,IAAAA,eAfK;AAgBLC,IAAAA,WAhBK;AAiBLC,IAAAA,mBAjBK;AAkBLC,IAAAA;AAlBK,MAmBFlB,KAnBJ,CADkC,CAsBlC;;AACA,QAAMmB,QAAQ,GAAG,qBAAQP,KAAR,CAAjB;AACAO,EAAAA,QAAQ,CAACC,OAAT,GAAmBR,KAAnB,CAxBkC,CA0BlC;;AACA,QAAMS,QAAQ,GACbV,QAAQ,IAA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,uCAA0B7C,gBAA1B,C","sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text, TouchableWithoutFeedback } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tMediaUpload,\n\tMEDIA_TYPE_IMAGE,\n\tMEDIA_TYPE_VIDEO,\n\tMEDIA_TYPE_AUDIO,\n} from '@wordpress/block-editor';\nimport { withPreferredColorScheme } from '@wordpress/compose';\nimport { useRef } from '@wordpress/element';\nimport { Icon, plusCircleFilled } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\n\nconst isMediaEqual = ( media1, media2 ) =>\n\tmedia1.id === media2.id || media1.url === media2.url;\n\n// Remove duplicates after gallery append.\nconst dedupMedia = ( media ) =>\n\tmedia.reduce(\n\t\t( dedupedMedia, mediaItem ) =>\n\t\t\tdedupedMedia.some( ( item ) => isMediaEqual( item, mediaItem ) )\n\t\t\t\t? dedupedMedia\n\t\t\t\t: [ ...dedupedMedia, mediaItem ],\n\t\t[]\n\t);\n\nfunction MediaPlaceholder( props ) {\n\tconst {\n\t\taddToGallery,\n\t\tallowedTypes = [],\n\t\tlabels = {},\n\t\ticon,\n\t\tonSelect,\n\t\tonFocus,\n\t\t__experimentalOnlyMediaLibrary,\n\t\tisAppender,\n\t\tdisableMediaButtons,\n\t\tgetStylesFromColorScheme,\n\t\tmultiple,\n\t\tvalue = [],\n\t\tchildren,\n\t\theight,\n\t\tbackgroundColor,\n\t\thideContent,\n\t\tautoOpenMediaUpload,\n\t\tonSelectURL,\n\t} = props;\n\n\t// Use ref to keep media array current for callbacks during rerenders.\n\tconst mediaRef = useRef( value );\n\tmediaRef.current = value;\n\n\t// Append and deduplicate media array for gallery use case.\n\tconst setMedia =\n\t\tmultiple && addToGallery\n\t\t\t? ( selected ) =>\n\t\t\t\t\tonSelect(\n\t\t\t\t\t\tdedupMedia( [ ...mediaRef.current, ...selected ] )\n\t\t\t\t\t)\n\t\t\t: onSelect;\n\n\tconst isOneType = allowedTypes.length === 1;\n\tconst isImage = isOneType && allowedTypes.includes( MEDIA_TYPE_IMAGE );\n\tconst isVideo = isOneType && allowedTypes.includes( MEDIA_TYPE_VIDEO );\n\tconst isAudio = isOneType && allowedTypes.includes( MEDIA_TYPE_AUDIO );\n\n\tlet placeholderTitle = labels.title;\n\tif ( placeholderTitle === undefined ) {\n\t\tplaceholderTitle = __( 'Media' );\n\t\tif ( isImage ) {\n\t\t\tplaceholderTitle = __( 'Image' );\n\t\t} else if ( isVideo ) {\n\t\t\tplaceholderTitle = __( 'Video' );\n\t\t} else if ( isAudio ) {\n\t\t\tplaceholderTitle = __( 'Audio' );\n\t\t}\n\t}\n\n\tlet instructions = labels.instructions;\n\tif ( instructions === undefined ) {\n\t\tif ( isImage ) {\n\t\t\tinstructions = __( 'ADD IMAGE' );\n\t\t} else if ( isVideo ) {\n\t\t\tinstructions = __( 'ADD VIDEO' );\n\t\t} else if ( isAudio ) {\n\t\t\tinstructions = __( 'ADD AUDIO' );\n\t\t} else {\n\t\t\tinstructions = __( 'ADD IMAGE OR VIDEO' );\n\t\t}\n\t}\n\n\tlet accessibilityHint = __( 'Double tap to select' );\n\tif ( isImage ) {\n\t\taccessibilityHint = __( 'Double tap to select an image' );\n\t} else if ( isVideo ) {\n\t\taccessibilityHint = __( 'Double tap to select a video' );\n\t} else if ( isAudio ) {\n\t\taccessibilityHint = __( 'Double tap to select an audio file' );\n\t}\n\n\tconst emptyStateTitleStyle = getStylesFromColorScheme(\n\t\tstyles.emptyStateTitle,\n\t\tstyles.emptyStateTitleDark\n\t);\n\tconst addMediaButtonStyle = getStylesFromColorScheme(\n\t\tstyles.addMediaButton,\n\t\tstyles.addMediaButtonDark\n\t);\n\n\tconst renderContent = () => {\n\t\tif ( isAppender === undefined || ! isAppender ) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<View style={ styles.modalIcon }>{ icon }</View>\n\t\t\t\t\t<Text style={ emptyStateTitleStyle }>\n\t\t\t\t\t\t{ placeholderTitle }\n\t\t\t\t\t</Text>\n\t\t\t\t\t{ children }\n\t\t\t\t\t<Text style={ styles.emptyStateDescription }>\n\t\t\t\t\t\t{ instructions }\n\t\t\t\t\t</Text>\n\t\t\t\t</>\n\t\t\t);\n\t\t} else if ( isAppender && ! disableMediaButtons ) {\n\t\t\treturn (\n\t\t\t\t<View testID=\"media-placeholder-appender-icon\">\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={ plusCircleFilled }\n\t\t\t\t\t\tstyle={ addMediaButtonStyle }\n\t\t\t\t\t\tcolor={ addMediaButtonStyle.color }\n\t\t\t\t\t\tsize={ addMediaButtonStyle.size }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t);\n\t\t}\n\t};\n\n\tif ( isAppender && disableMediaButtons ) {\n\t\treturn null;\n\t}\n\n\tconst appenderStyle = getStylesFromColorScheme(\n\t\tstyles.appender,\n\t\tstyles.appenderDark\n\t);\n\tconst emptyStateContainerStyle = getStylesFromColorScheme(\n\t\tstyles.emptyStateContainer,\n\t\tstyles.emptyStateContainerDark\n\t);\n\n\treturn (\n\t\t<View style={ { flex: 1 } }>\n\t\t\t<MediaUpload\n\t\t\t\tallowedTypes={ allowedTypes }\n\t\t\t\tonSelect={ setMedia }\n\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t__experimentalOnlyMediaLibrary={\n\t\t\t\t\t__experimentalOnlyMediaLibrary\n\t\t\t\t}\n\t\t\t\tmultiple={ multiple }\n\t\t\t\tisReplacingMedia={ false }\n\t\t\t\tautoOpen={ autoOpenMediaUpload }\n\t\t\t\trender={ ( { open, getMediaOptions } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<TouchableWithoutFeedback\n\t\t\t\t\t\t\taccessibilityLabel={ sprintf(\n\t\t\t\t\t\t\t\t/* translators: accessibility text for the media block empty state. %s: media type */\n\t\t\t\t\t\t\t\t__( '%s block. Empty' ),\n\t\t\t\t\t\t\t\tplaceholderTitle\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\t\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\t\t\t\t\tonPress={ ( event ) => {\n\t\t\t\t\t\t\t\tonFocus?.( event );\n\t\t\t\t\t\t\t\topen();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<View\n\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\temptyStateContainerStyle,\n\t\t\t\t\t\t\t\t\t\theight && { height },\n\t\t\t\t\t\t\t\t\t\tbackgroundColor && { backgroundColor },\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\tisAppender && appenderStyle,\n\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ getMediaOptions() }\n\t\t\t\t\t\t\t\t{ ! hideContent && renderContent() }\n\t\t\t\t\t\t\t</View>\n\t\t\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t/>\n\t\t</View>\n\t);\n}\n\nexport default withPreferredColorScheme( MediaPlaceholder );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/media-placeholder/index.native.js"],"names":["isMediaEqual","media1","media2","id","url","dedupMedia","media","reduce","dedupedMedia","mediaItem","some","item","hitSlop","top","bottom","left","right","MediaPlaceholder","props","addToGallery","allowedTypes","className","labels","icon","onSelect","onFocus","__experimentalOnlyMediaLibrary","isAppender","disableMediaButtons","multiple","value","children","height","backgroundColor","hideContent","autoOpenMediaUpload","onSelectURL","mediaRef","current","blockEditContext","onButtonPress","open","event","setMedia","selected","isOneType","length","isImage","includes","MEDIA_TYPE_IMAGE","isVideo","MEDIA_TYPE_VIDEO","isAudio","MEDIA_TYPE_AUDIO","placeholderTitle","title","undefined","instructions","accessibilityHint","titleStyles","styles","addMediaButtonStyle","addMediaButton","addMediaButtonDark","buttonStyles","emptyStateDescriptionStyles","emptyStateDescription","emptyStateDescriptionDark","iconStyles","placeholderIcon","fill","accessibilityLabel","renderContent","plusCircleFilled","color","size","appenderStyle","appender","appenderDark","containerSelectedStyle","containerStyle","isSelected","flex","getMediaOptions"],"mappings":";;;;;;;;;AAiBA;;AAdA;;AACA;;AAKA;;AACA;;AAMA;;AAEA;;AAKA;;AACA;;AAxBA;AACA;AACA;;AAIA;AACA;AACA;;AAYA;AACA;AACA;AAIA,MAAMA,YAAY,GAAG,CAAEC,MAAF,EAAUC,MAAV,KACpBD,MAAM,CAACE,EAAP,KAAcD,MAAM,CAACC,EAArB,IAA2BF,MAAM,CAACG,GAAP,KAAeF,MAAM,CAACE,GADlD,C,CAGA;;;AACA,MAAMC,UAAU,GAAKC,KAAF,IAClBA,KAAK,CAACC,MAAN,CACC,CAAEC,YAAF,EAAgBC,SAAhB,KACCD,YAAY,CAACE,IAAb,CAAqBC,IAAF,IAAYX,YAAY,CAAEW,IAAF,EAAQF,SAAR,CAA3C,IACGD,YADH,GAEG,CAAE,GAAGA,YAAL,EAAmBC,SAAnB,CAJL,EAKC,EALD,CADD;;AASA,MAAMG,OAAO,GAAG;AAAEC,EAAAA,GAAG,EAAE,EAAP;AAAWC,EAAAA,MAAM,EAAE,EAAnB;AAAuBC,EAAAA,IAAI,EAAE,EAA7B;AAAiCC,EAAAA,KAAK,EAAE;AAAxC,CAAhB;;AAEA,SAASC,gBAAT,CAA2BC,KAA3B,EAAmC;AAClC,QAAM;AACLC,IAAAA,YADK;AAELC,IAAAA,YAAY,GAAG,EAFV;AAGLC,IAAAA,SAAS,GAAG,EAHP;AAILC,IAAAA,MAAM,GAAG,EAJJ;AAKLC,IAAAA,IALK;AAMLC,IAAAA,QANK;AAOLC,IAAAA,OAPK;AAQLC,IAAAA,8BARK;AASLC,IAAAA,UATK;AAULC,IAAAA,mBAVK;AAWLC,IAAAA,QAXK;AAYLC,IAAAA,KAAK,GAAG,EA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AiC;AACzC,aACC,4BAAC,iBAAD;AACC,QAAA,KAAK,EAAG,CACP,CACCH,cADD,EAEChD,MAAM,IAAI;AAAEA,UAAAA;AAAF,SAFX,EAGCC,eAAe,IAAI;AAAEA,UAAAA;AAAF,SAHpB,CADO,EAMPN,UAAU,IAAIiD,aANP;AADT,SAUGO,eAAe,EAVlB,EAWG,CAAEjD,WAAF,IAAiBsC,aAAa,CAAE/B,IAAF,CAXjC,CADD;AAeA;AA1BF,IADD,CADD;AAgCA;;eAEcxB,gB","sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text, TouchableOpacity } from 'react-native';\nimport { sentenceCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tMediaUpload,\n\tMEDIA_TYPE_IMAGE,\n\tMEDIA_TYPE_VIDEO,\n\tMEDIA_TYPE_AUDIO,\n} from '@wordpress/block-editor';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport { cloneElement, useCallback, useRef } from '@wordpress/element';\nimport { Icon, plusCircleFilled } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\nimport { useBlockEditContext } from '../block-edit/context';\n\nconst isMediaEqual = ( media1, media2 ) =>\n\tmedia1.id === media2.id || media1.url === media2.url;\n\n// Remove duplicates after gallery append.\nconst dedupMedia = ( media ) =>\n\tmedia.reduce(\n\t\t( dedupedMedia, mediaItem ) =>\n\t\t\tdedupedMedia.some( ( item ) => isMediaEqual( item, mediaItem ) )\n\t\t\t\t? dedupedMedia\n\t\t\t\t: [ ...dedupedMedia, mediaItem ],\n\t\t[]\n\t);\n\nconst hitSlop = { top: 22, bottom: 22, left: 22, right: 22 };\n\nfunction MediaPlaceholder( props ) {\n\tconst {\n\t\taddToGallery,\n\t\tallowedTypes = [],\n\t\tclassName = '',\n\t\tlabels = {},\n\t\ticon,\n\t\tonSelect,\n\t\tonFocus,\n\t\t__experimentalOnlyMediaLibrary,\n\t\tisAppender,\n\t\tdisableMediaButtons,\n\t\tmultiple,\n\t\tvalue = [],\n\t\tchildren,\n\t\theight,\n\t\tbackgroundColor,\n\t\thideContent,\n\t\tautoOpenMediaUpload,\n\t\tonSelectURL,\n\t} = props;\n\n\t// Use ref to keep media array current for callbacks during rerenders.\n\tconst mediaRef = useRef( value );\n\tmediaRef.current = value;\n\n\tconst blockEditContext = useBlockEditContext();\n\n\tconst onButtonPress = useCallback(\n\t\t( open ) => ( event ) => {\n\t\t\tonFocus?.( event );\n\t\t\topen();\n\t\t},\n\t\t[ onFocus ]\n\t);\n\n\t// Append and deduplicate media array for gallery use case.\n\tconst setMedia =\n\t\tmultiple && addToGallery\n\t\t\t? ( selected ) =>\n\t\t\t\t\tonSelect(\n\t\t\t\t\t\tdedupMedia( [ ...mediaRef.current, ...selected ] )\n\t\t\t\t\t)\n\t\t\t: onSelect;\n\n\tconst isOneType = allowedTypes.length === 1;\n\tconst isImage = isOneType && allowedTypes.includes( MEDIA_TYPE_IMAGE );\n\tconst isVideo = isOneType && allowedTypes.includes( MEDIA_TYPE_VIDEO );\n\tconst isAudio = isOneType && allowedTypes.includes( MEDIA_TYPE_AUDIO );\n\n\tlet placeholderTitle = labels.title;\n\tif ( placeholderTitle === undefined ) {\n\t\tplaceholderTitle = __( 'Media' );\n\t\tif ( isImage ) {\n\t\t\tplaceholderTitle = __( 'Image' );\n\t\t} else if ( isVideo ) {\n\t\t\tplaceholderTitle = __( 'Video' );\n\t\t} else if ( isAudio ) {\n\t\t\tplaceholderTitle = __( 'Audio' );\n\t\t}\n\t}\n\n\tlet instructions = labels.instructions;\n\tif ( instructions === undefined ) {\n\t\tif ( isImage ) {\n\t\t\tinstructions = __( 'ADD IMAGE' );\n\t\t} else if ( isVideo ) {\n\t\t\tinstructions = __( 'ADD VIDEO' );\n\t\t} else if ( isAudio ) {\n\t\t\tinstructions = __( 'ADD AUDIO' );\n\t\t} else {\n\t\t\tinstructions = __( 'ADD IMAGE OR VIDEO' );\n\t\t}\n\t}\n\n\tlet accessibilityHint = __( 'Double tap to select' );\n\tif ( isImage ) {\n\t\taccessibilityHint = __( 'Double tap to select an image' );\n\t} else if ( isVideo ) {\n\t\taccessibilityHint = __( 'Double tap to select a video' );\n\t} else if ( isAudio ) {\n\t\taccessibilityHint = __( 'Double tap to select an audio file' );\n\t}\n\n\tconst titleStyles = usePreferredColorSchemeStyle(\n\t\tstyles[ 'media-placeholder__header-title' ],\n\t\tstyles[ 'media-placeholder__header-title--dark' ]\n\t);\n\tconst addMediaButtonStyle = usePreferredColorSchemeStyle(\n\t\tstyles.addMediaButton,\n\t\tstyles.addMediaButtonDark\n\t);\n\tconst buttonStyles = usePreferredColorSchemeStyle(\n\t\tstyles[ 'media-placeholder__button' ],\n\t\tstyles[ 'media-placeholder__button--dark' ]\n\t);\n\tconst emptyStateDescriptionStyles = usePreferredColorSchemeStyle(\n\t\tstyles.emptyStateDescription,\n\t\tstyles.emptyStateDescriptionDark\n\t);\n\tconst iconStyles = usePreferredColorSchemeStyle(\n\t\tstyles[ 'media-placeholder__header-icon' ],\n\t\tstyles[ 'media-placeholder__header-icon--dark' ]\n\t);\n\tconst placeholderIcon = cloneElement( icon, {\n\t\tfill: iconStyles.fill,\n\t} );\n\tconst accessibilityLabel = sprintf(\n\t\t/* translators: accessibility text for the media block empty state. %s: media type */\n\t\t__( '%s block. Empty' ),\n\t\tplaceholderTitle\n\t);\n\n\tconst renderContent = ( open ) => {\n\t\tif ( isAppender === undefined || ! isAppender ) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<View style={ styles[ 'media-placeholder__header' ] }>\n\t\t\t\t\t\t<View style={ iconStyles }>{ placeholderIcon }</View>\n\t\t\t\t\t\t<Text style={ titleStyles }>{ placeholderTitle }</Text>\n\t\t\t\t\t</View>\n\t\t\t\t\t{ children }\n\t\t\t\t\t<TouchableOpacity\n\t\t\t\t\t\tactiveOpacity={ 0.5 }\n\t\t\t\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\t\t\t\thitSlop={ hitSlop }\n\t\t\t\t\t\tonPress={ onButtonPress( open ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Text style={ emptyStateDescriptionStyles }>\n\t\t\t\t\t\t\t{ sentenceCase( instructions ) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</TouchableOpacity>\n\t\t\t\t</>\n\t\t\t);\n\t\t} else if ( isAppender && ! disableMediaButtons ) {\n\t\t\treturn (\n\t\t\t\t<TouchableOpacity\n\t\t\t\t\tactiveOpacity={ 0.5 }\n\t\t\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\t\t\tstyle={ styles[ 'media-placeholder__appender' ] }\n\t\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\t\t\thitSlop={ hitSlop }\n\t\t\t\t\tonPress={ onButtonPress( open ) }\n\t\t\t\t>\n\t\t\t\t\t<View testID=\"media-placeholder-appender-icon\">\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\ticon={ plusCircleFilled }\n\t\t\t\t\t\t\tstyle={ addMediaButtonStyle }\n\t\t\t\t\t\t\tcolor={ addMediaButtonStyle.color }\n\t\t\t\t\t\t\tsize={ addMediaButtonStyle.size }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t</TouchableOpacity>\n\t\t\t);\n\t\t}\n\t};\n\n\tconst appenderStyle = usePreferredColorSchemeStyle(\n\t\tstyles.appender,\n\t\tstyles.appenderDark\n\t);\n\tconst containerSelectedStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'media-placeholder__container-selected' ],\n\t\tstyles[ 'media-placeholder__container-selected--dark' ]\n\t);\n\tconst containerStyle = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles[ 'media-placeholder__container' ],\n\t\t\tstyles[ 'media-placeholder__container--dark' ]\n\t\t),\n\t\tblockEditContext?.isSelected &&\n\t\t\t! className.includes( 'no-block-outline' ) &&\n\t\t\tcontainerSelectedStyle,\n\t];\n\n\tif ( isAppender && disableMediaButtons ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<View style={ { flex: 1 } }>\n\t\t\t<MediaUpload\n\t\t\t\tallowedTypes={ allowedTypes }\n\t\t\t\tonSelect={ setMedia }\n\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t__experimentalOnlyMediaLibrary={\n\t\t\t\t\t__experimentalOnlyMediaLibrary\n\t\t\t\t}\n\t\t\t\tmultiple={ multiple }\n\t\t\t\tisReplacingMedia={ false }\n\t\t\t\tautoOpen={ autoOpenMediaUpload }\n\t\t\t\trender={ ( { open, getMediaOptions } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<View\n\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\tcontainerStyle,\n\t\t\t\t\t\t\t\t\theight && { height },\n\t\t\t\t\t\t\t\t\tbackgroundColor && { backgroundColor },\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tisAppender && appenderStyle,\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ getMediaOptions() }\n\t\t\t\t\t\t\t{ ! hideContent && renderContent( open ) }\n\t\t\t\t\t\t</View>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t/>\n\t\t</View>\n\t);\n}\n\nexport default MediaPlaceholder;\n"]}
@@ -61,7 +61,7 @@ function PreviewOptions({
61
61
  menuProps: menuProps,
62
62
  icon: deviceIcons[deviceType.toLowerCase()],
63
63
  label: label || (0, _i18n.__)('Preview')
64
- }, () => (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.MenuGroup, null, (0, _element.createElement)(_components.MenuItem, {
64
+ }, renderProps => (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.MenuGroup, null, (0, _element.createElement)(_components.MenuItem, {
65
65
  className: "block-editor-post-preview__button-resize",
66
66
  onClick: () => setDeviceType('Desktop'),
67
67
  icon: deviceType === 'Desktop' && _icons.check
@@ -73,6 +73,6 @@ function PreviewOptions({
73
73
  className: "block-editor-post-preview__button-resize",
74
74
  onClick: () => setDeviceType('Mobile'),
75
75
  icon: deviceType === 'Mobile' && _icons.check
76
- }, (0, _i18n.__)('Mobile'))), children));
76
+ }, (0, _i18n.__)('Mobile'))), children(renderProps)));
77
77
  }
78
78
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/preview-options/index.js"],"names":["PreviewOptions","children","viewLabel","className","isEnabled","deviceType","setDeviceType","label","isMobile","popoverProps","placement","toggleProps","disabled","menuProps","deviceIcons","mobile","tablet","desktop","toLowerCase","check"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;AAMe,SAASA,cAAT,CAAyB;AACvCC,EAAAA,QADuC;AAEvCC,EAAAA,SAFuC;AAGvCC,EAAAA,SAHuC;AAIvCC,EAAAA,SAAS,GAAG,IAJ2B;AAKvCC,EAAAA,UALuC;AAMvCC,EAAAA,aANuC;AAOvCC,EAAAA;AAPuC,CAAzB,EAQX;AACH,QAAMC,QAAQ,GAAG,+BAAkB,OAAlB,EAA2B,GAA3B,CAAjB;AACA,MAAKA,QAAL,EAAgB,OAAO,IAAP;AAEhB,QAAMC,YAAY,GAAG;AACpBN,IAAAA,SAAS,EAAE,yBACVA,SADU,EAEV,6CAFU,CADS;AAKpBO,IAAAA,SAAS,EAAE;AALS,GAArB;AAOA,QAAMC,WAAW,GAAG;AACnBR,IAAAA,SAAS,EAAE,0CADQ;AAEnBS,IAAAA,QAAQ,EAAE,CAAER,SAFO;AAGnBH,IAAAA,QAAQ,EAAEC;AAHS,GAApB;AAKA,QAAMW,SAAS,GAAG;AACjB,kBAAc,cAAI,cAAJ;AADG,GAAlB;AAIA,QAAMC,WAAW,GAAG;AACnBC,IAAAA,MAAM,EAANA,aADmB;AAEnBC,IAAAA,MAAM,EAANA,aAFmB;AAGnBC,IAAAA,OAAO,EAAPA;AAHmB,GAApB;AAMA,SACC,4BAAC,wBAAD;AACC,IAAA,SAAS,EAAC,qCADX;AAEC,IAAA,YAAY,EAAGR,YAFhB;AAGC,IAAA,WAAW,EAAGE,WAHf;AAIC,IAAA,SAAS,EAAGE,SAJb;AAKC,IAAA,IAAI,EAAGC,WAAW,CAAET,UAAU,CAACa,WAAX,EAAF,CALnB;AAMC,IAAA,KAAK,EAAGX,KAAK,IAAI,cAAI,SAAJ;AANlB,KAQG,MACD,qDACC,4BAAC,qBAAD,QACC,4BAAC,oBAAD;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,OAAO,EAAG,MAAMD,aAAa,CAAE,SAAF,CAF9B;AAGC,IAAA,IAAI,EAAGD,UAAU,KAAK,SAAf,IAA4Bc;AAHpC,KAKG,cAAI,SAAJ,CALH,CADD,EAQC,4BAAC,oBAAD;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,OAAO,EAAG,MAAMb,aAAa,CAAE,QAAF,CAF9B;AAGC,IAAA,IAAI,EAAGD,UAAU,KAAK,QAAf,IAA2Bc;AAHnC,KAKG,cAAI,QAAJ,CALH,CARD,EAeC,4BAAC,oBAAD;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,OAAO,EAAG,MAAMb,aAAa,CAAE,QAAF,CAF9B;AAGC,IAAA,IAAI,EAAGD,UAAU,KAAK,QAAf,IAA2Bc;AAHnC,KAKG,cAAI,QAAJ,CALH,CAfD,CADD,EAwBGlB,QAxBH,CATF,CADD;AAuCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check, desktop, mobile, tablet } from '@wordpress/icons';\n\nexport default function PreviewOptions( {\n\tchildren,\n\tviewLabel,\n\tclassName,\n\tisEnabled = true,\n\tdeviceType,\n\tsetDeviceType,\n\tlabel,\n} ) {\n\tconst isMobile = useViewportMatch( 'small', '<' );\n\tif ( isMobile ) return null;\n\n\tconst popoverProps = {\n\t\tclassName: classnames(\n\t\t\tclassName,\n\t\t\t'block-editor-post-preview__dropdown-content'\n\t\t),\n\t\tplacement: 'bottom-end',\n\t};\n\tconst toggleProps = {\n\t\tclassName: 'block-editor-post-preview__button-toggle',\n\t\tdisabled: ! isEnabled,\n\t\tchildren: viewLabel,\n\t};\n\tconst menuProps = {\n\t\t'aria-label': __( 'View options' ),\n\t};\n\n\tconst deviceIcons = {\n\t\tmobile,\n\t\ttablet,\n\t\tdesktop,\n\t};\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName=\"block-editor-post-preview__dropdown\"\n\t\t\tpopoverProps={ popoverProps }\n\t\t\ttoggleProps={ toggleProps }\n\t\t\tmenuProps={ menuProps }\n\t\t\ticon={ deviceIcons[ deviceType.toLowerCase() ] }\n\t\t\tlabel={ label || __( 'Preview' ) }\n\t\t>\n\t\t\t{ () => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tclassName=\"block-editor-post-preview__button-resize\"\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Desktop' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Desktop' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Desktop' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tclassName=\"block-editor-post-preview__button-resize\"\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Tablet' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Tablet' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Tablet' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tclassName=\"block-editor-post-preview__button-resize\"\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Mobile' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Mobile' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Mobile' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t{ children }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/preview-options/index.js"],"names":["PreviewOptions","children","viewLabel","className","isEnabled","deviceType","setDeviceType","label","isMobile","popoverProps","placement","toggleProps","disabled","menuProps","deviceIcons","mobile","tablet","desktop","toLowerCase","renderProps","check"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;AAMe,SAASA,cAAT,CAAyB;AACvCC,EAAAA,QADuC;AAEvCC,EAAAA,SAFuC;AAGvCC,EAAAA,SAHuC;AAIvCC,EAAAA,SAAS,GAAG,IAJ2B;AAKvCC,EAAAA,UALuC;AAMvCC,EAAAA,aANuC;AAOvCC,EAAAA;AAPuC,CAAzB,EAQX;AACH,QAAMC,QAAQ,GAAG,+BAAkB,OAAlB,EAA2B,GAA3B,CAAjB;AACA,MAAKA,QAAL,EAAgB,OAAO,IAAP;AAEhB,QAAMC,YAAY,GAAG;AACpBN,IAAAA,SAAS,EAAE,yBACVA,SADU,EAEV,6CAFU,CADS;AAKpBO,IAAAA,SAAS,EAAE;AALS,GAArB;AAOA,QAAMC,WAAW,GAAG;AACnBR,IAAAA,SAAS,EAAE,0CADQ;AAEnBS,IAAAA,QAAQ,EAAE,CAAER,SAFO;AAGnBH,IAAAA,QAAQ,EA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n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check, desktop, mobile, tablet } from '@wordpress/icons';\n\nexport default function PreviewOptions( {\n\tchildren,\n\tviewLabel,\n\tclassName,\n\tisEnabled = true,\n\tdeviceType,\n\tsetDeviceType,\n\tlabel,\n} ) {\n\tconst isMobile = useViewportMatch( 'small', '<' );\n\tif ( isMobile ) return null;\n\n\tconst popoverProps = {\n\t\tclassName: classnames(\n\t\t\tclassName,\n\t\t\t'block-editor-post-preview__dropdown-content'\n\t\t),\n\t\tplacement: 'bottom-end',\n\t};\n\tconst toggleProps = {\n\t\tclassName: 'block-editor-post-preview__button-toggle',\n\t\tdisabled: ! isEnabled,\n\t\tchildren: viewLabel,\n\t};\n\tconst menuProps = {\n\t\t'aria-label': __( 'View options' ),\n\t};\n\n\tconst deviceIcons = {\n\t\tmobile,\n\t\ttablet,\n\t\tdesktop,\n\t};\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName=\"block-editor-post-preview__dropdown\"\n\t\t\tpopoverProps={ popoverProps }\n\t\t\ttoggleProps={ toggleProps }\n\t\t\tmenuProps={ menuProps }\n\t\t\ticon={ deviceIcons[ deviceType.toLowerCase() ] }\n\t\t\tlabel={ label || __( 'Preview' ) }\n\t\t>\n\t\t\t{ ( renderProps ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tclassName=\"block-editor-post-preview__button-resize\"\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Desktop' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Desktop' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Desktop' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tclassName=\"block-editor-post-preview__button-resize\"\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Tablet' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Tablet' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Tablet' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tclassName=\"block-editor-post-preview__button-resize\"\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Mobile' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Mobile' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Mobile' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t{ children( renderProps ) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"]}
@@ -42,8 +42,11 @@ const ExperimentalBlockEditorProvider = (0, _withRegistryProvider.default)(props
42
42
  (0, _element.useEffect)(() => {
43
43
  __experimentalUpdateSettings({ ...settings,
44
44
  __internalIsInitialized: true
45
- }, stripExperimentalSettings);
46
- }, [settings]); // Syncs the entity provider with changes in the block-editor store.
45
+ }, {
46
+ stripExperimentalSettings,
47
+ reset: true
48
+ });
49
+ }, [settings, stripExperimentalSettings, __experimentalUpdateSettings]); // Syncs the entity provider with changes in the block-editor store.
47
50
 
48
51
  (0, _useBlockSync.default)(props);
49
52
  return (0, _element.createElement)(_blockRefsProvider.BlockRefsProvider, null, children);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/provider/index.js"],"names":["ExperimentalBlockEditorProvider","props","children","settings","stripExperimentalSettings","__experimentalUpdateSettings","blockEditorStore","__internalIsInitialized","BlockEditorProvider"],"mappings":";;;;;;;;;AAIA;;AADA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAbA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AAEO,MAAMA,+BAA+B,GAAG,mCAC5CC,KAAF,IAAa;AACZ,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,QAAZ;AAAsBC,IAAAA,yBAAyB,GAAG;AAAlD,MAA4DH,KAAlE;AAEA,QAAM;AAAEI,IAAAA;AAAF,MAAmC,wBACxC,uBAAaC,YAAb,CADwC,CAAzC;AAGA,0BAAW,MAAM;AAChBD,IAAAA,4BAA4B,CAC3B,EACC,GAAGF,QADJ;AAECI,MAAAA,uBAAuB,EAAE;AAF1B,KAD2B,EAK3BH,yBAL2B,CAA5B;AAOA,GARD,EAQG,CAAED,QAAF,CARH,EANY,CAgBZ;;AACA,6BAAcF,KAAd;AAEA,SAAO,4BAAC,oCAAD,QAAqBC,QAArB,CAAP;AACA,CArB6C,CAAxC;;;AAwBA,MAAMM,mBAAmB,GAAKP,KAAF,IAAa;AAC/C,SACC,4BAAC,+BAAD,OACMA,KADN;AAEC,IAAA,yBAAyB,EAAG;AAF7B,KAIGA,KAAK,CAACC,QAJT,CADD;AAQA,CATM;;;eAWQM,mB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport withRegistryProvider from './with-registry-provider';\nimport useBlockSync from './use-block-sync';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockRefsProvider } from './block-refs-provider';\nimport { unlock } from '../../lock-unlock';\n\n/** @typedef {import('@wordpress/data').WPDataRegistry} WPDataRegistry */\n\nexport const ExperimentalBlockEditorProvider = withRegistryProvider(\n\t( props ) => {\n\t\tconst { children, settings, stripExperimentalSettings = false } = props;\n\n\t\tconst { __experimentalUpdateSettings } = unlock(\n\t\t\tuseDispatch( blockEditorStore )\n\t\t);\n\t\tuseEffect( () => {\n\t\t\t__experimentalUpdateSettings(\n\t\t\t\t{\n\t\t\t\t\t...settings,\n\t\t\t\t\t__internalIsInitialized: true,\n\t\t\t\t},\n\t\t\t\tstripExperimentalSettings\n\t\t\t);\n\t\t}, [ settings ] );\n\n\t\t// Syncs the entity provider with changes in the block-editor store.\n\t\tuseBlockSync( props );\n\n\t\treturn <BlockRefsProvider>{ children }</BlockRefsProvider>;\n\t}\n);\n\nexport const BlockEditorProvider = ( props ) => {\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\t{ ...props }\n\t\t\tstripExperimentalSettings={ true }\n\t\t>\n\t\t\t{ props.children }\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n};\n\nexport default BlockEditorProvider;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/provider/index.js"],"names":["ExperimentalBlockEditorProvider","props","children","settings","stripExperimentalSettings","__experimentalUpdateSettings","blockEditorStore","__internalIsInitialized","reset","BlockEditorProvider"],"mappings":";;;;;;;;;AAIA;;AADA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAbA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AAEO,MAAMA,+BAA+B,GAAG,mCAC5CC,KAAF,IAAa;AACZ,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,QAAZ;AAAsBC,IAAAA,yBAAyB,GAAG;AAAlD,MAA4DH,KAAlE;AAEA,QAAM;AAAEI,IAAAA;AAAF,MAAmC,wBACxC,uBAAaC,YAAb,CADwC,CAAzC;AAGA,0BAAW,MAAM;AAChBD,IAAAA,4BAA4B,CAC3B,EACC,GAAGF,QADJ;AAECI,MAAAA,uBAAuB,EAAE;AAF1B,KAD2B,EAK3B;AACCH,MAAAA,yBADD;AAECI,MAAAA,KAAK,EAAE;AAFR,KAL2B,CAA5B;AAUA,GAXD,EAWG,CACFL,QADE,EAEFC,yBAFE,EAGFC,4BAHE,CAXH,EANY,CAuBZ;;AACA,6BAAcJ,KAAd;AAEA,SAAO,4BAAC,oCAAD,QAAqBC,QAArB,CAAP;AACA,CA5B6C,CAAxC;;;AA+BA,MAAMO,mBAAmB,GAAKR,KAAF,IAAa;AAC/C,SACC,4BAAC,+BAAD,OACMA,KADN;AAEC,IAAA,yBAAyB,EAAG;AAF7B,KAIGA,KAAK,CAACC,QAJT,CADD;AAQA,CATM;;;eAWQO,mB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport withRegistryProvider from './with-registry-provider';\nimport useBlockSync from './use-block-sync';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockRefsProvider } from './block-refs-provider';\nimport { unlock } from '../../lock-unlock';\n\n/** @typedef {import('@wordpress/data').WPDataRegistry} WPDataRegistry */\n\nexport const ExperimentalBlockEditorProvider = withRegistryProvider(\n\t( props ) => {\n\t\tconst { children, settings, stripExperimentalSettings = false } = props;\n\n\t\tconst { __experimentalUpdateSettings } = unlock(\n\t\t\tuseDispatch( blockEditorStore )\n\t\t);\n\t\tuseEffect( () => {\n\t\t\t__experimentalUpdateSettings(\n\t\t\t\t{\n\t\t\t\t\t...settings,\n\t\t\t\t\t__internalIsInitialized: true,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tstripExperimentalSettings,\n\t\t\t\t\treset: true,\n\t\t\t\t}\n\t\t\t);\n\t\t}, [\n\t\t\tsettings,\n\t\t\tstripExperimentalSettings,\n\t\t\t__experimentalUpdateSettings,\n\t\t] );\n\n\t\t// Syncs the entity provider with changes in the block-editor store.\n\t\tuseBlockSync( props );\n\n\t\treturn <BlockRefsProvider>{ children }</BlockRefsProvider>;\n\t}\n);\n\nexport const BlockEditorProvider = ( props ) => {\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\t{ ...props }\n\t\t\tstripExperimentalSettings={ true }\n\t\t>\n\t\t\t{ props.children }\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n};\n\nexport default BlockEditorProvider;\n"]}
@@ -141,6 +141,22 @@ function useBlockSync({
141
141
 
142
142
  resetBlocks(controlledBlocks);
143
143
  }
144
+ }; // Clean up the changes made by setControlledBlocks() when the component
145
+ // containing useBlockSync() unmounts.
146
+
147
+
148
+ const unsetControlledBlocks = () => {
149
+ __unstableMarkNextChangeAsNotPersistent();
150
+
151
+ if (clientId) {
152
+ setHasControlledInnerBlocks(clientId, false);
153
+
154
+ __unstableMarkNextChangeAsNotPersistent();
155
+
156
+ replaceInnerBlocks(clientId, []);
157
+ } else {
158
+ resetBlocks([]);
159
+ }
144
160
  }; // Add a subscription to the block-editor registry to detect when changes
145
161
  // have been made. This lets us inform the data source of changes. This
146
162
  // is an effect so that the subscriber can run synchronously without
@@ -269,5 +285,10 @@ function useBlockSync({
269
285
  unsubscribe();
270
286
  };
271
287
  }, [registry, clientId]);
288
+ (0, _element.useEffect)(() => {
289
+ return () => {
290
+ unsetControlledBlocks();
291
+ };
292
+ }, []);
272
293
  }
273
294
  //# sourceMappingURL=use-block-sync.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/provider/use-block-sync.js"],"names":["noop","useBlockSync","clientId","value","controlledBlocks","selection","controlledSelection","onChange","onInput","registry","resetBlocks","resetSelection","replaceInnerBlocks","selectBlock","setHasControlledInnerBlocks","__unstableMarkNextChangeAsNotPersistent","dispatch","blockEditorStore","hasSelectedBlock","getBlockName","getBlocks","getSelectionStart","getSelectionEnd","getBlock","select","isControlled","areInnerBlocksControlled","pendingChanges","incoming","outgoing","subscribed","setControlledBlocks","batch","storeBlocks","map","block","current","onInputRef","onChangeRef","includes","length","hadSelecton","selectionAnchor","selectionFocus","selectionStart","selectionEnd","initialPosition","selectionStillExists","getSelectedBlocksInitialCaretPosition","isLastBlockChangePersistent","__unstableIsLastBlockChangeIgnored","blocks","isPersistent","previousAreBlocksDifferent","unsubscribe","subscribe","isStillControlled","newIsPersistent","newBlocks","areBlocksDifferent","didPersistenceChange","push","updateParent"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;AAGA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;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A,cAAMW,YAAY,GAAGV,YAAY,GAC9Bd,WAAW,CAACF,OADkB,GAE9BC,UAAU,CAACD,OAFd;AAGA0B,QAAAA,YAAY,CAAEX,MAAF,EAAU;AACrB9C,UAAAA,SAAS,EAAE;AACVuC,YAAAA,cAAc,EAAEvB,iBAAiB,EADvB;AAEVwB,YAAAA,YAAY,EAAEvB,eAAe,EAFnB;AAGVwB,YAAAA,eAAe,EACdE,qCAAqC;AAJ5B;AADU,SAAV,CAAZ;AAQA;;AACDK,MAAAA,0BAA0B,GAAGM,kBAA7B;AACA,KAnEmB,CAApB;AAqEA,WAAO,MAAM;AACZ7B,MAAAA,UAAU,CAACM,OAAX,GAAqB,KAArB;AACAkB,MAAAA,WAAW;AACX,KAHD;AAIA,GAtFD,EAsFG,CAAE7C,QAAF,EAAYP,QAAZ,CAtFH;AAuFA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useRegistry, useSelect } from '@wordpress/data';\nimport { cloneBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nconst noop = () => {};\n\n/**\n * A function to call when the block value has been updated in the block-editor\n * store.\n *\n * @callback onBlockUpdate\n * @param {Object[]} blocks The updated blocks.\n * @param {Object} options The updated block options, such as selectionStart\n * and selectionEnd.\n */\n\n/**\n * useBlockSync is a side effect which handles bidirectional sync between the\n * block-editor store and a controlling data source which provides blocks. This\n * is most commonly used by the BlockEditorProvider to synchronize the contents\n * of the block-editor store with the root entity, like a post.\n *\n * Another example would be the template part block, which provides blocks from\n * a separate entity data source than a root entity. This hook syncs edits to\n * the template part in the block editor back to the entity and vice-versa.\n *\n * Here are some of its basic functions:\n * - Initalizes the block-editor store for the given clientID to the blocks\n * given via props.\n * - Adds incoming changes (like undo) to the block-editor store.\n * - Adds outgoing changes (like editing content) to the controlling entity,\n * determining if a change should be considered persistent or not.\n * - Handles edge cases and race conditions which occur in those operations.\n * - Ignores changes which happen to other entities (like nested inner block\n * controllers.\n * - Passes selection state from the block-editor store to the controlling entity.\n *\n * @param {Object} props Props for the block sync hook\n * @param {string} props.clientId The client ID of the inner block controller.\n * If none is passed, then it is assumed to be a\n * root controller rather than an inner block\n * controller.\n * @param {Object[]} props.value The control value for the blocks. This value\n * is used to initalize the block-editor store\n * and for resetting the blocks to incoming\n * changes like undo.\n * @param {Object} props.selection The selection state responsible to restore the selection on undo/redo.\n * @param {onBlockUpdate} props.onChange Function to call when a persistent\n * change has been made in the block-editor blocks\n * for the given clientId. For example, after\n * this function is called, an entity is marked\n * dirty because it has changes to save.\n * @param {onBlockUpdate} props.onInput Function to call when a non-persistent\n * change has been made in the block-editor blocks\n * for the given clientId. When this is called,\n * controlling sources do not become dirty.\n */\nexport default function useBlockSync( {\n\tclientId = null,\n\tvalue: controlledBlocks,\n\tselection: controlledSelection,\n\tonChange = noop,\n\tonInput = noop,\n} ) {\n\tconst registry = useRegistry();\n\n\tconst {\n\t\tresetBlocks,\n\t\tresetSelection,\n\t\treplaceInnerBlocks,\n\t\tselectBlock,\n\t\tsetHasControlledInnerBlocks,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t} = registry.dispatch( blockEditorStore );\n\tconst {\n\t\thasSelectedBlock,\n\t\tgetBlockName,\n\t\tgetBlocks,\n\t\tgetSelectionStart,\n\t\tgetSelectionEnd,\n\t\tgetBlock,\n\t} = registry.select( blockEditorStore );\n\tconst isControlled = useSelect(\n\t\t( select ) => {\n\t\t\treturn (\n\t\t\t\t! clientId ||\n\t\t\t\tselect( blockEditorStore ).areInnerBlocksControlled( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst pendingChanges = useRef( { incoming: null, outgoing: [] } );\n\tconst subscribed = useRef( false );\n\n\tconst setControlledBlocks = () => {\n\t\tif ( ! controlledBlocks ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// We don't need to persist this change because we only replace\n\t\t// controlled inner blocks when the change was caused by an entity,\n\t\t// and so it would already be persisted.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tif ( clientId ) {\n\t\t\t// It is important to batch here because otherwise,\n\t\t\t// as soon as `setHasControlledInnerBlocks` is called\n\t\t\t// the effect to restore might be triggered\n\t\t\t// before the actual blocks get set properly in state.\n\t\t\tregistry.batch( () => {\n\t\t\t\tsetHasControlledInnerBlocks( clientId, true );\n\t\t\t\tconst storeBlocks = controlledBlocks.map( ( block ) =>\n\t\t\t\t\tcloneBlock( block )\n\t\t\t\t);\n\t\t\t\tif ( subscribed.current ) {\n\t\t\t\t\tpendingChanges.current.incoming = storeBlocks;\n\t\t\t\t}\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\treplaceInnerBlocks( clientId, storeBlocks );\n\t\t\t} );\n\t\t} else {\n\t\t\tif ( subscribed.current ) {\n\t\t\t\tpendingChanges.current.incoming = controlledBlocks;\n\t\t\t}\n\t\t\tresetBlocks( controlledBlocks );\n\t\t}\n\t};\n\n\t// Add a subscription to the block-editor registry to detect when changes\n\t// have been made. This lets us inform the data source of changes. This\n\t// is an effect so that the subscriber can run synchronously without\n\t// waiting for React renders for changes.\n\tconst onInputRef = useRef( onInput );\n\tconst onChangeRef = useRef( onChange );\n\tuseEffect( () => {\n\t\tonInputRef.current = onInput;\n\t\tonChangeRef.current = onChange;\n\t}, [ onInput, onChange ] );\n\n\t// Determine if blocks need to be reset when they change.\n\tuseEffect( () => {\n\t\tif ( pendingChanges.current.outgoing.includes( controlledBlocks ) ) {\n\t\t\t// Skip block reset if the value matches expected outbound sync\n\t\t\t// triggered by this component by a preceding change detection.\n\t\t\t// Only skip if the value matches expectation, since a reset should\n\t\t\t// still occur if the value is modified (not equal by reference),\n\t\t\t// to allow that the consumer may apply modifications to reflect\n\t\t\t// back on the editor.\n\t\t\tif (\n\t\t\t\tpendingChanges.current.outgoing[\n\t\t\t\t\tpendingChanges.current.outgoing.length - 1\n\t\t\t\t] === controlledBlocks\n\t\t\t) {\n\t\t\t\tpendingChanges.current.outgoing = [];\n\t\t\t}\n\t\t} else if ( getBlocks( clientId ) !== controlledBlocks ) {\n\t\t\t// Reset changing value in all other cases than the sync described\n\t\t\t// above. Since this can be reached in an update following an out-\n\t\t\t// bound sync, unset the outbound value to avoid considering it in\n\t\t\t// subsequent renders.\n\t\t\tpendingChanges.current.outgoing = [];\n\t\t\tconst hadSelecton = hasSelectedBlock();\n\t\t\tconst selectionAnchor = getSelectionStart();\n\t\t\tconst selectionFocus = getSelectionEnd();\n\t\t\tsetControlledBlocks();\n\n\t\t\tif ( controlledSelection ) {\n\t\t\t\tresetSelection(\n\t\t\t\t\tcontrolledSelection.selectionStart,\n\t\t\t\t\tcontrolledSelection.selectionEnd,\n\t\t\t\t\tcontrolledSelection.initialPosition\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconst selectionStillExists = getBlock(\n\t\t\t\t\tselectionAnchor.clientId\n\t\t\t\t);\n\t\t\t\tif ( hadSelecton && ! selectionStillExists ) {\n\t\t\t\t\tselectBlock( clientId );\n\t\t\t\t} else {\n\t\t\t\t\tresetSelection( selectionAnchor, selectionFocus );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, [ controlledBlocks, clientId ] );\n\n\tuseEffect( () => {\n\t\t// When the block becomes uncontrolled, it means its inner state has been reset\n\t\t// we need to take the blocks again from the external value property.\n\t\tif ( ! isControlled ) {\n\t\t\tpendingChanges.current.outgoing = [];\n\t\t\tsetControlledBlocks();\n\t\t}\n\t}, [ isControlled ] );\n\n\tuseEffect( () => {\n\t\tconst {\n\t\t\tgetSelectedBlocksInitialCaretPosition,\n\t\t\tisLastBlockChangePersistent,\n\t\t\t__unstableIsLastBlockChangeIgnored,\n\t\t\tareInnerBlocksControlled,\n\t\t} = registry.select( blockEditorStore );\n\n\t\tlet blocks = getBlocks( clientId );\n\t\tlet isPersistent = isLastBlockChangePersistent();\n\t\tlet previousAreBlocksDifferent = false;\n\n\t\tsubscribed.current = true;\n\t\tconst unsubscribe = registry.subscribe( () => {\n\t\t\t// Sometimes, when changing block lists, lingering subscriptions\n\t\t\t// might trigger before they are cleaned up. If the block for which\n\t\t\t// the subscription runs is no longer in the store, this would clear\n\t\t\t// its parent entity's block list. To avoid this, we bail out if\n\t\t\t// the subscription is triggering for a block (`clientId !== null`)\n\t\t\t// and its block name can't be found because it's not on the list.\n\t\t\t// (`getBlockName( clientId ) === null`).\n\t\t\tif ( clientId !== null && getBlockName( clientId ) === null )\n\t\t\t\treturn;\n\n\t\t\t// When RESET_BLOCKS on parent blocks get called, the controlled blocks\n\t\t\t// can reset to uncontrolled, in these situations, it means we need to populate\n\t\t\t// the blocks again from the external blocks (the value property here)\n\t\t\t// and we should stop triggering onChange\n\t\t\tconst isStillControlled =\n\t\t\t\t! clientId || areInnerBlocksControlled( clientId );\n\t\t\tif ( ! isStillControlled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst newIsPersistent = isLastBlockChangePersistent();\n\t\t\tconst newBlocks = getBlocks( clientId );\n\t\t\tconst areBlocksDifferent = newBlocks !== blocks;\n\t\t\tblocks = newBlocks;\n\t\t\tif (\n\t\t\t\tareBlocksDifferent &&\n\t\t\t\t( pendingChanges.current.incoming ||\n\t\t\t\t\t__unstableIsLastBlockChangeIgnored() )\n\t\t\t) {\n\t\t\t\tpendingChanges.current.incoming = null;\n\t\t\t\tisPersistent = newIsPersistent;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Since we often dispatch an action to mark the previous action as\n\t\t\t// persistent, we need to make sure that the blocks changed on the\n\t\t\t// previous action before committing the change.\n\t\t\tconst didPersistenceChange =\n\t\t\t\tpreviousAreBlocksDifferent &&\n\t\t\t\t! areBlocksDifferent &&\n\t\t\t\tnewIsPersistent &&\n\t\t\t\t! isPersistent;\n\n\t\t\tif ( areBlocksDifferent || didPersistenceChange ) {\n\t\t\t\tisPersistent = newIsPersistent;\n\t\t\t\t// We know that onChange/onInput will update controlledBlocks.\n\t\t\t\t// We need to be aware that it was caused by an outgoing change\n\t\t\t\t// so that we do not treat it as an incoming change later on,\n\t\t\t\t// which would cause a block reset.\n\t\t\t\tpendingChanges.current.outgoing.push( blocks );\n\n\t\t\t\t// Inform the controlling entity that changes have been made to\n\t\t\t\t// the block-editor store they should be aware about.\n\t\t\t\tconst updateParent = isPersistent\n\t\t\t\t\t? onChangeRef.current\n\t\t\t\t\t: onInputRef.current;\n\t\t\t\tupdateParent( blocks, {\n\t\t\t\t\tselection: {\n\t\t\t\t\t\tselectionStart: getSelectionStart(),\n\t\t\t\t\t\tselectionEnd: getSelectionEnd(),\n\t\t\t\t\t\tinitialPosition:\n\t\t\t\t\t\t\tgetSelectedBlocksInitialCaretPosition(),\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t\tpreviousAreBlocksDifferent = areBlocksDifferent;\n\t\t} );\n\n\t\treturn () => {\n\t\t\tsubscribed.current = false;\n\t\t\tunsubscribe();\n\t\t};\n\t}, [ registry, clientId ] );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/provider/use-block-sync.js"],"names":["noop","useBlockSync","clientId","value","controlledBlocks","selection","controlledSelection","onChange","onInput","registry","resetBlocks","resetSelection","replaceInnerBlocks","selectBlock","setHasControlledInnerBlocks","__unstableMarkNextChangeAsNotPersistent","dispatch","blockEditorStore","hasSelectedBlock","getBlockName","getBlocks","getSelectionStart","getSelectionEnd","getBlock","select","isControlled","areInnerBlocksControlled","pendingChanges","incoming","outgoing","subscribed","setControlledBlocks","batch","storeBlocks","map","block","current","unsetControlledBlocks","onInputRef","onChangeRef","includes","length","hadSelecton","selectionAnchor","selectionFocus","selectionStart","selectionEnd","initialPosition","selectionStillExists","getSelectedBlocksInitialCaretPosition","isLastBlockChangePersistent","__unstableIsLastBlockChangeIgnored","blocks","isPersistent","previousAreBlocksDifferent","unsubscribe","subscribe","isStillControlled","newIsPersistent","newBlocks","areBlocksDifferent","didPersistenceChange","push","updateParent"],"mappings":";;;;;;;AAGA;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AAvB,IACDuB,kCAAkC,EAFjB,CADnB,EAIE;AACDxB,QAAAA,cAAc,CAACS,OAAf,CAAuBR,QAAvB,GAAkC,IAAlC;AACAyB,QAAAA,YAAY,GAAGK,eAAf;AACA;AACA,OAjC4C,CAmC7C;AACA;AACA;;;AACA,YAAMG,oBAAoB,GACzBP,0BAA0B,IAC1B,CAAEM,kBADF,IAEAF,eAFA,IAGA,CAAEL,YAJH;;AAMA,UAAKO,kBAAkB,IAAIC,oBAA3B,EAAkD;AACjDR,QAAAA,YAAY,GAAGK,eAAf,CADiD,CAEjD;AACA;AACA;AACA;;AACA/B,QAAAA,cAAc,CAACS,OAAf,CAAuBP,QAAvB,CAAgCiC,IAAhC,CAAsCV,MAAtC,EANiD,CAQjD;AACA;;AACA,cAAMW,YAAY,GAAGV,YAAY,GAC9Bd,WAAW,CAACH,OADkB,GAE9BE,UAAU,CAACF,OAFd;AAGA2B,QAAAA,YAAY,CAAEX,MAAF,EAAU;AACrB/C,UAAAA,SAAS,EAAE;AACVwC,YAAAA,cAAc,EAAExB,iBAAiB,EADvB;AAEVyB,YAAAA,YAAY,EAAExB,eAAe,EAFnB;AAGVyB,YAAAA,eAAe,EACdE,qCAAqC;AAJ5B;AADU,SAAV,CAAZ;AAQA;;AACDK,MAAAA,0BAA0B,GAAGM,kBAA7B;AACA,KAnEmB,CAApB;AAqEA,WAAO,MAAM;AACZ9B,MAAAA,UAAU,CAACM,OAAX,GAAqB,KAArB;AACAmB,MAAAA,WAAW;AACX,KAHD;AAIA,GAtFD,EAsFG,CAAE9C,QAAF,EAAYP,QAAZ,CAtFH;AAwFA,0BAAW,MAAM;AAChB,WAAO,MAAM;AACZmC,MAAAA,qBAAqB;AACrB,KAFD;AAGA,GAJD,EAIG,EAJH;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useRegistry, useSelect } from '@wordpress/data';\nimport { cloneBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nconst noop = () => {};\n\n/**\n * A function to call when the block value has been updated in the block-editor\n * store.\n *\n * @callback onBlockUpdate\n * @param {Object[]} blocks The updated blocks.\n * @param {Object} options The updated block options, such as selectionStart\n * and selectionEnd.\n */\n\n/**\n * useBlockSync is a side effect which handles bidirectional sync between the\n * block-editor store and a controlling data source which provides blocks. This\n * is most commonly used by the BlockEditorProvider to synchronize the contents\n * of the block-editor store with the root entity, like a post.\n *\n * Another example would be the template part block, which provides blocks from\n * a separate entity data source than a root entity. This hook syncs edits to\n * the template part in the block editor back to the entity and vice-versa.\n *\n * Here are some of its basic functions:\n * - Initalizes the block-editor store for the given clientID to the blocks\n * given via props.\n * - Adds incoming changes (like undo) to the block-editor store.\n * - Adds outgoing changes (like editing content) to the controlling entity,\n * determining if a change should be considered persistent or not.\n * - Handles edge cases and race conditions which occur in those operations.\n * - Ignores changes which happen to other entities (like nested inner block\n * controllers.\n * - Passes selection state from the block-editor store to the controlling entity.\n *\n * @param {Object} props Props for the block sync hook\n * @param {string} props.clientId The client ID of the inner block controller.\n * If none is passed, then it is assumed to be a\n * root controller rather than an inner block\n * controller.\n * @param {Object[]} props.value The control value for the blocks. This value\n * is used to initalize the block-editor store\n * and for resetting the blocks to incoming\n * changes like undo.\n * @param {Object} props.selection The selection state responsible to restore the selection on undo/redo.\n * @param {onBlockUpdate} props.onChange Function to call when a persistent\n * change has been made in the block-editor blocks\n * for the given clientId. For example, after\n * this function is called, an entity is marked\n * dirty because it has changes to save.\n * @param {onBlockUpdate} props.onInput Function to call when a non-persistent\n * change has been made in the block-editor blocks\n * for the given clientId. When this is called,\n * controlling sources do not become dirty.\n */\nexport default function useBlockSync( {\n\tclientId = null,\n\tvalue: controlledBlocks,\n\tselection: controlledSelection,\n\tonChange = noop,\n\tonInput = noop,\n} ) {\n\tconst registry = useRegistry();\n\n\tconst {\n\t\tresetBlocks,\n\t\tresetSelection,\n\t\treplaceInnerBlocks,\n\t\tselectBlock,\n\t\tsetHasControlledInnerBlocks,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t} = registry.dispatch( blockEditorStore );\n\tconst {\n\t\thasSelectedBlock,\n\t\tgetBlockName,\n\t\tgetBlocks,\n\t\tgetSelectionStart,\n\t\tgetSelectionEnd,\n\t\tgetBlock,\n\t} = registry.select( blockEditorStore );\n\tconst isControlled = useSelect(\n\t\t( select ) => {\n\t\t\treturn (\n\t\t\t\t! clientId ||\n\t\t\t\tselect( blockEditorStore ).areInnerBlocksControlled( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst pendingChanges = useRef( { incoming: null, outgoing: [] } );\n\tconst subscribed = useRef( false );\n\n\tconst setControlledBlocks = () => {\n\t\tif ( ! controlledBlocks ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// We don't need to persist this change because we only replace\n\t\t// controlled inner blocks when the change was caused by an entity,\n\t\t// and so it would already be persisted.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tif ( clientId ) {\n\t\t\t// It is important to batch here because otherwise,\n\t\t\t// as soon as `setHasControlledInnerBlocks` is called\n\t\t\t// the effect to restore might be triggered\n\t\t\t// before the actual blocks get set properly in state.\n\t\t\tregistry.batch( () => {\n\t\t\t\tsetHasControlledInnerBlocks( clientId, true );\n\t\t\t\tconst storeBlocks = controlledBlocks.map( ( block ) =>\n\t\t\t\t\tcloneBlock( block )\n\t\t\t\t);\n\t\t\t\tif ( subscribed.current ) {\n\t\t\t\t\tpendingChanges.current.incoming = storeBlocks;\n\t\t\t\t}\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\treplaceInnerBlocks( clientId, storeBlocks );\n\t\t\t} );\n\t\t} else {\n\t\t\tif ( subscribed.current ) {\n\t\t\t\tpendingChanges.current.incoming = controlledBlocks;\n\t\t\t}\n\t\t\tresetBlocks( controlledBlocks );\n\t\t}\n\t};\n\n\t// Clean up the changes made by setControlledBlocks() when the component\n\t// containing useBlockSync() unmounts.\n\tconst unsetControlledBlocks = () => {\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tif ( clientId ) {\n\t\t\tsetHasControlledInnerBlocks( clientId, false );\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\treplaceInnerBlocks( clientId, [] );\n\t\t} else {\n\t\t\tresetBlocks( [] );\n\t\t}\n\t};\n\n\t// Add a subscription to the block-editor registry to detect when changes\n\t// have been made. This lets us inform the data source of changes. This\n\t// is an effect so that the subscriber can run synchronously without\n\t// waiting for React renders for changes.\n\tconst onInputRef = useRef( onInput );\n\tconst onChangeRef = useRef( onChange );\n\tuseEffect( () => {\n\t\tonInputRef.current = onInput;\n\t\tonChangeRef.current = onChange;\n\t}, [ onInput, onChange ] );\n\n\t// Determine if blocks need to be reset when they change.\n\tuseEffect( () => {\n\t\tif ( pendingChanges.current.outgoing.includes( controlledBlocks ) ) {\n\t\t\t// Skip block reset if the value matches expected outbound sync\n\t\t\t// triggered by this component by a preceding change detection.\n\t\t\t// Only skip if the value matches expectation, since a reset should\n\t\t\t// still occur if the value is modified (not equal by reference),\n\t\t\t// to allow that the consumer may apply modifications to reflect\n\t\t\t// back on the editor.\n\t\t\tif (\n\t\t\t\tpendingChanges.current.outgoing[\n\t\t\t\t\tpendingChanges.current.outgoing.length - 1\n\t\t\t\t] === controlledBlocks\n\t\t\t) {\n\t\t\t\tpendingChanges.current.outgoing = [];\n\t\t\t}\n\t\t} else if ( getBlocks( clientId ) !== controlledBlocks ) {\n\t\t\t// Reset changing value in all other cases than the sync described\n\t\t\t// above. Since this can be reached in an update following an out-\n\t\t\t// bound sync, unset the outbound value to avoid considering it in\n\t\t\t// subsequent renders.\n\t\t\tpendingChanges.current.outgoing = [];\n\t\t\tconst hadSelecton = hasSelectedBlock();\n\t\t\tconst selectionAnchor = getSelectionStart();\n\t\t\tconst selectionFocus = getSelectionEnd();\n\t\t\tsetControlledBlocks();\n\n\t\t\tif ( controlledSelection ) {\n\t\t\t\tresetSelection(\n\t\t\t\t\tcontrolledSelection.selectionStart,\n\t\t\t\t\tcontrolledSelection.selectionEnd,\n\t\t\t\t\tcontrolledSelection.initialPosition\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconst selectionStillExists = getBlock(\n\t\t\t\t\tselectionAnchor.clientId\n\t\t\t\t);\n\t\t\t\tif ( hadSelecton && ! selectionStillExists ) {\n\t\t\t\t\tselectBlock( clientId );\n\t\t\t\t} else {\n\t\t\t\t\tresetSelection( selectionAnchor, selectionFocus );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, [ controlledBlocks, clientId ] );\n\n\tuseEffect( () => {\n\t\t// When the block becomes uncontrolled, it means its inner state has been reset\n\t\t// we need to take the blocks again from the external value property.\n\t\tif ( ! isControlled ) {\n\t\t\tpendingChanges.current.outgoing = [];\n\t\t\tsetControlledBlocks();\n\t\t}\n\t}, [ isControlled ] );\n\n\tuseEffect( () => {\n\t\tconst {\n\t\t\tgetSelectedBlocksInitialCaretPosition,\n\t\t\tisLastBlockChangePersistent,\n\t\t\t__unstableIsLastBlockChangeIgnored,\n\t\t\tareInnerBlocksControlled,\n\t\t} = registry.select( blockEditorStore );\n\n\t\tlet blocks = getBlocks( clientId );\n\t\tlet isPersistent = isLastBlockChangePersistent();\n\t\tlet previousAreBlocksDifferent = false;\n\n\t\tsubscribed.current = true;\n\t\tconst unsubscribe = registry.subscribe( () => {\n\t\t\t// Sometimes, when changing block lists, lingering subscriptions\n\t\t\t// might trigger before they are cleaned up. If the block for which\n\t\t\t// the subscription runs is no longer in the store, this would clear\n\t\t\t// its parent entity's block list. To avoid this, we bail out if\n\t\t\t// the subscription is triggering for a block (`clientId !== null`)\n\t\t\t// and its block name can't be found because it's not on the list.\n\t\t\t// (`getBlockName( clientId ) === null`).\n\t\t\tif ( clientId !== null && getBlockName( clientId ) === null )\n\t\t\t\treturn;\n\n\t\t\t// When RESET_BLOCKS on parent blocks get called, the controlled blocks\n\t\t\t// can reset to uncontrolled, in these situations, it means we need to populate\n\t\t\t// the blocks again from the external blocks (the value property here)\n\t\t\t// and we should stop triggering onChange\n\t\t\tconst isStillControlled =\n\t\t\t\t! clientId || areInnerBlocksControlled( clientId );\n\t\t\tif ( ! isStillControlled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst newIsPersistent = isLastBlockChangePersistent();\n\t\t\tconst newBlocks = getBlocks( clientId );\n\t\t\tconst areBlocksDifferent = newBlocks !== blocks;\n\t\t\tblocks = newBlocks;\n\t\t\tif (\n\t\t\t\tareBlocksDifferent &&\n\t\t\t\t( pendingChanges.current.incoming ||\n\t\t\t\t\t__unstableIsLastBlockChangeIgnored() )\n\t\t\t) {\n\t\t\t\tpendingChanges.current.incoming = null;\n\t\t\t\tisPersistent = newIsPersistent;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Since we often dispatch an action to mark the previous action as\n\t\t\t// persistent, we need to make sure that the blocks changed on the\n\t\t\t// previous action before committing the change.\n\t\t\tconst didPersistenceChange =\n\t\t\t\tpreviousAreBlocksDifferent &&\n\t\t\t\t! areBlocksDifferent &&\n\t\t\t\tnewIsPersistent &&\n\t\t\t\t! isPersistent;\n\n\t\t\tif ( areBlocksDifferent || didPersistenceChange ) {\n\t\t\t\tisPersistent = newIsPersistent;\n\t\t\t\t// We know that onChange/onInput will update controlledBlocks.\n\t\t\t\t// We need to be aware that it was caused by an outgoing change\n\t\t\t\t// so that we do not treat it as an incoming change later on,\n\t\t\t\t// which would cause a block reset.\n\t\t\t\tpendingChanges.current.outgoing.push( blocks );\n\n\t\t\t\t// Inform the controlling entity that changes have been made to\n\t\t\t\t// the block-editor store they should be aware about.\n\t\t\t\tconst updateParent = isPersistent\n\t\t\t\t\t? onChangeRef.current\n\t\t\t\t\t: onInputRef.current;\n\t\t\t\tupdateParent( blocks, {\n\t\t\t\t\tselection: {\n\t\t\t\t\t\tselectionStart: getSelectionStart(),\n\t\t\t\t\t\tselectionEnd: getSelectionEnd(),\n\t\t\t\t\t\tinitialPosition:\n\t\t\t\t\t\t\tgetSelectedBlocksInitialCaretPosition(),\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t\tpreviousAreBlocksDifferent = areBlocksDifferent;\n\t\t} );\n\n\t\treturn () => {\n\t\t\tsubscribed.current = false;\n\t\t\tunsubscribe();\n\t\t};\n\t}, [ registry, clientId ] );\n\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tunsetControlledBlocks();\n\t\t};\n\t}, [] );\n}\n"]}