@wordpress/block-editor 12.20.0 → 12.22.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 (558) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/block-actions/index.js +47 -36
  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-heading-level-dropdown/index.js +5 -5
  11. package/build/components/block-heading-level-dropdown/index.js.map +1 -1
  12. package/build/components/block-heading-level-dropdown/index.native.js +5 -4
  13. package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
  14. package/build/components/block-inspector/index.js +5 -4
  15. package/build/components/block-inspector/index.js.map +1 -1
  16. package/build/components/block-list/block-crash-boundary.native.js +49 -0
  17. package/build/components/block-list/block-crash-boundary.native.js.map +1 -0
  18. package/build/components/block-list/block-crash-warning.native.js +24 -0
  19. package/build/components/block-list/block-crash-warning.native.js.map +1 -0
  20. package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
  21. package/build/components/block-list/block-list-item.native.js +1 -1
  22. package/build/components/block-list/block-list-item.native.js.map +1 -1
  23. package/build/components/block-list/block-outline.native.js +23 -7
  24. package/build/components/block-list/block-outline.native.js.map +1 -1
  25. package/build/components/block-list/block-selection-button.native.js.map +1 -1
  26. package/build/components/block-list/block.native.js +7 -5
  27. package/build/components/block-list/block.native.js.map +1 -1
  28. package/build/components/block-list/use-block-props/index.js +8 -1
  29. package/build/components/block-list/use-block-props/index.js.map +1 -1
  30. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -3
  31. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  32. package/build/components/block-mover/index.native.js.map +1 -1
  33. package/build/components/block-popover/cover.js +68 -0
  34. package/build/components/block-popover/cover.js.map +1 -0
  35. package/build/components/block-popover/drop-zone.js +2 -3
  36. package/build/components/block-popover/drop-zone.js.map +1 -1
  37. package/build/components/block-popover/index.js +1 -19
  38. package/build/components/block-popover/index.js.map +1 -1
  39. package/build/components/block-preview/index.js +2 -1
  40. package/build/components/block-preview/index.js.map +1 -1
  41. package/build/components/block-removal-warning-modal/index.js +2 -4
  42. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  43. package/build/components/block-rename/modal.js.map +1 -1
  44. package/build/components/block-settings/container.native.js +2 -1
  45. package/build/components/block-settings/container.native.js.map +1 -1
  46. package/build/components/block-settings-menu/block-settings-dropdown.js +41 -39
  47. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  48. package/build/components/block-settings-menu-controls/index.js +1 -3
  49. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  50. package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
  51. package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  52. package/build/components/block-toolbar/index.js +24 -11
  53. package/build/components/block-toolbar/index.js.map +1 -1
  54. package/build/components/block-toolbar/shuffle.js +89 -0
  55. package/build/components/block-toolbar/shuffle.js.map +1 -0
  56. package/build/components/block-toolbar/use-has-block-toolbar.js +43 -0
  57. package/build/components/block-toolbar/use-has-block-toolbar.js.map +1 -0
  58. package/build/components/block-tools/block-selection-button.js +5 -1
  59. package/build/components/block-tools/block-selection-button.js.map +1 -1
  60. package/build/components/block-tools/empty-block-inserter.js +2 -5
  61. package/build/components/block-tools/empty-block-inserter.js.map +1 -1
  62. package/build/components/block-tools/index.js +9 -26
  63. package/build/components/block-tools/index.js.map +1 -1
  64. package/build/components/block-tools/use-show-block-tools.js +60 -0
  65. package/build/components/block-tools/use-show-block-tools.js.map +1 -0
  66. package/build/components/caption/index.native.js.map +1 -1
  67. package/build/components/child-layout-control/index.js +108 -11
  68. package/build/components/child-layout-control/index.js.map +1 -1
  69. package/build/components/color-palette/control.js.map +1 -1
  70. package/build/components/colors-gradients/control.js +1 -1
  71. package/build/components/colors-gradients/control.js.map +1 -1
  72. package/build/components/convert-to-group-buttons/toolbar.js +11 -0
  73. package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
  74. package/build/components/global-styles/border-panel.js +21 -8
  75. package/build/components/global-styles/border-panel.js.map +1 -1
  76. package/build/components/global-styles/color-panel.js +1 -1
  77. package/build/components/global-styles/color-panel.js.map +1 -1
  78. package/build/components/global-styles/dimensions-panel.js +8 -33
  79. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  80. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  81. package/build/components/global-styles/index.js +6 -0
  82. package/build/components/global-styles/index.js.map +1 -1
  83. package/build/components/global-styles/shadow-panel-components.js +80 -23
  84. package/build/components/global-styles/shadow-panel-components.js.map +1 -1
  85. package/build/components/global-styles/typography-utils.js +7 -5
  86. package/build/components/global-styles/typography-utils.js.map +1 -1
  87. package/build/components/global-styles/use-global-styles-output.js +16 -16
  88. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  89. package/build/components/global-styles/utils.js +2 -4
  90. package/build/components/global-styles/utils.js.map +1 -1
  91. package/build/components/grid-visualizer/grid-item-resizer.js +77 -0
  92. package/build/components/grid-visualizer/grid-item-resizer.js.map +1 -0
  93. package/build/components/grid-visualizer/grid-visualizer.js +81 -0
  94. package/build/components/grid-visualizer/grid-visualizer.js.map +1 -0
  95. package/build/components/grid-visualizer/index.js +20 -0
  96. package/build/components/grid-visualizer/index.js.map +1 -0
  97. package/build/components/grid-visualizer/utils.js +10 -0
  98. package/build/components/grid-visualizer/utils.js.map +1 -0
  99. package/build/components/iframe/index.js +66 -17
  100. package/build/components/iframe/index.js.map +1 -1
  101. package/build/components/index.native.js +7 -0
  102. package/build/components/index.native.js.map +1 -1
  103. package/build/components/inner-blocks/use-nested-settings-update.js +8 -2
  104. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  105. package/build/components/inserter/block-patterns-explorer/index.js +3 -6
  106. package/build/components/inserter/block-patterns-explorer/index.js.map +1 -1
  107. package/build/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
  108. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  109. package/build/components/inserter/media-tab/media-preview.js.map +1 -1
  110. package/build/components/inserter/menu.native.js.map +1 -1
  111. package/build/components/inserter/mobile-tab-navigation.js +2 -2
  112. package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
  113. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  114. package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js +36 -0
  115. package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
  116. package/build/components/inspector-controls-tabs/index.js +1 -1
  117. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  118. package/build/components/inspector-controls-tabs/styles-tab.js +1 -1
  119. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  120. package/build/components/link-control/link-preview.js +4 -1
  121. package/build/components/link-control/link-preview.js.map +1 -1
  122. package/build/components/link-control/search-input.js.map +1 -1
  123. package/build/components/list-view/block-select-button.js +0 -2
  124. package/build/components/list-view/block-select-button.js.map +1 -1
  125. package/build/components/list-view/block.js +4 -11
  126. package/build/components/list-view/block.js.map +1 -1
  127. package/build/components/list-view/branch.js.map +1 -1
  128. package/build/components/list-view/drop-indicator.js.map +1 -1
  129. package/build/components/list-view/index.js.map +1 -1
  130. package/build/components/list-view/use-clipboard-handler.js +2 -1
  131. package/build/components/list-view/use-clipboard-handler.js.map +1 -1
  132. package/build/components/list-view/utils.js +5 -3
  133. package/build/components/list-view/utils.js.map +1 -1
  134. package/build/components/panel-color-settings/index.js.map +1 -1
  135. package/build/components/provider/index.js.map +1 -1
  136. package/build/components/resizable-box-popover/index.js +3 -5
  137. package/build/components/resizable-box-popover/index.js.map +1 -1
  138. package/build/components/responsive-block-control/index.js +1 -1
  139. package/build/components/responsive-block-control/index.js.map +1 -1
  140. package/build/components/rich-text/index.js +46 -26
  141. package/build/components/rich-text/index.js.map +1 -1
  142. package/build/components/rich-text/use-enter.js +3 -0
  143. package/build/components/rich-text/use-enter.js.map +1 -1
  144. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  145. package/build/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
  146. package/build/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
  147. package/build/components/url-popover/index.js +3 -3
  148. package/build/components/url-popover/index.js.map +1 -1
  149. package/build/components/use-moving-animation/index.js +4 -0
  150. package/build/components/use-moving-animation/index.js.map +1 -1
  151. package/build/components/warning/index.native.js +9 -4
  152. package/build/components/warning/index.native.js.map +1 -1
  153. package/build/components/writing-flow/use-clipboard-handler.js +2 -1
  154. package/build/components/writing-flow/use-clipboard-handler.js.map +1 -1
  155. package/build/components/writing-flow/utils.js +23 -6
  156. package/build/components/writing-flow/utils.js.map +1 -1
  157. package/build/hooks/anchor.js +7 -8
  158. package/build/hooks/anchor.js.map +1 -1
  159. package/build/hooks/background.js +39 -2
  160. package/build/hooks/background.js.map +1 -1
  161. package/build/hooks/block-hooks.js +34 -8
  162. package/build/hooks/block-hooks.js.map +1 -1
  163. package/build/hooks/border.js +6 -4
  164. package/build/hooks/border.js.map +1 -1
  165. package/build/hooks/dimensions.js +3 -4
  166. package/build/hooks/dimensions.js.map +1 -1
  167. package/build/hooks/font-size.js +6 -7
  168. package/build/hooks/font-size.js.map +1 -1
  169. package/build/hooks/index.js +3 -2
  170. package/build/hooks/index.js.map +1 -1
  171. package/build/hooks/layout-child.js +67 -6
  172. package/build/hooks/layout-child.js.map +1 -1
  173. package/build/hooks/layout.js +32 -14
  174. package/build/hooks/layout.js.map +1 -1
  175. package/build/hooks/line-height.js.map +1 -1
  176. package/build/hooks/position.js +1 -1
  177. package/build/hooks/position.js.map +1 -1
  178. package/build/hooks/spacing-visualizer.js +115 -0
  179. package/build/hooks/spacing-visualizer.js.map +1 -0
  180. package/build/hooks/use-bindings-attributes.js +171 -48
  181. package/build/hooks/use-bindings-attributes.js.map +1 -1
  182. package/build/hooks/use-typography-props.js +1 -2
  183. package/build/hooks/use-typography-props.js.map +1 -1
  184. package/build/layouts/grid.js +6 -2
  185. package/build/layouts/grid.js.map +1 -1
  186. package/build/private-apis.js +7 -3
  187. package/build/private-apis.js.map +1 -1
  188. package/build/private-apis.native.js +3 -1
  189. package/build/private-apis.native.js.map +1 -1
  190. package/build/store/actions.js +42 -12
  191. package/build/store/actions.js.map +1 -1
  192. package/build/store/private-actions.js +29 -55
  193. package/build/store/private-actions.js.map +1 -1
  194. package/build/store/private-selectors.js +0 -8
  195. package/build/store/private-selectors.js.map +1 -1
  196. package/build/store/reducer.js +34 -46
  197. package/build/store/reducer.js.map +1 -1
  198. package/build/store/selectors.js +27 -15
  199. package/build/store/selectors.js.map +1 -1
  200. package/build-module/components/block-actions/index.js +47 -36
  201. package/build-module/components/block-actions/index.js.map +1 -1
  202. package/build-module/components/block-bindings-toolbar-indicator/index.js +18 -0
  203. package/build-module/components/block-bindings-toolbar-indicator/index.js.map +1 -0
  204. package/build-module/components/block-edit/context.js +1 -0
  205. package/build-module/components/block-edit/context.js.map +1 -1
  206. package/build-module/components/block-edit/index.js +9 -4
  207. package/build-module/components/block-edit/index.js.map +1 -1
  208. package/build-module/components/block-heading-level-dropdown/index.js +5 -5
  209. package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
  210. package/build-module/components/block-heading-level-dropdown/index.native.js +5 -4
  211. package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
  212. package/build-module/components/block-inspector/index.js +6 -5
  213. package/build-module/components/block-inspector/index.js.map +1 -1
  214. package/build-module/components/block-list/block-crash-boundary.native.js +42 -0
  215. package/build-module/components/block-list/block-crash-boundary.native.js.map +1 -0
  216. package/build-module/components/block-list/block-crash-warning.native.js +15 -0
  217. package/build-module/components/block-list/block-crash-warning.native.js.map +1 -0
  218. package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
  219. package/build-module/components/block-list/block-list-item.native.js +1 -1
  220. package/build-module/components/block-list/block-list-item.native.js.map +1 -1
  221. package/build-module/components/block-list/block-outline.native.js +23 -7
  222. package/build-module/components/block-list/block-outline.native.js.map +1 -1
  223. package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
  224. package/build-module/components/block-list/block.native.js +7 -5
  225. package/build-module/components/block-list/block.native.js.map +1 -1
  226. package/build-module/components/block-list/use-block-props/index.js +9 -2
  227. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  228. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -3
  229. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  230. package/build-module/components/block-mover/index.native.js.map +1 -1
  231. package/build-module/components/block-popover/cover.js +60 -0
  232. package/build-module/components/block-popover/cover.js.map +1 -0
  233. package/build-module/components/block-popover/drop-zone.js +2 -3
  234. package/build-module/components/block-popover/drop-zone.js.map +1 -1
  235. package/build-module/components/block-popover/index.js +1 -19
  236. package/build-module/components/block-popover/index.js.map +1 -1
  237. package/build-module/components/block-preview/index.js +2 -1
  238. package/build-module/components/block-preview/index.js.map +1 -1
  239. package/build-module/components/block-removal-warning-modal/index.js +3 -5
  240. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  241. package/build-module/components/block-rename/modal.js.map +1 -1
  242. package/build-module/components/block-settings/container.native.js +3 -2
  243. package/build-module/components/block-settings/container.native.js.map +1 -1
  244. package/build-module/components/block-settings-menu/block-settings-dropdown.js +42 -40
  245. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  246. package/build-module/components/block-settings-menu-controls/index.js +1 -3
  247. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  248. package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
  249. package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  250. package/build-module/components/block-toolbar/index.js +24 -12
  251. package/build-module/components/block-toolbar/index.js.map +1 -1
  252. package/build-module/components/block-toolbar/shuffle.js +82 -0
  253. package/build-module/components/block-toolbar/shuffle.js.map +1 -0
  254. package/build-module/components/block-toolbar/use-has-block-toolbar.js +36 -0
  255. package/build-module/components/block-toolbar/use-has-block-toolbar.js.map +1 -0
  256. package/build-module/components/block-tools/block-selection-button.js +5 -1
  257. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  258. package/build-module/components/block-tools/empty-block-inserter.js +2 -5
  259. package/build-module/components/block-tools/empty-block-inserter.js.map +1 -1
  260. package/build-module/components/block-tools/index.js +9 -26
  261. package/build-module/components/block-tools/index.js.map +1 -1
  262. package/build-module/components/block-tools/use-show-block-tools.js +54 -0
  263. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -0
  264. package/build-module/components/caption/index.native.js.map +1 -1
  265. package/build-module/components/child-layout-control/index.js +109 -12
  266. package/build-module/components/child-layout-control/index.js.map +1 -1
  267. package/build-module/components/color-palette/control.js.map +1 -1
  268. package/build-module/components/colors-gradients/control.js +1 -1
  269. package/build-module/components/colors-gradients/control.js.map +1 -1
  270. package/build-module/components/convert-to-group-buttons/toolbar.js +12 -1
  271. package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
  272. package/build-module/components/global-styles/border-panel.js +22 -10
  273. package/build-module/components/global-styles/border-panel.js.map +1 -1
  274. package/build-module/components/global-styles/color-panel.js +1 -1
  275. package/build-module/components/global-styles/color-panel.js.map +1 -1
  276. package/build-module/components/global-styles/dimensions-panel.js +9 -34
  277. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  278. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  279. package/build-module/components/global-styles/index.js +1 -1
  280. package/build-module/components/global-styles/index.js.map +1 -1
  281. package/build-module/components/global-styles/shadow-panel-components.js +82 -24
  282. package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
  283. package/build-module/components/global-styles/typography-utils.js +7 -5
  284. package/build-module/components/global-styles/typography-utils.js.map +1 -1
  285. package/build-module/components/global-styles/use-global-styles-output.js +17 -17
  286. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  287. package/build-module/components/global-styles/utils.js +2 -4
  288. package/build-module/components/global-styles/utils.js.map +1 -1
  289. package/build-module/components/grid-visualizer/grid-item-resizer.js +69 -0
  290. package/build-module/components/grid-visualizer/grid-item-resizer.js.map +1 -0
  291. package/build-module/components/grid-visualizer/grid-visualizer.js +73 -0
  292. package/build-module/components/grid-visualizer/grid-visualizer.js.map +1 -0
  293. package/build-module/components/grid-visualizer/index.js +3 -0
  294. package/build-module/components/grid-visualizer/index.js.map +1 -0
  295. package/build-module/components/grid-visualizer/utils.js +4 -0
  296. package/build-module/components/grid-visualizer/utils.js.map +1 -0
  297. package/build-module/components/iframe/index.js +66 -17
  298. package/build-module/components/iframe/index.js.map +1 -1
  299. package/build-module/components/index.native.js +1 -1
  300. package/build-module/components/index.native.js.map +1 -1
  301. package/build-module/components/inner-blocks/use-nested-settings-update.js +8 -2
  302. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  303. package/build-module/components/inserter/block-patterns-explorer/index.js +3 -6
  304. package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
  305. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
  306. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  307. package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
  308. package/build-module/components/inserter/menu.native.js.map +1 -1
  309. package/build-module/components/inserter/mobile-tab-navigation.js +2 -2
  310. package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
  311. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  312. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js +28 -0
  313. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
  314. package/build-module/components/inspector-controls-tabs/index.js +1 -1
  315. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  316. package/build-module/components/inspector-controls-tabs/styles-tab.js +2 -2
  317. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  318. package/build-module/components/link-control/link-preview.js +5 -2
  319. package/build-module/components/link-control/link-preview.js.map +1 -1
  320. package/build-module/components/link-control/search-input.js.map +1 -1
  321. package/build-module/components/list-view/block-select-button.js +0 -2
  322. package/build-module/components/list-view/block-select-button.js.map +1 -1
  323. package/build-module/components/list-view/block.js +6 -13
  324. package/build-module/components/list-view/block.js.map +1 -1
  325. package/build-module/components/list-view/branch.js.map +1 -1
  326. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  327. package/build-module/components/list-view/index.js.map +1 -1
  328. package/build-module/components/list-view/use-clipboard-handler.js +3 -2
  329. package/build-module/components/list-view/use-clipboard-handler.js.map +1 -1
  330. package/build-module/components/list-view/utils.js +2 -1
  331. package/build-module/components/list-view/utils.js.map +1 -1
  332. package/build-module/components/panel-color-settings/index.js.map +1 -1
  333. package/build-module/components/provider/index.js.map +1 -1
  334. package/build-module/components/resizable-box-popover/index.js +3 -5
  335. package/build-module/components/resizable-box-popover/index.js.map +1 -1
  336. package/build-module/components/responsive-block-control/index.js +1 -1
  337. package/build-module/components/responsive-block-control/index.js.map +1 -1
  338. package/build-module/components/rich-text/index.js +47 -28
  339. package/build-module/components/rich-text/index.js.map +1 -1
  340. package/build-module/components/rich-text/use-enter.js +3 -0
  341. package/build-module/components/rich-text/use-enter.js.map +1 -1
  342. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  343. package/build-module/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
  344. package/build-module/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
  345. package/build-module/components/url-popover/index.js +3 -3
  346. package/build-module/components/url-popover/index.js.map +1 -1
  347. package/build-module/components/use-moving-animation/index.js +4 -0
  348. package/build-module/components/use-moving-animation/index.js.map +1 -1
  349. package/build-module/components/warning/index.native.js +9 -4
  350. package/build-module/components/warning/index.native.js.map +1 -1
  351. package/build-module/components/writing-flow/use-clipboard-handler.js +3 -2
  352. package/build-module/components/writing-flow/use-clipboard-handler.js.map +1 -1
  353. package/build-module/components/writing-flow/utils.js +22 -7
  354. package/build-module/components/writing-flow/utils.js.map +1 -1
  355. package/build-module/hooks/anchor.js +8 -9
  356. package/build-module/hooks/anchor.js.map +1 -1
  357. package/build-module/hooks/background.js +38 -1
  358. package/build-module/hooks/background.js.map +1 -1
  359. package/build-module/hooks/block-hooks.js +34 -8
  360. package/build-module/hooks/block-hooks.js.map +1 -1
  361. package/build-module/hooks/border.js +7 -5
  362. package/build-module/hooks/border.js.map +1 -1
  363. package/build-module/hooks/dimensions.js +1 -2
  364. package/build-module/hooks/dimensions.js.map +1 -1
  365. package/build-module/hooks/font-size.js +7 -8
  366. package/build-module/hooks/font-size.js.map +1 -1
  367. package/build-module/hooks/index.js +3 -2
  368. package/build-module/hooks/index.js.map +1 -1
  369. package/build-module/hooks/layout-child.js +67 -6
  370. package/build-module/hooks/layout-child.js.map +1 -1
  371. package/build-module/hooks/layout.js +32 -14
  372. package/build-module/hooks/layout.js.map +1 -1
  373. package/build-module/hooks/line-height.js.map +1 -1
  374. package/build-module/hooks/position.js +1 -1
  375. package/build-module/hooks/position.js.map +1 -1
  376. package/build-module/hooks/spacing-visualizer.js +106 -0
  377. package/build-module/hooks/spacing-visualizer.js.map +1 -0
  378. package/build-module/hooks/use-bindings-attributes.js +172 -49
  379. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  380. package/build-module/hooks/use-typography-props.js +2 -3
  381. package/build-module/hooks/use-typography-props.js.map +1 -1
  382. package/build-module/layouts/grid.js +6 -2
  383. package/build-module/layouts/grid.js.map +1 -1
  384. package/build-module/private-apis.js +7 -3
  385. package/build-module/private-apis.js.map +1 -1
  386. package/build-module/private-apis.native.js +3 -1
  387. package/build-module/private-apis.native.js.map +1 -1
  388. package/build-module/store/actions.js +42 -12
  389. package/build-module/store/actions.js.map +1 -1
  390. package/build-module/store/private-actions.js +29 -54
  391. package/build-module/store/private-actions.js.map +1 -1
  392. package/build-module/store/private-selectors.js +0 -6
  393. package/build-module/store/private-selectors.js.map +1 -1
  394. package/build-module/store/reducer.js +34 -46
  395. package/build-module/store/reducer.js.map +1 -1
  396. package/build-module/store/selectors.js +23 -13
  397. package/build-module/store/selectors.js.map +1 -1
  398. package/build-style/content-rtl.css +22 -2
  399. package/build-style/content.css +22 -2
  400. package/build-style/default-editor-styles-rtl.css +1 -0
  401. package/build-style/default-editor-styles.css +1 -0
  402. package/build-style/style-rtl.css +106 -27
  403. package/build-style/style.css +106 -27
  404. package/package.json +31 -31
  405. package/src/components/block-actions/index.js +59 -55
  406. package/src/components/block-bindings-toolbar-indicator/index.js +20 -0
  407. package/src/components/block-bindings-toolbar-indicator/style.scss +16 -0
  408. package/src/components/block-draggable/test/index.native.js +2 -2
  409. package/src/components/block-edit/context.js +1 -0
  410. package/src/components/block-edit/index.js +5 -1
  411. package/src/components/block-heading-level-dropdown/README.md +5 -5
  412. package/src/components/block-heading-level-dropdown/index.js +5 -5
  413. package/src/components/block-heading-level-dropdown/index.native.js +5 -4
  414. package/src/components/block-inspector/index.js +7 -5
  415. package/src/components/block-list/block-crash-boundary.native.js +43 -0
  416. package/src/components/block-list/block-crash-warning.native.js +19 -0
  417. package/src/components/block-list/block-invalid-warning.native.js +1 -1
  418. package/src/components/block-list/block-list-item.native.js +1 -1
  419. package/src/components/block-list/block-outline.native.js +36 -21
  420. package/src/components/block-list/block-selection-button.native.js +1 -3
  421. package/src/components/block-list/block.native.js +14 -10
  422. package/src/components/block-list/content.scss +21 -1
  423. package/src/components/block-list/test/block-outline.native.js +255 -0
  424. package/src/components/block-list/use-block-props/index.js +12 -2
  425. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -7
  426. package/src/components/block-mover/index.native.js +1 -1
  427. package/src/components/block-popover/cover.js +63 -0
  428. package/src/components/block-popover/drop-zone.js +3 -4
  429. package/src/components/block-popover/index.js +1 -28
  430. package/src/components/block-preview/index.js +3 -1
  431. package/src/components/block-removal-warning-modal/index.js +5 -19
  432. package/src/components/block-rename/modal.js +1 -1
  433. package/src/components/block-settings/container.native.js +5 -1
  434. package/src/components/block-settings-menu/block-settings-dropdown.js +53 -65
  435. package/src/components/block-settings-menu-controls/README.md +0 -9
  436. package/src/components/block-settings-menu-controls/index.js +1 -6
  437. package/src/components/block-switcher/block-transformations-menu.native.js +1 -1
  438. package/src/components/block-toolbar/block-toolbar-menu.native.js +2 -2
  439. package/src/components/block-toolbar/index.js +22 -16
  440. package/src/components/block-toolbar/shuffle.js +93 -0
  441. package/src/components/block-toolbar/test/index.native.js +1 -7
  442. package/src/components/block-toolbar/use-has-block-toolbar.js +49 -0
  443. package/src/components/block-tools/block-selection-button.js +4 -0
  444. package/src/components/block-tools/empty-block-inserter.js +3 -6
  445. package/src/components/block-tools/index.js +13 -36
  446. package/src/components/block-tools/use-show-block-tools.js +73 -0
  447. package/src/components/caption/index.native.js +1 -1
  448. package/src/components/child-layout-control/index.js +148 -36
  449. package/src/components/color-palette/control.js +1 -1
  450. package/src/components/colors-gradients/control.js +1 -1
  451. package/src/components/colors-gradients/test/control.js +2 -2
  452. package/src/components/contrast-checker/test/index.js +10 -10
  453. package/src/components/convert-to-group-buttons/toolbar.js +13 -1
  454. package/src/components/default-block-appender/content.scss +5 -2
  455. package/src/components/global-styles/border-panel.js +35 -24
  456. package/src/components/global-styles/color-panel.js +1 -1
  457. package/src/components/global-styles/dimensions-panel.js +9 -34
  458. package/src/components/global-styles/image-settings-panel.js +1 -1
  459. package/src/components/global-styles/index.js +5 -1
  460. package/src/components/global-styles/shadow-panel-components.js +92 -23
  461. package/src/components/global-styles/style.scss +33 -10
  462. package/src/components/global-styles/test/typography-utils.js +231 -81
  463. package/src/components/global-styles/test/use-global-styles-output.js +31 -0
  464. package/src/components/global-styles/typography-utils.js +10 -7
  465. package/src/components/global-styles/use-global-styles-output.js +17 -17
  466. package/src/components/global-styles/utils.js +2 -26
  467. package/src/components/grid-visualizer/grid-item-resizer.js +100 -0
  468. package/src/components/grid-visualizer/grid-visualizer.js +81 -0
  469. package/src/components/grid-visualizer/index.js +2 -0
  470. package/src/components/grid-visualizer/style.scss +33 -0
  471. package/src/components/grid-visualizer/utils.js +5 -0
  472. package/src/components/iframe/index.js +89 -26
  473. package/src/components/index.native.js +1 -0
  474. package/src/components/inner-blocks/use-nested-settings-update.js +12 -2
  475. package/src/components/inserter/block-patterns-explorer/index.js +2 -9
  476. package/src/components/inserter/block-patterns-explorer/pattern-list.js +7 -1
  477. package/src/components/inserter/media-tab/media-preview.js +1 -1
  478. package/src/components/inserter/menu.native.js +3 -3
  479. package/src/components/inserter/mobile-tab-navigation.js +2 -2
  480. package/src/components/inserter/style.scss +10 -0
  481. package/src/components/inspector-controls/block-support-tools-panel.js +2 -2
  482. package/src/components/inspector-controls-tabs/advanced-controls-panel.native.js +31 -0
  483. package/src/components/inspector-controls-tabs/index.js +1 -1
  484. package/src/components/inspector-controls-tabs/styles-tab.js +2 -2
  485. package/src/components/line-height-control/test/index.js +1 -1
  486. package/src/components/link-control/link-preview.js +9 -2
  487. package/src/components/link-control/search-input.js +1 -1
  488. package/src/components/link-control/style.scss +9 -5
  489. package/src/components/list-view/block-select-button.js +0 -2
  490. package/src/components/list-view/block.js +12 -21
  491. package/src/components/list-view/branch.js +1 -1
  492. package/src/components/list-view/drop-indicator.js +1 -1
  493. package/src/components/list-view/index.js +1 -1
  494. package/src/components/list-view/style.scss +34 -16
  495. package/src/components/list-view/use-clipboard-handler.js +3 -2
  496. package/src/components/list-view/utils.js +4 -1
  497. package/src/components/panel-color-settings/index.js +1 -1
  498. package/src/components/panel-color-settings/test/index.js +3 -3
  499. package/src/components/provider/index.js +1 -4
  500. package/src/components/resizable-box-popover/index.js +4 -6
  501. package/src/components/responsive-block-control/README.md +4 -4
  502. package/src/components/responsive-block-control/index.js +1 -1
  503. package/src/components/responsive-block-control/test/index.js +5 -5
  504. package/src/components/rich-text/README.md +6 -0
  505. package/src/components/rich-text/index.js +76 -53
  506. package/src/components/rich-text/use-enter.js +4 -0
  507. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
  508. package/src/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
  509. package/src/components/url-popover/index.js +5 -5
  510. package/src/components/url-popover/style.scss +1 -0
  511. package/src/components/use-moving-animation/index.js +1 -0
  512. package/src/components/warning/index.native.js +19 -15
  513. package/src/components/writing-flow/use-clipboard-handler.js +3 -2
  514. package/src/components/writing-flow/utils.js +31 -16
  515. package/src/hooks/anchor.js +41 -61
  516. package/src/hooks/background.js +49 -4
  517. package/src/hooks/block-hooks.js +47 -9
  518. package/src/hooks/block-hooks.scss +6 -0
  519. package/src/hooks/border.js +16 -4
  520. package/src/hooks/dimensions.js +1 -2
  521. package/src/hooks/font-size.js +7 -12
  522. package/src/hooks/index.js +3 -0
  523. package/src/hooks/layout-child.js +82 -8
  524. package/src/hooks/layout.js +34 -19
  525. package/src/hooks/line-height.js +1 -1
  526. package/src/hooks/position.js +1 -1
  527. package/src/hooks/spacing-visualizer.js +126 -0
  528. package/src/hooks/{padding.scss → spacing.scss} +1 -1
  529. package/src/hooks/test/__snapshots__/anchor.native.js.snap +7 -0
  530. package/src/hooks/test/anchor.native.js +32 -0
  531. package/src/hooks/use-bindings-attributes.js +215 -65
  532. package/src/hooks/use-typography-props.js +2 -8
  533. package/src/layouts/grid.js +8 -3
  534. package/src/private-apis.js +6 -2
  535. package/src/private-apis.native.js +2 -0
  536. package/src/store/actions.js +56 -18
  537. package/src/store/private-actions.js +34 -79
  538. package/src/store/private-selectors.js +0 -8
  539. package/src/store/reducer.js +43 -64
  540. package/src/store/selectors.js +41 -46
  541. package/src/store/test/actions.js +0 -4
  542. package/src/style.scss +3 -1
  543. package/tsconfig.json +1 -0
  544. package/build/hooks/margin.js +0 -86
  545. package/build/hooks/margin.js.map +0 -1
  546. package/build/hooks/padding.js +0 -78
  547. package/build/hooks/padding.js.map +0 -1
  548. package/build/utils/use-can-block-toolbar-be-focused.js +0 -46
  549. package/build/utils/use-can-block-toolbar-be-focused.js.map +0 -1
  550. package/build-module/hooks/margin.js +0 -78
  551. package/build-module/hooks/margin.js.map +0 -1
  552. package/build-module/hooks/padding.js +0 -70
  553. package/build-module/hooks/padding.js.map +0 -1
  554. package/build-module/utils/use-can-block-toolbar-be-focused.js +0 -40
  555. package/build-module/utils/use-can-block-toolbar-be-focused.js.map +0 -1
  556. package/src/hooks/margin.js +0 -91
  557. package/src/hooks/padding.js +0 -82
  558. package/src/utils/use-can-block-toolbar-be-focused.js +0 -48
@@ -16,20 +16,25 @@ import { normalizeIconObject } from '@wordpress/blocks';
16
16
  */
17
17
  import styles from './style.scss';
18
18
  function Warning({
19
+ actions,
19
20
  title,
20
21
  message,
21
22
  icon,
22
23
  iconClass,
23
24
  preferredColorScheme,
24
25
  getStylesFromColorScheme,
26
+ containerStyle: extraContainerStyle,
27
+ titleStyle: extraTitleStyle,
28
+ messageStyle: extraMessageStyle,
25
29
  ...viewProps
26
30
  }) {
27
31
  icon = icon && normalizeIconObject(icon);
28
32
  const internalIconClass = 'warning-icon' + '-' + preferredColorScheme;
29
- const titleStyle = getStylesFromColorScheme(styles.title, styles.titleDark);
30
- const messageStyle = getStylesFromColorScheme(styles.message, styles.messageDark);
33
+ const containerStyle = [getStylesFromColorScheme(styles.container, styles.containerDark), extraContainerStyle];
34
+ const titleStyle = [getStylesFromColorScheme(styles.title, styles.titleDark), extraTitleStyle];
35
+ const messageStyle = [getStylesFromColorScheme(styles.message, styles.messageDark), extraMessageStyle];
31
36
  return createElement(View, {
32
- style: getStylesFromColorScheme(styles.container, styles.containerDark),
37
+ style: containerStyle,
33
38
  ...viewProps
34
39
  }, icon && createElement(View, {
35
40
  style: styles.icon
@@ -40,7 +45,7 @@ function Warning({
40
45
  style: titleStyle
41
46
  }, title), message && createElement(Text, {
42
47
  style: messageStyle
43
- }, message));
48
+ }, message), actions);
44
49
  }
45
50
  export default withPreferredColorScheme(Warning);
46
51
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["View","Text","Icon","withPreferredColorScheme","normalizeIconObject","styles","Warning","title","message","icon","iconClass","preferredColorScheme","getStylesFromColorScheme","viewProps","internalIconClass","titleStyle","titleDark","messageStyle","messageDark","createElement","style","container","containerDark","className","src"],"sources":["@wordpress/block-editor/src/components/warning/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Icon } from '@wordpress/components';\nimport { withPreferredColorScheme } from '@wordpress/compose';\nimport { normalizeIconObject } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nfunction Warning( {\n\ttitle,\n\tmessage,\n\ticon,\n\ticonClass,\n\tpreferredColorScheme,\n\tgetStylesFromColorScheme,\n\t...viewProps\n} ) {\n\ticon = icon && normalizeIconObject( icon );\n\tconst internalIconClass = 'warning-icon' + '-' + preferredColorScheme;\n\tconst titleStyle = getStylesFromColorScheme(\n\t\tstyles.title,\n\t\tstyles.titleDark\n\t);\n\tconst messageStyle = getStylesFromColorScheme(\n\t\tstyles.message,\n\t\tstyles.messageDark\n\t);\n\n\treturn (\n\t\t<View\n\t\t\tstyle={ getStylesFromColorScheme(\n\t\t\t\tstyles.container,\n\t\t\t\tstyles.containerDark\n\t\t\t) }\n\t\t\t{ ...viewProps }\n\t\t>\n\t\t\t{ icon && (\n\t\t\t\t<View style={ styles.icon }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tclassName={ iconClass || internalIconClass }\n\t\t\t\t\t\ticon={ icon && icon.src ? icon.src : icon }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t\t{ title && <Text style={ titleStyle }>{ title }</Text> }\n\t\t\t{ message && <Text style={ messageStyle }>{ message }</Text> }\n\t\t</View>\n\t);\n}\n\nexport default withPreferredColorScheme( Warning );\n"],"mappings":";AAAA;AACA;AACA;AACA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AAeL,wBAAwB,CAAEG,OAAQ,CAAC"}
1
+ {"version":3,"names":["View","Text","Icon","withPreferredColorScheme","normalizeIconObject","styles","Warning","actions","title","message","icon","iconClass","preferredColorScheme","getStylesFromColorScheme","containerStyle","extraContainerStyle","titleStyle","extraTitleStyle","messageStyle","extraMessageStyle","viewProps","internalIconClass","container","containerDark","titleDark","messageDark","createElement","style","className","src"],"sources":["@wordpress/block-editor/src/components/warning/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Icon } from '@wordpress/components';\nimport { withPreferredColorScheme } from '@wordpress/compose';\nimport { normalizeIconObject } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nfunction Warning( {\n\tactions,\n\ttitle,\n\tmessage,\n\ticon,\n\ticonClass,\n\tpreferredColorScheme,\n\tgetStylesFromColorScheme,\n\tcontainerStyle: extraContainerStyle,\n\ttitleStyle: extraTitleStyle,\n\tmessageStyle: extraMessageStyle,\n\t...viewProps\n} ) {\n\ticon = icon && normalizeIconObject( icon );\n\tconst internalIconClass = 'warning-icon' + '-' + preferredColorScheme;\n\n\tconst containerStyle = [\n\t\tgetStylesFromColorScheme( styles.container, styles.containerDark ),\n\t\textraContainerStyle,\n\t];\n\tconst titleStyle = [\n\t\tgetStylesFromColorScheme( styles.title, styles.titleDark ),\n\t\textraTitleStyle,\n\t];\n\tconst messageStyle = [\n\t\tgetStylesFromColorScheme( styles.message, styles.messageDark ),\n\t\textraMessageStyle,\n\t];\n\n\treturn (\n\t\t<View style={ containerStyle } { ...viewProps }>\n\t\t\t{ icon && (\n\t\t\t\t<View style={ styles.icon }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tclassName={ iconClass || internalIconClass }\n\t\t\t\t\t\ticon={ icon && icon.src ? icon.src : icon }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t\t{ title && <Text style={ titleStyle }>{ title }</Text> }\n\t\t\t{ message && <Text style={ messageStyle }>{ message }</Text> }\n\t\t\t{ actions }\n\t\t</View>\n\t);\n}\n\nexport default withPreferredColorScheme( Warning );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,IAAI,EAAEC,IAAI,QAAQ,cAAc;;AAEzC;AACA;AACA;AACA,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,mBAAmB,QAAQ,mBAAmB;;AAEvD;AACA;AACA;AACA,OAAOC,MAAM,MAAM,cAAc;AAEjC,SAASC,OAAOA,CAAE;EACjBC,OAAO;EACPC,KAAK;EACLC,OAAO;EACPC,IAAI;EACJC,SAAS;EACTC,oBAAoB;EACpBC,wBAAwB;EACxBC,cAAc,EAAEC,mBAAmB;EACnCC,UAAU,EAAEC,eAAe;EAC3BC,YAAY,EAAEC,iBAAiB;EAC/B,GAAGC;AACJ,CAAC,EAAG;EACHV,IAAI,GAAGA,IAAI,IAAIN,mBAAmB,CAAEM,IAAK,CAAC;EAC1C,MAAMW,iBAAiB,GAAG,cAAc,GAAG,GAAG,GAAGT,oBAAoB;EAErE,MAAME,cAAc,GAAG,CACtBD,wBAAwB,CAAER,MAAM,CAACiB,SAAS,EAAEjB,MAAM,CAACkB,aAAc,CAAC,EAClER,mBAAmB,CACnB;EACD,MAAMC,UAAU,GAAG,CAClBH,wBAAwB,CAAER,MAAM,CAACG,KAAK,EAAEH,MAAM,CAACmB,SAAU,CAAC,EAC1DP,eAAe,CACf;EACD,MAAMC,YAAY,GAAG,CACpBL,wBAAwB,CAAER,MAAM,CAACI,OAAO,EAAEJ,MAAM,CAACoB,WAAY,CAAC,EAC9DN,iBAAiB,CACjB;EAED,OACCO,aAAA,CAAC1B,IAAI;IAAC2B,KAAK,EAAGb,cAAgB;IAAA,GAAMM;EAAS,GAC1CV,IAAI,IACLgB,aAAA,CAAC1B,IAAI;IAAC2B,KAAK,EAAGtB,MAAM,CAACK;EAAM,GAC1BgB,aAAA,CAACxB,IAAI;IACJ0B,SAAS,EAAGjB,SAAS,IAAIU,iBAAmB;IAC5CX,IAAI,EAAGA,IAAI,IAAIA,IAAI,CAACmB,GAAG,GAAGnB,IAAI,CAACmB,GAAG,GAAGnB;EAAM,CAC3C,CACI,CACN,EACCF,KAAK,IAAIkB,aAAA,CAACzB,IAAI;IAAC0B,KAAK,EAAGX;EAAY,GAAGR,KAAa,CAAC,EACpDC,OAAO,IAAIiB,aAAA,CAACzB,IAAI;IAAC0B,KAAK,EAAGT;EAAc,GAAGT,OAAe,CAAC,EAC1DF,OACG,CAAC;AAET;AAEA,eAAeJ,wBAAwB,CAAEG,OAAQ,CAAC"}
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { documentHasSelection, documentHasUncollapsedSelection } from '@wordpress/dom';
5
- import { useDispatch, useSelect } from '@wordpress/data';
5
+ import { useDispatch, useRegistry, useSelect } from '@wordpress/data';
6
6
  import { useRefEffect } from '@wordpress/compose';
7
7
 
8
8
  /**
@@ -12,6 +12,7 @@ import { store as blockEditorStore } from '../../store';
12
12
  import { useNotifyCopy } from '../../utils/use-notify-copy';
13
13
  import { getPasteBlocks, setClipboardBlocks } from './utils';
14
14
  export default function useClipboardHandler() {
15
+ const registry = useRegistry();
15
16
  const {
16
17
  getBlocksByClientId,
17
18
  getSelectedBlockClientIds,
@@ -86,7 +87,7 @@ export default function useClipboardHandler() {
86
87
  const inBetweenBlocks = getBlocksByClientId(selectedBlockClientIds.slice(1, selectedBlockClientIds.length - 1));
87
88
  blocks = [head, ...inBetweenBlocks, tail];
88
89
  }
89
- setClipboardBlocks(event, blocks);
90
+ setClipboardBlocks(event, blocks, registry);
90
91
  }
91
92
  }
92
93
  if (event.type === 'cut') {
@@ -1 +1 @@
1
- {"version":3,"names":["documentHasSelection","documentHasUncollapsedSelection","useDispatch","useSelect","useRefEffect","store","blockEditorStore","useNotifyCopy","getPasteBlocks","setClipboardBlocks","useClipboardHandler","getBlocksByClientId","getSelectedBlockClientIds","hasMultiSelection","getSettings","__unstableIsFullySelected","__unstableIsSelectionCollapsed","__unstableIsSelectionMergeable","__unstableGetSelectedBlocksWithPartialSelection","canInsertBlockType","flashBlock","removeBlocks","replaceBlocks","__unstableDeleteSelection","__unstableExpandSelection","insertBlocks","notifyCopy","node","handler","event","defaultPrevented","selectedBlockClientIds","length","target","ownerDocument","hasSelection","type","contains","activeElement","preventDefault","isSelectionMergeable","shouldHandleWholeBlocks","expandSelectionIsNeeded","blocks","head","tail","inBetweenBlocks","slice","contentEditable","__experimentalCanUserUseUnfilteredHTML","canUserUseUnfilteredHTML","selectedBlockClientId","every","block","name","undefined","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-clipboard-handler.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tdocumentHasSelection,\n\tdocumentHasUncollapsedSelection,\n} from '@wordpress/dom';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useNotifyCopy } from '../../utils/use-notify-copy';\nimport { getPasteBlocks, setClipboardBlocks } from './utils';\n\nexport default function useClipboardHandler() {\n\tconst {\n\t\tgetBlocksByClientId,\n\t\tgetSelectedBlockClientIds,\n\t\thasMultiSelection,\n\t\tgetSettings,\n\t\t__unstableIsFullySelected,\n\t\t__unstableIsSelectionCollapsed,\n\t\t__unstableIsSelectionMergeable,\n\t\t__unstableGetSelectedBlocksWithPartialSelection,\n\t\tcanInsertBlockType,\n\t} = useSelect( blockEditorStore );\n\tconst {\n\t\tflashBlock,\n\t\tremoveBlocks,\n\t\treplaceBlocks,\n\t\t__unstableDeleteSelection,\n\t\t__unstableExpandSelection,\n\t\tinsertBlocks,\n\t} = useDispatch( blockEditorStore );\n\tconst notifyCopy = useNotifyCopy();\n\n\treturn useRefEffect( ( node ) => {\n\t\tfunction handler( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\t// This was likely already handled in rich-text/use-paste-handler.js.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\n\t\t\tif ( selectedBlockClientIds.length === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Always handle multiple selected blocks.\n\t\t\tif ( ! hasMultiSelection() ) {\n\t\t\t\tconst { target } = event;\n\t\t\t\tconst { ownerDocument } = target;\n\t\t\t\t// If copying, only consider actual text selection as selection.\n\t\t\t\t// Otherwise, any focus on an input field is considered.\n\t\t\t\tconst hasSelection =\n\t\t\t\t\tevent.type === 'copy' || event.type === 'cut'\n\t\t\t\t\t\t? documentHasUncollapsedSelection( ownerDocument )\n\t\t\t\t\t\t: documentHasSelection( ownerDocument );\n\n\t\t\t\t// Let native copy behaviour take over in input fields.\n\t\t\t\tif ( hasSelection ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( ! node.contains( event.target.ownerDocument.activeElement ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tevent.preventDefault();\n\n\t\t\tconst isSelectionMergeable = __unstableIsSelectionMergeable();\n\t\t\tconst shouldHandleWholeBlocks =\n\t\t\t\t__unstableIsSelectionCollapsed() || __unstableIsFullySelected();\n\t\t\tconst expandSelectionIsNeeded =\n\t\t\t\t! shouldHandleWholeBlocks && ! isSelectionMergeable;\n\t\t\tif ( event.type === 'copy' || event.type === 'cut' ) {\n\t\t\t\tif ( selectedBlockClientIds.length === 1 ) {\n\t\t\t\t\tflashBlock( selectedBlockClientIds[ 0 ] );\n\t\t\t\t}\n\t\t\t\t// If we have a partial selection that is not mergeable, just\n\t\t\t\t// expand the selection to the whole blocks.\n\t\t\t\tif ( expandSelectionIsNeeded ) {\n\t\t\t\t\t__unstableExpandSelection();\n\t\t\t\t} else {\n\t\t\t\t\tnotifyCopy( event.type, selectedBlockClientIds );\n\t\t\t\t\tlet blocks;\n\t\t\t\t\t// Check if we have partial selection.\n\t\t\t\t\tif ( shouldHandleWholeBlocks ) {\n\t\t\t\t\t\tblocks = getBlocksByClientId( selectedBlockClientIds );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst [ head, tail ] =\n\t\t\t\t\t\t\t__unstableGetSelectedBlocksWithPartialSelection();\n\t\t\t\t\t\tconst inBetweenBlocks = getBlocksByClientId(\n\t\t\t\t\t\t\tselectedBlockClientIds.slice(\n\t\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\t\tselectedBlockClientIds.length - 1\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t\tblocks = [ head, ...inBetweenBlocks, tail ];\n\t\t\t\t\t}\n\n\t\t\t\t\tsetClipboardBlocks( event, blocks );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( event.type === 'cut' ) {\n\t\t\t\t// We need to also check if at the start we needed to\n\t\t\t\t// expand the selection, as in this point we might have\n\t\t\t\t// programmatically fully selected the blocks above.\n\t\t\t\tif ( shouldHandleWholeBlocks && ! expandSelectionIsNeeded ) {\n\t\t\t\t\tremoveBlocks( selectedBlockClientIds );\n\t\t\t\t} else {\n\t\t\t\t\tevent.target.ownerDocument.activeElement.contentEditable = false;\n\t\t\t\t\t__unstableDeleteSelection();\n\t\t\t\t}\n\t\t\t} else if ( event.type === 'paste' ) {\n\t\t\t\tconst {\n\t\t\t\t\t__experimentalCanUserUseUnfilteredHTML:\n\t\t\t\t\t\tcanUserUseUnfilteredHTML,\n\t\t\t\t} = getSettings();\n\t\t\t\tconst blocks = getPasteBlocks(\n\t\t\t\t\tevent,\n\t\t\t\t\tcanUserUseUnfilteredHTML\n\t\t\t\t);\n\n\t\t\t\tif ( selectedBlockClientIds.length === 1 ) {\n\t\t\t\t\tconst [ selectedBlockClientId ] = selectedBlockClientIds;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tblocks.every( ( block ) =>\n\t\t\t\t\t\t\tcanInsertBlockType(\n\t\t\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\t\t\tselectedBlockClientId\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\tinsertBlocks(\n\t\t\t\t\t\t\tblocks,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tselectedBlockClientId\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treplaceBlocks(\n\t\t\t\t\tselectedBlockClientIds,\n\t\t\t\t\tblocks,\n\t\t\t\t\tblocks.length - 1,\n\t\t\t\t\t-1\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tnode.ownerDocument.addEventListener( 'copy', handler );\n\t\tnode.ownerDocument.addEventListener( 'cut', handler );\n\t\tnode.ownerDocument.addEventListener( 'paste', handler );\n\n\t\treturn () => {\n\t\t\tnode.ownerDocument.removeEventListener( 'copy', handler );\n\t\t\tnode.ownerDocument.removeEventListener( 'cut', handler );\n\t\t\tnode.ownerDocument.removeEventListener( 'paste', handler );\n\t\t};\n\t}, [] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,oBAAoB,EACpBC,+BAA+B,QACzB,gBAAgB;AACvB,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,oBAAoB;;AAEjD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,aAAa,QAAQ,6BAA6B;AAC3D,SAASC,cAAc,EAAEC,kBAAkB,QAAQ,SAAS;AAE5D,eAAe,SAASC,mBAAmBA,CAAA,EAAG;EAC7C,MAAM;IACLC,mBAAmB;IACnBC,yBAAyB;IACzBC,iBAAiB;IACjBC,WAAW;IACXC,yBAAyB;IACzBC,8BAA8B;IAC9BC,8BAA8B;IAC9BC,+CAA+C;IAC/CC;EACD,CAAC,GAAGhB,SAAS,CAAEG,gBA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,CAACC,MAAM,KAAK,CAAC,EAAG;UAC1C,MAAM,CAAEmB,qBAAqB,CAAE,GAAGpB,sBAAsB;UAExD,IACCY,MAAM,CAACS,KAAK,CAAIC,KAAK,IACpBlC,kBAAkB,CACjBkC,KAAK,CAACC,IAAI,EACVH,qBACD,CACD,CAAC,EACA;YACD1B,YAAY,CACXkB,MAAM,EACNY,SAAS,EACTJ,qBACD,CAAC;YACD;UACD;QACD;QAEA7B,aAAa,CACZS,sBAAsB,EACtBY,MAAM,EACNA,MAAM,CAACX,MAAM,GAAG,CAAC,EACjB,CAAC,CACF,CAAC;MACF;IACD;IAEAL,IAAI,CAACO,aAAa,CAACsB,gBAAgB,CAAE,MAAM,EAAE5B,OAAQ,CAAC;IACtDD,IAAI,CAACO,aAAa,CAACsB,gBAAgB,CAAE,KAAK,EAAE5B,OAAQ,CAAC;IACrDD,IAAI,CAACO,aAAa,CAACsB,gBAAgB,CAAE,OAAO,EAAE5B,OAAQ,CAAC;IAEvD,OAAO,MAAM;MACZD,IAAI,CAACO,aAAa,CAACuB,mBAAmB,CAAE,MAAM,EAAE7B,OAAQ,CAAC;MACzDD,IAAI,CAACO,aAAa,CAACuB,mBAAmB,CAAE,KAAK,EAAE7B,OAAQ,CAAC;MACxDD,IAAI,CAACO,aAAa,CAACuB,mBAAmB,CAAE,OAAO,EAAE7B,OAAQ,CAAC;IAC3D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR"}
1
+ {"version":3,"names":["documentHasSelection","documentHasUncollapsedSelection","useDispatch","useRegistry","useSelect","useRefEffect","store","blockEditorStore","useNotifyCopy","getPasteBlocks","setClipboardBlocks","useClipboardHandler","registry","getBlocksByClientId","getSelectedBlockClientIds","hasMultiSelection","getSettings","__unstableIsFullySelected","__unstableIsSelectionCollapsed","__unstableIsSelectionMergeable","__unstableGetSelectedBlocksWithPartialSelection","canInsertBlockType","flashBlock","removeBlocks","replaceBlocks","__unstableDeleteSelection","__unstableExpandSelection","insertBlocks","notifyCopy","node","handler","event","defaultPrevented","selectedBlockClientIds","length","target","ownerDocument","hasSelection","type","contains","activeElement","preventDefault","isSelectionMergeable","shouldHandleWholeBlocks","expandSelectionIsNeeded","blocks","head","tail","inBetweenBlocks","slice","contentEditable","__experimentalCanUserUseUnfilteredHTML","canUserUseUnfilteredHTML","selectedBlockClientId","every","block","name","undefined","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-clipboard-handler.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tdocumentHasSelection,\n\tdocumentHasUncollapsedSelection,\n} from '@wordpress/dom';\nimport { useDispatch, useRegistry, useSelect } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useNotifyCopy } from '../../utils/use-notify-copy';\nimport { getPasteBlocks, setClipboardBlocks } from './utils';\n\nexport default function useClipboardHandler() {\n\tconst registry = useRegistry();\n\tconst {\n\t\tgetBlocksByClientId,\n\t\tgetSelectedBlockClientIds,\n\t\thasMultiSelection,\n\t\tgetSettings,\n\t\t__unstableIsFullySelected,\n\t\t__unstableIsSelectionCollapsed,\n\t\t__unstableIsSelectionMergeable,\n\t\t__unstableGetSelectedBlocksWithPartialSelection,\n\t\tcanInsertBlockType,\n\t} = useSelect( blockEditorStore );\n\tconst {\n\t\tflashBlock,\n\t\tremoveBlocks,\n\t\treplaceBlocks,\n\t\t__unstableDeleteSelection,\n\t\t__unstableExpandSelection,\n\t\tinsertBlocks,\n\t} = useDispatch( blockEditorStore );\n\tconst notifyCopy = useNotifyCopy();\n\n\treturn useRefEffect( ( node ) => {\n\t\tfunction handler( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\t// This was likely already handled in rich-text/use-paste-handler.js.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\n\t\t\tif ( selectedBlockClientIds.length === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Always handle multiple selected blocks.\n\t\t\tif ( ! hasMultiSelection() ) {\n\t\t\t\tconst { target } = event;\n\t\t\t\tconst { ownerDocument } = target;\n\t\t\t\t// If copying, only consider actual text selection as selection.\n\t\t\t\t// Otherwise, any focus on an input field is considered.\n\t\t\t\tconst hasSelection =\n\t\t\t\t\tevent.type === 'copy' || event.type === 'cut'\n\t\t\t\t\t\t? documentHasUncollapsedSelection( ownerDocument )\n\t\t\t\t\t\t: documentHasSelection( ownerDocument );\n\n\t\t\t\t// Let native copy behaviour take over in input fields.\n\t\t\t\tif ( hasSelection ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( ! node.contains( event.target.ownerDocument.activeElement ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tevent.preventDefault();\n\n\t\t\tconst isSelectionMergeable = __unstableIsSelectionMergeable();\n\t\t\tconst shouldHandleWholeBlocks =\n\t\t\t\t__unstableIsSelectionCollapsed() || __unstableIsFullySelected();\n\t\t\tconst expandSelectionIsNeeded =\n\t\t\t\t! shouldHandleWholeBlocks && ! isSelectionMergeable;\n\t\t\tif ( event.type === 'copy' || event.type === 'cut' ) {\n\t\t\t\tif ( selectedBlockClientIds.length === 1 ) {\n\t\t\t\t\tflashBlock( selectedBlockClientIds[ 0 ] );\n\t\t\t\t}\n\t\t\t\t// If we have a partial selection that is not mergeable, just\n\t\t\t\t// expand the selection to the whole blocks.\n\t\t\t\tif ( expandSelectionIsNeeded ) {\n\t\t\t\t\t__unstableExpandSelection();\n\t\t\t\t} else {\n\t\t\t\t\tnotifyCopy( event.type, selectedBlockClientIds );\n\t\t\t\t\tlet blocks;\n\t\t\t\t\t// Check if we have partial selection.\n\t\t\t\t\tif ( shouldHandleWholeBlocks ) {\n\t\t\t\t\t\tblocks = getBlocksByClientId( selectedBlockClientIds );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst [ head, tail ] =\n\t\t\t\t\t\t\t__unstableGetSelectedBlocksWithPartialSelection();\n\t\t\t\t\t\tconst inBetweenBlocks = getBlocksByClientId(\n\t\t\t\t\t\t\tselectedBlockClientIds.slice(\n\t\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\t\tselectedBlockClientIds.length - 1\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t\tblocks = [ head, ...inBetweenBlocks, tail ];\n\t\t\t\t\t}\n\n\t\t\t\t\tsetClipboardBlocks( event, blocks, registry );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( event.type === 'cut' ) {\n\t\t\t\t// We need to also check if at the start we needed to\n\t\t\t\t// expand the selection, as in this point we might have\n\t\t\t\t// programmatically fully selected the blocks above.\n\t\t\t\tif ( shouldHandleWholeBlocks && ! expandSelectionIsNeeded ) {\n\t\t\t\t\tremoveBlocks( selectedBlockClientIds );\n\t\t\t\t} else {\n\t\t\t\t\tevent.target.ownerDocument.activeElement.contentEditable = false;\n\t\t\t\t\t__unstableDeleteSelection();\n\t\t\t\t}\n\t\t\t} else if ( event.type === 'paste' ) {\n\t\t\t\tconst {\n\t\t\t\t\t__experimentalCanUserUseUnfilteredHTML:\n\t\t\t\t\t\tcanUserUseUnfilteredHTML,\n\t\t\t\t} = getSettings();\n\t\t\t\tconst blocks = getPasteBlocks(\n\t\t\t\t\tevent,\n\t\t\t\t\tcanUserUseUnfilteredHTML\n\t\t\t\t);\n\n\t\t\t\tif ( selectedBlockClientIds.length === 1 ) {\n\t\t\t\t\tconst [ selectedBlockClientId ] = selectedBlockClientIds;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tblocks.every( ( block ) =>\n\t\t\t\t\t\t\tcanInsertBlockType(\n\t\t\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\t\t\tselectedBlockClientId\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\tinsertBlocks(\n\t\t\t\t\t\t\tblocks,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tselectedBlockClientId\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treplaceBlocks(\n\t\t\t\t\tselectedBlockClientIds,\n\t\t\t\t\tblocks,\n\t\t\t\t\tblocks.length - 1,\n\t\t\t\t\t-1\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tnode.ownerDocument.addEventListener( 'copy', handler );\n\t\tnode.ownerDocument.addEventListener( 'cut', handler );\n\t\tnode.ownerDocument.addEventListener( 'paste', handler );\n\n\t\treturn () => {\n\t\t\tnode.ownerDocument.removeEventListener( 'copy', handler );\n\t\t\tnode.ownerDocument.removeEventListener( 'cut', handler );\n\t\t\tnode.ownerDocument.removeEventListener( 'paste', handler );\n\t\t};\n\t}, [] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,oBAAoB,EACpBC,+BAA+B,QACzB,gBAAgB;AACvB,SAASC,WAAW,EAAEC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACrE,SAASC,YAAY,QAAQ,oBAAoB;;AAEjD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,aAAa,QAAQ,6BAA6B;AAC3D,SAASC,cAAc,EAAEC,kBAAkB,QAAQ,SAAS;AAE5D,eAAe,SAASC,mBAAmBA,CAAA,EAAG;EAC7C,MAAMC,QAAQ,GAAGT,WAAW,CAAC,CAAC;EAC9B,MAAM;IACLU,mBAAmB;IACnBC,yBAAyB;IACzBC,iBAAiB;IACjBC,WAAW;IACXC,yBAAyB;IACzBC,8BAA8B;IAC9BC,8BAA8B;IAC9BC,+CAA+C;IAC/CC;EACD,CAAC,GAAGjB,SAAS,CAAEG,gBAAiB,CAAC;EACjC,MAAM;IACLe,UAAU;IACVC,YAAY;IACZC,aAAa;IACbC,yBAAyB;IACzBC,yBAAyB;IACzBC;EACD,CAAC,GAAGzB,W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M,CAACS,KAAK,CAAIC,KAAK,IACpBlC,kBAAkB,CACjBkC,KAAK,CAACC,IAAI,EACVH,qBACD,CACD,CAAC,EACA;YACD1B,YAAY,CACXkB,MAAM,EACNY,SAAS,EACTJ,qBACD,CAAC;YACD;UACD;QACD;QAEA7B,aAAa,CACZS,sBAAsB,EACtBY,MAAM,EACNA,MAAM,CAACX,MAAM,GAAG,CAAC,EACjB,CAAC,CACF,CAAC;MACF;IACD;IAEAL,IAAI,CAACO,aAAa,CAACsB,gBAAgB,CAAE,MAAM,EAAE5B,OAAQ,CAAC;IACtDD,IAAI,CAACO,aAAa,CAACsB,gBAAgB,CAAE,KAAK,EAAE5B,OAAQ,CAAC;IACrDD,IAAI,CAACO,aAAa,CAACsB,gBAAgB,CAAE,OAAO,EAAE5B,OAAQ,CAAC;IAEvD,OAAO,MAAM;MACZD,IAAI,CAACO,aAAa,CAACuB,mBAAmB,CAAE,MAAM,EAAE7B,OAAQ,CAAC;MACzDD,IAAI,CAACO,aAAa,CAACuB,mBAAmB,CAAE,KAAK,EAAE7B,OAAQ,CAAC;MACxDD,IAAI,CAACO,aAAa,CAACuB,mBAAmB,CAAE,OAAO,EAAE7B,OAAQ,CAAC;IAC3D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR"}
@@ -2,25 +2,40 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
5
- import { serialize, createBlock, pasteHandler, findTransform, getBlockTransforms } from '@wordpress/blocks';
5
+ import { serialize, createBlock, pasteHandler, findTransform, getBlockTransforms, store as blocksStore } from '@wordpress/blocks';
6
6
 
7
7
  /**
8
8
  * Internal dependencies
9
9
  */
10
10
  import { getPasteEventData } from '../../utils/pasting';
11
+ import { store as blockEditorStore } from '../../store';
12
+ export const requiresWrapperOnCopy = Symbol('requiresWrapperOnCopy');
11
13
 
12
14
  /**
13
15
  * Sets the clipboard data for the provided blocks, with both HTML and plain
14
16
  * text representations.
15
17
  *
16
- * @param {ClipboardEvent} event Clipboard event.
17
- * @param {WPBlock[]} blocks Blocks to set as clipboard data.
18
+ * @param {ClipboardEvent} event Clipboard event.
19
+ * @param {WPBlock[]} blocks Blocks to set as clipboard data.
20
+ * @param {Object} registry The registry to select from.
18
21
  */
19
- export function setClipboardBlocks(event, blocks) {
22
+ export function setClipboardBlocks(event, blocks, registry) {
20
23
  let _blocks = blocks;
21
- const wrapperBlockName = event.clipboardData.getData('__unstableWrapperBlockName');
22
- if (wrapperBlockName) {
23
- _blocks = createBlock(wrapperBlockName, JSON.parse(event.clipboardData.getData('__unstableWrapperBlockAttributes')), _blocks);
24
+ const [firstBlock] = blocks;
25
+ if (firstBlock) {
26
+ const firstBlockType = registry.select(blocksStore).getBlockType(firstBlock.name);
27
+ if (firstBlockType[requiresWrapperOnCopy]) {
28
+ const {
29
+ getBlockRootClientId,
30
+ getBlockName,
31
+ getBlockAttributes
32
+ } = registry.select(blockEditorStore);
33
+ const wrapperBlockClientId = getBlockRootClientId(firstBlock.clientId);
34
+ const wrapperBlockName = getBlockName(wrapperBlockClientId);
35
+ if (wrapperBlockName) {
36
+ _blocks = createBlock(wrapperBlockName, getBlockAttributes(wrapperBlockClientId), _blocks);
37
+ }
38
+ }
24
39
  }
25
40
  const serialized = serialize(_blocks);
26
41
  event.clipboardData.setData('text/plain', toPlainText(serialized));
@@ -1 +1 @@
1
- {"version":3,"names":["__unstableStripHTML","stripHTML","serialize","createBlock","pasteHandler","findTransform","getBlockTransforms","getPasteEventData","setClipboardBlocks","event","blocks","_blocks","wrapperBlockName","clipboardData","getData","JSON","parse","serialized","setData","toPlainText","getPasteBlocks","canUserUseUnfilteredHTML","plainText","html","files","length","fromTransforms","reduce","accumulator","file","transformation","transform","type","isMatch","push","flat","HTML","mode","replace","trim"],"sources":["@wordpress/block-editor/src/components/writing-flow/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport {\n\tserialize,\n\tcreateBlock,\n\tpasteHandler,\n\tfindTransform,\n\tgetBlockTransforms,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { getPasteEventData } from '../../utils/pasting';\n\n/**\n * Sets the clipboard data for the provided blocks, with both HTML and plain\n * text representations.\n *\n * @param {ClipboardEvent} event Clipboard event.\n * @param {WPBlock[]} blocks Blocks to set as clipboard data.\n */\nexport function setClipboardBlocks( event, blocks ) {\n\tlet _blocks = blocks;\n\tconst wrapperBlockName = event.clipboardData.getData(\n\t\t'__unstableWrapperBlockName'\n\t);\n\n\tif ( wrapperBlockName ) {\n\t\t_blocks = createBlock(\n\t\t\twrapperBlockName,\n\t\t\tJSON.parse(\n\t\t\t\tevent.clipboardData.getData(\n\t\t\t\t\t'__unstableWrapperBlockAttributes'\n\t\t\t\t)\n\t\t\t),\n\t\t\t_blocks\n\t\t);\n\t}\n\n\tconst serialized = serialize( _blocks );\n\n\tevent.clipboardData.setData( 'text/plain', toPlainText( serialized ) );\n\tevent.clipboardData.setData( 'text/html', serialized );\n}\n\n/**\n * Returns the blocks to be pasted from the clipboard event.\n *\n * @param {ClipboardEvent} event The clipboard event.\n * @param {boolean} canUserUseUnfilteredHTML Whether the user can or can't post unfiltered HTML.\n * @return {Array|string} A list of blocks or a string, depending on `handlerMode`.\n */\nexport function getPasteBlocks( event, canUserUseUnfilteredHTML ) {\n\tconst { plainText, html, files } = getPasteEventData( event );\n\tlet blocks = [];\n\n\tif ( files.length ) {\n\t\tconst fromTransforms = getBlockTransforms( 'from' );\n\t\tblocks = files\n\t\t\t.reduce( ( accumulator, file ) => {\n\t\t\t\tconst transformation = findTransform(\n\t\t\t\t\tfromTransforms,\n\t\t\t\t\t( transform ) =>\n\t\t\t\t\t\ttransform.type === 'files' &&\n\t\t\t\t\t\ttransform.isMatch( [ file ] )\n\t\t\t\t);\n\t\t\t\tif ( transformation ) {\n\t\t\t\t\taccumulator.push( transformation.transform( [ file ] ) );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, [] )\n\t\t\t.flat();\n\t} else {\n\t\tblocks = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t\tmode: 'BLOCKS',\n\t\t\tcanUserUseUnfilteredHTML,\n\t\t} );\n\t}\n\n\treturn blocks;\n}\n\n/**\n * Given a string of HTML representing serialized blocks, returns the plain\n * text extracted after stripping the HTML of any tags and fixing line breaks.\n *\n * @param {string} html Serialized blocks.\n * @return {string} The plain-text content with any html removed.\n */\nfunction toPlainText( html ) {\n\t// Manually handle BR tags as line breaks prior to `stripHTML` call\n\thtml = html.replace( /<br>/g, '\\n' );\n\n\tconst plainText = stripHTML( html ).trim();\n\n\t// Merge any consecutive line breaks\n\treturn plainText.replace( /\\n\\n+/g, '\\n\\n' );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,mBAAmB,IAAIC,SAAS,QAAQ,gBAAgB;AACjE,SACCC,SAAS,EACTC,WAAW,EACXC,YAAY,EACZC,aAAa,EACbC,kBAAkB,QACZ,mBAAmB;;AAE1B;AACA;AACA;AACA,SAASC,iBAAiB,QAAQ,qBAAqB;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAAEC,KAAK,EAAEC,MAAM,EAAG;EACnD,IAAIC,OAAO,GAAGD,MAAM;EACpB,MAAME,gBAAgB,GAAGH,KAAK,CAACI,aAAa,CAACC,OAAO,CACnD,4BACD,CAAC;EAED,IAAKF,gBAAgB,EAAG;IACvBD,OAAO,GAAGR,WAAW,CACpBS,gBAAgB,EAChBG,IAAI,CAACC,KAAK,CACTP,KAAK,CAACI,aAAa,CAACC,OAAO,CAC1B,kCACD,CACD,CAAC,EACDH,OACD,CAAC;EACF;EAEA,MAAMM,UAAU,GAAGf,SAAS,CAAES,OAAQ,CAAC;EAEvCF,KAAK,CAACI,aAAa,CAACK,OAAO,CAAE,YAAY,EAAEC,WAAW,CAAEF,UAAW,CAAE,CAAC;EACtER,K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S,CAACgB,OAAO,CAAE,QAAQ,EAAE,MAAO,CAAC;AAC7C"}
1
+ {"version":3,"names":["__unstableStripHTML","stripHTML","serialize","createBlock","pasteHandler","findTransform","getBlockTransforms","store","blocksStore","getPasteEventData","blockEditorStore","requiresWrapperOnCopy","Symbol","setClipboardBlocks","event","blocks","registry","_blocks","firstBlock","firstBlockType","select","getBlockType","name","getBlockRootClientId","getBlockName","getBlockAttributes","wrapperBlockClientId","clientId","wrapperBlockName","serialized","clipboardData","setData","toPlainText","getPasteBlocks","canUserUseUnfilteredHTML","plainText","html","files","length","fromTransforms","reduce","accumulator","file","transformation","transform","type","isMatch","push","flat","HTML","mode","replace","trim"],"sources":["@wordpress/block-editor/src/components/writing-flow/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport {\n\tserialize,\n\tcreateBlock,\n\tpasteHandler,\n\tfindTransform,\n\tgetBlockTransforms,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { getPasteEventData } from '../../utils/pasting';\nimport { store as blockEditorStore } from '../../store';\n\nexport const requiresWrapperOnCopy = Symbol( 'requiresWrapperOnCopy' );\n\n/**\n * Sets the clipboard data for the provided blocks, with both HTML and plain\n * text representations.\n *\n * @param {ClipboardEvent} event Clipboard event.\n * @param {WPBlock[]} blocks Blocks to set as clipboard data.\n * @param {Object} registry The registry to select from.\n */\nexport function setClipboardBlocks( event, blocks, registry ) {\n\tlet _blocks = blocks;\n\n\tconst [ firstBlock ] = blocks;\n\n\tif ( firstBlock ) {\n\t\tconst firstBlockType = registry\n\t\t\t.select( blocksStore )\n\t\t\t.getBlockType( firstBlock.name );\n\n\t\tif ( firstBlockType[ requiresWrapperOnCopy ] ) {\n\t\t\tconst { getBlockRootClientId, getBlockName, getBlockAttributes } =\n\t\t\t\tregistry.select( blockEditorStore );\n\t\t\tconst wrapperBlockClientId = getBlockRootClientId(\n\t\t\t\tfirstBlock.clientId\n\t\t\t);\n\t\t\tconst wrapperBlockName = getBlockName( wrapperBlockClientId );\n\n\t\t\tif ( wrapperBlockName ) {\n\t\t\t\t_blocks = createBlock(\n\t\t\t\t\twrapperBlockName,\n\t\t\t\t\tgetBlockAttributes( wrapperBlockClientId ),\n\t\t\t\t\t_blocks\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst serialized = serialize( _blocks );\n\n\tevent.clipboardData.setData( 'text/plain', toPlainText( serialized ) );\n\tevent.clipboardData.setData( 'text/html', serialized );\n}\n\n/**\n * Returns the blocks to be pasted from the clipboard event.\n *\n * @param {ClipboardEvent} event The clipboard event.\n * @param {boolean} canUserUseUnfilteredHTML Whether the user can or can't post unfiltered HTML.\n * @return {Array|string} A list of blocks or a string, depending on `handlerMode`.\n */\nexport function getPasteBlocks( event, canUserUseUnfilteredHTML ) {\n\tconst { plainText, html, files } = getPasteEventData( event );\n\tlet blocks = [];\n\n\tif ( files.length ) {\n\t\tconst fromTransforms = getBlockTransforms( 'from' );\n\t\tblocks = files\n\t\t\t.reduce( ( accumulator, file ) => {\n\t\t\t\tconst transformation = findTransform(\n\t\t\t\t\tfromTransforms,\n\t\t\t\t\t( transform ) =>\n\t\t\t\t\t\ttransform.type === 'files' &&\n\t\t\t\t\t\ttransform.isMatch( [ file ] )\n\t\t\t\t);\n\t\t\t\tif ( transformation ) {\n\t\t\t\t\taccumulator.push( transformation.transform( [ file ] ) );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, [] )\n\t\t\t.flat();\n\t} else {\n\t\tblocks = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t\tmode: 'BLOCKS',\n\t\t\tcanUserUseUnfilteredHTML,\n\t\t} );\n\t}\n\n\treturn blocks;\n}\n\n/**\n * Given a string of HTML representing serialized blocks, returns the plain\n * text extracted after stripping the HTML of any tags and fixing line breaks.\n *\n * @param {string} html Serialized blocks.\n * @return {string} The plain-text content with any html removed.\n */\nfunction toPlainText( html ) {\n\t// Manually handle BR tags as line breaks prior to `stripHTML` call\n\thtml = html.replace( /<br>/g, '\\n' );\n\n\tconst plainText = stripHTML( html ).trim();\n\n\t// Merge any consecutive line breaks\n\treturn plainText.replace( /\\n\\n+/g, '\\n\\n' );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,mBAAmB,IAAIC,SAAS,QAAQ,gBAAgB;AACjE,SACCC,SAAS,EACTC,WAAW,EACXC,YAAY,EACZC,aAAa,EACbC,kBAAkB,EAClBC,KAAK,IAAIC,WAAW,QACd,mBAAmB;;AAE1B;AACA;AACA;AACA,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASF,KAAK,IAAIG,gBAAgB,QAAQ,aAAa;AAEvD,OAAO,MAAMC,qBAAqB,GAAGC,MAAM,CAAE,uBAAwB,CAAC;;AAEtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAAEC,KAAK,EAAEC,MAAM,EAAEC,QAAQ,EAAG;EAC7D,IAAIC,OAAO,GAAGF,MAAM;EAEpB,MAAM,CAAEG,UAAU,CAAE,GAAGH,MAAM;EAE7B,IAAKG,UAAU,EAAG;IACjB,MAAMC,cAAc,GAAGH,QAAQ,CAC7BI,MAAM,CAAEZ,WAAY,CAAC,CACrBa,YAAY,CAAEH,UAAU,CAACI,IAAK,CAAC;IAEjC,IAAKH,cAAc,CAAER,qBAAqB,CAAE,EAAG;MAC9C,MAAM;QAAEY,oBAAoB;QAAEC,YAAY;QAAEC;MAAmB,CAAC,GAC/DT,QAAQ,CAACI,MAAM,CAAEV,gBAAiB,CAAC;MACpC,MAAMgB,oBAAoB,GAAGH,oBAAoB,CAChDL,UAAU,CAACS,QACZ,CAAC;MACD,MAAMC,gBAAgB,GAAGJ,YAAY,CAAEE,oBAAqB,CAAC;MAE7D,IAAKE,gBAAgB,EAAG;QACvBX,OAAO,GAAGd,WAAW,CACpByB,gBAAgB,EAChBH,kBAA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;AACA,SAASiB,WAAWA,CAAEI,IAAI,EAAG;EAC5B;EACAA,IAAI,GAAGA,IAAI,CAACe,OAAO,CAAE,OAAO,EAAE,IAAK,CAAC;EAEpC,MAAMhB,SAAS,GAAGlC,SAAS,CAAEmC,IAAK,CAAC,CAACgB,IAAI,CAAC,CAAC;;EAE1C;EACA,OAAOjB,SAAS,CAACgB,OAAO,CAAE,QAAQ,EAAE,MAAO,CAAC;AAC7C"}
@@ -3,7 +3,7 @@ import { createElement, Fragment } from "react";
3
3
  * WordPress dependencies
4
4
  */
5
5
  import { addFilter } from '@wordpress/hooks';
6
- import { PanelBody, TextControl, ExternalLink } from '@wordpress/components';
6
+ import { TextControl, ExternalLink } from '@wordpress/components';
7
7
  import { __ } from '@wordpress/i18n';
8
8
  import { hasBlockSupport } from '@wordpress/blocks';
9
9
  import { Platform } from '@wordpress/element';
@@ -51,13 +51,17 @@ export function addAttribute(settings) {
51
51
  return settings;
52
52
  }
53
53
  function BlockEditAnchorControlPure({
54
- name: blockName,
55
54
  anchor,
56
55
  setAttributes
57
56
  }) {
58
57
  const blockEditingMode = useBlockEditingMode();
58
+ if (blockEditingMode !== 'default') {
59
+ return null;
60
+ }
59
61
  const isWeb = Platform.OS === 'web';
60
- const textControl = createElement(TextControl, {
62
+ return createElement(InspectorControls, {
63
+ group: "advanced"
64
+ }, createElement(TextControl, {
61
65
  __nextHasNoMarginBottom: true,
62
66
  __next40pxDefaultSize: true,
63
67
  className: "html-anchor-control",
@@ -75,12 +79,7 @@ function BlockEditAnchorControlPure({
75
79
  },
76
80
  autoCapitalize: "none",
77
81
  autoComplete: "off"
78
- });
79
- return createElement(Fragment, null, isWeb && blockEditingMode === 'default' && createElement(InspectorControls, {
80
- group: "advanced"
81
- }, textControl), !isWeb && blockName === 'core/heading' && createElement(InspectorControls, null, createElement(PanelBody, {
82
- title: __('Heading settings')
83
- }, textControl)));
82
+ }));
84
83
  }
85
84
  export default {
86
85
  addSaveProps,
@@ -1 +1 @@
1
- {"version":3,"names":["addFilter","PanelBody","TextControl","ExternalLink","__","hasBlockSupport","Platform","InspectorControls","useBlockEditingMode","ANCHOR_REGEX","ANCHOR_SCHEMA","type","source","attribute","selector","addAttribute","settings","_settings$attributes$","attributes","anchor","BlockEditAnchorControlPure","name","blockName","setAttributes","blockEditingMode","isWeb","OS","textControl","createElement","__nextHasNoMarginBottom","__next40pxDefaultSize","className","label","help","Fragment","href","value","placeholder","onChange","nextValue","replace","autoCapitalize","autoComplete","group","title","addSaveProps","edit","attributeKeys","hasSupport","extraProps","blockType","id"],"sources":["@wordpress/block-editor/src/hooks/anchor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { PanelBody, TextControl, ExternalLink } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { InspectorControls } from '../components';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\n/**\n * Regular expression matching invalid anchor characters for replacement.\n *\n * @type {RegExp}\n */\nconst ANCHOR_REGEX = /[\\s#]/g;\n\nconst ANCHOR_SCHEMA = {\n\ttype: 'string',\n\tsource: 'attribute',\n\tattribute: 'id',\n\tselector: '*',\n};\n\n/**\n * Filters registered block settings, extending attributes with anchor using ID\n * of the first node.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( 'type' in ( settings.attributes?.anchor ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'anchor' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tanchor: ANCHOR_SCHEMA,\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockEditAnchorControlPure( {\n\tname: blockName,\n\tanchor,\n\tsetAttributes,\n} ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst isWeb = Platform.OS === 'web';\n\tconst textControl = (\n\t\t<TextControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName=\"html-anchor-control\"\n\t\t\tlabel={ __( 'HTML anchor' ) }\n\t\t\thelp={\n\t\t\t\t<>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.'\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ isWeb && (\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-jumps/'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Learn more about anchors' ) }\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t\tvalue={ anchor || '' }\n\t\t\tplaceholder={ ! isWeb ? __( 'Add an anchor' ) : null }\n\t\t\tonChange={ ( nextValue ) => {\n\t\t\t\tnextValue = nextValue.replace( ANCHOR_REGEX, '-' );\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tanchor: nextValue,\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tautoCapitalize=\"none\"\n\t\t\tautoComplete=\"off\"\n\t\t/>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ isWeb && blockEditingMode === 'default' && (\n\t\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t\t{ textControl }\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t{ /*\n\t\t\t * We plan to remove scoping anchors to 'core/heading' to support\n\t\t\t * anchors for all eligble blocks. Additionally we plan to explore\n\t\t\t * leveraging InspectorAdvancedControls instead of a custom\n\t\t\t * PanelBody title. https://github.com/WordPress/gutenberg/issues/28363\n\t\t\t */ }\n\t\t\t{ ! isWeb && blockName === 'core/heading' && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<PanelBody title={ __( 'Heading settings' ) }>\n\t\t\t\t\t\t{ textControl }\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\taddSaveProps,\n\tedit: BlockEditAnchorControlPure,\n\tattributeKeys: [ 'anchor' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'anchor' );\n\t},\n};\n\n/**\n * Override props assigned to save component to inject anchor ID, if block\n * supports anchor. This is only applied if the block's save result is an\n * element and not a markup string.\n *\n * @param {Object} extraProps Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Current block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( extraProps, blockType, attributes ) {\n\tif ( hasBlockSupport( blockType, 'anchor' ) ) {\n\t\textraProps.id = attributes.anchor === '' ? null : attributes.anchor;\n\t}\n\n\treturn extraProps;\n}\n\naddFilter( 'blocks.registerBlockType', 'core/anchor/attribute', addAttribute );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,SAAS,EAAEC,WAAW,EAAEC,YAAY,QAAQ,uBAAuB;AAC5E,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,SAASC,iBAAiB,QAAQ,eAAe;AACjD,SAASC,mBAAmB,QAAQ,kCAAkC;;AAEtE;AACA;AACA;AACA;AACA;AACA,MAAMC,YAAY,GAAG,QAAQ;AAE7B,MAAMC,aAAa,GAAG;EACrBC,IAAI,EAAE,QAAQ;EACdC,MAAM,EAAE,WAAW;EACnBC,SAAS,EAAE,IAAI;EACfC,QAAQ,EAAE;AACX,CAAC;;AAED;AACA;AACA;AACA;AACA;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dJ,MAAM,EAAEoB;MACT,CAAE,CAAC;IACJ,CAAG;IACHE,cAAc,EAAC,MAAM;IACrBC,YAAY,EAAC;EAAK,CAClB,CACD;EAED,OACCd,aAAA,CAAAM,QAAA,QACGT,KAAK,IAAID,gBAAgB,KAAK,SAAS,IACxCI,aAAA,CAACrB,iBAAiB;IAACoC,KAAK,EAAC;EAAU,GAChChB,WACgB,CACnB,EAOC,CAAEF,KAAK,IAAIH,SAAS,KAAK,cAAc,IACxCM,aAAA,CAACrB,iBAAiB,QACjBqB,aAAA,CAAC3B,SAAS;IAAC2C,KAAK,EAAGxC,EAAE,CAAE,kBAAmB;EAAG,GAC1CuB,WACQ,CACO,CAEnB,CAAC;AAEL;AAEA,eAAe;EACdkB,YAAY;EACZC,IAAI,EAAE1B,0BAA0B;EAChC2B,aAAa,EAAE,CAAE,QAAQ,CAAE;EAC3BC,UAAUA,CAAE3B,IAAI,EAAG;IAClB,OAAOhB,eAAe,CAAEgB,IAAI,EAAE,QAAS,CAAC;EACzC;AACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASwB,YAAYA,CAAEI,UAAU,EAAEC,SAAS,EAAEhC,UAAU,EAAG;EACjE,IAAKb,eAAe,CAAE6C,SAAS,EAAE,QAAS,CAAC,EAAG;IAC7CD,UAAU,CAACE,EAAE,GAAGjC,UAAU,CAACC,MAAM,KAAK,EAAE,GAAG,IAAI,GAAGD,UAAU,CAACC,MAAM;EACpE;EAEA,OAAO8B,UAAU;AAClB;AAEAjD,SAAS,CAAE,0BAA0B,EAAE,uBAAuB,EAAEe,YAAa,CAAC"}
1
+ {"version":3,"names":["addFilter","TextControl","ExternalLink","__","hasBlockSupport","Platform","InspectorControls","useBlockEditingMode","ANCHOR_REGEX","ANCHOR_SCHEMA","type","source","attribute","selector","addAttribute","settings","_settings$attributes$","attributes","anchor","BlockEditAnchorControlPure","setAttributes","blockEditingMode","isWeb","OS","createElement","group","__nextHasNoMarginBottom","__next40pxDefaultSize","className","label","help","Fragment","href","value","placeholder","onChange","nextValue","replace","autoCapitalize","autoComplete","addSaveProps","edit","attributeKeys","hasSupport","name","extraProps","blockType","id"],"sources":["@wordpress/block-editor/src/hooks/anchor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { TextControl, ExternalLink } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { InspectorControls } from '../components';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\n/**\n * Regular expression matching invalid anchor characters for replacement.\n *\n * @type {RegExp}\n */\nconst ANCHOR_REGEX = /[\\s#]/g;\n\nconst ANCHOR_SCHEMA = {\n\ttype: 'string',\n\tsource: 'attribute',\n\tattribute: 'id',\n\tselector: '*',\n};\n\n/**\n * Filters registered block settings, extending attributes with anchor using ID\n * of the first node.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( 'type' in ( settings.attributes?.anchor ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'anchor' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tanchor: ANCHOR_SCHEMA,\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockEditAnchorControlPure( { anchor, setAttributes } ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst isWeb = Platform.OS === 'web';\n\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tclassName=\"html-anchor-control\"\n\t\t\t\tlabel={ __( 'HTML anchor' ) }\n\t\t\t\thelp={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.'\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t{ isWeb && (\n\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-jumps/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Learn more about anchors' ) }\n\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tvalue={ anchor || '' }\n\t\t\t\tplaceholder={ ! isWeb ? __( 'Add an anchor' ) : null }\n\t\t\t\tonChange={ ( nextValue ) => {\n\t\t\t\t\tnextValue = nextValue.replace( ANCHOR_REGEX, '-' );\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tanchor: nextValue,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tautoCapitalize=\"none\"\n\t\t\t\tautoComplete=\"off\"\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\nexport default {\n\taddSaveProps,\n\tedit: BlockEditAnchorControlPure,\n\tattributeKeys: [ 'anchor' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'anchor' );\n\t},\n};\n\n/**\n * Override props assigned to save component to inject anchor ID, if block\n * supports anchor. This is only applied if the block's save result is an\n * element and not a markup string.\n *\n * @param {Object} extraProps Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Current block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( extraProps, blockType, attributes ) {\n\tif ( hasBlockSupport( blockType, 'anchor' ) ) {\n\t\textraProps.id = attributes.anchor === '' ? null : attributes.anchor;\n\t}\n\n\treturn extraProps;\n}\n\naddFilter( 'blocks.registerBlockType', 'core/anchor/attribute', addAttribute );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,WAAW,EAAEC,YAAY,QAAQ,uBAAuB;AACjE,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,SAASC,iBAAiB,QAAQ,eAAe;AACjD,SAASC,mBAAmB,QAAQ,kCAAkC;;AAEtE;AACA;AACA;AACA;AACA;AACA,MAAMC,YAAY,GAAG,QAAQ;AAE7B,MAAMC,aAAa,GAAG;EACrBC,IAAI,EAAE,QAAQ;EACdC,MAAM,EAAE,WAAW;EACnBC,SAAS,EAAE,IAAI;EACfC,QAAQ,EAAE;AACX,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAEC,QAAQ,EAAG;EAAA,IAAAC,qBAAA;EACxC;EACA,IAAK,MAAM,MAAAA,qBAAA,GAAMD,QAAQ,CAACE,UAAU,EAAEC,MAAM,cAAAF,qBAAA,cAAAA,qBAAA,GAAI,CAAC,CAAC,CAAE,EAAG;IACtD,OAAOD,QAAQ;EAChB;EACA,IAAKX,eAAe,CAAEW,QAAQ,EAAE,QAAS,CAAC,EAAG;IAC5C;IACAA,QAAQ,CAACE,UAAU,GAAG;MACrB,GAAGF,QAAQ,CAACE,UAAU;MACtBC,MAAM,EAAET;IACT,CAAC;EACF;EAEA,OAAOM,QAAQ;AAChB;AAEA,SAASI,0BAA0BA,CAAE;EAAED,MAAM;EAAEE;AAAc,CAAC,EAAG;EAChE,MAAMC,gBAAgB,GAAGd,mBAAmB,CAAC,CAAC;EAE9C,IAAKc,gBAAgB,KAAK,SAAS,EAAG;IACrC,OAAO,IAAI;EACZ;EAEA,MAAMC,K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ACC,MAAM,KAAK,EAAE,GAAG,IAAI,GAAGD,UAAU,CAACC,MAAM;EACpE;EAEA,OAAO2B,UAAU;AAClB;AAEA7C,SAAS,CAAE,0BAA0B,EAAE,uBAAuB,EAAEc,YAAa,CAAC"}
@@ -73,6 +73,38 @@ export function hasBackgroundSupport(blockName, feature = 'any') {
73
73
  }
74
74
  return !!support?.[feature];
75
75
  }
76
+ function useBlockProps({
77
+ name,
78
+ style
79
+ }) {
80
+ if (!hasBackgroundSupport(name) || !style?.background?.backgroundImage) {
81
+ return;
82
+ }
83
+ const backgroundImage = style?.background?.backgroundImage;
84
+ let props;
85
+
86
+ // Set block background defaults.
87
+ if (backgroundImage?.source === 'file' && !!backgroundImage?.url) {
88
+ if (!style?.background?.backgroundSize) {
89
+ props = {
90
+ style: {
91
+ backgroundSize: 'cover'
92
+ }
93
+ };
94
+ }
95
+ if ('contain' === style?.background?.backgroundSize && !style?.background?.backgroundPosition) {
96
+ props = {
97
+ style: {
98
+ backgroundPosition: 'center'
99
+ }
100
+ };
101
+ }
102
+ }
103
+ if (!props) {
104
+ return;
105
+ }
106
+ return props;
107
+ }
76
108
 
77
109
  /**
78
110
  * Resets the background image block support attributes. This can be used when disabling
@@ -339,7 +371,7 @@ function BackgroundSizePanelItem({
339
371
  // If the current value is `cover` and the repeat value is `undefined`, then
340
372
  // the toggle should be unchecked as the default state. Otherwise, the toggle
341
373
  // should reflect the current repeat value.
342
- const repeatCheckedValue = repeatValue === 'no-repeat' || currentValueForToggle === 'cover' && repeatValue === undefined ? false : true;
374
+ const repeatCheckedValue = !(repeatValue === 'no-repeat' || currentValueForToggle === 'cover' && repeatValue === undefined);
343
375
  const hasValue = hasBackgroundSizeValue(style);
344
376
  const resetAllFilter = useCallback(previousValue => {
345
377
  return {
@@ -458,4 +490,9 @@ export function BackgroundImagePanel(props) {
458
490
  ...props
459
491
  }));
460
492
  }
493
+ export default {
494
+ useBlockProps,
495
+ attributeKeys: ['style'],
496
+ hasSupport: hasBackgroundSupport
497
+ };
461
498
  //# sourceMappingURL=background.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","isBlobURL","getBlockSupport","focus","ToggleControl","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOption","ToggleGroupControlOption","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalUnitControl","UnitControl","__experimentalVStack","VStack","DropZone","FlexItem","FocalPointPicker","MenuItem","VisuallyHidden","__experimentalItemGroup","ItemGroup","__experimentalHStack","HStack","__experimentalTruncate","Truncate","useDispatch","useSelect","Platform","useCallback","useRef","__","sprintf","store","noticesStore","getFilename","InspectorControls","MediaReplaceFlow","useSettings","cleanEmptyObject","blockEditorStore","BACKGROUND_SUPPORT_KEY","IMAGE_BACKGROUND_TYPE","hasBackgroundImageValue","style","hasValue","background","backgroundImage","id","url","hasBackgroundSizeValue","backgroundPosition","undefined","backgroundSize","hasBackgroundSupport","blockName","feature","OS","support","backgroundRepeat","resetBackgroundImage","setAttributes","resetBackgroundSize","getBackgroundImageClasses","InspectorImagePreview","label","filename","imgUrl","imgLabel","createElement","as","justify","className","numberOfLines","BackgroundImagePanelItem","clientId","isShownByDefault","mediaUpload","select","getBlockAttributes","getSettings","title","replaceContainerRef","createErrorNotice","onUploadError","message","type","onSelectMedia","media","newStyle","newAttributes","media_type","source","onFilesDrop","filesList","allowedTypes","onFileChange","image","onError","resetAllFilter","previousValue","onDeselect","panelId","ref","mediaId","mediaURL","accept","onSelect","name","variant","onClick","toggleButton","tabbable","find","current","click","backgroundSizeHelpText","value","coordsToBackgroundPosition","isNaN","x","y","backgroundPositionToCoords","split","map","v","parseFloat","BackgroundSizePanelItem","sizeValue","repeatValue","currentValueForToggle","repeatCheckedValue","updateBackgroundSize","next","nextRepeat","updateBackgroundPosition","toggleIsRepeated","spacing","__next40pxDefaultSize","onChange","size","isBlock","help","key","checked","BackgroundImagePanel","props","showBackgroundSize","defaultControls","group"],"sources":["@wordpress/block-editor/src/hooks/background.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { focus } from '@wordpress/dom';\nimport {\n\tToggleControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalVStack as VStack,\n\tDropZone,\n\tFlexItem,\n\tFocalPointPicker,\n\tMenuItem,\n\tVisuallyHidden,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Platform, useCallback, useRef } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { getFilename } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport MediaReplaceFlow from '../components/media-replace-flow';\nimport { useSettings } from '../components/use-settings';\nimport { cleanEmptyObject } from './utils';\nimport { store as blockEditorStore } from '../store';\n\nexport const BACKGROUND_SUPPORT_KEY = 'background';\nexport const IMAGE_BACKGROUND_TYPE = 'image';\n\n/**\n * Checks if there is a current value in the background image block support\n * attributes.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether or not the block has a background image value set.\n */\nexport function hasBackgroundImageValue( style ) {\n\tconst hasValue =\n\t\t!! style?.background?.backgroundImage?.id ||\n\t\t!! style?.background?.backgroundImage?.url;\n\n\treturn hasValue;\n}\n\n/**\n * Checks if there is a current value in the background size block support\n * attributes. Background size values include background size as well\n * as background position.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether or not the block has a background size value set.\n */\nexport function hasBackgroundSizeValue( style ) {\n\treturn (\n\t\tstyle?.background?.backgroundPosition !== undefined ||\n\t\tstyle?.background?.backgroundSize !== undefined\n\t);\n}\n\n/**\n * Determine whether there is block support for background.\n *\n * @param {string} blockName Block name.\n * @param {string} feature Background image feature to check for.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasBackgroundSupport( blockName, feature = 'any' ) {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst support = getBlockSupport( blockName, BACKGROUND_SUPPORT_KEY );\n\n\tif ( support === true ) {\n\t\treturn true;\n\t}\n\n\tif ( feature === 'any' ) {\n\t\treturn (\n\t\t\t!! support?.backgroundImage ||\n\t\t\t!! support?.backgroundSize ||\n\t\t\t!! support?.backgroundRepeat\n\t\t);\n\t}\n\n\treturn !! support?.[ feature ];\n}\n\n/**\n * Resets the background image block support attributes. This can be used when disabling\n * the background image controls for a block via a `ToolsPanel`.\n *\n * @param {Object} style Style attribute.\n * @param {Function} setAttributes Function to set block's attributes.\n */\nexport function resetBackgroundImage( style = {}, setAttributes ) {\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tbackground: {\n\t\t\t\t...style?.background,\n\t\t\t\tbackgroundImage: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Resets the background size block support attributes. This can be used when disabling\n * the background size controls for a block via a `ToolsPanel`.\n *\n * @param {Object} style Style attribute.\n * @param {Function} setAttributes Function to set block's attributes.\n */\nfunction resetBackgroundSize( style = {}, setAttributes ) {\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tbackground: {\n\t\t\t\t...style?.background,\n\t\t\t\tbackgroundPosition: undefined,\n\t\t\t\tbackgroundRepeat: undefined,\n\t\t\t\tbackgroundSize: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Generates a CSS class name if an background image is set.\n *\n * @param {Object} style A block's style attribute.\n *\n * @return {string} CSS class name.\n */\nexport function getBackgroundImageClasses( style ) {\n\treturn hasBackgroundImageValue( style ) ? 'has-background' : '';\n}\n\nfunction InspectorImagePreview( { label, filename, url: imgUrl } ) {\n\tconst imgLabel = label || getFilename( imgUrl );\n\treturn (\n\t\t<ItemGroup as=\"span\">\n\t\t\t<HStack justify=\"flex-start\" as=\"span\">\n\t\t\t\t<span\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'block-editor-hooks__background__inspector-image-indicator-wrapper',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'has-image': imgUrl,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\taria-hidden\n\t\t\t\t>\n\t\t\t\t\t{ imgUrl && (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName=\"block-editor-hooks__background__inspector-image-indicator\"\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tbackgroundImage: `url(${ imgUrl })`,\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</span>\n\t\t\t\t<FlexItem as=\"span\">\n\t\t\t\t\t<Truncate\n\t\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-hooks__background__inspector-media-replace-title\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ imgLabel }\n\t\t\t\t\t</Truncate>\n\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t{ filename\n\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: file name */\n\t\t\t\t\t\t\t\t\t__( 'Selected image: %s' ),\n\t\t\t\t\t\t\t\t\tfilename\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __( 'No image selected' ) }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t</ItemGroup>\n\t);\n}\n\nfunction BackgroundImagePanelItem( {\n\tclientId,\n\tisShownByDefault,\n\tsetAttributes,\n} ) {\n\tconst { style, mediaUpload } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockAttributes, getSettings } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tstyle: getBlockAttributes( clientId )?.style,\n\t\t\t\tmediaUpload: getSettings().mediaUpload,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { id, title, url } = style?.background?.backgroundImage || {};\n\n\tconst replaceContainerRef = useRef();\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t};\n\n\tconst onSelectMedia = ( media ) => {\n\t\tif ( ! media || ! media.url ) {\n\t\t\tconst newStyle = {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundImage: undefined,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst newAttributes = {\n\t\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t};\n\n\t\t\tsetAttributes( newAttributes );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// For media selections originated from a file upload.\n\t\tif (\n\t\t\t( media.media_type &&\n\t\t\t\tmedia.media_type !== IMAGE_BACKGROUND_TYPE ) ||\n\t\t\t( ! media.media_type &&\n\t\t\t\tmedia.type &&\n\t\t\t\tmedia.type !== IMAGE_BACKGROUND_TYPE )\n\t\t) {\n\t\t\tonUploadError(\n\t\t\t\t__( 'Only images can be used as a background image.' )\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tbackground: {\n\t\t\t\t...style?.background,\n\t\t\t\tbackgroundImage: {\n\t\t\t\t\turl: media.url,\n\t\t\t\t\tid: media.id,\n\t\t\t\t\tsource: 'file',\n\t\t\t\t\ttitle: media.title || undefined,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\n\t\tconst newAttributes = {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t};\n\n\t\tsetAttributes( newAttributes );\n\t};\n\n\tconst onFilesDrop = ( filesList ) => {\n\t\tmediaUpload( {\n\t\t\tallowedTypes: [ 'image' ],\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tonSelectMedia( image );\n\t\t\t},\n\t\t\tonError: onUploadError,\n\t\t} );\n\t};\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tstyle: {\n\t\t\t\t...previousValue.style,\n\t\t\t\tbackground: undefined,\n\t\t\t},\n\t\t};\n\t}, [] );\n\n\tconst hasValue = hasBackgroundImageValue( style );\n\n\treturn (\n\t\t<ToolsPanelItem\n\t\t\tclassName=\"single-column\"\n\t\t\thasValue={ () => hasValue }\n\t\t\tlabel={ __( 'Background image' ) }\n\t\t\tonDeselect={ () => resetBackgroundImage( style, setAttributes ) }\n\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tpanelId={ clientId }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"block-editor-hooks__background__inspector-media-replace-container\"\n\t\t\t\tref={ replaceContainerRef }\n\t\t\t>\n\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tmediaURL={ url }\n\t\t\t\t\tallowedTypes={ [ IMAGE_BACKGROUND_TYPE ] }\n\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\t\tname={\n\t\t\t\t\t\t<InspectorImagePreview\n\t\t\t\t\t\t\tlabel={ __( 'Background image' ) }\n\t\t\t\t\t\t\tfilename={ title }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t>\n\t\t\t\t\t{ hasValue && (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tconst [ toggleButton ] = focus.tabbable.find(\n\t\t\t\t\t\t\t\t\treplaceContainerRef.current\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t// Focus the toggle button and close the dropdown menu.\n\t\t\t\t\t\t\t\t// This ensures similar behaviour as to selecting an image, where the dropdown is\n\t\t\t\t\t\t\t\t// closed and focus is redirected to the dropdown toggle button.\n\t\t\t\t\t\t\t\ttoggleButton?.focus();\n\t\t\t\t\t\t\t\ttoggleButton?.click();\n\t\t\t\t\t\t\t\tresetBackgroundImage( style, setAttributes );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset ' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t) }\n\t\t\t\t</MediaReplaceFlow>\n\t\t\t\t<DropZone\n\t\t\t\t\tonFilesDrop={ onFilesDrop }\n\t\t\t\t\tlabel={ __( 'Drop to upload' ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</ToolsPanelItem>\n\t);\n}\n\nfunction backgroundSizeHelpText( value ) {\n\tif ( value === 'cover' || value === undefined ) {\n\t\treturn __( 'Image covers the space evenly.' );\n\t}\n\tif ( value === 'contain' ) {\n\t\treturn __( 'Image is contained without distortion.' );\n\t}\n\treturn __( 'Specify a fixed width.' );\n}\n\nexport const coordsToBackgroundPosition = ( value ) => {\n\tif ( ! value || ( isNaN( value.x ) && isNaN( value.y ) ) ) {\n\t\treturn undefined;\n\t}\n\n\tconst x = isNaN( value.x ) ? 0.5 : value.x;\n\tconst y = isNaN( value.y ) ? 0.5 : value.y;\n\n\treturn `${ x * 100 }% ${ y * 100 }%`;\n};\n\nexport const backgroundPositionToCoords = ( value ) => {\n\tif ( ! value ) {\n\t\treturn { x: undefined, y: undefined };\n\t}\n\n\tlet [ x, y ] = value.split( ' ' ).map( ( v ) => parseFloat( v ) / 100 );\n\tx = isNaN( x ) ? undefined : x;\n\ty = isNaN( y ) ? x : y;\n\n\treturn { x, y };\n};\n\nfunction BackgroundSizePanelItem( {\n\tclientId,\n\tisShownByDefault,\n\tsetAttributes,\n} ) {\n\tconst style = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlockAttributes( clientId )?.style,\n\t\t[ clientId ]\n\t);\n\n\tconst sizeValue = style?.background?.backgroundSize;\n\tconst repeatValue = style?.background?.backgroundRepeat;\n\n\t// An `undefined` value is treated as `cover` by the toggle group control.\n\t// An empty string is treated as `auto` by the toggle group control. This\n\t// allows a user to select \"Size\" and then enter a custom value, with an\n\t// empty value being treated as `auto`.\n\tconst currentValueForToggle =\n\t\t( sizeValue !== undefined &&\n\t\t\tsizeValue !== 'cover' &&\n\t\t\tsizeValue !== 'contain' ) ||\n\t\tsizeValue === ''\n\t\t\t? 'auto'\n\t\t\t: sizeValue || 'cover';\n\n\t// If the current value is `cover` and the repeat value is `undefined`, then\n\t// the toggle should be unchecked as the default state. Otherwise, the toggle\n\t// should reflect the current repeat value.\n\tconst repeatCheckedValue =\n\t\trepeatValue === 'no-repeat' ||\n\t\t( currentValueForToggle === 'cover' && repeatValue === undefined )\n\t\t\t? false\n\t\t\t: true;\n\n\tconst hasValue = hasBackgroundSizeValue( style );\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tstyle: {\n\t\t\t\t...previousValue.style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...previousValue.style?.background,\n\t\t\t\t\tbackgroundRepeat: undefined,\n\t\t\t\t\tbackgroundSize: undefined,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}, [] );\n\n\tconst updateBackgroundSize = ( next ) => {\n\t\t// When switching to 'contain' toggle the repeat off.\n\t\tlet nextRepeat = repeatValue;\n\n\t\tif ( next === 'contain' ) {\n\t\t\tnextRepeat = 'no-repeat';\n\t\t}\n\n\t\tif (\n\t\t\t( currentValueForToggle === 'cover' ||\n\t\t\t\tcurrentValueForToggle === 'contain' ) &&\n\t\t\tnext === 'auto'\n\t\t) {\n\t\t\tnextRepeat = undefined;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundRepeat: nextRepeat,\n\t\t\t\t\tbackgroundSize: next,\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t};\n\n\tconst updateBackgroundPosition = ( next ) => {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundPosition: coordsToBackgroundPosition( next ),\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t};\n\n\tconst toggleIsRepeated = () => {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundRepeat:\n\t\t\t\t\t\trepeatCheckedValue === true ? 'no-repeat' : undefined,\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t};\n\n\treturn (\n\t\t<VStack\n\t\t\tas={ ToolsPanelItem }\n\t\t\tspacing={ 2 }\n\t\t\tclassName=\"single-column\"\n\t\t\thasValue={ () => hasValue }\n\t\t\tlabel={ __( 'Size' ) }\n\t\t\tonDeselect={ () => resetBackgroundSize( style, setAttributes ) }\n\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tpanelId={ clientId }\n\t\t>\n\t\t\t<FocalPointPicker\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'Position' ) }\n\t\t\t\turl={ style?.background?.backgroundImage?.url }\n\t\t\t\tvalue={ backgroundPositionToCoords(\n\t\t\t\t\tstyle?.background?.backgroundPosition\n\t\t\t\t) }\n\t\t\t\tonChange={ updateBackgroundPosition }\n\t\t\t/>\n\t\t\t<ToggleGroupControl\n\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\tlabel={ __( 'Size' ) }\n\t\t\t\tvalue={ currentValueForToggle }\n\t\t\t\tonChange={ updateBackgroundSize }\n\t\t\t\tisBlock={ true }\n\t\t\t\thelp={ backgroundSizeHelpText( sizeValue ) }\n\t\t\t>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey={ 'cover' }\n\t\t\t\t\tvalue={ 'cover' }\n\t\t\t\t\tlabel={ __( 'Cover' ) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey={ 'contain' }\n\t\t\t\t\tvalue={ 'contain' }\n\t\t\t\t\tlabel={ __( 'Contain' ) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey={ 'fixed' }\n\t\t\t\t\tvalue={ 'auto' }\n\t\t\t\t\tlabel={ __( 'Fixed' ) }\n\t\t\t\t/>\n\t\t\t</ToggleGroupControl>\n\t\t\t{ sizeValue !== undefined &&\n\t\t\tsizeValue !== 'cover' &&\n\t\t\tsizeValue !== 'contain' ? (\n\t\t\t\t<UnitControl\n\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\tonChange={ updateBackgroundSize }\n\t\t\t\t\tvalue={ sizeValue }\n\t\t\t\t/>\n\t\t\t) : null }\n\t\t\t{ currentValueForToggle !== 'cover' && (\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Repeat' ) }\n\t\t\t\t\tchecked={ repeatCheckedValue }\n\t\t\t\t\tonChange={ toggleIsRepeated }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport function BackgroundImagePanel( props ) {\n\tconst [ backgroundImage, backgroundSize ] = useSettings(\n\t\t'background.backgroundImage',\n\t\t'background.backgroundSize'\n\t);\n\n\tif (\n\t\t! backgroundImage ||\n\t\t! hasBackgroundSupport( props.name, 'backgroundImage' )\n\t) {\n\t\treturn null;\n\t}\n\n\tconst showBackgroundSize = !! (\n\t\tbackgroundSize && hasBackgroundSupport( props.name, 'backgroundSize' )\n\t);\n\n\tconst defaultControls = getBlockSupport( props.name, [\n\t\tBACKGROUND_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\treturn (\n\t\t<InspectorControls group=\"background\">\n\t\t\t<BackgroundImagePanelItem\n\t\t\t\tisShownByDefault={ defaultControls?.backgroundImage }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t\t{ showBackgroundSize && (\n\t\t\t\t<BackgroundSizePanelItem\n\t\t\t\t\tisShownByDefault={ defaultControls?.backgroundSize }\n\t\t\t\t\t{ ...props }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SACCC,aAAa,EACbC,gCAAgC,IAAIC,kBAAkB,EACtDC,sCAAsC,IAAIC,wBAAwB,EAClEC,4BAA4B,IAAIC,cAAc,EAC9CC,yBAAyB,IAAIC,WAAW,EACxCC,oBAAoB,IAAIC,MAAM,EAC9BC,QAAQ,EACRC,QAAQ,EACRC,gBAAgB,EAChBC,QAAQ,EACRC,cAAc,EACdC,uBAAuB,IAAIC,SAAS,EACpCC,oBAAoB,IAAIC,MAAM,EAC9BC,sBAAsB,IAAIC,QAAQ,QAC5B,uBAAuB;AAC9B,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,QAAQ,EAAEC,WAAW,EAAEC,MAAM,QAAQ,oBAAoB;AAClE,SAASC,EAAE,EAAEC,OAAO,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gBAAiB,CAAC,CACtE;EAED,MAAMwC,eAAe,GAAGlJ,eAAe,CAAEgJ,KAAK,CAACtC,IAAI,EAAE,CACpDnE,sBAAsB,EACtB,+BAA+B,CAC9B,CAAC;EAEH,OACC4B,aAAA,CAACjC,iBAAiB;IAACiH,KAAK,EAAC;EAAY,GACpChF,aAAA,CAACK,wBAAwB;IACxBE,gBAAgB,EAAGwE,eAAe,EAAErG,eAAiB;IAAA,GAChDmG;EAAK,CACV,CAAC,EACAC,kBAAkB,IACnB9E,aAAA,CAAC0D,uBAAuB;IACvBnD,gBAAgB,EAAGwE,eAAe,EAAE/F,cAAgB;IAAA,GAC/C6F;EAAK,CACV,CAEgB,CAAC;AAEtB"}
1
+ {"version":3,"names":["classnames","isBlobURL","getBlockSupport","focus","ToggleControl","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOption","ToggleGroupControlOption","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalUnitControl","UnitControl","__experimentalVStack","VStack","DropZone","FlexItem","FocalPointPicker","MenuItem","VisuallyHidden","__experimentalItemGroup","ItemGroup","__experimentalHStack","HStack","__experimentalTruncate","Truncate","useDispatch","useSelect","Platform","useCallback","useRef","__","sprintf","store","noticesStore","getFilename","InspectorControls","MediaReplaceFlow","useSettings","cleanEmptyObject","blockEditorStore","BACKGROUND_SUPPORT_KEY","IMAGE_BACKGROUND_TYPE","hasBackgroundImageValue","style","hasValue","background","backgroundImage","id","url","hasBackgroundSizeValue","backgroundPosition","undefined","backgroundSize","hasBackgroundSupport","blockName","feature","OS","support","backgroundRepeat","useBlockProps","name","props","source","resetBackgroundImage","setAttributes","resetBackgroundSize","getBackgroundImageClasses","InspectorImagePreview","label","filename","imgUrl","imgLabel","createElement","as","justify","className","numberOfLines","BackgroundImagePanelItem","clientId","isShownByDefault","mediaUpload","select","getBlockAttributes","getSettings","title","replaceContainerRef","createErrorNotice","onUploadError","message","type","onSelectMedia","media","newStyle","newAttributes","media_type","onFilesDrop","filesList","allowedTypes","onFileChange","image","onError","resetAllFilter","previousValue","onDeselect","panelId","ref","mediaId","mediaURL","accept","onSelect","variant","onClick","toggleButton","tabbable","find","current","click","backgroundSizeHelpText","value","coordsToBackgroundPosition","isNaN","x","y","backgroundPositionToCoords","split","map","v","parseFloat","BackgroundSizePanelItem","sizeValue","repeatValue","currentValueForToggle","repeatCheckedValue","updateBackgroundSize","next","nextRepeat","updateBackgroundPosition","toggleIsRepeated","spacing","__next40pxDefaultSize","onChange","size","isBlock","help","key","checked","BackgroundImagePanel","showBackgroundSize","defaultControls","group","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/background.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { focus } from '@wordpress/dom';\nimport {\n\tToggleControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalVStack as VStack,\n\tDropZone,\n\tFlexItem,\n\tFocalPointPicker,\n\tMenuItem,\n\tVisuallyHidden,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Platform, useCallback, useRef } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { getFilename } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport MediaReplaceFlow from '../components/media-replace-flow';\nimport { useSettings } from '../components/use-settings';\nimport { cleanEmptyObject } from './utils';\nimport { store as blockEditorStore } from '../store';\n\nexport const BACKGROUND_SUPPORT_KEY = 'background';\nexport const IMAGE_BACKGROUND_TYPE = 'image';\n\n/**\n * Checks if there is a current value in the background image block support\n * attributes.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether or not the block has a background image value set.\n */\nexport function hasBackgroundImageValue( style ) {\n\tconst hasValue =\n\t\t!! style?.background?.backgroundImage?.id ||\n\t\t!! style?.background?.backgroundImage?.url;\n\n\treturn hasValue;\n}\n\n/**\n * Checks if there is a current value in the background size block support\n * attributes. Background size values include background size as well\n * as background position.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether or not the block has a background size value set.\n */\nexport function hasBackgroundSizeValue( style ) {\n\treturn (\n\t\tstyle?.background?.backgroundPosition !== undefined ||\n\t\tstyle?.background?.backgroundSize !== undefined\n\t);\n}\n\n/**\n * Determine whether there is block support for background.\n *\n * @param {string} blockName Block name.\n * @param {string} feature Background image feature to check for.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasBackgroundSupport( blockName, feature = 'any' ) {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst support = getBlockSupport( blockName, BACKGROUND_SUPPORT_KEY );\n\n\tif ( support === true ) {\n\t\treturn true;\n\t}\n\n\tif ( feature === 'any' ) {\n\t\treturn (\n\t\t\t!! support?.backgroundImage ||\n\t\t\t!! support?.backgroundSize ||\n\t\t\t!! support?.backgroundRepeat\n\t\t);\n\t}\n\n\treturn !! support?.[ feature ];\n}\n\nfunction useBlockProps( { name, style } ) {\n\tif (\n\t\t! hasBackgroundSupport( name ) ||\n\t\t! style?.background?.backgroundImage\n\t) {\n\t\treturn;\n\t}\n\n\tconst backgroundImage = style?.background?.backgroundImage;\n\tlet props;\n\n\t// Set block background defaults.\n\tif ( backgroundImage?.source === 'file' && !! backgroundImage?.url ) {\n\t\tif ( ! style?.background?.backgroundSize ) {\n\t\t\tprops = {\n\t\t\t\tstyle: {\n\t\t\t\t\tbackgroundSize: 'cover',\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tif (\n\t\t\t'contain' === style?.background?.backgroundSize &&\n\t\t\t! style?.background?.backgroundPosition\n\t\t) {\n\t\t\tprops = {\n\t\t\t\tstyle: {\n\t\t\t\t\tbackgroundPosition: 'center',\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t}\n\n\tif ( ! props ) {\n\t\treturn;\n\t}\n\n\treturn props;\n}\n\n/**\n * Resets the background image block support attributes. This can be used when disabling\n * the background image controls for a block via a `ToolsPanel`.\n *\n * @param {Object} style Style attribute.\n * @param {Function} setAttributes Function to set block's attributes.\n */\nexport function resetBackgroundImage( style = {}, setAttributes ) {\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tbackground: {\n\t\t\t\t...style?.background,\n\t\t\t\tbackgroundImage: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Resets the background size block support attributes. This can be used when disabling\n * the background size controls for a block via a `ToolsPanel`.\n *\n * @param {Object} style Style attribute.\n * @param {Function} setAttributes Function to set block's attributes.\n */\nfunction resetBackgroundSize( style = {}, setAttributes ) {\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tbackground: {\n\t\t\t\t...style?.background,\n\t\t\t\tbackgroundPosition: undefined,\n\t\t\t\tbackgroundRepeat: undefined,\n\t\t\t\tbackgroundSize: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Generates a CSS class name if an background image is set.\n *\n * @param {Object} style A block's style attribute.\n *\n * @return {string} CSS class name.\n */\nexport function getBackgroundImageClasses( style ) {\n\treturn hasBackgroundImageValue( style ) ? 'has-background' : '';\n}\n\nfunction InspectorImagePreview( { label, filename, url: imgUrl } ) {\n\tconst imgLabel = label || getFilename( imgUrl );\n\treturn (\n\t\t<ItemGroup as=\"span\">\n\t\t\t<HStack justify=\"flex-start\" as=\"span\">\n\t\t\t\t<span\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'block-editor-hooks__background__inspector-image-indicator-wrapper',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'has-image': imgUrl,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\taria-hidden\n\t\t\t\t>\n\t\t\t\t\t{ imgUrl && (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName=\"block-editor-hooks__background__inspector-image-indicator\"\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tbackgroundImage: `url(${ imgUrl })`,\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</span>\n\t\t\t\t<FlexItem as=\"span\">\n\t\t\t\t\t<Truncate\n\t\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-hooks__background__inspector-media-replace-title\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ imgLabel }\n\t\t\t\t\t</Truncate>\n\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t{ filename\n\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: file name */\n\t\t\t\t\t\t\t\t\t__( 'Selected image: %s' ),\n\t\t\t\t\t\t\t\t\tfilename\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __( 'No image selected' ) }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t</ItemGroup>\n\t);\n}\n\nfunction BackgroundImagePanelItem( {\n\tclientId,\n\tisShownByDefault,\n\tsetAttributes,\n} ) {\n\tconst { style, mediaUpload } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockAttributes, getSettings } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tstyle: getBlockAttributes( clientId )?.style,\n\t\t\t\tmediaUpload: getSettings().mediaUpload,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { id, title, url } = style?.background?.backgroundImage || {};\n\n\tconst replaceContainerRef = useRef();\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t};\n\n\tconst onSelectMedia = ( media ) => {\n\t\tif ( ! media || ! media.url ) {\n\t\t\tconst newStyle = {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundImage: undefined,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst newAttributes = {\n\t\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t};\n\n\t\t\tsetAttributes( newAttributes );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// For media selections originated from a file upload.\n\t\tif (\n\t\t\t( media.media_type &&\n\t\t\t\tmedia.media_type !== IMAGE_BACKGROUND_TYPE ) ||\n\t\t\t( ! media.media_type &&\n\t\t\t\tmedia.type &&\n\t\t\t\tmedia.type !== IMAGE_BACKGROUND_TYPE )\n\t\t) {\n\t\t\tonUploadError(\n\t\t\t\t__( 'Only images can be used as a background image.' )\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tbackground: {\n\t\t\t\t...style?.background,\n\t\t\t\tbackgroundImage: {\n\t\t\t\t\turl: media.url,\n\t\t\t\t\tid: media.id,\n\t\t\t\t\tsource: 'file',\n\t\t\t\t\ttitle: media.title || undefined,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\n\t\tconst newAttributes = {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t};\n\n\t\tsetAttributes( newAttributes );\n\t};\n\n\tconst onFilesDrop = ( filesList ) => {\n\t\tmediaUpload( {\n\t\t\tallowedTypes: [ 'image' ],\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tonSelectMedia( image );\n\t\t\t},\n\t\t\tonError: onUploadError,\n\t\t} );\n\t};\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tstyle: {\n\t\t\t\t...previousValue.style,\n\t\t\t\tbackground: undefined,\n\t\t\t},\n\t\t};\n\t}, [] );\n\n\tconst hasValue = hasBackgroundImageValue( style );\n\n\treturn (\n\t\t<ToolsPanelItem\n\t\t\tclassName=\"single-column\"\n\t\t\thasValue={ () => hasValue }\n\t\t\tlabel={ __( 'Background image' ) }\n\t\t\tonDeselect={ () => resetBackgroundImage( style, setAttributes ) }\n\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tpanelId={ clientId }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"block-editor-hooks__background__inspector-media-replace-container\"\n\t\t\t\tref={ replaceContainerRef }\n\t\t\t>\n\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tmediaURL={ url }\n\t\t\t\t\tallowedTypes={ [ IMAGE_BACKGROUND_TYPE ] }\n\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\t\tname={\n\t\t\t\t\t\t<InspectorImagePreview\n\t\t\t\t\t\t\tlabel={ __( 'Background image' ) }\n\t\t\t\t\t\t\tfilename={ title }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t>\n\t\t\t\t\t{ hasValue && (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tconst [ toggleButton ] = focus.tabbable.find(\n\t\t\t\t\t\t\t\t\treplaceContainerRef.current\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t// Focus the toggle button and close the dropdown menu.\n\t\t\t\t\t\t\t\t// This ensures similar behaviour as to selecting an image, where the dropdown is\n\t\t\t\t\t\t\t\t// closed and focus is redirected to the dropdown toggle button.\n\t\t\t\t\t\t\t\ttoggleButton?.focus();\n\t\t\t\t\t\t\t\ttoggleButton?.click();\n\t\t\t\t\t\t\t\tresetBackgroundImage( style, setAttributes );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset ' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t) }\n\t\t\t\t</MediaReplaceFlow>\n\t\t\t\t<DropZone\n\t\t\t\t\tonFilesDrop={ onFilesDrop }\n\t\t\t\t\tlabel={ __( 'Drop to upload' ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</ToolsPanelItem>\n\t);\n}\n\nfunction backgroundSizeHelpText( value ) {\n\tif ( value === 'cover' || value === undefined ) {\n\t\treturn __( 'Image covers the space evenly.' );\n\t}\n\tif ( value === 'contain' ) {\n\t\treturn __( 'Image is contained without distortion.' );\n\t}\n\treturn __( 'Specify a fixed width.' );\n}\n\nexport const coordsToBackgroundPosition = ( value ) => {\n\tif ( ! value || ( isNaN( value.x ) && isNaN( value.y ) ) ) {\n\t\treturn undefined;\n\t}\n\n\tconst x = isNaN( value.x ) ? 0.5 : value.x;\n\tconst y = isNaN( value.y ) ? 0.5 : value.y;\n\n\treturn `${ x * 100 }% ${ y * 100 }%`;\n};\n\nexport const backgroundPositionToCoords = ( value ) => {\n\tif ( ! value ) {\n\t\treturn { x: undefined, y: undefined };\n\t}\n\n\tlet [ x, y ] = value.split( ' ' ).map( ( v ) => parseFloat( v ) / 100 );\n\tx = isNaN( x ) ? undefined : x;\n\ty = isNaN( y ) ? x : y;\n\n\treturn { x, y };\n};\n\nfunction BackgroundSizePanelItem( {\n\tclientId,\n\tisShownByDefault,\n\tsetAttributes,\n} ) {\n\tconst style = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlockAttributes( clientId )?.style,\n\t\t[ clientId ]\n\t);\n\n\tconst sizeValue = style?.background?.backgroundSize;\n\tconst repeatValue = style?.background?.backgroundRepeat;\n\n\t// An `undefined` value is treated as `cover` by the toggle group control.\n\t// An empty string is treated as `auto` by the toggle group control. This\n\t// allows a user to select \"Size\" and then enter a custom value, with an\n\t// empty value being treated as `auto`.\n\tconst currentValueForToggle =\n\t\t( sizeValue !== undefined &&\n\t\t\tsizeValue !== 'cover' &&\n\t\t\tsizeValue !== 'contain' ) ||\n\t\tsizeValue === ''\n\t\t\t? 'auto'\n\t\t\t: sizeValue || 'cover';\n\n\t// If the current value is `cover` and the repeat value is `undefined`, then\n\t// the toggle should be unchecked as the default state. Otherwise, the toggle\n\t// should reflect the current repeat value.\n\tconst repeatCheckedValue = ! (\n\t\trepeatValue === 'no-repeat' ||\n\t\t( currentValueForToggle === 'cover' && repeatValue === undefined )\n\t);\n\n\tconst hasValue = hasBackgroundSizeValue( style );\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tstyle: {\n\t\t\t\t...previousValue.style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...previousValue.style?.background,\n\t\t\t\t\tbackgroundRepeat: undefined,\n\t\t\t\t\tbackgroundSize: undefined,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}, [] );\n\n\tconst updateBackgroundSize = ( next ) => {\n\t\t// When switching to 'contain' toggle the repeat off.\n\t\tlet nextRepeat = repeatValue;\n\n\t\tif ( next === 'contain' ) {\n\t\t\tnextRepeat = 'no-repeat';\n\t\t}\n\n\t\tif (\n\t\t\t( currentValueForToggle === 'cover' ||\n\t\t\t\tcurrentValueForToggle === 'contain' ) &&\n\t\t\tnext === 'auto'\n\t\t) {\n\t\t\tnextRepeat = undefined;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundRepeat: nextRepeat,\n\t\t\t\t\tbackgroundSize: next,\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t};\n\n\tconst updateBackgroundPosition = ( next ) => {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundPosition: coordsToBackgroundPosition( next ),\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t};\n\n\tconst toggleIsRepeated = () => {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundRepeat:\n\t\t\t\t\t\trepeatCheckedValue === true ? 'no-repeat' : undefined,\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t};\n\n\treturn (\n\t\t<VStack\n\t\t\tas={ ToolsPanelItem }\n\t\t\tspacing={ 2 }\n\t\t\tclassName=\"single-column\"\n\t\t\thasValue={ () => hasValue }\n\t\t\tlabel={ __( 'Size' ) }\n\t\t\tonDeselect={ () => resetBackgroundSize( style, setAttributes ) }\n\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tpanelId={ clientId }\n\t\t>\n\t\t\t<FocalPointPicker\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'Position' ) }\n\t\t\t\turl={ style?.background?.backgroundImage?.url }\n\t\t\t\tvalue={ backgroundPositionToCoords(\n\t\t\t\t\tstyle?.background?.backgroundPosition\n\t\t\t\t) }\n\t\t\t\tonChange={ updateBackgroundPosition }\n\t\t\t/>\n\t\t\t<ToggleGroupControl\n\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\tlabel={ __( 'Size' ) }\n\t\t\t\tvalue={ currentValueForToggle }\n\t\t\t\tonChange={ updateBackgroundSize }\n\t\t\t\tisBlock\n\t\t\t\thelp={ backgroundSizeHelpText( sizeValue ) }\n\t\t\t>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey={ 'cover' }\n\t\t\t\t\tvalue={ 'cover' }\n\t\t\t\t\tlabel={ __( 'Cover' ) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey={ 'contain' }\n\t\t\t\t\tvalue={ 'contain' }\n\t\t\t\t\tlabel={ __( 'Contain' ) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey={ 'fixed' }\n\t\t\t\t\tvalue={ 'auto' }\n\t\t\t\t\tlabel={ __( 'Fixed' ) }\n\t\t\t\t/>\n\t\t\t</ToggleGroupControl>\n\t\t\t{ sizeValue !== undefined &&\n\t\t\tsizeValue !== 'cover' &&\n\t\t\tsizeValue !== 'contain' ? (\n\t\t\t\t<UnitControl\n\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\tonChange={ updateBackgroundSize }\n\t\t\t\t\tvalue={ sizeValue }\n\t\t\t\t/>\n\t\t\t) : null }\n\t\t\t{ currentValueForToggle !== 'cover' && (\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Repeat' ) }\n\t\t\t\t\tchecked={ repeatCheckedValue }\n\t\t\t\t\tonChange={ toggleIsRepeated }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport function BackgroundImagePanel( props ) {\n\tconst [ backgroundImage, backgroundSize ] = useSettings(\n\t\t'background.backgroundImage',\n\t\t'background.backgroundSize'\n\t);\n\n\tif (\n\t\t! backgroundImage ||\n\t\t! hasBackgroundSupport( props.name, 'backgroundImage' )\n\t) {\n\t\treturn null;\n\t}\n\n\tconst showBackgroundSize = !! (\n\t\tbackgroundSize && hasBackgroundSupport( props.name, 'backgroundSize' )\n\t);\n\n\tconst defaultControls = getBlockSupport( props.name, [\n\t\tBACKGROUND_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\treturn (\n\t\t<InspectorControls group=\"background\">\n\t\t\t<BackgroundImagePanelItem\n\t\t\t\tisShownByDefault={ defaultControls?.backgroundImage }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t\t{ showBackgroundSize && (\n\t\t\t\t<BackgroundSizePanelItem\n\t\t\t\t\tisShownByDefault={ defaultControls?.backgroundSize }\n\t\t\t\t\t{ ...props }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n}\n\nexport default {\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport: hasBackgroundSupport,\n};\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SACCC,aAAa,EACbC,gCAAgC,IAAIC,kBAAkB,EACtDC,sCAAsC,IAAIC,wBAAwB,EAClEC,4BAA4B,IAAIC,cAAc,EAC9CC,yBAAyB,IAAIC,WAAW,EACxCC,oBAAoB,IAAIC,MAAM,EAC9BC,QAAQ,EACRC,QAAQ,EACRC,gBAAgB,EAChBC,QAAQ,EACRC,cAAc,EACdC,uBAAuB,IAAIC,SAAS,EACpCC,oBAAoB,IAAIC,MAAM,EAC9BC,sBAAsB,IAAIC,QAAQ,QAC5B,uBAAuB;AAC9B,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,QAAQ,EAAEC,WAAW,EAAEC,MAAM,QAAQ,oBAAoB;AAClE,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,KAAK,IAAIC,YAAY,QAAQ,oBAAoB;AAC1D,SAASC,WAAW,QAAQ,gBAAgB;;AAE5C;AACA;AACA;AACA,OAAOC,iBAAiB,MAAM,kCAAkC;AAChE,OAAOC,gBAAgB,MAAM,kCAAkC;AAC/D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