@wordpress/block-editor 15.7.1-next.2f1c7c01b.0 → 15.8.1-next.16d95556a.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 (195) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-card/index.js +76 -34
  3. package/build/components/block-card/index.js.map +2 -2
  4. package/build/components/block-inspector/edit-contents.js +72 -0
  5. package/build/components/block-inspector/edit-contents.js.map +7 -0
  6. package/build/components/block-inspector/index.js +32 -9
  7. package/build/components/block-inspector/index.js.map +3 -3
  8. package/build/components/block-list/index.js +9 -9
  9. package/build/components/block-list/index.js.map +2 -2
  10. package/build/components/block-switcher/index.js +24 -123
  11. package/build/components/block-switcher/index.js.map +3 -3
  12. package/build/components/block-toolbar/block-toolbar-icon.js +175 -0
  13. package/build/components/block-toolbar/block-toolbar-icon.js.map +7 -0
  14. package/build/components/block-toolbar/index.js +51 -53
  15. package/build/components/block-toolbar/index.js.map +3 -3
  16. package/build/components/block-toolbar/pattern-overrides-dropdown.js +93 -0
  17. package/build/components/block-toolbar/pattern-overrides-dropdown.js.map +7 -0
  18. package/build/components/block-tools/index.js +10 -3
  19. package/build/components/block-tools/index.js.map +2 -2
  20. package/build/components/border-radius-control/utils.js +7 -3
  21. package/build/components/border-radius-control/utils.js.map +2 -2
  22. package/build/components/content-lock/modify-content-lock-menu-item.js +3 -3
  23. package/build/components/content-lock/modify-content-lock-menu-item.js.map +2 -2
  24. package/build/components/global-styles/border-panel.js +11 -7
  25. package/build/components/global-styles/border-panel.js.map +2 -2
  26. package/build/components/global-styles/color-panel.js +35 -27
  27. package/build/components/global-styles/color-panel.js.map +2 -2
  28. package/build/components/global-styles/typography-panel.js +19 -12
  29. package/build/components/global-styles/typography-panel.js.map +2 -2
  30. package/build/components/inserter/media-tab/media-tab.js +2 -1
  31. package/build/components/inserter/media-tab/media-tab.js.map +2 -2
  32. package/build/components/inspector-controls-tabs/index.js +2 -1
  33. package/build/components/inspector-controls-tabs/index.js.map +2 -2
  34. package/build/components/inspector-controls-tabs/styles-tab.js +55 -1
  35. package/build/components/inspector-controls-tabs/styles-tab.js.map +3 -3
  36. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +1 -1
  37. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +2 -2
  38. package/build/components/keyboard-shortcuts/index.js +8 -0
  39. package/build/components/keyboard-shortcuts/index.js.map +2 -2
  40. package/build/components/rich-text/format-edit.js +9 -1
  41. package/build/components/rich-text/format-edit.js.map +2 -2
  42. package/build/components/rich-text/index.js +1 -0
  43. package/build/components/rich-text/index.js.map +2 -2
  44. package/build/hooks/border.js +10 -5
  45. package/build/hooks/border.js.map +3 -3
  46. package/build/hooks/color.js +31 -9
  47. package/build/hooks/color.js.map +3 -3
  48. package/build/hooks/content-lock-ui.js +4 -5
  49. package/build/hooks/content-lock-ui.js.map +2 -2
  50. package/build/hooks/dimensions.js +9 -4
  51. package/build/hooks/dimensions.js.map +2 -2
  52. package/build/hooks/fit-text.js +19 -75
  53. package/build/hooks/fit-text.js.map +3 -3
  54. package/build/hooks/font-size.js +5 -2
  55. package/build/hooks/font-size.js.map +2 -2
  56. package/build/hooks/layout.js +4 -1
  57. package/build/hooks/layout.js.map +2 -2
  58. package/build/hooks/spacing-visualizer.js +5 -0
  59. package/build/hooks/spacing-visualizer.js.map +2 -2
  60. package/build/hooks/typography.js +23 -14
  61. package/build/hooks/typography.js.map +3 -3
  62. package/build/store/private-selectors.js +21 -1
  63. package/build/store/private-selectors.js.map +2 -2
  64. package/build/store/reducer.js +4 -0
  65. package/build/store/reducer.js.map +2 -2
  66. package/build/store/selectors.js +12 -3
  67. package/build/store/selectors.js.map +2 -2
  68. package/build/utils/fit-text-frontend.js +1 -0
  69. package/build/utils/fit-text-frontend.js.map +2 -2
  70. package/build/utils/fit-text-utils.js +1 -1
  71. package/build/utils/fit-text-utils.js.map +1 -1
  72. package/build-module/components/block-card/index.js +82 -32
  73. package/build-module/components/block-card/index.js.map +2 -2
  74. package/build-module/components/block-inspector/edit-contents.js +51 -0
  75. package/build-module/components/block-inspector/edit-contents.js.map +7 -0
  76. package/build-module/components/block-inspector/index.js +32 -9
  77. package/build-module/components/block-inspector/index.js.map +2 -2
  78. package/build-module/components/block-list/index.js +11 -11
  79. package/build-module/components/block-list/index.js.map +2 -2
  80. package/build-module/components/block-switcher/index.js +24 -124
  81. package/build-module/components/block-switcher/index.js.map +2 -2
  82. package/build-module/components/block-toolbar/block-toolbar-icon.js +144 -0
  83. package/build-module/components/block-toolbar/block-toolbar-icon.js.map +7 -0
  84. package/build-module/components/block-toolbar/index.js +51 -53
  85. package/build-module/components/block-toolbar/index.js.map +2 -2
  86. package/build-module/components/block-toolbar/pattern-overrides-dropdown.js +76 -0
  87. package/build-module/components/block-toolbar/pattern-overrides-dropdown.js.map +7 -0
  88. package/build-module/components/block-tools/index.js +10 -3
  89. package/build-module/components/block-tools/index.js.map +2 -2
  90. package/build-module/components/border-radius-control/utils.js +7 -3
  91. package/build-module/components/border-radius-control/utils.js.map +2 -2
  92. package/build-module/components/content-lock/modify-content-lock-menu-item.js +3 -3
  93. package/build-module/components/content-lock/modify-content-lock-menu-item.js.map +2 -2
  94. package/build-module/components/global-styles/border-panel.js +11 -7
  95. package/build-module/components/global-styles/border-panel.js.map +2 -2
  96. package/build-module/components/global-styles/color-panel.js +34 -27
  97. package/build-module/components/global-styles/color-panel.js.map +2 -2
  98. package/build-module/components/global-styles/typography-panel.js +21 -13
  99. package/build-module/components/global-styles/typography-panel.js.map +2 -2
  100. package/build-module/components/inserter/media-tab/media-tab.js +2 -1
  101. package/build-module/components/inserter/media-tab/media-tab.js.map +2 -2
  102. package/build-module/components/inspector-controls-tabs/index.js +2 -1
  103. package/build-module/components/inspector-controls-tabs/index.js.map +2 -2
  104. package/build-module/components/inspector-controls-tabs/styles-tab.js +55 -1
  105. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +2 -2
  106. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +1 -1
  107. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +2 -2
  108. package/build-module/components/keyboard-shortcuts/index.js +8 -0
  109. package/build-module/components/keyboard-shortcuts/index.js.map +2 -2
  110. package/build-module/components/rich-text/format-edit.js +9 -1
  111. package/build-module/components/rich-text/format-edit.js.map +2 -2
  112. package/build-module/components/rich-text/index.js +1 -0
  113. package/build-module/components/rich-text/index.js.map +2 -2
  114. package/build-module/hooks/border.js +10 -5
  115. package/build-module/hooks/border.js.map +3 -3
  116. package/build-module/hooks/color.js +31 -9
  117. package/build-module/hooks/color.js.map +3 -3
  118. package/build-module/hooks/content-lock-ui.js +4 -5
  119. package/build-module/hooks/content-lock-ui.js.map +2 -2
  120. package/build-module/hooks/dimensions.js +9 -4
  121. package/build-module/hooks/dimensions.js.map +2 -2
  122. package/build-module/hooks/fit-text.js +18 -66
  123. package/build-module/hooks/fit-text.js.map +2 -2
  124. package/build-module/hooks/font-size.js +5 -2
  125. package/build-module/hooks/font-size.js.map +2 -2
  126. package/build-module/hooks/layout.js +4 -1
  127. package/build-module/hooks/layout.js.map +2 -2
  128. package/build-module/hooks/spacing-visualizer.js +5 -0
  129. package/build-module/hooks/spacing-visualizer.js.map +2 -2
  130. package/build-module/hooks/typography.js +23 -14
  131. package/build-module/hooks/typography.js.map +3 -3
  132. package/build-module/store/private-selectors.js +20 -1
  133. package/build-module/store/private-selectors.js.map +2 -2
  134. package/build-module/store/reducer.js +4 -0
  135. package/build-module/store/reducer.js.map +2 -2
  136. package/build-module/store/selectors.js +12 -3
  137. package/build-module/store/selectors.js.map +2 -2
  138. package/build-module/utils/fit-text-frontend.js +1 -0
  139. package/build-module/utils/fit-text-frontend.js.map +2 -2
  140. package/build-module/utils/fit-text-utils.js +1 -1
  141. package/build-module/utils/fit-text-utils.js.map +1 -1
  142. package/build-style/style-rtl.css +31 -71
  143. package/build-style/style.css +31 -71
  144. package/package.json +37 -37
  145. package/src/components/block-card/index.js +95 -38
  146. package/src/components/block-card/style.scss +17 -1
  147. package/src/components/block-inspector/edit-contents.js +64 -0
  148. package/src/components/block-inspector/index.js +35 -13
  149. package/src/components/block-inspector/style.scss +6 -3
  150. package/src/components/block-list/index.js +11 -9
  151. package/src/components/block-switcher/block-transformations-menu.native.js +0 -1
  152. package/src/components/block-switcher/index.js +51 -180
  153. package/src/components/block-switcher/style.scss +0 -70
  154. package/src/components/block-switcher/test/index.js +17 -18
  155. package/src/components/block-toolbar/block-toolbar-icon.js +173 -0
  156. package/src/components/block-toolbar/index.js +50 -52
  157. package/src/components/block-toolbar/pattern-overrides-dropdown.js +99 -0
  158. package/src/components/block-toolbar/style.scss +21 -21
  159. package/src/components/block-toolbar/test/__snapshots__/block-toolbar-menu.native.js.snap +6 -4
  160. package/src/components/block-toolbar/test/block-toolbar-icon.js +182 -0
  161. package/src/components/block-toolbar/test/block-toolbar-menu.native.js +2 -2
  162. package/src/components/block-tools/index.js +11 -1
  163. package/src/components/border-radius-control/test/utils.js +90 -0
  164. package/src/components/border-radius-control/utils.js +7 -3
  165. package/src/components/content-lock/modify-content-lock-menu-item.js +9 -3
  166. package/src/components/global-styles/border-panel.js +11 -7
  167. package/src/components/global-styles/color-panel.js +32 -26
  168. package/src/components/global-styles/typography-panel.js +14 -1
  169. package/src/components/inserter/media-tab/media-tab.js +7 -1
  170. package/src/components/inspector-controls-tabs/index.js +1 -0
  171. package/src/components/inspector-controls-tabs/styles-tab.js +58 -0
  172. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +5 -1
  173. package/src/components/keyboard-shortcuts/index.js +9 -0
  174. package/src/components/rich-text/format-edit.js +9 -1
  175. package/src/components/rich-text/index.js +1 -0
  176. package/src/hooks/border.js +12 -6
  177. package/src/hooks/color.js +40 -13
  178. package/src/hooks/content-lock-ui.js +9 -6
  179. package/src/hooks/dimensions.js +25 -17
  180. package/src/hooks/fit-text.js +23 -84
  181. package/src/hooks/font-size.js +7 -2
  182. package/src/hooks/layout.js +11 -7
  183. package/src/hooks/spacing-visualizer.js +9 -1
  184. package/src/hooks/typography.js +24 -18
  185. package/src/store/private-selectors.js +26 -1
  186. package/src/store/reducer.js +6 -0
  187. package/src/store/selectors.js +24 -3
  188. package/src/utils/fit-text-frontend.js +1 -0
  189. package/src/utils/fit-text-utils.js +1 -1
  190. package/tsconfig.tsbuildinfo +1 -1
  191. package/build/components/block-inspector/edit-contents-button.js +0 -61
  192. package/build/components/block-inspector/edit-contents-button.js.map +0 -7
  193. package/build-module/components/block-inspector/edit-contents-button.js +0 -40
  194. package/build-module/components/block-inspector/edit-contents-button.js.map +0 -7
  195. package/src/components/block-inspector/edit-contents-button.js +0 -46
@@ -13,7 +13,6 @@ import {
13
13
  import { ToolbarGroup } from "@wordpress/components";
14
14
  import BlockMover from "../block-mover";
15
15
  import BlockParentSelector from "../block-parent-selector";
16
- import BlockSwitcher from "../block-switcher";
17
16
  import BlockControls from "../block-controls";
18
17
  import __unstableBlockToolbarLastItem from "./block-toolbar-last-item";
19
18
  import BlockSettingsMenu from "../block-settings-menu";
@@ -29,6 +28,7 @@ import { useHasBlockToolbar } from "./use-has-block-toolbar";
29
28
  import ChangeDesign from "./change-design";
30
29
  import SwitchSectionStyle from "./switch-section-style";
31
30
  import { unlock } from "../../lock-unlock";
31
+ import BlockToolbarIcon from "./block-toolbar-icon";
32
32
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
33
33
  function PrivateBlockToolbar({
34
34
  hideDragHandle,
@@ -46,7 +46,7 @@ function PrivateBlockToolbar({
46
46
  shouldShowVisualToolbar,
47
47
  showParentSelector,
48
48
  isUsingBindings,
49
- hasParentPattern,
49
+ isSectionContainer,
50
50
  hasContentOnlyLocking,
51
51
  showShuffleButton,
52
52
  showSlots,
@@ -63,7 +63,6 @@ function PrivateBlockToolbar({
63
63
  isBlockValid,
64
64
  getBlockEditingMode,
65
65
  getBlockAttributes,
66
- getBlockParentsByBlockName,
67
66
  getTemplateLock,
68
67
  getParentSectionBlock,
69
68
  isZoomOut,
@@ -88,14 +87,12 @@ function PrivateBlockToolbar({
88
87
  const _isUsingBindings = selectedBlockClientIds.every(
89
88
  (clientId) => !!getBlockAttributes(clientId)?.metadata?.bindings
90
89
  );
91
- const _hasParentPattern = selectedBlockClientIds.every(
92
- (clientId) => getBlockParentsByBlockName(clientId, "core/block", true).length > 0
93
- );
94
90
  const _hasTemplateLock = selectedBlockClientIds.some(
95
91
  (id) => getTemplateLock(id) === "contentOnly"
96
92
  );
97
93
  const _isZoomOut = isZoomOut();
98
- const _showSwitchSectionStyleButton = window?.__experimentalContentOnlyPatternInsertion && (_isZoomOut || isSectionBlock(selectedBlockClientId));
94
+ const _isSectionBlock = isSectionBlock(selectedBlockClientId);
95
+ const _showSwitchSectionStyleButton = window?.__experimentalContentOnlyPatternInsertion && (_isZoomOut || _isSectionBlock);
99
96
  return {
100
97
  blockClientId: selectedBlockClientId,
101
98
  blockClientIds: selectedBlockClientIds,
@@ -109,7 +106,7 @@ function PrivateBlockToolbar({
109
106
  true
110
107
  ) && selectedBlockClientIds.length === 1,
111
108
  isUsingBindings: _isUsingBindings,
112
- hasParentPattern: _hasParentPattern,
109
+ isSectionContainer: _isSectionBlock,
113
110
  hasContentOnlyLocking: _hasTemplateLock,
114
111
  showShuffleButton: _isZoomOut,
115
112
  showSlots: !_isZoomOut,
@@ -150,61 +147,62 @@ function PrivateBlockToolbar({
150
147
  __experimentalOnIndexChange,
151
148
  children: /* @__PURE__ */ jsxs("div", { ref: toolbarWrapperRef, className: innerClasses, children: [
152
149
  showParentSelector && !isMultiToolbar && isLargeViewport && /* @__PURE__ */ jsx(BlockParentSelector, {}),
153
- (shouldShowVisualToolbar || isMultiToolbar) && !hasParentPattern && /* @__PURE__ */ jsx(
154
- "div",
155
- {
156
- ref: nodeRef,
157
- ...showHoveredOrFocusedGestures,
158
- children: /* @__PURE__ */ jsxs(ToolbarGroup, { className: "block-editor-block-toolbar__block-controls", children: [
159
- /* @__PURE__ */ jsx(BlockSwitcher, { clientIds: blockClientIds }),
160
- isDefaultEditingMode && showBlockVisibilityButton && /* @__PURE__ */ jsx(
161
- BlockVisibilityToolbar,
162
- {
163
- clientIds: blockClientIds
164
- }
165
- ),
166
- !isMultiToolbar && isDefaultEditingMode && showLockButtons && /* @__PURE__ */ jsx(
167
- BlockLockToolbar,
168
- {
169
- clientId: blockClientId
170
- }
171
- ),
172
- /* @__PURE__ */ jsx(
173
- BlockMover,
174
- {
175
- clientIds: blockClientIds,
176
- hideDragHandle
177
- }
178
- )
179
- ] })
180
- }
181
- ),
182
- !hasContentOnlyLocking && shouldShowVisualToolbar && isMultiToolbar && showGroupButtons && /* @__PURE__ */ jsx(BlockGroupToolbar, {}),
183
- showShuffleButton && /* @__PURE__ */ jsx(ChangeDesign, { clientId: blockClientIds[0] }),
184
- showSwitchSectionStyleButton && /* @__PURE__ */ jsx(SwitchSectionStyle, { clientId: blockClientIds[0] }),
185
- shouldShowVisualToolbar && showSlots && /* @__PURE__ */ jsxs(Fragment, { children: [
150
+ (shouldShowVisualToolbar || isMultiToolbar) && /* @__PURE__ */ jsx("div", { ref: nodeRef, ...showHoveredOrFocusedGestures, children: /* @__PURE__ */ jsxs(ToolbarGroup, { className: "block-editor-block-toolbar__block-controls", children: [
186
151
  /* @__PURE__ */ jsx(
187
- BlockControls.Slot,
152
+ BlockToolbarIcon,
188
153
  {
189
- group: "parent",
190
- className: "block-editor-block-toolbar__slot"
154
+ clientIds: blockClientIds,
155
+ isSynced
191
156
  }
192
157
  ),
193
- /* @__PURE__ */ jsx(
194
- BlockControls.Slot,
158
+ isDefaultEditingMode && showBlockVisibilityButton && /* @__PURE__ */ jsx(
159
+ BlockVisibilityToolbar,
195
160
  {
196
- group: "block",
197
- className: "block-editor-block-toolbar__slot"
161
+ clientIds: blockClientIds
198
162
  }
199
163
  ),
200
- /* @__PURE__ */ jsx(BlockControls.Slot, { className: "block-editor-block-toolbar__slot" }),
201
- /* @__PURE__ */ jsx(
202
- BlockControls.Slot,
164
+ !isMultiToolbar && isDefaultEditingMode && showLockButtons && /* @__PURE__ */ jsx(
165
+ BlockLockToolbar,
203
166
  {
204
- group: "inline",
205
- className: "block-editor-block-toolbar__slot"
167
+ clientId: blockClientId
206
168
  }
207
169
  ),
170
+ /* @__PURE__ */ jsx(
171
+ BlockMover,
172
+ {
173
+ clientIds: blockClientIds,
174
+ hideDragHandle
175
+ }
176
+ )
177
+ ] }) }),
178
+ !hasContentOnlyLocking && shouldShowVisualToolbar && isMultiToolbar && showGroupButtons && /* @__PURE__ */ jsx(BlockGroupToolbar, {}),
179
+ showShuffleButton && /* @__PURE__ */ jsx(ChangeDesign, { clientId: blockClientIds[0] }),
180
+ showSwitchSectionStyleButton && /* @__PURE__ */ jsx(SwitchSectionStyle, { clientId: blockClientIds[0] }),
181
+ shouldShowVisualToolbar && showSlots && /* @__PURE__ */ jsxs(Fragment, { children: [
182
+ !isSectionContainer && /* @__PURE__ */ jsxs(Fragment, { children: [
183
+ /* @__PURE__ */ jsx(
184
+ BlockControls.Slot,
185
+ {
186
+ group: "parent",
187
+ className: "block-editor-block-toolbar__slot"
188
+ }
189
+ ),
190
+ /* @__PURE__ */ jsx(
191
+ BlockControls.Slot,
192
+ {
193
+ group: "block",
194
+ className: "block-editor-block-toolbar__slot"
195
+ }
196
+ ),
197
+ /* @__PURE__ */ jsx(BlockControls.Slot, { className: "block-editor-block-toolbar__slot" }),
198
+ /* @__PURE__ */ jsx(
199
+ BlockControls.Slot,
200
+ {
201
+ group: "inline",
202
+ className: "block-editor-block-toolbar__slot"
203
+ }
204
+ )
205
+ ] }),
208
206
  /* @__PURE__ */ jsx(
209
207
  BlockControls.Slot,
210
208
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/block-toolbar/index.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tgetBlockType,\n\thasBlockSupport,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { ToolbarGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockMover from '../block-mover';\nimport BlockParentSelector from '../block-parent-selector';\nimport BlockSwitcher from '../block-switcher';\nimport BlockControls from '../block-controls';\nimport __unstableBlockToolbarLastItem from './block-toolbar-last-item';\nimport BlockSettingsMenu from '../block-settings-menu';\nimport { BlockLockToolbar } from '../block-lock';\nimport { BlockVisibilityToolbar } from '../block-visibility';\nimport { BlockGroupToolbar } from '../convert-to-group-buttons';\nimport BlockEditVisuallyButton from '../block-edit-visually-button';\nimport { useShowHoveredOrFocusedGestures } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport __unstableBlockNameContext from './block-name-context';\nimport NavigableToolbar from '../navigable-toolbar';\nimport { useHasBlockToolbar } from './use-has-block-toolbar';\nimport ChangeDesign from './change-design';\nimport SwitchSectionStyle from './switch-section-style';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {boolean} props.focusOnMount Focus the toolbar when mounted.\n * @param {number} props.__experimentalInitialIndex The initial index of the toolbar item to focus.\n * @param {Function} props.__experimentalOnIndexChange Callback function to be called when the index of the focused toolbar item changes.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport function PrivateBlockToolbar( {\n\thideDragHandle,\n\tfocusOnMount,\n\t__experimentalInitialIndex,\n\t__experimentalOnIndexChange,\n\tvariant = 'unstyled',\n} ) {\n\tconst {\n\t\tblockClientId,\n\t\tblockClientIds,\n\t\tisDefaultEditingMode,\n\t\tblockType,\n\t\ttoolbarKey,\n\t\tshouldShowVisualToolbar,\n\t\tshowParentSelector,\n\t\tisUsingBindings,\n\t\thasParentPattern,\n\t\thasContentOnlyLocking,\n\t\tshowShuffleButton,\n\t\tshowSlots,\n\t\tshowGroupButtons,\n\t\tshowLockButtons,\n\t\tshowBlockVisibilityButton,\n\t\tshowSwitchSectionStyleButton,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockName,\n\t\t\tgetBlockMode,\n\t\t\tgetBlockParents,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisBlockValid,\n\t\t\tgetBlockEditingMode,\n\t\t\tgetBlockAttributes,\n\t\t\tgetBlockParentsByBlockName,\n\t\t\tgetTemplateLock,\n\t\t\tgetParentSectionBlock,\n\t\t\tisZoomOut,\n\t\t\tisSectionBlock,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst selectedBlockClientId = selectedBlockClientIds[ 0 ];\n\t\tconst parents = getBlockParents( selectedBlockClientId );\n\t\tconst parentSection = getParentSectionBlock( selectedBlockClientId );\n\t\tconst parentClientId = parentSection ?? parents[ parents.length - 1 ];\n\t\tconst parentBlockName = getBlockName( parentClientId );\n\t\tconst parentBlockType = getBlockType( parentBlockName );\n\t\tconst editingMode = getBlockEditingMode( selectedBlockClientId );\n\t\tconst _isDefaultEditingMode = editingMode === 'default';\n\t\tconst _blockName = getBlockName( selectedBlockClientId );\n\t\tconst isValid = selectedBlockClientIds.every( ( id ) =>\n\t\t\tisBlockValid( id )\n\t\t);\n\t\tconst isVisual = selectedBlockClientIds.every(\n\t\t\t( id ) => getBlockMode( id ) === 'visual'\n\t\t);\n\t\tconst _isUsingBindings = selectedBlockClientIds.every(\n\t\t\t( clientId ) =>\n\t\t\t\t!! getBlockAttributes( clientId )?.metadata?.bindings\n\t\t);\n\n\t\tconst _hasParentPattern = selectedBlockClientIds.every(\n\t\t\t( clientId ) =>\n\t\t\t\tgetBlockParentsByBlockName( clientId, 'core/block', true )\n\t\t\t\t\t.length > 0\n\t\t);\n\n\t\t// If one or more selected blocks are locked, do not show the BlockGroupToolbar.\n\t\tconst _hasTemplateLock = selectedBlockClientIds.some(\n\t\t\t( id ) => getTemplateLock( id ) === 'contentOnly'\n\t\t);\n\n\t\tconst _isZoomOut = isZoomOut();\n\n\t\t// The switch style button appears more prominently with the\n\t\t// content only pattern experiment.\n\t\tconst _showSwitchSectionStyleButton =\n\t\t\twindow?.__experimentalContentOnlyPatternInsertion &&\n\t\t\t( _isZoomOut || isSectionBlock( selectedBlockClientId ) );\n\n\t\treturn {\n\t\t\tblockClientId: selectedBlockClientId,\n\t\t\tblockClientIds: selectedBlockClientIds,\n\t\t\tisDefaultEditingMode: _isDefaultEditingMode,\n\t\t\tblockType: selectedBlockClientId && getBlockType( _blockName ),\n\t\t\tshouldShowVisualToolbar: isValid && isVisual,\n\t\t\ttoolbarKey: `${ selectedBlockClientId }${ parentClientId }`,\n\t\t\tshowParentSelector:\n\t\t\t\t! _isZoomOut &&\n\t\t\t\tparentBlockType &&\n\t\t\t\teditingMode !== 'contentOnly' &&\n\t\t\t\tgetBlockEditingMode( parentClientId ) !== 'disabled' &&\n\t\t\t\thasBlockSupport(\n\t\t\t\t\tparentBlockType,\n\t\t\t\t\t'__experimentalParentSelector',\n\t\t\t\t\ttrue\n\t\t\t\t) &&\n\t\t\t\tselectedBlockClientIds.length === 1,\n\t\t\tisUsingBindings: _isUsingBindings,\n\t\t\thasParentPattern: _hasParentPattern,\n\t\t\thasContentOnlyLocking: _hasTemplateLock,\n\t\t\tshowShuffleButton: _isZoomOut,\n\t\t\tshowSlots: ! _isZoomOut,\n\t\t\tshowGroupButtons: ! _isZoomOut,\n\t\t\tshowLockButtons: ! _isZoomOut,\n\t\t\tshowBlockVisibilityButton: ! _isZoomOut,\n\t\t\tshowSwitchSectionStyleButton: _showSwitchSectionStyleButton,\n\t\t};\n\t}, [] );\n\n\tconst toolbarWrapperRef = useRef( null );\n\n\t// Handles highlighting the current block outline on hover or focus of the\n\t// block type toolbar area.\n\tconst nodeRef = useRef();\n\tconst showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures( {\n\t\tref: nodeRef,\n\t} );\n\n\tconst isLargeViewport = ! useViewportMatch( 'medium', '<' );\n\n\tconst hasBlockToolbar = useHasBlockToolbar();\n\tif ( ! hasBlockToolbar ) {\n\t\treturn null;\n\t}\n\n\tconst isMultiToolbar = blockClientIds.length > 1;\n\tconst isSynced =\n\t\tisReusableBlock( blockType ) || isTemplatePart( blockType );\n\n\t// Shifts the toolbar to make room for the parent block selector.\n\tconst classes = clsx( 'block-editor-block-contextual-toolbar', {\n\t\t'has-parent': showParentSelector,\n\t} );\n\n\tconst innerClasses = clsx( 'block-editor-block-toolbar', {\n\t\t'is-synced': isSynced,\n\t\t'is-connected': isUsingBindings,\n\t} );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tfocusEditorOnEscape\n\t\t\tclassName={ classes }\n\t\t\t/* translators: accessibility text for the block toolbar */\n\t\t\taria-label={ __( 'Block tools' ) }\n\t\t\t// The variant is applied as \"toolbar\" when undefined, which is the black border style of the dropdown from the toolbar popover.\n\t\t\tvariant={ variant === 'toolbar' ? undefined : variant }\n\t\t\tfocusOnMount={ focusOnMount }\n\t\t\t__experimentalInitialIndex={ __experimentalInitialIndex }\n\t\t\t__experimentalOnIndexChange={ __experimentalOnIndexChange }\n\t\t\t// Resets the index whenever the active block changes so\n\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\tkey={ toolbarKey }\n\t\t>\n\t\t\t<div ref={ toolbarWrapperRef } className={ innerClasses }>\n\t\t\t\t{ showParentSelector && ! isMultiToolbar && isLargeViewport && (\n\t\t\t\t\t<BlockParentSelector />\n\t\t\t\t) }\n\t\t\t\t{ ( shouldShowVisualToolbar || isMultiToolbar ) &&\n\t\t\t\t\t! hasParentPattern && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tref={ nodeRef }\n\t\t\t\t\t\t\t{ ...showHoveredOrFocusedGestures }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToolbarGroup className=\"block-editor-block-toolbar__block-controls\">\n\t\t\t\t\t\t\t\t<BlockSwitcher clientIds={ blockClientIds } />\n\t\t\t\t\t\t\t\t{ isDefaultEditingMode &&\n\t\t\t\t\t\t\t\t\tshowBlockVisibilityButton && (\n\t\t\t\t\t\t\t\t\t\t<BlockVisibilityToolbar\n\t\t\t\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ ! isMultiToolbar &&\n\t\t\t\t\t\t\t\t\tisDefaultEditingMode &&\n\t\t\t\t\t\t\t\t\tshowLockButtons && (\n\t\t\t\t\t\t\t\t\t\t<BlockLockToolbar\n\t\t\t\t\t\t\t\t\t\t\tclientId={ blockClientId }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<BlockMover\n\t\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\n\t\t\t\t\t\t\t\t\thideDragHandle={ hideDragHandle }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t{ ! hasContentOnlyLocking &&\n\t\t\t\t\tshouldShowVisualToolbar &&\n\t\t\t\t\tisMultiToolbar &&\n\t\t\t\t\tshowGroupButtons && <BlockGroupToolbar /> }\n\t\t\t\t{ showShuffleButton && (\n\t\t\t\t\t<ChangeDesign clientId={ blockClientIds[ 0 ] } />\n\t\t\t\t) }\n\t\t\t\t{ showSwitchSectionStyleButton && (\n\t\t\t\t\t<SwitchSectionStyle clientId={ blockClientIds[ 0 ] } />\n\t\t\t\t) }\n\t\t\t\t{ shouldShowVisualToolbar && showSlots && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"parent\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"block\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot className=\"block-editor-block-toolbar__slot\" />\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"inline\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"other\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<__unstableBlockNameContext.Provider\n\t\t\t\t\t\t\tvalue={ blockType?.name }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<__unstableBlockToolbarLastItem.Slot />\n\t\t\t\t\t\t</__unstableBlockNameContext.Provider>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEditVisuallyButton clientIds={ blockClientIds } />\n\t\t\t\t<BlockSettingsMenu clientIds={ blockClientIds } />\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport default function BlockToolbar( { hideDragHandle, variant } ) {\n\treturn (\n\t\t<PrivateBlockToolbar\n\t\t\thideDragHandle={ hideDragHandle }\n\t\t\tvariant={ variant }\n\t\t\tfocusOnMount={ undefined }\n\t\t\t__experimentalInitialIndex={ undefined }\n\t\t\t__experimentalOnIndexChange={ undefined }\n\t\t/>\n\t);\n}\n"],
5
- "mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AACvB,SAAS,wBAAwB;AACjC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,oBAAoB;AAK7B,OAAO,gBAAgB;AACvB,OAAO,yBAAyB;AAChC,OAAO,mBAAmB;AAC1B,OAAO,mBAAmB;AAC1B,OAAO,oCAAoC;AAC3C,OAAO,uBAAuB;AAC9B,SAAS,wBAAwB;AACjC,SAAS,8BAA8B;AACvC,SAAS,yBAAyB;AAClC,OAAO,6BAA6B;AACpC,SAAS,uCAAuC;AAChD,SAAS,SAAS,wBAAwB;AAC1C,OAAO,gCAAgC;AACvC,OAAO,sBAAsB;AAC7B,SAAS,0BAA0B;AACnC,OAAO,kBAAkB;AACzB,OAAO,wBAAwB;AAC/B,SAAS,cAAc;AA0KlB,SAyCA,UAzCA,KAQE,YARF;AA5JE,SAAS,oBAAqB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AACX,GAAI;AACH,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI,UAAW,CAAE,WAAY;AAC5B,UAAM;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD,IAAI,OAAQ,OAAQ,gBAAiB,CAAE;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B;AAAA,MAC7B,6BAA8B;AAAA;AAAA,EAC/B;AAEF;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tgetBlockType,\n\thasBlockSupport,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { ToolbarGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockMover from '../block-mover';\nimport BlockParentSelector from '../block-parent-selector';\nimport BlockControls from '../block-controls';\nimport __unstableBlockToolbarLastItem from './block-toolbar-last-item';\nimport BlockSettingsMenu from '../block-settings-menu';\nimport { BlockLockToolbar } from '../block-lock';\nimport { BlockVisibilityToolbar } from '../block-visibility';\nimport { BlockGroupToolbar } from '../convert-to-group-buttons';\nimport BlockEditVisuallyButton from '../block-edit-visually-button';\nimport { useShowHoveredOrFocusedGestures } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport __unstableBlockNameContext from './block-name-context';\nimport NavigableToolbar from '../navigable-toolbar';\nimport { useHasBlockToolbar } from './use-has-block-toolbar';\nimport ChangeDesign from './change-design';\nimport SwitchSectionStyle from './switch-section-style';\nimport { unlock } from '../../lock-unlock';\nimport BlockToolbarIcon from './block-toolbar-icon';\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {boolean} props.focusOnMount Focus the toolbar when mounted.\n * @param {number} props.__experimentalInitialIndex The initial index of the toolbar item to focus.\n * @param {Function} props.__experimentalOnIndexChange Callback function to be called when the index of the focused toolbar item changes.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport function PrivateBlockToolbar( {\n\thideDragHandle,\n\tfocusOnMount,\n\t__experimentalInitialIndex,\n\t__experimentalOnIndexChange,\n\tvariant = 'unstyled',\n} ) {\n\tconst {\n\t\tblockClientId,\n\t\tblockClientIds,\n\t\tisDefaultEditingMode,\n\t\tblockType,\n\t\ttoolbarKey,\n\t\tshouldShowVisualToolbar,\n\t\tshowParentSelector,\n\t\tisUsingBindings,\n\t\tisSectionContainer,\n\t\thasContentOnlyLocking,\n\t\tshowShuffleButton,\n\t\tshowSlots,\n\t\tshowGroupButtons,\n\t\tshowLockButtons,\n\t\tshowBlockVisibilityButton,\n\t\tshowSwitchSectionStyleButton,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockName,\n\t\t\tgetBlockMode,\n\t\t\tgetBlockParents,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisBlockValid,\n\t\t\tgetBlockEditingMode,\n\t\t\tgetBlockAttributes,\n\t\t\tgetTemplateLock,\n\t\t\tgetParentSectionBlock,\n\t\t\tisZoomOut,\n\t\t\tisSectionBlock,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst selectedBlockClientId = selectedBlockClientIds[ 0 ];\n\t\tconst parents = getBlockParents( selectedBlockClientId );\n\t\tconst parentSection = getParentSectionBlock( selectedBlockClientId );\n\t\tconst parentClientId = parentSection ?? parents[ parents.length - 1 ];\n\t\tconst parentBlockName = getBlockName( parentClientId );\n\t\tconst parentBlockType = getBlockType( parentBlockName );\n\t\tconst editingMode = getBlockEditingMode( selectedBlockClientId );\n\t\tconst _isDefaultEditingMode = editingMode === 'default';\n\t\tconst _blockName = getBlockName( selectedBlockClientId );\n\t\tconst isValid = selectedBlockClientIds.every( ( id ) =>\n\t\t\tisBlockValid( id )\n\t\t);\n\t\tconst isVisual = selectedBlockClientIds.every(\n\t\t\t( id ) => getBlockMode( id ) === 'visual'\n\t\t);\n\t\tconst _isUsingBindings = selectedBlockClientIds.every(\n\t\t\t( clientId ) =>\n\t\t\t\t!! getBlockAttributes( clientId )?.metadata?.bindings\n\t\t);\n\n\t\t// If one or more selected blocks are locked, do not show the BlockGroupToolbar.\n\t\tconst _hasTemplateLock = selectedBlockClientIds.some(\n\t\t\t( id ) => getTemplateLock( id ) === 'contentOnly'\n\t\t);\n\n\t\tconst _isZoomOut = isZoomOut();\n\n\t\tconst _isSectionBlock = isSectionBlock( selectedBlockClientId );\n\n\t\t// The switch style button appears more prominently with the\n\t\t// content only pattern experiment.\n\t\tconst _showSwitchSectionStyleButton =\n\t\t\twindow?.__experimentalContentOnlyPatternInsertion &&\n\t\t\t( _isZoomOut || _isSectionBlock );\n\n\t\treturn {\n\t\t\tblockClientId: selectedBlockClientId,\n\t\t\tblockClientIds: selectedBlockClientIds,\n\t\t\tisDefaultEditingMode: _isDefaultEditingMode,\n\t\t\tblockType: selectedBlockClientId && getBlockType( _blockName ),\n\t\t\tshouldShowVisualToolbar: isValid && isVisual,\n\t\t\ttoolbarKey: `${ selectedBlockClientId }${ parentClientId }`,\n\t\t\tshowParentSelector:\n\t\t\t\t! _isZoomOut &&\n\t\t\t\tparentBlockType &&\n\t\t\t\teditingMode !== 'contentOnly' &&\n\t\t\t\tgetBlockEditingMode( parentClientId ) !== 'disabled' &&\n\t\t\t\thasBlockSupport(\n\t\t\t\t\tparentBlockType,\n\t\t\t\t\t'__experimentalParentSelector',\n\t\t\t\t\ttrue\n\t\t\t\t) &&\n\t\t\t\tselectedBlockClientIds.length === 1,\n\t\t\tisUsingBindings: _isUsingBindings,\n\t\t\tisSectionContainer: _isSectionBlock,\n\t\t\thasContentOnlyLocking: _hasTemplateLock,\n\t\t\tshowShuffleButton: _isZoomOut,\n\t\t\tshowSlots: ! _isZoomOut,\n\t\t\tshowGroupButtons: ! _isZoomOut,\n\t\t\tshowLockButtons: ! _isZoomOut,\n\t\t\tshowBlockVisibilityButton: ! _isZoomOut,\n\t\t\tshowSwitchSectionStyleButton: _showSwitchSectionStyleButton,\n\t\t};\n\t}, [] );\n\n\tconst toolbarWrapperRef = useRef( null );\n\n\t// Handles highlighting the current block outline on hover or focus of the\n\t// block type toolbar area.\n\tconst nodeRef = useRef();\n\tconst showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures( {\n\t\tref: nodeRef,\n\t} );\n\n\tconst isLargeViewport = ! useViewportMatch( 'medium', '<' );\n\n\tconst hasBlockToolbar = useHasBlockToolbar();\n\tif ( ! hasBlockToolbar ) {\n\t\treturn null;\n\t}\n\n\tconst isMultiToolbar = blockClientIds.length > 1;\n\tconst isSynced =\n\t\tisReusableBlock( blockType ) || isTemplatePart( blockType );\n\n\t// Shifts the toolbar to make room for the parent block selector.\n\tconst classes = clsx( 'block-editor-block-contextual-toolbar', {\n\t\t'has-parent': showParentSelector,\n\t} );\n\n\tconst innerClasses = clsx( 'block-editor-block-toolbar', {\n\t\t'is-synced': isSynced,\n\t\t'is-connected': isUsingBindings,\n\t} );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tfocusEditorOnEscape\n\t\t\tclassName={ classes }\n\t\t\t/* translators: accessibility text for the block toolbar */\n\t\t\taria-label={ __( 'Block tools' ) }\n\t\t\t// The variant is applied as \"toolbar\" when undefined, which is the black border style of the dropdown from the toolbar popover.\n\t\t\tvariant={ variant === 'toolbar' ? undefined : variant }\n\t\t\tfocusOnMount={ focusOnMount }\n\t\t\t__experimentalInitialIndex={ __experimentalInitialIndex }\n\t\t\t__experimentalOnIndexChange={ __experimentalOnIndexChange }\n\t\t\t// Resets the index whenever the active block changes so\n\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\tkey={ toolbarKey }\n\t\t>\n\t\t\t<div ref={ toolbarWrapperRef } className={ innerClasses }>\n\t\t\t\t{ showParentSelector && ! isMultiToolbar && isLargeViewport && (\n\t\t\t\t\t<BlockParentSelector />\n\t\t\t\t) }\n\t\t\t\t{ ( shouldShowVisualToolbar || isMultiToolbar ) && (\n\t\t\t\t\t<div ref={ nodeRef } { ...showHoveredOrFocusedGestures }>\n\t\t\t\t\t\t<ToolbarGroup className=\"block-editor-block-toolbar__block-controls\">\n\t\t\t\t\t\t\t<BlockToolbarIcon\n\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\n\t\t\t\t\t\t\t\tisSynced={ isSynced }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ isDefaultEditingMode &&\n\t\t\t\t\t\t\t\tshowBlockVisibilityButton && (\n\t\t\t\t\t\t\t\t\t<BlockVisibilityToolbar\n\t\t\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ ! isMultiToolbar &&\n\t\t\t\t\t\t\t\tisDefaultEditingMode &&\n\t\t\t\t\t\t\t\tshowLockButtons && (\n\t\t\t\t\t\t\t\t\t<BlockLockToolbar\n\t\t\t\t\t\t\t\t\t\tclientId={ blockClientId }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<BlockMover\n\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\n\t\t\t\t\t\t\t\thideDragHandle={ hideDragHandle }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t{ ! hasContentOnlyLocking &&\n\t\t\t\t\tshouldShowVisualToolbar &&\n\t\t\t\t\tisMultiToolbar &&\n\t\t\t\t\tshowGroupButtons && <BlockGroupToolbar /> }\n\t\t\t\t{ showShuffleButton && (\n\t\t\t\t\t<ChangeDesign clientId={ blockClientIds[ 0 ] } />\n\t\t\t\t) }\n\t\t\t\t{ showSwitchSectionStyleButton && (\n\t\t\t\t\t<SwitchSectionStyle clientId={ blockClientIds[ 0 ] } />\n\t\t\t\t) }\n\t\t\t\t{ shouldShowVisualToolbar && showSlots && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! isSectionContainer && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\t\t\tgroup=\"parent\"\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\t\t\tgroup=\"block\"\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<BlockControls.Slot className=\"block-editor-block-toolbar__slot\" />\n\t\t\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\t\t\tgroup=\"inline\"\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"other\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<__unstableBlockNameContext.Provider\n\t\t\t\t\t\t\tvalue={ blockType?.name }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<__unstableBlockToolbarLastItem.Slot />\n\t\t\t\t\t\t</__unstableBlockNameContext.Provider>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEditVisuallyButton clientIds={ blockClientIds } />\n\t\t\t\t<BlockSettingsMenu clientIds={ blockClientIds } />\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport default function BlockToolbar( { hideDragHandle, variant } ) {\n\treturn (\n\t\t<PrivateBlockToolbar\n\t\t\thideDragHandle={ hideDragHandle }\n\t\t\tvariant={ variant }\n\t\t\tfocusOnMount={ undefined }\n\t\t\t__experimentalInitialIndex={ undefined }\n\t\t\t__experimentalOnIndexChange={ undefined }\n\t\t/>\n\t);\n}\n"],
5
+ "mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AACvB,SAAS,wBAAwB;AACjC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,oBAAoB;AAK7B,OAAO,gBAAgB;AACvB,OAAO,yBAAyB;AAChC,OAAO,mBAAmB;AAC1B,OAAO,oCAAoC;AAC3C,OAAO,uBAAuB;AAC9B,SAAS,wBAAwB;AACjC,SAAS,8BAA8B;AACvC,SAAS,yBAAyB;AAClC,OAAO,6BAA6B;AACpC,SAAS,uCAAuC;AAChD,SAAS,SAAS,wBAAwB;AAC1C,OAAO,gCAAgC;AACvC,OAAO,sBAAsB;AAC7B,SAAS,0BAA0B;AACnC,OAAO,kBAAkB;AACzB,OAAO,wBAAwB;AAC/B,SAAS,cAAc;AACvB,OAAO,sBAAsB;AAqKxB,SA0CE,UA1CF,KAIC,YAJD;AAvJE,SAAS,oBAAqB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AACX,GAAI;AACH,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI,UAAW,CAAE,WAAY;AAC5B,UAAM;AAAA,MACL;AAAA,MACA;AAAA,MACA;A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IAAC;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA,cAAe;AAAA,MACf,4BAA6B;AAAA,MAC7B,6BAA8B;AAAA;AAAA,EAC/B;AAEF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,76 @@
1
+ // packages/block-editor/src/components/block-toolbar/pattern-overrides-dropdown.js
2
+ import {
3
+ Popover,
4
+ ToolbarButton,
5
+ __experimentalText as Text
6
+ } from "@wordpress/components";
7
+ import { __, sprintf } from "@wordpress/i18n";
8
+ import { useState, useRef } from "@wordpress/element";
9
+ import { useSelect } from "@wordpress/data";
10
+ import { store as blockEditorStore } from "../../store";
11
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
+ function PatternOverridesPopoverContent({ clientIds, blockTitle }) {
13
+ const blockMetaName = useSelect(
14
+ (select) => {
15
+ const { getBlockAttributes } = select(blockEditorStore);
16
+ return getBlockAttributes(clientIds?.[0])?.metadata?.name;
17
+ },
18
+ [clientIds]
19
+ );
20
+ const isSingleBlock = clientIds.length === 1;
21
+ let description;
22
+ if (isSingleBlock && blockMetaName) {
23
+ description = sprintf(
24
+ /* translators: 1: The block type's name. 2: The block's user-provided name (the same as the override name). */
25
+ __('This %1$s is editable using the "%2$s" override.'),
26
+ blockTitle.toLowerCase(),
27
+ blockMetaName
28
+ );
29
+ } else {
30
+ description = __("These blocks are editable using overrides.");
31
+ }
32
+ return /* @__PURE__ */ jsx(Text, { children: description });
33
+ }
34
+ function PatternOverridesDropdown({
35
+ icon,
36
+ clientIds,
37
+ blockTitle,
38
+ label
39
+ }) {
40
+ const [isOpen, setIsOpen] = useState(false);
41
+ const anchorRef = useRef();
42
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
43
+ /* @__PURE__ */ jsx(
44
+ ToolbarButton,
45
+ {
46
+ ref: anchorRef,
47
+ className: "block-editor-block-toolbar__pattern-overrides-indicator",
48
+ icon,
49
+ label,
50
+ onClick: () => setIsOpen(!isOpen),
51
+ "aria-expanded": isOpen
52
+ }
53
+ ),
54
+ isOpen && /* @__PURE__ */ jsx(
55
+ Popover,
56
+ {
57
+ anchor: anchorRef.current,
58
+ onClose: () => setIsOpen(false),
59
+ placement: "bottom-start",
60
+ offset: 16,
61
+ className: "block-editor-block-toolbar__pattern-overrides-popover",
62
+ children: /* @__PURE__ */ jsx(
63
+ PatternOverridesPopoverContent,
64
+ {
65
+ clientIds,
66
+ blockTitle
67
+ }
68
+ )
69
+ }
70
+ )
71
+ ] });
72
+ }
73
+ export {
74
+ PatternOverridesDropdown as default
75
+ };
76
+ //# sourceMappingURL=pattern-overrides-dropdown.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/block-toolbar/pattern-overrides-dropdown.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tPopover,\n\tToolbarButton,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useState, useRef } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Renders the content of the pattern overrides popover.\n * Only mounts when the popover is opened.\n *\n * @param {Object} props Component props.\n * @param {Array} props.clientIds The client IDs of selected blocks.\n * @param {string} props.blockTitle The display title of the block.\n * @return {JSX.Element} The popover content.\n */\nfunction PatternOverridesPopoverContent( { clientIds, blockTitle } ) {\n\tconst blockMetaName = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockAttributes } = select( blockEditorStore );\n\t\t\treturn getBlockAttributes( clientIds?.[ 0 ] )?.metadata?.name;\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\tconst isSingleBlock = clientIds.length === 1;\n\n\t// Pattern overrides description\n\tlet description;\n\tif ( isSingleBlock && blockMetaName ) {\n\t\tdescription = sprintf(\n\t\t\t/* translators: 1: The block type's name. 2: The block's user-provided name (the same as the override name). */\n\t\t\t__( 'This %1$s is editable using the \"%2$s\" override.' ),\n\t\t\tblockTitle.toLowerCase(),\n\t\t\tblockMetaName\n\t\t);\n\t} else {\n\t\tdescription = __( 'These blocks are editable using overrides.' );\n\t}\n\n\treturn <Text>{ description }</Text>;\n}\n\n/**\n * Renders a toolbar button that displays information about pattern overrides in a popover.\n *\n * @param {Object} props Component props.\n * @param {JSX.Element} props.icon The icon element to display.\n * @param {Array} props.clientIds The client IDs of selected blocks.\n * @param {string} props.blockTitle The display title of the block.\n * @param {string} props.label The label for the button.\n * @return {JSX.Element} The pattern overrides button component.\n */\nexport default function PatternOverridesDropdown( {\n\ticon,\n\tclientIds,\n\tblockTitle,\n\tlabel,\n} ) {\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\tconst anchorRef = useRef();\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\tref={ anchorRef }\n\t\t\t\tclassName=\"block-editor-block-toolbar__pattern-overrides-indicator\"\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t\tonClick={ () => setIsOpen( ! isOpen ) }\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t/>\n\t\t\t{ isOpen && (\n\t\t\t\t<Popover\n\t\t\t\t\tanchor={ anchorRef.current }\n\t\t\t\t\tonClose={ () => setIsOpen( false ) }\n\t\t\t\t\tplacement=\"bottom-start\"\n\t\t\t\t\toffset={ 16 }\n\t\t\t\t\tclassName=\"block-editor-block-toolbar__pattern-overrides-popover\"\n\t\t\t\t>\n\t\t\t\t\t<PatternOverridesPopoverContent\n\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\tblockTitle={ blockTitle }\n\t\t\t\t\t/>\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
5
+ "mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA,sBAAsB;AAAA,OAChB;AACP,SAAS,IAAI,eAAe;AAC5B,SAAS,UAAU,cAAc;AACjC,SAAS,iBAAiB;AAK1B,SAAS,SAAS,wBAAwB;AAmClC,SAuBN,UAvBM,KAuBN,YAvBM;AAxBR,SAAS,+BAAgC,EAAE,WAAW,WAAW,GAAI;AACpE,QAAM,gBAAgB;AAAA,IACrB,CAAE,WAAY;AACb,YAAM,EAAE,mBAAmB,IAAI,OAAQ,gBAAiB;AACxD,aAAO,mBAAoB,YAAa,CAAE,CAAE,GAAG,UAAU;AAAA,IAC1D;AAAA,IACA,CAAE,SAAU;AAAA,EACb;AAEA,QAAM,gBAAgB,UAAU,WAAW;AAG3C,MAAI;AACJ,MAAK,iBAAiB,eAAgB;AACrC,kBAAc;AAAA;AAAA,MAEb,GAAI,kDAAmD;AAAA,MACvD,WAAW,YAAY;AAAA,MACvB;AAAA,IACD;AAAA,EACD,OAAO;AACN,kBAAc,GAAI,4CAA6C;AAAA,EAChE;AAEA,SAAO,oBAAC,QAAO,uBAAa;AAC7B;AAYe,SAAR,yBAA2C;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,CAAE,QAAQ,SAAU,IAAI,SAAU,KAAM;AAC9C,QAAM,YAAY,OAAO;AAEzB,SACC,iCACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,KAAM;AAAA,QACN,WAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA,SAAU,MAAM,UAAW,CAAE,MAAO;AAAA,QACpC,iBAAgB;AAAA;AAAA,IACjB;AAAA,IACE,UACD;AAAA,MAAC;AAAA;AAAA,QACA,QAAS,UAAU;AAAA,QACnB,SAAU,MAAM,UAAW,KAAM;AAAA,QACjC,WAAU;AAAA,QACV,QAAS;AAAA,QACT,WAAU;AAAA,QAEV;AAAA,UAAC;AAAA;AAAA,YACA;AAAA,YACA;AAAA;AAAA,QACD;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;",
6
+ "names": []
7
+ }
@@ -55,8 +55,9 @@ function BlockTools({
55
55
  getSelectedBlockClientIds,
56
56
  getBlockRootClientId,
57
57
  isGroupable,
58
- getBlockName
59
- } = useSelect(blockEditorStore);
58
+ getBlockName,
59
+ getEditedContentOnlySection
60
+ } = unlock(useSelect(blockEditorStore));
60
61
  const { getGroupingBlockName } = useSelect(blocksStore);
61
62
  const { showEmptyBlockSideInserter, showBlockToolbarPopover } = useShowBlockTools();
62
63
  const pasteStyles = usePasteStyles();
@@ -70,7 +71,8 @@ function BlockTools({
70
71
  moveBlocksUp,
71
72
  moveBlocksDown,
72
73
  expandBlock,
73
- updateBlockAttributes
74
+ updateBlockAttributes,
75
+ stopEditingContentOnlySection
74
76
  } = unlock(useDispatch(blockEditorStore));
75
77
  function onKeyDown(event) {
76
78
  if (event.defaultPrevented) {
@@ -194,6 +196,11 @@ function BlockTools({
194
196
  });
195
197
  }
196
198
  }
199
+ if (isMatch("core/block-editor/stop-editing-as-blocks", event)) {
200
+ if (getEditedContentOnlySection()) {
201
+ stopEditingContentOnlySection();
202
+ }
203
+ }
197
204
  }
198
205
  const blockToolbarRef = usePopoverScroll(__unstableContentRef);
199
206
  const blockToolbarAfterRef = usePopoverScroll(__unstableContentRef);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/block-tools/index.js"],
4
- "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 {\n\tswitchToBlockType,\n\tstore as blocksStore,\n\thasBlockSupport,\n} 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';\nimport { cleanEmptyObject } from '../../hooks/utils';\nimport usePasteStyles from '../use-paste-styles';\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\tgetBlockName,\n\t} = useSelect( blockEditorStore );\n\tconst { getGroupingBlockName } = useSelect( blocksStore );\n\tconst { showEmptyBlockSideInserter, showBlockToolbarPopover } =\n\t\tuseShowBlockTools();\n\tconst pasteStyles = usePasteStyles();\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\tupdateBlockAttributes,\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/paste-styles', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst blocks = getBlocksByClientId( clientIds );\n\t\t\t\tpasteStyles( blocks );\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} else if (\n\t\t\tisMatch( 'core/block-editor/toggle-block-visibility', 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 blocks = getBlocksByClientId( clientIds );\n\t\t\t\tconst canToggleBlockVisibility = blocks.every( ( block ) =>\n\t\t\t\t\thasBlockSupport(\n\t\t\t\t\t\tgetBlockName( block.clientId ),\n\t\t\t\t\t\t'blockVisibility',\n\t\t\t\t\t\ttrue\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\tif ( ! canToggleBlockVisibility ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst hasHiddenBlock = blocks.some(\n\t\t\t\t\t( block ) =>\n\t\t\t\t\t\tblock.attributes.metadata?.blockVisibility === false\n\t\t\t\t);\n\t\t\t\tconst attributesByClientId = Object.fromEntries(\n\t\t\t\t\tblocks.map( ( { clientId: mapClientId, attributes } ) => [\n\t\t\t\t\t\tmapClientId,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmetadata: cleanEmptyObject( {\n\t\t\t\t\t\t\t\t...attributes?.metadata,\n\t\t\t\t\t\t\t\tblockVisibility: hasHiddenBlock\n\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t: false,\n\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t},\n\t\t\t\t\t] )\n\t\t\t\t);\n\t\t\t\tupdateBlockAttributes( clientIds, attributesByClientId, {\n\t\t\t\t\tuniqueByBlock: true,\n\t\t\t\t} );\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"],
5
- "mappings": ";AAGA,SAAS,WAAW,mBAAmB;AACvC,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AACxB,SAAS,mCAAmC,6BAA6B;AACzE,SAAS,cAAc;AACvB;AAAA,EACC;AAAA,EACA,SAAS;AAAA,EACT;AAAA,OACM;AACP,SAAS,aAAa;AACtB,SAAS,IAAI,SAAS,UAAU;AAKhC,OAAO,wBAAwB;AAC/B;AAAA,EACC;AAAA,EACA,WAAW;AAAA,OACL;AACP,OAAO,yBAAyB;AAChC,SAAS,SAAS,wBAAwB;AAC1C,OAAO,sBAAsB;AAC7B,OAAO,0BAA0B;AACjC,SAAS,yBAAyB;AAClC,SAAS,cAAc;AACvB,SAAS,wBAAwB;AACjC,OAAO,oBAAoB;AAgOxB,SAEE,KAFF;AA9NH,SAAS,SAAU,QAAS;AAC3B,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,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C/D,QAAM,uBAAuB,iBAAkB,oBAAqB;AAEpE;AAAA;AAAA,IAEC,oBAAC,SAAM,GAAG,OAAQ,WACjB,+BAAC,sBAAsB,UAAtB,EAA+B,OAAQ,OAAQ,KAAM,GACnD;AAAA,OAAE,YAAY,CAAE,iBACjB;AAAA,QAAC;AAAA;AAAA,UACA;AAAA;AAAA,MACD;AAAA,MAGC,8BACD;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACD;AAAA,MAGC,2BACD;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACD;AAAA,MAIC,CAAE,iBAAiB,CAAE,mBACtB;AAAA,QAAC,QAAQ;AAAA,QAAR;AAAA,UACA,MAAK;AAAA,UACL,KAAM;AAAA;AAAA,MACP;AAAA,MAEC;AAAA,MAEF;AAAA,QAAC,QAAQ;AAAA,QAAR;AAAA,UACA,MAAK;AAAA,UACL,KAAM;AAAA;AAAA,MACP;AAAA,MACE,iBAAiB,CAAE,cACpB;AAAA,QAAC;AAAA;AAAA,UACA;AAAA;AAAA,MACD;AAAA,OAEF,GACD;AAAA;AAEF;",
4
+ "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 {\n\tswitchToBlockType,\n\tstore as blocksStore,\n\thasBlockSupport,\n} 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';\nimport { cleanEmptyObject } from '../../hooks/utils';\nimport usePasteStyles from '../use-paste-styles';\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\tgetBlockName,\n\t\tgetEditedContentOnlySection,\n\t} = unlock( useSelect( blockEditorStore ) );\n\tconst { getGroupingBlockName } = useSelect( blocksStore );\n\tconst { showEmptyBlockSideInserter, showBlockToolbarPopover } =\n\t\tuseShowBlockTools();\n\tconst pasteStyles = usePasteStyles();\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\tupdateBlockAttributes,\n\t\tstopEditingContentOnlySection,\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/paste-styles', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst blocks = getBlocksByClientId( clientIds );\n\t\t\t\tpasteStyles( blocks );\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} else if (\n\t\t\tisMatch( 'core/block-editor/toggle-block-visibility', 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 blocks = getBlocksByClientId( clientIds );\n\t\t\t\tconst canToggleBlockVisibility = blocks.every( ( block ) =>\n\t\t\t\t\thasBlockSupport(\n\t\t\t\t\t\tgetBlockName( block.clientId ),\n\t\t\t\t\t\t'blockVisibility',\n\t\t\t\t\t\ttrue\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\tif ( ! canToggleBlockVisibility ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst hasHiddenBlock = blocks.some(\n\t\t\t\t\t( block ) =>\n\t\t\t\t\t\tblock.attributes.metadata?.blockVisibility === false\n\t\t\t\t);\n\t\t\t\tconst attributesByClientId = Object.fromEntries(\n\t\t\t\t\tblocks.map( ( { clientId: mapClientId, attributes } ) => [\n\t\t\t\t\t\tmapClientId,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmetadata: cleanEmptyObject( {\n\t\t\t\t\t\t\t\t...attributes?.metadata,\n\t\t\t\t\t\t\t\tblockVisibility: hasHiddenBlock\n\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t: false,\n\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t},\n\t\t\t\t\t] )\n\t\t\t\t);\n\t\t\t\tupdateBlockAttributes( clientIds, attributesByClientId, {\n\t\t\t\t\tuniqueByBlock: true,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\t// Has the same keyboard shortcut as 'unselect', so can't be within the\n\t\t// if/else chain above.\n\t\tif ( isMatch( 'core/block-editor/stop-editing-as-blocks', event ) ) {\n\t\t\tif ( getEditedContentOnlySection() ) {\n\t\t\t\tstopEditingContentOnlySection();\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"],
5
+ "mappings": ";AAGA,SAAS,WAAW,mBAAmB;AACvC,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AACxB,SAAS,mCAAmC,6BAA6B;AACzE,SAAS,cAAc;AACvB;AAAA,EACC;AAAA,EACA,SAAS;AAAA,EACT;AAAA,OACM;AACP,SAAS,aAAa;AACtB,SAAS,IAAI,SAAS,UAAU;AAKhC,OAAO,wBAAwB;AAC/B;AAAA,EACC;AAAA,EACA,WAAW;AAAA,OACL;AACP,OAAO,yBAAyB;AAChC,SAAS,SAAS,wBAAwB;AAC1C,OAAO,sBAAsB;AAC7B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C,UAAU,iBAAkB;AAAA,gBAC3B,GAAG,YAAY;AAAA,gBACf,iBAAiB,iBACd,SACA;AAAA,cACJ,CAAE;AAAA,YACH;AAAA,UACD,CAAE;AAAA,QACH;AACA,8BAAuB,WAAW,sBAAsB;AAAA,UACvD,eAAe;AAAA,QAChB,CAAE;AAAA,MACH;AAAA,IACD;AAIA,QAAK,QAAS,4CAA4C,KAAM,GAAI;AACnE,UAAK,4BAA4B,GAAI;AACpC,sCAA8B;AAAA,MAC/B;AAAA,IACD;AAAA,EACD;AACA,QAAM,kBAAkB,iBAAkB,oBAAqB;AAC/D,QAAM,uBAAuB,iBAAkB,oBAAqB;AAEpE;AAAA;AAAA,IAEC,oBAAC,SAAM,GAAG,OAAQ,WACjB,+BAAC,sBAAsB,UAAtB,EAA+B,OAAQ,OAAQ,KAAM,GACnD;AAAA,OAAE,YAAY,CAAE,iBACjB;AAAA,QAAC;AAAA;AAAA,UACA;AAAA;AAAA,MACD;AAAA,MAGC,8BACD;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACD;AAAA,MAGC,2BACD;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACD;AAAA,MAIC,CAAE,iBAAiB,CAAE,mBACtB;AAAA,QAAC,QAAQ;AAAA,QAAR;AAAA,UACA,MAAK;AAAA,UACL,KAAM;AAAA;AAAA,MACP;AAAA,MAEC;AAAA,MAEF;AAAA,QAAC,QAAQ;AAAA,QAAR;AAAA,UACA,MAAK;AAAA,UACL,KAAM;AAAA;AAAA,MACP;AAAA,MACE,iBAAiB,CAAE,cACpB;AAAA,QAAC;AAAA;AAAA,UACA;AAAA;AAAA,MACD;AAAA,OAEF,GACD;AAAA;AAEF;",
6
6
  "names": []
7
7
  }
@@ -14,9 +14,13 @@ function getAllValue(values = {}) {
14
14
  if (typeof values === "string") {
15
15
  return values;
16
16
  }
17
- const parsedQuantitiesAndUnits = Object.values(values).map(
18
- (value2) => parseQuantityAndUnitFromRawValue(value2)
19
- );
17
+ const parsedQuantitiesAndUnits = Object.values(values).map((value2) => {
18
+ const newValue = parseQuantityAndUnitFromRawValue(value2);
19
+ if (typeof value2 === "string" && newValue[0] === void 0) {
20
+ return [value2, ""];
21
+ }
22
+ return newValue;
23
+ });
20
24
  const allValues = parsedQuantitiesAndUnits.map(
21
25
  (value2) => value2[0] ?? ""
22
26
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/border-radius-control/utils.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue } from '@wordpress/components';\n\n/**\n * Gets the (non-undefined) item with the highest occurrence within an array\n * Based in part on: https://stackoverflow.com/a/20762713\n *\n * Undefined values are always sorted to the end by `sort`, so this function\n * returns the first element, to always prioritize real values over undefined\n * values.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description\n *\n * @param {Array<any>} inputArray Array of items to check.\n * @return {any} The item with the most occurrences.\n */\nexport function mode( inputArray ) {\n\tconst arr = [ ...inputArray ];\n\treturn arr\n\t\t.sort(\n\t\t\t( a, b ) =>\n\t\t\t\tinputArray.filter( ( v ) => v === b ).length -\n\t\t\t\tinputArray.filter( ( v ) => v === a ).length\n\t\t)\n\t\t.shift();\n}\n\n/**\n * Returns the most common CSS unit from the current CSS unit selections.\n *\n * - If a single flat border radius is set, its unit will be used\n * - If individual corner selections, the most common of those will be used\n * - Failing any unit selections a default of 'px' is returned.\n *\n * @param {Object} selectedUnits Unit selections for flat radius & each corner.\n * @return {string} Most common CSS unit from current selections. Default: `px`.\n */\nexport function getAllUnit( selectedUnits = {} ) {\n\tconst { flat, ...cornerUnits } = selectedUnits;\n\treturn (\n\t\tflat || mode( Object.values( cornerUnits ).filter( Boolean ) ) || 'px'\n\t);\n}\n\n/**\n * Gets the 'all' input value and unit from values data.\n *\n * @param {Object|string} values Radius values.\n * @return {string} A value + unit for the 'all' input.\n */\nexport function getAllValue( values = {} ) {\n\t/**\n\t * Border radius support was originally a single pixel value.\n\t *\n\t * To maintain backwards compatibility treat this case as the all value.\n\t */\n\tif ( typeof values === 'string' ) {\n\t\treturn values;\n\t}\n\n\tconst parsedQuantitiesAndUnits = Object.values( values ).map( ( value ) =>\n\t\tparseQuantityAndUnitFromRawValue( value )\n\t);\n\n\tconst allValues = parsedQuantitiesAndUnits.map(\n\t\t( value ) => value[ 0 ] ?? ''\n\t);\n\tconst allUnits = parsedQuantitiesAndUnits.map( ( value ) => value[ 1 ] );\n\n\tconst value = allValues.every( ( v ) => v === allValues[ 0 ] )\n\t\t? allValues[ 0 ]\n\t\t: '';\n\tconst unit = mode( allUnits );\n\n\tconst allValue =\n\t\tvalue === 0 || value ? `${ value }${ unit || '' }` : undefined;\n\n\treturn allValue;\n}\n\n/**\n * Checks to determine if values are mixed.\n *\n * @param {Object} values Radius values.\n * @return {boolean} Whether values are mixed.\n */\nexport function hasMixedValues( values = {} ) {\n\tif ( typeof values === 'string' ) {\n\t\treturn false;\n\t}\n\n\tif ( ! values || typeof values !== 'object' ) {\n\t\treturn false;\n\t}\n\n\tconst cornerValues = Object.values( values );\n\n\tif ( cornerValues.length === 0 ) {\n\t\treturn false;\n\t}\n\n\tconst firstValue = cornerValues[ 0 ];\n\n\t// Check if all values are exactly the same (including undefined)\n\tconst allSame = cornerValues.every( ( value ) => value === firstValue );\n\n\treturn ! allSame;\n}\n\n/**\n * Checks to determine if values are defined.\n *\n * @param {Object} values Radius values.\n * @return {boolean} Whether values are mixed.\n */\nexport function hasDefinedValues( values ) {\n\tif ( ! values ) {\n\t\treturn false;\n\t}\n\n\t// A string value represents a shorthand value.\n\tif ( typeof values === 'string' ) {\n\t\treturn true;\n\t}\n\n\t// An object represents longhand border radius values, if any are set\n\t// flag values as being defined.\n\tconst filteredValues = Object.values( values ).filter( ( value ) => {\n\t\treturn !! value || value === 0;\n\t} );\n\n\treturn !! filteredValues.length;\n}\n\n/**\n * Checks is given value is a radius preset.\n *\n * @param {string} value Value to check\n *\n * @return {boolean} Return true if value is string in format var:preset|border-radius|.\n */\nexport function isValuePreset( value ) {\n\tif ( ! value?.includes ) {\n\t\treturn false;\n\t}\n\treturn value === '0' || value.includes( 'var:preset|border-radius|' );\n}\n\n/**\n * Returns the slug section of the given preset string.\n *\n * @param {string} value Value to extract slug from.\n *\n * @return {string|undefined} The int value of the slug from given preset.\n */\nexport function getPresetSlug( value ) {\n\tif ( ! value ) {\n\t\treturn;\n\t}\n\n\tif ( value === '0' || value === 'default' ) {\n\t\treturn value;\n\t}\n\n\tconst slug = value.match( /var:preset\\|border-radius\\|(.+)/ );\n\n\treturn slug ? slug[ 1 ] : undefined;\n}\n\n/**\n * Converts radius preset value into a Range component value .\n *\n * @param {string} presetValue Value to convert to Range value.\n * @param {Array} presets Array of current radius preset value objects.\n *\n * @return {number} The int value for use in Range control.\n */\nexport function getSliderValueFromPreset( presetValue, presets ) {\n\tif ( presetValue === undefined ) {\n\t\treturn 0;\n\t}\n\tconst slug =\n\t\tparseFloat( presetValue, 10 ) === 0\n\t\t\t? '0'\n\t\t\t: getPresetSlug( presetValue );\n\tconst sliderValue = presets.findIndex( ( size ) => {\n\t\treturn String( size.slug ) === slug;\n\t} );\n\n\t// Returning NaN rather than undefined as undefined makes range control thumb sit in center\n\treturn sliderValue !== -1 ? sliderValue : NaN;\n}\n\n/**\n * Converts a preset into a custom value.\n *\n * @param {string} value Value to convert\n * @param {Array} presets Array of the current radius preset objects\n *\n * @return {string} Mapping of the radius preset to its equivalent custom value.\n */\nexport function getCustomValueFromPreset( value, presets ) {\n\tif ( ! isValuePreset( value ) ) {\n\t\treturn value;\n\t}\n\n\tconst slug = parseFloat( value, 10 ) === 0 ? '0' : getPresetSlug( value );\n\tconst radiusSize = presets.find( ( size ) => String( size.slug ) === slug );\n\n\treturn radiusSize?.size;\n}\n\n/**\n * Converts a control value into a preset value.\n *\n * @param {number} controlValue to convert to preset value.\n * @param {string} controlType Type of control\n * @param {Array} presets Array of current radius preset value objects.\n *\n * @return {string} The custom value for use in Range control.\n */\nexport function getPresetValueFromControlValue(\n\tcontrolValue,\n\tcontrolType,\n\tpresets\n) {\n\tconst size = parseInt( controlValue, 10 );\n\tif ( controlType === 'selectList' ) {\n\t\tif ( size === 0 ) {\n\t\t\treturn undefined;\n\t\t}\n\t} else if ( size === 0 ) {\n\t\treturn '0';\n\t}\n\n\treturn `var:preset|border-radius|${ presets[ controlValue ]?.slug }`;\n}\n\n/**\n * Converts a custom value to preset value if one can be found.\n *\n * Returns value as-is if no match is found.\n *\n * @param {string} value Value to convert\n * @param {Array} presets Array of the current border radius preset objects\n *\n * @return {string} The preset value if it can be found.\n */\nexport function getPresetValueFromCustomValue( value, presets ) {\n\t// Return value as-is if it is undefined or is already a preset, or '0';\n\tif ( ! value || isValuePreset( value ) || value === '0' ) {\n\t\treturn value;\n\t}\n\n\tconst spacingMatch = presets.find(\n\t\t( size ) => String( size.size ) === String( value )\n\t);\n\n\tif ( spacingMatch?.slug ) {\n\t\treturn `var:preset|border-radius|${ spacingMatch.slug }`;\n\t}\n\n\treturn value;\n}\n\n/**\n * Converts all preset values in a values object to their custom equivalents.\n *\n * @param {Object} values Values object to convert\n * @param {Array} presets Array of current border radius preset objects\n *\n * @return {Object} Values with presets converted to custom values\n */\nexport function convertPresetsToCustomValues( values, presets ) {\n\tif ( ! values || typeof values !== 'object' ) {\n\t\treturn values;\n\t}\n\n\tconst converted = {};\n\tObject.keys( values ).forEach( ( key ) => {\n\t\tconst value = values[ key ];\n\t\tif ( isValuePreset( value ) ) {\n\t\t\tconst customValue = getCustomValueFromPreset( value, presets );\n\t\t\tconverted[ key ] = customValue !== undefined ? customValue : value;\n\t\t} else {\n\t\t\tconverted[ key ] = value;\n\t\t}\n\t} );\n\n\treturn converted;\n}\n"],
5
- "mappings": ";AAGA,SAAS,kDAAkD,wCAAwC;AAe5F,SAAS,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S,+BACf,cACA,aACA,SACC;AACD,QAAM,OAAO,SAAU,cAAc,EAAG;AACxC,MAAK,gBAAgB,cAAe;AACnC,QAAK,SAAS,GAAI;AACjB,aAAO;AAAA,IACR;AAAA,EACD,WAAY,SAAS,GAAI;AACxB,WAAO;AAAA,EACR;AAEA,SAAO,4BAA6B,QAAS,YAAa,GAAG,IAAK;AACnE;AAYO,SAAS,8BAA+B,OAAO,SAAU;AAE/D,MAAK,CAAE,SAAS,cAAe,KAAM,KAAK,UAAU,KAAM;AACzD,WAAO;AAAA,EACR;AAEA,QAAM,eAAe,QAAQ;AAAA,IAC5B,CAAE,SAAU,OAAQ,KAAK,IAAK,MAAM,OAAQ,KAAM;AAAA,EACnD;AAEA,MAAK,cAAc,MAAO;AACzB,WAAO,4BAA6B,aAAa,IAAK;AAAA,EACvD;AAEA,SAAO;AACR;AAUO,SAAS,6BAA8B,QAAQ,SAAU;AAC/D,MAAK,CAAE,UAAU,OAAO,WAAW,UAAW;AAC7C,WAAO;AAAA,EACR;AAEA,QAAM,YAAY,CAAC;AACnB,SAAO,KAAM,MAAO,EAAE,QAAS,CAAE,QAAS;AACzC,UAAM,QAAQ,OAAQ,GAAI;AAC1B,QAAK,cAAe,KAAM,GAAI;AAC7B,YAAM,cAAc,yBAA0B,OAAO,OAAQ;AAC7D,gBAAW,GAAI,IAAI,gBAAgB,SAAY,cAAc;AAAA,IAC9D,OAAO;AACN,gBAAW,GAAI,IAAI;AAAA,IACpB;AAAA,EACD,CAAE;AAEF,SAAO;AACR;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue } from '@wordpress/components';\n\n/**\n * Gets the (non-undefined) item with the highest occurrence within an array\n * Based in part on: https://stackoverflow.com/a/20762713\n *\n * Undefined values are always sorted to the end by `sort`, so this function\n * returns the first element, to always prioritize real values over undefined\n * values.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description\n *\n * @param {Array<any>} inputArray Array of items to check.\n * @return {any} The item with the most occurrences.\n */\nexport function mode( inputArray ) {\n\tconst arr = [ ...inputArray ];\n\treturn arr\n\t\t.sort(\n\t\t\t( a, b ) =>\n\t\t\t\tinputArray.filter( ( v ) => v === b ).length -\n\t\t\t\tinputArray.filter( ( v ) => v === a ).length\n\t\t)\n\t\t.shift();\n}\n\n/**\n * Returns the most common CSS unit from the current CSS unit selections.\n *\n * - If a single flat border radius is set, its unit will be used\n * - If individual corner selections, the most common of those will be used\n * - Failing any unit selections a default of 'px' is returned.\n *\n * @param {Object} selectedUnits Unit selections for flat radius & each corner.\n * @return {string} Most common CSS unit from current selections. Default: `px`.\n */\nexport function getAllUnit( selectedUnits = {} ) {\n\tconst { flat, ...cornerUnits } = selectedUnits;\n\treturn (\n\t\tflat || mode( Object.values( cornerUnits ).filter( Boolean ) ) || 'px'\n\t);\n}\n\n/**\n * Gets the 'all' input value and unit from values data.\n *\n * @param {Object|string} values Radius values.\n * @return {string} A value + unit for the 'all' input.\n */\nexport function getAllValue( values = {} ) {\n\t/**\n\t * Border radius support was originally a single pixel value.\n\t *\n\t * To maintain backwards compatibility treat this case as the all value.\n\t */\n\tif ( typeof values === 'string' ) {\n\t\treturn values;\n\t}\n\n\tconst parsedQuantitiesAndUnits = Object.values( values ).map( ( value ) => {\n\t\tconst newValue = parseQuantityAndUnitFromRawValue( value );\n\t\tif ( typeof value === 'string' && newValue[ 0 ] === undefined ) {\n\t\t\treturn [ value, '' ];\n\t\t}\n\t\treturn newValue;\n\t} );\n\n\tconst allValues = parsedQuantitiesAndUnits.map(\n\t\t( value ) => value[ 0 ] ?? ''\n\t);\n\tconst allUnits = parsedQuantitiesAndUnits.map( ( value ) => value[ 1 ] );\n\n\tconst value = allValues.every( ( v ) => v === allValues[ 0 ] )\n\t\t? allValues[ 0 ]\n\t\t: '';\n\tconst unit = mode( allUnits );\n\n\tconst allValue =\n\t\tvalue === 0 || value ? `${ value }${ unit || '' }` : undefined;\n\n\treturn allValue;\n}\n\n/**\n * Checks to determine if values are mixed.\n *\n * @param {Object} values Radius values.\n * @return {boolean} Whether values are mixed.\n */\nexport function hasMixedValues( values = {} ) {\n\tif ( typeof values === 'string' ) {\n\t\treturn false;\n\t}\n\n\tif ( ! values || typeof values !== 'object' ) {\n\t\treturn false;\n\t}\n\n\tconst cornerValues = Object.values( values );\n\n\tif ( cornerValues.length === 0 ) {\n\t\treturn false;\n\t}\n\n\tconst firstValue = cornerValues[ 0 ];\n\n\t// Check if all values are exactly the same (including undefined)\n\tconst allSame = cornerValues.every( ( value ) => value === firstValue );\n\n\treturn ! allSame;\n}\n\n/**\n * Checks to determine if values are defined.\n *\n * @param {Object} values Radius values.\n * @return {boolean} Whether values are mixed.\n */\nexport function hasDefinedValues( values ) {\n\tif ( ! values ) {\n\t\treturn false;\n\t}\n\n\t// A string value represents a shorthand value.\n\tif ( typeof values === 'string' ) {\n\t\treturn true;\n\t}\n\n\t// An object represents longhand border radius values, if any are set\n\t// flag values as being defined.\n\tconst filteredValues = Object.values( values ).filter( ( value ) => {\n\t\treturn !! value || value === 0;\n\t} );\n\n\treturn !! filteredValues.length;\n}\n\n/**\n * Checks is given value is a radius preset.\n *\n * @param {string} value Value to check\n *\n * @return {boolean} Return true if value is string in format var:preset|border-radius|.\n */\nexport function isValuePreset( value ) {\n\tif ( ! value?.includes ) {\n\t\treturn false;\n\t}\n\treturn value === '0' || value.includes( 'var:preset|border-radius|' );\n}\n\n/**\n * Returns the slug section of the given preset string.\n *\n * @param {string} value Value to extract slug from.\n *\n * @return {string|undefined} The int value of the slug from given preset.\n */\nexport function getPresetSlug( value ) {\n\tif ( ! value ) {\n\t\treturn;\n\t}\n\n\tif ( value === '0' || value === 'default' ) {\n\t\treturn value;\n\t}\n\n\tconst slug = value.match( /var:preset\\|border-radius\\|(.+)/ );\n\n\treturn slug ? slug[ 1 ] : undefined;\n}\n\n/**\n * Converts radius preset value into a Range component value .\n *\n * @param {string} presetValue Value to convert to Range value.\n * @param {Array} presets Array of current radius preset value objects.\n *\n * @return {number} The int value for use in Range control.\n */\nexport function getSliderValueFromPreset( presetValue, presets ) {\n\tif ( presetValue === undefined ) {\n\t\treturn 0;\n\t}\n\tconst slug =\n\t\tparseFloat( presetValue, 10 ) === 0\n\t\t\t? '0'\n\t\t\t: getPresetSlug( presetValue );\n\tconst sliderValue = presets.findIndex( ( size ) => {\n\t\treturn String( size.slug ) === slug;\n\t} );\n\n\t// Returning NaN rather than undefined as undefined makes range control thumb sit in center\n\treturn sliderValue !== -1 ? sliderValue : NaN;\n}\n\n/**\n * Converts a preset into a custom value.\n *\n * @param {string} value Value to convert\n * @param {Array} presets Array of the current radius preset objects\n *\n * @return {string} Mapping of the radius preset to its equivalent custom value.\n */\nexport function getCustomValueFromPreset( value, presets ) {\n\tif ( ! isValuePreset( value ) ) {\n\t\treturn value;\n\t}\n\n\tconst slug = parseFloat( value, 10 ) === 0 ? '0' : getPresetSlug( value );\n\tconst radiusSize = presets.find( ( size ) => String( size.slug ) === slug );\n\n\treturn radiusSize?.size;\n}\n\n/**\n * Converts a control value into a preset value.\n *\n * @param {number} controlValue to convert to preset value.\n * @param {string} controlType Type of control\n * @param {Array} presets Array of current radius preset value objects.\n *\n * @return {string} The custom value for use in Range control.\n */\nexport function getPresetValueFromControlValue(\n\tcontrolValue,\n\tcontrolType,\n\tpresets\n) {\n\tconst size = parseInt( controlValue, 10 );\n\tif ( controlType === 'selectList' ) {\n\t\tif ( size === 0 ) {\n\t\t\treturn undefined;\n\t\t}\n\t} else if ( size === 0 ) {\n\t\treturn '0';\n\t}\n\n\treturn `var:preset|border-radius|${ presets[ controlValue ]?.slug }`;\n}\n\n/**\n * Converts a custom value to preset value if one can be found.\n *\n * Returns value as-is if no match is found.\n *\n * @param {string} value Value to convert\n * @param {Array} presets Array of the current border radius preset objects\n *\n * @return {string} The preset value if it can be found.\n */\nexport function getPresetValueFromCustomValue( value, presets ) {\n\t// Return value as-is if it is undefined or is already a preset, or '0';\n\tif ( ! value || isValuePreset( value ) || value === '0' ) {\n\t\treturn value;\n\t}\n\n\tconst spacingMatch = presets.find(\n\t\t( size ) => String( size.size ) === String( value )\n\t);\n\n\tif ( spacingMatch?.slug ) {\n\t\treturn `var:preset|border-radius|${ spacingMatch.slug }`;\n\t}\n\n\treturn value;\n}\n\n/**\n * Converts all preset values in a values object to their custom equivalents.\n *\n * @param {Object} values Values object to convert\n * @param {Array} presets Array of current border radius preset objects\n *\n * @return {Object} Values with presets converted to custom values\n */\nexport function convertPresetsToCustomValues( values, presets ) {\n\tif ( ! values || typeof values !== 'object' ) {\n\t\treturn values;\n\t}\n\n\tconst converted = {};\n\tObject.keys( values ).forEach( ( key ) => {\n\t\tconst value = values[ key ];\n\t\tif ( isValuePreset( value ) ) {\n\t\t\tconst customValue = getCustomValueFromPreset( value, presets );\n\t\t\tconverted[ key ] = customValue !== undefined ? customValue : value;\n\t\t} else {\n\t\t\tconverted[ key ] = value;\n\t\t}\n\t} );\n\n\treturn converted;\n}\n"],
5
+ "mappings": ";AAGA,SAAS,kDAAkD,wCAAwC;AAe5F,SAAS,KAAM,YAAa;AAClC,QAAM,MAAM,CAAE,GAAG,UAAW;AAC5B,SAAO,IACL;AAAA,IACA,CAAE,GAAG,MACJ,WAAW,OAAQ,CAAE,MAAO,MAAM,CAAE,EAAE,SACtC,WAAW,OAAQ,CAAE,MAAO,MAAM,CAAE,EAAE;AAAA,EACxC,EACC,MAAM;AACT;AAYO,SAAS,WAAY,gBAAgB,CAAC,GAAI;AAChD,QAAM,EAAE,MAAM,GAAG,YAAY,IAAI;AACjC,SACC,QAAQ,KAAM,OAAO,OAAQ,WAAY,EAAE,OAAQ,OAAQ,CAAE,KAAK;AAEpE;AAQO,SAAS,YAAa,SAAS,CAAC,GAAI;AAM1C,MAAK,OAAO,WAAW,UAAW;AACjC,WAAO;AAAA,EACR;AAEA,QAAM,2BAA2B,OAAO,OAAQ,MAAO,EAAE,IAAK,CAAE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Q,KAAK,IAAK,MAAM,OAAQ,KAAM;AAAA,EACnD;AAEA,MAAK,cAAc,MAAO;AACzB,WAAO,4BAA6B,aAAa,IAAK;AAAA,EACvD;AAEA,SAAO;AACR;AAUO,SAAS,6BAA8B,QAAQ,SAAU;AAC/D,MAAK,CAAE,UAAU,OAAO,WAAW,UAAW;AAC7C,WAAO;AAAA,EACR;AAEA,QAAM,YAAY,CAAC;AACnB,SAAO,KAAM,MAAO,EAAE,QAAS,CAAE,QAAS;AACzC,UAAM,QAAQ,OAAQ,GAAI;AAC1B,QAAK,cAAe,KAAM,GAAI;AAC7B,YAAM,cAAc,yBAA0B,OAAO,OAAQ;AAC7D,gBAAW,GAAI,IAAI,gBAAgB,SAAY,cAAc;AAAA,IAC9D,OAAO;AACN,gBAAW,GAAI,IAAI;AAAA,IACpB;AAAA,EACD,CAAE;AAEF,SAAO;AACR;",
6
6
  "names": ["value"]
7
7
  }
@@ -23,12 +23,12 @@ function ModifyContentOnlySectionMenuItem({ clientId, onClose }) {
23
23
  );
24
24
  const blockEditorActions = useDispatch(blockEditorStore);
25
25
  const isContentLocked = !isLockedByParent && templateLock === "contentOnly";
26
- if (!isContentLocked && !isEditingContentOnlySection) {
26
+ if (window?.__experimentalContentOnlyPatternInsertion || !isContentLocked && !isEditingContentOnlySection) {
27
27
  return null;
28
28
  }
29
29
  const { editContentOnlySection } = unlock(blockEditorActions);
30
- const showStartEditingAsBlocks = !isEditingContentOnlySection && isContentLocked;
31
- return showStartEditingAsBlocks && /* @__PURE__ */ jsx(
30
+ const showContentOnlyModifyButton = !isEditingContentOnlySection && isContentLocked;
31
+ return showContentOnlyModifyButton && /* @__PURE__ */ jsx(
32
32
  MenuItem,
33
33
  {
34
34
  onClick: () => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/content-lock/modify-content-lock-menu-item.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n// The implementation of content locking is mainly in this file, although the mechanism\n// to stop editing a content only section when an outside block is selected is in the component\n// `StopEditingContentOnlySectionOnOutsideSelect` at block-editor/src/components/block-list/index.js.\n// Besides the components on this file and the file referenced above the implementation\n// also includes artifacts on the store (actions, reducers, and selector).\n\nexport function ModifyContentOnlySectionMenuItem( { clientId, onClose } ) {\n\tconst { templateLock, isLockedByParent, isEditingContentOnlySection } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetContentLockingParent,\n\t\t\t\t\tgetTemplateLock,\n\t\t\t\t\tgetEditedContentOnlySection,\n\t\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\t\treturn {\n\t\t\t\t\ttemplateLock: getTemplateLock( clientId ),\n\t\t\t\t\tisLockedByParent: !! getContentLockingParent( clientId ),\n\t\t\t\t\tisEditingContentOnlySection:\n\t\t\t\t\t\tgetEditedContentOnlySection() === clientId,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\tconst blockEditorActions = useDispatch( blockEditorStore );\n\tconst isContentLocked =\n\t\t! isLockedByParent && templateLock === 'contentOnly';\n\tif ( ! isContentLocked && ! isEditingContentOnlySection ) {\n\t\treturn null;\n\t}\n\n\tconst { editContentOnlySection } = unlock( blockEditorActions );\n\tconst showStartEditingAsBlocks =\n\t\t! isEditingContentOnlySection && isContentLocked;\n\n\treturn (\n\t\tshowStartEditingAsBlocks && (\n\t\t\t<MenuItem\n\t\t\t\tonClick={ () => {\n\t\t\t\t\teditContentOnlySection( clientId );\n\t\t\t\t\tonClose();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ _x( 'Modify', 'Unlock content locked blocks' ) }\n\t\t\t</MenuItem>\n\t\t)\n\t);\n}\n"],
5
- "mappings": ";AAGA,SAAS,gBAAgB;AACzB,SAAS,aAAa,iBAAiB;AACvC,SAAS,UAAU;AAKnB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,cAAc;AAuCpB;AA/BI,SAAS,iCAAkC,EAAE,UAAU,QAAQ,GAAI;AACzE,QAAM,EAAE,cAAc,kBAAkB,4BAA4B,IACnE;AAAA,IACC,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,OAAQ,gBAAiB,CAAE;AACvC,aAAO;AAAA,QACN,cAAc,gBAAiB,QAAS;AAAA,QACxC,kBAAkB,CAAC,CAAE,wBAAyB,QAAS;AAAA,QACvD,6BACC,4BAA4B,MAAM;AAAA,MACpC;AAAA,IACD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AACD,QAAM,qBAAqB,YAAa,gBAAiB;AACzD,QAAM,kBACL,CAAE,oBAAoB,iBAAiB;AACxC,MAAK,CAAE,mBAAmB,CAAE,6BAA8B;AACzD,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,uBAAuB,IAAI,OAAQ,kBAAmB;AAC9D,QAAM,2BACL,CAAE,+BAA+B;AAElC,SACC,4BACC;AAAA,IAAC;AAAA;AAAA,MACA,SAAU,MAAM;AACf,+BAAwB,QAAS;AACjC,gBAAQ;AAAA,MACT;AAAA,MAEE,aAAI,UAAU,8BAA+B;AAAA;AAAA,EAChD;AAGH;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n// The implementation of content locking is mainly in this file, although the mechanism\n// to stop editing a content only section when an outside block is selected is in the component\n// `StopEditingContentOnlySectionOnOutsideSelect` at block-editor/src/components/block-list/index.js.\n// Besides the components on this file and the file referenced above the implementation\n// also includes artifacts on the store (actions, reducers, and selector).\n\nexport function ModifyContentOnlySectionMenuItem( { clientId, onClose } ) {\n\tconst { templateLock, isLockedByParent, isEditingContentOnlySection } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetContentLockingParent,\n\t\t\t\t\tgetTemplateLock,\n\t\t\t\t\tgetEditedContentOnlySection,\n\t\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\t\treturn {\n\t\t\t\t\ttemplateLock: getTemplateLock( clientId ),\n\t\t\t\t\tisLockedByParent: !! getContentLockingParent( clientId ),\n\t\t\t\t\tisEditingContentOnlySection:\n\t\t\t\t\t\tgetEditedContentOnlySection() === clientId,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\tconst blockEditorActions = useDispatch( blockEditorStore );\n\tconst isContentLocked =\n\t\t! isLockedByParent && templateLock === 'contentOnly';\n\n\t// Hide the Modify button when the content only pattern insertion experiment is active.\n\t// This is replaced by an alternative UI in the experiment.\n\tif (\n\t\twindow?.__experimentalContentOnlyPatternInsertion ||\n\t\t( ! isContentLocked && ! isEditingContentOnlySection )\n\t) {\n\t\treturn null;\n\t}\n\n\tconst { editContentOnlySection } = unlock( blockEditorActions );\n\tconst showContentOnlyModifyButton =\n\t\t! isEditingContentOnlySection && isContentLocked;\n\n\treturn (\n\t\tshowContentOnlyModifyButton && (\n\t\t\t<MenuItem\n\t\t\t\tonClick={ () => {\n\t\t\t\t\teditContentOnlySection( clientId );\n\t\t\t\t\tonClose();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ _x( 'Modify', 'Unlock content locked blocks' ) }\n\t\t\t</MenuItem>\n\t\t)\n\t);\n}\n"],
5
+ "mappings": ";AAGA,SAAS,gBAAgB;AACzB,SAAS,aAAa,iBAAiB;AACvC,SAAS,UAAU;AAKnB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,cAAc;AA6CpB;AArCI,SAAS,iCAAkC,EAAE,UAAU,QAAQ,GAAI;AACzE,QAAM,EAAE,cAAc,kBAAkB,4BAA4B,IACnE;AAAA,IACC,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,OAAQ,gBAAiB,CAAE;AACvC,aAAO;AAAA,QACN,cAAc,gBAAiB,QAAS;AAAA,QACxC,kBAAkB,CAAC,CAAE,wBAAyB,QAAS;AAAA,QACvD,6BACC,4BAA4B,MAAM;AAAA,MACpC;AAAA,IACD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AACD,QAAM,qBAAqB,YAAa,gBAAiB;AACzD,QAAM,kBACL,CAAE,oBAAoB,iBAAiB;AAIxC,MACC,QAAQ,6CACN,CAAE,mBAAmB,CAAE,6BACxB;AACD,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,uBAAuB,IAAI,OAAQ,kBAAmB;AAC9D,QAAM,8BACL,CAAE,+BAA+B;AAElC,SACC,+BACC;AAAA,IAAC;AAAA;AAAA,MACA,SAAU,MAAM;AACf,+BAAwB,QAAS;AACjC,gBAAQ;AAAA,MACT;AAAA,MAEE,aAAI,UAAU,8BAA+B;AAAA;AAAA,EAChD;AAGH;",
6
6
  "names": []
7
7
  }
@@ -123,16 +123,20 @@ function BorderPanel({
123
123
  const showBorderWidth = useHasBorderWidthControl(settings);
124
124
  const showBorderRadius = useHasBorderRadiusControl(settings);
125
125
  const borderRadiusValues = useMemo(() => {
126
- if (typeof border?.radius !== "object") {
127
- return border?.radius;
126
+ if (typeof inheritedValue?.border?.radius !== "object") {
127
+ return decodeValue(inheritedValue?.border?.radius);
128
128
  }
129
129
  return {
130
- topLeft: border?.radius?.topLeft,
131
- topRight: border?.radius?.topRight,
132
- bottomLeft: border?.radius?.bottomLeft,
133
- bottomRight: border?.radius?.bottomRight
130
+ topLeft: decodeValue(inheritedValue?.border?.radius?.topLeft),
131
+ topRight: decodeValue(inheritedValue?.border?.radius?.topRight),
132
+ bottomLeft: decodeValue(
133
+ inheritedValue?.border?.radius?.bottomLeft
134
+ ),
135
+ bottomRight: decodeValue(
136
+ inheritedValue?.border?.radius?.bottomRight
137
+ )
134
138
  };
135
- }, [border?.radius]);
139
+ }, [inheritedValue?.border?.radius, decodeValue]);
136
140
  const setBorderRadius = (newBorderRadius) => setBorder({ ...border, radius: newBorderRadius });
137
141
  const hasBorderRadius = () => {
138
142
  const borderValues = value?.border?.radius;