@wordpress/block-library 9.42.0 → 9.43.1-next.v.202604091042.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/code/edit.cjs +2 -1
- package/build/code/edit.cjs.map +2 -2
- package/build/cover/edit/color-utils.cjs +1 -1
- package/build/cover/edit/color-utils.cjs.map +2 -2
- package/build/cover/edit/index.cjs +31 -25
- package/build/cover/edit/index.cjs.map +2 -2
- package/build/cover/embed-video-utils.cjs +9 -7
- package/build/cover/embed-video-utils.cjs.map +2 -2
- package/build/file/utils/index.cjs +1 -1
- package/build/file/utils/index.cjs.map +2 -2
- package/build/form/view.cjs +1 -1
- package/build/form/view.cjs.map +2 -2
- package/build/form-input/edit.cjs +36 -29
- package/build/form-input/edit.cjs.map +2 -2
- package/build/form-input/variations.cjs +10 -0
- package/build/form-input/variations.cjs.map +2 -2
- package/build/group/block.json +3 -1
- package/build/icon/edit.cjs +1 -3
- package/build/icon/edit.cjs.map +2 -2
- package/build/image/image.cjs +17 -7
- package/build/image/image.cjs.map +2 -2
- package/build/latest-comments/deprecated.cjs +33 -0
- package/build/latest-comments/deprecated.cjs.map +2 -2
- package/build/list-item/block.json +1 -0
- package/build/navigation/edit/index.cjs +123 -119
- package/build/navigation/edit/index.cjs.map +3 -3
- package/build/navigation/edit/navigation-menu-selector.cjs +2 -1
- package/build/navigation/edit/navigation-menu-selector.cjs.map +2 -2
- package/build/navigation-link/link-ui/page-creator.cjs +1 -1
- package/build/navigation-link/link-ui/page-creator.cjs.map +2 -2
- package/build/navigation-link/shared/update-attributes.cjs +1 -1
- package/build/navigation-link/shared/update-attributes.cjs.map +2 -2
- package/build/navigation-link/shared/use-link-preview.cjs +1 -1
- package/build/navigation-link/shared/use-link-preview.cjs.map +2 -2
- package/build/pattern/edit.cjs +1 -1
- package/build/pattern/edit.cjs.map +2 -2
- package/build/search/block.json +0 -4
- package/build/search/edit.cjs +6 -33
- package/build/search/edit.cjs.map +2 -2
- package/build/site-logo/edit.cjs +19 -13
- package/build/site-logo/edit.cjs.map +3 -3
- package/build/site-tagline/deprecated.cjs +2 -1
- package/build/site-tagline/deprecated.cjs.map +2 -2
- package/build/tab/save.cjs +2 -4
- package/build/tab/save.cjs.map +2 -2
- package/build/tabs/save.cjs +2 -4
- package/build/tabs/save.cjs.map +2 -2
- package/build/utils/media-control.cjs +1 -1
- package/build/utils/media-control.cjs.map +2 -2
- package/build-module/code/edit.mjs +2 -1
- package/build-module/code/edit.mjs.map +2 -2
- package/build-module/cover/edit/color-utils.mjs +1 -1
- package/build-module/cover/edit/color-utils.mjs.map +2 -2
- package/build-module/cover/edit/index.mjs +39 -28
- package/build-module/cover/edit/index.mjs.map +2 -2
- package/build-module/cover/embed-video-utils.mjs +8 -6
- package/build-module/cover/embed-video-utils.mjs.map +2 -2
- package/build-module/file/utils/index.mjs +1 -1
- package/build-module/file/utils/index.mjs.map +2 -2
- package/build-module/form/view.mjs +1 -1
- package/build-module/form/view.mjs.map +2 -2
- package/build-module/form-input/edit.mjs +36 -29
- package/build-module/form-input/edit.mjs.map +2 -2
- package/build-module/form-input/variations.mjs +10 -0
- package/build-module/form-input/variations.mjs.map +2 -2
- package/build-module/group/block.json +3 -1
- package/build-module/icon/edit.mjs +1 -3
- package/build-module/icon/edit.mjs.map +2 -2
- package/build-module/image/image.mjs +17 -7
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/latest-comments/deprecated.mjs +33 -0
- package/build-module/latest-comments/deprecated.mjs.map +2 -2
- package/build-module/list-item/block.json +1 -0
- package/build-module/navigation/edit/index.mjs +123 -119
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/navigation-menu-selector.mjs +2 -1
- package/build-module/navigation/edit/navigation-menu-selector.mjs.map +2 -2
- package/build-module/navigation-link/link-ui/page-creator.mjs +1 -1
- package/build-module/navigation-link/link-ui/page-creator.mjs.map +2 -2
- package/build-module/navigation-link/shared/update-attributes.mjs +1 -1
- package/build-module/navigation-link/shared/update-attributes.mjs.map +2 -2
- package/build-module/navigation-link/shared/use-link-preview.mjs +1 -1
- package/build-module/navigation-link/shared/use-link-preview.mjs.map +2 -2
- package/build-module/pattern/edit.mjs +1 -1
- package/build-module/pattern/edit.mjs.map +2 -2
- package/build-module/search/block.json +0 -4
- package/build-module/search/edit.mjs +6 -33
- package/build-module/search/edit.mjs.map +2 -2
- package/build-module/site-logo/edit.mjs +21 -14
- package/build-module/site-logo/edit.mjs.map +2 -2
- package/build-module/site-tagline/deprecated.mjs +2 -1
- package/build-module/site-tagline/deprecated.mjs.map +2 -2
- package/build-module/tab/save.mjs +2 -4
- package/build-module/tab/save.mjs.map +2 -2
- package/build-module/tabs/save.mjs +2 -4
- package/build-module/tabs/save.mjs.map +2 -2
- package/build-module/utils/media-control.mjs +1 -1
- package/build-module/utils/media-control.mjs.map +2 -2
- package/build-style/code/style-rtl.css +1 -1
- package/build-style/code/style.css +1 -1
- package/build-style/editor-rtl.css +15 -5
- package/build-style/editor.css +15 -5
- package/build-style/form-input/editor-rtl.css +6 -5
- package/build-style/form-input/editor.css +6 -5
- package/build-style/icon/editor-rtl.css +5 -0
- package/build-style/icon/editor.css +5 -0
- package/build-style/image/editor-rtl.css +4 -0
- package/build-style/image/editor.css +4 -0
- package/build-style/navigation/style-rtl.css +4 -1
- package/build-style/navigation/style.css +4 -1
- package/build-style/style-rtl.css +5 -2
- package/build-style/style.css +5 -2
- package/package.json +38 -38
- package/src/code/edit.js +1 -0
- package/src/code/style.scss +1 -1
- package/src/cover/edit/color-utils.js +1 -1
- package/src/cover/edit/index.js +63 -34
- package/src/cover/embed-video-utils.js +10 -8
- package/src/embed/test/index.native.js +3 -2
- package/src/file/utils/index.js +1 -1
- package/src/form/view.js +1 -1
- package/src/form-input/edit.js +19 -15
- package/src/form-input/editor.scss +6 -6
- package/src/form-input/variations.js +10 -0
- package/src/group/block.json +3 -1
- package/src/home-link/index.php +14 -33
- package/src/icon/edit.js +1 -3
- package/src/icon/editor.scss +5 -0
- package/src/image/editor.scss +5 -0
- package/src/image/image.js +24 -7
- package/src/image/index.php +4 -4
- package/src/latest-comments/deprecated.js +33 -0
- package/src/list-item/block.json +1 -0
- package/src/loginout/index.php +13 -0
- package/src/navigation/edit/index.js +134 -130
- package/src/navigation/edit/navigation-menu-selector.js +2 -1
- package/src/navigation/style.scss +5 -3
- package/src/navigation-link/index.php +10 -38
- package/src/navigation-link/link-ui/page-creator.js +1 -1
- package/src/navigation-link/shared/build-css-font-sizes.php +43 -0
- package/src/navigation-link/shared/update-attributes.js +1 -1
- package/src/navigation-link/shared/use-link-preview.js +1 -1
- package/src/navigation-submenu/index.php +10 -38
- package/src/page-list/index.php +14 -41
- package/src/pattern/edit.js +1 -1
- package/src/search/block.json +0 -4
- package/src/search/edit.js +2 -35
- package/src/site-logo/edit.js +24 -13
- package/src/site-tagline/deprecated.js +1 -0
- package/src/tab/save.js +2 -6
- package/src/tabs/save.js +2 -6
- package/src/utils/media-control.js +3 -1
|
@@ -99,7 +99,6 @@
|
|
|
99
99
|
.wp-block-navigation ul,
|
|
100
100
|
.wp-block-navigation ul li {
|
|
101
101
|
list-style: none;
|
|
102
|
-
padding: 0;
|
|
103
102
|
}
|
|
104
103
|
.wp-block-navigation .wp-block-navigation-item {
|
|
105
104
|
background-color: inherit;
|
|
@@ -186,6 +185,10 @@
|
|
|
186
185
|
--navigation-layout-justify: space-between;
|
|
187
186
|
}
|
|
188
187
|
|
|
188
|
+
:where(.wp-block-navigation) ul li {
|
|
189
|
+
padding: 0;
|
|
190
|
+
}
|
|
191
|
+
|
|
189
192
|
.wp-block-navigation .has-child .wp-block-navigation__submenu-container {
|
|
190
193
|
background-color: inherit;
|
|
191
194
|
color: inherit;
|
|
@@ -427,7 +427,7 @@
|
|
|
427
427
|
display: block;
|
|
428
428
|
font-family: inherit;
|
|
429
429
|
overflow-wrap: break-word;
|
|
430
|
-
white-space:
|
|
430
|
+
white-space: break-spaces;
|
|
431
431
|
direction: ltr;
|
|
432
432
|
text-align: initial;
|
|
433
433
|
}
|
|
@@ -2466,7 +2466,6 @@ ul {
|
|
|
2466
2466
|
.wp-block-navigation ul,
|
|
2467
2467
|
.wp-block-navigation ul li {
|
|
2468
2468
|
list-style: none;
|
|
2469
|
-
padding: 0;
|
|
2470
2469
|
}
|
|
2471
2470
|
.wp-block-navigation .wp-block-navigation-item {
|
|
2472
2471
|
background-color: inherit;
|
|
@@ -2553,6 +2552,10 @@ ul {
|
|
|
2553
2552
|
--navigation-layout-justify: space-between;
|
|
2554
2553
|
}
|
|
2555
2554
|
|
|
2555
|
+
:where(.wp-block-navigation) ul li {
|
|
2556
|
+
padding: 0;
|
|
2557
|
+
}
|
|
2558
|
+
|
|
2556
2559
|
.wp-block-navigation .has-child .wp-block-navigation__submenu-container {
|
|
2557
2560
|
background-color: inherit;
|
|
2558
2561
|
color: inherit;
|
package/build-style/style.css
CHANGED
|
@@ -430,7 +430,7 @@
|
|
|
430
430
|
display: block;
|
|
431
431
|
font-family: inherit;
|
|
432
432
|
overflow-wrap: break-word;
|
|
433
|
-
white-space:
|
|
433
|
+
white-space: break-spaces;
|
|
434
434
|
/*!rtl:begin:ignore*/
|
|
435
435
|
direction: ltr;
|
|
436
436
|
text-align: initial;
|
|
@@ -2496,7 +2496,6 @@ ul {
|
|
|
2496
2496
|
.wp-block-navigation ul,
|
|
2497
2497
|
.wp-block-navigation ul li {
|
|
2498
2498
|
list-style: none;
|
|
2499
|
-
padding: 0;
|
|
2500
2499
|
}
|
|
2501
2500
|
.wp-block-navigation .wp-block-navigation-item {
|
|
2502
2501
|
background-color: inherit;
|
|
@@ -2583,6 +2582,10 @@ ul {
|
|
|
2583
2582
|
--navigation-layout-justify: space-between;
|
|
2584
2583
|
}
|
|
2585
2584
|
|
|
2585
|
+
:where(.wp-block-navigation) ul li {
|
|
2586
|
+
padding: 0;
|
|
2587
|
+
}
|
|
2588
|
+
|
|
2586
2589
|
.wp-block-navigation .has-child .wp-block-navigation__submenu-container {
|
|
2587
2590
|
background-color: inherit;
|
|
2588
2591
|
color: inherit;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.43.1-next.v.202604091042.0+668146787",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -95,42 +95,42 @@
|
|
|
95
95
|
],
|
|
96
96
|
"dependencies": {
|
|
97
97
|
"@arraypress/waveform-player": "1.2.1",
|
|
98
|
-
"@wordpress/a11y": "^4.
|
|
99
|
-
"@wordpress/api-fetch": "^7.
|
|
100
|
-
"@wordpress/autop": "^4.
|
|
101
|
-
"@wordpress/base-styles": "^6.
|
|
102
|
-
"@wordpress/blob": "^4.
|
|
103
|
-
"@wordpress/block-editor": "^15.
|
|
104
|
-
"@wordpress/blocks": "^15.
|
|
105
|
-
"@wordpress/components": "^32.
|
|
106
|
-
"@wordpress/compose": "^7.
|
|
107
|
-
"@wordpress/core-data": "^7.
|
|
108
|
-
"@wordpress/data": "^10.
|
|
109
|
-
"@wordpress/date": "^5.
|
|
110
|
-
"@wordpress/deprecated": "^4.
|
|
111
|
-
"@wordpress/dom": "^4.
|
|
112
|
-
"@wordpress/element": "^6.
|
|
113
|
-
"@wordpress/escape-html": "^3.
|
|
114
|
-
"@wordpress/hooks": "^4.
|
|
115
|
-
"@wordpress/html-entities": "^4.
|
|
116
|
-
"@wordpress/i18n": "^6.
|
|
117
|
-
"@wordpress/icons": "^12.
|
|
118
|
-
"@wordpress/interactivity": "^6.
|
|
119
|
-
"@wordpress/interactivity-router": "^2.
|
|
120
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
121
|
-
"@wordpress/keycodes": "^4.
|
|
122
|
-
"@wordpress/latex-to-mathml": "^1.
|
|
123
|
-
"@wordpress/notices": "^5.
|
|
124
|
-
"@wordpress/patterns": "^2.
|
|
125
|
-
"@wordpress/primitives": "^4.
|
|
126
|
-
"@wordpress/private-apis": "^1.
|
|
127
|
-
"@wordpress/reusable-blocks": "^5.
|
|
128
|
-
"@wordpress/rich-text": "^7.
|
|
129
|
-
"@wordpress/server-side-render": "^6.
|
|
130
|
-
"@wordpress/upload-media": "^0.
|
|
131
|
-
"@wordpress/url": "^4.
|
|
132
|
-
"@wordpress/viewport": "^6.
|
|
133
|
-
"@wordpress/wordcount": "^4.
|
|
98
|
+
"@wordpress/a11y": "^4.43.1-next.v.202604091042.0+668146787",
|
|
99
|
+
"@wordpress/api-fetch": "^7.43.1-next.v.202604091042.0+668146787",
|
|
100
|
+
"@wordpress/autop": "^4.43.1-next.v.202604091042.0+668146787",
|
|
101
|
+
"@wordpress/base-styles": "^6.19.1-next.v.202604091042.0+668146787",
|
|
102
|
+
"@wordpress/blob": "^4.43.1-next.v.202604091042.0+668146787",
|
|
103
|
+
"@wordpress/block-editor": "^15.16.1-next.v.202604091042.0+668146787",
|
|
104
|
+
"@wordpress/blocks": "^15.16.1-next.v.202604091042.0+668146787",
|
|
105
|
+
"@wordpress/components": "^32.5.2-next.v.202604091042.0+668146787",
|
|
106
|
+
"@wordpress/compose": "^7.43.1-next.v.202604091042.0+668146787",
|
|
107
|
+
"@wordpress/core-data": "^7.43.2-next.v.202604091042.0+668146787",
|
|
108
|
+
"@wordpress/data": "^10.43.1-next.v.202604091042.0+668146787",
|
|
109
|
+
"@wordpress/date": "^5.43.1-next.v.202604091042.0+668146787",
|
|
110
|
+
"@wordpress/deprecated": "^4.43.1-next.v.202604091042.0+668146787",
|
|
111
|
+
"@wordpress/dom": "^4.43.1-next.v.202604091042.0+668146787",
|
|
112
|
+
"@wordpress/element": "^6.44.1-next.v.202604091042.0+668146787",
|
|
113
|
+
"@wordpress/escape-html": "^3.43.1-next.v.202604091042.0+668146787",
|
|
114
|
+
"@wordpress/hooks": "^4.43.1-next.v.202604091042.0+668146787",
|
|
115
|
+
"@wordpress/html-entities": "^4.43.1-next.v.202604091042.0+668146787",
|
|
116
|
+
"@wordpress/i18n": "^6.17.1-next.v.202604091042.0+668146787",
|
|
117
|
+
"@wordpress/icons": "^12.1.1-next.v.202604091042.0+668146787",
|
|
118
|
+
"@wordpress/interactivity": "^6.43.1-next.v.202604091042.0+668146787",
|
|
119
|
+
"@wordpress/interactivity-router": "^2.43.1-next.v.202604091042.0+668146787",
|
|
120
|
+
"@wordpress/keyboard-shortcuts": "^5.43.1-next.v.202604091042.0+668146787",
|
|
121
|
+
"@wordpress/keycodes": "^4.43.1-next.v.202604091042.0+668146787",
|
|
122
|
+
"@wordpress/latex-to-mathml": "^1.11.1-next.v.202604091042.0+668146787",
|
|
123
|
+
"@wordpress/notices": "^5.43.1-next.v.202604091042.0+668146787",
|
|
124
|
+
"@wordpress/patterns": "^2.43.1-next.v.202604091042.0+668146787",
|
|
125
|
+
"@wordpress/primitives": "^4.43.1-next.v.202604091042.0+668146787",
|
|
126
|
+
"@wordpress/private-apis": "^1.43.1-next.v.202604091042.0+668146787",
|
|
127
|
+
"@wordpress/reusable-blocks": "^5.43.1-next.v.202604091042.0+668146787",
|
|
128
|
+
"@wordpress/rich-text": "^7.43.1-next.v.202604091042.0+668146787",
|
|
129
|
+
"@wordpress/server-side-render": "^6.19.1-next.v.202604091042.0+668146787",
|
|
130
|
+
"@wordpress/upload-media": "^0.28.1-next.v.202604091042.0+668146787",
|
|
131
|
+
"@wordpress/url": "^4.43.1-next.v.202604091042.0+668146787",
|
|
132
|
+
"@wordpress/viewport": "^6.43.1-next.v.202604091042.0+668146787",
|
|
133
|
+
"@wordpress/wordcount": "^4.43.1-next.v.202604091042.0+668146787",
|
|
134
134
|
"change-case": "^4.1.2",
|
|
135
135
|
"clsx": "^2.1.1",
|
|
136
136
|
"colord": "^2.7.0",
|
|
@@ -151,5 +151,5 @@
|
|
|
151
151
|
"publishConfig": {
|
|
152
152
|
"access": "public"
|
|
153
153
|
},
|
|
154
|
-
"gitHead": "
|
|
154
|
+
"gitHead": "73606df74f1c38a084bfa5db97205259ef817593"
|
|
155
155
|
}
|
package/src/code/edit.js
CHANGED
package/src/code/style.scss
CHANGED
package/src/cover/edit/index.js
CHANGED
|
@@ -7,8 +7,13 @@ import clsx from 'clsx';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { useEntityProp, store as coreStore } from '@wordpress/core-data';
|
|
10
|
-
import {
|
|
11
|
-
|
|
10
|
+
import {
|
|
11
|
+
useEffect,
|
|
12
|
+
useLayoutEffect,
|
|
13
|
+
useMemo,
|
|
14
|
+
useRef,
|
|
15
|
+
} from '@wordpress/element';
|
|
16
|
+
import { Placeholder, SandBox, Spinner } from '@wordpress/components';
|
|
12
17
|
import { compose, useResizeObserver } from '@wordpress/compose';
|
|
13
18
|
import {
|
|
14
19
|
withColors,
|
|
@@ -49,7 +54,7 @@ import {
|
|
|
49
54
|
DEFAULT_OVERLAY_COLOR,
|
|
50
55
|
} from './color-utils';
|
|
51
56
|
import { DEFAULT_MEDIA_SIZE_SLUG } from '../constants';
|
|
52
|
-
import {
|
|
57
|
+
import { getBackgroundEmbedHtml } from '../embed-video-utils';
|
|
53
58
|
|
|
54
59
|
function getInnerBlocksTemplate( attributes ) {
|
|
55
60
|
return [
|
|
@@ -121,6 +126,14 @@ function CoverEdit( {
|
|
|
121
126
|
|
|
122
127
|
const { __unstableMarkNextChangeAsNotPersistent } =
|
|
123
128
|
useDispatch( blockEditorStore );
|
|
129
|
+
|
|
130
|
+
// Ref to access latest values after async operations (e.g. getMediaColor),
|
|
131
|
+
// avoiding stale values that could overwrite concurrent remote changes.
|
|
132
|
+
const propsRef = useRef( { attributes, overlayColor } );
|
|
133
|
+
useLayoutEffect( () => {
|
|
134
|
+
propsRef.current = { attributes, overlayColor };
|
|
135
|
+
} );
|
|
136
|
+
|
|
124
137
|
const { media } = useSelect(
|
|
125
138
|
( select ) => {
|
|
126
139
|
return {
|
|
@@ -155,22 +168,26 @@ function CoverEdit( {
|
|
|
155
168
|
|
|
156
169
|
const averageBackgroundColor = await getMediaColor( mediaUrl );
|
|
157
170
|
|
|
158
|
-
|
|
159
|
-
|
|
171
|
+
// Read latest values after await to avoid stale closures.
|
|
172
|
+
const { attributes: currentAttrs, overlayColor: currentOverlay } =
|
|
173
|
+
propsRef.current;
|
|
174
|
+
|
|
175
|
+
let newOverlayColor = currentOverlay.color;
|
|
176
|
+
if ( ! currentAttrs.isUserOverlayColor ) {
|
|
160
177
|
newOverlayColor = averageBackgroundColor;
|
|
161
178
|
__unstableMarkNextChangeAsNotPersistent();
|
|
162
179
|
setOverlayColor( newOverlayColor );
|
|
163
180
|
}
|
|
164
181
|
|
|
165
182
|
const newIsDark = compositeIsDark(
|
|
166
|
-
dimRatio,
|
|
183
|
+
currentAttrs.dimRatio,
|
|
167
184
|
newOverlayColor,
|
|
168
185
|
averageBackgroundColor
|
|
169
186
|
);
|
|
170
187
|
__unstableMarkNextChangeAsNotPersistent();
|
|
171
188
|
setAttributes( {
|
|
172
189
|
isDark: newIsDark,
|
|
173
|
-
isUserOverlayColor: isUserOverlayColor || false,
|
|
190
|
+
isUserOverlayColor: currentAttrs.isUserOverlayColor || false,
|
|
174
191
|
} );
|
|
175
192
|
} )();
|
|
176
193
|
// Update the block only when the featured image changes.
|
|
@@ -201,8 +218,12 @@ function CoverEdit( {
|
|
|
201
218
|
isImage ? newMedia?.url : undefined
|
|
202
219
|
);
|
|
203
220
|
|
|
204
|
-
|
|
205
|
-
|
|
221
|
+
// Read latest values to avoid stale closures.
|
|
222
|
+
const { attributes: currentAttrs, overlayColor: currentOverlay } =
|
|
223
|
+
propsRef.current;
|
|
224
|
+
|
|
225
|
+
let newOverlayColor = currentOverlay.color;
|
|
226
|
+
if ( ! currentAttrs.isUserOverlayColor ) {
|
|
206
227
|
newOverlayColor = averageBackgroundColor;
|
|
207
228
|
setOverlayColor( newOverlayColor );
|
|
208
229
|
|
|
@@ -214,7 +235,9 @@ function CoverEdit( {
|
|
|
214
235
|
// to avoid resetting to 50 if it has been explicitly set to 100.
|
|
215
236
|
// See issue #52835 for context.
|
|
216
237
|
const newDimRatio =
|
|
217
|
-
|
|
238
|
+
currentAttrs.url === undefined && currentAttrs.dimRatio === 100
|
|
239
|
+
? 50
|
|
240
|
+
: currentAttrs.dimRatio;
|
|
218
241
|
|
|
219
242
|
const newIsDark = compositeIsDark(
|
|
220
243
|
newDimRatio,
|
|
@@ -256,7 +279,7 @@ function CoverEdit( {
|
|
|
256
279
|
useFeaturedImage: undefined,
|
|
257
280
|
dimRatio: newDimRatio,
|
|
258
281
|
isDark: newIsDark,
|
|
259
|
-
isUserOverlayColor: isUserOverlayColor || false,
|
|
282
|
+
isUserOverlayColor: currentAttrs.isUserOverlayColor || false,
|
|
260
283
|
} );
|
|
261
284
|
};
|
|
262
285
|
|
|
@@ -290,8 +313,12 @@ function CoverEdit( {
|
|
|
290
313
|
|
|
291
314
|
const onSetOverlayColor = async ( newOverlayColor ) => {
|
|
292
315
|
const averageBackgroundColor = await getMediaColor( url );
|
|
316
|
+
|
|
317
|
+
// Read latest dimRatio after await to avoid stale closure.
|
|
318
|
+
const { attributes: currentAttrs } = propsRef.current;
|
|
319
|
+
|
|
293
320
|
const newIsDark = compositeIsDark(
|
|
294
|
-
dimRatio,
|
|
321
|
+
currentAttrs.dimRatio,
|
|
295
322
|
newOverlayColor,
|
|
296
323
|
averageBackgroundColor
|
|
297
324
|
);
|
|
@@ -309,9 +336,13 @@ function CoverEdit( {
|
|
|
309
336
|
|
|
310
337
|
const onUpdateDimRatio = async ( newDimRatio ) => {
|
|
311
338
|
const averageBackgroundColor = await getMediaColor( url );
|
|
339
|
+
|
|
340
|
+
// Read latest overlayColor after await to avoid stale closure.
|
|
341
|
+
const { overlayColor: currentOverlay } = propsRef.current;
|
|
342
|
+
|
|
312
343
|
const newIsDark = compositeIsDark(
|
|
313
344
|
newDimRatio,
|
|
314
|
-
|
|
345
|
+
currentOverlay.color,
|
|
315
346
|
averageBackgroundColor
|
|
316
347
|
);
|
|
317
348
|
|
|
@@ -365,23 +396,15 @@ function CoverEdit( {
|
|
|
365
396
|
[ url, backgroundType ]
|
|
366
397
|
);
|
|
367
398
|
|
|
368
|
-
// Compute
|
|
369
|
-
const
|
|
399
|
+
// Compute embed HTML for editor display via SandBox
|
|
400
|
+
const embedHtml = useMemo( () => {
|
|
370
401
|
if (
|
|
371
402
|
backgroundType !== EMBED_VIDEO_BACKGROUND_TYPE ||
|
|
372
403
|
! embedPreview?.html
|
|
373
404
|
) {
|
|
374
405
|
return null;
|
|
375
406
|
}
|
|
376
|
-
|
|
377
|
-
// Extract iframe src from embed HTML
|
|
378
|
-
const iframeSrc = getIframeSrc( embedPreview.html );
|
|
379
|
-
if ( ! iframeSrc ) {
|
|
380
|
-
return null;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
// Modify the src to add background video parameters (provider auto-detected)
|
|
384
|
-
return getBackgroundVideoSrc( iframeSrc );
|
|
407
|
+
return getBackgroundEmbedHtml( embedPreview.html );
|
|
385
408
|
}, [ embedPreview, backgroundType ] );
|
|
386
409
|
|
|
387
410
|
const isUploadingMedia = isTemporaryMedia( id, url );
|
|
@@ -477,11 +500,15 @@ function CoverEdit( {
|
|
|
477
500
|
? await getMediaColor( mediaUrl )
|
|
478
501
|
: DEFAULT_BACKGROUND_COLOR;
|
|
479
502
|
|
|
480
|
-
|
|
503
|
+
// Read latest values after await to avoid stale closures.
|
|
504
|
+
const { attributes: currentAttrs, overlayColor: currentOverlay } =
|
|
505
|
+
propsRef.current;
|
|
506
|
+
|
|
507
|
+
const newOverlayColor = ! currentAttrs.isUserOverlayColor
|
|
481
508
|
? averageBackgroundColor
|
|
482
|
-
:
|
|
509
|
+
: currentOverlay.color;
|
|
483
510
|
|
|
484
|
-
if ( ! isUserOverlayColor ) {
|
|
511
|
+
if ( ! currentAttrs.isUserOverlayColor ) {
|
|
485
512
|
if ( newUseFeaturedImage ) {
|
|
486
513
|
setOverlayColor( newOverlayColor );
|
|
487
514
|
} else {
|
|
@@ -492,7 +519,8 @@ function CoverEdit( {
|
|
|
492
519
|
__unstableMarkNextChangeAsNotPersistent();
|
|
493
520
|
}
|
|
494
521
|
|
|
495
|
-
const newDimRatio =
|
|
522
|
+
const newDimRatio =
|
|
523
|
+
currentAttrs.dimRatio === 100 ? 50 : currentAttrs.dimRatio;
|
|
496
524
|
const newIsDark = compositeIsDark(
|
|
497
525
|
newDimRatio,
|
|
498
526
|
newOverlayColor,
|
|
@@ -668,21 +696,22 @@ function CoverEdit( {
|
|
|
668
696
|
style={ mediaStyle }
|
|
669
697
|
/>
|
|
670
698
|
) }
|
|
671
|
-
{ isEmbedVideoBackground &&
|
|
699
|
+
{ isEmbedVideoBackground && embedHtml && (
|
|
672
700
|
<div
|
|
673
701
|
ref={ mediaElement }
|
|
674
702
|
className="wp-block-cover__video-background wp-block-cover__embed-background"
|
|
675
703
|
style={ mediaStyle }
|
|
676
704
|
>
|
|
677
|
-
<
|
|
678
|
-
|
|
705
|
+
<SandBox
|
|
706
|
+
html={ embedHtml }
|
|
679
707
|
title="Background video"
|
|
680
|
-
|
|
681
|
-
|
|
708
|
+
styles={ [
|
|
709
|
+
'iframe{position:fixed;top:0;left:0;width:100%;height:100%;}',
|
|
710
|
+
] }
|
|
682
711
|
/>
|
|
683
712
|
</div>
|
|
684
713
|
) }
|
|
685
|
-
{ isEmbedVideoBackground && !
|
|
714
|
+
{ isEmbedVideoBackground && ! embedHtml && isFetchingEmbed && (
|
|
686
715
|
<Spinner />
|
|
687
716
|
) }
|
|
688
717
|
|
|
@@ -74,18 +74,20 @@ function findVideoEmbedProvider( url ) {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
77
|
+
* Modifies embed HTML to use background video parameters.
|
|
78
78
|
*
|
|
79
|
-
* @param {string} html The embed HTML.
|
|
80
|
-
* @return {string|null} The
|
|
79
|
+
* @param {string} html The original embed HTML.
|
|
80
|
+
* @return {string|null} The modified embed HTML, or null if not possible.
|
|
81
81
|
*/
|
|
82
|
-
export function
|
|
83
|
-
|
|
82
|
+
export function getBackgroundEmbedHtml( html ) {
|
|
83
|
+
const srcMatch = html?.match( /src=["']([^"']+)["']/ );
|
|
84
|
+
if ( ! srcMatch ) {
|
|
84
85
|
return null;
|
|
85
86
|
}
|
|
86
87
|
|
|
87
|
-
const
|
|
88
|
-
|
|
88
|
+
const iframeSrc = srcMatch[ 1 ];
|
|
89
|
+
const backgroundSrc = getBackgroundVideoSrc( iframeSrc );
|
|
90
|
+
return html.replace( iframeSrc, backgroundSrc );
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
/**
|
|
@@ -189,7 +191,7 @@ export function getBackgroundVideoSrc( src ) {
|
|
|
189
191
|
}
|
|
190
192
|
|
|
191
193
|
return url.toString();
|
|
192
|
-
} catch
|
|
194
|
+
} catch {
|
|
193
195
|
// If URL parsing fails, return original src
|
|
194
196
|
return src;
|
|
195
197
|
}
|
|
@@ -28,9 +28,10 @@ import { requestPreview } from '@wordpress/react-native-bridge';
|
|
|
28
28
|
/**
|
|
29
29
|
* Internal dependencies
|
|
30
30
|
*/
|
|
31
|
+
import { WebView } from 'react-native-webview';
|
|
32
|
+
|
|
31
33
|
import * as paragraph from '../../paragraph';
|
|
32
34
|
import * as embed from '..';
|
|
33
|
-
import { WebView } from 'react-native-webview';
|
|
34
35
|
|
|
35
36
|
// Override modal mock to prevent unmounting it when is not visible.
|
|
36
37
|
// This is required to be able to trigger onClose and onDismiss events when
|
|
@@ -1114,7 +1115,7 @@ describe( 'Embed block', () => {
|
|
|
1114
1115
|
try {
|
|
1115
1116
|
mediaSettingsPanel =
|
|
1116
1117
|
await screen.findByText( 'Media settings' );
|
|
1117
|
-
} catch
|
|
1118
|
+
} catch {
|
|
1118
1119
|
// NOOP.
|
|
1119
1120
|
}
|
|
1120
1121
|
|
package/src/file/utils/index.js
CHANGED
package/src/form/view.js
CHANGED
package/src/form-input/edit.js
CHANGED
|
@@ -115,6 +115,20 @@ function InputFieldBlock( { attributes, setAttributes, className } ) {
|
|
|
115
115
|
'Affects the "name" attribute of the input element, and is used as a name for the form submission results.'
|
|
116
116
|
) }
|
|
117
117
|
/>
|
|
118
|
+
{ 'hidden' === type && (
|
|
119
|
+
<TextControl
|
|
120
|
+
__next40pxDefaultSize
|
|
121
|
+
autoComplete="off"
|
|
122
|
+
label={ __( 'Value' ) }
|
|
123
|
+
value={ value }
|
|
124
|
+
onChange={ ( newVal ) =>
|
|
125
|
+
setAttributes( { value: newVal } )
|
|
126
|
+
}
|
|
127
|
+
help={ __(
|
|
128
|
+
'Sets the stored value for this hidden field.'
|
|
129
|
+
) }
|
|
130
|
+
/>
|
|
131
|
+
) }
|
|
118
132
|
</InspectorControls>
|
|
119
133
|
</>
|
|
120
134
|
);
|
|
@@ -133,23 +147,13 @@ function InputFieldBlock( { attributes, setAttributes, className } ) {
|
|
|
133
147
|
|
|
134
148
|
if ( 'hidden' === type ) {
|
|
135
149
|
return (
|
|
136
|
-
|
|
150
|
+
<div { ...blockProps }>
|
|
137
151
|
{ controls }
|
|
138
|
-
<
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
className,
|
|
142
|
-
'wp-block-form-input__input',
|
|
143
|
-
colorProps.className,
|
|
144
|
-
borderProps.className
|
|
145
|
-
) }
|
|
146
|
-
aria-label={ __( 'Value' ) }
|
|
147
|
-
value={ value }
|
|
148
|
-
onChange={ ( event ) =>
|
|
149
|
-
setAttributes( { value: event.target.value } )
|
|
150
|
-
}
|
|
152
|
+
<span
|
|
153
|
+
className="wp-block-form-input__label is-input-hidden"
|
|
154
|
+
data-message={ __( 'Hidden field' ) }
|
|
151
155
|
/>
|
|
152
|
-
|
|
156
|
+
</div>
|
|
153
157
|
);
|
|
154
158
|
}
|
|
155
159
|
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
.wp-block-form-input {
|
|
2
2
|
.is-input-hidden {
|
|
3
|
+
display: flex;
|
|
4
|
+
position: relative;
|
|
3
5
|
font-size: 0.85em;
|
|
4
6
|
opacity: 0.3;
|
|
5
7
|
border: 1px dashed;
|
|
6
8
|
padding: 0.5em;
|
|
7
9
|
box-sizing: border-box;
|
|
8
10
|
background: repeating-linear-gradient(45deg, transparent, transparent 5px, currentColor 5px, currentColor 6px);
|
|
11
|
+
justify-content: center;
|
|
12
|
+
align-items: center;
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
|
|
14
|
+
&::after {
|
|
15
|
+
content: attr(data-message);
|
|
12
16
|
}
|
|
13
17
|
}
|
|
14
18
|
&.is-selected {
|
|
15
19
|
.is-input-hidden {
|
|
16
20
|
opacity: 1;
|
|
17
21
|
background: none;
|
|
18
|
-
|
|
19
|
-
input[type="text"] {
|
|
20
|
-
background: unset;
|
|
21
|
-
}
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -70,6 +70,16 @@ const variations = [
|
|
|
70
70
|
scope: [ 'inserter', 'transform' ],
|
|
71
71
|
isActive: ( blockAttributes ) => blockAttributes?.type === 'number',
|
|
72
72
|
},
|
|
73
|
+
{
|
|
74
|
+
name: 'hidden',
|
|
75
|
+
title: __( 'Hidden Input' ),
|
|
76
|
+
icon: 'visibility',
|
|
77
|
+
description: __( 'A hidden input field.' ),
|
|
78
|
+
attributes: { type: 'hidden' },
|
|
79
|
+
isDefault: true,
|
|
80
|
+
scope: [ 'inserter', 'transform' ],
|
|
81
|
+
isActive: ( blockAttributes ) => blockAttributes?.type === 'hidden',
|
|
82
|
+
},
|
|
73
83
|
];
|
|
74
84
|
|
|
75
85
|
export default variations;
|
package/src/group/block.json
CHANGED