@wordpress/block-editor 12.20.0 → 12.21.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 (471) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-actions/index.js +45 -32
  3. package/build/components/block-actions/index.js.map +1 -1
  4. package/build/components/block-bindings-toolbar-indicator/index.js +25 -0
  5. package/build/components/block-bindings-toolbar-indicator/index.js.map +1 -0
  6. package/build/components/block-edit/context.js +2 -1
  7. package/build/components/block-edit/context.js.map +1 -1
  8. package/build/components/block-edit/index.js +8 -3
  9. package/build/components/block-edit/index.js.map +1 -1
  10. package/build/components/block-inspector/index.js +5 -4
  11. package/build/components/block-inspector/index.js.map +1 -1
  12. package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
  13. package/build/components/block-list/block-list-item.native.js +1 -1
  14. package/build/components/block-list/block-list-item.native.js.map +1 -1
  15. package/build/components/block-list/block-outline.native.js +23 -7
  16. package/build/components/block-list/block-outline.native.js.map +1 -1
  17. package/build/components/block-list/block-selection-button.native.js.map +1 -1
  18. package/build/components/block-list/block.native.js +0 -3
  19. package/build/components/block-list/block.native.js.map +1 -1
  20. package/build/components/block-list/use-block-props/index.js +8 -1
  21. package/build/components/block-list/use-block-props/index.js.map +1 -1
  22. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -3
  23. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  24. package/build/components/block-mover/index.native.js.map +1 -1
  25. package/build/components/block-popover/cover.js +68 -0
  26. package/build/components/block-popover/cover.js.map +1 -0
  27. package/build/components/block-popover/drop-zone.js +2 -3
  28. package/build/components/block-popover/drop-zone.js.map +1 -1
  29. package/build/components/block-popover/index.js +1 -19
  30. package/build/components/block-popover/index.js.map +1 -1
  31. package/build/components/block-preview/index.js +2 -1
  32. package/build/components/block-preview/index.js.map +1 -1
  33. package/build/components/block-removal-warning-modal/index.js +2 -4
  34. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  35. package/build/components/block-rename/modal.js.map +1 -1
  36. package/build/components/block-settings-menu/block-settings-dropdown.js +12 -10
  37. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  38. package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
  39. package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  40. package/build/components/block-toolbar/index.js +21 -10
  41. package/build/components/block-toolbar/index.js.map +1 -1
  42. package/build/components/block-toolbar/shuffle.js +89 -0
  43. package/build/components/block-toolbar/shuffle.js.map +1 -0
  44. package/build/components/block-toolbar/use-has-block-toolbar.js +43 -0
  45. package/build/components/block-toolbar/use-has-block-toolbar.js.map +1 -0
  46. package/build/components/block-tools/block-selection-button.js +5 -1
  47. package/build/components/block-tools/block-selection-button.js.map +1 -1
  48. package/build/components/block-tools/empty-block-inserter.js +2 -5
  49. package/build/components/block-tools/empty-block-inserter.js.map +1 -1
  50. package/build/components/block-tools/index.js +9 -26
  51. package/build/components/block-tools/index.js.map +1 -1
  52. package/build/components/block-tools/use-show-block-tools.js +60 -0
  53. package/build/components/block-tools/use-show-block-tools.js.map +1 -0
  54. package/build/components/caption/index.native.js.map +1 -1
  55. package/build/components/child-layout-control/index.js.map +1 -1
  56. package/build/components/color-palette/control.js.map +1 -1
  57. package/build/components/colors-gradients/control.js +1 -1
  58. package/build/components/colors-gradients/control.js.map +1 -1
  59. package/build/components/global-styles/border-panel.js +21 -8
  60. package/build/components/global-styles/border-panel.js.map +1 -1
  61. package/build/components/global-styles/color-panel.js +1 -1
  62. package/build/components/global-styles/color-panel.js.map +1 -1
  63. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  64. package/build/components/global-styles/index.js +6 -0
  65. package/build/components/global-styles/index.js.map +1 -1
  66. package/build/components/global-styles/shadow-panel-components.js +80 -23
  67. package/build/components/global-styles/shadow-panel-components.js.map +1 -1
  68. package/build/components/global-styles/typography-utils.js +7 -5
  69. package/build/components/global-styles/typography-utils.js.map +1 -1
  70. package/build/components/global-styles/use-global-styles-output.js +15 -15
  71. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  72. package/build/components/global-styles/utils.js +1 -1
  73. package/build/components/global-styles/utils.js.map +1 -1
  74. package/build/components/grid-visualizer/grid-item-resizer.js +77 -0
  75. package/build/components/grid-visualizer/grid-item-resizer.js.map +1 -0
  76. package/build/components/grid-visualizer/grid-visualizer.js +81 -0
  77. package/build/components/grid-visualizer/grid-visualizer.js.map +1 -0
  78. package/build/components/grid-visualizer/index.js +20 -0
  79. package/build/components/grid-visualizer/index.js.map +1 -0
  80. package/build/components/grid-visualizer/utils.js +10 -0
  81. package/build/components/grid-visualizer/utils.js.map +1 -0
  82. package/build/components/iframe/index.js +61 -16
  83. package/build/components/iframe/index.js.map +1 -1
  84. package/build/components/index.native.js +7 -0
  85. package/build/components/index.native.js.map +1 -1
  86. package/build/components/inner-blocks/use-nested-settings-update.js +8 -2
  87. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  88. package/build/components/inserter/media-tab/media-preview.js.map +1 -1
  89. package/build/components/inserter/menu.js +9 -3
  90. package/build/components/inserter/menu.js.map +1 -1
  91. package/build/components/inserter/menu.native.js.map +1 -1
  92. package/build/components/inserter/mobile-tab-navigation.js +1 -1
  93. package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
  94. package/build/components/inserter/search-results.js +3 -2
  95. package/build/components/inserter/search-results.js.map +1 -1
  96. package/build/components/inserter/tabs.js +2 -1
  97. package/build/components/inserter/tabs.js.map +1 -1
  98. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  99. package/build/components/inspector-controls-tabs/index.js +1 -1
  100. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  101. package/build/components/inspector-controls-tabs/styles-tab.js +1 -1
  102. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  103. package/build/components/link-control/link-preview.js +4 -1
  104. package/build/components/link-control/link-preview.js.map +1 -1
  105. package/build/components/link-control/search-input.js.map +1 -1
  106. package/build/components/list-view/block-select-button.js +10 -2
  107. package/build/components/list-view/block-select-button.js.map +1 -1
  108. package/build/components/list-view/branch.js.map +1 -1
  109. package/build/components/list-view/drop-indicator.js.map +1 -1
  110. package/build/components/list-view/index.js.map +1 -1
  111. package/build/components/list-view/use-clipboard-handler.js +2 -1
  112. package/build/components/list-view/use-clipboard-handler.js.map +1 -1
  113. package/build/components/panel-color-settings/index.js.map +1 -1
  114. package/build/components/provider/index.js.map +1 -1
  115. package/build/components/resizable-box-popover/index.js +3 -5
  116. package/build/components/resizable-box-popover/index.js.map +1 -1
  117. package/build/components/responsive-block-control/index.js +1 -1
  118. package/build/components/responsive-block-control/index.js.map +1 -1
  119. package/build/components/rich-text/index.js +46 -26
  120. package/build/components/rich-text/index.js.map +1 -1
  121. package/build/components/rich-text/use-enter.js +3 -0
  122. package/build/components/rich-text/use-enter.js.map +1 -1
  123. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  124. package/build/components/url-popover/index.js +3 -3
  125. package/build/components/url-popover/index.js.map +1 -1
  126. package/build/components/writing-flow/use-clipboard-handler.js +2 -1
  127. package/build/components/writing-flow/use-clipboard-handler.js.map +1 -1
  128. package/build/components/writing-flow/utils.js +23 -6
  129. package/build/components/writing-flow/utils.js.map +1 -1
  130. package/build/hooks/background.js.map +1 -1
  131. package/build/hooks/block-hooks.js +34 -8
  132. package/build/hooks/block-hooks.js.map +1 -1
  133. package/build/hooks/border.js +6 -4
  134. package/build/hooks/border.js.map +1 -1
  135. package/build/hooks/dimensions.js +3 -4
  136. package/build/hooks/dimensions.js.map +1 -1
  137. package/build/hooks/font-size.js +6 -7
  138. package/build/hooks/font-size.js.map +1 -1
  139. package/build/hooks/index.js +1 -1
  140. package/build/hooks/index.js.map +1 -1
  141. package/build/hooks/layout-child.js +39 -0
  142. package/build/hooks/layout-child.js.map +1 -1
  143. package/build/hooks/layout.js +11 -4
  144. package/build/hooks/layout.js.map +1 -1
  145. package/build/hooks/line-height.js.map +1 -1
  146. package/build/hooks/spacing-visualizer.js +115 -0
  147. package/build/hooks/spacing-visualizer.js.map +1 -0
  148. package/build/hooks/use-bindings-attributes.js +171 -48
  149. package/build/hooks/use-bindings-attributes.js.map +1 -1
  150. package/build/hooks/use-typography-props.js +1 -2
  151. package/build/hooks/use-typography-props.js.map +1 -1
  152. package/build/layouts/grid.js +6 -2
  153. package/build/layouts/grid.js.map +1 -1
  154. package/build/private-apis.js +7 -3
  155. package/build/private-apis.js.map +1 -1
  156. package/build/store/actions.js +42 -12
  157. package/build/store/actions.js.map +1 -1
  158. package/build/store/private-actions.js +29 -55
  159. package/build/store/private-actions.js.map +1 -1
  160. package/build/store/private-selectors.js +0 -8
  161. package/build/store/private-selectors.js.map +1 -1
  162. package/build/store/reducer.js +3 -20
  163. package/build/store/reducer.js.map +1 -1
  164. package/build/store/selectors.js +27 -15
  165. package/build/store/selectors.js.map +1 -1
  166. package/build/utils/calculate-scale.js +17 -0
  167. package/build/utils/calculate-scale.js.map +1 -0
  168. package/build-module/components/block-actions/index.js +45 -32
  169. package/build-module/components/block-actions/index.js.map +1 -1
  170. package/build-module/components/block-bindings-toolbar-indicator/index.js +18 -0
  171. package/build-module/components/block-bindings-toolbar-indicator/index.js.map +1 -0
  172. package/build-module/components/block-edit/context.js +1 -0
  173. package/build-module/components/block-edit/context.js.map +1 -1
  174. package/build-module/components/block-edit/index.js +9 -4
  175. package/build-module/components/block-edit/index.js.map +1 -1
  176. package/build-module/components/block-inspector/index.js +6 -5
  177. package/build-module/components/block-inspector/index.js.map +1 -1
  178. package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
  179. package/build-module/components/block-list/block-list-item.native.js +1 -1
  180. package/build-module/components/block-list/block-list-item.native.js.map +1 -1
  181. package/build-module/components/block-list/block-outline.native.js +23 -7
  182. package/build-module/components/block-list/block-outline.native.js.map +1 -1
  183. package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
  184. package/build-module/components/block-list/block.native.js +0 -3
  185. package/build-module/components/block-list/block.native.js.map +1 -1
  186. package/build-module/components/block-list/use-block-props/index.js +9 -2
  187. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  188. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -3
  189. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  190. package/build-module/components/block-mover/index.native.js.map +1 -1
  191. package/build-module/components/block-popover/cover.js +60 -0
  192. package/build-module/components/block-popover/cover.js.map +1 -0
  193. package/build-module/components/block-popover/drop-zone.js +2 -3
  194. package/build-module/components/block-popover/drop-zone.js.map +1 -1
  195. package/build-module/components/block-popover/index.js +1 -19
  196. package/build-module/components/block-popover/index.js.map +1 -1
  197. package/build-module/components/block-preview/index.js +2 -1
  198. package/build-module/components/block-preview/index.js.map +1 -1
  199. package/build-module/components/block-removal-warning-modal/index.js +3 -5
  200. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  201. package/build-module/components/block-rename/modal.js.map +1 -1
  202. package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -10
  203. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  204. package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
  205. package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  206. package/build-module/components/block-toolbar/index.js +21 -11
  207. package/build-module/components/block-toolbar/index.js.map +1 -1
  208. package/build-module/components/block-toolbar/shuffle.js +82 -0
  209. package/build-module/components/block-toolbar/shuffle.js.map +1 -0
  210. package/build-module/components/block-toolbar/use-has-block-toolbar.js +36 -0
  211. package/build-module/components/block-toolbar/use-has-block-toolbar.js.map +1 -0
  212. package/build-module/components/block-tools/block-selection-button.js +5 -1
  213. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  214. package/build-module/components/block-tools/empty-block-inserter.js +2 -5
  215. package/build-module/components/block-tools/empty-block-inserter.js.map +1 -1
  216. package/build-module/components/block-tools/index.js +9 -26
  217. package/build-module/components/block-tools/index.js.map +1 -1
  218. package/build-module/components/block-tools/use-show-block-tools.js +54 -0
  219. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -0
  220. package/build-module/components/caption/index.native.js.map +1 -1
  221. package/build-module/components/child-layout-control/index.js.map +1 -1
  222. package/build-module/components/color-palette/control.js.map +1 -1
  223. package/build-module/components/colors-gradients/control.js +1 -1
  224. package/build-module/components/colors-gradients/control.js.map +1 -1
  225. package/build-module/components/global-styles/border-panel.js +22 -10
  226. package/build-module/components/global-styles/border-panel.js.map +1 -1
  227. package/build-module/components/global-styles/color-panel.js +1 -1
  228. package/build-module/components/global-styles/color-panel.js.map +1 -1
  229. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  230. package/build-module/components/global-styles/index.js +1 -1
  231. package/build-module/components/global-styles/index.js.map +1 -1
  232. package/build-module/components/global-styles/shadow-panel-components.js +82 -24
  233. package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
  234. package/build-module/components/global-styles/typography-utils.js +7 -5
  235. package/build-module/components/global-styles/typography-utils.js.map +1 -1
  236. package/build-module/components/global-styles/use-global-styles-output.js +16 -16
  237. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  238. package/build-module/components/global-styles/utils.js +2 -2
  239. package/build-module/components/global-styles/utils.js.map +1 -1
  240. package/build-module/components/grid-visualizer/grid-item-resizer.js +69 -0
  241. package/build-module/components/grid-visualizer/grid-item-resizer.js.map +1 -0
  242. package/build-module/components/grid-visualizer/grid-visualizer.js +73 -0
  243. package/build-module/components/grid-visualizer/grid-visualizer.js.map +1 -0
  244. package/build-module/components/grid-visualizer/index.js +3 -0
  245. package/build-module/components/grid-visualizer/index.js.map +1 -0
  246. package/build-module/components/grid-visualizer/utils.js +4 -0
  247. package/build-module/components/grid-visualizer/utils.js.map +1 -0
  248. package/build-module/components/iframe/index.js +61 -16
  249. package/build-module/components/iframe/index.js.map +1 -1
  250. package/build-module/components/index.native.js +1 -1
  251. package/build-module/components/index.native.js.map +1 -1
  252. package/build-module/components/inner-blocks/use-nested-settings-update.js +8 -2
  253. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  254. package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
  255. package/build-module/components/inserter/menu.js +9 -3
  256. package/build-module/components/inserter/menu.js.map +1 -1
  257. package/build-module/components/inserter/menu.native.js.map +1 -1
  258. package/build-module/components/inserter/mobile-tab-navigation.js +1 -1
  259. package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
  260. package/build-module/components/inserter/search-results.js +3 -2
  261. package/build-module/components/inserter/search-results.js.map +1 -1
  262. package/build-module/components/inserter/tabs.js +2 -1
  263. package/build-module/components/inserter/tabs.js.map +1 -1
  264. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  265. package/build-module/components/inspector-controls-tabs/index.js +1 -1
  266. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  267. package/build-module/components/inspector-controls-tabs/styles-tab.js +2 -2
  268. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  269. package/build-module/components/link-control/link-preview.js +5 -2
  270. package/build-module/components/link-control/link-preview.js.map +1 -1
  271. package/build-module/components/link-control/search-input.js.map +1 -1
  272. package/build-module/components/list-view/block-select-button.js +11 -3
  273. package/build-module/components/list-view/block-select-button.js.map +1 -1
  274. package/build-module/components/list-view/branch.js.map +1 -1
  275. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  276. package/build-module/components/list-view/index.js.map +1 -1
  277. package/build-module/components/list-view/use-clipboard-handler.js +3 -2
  278. package/build-module/components/list-view/use-clipboard-handler.js.map +1 -1
  279. package/build-module/components/panel-color-settings/index.js.map +1 -1
  280. package/build-module/components/provider/index.js.map +1 -1
  281. package/build-module/components/resizable-box-popover/index.js +3 -5
  282. package/build-module/components/resizable-box-popover/index.js.map +1 -1
  283. package/build-module/components/responsive-block-control/index.js +1 -1
  284. package/build-module/components/responsive-block-control/index.js.map +1 -1
  285. package/build-module/components/rich-text/index.js +47 -28
  286. package/build-module/components/rich-text/index.js.map +1 -1
  287. package/build-module/components/rich-text/use-enter.js +3 -0
  288. package/build-module/components/rich-text/use-enter.js.map +1 -1
  289. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  290. package/build-module/components/url-popover/index.js +3 -3
  291. package/build-module/components/url-popover/index.js.map +1 -1
  292. package/build-module/components/writing-flow/use-clipboard-handler.js +3 -2
  293. package/build-module/components/writing-flow/use-clipboard-handler.js.map +1 -1
  294. package/build-module/components/writing-flow/utils.js +22 -7
  295. package/build-module/components/writing-flow/utils.js.map +1 -1
  296. package/build-module/hooks/background.js.map +1 -1
  297. package/build-module/hooks/block-hooks.js +34 -8
  298. package/build-module/hooks/block-hooks.js.map +1 -1
  299. package/build-module/hooks/border.js +7 -5
  300. package/build-module/hooks/border.js.map +1 -1
  301. package/build-module/hooks/dimensions.js +1 -2
  302. package/build-module/hooks/dimensions.js.map +1 -1
  303. package/build-module/hooks/font-size.js +7 -8
  304. package/build-module/hooks/font-size.js.map +1 -1
  305. package/build-module/hooks/index.js +1 -1
  306. package/build-module/hooks/index.js.map +1 -1
  307. package/build-module/hooks/layout-child.js +39 -0
  308. package/build-module/hooks/layout-child.js.map +1 -1
  309. package/build-module/hooks/layout.js +11 -4
  310. package/build-module/hooks/layout.js.map +1 -1
  311. package/build-module/hooks/line-height.js.map +1 -1
  312. package/build-module/hooks/spacing-visualizer.js +106 -0
  313. package/build-module/hooks/spacing-visualizer.js.map +1 -0
  314. package/build-module/hooks/use-bindings-attributes.js +172 -49
  315. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  316. package/build-module/hooks/use-typography-props.js +2 -3
  317. package/build-module/hooks/use-typography-props.js.map +1 -1
  318. package/build-module/layouts/grid.js +6 -2
  319. package/build-module/layouts/grid.js.map +1 -1
  320. package/build-module/private-apis.js +7 -3
  321. package/build-module/private-apis.js.map +1 -1
  322. package/build-module/store/actions.js +42 -12
  323. package/build-module/store/actions.js.map +1 -1
  324. package/build-module/store/private-actions.js +29 -54
  325. package/build-module/store/private-actions.js.map +1 -1
  326. package/build-module/store/private-selectors.js +0 -6
  327. package/build-module/store/private-selectors.js.map +1 -1
  328. package/build-module/store/reducer.js +3 -20
  329. package/build-module/store/reducer.js.map +1 -1
  330. package/build-module/store/selectors.js +23 -13
  331. package/build-module/store/selectors.js.map +1 -1
  332. package/build-module/utils/calculate-scale.js +11 -0
  333. package/build-module/utils/calculate-scale.js.map +1 -0
  334. package/build-style/content-rtl.css +8 -2
  335. package/build-style/content.css +8 -2
  336. package/build-style/default-editor-styles-rtl.css +1 -0
  337. package/build-style/default-editor-styles.css +1 -0
  338. package/build-style/style-rtl.css +113 -22
  339. package/build-style/style.css +113 -22
  340. package/package.json +31 -31
  341. package/src/components/block-actions/index.js +57 -47
  342. package/src/components/block-bindings-toolbar-indicator/index.js +20 -0
  343. package/src/components/block-bindings-toolbar-indicator/style.scss +14 -0
  344. package/src/components/block-draggable/test/index.native.js +2 -2
  345. package/src/components/block-edit/context.js +1 -0
  346. package/src/components/block-edit/index.js +5 -1
  347. package/src/components/block-inspector/index.js +7 -5
  348. package/src/components/block-list/block-invalid-warning.native.js +1 -1
  349. package/src/components/block-list/block-list-item.native.js +1 -1
  350. package/src/components/block-list/block-outline.native.js +36 -21
  351. package/src/components/block-list/block-selection-button.native.js +1 -3
  352. package/src/components/block-list/block.native.js +0 -3
  353. package/src/components/block-list/content.scss +5 -1
  354. package/src/components/block-list/test/block-outline.native.js +255 -0
  355. package/src/components/block-list/use-block-props/index.js +12 -2
  356. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -7
  357. package/src/components/block-mover/index.native.js +1 -1
  358. package/src/components/block-popover/cover.js +63 -0
  359. package/src/components/block-popover/drop-zone.js +3 -4
  360. package/src/components/block-popover/index.js +1 -28
  361. package/src/components/block-preview/index.js +3 -1
  362. package/src/components/block-removal-warning-modal/index.js +5 -19
  363. package/src/components/block-rename/modal.js +1 -1
  364. package/src/components/block-settings-menu/block-settings-dropdown.js +12 -9
  365. package/src/components/block-switcher/block-transformations-menu.native.js +1 -1
  366. package/src/components/block-toolbar/block-toolbar-menu.native.js +2 -2
  367. package/src/components/block-toolbar/index.js +19 -15
  368. package/src/components/block-toolbar/shuffle.js +93 -0
  369. package/src/components/block-toolbar/use-has-block-toolbar.js +49 -0
  370. package/src/components/block-tools/block-selection-button.js +4 -0
  371. package/src/components/block-tools/empty-block-inserter.js +3 -6
  372. package/src/components/block-tools/index.js +13 -36
  373. package/src/components/block-tools/use-show-block-tools.js +73 -0
  374. package/src/components/caption/index.native.js +1 -1
  375. package/src/components/child-layout-control/index.js +1 -1
  376. package/src/components/color-palette/control.js +1 -1
  377. package/src/components/colors-gradients/control.js +1 -1
  378. package/src/components/colors-gradients/test/control.js +2 -2
  379. package/src/components/contrast-checker/test/index.js +10 -10
  380. package/src/components/default-block-appender/content.scss +5 -2
  381. package/src/components/global-styles/border-panel.js +35 -24
  382. package/src/components/global-styles/color-panel.js +1 -1
  383. package/src/components/global-styles/image-settings-panel.js +1 -1
  384. package/src/components/global-styles/index.js +5 -1
  385. package/src/components/global-styles/shadow-panel-components.js +92 -23
  386. package/src/components/global-styles/style.scss +33 -10
  387. package/src/components/global-styles/test/typography-utils.js +231 -81
  388. package/src/components/global-styles/typography-utils.js +10 -7
  389. package/src/components/global-styles/use-global-styles-output.js +14 -16
  390. package/src/components/global-styles/utils.js +2 -8
  391. package/src/components/grid-visualizer/grid-item-resizer.js +100 -0
  392. package/src/components/grid-visualizer/grid-visualizer.js +81 -0
  393. package/src/components/grid-visualizer/index.js +2 -0
  394. package/src/components/grid-visualizer/style.scss +33 -0
  395. package/src/components/grid-visualizer/utils.js +5 -0
  396. package/src/components/iframe/index.js +78 -31
  397. package/src/components/index.native.js +1 -0
  398. package/src/components/inner-blocks/use-nested-settings-update.js +12 -2
  399. package/src/components/inserter/media-tab/media-preview.js +1 -1
  400. package/src/components/inserter/menu.js +10 -4
  401. package/src/components/inserter/menu.native.js +3 -3
  402. package/src/components/inserter/mobile-tab-navigation.js +1 -1
  403. package/src/components/inserter/search-results.js +2 -1
  404. package/src/components/inserter/style.scss +10 -0
  405. package/src/components/inserter/tabs.js +2 -1
  406. package/src/components/inspector-controls/block-support-tools-panel.js +2 -2
  407. package/src/components/inspector-controls-tabs/index.js +1 -1
  408. package/src/components/inspector-controls-tabs/styles-tab.js +2 -2
  409. package/src/components/line-height-control/test/index.js +1 -1
  410. package/src/components/link-control/link-preview.js +9 -2
  411. package/src/components/link-control/search-input.js +1 -1
  412. package/src/components/link-control/style.scss +9 -0
  413. package/src/components/list-view/block-select-button.js +16 -2
  414. package/src/components/list-view/branch.js +1 -1
  415. package/src/components/list-view/drop-indicator.js +1 -1
  416. package/src/components/list-view/index.js +1 -1
  417. package/src/components/list-view/style.scss +8 -0
  418. package/src/components/list-view/use-clipboard-handler.js +3 -2
  419. package/src/components/panel-color-settings/index.js +1 -1
  420. package/src/components/panel-color-settings/test/index.js +3 -3
  421. package/src/components/provider/index.js +1 -4
  422. package/src/components/resizable-box-popover/index.js +4 -6
  423. package/src/components/responsive-block-control/README.md +4 -4
  424. package/src/components/responsive-block-control/index.js +1 -1
  425. package/src/components/responsive-block-control/test/index.js +5 -5
  426. package/src/components/rich-text/index.js +76 -53
  427. package/src/components/rich-text/use-enter.js +4 -0
  428. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
  429. package/src/components/url-popover/index.js +5 -5
  430. package/src/components/url-popover/style.scss +1 -0
  431. package/src/components/writing-flow/use-clipboard-handler.js +3 -2
  432. package/src/components/writing-flow/utils.js +31 -16
  433. package/src/hooks/background.js +1 -1
  434. package/src/hooks/block-hooks.js +47 -9
  435. package/src/hooks/block-hooks.scss +6 -0
  436. package/src/hooks/border.js +16 -4
  437. package/src/hooks/dimensions.js +1 -2
  438. package/src/hooks/font-size.js +7 -12
  439. package/src/hooks/index.js +1 -0
  440. package/src/hooks/layout-child.js +38 -0
  441. package/src/hooks/layout.js +12 -1
  442. package/src/hooks/line-height.js +1 -1
  443. package/src/hooks/spacing-visualizer.js +126 -0
  444. package/src/hooks/{padding.scss → spacing.scss} +1 -1
  445. package/src/hooks/use-bindings-attributes.js +215 -65
  446. package/src/hooks/use-typography-props.js +2 -8
  447. package/src/layouts/grid.js +8 -3
  448. package/src/private-apis.js +6 -2
  449. package/src/store/actions.js +56 -18
  450. package/src/store/private-actions.js +34 -79
  451. package/src/store/private-selectors.js +0 -8
  452. package/src/store/reducer.js +2 -23
  453. package/src/store/selectors.js +41 -46
  454. package/src/store/test/actions.js +0 -4
  455. package/src/style.scss +3 -1
  456. package/src/utils/calculate-scale.js +20 -0
  457. package/build/hooks/margin.js +0 -86
  458. package/build/hooks/margin.js.map +0 -1
  459. package/build/hooks/padding.js +0 -78
  460. package/build/hooks/padding.js.map +0 -1
  461. package/build/utils/use-can-block-toolbar-be-focused.js +0 -46
  462. package/build/utils/use-can-block-toolbar-be-focused.js.map +0 -1
  463. package/build-module/hooks/margin.js +0 -78
  464. package/build-module/hooks/margin.js.map +0 -1
  465. package/build-module/hooks/padding.js +0 -70
  466. package/build-module/hooks/padding.js.map +0 -1
  467. package/build-module/utils/use-can-block-toolbar-be-focused.js +0 -40
  468. package/build-module/utils/use-can-block-toolbar-be-focused.js.map +0 -1
  469. package/src/hooks/margin.js +0 -91
  470. package/src/hooks/padding.js +0 -82
  471. package/src/utils/use-can-block-toolbar-be-focused.js +0 -48
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useReducedMotion","__unstableMotion","motion","store","blockEditorStore","BlockPopover","animateVariants","hide","opacity","scaleY","show","exit","BlockDropZonePopover","__unstablePopoverSlot","__unstableContentRef","clientId","select","getBlockOrder","getBlockInsertionPoint","insertionPoint","order","rootClientId","length","index","reducedMotion","createElement","__unstableCoverTarget","className","div","initial","animate"],"sources":["@wordpress/block-editor/src/components/block-popover/drop-zone.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { __unstableMotion as motion } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport BlockPopover from './index';\n\nconst animateVariants = {\n\thide: { opacity: 0, scaleY: 0.75 },\n\tshow: { opacity: 1, scaleY: 1 },\n\texit: { opacity: 0, scaleY: 0.9 },\n};\n\nfunction BlockDropZonePopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst { clientId } = useSelect( ( select ) => {\n\t\tconst { getBlockOrder, getBlockInsertionPoint } =\n\t\t\tselect( blockEditorStore );\n\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\tclientId: order[ insertionPoint.index ],\n\t\t};\n\t}, [] );\n\tconst reducedMotion = useReducedMotion();\n\n\treturn (\n\t\t<BlockPopover\n\t\t\tclientId={ clientId }\n\t\t\t__unstableCoverTarget\n\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\tclassName=\"block-editor-block-popover__drop-zone\"\n\t\t>\n\t\t\t<motion.div\n\t\t\t\tdata-testid=\"block-popover-drop-zone\"\n\t\t\t\tinitial={\n\t\t\t\t\treducedMotion ? animateVariants.show : animateVariants.hide\n\t\t\t\t}\n\t\t\t\tanimate={ animateVariants.show }\n\t\t\t\texit={\n\t\t\t\t\treducedMotion ? animateVariants.show : animateVariants.exit\n\t\t\t\t}\n\t\t\t\tclassName=\"block-editor-block-popover__drop-zone-foreground\"\n\t\t\t/>\n\t\t</BlockPopover>\n\t);\n}\n\nexport default BlockDropZonePopover;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,gBAAgB,IAAIC,MAAM,QAAQ,uBAAuB;;AAElE;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CAACI,IAAM;IAChCC,IAAI,EACHa,aAAa,GAAGlB,eAAe,CAACI,IAAI,GAAGJ,eAAe,CAACK,IACvD;IACDgB,SAAS,EAAC;EAAkD,CAC5D,CACY,CAAC;AAEjB;AAEA,eAAef,oBAAoB"}
1
+ {"version":3,"names":["useSelect","useReducedMotion","__unstableMotion","motion","store","blockEditorStore","BlockPopoverCover","animateVariants","hide","opacity","scaleY","show","exit","BlockDropZonePopover","__unstablePopoverSlot","__unstableContentRef","clientId","select","getBlockOrder","getBlockInsertionPoint","insertionPoint","order","rootClientId","length","index","reducedMotion","createElement","className","div","initial","animate"],"sources":["@wordpress/block-editor/src/components/block-popover/drop-zone.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { __unstableMotion as motion } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport BlockPopoverCover from './cover';\n\nconst animateVariants = {\n\thide: { opacity: 0, scaleY: 0.75 },\n\tshow: { opacity: 1, scaleY: 1 },\n\texit: { opacity: 0, scaleY: 0.9 },\n};\n\nfunction BlockDropZonePopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst { clientId } = useSelect( ( select ) => {\n\t\tconst { getBlockOrder, getBlockInsertionPoint } =\n\t\t\tselect( blockEditorStore );\n\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\tclientId: order[ insertionPoint.index ],\n\t\t};\n\t}, [] );\n\tconst reducedMotion = useReducedMotion();\n\n\treturn (\n\t\t<BlockPopoverCover\n\t\t\tclientId={ clientId }\n\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\tclassName=\"block-editor-block-popover__drop-zone\"\n\t\t>\n\t\t\t<motion.div\n\t\t\t\tdata-testid=\"block-popover-drop-zone\"\n\t\t\t\tinitial={\n\t\t\t\t\treducedMotion ? animateVariants.show : animateVariants.hide\n\t\t\t\t}\n\t\t\t\tanimate={ animateVariants.show }\n\t\t\t\texit={\n\t\t\t\t\treducedMotion ? animateVariants.show : animateVariants.exit\n\t\t\t\t}\n\t\t\t\tclassName=\"block-editor-block-popover__drop-zone-foreground\"\n\t\t\t/>\n\t\t</BlockPopoverCover>\n\t);\n}\n\nexport default BlockDropZonePopover;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,gBAAgB,IAAIC,MAAM,QAAQ,uBAAuB;;AAElE;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,iBAAiB,MAAM,SAAS;AAEvC,MAAMC,eAAe,GAAG;EACvBC,IAAI,EAAE;IAAEC,OAAO,EAAE,CAAC;IAAEC,MAAM,EAAE;EAAK,CAAC;EAClCC,IAAI,EAAE;IAAEF,OAAO,EAAE,CAAC;IAAEC,MAAM,EAAE;EAAE,CAAC;EAC/BE,IAAI,EAAE;IAAEH,OAAO,EAAE,CAAC;IAAEC,MAAM,EAAE;EAAI;AACjC,CAAC;AAED,SAASG,oBAAoBA,CAAE;EAC9BC,qBAAqB;EACrBC;AACD,CAAC,EAAG;EACH,MAAM;IAAEC;EAAS,CAAC,GAAGhB,SAAS,CAAIiB,MAAM,IAAM;IAC7C,MAAM;MAAEC,aAAa;MAAEC;IAAuB,CAAC,GAC9CF,MAAM,CAAEZ,gBAAiB,CAAC;IAC3B,MAAMe,cAAc,GAAGD,sBAAsB,CAAC,CAAC;IAC/C,MAAME,KAAK,GAAGH,aAAa,CAAEE,cAAc,CAACE,YAAa,CAAC;IAE1D,IAAK,CAAED,KAAK,CAACE,MAAM,EAAG;MACrB,OAAO,CAAC,CAAC;IACV;IAEA,OAAO;MACNP,QAAQ,EAAEK,KAAK,CAAED,cAAc,CAACI,KAAK;IACtC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAMC,aAAa,GAAGxB,gBAAgB,CAAC,CAAC;EAExC,OACCyB,aAAA,CAACpB,iBAAiB;IACjBU,QAAQ,EAAGA,QAAU;IACrBF,qBAAqB,EAAGA,qBAAuB;IAC/CC,oBAAoB,EAAGA,oBAAsB;IAC7CY,SAAS,EAAC;EAAuC,GAEjDD,aAAA,CAACvB,MAAM,CAACyB,GAAG;IACV,eAAY,yBAAyB;IACrCC,OAAO,EACNJ,aAAa,GAAGlB,eAAe,CAACI,IAAI,GAAGJ,eAAe,CAACC,IACvD;IACDsB,OAAO,EAAGvB,eAAe,CAACI,IAAM;IAChCC,IAAI,EACHa,aAAa,GAAGlB,eAAe,CAACI,IAAI,GAAGJ,eAAe,CAACK,IACvD;IACDe,SAAS,EAAC;EAAkD,CAC5D,CACiB,CAAC;AAEtB;AAEA,eAAed,oBAAoB"}
@@ -21,8 +21,6 @@ function BlockPopover({
21
21
  clientId,
22
22
  bottomClientId,
23
23
  children,
24
- __unstableRefreshSize,
25
- __unstableCoverTarget = false,
26
24
  __unstablePopoverSlot,
27
25
  __unstableContentRef,
28
26
  shift = true,
@@ -54,20 +52,6 @@ function BlockPopover({
54
52
  observer.disconnect();
55
53
  };
56
54
  }, [selectedElement]);
57
- const style = useMemo(() => {
58
- if (
59
- // popoverDimensionsRecomputeCounter is by definition always equal or greater
60
- // than 0. This check is only there to satisfy the correctness of the
61
- // exhaustive-deps rule for the `useMemo` hook.
62
- popoverDimensionsRecomputeCounter < 0 || !selectedElement || lastSelectedElement !== selectedElement) {
63
- return {};
64
- }
65
- return {
66
- position: 'absolute',
67
- width: selectedElement.offsetWidth,
68
- height: selectedElement.offsetHeight
69
- };
70
- }, [selectedElement, lastSelectedElement, __unstableRefreshSize, popoverDimensionsRecomputeCounter]);
71
55
  const popoverAnchor = useMemo(() => {
72
56
  if (
73
57
  // popoverDimensionsRecomputeCounter is by definition always equal or greater
@@ -117,9 +101,7 @@ function BlockPopover({
117
101
  ...props,
118
102
  className: classnames('block-editor-block-popover', props.className),
119
103
  variant: "unstyled"
120
- }, __unstableCoverTarget && createElement("div", {
121
- style: style
122
- }, children), !__unstableCoverTarget && children);
104
+ }, children);
123
105
  }
124
106
  export default forwardRef(BlockPopover);
125
107
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","useMergeRefs","Popover","forwardRef","useMemo","useReducer","useLayoutEffect","__unstableUseBlockElement","useBlockElement","usePopoverScroll","MAX_POPOVER_RECOMPUTE_COUNTER","Number","MAX_SAFE_INTEGER","BlockPopover","clientId","bottomClientId","children","__unstableRefreshSize","__unstableCoverTarget","__unstablePopoverSlot","__unstableContentRef","shift","props","ref","selectedElement","lastSelectedElement","mergedRefs","popoverDimensionsRecomputeCounter","forceRecomputePopoverDimensions","s","observer","window","MutationObserver","observe","attributes","disconnect","style","position","width","offsetWidth","height","offsetHeight","popoverAnchor","undefined","getBoundingClientRect","_lastSelectedBCR$left","_lastSelectedBCR$top","_lastSelectedBCR$righ","_lastSelectedBCR$bott","selectedBCR","lastSelectedBCR","left","Math","min","Infinity","top","right","max","bottom","DOMRect","contextElement","createElement","animate","focusOnMount","anchor","__unstableSlotName","inline","placement","resize","flip","className","variant"],"sources":["@wordpress/block-editor/src/components/block-popover/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useMergeRefs } from '@wordpress/compose';\nimport { Popover } from '@wordpress/components';\nimport {\n\tforwardRef,\n\tuseMemo,\n\tuseReducer,\n\tuseLayoutEffect,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport usePopoverScroll from './use-popover-scroll';\n\nconst MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;\n\nfunction BlockPopover(\n\t{\n\t\tclientId,\n\t\tbottomClientId,\n\t\tchildren,\n\t\t__unstableRefreshSize,\n\t\t__unstableCoverTarget = false,\n\t\t__unstablePopoverSlot,\n\t\t__unstableContentRef,\n\t\tshift = true,\n\t\t...props\n\t},\n\tref\n) {\n\tconst selectedElement = useBlockElement( clientId );\n\tconst lastSelectedElement = useBlockElement( bottomClientId ?? clientId );\n\tconst mergedRefs = useMergeRefs( [\n\t\tref,\n\t\tusePopoverScroll( __unstableContentRef ),\n\t] );\n\n\tconst [\n\t\tpopoverDimensionsRecomputeCounter,\n\t\tforceRecomputePopoverDimensions,\n\t] = useReducer(\n\t\t// Module is there to make sure that the counter doesn't overflow.\n\t\t( s ) => ( s + 1 ) % MAX_POPOVER_RECOMPUTE_COUNTER,\n\t\t0\n\t);\n\n\t// When blocks are moved up/down, they are animated to their new position by\n\t// updating the `transform` property manually (i.e. without using CSS\n\t// transitions or animations). The animation, which can also scroll the block\n\t// editor, can sometimes cause the position of the Popover to get out of sync.\n\t// A MutationObserver is therefore used to make sure that changes to the\n\t// selectedElement's attribute (i.e. `transform`) can be tracked and used to\n\t// trigger the Popover to rerender.\n\tuseLayoutEffect( () => {\n\t\tif ( ! selectedElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst observer = new window.MutationObserver(\n\t\t\tforceRecomputePopoverDimensions\n\t\t);\n\t\tobserver.observe( selectedElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ selectedElement ] );\n\n\tconst style = useMemo( () => {\n\t\tif (\n\t\t\t// popoverDimensionsRecomputeCounter is by definition always equal or greater\n\t\t\t// than 0. This check is only there to satisfy the correctness of the\n\t\t\t// exhaustive-deps rule for the `useMemo` hook.\n\t\t\tpopoverDimensionsRecomputeCounter < 0 ||\n\t\t\t! selectedElement ||\n\t\t\tlastSelectedElement !== selectedElement\n\t\t) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\tposition: 'absolute',\n\t\t\twidth: selectedElement.offsetWidth,\n\t\t\theight: selectedElement.offsetHeight,\n\t\t};\n\t}, [\n\t\tselectedElement,\n\t\tlastSelectedElement,\n\t\t__unstableRefreshSize,\n\t\tpopoverDimensionsRecomputeCounter,\n\t] );\n\n\tconst popoverAnchor = useMemo( () => {\n\t\tif (\n\t\t\t// popoverDimensionsRecomputeCounter is by definition always equal or greater\n\t\t\t// than 0. This check is only there to satisfy the correctness of the\n\t\t\t// exhaustive-deps rule for the `useMemo` hook.\n\t\t\tpopoverDimensionsRecomputeCounter < 0 ||\n\t\t\t! selectedElement ||\n\t\t\t( bottomClientId && ! lastSelectedElement )\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tgetBoundingClientRect() {\n\t\t\t\tconst selectedBCR = selectedElement.getBoundingClientRect();\n\t\t\t\tconst lastSelectedBCR =\n\t\t\t\t\tlastSelectedElement?.getBoundingClientRect();\n\n\t\t\t\t// Get the biggest rectangle that encompasses completely the currently\n\t\t\t\t// selected element and the last selected element:\n\t\t\t\t// - for top/left coordinates, use the smaller numbers\n\t\t\t\t// - for the bottom/right coordinates, use the largest numbers\n\t\t\t\tconst left = Math.min(\n\t\t\t\t\tselectedBCR.left,\n\t\t\t\t\tlastSelectedBCR?.left ?? Infinity\n\t\t\t\t);\n\t\t\t\tconst top = Math.min(\n\t\t\t\t\tselectedBCR.top,\n\t\t\t\t\tlastSelectedBCR?.top ?? Infinity\n\t\t\t\t);\n\t\t\t\tconst right = Math.max(\n\t\t\t\t\tselectedBCR.right,\n\t\t\t\t\tlastSelectedBCR.right ?? -Infinity\n\t\t\t\t);\n\t\t\t\tconst bottom = Math.max(\n\t\t\t\t\tselectedBCR.bottom,\n\t\t\t\t\tlastSelectedBCR.bottom ?? -Infinity\n\t\t\t\t);\n\t\t\t\tconst width = right - left;\n\t\t\t\tconst height = bottom - top;\n\n\t\t\t\treturn new window.DOMRect( left, top, width, height );\n\t\t\t},\n\t\t\tcontextElement: selectedElement,\n\t\t};\n\t}, [\n\t\tbottomClientId,\n\t\tlastSelectedElement,\n\t\tselectedElement,\n\t\tpopoverDimensionsRecomputeCounter,\n\t] );\n\n\tif ( ! selectedElement || ( bottomClientId && ! lastSelectedElement ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Popover\n\t\t\tref={ mergedRefs }\n\t\t\tanimate={ false }\n\t\t\tfocusOnMount={ false }\n\t\t\tanchor={ popoverAnchor }\n\t\t\t// Render in the old slot if needed for backward compatibility,\n\t\t\t// otherwise render in place (not in the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot }\n\t\t\tinline={ ! __unstablePopoverSlot }\n\t\t\tplacement=\"top-start\"\n\t\t\tresize={ false }\n\t\t\tflip={ false }\n\t\t\tshift={ shift }\n\t\t\t{ ...props }\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-block-popover',\n\t\t\t\tprops.className\n\t\t\t) }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t{ __unstableCoverTarget && <div style={ style }>{ children }</div> }\n\t\t\t{ ! __unstableCoverTarget && children }\n\t\t</Popover>\n\t);\n}\n\nexport default forwardRef( BlockPopover );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,OAAO,QAAQ,uBAAuB;AAC/C,SACCC,UAAU,EACVC,OAAO,EACPC,UAAU,EACVC,eAAe,QACT,oBAAoB;;AAE3B;AACA;AACA;AACA,SAASC,yBAAyB,IAAIC,eAAe,QAAQ,8CAA8C;AAC3G,OAAOC,gBAAgB,MAAM,sBAAsB;AAEnD,MAAMC,6BAA6B,GAAGC,MAAM,CAACC,gBAAgB;AAE7D,SAASC,YAAYA,CACpB;EACCC,QAAQ;EACRC,cAAc;EACdC,QAAQ;EACRC,qBAAqB;EACrBC,qBAAqB,GA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CAAC4B,OAAO,CAAER,IAAI,EAAEI,GAAG,EAAEjB,KAAK,EAAEE,MAAO,CAAC;MACtD,CAAC;MACDoB,cAAc,EAAEpC;IACjB,CAAC;EACF,CAAC,EAAE,CACFT,cAAc,EACdU,mBAAmB,EACnBD,eAAe,EACfG,iCAAiC,CAChC,CAAC;EAEH,IAAK,CAAEH,eAAe,IAAMT,cAAc,IAAI,CAAEU,mBAAqB,EAAG;IACvE,OAAO,IAAI;EACZ;EAEA,OACCoC,aAAA,CAAC3D,OAAO;IACPqB,GAAG,EAAGG,UAAY;IAClBoC,OAAO,EAAG,KAAO;IACjBC,YAAY,EAAG,KAAO;IACtBC,MAAM,EAAGtB;IACT;IACA;IAAA;IACAuB,kBAAkB,EAAG9C,qBAAuB;IAC5C+C,MAAM,EAAG,CAAE/C,qBAAuB;IAClCgD,SAAS,EAAC,WAAW;IACrBC,MAAM,EAAG,KAAO;IAChBC,IAAI,EAAG,KAAO;IACdhD,KAAK,EAAGA,KAAO;IAAA,GACVC,KAAK;IACVgD,SAAS,EAAGtE,UAAU,CACrB,4BAA4B,EAC5BsB,KAAK,CAACgD,SACP,CAAG;IACHC,OAAO,EAAC;EAAU,GAEhBrD,qBAAqB,IAAI2C,aAAA;IAAKzB,KAAK,EAAGA;EAAO,GAAGpB,QAAe,CAAC,EAChE,CAAEE,qBAAqB,IAAIF,QACrB,CAAC;AAEZ;AAEA,eAAeb,UAAU,CAAEU,YAAa,CAAC"}
1
+ {"version":3,"names":["classnames","useMergeRefs","Popover","forwardRef","useMemo","useReducer","useLayoutEffect","__unstableUseBlockElement","useBlockElement","usePopoverScroll","MAX_POPOVER_RECOMPUTE_COUNTER","Number","MAX_SAFE_INTEGER","BlockPopover","clientId","bottomClientId","children","__unstablePopoverSlot","__unstableContentRef","shift","props","ref","selectedElement","lastSelectedElement","mergedRefs","popoverDimensionsRecomputeCounter","forceRecomputePopoverDimensions","s","observer","window","MutationObserver","observe","attributes","disconnect","popoverAnchor","undefined","getBoundingClientRect","_lastSelectedBCR$left","_lastSelectedBCR$top","_lastSelectedBCR$righ","_lastSelectedBCR$bott","selectedBCR","lastSelectedBCR","left","Math","min","Infinity","top","right","max","bottom","width","height","DOMRect","contextElement","createElement","animate","focusOnMount","anchor","__unstableSlotName","inline","placement","resize","flip","className","variant"],"sources":["@wordpress/block-editor/src/components/block-popover/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useMergeRefs } from '@wordpress/compose';\nimport { Popover } from '@wordpress/components';\nimport {\n\tforwardRef,\n\tuseMemo,\n\tuseReducer,\n\tuseLayoutEffect,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport usePopoverScroll from './use-popover-scroll';\n\nconst MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;\n\nfunction BlockPopover(\n\t{\n\t\tclientId,\n\t\tbottomClientId,\n\t\tchildren,\n\t\t__unstablePopoverSlot,\n\t\t__unstableContentRef,\n\t\tshift = true,\n\t\t...props\n\t},\n\tref\n) {\n\tconst selectedElement = useBlockElement( clientId );\n\tconst lastSelectedElement = useBlockElement( bottomClientId ?? clientId );\n\tconst mergedRefs = useMergeRefs( [\n\t\tref,\n\t\tusePopoverScroll( __unstableContentRef ),\n\t] );\n\n\tconst [\n\t\tpopoverDimensionsRecomputeCounter,\n\t\tforceRecomputePopoverDimensions,\n\t] = useReducer(\n\t\t// Module is there to make sure that the counter doesn't overflow.\n\t\t( s ) => ( s + 1 ) % MAX_POPOVER_RECOMPUTE_COUNTER,\n\t\t0\n\t);\n\n\t// When blocks are moved up/down, they are animated to their new position by\n\t// updating the `transform` property manually (i.e. without using CSS\n\t// transitions or animations). The animation, which can also scroll the block\n\t// editor, can sometimes cause the position of the Popover to get out of sync.\n\t// A MutationObserver is therefore used to make sure that changes to the\n\t// selectedElement's attribute (i.e. `transform`) can be tracked and used to\n\t// trigger the Popover to rerender.\n\tuseLayoutEffect( () => {\n\t\tif ( ! selectedElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst observer = new window.MutationObserver(\n\t\t\tforceRecomputePopoverDimensions\n\t\t);\n\t\tobserver.observe( selectedElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ selectedElement ] );\n\n\tconst popoverAnchor = useMemo( () => {\n\t\tif (\n\t\t\t// popoverDimensionsRecomputeCounter is by definition always equal or greater\n\t\t\t// than 0. This check is only there to satisfy the correctness of the\n\t\t\t// exhaustive-deps rule for the `useMemo` hook.\n\t\t\tpopoverDimensionsRecomputeCounter < 0 ||\n\t\t\t! selectedElement ||\n\t\t\t( bottomClientId && ! lastSelectedElement )\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tgetBoundingClientRect() {\n\t\t\t\tconst selectedBCR = selectedElement.getBoundingClientRect();\n\t\t\t\tconst lastSelectedBCR =\n\t\t\t\t\tlastSelectedElement?.getBoundingClientRect();\n\n\t\t\t\t// Get the biggest rectangle that encompasses completely the currently\n\t\t\t\t// selected element and the last selected element:\n\t\t\t\t// - for top/left coordinates, use the smaller numbers\n\t\t\t\t// - for the bottom/right coordinates, use the largest numbers\n\t\t\t\tconst left = Math.min(\n\t\t\t\t\tselectedBCR.left,\n\t\t\t\t\tlastSelectedBCR?.left ?? Infinity\n\t\t\t\t);\n\t\t\t\tconst top = Math.min(\n\t\t\t\t\tselectedBCR.top,\n\t\t\t\t\tlastSelectedBCR?.top ?? Infinity\n\t\t\t\t);\n\t\t\t\tconst right = Math.max(\n\t\t\t\t\tselectedBCR.right,\n\t\t\t\t\tlastSelectedBCR.right ?? -Infinity\n\t\t\t\t);\n\t\t\t\tconst bottom = Math.max(\n\t\t\t\t\tselectedBCR.bottom,\n\t\t\t\t\tlastSelectedBCR.bottom ?? -Infinity\n\t\t\t\t);\n\t\t\t\tconst width = right - left;\n\t\t\t\tconst height = bottom - top;\n\n\t\t\t\treturn new window.DOMRect( left, top, width, height );\n\t\t\t},\n\t\t\tcontextElement: selectedElement,\n\t\t};\n\t}, [\n\t\tbottomClientId,\n\t\tlastSelectedElement,\n\t\tselectedElement,\n\t\tpopoverDimensionsRecomputeCounter,\n\t] );\n\n\tif ( ! selectedElement || ( bottomClientId && ! lastSelectedElement ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Popover\n\t\t\tref={ mergedRefs }\n\t\t\tanimate={ false }\n\t\t\tfocusOnMount={ false }\n\t\t\tanchor={ popoverAnchor }\n\t\t\t// Render in the old slot if needed for backward compatibility,\n\t\t\t// otherwise render in place (not in the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot }\n\t\t\tinline={ ! __unstablePopoverSlot }\n\t\t\tplacement=\"top-start\"\n\t\t\tresize={ false }\n\t\t\tflip={ false }\n\t\t\tshift={ shift }\n\t\t\t{ ...props }\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-block-popover',\n\t\t\t\tprops.className\n\t\t\t) }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t{ children }\n\t\t</Popover>\n\t);\n}\n\nexport default forwardRef( BlockPopover );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,OAAO,QAAQ,uBAAuB;AAC/C,SACCC,UAAU,EACVC,OAAO,EACPC,UAAU,EACVC,eAAe,QACT,oBAAoB;;AAE3B;AACA;AACA;AACA,SAASC,yBAAyB,IAAIC,eAAe,QAAQ,8CAA8C;AAC3G,OAAOC,gBAAgB,MAAM,sBAAsB;AAEnD,MAAMC,6BAA6B,GAAGC,MAAM,CAACC,gBAAgB;AAE7D,SAASC,YAAYA,CACpB;EACCC,QAAQ;EACRC,cAAc;EACdC,QAAQ;EACRC,qBAAqB;EACrBC,oBAAoB;EAC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IACAyB,kBAAkB,EAAG1C,qBAAuB;IAC5C2C,MAAM,EAAG,CAAE3C,qBAAuB;IAClC4C,SAAS,EAAC,WAAW;IACrBC,MAAM,EAAG,KAAO;IAChBC,IAAI,EAAG,KAAO;IACd5C,KAAK,EAAGA,KAAO;IAAA,GACVC,KAAK;IACV4C,SAAS,EAAGhE,UAAU,CACrB,4BAA4B,EAC5BoB,KAAK,CAAC4C,SACP,CAAG;IACHC,OAAO,EAAC;EAAU,GAEhBjD,QACM,CAAC;AAEZ;AAEA,eAAeb,UAAU,CAAEU,YAAa,CAAC"}
@@ -20,11 +20,12 @@ import AutoHeightBlockPreview from './auto';
20
20
  import EditorStyles from '../editor-styles';
21
21
  import { store as blockEditorStore } from '../../store';
22
22
  import { BlockListItems } from '../block-list';
23
+ const EMPTY_ADDITIONAL_STYLES = [];
23
24
  export function BlockPreview({
24
25
  blocks,
25
26
  viewportWidth = 1200,
26
27
  minHeight,
27
- additionalStyles = [],
28
+ additionalStyles = EMPTY_ADDITIONAL_STYLES,
28
29
  // Deprecated props:
29
30
  __experimentalMinHeight,
30
31
  __experimentalPadding
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","useDisabled","useMergeRefs","useSelect","memo","useMemo","deprecated","ExperimentalBlockEditorProvider","AutoHeightBlockPreview","EditorStyles","store","blockEditorStore","BlockListItems","BlockPreview","blocks","viewportWidth","minHeight","additionalStyles","__experimentalMinHeight","__experimentalPadding","since","version","alternative","css","originalSettings","select","getSettings","settings","focusMode","__unstableIsPreviewMode","renderedBlocks","Array","isArray","length","createElement","value","useBlockPreview","props","layout","styles","undefined","disabledRef","ref","children","renderAppender","className"],"sources":["@wordpress/block-editor/src/components/block-preview/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useDisabled, useMergeRefs } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { memo, useMemo } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { ExperimentalBlockEditorProvider } from '../provider';\nimport AutoHeightBlockPreview from './auto';\nimport EditorStyles from '../editor-styles';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockListItems } from '../block-list';\n\nexport function BlockPreview( {\n\tblocks,\n\tviewportWidth = 1200,\n\tminHeight,\n\tadditionalStyles = [],\n\t// Deprecated props:\n\t__experimentalMinHeight,\n\t__experimentalPadding,\n} ) {\n\tif ( __experimentalMinHeight ) {\n\t\tminHeight = __experimentalMinHeight;\n\t\tdeprecated( 'The __experimentalMinHeight prop', {\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t\talternative: 'minHeight',\n\t\t} );\n\t}\n\tif ( __experimentalPadding ) {\n\t\tadditionalStyles = [\n\t\t\t...additionalStyles,\n\t\t\t{ css: `body { padding: ${ __experimentalPadding }px; }` },\n\t\t];\n\t\tdeprecated( 'The __experimentalPadding prop of BlockPreview', {\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t\talternative: 'additionalStyles',\n\t\t} );\n\t}\n\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...originalSettings,\n\t\t\tfocusMode: false, // Disable \"Spotlight mode\".\n\t\t\t__unstableIsPreviewMode: true,\n\t\t} ),\n\t\t[ originalSettings ]\n\t);\n\tconst renderedBlocks = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tif ( ! blocks || blocks.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tvalue={ renderedBlocks }\n\t\t\tsettings={ settings }\n\t\t>\n\t\t\t<AutoHeightBlockPreview\n\t\t\t\tviewportWidth={ viewportWidth }\n\t\t\t\tminHeight={ minHeight }\n\t\t\t\tadditionalStyles={ additionalStyles }\n\t\t\t/>\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n\n/**\n * BlockPreview renders a preview of a block or array of blocks.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-preview/README.md\n *\n * @param {Object} preview options for how the preview should be shown\n * @param {Array|Object} preview.blocks A block instance (object) or an array of blocks to be previewed.\n * @param {number} preview.viewportWidth Width of the preview container in pixels. Controls at what size the blocks will be rendered inside the preview. Default: 700.\n *\n * @return {Component} The component to be rendered.\n */\nexport default memo( BlockPreview );\n\n/**\n * This hook is used to lightly mark an element as a block preview wrapper\n * element. Call this hook and pass the returned props to the element to mark as\n * a block preview wrapper, automatically rendering inner blocks as children. If\n * you define a ref for the element, it is important to pass the ref to this\n * hook, which the hook in turn will pass to the component through the props it\n * returns. Optionally, you can also pass any other props through this hook, and\n * they will be merged and returned.\n *\n * @param {Object} options Preview options.\n * @param {WPBlock[]} options.blocks Block objects.\n * @param {Object} options.props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options.layout Layout settings to be used in the preview.\n */\nexport function useBlockPreview( { blocks, props = {}, layout } ) {\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...originalSettings,\n\t\t\tstyles: undefined, // Clear styles included by the parent settings, as they are already output by the parent's EditorStyles.\n\t\t\tfocusMode: false, // Disable \"Spotlight mode\".\n\t\t\t__unstableIsPreviewMode: true,\n\t\t} ),\n\t\t[ originalSettings ]\n\t);\n\tconst disabledRef = useDisabled();\n\tconst ref = useMergeRefs( [ props.ref, disabledRef ] );\n\tconst renderedBlocks = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tconst children = (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tvalue={ renderedBlocks }\n\t\t\tsettings={ settings }\n\t\t>\n\t\t\t<EditorStyles />\n\t\t\t<BlockListItems renderAppender={ false } layout={ layout } />\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n\n\treturn {\n\t\t...props,\n\t\tref,\n\t\tclassName: classnames(\n\t\t\tprops.className,\n\t\t\t'block-editor-block-preview__live-content',\n\t\t\t'components-disabled'\n\t\t),\n\t\tchildren: blocks?.length ? children : null,\n\t};\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,WAAW,EAAEC,YAAY,QAAQ,oBAAoB;AAC9D,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,IAAI,EAAEC,OAAO,QAAQ,oBAAoB;AAClD,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,+BAA+B,QAAQ,aAAa;AAC7D,OAAOC,sBAAsB,MAAM,QAAQ;AAC3C,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,cAAc,QAAQ,eAAe;AAE9C,OAAO,SAASC,YAAYA,CAAE;EAC7BC,MAAM;EACNC,aAAa,GAAG,IAAI;EACpBC,SAAS;EACTC,gBAAgB,GAAG,EAAE;EACrB;EACAC,uBAAuB;EACvBC;AACD,CAAC,EAAG;EACH,IAAKD,uBAAuB,EAAG;IAC9BF,SAAS,GAAGE,uBAAuB;IACnCZ,UAAU,CAAE,kCAAkC,EAAE;MAC/Cc,KAAK,EAAE,KAAK;MACZC,OAAO,EAAE,KAAK;MACdC,WAAW,EAAE;IACd,CAAE,CAAC;EACJ;EACA,IAAKH,qBAAqB,EAAG;IAC5BF,gBAAgB,GAAG,CAClB,GAAGA,gBAAgB,EACnB;MAAEM,GAAG,EAAG,mBAAmBJ,qBAAuB;IAAO,CAAC,CAC1D;IACDb,UAAU,CAAE,gDAAgD,EAAE;MAC7Dc,KAAK,EAAE,KAAK;MACZC,OAAO,EAAE,KAA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C,QAAQ,GAAGtB,OAAO,CACvB,OAAQ;IACP,GAAGmB,gBAAgB;IACnBe,MAAM,EAAEC,SAAS;IAAE;IACnBZ,SAAS,EAAE,KAAK;IAAE;IAClBC,uBAAuB,EAAE;EAC1B,CAAC,CAAE,EACH,CAAEL,gBAAgB,CACnB,CAAC;EACD,MAAMiB,WAAW,GAAGxC,WAAW,CAAC,CAAC;EACjC,MAAMyC,GAAG,GAAGxC,YAAY,CAAE,CAAEmC,KAAK,CAACK,GAAG,EAAED,WAAW,CAAG,CAAC;EACtD,MAAMX,cAAc,GAAGzB,OAAO,CAC7B,MAAQ0B,KAAK,CAACC,OAAO,CAAElB,MAAO,CAAC,GAAGA,MAAM,GAAG,CAAEA,MAAM,CAAI,EACvD,CAAEA,MAAM,CACT,CAAC;EAED,MAAM6B,QAAQ,GACbT,aAAA,CAAC3B,+BAA+B;IAC/B4B,KAAK,EAAGL,cAAgB;IACxBH,QAAQ,EAAGA;EAAU,GAErBO,aAAA,CAACzB,YAAY,MAAE,CAAC,EAChByB,aAAA,CAACtB,cAAc;IAACgC,cAAc,EAAG,KAAO;IAACN,MAAM,EAAGA;EAAQ,CAAE,CAC5B,CACjC;EAED,OAAO;IACN,GAAGD,KAAK;IACRK,GAAG;IACHG,SAAS,EAAE7C,UAAU,CACpBqC,KAAK,CAACQ,SAAS,EACf,0CAA0C,EAC1C,qBACD,CAAC;IACDF,QAAQ,EAAE7B,MAAM,EAAEmB,MAAM,GAAGU,QAAQ,GAAG;EACvC,CAAC;AACF"}
1
+ {"version":3,"names":["classnames","useDisabled","useMergeRefs","useSelect","memo","useMemo","deprecated","ExperimentalBlockEditorProvider","AutoHeightBlockPreview","EditorStyles","store","blockEditorStore","BlockListItems","EMPTY_ADDITIONAL_STYLES","BlockPreview","blocks","viewportWidth","minHeight","additionalStyles","__experimentalMinHeight","__experimentalPadding","since","version","alternative","css","originalSettings","select","getSettings","settings","focusMode","__unstableIsPreviewMode","renderedBlocks","Array","isArray","length","createElement","value","useBlockPreview","props","layout","styles","undefined","disabledRef","ref","children","renderAppender","className"],"sources":["@wordpress/block-editor/src/components/block-preview/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useDisabled, useMergeRefs } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { memo, useMemo } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { ExperimentalBlockEditorProvider } from '../provider';\nimport AutoHeightBlockPreview from './auto';\nimport EditorStyles from '../editor-styles';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockListItems } from '../block-list';\n\nconst EMPTY_ADDITIONAL_STYLES = [];\n\nexport function BlockPreview( {\n\tblocks,\n\tviewportWidth = 1200,\n\tminHeight,\n\tadditionalStyles = EMPTY_ADDITIONAL_STYLES,\n\t// Deprecated props:\n\t__experimentalMinHeight,\n\t__experimentalPadding,\n} ) {\n\tif ( __experimentalMinHeight ) {\n\t\tminHeight = __experimentalMinHeight;\n\t\tdeprecated( 'The __experimentalMinHeight prop', {\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t\talternative: 'minHeight',\n\t\t} );\n\t}\n\tif ( __experimentalPadding ) {\n\t\tadditionalStyles = [\n\t\t\t...additionalStyles,\n\t\t\t{ css: `body { padding: ${ __experimentalPadding }px; }` },\n\t\t];\n\t\tdeprecated( 'The __experimentalPadding prop of BlockPreview', {\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t\talternative: 'additionalStyles',\n\t\t} );\n\t}\n\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...originalSettings,\n\t\t\tfocusMode: false, // Disable \"Spotlight mode\".\n\t\t\t__unstableIsPreviewMode: true,\n\t\t} ),\n\t\t[ originalSettings ]\n\t);\n\tconst renderedBlocks = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tif ( ! blocks || blocks.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tvalue={ renderedBlocks }\n\t\t\tsettings={ settings }\n\t\t>\n\t\t\t<AutoHeightBlockPreview\n\t\t\t\tviewportWidth={ viewportWidth }\n\t\t\t\tminHeight={ minHeight }\n\t\t\t\tadditionalStyles={ additionalStyles }\n\t\t\t/>\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n\n/**\n * BlockPreview renders a preview of a block or array of blocks.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-preview/README.md\n *\n * @param {Object} preview options for how the preview should be shown\n * @param {Array|Object} preview.blocks A block instance (object) or an array of blocks to be previewed.\n * @param {number} preview.viewportWidth Width of the preview container in pixels. Controls at what size the blocks will be rendered inside the preview. Default: 700.\n *\n * @return {Component} The component to be rendered.\n */\nexport default memo( BlockPreview );\n\n/**\n * This hook is used to lightly mark an element as a block preview wrapper\n * element. Call this hook and pass the returned props to the element to mark as\n * a block preview wrapper, automatically rendering inner blocks as children. If\n * you define a ref for the element, it is important to pass the ref to this\n * hook, which the hook in turn will pass to the component through the props it\n * returns. Optionally, you can also pass any other props through this hook, and\n * they will be merged and returned.\n *\n * @param {Object} options Preview options.\n * @param {WPBlock[]} options.blocks Block objects.\n * @param {Object} options.props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options.layout Layout settings to be used in the preview.\n */\nexport function useBlockPreview( { blocks, props = {}, layout } ) {\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...originalSettings,\n\t\t\tstyles: undefined, // Clear styles included by the parent settings, as they are already output by the parent's EditorStyles.\n\t\t\tfocusMode: false, // Disable \"Spotlight mode\".\n\t\t\t__unstableIsPreviewMode: true,\n\t\t} ),\n\t\t[ originalSettings ]\n\t);\n\tconst disabledRef = useDisabled();\n\tconst ref = useMergeRefs( [ props.ref, disabledRef ] );\n\tconst renderedBlocks = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tconst children = (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tvalue={ renderedBlocks }\n\t\t\tsettings={ settings }\n\t\t>\n\t\t\t<EditorStyles />\n\t\t\t<BlockListItems renderAppender={ false } layout={ layout } />\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n\n\treturn {\n\t\t...props,\n\t\tref,\n\t\tclassName: classnames(\n\t\t\tprops.className,\n\t\t\t'block-editor-block-preview__live-content',\n\t\t\t'components-disabled'\n\t\t),\n\t\tchildren: blocks?.length ? children : null,\n\t};\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,WAAW,EAAEC,YAAY,QAAQ,oBAAoB;AAC9D,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,IAAI,EAAEC,OAAO,QAAQ,oBAAoB;AAClD,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,+BAA+B,QAAQ,aAAa;AAC7D,OAAOC,sBAAsB,MAAM,QAAQ;AAC3C,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,cAAc,QAAQ,eAAe;AAE9C,MAAMC,uBAAuB,GAAG,EAAE;AAElC,OAAO,SAASC,YAAYA,CAAE;EAC7BC,MAAM;EACNC,aAAa,GAAG,IAAI;EACpBC,SAAS;EACTC,gBAAgB,GAAGL,uBAAuB;EAC1C;EACAM,uBAAuB;EACvBC;AACD,CAAC,EAAG;EACH,IAAKD,uBAAuB,EAAG;IAC9BF,SAAS,GAA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,EAAE7B,MAAM,EAAEmB,MAAM,GAAGU,QAAQ,GAAG;EACvC,CAAC;AACF"}
@@ -5,7 +5,7 @@ import { createElement } from "react";
5
5
  import { useEffect } from '@wordpress/element';
6
6
  import { useDispatch, useSelect } from '@wordpress/data';
7
7
  import { Modal, Button, __experimentalHStack as HStack } from '@wordpress/components';
8
- import { __, _n } from '@wordpress/i18n';
8
+ import { __ } from '@wordpress/i18n';
9
9
 
10
10
  /**
11
11
  * Internal dependencies
@@ -18,8 +18,7 @@ export function BlockRemovalWarningModal({
18
18
  const {
19
19
  clientIds,
20
20
  selectPrevious,
21
- blockNamesForPrompt,
22
- messageType
21
+ message
23
22
  } = useSelect(select => unlock(select(blockEditorStore)).getRemovalPromptData());
24
23
  const {
25
24
  clearBlockRemovalPrompt,
@@ -35,10 +34,9 @@ export function BlockRemovalWarningModal({
35
34
  setBlockRemovalRules();
36
35
  };
37
36
  }, [rules, setBlockRemovalRules]);
38
- if (!blockNamesForPrompt) {
37
+ if (!message) {
39
38
  return;
40
39
  }
41
- const message = messageType === 'templates' ? _n('Deleting this block will stop your post or page content from displaying on this template. It is not recommended.', 'Deleting these blocks will stop your post or page content from displaying on this template. It is not recommended.', blockNamesForPrompt.length) : _n('Deleting this block could break patterns on your site that have content linked to it. Are you sure you want to delete it?', 'Deleting these blocks could break patterns on your site that have content linked to them. Are you sure you want to delete them?', blockNamesForPrompt.length);
42
40
  const onConfirmRemoval = () => {
43
41
  privateRemoveBlocks(clientIds, selectPrevious, /* force */true);
44
42
  clearBlockRemovalPrompt();
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useDispatch","useSelect","Modal","Button","__experimentalHStack","HStack","__","_n","store","blockEditorStore","unlock","BlockRemovalWarningModal","rules","clientIds","selectPrevious","blockNamesForPrompt","messageType","select","getRemovalPromptData","clearBlockRemovalPrompt","setBlockRemovalRules","privateRemoveBlocks","message","length","onConfirmRemoval","createElement","title","onRequestClose","size","justify","variant","onClick"],"sources":["@wordpress/block-editor/src/components/block-removal-warning-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tModal,\n\tButton,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { __, _n } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport function BlockRemovalWarningModal( { rules } ) {\n\tconst { clientIds, selectPrevious, blockNamesForPrompt, messageType } =\n\t\tuseSelect( ( select ) =>\n\t\t\tunlock( select( blockEditorStore ) ).getRemovalPromptData()\n\t\t);\n\n\tconst {\n\t\tclearBlockRemovalPrompt,\n\t\tsetBlockRemovalRules,\n\t\tprivateRemoveBlocks,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\n\t// Load block removal rules, simultaneously signalling that the block\n\t// removal prompt is in place.\n\tuseEffect( () => {\n\t\tsetBlockRemovalRules( rules );\n\t\treturn () => {\n\t\t\tsetBlockRemovalRules();\n\t\t};\n\t}, [ rules, setBlockRemovalRules ] );\n\n\tif ( ! blockNamesForPrompt ) {\n\t\treturn;\n\t}\n\n\tconst message =\n\t\tmessageType === 'templates'\n\t\t\t? _n(\n\t\t\t\t\t'Deleting this block will stop your post or page content from displaying on this template. It is not recommended.',\n\t\t\t\t\t'Deleting these blocks will stop your post or page content from displaying on this template. It is not recommended.',\n\t\t\t\t\tblockNamesForPrompt.length\n\t\t\t )\n\t\t\t: _n(\n\t\t\t\t\t'Deleting this block could break patterns on your site that have content linked to it. Are you sure you want to delete it?',\n\t\t\t\t\t'Deleting these blocks could break patterns on your site that have content linked to them. Are you sure you want to delete them?',\n\t\t\t\t\tblockNamesForPrompt.length\n\t\t\t );\n\n\tconst onConfirmRemoval = () => {\n\t\tprivateRemoveBlocks( clientIds, selectPrevious, /* force */ true );\n\t\tclearBlockRemovalPrompt();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Be careful!' ) }\n\t\t\tonRequestClose={ clearBlockRemovalPrompt }\n\t\t\tsize=\"medium\"\n\t\t>\n\t\t\t<p>{ message }</p>\n\t\t\t<HStack justify=\"right\">\n\t\t\t\t<Button variant=\"tertiary\" onClick={ clearBlockRemovalPrompt }>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</Button>\n\t\t\t\t<Button variant=\"primary\" onClick={ onConfirmRemoval }>\n\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t\t</Button>\n\t\t\t</HStack>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SACCC,KAAK,EACLC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;;AAExC;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,OAAO,SAASC,wBAAwBA,CAAE;EAAEC;AAAM,CAAC,EAAG;EACrD,MAAM;IAAEC,SAAS;IAAEC,cAAc;IAAEC,mBAAmB;IAAEC;EAAY,CAAC,GACpEf,SAAS,CAAIgB,MAAM,IAClBP,MAAM,CAAEO,MAAM,CAAER,gBAAiB,CAAE,CAAC,CAACS,oBAAoB,CAAC,CAC3D,CAAC;EAEF,MAAM;IACLC,uBAAuB;IACvBC,oBAAoB;IACpBC;EACD,CAAC,GAAGX,MAAM,CAAEV,WAAW,CAAES,gBAAiB,CAAE,CAAC;;EAE7C;EACA;EACAV,SAAS,CAAE,MAAM;IAChBqB,oBAAoB,CAAER,KAAM,CAAC;IAC7B,OAAO,MAAM;MACZQ,oBAAoB,CAAC,CAAC;IACvB,CAAC;EACF,CAAC,EAAE,CAAER,KAAK,EAAEQ,oBAAoB,CAAG,CAAC;EAEpC,IAAK,CAAEL,mBAAmB,EAAG;IAC5B;EACD;EAEA,MAAMO,OAAO,GACZN,WAAW,KAAK,WAAW,GACxBT,EAAE,CACF,kHAAkH,EAClH,oHAAoH,EACpHQ,mBAAmB,CAACQ,MACpB,CAAC,GACDhB,EAAE,CACF,2HAA2H,EAC3H,iIAAiI,EACjIQ,mBAAmB,CAACQ,MACpB,CAAC;EAEL,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;IAC9BH,mBAAmB,CAAER,SAAS,EAAEC,cAAc,EAAE,WAAY,IAAK,CAAC;IAClEK,uBAAuB,CAAC,CAAC;EAC1B,CAAC;EAED,OACCM,aAAA,CAACvB,KAAK;IACLwB,KAAK,EAAGpB,EAAE,CAAE,aAAc,CAAG;IAC7BqB,cAAc,EAAGR,uBAAyB;IAC1CS,IAAI,EAAC;EAAQ,GAEbH,aAAA,YAAKH,OAAY,CAAC,EAClBG,aAAA,CAACpB,MAAM;IAACwB,OAAO,EAAC;EAAO,GACtBJ,aAAA,CAACtB,MAAM;IAAC2B,OAAO,EAAC,UAAU;IAACC,OAAO,EAAGZ;EAAyB,GAC3Db,EAAE,CAAE,QAAS,CACR,CAAC,EACTmB,aAAA,CAACtB,MAAM;IAAC2B,OAAO,EAAC,SAAS;IAACC,OAAO,EAAGP;EAAkB,GACnDlB,EAAE,CAAE,QAAS,CACR,CACD,CACF,CAAC;AAEV"}
1
+ {"version":3,"names":["useEffect","useDispatch","useSelect","Modal","Button","__experimentalHStack","HStack","__","store","blockEditorStore","unlock","BlockRemovalWarningModal","rules","clientIds","selectPrevious","message","select","getRemovalPromptData","clearBlockRemovalPrompt","setBlockRemovalRules","privateRemoveBlocks","onConfirmRemoval","createElement","title","onRequestClose","size","justify","variant","onClick"],"sources":["@wordpress/block-editor/src/components/block-removal-warning-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tModal,\n\tButton,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport function BlockRemovalWarningModal( { rules } ) {\n\tconst { clientIds, selectPrevious, message } = useSelect( ( select ) =>\n\t\tunlock( select( blockEditorStore ) ).getRemovalPromptData()\n\t);\n\n\tconst {\n\t\tclearBlockRemovalPrompt,\n\t\tsetBlockRemovalRules,\n\t\tprivateRemoveBlocks,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\n\t// Load block removal rules, simultaneously signalling that the block\n\t// removal prompt is in place.\n\tuseEffect( () => {\n\t\tsetBlockRemovalRules( rules );\n\t\treturn () => {\n\t\t\tsetBlockRemovalRules();\n\t\t};\n\t}, [ rules, setBlockRemovalRules ] );\n\n\tif ( ! message ) {\n\t\treturn;\n\t}\n\n\tconst onConfirmRemoval = () => {\n\t\tprivateRemoveBlocks( clientIds, selectPrevious, /* force */ true );\n\t\tclearBlockRemovalPrompt();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Be careful!' ) }\n\t\t\tonRequestClose={ clearBlockRemovalPrompt }\n\t\t\tsize=\"medium\"\n\t\t>\n\t\t\t<p>{ message }</p>\n\t\t\t<HStack justify=\"right\">\n\t\t\t\t<Button variant=\"tertiary\" onClick={ clearBlockRemovalPrompt }>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</Button>\n\t\t\t\t<Button variant=\"primary\" onClick={ onConfirmRemoval }>\n\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t\t</Button>\n\t\t\t</HStack>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SACCC,KAAK,EACLC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,QAC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AM;IAACuB,OAAO,EAAC,SAAS;IAACC,OAAO,EAAGP;EAAkB,GACnDd,EAAE,CAAE,QAAS,CACR,CACD,CACF,CAAC;AAEV"}
@@ -1 +1 @@
1
- {"version":3,"names":["__experimentalHStack","HStack","__experimentalVStack","VStack","Button","TextControl","Modal","useInstanceId","__","sprintf","useState","speak","isEmptyString","BlockRenameModal","blockName","originalBlockName","onClose","onSave","editedBlockName","setEditedBlockName","nameHasChanged","nameIsOriginal","nameIsEmpty","isNameValid","autoSelectInputText","event","target","select","dialogDescription","handleSubmit","message","createElement","title","onRequestClose","overlayClassName","aria","describedby","focusOnMount","id","onSubmit","e","preventDefault","spacing","__nextHasNoMarginBottom","__next40pxDefaultSize","value","label","hideLabelFromVision","placeholder","onChange","onFocus","justify","variant","onClick","type"],"sources":["@wordpress/block-editor/src/components/block-rename/modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\tTextControl,\n\tModal,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport isEmptyString from './is-empty-string';\n\nexport default function BlockRenameModal( {\n\tblockName,\n\toriginalBlockName,\n\tonClose,\n\tonSave,\n} ) {\n\tconst [ editedBlockName, setEditedBlockName ] = useState( blockName );\n\n\tconst nameHasChanged = editedBlockName !== blockName;\n\tconst nameIsOriginal = editedBlockName === originalBlockName;\n\tconst nameIsEmpty = isEmptyString( editedBlockName );\n\n\tconst isNameValid = nameHasChanged || nameIsOriginal;\n\n\tconst autoSelectInputText = ( event ) => event.target.select();\n\n\tconst dialogDescription = useInstanceId(\n\t\tBlockRenameModal,\n\t\t`block-editor-rename-modal__description`\n\t);\n\n\tconst handleSubmit = () => {\n\t\tconst message =\n\t\t\tnameIsOriginal || nameIsEmpty\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %s: new name/label for the block */\n\t\t\t\t\t\t__( 'Block name reset to: \"%s\".' ),\n\t\t\t\t\t\teditedBlockName\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: new name/label for the block */\n\t\t\t\t\t\t__( 'Block name changed to: \"%s\".' ),\n\t\t\t\t\t\teditedBlockName\n\t\t\t\t );\n\n\t\t// Must be assertive to immediately announce change.\n\t\tspeak( message, 'assertive' );\n\t\tonSave( editedBlockName );\n\n\t\t// Immediate close avoids ability to hit save multiple times.\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Rename' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\toverlayClassName=\"block-editor-block-rename-modal\"\n\t\t\taria={ {\n\t\t\t\tdescribedby: dialogDescription,\n\t\t\t} }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t>\n\t\t\t<p id={ dialogDescription }>\n\t\t\t\t{ __( 'Enter a custom name for this block.' ) }\n\t\t\t</p>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( e ) => {\n\t\t\t\t\te.preventDefault();\n\n\t\t\t\t\tif ( ! isNameValid ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\thandleSubmit();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ editedBlockName }\n\t\t\t\t\t\tlabel={ __( 'Block name' ) }\n\t\t\t\t\t\thideLabelFromVision={ true }\n\t\t\t\t\t\tplaceholder={ originalBlockName }\n\t\t\t\t\t\tonChange={ setEditedBlockName }\n\t\t\t\t\t\tonFocus={ autoSelectInputText }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\taria-disabled={ ! isNameValid }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,MAAM,EACNC,WAAW,EACXC,KAAK,QACC,uBAAuB;AAC9B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,KAAK,QAAQ,iBAAiB;;AAEvC;AACA;AACA;AACA,OAAOC,aAAa,MAAM,mBAAmB;AAE7C,eAAe,SAASC,gBAAgBA,CAAE;EACzCC,SAAS;EACTC,iBAAiB;EACjBC,OAAO;EACPC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,eAAe,EAAEC,kBAAkB,CAAE,GAAGT,QAAQ,CAAEI,SAAU,CAAC;EAErE,MAAMM,cAAc,GAAGF,eAAe,KAAKJ,SAAS;EACpD,MAAMO,cAAc,GAAGH,eAAe,KAAKH,iBAAiB;EAC5D,MAAMO,WAAW,GAAGV,aAAa,CAAEM,eAAgB,CAAC;EAEpD,MAAMK,WAAW,GAAGH,cAAc,IAAIC,cAAc;EAEpD,MAAMG,mBAAmB,GAAKC,KAAK,IAAMA,KA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AC/B,CAAC,EACFO,aAAA,CAAC9B,MAAM;IAACkD,OAAO,EAAC;EAAO,GACtBpB,aAAA,CAAC3B,MAAM;IACNwC,qBAAqB;IACrBQ,OAAO,EAAC,UAAU;IAClBC,OAAO,EAAGrC;EAAS,GAEjBR,EAAE,CAAE,QAAS,CACR,CAAC,EAETuB,aAAA,CAAC3B,MAAM;IACNwC,qBAAqB;IACrB,iBAAgB,CAAErB,WAAa;IAC/B6B,OAAO,EAAC,SAAS;IACjBE,IAAI,EAAC;EAAQ,GAEX9C,EAAE,CAAE,MAAO,CACN,CACD,CACD,CACH,CACA,CAAC;AAEV"}
1
+ {"version":3,"names":["__experimentalHStack","HStack","__experimentalVStack","VStack","Button","TextControl","Modal","useInstanceId","__","sprintf","useState","speak","isEmptyString","BlockRenameModal","blockName","originalBlockName","onClose","onSave","editedBlockName","setEditedBlockName","nameHasChanged","nameIsOriginal","nameIsEmpty","isNameValid","autoSelectInputText","event","target","select","dialogDescription","handleSubmit","message","createElement","title","onRequestClose","overlayClassName","aria","describedby","focusOnMount","id","onSubmit","e","preventDefault","spacing","__nextHasNoMarginBottom","__next40pxDefaultSize","value","label","hideLabelFromVision","placeholder","onChange","onFocus","justify","variant","onClick","type"],"sources":["@wordpress/block-editor/src/components/block-rename/modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\tTextControl,\n\tModal,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport isEmptyString from './is-empty-string';\n\nexport default function BlockRenameModal( {\n\tblockName,\n\toriginalBlockName,\n\tonClose,\n\tonSave,\n} ) {\n\tconst [ editedBlockName, setEditedBlockName ] = useState( blockName );\n\n\tconst nameHasChanged = editedBlockName !== blockName;\n\tconst nameIsOriginal = editedBlockName === originalBlockName;\n\tconst nameIsEmpty = isEmptyString( editedBlockName );\n\n\tconst isNameValid = nameHasChanged || nameIsOriginal;\n\n\tconst autoSelectInputText = ( event ) => event.target.select();\n\n\tconst dialogDescription = useInstanceId(\n\t\tBlockRenameModal,\n\t\t`block-editor-rename-modal__description`\n\t);\n\n\tconst handleSubmit = () => {\n\t\tconst message =\n\t\t\tnameIsOriginal || nameIsEmpty\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %s: new name/label for the block */\n\t\t\t\t\t\t__( 'Block name reset to: \"%s\".' ),\n\t\t\t\t\t\teditedBlockName\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: new name/label for the block */\n\t\t\t\t\t\t__( 'Block name changed to: \"%s\".' ),\n\t\t\t\t\t\teditedBlockName\n\t\t\t\t );\n\n\t\t// Must be assertive to immediately announce change.\n\t\tspeak( message, 'assertive' );\n\t\tonSave( editedBlockName );\n\n\t\t// Immediate close avoids ability to hit save multiple times.\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Rename' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\toverlayClassName=\"block-editor-block-rename-modal\"\n\t\t\taria={ {\n\t\t\t\tdescribedby: dialogDescription,\n\t\t\t} }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t>\n\t\t\t<p id={ dialogDescription }>\n\t\t\t\t{ __( 'Enter a custom name for this block.' ) }\n\t\t\t</p>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( e ) => {\n\t\t\t\t\te.preventDefault();\n\n\t\t\t\t\tif ( ! isNameValid ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\thandleSubmit();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ editedBlockName }\n\t\t\t\t\t\tlabel={ __( 'Block name' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tplaceholder={ originalBlockName }\n\t\t\t\t\t\tonChange={ setEditedBlockName }\n\t\t\t\t\t\tonFocus={ autoSelectInputText }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\taria-disabled={ ! isNameValid }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,MAAM,EACNC,WAAW,EACXC,KAAK,QACC,uBAAuB;AAC9B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,KAAK,QAAQ,iBAAiB;;AAEvC;AACA;AACA;AACA,OAAOC,aAAa,MAAM,mBAAmB;AAE7C,eAAe,SAASC,gBAAgBA,CAAE;EACzCC,SAAS;EACTC,iBAAiB;EACjBC,OAAO;EACPC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,eAAe,EAAEC,kBAAkB,CAAE,GAAGT,QAAQ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,GAClBX,aAAA,CAAC1B,WAAW;IACXsC,uBAAuB;IACvBC,qBAAqB;IACrBC,KAAK,EAAG3B,eAAiB;IACzB4B,KAAK,EAAGtC,EAAE,CAAE,YAAa,CAAG;IAC5BuC,mBAAmB;IACnBC,WAAW,EAAGjC,iBAAmB;IACjCkC,QAAQ,EAAG9B,kBAAoB;IAC/B+B,OAAO,EAAG1B;EAAqB,CAC/B,CAAC,EACFO,aAAA,CAAC9B,MAAM;IAACkD,OAAO,EAAC;EAAO,GACtBpB,aAAA,CAAC3B,MAAM;IACNwC,qBAAqB;IACrBQ,OAAO,EAAC,UAAU;IAClBC,OAAO,EAAGrC;EAAS,GAEjBR,EAAE,CAAE,QAAS,CACR,CAAC,EAETuB,aAAA,CAAC3B,MAAM;IACNwC,qBAAqB;IACrB,iBAAgB,CAAErB,WAAa;IAC/B6B,OAAO,EAAC,SAAS;IACjBE,IAAI,EAAC;EAAQ,GAEX9C,EAAE,CAAE,MAAO,CACN,CACD,CACD,CACH,CACA,CAAC;AAEV"}
@@ -26,11 +26,14 @@ const POPOVER_PROPS = {
26
26
  placement: 'bottom-start'
27
27
  };
28
28
  function CopyMenuItem({
29
- blocks,
29
+ clientIds,
30
30
  onCopy,
31
31
  label
32
32
  }) {
33
- const ref = useCopyToClipboard(() => serialize(blocks), onCopy);
33
+ const {
34
+ getBlocksByClientId
35
+ } = useSelect(blockEditorStore);
36
+ const ref = useCopyToClipboard(() => serialize(getBlocksByClientId(clientIds)), onCopy);
34
37
  const copyMenuItemLabel = label ? label : __('Copy');
35
38
  return createElement(MenuItem, {
36
39
  ref: ref
@@ -148,7 +151,7 @@ export function BlockSettingsDropdown({
148
151
  }, ({
149
152
  canCopyStyles,
150
153
  canDuplicate,
151
- canInsertDefaultBlock,
154
+ canInsertBlock,
152
155
  canMove,
153
156
  canRemove,
154
157
  onDuplicate,
@@ -157,8 +160,7 @@ export function BlockSettingsDropdown({
157
160
  onRemove,
158
161
  onCopy,
159
162
  onPasteStyles,
160
- onMoveTo,
161
- blocks
163
+ onMoveTo
162
164
  }) => createElement(DropdownMenu, {
163
165
  icon: moreVertical,
164
166
  label: __('Options'),
@@ -179,11 +181,11 @@ export function BlockSettingsDropdown({
179
181
  } else if (isMatch('core/block-editor/duplicate', event) && canDuplicate) {
180
182
  event.preventDefault();
181
183
  updateSelectionAfterDuplicate(onDuplicate());
182
- } else if (isMatch('core/block-editor/insert-after', event) && canInsertDefaultBlock) {
184
+ } else if (isMatch('core/block-editor/insert-after', event) && canInsertBlock) {
183
185
  event.preventDefault();
184
186
  setOpenedBlockSettingsMenu(undefined);
185
187
  onInsertAfter();
186
- } else if (isMatch('core/block-editor/insert-before', event) && canInsertDefaultBlock) {
188
+ } else if (isMatch('core/block-editor/insert-before', event) && canInsertBlock) {
187
189
  event.preventDefault();
188
190
  setOpenedBlockSettingsMenu(undefined);
189
191
  onInsertBefore();
@@ -203,19 +205,19 @@ export function BlockSettingsDropdown({
203
205
  }), count === 1 && createElement(BlockHTMLConvertButton, {
204
206
  clientId: firstBlockClientId
205
207
  }), createElement(CopyMenuItem, {
206
- blocks: blocks,
208
+ clientIds: clientIds,
207
209
  onCopy: onCopy
208
210
  }), canDuplicate && createElement(MenuItem, {
209
211
  onClick: pipe(onClose, onDuplicate, updateSelectionAfterDuplicate),
210
212
  shortcut: shortcuts.duplicate
211
- }, __('Duplicate')), canInsertDefaultBlock && createElement(Fragment, null, createElement(MenuItem, {
213
+ }, __('Duplicate')), canInsertBlock && createElement(Fragment, null, createElement(MenuItem, {
212
214
  onClick: pipe(onClose, onInsertBefore),
213
215
  shortcut: shortcuts.insertBefore
214
216
  }, __('Add before')), createElement(MenuItem, {
215
217
  onClick: pipe(onClose, onInsertAfter),
216
218
  shortcut: shortcuts.insertAfter
217
219
  }, __('Add after')))), canCopyStyles && createElement(MenuGroup, null, createElement(CopyMenuItem, {
218
- blocks: blocks,
220
+ clientIds: clientIds,
219
221
  onCopy: onCopy,
220
222
  label: __('Copy styles')
221
223
  }), createElement(MenuItem, {
@@ -1 +1 @@
1
- {"version":3,"names":["getBlockType","serialize","store","blocksStore","DropdownMenu","MenuGroup","MenuItem","useDispatch","useSelect","moreVertical","Children","cloneElement","useCallback","__","keyboardShortcutsStore","__unstableUseShortcutEventMatch","pipe","useCopyToClipboard","BlockActions","BlockHTMLConvertButton","__unstableBlockSettingsMenuFirstItem","BlockSettingsMenuControls","BlockParentSelectorMenuItem","blockEditorStore","unlock","POPOVER_PROPS","className","placement","CopyMenuItem","blocks","onCopy","label","ref","copyMenuItemLabel","createElement","BlockSettingsDropdown","block","clientIds","__experimentalSelectBlock","children","__unstableDisplayLocation","props","currentClientId","clientId","blockClientIds","Array","isArray","count","length","firstBlockClientId","firstParentClientId","onlyBlock","parentBlockType","previousBlockClientId","selectedBlockClientIds","openedBlockSettingsMenu","select","getBlockCount","getBlockName","getBlockRootClientId","getPreviousBlockClientId","getSelectedBlockClientIds","getBlockAttributes","getOpenedBlockSettingsMenu","getActiveBlockVariation","_firstParentClientId","parentBlockName","getBlockOrder","setOpenedBlockSettingsMenu","shortcuts","getShortcutRepresentation","duplicate","remove","insertAfter","insertBefore","isMatch","hasSelectedBlocks","updateSelectionAfterDuplicate","clientIdsPromise","ids","updateSelectionAfterRemove","blockToFocus","shouldUpdateSelection","parentBlockIsSelected","includes","open","undefined","onToggle","localOpen","__experimentalUpdateSelection","canCopyStyles","canDuplicate","canInsertDefaultBlock","canMove","canRemove","onDuplicate","onInsertAfter","onInsertBefore","onRemove","onPasteStyles","onMoveTo","icon","popoverProps","noIcons","menuProps","onKeyDown","event","defaultPrevented","preventDefault","onClose","Fragment","Slot","fillProps","parentClientId","onClick","shortcut","map","child"],"sources":["@wordpress/block-editor/src/components/block-settings-menu/block-settings-dropdown.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockType,\n\tserialize,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { moreVertical } from '@wordpress/icons';\nimport { Children, cloneElement, useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tstore as keyboardShortcutsStore,\n\t__unstableUseShortcutEventMatch,\n} from '@wordpress/keyboard-shortcuts';\nimport { pipe, useCopyToClipboard } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockActions from '../block-actions';\nimport BlockHTMLConvertButton from './block-html-convert-button';\nimport __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';\nimport BlockSettingsMenuControls from '../block-settings-menu-controls';\nimport BlockParentSelectorMenuItem from './block-parent-selector-menu-item';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst POPOVER_PROPS = {\n\tclassName: 'block-editor-block-settings-menu__popover',\n\tplacement: 'bottom-start',\n};\n\nfunction CopyMenuItem( { blocks, onCopy, label } ) {\n\tconst ref = useCopyToClipboard( () => serialize( blocks ), onCopy );\n\tconst copyMenuItemLabel = label ? label : __( 'Copy' );\n\treturn <MenuItem ref={ ref }>{ copyMenuItemLabel }</MenuItem>;\n}\n\nexport function BlockSettingsDropdown( {\n\tblock,\n\tclientIds,\n\t__experimentalSelectBlock,\n\tchildren,\n\t__unstableDisplayLocation,\n\t...props\n} ) {\n\t// Get the client id of the current block for this menu, if one is set.\n\tconst currentClientId = block?.clientId;\n\tconst blockClientIds = Array.isArray( clientIds )\n\t\t? clientIds\n\t\t: [ clientIds ];\n\tconst count = blockClientIds.length;\n\tconst firstBlockClientId = blockClientIds[ 0 ];\n\tconst {\n\t\tfirstParentClientId,\n\t\tonlyBlock,\n\t\tparentBlockType,\n\t\tpreviousBlockClientId,\n\t\tselectedBlockClientIds,\n\t\topenedBlockSettingsMenu,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetOpenedBlockSettingsMenu,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\tconst { getActiveBlockVariation } = select( blocksStore );\n\n\t\t\tconst _firstParentClientId =\n\t\t\t\tgetBlockRootClientId( firstBlockClientId );\n\t\t\tconst parentBlockName =\n\t\t\t\t_firstParentClientId && getBlockName( _firstParentClientId );\n\n\t\t\treturn {\n\t\t\t\tfirstParentClientId: _firstParentClientId,\n\t\t\t\tonlyBlock: 1 === getBlockCount( _firstParentClientId ),\n\t\t\t\tparentBlockType:\n\t\t\t\t\t_firstParentClientId &&\n\t\t\t\t\t( getActiveBlockVariation(\n\t\t\t\t\t\tparentBlockName,\n\t\t\t\t\t\tgetBlockAttributes( _firstParentClientId )\n\t\t\t\t\t) ||\n\t\t\t\t\t\tgetBlockType( parentBlockName ) ),\n\t\t\t\tpreviousBlockClientId:\n\t\t\t\t\tgetPreviousBlockClientId( firstBlockClientId ),\n\t\t\t\tselectedBlockClientIds: getSelectedBlockClientIds(),\n\t\t\t\topenedBlockSettingsMenu: getOpenedBlockSettingsMenu(),\n\t\t\t};\n\t\t},\n\t\t[ firstBlockClientId ]\n\t);\n\tconst { getBlockOrder, getSelectedBlockClientIds } =\n\t\tuseSelect( blockEditorStore );\n\n\tconst { setOpenedBlockSettingsMenu } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tconst shortcuts = useSelect( ( select ) => {\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\t\treturn {\n\t\t\tduplicate: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/duplicate'\n\t\t\t),\n\t\t\tremove: getShortcutRepresentation( 'core/block-editor/remove' ),\n\t\t\tinsertAfter: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/insert-after'\n\t\t\t),\n\t\t\tinsertBefore: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/insert-before'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst isMatch = __unstableUseShortcutEventMatch();\n\tconst hasSelectedBlocks = selectedBlockClientIds.length > 0;\n\n\tconst updateSelectionAfterDuplicate = useCallback(\n\t\tasync ( clientIdsPromise ) => {\n\t\t\tif ( __experimentalSelectBlock ) {\n\t\t\t\tconst ids = await clientIdsPromise;\n\t\t\t\tif ( ids && ids[ 0 ] ) {\n\t\t\t\t\t__experimentalSelectBlock( ids[ 0 ], false );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[ __experimentalSelectBlock ]\n\t);\n\n\tconst updateSelectionAfterRemove = useCallback( () => {\n\t\tif ( __experimentalSelectBlock ) {\n\t\t\tlet blockToFocus = previousBlockClientId || firstParentClientId;\n\n\t\t\t// Focus the first block if there's no previous block nor parent block.\n\t\t\tif ( ! blockToFocus ) {\n\t\t\t\tblockToFocus = getBlockOrder()[ 0 ];\n\t\t\t}\n\n\t\t\t// Only update the selection if the original selection is removed.\n\t\t\tconst shouldUpdateSelection =\n\t\t\t\thasSelectedBlocks && getSelectedBlockClientIds().length === 0;\n\n\t\t\t__experimentalSelectBlock( blockToFocus, shouldUpdateSelection );\n\t\t}\n\t}, [\n\t\t__experimentalSelectBlock,\n\t\tpreviousBlockClientId,\n\t\tfirstParentClientId,\n\t\tgetBlockOrder,\n\t\thasSelectedBlocks,\n\t\tgetSelectedBlockClientIds,\n\t] );\n\n\t// This can occur when the selected block (the parent)\n\t// displays child blocks within a List View.\n\tconst parentBlockIsSelected =\n\t\tselectedBlockClientIds?.includes( firstParentClientId );\n\n\t// When a currentClientId is in use, treat the menu as a controlled component.\n\t// This ensures that only one block settings menu is open at a time.\n\t// This is a temporary solution to work around an issue with `onFocusOutside`\n\t// where it does not allow a dropdown to be closed if focus was never within\n\t// the dropdown to begin with. Examples include a user either CMD+Clicking or\n\t// right clicking into an inactive window.\n\t// See: https://github.com/WordPress/gutenberg/pull/54083\n\tconst open = ! currentClientId\n\t\t? undefined\n\t\t: openedBlockSettingsMenu === currentClientId || false;\n\n\tconst onToggle = useCallback(\n\t\t( localOpen ) => {\n\t\t\tif ( localOpen && openedBlockSettingsMenu !== currentClientId ) {\n\t\t\t\tsetOpenedBlockSettingsMenu( currentClientId );\n\t\t\t} else if (\n\t\t\t\t! localOpen &&\n\t\t\t\topenedBlockSettingsMenu &&\n\t\t\t\topenedBlockSettingsMenu === currentClientId\n\t\t\t) {\n\t\t\t\tsetOpenedBlockSettingsMenu( undefined );\n\t\t\t}\n\t\t},\n\t\t[ currentClientId, openedBlockSettingsMenu, setOpenedBlockSettingsMenu ]\n\t);\n\n\treturn (\n\t\t<BlockActions\n\t\t\tclientIds={ clientIds }\n\t\t\t__experimentalUpdateSelection={ ! __experimentalSelectBlock }\n\t\t>\n\t\t\t{ ( {\n\t\t\t\tcanCopyStyles,\n\t\t\t\tcanDuplicate,\n\t\t\t\tcanInsertDefaultBlock,\n\t\t\t\tcanMove,\n\t\t\t\tcanRemove,\n\t\t\t\tonDuplicate,\n\t\t\t\tonInsertAfter,\n\t\t\t\tonInsertBefore,\n\t\t\t\tonRemove,\n\t\t\t\tonCopy,\n\t\t\t\tonPasteStyles,\n\t\t\t\tonMoveTo,\n\t\t\t\tblocks,\n\t\t\t} ) => (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\t\tclassName=\"block-editor-block-settings-menu\"\n\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t\topen={ open }\n\t\t\t\t\tonToggle={ onToggle }\n\t\t\t\t\tnoIcons\n\t\t\t\t\tmenuProps={ {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * @param {KeyboardEvent} event\n\t\t\t\t\t\t */\n\t\t\t\t\t\tonKeyDown( event ) {\n\t\t\t\t\t\t\tif ( event.defaultPrevented ) return;\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tisMatch( 'core/block-editor/remove', event ) &&\n\t\t\t\t\t\t\t\tcanRemove\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tupdateSelectionAfterRemove( onRemove() );\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tisMatch(\n\t\t\t\t\t\t\t\t\t'core/block-editor/duplicate',\n\t\t\t\t\t\t\t\t\tevent\n\t\t\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\t\tcanDuplicate\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tupdateSelectionAfterDuplicate( onDuplicate() );\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tisMatch(\n\t\t\t\t\t\t\t\t\t'core/block-editor/insert-after',\n\t\t\t\t\t\t\t\t\tevent\n\t\t\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\t\tcanInsertDefaultBlock\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tsetOpenedBlockSettingsMenu( undefined );\n\t\t\t\t\t\t\t\tonInsertAfter();\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tisMatch(\n\t\t\t\t\t\t\t\t\t'core/block-editor/insert-before',\n\t\t\t\t\t\t\t\t\tevent\n\t\t\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\t\tcanInsertDefaultBlock\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tsetOpenedBlockSettingsMenu( undefined );\n\t\t\t\t\t\t\t\tonInsertBefore();\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\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<__unstableBlockSettingsMenuFirstItem.Slot\n\t\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ ! parentBlockIsSelected &&\n\t\t\t\t\t\t\t\t\t!! firstParentClientId && (\n\t\t\t\t\t\t\t\t\t\t<BlockParentSelectorMenuItem\n\t\t\t\t\t\t\t\t\t\t\tparentClientId={\n\t\t\t\t\t\t\t\t\t\t\t\tfirstParentClientId\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tparentBlockType={ parentBlockType }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ count === 1 && (\n\t\t\t\t\t\t\t\t\t<BlockHTMLConvertButton\n\t\t\t\t\t\t\t\t\t\tclientId={ firstBlockClientId }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<CopyMenuItem\n\t\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\t\tonCopy={ onCopy }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ canDuplicate && (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\tonDuplicate,\n\t\t\t\t\t\t\t\t\t\t\tupdateSelectionAfterDuplicate\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.duplicate }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Duplicate' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ canInsertDefaultBlock && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\tonInsertBefore\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.insertBefore }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Add before' ) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\tonInsertAfter\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.insertAfter }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Add after' ) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t{ canCopyStyles && (\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<CopyMenuItem\n\t\t\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\t\t\tonCopy={ onCopy }\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Copy styles' ) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<MenuItem onClick={ onPasteStyles }>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Paste styles' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<BlockSettingsMenuControls.Slot\n\t\t\t\t\t\t\t\tfillProps={ {\n\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\tcanMove,\n\t\t\t\t\t\t\t\t\tonMoveTo,\n\t\t\t\t\t\t\t\t\tonlyBlock,\n\t\t\t\t\t\t\t\t\tcount,\n\t\t\t\t\t\t\t\t\tfirstBlockClientId,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t\t__unstableDisplayLocation={\n\t\t\t\t\t\t\t\t\t__unstableDisplayLocation\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{ typeof children === 'function'\n\t\t\t\t\t\t\t\t? children( { onClose } )\n\t\t\t\t\t\t\t\t: Children.map( ( child ) =>\n\t\t\t\t\t\t\t\t\t\tcloneElement( child, { onClose } )\n\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t{ canRemove && (\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\tonRemove,\n\t\t\t\t\t\t\t\t\t\t\tupdateSelectionAfterRemove\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.remove }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t</MenuGroup>\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</DropdownMenu>\n\t\t\t) }\n\t\t</BlockActions>\n\t);\n}\n\nexport default BlockSettingsDropdown;\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,YAAY,EACZC,SAAS,EACTC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASC,YAAY,EAAEC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,CAAE;IAAEsE;EAAQ,CAAE,CAAC,GACvBnG,QAAQ,CAAC0G,GAAG,CAAIC,KAAK,IACrB1G,YAAY,CAAE0G,KAAK,EAAE;IAAER;EAAQ,CAAE,CACjC,CAAC,EACFf,SAAS,IACV5D,aAAA,CAAC7B,SAAS,QACT6B,aAAA,CAAC5B,QAAQ;IACR4G,OAAO,EAAGlG,IAAI,CACb6F,OAAO,EACPX,QAAQ,EACRlB,0BACD,CAAG;IACHmC,QAAQ,EAAG9C,SAAS,CAACG;EAAQ,GAE3B3D,EAAE,CAAE,QAAS,CACN,CACA,CAEX,CAEU,CAEF,CAAC;AAEjB;AAEA,eAAesB,qBAAqB"}
1
+ {"version":3,"names":["getBlockType","serialize","store","blocksStore","DropdownMenu","MenuGroup","MenuItem","useDispatch","useSelect","moreVertical","Children","cloneElement","useCallback","__","keyboardShortcutsStore","__unstableUseShortcutEventMatch","pipe","useCopyToClipboard","BlockActions","BlockHTMLConvertButton","__unstableBlockSettingsMenuFirstItem","BlockSettingsMenuControls","BlockParentSelectorMenuItem","blockEditorStore","unlock","POPOVER_PROPS","className","placement","CopyMenuItem","clientIds","onCopy","label","getBlocksByClientId","ref","copyMenuItemLabel","createElement","BlockSettingsDropdown","block","__experimentalSelectBlock","children","__unstableDisplayLocation","props","currentClientId","clientId","blockClientIds","Array","isArray","count","length","firstBlockClientId","firstParentClientId","onlyBlock","parentBlockType","previousBlockClientId","selectedBlockClientIds","openedBlockSettingsMenu","select","getBlockCount","getBlockName","getBlockRootClientId","getPreviousBlockClientId","getSelectedBlockClientIds","getBlockAttributes","getOpenedBlockSettingsMenu","getActiveBlockVariation","_firstParentClientId","parentBlockName","getBlockOrder","setOpenedBlockSettingsMenu","shortcuts","getShortcutRepresentation","duplicate","remove","insertAfter","insertBefore","isMatch","hasSelectedBlocks","updateSelectionAfterDuplicate","clientIdsPromise","ids","updateSelectionAfterRemove","blockToFocus","shouldUpdateSelection","parentBlockIsSelected","includes","open","undefined","onToggle","localOpen","__experimentalUpdateSelection","canCopyStyles","canDuplicate","canInsertBlock","canMove","canRemove","onDuplicate","onInsertAfter","onInsertBefore","onRemove","onPasteStyles","onMoveTo","icon","popoverProps","noIcons","menuProps","onKeyDown","event","defaultPrevented","preventDefault","onClose","Fragment","Slot","fillProps","parentClientId","onClick","shortcut","map","child"],"sources":["@wordpress/block-editor/src/components/block-settings-menu/block-settings-dropdown.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockType,\n\tserialize,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { moreVertical } from '@wordpress/icons';\nimport { Children, cloneElement, useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tstore as keyboardShortcutsStore,\n\t__unstableUseShortcutEventMatch,\n} from '@wordpress/keyboard-shortcuts';\nimport { pipe, useCopyToClipboard } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockActions from '../block-actions';\nimport BlockHTMLConvertButton from './block-html-convert-button';\nimport __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';\nimport BlockSettingsMenuControls from '../block-settings-menu-controls';\nimport BlockParentSelectorMenuItem from './block-parent-selector-menu-item';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst POPOVER_PROPS = {\n\tclassName: 'block-editor-block-settings-menu__popover',\n\tplacement: 'bottom-start',\n};\n\nfunction CopyMenuItem( { clientIds, onCopy, label } ) {\n\tconst { getBlocksByClientId } = useSelect( blockEditorStore );\n\tconst ref = useCopyToClipboard(\n\t\t() => serialize( getBlocksByClientId( clientIds ) ),\n\t\tonCopy\n\t);\n\tconst copyMenuItemLabel = label ? label : __( 'Copy' );\n\treturn <MenuItem ref={ ref }>{ copyMenuItemLabel }</MenuItem>;\n}\n\nexport function BlockSettingsDropdown( {\n\tblock,\n\tclientIds,\n\t__experimentalSelectBlock,\n\tchildren,\n\t__unstableDisplayLocation,\n\t...props\n} ) {\n\t// Get the client id of the current block for this menu, if one is set.\n\tconst currentClientId = block?.clientId;\n\tconst blockClientIds = Array.isArray( clientIds )\n\t\t? clientIds\n\t\t: [ clientIds ];\n\tconst count = blockClientIds.length;\n\tconst firstBlockClientId = blockClientIds[ 0 ];\n\tconst {\n\t\tfirstParentClientId,\n\t\tonlyBlock,\n\t\tparentBlockType,\n\t\tpreviousBlockClientId,\n\t\tselectedBlockClientIds,\n\t\topenedBlockSettingsMenu,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetOpenedBlockSettingsMenu,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\tconst { getActiveBlockVariation } = select( blocksStore );\n\n\t\t\tconst _firstParentClientId =\n\t\t\t\tgetBlockRootClientId( firstBlockClientId );\n\t\t\tconst parentBlockName =\n\t\t\t\t_firstParentClientId && getBlockName( _firstParentClientId );\n\n\t\t\treturn {\n\t\t\t\tfirstParentClientId: _firstParentClientId,\n\t\t\t\tonlyBlock: 1 === getBlockCount( _firstParentClientId ),\n\t\t\t\tparentBlockType:\n\t\t\t\t\t_firstParentClientId &&\n\t\t\t\t\t( getActiveBlockVariation(\n\t\t\t\t\t\tparentBlockName,\n\t\t\t\t\t\tgetBlockAttributes( _firstParentClientId )\n\t\t\t\t\t) ||\n\t\t\t\t\t\tgetBlockType( parentBlockName ) ),\n\t\t\t\tpreviousBlockClientId:\n\t\t\t\t\tgetPreviousBlockClientId( firstBlockClientId ),\n\t\t\t\tselectedBlockClientIds: getSelectedBlockClientIds(),\n\t\t\t\topenedBlockSettingsMenu: getOpenedBlockSettingsMenu(),\n\t\t\t};\n\t\t},\n\t\t[ firstBlockClientId ]\n\t);\n\tconst { getBlockOrder, getSelectedBlockClientIds } =\n\t\tuseSelect( blockEditorStore );\n\n\tconst { setOpenedBlockSettingsMenu } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tconst shortcuts = useSelect( ( select ) => {\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\t\treturn {\n\t\t\tduplicate: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/duplicate'\n\t\t\t),\n\t\t\tremove: getShortcutRepresentation( 'core/block-editor/remove' ),\n\t\t\tinsertAfter: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/insert-after'\n\t\t\t),\n\t\t\tinsertBefore: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/insert-before'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst isMatch = __unstableUseShortcutEventMatch();\n\tconst hasSelectedBlocks = selectedBlockClientIds.length > 0;\n\n\tconst updateSelectionAfterDuplicate = useCallback(\n\t\tasync ( clientIdsPromise ) => {\n\t\t\tif ( __experimentalSelectBlock ) {\n\t\t\t\tconst ids = await clientIdsPromise;\n\t\t\t\tif ( ids && ids[ 0 ] ) {\n\t\t\t\t\t__experimentalSelectBlock( ids[ 0 ], false );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[ __experimentalSelectBlock ]\n\t);\n\n\tconst updateSelectionAfterRemove = useCallback( () => {\n\t\tif ( __experimentalSelectBlock ) {\n\t\t\tlet blockToFocus = previousBlockClientId || firstParentClientId;\n\n\t\t\t// Focus the first block if there's no previous block nor parent block.\n\t\t\tif ( ! blockToFocus ) {\n\t\t\t\tblockToFocus = getBlockOrder()[ 0 ];\n\t\t\t}\n\n\t\t\t// Only update the selection if the original selection is removed.\n\t\t\tconst shouldUpdateSelection =\n\t\t\t\thasSelectedBlocks && getSelectedBlockClientIds().length === 0;\n\n\t\t\t__experimentalSelectBlock( blockToFocus, shouldUpdateSelection );\n\t\t}\n\t}, [\n\t\t__experimentalSelectBlock,\n\t\tpreviousBlockClientId,\n\t\tfirstParentClientId,\n\t\tgetBlockOrder,\n\t\thasSelectedBlocks,\n\t\tgetSelectedBlockClientIds,\n\t] );\n\n\t// This can occur when the selected block (the parent)\n\t// displays child blocks within a List View.\n\tconst parentBlockIsSelected =\n\t\tselectedBlockClientIds?.includes( firstParentClientId );\n\n\t// When a currentClientId is in use, treat the menu as a controlled component.\n\t// This ensures that only one block settings menu is open at a time.\n\t// This is a temporary solution to work around an issue with `onFocusOutside`\n\t// where it does not allow a dropdown to be closed if focus was never within\n\t// the dropdown to begin with. Examples include a user either CMD+Clicking or\n\t// right clicking into an inactive window.\n\t// See: https://github.com/WordPress/gutenberg/pull/54083\n\tconst open = ! currentClientId\n\t\t? undefined\n\t\t: openedBlockSettingsMenu === currentClientId || false;\n\n\tconst onToggle = useCallback(\n\t\t( localOpen ) => {\n\t\t\tif ( localOpen && openedBlockSettingsMenu !== currentClientId ) {\n\t\t\t\tsetOpenedBlockSettingsMenu( currentClientId );\n\t\t\t} else if (\n\t\t\t\t! localOpen &&\n\t\t\t\topenedBlockSettingsMenu &&\n\t\t\t\topenedBlockSettingsMenu === currentClientId\n\t\t\t) {\n\t\t\t\tsetOpenedBlockSettingsMenu( undefined );\n\t\t\t}\n\t\t},\n\t\t[ currentClientId, openedBlockSettingsMenu, setOpenedBlockSettingsMenu ]\n\t);\n\n\treturn (\n\t\t<BlockActions\n\t\t\tclientIds={ clientIds }\n\t\t\t__experimentalUpdateSelection={ ! __experimentalSelectBlock }\n\t\t>\n\t\t\t{ ( {\n\t\t\t\tcanCopyStyles,\n\t\t\t\tcanDuplicate,\n\t\t\t\tcanInsertBlock,\n\t\t\t\tcanMove,\n\t\t\t\tcanRemove,\n\t\t\t\tonDuplicate,\n\t\t\t\tonInsertAfter,\n\t\t\t\tonInsertBefore,\n\t\t\t\tonRemove,\n\t\t\t\tonCopy,\n\t\t\t\tonPasteStyles,\n\t\t\t\tonMoveTo,\n\t\t\t} ) => (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\t\tclassName=\"block-editor-block-settings-menu\"\n\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t\topen={ open }\n\t\t\t\t\tonToggle={ onToggle }\n\t\t\t\t\tnoIcons\n\t\t\t\t\tmenuProps={ {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * @param {KeyboardEvent} event\n\t\t\t\t\t\t */\n\t\t\t\t\t\tonKeyDown( event ) {\n\t\t\t\t\t\t\tif ( event.defaultPrevented ) return;\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tisMatch( 'core/block-editor/remove', event ) &&\n\t\t\t\t\t\t\t\tcanRemove\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tupdateSelectionAfterRemove( onRemove() );\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tisMatch(\n\t\t\t\t\t\t\t\t\t'core/block-editor/duplicate',\n\t\t\t\t\t\t\t\t\tevent\n\t\t\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\t\tcanDuplicate\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tupdateSelectionAfterDuplicate( onDuplicate() );\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tisMatch(\n\t\t\t\t\t\t\t\t\t'core/block-editor/insert-after',\n\t\t\t\t\t\t\t\t\tevent\n\t\t\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\t\tcanInsertBlock\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tsetOpenedBlockSettingsMenu( undefined );\n\t\t\t\t\t\t\t\tonInsertAfter();\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tisMatch(\n\t\t\t\t\t\t\t\t\t'core/block-editor/insert-before',\n\t\t\t\t\t\t\t\t\tevent\n\t\t\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\t\tcanInsertBlock\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tsetOpenedBlockSettingsMenu( undefined );\n\t\t\t\t\t\t\t\tonInsertBefore();\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\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<__unstableBlockSettingsMenuFirstItem.Slot\n\t\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ ! parentBlockIsSelected &&\n\t\t\t\t\t\t\t\t\t!! firstParentClientId && (\n\t\t\t\t\t\t\t\t\t\t<BlockParentSelectorMenuItem\n\t\t\t\t\t\t\t\t\t\t\tparentClientId={\n\t\t\t\t\t\t\t\t\t\t\t\tfirstParentClientId\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tparentBlockType={ parentBlockType }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ count === 1 && (\n\t\t\t\t\t\t\t\t\t<BlockHTMLConvertButton\n\t\t\t\t\t\t\t\t\t\tclientId={ firstBlockClientId }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<CopyMenuItem\n\t\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t\t\tonCopy={ onCopy }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ canDuplicate && (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\tonDuplicate,\n\t\t\t\t\t\t\t\t\t\t\tupdateSelectionAfterDuplicate\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.duplicate }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Duplicate' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ canInsertBlock && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\tonInsertBefore\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.insertBefore }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Add before' ) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\tonInsertAfter\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.insertAfter }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Add after' ) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t{ canCopyStyles && (\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<CopyMenuItem\n\t\t\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t\t\t\tonCopy={ onCopy }\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Copy styles' ) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<MenuItem onClick={ onPasteStyles }>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Paste styles' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<BlockSettingsMenuControls.Slot\n\t\t\t\t\t\t\t\tfillProps={ {\n\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\tcanMove,\n\t\t\t\t\t\t\t\t\tonMoveTo,\n\t\t\t\t\t\t\t\t\tonlyBlock,\n\t\t\t\t\t\t\t\t\tcount,\n\t\t\t\t\t\t\t\t\tfirstBlockClientId,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t\t__unstableDisplayLocation={\n\t\t\t\t\t\t\t\t\t__unstableDisplayLocation\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{ typeof children === 'function'\n\t\t\t\t\t\t\t\t? children( { onClose } )\n\t\t\t\t\t\t\t\t: Children.map( ( child ) =>\n\t\t\t\t\t\t\t\t\t\tcloneElement( child, { onClose } )\n\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t{ canRemove && (\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\tonRemove,\n\t\t\t\t\t\t\t\t\t\t\tupdateSelectionAfterRemove\n\t\t\t\t\t\t\t\t\t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,CAAC9B,SAAS,QACT8B,aAAA,CAACP,YAAY;IACZC,SAAS,EAAGA,SAAW;IACvBC,MAAM,EAAGA,MAAQ;IACjBC,KAAK,EAAGlB,EAAE,CAAE,aAAc;EAAG,CAC7B,CAAC,EACFsB,aAAA,CAAC7B,QAAQ;IAAC4G,OAAO,EAAGf;EAAe,GAChCtF,EAAE,CAAE,cAAe,CACZ,CACA,CACX,EACDsB,aAAA,CAACd,yBAAyB,CAAC0F,IAAI;IAC9BC,SAAS,EAAG;MACXH,OAAO;MACPhB,OAAO;MACPO,QAAQ;MACRjD,SAAS;MACTJ,KAAK;MACLE;IACD,CAAG;IACHpB,SAAS,EAAGA,SAAW;IACvBW,yBAAyB,EACxBA;EACA,CACD,CAAC,EACA,OAAOD,QAAQ,KAAK,UAAU,GAC7BA,QAAQ,CAAE;IAAEsE;EAAQ,CAAE,CAAC,GACvBnG,QAAQ,CAAC0G,GAAG,CAAIC,KAAK,IACrB1G,YAAY,CAAE0G,KAAK,EAAE;IAAER;EAAQ,CAAE,CACjC,CAAC,EACFf,SAAS,IACV3D,aAAA,CAAC9B,SAAS,QACT8B,aAAA,CAAC7B,QAAQ;IACR4G,OAAO,EAAGlG,IAAI,CACb6F,OAAO,EACPX,QAAQ,EACRlB,0BACD,CAAG;IACHmC,QAAQ,EAAG9C,SAAS,CAACG;EAAQ,GAE3B3D,EAAE,CAAE,QAAS,CACN,CACA,CAEX,CAEU,CAEF,CAAC;AAEjB;AAEA,eAAeuB,qBAAqB"}
@@ -1 +1 @@
1
- {"version":3,"names":["findNodeHandle","Platform","__","sprintf","switchToBlockType","Picker","useDispatch","store","noticesStore","blockEditorStore","BlockTransformationsMenu","anchorNodeRef","blockTitle","pickerRef","possibleTransformations","selectedBlock","selectedBlockClientId","replaceBlocks","createSuccessNotice","pickerOptions","_selectedBlock$name","selectedBlockName","name","blocksThatSplitWhenTransformed","map","item","label","length","includes","id","title","value","getAnchor","undefined","onPickerSelect","selectedItem","find","successNotice","createElement","testID","ref","options","onChange","hideCancelButton","OS","leftAlign"],"sources":["@wordpress/block-editor/src/components/block-switcher/block-transformations-menu.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { findNodeHandle, Platform } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { switchToBlockType } from '@wordpress/blocks';\nimport { Picker } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nconst BlockTransformationsMenu = ( {\n\tanchorNodeRef,\n\tblockTitle,\n\tpickerRef,\n\tpossibleTransformations,\n\tselectedBlock,\n\tselectedBlockClientId,\n} ) => {\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pickerOptions = () => {\n\t\tconst selectedBlockName = selectedBlock?.name ?? '';\n\t\tconst blocksThatSplitWhenTransformed = {\n\t\t\t'core/list': [ 'core/paragraph', 'core/heading' ],\n\t\t\t'core/quote': [ 'core/paragraph' ],\n\t\t\t'core/pullquote': [ 'core/paragraph' ],\n\t\t};\n\n\t\treturn possibleTransformations.map( ( item ) => {\n\t\t\tconst label =\n\t\t\t\tselectedBlockName.length &&\n\t\t\t\tblocksThatSplitWhenTransformed[ selectedBlockName ] &&\n\t\t\t\tblocksThatSplitWhenTransformed[ selectedBlockName ].includes(\n\t\t\t\t\titem.id\n\t\t\t\t)\n\t\t\t\t\t? `${ item.title } blocks`\n\t\t\t\t\t: item.title;\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tvalue: item.id,\n\t\t\t};\n\t\t} );\n\t};\n\n\tconst getAnchor = () =>\n\t\tanchorNodeRef ? findNodeHandle( anchorNodeRef ) : undefined;\n\n\tfunction onPickerSelect( value ) {\n\t\treplaceBlocks(\n\t\t\tselectedBlockClientId,\n\t\t\tswitchToBlockType( selectedBlock, value )\n\t\t);\n\n\t\tconst selectedItem = pickerOptions().find(\n\t\t\t( item ) => item.value === value\n\t\t);\n\t\tconst successNotice = sprintf(\n\t\t\t/* translators: 1: From block title, e.g. Paragraph. 2: To block title, e.g. Header. */\n\t\t\t__( '%1$s transformed to %2$s' ),\n\t\t\tblockTitle,\n\t\t\tselectedItem.label\n\t\t);\n\t\tcreateSuccessNotice( successNotice );\n\t}\n\n\treturn (\n\t\t<Picker\n\t\t\ttestID=\"block-transformations-menu\"\n\t\t\tref={ pickerRef }\n\t\t\toptions={ pickerOptions() }\n\t\t\tonChange={ onPickerSelect }\n\t\t\thideCancelButton={ Platform.OS !== 'ios' }\n\t\t\tleftAlign={ true }\n\t\t\tgetAnchor={ getAnchor }\n\t\t\t// translators: %s: block title e.g: \"Paragraph\".\n\t\t\ttitle={ sprintf( __( 'Transform %s to' ), blockTitle ) }\n\t\t/>\n\t);\n};\n\nexport default BlockTransformationsMenu;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,cAAc,EAAEC,QAAQ,QAAQ,cAAc;;AAEvD;AACA;AACA;AACA,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,iBAAiB,QAAQ,mBAAmB;AACrD,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,KAAK,IAAIC,YAAY,QAAQ,oBAAoB;;AAE1D;AACA;AACA;AACA,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,aAAa;AAEvD,MAAMC,wBAAwB,GAAGA,CAAE;EAClCC,aAAa;EACbC,UAAU;EACVC,SAAS;EACTC,uBAAuB;EACvBC,aAAa;EACbC;AACD,CAAC,KAAM;EACN,MAAM;IAAEC;EAAc,CAAC,GAAGX,WAAW,CAAEG,gBAAiB,CAAC;EACzD,MAAM;IAAES;EAAoB,CAAC,GAAGZ,WAAW,CAAEE,YAAa,CAAC;EAE3D,MAAMW,aAAa,GAAGA,CAAA,KAAM;IAAA,IAAAC,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jB4B,OAAO,EAAGtB,aAAa,CAAC,CAAG;IAC3BuB,QAAQ,EAAGR,cAAgB;IAC3BS,gBAAgB,EAAG1C,QAAQ,CAAC2C,EAAE,KAAK,KAAO;IAC1CC,SAAS,EAAG,IAAM;IAClBb,SAAS,EAAGA;IACZ;IAAA;IACAF,KAAK,EAAG3B,OAAO,CAAED,EAAE,CAAE,iBAAkB,CAAC,EAAEU,UAAW;EAAG,CACxD,CAAC;AAEJ,CAAC;AAED,eAAeF,wBAAwB"}
1
+ {"version":3,"names":["findNodeHandle","Platform","__","sprintf","switchToBlockType","Picker","useDispatch","store","noticesStore","blockEditorStore","BlockTransformationsMenu","anchorNodeRef","blockTitle","pickerRef","possibleTransformations","selectedBlock","selectedBlockClientId","replaceBlocks","createSuccessNotice","pickerOptions","_selectedBlock$name","selectedBlockName","name","blocksThatSplitWhenTransformed","map","item","label","length","includes","id","title","value","getAnchor","undefined","onPickerSelect","selectedItem","find","successNotice","createElement","testID","ref","options","onChange","hideCancelButton","OS","leftAlign"],"sources":["@wordpress/block-editor/src/components/block-switcher/block-transformations-menu.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { findNodeHandle, Platform } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { switchToBlockType } from '@wordpress/blocks';\nimport { Picker } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nconst BlockTransformationsMenu = ( {\n\tanchorNodeRef,\n\tblockTitle,\n\tpickerRef,\n\tpossibleTransformations,\n\tselectedBlock,\n\tselectedBlockClientId,\n} ) => {\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pickerOptions = () => {\n\t\tconst selectedBlockName = selectedBlock?.name ?? '';\n\t\tconst blocksThatSplitWhenTransformed = {\n\t\t\t'core/list': [ 'core/paragraph', 'core/heading' ],\n\t\t\t'core/quote': [ 'core/paragraph' ],\n\t\t\t'core/pullquote': [ 'core/paragraph' ],\n\t\t};\n\n\t\treturn possibleTransformations.map( ( item ) => {\n\t\t\tconst label =\n\t\t\t\tselectedBlockName.length &&\n\t\t\t\tblocksThatSplitWhenTransformed[ selectedBlockName ] &&\n\t\t\t\tblocksThatSplitWhenTransformed[ selectedBlockName ].includes(\n\t\t\t\t\titem.id\n\t\t\t\t)\n\t\t\t\t\t? `${ item.title } blocks`\n\t\t\t\t\t: item.title;\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\tvalue: item.id,\n\t\t\t};\n\t\t} );\n\t};\n\n\tconst getAnchor = () =>\n\t\tanchorNodeRef ? findNodeHandle( anchorNodeRef ) : undefined;\n\n\tfunction onPickerSelect( value ) {\n\t\treplaceBlocks(\n\t\t\tselectedBlockClientId,\n\t\t\tswitchToBlockType( selectedBlock, value )\n\t\t);\n\n\t\tconst selectedItem = pickerOptions().find(\n\t\t\t( item ) => item.value === value\n\t\t);\n\t\tconst successNotice = sprintf(\n\t\t\t/* translators: 1: From block title, e.g. Paragraph. 2: To block title, e.g. Header. */\n\t\t\t__( '%1$s transformed to %2$s' ),\n\t\t\tblockTitle,\n\t\t\tselectedItem.label\n\t\t);\n\t\tcreateSuccessNotice( successNotice );\n\t}\n\n\treturn (\n\t\t<Picker\n\t\t\ttestID=\"block-transformations-menu\"\n\t\t\tref={ pickerRef }\n\t\t\toptions={ pickerOptions() }\n\t\t\tonChange={ onPickerSelect }\n\t\t\thideCancelButton={ Platform.OS !== 'ios' }\n\t\t\tleftAlign\n\t\t\tgetAnchor={ getAnchor }\n\t\t\t// translators: %s: block title e.g: \"Paragraph\".\n\t\t\ttitle={ sprintf( __( 'Transform %s to' ), blockTitle ) }\n\t\t/>\n\t);\n};\n\nexport default BlockTransformationsMenu;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,cAAc,EAAEC,QAAQ,QA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