@wordpress/block-editor 14.6.0 → 14.7.1-next.082ed6819.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 (332) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-controls/slot.js +6 -3
  3. package/build/components/block-controls/slot.js.map +1 -1
  4. package/build/components/block-inspector/index.js +1 -2
  5. package/build/components/block-inspector/index.js.map +1 -1
  6. package/build/components/block-list/block.js +14 -28
  7. package/build/components/block-list/block.js.map +1 -1
  8. package/build/components/block-lock/modal.js +1 -1
  9. package/build/components/block-lock/modal.js.map +1 -1
  10. package/build/components/block-manager/category.js +79 -0
  11. package/build/components/block-manager/category.js.map +1 -0
  12. package/build/components/block-manager/checklist.js +40 -0
  13. package/build/components/block-manager/checklist.js.map +1 -0
  14. package/build/components/block-manager/index.js +108 -0
  15. package/build/components/block-manager/index.js.map +1 -0
  16. package/build/components/block-patterns-list/index.js +23 -26
  17. package/build/components/block-patterns-list/index.js.map +1 -1
  18. package/build/components/block-popover/index.js +1 -1
  19. package/build/components/block-popover/index.js.map +1 -1
  20. package/build/components/block-preview/async.js +51 -0
  21. package/build/components/block-preview/async.js.map +1 -0
  22. package/build/components/block-preview/index.js +4 -1
  23. package/build/components/block-preview/index.js.map +1 -1
  24. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  25. package/build/components/block-settings-menu/index.js.map +1 -1
  26. package/build/components/block-toolbar/change-design.js +1 -4
  27. package/build/components/block-toolbar/change-design.js.map +1 -1
  28. package/build/components/block-toolbar/index.js +7 -2
  29. package/build/components/block-toolbar/index.js.map +1 -1
  30. package/build/components/block-toolbar/switch-section-style.js +105 -0
  31. package/build/components/block-toolbar/switch-section-style.js.map +1 -0
  32. package/build/components/block-tools/index.js +12 -9
  33. package/build/components/block-tools/index.js.map +1 -1
  34. package/build/components/block-tools/use-block-toolbar-popover-props.js +1 -1
  35. package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  36. package/build/components/block-tools/use-show-block-tools.js +4 -1
  37. package/build/components/block-tools/use-show-block-tools.js.map +1 -1
  38. package/build/components/collab/block-comment-icon-slot.js +2 -6
  39. package/build/components/collab/block-comment-icon-slot.js.map +1 -1
  40. package/build/components/collab/block-comment-icon-toolbar-slot.js +2 -6
  41. package/build/components/collab/block-comment-icon-toolbar-slot.js.map +1 -1
  42. package/build/components/color-palette/with-color-context.js +4 -2
  43. package/build/components/color-palette/with-color-context.js.map +1 -1
  44. package/build/components/font-family/index.js +14 -13
  45. package/build/components/font-family/index.js.map +1 -1
  46. package/build/components/global-styles/dimensions-panel.js +26 -14
  47. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  48. package/build/components/global-styles/use-global-styles-output.js +1 -1
  49. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  50. package/build/components/iframe/get-compatibility-styles.js +4 -4
  51. package/build/components/iframe/get-compatibility-styles.js.map +1 -1
  52. package/build/components/iframe/index.js +156 -23
  53. package/build/components/iframe/index.js.map +1 -1
  54. package/build/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  55. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  56. package/build/components/inserter/block-patterns-tab/index.js +1 -2
  57. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  58. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -6
  59. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  60. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +3 -0
  61. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  62. package/build/components/inserter/block-patterns-tab/utils.js +5 -1
  63. package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
  64. package/build/components/inserter/category-tabs/index.js +7 -8
  65. package/build/components/inserter/category-tabs/index.js.map +1 -1
  66. package/build/components/inserter/hooks/use-block-types-state.js +1 -1
  67. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  68. package/build/components/inserter/hooks/use-patterns-paging.js +0 -5
  69. package/build/components/inserter/hooks/use-patterns-paging.js.map +1 -1
  70. package/build/components/inserter/search-results.js +0 -2
  71. package/build/components/inserter/search-results.js.map +1 -1
  72. package/build/components/inserter-draggable-blocks/index.js +2 -1
  73. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  74. package/build/components/inspector-controls/slot.js +7 -4
  75. package/build/components/inspector-controls/slot.js.map +1 -1
  76. package/build/components/inspector-controls-tabs/position-controls-panel.js +1 -1
  77. package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
  78. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +4 -4
  79. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  80. package/build/components/media-placeholder/index.js +33 -25
  81. package/build/components/media-placeholder/index.js.map +1 -1
  82. package/build/components/rich-text/index.js +1 -1
  83. package/build/components/rich-text/index.js.map +1 -1
  84. package/build/components/tabbed-sidebar/index.js +1 -1
  85. package/build/components/tabbed-sidebar/index.js.map +1 -1
  86. package/build/components/url-input/index.js +3 -1
  87. package/build/components/url-input/index.js.map +1 -1
  88. package/build/components/use-block-commands/index.js +5 -6
  89. package/build/components/use-block-commands/index.js.map +1 -1
  90. package/build/hooks/border.js +3 -3
  91. package/build/hooks/border.js.map +1 -1
  92. package/build/hooks/color.js +1 -1
  93. package/build/hooks/color.js.map +1 -1
  94. package/build/hooks/dimensions.js +2 -2
  95. package/build/hooks/dimensions.js.map +1 -1
  96. package/build/hooks/font-family.js +1 -1
  97. package/build/hooks/font-family.js.map +1 -1
  98. package/build/hooks/style.js +6 -6
  99. package/build/hooks/style.js.map +1 -1
  100. package/build/hooks/supports.js +7 -7
  101. package/build/hooks/supports.js.map +1 -1
  102. package/build/hooks/typography.js +6 -6
  103. package/build/hooks/typography.js.map +1 -1
  104. package/build/hooks/utils.js +3 -3
  105. package/build/hooks/utils.js.map +1 -1
  106. package/build/layouts/flex.js +11 -9
  107. package/build/layouts/flex.js.map +1 -1
  108. package/build/lock-unlock.js.map +1 -1
  109. package/build/private-apis.js +4 -4
  110. package/build/private-apis.js.map +1 -1
  111. package/build/store/private-selectors.js +3 -3
  112. package/build/store/private-selectors.js.map +1 -1
  113. package/build/store/selectors.js +12 -8
  114. package/build/store/selectors.js.map +1 -1
  115. package/build/store/utils.js +5 -4
  116. package/build/store/utils.js.map +1 -1
  117. package/build/utils/dom.js +27 -22
  118. package/build/utils/dom.js.map +1 -1
  119. package/build-module/components/block-controls/slot.js +6 -3
  120. package/build-module/components/block-controls/slot.js.map +1 -1
  121. package/build-module/components/block-inspector/index.js +1 -2
  122. package/build-module/components/block-inspector/index.js.map +1 -1
  123. package/build-module/components/block-list/block.js +15 -27
  124. package/build-module/components/block-list/block.js.map +1 -1
  125. package/build-module/components/block-lock/modal.js +1 -1
  126. package/build-module/components/block-lock/modal.js.map +1 -1
  127. package/build-module/components/block-manager/category.js +71 -0
  128. package/build-module/components/block-manager/category.js.map +1 -0
  129. package/build-module/components/block-manager/checklist.js +32 -0
  130. package/build-module/components/block-manager/checklist.js.map +1 -0
  131. package/build-module/components/block-manager/index.js +102 -0
  132. package/build-module/components/block-manager/index.js.map +1 -0
  133. package/build-module/components/block-patterns-list/index.js +23 -26
  134. package/build-module/components/block-patterns-list/index.js.map +1 -1
  135. package/build-module/components/block-popover/index.js +2 -2
  136. package/build-module/components/block-popover/index.js.map +1 -1
  137. package/build-module/components/block-preview/async.js +44 -0
  138. package/build-module/components/block-preview/async.js.map +1 -0
  139. package/build-module/components/block-preview/index.js +4 -1
  140. package/build-module/components/block-preview/index.js.map +1 -1
  141. package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -2
  142. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  143. package/build-module/components/block-settings-menu/index.js +2 -2
  144. package/build-module/components/block-settings-menu/index.js.map +1 -1
  145. package/build-module/components/block-toolbar/change-design.js +1 -4
  146. package/build-module/components/block-toolbar/change-design.js.map +1 -1
  147. package/build-module/components/block-toolbar/index.js +7 -2
  148. package/build-module/components/block-toolbar/index.js.map +1 -1
  149. package/build-module/components/block-toolbar/switch-section-style.js +97 -0
  150. package/build-module/components/block-toolbar/switch-section-style.js.map +1 -0
  151. package/build-module/components/block-tools/index.js +13 -10
  152. package/build-module/components/block-tools/index.js.map +1 -1
  153. package/build-module/components/block-tools/use-block-toolbar-popover-props.js +2 -2
  154. package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  155. package/build-module/components/block-tools/use-show-block-tools.js +4 -1
  156. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
  157. package/build-module/components/collab/block-comment-icon-slot.js +2 -6
  158. package/build-module/components/collab/block-comment-icon-slot.js.map +1 -1
  159. package/build-module/components/collab/block-comment-icon-toolbar-slot.js +2 -6
  160. package/build-module/components/collab/block-comment-icon-toolbar-slot.js.map +1 -1
  161. package/build-module/components/color-palette/with-color-context.js +4 -2
  162. package/build-module/components/color-palette/with-color-context.js.map +1 -1
  163. package/build-module/components/font-family/index.js +15 -14
  164. package/build-module/components/font-family/index.js.map +1 -1
  165. package/build-module/components/global-styles/dimensions-panel.js +26 -14
  166. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  167. package/build-module/components/global-styles/use-global-styles-output.js +1 -1
  168. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  169. package/build-module/components/iframe/get-compatibility-styles.js +4 -4
  170. package/build-module/components/iframe/get-compatibility-styles.js.map +1 -1
  171. package/build-module/components/iframe/index.js +157 -24
  172. package/build-module/components/iframe/index.js.map +1 -1
  173. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  174. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  175. package/build-module/components/inserter/block-patterns-tab/index.js +1 -2
  176. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
  177. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +5 -7
  178. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  179. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +4 -1
  180. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  181. package/build-module/components/inserter/block-patterns-tab/utils.js +4 -0
  182. package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
  183. package/build-module/components/inserter/category-tabs/index.js +8 -9
  184. package/build-module/components/inserter/category-tabs/index.js.map +1 -1
  185. package/build-module/components/inserter/hooks/use-block-types-state.js +1 -1
  186. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  187. package/build-module/components/inserter/hooks/use-patterns-paging.js +1 -6
  188. package/build-module/components/inserter/hooks/use-patterns-paging.js.map +1 -1
  189. package/build-module/components/inserter/search-results.js +0 -2
  190. package/build-module/components/inserter/search-results.js.map +1 -1
  191. package/build-module/components/inserter-draggable-blocks/index.js +2 -1
  192. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  193. package/build-module/components/inspector-controls/slot.js +7 -4
  194. package/build-module/components/inspector-controls/slot.js.map +1 -1
  195. package/build-module/components/inspector-controls-tabs/position-controls-panel.js +1 -1
  196. package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
  197. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +4 -4
  198. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  199. package/build-module/components/media-placeholder/index.js +33 -25
  200. package/build-module/components/media-placeholder/index.js.map +1 -1
  201. package/build-module/components/rich-text/index.js +1 -1
  202. package/build-module/components/rich-text/index.js.map +1 -1
  203. package/build-module/components/tabbed-sidebar/index.js +1 -1
  204. package/build-module/components/tabbed-sidebar/index.js.map +1 -1
  205. package/build-module/components/url-input/index.js +3 -1
  206. package/build-module/components/url-input/index.js.map +1 -1
  207. package/build-module/components/use-block-commands/index.js +4 -4
  208. package/build-module/components/use-block-commands/index.js.map +1 -1
  209. package/build-module/hooks/border.js +3 -3
  210. package/build-module/hooks/border.js.map +1 -1
  211. package/build-module/hooks/color.js +1 -1
  212. package/build-module/hooks/color.js.map +1 -1
  213. package/build-module/hooks/dimensions.js +2 -2
  214. package/build-module/hooks/dimensions.js.map +1 -1
  215. package/build-module/hooks/font-family.js +1 -1
  216. package/build-module/hooks/font-family.js.map +1 -1
  217. package/build-module/hooks/style.js +6 -6
  218. package/build-module/hooks/style.js.map +1 -1
  219. package/build-module/hooks/supports.js +7 -7
  220. package/build-module/hooks/supports.js.map +1 -1
  221. package/build-module/hooks/typography.js +6 -6
  222. package/build-module/hooks/typography.js.map +1 -1
  223. package/build-module/hooks/utils.js +3 -3
  224. package/build-module/hooks/utils.js.map +1 -1
  225. package/build-module/layouts/flex.js +11 -9
  226. package/build-module/layouts/flex.js.map +1 -1
  227. package/build-module/lock-unlock.js.map +1 -1
  228. package/build-module/private-apis.js +6 -6
  229. package/build-module/private-apis.js.map +1 -1
  230. package/build-module/store/private-selectors.js +3 -3
  231. package/build-module/store/private-selectors.js.map +1 -1
  232. package/build-module/store/selectors.js +12 -8
  233. package/build-module/store/selectors.js.map +1 -1
  234. package/build-module/store/utils.js +3 -3
  235. package/build-module/store/utils.js.map +1 -1
  236. package/build-module/utils/dom.js +25 -21
  237. package/build-module/utils/dom.js.map +1 -1
  238. package/build-style/content-rtl.css +30 -15
  239. package/build-style/content.css +30 -15
  240. package/build-style/style-rtl.css +92 -3
  241. package/build-style/style.css +92 -3
  242. package/build-types/utils/dom.d.ts +7 -9
  243. package/build-types/utils/dom.d.ts.map +1 -1
  244. package/package.json +32 -31
  245. package/src/components/block-canvas/style.scss +1 -1
  246. package/src/components/block-controls/slot.js +5 -3
  247. package/src/components/block-inspector/index.js +0 -2
  248. package/src/components/block-inspector/style.scss +2 -1
  249. package/src/components/block-list/block.js +28 -48
  250. package/src/components/block-lock/modal.js +1 -1
  251. package/src/components/block-manager/category.js +102 -0
  252. package/src/components/block-manager/checklist.js +34 -0
  253. package/src/components/block-manager/index.js +127 -0
  254. package/src/components/block-manager/style.scss +82 -0
  255. package/src/components/block-mover/README.md +15 -8
  256. package/src/components/block-mover/stories/index.story.js +73 -71
  257. package/src/components/block-mover/style.scss +3 -0
  258. package/src/components/block-patterns-list/README.md +8 -8
  259. package/src/components/block-patterns-list/index.js +35 -51
  260. package/src/components/block-patterns-list/stories/index.story.js +2 -19
  261. package/src/components/block-popover/index.js +4 -4
  262. package/src/components/block-preview/async.js +43 -0
  263. package/src/components/block-preview/index.js +6 -1
  264. package/src/components/block-settings-menu/block-settings-dropdown.js +2 -2
  265. package/src/components/block-settings-menu/index.js +2 -2
  266. package/src/components/block-toolbar/change-design.js +1 -7
  267. package/src/components/block-toolbar/index.js +6 -0
  268. package/src/components/block-toolbar/switch-section-style.js +115 -0
  269. package/src/components/block-tools/index.js +26 -10
  270. package/src/components/block-tools/style.scss +12 -0
  271. package/src/components/block-tools/use-block-toolbar-popover-props.js +2 -2
  272. package/src/components/block-tools/use-show-block-tools.js +3 -1
  273. package/src/components/collab/block-comment-icon-slot.js +2 -6
  274. package/src/components/collab/block-comment-icon-toolbar-slot.js +3 -5
  275. package/src/components/color-palette/with-color-context.js +25 -7
  276. package/src/components/default-block-appender/content.scss +13 -19
  277. package/src/components/font-family/index.js +13 -13
  278. package/src/components/global-styles/dimensions-panel.js +22 -16
  279. package/src/components/global-styles/test/use-global-styles-output.js +1 -1
  280. package/src/components/global-styles/use-global-styles-output.js +1 -1
  281. package/src/components/iframe/content.scss +16 -3
  282. package/src/components/iframe/get-compatibility-styles.js +4 -9
  283. package/src/components/iframe/index.js +204 -44
  284. package/src/components/inserter/block-patterns-explorer/pattern-list.js +3 -6
  285. package/src/components/inserter/block-patterns-tab/index.js +0 -1
  286. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +15 -17
  287. package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +8 -0
  288. package/src/components/inserter/block-patterns-tab/utils.js +5 -0
  289. package/src/components/inserter/category-tabs/index.js +8 -9
  290. package/src/components/inserter/hooks/use-block-types-state.js +6 -1
  291. package/src/components/inserter/hooks/use-patterns-paging.js +1 -6
  292. package/src/components/inserter/search-results.js +0 -6
  293. package/src/components/inserter-draggable-blocks/index.js +10 -1
  294. package/src/components/inspector-controls/README.md +2 -0
  295. package/src/components/inspector-controls/slot.js +6 -4
  296. package/src/components/inspector-controls-tabs/position-controls-panel.js +1 -3
  297. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +10 -10
  298. package/src/components/media-placeholder/index.js +41 -37
  299. package/src/components/provider/test/use-block-sync.js +3 -1
  300. package/src/components/rich-text/content.scss +15 -10
  301. package/src/components/rich-text/index.js +8 -1
  302. package/src/components/tabbed-sidebar/index.js +1 -1
  303. package/src/components/tabbed-sidebar/style.scss +1 -1
  304. package/src/components/url-input/index.js +3 -4
  305. package/src/components/use-block-commands/index.js +245 -234
  306. package/src/hooks/border.js +3 -9
  307. package/src/hooks/color.js +1 -1
  308. package/src/hooks/dimensions.js +2 -2
  309. package/src/hooks/font-family.js +1 -1
  310. package/src/hooks/style.js +6 -12
  311. package/src/hooks/supports.js +7 -7
  312. package/src/hooks/test/style.js +1 -2
  313. package/src/hooks/typography.js +6 -6
  314. package/src/hooks/utils.js +8 -3
  315. package/src/layouts/flex.js +26 -18
  316. package/src/private-apis.js +6 -6
  317. package/src/store/private-selectors.js +6 -7
  318. package/src/store/selectors.js +60 -45
  319. package/src/store/test/private-selectors.js +5 -0
  320. package/src/store/test/selectors.js +87 -58
  321. package/src/store/utils.js +12 -11
  322. package/src/style.scss +1 -0
  323. package/src/utils/dom.js +26 -21
  324. package/src/utils/test/dom.js +224 -0
  325. package/tsconfig.json +1 -0
  326. package/tsconfig.tsbuildinfo +1 -1
  327. package/build/components/block-info-slot-fill/index.js +0 -39
  328. package/build/components/block-info-slot-fill/index.js.map +0 -1
  329. package/build-module/components/block-info-slot-fill/index.js +0 -32
  330. package/build-module/components/block-info-slot-fill/index.js.map +0 -1
  331. package/src/components/block-info-slot-fill/index.js +0 -27
  332. /package/src/{lock-unlock.js → lock-unlock.ts} +0 -0
@@ -101,19 +101,22 @@ function BlockTools({
101
101
  if (event.defaultPrevented) {
102
102
  return;
103
103
  }
104
- if (isMatch('core/block-editor/move-up', event)) {
104
+ if (isMatch('core/block-editor/move-up', event) || isMatch('core/block-editor/move-down', event)) {
105
105
  const clientIds = getSelectedBlockClientIds();
106
106
  if (clientIds.length) {
107
107
  event.preventDefault();
108
108
  const rootClientId = getBlockRootClientId(clientIds[0]);
109
- moveBlocksUp(clientIds, rootClientId);
110
- }
111
- } else if (isMatch('core/block-editor/move-down', event)) {
112
- const clientIds = getSelectedBlockClientIds();
113
- if (clientIds.length) {
114
- event.preventDefault();
115
- const rootClientId = getBlockRootClientId(clientIds[0]);
116
- moveBlocksDown(clientIds, rootClientId);
109
+ const direction = isMatch('core/block-editor/move-up', event) ? 'up' : 'down';
110
+ if (direction === 'up') {
111
+ moveBlocksUp(clientIds, rootClientId);
112
+ } else {
113
+ moveBlocksDown(clientIds, rootClientId);
114
+ }
115
+ const blockLength = Array.isArray(clientIds) ? clientIds.length : 1;
116
+ const message = (0, _i18n.sprintf)(
117
+ // translators: %d: the name of the block that has been moved
118
+ (0, _i18n._n)('%d block moved.', '%d blocks moved.', clientIds.length), blockLength);
119
+ (0, _a11y.speak)(message);
117
120
  }
118
121
  } else if (isMatch('core/block-editor/duplicate', event)) {
119
122
  const clientIds = getSelectedBlockClientIds();
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_dom","_components","_keyboardShortcuts","_element","_blocks","_a11y","_i18n","_emptyBlockInserter","_interopRequireDefault","_insertionPoint","_interopRequireWildcard","_blockToolbarPopover","_store","_usePopoverScroll","_zoomOutModeInserters","_useShowBlockTools","_lockUnlock","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","selector","select","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getSettings","isTyping","isDragging","isZoomOut","unlock","blockEditorStore","clientId","hasFixedToolbar","isZoomOutMode","BlockTools","children","__unstableContentRef","props","useSelect","isMatch","useShortcutEventMatch","getBlocksByClientId","getSelectedBlockClientIds","getBlockRootClientId","isGroupable","getGroupingBlockName","blocksStore","showEmptyBlockSideInserter","showBlockToolbarPopover","useShowBlockTools","duplicateBlocks","removeBlocks","replaceBlocks","insertAfterBlock","insertBeforeBlock","selectBlock","moveBlocksUp","moveBlocksDown","expandBlock","useDispatch","onKeyDown","event","defaultPrevented","clientIds","length","preventDefault","rootClientId","target","closest","isTextField","contentWindow","document","activeElement","blocks","groupingBlockName","newBlocks","switchToBlockType","speak","__","blockToolbarRef","usePopoverScroll","blockToolbarAfterRef","jsx","jsxs","InsertionPointOpenRef","Provider","value","useRef","Popover","Slot","name","ref"],"sources":["@wordpress/block-editor/src/components/block-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { isTextField } from '@wordpress/dom';\nimport { Popover } from '@wordpress/components';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { useRef } from '@wordpress/element';\nimport { switchToBlockType, store as blocksStore } from '@wordpress/blocks';\nimport { speak } from '@wordpress/a11y';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport EmptyBlockInserter from './empty-block-inserter';\nimport {\n\tInsertionPointOpenRef,\n\tdefault as InsertionPoint,\n} from './insertion-point';\nimport BlockToolbarPopover from './block-toolbar-popover';\nimport { store as blockEditorStore } from '../../store';\nimport usePopoverScroll from '../block-popover/use-popover-scroll';\nimport ZoomOutModeInserters from './zoom-out-mode-inserters';\nimport { useShowBlockTools } from './use-show-block-tools';\nimport { unlock } from '../../lock-unlock';\n\nfunction selector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetSettings,\n\t\tisTyping,\n\t\tisDragging,\n\t\tisZoomOut,\n\t} = unlock( select( blockEditorStore ) );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\treturn {\n\t\tclientId,\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tisTyping: isTyping(),\n\t\tisZoomOutMode: isZoomOut(),\n\t\tisDragging: isDragging(),\n\t};\n}\n\n/**\n * Renders block tools (the block toolbar, select/navigation mode toolbar, the\n * insertion point and a slot for the inline rich text toolbar). Must be wrapped\n * around the block content and editor styles wrapper or iframe.\n *\n * @param {Object} $0 Props.\n * @param {Object} $0.children The block content and style container.\n * @param {Object} $0.__unstableContentRef Ref holding the content scroll container.\n */\nexport default function BlockTools( {\n\tchildren,\n\t__unstableContentRef,\n\t...props\n} ) {\n\tconst { clientId, hasFixedToolbar, isTyping, isZoomOutMode, isDragging } =\n\t\tuseSelect( selector, [] );\n\n\tconst isMatch = useShortcutEventMatch();\n\tconst {\n\t\tgetBlocksByClientId,\n\t\tgetSelectedBlockClientIds,\n\t\tgetBlockRootClientId,\n\t\tisGroupable,\n\t} = useSelect( blockEditorStore );\n\tconst { getGroupingBlockName } = useSelect( blocksStore );\n\tconst { showEmptyBlockSideInserter, showBlockToolbarPopover } =\n\t\tuseShowBlockTools();\n\n\tconst {\n\t\tduplicateBlocks,\n\t\tremoveBlocks,\n\t\treplaceBlocks,\n\t\tinsertAfterBlock,\n\t\tinsertBeforeBlock,\n\t\tselectBlock,\n\t\tmoveBlocksUp,\n\t\tmoveBlocksDown,\n\t\texpandBlock,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isMatch( 'core/block-editor/move-up', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tmoveBlocksUp( clientIds, rootClientId );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/move-down', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tmoveBlocksDown( clientIds, rootClientId );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/duplicate', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tduplicateBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/remove', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tremoveBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-after', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertAfterBlock( clientIds[ clientIds.length - 1 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-before', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertBeforeBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/unselect', event ) ) {\n\t\t\tif ( event.target.closest( '[role=toolbar]' ) ) {\n\t\t\t\t// This shouldn't be necessary, but we have a combination of a few things all combining to create a situation where:\n\t\t\t\t// - Because the block toolbar uses createPortal to populate the block toolbar fills, we can't rely on the React event bubbling to hit the onKeyDown listener for the block toolbar\n\t\t\t\t// - Since we can't use the React tree, we use the DOM tree which _should_ handle the event bubbling correctly from a `createPortal` element.\n\t\t\t\t// - This bubbles via the React tree, which hits this `unselect` escape keypress before the block toolbar DOM event listener has access to it.\n\t\t\t\t// An alternative would be to remove the addEventListener on the navigableToolbar and use this event to handle it directly right here. That feels hacky too though.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length > 1 ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t// If there is more than one block selected, select the first\n\t\t\t\t// block so that focus is directed back to the beginning of the selection.\n\t\t\t\t// In effect, to the user this feels like deselecting the multi-selection.\n\t\t\t\tselectBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/collapse-list-view', event ) ) {\n\t\t\t// If focus is currently within a text field, such as a rich text block or other editable field,\n\t\t\t// skip collapsing the list view, and allow the keyboard shortcut to be handled by the text field.\n\t\t\t// This condition checks for both the active element and the active element within an iframed editor.\n\t\t\tif (\n\t\t\t\tisTextField( event.target ) ||\n\t\t\t\tisTextField(\n\t\t\t\t\tevent.target?.contentWindow?.document?.activeElement\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\texpandBlock( clientId );\n\t\t} else if ( isMatch( 'core/block-editor/group', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length > 1 && isGroupable( clientIds ) ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst blocks = getBlocksByClientId( clientIds );\n\t\t\t\tconst groupingBlockName = getGroupingBlockName();\n\t\t\t\tconst newBlocks = switchToBlockType(\n\t\t\t\t\tblocks,\n\t\t\t\t\tgroupingBlockName\n\t\t\t\t);\n\t\t\t\treplaceBlocks( clientIds, newBlocks );\n\t\t\t\tspeak( __( 'Selected blocks are grouped.' ) );\n\t\t\t}\n\t\t}\n\t}\n\tconst blockToolbarRef = usePopoverScroll( __unstableContentRef );\n\tconst blockToolbarAfterRef = usePopoverScroll( __unstableContentRef );\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div { ...props } onKeyDown={ onKeyDown }>\n\t\t\t<InsertionPointOpenRef.Provider value={ useRef( false ) }>\n\t\t\t\t{ ! isTyping && ! isZoomOutMode && (\n\t\t\t\t\t<InsertionPoint\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showEmptyBlockSideInserter && (\n\t\t\t\t\t<EmptyBlockInserter\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showBlockToolbarPopover && (\n\t\t\t\t\t<BlockToolbarPopover\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisTyping={ isTyping }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ /* Used for the inline rich text toolbar. Until this toolbar is combined into BlockToolbar, someone implementing their own BlockToolbar will also need to use this to see the image caption toolbar. */ }\n\t\t\t\t{ ! isZoomOutMode && ! hasFixedToolbar && (\n\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t\t{ /* Used for inline rich text popovers. */ }\n\t\t\t\t<Popover.Slot\n\t\t\t\t\tname=\"__unstable-block-tools-after\"\n\t\t\t\t\tref={ blockToolbarAfterRef }\n\t\t\t\t/>\n\t\t\t\t{ isZoomOutMode && ! isDragging && (\n\t\t\t\t\t<ZoomOutModeInserters\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InsertionPointOpenRef.Provider>\n\t\t</div>\n\t);\n}\n"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IAAC,CAC7B;EAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_dom","_components","_keyboardShortcuts","_element","_blocks","_a11y","_i18n","_emptyBlockInserter","_interopRequireDefault","_insertionPoint","_interopRequireWildcard","_blockToolbarPopover","_store","_usePopoverScroll","_zoomOutModeInserters","_useShowBlockTools","_lockUnlock","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","selector","select","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getSettings","isTyping","isDragging","isZoomOut","unlock","blockEditorStore","clientId","hasFixedToolbar","isZoomOutMode","BlockTools","children","__unstableContentRef","props","useSelect","isMatch","useShortcutEventMatch","getBlocksByClientId","getSelectedBlockClientIds","getBlockRootClientId","isGroupable","getGroupingBlockName","blocksStore","showEmptyBlockSideInserter","showBlockToolbarPopover","useShowBlockTools","duplicateBlocks","removeBlocks","replaceBlocks","insertAfterBlock","insertBeforeBlock","selectBlock","moveBlocksUp","moveBlocksDown","expandBlock","useDispatch","onKeyDown","event","defaultPrevented","clientIds","length","preventDefault","rootClientId","direction","blockLength","Array","isArray","message","sprintf","_n","speak","target","closest","isTextField","contentWindow","document","activeElement","blocks","groupingBlockName","newBlocks","switchToBlockType","__","blockToolbarRef","usePopoverScroll","blockToolbarAfterRef","jsx","jsxs","InsertionPointOpenRef","Provider","value","useRef","Popover","Slot","name","ref"],"sources":["@wordpress/block-editor/src/components/block-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { isTextField } from '@wordpress/dom';\nimport { Popover } from '@wordpress/components';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { useRef } from '@wordpress/element';\nimport { switchToBlockType, store as blocksStore } from '@wordpress/blocks';\nimport { speak } from '@wordpress/a11y';\nimport { __, sprintf, _n } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport EmptyBlockInserter from './empty-block-inserter';\nimport {\n\tInsertionPointOpenRef,\n\tdefault as InsertionPoint,\n} from './insertion-point';\nimport BlockToolbarPopover from './block-toolbar-popover';\nimport { store as blockEditorStore } from '../../store';\nimport usePopoverScroll from '../block-popover/use-popover-scroll';\nimport ZoomOutModeInserters from './zoom-out-mode-inserters';\nimport { useShowBlockTools } from './use-show-block-tools';\nimport { unlock } from '../../lock-unlock';\n\nfunction selector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetSettings,\n\t\tisTyping,\n\t\tisDragging,\n\t\tisZoomOut,\n\t} = unlock( select( blockEditorStore ) );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\treturn {\n\t\tclientId,\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tisTyping: isTyping(),\n\t\tisZoomOutMode: isZoomOut(),\n\t\tisDragging: isDragging(),\n\t};\n}\n\n/**\n * Renders block tools (the block toolbar, select/navigation mode toolbar, the\n * insertion point and a slot for the inline rich text toolbar). Must be wrapped\n * around the block content and editor styles wrapper or iframe.\n *\n * @param {Object} $0 Props.\n * @param {Object} $0.children The block content and style container.\n * @param {Object} $0.__unstableContentRef Ref holding the content scroll container.\n */\nexport default function BlockTools( {\n\tchildren,\n\t__unstableContentRef,\n\t...props\n} ) {\n\tconst { clientId, hasFixedToolbar, isTyping, isZoomOutMode, isDragging } =\n\t\tuseSelect( selector, [] );\n\n\tconst isMatch = useShortcutEventMatch();\n\tconst {\n\t\tgetBlocksByClientId,\n\t\tgetSelectedBlockClientIds,\n\t\tgetBlockRootClientId,\n\t\tisGroupable,\n\t} = useSelect( blockEditorStore );\n\tconst { getGroupingBlockName } = useSelect( blocksStore );\n\tconst { showEmptyBlockSideInserter, showBlockToolbarPopover } =\n\t\tuseShowBlockTools();\n\n\tconst {\n\t\tduplicateBlocks,\n\t\tremoveBlocks,\n\t\treplaceBlocks,\n\t\tinsertAfterBlock,\n\t\tinsertBeforeBlock,\n\t\tselectBlock,\n\t\tmoveBlocksUp,\n\t\tmoveBlocksDown,\n\t\texpandBlock,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tisMatch( 'core/block-editor/move-up', event ) ||\n\t\t\tisMatch( 'core/block-editor/move-down', event )\n\t\t) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tconst direction = isMatch( 'core/block-editor/move-up', event )\n\t\t\t\t\t? 'up'\n\t\t\t\t\t: 'down';\n\t\t\t\tif ( direction === 'up' ) {\n\t\t\t\t\tmoveBlocksUp( clientIds, rootClientId );\n\t\t\t\t} else {\n\t\t\t\t\tmoveBlocksDown( clientIds, rootClientId );\n\t\t\t\t}\n\t\t\t\tconst blockLength = Array.isArray( clientIds )\n\t\t\t\t\t? clientIds.length\n\t\t\t\t\t: 1;\n\t\t\t\tconst message = sprintf(\n\t\t\t\t\t// translators: %d: the name of the block that has been moved\n\t\t\t\t\t_n(\n\t\t\t\t\t\t'%d block moved.',\n\t\t\t\t\t\t'%d blocks moved.',\n\t\t\t\t\t\tclientIds.length\n\t\t\t\t\t),\n\t\t\t\t\tblockLength\n\t\t\t\t);\n\t\t\t\tspeak( message );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/duplicate', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tduplicateBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/remove', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tremoveBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-after', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertAfterBlock( clientIds[ clientIds.length - 1 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-before', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertBeforeBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/unselect', event ) ) {\n\t\t\tif ( event.target.closest( '[role=toolbar]' ) ) {\n\t\t\t\t// This shouldn't be necessary, but we have a combination of a few things all combining to create a situation where:\n\t\t\t\t// - Because the block toolbar uses createPortal to populate the block toolbar fills, we can't rely on the React event bubbling to hit the onKeyDown listener for the block toolbar\n\t\t\t\t// - Since we can't use the React tree, we use the DOM tree which _should_ handle the event bubbling correctly from a `createPortal` element.\n\t\t\t\t// - This bubbles via the React tree, which hits this `unselect` escape keypress before the block toolbar DOM event listener has access to it.\n\t\t\t\t// An alternative would be to remove the addEventListener on the navigableToolbar and use this event to handle it directly right here. That feels hacky too though.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length > 1 ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t// If there is more than one block selected, select the first\n\t\t\t\t// block so that focus is directed back to the beginning of the selection.\n\t\t\t\t// In effect, to the user this feels like deselecting the multi-selection.\n\t\t\t\tselectBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/collapse-list-view', event ) ) {\n\t\t\t// If focus is currently within a text field, such as a rich text block or other editable field,\n\t\t\t// skip collapsing the list view, and allow the keyboard shortcut to be handled by the text field.\n\t\t\t// This condition checks for both the active element and the active element within an iframed editor.\n\t\t\tif (\n\t\t\t\tisTextField( event.target ) ||\n\t\t\t\tisTextField(\n\t\t\t\t\tevent.target?.contentWindow?.document?.activeElement\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\texpandBlock( clientId );\n\t\t} else if ( isMatch( 'core/block-editor/group', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length > 1 && isGroupable( clientIds ) ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst blocks = getBlocksByClientId( clientIds );\n\t\t\t\tconst groupingBlockName = getGroupingBlockName();\n\t\t\t\tconst newBlocks = switchToBlockType(\n\t\t\t\t\tblocks,\n\t\t\t\t\tgroupingBlockName\n\t\t\t\t);\n\t\t\t\treplaceBlocks( clientIds, newBlocks );\n\t\t\t\tspeak( __( 'Selected blocks are grouped.' ) );\n\t\t\t}\n\t\t}\n\t}\n\tconst blockToolbarRef = usePopoverScroll( __unstableContentRef );\n\tconst blockToolbarAfterRef = usePopoverScroll( __unstableContentRef );\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div { ...props } onKeyDown={ onKeyDown }>\n\t\t\t<InsertionPointOpenRef.Provider value={ useRef( false ) }>\n\t\t\t\t{ ! isTyping && ! isZoomOutMode && (\n\t\t\t\t\t<InsertionPoint\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showEmptyBlockSideInserter && (\n\t\t\t\t\t<EmptyBlockInserter\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showBlockToolbarPopover && (\n\t\t\t\t\t<BlockToolbarPopover\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisTyping={ isTyping }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ /* Used for the inline rich text toolbar. Until this toolbar is combined into BlockToolbar, someone implementing their own BlockToolbar will also need to use this to see the image caption toolbar. */ }\n\t\t\t\t{ ! isZoomOutMode && ! hasFixedToolbar && (\n\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t\t{ /* Used for inline rich text popovers. */ }\n\t\t\t\t<Popover.Slot\n\t\t\t\t\tname=\"__unstable-block-tools-after\"\n\t\t\t\t\tref={ blockToolbarAfterRef }\n\t\t\t\t/>\n\t\t\t\t{ isZoomOutMode && ! isDragging && (\n\t\t\t\t\t<ZoomOutModeInserters\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InsertionPointOpenRef.Provider>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AAKA,IAAAQ,mBAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,eAAA,GAAAC,uBAAA,CAAAX,OAAA;AAIA,IAAAY,oBAAA,GAAAH,sBAAA,CAAAT,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,iBAAA,GAAAL,sBAAA,CAAAT,OAAA;AACA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CAAEO,aAAa,iBAC9B,IAAAjC,WAAA,CAAAyF,GAAA,EAACjG,eAAA,CAAAe,OAAc;UACd6B,oBAAoB,EAAGA;QAAsB,CAC7C,CACD,EAECW,0BAA0B,iBAC3B,IAAA/C,WAAA,CAAAyF,GAAA,EAACnG,mBAAA,CAAAiB,OAAkB;UAClB6B,oBAAoB,EAAGA,oBAAsB;UAC7CL,QAAQ,EAAGA;QAAU,CACrB,CACD,EAECiB,uBAAuB,iBACxB,IAAAhD,WAAA,CAAAyF,GAAA,EAAC/F,oBAAA,CAAAa,OAAmB;UACnB6B,oBAAoB,EAAGA,oBAAsB;UAC7CL,QAAQ,EAAGA,QAAU;UACrBL,QAAQ,EAAGA;QAAU,CACrB,CACD,EAGC,CAAEO,aAAa,IAAI,CAAED,eAAe,iBACrC,IAAAhC,WAAA,CAAAyF,GAAA,EAACzG,WAAA,CAAA+G,OAAO,CAACC,IAAI;UACZC,IAAI,EAAC,eAAe;UACpBC,GAAG,EAAGZ;QAAiB,CACvB,CACD,EACCnD,QAAQ,eAEV,IAAAnC,WAAA,CAAAyF,GAAA,EAACzG,WAAA,CAAA+G,OAAO,CAACC,IAAI;UACZC,IAAI,EAAC,8BAA8B;UACnCC,GAAG,EAAGV;QAAsB,CAC5B,CAAC,EACAvD,aAAa,IAAI,CAAEN,UAAU,iBAC9B,IAAA3B,WAAA,CAAAyF,GAAA,EAAC5F,qBAAA,CAAAU,OAAoB;UACpB6B,oBAAoB,EAAGA;QAAsB,CAC7C,CACD;MAAA,CAC8B;IAAC,CAC7B;EAAC;AAER","ignoreList":[]}
@@ -62,7 +62,7 @@ function getProps(contentElement, selectedBlockElement, scrollContainer, toolbar
62
62
 
63
63
  // Get how far the content area has been scrolled.
64
64
  const scrollTop = scrollContainer?.scrollTop || 0;
65
- const blockRect = (0, _dom2.getVisibleElementBounds)(selectedBlockElement);
65
+ const blockRect = (0, _dom2.getElementBounds)(selectedBlockElement);
66
66
  const contentRect = contentElement.getBoundingClientRect();
67
67
 
68
68
  // Get the vertical position of top of the visible content area.
@@ -1 +1 @@
1
- {"version":3,"names":["_compose","require","_data","_dom","_element","_store","_useBlockRefs","_position","_dom2","COMMON_PROPS","placement","DEFAULT_PROPS","flip","shift","RESTRICTED_HEIGHT_PROPS","getProps","contentElement","selectedBlockElement","scrollContainer","toolbarHeight","isSticky","scrollTop","blockRect","getVisibleElementBounds","contentRect","getBoundingClientRect","topOfContentElementInViewport","top","viewportHeight","ownerDocument","documentElement","clientHeight","restrictedTopArea","hasSpaceForToolbarAbove","isBlockTallerThanViewport","height","useBlockToolbarPopoverProps","clientId","useBlockElement","setToolbarHeight","useState","blockIndex","useSelect","select","getBlockIndex","getBlockAttributes","blockEditorStore","hasStickyOrFixedPositionValue","useMemo","getScrollContainer","props","setProps","popoverRef","useRefEffect","popoverNode","offsetHeight","updateProps","useCallback","useLayoutEffect","contentView","defaultView","addEventHandler","resizeObserver","blockView","ResizeObserver","observe","removeEventHandler","disconnect","ref"],"sources":["@wordpress/block-editor/src/components/block-tools/use-block-toolbar-popover-props.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { getScrollContainer } from '@wordpress/dom';\nimport {\n\tuseCallback,\n\tuseLayoutEffect,\n\tuseMemo,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport { hasStickyOrFixedPositionValue } from '../../hooks/position';\nimport { getVisibleElementBounds } from '../../utils/dom';\n\nconst COMMON_PROPS = {\n\tplacement: 'top-start',\n};\n\n// By default the toolbar sets the `shift` prop. If the user scrolls the page\n// down the toolbar will stay on screen by adopting a sticky position at the\n// top of the viewport.\nconst DEFAULT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: false,\n\tshift: true,\n};\n\n// When there isn't enough height between the top of the block and the editor\n// canvas, the `shift` prop is set to `false`, as it will cause the block to be\n// obscured. The `flip` behavior is enabled, which positions the toolbar below\n// the block. This only happens if the block is smaller than the viewport, as\n// otherwise the toolbar will be off-screen.\nconst RESTRICTED_HEIGHT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: true,\n\tshift: false,\n};\n\n/**\n * Get the popover props for the block toolbar, determined by the space at the top of the canvas and the toolbar height.\n *\n * @param {Element} contentElement The DOM element that represents the editor content or canvas.\n * @param {Element} selectedBlockElement The outer DOM element of the first selected block.\n * @param {Element} scrollContainer The scrollable container for the contentElement.\n * @param {number} toolbarHeight The height of the toolbar in pixels.\n * @param {boolean} isSticky Whether or not the selected block is sticky or fixed.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nfunction getProps(\n\tcontentElement,\n\tselectedBlockElement,\n\tscrollContainer,\n\ttoolbarHeight,\n\tisSticky\n) {\n\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\t// Get how far the content area has been scrolled.\n\tconst scrollTop = scrollContainer?.scrollTop || 0;\n\n\tconst blockRect = getVisibleElementBounds( selectedBlockElement );\n\tconst contentRect = contentElement.getBoundingClientRect();\n\n\t// Get the vertical position of top of the visible content area.\n\tconst topOfContentElementInViewport = scrollTop + contentRect.top;\n\n\t// The document element's clientHeight represents the viewport height.\n\tconst viewportHeight =\n\t\tcontentElement.ownerDocument.documentElement.clientHeight;\n\n\t// The restricted height area is calculated as the sum of the\n\t// vertical position of the visible content area, plus the height\n\t// of the block toolbar.\n\tconst restrictedTopArea = topOfContentElementInViewport + toolbarHeight;\n\tconst hasSpaceForToolbarAbove = blockRect.top > restrictedTopArea;\n\n\tconst isBlockTallerThanViewport =\n\t\tblockRect.height > viewportHeight - toolbarHeight;\n\n\t// Sticky blocks are treated as if they will never have enough space for the toolbar above.\n\tif (\n\t\t! isSticky &&\n\t\t( hasSpaceForToolbarAbove || isBlockTallerThanViewport )\n\t) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\treturn RESTRICTED_HEIGHT_PROPS;\n}\n\n/**\n * Determines the desired popover positioning behavior, returning a set of appropriate props.\n *\n * @param {Object} elements\n * @param {Element} elements.contentElement The DOM element that represents the editor content or canvas.\n * @param {string} elements.clientId The clientId of the first selected block.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nexport default function useBlockToolbarPopoverProps( {\n\tcontentElement,\n\tclientId,\n} ) {\n\tconst selectedBlockElement = useBlockElement( clientId );\n\tconst [ toolbarHeight, setToolbarHeight ] = useState( 0 );\n\tconst { blockIndex, isSticky } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockIndex, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\tisSticky: hasStickyOrFixedPositionValue(\n\t\t\t\t\tgetBlockAttributes( clientId )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst scrollContainer = useMemo( () => {\n\t\tif ( ! contentElement ) {\n\t\t\treturn;\n\t\t}\n\t\treturn getScrollContainer( contentElement );\n\t}, [ contentElement ] );\n\tconst [ props, setProps ] = useState( () =>\n\t\tgetProps(\n\t\t\tcontentElement,\n\t\t\tselectedBlockElement,\n\t\t\tscrollContainer,\n\t\t\ttoolbarHeight,\n\t\t\tisSticky\n\t\t)\n\t);\n\n\tconst popoverRef = useRefEffect( ( popoverNode ) => {\n\t\tsetToolbarHeight( popoverNode.offsetHeight );\n\t}, [] );\n\n\tconst updateProps = useCallback(\n\t\t() =>\n\t\t\tsetProps(\n\t\t\t\tgetProps(\n\t\t\t\t\tcontentElement,\n\t\t\t\t\tselectedBlockElement,\n\t\t\t\t\tscrollContainer,\n\t\t\t\t\ttoolbarHeight,\n\t\t\t\t\tisSticky\n\t\t\t\t)\n\t\t\t),\n\t\t[ contentElement, selectedBlockElement, scrollContainer, toolbarHeight ]\n\t);\n\n\t// Update props when the block is moved. This also ensures the props are\n\t// correct on initial mount, and when the selected block or content element\n\t// changes (since the callback ref will update).\n\tuseLayoutEffect( updateProps, [ blockIndex, updateProps ] );\n\n\t// Update props when the viewport is resized or the block is resized.\n\tuseLayoutEffect( () => {\n\t\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update the toolbar props on viewport resize.\n\t\tconst contentView = contentElement?.ownerDocument?.defaultView;\n\t\tcontentView?.addEventHandler?.( 'resize', updateProps );\n\n\t\t// Update the toolbar props on block resize.\n\t\tlet resizeObserver;\n\t\tconst blockView = selectedBlockElement?.ownerDocument?.defaultView;\n\t\tif ( blockView.ResizeObserver ) {\n\t\t\tresizeObserver = new blockView.ResizeObserver( updateProps );\n\t\t\tresizeObserver.observe( selectedBlockElement );\n\t\t}\n\n\t\treturn () => {\n\t\t\tcontentView?.removeEventHandler?.( 'resize', updateProps );\n\n\t\t\tif ( resizeObserver ) {\n\t\t\t\tresizeObserver.disconnect();\n\t\t\t}\n\t\t};\n\t}, [ updateProps, contentElement, selectedBlockElement ] );\n\n\treturn {\n\t\t...props,\n\t\tref: popoverRef,\n\t};\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAUA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AAnBA;AACA;AACA;;AAWA;AACA;AACA;;AAMA,MAAMQ,YAAY,GAAG;EACpBC,SAAS,EAAE;AACZ,CAAC;;AAED;AACA;AACA;AACA,MAAMC,aAAa,GAAG;EACrB,GAAGF,YAAY;EACfG,IAAI,EAAE,KAAK;EACXC,KAAK,EAAE;AACR,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,uBAAuB,GAAG;EAC/B,G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D;;IAEA;IACA,MAAM0C,WAAW,GAAG3C,cAAc,EAAEa,aAAa,EAAE+B,WAAW;IAC9DD,WAAW,EAAEE,eAAe,GAAI,QAAQ,EAAEL,WAAY,CAAC;;IAEvD;IACA,IAAIM,cAAc;IAClB,MAAMC,SAAS,GAAG9C,oBAAoB,EAAEY,aAAa,EAAE+B,WAAW;IAClE,IAAKG,SAAS,CAACC,cAAc,EAAG;MAC/BF,cAAc,GAAG,IAAIC,SAAS,CAACC,cAAc,CAAER,WAAY,CAAC;MAC5DM,cAAc,CAACG,OAAO,CAAEhD,oBAAqB,CAAC;IAC/C;IAEA,OAAO,MAAM;MACZ0C,WAAW,EAAEO,kBAAkB,GAAI,QAAQ,EAAEV,WAAY,CAAC;MAE1D,IAAKM,cAAc,EAAG;QACrBA,cAAc,CAACK,UAAU,CAAC,CAAC;MAC5B;IACD,CAAC;EACF,CAAC,EAAE,CAAEX,WAAW,EAAExC,cAAc,EAAEC,oBAAoB,CAAG,CAAC;EAE1D,OAAO;IACN,GAAGiC,KAAK;IACRkB,GAAG,EAAEhB;EACN,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["_compose","require","_data","_dom","_element","_store","_useBlockRefs","_position","_dom2","COMMON_PROPS","placement","DEFAULT_PROPS","flip","shift","RESTRICTED_HEIGHT_PROPS","getProps","contentElement","selectedBlockElement","scrollContainer","toolbarHeight","isSticky","scrollTop","blockRect","getElementBounds","contentRect","getBoundingClientRect","topOfContentElementInViewport","top","viewportHeight","ownerDocument","documentElement","clientHeight","restrictedTopArea","hasSpaceForToolbarAbove","isBlockTallerThanViewport","height","useBlockToolbarPopoverProps","clientId","useBlockElement","setToolbarHeight","useState","blockIndex","useSelect","select","getBlockIndex","getBlockAttributes","blockEditorStore","hasStickyOrFixedPositionValue","useMemo","getScrollContainer","props","setProps","popoverRef","useRefEffect","popoverNode","offsetHeight","updateProps","useCallback","useLayoutEffect","contentView","defaultView","addEventHandler","resizeObserver","blockView","ResizeObserver","observe","removeEventHandler","disconnect","ref"],"sources":["@wordpress/block-editor/src/components/block-tools/use-block-toolbar-popover-props.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { getScrollContainer } from '@wordpress/dom';\nimport {\n\tuseCallback,\n\tuseLayoutEffect,\n\tuseMemo,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport { hasStickyOrFixedPositionValue } from '../../hooks/position';\nimport { getElementBounds } from '../../utils/dom';\n\nconst COMMON_PROPS = {\n\tplacement: 'top-start',\n};\n\n// By default the toolbar sets the `shift` prop. If the user scrolls the page\n// down the toolbar will stay on screen by adopting a sticky position at the\n// top of the viewport.\nconst DEFAULT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: false,\n\tshift: true,\n};\n\n// When there isn't enough height between the top of the block and the editor\n// canvas, the `shift` prop is set to `false`, as it will cause the block to be\n// obscured. The `flip` behavior is enabled, which positions the toolbar below\n// the block. This only happens if the block is smaller than the viewport, as\n// otherwise the toolbar will be off-screen.\nconst RESTRICTED_HEIGHT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: true,\n\tshift: false,\n};\n\n/**\n * Get the popover props for the block toolbar, determined by the space at the top of the canvas and the toolbar height.\n *\n * @param {Element} contentElement The DOM element that represents the editor content or canvas.\n * @param {Element} selectedBlockElement The outer DOM element of the first selected block.\n * @param {Element} scrollContainer The scrollable container for the contentElement.\n * @param {number} toolbarHeight The height of the toolbar in pixels.\n * @param {boolean} isSticky Whether or not the selected block is sticky or fixed.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nfunction getProps(\n\tcontentElement,\n\tselectedBlockElement,\n\tscrollContainer,\n\ttoolbarHeight,\n\tisSticky\n) {\n\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\t// Get how far the content area has been scrolled.\n\tconst scrollTop = scrollContainer?.scrollTop || 0;\n\n\tconst blockRect = getElementBounds( selectedBlockElement );\n\tconst contentRect = contentElement.getBoundingClientRect();\n\n\t// Get the vertical position of top of the visible content area.\n\tconst topOfContentElementInViewport = scrollTop + contentRect.top;\n\n\t// The document element's clientHeight represents the viewport height.\n\tconst viewportHeight =\n\t\tcontentElement.ownerDocument.documentElement.clientHeight;\n\n\t// The restricted height area is calculated as the sum of the\n\t// vertical position of the visible content area, plus the height\n\t// of the block toolbar.\n\tconst restrictedTopArea = topOfContentElementInViewport + toolbarHeight;\n\tconst hasSpaceForToolbarAbove = blockRect.top > restrictedTopArea;\n\n\tconst isBlockTallerThanViewport =\n\t\tblockRect.height > viewportHeight - toolbarHeight;\n\n\t// Sticky blocks are treated as if they will never have enough space for the toolbar above.\n\tif (\n\t\t! isSticky &&\n\t\t( hasSpaceForToolbarAbove || isBlockTallerThanViewport )\n\t) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\treturn RESTRICTED_HEIGHT_PROPS;\n}\n\n/**\n * Determines the desired popover positioning behavior, returning a set of appropriate props.\n *\n * @param {Object} elements\n * @param {Element} elements.contentElement The DOM element that represents the editor content or canvas.\n * @param {string} elements.clientId The clientId of the first selected block.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nexport default function useBlockToolbarPopoverProps( {\n\tcontentElement,\n\tclientId,\n} ) {\n\tconst selectedBlockElement = useBlockElement( clientId );\n\tconst [ toolbarHeight, setToolbarHeight ] = useState( 0 );\n\tconst { blockIndex, isSticky } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockIndex, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\tisSticky: hasStickyOrFixedPositionValue(\n\t\t\t\t\tgetBlockAttributes( clientId )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst scrollContainer = useMemo( () => {\n\t\tif ( ! contentElement ) {\n\t\t\treturn;\n\t\t}\n\t\treturn getScrollContainer( contentElement );\n\t}, [ contentElement ] );\n\tconst [ props, setProps ] = useState( () =>\n\t\tgetProps(\n\t\t\tcontentElement,\n\t\t\tselectedBlockElement,\n\t\t\tscrollContainer,\n\t\t\ttoolbarHeight,\n\t\t\tisSticky\n\t\t)\n\t);\n\n\tconst popoverRef = useRefEffect( ( popoverNode ) => {\n\t\tsetToolbarHeight( popoverNode.offsetHeight );\n\t}, [] );\n\n\tconst updateProps = useCallback(\n\t\t() =>\n\t\t\tsetProps(\n\t\t\t\tgetProps(\n\t\t\t\t\tcontentElement,\n\t\t\t\t\tselectedBlockElement,\n\t\t\t\t\tscrollContainer,\n\t\t\t\t\ttoolbarHeight,\n\t\t\t\t\tisSticky\n\t\t\t\t)\n\t\t\t),\n\t\t[ contentElement, selectedBlockElement, scrollContainer, toolbarHeight ]\n\t);\n\n\t// Update props when the block is moved. This also ensures the props are\n\t// correct on initial mount, and when the selected block or content element\n\t// changes (since the callback ref will update).\n\tuseLayoutEffect( updateProps, [ blockIndex, updateProps ] );\n\n\t// Update props when the viewport is resized or the block is resized.\n\tuseLayoutEffect( () => {\n\t\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update the toolbar props on viewport resize.\n\t\tconst contentView = contentElement?.ownerDocument?.defaultView;\n\t\tcontentView?.addEventHandler?.( 'resize', updateProps );\n\n\t\t// Update the toolbar props on block resize.\n\t\tlet resizeObserver;\n\t\tconst blockView = selectedBlockElement?.ownerDocument?.defaultView;\n\t\tif ( blockView.ResizeObserver ) {\n\t\t\tresizeObserver = new blockView.ResizeObserver( updateProps );\n\t\t\tresizeObserver.observe( selectedBlockElement );\n\t\t}\n\n\t\treturn () => {\n\t\t\tcontentView?.removeEventHandler?.( 'resize', updateProps );\n\n\t\t\tif ( resizeObserver ) {\n\t\t\t\tresizeObserver.disconnect();\n\t\t\t}\n\t\t};\n\t}, [ updateProps, contentElement, selectedBlockElement ] );\n\n\treturn {\n\t\t...props,\n\t\tref: popoverRef,\n\t};\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAUA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AAnBA;AACA;AACA;;AAWA;AACA;AACA;;AAMA,MAAMQ,YAAY,GAAG;EACpBC,SAAS,EAAE;AACZ,CAAC;;AAED;AACA;AACA;AACA,MAAMC,aAAa,GAAG;EACrB,GAAGF,YAAY;EACfG,IAAI,EAAE,KAAK;EACXC,KAAK,EAAE;AACR,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,uBAAuB,GAAG;EAC/B,GAAGL,YAAY;EACfG,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE;AACR,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,QAAQA,CAChBC,cAAc,EACdC,oBAAoB,EACpBC,eAAe,EACfC,aAAa,EACbC,QAAQ,EACP;EACD,IAAK,CAAEJ,cAAc,IAAI,CAAEC,oBAAoB,EAAG;IACjD,OAAON,aAAa;EACrB;;EAEA;EACA,MAAMU,SAAS,GAAGH,eAAe,EAAEG,SAAS,IAAI,CAAC;EAEjD,MAAMC,SAAS,GAAG,IAAAC,sBAAgB,EAAEN,oBAAqB,CAAC;EAC1D,MAAMO,WAAW,GAAGR,cAAc,CAACS,qBAAqB,CAAC,CAAC;;EAE1D;EACA,MAAMC,6BAA6B,GAAGL,SAAS,GAAGG,WAAW,CAACG,GAAG;;EAEjE;EACA,MAAMC,cAAc,GACnBZ,cAAc,CAACa,aAAa,CAAC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AoB,CAAG,CAAC;EAE1D,OAAO;IACN,GAAGiC,KAAK;IACRkB,GAAG,EAAEhB;EACN,CAAC;AACF","ignoreList":[]}
@@ -37,7 +37,10 @@ function useShowBlockTools() {
37
37
  const editorMode = __unstableGetEditorMode();
38
38
  const hasSelectedBlock = !!clientId && !!block;
39
39
  const isEmptyDefaultBlock = hasSelectedBlock && (0, _blocks.isUnmodifiedDefaultBlock)(block) && getBlockMode(clientId) !== 'html';
40
- const _showEmptyBlockSideInserter = clientId && !isTyping() && editorMode === 'edit' && isEmptyDefaultBlock;
40
+ const _showEmptyBlockSideInserter = clientId && !isTyping() &&
41
+ // Hide the block inserter on the navigation mode.
42
+ // See https://github.com/WordPress/gutenberg/pull/66636#discussion_r1824728483.
43
+ editorMode !== 'navigation' && isEmptyDefaultBlock;
41
44
  const _showBlockToolbarPopover = !getSettings().hasFixedToolbar && !_showEmptyBlockSideInserter && hasSelectedBlock && !isEmptyDefaultBlock;
42
45
  return {
43
46
  showEmptyBlockSideInserter: _showEmptyBlockSideInserter,
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_blocks","_store","_lockUnlock","useShowBlockTools","useSelect","select","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getBlock","getBlockMode","getSettings","__unstableGetEditorMode","isTyping","unlock","blockEditorStore","clientId","block","editorMode","hasSelectedBlock","isEmptyDefaultBlock","isUnmodifiedDefaultBlock","_showEmptyBlockSideInserter","_showBlockToolbarPopover","hasFixedToolbar","showEmptyBlockSideInserter","showBlockToolbarPopover"],"sources":["@wordpress/block-editor/src/components/block-tools/use-show-block-tools.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Source of truth for which block tools are showing in the block editor.\n *\n * @return {Object} Object of which block tools will be shown.\n */\nexport function useShowBlockTools() {\n\treturn useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetFirstMultiSelectedBlockClientId,\n\t\t\tgetBlock,\n\t\t\tgetBlockMode,\n\t\t\tgetSettings,\n\t\t\t__unstableGetEditorMode,\n\t\t\tisTyping,\n\t\t} = unlock( select( blockEditorStore ) );\n\n\t\tconst clientId =\n\t\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\t\tconst block = getBlock( clientId );\n\t\tconst editorMode = __unstableGetEditorMode();\n\t\tconst hasSelectedBlock = !! clientId && !! block;\n\t\tconst isEmptyDefaultBlock =\n\t\t\thasSelectedBlock &&\n\t\t\tisUnmodifiedDefaultBlock( block ) &&\n\t\t\tgetBlockMode( clientId ) !== 'html';\n\t\tconst _showEmptyBlockSideInserter =\n\t\t\tclientId &&\n\t\t\t! isTyping() &&\n\t\t\teditorMode === 'edit' &&\n\t\t\tisEmptyDefaultBlock;\n\t\tconst _showBlockToolbarPopover =\n\t\t\t! getSettings().hasFixedToolbar &&\n\t\t\t! _showEmptyBlockSideInserter &&\n\t\t\thasSelectedBlock &&\n\t\t\t! isEmptyDefaultBlock;\n\n\t\treturn {\n\t\t\tshowEmptyBlockSideInserter: _showEmptyBlockSideInserter,\n\t\t\tshowBlockToolbarPopover: _showBlockToolbarPopover,\n\t\t};\n\t}, [] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,SAASI,iBAAiBA,CAAA,EAAG;EACnC,OAAO,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC/B,MAAM;MACLC,wBAAwB;MACxBC,kCAAkC;MAClCC,QAAQ;MACRC,YAAY;MACZC,WAAW;MACXC,uBAAuB;MACvBC;IACD,CAAC,GAAG,IAAAC,kBAAM,EAAER,MAAM,CAAES,YAAiB,CAAE,CAAC;IAExC,MAAMC,QAAQ,GACbT,wBAAwB,CAAC,CAAC,IAAIC,kCAAkC,CAAC,CAAC;IAEnE,MAAMS,KAAK,GAAGR,QAAQ,CAAEO,QAAS,CAAC;IAClC,MAAME,UAAU,GAAGN,uBAAuB,CAAC,CAAC;IAC5C,MAAMO,gBAAgB,GAAG,CAAC,CAAEH,QAAQ,IAAI,CAAC,CAAEC,KAAK;IAChD,MAAMG,mBAAmB,GACxBD,gBAAgB,IAChB,IAAAE,gCAAwB,EAAEJ,KAAM,CAAC,IACjCP,YAAY,CAAEM,QAAS,CAAC,KAAK,MAAM;IACpC,MAAMM,2BAA2B,GAChCN,QAAQ,IACR,CAAEH,QAAQ,CAAC,CAAC,IACZK,UAAU,KAAK,MAAM,IACrBE,mBAAmB;IACpB,MAAMG,wBAAwB,GAC7B,CAAEZ,WAAW,CAAC,CAAC,CAACa,eAAe,IAC/B,CAAEF,2BAA2B,IAC7BH,gBAAgB,IAChB,CAAEC,mBAAmB;IAEtB,OAAO;MACNK,0BAA0B,EAAEH,2BAA2B;MACvDI,uBAAuB,EAAEH;IAC1B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_blocks","_store","_lockUnlock","useShowBlockTools","useSelect","select","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getBlock","getBlockMode","getSettings","__unstableGetEditorMode","isTyping","unlock","blockEditorStore","clientId","block","editorMode","hasSelectedBlock","isEmptyDefaultBlock","isUnmodifiedDefaultBlock","_showEmptyBlockSideInserter","_showBlockToolbarPopover","hasFixedToolbar","showEmptyBlockSideInserter","showBlockToolbarPopover"],"sources":["@wordpress/block-editor/src/components/block-tools/use-show-block-tools.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Source of truth for which block tools are showing in the block editor.\n *\n * @return {Object} Object of which block tools will be shown.\n */\nexport function useShowBlockTools() {\n\treturn useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetFirstMultiSelectedBlockClientId,\n\t\t\tgetBlock,\n\t\t\tgetBlockMode,\n\t\t\tgetSettings,\n\t\t\t__unstableGetEditorMode,\n\t\t\tisTyping,\n\t\t} = unlock( select( blockEditorStore ) );\n\n\t\tconst clientId =\n\t\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\t\tconst block = getBlock( clientId );\n\t\tconst editorMode = __unstableGetEditorMode();\n\t\tconst hasSelectedBlock = !! clientId && !! block;\n\t\tconst isEmptyDefaultBlock =\n\t\t\thasSelectedBlock &&\n\t\t\tisUnmodifiedDefaultBlock( block ) &&\n\t\t\tgetBlockMode( clientId ) !== 'html';\n\t\tconst _showEmptyBlockSideInserter =\n\t\t\tclientId &&\n\t\t\t! isTyping() &&\n\t\t\t// Hide the block inserter on the navigation mode.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/66636#discussion_r1824728483.\n\t\t\teditorMode !== 'navigation' &&\n\t\t\tisEmptyDefaultBlock;\n\t\tconst _showBlockToolbarPopover =\n\t\t\t! getSettings().hasFixedToolbar &&\n\t\t\t! _showEmptyBlockSideInserter &&\n\t\t\thasSelectedBlock &&\n\t\t\t! isEmptyDefaultBlock;\n\n\t\treturn {\n\t\t\tshowEmptyBlockSideInserter: _showEmptyBlockSideInserter,\n\t\t\tshowBlockToolbarPopover: _showBlockToolbarPopover,\n\t\t};\n\t}, [] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,SAASI,iBAAiBA,CAAA,EAAG;EACnC,OAAO,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC/B,MAAM;MACLC,wBAAwB;MACxBC,kCAAkC;MAClCC,QAAQ;MACRC,YAAY;MACZC,WAAW;MACXC,uBAAuB;MACvBC;IACD,CAAC,GAAG,IAAAC,kBAAM,EAAER,MAAM,CAAES,YAAiB,CAAE,CAAC;IAExC,MAAMC,QAAQ,GACbT,wBAAwB,CAAC,CAAC,IAAIC,kCAAkC,CAAC,CAAC;IAEnE,MAAMS,KAAK,GAAGR,QAAQ,CAAEO,QAAS,CAAC;IAClC,MAAME,UAAU,GAAGN,uBAAuB,CAAC,CAAC;IAC5C,MAAMO,gBAAgB,GAAG,CAAC,CAAEH,QAAQ,IAAI,CAAC,CAAEC,KAAK;IAChD,MAAMG,mBAAmB,GACxBD,gBAAgB,IAChB,IAAAE,gCAAwB,EAAEJ,KAAM,CAAC,IACjCP,YAAY,CAAEM,QAAS,CAAC,KAAK,MAAM;IACpC,MAAMM,2BAA2B,GAChCN,QAAQ,IACR,CAAEH,QAAQ,CAAC,CAAC;IACZ;IACA;IACAK,UAAU,KAAK,YAAY,IAC3BE,mBAAmB;IACpB,MAAMG,wBAAwB,GAC7B,CAAEZ,WAAW,CAAC,CAAC,CAACa,eAAe,IAC/B,CAAEF,2BAA2B,IAC7BH,gBAAgB,IAChB,CAAEC,mBAAmB;IAEtB,OAAO;MACNK,0BAA0B,EAAEH,2BAA2B;MACvDI,uBAAuB,EAAEH;IAC1B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR","ignoreList":[]}
@@ -9,10 +9,6 @@ var _components = require("@wordpress/components");
9
9
  * WordPress dependencies
10
10
  */
11
11
 
12
- const {
13
- Fill: __unstableCommentIconFill,
14
- Slot
15
- } = (0, _components.createSlotFill)('__unstableCommentIconFill');
16
- __unstableCommentIconFill.Slot = Slot;
17
- var _default = exports.default = __unstableCommentIconFill;
12
+ const CommentIconSlotFill = (0, _components.createSlotFill)(Symbol('CommentIconSlotFill'));
13
+ var _default = exports.default = CommentIconSlotFill;
18
14
  //# sourceMappingURL=block-comment-icon-slot.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","Fill","__unstableCommentIconFill","Slot","createSlotFill","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/collab/block-comment-icon-slot.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst { Fill: __unstableCommentIconFill, Slot } = createSlotFill(\n\t'__unstableCommentIconFill'\n);\n\n__unstableCommentIconFill.Slot = Slot;\n\nexport default __unstableCommentIconFill;\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAM;EAAEC,IAAI,EAAEC,yBAAyB;EAAEC;AAAK,CAAC,GAAG,IAAAC,0BAAc,EAC/D,2BACD,CAAC;AAEDF,yBAAyB,CAACC,IAAI,GAAGA,IAAI;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEvBL,yBAAyB","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","CommentIconSlotFill","createSlotFill","Symbol","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/collab/block-comment-icon-slot.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst CommentIconSlotFill = createSlotFill( Symbol( 'CommentIconSlotFill' ) );\n\nexport default CommentIconSlotFill;\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,mBAAmB,GAAG,IAAAC,0BAAc,EAAEC,MAAM,CAAE,qBAAsB,CAAE,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAE/DL,mBAAmB","ignoreList":[]}
@@ -9,10 +9,6 @@ var _components = require("@wordpress/components");
9
9
  * WordPress dependencies
10
10
  */
11
11
 
12
- const {
13
- Fill: __unstableCommentIconToolbarFill,
14
- Slot
15
- } = (0, _components.createSlotFill)('__unstableCommentIconToolbarFill');
16
- __unstableCommentIconToolbarFill.Slot = Slot;
17
- var _default = exports.default = __unstableCommentIconToolbarFill;
12
+ const CommentIconToolbarSlotFill = (0, _components.createSlotFill)(Symbol('CommentIconToolbarSlotFill'));
13
+ var _default = exports.default = CommentIconToolbarSlotFill;
18
14
  //# sourceMappingURL=block-comment-icon-toolbar-slot.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","Fill","__unstableCommentIconToolbarFill","Slot","createSlotFill","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/collab/block-comment-icon-toolbar-slot.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst { Fill: __unstableCommentIconToolbarFill, Slot } = createSlotFill(\n\t'__unstableCommentIconToolbarFill'\n);\n\n__unstableCommentIconToolbarFill.Slot = Slot;\n\nexport default __unstableCommentIconToolbarFill;\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAM;EAAEC,IAAI,EAAEC,gCAAgC;EAAEC;AAAK,CAAC,GAAG,IAAAC,0BAAc,EACtE,kCACD,CAAC;AAEDF,gCAAgC,CAACC,IAAI,GAAGA,IAAI;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAE9BL,gCAAgC","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","CommentIconToolbarSlotFill","createSlotFill","Symbol","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/collab/block-comment-icon-toolbar-slot.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst CommentIconToolbarSlotFill = createSlotFill(\n\tSymbol( 'CommentIconToolbarSlotFill' )\n);\n\nexport default CommentIconToolbarSlotFill;\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,0BAA0B,GAAG,IAAAC,0BAAc,EAChDC,MAAM,CAAE,4BAA6B,CACtC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaL,0BAA0B","ignoreList":[]}
@@ -15,9 +15,11 @@ var _jsxRuntime = require("react/jsx-runtime");
15
15
  */
16
16
  var _default = exports.default = (0, _compose.createHigherOrderComponent)(WrappedComponent => {
17
17
  return props => {
18
- const [colorsFeature, enableCustomColors] = (0, _useSettings.useSettings)('color.palette', 'color.custom');
18
+ // Get the default colors, theme colors, and custom colors
19
+ const [defaultColors, themeColors, customColors, enableCustomColors, enableDefaultColors] = (0, _useSettings.useSettings)('color.palette.default', 'color.palette.theme', 'color.palette.custom', 'color.custom', 'color.defaultPalette');
20
+ const _colors = enableDefaultColors ? [...(themeColors || []), ...(defaultColors || []), ...(customColors || [])] : [...(themeColors || []), ...(customColors || [])];
19
21
  const {
20
- colors = colorsFeature,
22
+ colors = _colors,
21
23
  disableCustomColors = !enableCustomColors
22
24
  } = props;
23
25
  const hasColorsToChoose = colors && colors.length > 0 || !disableCustomColors;
@@ -1 +1 @@
1
- {"version":3,"names":["_compose","require","_useSettings","_jsxRuntime","_default","exports","default","createHigherOrderComponent","WrappedComponent","props","colorsFeature","enableCustomColors","useSettings","colors","disableCustomColors","hasColorsToChoose","length","jsx"],"sources":["@wordpress/block-editor/src/components/color-palette/with-color-context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../use-settings';\n\nexport default createHigherOrderComponent( ( WrappedComponent ) => {\n\treturn ( props ) => {\n\t\tconst [ colorsFeature, enableCustomColors ] = useSettings(\n\t\t\t'color.palette',\n\t\t\t'color.custom'\n\t\t);\n\t\tconst {\n\t\t\tcolors = colorsFeature,\n\t\t\tdisableCustomColors = ! enableCustomColors,\n\t\t} = props;\n\t\tconst hasColorsToChoose =\n\t\t\t( colors && colors.length > 0 ) || ! disableCustomColors;\n\t\treturn (\n\t\t\t<WrappedComponent\n\t\t\t\t{ ...{\n\t\t\t\t\t...props,\n\t\t\t\t\tcolors,\n\t\t\t\t\tdisableCustomColors,\n\t\t\t\t\thasColorsToChoose,\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t};\n}, 'withColorContext' );\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAA8C,IAAAE,WAAA,GAAAF,OAAA;AAR9C;AACA;AACA;AAGA;AACA;AACA;AAFA,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAKe,IAAAC,mCAA0B,EAAIC,gBAAgB,IAAM;EAClE,OAASC,KAAK,IAAM;IACnB,MAAM,CAAEC,aAAa,EAAEC,kBAAkB,CAAE,GAAG,IAAAC,wBAAW,EACxD,eAAe,EACf,cACD,CAAC;IACD,MAAM;MACLC,MAAM,GAAGH,aAAa;MACtBI,mBAAmB,GAAG,CAAEH;IACzB,CAAC,GAAGF,KAAK;IACT,MAAMM,iBAAiB,GACpBF,MAAM,IAAIA,MAAM,CAACG,MAAM,GAAG,CAAC,IAAM,CAAEF,mBAAmB;IACzD,oBACC,IAAAX,WAAA,CAAAc,GAAA,EAACT,gBAAgB;MAEf,GAAGC,KAAK;MACRI,MAAM;MACNC,mBAAmB;MACnBC;IAAiB,CAElB,CAAC;EAEJ,CAAC;AACF,CAAC,EAAE,kBAAmB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_compose","require","_useSettings","_jsxRuntime","_default","exports","default","createHigherOrderComponent","WrappedComponent","props","defaultColors","themeColors","customColors","enableCustomColors","enableDefaultColors","useSettings","_colors","colors","disableCustomColors","hasColorsToChoose","length","jsx"],"sources":["@wordpress/block-editor/src/components/color-palette/with-color-context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../use-settings';\n\nexport default createHigherOrderComponent( ( WrappedComponent ) => {\n\treturn ( props ) => {\n\t\t// Get the default colors, theme colors, and custom colors\n\t\tconst [\n\t\t\tdefaultColors,\n\t\t\tthemeColors,\n\t\t\tcustomColors,\n\t\t\tenableCustomColors,\n\t\t\tenableDefaultColors,\n\t\t] = useSettings(\n\t\t\t'color.palette.default',\n\t\t\t'color.palette.theme',\n\t\t\t'color.palette.custom',\n\t\t\t'color.custom',\n\t\t\t'color.defaultPalette'\n\t\t);\n\n\t\tconst _colors = enableDefaultColors\n\t\t\t? [\n\t\t\t\t\t...( themeColors || [] ),\n\t\t\t\t\t...( defaultColors || [] ),\n\t\t\t\t\t...( customColors || [] ),\n\t\t\t ]\n\t\t\t: [ ...( themeColors || [] ), ...( customColors || [] ) ];\n\n\t\tconst { colors = _colors, disableCustomColors = ! enableCustomColors } =\n\t\t\tprops;\n\n\t\tconst hasColorsToChoose =\n\t\t\t( colors && colors.length > 0 ) || ! disableCustomColors;\n\t\treturn (\n\t\t\t<WrappedComponent\n\t\t\t\t{ ...{\n\t\t\t\t\t...props,\n\t\t\t\t\tcolors,\n\t\t\t\t\tdisableCustomColors,\n\t\t\t\t\thasColorsToChoose,\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t};\n}, 'withColorContext' );\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAA8C,IAAAE,WAAA,GAAAF,OAAA;AAR9C;AACA;AACA;AAGA;AACA;AACA;AAFA,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAKe,IAAAC,mCAA0B,EAAIC,gBAAgB,IAAM;EAClE,OAASC,KAAK,IAAM;IACnB;IACA,MAAM,CACLC,aAAa,EACbC,WAAW,EACXC,YAAY,EACZC,kBAAkB,EAClBC,mBAAmB,CACnB,GAAG,IAAAC,wBAAW,EACd,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,cAAc,EACd,sBACD,CAAC;IAED,MAAMC,OAAO,GAAGF,mBAAmB,GAChC,CACA,IAAKH,WAAW,IAAI,EAAE,CAAE,EACxB,IAAKD,aAAa,IAAI,EAAE,CAAE,EAC1B,IAAKE,YAAY,IAAI,EAAE,CAAE,CACxB,GACD,CAAE,IAAKD,WAAW,IAAI,EAAE,CAAE,EAAE,IAAKC,YAAY,IAAI,EAAE,CAAE,CAAE;IAE1D,MAAM;MAAEK,MAAM,GAAGD,OAAO;MAAEE,mBAAmB,GAAG,CAAEL;IAAmB,CAAC,GACrEJ,KAAK;IAEN,MAAMU,iBAAiB,GACpBF,MAAM,IAAIA,MAAM,CAACG,MAAM,GAAG,CAAC,IAAM,CAAEF,mBAAmB;IACzD,oBACC,IAAAf,WAAA,CAAAkB,GAAA,EAACb,gBAAgB;MAEf,GAAGC,KAAK;MACRQ,MAAM;MACNC,mBAAmB;MACnBC;IAAiB,CAElB,CAAC;EAEJ,CAAC;AACF,CAAC,EAAE,kBAAmB,CAAC","ignoreList":[]}
@@ -36,17 +36,18 @@ function FontFamilyControl({
36
36
  return null;
37
37
  }
38
38
  const options = [{
39
- value: '',
40
- label: (0, _i18n.__)('Default')
39
+ key: '',
40
+ name: (0, _i18n.__)('Default')
41
41
  }, ...fontFamilies.map(({
42
42
  fontFamily,
43
43
  name
44
- }) => {
45
- return {
46
- value: fontFamily,
47
- label: name || fontFamily
48
- };
49
- })];
44
+ }) => ({
45
+ key: fontFamily,
46
+ name: name || fontFamily,
47
+ style: {
48
+ fontFamily
49
+ }
50
+ }))];
50
51
  if (!__nextHasNoMarginBottom) {
51
52
  (0, _deprecated.default)('Bottom margin styles for wp.blockEditor.FontFamilyControl', {
52
53
  since: '6.7',
@@ -54,14 +55,14 @@ function FontFamilyControl({
54
55
  hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version'
55
56
  });
56
57
  }
57
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectControl, {
58
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CustomSelectControl, {
58
59
  __next40pxDefaultSize: __next40pxDefaultSize,
59
- __nextHasNoMarginBottom: __nextHasNoMarginBottom,
60
60
  label: (0, _i18n.__)('Font'),
61
- options: options,
62
61
  value: value,
63
- onChange: onChange,
64
- labelPosition: "top",
62
+ onChange: ({
63
+ selectedItem
64
+ }) => onChange(selectedItem.key),
65
+ options: options,
65
66
  ...props
66
67
  });
67
68
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_deprecated","_interopRequireDefault","_i18n","_useSettings","_jsxRuntime","FontFamilyControl","__next40pxDefaultSize","__nextHasNoMarginBottom","value","onChange","fontFamilies","props","blockLevelFontFamilies","useSettings","length","options","label","__","map","fontFamily","name","deprecated","since","version","hint","jsx","SelectControl","labelPosition"],"sources":["@wordpress/block-editor/src/components/font-family/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SelectControl } from '@wordpress/components';\nimport deprecated from '@wordpress/deprecated';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../use-settings';\n\nexport default function FontFamilyControl( {\n\t/** Start opting into the larger default height that will become the default size in a future version. */\n\t__next40pxDefaultSize = false,\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMarginBottom = false,\n\tvalue = '',\n\tonChange,\n\tfontFamilies,\n\t...props\n} ) {\n\tconst [ blockLevelFontFamilies ] = useSettings( 'typography.fontFamilies' );\n\tif ( ! fontFamilies ) {\n\t\tfontFamilies = blockLevelFontFamilies;\n\t}\n\n\tif ( ! fontFamilies || fontFamilies.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst options = [\n\t\t{ value: '', label: __( 'Default' ) },\n\t\t...fontFamilies.map( ( { fontFamily, name } ) => {\n\t\t\treturn {\n\t\t\t\tvalue: fontFamily,\n\t\t\t\tlabel: name || fontFamily,\n\t\t\t};\n\t\t} ),\n\t];\n\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\tdeprecated(\n\t\t\t'Bottom margin styles for wp.blockEditor.FontFamilyControl',\n\t\t\t{\n\t\t\t\tsince: '6.7',\n\t\t\t\tversion: '7.0',\n\t\t\t\thint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version',\n\t\t\t}\n\t\t);\n\t}\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\tlabel={ __( 'Font' ) }\n\t\t\toptions={ options }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tlabelPosition=\"top\"\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,YAAA,GAAAJ,OAAA;AAA8C,IAAAK,WAAA,GAAAL,OAAA;AAV9C;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASM,iBAAiBA,CAAE;EAC1C;EACAC,qBAAqB,GAAG,KAAK;EAC7B;EACAC,uBAAuB,GAAG,KAAK;EAC/BC,KAAK,GAAG,EAAE;EACVC,QAAQ;EACRC,YAAY;EACZ,GAAGC;AACJ,CAAC,EAAG;EACH,MAAM,CAAEC,sBAAsB,CAAE,GAAG,IAAAC,wBAAW,EAAE,yBAA0B,CAAC;EAC3E,IAAK,CAAEH,YAAY,EAAG;IACrBA,YAAY,GAAGE,sBAAsB;EACtC;EAEA,IAAK,CAAEF,YAAY,IAAIA,YAAY,CAACI,MAAM,KAAK,CAAC,EAAG;IAClD,OAAO,IAAI;EACZ;EAEA,MAAMC,OAAO,GAAG,CACf;IAAEP,KAAK,EAAE,EAAE;IAAEQ,KAAK,EAAE,IAAAC,QAAE,EAAE,SAAU;EAAE,CAAC,EACrC,GAAGP,YAAY,CAACQ,GAAG,CAAE,CAAE;IAAEC,UAAU;IAAEC;EAAK,CAAC,KAAM;IAChD,OAAO;MACNZ,KAAK,EAAEW,UAAU;MACjBH,KAAK,EAAEI,IAAI,IAAID;IAChB,CAAC;EACF,CAAE,CAAC,CACH;EAED,IAAK,CAAEZ,uBAAuB,EAAG;IAChC,IAAAc,mBAAU,EACT,2DAA2D,EAC3D;MACCC,KAAK,EAAE,KAAK;MACZC,OAAO,EAAE,KAAK;MACdC,IAAI,EAAE;IACP,CACD,CAAC;EACF;EAEA,oBACC,IAAApB,WAAA,CAAAqB,GAAA,EAAC3B,WAAA,CAAA4B,aAAa;IACbpB,qBAAqB,EAAGA,qBAAuB;IAC/CC,uBAAuB,EAAGA,uBAAyB;IACnDS,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO,CAAG;IACtBF,OAAO,EAAGA,OAAS;IACnBP,KAAK,EAAGA,KAAO;IACfC,QAAQ,EAAGA,QAAU;IACrBkB,aAAa,EAAC,KAAK;IAAA,GACdhB;EAAK,CACV,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_deprecated","_interopRequireDefault","_i18n","_useSettings","_jsxRuntime","FontFamilyControl","__next40pxDefaultSize","__nextHasNoMarginBottom","value","onChange","fontFamilies","props","blockLevelFontFamilies","useSettings","length","options","key","name","__","map","fontFamily","style","deprecated","since","version","hint","jsx","CustomSelectControl","label","selectedItem"],"sources":["@wordpress/block-editor/src/components/font-family/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { CustomSelectControl } from '@wordpress/components';\nimport deprecated from '@wordpress/deprecated';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../use-settings';\n\nexport default function FontFamilyControl( {\n\t/** Start opting into the larger default height that will become the default size in a future version. */\n\t__next40pxDefaultSize = false,\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMarginBottom = false,\n\tvalue = '',\n\tonChange,\n\tfontFamilies,\n\t...props\n} ) {\n\tconst [ blockLevelFontFamilies ] = useSettings( 'typography.fontFamilies' );\n\tif ( ! fontFamilies ) {\n\t\tfontFamilies = blockLevelFontFamilies;\n\t}\n\n\tif ( ! fontFamilies || fontFamilies.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst options = [\n\t\t{\n\t\t\tkey: '',\n\t\t\tname: __( 'Default' ),\n\t\t},\n\t\t...fontFamilies.map( ( { fontFamily, name } ) => ( {\n\t\t\tkey: fontFamily,\n\t\t\tname: name || fontFamily,\n\t\t\tstyle: { fontFamily },\n\t\t} ) ),\n\t];\n\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\tdeprecated(\n\t\t\t'Bottom margin styles for wp.blockEditor.FontFamilyControl',\n\t\t\t{\n\t\t\t\tsince: '6.7',\n\t\t\t\tversion: '7.0',\n\t\t\t\thint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version',\n\t\t\t}\n\t\t);\n\t}\n\n\treturn (\n\t\t<CustomSelectControl\n\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\tlabel={ __( 'Font' ) }\n\t\t\tvalue={ value }\n\t\t\tonChange={ ( { selectedItem } ) => onChange( selectedItem.key ) }\n\t\t\toptions={ options }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,YAAA,GAAAJ,OAAA;AAA8C,IAAAK,WAAA,GAAAL,OAAA;AAV9C;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASM,iBAAiBA,CAAE;EAC1C;EACAC,qBAAqB,GAAG,KAAK;EAC7B;EACAC,uBAAuB,GAAG,KAAK;EAC/BC,KAAK,GAAG,EAAE;EACVC,QAAQ;EACRC,YAAY;EACZ,GAAGC;AACJ,CAAC,EAAG;EACH,MAAM,CAAEC,sBAAsB,CAAE,GAAG,IAAAC,wBAAW,EAAE,yBAA0B,CAAC;EAC3E,IAAK,CAAEH,YAAY,EAAG;IACrBA,YAAY,GAAGE,sBAAsB;EACtC;EAEA,IAAK,CAAEF,YAAY,IAAIA,YAAY,CAACI,MAAM,KAAK,CAAC,EAAG;IAClD,OAAO,IAAI;EACZ;EAEA,MAAMC,OAAO,GAAG,CACf;IACCC,GAAG,EAAE,EAAE;IACPC,IAAI,EAAE,IAAAC,QAAE,EAAE,SAAU;EACrB,CAAC,EACD,GAAGR,YAAY,CAACS,GAAG,CAAE,CAAE;IAAEC,UAAU;IAAEH;EAAK,CAAC,MAAQ;IAClDD,GAAG,EAAEI,UAAU;IACfH,IAAI,EAAEA,IAAI,IAAIG,UAAU;IACxBC,KAAK,EAAE;MAAED;IAAW;EACrB,CAAC,CAAG,CAAC,CACL;EAED,IAAK,CAAEb,uBAAuB,EAAG;IAChC,IAAAe,mBAAU,EACT,2DAA2D,EAC3D;MACCC,KAAK,EAAE,KAAK;MACZC,OAAO,EAAE,KAAK;MACdC,IAAI,EAAE;IACP,CACD,CAAC;EACF;EAEA,oBACC,IAAArB,WAAA,CAAAsB,GAAA,EAAC5B,WAAA,CAAA6B,mBAAmB;IACnBrB,qBAAqB,EAAGA,qBAAuB;IAC/CsB,KAAK,EAAG,IAAAV,QAAE,EAAE,MAAO,CAAG;IACtBV,KAAK,EAAGA,KAAO;IACfC,QAAQ,EAAGA,CAAE;MAAEoB;IAAa,CAAC,KAAMpB,QAAQ,CAAEoB,YAAY,CAACb,GAAI,CAAG;IACjED,OAAO,EAAGA,OAAS;IAAA,GACdJ;EAAK,CACV,CAAC;AAEJ","ignoreList":[]}
@@ -118,22 +118,34 @@ function splitStyleValue(value) {
118
118
  }
119
119
  return value;
120
120
  }
121
- function splitGapValue(value) {
121
+ function splitGapValue(value, isAxialGap) {
122
+ if (!value) {
123
+ return value;
124
+ }
125
+
122
126
  // Check for shorthand value (a string value).
123
- if (value && typeof value === 'string') {
124
- // If the value is a string, treat it as a single side (top) for the spacing controls.
125
- return {
127
+ if (typeof value === 'string') {
128
+ /*
129
+ * Map the string value to appropriate sides for the spacing control depending
130
+ * on whether the current block has axial gap support or not.
131
+ *
132
+ * Note: The axial value pairs must match for the spacing control to display
133
+ * the appropriate horizontal/vertical sliders.
134
+ */
135
+ return isAxialGap ? {
136
+ top: value,
137
+ right: value,
138
+ bottom: value,
139
+ left: value
140
+ } : {
126
141
  top: value
127
142
  };
128
143
  }
129
- if (value) {
130
- return {
131
- ...value,
132
- right: value?.left,
133
- bottom: value?.top
134
- };
135
- }
136
- return value;
144
+ return {
145
+ ...value,
146
+ right: value?.left,
147
+ bottom: value?.top
148
+ };
137
149
  }
138
150
  function DimensionsToolsPanel({
139
151
  resetAllFilter,
@@ -259,10 +271,10 @@ function DimensionsPanel({
259
271
 
260
272
  // Block Gap
261
273
  const showGapControl = useHasGap(settings);
262
- const gapValue = decodeValue(inheritedValue?.spacing?.blockGap);
263
- const gapValues = splitGapValue(gapValue);
264
274
  const gapSides = Array.isArray(settings?.spacing?.blockGap) ? settings?.spacing?.blockGap : settings?.spacing?.blockGap?.sides;
265
275
  const isAxialGap = gapSides && gapSides.some(side => AXIAL_SIDES.includes(side));
276
+ const gapValue = decodeValue(inheritedValue?.spacing?.blockGap);
277
+ const gapValues = splitGapValue(gapValue, isAxialGap);
266
278
  const setGapValue = newGapValue => {
267
279
  onChange((0, _object.setImmutably)(value, ['spacing', 'blockGap'], newGapValue));
268
280
  };