@wordpress/block-editor 10.4.0 → 10.5.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 (254) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +0 -1
  3. package/build/components/block-lock/menu-item.js +1 -1
  4. package/build/components/block-lock/menu-item.js.map +1 -1
  5. package/build/components/block-lock/modal.js +16 -9
  6. package/build/components/block-lock/modal.js.map +1 -1
  7. package/build/components/block-styles/utils.js +3 -3
  8. package/build/components/block-styles/utils.js.map +1 -1
  9. package/build/components/block-switcher/index.js +19 -4
  10. package/build/components/block-switcher/index.js.map +1 -1
  11. package/build/components/block-tools/selected-block-popover.js +27 -4
  12. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  13. package/build/components/colors/with-colors.js +4 -3
  14. package/build/components/colors/with-colors.js.map +1 -1
  15. package/build/components/font-sizes/fluid-utils.js +24 -40
  16. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  17. package/build/components/font-sizes/with-font-sizes.js +7 -5
  18. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  19. package/build/components/index.js +9 -0
  20. package/build/components/index.js.map +1 -1
  21. package/build/components/inner-blocks/index.js +5 -3
  22. package/build/components/inner-blocks/index.js.map +1 -1
  23. package/build/components/inserter/reusable-blocks-tab.js +4 -1
  24. package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
  25. package/build/components/link-control/index.js +18 -34
  26. package/build/components/link-control/index.js.map +1 -1
  27. package/build/components/link-control/search-input.js +1 -1
  28. package/build/components/link-control/search-input.js.map +1 -1
  29. package/build/components/link-control/use-internal-input-value.js +26 -0
  30. package/build/components/link-control/use-internal-input-value.js.map +1 -0
  31. package/build/components/list-view/block.js +5 -3
  32. package/build/components/list-view/block.js.map +1 -1
  33. package/build/components/list-view/branch.js +9 -3
  34. package/build/components/list-view/branch.js.map +1 -1
  35. package/build/components/off-canvas-editor/block-contents.js +100 -0
  36. package/build/components/off-canvas-editor/block-contents.js.map +1 -0
  37. package/build/components/off-canvas-editor/block-select-button.js +119 -0
  38. package/build/components/off-canvas-editor/block-select-button.js.map +1 -0
  39. package/build/components/off-canvas-editor/block.js +292 -0
  40. package/build/components/off-canvas-editor/block.js.map +1 -0
  41. package/build/components/off-canvas-editor/branch.js +181 -0
  42. package/build/components/off-canvas-editor/branch.js.map +1 -0
  43. package/build/components/off-canvas-editor/context.js +19 -0
  44. package/build/components/off-canvas-editor/context.js.map +1 -0
  45. package/build/components/off-canvas-editor/drop-indicator.js +118 -0
  46. package/build/components/off-canvas-editor/drop-indicator.js.map +1 -0
  47. package/build/components/off-canvas-editor/expander.js +41 -0
  48. package/build/components/off-canvas-editor/expander.js.map +1 -0
  49. package/build/components/off-canvas-editor/index.js +204 -0
  50. package/build/components/off-canvas-editor/index.js.map +1 -0
  51. package/build/components/off-canvas-editor/leaf.js +60 -0
  52. package/build/components/off-canvas-editor/leaf.js.map +1 -0
  53. package/build/components/off-canvas-editor/use-block-selection.js +139 -0
  54. package/build/components/off-canvas-editor/use-block-selection.js.map +1 -0
  55. package/build/components/off-canvas-editor/use-list-view-client-ids.js +33 -0
  56. package/build/components/off-canvas-editor/use-list-view-client-ids.js.map +1 -0
  57. package/build/components/off-canvas-editor/use-list-view-drop-zone.js +235 -0
  58. package/build/components/off-canvas-editor/use-list-view-drop-zone.js.map +1 -0
  59. package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js +60 -0
  60. package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +1 -0
  61. package/build/components/off-canvas-editor/utils.js +60 -0
  62. package/build/components/off-canvas-editor/utils.js.map +1 -0
  63. package/build/components/url-popover/index.js +31 -2
  64. package/build/components/url-popover/index.js.map +1 -1
  65. package/build/components/use-setting/index.js +1 -1
  66. package/build/components/use-setting/index.js.map +1 -1
  67. package/build/hooks/color-panel.js +17 -1
  68. package/build/hooks/color-panel.js.map +1 -1
  69. package/build/hooks/color.js +1 -1
  70. package/build/hooks/color.js.map +1 -1
  71. package/build/hooks/content-lock-ui.js +13 -6
  72. package/build/hooks/content-lock-ui.js.map +1 -1
  73. package/build/hooks/dimensions.js +44 -13
  74. package/build/hooks/dimensions.js.map +1 -1
  75. package/build/hooks/layout.js +2 -2
  76. package/build/hooks/layout.js.map +1 -1
  77. package/build/hooks/margin.js +4 -2
  78. package/build/hooks/margin.js.map +1 -1
  79. package/build/hooks/min-height.js +145 -0
  80. package/build/hooks/min-height.js.map +1 -0
  81. package/build/hooks/padding.js +4 -2
  82. package/build/hooks/padding.js.map +1 -1
  83. package/build/hooks/style.js +3 -2
  84. package/build/hooks/style.js.map +1 -1
  85. package/build/layouts/flex.js +22 -21
  86. package/build/layouts/flex.js.map +1 -1
  87. package/build/store/actions.js +26 -0
  88. package/build/store/actions.js.map +1 -1
  89. package/build/store/reducer.js +46 -14
  90. package/build/store/reducer.js.map +1 -1
  91. package/build/store/selectors.js +16 -2
  92. package/build/store/selectors.js.map +1 -1
  93. package/build-module/components/block-lock/menu-item.js +2 -2
  94. package/build-module/components/block-lock/menu-item.js.map +1 -1
  95. package/build-module/components/block-lock/modal.js +17 -10
  96. package/build-module/components/block-lock/modal.js.map +1 -1
  97. package/build-module/components/block-styles/utils.js +3 -3
  98. package/build-module/components/block-styles/utils.js.map +1 -1
  99. package/build-module/components/block-switcher/index.js +19 -4
  100. package/build-module/components/block-switcher/index.js.map +1 -1
  101. package/build-module/components/block-tools/selected-block-popover.js +27 -5
  102. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  103. package/build-module/components/colors/with-colors.js +5 -4
  104. package/build-module/components/colors/with-colors.js.map +1 -1
  105. package/build-module/components/font-sizes/fluid-utils.js +24 -40
  106. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  107. package/build-module/components/font-sizes/with-font-sizes.js +8 -6
  108. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  109. package/build-module/components/index.js +1 -0
  110. package/build-module/components/index.js.map +1 -1
  111. package/build-module/components/inner-blocks/index.js +5 -3
  112. package/build-module/components/inner-blocks/index.js.map +1 -1
  113. package/build-module/components/inserter/reusable-blocks-tab.js +3 -1
  114. package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
  115. package/build-module/components/link-control/index.js +17 -34
  116. package/build-module/components/link-control/index.js.map +1 -1
  117. package/build-module/components/link-control/search-input.js +1 -1
  118. package/build-module/components/link-control/search-input.js.map +1 -1
  119. package/build-module/components/link-control/use-internal-input-value.js +18 -0
  120. package/build-module/components/link-control/use-internal-input-value.js.map +1 -0
  121. package/build-module/components/list-view/block.js +5 -3
  122. package/build-module/components/list-view/block.js.map +1 -1
  123. package/build-module/components/list-view/branch.js +9 -3
  124. package/build-module/components/list-view/branch.js.map +1 -1
  125. package/build-module/components/off-canvas-editor/block-contents.js +85 -0
  126. package/build-module/components/off-canvas-editor/block-contents.js.map +1 -0
  127. package/build-module/components/off-canvas-editor/block-select-button.js +101 -0
  128. package/build-module/components/off-canvas-editor/block-select-button.js.map +1 -0
  129. package/build-module/components/off-canvas-editor/block.js +268 -0
  130. package/build-module/components/off-canvas-editor/block.js.map +1 -0
  131. package/build-module/components/off-canvas-editor/branch.js +165 -0
  132. package/build-module/components/off-canvas-editor/branch.js.map +1 -0
  133. package/build-module/components/off-canvas-editor/context.js +7 -0
  134. package/build-module/components/off-canvas-editor/context.js.map +1 -0
  135. package/build-module/components/off-canvas-editor/drop-indicator.js +111 -0
  136. package/build-module/components/off-canvas-editor/drop-indicator.js.map +1 -0
  137. package/build-module/components/off-canvas-editor/expander.js +32 -0
  138. package/build-module/components/off-canvas-editor/expander.js.map +1 -0
  139. package/build-module/components/off-canvas-editor/index.js +181 -0
  140. package/build-module/components/off-canvas-editor/index.js.map +1 -0
  141. package/build-module/components/off-canvas-editor/leaf.js +45 -0
  142. package/build-module/components/off-canvas-editor/leaf.js.map +1 -0
  143. package/build-module/components/off-canvas-editor/use-block-selection.js +124 -0
  144. package/build-module/components/off-canvas-editor/use-block-selection.js.map +1 -0
  145. package/build-module/components/off-canvas-editor/use-list-view-client-ids.js +24 -0
  146. package/build-module/components/off-canvas-editor/use-list-view-client-ids.js.map +1 -0
  147. package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js +220 -0
  148. package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js.map +1 -0
  149. package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js +50 -0
  150. package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +1 -0
  151. package/build-module/components/off-canvas-editor/utils.js +44 -0
  152. package/build-module/components/off-canvas-editor/utils.js.map +1 -0
  153. package/build-module/components/url-popover/index.js +30 -3
  154. package/build-module/components/url-popover/index.js.map +1 -1
  155. package/build-module/components/use-setting/index.js +1 -1
  156. package/build-module/components/use-setting/index.js.map +1 -1
  157. package/build-module/hooks/color-panel.js +17 -1
  158. package/build-module/hooks/color-panel.js.map +1 -1
  159. package/build-module/hooks/color.js +1 -1
  160. package/build-module/hooks/color.js.map +1 -1
  161. package/build-module/hooks/content-lock-ui.js +15 -8
  162. package/build-module/hooks/content-lock-ui.js.map +1 -1
  163. package/build-module/hooks/dimensions.js +39 -12
  164. package/build-module/hooks/dimensions.js.map +1 -1
  165. package/build-module/hooks/layout.js +2 -2
  166. package/build-module/hooks/layout.js.map +1 -1
  167. package/build-module/hooks/margin.js +4 -2
  168. package/build-module/hooks/margin.js.map +1 -1
  169. package/build-module/hooks/min-height.js +122 -0
  170. package/build-module/hooks/min-height.js.map +1 -0
  171. package/build-module/hooks/padding.js +4 -2
  172. package/build-module/hooks/padding.js.map +1 -1
  173. package/build-module/hooks/style.js +4 -3
  174. package/build-module/hooks/style.js.map +1 -1
  175. package/build-module/layouts/flex.js +23 -22
  176. package/build-module/layouts/flex.js.map +1 -1
  177. package/build-module/store/actions.js +22 -0
  178. package/build-module/store/actions.js.map +1 -1
  179. package/build-module/store/reducer.js +44 -14
  180. package/build-module/store/reducer.js.map +1 -1
  181. package/build-module/store/selectors.js +13 -2
  182. package/build-module/store/selectors.js.map +1 -1
  183. package/build-style/style-rtl.css +39 -26
  184. package/build-style/style.css +39 -26
  185. package/package.json +28 -28
  186. package/src/components/alignment-control/README.md +1 -1
  187. package/src/components/block-alignment-control/test/index.native.js +4 -4
  188. package/src/components/block-draggable/test/helpers.native.js +3 -3
  189. package/src/components/block-draggable/test/index.native.js +27 -27
  190. package/src/components/block-list/style.scss +10 -5
  191. package/src/components/block-lock/menu-item.js +5 -2
  192. package/src/components/block-lock/modal.js +19 -36
  193. package/src/components/block-lock/style.scss +8 -17
  194. package/src/components/block-mover/style.scss +0 -1
  195. package/src/components/block-popover/style.scss +1 -1
  196. package/src/components/block-styles/utils.js +3 -3
  197. package/src/components/block-switcher/index.js +19 -4
  198. package/src/components/block-tools/selected-block-popover.js +80 -34
  199. package/src/components/block-tools/style.scss +15 -0
  200. package/src/components/colors/with-colors.js +13 -23
  201. package/src/components/default-block-appender/style.scss +1 -0
  202. package/src/components/font-sizes/fluid-utils.js +37 -64
  203. package/src/components/font-sizes/test/fluid-utils.js +5 -5
  204. package/src/components/font-sizes/with-font-sizes.js +14 -11
  205. package/src/components/index.js +1 -0
  206. package/src/components/inner-blocks/index.js +7 -4
  207. package/src/components/inserter/reusable-blocks-tab.js +4 -2
  208. package/src/components/inserter/style.scss +8 -7
  209. package/src/components/inserter/test/reusable-blocks-tab.js +14 -57
  210. package/src/components/link-control/index.js +23 -39
  211. package/src/components/link-control/search-input.js +1 -1
  212. package/src/components/link-control/test/index.js +272 -241
  213. package/src/components/link-control/use-internal-input-value.js +22 -0
  214. package/src/components/list-view/block.js +4 -3
  215. package/src/components/list-view/branch.js +11 -6
  216. package/src/components/off-canvas-editor/README.md +5 -0
  217. package/src/components/off-canvas-editor/block-contents.js +89 -0
  218. package/src/components/off-canvas-editor/block-select-button.js +113 -0
  219. package/src/components/off-canvas-editor/block.js +335 -0
  220. package/src/components/off-canvas-editor/branch.js +210 -0
  221. package/src/components/off-canvas-editor/context.js +8 -0
  222. package/src/components/off-canvas-editor/drop-indicator.js +126 -0
  223. package/src/components/off-canvas-editor/expander.js +26 -0
  224. package/src/components/off-canvas-editor/index.js +216 -0
  225. package/src/components/off-canvas-editor/leaf.js +48 -0
  226. package/src/components/off-canvas-editor/style.scss +397 -0
  227. package/src/components/off-canvas-editor/test/utils.js +50 -0
  228. package/src/components/off-canvas-editor/use-block-selection.js +169 -0
  229. package/src/components/off-canvas-editor/use-list-view-client-ids.js +29 -0
  230. package/src/components/off-canvas-editor/use-list-view-drop-zone.js +260 -0
  231. package/src/components/off-canvas-editor/use-list-view-expand-selected-item.js +58 -0
  232. package/src/components/off-canvas-editor/utils.js +58 -0
  233. package/src/components/responsive-block-control/test/index.js +69 -92
  234. package/src/components/url-popover/README.md +12 -3
  235. package/src/components/url-popover/index.js +33 -3
  236. package/src/components/use-setting/index.js +7 -1
  237. package/src/hooks/color-panel.js +13 -1
  238. package/src/hooks/color.js +2 -0
  239. package/src/hooks/content-lock-ui.js +46 -34
  240. package/src/hooks/dimensions.js +76 -16
  241. package/src/hooks/layout.js +2 -3
  242. package/src/hooks/margin.js +4 -3
  243. package/src/hooks/min-height.js +121 -0
  244. package/src/hooks/padding.js +4 -3
  245. package/src/hooks/style.js +10 -2
  246. package/src/hooks/test/style.js +4 -0
  247. package/src/hooks/test/use-typography-props.js +1 -1
  248. package/src/layouts/flex.js +43 -38
  249. package/src/store/actions.js +22 -0
  250. package/src/store/reducer.js +50 -40
  251. package/src/store/selectors.js +16 -9
  252. package/src/store/test/actions.js +18 -0
  253. package/src/store/test/reducer.js +40 -0
  254. package/src/store/test/selectors.js +19 -0
@@ -4,7 +4,7 @@
4
4
  import { __ } from '@wordpress/i18n';
5
5
  import { useReducer } from '@wordpress/element';
6
6
  import { MenuItem } from '@wordpress/components';
7
- import { lock, unlock } from '@wordpress/icons';
7
+ import { lockOutline, unlock } from '@wordpress/icons';
8
8
 
9
9
  /**
10
10
  * Internal dependencies
@@ -28,7 +28,10 @@ export default function BlockLockMenuItem( { clientId } ) {
28
28
 
29
29
  return (
30
30
  <>
31
- <MenuItem icon={ isLocked ? unlock : lock } onClick={ toggleModal }>
31
+ <MenuItem
32
+ icon={ isLocked ? unlock : lockOutline }
33
+ onClick={ toggleModal }
34
+ >
32
35
  { label }
33
36
  </MenuItem>
34
37
  { isModalOpen && (
@@ -114,6 +114,7 @@ export default function BlockLockModal( { clientId, onClose } ) {
114
114
  className="block-editor-block-lock-modal__options"
115
115
  >
116
116
  <CheckboxControl
117
+ __nextHasNoMarginBottom
117
118
  className="block-editor-block-lock-modal__options-title"
118
119
  label={
119
120
  <span id={ instanceId }>{ __( 'Lock all' ) }</span>
@@ -134,18 +135,8 @@ export default function BlockLockModal( { clientId, onClose } ) {
134
135
  { allowsEditLocking && (
135
136
  <li className="block-editor-block-lock-modal__checklist-item">
136
137
  <CheckboxControl
137
- label={
138
- <>
139
- { __( 'Restrict editing' ) }
140
- <Icon
141
- icon={
142
- lock.edit
143
- ? lockIcon
144
- : unlockIcon
145
- }
146
- />
147
- </>
148
- }
138
+ __nextHasNoMarginBottom
139
+ label={ __( 'Restrict editing' ) }
149
140
  checked={ !! lock.edit }
150
141
  onChange={ ( edit ) =>
151
142
  setLock( ( prevLock ) => ( {
@@ -154,22 +145,16 @@ export default function BlockLockModal( { clientId, onClose } ) {
154
145
  } ) )
155
146
  }
156
147
  />
148
+ <Icon
149
+ className="block-editor-block-lock-modal__lock-icon"
150
+ icon={ lock.edit ? lockIcon : unlockIcon }
151
+ />
157
152
  </li>
158
153
  ) }
159
154
  <li className="block-editor-block-lock-modal__checklist-item">
160
155
  <CheckboxControl
161
- label={
162
- <>
163
- { __( 'Disable movement' ) }
164
- <Icon
165
- icon={
166
- lock.move
167
- ? lockIcon
168
- : unlockIcon
169
- }
170
- />
171
- </>
172
- }
156
+ __nextHasNoMarginBottom
157
+ label={ __( 'Disable movement' ) }
173
158
  checked={ lock.move }
174
159
  onChange={ ( move ) =>
175
160
  setLock( ( prevLock ) => ( {
@@ -178,21 +163,15 @@ export default function BlockLockModal( { clientId, onClose } ) {
178
163
  } ) )
179
164
  }
180
165
  />
166
+ <Icon
167
+ className="block-editor-block-lock-modal__lock-icon"
168
+ icon={ lock.move ? lockIcon : unlockIcon }
169
+ />
181
170
  </li>
182
171
  <li className="block-editor-block-lock-modal__checklist-item">
183
172
  <CheckboxControl
184
- label={
185
- <>
186
- { __( 'Prevent removal' ) }
187
- <Icon
188
- icon={
189
- lock.remove
190
- ? lockIcon
191
- : unlockIcon
192
- }
193
- />
194
- </>
195
- }
173
+ __nextHasNoMarginBottom
174
+ label={ __( 'Prevent removal' ) }
196
175
  checked={ lock.remove }
197
176
  onChange={ ( remove ) =>
198
177
  setLock( ( prevLock ) => ( {
@@ -201,6 +180,10 @@ export default function BlockLockModal( { clientId, onClose } ) {
201
180
  } ) )
202
181
  }
203
182
  />
183
+ <Icon
184
+ className="block-editor-block-lock-modal__lock-icon"
185
+ icon={ lock.remove ? lockIcon : unlockIcon }
186
+ />
204
187
  </li>
205
188
  </ul>
206
189
  { hasTemplateLock && (
@@ -22,29 +22,20 @@
22
22
  .components-base-control__field {
23
23
  align-items: center;
24
24
  display: flex;
25
- margin: 0;
26
25
  }
27
26
  }
28
27
  .block-editor-block-lock-modal__checklist-item {
28
+ display: flex;
29
+ justify-content: space-between;
30
+ align-items: center;
31
+ gap: $grid-unit-15;
29
32
  margin-bottom: 0;
30
33
  padding: $grid-unit-15 0 $grid-unit-15 $grid-unit-40;
31
34
 
32
- .components-base-control__field {
33
- align-items: center;
34
- display: flex;
35
- margin: 0;
36
- }
37
-
38
- .components-checkbox-control__label {
39
- display: flex;
40
- align-items: center;
41
- justify-content: space-between;
42
- flex-grow: 1;
43
-
44
- svg {
45
- margin-right: $grid-unit-15;
46
- fill: $gray-900;
47
- }
35
+ .block-editor-block-lock-modal__lock-icon {
36
+ flex-shrink: 0;
37
+ margin-right: $grid-unit-15;
38
+ fill: $gray-900;
48
39
  }
49
40
 
50
41
  &:hover {
@@ -15,7 +15,6 @@
15
15
  // Focus style.
16
16
  &::before {
17
17
  height: calc(100% - 4px);
18
- width: calc(100% - 4px);
19
18
  }
20
19
  }
21
20
 
@@ -17,7 +17,7 @@
17
17
  }
18
18
 
19
19
  // Enable pointer events for the toolbar's content.
20
- &:not(.block-editor-block-popover__inbetween, .block-editor-block-popover__drop-zone) .components-popover__content {
20
+ &:not(.block-editor-block-popover__inbetween, .block-editor-block-popover__drop-zone, .block-editor-block-list__block-side-inserter-popover) .components-popover__content {
21
21
  * {
22
22
  pointer-events: all;
23
23
  }
@@ -11,7 +11,7 @@ import { _x } from '@wordpress/i18n';
11
11
  /**
12
12
  * Returns the active style from the given className.
13
13
  *
14
- * @param {Array} styles Block style variations.
14
+ * @param {Array} styles Block styles.
15
15
  * @param {string} className Class name
16
16
  *
17
17
  * @return {Object?} The active style.
@@ -59,7 +59,7 @@ export function replaceActiveStyle( className, activeStyle, newStyle ) {
59
59
  * act as a fallback for when there is no active style applied to a block. The default item also serves
60
60
  * as a switch on the frontend to deactivate non-default styles.
61
61
  *
62
- * @param {Array} styles Block style variations.
62
+ * @param {Array} styles Block styles.
63
63
  *
64
64
  * @return {Array<Object?>} The style collection.
65
65
  */
@@ -83,7 +83,7 @@ export function getRenderedStyles( styles ) {
83
83
  /**
84
84
  * Returns a style object from a collection of styles where that style object is the default block style.
85
85
  *
86
- * @param {Array} styles Block style variations.
86
+ * @param {Array} styles Block styles.
87
87
  *
88
88
  * @return {Object?} The default style object, if found.
89
89
  */
@@ -29,7 +29,7 @@ import PatternTransformationsMenu from './pattern-transformations-menu';
29
29
  import useBlockDisplayTitle from '../block-title/use-block-display-title';
30
30
 
31
31
  export const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {
32
- const { replaceBlocks } = useDispatch( blockEditorStore );
32
+ const { replaceBlocks, multiSelect } = useDispatch( blockEditorStore );
33
33
  const blockInformation = useBlockDisplayInformation( blocks[ 0 ].clientId );
34
34
  const {
35
35
  possibleBlockTransformations,
@@ -89,12 +89,27 @@ export const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {
89
89
  const isReusable = blocks.length === 1 && isReusableBlock( blocks[ 0 ] );
90
90
  const isTemplate = blocks.length === 1 && isTemplatePart( blocks[ 0 ] );
91
91
 
92
+ function selectForMultipleBlocks( insertedBlocks ) {
93
+ if ( insertedBlocks.length > 1 ) {
94
+ multiSelect(
95
+ insertedBlocks[ 0 ].clientId,
96
+ insertedBlocks[ insertedBlocks.length - 1 ].clientId
97
+ );
98
+ }
99
+ }
100
+
92
101
  // Simple block tranformation based on the `Block Transforms` API.
93
- const onBlockTransform = ( name ) =>
94
- replaceBlocks( clientIds, switchToBlockType( blocks, name ) );
102
+ function onBlockTransform( name ) {
103
+ const newBlocks = switchToBlockType( blocks, name );
104
+ replaceBlocks( clientIds, newBlocks );
105
+ selectForMultipleBlocks( newBlocks );
106
+ }
107
+
95
108
  // Pattern transformation through the `Patterns` API.
96
- const onPatternTransform = ( transformedBlocks ) =>
109
+ function onPatternTransform( transformedBlocks ) {
97
110
  replaceBlocks( clientIds, transformedBlocks );
111
+ selectForMultipleBlocks( transformedBlocks );
112
+ }
98
113
 
99
114
  /**
100
115
  * The `isTemplate` check is a stopgap solution here.
@@ -21,6 +21,7 @@ import BlockContextualToolbar from './block-contextual-toolbar';
21
21
  import { store as blockEditorStore } from '../../store';
22
22
  import BlockPopover from '../block-popover';
23
23
  import useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';
24
+ import Inserter from '../inserter';
24
25
 
25
26
  function selector( select ) {
26
27
  const {
@@ -28,13 +29,16 @@ function selector( select ) {
28
29
  isMultiSelecting,
29
30
  hasMultiSelection,
30
31
  isTyping,
32
+ __experimentalIsBlockInterfaceHidden: isBlockInterfaceHidden,
31
33
  getSettings,
32
34
  getLastMultiSelectedBlockClientId,
33
35
  } = select( blockEditorStore );
36
+
34
37
  return {
35
38
  editorMode: __unstableGetEditorMode(),
36
39
  isMultiSelecting: isMultiSelecting(),
37
40
  isTyping: isTyping(),
41
+ isBlockInterfaceHidden: isBlockInterfaceHidden(),
38
42
  hasFixedToolbar: getSettings().hasFixedToolbar,
39
43
  isDistractionFree: getSettings().isDistractionFree,
40
44
  lastClientId: hasMultiSelection()
@@ -56,6 +60,7 @@ function SelectedBlockPopover( {
56
60
  editorMode,
57
61
  isMultiSelecting,
58
62
  isTyping,
63
+ isBlockInterfaceHidden,
59
64
  hasFixedToolbar,
60
65
  isDistractionFree,
61
66
  lastClientId,
@@ -92,7 +97,8 @@ function SelectedBlockPopover( {
92
97
  isLargeViewport &&
93
98
  ! isMultiSelecting &&
94
99
  ! showEmptyBlockSideInserter &&
95
- ! isTyping;
100
+ ! isTyping &&
101
+ ! isBlockInterfaceHidden;
96
102
  const canFocusHiddenToolbar =
97
103
  editorMode === 'edit' &&
98
104
  ! shouldShowContextualToolbar &&
@@ -124,45 +130,85 @@ function SelectedBlockPopover( {
124
130
  clientId,
125
131
  } );
126
132
 
127
- if ( ! shouldShowBreadcrumb && ! shouldShowContextualToolbar ) {
133
+ if (
134
+ ! shouldShowBreadcrumb &&
135
+ ! shouldShowContextualToolbar &&
136
+ ! showEmptyBlockSideInserter
137
+ ) {
128
138
  return null;
129
139
  }
130
140
 
131
141
  return (
132
- <BlockPopover
133
- clientId={ capturingClientId || clientId }
134
- bottomClientId={ lastClientId }
135
- className={ classnames( 'block-editor-block-list__block-popover', {
136
- 'is-insertion-point-visible': isInsertionPointVisible,
137
- } ) }
138
- __unstablePopoverSlot={ __unstablePopoverSlot }
139
- __unstableContentRef={ __unstableContentRef }
140
- resize={ false }
141
- { ...popoverProps }
142
- >
143
- { shouldShowContextualToolbar && showContents && (
144
- <BlockContextualToolbar
145
- // If the toolbar is being shown because of being forced
146
- // it should focus the toolbar right after the mount.
147
- focusOnMount={ isToolbarForced.current }
148
- __experimentalInitialIndex={
149
- initialToolbarItemIndexRef.current
150
- }
151
- __experimentalOnIndexChange={ ( index ) => {
152
- initialToolbarItemIndexRef.current = index;
153
- } }
154
- // Resets the index whenever the active block changes so
155
- // this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
156
- key={ clientId }
157
- />
142
+ <>
143
+ { showEmptyBlockSideInserter && (
144
+ <BlockPopover
145
+ clientId={ capturingClientId || clientId }
146
+ __unstableCoverTarget
147
+ bottomClientId={ lastClientId }
148
+ className={ classnames(
149
+ 'block-editor-block-list__block-side-inserter-popover',
150
+ {
151
+ 'is-insertion-point-visible':
152
+ isInsertionPointVisible,
153
+ }
154
+ ) }
155
+ __unstablePopoverSlot={ __unstablePopoverSlot }
156
+ __unstableContentRef={ __unstableContentRef }
157
+ resize={ false }
158
+ shift={ false }
159
+ { ...popoverProps }
160
+ >
161
+ <div className="block-editor-block-list__empty-block-inserter">
162
+ <Inserter
163
+ position="bottom right"
164
+ rootClientId={ rootClientId }
165
+ clientId={ clientId }
166
+ __experimentalIsQuick
167
+ />
168
+ </div>
169
+ </BlockPopover>
158
170
  ) }
159
- { shouldShowBreadcrumb && (
160
- <BlockSelectionButton
161
- clientId={ clientId }
162
- rootClientId={ rootClientId }
163
- />
171
+ { ( shouldShowBreadcrumb || shouldShowContextualToolbar ) && (
172
+ <BlockPopover
173
+ clientId={ capturingClientId || clientId }
174
+ bottomClientId={ lastClientId }
175
+ className={ classnames(
176
+ 'block-editor-block-list__block-popover',
177
+ {
178
+ 'is-insertion-point-visible':
179
+ isInsertionPointVisible,
180
+ }
181
+ ) }
182
+ __unstablePopoverSlot={ __unstablePopoverSlot }
183
+ __unstableContentRef={ __unstableContentRef }
184
+ resize={ false }
185
+ { ...popoverProps }
186
+ >
187
+ { shouldShowContextualToolbar && showContents && (
188
+ <BlockContextualToolbar
189
+ // If the toolbar is being shown because of being forced
190
+ // it should focus the toolbar right after the mount.
191
+ focusOnMount={ isToolbarForced.current }
192
+ __experimentalInitialIndex={
193
+ initialToolbarItemIndexRef.current
194
+ }
195
+ __experimentalOnIndexChange={ ( index ) => {
196
+ initialToolbarItemIndexRef.current = index;
197
+ } }
198
+ // Resets the index whenever the active block changes so
199
+ // this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
200
+ key={ clientId }
201
+ />
202
+ ) }
203
+ { shouldShowBreadcrumb && (
204
+ <BlockSelectionButton
205
+ clientId={ clientId }
206
+ rootClientId={ rootClientId }
207
+ />
208
+ ) }
209
+ </BlockPopover>
164
210
  ) }
165
- </BlockPopover>
211
+ </>
166
212
  );
167
213
  }
168
214
 
@@ -42,7 +42,16 @@
42
42
  left: calc(50% - #{$button-size-small * 0.5});
43
43
  }
44
44
 
45
+ .block-editor-block-list__block-side-inserter-popover .components-popover__content > div {
46
+ pointer-events: none;
47
+
48
+ > * {
49
+ pointer-events: all;
50
+ }
51
+ }
52
+
45
53
  // Sibling inserter / "inbetweenserter".
54
+ .block-editor-block-list__empty-block-inserter,
46
55
  .block-editor-default-block-appender,
47
56
  .block-editor-block-list__insertion-point-inserter {
48
57
  .block-editor-inserter__toggle.components-button.has-icon {
@@ -166,6 +175,12 @@
166
175
  &:active {
167
176
  color: $white;
168
177
  }
178
+
179
+ // Make sure the button has no hover style when it's disabled.
180
+ &[aria-disabled="true"]:hover {
181
+ color: $white;
182
+ }
183
+
169
184
  display: flex;
170
185
  }
171
186
  .block-selection-button_select-button.components-button {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { kebabCase, reduce } from 'lodash';
4
+ import { kebabCase } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -83,18 +83,14 @@ const withEditorColorPalette = () =>
83
83
  * @return {WPComponent} The component that can be used as a HOC.
84
84
  */
85
85
  function createColorHOC( colorTypes, withColorPalette ) {
86
- const colorMap = reduce(
87
- colorTypes,
88
- ( colorObject, colorType ) => {
89
- return {
90
- ...colorObject,
91
- ...( typeof colorType === 'string'
92
- ? { [ colorType ]: kebabCase( colorType ) }
93
- : colorType ),
94
- };
95
- },
96
- {}
97
- );
86
+ const colorMap = colorTypes.reduce( ( colorObject, colorType ) => {
87
+ return {
88
+ ...colorObject,
89
+ ...( typeof colorType === 'string'
90
+ ? { [ colorType ]: kebabCase( colorType ) }
91
+ : colorType ),
92
+ };
93
+ }, {} );
98
94
 
99
95
  return compose( [
100
96
  withColorPalette,
@@ -118,13 +114,8 @@ function createColorHOC( colorTypes, withColorPalette ) {
118
114
  }
119
115
 
120
116
  createSetters() {
121
- return reduce(
122
- colorMap,
123
- (
124
- settersAccumulator,
125
- colorContext,
126
- colorAttributeName
127
- ) => {
117
+ return Object.keys( colorMap ).reduce(
118
+ ( settersAccumulator, colorAttributeName ) => {
128
119
  const upperFirstColorAttributeName =
129
120
  upperFirst( colorAttributeName );
130
121
  const customColorAttributeName = `custom${ upperFirstColorAttributeName }`;
@@ -163,9 +154,8 @@ function createColorHOC( colorTypes, withColorPalette ) {
163
154
  { attributes, colors },
164
155
  previousState
165
156
  ) {
166
- return reduce(
167
- colorMap,
168
- ( newState, colorContext, colorAttributeName ) => {
157
+ return Object.entries( colorMap ).reduce(
158
+ ( newState, [ colorAttributeName, colorContext ] ) => {
169
159
  const colorObject = getColorObjectByAttributeValues(
170
160
  colors,
171
161
  attributes[ colorAttributeName ],
@@ -34,6 +34,7 @@
34
34
 
35
35
  // The black plus that shows up on the right side of an empty paragraph block, or the initial appender
36
36
  // that exists only on empty documents.
37
+ .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter,
37
38
  .block-editor-default-block-appender .block-editor-inserter {
38
39
  position: absolute;
39
40
  top: 0;
@@ -9,7 +9,6 @@ const DEFAULT_MAXIMUM_VIEWPORT_WIDTH = '1600px';
9
9
  const DEFAULT_MINIMUM_VIEWPORT_WIDTH = '768px';
10
10
  const DEFAULT_SCALE_FACTOR = 1;
11
11
  const DEFAULT_MINIMUM_FONT_SIZE_FACTOR = 0.75;
12
- const DEFAULT_MAXIMUM_FONT_SIZE_FACTOR = 1.5;
13
12
  const DEFAULT_MINIMUM_FONT_SIZE_LIMIT = '14px';
14
13
 
15
14
  /**
@@ -41,7 +40,6 @@ const DEFAULT_MINIMUM_FONT_SIZE_LIMIT = '14px';
41
40
  * @param {?string} args.minimumFontSize Minimum font size for any clamp() calculation. Optional.
42
41
  * @param {?number} args.scaleFactor A scale factor to determine how fast a font scales within boundaries. Optional.
43
42
  * @param {?number} args.minimumFontSizeFactor How much to scale defaultFontSize by to derive minimumFontSize. Optional.
44
- * @param {?number} args.maximumFontSizeFactor How much to scale defaultFontSize by to derive maximumFontSize. Optional.
45
43
  *
46
44
  * @return {string|null} A font-size value using clamp().
47
45
  */
@@ -53,15 +51,8 @@ export function getComputedFluidTypographyValue( {
53
51
  maximumViewPortWidth = DEFAULT_MAXIMUM_VIEWPORT_WIDTH,
54
52
  scaleFactor = DEFAULT_SCALE_FACTOR,
55
53
  minimumFontSizeFactor = DEFAULT_MINIMUM_FONT_SIZE_FACTOR,
56
- maximumFontSizeFactor = DEFAULT_MAXIMUM_FONT_SIZE_FACTOR,
57
54
  minimumFontSizeLimit = DEFAULT_MINIMUM_FONT_SIZE_LIMIT,
58
55
  } ) {
59
- /*
60
- * Caches minimumFontSize in minimumFontSizeValue
61
- * so we can check if minimumFontSize exists later.
62
- */
63
- let minimumFontSizeValue = minimumFontSize;
64
-
65
56
  /*
66
57
  * Calculates missing minimumFontSize and maximumFontSize from
67
58
  * defaultFontSize if provided.
@@ -75,15 +66,6 @@ export function getComputedFluidTypographyValue( {
75
66
  return null;
76
67
  }
77
68
 
78
- // If no minimumFontSize is provided, derive using min scale factor.
79
- if ( ! minimumFontSizeValue ) {
80
- minimumFontSizeValue =
81
- roundToPrecision(
82
- fontSizeParsed.value * minimumFontSizeFactor,
83
- 3
84
- ) + fontSizeParsed.unit;
85
- }
86
-
87
69
  // Parses the minimum font size limit, so we can perform checks using it.
88
70
  const minimumFontSizeLimitParsed = getTypographyValueAndUnit(
89
71
  minimumFontSizeLimit,
@@ -92,57 +74,51 @@ export function getComputedFluidTypographyValue( {
92
74
  }
93
75
  );
94
76
 
95
- if ( !! minimumFontSizeLimitParsed?.value ) {
77
+ // Don't enforce minimum font size if a font size has explicitly set a min and max value.
78
+ if (
79
+ !! minimumFontSizeLimitParsed?.value &&
80
+ ! minimumFontSize &&
81
+ ! maximumFontSize
82
+ ) {
96
83
  /*
97
84
  * If a minimum size was not passed to this function
98
- * and the user-defined font size is lower than `minimumFontSizeLimit`,
99
- * then uses the user-defined font size as the minimum font-size.
85
+ * and the user-defined font size is lower than $minimum_font_size_limit,
86
+ * do not calculate a fluid value.
100
87
  */
101
- if (
102
- ! minimumFontSize &&
103
- fontSizeParsed?.value < minimumFontSizeLimitParsed?.value
104
- ) {
105
- minimumFontSizeValue = `${ fontSizeParsed.value }${ fontSizeParsed.unit }`;
106
- } else {
107
- const minimumFontSizeParsed = getTypographyValueAndUnit(
108
- minimumFontSizeValue,
109
- {
110
- coerceTo: fontSizeParsed.unit,
111
- }
112
- );
113
-
114
- /*
115
- * Otherwise, if the passed or calculated minimum font size is lower than `minimumFontSizeLimit`
116
- * use `minimumFontSizeLimit` instead.
117
- */
118
- if (
119
- !! minimumFontSizeParsed?.value &&
120
- minimumFontSizeParsed.value <
121
- minimumFontSizeLimitParsed.value
122
- ) {
123
- minimumFontSizeValue = `${ minimumFontSizeLimitParsed.value }${ minimumFontSizeLimitParsed.unit }`;
124
- }
88
+ if ( fontSizeParsed?.value <= minimumFontSizeLimitParsed?.value ) {
89
+ return null;
125
90
  }
126
91
  }
127
92
 
128
- // If no maximumFontSize is provided, derive using max scale factor.
93
+ // If no fluid max font size is available use the incoming value.
129
94
  if ( ! maximumFontSize ) {
130
- maximumFontSize =
131
- roundToPrecision(
132
- fontSizeParsed.value * maximumFontSizeFactor,
133
- 3
134
- ) + fontSizeParsed.unit;
95
+ maximumFontSize = `${ fontSizeParsed.value }${ fontSizeParsed.unit }`;
135
96
  }
136
- }
137
97
 
138
- // Return early if one of the provided inputs is not provided.
139
- if ( ! minimumFontSizeValue || ! maximumFontSize ) {
140
- return null;
98
+ /*
99
+ * If no minimumFontSize is provided, create one using
100
+ * the given font size multiplied by the min font size scale factor.
101
+ */
102
+ if ( ! minimumFontSize ) {
103
+ const calculatedMinimumFontSize = roundToPrecision(
104
+ fontSizeParsed.value * minimumFontSizeFactor,
105
+ 3
106
+ );
107
+
108
+ // Only use calculated min font size if it's > $minimum_font_size_limit value.
109
+ if (
110
+ !! minimumFontSizeLimitParsed?.value &&
111
+ calculatedMinimumFontSize < minimumFontSizeLimitParsed?.value
112
+ ) {
113
+ minimumFontSize = `${ minimumFontSizeLimitParsed.value }${ minimumFontSizeLimitParsed.unit }`;
114
+ } else {
115
+ minimumFontSize = `${ calculatedMinimumFontSize }${ fontSizeParsed.unit }`;
116
+ }
117
+ }
141
118
  }
142
119
 
143
120
  // Grab the minimum font size and normalize it in order to use the value for calculations.
144
- const minimumFontSizeParsed =
145
- getTypographyValueAndUnit( minimumFontSizeValue );
121
+ const minimumFontSizeParsed = getTypographyValueAndUnit( minimumFontSize );
146
122
 
147
123
  // We get a 'preferred' unit to keep units consistent when calculating,
148
124
  // otherwise the result will not be accurate.
@@ -159,12 +135,9 @@ export function getComputedFluidTypographyValue( {
159
135
  }
160
136
 
161
137
  // Uses rem for accessible fluid target font scaling.
162
- const minimumFontSizeRem = getTypographyValueAndUnit(
163
- minimumFontSizeValue,
164
- {
165
- coerceTo: 'rem',
166
- }
167
- );
138
+ const minimumFontSizeRem = getTypographyValueAndUnit( minimumFontSize, {
139
+ coerceTo: 'rem',
140
+ } );
168
141
 
169
142
  // Viewport widths defined for fluid typography. Normalize units
170
143
  const maximumViewPortWidthParsed = getTypographyValueAndUnit(
@@ -205,7 +178,7 @@ export function getComputedFluidTypographyValue( {
205
178
  );
206
179
  const fluidTargetFontSize = `${ minimumFontSizeRem.value }${ minimumFontSizeRem.unit } + ((1vw - ${ viewPortWidthOffset }) * ${ linearFactorScaled })`;
207
180
 
208
- return `clamp(${ minimumFontSizeValue }, ${ fluidTargetFontSize }, ${ maximumFontSize })`;
181
+ return `clamp(${ minimumFontSize }, ${ fluidTargetFontSize }, ${ maximumFontSize })`;
209
182
  }
210
183
 
211
184
  /**