@wordpress/block-editor 9.6.0 → 9.7.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.
- package/CHANGELOG.md +2 -0
- package/build/components/block-list/block.js +12 -2
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/index.native.js +1 -1
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-popover/inbetween.js +1 -1
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-styles/index.js +3 -6
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-types-list/index.js +1 -1
- package/build/components/block-types-list/index.js.map +1 -1
- package/build/components/border-radius-control/index.js +3 -1
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/colors/utils.js +6 -2
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors-gradients/control.js +7 -4
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +5 -2
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/font-appearance-control/index.js +10 -4
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/image-size-control/index.js +3 -1
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.js +13 -6
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +11 -4
- package/build/components/index.native.js.map +1 -1
- package/build/components/inserter/index.native.js +8 -3
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter-list-item/index.js +2 -19
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +6 -3
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/line-height-control/index.js +6 -3
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/is-url-like.js +1 -7
- package/build/components/link-control/is-url-like.js.map +1 -1
- package/build/components/link-control/use-search-handler.js +1 -7
- package/build/components/link-control/use-search-handler.js.map +1 -1
- package/build/components/list-view/expander.js +3 -1
- package/build/components/list-view/expander.js.map +1 -1
- package/build/components/media-upload/index.native.js +8 -3
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/preview-options/index.js +2 -2
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/{use-no-recursive-renders → recursion-provider}/index.js +40 -18
- package/build/components/recursion-provider/index.js.map +1 -0
- package/build/components/rich-text/index.js +6 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +3 -1
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/use-before-input-rules.js +110 -0
- package/build/components/rich-text/use-before-input-rules.js.map +1 -0
- package/build/components/text-decoration-control/index.js +3 -1
- package/build/components/text-decoration-control/index.js.map +1 -1
- package/build/components/text-transform-control/index.js +3 -1
- package/build/components/text-transform-control/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +4 -1
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +4 -25
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/components/writing-flow/use-drag-selection.js +9 -2
- package/build/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build/components/writing-flow/use-select-all.js +3 -1
- package/build/components/writing-flow/use-select-all.js.map +1 -1
- package/build/hooks/layout.js +9 -2
- package/build/hooks/layout.js.map +1 -1
- package/build/utils/block-variation-transforms.js +15 -9
- package/build/utils/block-variation-transforms.js.map +1 -1
- package/build/utils/pasting.js +9 -1
- package/build/utils/pasting.js.map +1 -1
- package/build-module/components/block-list/block.js +13 -3
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/index.native.js +1 -1
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +1 -1
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-styles/index.js +4 -7
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-types-list/index.js +1 -1
- package/build-module/components/block-types-list/index.js.map +1 -1
- package/build-module/components/border-radius-control/index.js +4 -2
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/colors/utils.js +7 -3
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +7 -4
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +5 -2
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +7 -4
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/image-size-control/index.js +3 -1
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.js +1 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inserter/index.native.js +9 -2
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +1 -17
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +5 -3
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js +5 -3
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/is-url-like.js +1 -6
- package/build-module/components/link-control/is-url-like.js.map +1 -1
- package/build-module/components/link-control/use-search-handler.js +1 -6
- package/build-module/components/link-control/use-search-handler.js.map +1 -1
- package/build-module/components/list-view/expander.js +3 -2
- package/build-module/components/list-view/expander.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +9 -2
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/preview-options/index.js +2 -2
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/{use-no-recursive-renders → recursion-provider}/index.js +39 -19
- package/build-module/components/recursion-provider/index.js.map +1 -0
- package/build-module/components/rich-text/index.js +5 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +3 -1
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-before-input-rules.js +96 -0
- package/build-module/components/rich-text/use-before-input-rules.js.map +1 -0
- package/build-module/components/text-decoration-control/index.js +4 -2
- package/build-module/components/text-decoration-control/index.js.map +1 -1
- package/build-module/components/text-transform-control/index.js +4 -2
- package/build-module/components/text-transform-control/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +4 -1
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +5 -26
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/components/writing-flow/use-drag-selection.js +9 -2
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-select-all.js +3 -1
- package/build-module/components/writing-flow/use-select-all.js.map +1 -1
- package/build-module/hooks/layout.js +9 -2
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/utils/block-variation-transforms.js +14 -7
- package/build-module/utils/block-variation-transforms.js.map +1 -1
- package/build-module/utils/pasting.js +9 -1
- package/build-module/utils/pasting.js.map +1 -1
- package/build-style/style-rtl.css +39 -7
- package/build-style/style.css +39 -7
- package/package.json +28 -28
- package/src/components/block-list/block.js +13 -2
- package/src/components/block-list/index.native.js +1 -1
- package/src/components/block-popover/inbetween.js +1 -0
- package/src/components/block-popover/style.scss +25 -2
- package/src/components/block-styles/index.js +4 -7
- package/src/components/block-styles/style.scss +10 -0
- package/src/components/block-types-list/index.js +1 -1
- package/src/components/border-radius-control/index.js +4 -1
- package/src/components/color-palette/test/__snapshots__/control.js.snap +93 -77
- package/src/components/colors/utils.js +5 -2
- package/src/components/colors-gradients/control.js +12 -8
- package/src/components/colors-gradients/dropdown.js +7 -2
- package/src/components/colors-gradients/style.scss +27 -5
- package/src/components/colors-gradients/test/control.js +3 -3
- package/src/components/font-appearance-control/index.js +3 -0
- package/src/components/image-size-control/README.md +7 -0
- package/src/components/image-size-control/index.js +2 -0
- package/src/components/index.js +4 -1
- package/src/components/index.native.js +4 -1
- package/src/components/inserter/index.native.js +7 -2
- package/src/components/inserter-list-item/index.js +1 -17
- package/src/components/letter-spacing-control/index.js +2 -0
- package/src/components/line-height-control/index.js +2 -0
- package/src/components/link-control/is-url-like.js +1 -6
- package/src/components/link-control/use-search-handler.js +1 -6
- package/src/components/list-view/expander.js +4 -2
- package/src/components/media-upload/index.native.js +7 -3
- package/src/components/preview-options/index.js +2 -2
- package/src/components/{use-no-recursive-renders → recursion-provider}/index.js +39 -28
- package/src/components/{use-no-recursive-renders/test/use-no-recursive-renders.js → recursion-provider/test/index.js} +5 -6
- package/src/components/rich-text/README.md +13 -1
- package/src/components/rich-text/index.js +2 -0
- package/src/components/rich-text/index.native.js +2 -0
- package/src/components/rich-text/use-before-input-rules.js +91 -0
- package/src/components/text-decoration-control/index.js +4 -2
- package/src/components/text-transform-control/index.js +4 -2
- package/src/components/url-popover/image-url-input-ui.js +3 -0
- package/src/components/writing-flow/use-arrow-nav.js +4 -33
- package/src/components/writing-flow/use-drag-selection.js +7 -1
- package/src/components/writing-flow/use-select-all.js +2 -1
- package/src/hooks/layout.js +8 -2
- package/src/utils/block-variation-transforms.js +13 -6
- package/src/utils/pasting.js +10 -1
- package/src/utils/test/block-variation-transforms.js +24 -0
- package/src/utils/test/pasting.js +10 -0
- package/build/components/use-no-recursive-renders/index.js.map +0 -1
- package/build-module/components/use-no-recursive-renders/index.js.map +0 -1
|
@@ -4,6 +4,13 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
|
|
|
4
4
|
.emotion-0 {
|
|
5
5
|
font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif;
|
|
6
6
|
font-size: 13px;
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.emotion-0 *,
|
|
11
|
+
.emotion-0 *::before,
|
|
12
|
+
.emotion-0 *::after {
|
|
13
|
+
box-sizing: inherit;
|
|
7
14
|
}
|
|
8
15
|
|
|
9
16
|
.components-panel__row .emotion-2 {
|
|
@@ -36,8 +43,13 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
|
|
|
36
43
|
}
|
|
37
44
|
|
|
38
45
|
.emotion-6 {
|
|
46
|
+
font-size: 11px;
|
|
47
|
+
font-weight: 500;
|
|
48
|
+
line-height: 1.4;
|
|
49
|
+
text-transform: uppercase;
|
|
39
50
|
display: inline-block;
|
|
40
51
|
margin-bottom: calc(4px * 2);
|
|
52
|
+
padding: 0;
|
|
41
53
|
}
|
|
42
54
|
|
|
43
55
|
.emotion-8 {
|
|
@@ -140,100 +152,104 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
|
|
|
140
152
|
</div>
|
|
141
153
|
</legend>
|
|
142
154
|
<div
|
|
143
|
-
className="
|
|
144
|
-
data-wp-c16t={true}
|
|
145
|
-
data-wp-component="VStack"
|
|
155
|
+
className="block-editor-color-gradient-control__panel"
|
|
146
156
|
>
|
|
147
157
|
<div
|
|
148
|
-
className="components-
|
|
149
|
-
|
|
158
|
+
className="components-flex components-h-stack components-v-stack emotion-8 emotion-5"
|
|
159
|
+
data-wp-c16t={true}
|
|
160
|
+
data-wp-component="VStack"
|
|
150
161
|
>
|
|
151
|
-
<
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
aria-label="Custom color picker. The currently selected color is called \\"red\\" and has a value of \\"f00\\"."
|
|
155
|
-
className="components-flex components-color-palette__custom-color emotion-10 emotion-5"
|
|
156
|
-
data-wp-c16t={true}
|
|
157
|
-
data-wp-component="Flex"
|
|
158
|
-
onClick={[Function]}
|
|
159
|
-
style={
|
|
160
|
-
Object {
|
|
161
|
-
"background": "#f00",
|
|
162
|
-
"color": "#000",
|
|
163
|
-
}
|
|
164
|
-
}
|
|
162
|
+
<div
|
|
163
|
+
className="components-dropdown"
|
|
164
|
+
tabIndex="-1"
|
|
165
165
|
>
|
|
166
|
-
<
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
red
|
|
172
|
-
</span>
|
|
173
|
-
<span
|
|
174
|
-
className="components-flex-item components-color-palette__custom-color-value emotion-15 emotion-5"
|
|
166
|
+
<button
|
|
167
|
+
aria-expanded={false}
|
|
168
|
+
aria-haspopup="true"
|
|
169
|
+
aria-label="Custom color picker. The currently selected color is called \\"red\\" and has a value of \\"f00\\"."
|
|
170
|
+
className="components-flex components-color-palette__custom-color emotion-10 emotion-5"
|
|
175
171
|
data-wp-c16t={true}
|
|
176
|
-
data-wp-component="
|
|
172
|
+
data-wp-component="Flex"
|
|
173
|
+
onClick={[Function]}
|
|
174
|
+
style={
|
|
175
|
+
Object {
|
|
176
|
+
"background": "#f00",
|
|
177
|
+
"color": "#000",
|
|
178
|
+
}
|
|
179
|
+
}
|
|
177
180
|
>
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
181
|
+
<span
|
|
182
|
+
className="components-truncate components-flex-item components-color-palette__custom-color-name emotion-5 emotion-13 emotion-5"
|
|
183
|
+
data-wp-c16t={true}
|
|
184
|
+
data-wp-component="FlexItem"
|
|
185
|
+
>
|
|
186
|
+
red
|
|
187
|
+
</span>
|
|
188
|
+
<span
|
|
189
|
+
className="components-flex-item components-color-palette__custom-color-value emotion-15 emotion-5"
|
|
190
|
+
data-wp-c16t={true}
|
|
191
|
+
data-wp-component="FlexItem"
|
|
192
|
+
>
|
|
193
|
+
f00
|
|
194
|
+
</span>
|
|
195
|
+
</button>
|
|
196
|
+
</div>
|
|
185
197
|
<div
|
|
186
|
-
className="components-circular-option-
|
|
198
|
+
className="components-circular-option-picker"
|
|
187
199
|
>
|
|
188
200
|
<div
|
|
189
|
-
className="components-circular-option-
|
|
201
|
+
className="components-circular-option-picker__swatches"
|
|
202
|
+
>
|
|
203
|
+
<div
|
|
204
|
+
className="components-circular-option-picker__option-wrapper"
|
|
205
|
+
>
|
|
206
|
+
<button
|
|
207
|
+
aria-describedby={null}
|
|
208
|
+
aria-label="Color: red"
|
|
209
|
+
aria-pressed={true}
|
|
210
|
+
className="components-button components-circular-option-picker__option is-pressed"
|
|
211
|
+
onBlur={[Function]}
|
|
212
|
+
onClick={[Function]}
|
|
213
|
+
onFocus={[Function]}
|
|
214
|
+
onMouseDown={[Function]}
|
|
215
|
+
onMouseEnter={[Function]}
|
|
216
|
+
onMouseLeave={[Function]}
|
|
217
|
+
style={
|
|
218
|
+
Object {
|
|
219
|
+
"backgroundColor": "#f00",
|
|
220
|
+
"color": "#f00",
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
type="button"
|
|
224
|
+
/>
|
|
225
|
+
<svg
|
|
226
|
+
aria-hidden={true}
|
|
227
|
+
fill="#000"
|
|
228
|
+
focusable={false}
|
|
229
|
+
height={24}
|
|
230
|
+
viewBox="0 0 24 24"
|
|
231
|
+
width={24}
|
|
232
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
233
|
+
>
|
|
234
|
+
<path
|
|
235
|
+
d="M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
|
|
236
|
+
/>
|
|
237
|
+
</svg>
|
|
238
|
+
</div>
|
|
239
|
+
</div>
|
|
240
|
+
<div
|
|
241
|
+
className="components-circular-option-picker__custom-clear-wrapper"
|
|
190
242
|
>
|
|
191
243
|
<button
|
|
192
244
|
aria-describedby={null}
|
|
193
|
-
|
|
194
|
-
aria-pressed={true}
|
|
195
|
-
className="components-button components-circular-option-picker__option is-pressed"
|
|
196
|
-
onBlur={[Function]}
|
|
245
|
+
className="components-button components-circular-option-picker__clear is-tertiary"
|
|
197
246
|
onClick={[Function]}
|
|
198
|
-
onFocus={[Function]}
|
|
199
|
-
onMouseDown={[Function]}
|
|
200
|
-
onMouseEnter={[Function]}
|
|
201
|
-
onMouseLeave={[Function]}
|
|
202
|
-
style={
|
|
203
|
-
Object {
|
|
204
|
-
"backgroundColor": "#f00",
|
|
205
|
-
"color": "#f00",
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
247
|
type="button"
|
|
209
|
-
/>
|
|
210
|
-
<svg
|
|
211
|
-
aria-hidden={true}
|
|
212
|
-
fill="#000"
|
|
213
|
-
focusable={false}
|
|
214
|
-
height={24}
|
|
215
|
-
viewBox="0 0 24 24"
|
|
216
|
-
width={24}
|
|
217
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
218
248
|
>
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
/>
|
|
222
|
-
</svg>
|
|
249
|
+
Clear
|
|
250
|
+
</button>
|
|
223
251
|
</div>
|
|
224
252
|
</div>
|
|
225
|
-
<div
|
|
226
|
-
className="components-circular-option-picker__custom-clear-wrapper"
|
|
227
|
-
>
|
|
228
|
-
<button
|
|
229
|
-
aria-describedby={null}
|
|
230
|
-
className="components-button components-circular-option-picker__clear is-tertiary"
|
|
231
|
-
onClick={[Function]}
|
|
232
|
-
type="button"
|
|
233
|
-
>
|
|
234
|
-
Clear
|
|
235
|
-
</button>
|
|
236
|
-
</div>
|
|
237
253
|
</div>
|
|
238
254
|
</div>
|
|
239
255
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { find, kebabCase
|
|
4
|
+
import { find, kebabCase } from 'lodash';
|
|
5
5
|
import { colord, extend } from 'colord';
|
|
6
6
|
import namesPlugin from 'colord/plugins/names';
|
|
7
7
|
import a11yPlugin from 'colord/plugins/a11y';
|
|
@@ -77,6 +77,9 @@ export function getColorClassName( colorContextName, colorSlug ) {
|
|
|
77
77
|
*/
|
|
78
78
|
export function getMostReadableColor( colors, colorValue ) {
|
|
79
79
|
const colordColor = colord( colorValue );
|
|
80
|
-
|
|
80
|
+
const getColorContrast = ( { color } ) => colordColor.contrast( color );
|
|
81
|
+
|
|
82
|
+
const maxContrast = Math.max( ...colors.map( getColorContrast ) );
|
|
83
|
+
return colors.find( ( color ) => getColorContrast( color ) === maxContrast )
|
|
81
84
|
.color;
|
|
82
85
|
}
|
|
@@ -29,7 +29,7 @@ const colorsAndGradientKeys = [
|
|
|
29
29
|
|
|
30
30
|
const TAB_COLOR = {
|
|
31
31
|
name: 'color',
|
|
32
|
-
title: 'Solid
|
|
32
|
+
title: 'Solid',
|
|
33
33
|
value: 'color',
|
|
34
34
|
};
|
|
35
35
|
const TAB_GRADIENT = {
|
|
@@ -113,6 +113,12 @@ function ColorGradientControlInner( {
|
|
|
113
113
|
),
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
+
const renderPanelType = ( type ) => (
|
|
117
|
+
<div className="block-editor-color-gradient-control__panel">
|
|
118
|
+
{ tabPanels[ type ] }
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
|
|
116
122
|
return (
|
|
117
123
|
<BaseControl
|
|
118
124
|
__nextHasNoMarginBottom
|
|
@@ -142,15 +148,13 @@ function ColorGradientControlInner( {
|
|
|
142
148
|
: !! canChooseAColor && TAB_COLOR.value
|
|
143
149
|
}
|
|
144
150
|
>
|
|
145
|
-
{ ( tab ) => (
|
|
146
|
-
<div className="block-editor-color-gradient-control__tab-panel">
|
|
147
|
-
{ tabPanels[ tab.value ] }
|
|
148
|
-
</div>
|
|
149
|
-
) }
|
|
151
|
+
{ ( tab ) => renderPanelType( tab.value ) }
|
|
150
152
|
</TabPanel>
|
|
151
153
|
) }
|
|
152
|
-
{ ! canChooseAGradient &&
|
|
153
|
-
|
|
154
|
+
{ ! canChooseAGradient &&
|
|
155
|
+
renderPanelType( TAB_COLOR.value ) }
|
|
156
|
+
{ ! canChooseAColor &&
|
|
157
|
+
renderPanelType( TAB_GRADIENT.value ) }
|
|
154
158
|
</VStack>
|
|
155
159
|
</fieldset>
|
|
156
160
|
</BaseControl>
|
|
@@ -61,7 +61,12 @@ const LabeledColorIndicator = ( { colorValue, label } ) => (
|
|
|
61
61
|
className="block-editor-panel-color-gradient-settings__color-indicator"
|
|
62
62
|
colorValue={ colorValue }
|
|
63
63
|
/>
|
|
64
|
-
<FlexItem
|
|
64
|
+
<FlexItem
|
|
65
|
+
className="block-editor-panel-color-gradient-settings__color-name"
|
|
66
|
+
title={ label }
|
|
67
|
+
>
|
|
68
|
+
{ label }
|
|
69
|
+
</FlexItem>
|
|
65
70
|
</HStack>
|
|
66
71
|
);
|
|
67
72
|
|
|
@@ -158,7 +163,7 @@ export default function ColorGradientSettingsDropdown( {
|
|
|
158
163
|
className="block-editor-tools-panel-color-gradient-settings__dropdown"
|
|
159
164
|
renderToggle={ renderToggle( toggleSettings ) }
|
|
160
165
|
renderContent={ () => (
|
|
161
|
-
<DropdownContentWrapper paddingSize="
|
|
166
|
+
<DropdownContentWrapper paddingSize="none">
|
|
162
167
|
<div className="block-editor-panel-color-gradient-settings__dropdown-content">
|
|
163
168
|
<ColorGradientControl
|
|
164
169
|
{ ...controlProps }
|
|
@@ -15,6 +15,12 @@ $swatch-gap: 12px;
|
|
|
15
15
|
min-width: 0;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
.block-editor-color-gradient-control__tabs {
|
|
19
|
+
.block-editor-color-gradient-control__panel {
|
|
20
|
+
padding: $grid-unit-20;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
18
24
|
.block-editor-panel-color-gradient-settings.block-editor-panel-color-gradient-settings {
|
|
19
25
|
&,
|
|
20
26
|
& > div:not(:first-of-type) {
|
|
@@ -41,7 +47,13 @@ $swatch-gap: 12px;
|
|
|
41
47
|
}
|
|
42
48
|
|
|
43
49
|
.block-editor-panel-color-gradient-settings__dropdown-content {
|
|
44
|
-
|
|
50
|
+
.block-editor-color-gradient-control__panel {
|
|
51
|
+
$panelPadding: $grid-unit-20;
|
|
52
|
+
|
|
53
|
+
// Ensure the popover perfectly wraps the swatches.
|
|
54
|
+
width: ( $swatch-size * 6 ) + ( $swatch-gap * 5 ) + ( $panelPadding * 2 );
|
|
55
|
+
padding: $panelPadding;
|
|
56
|
+
}
|
|
45
57
|
}
|
|
46
58
|
|
|
47
59
|
.block-editor-panel-color-gradient-settings__color-indicator {
|
|
@@ -58,6 +70,7 @@ $swatch-gap: 12px;
|
|
|
58
70
|
*/
|
|
59
71
|
.block-editor-tools-panel-color-gradient-settings__item {
|
|
60
72
|
padding: 0;
|
|
73
|
+
max-width: 100%;
|
|
61
74
|
|
|
62
75
|
// Border styles.
|
|
63
76
|
border-left: 1px solid rgba(0, 0, 0, 0.1);
|
|
@@ -87,19 +100,28 @@ $swatch-gap: 12px;
|
|
|
87
100
|
padding: 0;
|
|
88
101
|
|
|
89
102
|
> button {
|
|
90
|
-
height:
|
|
103
|
+
height: auto;
|
|
104
|
+
padding-top: $grid-unit * 1.25;
|
|
105
|
+
padding-bottom: $grid-unit * 1.25;
|
|
106
|
+
text-align: left;
|
|
91
107
|
|
|
92
108
|
&.is-open {
|
|
93
109
|
background: $gray-100;
|
|
94
110
|
color: var(--wp-admin-theme-color);
|
|
95
111
|
}
|
|
96
112
|
}
|
|
113
|
+
|
|
114
|
+
.block-editor-panel-color-gradient-settings__color-name {
|
|
115
|
+
white-space: nowrap;
|
|
116
|
+
overflow: hidden;
|
|
117
|
+
text-overflow: ellipsis;
|
|
118
|
+
}
|
|
97
119
|
}
|
|
98
120
|
|
|
99
121
|
.block-editor-panel-color-gradient-settings__dropdown {
|
|
100
122
|
width: 100%;
|
|
101
|
-
}
|
|
102
123
|
|
|
103
|
-
.
|
|
104
|
-
|
|
124
|
+
.component-color-indicator {
|
|
125
|
+
flex-shrink: 0;
|
|
126
|
+
}
|
|
105
127
|
}
|
|
@@ -53,7 +53,7 @@ describe( 'ColorPaletteControl', () => {
|
|
|
53
53
|
|
|
54
54
|
// Is showing the two tab buttons.
|
|
55
55
|
expect(
|
|
56
|
-
screen.getByRole( 'tab', { name: 'Solid
|
|
56
|
+
screen.getByRole( 'tab', { name: 'Solid' } )
|
|
57
57
|
).toBeInTheDocument();
|
|
58
58
|
expect(
|
|
59
59
|
screen.getByRole( 'tab', { name: 'Gradient' } )
|
|
@@ -86,7 +86,7 @@ describe( 'ColorPaletteControl', () => {
|
|
|
86
86
|
|
|
87
87
|
// Is not showing the two tab buttons.
|
|
88
88
|
expect(
|
|
89
|
-
screen.queryByRole( 'tab', { name: 'Solid
|
|
89
|
+
screen.queryByRole( 'tab', { name: 'Solid' } )
|
|
90
90
|
).not.toBeInTheDocument();
|
|
91
91
|
expect(
|
|
92
92
|
screen.queryByRole( 'tab', { name: 'Gradient' } )
|
|
@@ -133,7 +133,7 @@ describe( 'ColorPaletteControl', () => {
|
|
|
133
133
|
|
|
134
134
|
// Is not showing the two tab buttons.
|
|
135
135
|
expect(
|
|
136
|
-
screen.queryByRole( 'tab', { name: 'Solid
|
|
136
|
+
screen.queryByRole( 'tab', { name: 'Solid' } )
|
|
137
137
|
).not.toBeInTheDocument();
|
|
138
138
|
expect(
|
|
139
139
|
screen.queryByRole( 'tab', { name: 'Gradient' } )
|
|
@@ -88,6 +88,7 @@ export default function FontAppearanceControl( props ) {
|
|
|
88
88
|
hasFontStyles = true,
|
|
89
89
|
hasFontWeights = true,
|
|
90
90
|
value: { fontStyle, fontWeight },
|
|
91
|
+
...otherProps
|
|
91
92
|
} = props;
|
|
92
93
|
const hasStylesOrWeights = hasFontStyles || hasFontWeights;
|
|
93
94
|
const label = getFontAppearanceLabel( hasFontStyles, hasFontWeights );
|
|
@@ -205,6 +206,7 @@ export default function FontAppearanceControl( props ) {
|
|
|
205
206
|
return (
|
|
206
207
|
hasStylesOrWeights && (
|
|
207
208
|
<CustomSelectControl
|
|
209
|
+
{ ...otherProps }
|
|
208
210
|
className="components-font-appearance-control"
|
|
209
211
|
label={ label }
|
|
210
212
|
describedBy={ getDescribedBy() }
|
|
@@ -213,6 +215,7 @@ export default function FontAppearanceControl( props ) {
|
|
|
213
215
|
onChange={ ( { selectedItem } ) =>
|
|
214
216
|
onChange( selectedItem.style )
|
|
215
217
|
}
|
|
218
|
+
__nextUnconstrainedWidth
|
|
216
219
|
/>
|
|
217
220
|
)
|
|
218
221
|
);
|
|
@@ -32,6 +32,13 @@ const MyImageSizeControl = () => {
|
|
|
32
32
|
|
|
33
33
|
The component accepts the following props:
|
|
34
34
|
|
|
35
|
+
### imageSizeHelp
|
|
36
|
+
|
|
37
|
+
If this property is added, a help text will be generated for the image size control, using imageSizeHelp property as the content.
|
|
38
|
+
|
|
39
|
+
- Type: `String|WPElement`
|
|
40
|
+
- Required: No
|
|
41
|
+
|
|
35
42
|
### slug
|
|
36
43
|
|
|
37
44
|
The currently-selected image size slug (`thumbnail`, `large`, etc). This is used by the parent component to get the specific image, which is used to populate `imageHeight` & `imageWidth`. This is not required, but necessary when `imageSizeOptions` is used.
|
|
@@ -23,6 +23,7 @@ const IMAGE_SIZE_PRESETS = [ 25, 50, 75, 100 ];
|
|
|
23
23
|
const noop = () => {};
|
|
24
24
|
|
|
25
25
|
export default function ImageSizeControl( {
|
|
26
|
+
imageSizeHelp,
|
|
26
27
|
imageWidth,
|
|
27
28
|
imageHeight,
|
|
28
29
|
imageSizeOptions = [],
|
|
@@ -44,6 +45,7 @@ export default function ImageSizeControl( {
|
|
|
44
45
|
value={ slug }
|
|
45
46
|
options={ imageSizeOptions }
|
|
46
47
|
onChange={ onChangeImage }
|
|
48
|
+
help={ imageSizeHelp }
|
|
47
49
|
/>
|
|
48
50
|
) }
|
|
49
51
|
{ isResizable && (
|
package/src/components/index.js
CHANGED
|
@@ -147,7 +147,10 @@ export { default as Warning } from './warning';
|
|
|
147
147
|
export { default as WritingFlow } from './writing-flow';
|
|
148
148
|
export { default as useBlockDisplayInformation } from './use-block-display-information';
|
|
149
149
|
export { default as __unstableIframe } from './iframe';
|
|
150
|
-
export {
|
|
150
|
+
export {
|
|
151
|
+
RecursionProvider as __experimentalRecursionProvider,
|
|
152
|
+
useHasRecursion as __experimentalUseHasRecursion,
|
|
153
|
+
} from './recursion-provider';
|
|
151
154
|
export { default as __experimentalBlockPatternsList } from './block-patterns-list';
|
|
152
155
|
export { default as __experimentalPublishDateTimePicker } from './publish-date-time-picker';
|
|
153
156
|
export { default as __experimentalInspectorPopoverHeader } from './inspector-popover-header';
|
|
@@ -59,7 +59,10 @@ export { default as Caption } from './caption';
|
|
|
59
59
|
export { default as PanelColorSettings } from './panel-color-settings';
|
|
60
60
|
export { default as __experimentalPanelColorGradientSettings } from './colors-gradients/panel-color-gradient-settings';
|
|
61
61
|
export { default as useSetting } from './use-setting';
|
|
62
|
-
export {
|
|
62
|
+
export {
|
|
63
|
+
RecursionProvider as __experimentalRecursionProvider,
|
|
64
|
+
useHasRecursion as __experimentalUseHasRecursion,
|
|
65
|
+
} from './recursion-provider';
|
|
63
66
|
export { default as Warning } from './warning';
|
|
64
67
|
export { default as ContrastChecker } from './contrast-checker';
|
|
65
68
|
export { default as useMultipleOriginColorsAndGradients } from './colors-gradients/use-multiple-origin-colors-and-gradients';
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { AccessibilityInfo, Platform, Text } from 'react-native';
|
|
5
|
-
import { delay } from 'lodash';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* WordPress dependencies
|
|
@@ -80,6 +79,8 @@ const defaultRenderToggle = ( {
|
|
|
80
79
|
};
|
|
81
80
|
|
|
82
81
|
export class Inserter extends Component {
|
|
82
|
+
announcementTimeout;
|
|
83
|
+
|
|
83
84
|
constructor() {
|
|
84
85
|
super( ...arguments );
|
|
85
86
|
|
|
@@ -88,6 +89,10 @@ export class Inserter extends Component {
|
|
|
88
89
|
this.renderContent = this.renderContent.bind( this );
|
|
89
90
|
}
|
|
90
91
|
|
|
92
|
+
componentWillUnmount() {
|
|
93
|
+
clearTimeout( this.announcementTimeout );
|
|
94
|
+
}
|
|
95
|
+
|
|
91
96
|
getInsertionOptions() {
|
|
92
97
|
const addBeforeOption = {
|
|
93
98
|
value: 'before',
|
|
@@ -217,7 +222,7 @@ export class Inserter extends Component {
|
|
|
217
222
|
const announcement = isOpen
|
|
218
223
|
? __( 'Scrollable block menu opened. Select a block.' )
|
|
219
224
|
: __( 'Scrollable block menu closed.' );
|
|
220
|
-
|
|
225
|
+
this.announcementTimeout = setTimeout(
|
|
221
226
|
() =>
|
|
222
227
|
AccessibilityInfo.announceForAccessibility(
|
|
223
228
|
announcement
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
createBlocksFromInnerBlocksTemplate,
|
|
13
13
|
} from '@wordpress/blocks';
|
|
14
14
|
import { __experimentalTruncate as Truncate } from '@wordpress/components';
|
|
15
|
-
import { ENTER } from '@wordpress/keycodes';
|
|
15
|
+
import { ENTER, isAppleOS } from '@wordpress/keycodes';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Internal dependencies
|
|
@@ -21,22 +21,6 @@ import BlockIcon from '../block-icon';
|
|
|
21
21
|
import { InserterListboxItem } from '../inserter-listbox';
|
|
22
22
|
import InserterDraggableBlocks from '../inserter-draggable-blocks';
|
|
23
23
|
|
|
24
|
-
/**
|
|
25
|
-
* Return true if platform is MacOS.
|
|
26
|
-
*
|
|
27
|
-
* @param {Object} _window window object by default; used for DI testing.
|
|
28
|
-
*
|
|
29
|
-
* @return {boolean} True if MacOS; false otherwise.
|
|
30
|
-
*/
|
|
31
|
-
function isAppleOS( _window = window ) {
|
|
32
|
-
const { platform } = _window.navigator;
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
platform.indexOf( 'Mac' ) !== -1 ||
|
|
36
|
-
[ 'iPad', 'iPhone' ].includes( platform )
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
24
|
function InserterListItem( {
|
|
41
25
|
className,
|
|
42
26
|
isFirst,
|
|
@@ -26,6 +26,7 @@ export default function LetterSpacingControl( {
|
|
|
26
26
|
value,
|
|
27
27
|
onChange,
|
|
28
28
|
__unstableInputWidth = '60px',
|
|
29
|
+
...otherProps
|
|
29
30
|
} ) {
|
|
30
31
|
const units = useCustomUnits( {
|
|
31
32
|
availableUnits: useSetting( 'spacing.units' ) || [ 'px', 'em', 'rem' ],
|
|
@@ -33,6 +34,7 @@ export default function LetterSpacingControl( {
|
|
|
33
34
|
} );
|
|
34
35
|
return (
|
|
35
36
|
<UnitControl
|
|
37
|
+
{ ...otherProps }
|
|
36
38
|
label={ __( 'Letter spacing' ) }
|
|
37
39
|
value={ value }
|
|
38
40
|
__unstableInputWidth={ __unstableInputWidth }
|
|
@@ -21,6 +21,7 @@ const LineHeightControl = ( {
|
|
|
21
21
|
/** Start opting into the new margin-free styles that will become the default in a future version. */
|
|
22
22
|
__nextHasNoMarginBottom = false,
|
|
23
23
|
__unstableInputWidth = '60px',
|
|
24
|
+
...otherProps
|
|
24
25
|
} ) => {
|
|
25
26
|
const isDefined = isLineHeightDefined( lineHeight );
|
|
26
27
|
|
|
@@ -89,6 +90,7 @@ const LineHeightControl = ( {
|
|
|
89
90
|
style={ deprecatedStyles }
|
|
90
91
|
>
|
|
91
92
|
<NumberControl
|
|
93
|
+
{ ...otherProps }
|
|
92
94
|
__unstableInputWidth={ __unstableInputWidth }
|
|
93
95
|
__unstableStateReducer={ stateReducer }
|
|
94
96
|
onChange={ onChange }
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { startsWith } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -20,6 +15,6 @@ import { isURL } from '@wordpress/url';
|
|
|
20
15
|
* @return {boolean} whether or not the value is potentially a URL.
|
|
21
16
|
*/
|
|
22
17
|
export default function isURLLike( val ) {
|
|
23
|
-
const isInternal = startsWith(
|
|
18
|
+
const isInternal = val?.startsWith( '#' );
|
|
24
19
|
return isURL( val ) || ( val && val.includes( 'www.' ) ) || isInternal;
|
|
25
20
|
}
|
|
@@ -5,11 +5,6 @@ import { getProtocol, prependHTTP } from '@wordpress/url';
|
|
|
5
5
|
import { useCallback } from '@wordpress/element';
|
|
6
6
|
import { useSelect } from '@wordpress/data';
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* External dependencies
|
|
10
|
-
*/
|
|
11
|
-
import { startsWith } from 'lodash';
|
|
12
|
-
|
|
13
8
|
/**
|
|
14
9
|
* Internal dependencies
|
|
15
10
|
*/
|
|
@@ -38,7 +33,7 @@ export const handleDirectEntry = ( val ) => {
|
|
|
38
33
|
type = TEL_TYPE;
|
|
39
34
|
}
|
|
40
35
|
|
|
41
|
-
if ( startsWith(
|
|
36
|
+
if ( val?.startsWith( '#' ) ) {
|
|
42
37
|
type = INTERNAL_TYPE;
|
|
43
38
|
}
|
|
44
39
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { chevronRightSmall, Icon } from '@wordpress/icons';
|
|
4
|
+
import { chevronRightSmall, chevronLeftSmall, Icon } from '@wordpress/icons';
|
|
5
|
+
import { isRTL } from '@wordpress/i18n';
|
|
6
|
+
|
|
5
7
|
export default function ListViewExpander( { onClick } ) {
|
|
6
8
|
return (
|
|
7
9
|
// Keyboard events are handled by TreeGrid see: components/src/tree-grid/index.js
|
|
@@ -18,7 +20,7 @@ export default function ListViewExpander( { onClick } ) {
|
|
|
18
20
|
onClick={ ( event ) => onClick( event, { forceToggle: true } ) }
|
|
19
21
|
aria-hidden="true"
|
|
20
22
|
>
|
|
21
|
-
<Icon icon={ chevronRightSmall } />
|
|
23
|
+
<Icon icon={ isRTL() ? chevronLeftSmall : chevronRightSmall } />
|
|
22
24
|
</span>
|
|
23
25
|
);
|
|
24
26
|
}
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Platform } from 'react-native';
|
|
5
5
|
|
|
6
|
-
import { delay } from 'lodash';
|
|
7
|
-
|
|
8
6
|
import prompt from 'react-native-prompt-android';
|
|
9
7
|
|
|
10
8
|
/**
|
|
@@ -46,6 +44,8 @@ const URL_MEDIA_SOURCE = 'URL';
|
|
|
46
44
|
const PICKER_OPENING_DELAY = 200;
|
|
47
45
|
|
|
48
46
|
export class MediaUpload extends Component {
|
|
47
|
+
pickerTimeout;
|
|
48
|
+
|
|
49
49
|
constructor( props ) {
|
|
50
50
|
super( props );
|
|
51
51
|
this.onPickerPresent = this.onPickerPresent.bind( this );
|
|
@@ -78,6 +78,10 @@ export class MediaUpload extends Component {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
componentWillUnmount() {
|
|
82
|
+
clearTimeout( this.pickerTimeout );
|
|
83
|
+
}
|
|
84
|
+
|
|
81
85
|
getAllSources() {
|
|
82
86
|
const { onSelectURL } = this.props;
|
|
83
87
|
|
|
@@ -189,7 +193,7 @@ export class MediaUpload extends Component {
|
|
|
189
193
|
// the delay below is required because on iOS this action sheet gets dismissed by the close event of the Inserter
|
|
190
194
|
// so this delay allows the Inserter to be closed fully before presenting action sheet.
|
|
191
195
|
if ( autoOpen && isIOS ) {
|
|
192
|
-
|
|
196
|
+
this.pickerTimeout = setTimeout(
|
|
193
197
|
() => this.picker.presentPicker(),
|
|
194
198
|
PICKER_OPENING_DELAY
|
|
195
199
|
);
|