@wordpress/block-editor 12.3.12 → 12.3.14

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 (46) hide show
  1. package/build/components/block-controls/use-has-block-controls.js +52 -0
  2. package/build/components/block-controls/use-has-block-controls.js.map +1 -0
  3. package/build/components/block-tools/block-contextual-toolbar.js +50 -5
  4. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  5. package/build/components/copy-handler/index.js +2 -0
  6. package/build/components/copy-handler/index.js.map +1 -1
  7. package/build/components/global-styles/typography-utils.js +3 -2
  8. package/build/components/global-styles/typography-utils.js.map +1 -1
  9. package/build/components/link-control/index.js +47 -6
  10. package/build/components/link-control/index.js.map +1 -1
  11. package/build/components/rich-text/index.js +8 -1
  12. package/build/components/rich-text/index.js.map +1 -1
  13. package/build/components/rich-text/use-format-types.js +3 -2
  14. package/build/components/rich-text/use-format-types.js.map +1 -1
  15. package/build-module/components/block-controls/use-has-block-controls.js +38 -0
  16. package/build-module/components/block-controls/use-has-block-controls.js.map +1 -0
  17. package/build-module/components/block-tools/block-contextual-toolbar.js +49 -5
  18. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  19. package/build-module/components/copy-handler/index.js +2 -0
  20. package/build-module/components/copy-handler/index.js.map +1 -1
  21. package/build-module/components/global-styles/typography-utils.js +4 -3
  22. package/build-module/components/global-styles/typography-utils.js.map +1 -1
  23. package/build-module/components/link-control/index.js +45 -6
  24. package/build-module/components/link-control/index.js.map +1 -1
  25. package/build-module/components/rich-text/index.js +8 -1
  26. package/build-module/components/rich-text/index.js.map +1 -1
  27. package/build-module/components/rich-text/use-format-types.js +3 -2
  28. package/build-module/components/rich-text/use-format-types.js.map +1 -1
  29. package/build-style/content-rtl.css +5 -7
  30. package/build-style/content.css +5 -7
  31. package/build-style/style-rtl.css +28 -6
  32. package/build-style/style.css +28 -6
  33. package/package.json +5 -5
  34. package/src/components/block-controls/use-has-block-controls.js +35 -0
  35. package/src/components/block-list/content.scss +2 -3
  36. package/src/components/block-toolbar/style.scss +10 -0
  37. package/src/components/block-tools/block-contextual-toolbar.js +86 -7
  38. package/src/components/block-tools/style.scss +34 -10
  39. package/src/components/copy-handler/index.js +1 -0
  40. package/src/components/global-styles/test/typography-utils.js +10 -0
  41. package/src/components/global-styles/typography-utils.js +11 -3
  42. package/src/components/link-control/README.md +12 -3
  43. package/src/components/link-control/index.js +43 -6
  44. package/src/components/link-control/test/index.js +2 -1
  45. package/src/components/rich-text/index.js +7 -0
  46. package/src/components/rich-text/use-format-types.js +3 -3
@@ -320,17 +320,19 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
320
320
  z-index: 31;
321
321
  display: block;
322
322
  width: 100%;
323
+ overflow: hidden;
323
324
  border: none;
324
325
  border-bottom: 1px solid #e0e0e0;
325
326
  border-radius: 0;
326
327
  }
328
+ .block-editor-block-contextual-toolbar.is-fixed .block-editor-block-toolbar {
329
+ overflow: auto;
330
+ overflow-y: hidden;
331
+ }
327
332
  .block-editor-block-contextual-toolbar.is-fixed .block-editor-block-toolbar .components-toolbar-group,
328
333
  .block-editor-block-contextual-toolbar.is-fixed .block-editor-block-toolbar .components-toolbar {
329
334
  border-left-color: #e0e0e0;
330
335
  }
331
- .block-editor-block-contextual-toolbar:has(.block-editor-block-toolbar:empty) {
332
- display: none;
333
- }
334
336
  .block-editor-block-contextual-toolbar.is-collapsed::after {
335
337
  content: "";
336
338
  position: absolute;
@@ -343,21 +345,29 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
343
345
  .block-editor-block-contextual-toolbar.is-fixed {
344
346
  margin-right: 180px;
345
347
  position: fixed;
346
- top: 39px;
348
+ top: 32px;
347
349
  min-height: initial;
348
350
  border-bottom: none;
349
351
  display: flex;
352
+ height: 60px;
353
+ align-items: center;
350
354
  }
351
355
  .block-editor-block-contextual-toolbar.is-fixed.is-collapsed {
352
356
  width: initial;
353
357
  }
358
+ .block-editor-block-contextual-toolbar.is-fixed:empty {
359
+ width: initial;
360
+ }
354
361
  .is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
355
362
  margin-right: 240px;
356
- top: 7px;
363
+ top: 0;
357
364
  }
358
365
  .is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed.is-collapsed {
359
366
  width: initial;
360
367
  }
368
+ .is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed:empty {
369
+ width: initial;
370
+ }
361
371
  .block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar.is-showing-movers {
362
372
  flex-grow: initial;
363
373
  width: initial;
@@ -475,13 +485,19 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
475
485
  }
476
486
  @media (min-width: 782px) {
477
487
  .block-editor-block-contextual-toolbar.is-fixed {
478
- width: 100%;
488
+ width: calc(100% - 180px);
489
+ }
490
+ .show-icon-labels .block-editor-block-contextual-toolbar.is-fixed {
491
+ width: calc(100% + 40px - 180px);
479
492
  }
480
493
  }
481
494
  @media (min-width: 960px) {
482
495
  .block-editor-block-contextual-toolbar.is-fixed {
483
496
  width: auto;
484
497
  }
498
+ .show-icon-labels .block-editor-block-contextual-toolbar.is-fixed {
499
+ width: auto;
500
+ }
485
501
  .is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
486
502
  width: calc(100% - 280px - 256px);
487
503
  }
@@ -3445,6 +3461,12 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
3445
3461
  .show-icon-labels .components-toolbar-group {
3446
3462
  flex-shrink: 1;
3447
3463
  }
3464
+ @media (min-width: 782px) {
3465
+ .show-icon-labels .block-editor-block-contextual-toolbar.is-fixed .components-toolbar,
3466
+ .show-icon-labels .block-editor-block-contextual-toolbar.is-fixed .components-toolbar-group {
3467
+ flex-shrink: 0;
3468
+ }
3469
+ }
3448
3470
  .show-icon-labels .block-editor-rich-text__inline-format-toolbar-group .components-button + .components-button {
3449
3471
  margin-right: 6px;
3450
3472
  }
@@ -320,17 +320,19 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
320
320
  z-index: 31;
321
321
  display: block;
322
322
  width: 100%;
323
+ overflow: hidden;
323
324
  border: none;
324
325
  border-bottom: 1px solid #e0e0e0;
325
326
  border-radius: 0;
326
327
  }
328
+ .block-editor-block-contextual-toolbar.is-fixed .block-editor-block-toolbar {
329
+ overflow: auto;
330
+ overflow-y: hidden;
331
+ }
327
332
  .block-editor-block-contextual-toolbar.is-fixed .block-editor-block-toolbar .components-toolbar-group,
328
333
  .block-editor-block-contextual-toolbar.is-fixed .block-editor-block-toolbar .components-toolbar {
329
334
  border-right-color: #e0e0e0;
330
335
  }
331
- .block-editor-block-contextual-toolbar:has(.block-editor-block-toolbar:empty) {
332
- display: none;
333
- }
334
336
  .block-editor-block-contextual-toolbar.is-collapsed::after {
335
337
  content: "";
336
338
  position: absolute;
@@ -343,21 +345,29 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
343
345
  .block-editor-block-contextual-toolbar.is-fixed {
344
346
  margin-left: 180px;
345
347
  position: fixed;
346
- top: 39px;
348
+ top: 32px;
347
349
  min-height: initial;
348
350
  border-bottom: none;
349
351
  display: flex;
352
+ height: 60px;
353
+ align-items: center;
350
354
  }
351
355
  .block-editor-block-contextual-toolbar.is-fixed.is-collapsed {
352
356
  width: initial;
353
357
  }
358
+ .block-editor-block-contextual-toolbar.is-fixed:empty {
359
+ width: initial;
360
+ }
354
361
  .is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
355
362
  margin-left: 240px;
356
- top: 7px;
363
+ top: 0;
357
364
  }
358
365
  .is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed.is-collapsed {
359
366
  width: initial;
360
367
  }
368
+ .is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed:empty {
369
+ width: initial;
370
+ }
361
371
  .block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar.is-showing-movers {
362
372
  flex-grow: initial;
363
373
  width: initial;
@@ -475,13 +485,19 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
475
485
  }
476
486
  @media (min-width: 782px) {
477
487
  .block-editor-block-contextual-toolbar.is-fixed {
478
- width: 100%;
488
+ width: calc(100% - 180px);
489
+ }
490
+ .show-icon-labels .block-editor-block-contextual-toolbar.is-fixed {
491
+ width: calc(100% + 40px - 180px);
479
492
  }
480
493
  }
481
494
  @media (min-width: 960px) {
482
495
  .block-editor-block-contextual-toolbar.is-fixed {
483
496
  width: auto;
484
497
  }
498
+ .show-icon-labels .block-editor-block-contextual-toolbar.is-fixed {
499
+ width: auto;
500
+ }
485
501
  .is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
486
502
  width: calc(100% - 280px - 256px);
487
503
  }
@@ -3446,6 +3462,12 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
3446
3462
  .show-icon-labels .components-toolbar-group {
3447
3463
  flex-shrink: 1;
3448
3464
  }
3465
+ @media (min-width: 782px) {
3466
+ .show-icon-labels .block-editor-block-contextual-toolbar.is-fixed .components-toolbar,
3467
+ .show-icon-labels .block-editor-block-contextual-toolbar.is-fixed .components-toolbar-group {
3468
+ flex-shrink: 0;
3469
+ }
3470
+ }
3449
3471
  .show-icon-labels .block-editor-rich-text__inline-format-toolbar-group .components-button + .components-button {
3450
3472
  margin-left: 6px;
3451
3473
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "12.3.12",
3
+ "version": "12.3.14",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -38,7 +38,7 @@
38
38
  "@wordpress/api-fetch": "^6.32.1",
39
39
  "@wordpress/blob": "^3.35.1",
40
40
  "@wordpress/blocks": "^12.12.7",
41
- "@wordpress/components": "^25.1.10",
41
+ "@wordpress/components": "^25.1.11",
42
42
  "@wordpress/compose": "^6.12.2",
43
43
  "@wordpress/data": "^9.5.5",
44
44
  "@wordpress/date": "^4.35.1",
@@ -54,9 +54,9 @@
54
54
  "@wordpress/keyboard-shortcuts": "^4.12.5",
55
55
  "@wordpress/keycodes": "^3.35.1",
56
56
  "@wordpress/notices": "^4.3.5",
57
- "@wordpress/preferences": "^3.12.10",
57
+ "@wordpress/preferences": "^3.12.11",
58
58
  "@wordpress/private-apis": "^0.17.2",
59
- "@wordpress/rich-text": "^6.12.7",
59
+ "@wordpress/rich-text": "^6.12.8",
60
60
  "@wordpress/shortcode": "^3.35.1",
61
61
  "@wordpress/style-engine": "^1.18.1",
62
62
  "@wordpress/token-list": "^2.35.1",
@@ -85,5 +85,5 @@
85
85
  "publishConfig": {
86
86
  "access": "public"
87
87
  },
88
- "gitHead": "53cd9574a54a643c73e76fe1abaa8d1be489f8f7"
88
+ "gitHead": "a5a32c1da19589a60d48ae793a3d0a5a48223db6"
89
89
  }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __experimentalUseSlotFills as useSlotFills } from '@wordpress/components';
5
+ import warning from '@wordpress/warning';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import groups from './groups';
11
+
12
+ export function useHasAnyBlockControls() {
13
+ let hasAnyBlockControls = false;
14
+ for ( const group in groups ) {
15
+ // It is safe to violate the rules of hooks here as the `groups` object
16
+ // is static and will not change length between renders. Do not return
17
+ // early as that will cause the hook to be called a different number of
18
+ // times between renders.
19
+ // eslint-disable-next-line react-hooks/rules-of-hooks
20
+ if ( useHasBlockControls( group ) ) {
21
+ hasAnyBlockControls = true;
22
+ }
23
+ }
24
+ return hasAnyBlockControls;
25
+ }
26
+
27
+ export function useHasBlockControls( group = 'default' ) {
28
+ const Slot = groups[ group ]?.Slot;
29
+ const fills = useSlotFills( Slot?.__unstableName );
30
+ if ( ! Slot ) {
31
+ warning( `Unknown BlockControls group "${ group }" provided.` );
32
+ return null;
33
+ }
34
+ return !! fills?.length;
35
+ }
@@ -85,7 +85,6 @@
85
85
  .block-editor-block-list__block.is-highlighted,
86
86
  .block-editor-block-list__block.is-highlighted ~ .is-multi-selected,
87
87
  &.is-navigate-mode .block-editor-block-list__block.is-selected,
88
- & .is-block-moving-mode.block-editor-block-list__block.has-child-selected,
89
88
  .block-editor-block-list__block:not([contenteditable]):focus {
90
89
  outline: none;
91
90
 
@@ -113,8 +112,6 @@
113
112
 
114
113
  // Moving blocks using keyboard (Ellipsis > Move).
115
114
  & .is-block-moving-mode.block-editor-block-list__block.is-selected {
116
- box-shadow: none;
117
- outline: none;
118
115
 
119
116
  &::after {
120
117
  content: "";
@@ -130,6 +127,8 @@
130
127
  top: -$default-block-margin * 0.5;
131
128
  border-radius: $radius-block-ui;
132
129
  border-top: 4px solid $gray-400;
130
+ bottom: auto;
131
+ box-shadow: none;
133
132
  }
134
133
  }
135
134
 
@@ -252,6 +252,16 @@
252
252
  flex-shrink: 1;
253
253
  }
254
254
 
255
+ @include break-medium() {
256
+ .block-editor-block-contextual-toolbar.is-fixed {
257
+ .components-toolbar,
258
+ .components-toolbar-group {
259
+ flex-shrink: 0;
260
+ }
261
+ }
262
+ }
263
+
264
+
255
265
  .block-editor-rich-text__inline-format-toolbar-group {
256
266
  .components-button + .components-button {
257
267
  margin-left: 6px;
@@ -7,7 +7,12 @@ import classnames from 'classnames';
7
7
  * WordPress dependencies
8
8
  */
9
9
  import { __ } from '@wordpress/i18n';
10
- import { useEffect, useRef, useState } from '@wordpress/element';
10
+ import {
11
+ useLayoutEffect,
12
+ useEffect,
13
+ useRef,
14
+ useState,
15
+ } from '@wordpress/element';
11
16
  import { hasBlockSupport, store as blocksStore } from '@wordpress/blocks';
12
17
  import { useSelect } from '@wordpress/data';
13
18
  import {
@@ -25,6 +30,7 @@ import NavigableToolbar from '../navigable-toolbar';
25
30
  import BlockToolbar from '../block-toolbar';
26
31
  import { store as blockEditorStore } from '../../store';
27
32
  import { unlock } from '../../lock-unlock';
33
+ import { useHasAnyBlockControls } from '../block-controls/use-has-block-controls';
28
34
 
29
35
  function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
30
36
  // When the toolbar is fixed it can be collapsed
@@ -34,10 +40,10 @@ function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
34
40
  const isLargeViewport = useViewportMatch( 'medium' );
35
41
  const {
36
42
  blockType,
43
+ blockEditingMode,
37
44
  hasParents,
38
45
  showParentSelector,
39
46
  selectedBlockClientId,
40
- isContentOnly,
41
47
  } = useSelect( ( select ) => {
42
48
  const {
43
49
  getBlockName,
@@ -58,9 +64,8 @@ function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
58
64
  blockType:
59
65
  _selectedBlockClientId &&
60
66
  getBlockType( getBlockName( _selectedBlockClientId ) ),
67
+ blockEditingMode: getBlockEditingMode( _selectedBlockClientId ),
61
68
  hasParents: parents.length,
62
- isContentOnly:
63
- getBlockEditingMode( _selectedBlockClientId ) === 'contentOnly',
64
69
  showParentSelector:
65
70
  parentBlockType &&
66
71
  getBlockEditingMode( firstParentClientId ) === 'default' &&
@@ -78,10 +83,84 @@ function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
78
83
  setIsCollapsed( false );
79
84
  }, [ selectedBlockClientId ] );
80
85
 
86
+ const isLargerThanTabletViewport = useViewportMatch( 'large', '>=' );
87
+ const isFullscreen =
88
+ document.body.classList.contains( 'is-fullscreen-mode' );
89
+
90
+ useLayoutEffect( () => {
91
+ // don't do anything if not fixed toolbar
92
+ if ( ! isFixed || ! blockType ) {
93
+ return;
94
+ }
95
+
96
+ const blockToolbar = document.querySelector(
97
+ '.block-editor-block-contextual-toolbar'
98
+ );
99
+
100
+ if ( ! blockToolbar ) {
101
+ return;
102
+ }
103
+
104
+ if ( ! isLargerThanTabletViewport ) {
105
+ // set the width of the toolbar to auto
106
+ blockToolbar.style = {};
107
+ return;
108
+ }
109
+
110
+ if ( isCollapsed ) {
111
+ // set the width of the toolbar to auto
112
+ blockToolbar.style.width = 'auto';
113
+ return;
114
+ }
115
+
116
+ // get the width of the pinned items in the post editor
117
+ const pinnedItems = document.querySelector(
118
+ '.edit-post-header__settings'
119
+ );
120
+
121
+ // get the width of the left header in the site editor
122
+ const leftHeader = document.querySelector(
123
+ '.edit-site-header-edit-mode__end'
124
+ );
125
+
126
+ const computedToolbarStyle = window.getComputedStyle( blockToolbar );
127
+ const computedPinnedItemsStyle = pinnedItems
128
+ ? window.getComputedStyle( pinnedItems )
129
+ : false;
130
+ const computedLeftHeaderStyle = leftHeader
131
+ ? window.getComputedStyle( leftHeader )
132
+ : false;
133
+
134
+ const marginLeft = parseFloat( computedToolbarStyle.marginLeft );
135
+ const pinnedItemsWidth = computedPinnedItemsStyle
136
+ ? parseFloat( computedPinnedItemsStyle.width ) + 10 // 10 is the pinned items padding
137
+ : 0;
138
+ const leftHeaderWidth = computedLeftHeaderStyle
139
+ ? parseFloat( computedLeftHeaderStyle.width )
140
+ : 0;
141
+
142
+ // set the new witdth of the toolbar
143
+ blockToolbar.style.width = `calc(100% - ${
144
+ leftHeaderWidth +
145
+ pinnedItemsWidth +
146
+ marginLeft +
147
+ ( isFullscreen ? 0 : 160 ) // the width of the admin sidebar expanded
148
+ }px)`;
149
+ }, [
150
+ isFixed,
151
+ isLargerThanTabletViewport,
152
+ isCollapsed,
153
+ isFullscreen,
154
+ blockType,
155
+ ] );
156
+
157
+ const isToolbarEnabled =
158
+ ! blockType ||
159
+ hasBlockSupport( blockType, '__experimentalToolbar', true );
160
+ const hasAnyBlockControls = useHasAnyBlockControls();
81
161
  if (
82
- isContentOnly ||
83
- ( blockType &&
84
- ! hasBlockSupport( blockType, '__experimentalToolbar', true ) )
162
+ ! isToolbarEnabled ||
163
+ ( blockEditingMode !== 'default' && ! hasAnyBlockControls )
85
164
  ) {
86
165
  return null;
87
166
  }
@@ -110,6 +110,12 @@
110
110
  z-index: z-index(".block-editor-block-popover");
111
111
  display: block;
112
112
  width: 100%;
113
+ overflow: hidden;
114
+
115
+ .block-editor-block-toolbar {
116
+ overflow: auto;
117
+ overflow-y: hidden;
118
+ }
113
119
 
114
120
  border: none;
115
121
  border-bottom: $border-width solid $gray-200;
@@ -121,10 +127,6 @@
121
127
  }
122
128
  }
123
129
 
124
- &:has(.block-editor-block-toolbar:empty) {
125
- display: none;
126
- }
127
-
128
130
  // Add a scrim to the right of the collapsed button.
129
131
  &.is-collapsed::after {
130
132
  content: "";
@@ -137,14 +139,14 @@
137
139
 
138
140
  // on desktop and tablet viewports the toolbar is fixed
139
141
  // on top of interface header
142
+ $toolbar-margin: $grid-unit-80 * 3 - 2 * $grid-unit + $grid-unit-05;
140
143
  @include break-medium() {
141
144
  &.is-fixed {
142
-
143
145
  // leave room for block inserter, undo and redo, list view
144
- margin-left: $grid-unit-80 * 3 - 2 * $grid-unit + $grid-unit-05;
146
+ margin-left: $toolbar-margin;
145
147
  // position on top of interface header
146
148
  position: fixed;
147
- top: $admin-bar-height + $grid-unit - $border-width;
149
+ top: $admin-bar-height;
148
150
  // Don't fill up when empty
149
151
  min-height: initial;
150
152
  // remove the border
@@ -152,18 +154,32 @@
152
154
  // has to be flex for collapse button to fit
153
155
  display: flex;
154
156
 
157
+ // Mimic the height of the parent, vertically align center, and provide a max-height.
158
+ height: $header-height;
159
+ align-items: center;
160
+
155
161
  &.is-collapsed {
156
162
  width: initial;
157
163
  }
158
164
 
165
+ &:empty {
166
+ width: initial;
167
+ }
168
+
159
169
  .is-fullscreen-mode & {
160
170
  // leave room for block inserter, undo and redo, list view
161
171
  // and some margin left
162
172
  margin-left: $grid-unit-80 * 4 - 2 * $grid-unit;
163
- top: $grid-unit - $border-width;
173
+
174
+ top: 0;
175
+
164
176
  &.is-collapsed {
165
177
  width: initial;
166
178
  }
179
+
180
+ &:empty {
181
+ width: initial;
182
+ }
167
183
  }
168
184
 
169
185
  & > .block-editor-block-toolbar.is-showing-movers {
@@ -249,7 +265,7 @@
249
265
 
250
266
  .show-icon-labels & {
251
267
 
252
- margin-left: $grid-unit-80 + 2 * $grid-unit; // inserter and margin ;
268
+ margin-left: $grid-unit-80 + 2 * $grid-unit; // inserter and margin
253
269
 
254
270
  .is-fullscreen-mode & {
255
271
  margin-left: $grid-unit * 18; // site hub, inserter and margin
@@ -322,7 +338,12 @@
322
338
  // except for the inserter on the left
323
339
  @include break-medium() {
324
340
  &.is-fixed {
325
- width: 100%;
341
+ width: calc(100% - #{$toolbar-margin});
342
+
343
+ .show-icon-labels & {
344
+ width: calc(100% + 40px - #{$toolbar-margin}); //there are no undo, redo and list view buttons
345
+ }
346
+
326
347
  }
327
348
  }
328
349
 
@@ -332,6 +353,9 @@
332
353
  @include break-large() {
333
354
  &.is-fixed {
334
355
  width: auto;
356
+ .show-icon-labels & {
357
+ width: auto; //there are no undo, redo and list view buttons
358
+ }
335
359
  }
336
360
  .is-fullscreen-mode &.is-fixed {
337
361
  // in full screen mode we need to account for
@@ -198,6 +198,7 @@ export function useClipboardHandler() {
198
198
  if ( shouldHandleWholeBlocks && ! expandSelectionIsNeeded ) {
199
199
  removeBlocks( selectedBlockClientIds );
200
200
  } else {
201
+ event.target.ownerDocument.activeElement.contentEditable = false;
201
202
  __unstableDeleteSelection();
202
203
  }
203
204
  } else if ( event.type === 'paste' ) {
@@ -561,6 +561,16 @@ describe( 'typography utils', () => {
561
561
  },
562
562
  expected: { fluid: { maxViewPortWidth: '10px' } },
563
563
  },
564
+ {
565
+ message: 'should not merge `layout.wideSize` if it is fluid',
566
+ settings: {
567
+ typography: { fluid: { minFontSize: '16px' } },
568
+ layout: { wideSize: 'clamp(1000px, 85vw, 2000px)' },
569
+ },
570
+ expected: {
571
+ fluid: { minFontSize: '16px' },
572
+ },
573
+ },
564
574
  ].forEach( ( { message, settings, expected } ) => {
565
575
  it( `${ message }`, () => {
566
576
  expect(
@@ -7,7 +7,10 @@
7
7
  /**
8
8
  * Internal dependencies
9
9
  */
10
- import { getComputedFluidTypographyValue } from '../font-sizes/fluid-utils';
10
+ import {
11
+ getComputedFluidTypographyValue,
12
+ getTypographyValueAndUnit,
13
+ } from '../font-sizes/fluid-utils';
11
14
 
12
15
  /**
13
16
  * @typedef {Object} FluidPreset
@@ -98,11 +101,16 @@ function isFluidTypographyEnabled( typographySettings ) {
98
101
  export function getFluidTypographyOptionsFromSettings( settings ) {
99
102
  const typographySettings = settings?.typography;
100
103
  const layoutSettings = settings?.layout;
101
- return isFluidTypographyEnabled( typographySettings ) &&
104
+ const defaultMaxViewportWidth = getTypographyValueAndUnit(
102
105
  layoutSettings?.wideSize
106
+ )
107
+ ? layoutSettings?.wideSize
108
+ : null;
109
+ return isFluidTypographyEnabled( typographySettings ) &&
110
+ defaultMaxViewportWidth
103
111
  ? {
104
112
  fluid: {
105
- maxViewPortWidth: layoutSettings.wideSize,
113
+ maxViewPortWidth: defaultMaxViewportWidth,
106
114
  ...typographySettings.fluid,
107
115
  },
108
116
  }
@@ -15,6 +15,16 @@ The distinction between the two components is perhaps best summarized by the fol
15
15
  - `<URLInput>` - an input for presenting and managing selection behaviors associated with choosing a URL, optionally from a pool of available candidates.
16
16
  - `<LinkControl>` - includes the features of `<URLInput>`, plus additional UI and behaviors to control how this URL applies to the concept of a "link". This includes link "settings" (eg: "opens in new tab", etc) and dynamic, "on the fly" link creation capabilities.
17
17
 
18
+ ## Persistent "Advanced" (settings) toggle state
19
+
20
+ By default the link "settings" are hidden and can be toggled open/closed by way of a button labelled `Advanced` in the UI.
21
+
22
+ In some circumstances if may be desirable to persist the toggle state of this portion of the UI so that it remains in the last state triggered by user interaction.
23
+
24
+ For example, once the user has toggled the UI to "open", then it may remain open across all links on the site until such time as the user toggles the UI back again.
25
+
26
+ Consumers who which to take advantage of this functionality should ensure that their block editor environment utilizes the [`@wordpress/preferences`](packages/preferences/README.md) package. By default the `<LinkControl>` component will attempt to persist the state of UI to a setting named `linkControlSettingsDrawer` with a scope of `core/block-editor`. If the preferences package is not available then local state is used and the setting will not be persisted.
27
+
18
28
  ## Search Suggestions
19
29
 
20
30
  When creating links the `LinkControl` component will handle two kinds of input from users:
@@ -69,9 +79,7 @@ An array of settings objects associated with a link (for example: a setting to d
69
79
  To disable settings, pass in an empty array. for example:
70
80
 
71
81
  ```jsx
72
- <LinkControl
73
- settings={ [] }
74
- />
82
+ <LinkControl settings={ [] } />
75
83
  ```
76
84
 
77
85
  ### onChange
@@ -192,6 +200,7 @@ A `suggestion` should have the following shape:
192
200
  )}
193
201
  />
194
202
  ```
203
+
195
204
  ### renderControlBottom
196
205
 
197
206
  - Type: `Function`