@wordpress/block-editor 14.2.1-next.5368f64a9.0 → 14.3.1
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.
- package/CHANGELOG.md +2 -0
- package/build/components/background-image-control/index.js +566 -0
- package/build/components/background-image-control/index.js.map +1 -0
- package/build/components/block-card/index.js +5 -2
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +4 -2
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -1
- package/build/components/global-styles/background-panel.js +20 -545
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +3 -0
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/grid/grid-item-resizer.js +2 -2
- package/build/components/grid/grid-item-resizer.js.map +1 -1
- package/build/components/iframe/index.js +1 -0
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +6 -0
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/image-editor/use-transform-image.js +1 -0
- package/build/components/image-editor/use-transform-image.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +2 -4
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/index.js +2 -4
- package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +4 -8
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/media-tab/media-tab.js +2 -4
- package/build/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -4
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter-listbox/item.js +2 -4
- package/build/components/inserter-listbox/item.js.map +1 -1
- package/build/components/link-control/index.js +14 -14
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-input.js +4 -2
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/rich-text/index.js +10 -4
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +8 -9
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/linked-button.js +35 -0
- package/build/components/spacing-sizes-control/linked-button.js.map +1 -0
- package/build/components/spacing-sizes-control/utils.js +3 -2
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/url-input/index.js +7 -6
- package/build/components/url-input/index.js.map +1 -1
- package/build/hooks/block-bindings.js +65 -53
- package/build/hooks/block-bindings.js.map +1 -1
- package/build/hooks/block-hooks.js +1 -8
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/store/private-selectors.js +10 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build-module/components/background-image-control/index.js +556 -0
- package/build-module/components/background-image-control/index.js.map +1 -0
- package/build-module/components/block-card/index.js +6 -3
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +4 -2
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +22 -546
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +3 -0
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/grid/grid-item-resizer.js +2 -2
- package/build-module/components/grid/grid-item-resizer.js.map +1 -1
- package/build-module/components/iframe/index.js +1 -0
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +6 -0
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-editor/use-transform-image.js +1 -0
- package/build-module/components/image-editor/use-transform-image.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +2 -4
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js +2 -4
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +4 -8
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-tab.js +2 -4
- package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -4
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter-listbox/item.js +2 -4
- package/build-module/components/inserter-listbox/item.js.map +1 -1
- package/build-module/components/link-control/index.js +15 -15
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-input.js +4 -2
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/rich-text/index.js +10 -4
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +9 -10
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/linked-button.js +28 -0
- package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -0
- package/build-module/components/spacing-sizes-control/utils.js +3 -2
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/url-input/index.js +8 -7
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/hooks/block-bindings.js +65 -53
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/block-hooks.js +3 -10
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/store/private-selectors.js +10 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-style/style-rtl.css +152 -285
- package/build-style/style.css +152 -285
- package/package.json +32 -32
- package/src/components/background-image-control/index.js +741 -0
- package/src/components/background-image-control/style.scss +170 -0
- package/src/components/background-image-control/test/index.js +47 -0
- package/src/components/block-card/index.js +12 -3
- package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +2 -5
- package/src/components/global-styles/background-panel.js +19 -730
- package/src/components/global-styles/dimensions-panel.js +3 -0
- package/src/components/global-styles/style.scss +0 -168
- package/src/components/global-styles/test/background-panel.js +1 -47
- package/src/components/grid/grid-item-resizer.js +2 -2
- package/src/components/image-editor/use-save-image.js +7 -0
- package/src/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +1 -2
- package/src/components/inserter/block-patterns-tab/index.js +1 -2
- package/src/components/inserter/media-tab/media-preview.js +2 -4
- package/src/components/inserter/media-tab/media-tab.js +1 -2
- package/src/components/inserter/quick-inserter.js +1 -2
- package/src/components/inserter/style.scss +0 -10
- package/src/components/inserter-listbox/item.js +1 -5
- package/src/components/link-control/index.js +19 -14
- package/src/components/link-control/search-input.js +2 -0
- package/src/components/link-control/style.scss +0 -22
- package/src/components/list-view/style.scss +1 -1
- package/src/components/rich-text/index.js +20 -5
- package/src/components/spacing-sizes-control/index.js +10 -13
- package/src/components/spacing-sizes-control/linked-button.js +32 -0
- package/src/components/spacing-sizes-control/test/utils.js +22 -30
- package/src/components/spacing-sizes-control/utils.js +6 -2
- package/src/components/url-input/index.js +5 -4
- package/src/components/url-input/style.scss +3 -26
- package/src/hooks/block-bindings.js +64 -50
- package/src/hooks/block-hooks.js +3 -14
- package/src/hooks/block-hooks.scss +0 -9
- package/src/store/private-selectors.js +9 -0
- package/src/style.scss +1 -0
- package/src/utils/test/transform-styles.js +1 -1
- package/build/components/spacing-sizes-control/sides-dropdown/index.js +0 -86
- package/build/components/spacing-sizes-control/sides-dropdown/index.js.map +0 -1
- package/build-module/components/spacing-sizes-control/sides-dropdown/index.js +0 -81
- package/build-module/components/spacing-sizes-control/sides-dropdown/index.js.map +0 -1
- package/src/components/spacing-sizes-control/sides-dropdown/index.js +0 -91
|
@@ -531,6 +531,7 @@ export default function DimensionsPanel( {
|
|
|
531
531
|
>
|
|
532
532
|
{ ! showSpacingPresetsControl && (
|
|
533
533
|
<BoxControl
|
|
534
|
+
__next40pxDefaultSize
|
|
534
535
|
values={ paddingValues }
|
|
535
536
|
onChange={ setPaddingValues }
|
|
536
537
|
label={ __( 'Padding' ) }
|
|
@@ -571,6 +572,7 @@ export default function DimensionsPanel( {
|
|
|
571
572
|
>
|
|
572
573
|
{ ! showSpacingPresetsControl && (
|
|
573
574
|
<BoxControl
|
|
575
|
+
__next40pxDefaultSize
|
|
574
576
|
values={ marginValues }
|
|
575
577
|
onChange={ setMarginValues }
|
|
576
578
|
inputProps={ inputProps }
|
|
@@ -617,6 +619,7 @@ export default function DimensionsPanel( {
|
|
|
617
619
|
{ ! showSpacingPresetsControl &&
|
|
618
620
|
( isAxialGap ? (
|
|
619
621
|
<BoxControl
|
|
622
|
+
__next40pxDefaultSize
|
|
620
623
|
label={ __( 'Block spacing' ) }
|
|
621
624
|
min={ 0 }
|
|
622
625
|
onChange={ setGapValues }
|
|
@@ -70,171 +70,3 @@
|
|
|
70
70
|
/*rtl:ignore*/
|
|
71
71
|
direction: ltr;
|
|
72
72
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
.block-editor-global-styles-background-panel__inspector-media-replace-container {
|
|
76
|
-
border: $border-width solid $gray-300;
|
|
77
|
-
border-radius: $radius-small;
|
|
78
|
-
// Full width. ToolsPanel lays out children in a grid.
|
|
79
|
-
grid-column: 1 / -1;
|
|
80
|
-
|
|
81
|
-
&.is-open {
|
|
82
|
-
background-color: $gray-100;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.block-editor-global-styles-background-panel__image-tools-panel-item {
|
|
86
|
-
flex-grow: 1;
|
|
87
|
-
border: 0;
|
|
88
|
-
.components-dropdown {
|
|
89
|
-
display: block;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.block-editor-global-styles-background-panel__inspector-preview-inner {
|
|
94
|
-
height: 100%;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.components-dropdown {
|
|
98
|
-
display: block;
|
|
99
|
-
height: 36px;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.block-editor-global-styles-background-panel__image-tools-panel-item {
|
|
104
|
-
border: $border-width solid $gray-300;
|
|
105
|
-
|
|
106
|
-
// Full width. ToolsPanel lays out children in a grid.
|
|
107
|
-
grid-column: 1 / -1;
|
|
108
|
-
|
|
109
|
-
// Ensure the dropzone is positioned to the size of the item.
|
|
110
|
-
position: relative;
|
|
111
|
-
|
|
112
|
-
// Since there is no option to skip rendering the drag'n'drop icon in drop
|
|
113
|
-
// zone, we hide it for now.
|
|
114
|
-
.components-drop-zone__content-icon {
|
|
115
|
-
display: none;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.components-dropdown {
|
|
119
|
-
display: block;
|
|
120
|
-
height: 36px;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
button.components-button {
|
|
124
|
-
color: $gray-900;
|
|
125
|
-
width: 100%;
|
|
126
|
-
display: block;
|
|
127
|
-
|
|
128
|
-
&:hover {
|
|
129
|
-
color: var(--wp-admin-theme-color);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
&:focus {
|
|
133
|
-
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.block-editor-global-styles-background-panel__loading {
|
|
138
|
-
height: 100%;
|
|
139
|
-
position: absolute;
|
|
140
|
-
z-index: 1;
|
|
141
|
-
width: 100%;
|
|
142
|
-
padding: 10px 0 0 0;
|
|
143
|
-
svg {
|
|
144
|
-
margin: 0;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.block-editor-global-styles-background-panel__image-preview-content,
|
|
150
|
-
.block-editor-global-styles-background-panel__dropdown-toggle {
|
|
151
|
-
height: 100%;
|
|
152
|
-
width: 100%;
|
|
153
|
-
padding-left: $grid-unit-15;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.block-editor-global-styles-background-panel__dropdown-toggle {
|
|
157
|
-
cursor: pointer;
|
|
158
|
-
background: transparent;
|
|
159
|
-
border: none;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.block-editor-global-styles-background-panel__inspector-media-replace-title {
|
|
163
|
-
word-break: break-all;
|
|
164
|
-
// The Button component is white-space: nowrap, and that won't work with line-clamp.
|
|
165
|
-
white-space: normal;
|
|
166
|
-
|
|
167
|
-
// Without this, the ellipsis can sometimes be partially hidden by the Button padding.
|
|
168
|
-
text-align: start;
|
|
169
|
-
text-align-last: center;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
.block-editor-global-styles-background-panel__inspector-preview-inner {
|
|
173
|
-
.block-editor-global-styles-background-panel__inspector-image-indicator-wrapper {
|
|
174
|
-
width: 20px;
|
|
175
|
-
height: 20px;
|
|
176
|
-
min-width: auto;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
.block-editor-global-styles-background-panel__inspector-image-indicator {
|
|
181
|
-
background-size: cover;
|
|
182
|
-
border-radius: $radius-round;
|
|
183
|
-
width: 20px;
|
|
184
|
-
height: 20px;
|
|
185
|
-
display: block;
|
|
186
|
-
position: relative;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.block-editor-global-styles-background-panel__inspector-image-indicator::after {
|
|
190
|
-
content: "";
|
|
191
|
-
position: absolute;
|
|
192
|
-
top: -1px;
|
|
193
|
-
left: -1px;
|
|
194
|
-
bottom: -1px;
|
|
195
|
-
right: -1px;
|
|
196
|
-
border-radius: $radius-round;
|
|
197
|
-
box-shadow: inset 0 0 0 $border-width rgba(0, 0, 0, 0.2);
|
|
198
|
-
// Show a thin outline in Windows high contrast mode, otherwise the button is invisible.
|
|
199
|
-
border: 1px solid transparent;
|
|
200
|
-
box-sizing: inherit;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
.block-editor-global-styles-background-panel__dropdown-content-wrapper {
|
|
204
|
-
min-width: 260px;
|
|
205
|
-
overflow-x: hidden;
|
|
206
|
-
|
|
207
|
-
.components-focal-point-picker-wrapper {
|
|
208
|
-
background-color: $gray-100;
|
|
209
|
-
width: 100%;
|
|
210
|
-
border-radius: $radius-small;
|
|
211
|
-
border: $border-width solid $gray-300;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.components-focal-point-picker__media--image {
|
|
215
|
-
max-height: 180px;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// Override focal picker to avoid a double border.
|
|
219
|
-
.components-focal-point-picker::after {
|
|
220
|
-
content: none;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// Push control panel into the background when the media modal is open.
|
|
225
|
-
.modal-open .block-editor-global-styles-background-panel__popover {
|
|
226
|
-
z-index: z-index(".block-editor-global-styles-background-panel__popover");
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
.block-editor-global-styles-background-panel__media-replace-popover {
|
|
230
|
-
.components-popover__content {
|
|
231
|
-
// width of block-editor-global-styles-background-panel__dropdown-content-wrapper minus padding.
|
|
232
|
-
width: 226px;
|
|
233
|
-
}
|
|
234
|
-
.components-button {
|
|
235
|
-
padding: 0 $grid-unit-10;
|
|
236
|
-
}
|
|
237
|
-
.components-button .components-menu-items__item-icon.has-icon-right {
|
|
238
|
-
margin-left: $grid-unit-30 - $grid-unit-10;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
@@ -2,53 +2,7 @@
|
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
backgroundPositionToCoords,
|
|
7
|
-
coordsToBackgroundPosition,
|
|
8
|
-
hasBackgroundImageValue,
|
|
9
|
-
} from '../background-panel';
|
|
10
|
-
|
|
11
|
-
describe( 'backgroundPositionToCoords', () => {
|
|
12
|
-
it( 'should return the correct coordinates for a percentage value using 2-value syntax', () => {
|
|
13
|
-
expect( backgroundPositionToCoords( '25% 75%' ) ).toEqual( {
|
|
14
|
-
x: 0.25,
|
|
15
|
-
y: 0.75,
|
|
16
|
-
} );
|
|
17
|
-
} );
|
|
18
|
-
|
|
19
|
-
it( 'should return the correct coordinates for a percentage using 1-value syntax', () => {
|
|
20
|
-
expect( backgroundPositionToCoords( '50%' ) ).toEqual( {
|
|
21
|
-
x: 0.5,
|
|
22
|
-
y: 0.5,
|
|
23
|
-
} );
|
|
24
|
-
} );
|
|
25
|
-
|
|
26
|
-
it( 'should return undefined coords in given an empty value', () => {
|
|
27
|
-
expect( backgroundPositionToCoords( '' ) ).toEqual( {
|
|
28
|
-
x: undefined,
|
|
29
|
-
y: undefined,
|
|
30
|
-
} );
|
|
31
|
-
} );
|
|
32
|
-
|
|
33
|
-
it( 'should return undefined coords in given a string that cannot be converted', () => {
|
|
34
|
-
expect( backgroundPositionToCoords( 'apples' ) ).toEqual( {
|
|
35
|
-
x: undefined,
|
|
36
|
-
y: undefined,
|
|
37
|
-
} );
|
|
38
|
-
} );
|
|
39
|
-
} );
|
|
40
|
-
|
|
41
|
-
describe( 'coordsToBackgroundPosition', () => {
|
|
42
|
-
it( 'should return the correct background position for a set of coordinates', () => {
|
|
43
|
-
expect( coordsToBackgroundPosition( { x: 0.25, y: 0.75 } ) ).toBe(
|
|
44
|
-
'25% 75%'
|
|
45
|
-
);
|
|
46
|
-
} );
|
|
47
|
-
|
|
48
|
-
it( 'should return undefined if no coordinates are provided', () => {
|
|
49
|
-
expect( coordsToBackgroundPosition( {} ) ).toBeUndefined();
|
|
50
|
-
} );
|
|
51
|
-
} );
|
|
5
|
+
import { hasBackgroundImageValue } from '../background-panel';
|
|
52
6
|
|
|
53
7
|
describe( 'hasBackgroundImageValue', () => {
|
|
54
8
|
it( 'should return `true` when id and url exist', () => {
|
|
@@ -54,6 +54,13 @@ export default function useSaveImage( {
|
|
|
54
54
|
} );
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
if ( modifiers.length === 0 ) {
|
|
58
|
+
// No changes to apply.
|
|
59
|
+
setIsInProgress( false );
|
|
60
|
+
onFinishEditing();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
57
64
|
apiFetch( {
|
|
58
65
|
path: `/wp/v2/media/${ id }/edit`,
|
|
59
66
|
method: 'POST',
|
|
@@ -15,8 +15,7 @@ function PatternCategoriesList( {
|
|
|
15
15
|
{ patternCategories.map( ( { name, label } ) => {
|
|
16
16
|
return (
|
|
17
17
|
<Button
|
|
18
|
-
|
|
19
|
-
__next40pxDefaultSize={ false }
|
|
18
|
+
__next40pxDefaultSize
|
|
20
19
|
key={ name }
|
|
21
20
|
label={ label }
|
|
22
21
|
className={ `${ baseClassName }__categories-list__item` }
|
|
@@ -61,8 +61,7 @@ function BlockPatternsTab( {
|
|
|
61
61
|
{ children }
|
|
62
62
|
</CategoryTabs>
|
|
63
63
|
<Button
|
|
64
|
-
|
|
65
|
-
__next40pxDefaultSize={ false }
|
|
64
|
+
__next40pxDefaultSize
|
|
66
65
|
className="block-editor-inserter__patterns-explore-button"
|
|
67
66
|
onClick={ () => setShowPatternsExplorer( true ) }
|
|
68
67
|
variant="secondary"
|
|
@@ -100,8 +100,7 @@ function InsertExternalImageModal( { onClose, onSubmit } ) {
|
|
|
100
100
|
>
|
|
101
101
|
<FlexItem>
|
|
102
102
|
<Button
|
|
103
|
-
|
|
104
|
-
__next40pxDefaultSize={ false }
|
|
103
|
+
__next40pxDefaultSize
|
|
105
104
|
variant="tertiary"
|
|
106
105
|
onClick={ onClose }
|
|
107
106
|
>
|
|
@@ -110,8 +109,7 @@ function InsertExternalImageModal( { onClose, onSubmit } ) {
|
|
|
110
109
|
</FlexItem>
|
|
111
110
|
<FlexItem>
|
|
112
111
|
<Button
|
|
113
|
-
|
|
114
|
-
__next40pxDefaultSize={ false }
|
|
112
|
+
__next40pxDefaultSize
|
|
115
113
|
variant="primary"
|
|
116
114
|
onClick={ onSubmit }
|
|
117
115
|
>
|
|
@@ -71,8 +71,7 @@ function MediaTab( {
|
|
|
71
71
|
allowedTypes={ ALLOWED_MEDIA_TYPES }
|
|
72
72
|
render={ ( { open } ) => (
|
|
73
73
|
<Button
|
|
74
|
-
|
|
75
|
-
__next40pxDefaultSize={ false }
|
|
74
|
+
__next40pxDefaultSize
|
|
76
75
|
onClick={ ( event ) => {
|
|
77
76
|
// Safari doesn't emit a focus event on button elements when
|
|
78
77
|
// clicked and we need to manually focus the button here.
|
|
@@ -138,8 +138,7 @@ export default function QuickInserter( {
|
|
|
138
138
|
|
|
139
139
|
{ setInserterIsOpened && (
|
|
140
140
|
<Button
|
|
141
|
-
|
|
142
|
-
__next40pxDefaultSize={ false }
|
|
141
|
+
__next40pxDefaultSize
|
|
143
142
|
className="block-editor-inserter__quick-inserter-expand"
|
|
144
143
|
onClick={ onBrowseAll }
|
|
145
144
|
aria-label={ __(
|
|
@@ -155,15 +155,6 @@ $block-inserter-tabs-height: 44px;
|
|
|
155
155
|
text-align: right;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
.block-editor-inserter__manage-reusable-blocks-container {
|
|
159
|
-
margin: auto $grid-unit-20 $grid-unit-20;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.block-editor-inserter__manage-reusable-blocks {
|
|
163
|
-
justify-content: center;
|
|
164
|
-
width: 100%;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
158
|
.block-editor-inserter__no-results,
|
|
168
159
|
.block-editor-inserter__patterns-loading {
|
|
169
160
|
padding: $grid-unit-40;
|
|
@@ -419,7 +410,6 @@ $block-inserter-tabs-height: 44px;
|
|
|
419
410
|
background: $gray-900;
|
|
420
411
|
color: $white;
|
|
421
412
|
width: 100%;
|
|
422
|
-
height: ($button-size + $grid-unit-10);
|
|
423
413
|
border-radius: 0;
|
|
424
414
|
|
|
425
415
|
&:hover {
|
|
@@ -33,11 +33,7 @@ function InserterListboxItem(
|
|
|
33
33
|
return children( propsWithTabIndex );
|
|
34
34
|
}
|
|
35
35
|
return (
|
|
36
|
-
<Button
|
|
37
|
-
// TODO: Switch to `true` (40px size) if possible
|
|
38
|
-
__next40pxDefaultSize={ false }
|
|
39
|
-
{ ...propsWithTabIndex }
|
|
40
|
-
>
|
|
36
|
+
<Button __next40pxDefaultSize { ...propsWithTabIndex }>
|
|
41
37
|
{ children }
|
|
42
38
|
</Button>
|
|
43
39
|
);
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
Notice,
|
|
13
13
|
TextControl,
|
|
14
14
|
__experimentalHStack as HStack,
|
|
15
|
+
__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,
|
|
15
16
|
} from '@wordpress/components';
|
|
16
17
|
import { __ } from '@wordpress/i18n';
|
|
17
18
|
import { useRef, useState, useEffect } from '@wordpress/element';
|
|
@@ -383,7 +384,7 @@ function LinkControl( {
|
|
|
383
384
|
value={ internalControlValue?.title }
|
|
384
385
|
onChange={ setInternalTextInputValue }
|
|
385
386
|
onKeyDown={ handleSubmitWithEnter }
|
|
386
|
-
|
|
387
|
+
__next40pxDefaultSize
|
|
387
388
|
/>
|
|
388
389
|
) }
|
|
389
390
|
<LinkControlSearchInput
|
|
@@ -404,20 +405,24 @@ function LinkControl( {
|
|
|
404
405
|
createSuggestionButtonText
|
|
405
406
|
}
|
|
406
407
|
hideLabelFromVision={ ! showTextControl }
|
|
408
|
+
suffix={
|
|
409
|
+
showActions ? undefined : (
|
|
410
|
+
<InputControlSuffixWrapper variant="control">
|
|
411
|
+
<Button
|
|
412
|
+
onClick={
|
|
413
|
+
isDisabled ? noop : handleSubmit
|
|
414
|
+
}
|
|
415
|
+
label={ __( 'Submit' ) }
|
|
416
|
+
icon={ keyboardReturn }
|
|
417
|
+
className="block-editor-link-control__search-submit"
|
|
418
|
+
aria-disabled={ isDisabled }
|
|
419
|
+
size="small"
|
|
420
|
+
/>
|
|
421
|
+
</InputControlSuffixWrapper>
|
|
422
|
+
)
|
|
423
|
+
}
|
|
424
|
+
props
|
|
407
425
|
/>
|
|
408
|
-
{ ! showActions && (
|
|
409
|
-
<div className="block-editor-link-control__search-enter">
|
|
410
|
-
<Button
|
|
411
|
-
// TODO: Switch to `true` (40px size) if possible
|
|
412
|
-
__next40pxDefaultSize={ false }
|
|
413
|
-
onClick={ isDisabled ? noop : handleSubmit }
|
|
414
|
-
label={ __( 'Submit' ) }
|
|
415
|
-
icon={ keyboardReturn }
|
|
416
|
-
className="block-editor-link-control__search-submit"
|
|
417
|
-
aria-disabled={ isDisabled }
|
|
418
|
-
/>
|
|
419
|
-
</div>
|
|
420
|
-
) }
|
|
421
426
|
</div>
|
|
422
427
|
{ errorMessage && (
|
|
423
428
|
<Notice
|
|
@@ -43,6 +43,7 @@ const LinkControlSearchInput = forwardRef(
|
|
|
43
43
|
withURLSuggestion = true,
|
|
44
44
|
createSuggestionButtonText,
|
|
45
45
|
hideLabelFromVision = false,
|
|
46
|
+
suffix,
|
|
46
47
|
},
|
|
47
48
|
ref
|
|
48
49
|
) => {
|
|
@@ -147,6 +148,7 @@ const LinkControlSearchInput = forwardRef(
|
|
|
147
148
|
}
|
|
148
149
|
} }
|
|
149
150
|
ref={ ref }
|
|
151
|
+
suffix={ suffix }
|
|
150
152
|
/>
|
|
151
153
|
{ children }
|
|
152
154
|
</div>
|
|
@@ -72,34 +72,12 @@ $block-editor-link-control-number-of-actions: 1;
|
|
|
72
72
|
color: $gray-900;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
input[type="text"],
|
|
76
|
-
// Specificity overide of URLInput defaults.
|
|
77
|
-
&.block-editor-url-input input[type="text"].block-editor-url-input__input {
|
|
78
|
-
@include input-control;
|
|
79
|
-
display: block;
|
|
80
|
-
border: $border-width solid $gray-600;
|
|
81
|
-
height: $button-size-next-default-40px; // components do not properly support unstable-large yet.
|
|
82
|
-
margin: 0;
|
|
83
|
-
padding: $grid-unit-10 $button-size-next-default-40px $grid-unit-10 $grid-unit-20;
|
|
84
|
-
position: relative;
|
|
85
|
-
width: 100%;
|
|
86
|
-
|
|
87
|
-
.has-actions & {
|
|
88
|
-
padding-right: $grid-unit-20;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
75
|
}
|
|
92
76
|
|
|
93
77
|
.block-editor-link-control__search-error {
|
|
94
78
|
margin: -$grid-unit-20 * 0.5 $grid-unit-20 $grid-unit-20; // negative margin to bring the error a bit closer to the button
|
|
95
79
|
}
|
|
96
80
|
|
|
97
|
-
.block-editor-link-control__search-enter {
|
|
98
|
-
position: absolute;
|
|
99
|
-
right: 19px; // specific to place the button properly.
|
|
100
|
-
top: 3px;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
81
|
.block-editor-link-control__search-actions {
|
|
104
82
|
padding: $grid-unit-10 $grid-unit-20 $grid-unit-20;
|
|
105
83
|
}
|
|
@@ -125,6 +125,7 @@ export function RichTextWrapper(
|
|
|
125
125
|
const { clientId, isSelected: isBlockSelected, name: blockName } = context;
|
|
126
126
|
const blockBindings = context[ blockBindingsKey ];
|
|
127
127
|
const blockContext = useContext( BlockContext );
|
|
128
|
+
const registry = useRegistry();
|
|
128
129
|
const selector = ( select ) => {
|
|
129
130
|
// Avoid subscribing to the block editor store if the block is not
|
|
130
131
|
// selected.
|
|
@@ -178,6 +179,10 @@ export function RichTextWrapper(
|
|
|
178
179
|
const blockBindingsSource = getBlockBindingsSource(
|
|
179
180
|
relatedBinding.source
|
|
180
181
|
);
|
|
182
|
+
const fieldsList = blockBindingsSource?.getFieldsList?.( {
|
|
183
|
+
registry,
|
|
184
|
+
context: blockContext,
|
|
185
|
+
} );
|
|
181
186
|
|
|
182
187
|
const _disableBoundBlock =
|
|
183
188
|
! blockBindingsSource?.canUserEditValue?.( {
|
|
@@ -186,12 +191,16 @@ export function RichTextWrapper(
|
|
|
186
191
|
args: relatedBinding.args,
|
|
187
192
|
} );
|
|
188
193
|
|
|
194
|
+
const bindingKey =
|
|
195
|
+
fieldsList?.[ relatedBinding?.args?.key ]?.label ??
|
|
196
|
+
blockBindingsSource?.label;
|
|
197
|
+
|
|
189
198
|
const _bindingsPlaceholder = _disableBoundBlock
|
|
190
|
-
?
|
|
199
|
+
? bindingKey
|
|
191
200
|
: sprintf(
|
|
192
|
-
/* translators: %s:
|
|
201
|
+
/* translators: %s: connected field label or source label */
|
|
193
202
|
__( 'Add %s' ),
|
|
194
|
-
|
|
203
|
+
bindingKey
|
|
195
204
|
);
|
|
196
205
|
|
|
197
206
|
return {
|
|
@@ -201,7 +210,14 @@ export function RichTextWrapper(
|
|
|
201
210
|
_bindingsPlaceholder,
|
|
202
211
|
};
|
|
203
212
|
},
|
|
204
|
-
[
|
|
213
|
+
[
|
|
214
|
+
blockBindings,
|
|
215
|
+
identifier,
|
|
216
|
+
blockName,
|
|
217
|
+
blockContext,
|
|
218
|
+
registry,
|
|
219
|
+
adjustedValue,
|
|
220
|
+
]
|
|
205
221
|
);
|
|
206
222
|
|
|
207
223
|
const shouldDisableEditing = readOnly || disableBoundBlock;
|
|
@@ -371,7 +387,6 @@ export function RichTextWrapper(
|
|
|
371
387
|
element.focus();
|
|
372
388
|
}
|
|
373
389
|
|
|
374
|
-
const registry = useRegistry();
|
|
375
390
|
const TagName = tagName;
|
|
376
391
|
return (
|
|
377
392
|
<>
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
__experimentalVStack as VStack,
|
|
8
8
|
} from '@wordpress/components';
|
|
9
9
|
import { useState } from '@wordpress/element';
|
|
10
|
-
import { __,
|
|
10
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
@@ -15,7 +15,7 @@ import { __, _x, sprintf } from '@wordpress/i18n';
|
|
|
15
15
|
import AxialInputControls from './input-controls/axial';
|
|
16
16
|
import SeparatedInputControls from './input-controls/separated';
|
|
17
17
|
import SingleInputControl from './input-controls/single';
|
|
18
|
-
import
|
|
18
|
+
import LinkedButton from './linked-button';
|
|
19
19
|
import useSpacingSizes from './hooks/use-spacing-sizes';
|
|
20
20
|
import {
|
|
21
21
|
ALL_SIDES,
|
|
@@ -47,6 +47,10 @@ export default function SpacingSizesControl( {
|
|
|
47
47
|
|
|
48
48
|
const [ view, setView ] = useState( getInitialView( inputValues, sides ) );
|
|
49
49
|
|
|
50
|
+
const toggleLinked = () => {
|
|
51
|
+
setView( view === VIEWS.axial ? VIEWS.custom : VIEWS.axial );
|
|
52
|
+
};
|
|
53
|
+
|
|
50
54
|
const handleOnChange = ( nextValue ) => {
|
|
51
55
|
const newValues = { ...values, ...nextValue };
|
|
52
56
|
onChange( newValues );
|
|
@@ -91,12 +95,6 @@ export default function SpacingSizesControl( {
|
|
|
91
95
|
sideLabel
|
|
92
96
|
).trim();
|
|
93
97
|
|
|
94
|
-
const dropdownLabelText = sprintf(
|
|
95
|
-
// translators: %s: The current spacing property e.g. "Padding", "Margin".
|
|
96
|
-
_x( '%s options', 'Button label to reveal side configuration options' ),
|
|
97
|
-
labelProp
|
|
98
|
-
);
|
|
99
|
-
|
|
100
98
|
return (
|
|
101
99
|
<fieldset className="spacing-sizes-control">
|
|
102
100
|
<HStack className="spacing-sizes-control__header">
|
|
@@ -107,11 +105,10 @@ export default function SpacingSizesControl( {
|
|
|
107
105
|
{ label }
|
|
108
106
|
</BaseControl.VisualLabel>
|
|
109
107
|
{ ! hasOneSide && ! hasOnlyAxialSides && (
|
|
110
|
-
<
|
|
111
|
-
label={
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
value={ view }
|
|
108
|
+
<LinkedButton
|
|
109
|
+
label={ labelProp }
|
|
110
|
+
onClick={ toggleLinked }
|
|
111
|
+
isLinked={ view === VIEWS.axial }
|
|
115
112
|
/>
|
|
116
113
|
) }
|
|
117
114
|
</HStack>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Button, Tooltip } from '@wordpress/components';
|
|
5
|
+
import { link, linkOff } from '@wordpress/icons';
|
|
6
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
7
|
+
|
|
8
|
+
export default function LinkedButton( { isLinked, ...props } ) {
|
|
9
|
+
const label = isLinked
|
|
10
|
+
? sprintf(
|
|
11
|
+
// translators: 1. Type of spacing being modified (padding, margin, etc).
|
|
12
|
+
__( 'Unlink %1$s' ),
|
|
13
|
+
props.label.toLowerCase()
|
|
14
|
+
).trim()
|
|
15
|
+
: sprintf(
|
|
16
|
+
// translators: 1. Type of spacing being modified (padding, margin, etc).
|
|
17
|
+
__( 'Link %1$s' ),
|
|
18
|
+
props.label.toLowerCase()
|
|
19
|
+
).trim();
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Tooltip text={ label }>
|
|
23
|
+
<Button
|
|
24
|
+
{ ...props }
|
|
25
|
+
size="small"
|
|
26
|
+
icon={ isLinked ? link : linkOff }
|
|
27
|
+
iconSize={ 24 }
|
|
28
|
+
aria-label={ label }
|
|
29
|
+
/>
|
|
30
|
+
</Tooltip>
|
|
31
|
+
);
|
|
32
|
+
}
|