@wordpress/block-editor 14.3.4 → 14.3.6

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 (157) hide show
  1. package/README.md +4 -0
  2. package/build/components/block-list/block.js +0 -3
  3. package/build/components/block-list/block.js.map +1 -1
  4. package/build/components/block-list/use-block-props/index.js +1 -4
  5. package/build/components/block-list/use-block-props/index.js.map +1 -1
  6. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +9 -12
  7. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -1
  8. package/build/components/block-variation-picker/index.js +2 -4
  9. package/build/components/block-variation-picker/index.js.map +1 -1
  10. package/build/components/block-variation-transforms/index.js +3 -4
  11. package/build/components/block-variation-transforms/index.js.map +1 -1
  12. package/build/components/button-block-appender/index.js +2 -4
  13. package/build/components/button-block-appender/index.js.map +1 -1
  14. package/build/components/colors-gradients/dropdown.js +2 -4
  15. package/build/components/colors-gradients/dropdown.js.map +1 -1
  16. package/build/components/global-styles/color-panel.js +2 -4
  17. package/build/components/global-styles/color-panel.js.map +1 -1
  18. package/build/components/global-styles/filters-panel.js +2 -4
  19. package/build/components/global-styles/filters-panel.js.map +1 -1
  20. package/build/components/global-styles/shadow-panel-components.js +24 -29
  21. package/build/components/global-styles/shadow-panel-components.js.map +1 -1
  22. package/build/components/iframe/index.js +6 -1
  23. package/build/components/iframe/index.js.map +1 -1
  24. package/build/components/inserter/menu.js +3 -0
  25. package/build/components/inserter/menu.js.map +1 -1
  26. package/build/components/inspector-controls-tabs/index.js +11 -8
  27. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  28. package/build/components/inspector-popover-header/index.js +4 -8
  29. package/build/components/inspector-popover-header/index.js.map +1 -1
  30. package/build/components/link-control/index.js +4 -8
  31. package/build/components/link-control/index.js.map +1 -1
  32. package/build/components/link-control/settings-drawer.js +2 -4
  33. package/build/components/link-control/settings-drawer.js.map +1 -1
  34. package/build/components/list-view/block-select-button.js +1 -4
  35. package/build/components/list-view/block-select-button.js.map +1 -1
  36. package/build/components/media-placeholder/index.js +12 -24
  37. package/build/components/media-placeholder/index.js.map +1 -1
  38. package/build/components/skip-to-selected-block/index.js +2 -4
  39. package/build/components/skip-to-selected-block/index.js.map +1 -1
  40. package/build/components/tool-selector/index.js +7 -5
  41. package/build/components/tool-selector/index.js.map +1 -1
  42. package/build/components/url-input/button.js +14 -16
  43. package/build/components/url-input/button.js.map +1 -1
  44. package/build/components/url-input/index.js +2 -4
  45. package/build/components/url-input/index.js.map +1 -1
  46. package/build/components/use-resize-canvas/index.js +1 -2
  47. package/build/components/use-resize-canvas/index.js.map +1 -1
  48. package/build/hooks/grid-visualizer.js +13 -11
  49. package/build/hooks/grid-visualizer.js.map +1 -1
  50. package/build/hooks/layout-child.js +41 -3
  51. package/build/hooks/layout-child.js.map +1 -1
  52. package/build/layouts/flex.js +6 -38
  53. package/build/layouts/flex.js.map +1 -1
  54. package/build/private-apis.js +2 -0
  55. package/build/private-apis.js.map +1 -1
  56. package/build/utils/block-bindings.js +9 -6
  57. package/build/utils/block-bindings.js.map +1 -1
  58. package/build-module/components/block-list/block.js +0 -3
  59. package/build-module/components/block-list/block.js.map +1 -1
  60. package/build-module/components/block-list/use-block-props/index.js +1 -4
  61. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  62. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +9 -12
  63. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -1
  64. package/build-module/components/block-variation-picker/index.js +2 -4
  65. package/build-module/components/block-variation-picker/index.js.map +1 -1
  66. package/build-module/components/block-variation-transforms/index.js +3 -4
  67. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  68. package/build-module/components/button-block-appender/index.js +2 -4
  69. package/build-module/components/button-block-appender/index.js.map +1 -1
  70. package/build-module/components/colors-gradients/dropdown.js +2 -4
  71. package/build-module/components/colors-gradients/dropdown.js.map +1 -1
  72. package/build-module/components/global-styles/color-panel.js +2 -4
  73. package/build-module/components/global-styles/color-panel.js.map +1 -1
  74. package/build-module/components/global-styles/filters-panel.js +2 -4
  75. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  76. package/build-module/components/global-styles/shadow-panel-components.js +25 -30
  77. package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
  78. package/build-module/components/iframe/index.js +6 -1
  79. package/build-module/components/iframe/index.js.map +1 -1
  80. package/build-module/components/inserter/menu.js +3 -0
  81. package/build-module/components/inserter/menu.js.map +1 -1
  82. package/build-module/components/inspector-controls-tabs/index.js +12 -9
  83. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  84. package/build-module/components/inspector-popover-header/index.js +4 -8
  85. package/build-module/components/inspector-popover-header/index.js.map +1 -1
  86. package/build-module/components/link-control/index.js +4 -8
  87. package/build-module/components/link-control/index.js.map +1 -1
  88. package/build-module/components/link-control/settings-drawer.js +2 -4
  89. package/build-module/components/link-control/settings-drawer.js.map +1 -1
  90. package/build-module/components/list-view/block-select-button.js +2 -5
  91. package/build-module/components/list-view/block-select-button.js.map +1 -1
  92. package/build-module/components/media-placeholder/index.js +12 -24
  93. package/build-module/components/media-placeholder/index.js.map +1 -1
  94. package/build-module/components/skip-to-selected-block/index.js +2 -4
  95. package/build-module/components/skip-to-selected-block/index.js.map +1 -1
  96. package/build-module/components/tool-selector/index.js +7 -5
  97. package/build-module/components/tool-selector/index.js.map +1 -1
  98. package/build-module/components/url-input/button.js +15 -17
  99. package/build-module/components/url-input/button.js.map +1 -1
  100. package/build-module/components/url-input/index.js +2 -4
  101. package/build-module/components/url-input/index.js.map +1 -1
  102. package/build-module/components/use-resize-canvas/index.js +1 -2
  103. package/build-module/components/use-resize-canvas/index.js.map +1 -1
  104. package/build-module/hooks/grid-visualizer.js +13 -11
  105. package/build-module/hooks/grid-visualizer.js.map +1 -1
  106. package/build-module/hooks/layout-child.js +41 -3
  107. package/build-module/hooks/layout-child.js.map +1 -1
  108. package/build-module/layouts/flex.js +7 -39
  109. package/build-module/layouts/flex.js.map +1 -1
  110. package/build-module/private-apis.js +2 -0
  111. package/build-module/private-apis.js.map +1 -1
  112. package/build-module/utils/block-bindings.js +9 -6
  113. package/build-module/utils/block-bindings.js.map +1 -1
  114. package/build-style/content-rtl.css +6 -10
  115. package/build-style/content.css +6 -10
  116. package/build-style/style-rtl.css +27 -26
  117. package/build-style/style.css +27 -26
  118. package/package.json +5 -5
  119. package/src/components/block-inspector/style.scss +2 -0
  120. package/src/components/block-list/block.js +0 -3
  121. package/src/components/block-list/use-block-props/index.js +1 -2
  122. package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +19 -11
  123. package/src/components/block-tools/style.scss +5 -0
  124. package/src/components/block-variation-picker/index.js +1 -2
  125. package/src/components/block-variation-transforms/index.js +2 -2
  126. package/src/components/button-block-appender/content.scss +0 -5
  127. package/src/components/button-block-appender/index.js +1 -2
  128. package/src/components/colors-gradients/dropdown.js +1 -5
  129. package/src/components/global-styles/color-panel.js +1 -5
  130. package/src/components/global-styles/filters-panel.js +1 -2
  131. package/src/components/global-styles/shadow-panel-components.js +28 -33
  132. package/src/components/global-styles/style.scss +5 -0
  133. package/src/components/iframe/content.scss +7 -8
  134. package/src/components/iframe/index.js +7 -1
  135. package/src/components/iframe/style.scss +17 -0
  136. package/src/components/inserter/menu.js +5 -0
  137. package/src/components/inspector-controls-tabs/index.js +21 -20
  138. package/src/components/inspector-popover-header/index.js +2 -4
  139. package/src/components/inspector-popover-header/style.scss +0 -13
  140. package/src/components/link-control/index.js +2 -4
  141. package/src/components/link-control/settings-drawer.js +1 -2
  142. package/src/components/list-view/block-select-button.js +2 -5
  143. package/src/components/list-view/style.scss +18 -0
  144. package/src/components/media-placeholder/index.js +6 -12
  145. package/src/components/skip-to-selected-block/index.js +1 -2
  146. package/src/components/skip-to-selected-block/style.scss +0 -9
  147. package/src/components/tool-selector/index.js +6 -4
  148. package/src/components/url-input/button.js +16 -12
  149. package/src/components/url-input/index.js +1 -2
  150. package/src/components/url-input/style.scss +0 -6
  151. package/src/components/use-resize-canvas/index.js +1 -3
  152. package/src/hooks/grid-visualizer.js +23 -9
  153. package/src/hooks/layout-child.js +48 -3
  154. package/src/layouts/flex.js +10 -53
  155. package/src/private-apis.js +2 -0
  156. package/src/utils/block-bindings.js +9 -6
  157. package/src/utils/test/use-block-bindings-utils.js +174 -0
@@ -710,7 +710,6 @@ function BlockListBlockProvider( props ) {
710
710
  ) && hasSelectedInnerBlock( clientId ),
711
711
  blockApiVersion: blockType?.apiVersion || 1,
712
712
  blockTitle: match?.title || blockType?.title,
713
- editorMode,
714
713
  isSubtreeDisabled:
715
714
  blockEditingMode === 'disabled' &&
716
715
  isBlockSubtreeDisabled( clientId ),
@@ -766,7 +765,6 @@ function BlockListBlockProvider( props ) {
766
765
  themeSupportsLayout,
767
766
  isTemporarilyEditingAsBlocks,
768
767
  blockEditingMode,
769
- editorMode,
770
768
  mayDisplayControls,
771
769
  mayDisplayParentControls,
772
770
  index,
@@ -821,7 +819,6 @@ function BlockListBlockProvider( props ) {
821
819
  hasOverlay,
822
820
  initialPosition,
823
821
  blockEditingMode,
824
- editorMode,
825
822
  isHighlighted,
826
823
  isMultiSelected,
827
824
  isPartiallySelected,
@@ -86,7 +86,6 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
86
86
  name,
87
87
  blockApiVersion,
88
88
  blockTitle,
89
- editorMode,
90
89
  isSelected,
91
90
  isSubtreeDisabled,
92
91
  hasOverlay,
@@ -117,7 +116,7 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
117
116
  useFocusHandler( clientId ),
118
117
  useEventHandlers( { clientId, isSelected } ),
119
118
  useNavModeExit( clientId ),
120
- useZoomOutModeExit( { editorMode } ),
119
+ useZoomOutModeExit(),
121
120
  useIsHovered( { clientId } ),
122
121
  useIntersectionObserver(),
123
122
  useMovingAnimation( { triggerAnimationOnChange: index, clientId } ),
@@ -12,25 +12,27 @@ import { unlock } from '../../../lock-unlock';
12
12
 
13
13
  /**
14
14
  * Allows Zoom Out mode to be exited by double clicking in the selected block.
15
- *
16
- * @param {string} clientId Block client ID.
17
15
  */
18
- export function useZoomOutModeExit( { editorMode } ) {
19
- const { getSettings, isZoomOut } = unlock( useSelect( blockEditorStore ) );
16
+ export function useZoomOutModeExit() {
17
+ const { getSettings, isZoomOut, __unstableGetEditorMode } = unlock(
18
+ useSelect( blockEditorStore )
19
+ );
20
+
20
21
  const { __unstableSetEditorMode, resetZoomLevel } = unlock(
21
22
  useDispatch( blockEditorStore )
22
23
  );
23
24
 
24
25
  return useRefEffect(
25
26
  ( node ) => {
26
- // In "compose" mode.
27
- const composeMode = editorMode === 'zoom-out' && isZoomOut();
27
+ function onDoubleClick( event ) {
28
+ // In "compose" mode.
29
+ const composeMode =
30
+ __unstableGetEditorMode() === 'zoom-out' && isZoomOut();
28
31
 
29
- if ( ! composeMode ) {
30
- return;
31
- }
32
+ if ( ! composeMode ) {
33
+ return;
34
+ }
32
35
 
33
- function onDoubleClick( event ) {
34
36
  if ( ! event.defaultPrevented ) {
35
37
  event.preventDefault();
36
38
 
@@ -52,6 +54,12 @@ export function useZoomOutModeExit( { editorMode } ) {
52
54
  node.removeEventListener( 'dblclick', onDoubleClick );
53
55
  };
54
56
  },
55
- [ editorMode, getSettings, __unstableSetEditorMode ]
57
+ [
58
+ getSettings,
59
+ __unstableSetEditorMode,
60
+ __unstableGetEditorMode,
61
+ isZoomOut,
62
+ resetZoomLevel,
63
+ ]
56
64
  );
57
65
  }
@@ -283,6 +283,11 @@
283
283
  background: none;
284
284
  border: none;
285
285
  }
286
+
287
+ // Make the spacing consistent between controls.
288
+ .zoom-out-toolbar-button {
289
+ height: $button-size-next-default-40px;
290
+ }
286
291
  }
287
292
 
288
293
  .block-editor-block-tools__zoom-out-mode-inserter-button {
@@ -64,8 +64,7 @@ function BlockVariationPicker( {
64
64
  { allowSkip && (
65
65
  <div className="block-editor-block-variation-picker__skip">
66
66
  <Button
67
- // TODO: Switch to `true` (40px size) if possible
68
- __next40pxDefaultSize={ false }
67
+ __next40pxDefaultSize
69
68
  variant="link"
70
69
  onClick={ () => onSelect() }
71
70
  >
@@ -36,8 +36,8 @@ function VariationsButtons( {
36
36
  </VisuallyHidden>
37
37
  { variations.map( ( variation ) => (
38
38
  <Button
39
- // TODO: Switch to `true` (40px size) if possible
40
- __next40pxDefaultSize={ false }
39
+ __next40pxDefaultSize
40
+ size="compact"
41
41
  key={ variation.name }
42
42
  icon={ <BlockIcon icon={ variation.icon } showColors /> }
43
43
  isPressed={ selectedValue === variation.name }
@@ -8,11 +8,6 @@
8
8
  color: $gray-900;
9
9
  box-shadow: inset 0 0 0 $border-width $gray-900;
10
10
 
11
- // Needs specificity to override button styles.
12
- &.components-button.components-button {
13
- padding: $grid-unit-15;
14
- }
15
-
16
11
  .is-dark-theme & {
17
12
  color: $light-gray-placeholder;
18
13
  box-shadow: inset 0 0 0 $border-width $light-gray-placeholder;
@@ -60,8 +60,7 @@ function ButtonBlockAppender(
60
60
 
61
61
  return (
62
62
  <Button
63
- // TODO: Switch to `true` (40px size) if possible
64
- __next40pxDefaultSize={ false }
63
+ __next40pxDefaultSize
65
64
  ref={ mergedInserterButtonRef }
66
65
  onFocus={ onFocus }
67
66
  tabIndex={ tabIndex }
@@ -88,11 +88,7 @@ const renderToggle =
88
88
  };
89
89
 
90
90
  return (
91
- <Button
92
- // TODO: Switch to `true` (40px size) if possible
93
- __next40pxDefaultSize={ false }
94
- { ...toggleProps }
95
- >
91
+ <Button __next40pxDefaultSize { ...toggleProps }>
96
92
  <LabeledColorIndicator
97
93
  colorValue={ colorValue }
98
94
  label={ label }
@@ -239,11 +239,7 @@ function ColorPanelDropdown( {
239
239
  };
240
240
 
241
241
  return (
242
- <Button
243
- // TODO: Switch to `true` (40px size) if possible
244
- __next40pxDefaultSize={ false }
245
- { ...toggleProps }
246
- >
242
+ <Button __next40pxDefaultSize { ...toggleProps }>
247
243
  <LabeledColorIndicators
248
244
  indicators={ indicators }
249
245
  label={ label }
@@ -190,8 +190,7 @@ export default function FiltersPanel( {
190
190
  return (
191
191
  <ItemGroup isBordered isSeparated>
192
192
  <Button
193
- // TODO: Switch to `true` (40px size) if possible
194
- __next40pxDefaultSize={ false }
193
+ __next40pxDefaultSize
195
194
  { ...toggleProps }
196
195
  >
197
196
  <LabeledColorIndicator
@@ -11,6 +11,7 @@ import {
11
11
  FlexItem,
12
12
  Dropdown,
13
13
  Composite,
14
+ Tooltip,
14
15
  } from '@wordpress/components';
15
16
  import { useMemo } from '@wordpress/element';
16
17
  import { shadow as shadowIcon, Icon, check } from '@wordpress/icons';
@@ -42,8 +43,7 @@ export function ShadowPopoverContainer( { shadow, onShadowChange, settings } ) {
42
43
  />
43
44
  <div className="block-editor-global-styles__clear-shadow">
44
45
  <Button
45
- // TODO: Switch to `true` (40px size) if possible
46
- __next40pxDefaultSize={ false }
46
+ __next40pxDefaultSize
47
47
  variant="tertiary"
48
48
  onClick={ () => onShadowChange( undefined ) }
49
49
  >
@@ -80,32 +80,31 @@ export function ShadowPresets( { presets, activeShadow, onSelect } ) {
80
80
 
81
81
  export function ShadowIndicator( { type, label, isActive, onSelect, shadow } ) {
82
82
  return (
83
- <Composite.Item
84
- role="option"
85
- aria-label={ label }
86
- aria-selected={ isActive }
87
- className={ clsx( 'block-editor-global-styles__shadow__item', {
88
- 'is-active': isActive,
89
- } ) }
90
- render={
91
- <Button
92
- // TODO: Switch to `true` (40px size) if possible
93
- __next40pxDefaultSize={ false }
94
- className={ clsx(
95
- 'block-editor-global-styles__shadow-indicator',
96
- {
97
- unset: type === 'unset',
98
- }
99
- ) }
100
- onClick={ onSelect }
101
- label={ label }
102
- style={ { boxShadow: shadow } }
103
- showTooltip
104
- >
105
- { isActive && <Icon icon={ check } /> }
106
- </Button>
107
- }
108
- />
83
+ <Tooltip text={ label }>
84
+ <Composite.Item
85
+ role="option"
86
+ aria-label={ label }
87
+ aria-selected={ isActive }
88
+ className={ clsx( 'block-editor-global-styles__shadow__item', {
89
+ 'is-active': isActive,
90
+ } ) }
91
+ render={
92
+ <button
93
+ className={ clsx(
94
+ 'block-editor-global-styles__shadow-indicator',
95
+ {
96
+ unset: type === 'unset',
97
+ }
98
+ ) }
99
+ onClick={ onSelect }
100
+ style={ { boxShadow: shadow } }
101
+ aria-label={ label }
102
+ >
103
+ { isActive && <Icon icon={ check } /> }
104
+ </button>
105
+ }
106
+ />
107
+ </Tooltip>
109
108
  );
110
109
  }
111
110
 
@@ -143,11 +142,7 @@ function renderShadowToggle() {
143
142
  };
144
143
 
145
144
  return (
146
- <Button
147
- // TODO: Switch to `true` (40px size) if possible
148
- __next40pxDefaultSize={ false }
149
- { ...toggleProps }
150
- >
145
+ <Button __next40pxDefaultSize { ...toggleProps }>
151
146
  <HStack justify="flex-start">
152
147
  <Icon
153
148
  className="block-editor-global-styles__toggle-icon"
@@ -37,10 +37,15 @@
37
37
 
38
38
  // These styles are similar to the color palette.
39
39
  .block-editor-global-styles__shadow-indicator {
40
+ appearance: none;
41
+ background: none;
40
42
  color: $gray-800;
41
43
  border: $gray-200 $border-width solid;
42
44
  border-radius: $radius-small;
43
45
  cursor: pointer;
46
+ display: inline-flex;
47
+ align-items: center;
48
+
44
49
  padding: 0;
45
50
 
46
51
  height: $button-size-small + 2 * $border-width;
@@ -1,5 +1,6 @@
1
1
  .block-editor-iframe__body {
2
2
  position: relative;
3
+ border: 0.01px solid transparent;
3
4
  }
4
5
 
5
6
  .block-editor-iframe__container {
@@ -22,7 +23,6 @@
22
23
  }
23
24
 
24
25
  .block-editor-iframe__html {
25
- border: 0 solid $gray-300;
26
26
  transform-origin: top center;
27
27
  @include editor-canvas-resize-animation;
28
28
  }
@@ -38,21 +38,20 @@
38
38
 
39
39
  background-color: $gray-300;
40
40
 
41
- // Firefox and Safari don't render margin-bottom here and margin-bottom is needed for Chrome
42
- // layout, so we use border matching the background instead of margins.
43
- border: calc(#{$frame-size} / #{$scale}) solid $gray-300;
44
-
45
41
  // Chrome seems to respect that transform scale shouldn't affect the layout size of the element,
46
42
  // so we need to adjust the height of the content to match the scale by using negative margins.
47
43
  $extra-content-height: calc(#{$content-height} * (1 - #{$scale}));
48
- $total-frame-height: calc(2 * #{$frame-size});
44
+ $total-frame-height: calc(2 * #{$frame-size} / #{$scale});
49
45
  $total-height: calc(#{$extra-content-height} + #{$total-frame-height} + 2px);
50
46
  margin-bottom: calc(-1 * #{$total-height});
47
+ // Add the top/bottom frame size. We use scaling to account for the left/right, as
48
+ // the padding left/right causes the contents to reflow, which breaks the 1:1 scaling
49
+ // of the content.
50
+ padding-top: calc(#{$frame-size} / #{$scale});
51
+ padding-bottom: calc(#{$frame-size} / #{$scale});
51
52
 
52
53
  body {
53
54
  min-height: calc((#{$inner-height} - #{$total-frame-height}) / #{$scale});
54
- display: flex;
55
- flex-direction: column;
56
55
 
57
56
  > .is-root-container:not(.wp-block-post-content) {
58
57
  flex: 1;
@@ -306,13 +306,19 @@ function Iframe( {
306
306
  iframeDocument.documentElement.classList.add( 'is-zoomed-out' );
307
307
 
308
308
  const maxWidth = 750;
309
+ // This scaling calculation has to happen within the JS because CSS calc() can
310
+ // only divide and multiply by a unitless value. I.e. calc( 100px / 2 ) is valid
311
+ // but calc( 100px / 2px ) is not.
309
312
  iframeDocument.documentElement.style.setProperty(
310
313
  '--wp-block-editor-iframe-zoom-out-scale',
311
314
  scale === 'default'
312
- ? Math.min( containerWidth, maxWidth ) /
315
+ ? ( Math.min( containerWidth, maxWidth ) -
316
+ parseInt( frameSize ) * 2 ) /
313
317
  prevContainerWidthRef.current
314
318
  : scale
315
319
  );
320
+
321
+ // frameSize has to be a px value for the scaling and frame size to be computed correctly.
316
322
  iframeDocument.documentElement.style.setProperty(
317
323
  '--wp-block-editor-iframe-zoom-out-frame-size',
318
324
  typeof frameSize === 'number' ? `${ frameSize }px` : frameSize
@@ -0,0 +1,17 @@
1
+ .block-editor-iframe__container {
2
+ width: 100%;
3
+ height: 100%;
4
+ overflow-x: hidden;
5
+ }
6
+
7
+ .block-editor-iframe__scale-container {
8
+ height: 100%;
9
+ }
10
+
11
+ .block-editor-iframe__scale-container.is-zoomed-out {
12
+ $container-width: var(--wp-block-editor-iframe-zoom-out-container-width, 100vw);
13
+ $prev-container-width: var(--wp-block-editor-iframe-zoom-out-prev-container-width, 100vw);
14
+ width: $prev-container-width;
15
+ // This is to offset the movement of the iframe when we open sidebars
16
+ margin-left: calc(-1 * (#{$prev-container-width} - #{$container-width}) / 2);
17
+ }
@@ -32,6 +32,7 @@ import InserterSearchResults from './search-results';
32
32
  import useInsertionPoint from './hooks/use-insertion-point';
33
33
  import { store as blockEditorStore } from '../../store';
34
34
  import TabbedSidebar from '../tabbed-sidebar';
35
+ import { useZoomOut } from '../../hooks/use-zoom-out';
35
36
 
36
37
  const NOOP = () => {};
37
38
  function InserterMenu(
@@ -77,6 +78,10 @@ function InserterMenu(
77
78
  }
78
79
  const [ selectedTab, setSelectedTab ] = useState( getInitialTab() );
79
80
 
81
+ const shouldUseZoomOut =
82
+ selectedTab === 'patterns' || selectedTab === 'media';
83
+ useZoomOut( shouldUseZoomOut );
84
+
80
85
  const [ destinationRootClientId, onInsertBlocks, onToggleInsertionPoint ] =
81
86
  useInsertionPoint( {
82
87
  rootClientId,
@@ -2,7 +2,8 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import {
5
- Button,
5
+ Icon,
6
+ Tooltip,
6
7
  privateApis as componentsPrivateApis,
7
8
  } from '@wordpress/components';
8
9
  import { store as preferencesStore } from '@wordpress/preferences';
@@ -43,27 +44,27 @@ export default function InspectorControlsTabs( {
43
44
  <div className="block-editor-block-inspector__tabs">
44
45
  <Tabs defaultTabId={ initialTabName } key={ clientId }>
45
46
  <Tabs.TabList>
46
- { tabs.map( ( tab ) => (
47
- <Tabs.Tab
48
- key={ tab.name }
49
- tabId={ tab.name }
50
- render={
51
- <Button
52
- // TODO: Switch to `true` (40px size) if possible
53
- __next40pxDefaultSize={ false }
54
- icon={
55
- ! showIconLabels ? tab.icon : undefined
56
- }
57
- label={
58
- ! showIconLabels ? tab.title : undefined
59
- }
47
+ { tabs.map( ( tab ) =>
48
+ showIconLabels ? (
49
+ <Tabs.Tab
50
+ key={ tab.name }
51
+ tabId={ tab.name }
52
+ className={ tab.className }
53
+ >
54
+ { tab.title }
55
+ </Tabs.Tab>
56
+ ) : (
57
+ <Tooltip text={ tab.title } key={ tab.name }>
58
+ <Tabs.Tab
59
+ tabId={ tab.name }
60
60
  className={ tab.className }
61
+ aria-label={ tab.title }
61
62
  >
62
- { showIconLabels && tab.title }
63
- </Button>
64
- }
65
- />
66
- ) ) }
63
+ <Icon icon={ tab.icon } />
64
+ </Tabs.Tab>
65
+ </Tooltip>
66
+ )
67
+ ) }
67
68
  </Tabs.TabList>
68
69
  <Tabs.TabPanel tabId={ TAB_SETTINGS.name } focusable={ false }>
69
70
  <SettingsTab showAdvancedControls={ !! blockName } />
@@ -31,8 +31,7 @@ export default function InspectorPopoverHeader( {
31
31
  <Spacer />
32
32
  { actions.map( ( { label, icon, onClick } ) => (
33
33
  <Button
34
- // TODO: Switch to `true` (40px size) if possible
35
- __next40pxDefaultSize={ false }
34
+ size="small"
36
35
  key={ label }
37
36
  className="block-editor-inspector-popover-header__action"
38
37
  label={ label }
@@ -45,8 +44,7 @@ export default function InspectorPopoverHeader( {
45
44
  ) ) }
46
45
  { onClose && (
47
46
  <Button
48
- // TODO: Switch to `true` (40px size) if possible
49
- __next40pxDefaultSize={ false }
47
+ size="small"
50
48
  className="block-editor-inspector-popover-header__action"
51
49
  label={ __( 'Close' ) }
52
50
  icon={ closeSmall }
@@ -1,16 +1,3 @@
1
1
  .block-editor-inspector-popover-header {
2
2
  margin-bottom: $grid-unit-20;
3
3
  }
4
-
5
- [class].block-editor-inspector-popover-header__action {
6
- height: $icon-size;
7
-
8
- &.has-icon {
9
- min-width: $icon-size;
10
- padding: 0;
11
- }
12
-
13
- &:not(.has-icon) {
14
- text-decoration: underline;
15
- }
16
- }
@@ -475,16 +475,14 @@ function LinkControl( {
475
475
  className="block-editor-link-control__search-actions"
476
476
  >
477
477
  <Button
478
- // TODO: Switch to `true` (40px size) if possible
479
- __next40pxDefaultSize={ false }
478
+ __next40pxDefaultSize
480
479
  variant="tertiary"
481
480
  onClick={ handleCancel }
482
481
  >
483
482
  { __( 'Cancel' ) }
484
483
  </Button>
485
484
  <Button
486
- // TODO: Switch to `true` (40px size) if possible
487
- __next40pxDefaultSize={ false }
485
+ __next40pxDefaultSize
488
486
  variant="primary"
489
487
  onClick={ isDisabled ? noop : handleSubmit }
490
488
  className="block-editor-link-control__search-submit"
@@ -25,8 +25,7 @@ function LinkSettingsDrawer( { children, settingsOpen, setSettingsOpen } ) {
25
25
  return (
26
26
  <>
27
27
  <Button
28
- // TODO: Switch to `true` (40px size) if possible
29
- __next40pxDefaultSize={ false }
28
+ __next40pxDefaultSize
30
29
  className="block-editor-link-control__drawer-toggle"
31
30
  aria-expanded={ settingsOpen }
32
31
  onClick={ () => setSettingsOpen( ! settingsOpen ) }
@@ -7,7 +7,6 @@ import clsx from 'clsx';
7
7
  * WordPress dependencies
8
8
  */
9
9
  import {
10
- Button,
11
10
  __experimentalHStack as HStack,
12
11
  __experimentalTruncate as Truncate,
13
12
  } from '@wordpress/components';
@@ -82,9 +81,7 @@ function ListViewBlockSelectButton(
82
81
  }
83
82
 
84
83
  return (
85
- <Button
86
- // TODO: Switch to `true` (40px size) if possible
87
- __next40pxDefaultSize={ false }
84
+ <a
88
85
  className={ clsx(
89
86
  'block-editor-list-view-block-select-button',
90
87
  className
@@ -156,7 +153,7 @@ function ListViewBlockSelectButton(
156
153
  </span>
157
154
  ) }
158
155
  </HStack>
159
- </Button>
156
+ </a>
160
157
  );
161
158
  }
162
159
 
@@ -41,6 +41,15 @@
41
41
  &:hover {
42
42
  color: var(--wp-admin-theme-color);
43
43
  }
44
+
45
+ svg {
46
+ fill: currentColor;
47
+ // Optimizate for high contrast modes.
48
+ // See also https://blogs.windows.com/msedgedev/2020/09/17/styling-for-windows-high-contrast-with-new-standards-for-forced-colors/.
49
+ @media (forced-colors: active) {
50
+ fill: CanvasText;
51
+ }
52
+ }
44
53
  }
45
54
 
46
55
  &:not(.is-selected) .block-editor-list-view-block-select-button {
@@ -216,6 +225,15 @@
216
225
  text-align: left;
217
226
  position: relative;
218
227
  white-space: nowrap;
228
+ border-radius: 2px;
229
+ box-sizing: border-box;
230
+ color: inherit;
231
+ font-family: inherit;
232
+ font-size: 13px;
233
+ font-weight: 400;
234
+ margin: 0;
235
+ text-decoration: none;
236
+ transition: box-shadow 0.1s linear;
219
237
 
220
238
  &.is-dropping-before::before {
221
239
  content: "";
@@ -91,8 +91,7 @@ const URLSelectionUI = ( { src, onChangeSrc, onSelectURL } ) => {
91
91
  return (
92
92
  <div className="block-editor-media-placeholder__url-input-container">
93
93
  <Button
94
- // TODO: Switch to `true` (40px size) if possible
95
- __next40pxDefaultSize={ false }
94
+ __next40pxDefaultSize
96
95
  className="block-editor-media-placeholder__button"
97
96
  onClick={ openURLInput }
98
97
  isPressed={ isURLInputVisible }
@@ -389,8 +388,7 @@ export function MediaPlaceholder( {
389
388
  return (
390
389
  onCancel && (
391
390
  <Button
392
- // TODO: Switch to `true` (40px size) if possible
393
- __next40pxDefaultSize={ false }
391
+ __next40pxDefaultSize
394
392
  className="block-editor-media-placeholder__cancel-button"
395
393
  title={ __( 'Cancel' ) }
396
394
  variant="link"
@@ -419,8 +417,7 @@ export function MediaPlaceholder( {
419
417
  onToggleFeaturedImage && (
420
418
  <div className="block-editor-media-placeholder__url-input-container">
421
419
  <Button
422
- // TODO: Switch to `true` (40px size) if possible
423
- __next40pxDefaultSize={ false }
420
+ __next40pxDefaultSize
424
421
  className="block-editor-media-placeholder__button"
425
422
  onClick={ onToggleFeaturedImage }
426
423
  variant="secondary"
@@ -436,8 +433,7 @@ export function MediaPlaceholder( {
436
433
  const defaultButton = ( { open } ) => {
437
434
  return (
438
435
  <Button
439
- // TODO: Switch to `true` (40px size) if possible
440
- __next40pxDefaultSize={ false }
436
+ __next40pxDefaultSize
441
437
  variant="secondary"
442
438
  onClick={ () => {
443
439
  open();
@@ -477,8 +473,7 @@ export function MediaPlaceholder( {
477
473
  const content = (
478
474
  <>
479
475
  <Button
480
- // TODO: Switch to `true` (40px size) if possible
481
- __next40pxDefaultSize={ false }
476
+ __next40pxDefaultSize
482
477
  variant="primary"
483
478
  className={ clsx(
484
479
  'block-editor-media-placeholder__button',
@@ -508,8 +503,7 @@ export function MediaPlaceholder( {
508
503
  <FormFileUpload
509
504
  render={ ( { openFileDialog } ) => (
510
505
  <Button
511
- // TODO: Switch to `true` (40px size) if possible
512
- __next40pxDefaultSize={ false }
506
+ __next40pxDefaultSize
513
507
  onClick={ openFileDialog }
514
508
  variant="primary"
515
509
  className={ clsx(
@@ -28,8 +28,7 @@ export default function SkipToSelectedBlock() {
28
28
 
29
29
  return selectedBlockClientId ? (
30
30
  <Button
31
- // TODO: Switch to `true` (40px size) if possible
32
- __next40pxDefaultSize={ false }
31
+ __next40pxDefaultSize
33
32
  variant="secondary"
34
33
  className="block-editor-skip-to-selected-block"
35
34
  onClick={ onClick }