@wordpress/block-editor 12.10.5 → 12.10.7
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/build/components/block-preview/index.js +4 -1
- package/build/components/block-preview/index.js.map +1 -1
- package/build/hooks/duotone.js +28 -1
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/layout.js +6 -6
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/utils.js +1 -1
- package/build/hooks/utils.js.map +1 -1
- package/build/lock-unlock.js +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build-module/components/block-preview/index.js +4 -1
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/hooks/duotone.js +28 -1
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/layout.js +6 -6
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/utils.js +1 -1
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/lock-unlock.js +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/package.json +32 -32
- package/src/components/block-preview/index.js +7 -1
- package/src/hooks/duotone.js +33 -0
- package/src/hooks/layout.js +6 -6
- package/src/hooks/utils.js +2 -0
- package/src/lock-unlock.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "12.10.
|
|
3
|
+
"version": "12.10.7",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -35,36 +35,36 @@
|
|
|
35
35
|
"@emotion/react": "^11.7.1",
|
|
36
36
|
"@emotion/styled": "^11.6.0",
|
|
37
37
|
"@react-spring/web": "^9.4.5",
|
|
38
|
-
"@wordpress/a11y": "^3.42.
|
|
39
|
-
"@wordpress/api-fetch": "^6.39.
|
|
40
|
-
"@wordpress/blob": "^3.42.
|
|
41
|
-
"@wordpress/blocks": "^12.19.
|
|
42
|
-
"@wordpress/commands": "^0.13.
|
|
43
|
-
"@wordpress/components": "^25.8.
|
|
44
|
-
"@wordpress/compose": "^6.19.
|
|
45
|
-
"@wordpress/data": "^9.12.
|
|
46
|
-
"@wordpress/date": "^4.42.
|
|
47
|
-
"@wordpress/deprecated": "^3.42.
|
|
48
|
-
"@wordpress/dom": "^3.42.
|
|
49
|
-
"@wordpress/element": "^5.19.
|
|
50
|
-
"@wordpress/escape-html": "^2.42.
|
|
51
|
-
"@wordpress/hooks": "^3.42.
|
|
52
|
-
"@wordpress/html-entities": "^3.42.
|
|
53
|
-
"@wordpress/i18n": "^4.42.
|
|
54
|
-
"@wordpress/icons": "^9.33.
|
|
55
|
-
"@wordpress/is-shallow-equal": "^4.42.
|
|
56
|
-
"@wordpress/keyboard-shortcuts": "^4.19.
|
|
57
|
-
"@wordpress/keycodes": "^3.42.
|
|
58
|
-
"@wordpress/notices": "^4.10.
|
|
59
|
-
"@wordpress/preferences": "^3.19.
|
|
60
|
-
"@wordpress/private-apis": "^0.24.
|
|
61
|
-
"@wordpress/rich-text": "^6.19.
|
|
62
|
-
"@wordpress/shortcode": "^3.42.
|
|
63
|
-
"@wordpress/style-engine": "^1.25.
|
|
64
|
-
"@wordpress/token-list": "^2.42.
|
|
65
|
-
"@wordpress/url": "^3.43.
|
|
66
|
-
"@wordpress/warning": "^2.42.
|
|
67
|
-
"@wordpress/wordcount": "^3.42.
|
|
38
|
+
"@wordpress/a11y": "^3.42.7",
|
|
39
|
+
"@wordpress/api-fetch": "^6.39.7",
|
|
40
|
+
"@wordpress/blob": "^3.42.7",
|
|
41
|
+
"@wordpress/blocks": "^12.19.7",
|
|
42
|
+
"@wordpress/commands": "^0.13.7",
|
|
43
|
+
"@wordpress/components": "^25.8.7",
|
|
44
|
+
"@wordpress/compose": "^6.19.7",
|
|
45
|
+
"@wordpress/data": "^9.12.7",
|
|
46
|
+
"@wordpress/date": "^4.42.7",
|
|
47
|
+
"@wordpress/deprecated": "^3.42.7",
|
|
48
|
+
"@wordpress/dom": "^3.42.7",
|
|
49
|
+
"@wordpress/element": "^5.19.7",
|
|
50
|
+
"@wordpress/escape-html": "^2.42.7",
|
|
51
|
+
"@wordpress/hooks": "^3.42.7",
|
|
52
|
+
"@wordpress/html-entities": "^3.42.7",
|
|
53
|
+
"@wordpress/i18n": "^4.42.7",
|
|
54
|
+
"@wordpress/icons": "^9.33.7",
|
|
55
|
+
"@wordpress/is-shallow-equal": "^4.42.7",
|
|
56
|
+
"@wordpress/keyboard-shortcuts": "^4.19.7",
|
|
57
|
+
"@wordpress/keycodes": "^3.42.7",
|
|
58
|
+
"@wordpress/notices": "^4.10.7",
|
|
59
|
+
"@wordpress/preferences": "^3.19.7",
|
|
60
|
+
"@wordpress/private-apis": "^0.24.7",
|
|
61
|
+
"@wordpress/rich-text": "^6.19.7",
|
|
62
|
+
"@wordpress/shortcode": "^3.42.7",
|
|
63
|
+
"@wordpress/style-engine": "^1.25.7",
|
|
64
|
+
"@wordpress/token-list": "^2.42.7",
|
|
65
|
+
"@wordpress/url": "^3.43.7",
|
|
66
|
+
"@wordpress/warning": "^2.42.7",
|
|
67
|
+
"@wordpress/wordcount": "^3.42.7",
|
|
68
68
|
"change-case": "^4.1.2",
|
|
69
69
|
"classnames": "^2.3.1",
|
|
70
70
|
"colord": "^2.7.0",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"publishConfig": {
|
|
87
87
|
"access": "public"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "5551609efcf6d5b15ac55842bbbb310faea607f9"
|
|
90
90
|
}
|
|
@@ -16,6 +16,7 @@ import deprecated from '@wordpress/deprecated';
|
|
|
16
16
|
*/
|
|
17
17
|
import { ExperimentalBlockEditorProvider } from '../provider';
|
|
18
18
|
import AutoHeightBlockPreview from './auto';
|
|
19
|
+
import EditorStyles from '../editor-styles';
|
|
19
20
|
import { store as blockEditorStore } from '../../store';
|
|
20
21
|
import { BlockListItems } from '../block-list';
|
|
21
22
|
|
|
@@ -113,7 +114,11 @@ export function useBlockPreview( { blocks, props = {}, layout } ) {
|
|
|
113
114
|
[]
|
|
114
115
|
);
|
|
115
116
|
const settings = useMemo(
|
|
116
|
-
() => ( {
|
|
117
|
+
() => ( {
|
|
118
|
+
...originalSettings,
|
|
119
|
+
styles: undefined, // Clear styles included by the parent settings, as they are already output by the parent's EditorStyles.
|
|
120
|
+
__unstableIsPreviewMode: true,
|
|
121
|
+
} ),
|
|
117
122
|
[ originalSettings ]
|
|
118
123
|
);
|
|
119
124
|
const disabledRef = useDisabled();
|
|
@@ -128,6 +133,7 @@ export function useBlockPreview( { blocks, props = {}, layout } ) {
|
|
|
128
133
|
value={ renderedBlocks }
|
|
129
134
|
settings={ settings }
|
|
130
135
|
>
|
|
136
|
+
<EditorStyles />
|
|
131
137
|
<BlockListItems renderAppender={ false } layout={ layout } />
|
|
132
138
|
</ExperimentalBlockEditorProvider>
|
|
133
139
|
);
|
package/src/hooks/duotone.js
CHANGED
|
@@ -37,11 +37,22 @@ import { scopeSelector } from '../components/global-styles/utils';
|
|
|
37
37
|
import { useBlockSettings } from './utils';
|
|
38
38
|
import { default as StylesFiltersPanel } from '../components/global-styles/filters-panel';
|
|
39
39
|
import { useBlockEditingMode } from '../components/block-editing-mode';
|
|
40
|
+
import { __unstableUseBlockElement as useBlockElement } from '../components/block-list/use-block-props/use-block-refs';
|
|
40
41
|
import { store as blockEditorStore } from '../store';
|
|
41
42
|
import { unlock } from '../lock-unlock';
|
|
42
43
|
|
|
43
44
|
const EMPTY_ARRAY = [];
|
|
44
45
|
|
|
46
|
+
// Safari does not always update the duotone filter when the duotone colors
|
|
47
|
+
// are changed. This browser check is later used to force a re-render of the block
|
|
48
|
+
// element to ensure the duotone filter is updated. The check is included at the
|
|
49
|
+
// root of this file as it only needs to be run once per page load.
|
|
50
|
+
const isSafari =
|
|
51
|
+
window?.navigator.userAgent &&
|
|
52
|
+
window.navigator.userAgent.includes( 'Safari' ) &&
|
|
53
|
+
! window.navigator.userAgent.includes( 'Chrome' ) &&
|
|
54
|
+
! window.navigator.userAgent.includes( 'Chromium' );
|
|
55
|
+
|
|
45
56
|
extend( [ namesPlugin ] );
|
|
46
57
|
|
|
47
58
|
function useMultiOriginPresets( { presetSetting, defaultSetting } ) {
|
|
@@ -223,6 +234,7 @@ const withDuotoneControls = createHigherOrderComponent(
|
|
|
223
234
|
);
|
|
224
235
|
|
|
225
236
|
function DuotoneStyles( {
|
|
237
|
+
clientId,
|
|
226
238
|
id: filterId,
|
|
227
239
|
selector: duotoneSelector,
|
|
228
240
|
attribute: duotoneAttr,
|
|
@@ -278,6 +290,8 @@ function DuotoneStyles( {
|
|
|
278
290
|
useDispatch( blockEditorStore )
|
|
279
291
|
);
|
|
280
292
|
|
|
293
|
+
const blockElement = useBlockElement( clientId );
|
|
294
|
+
|
|
281
295
|
useEffect( () => {
|
|
282
296
|
if ( ! isValidFilter ) return;
|
|
283
297
|
|
|
@@ -294,12 +308,30 @@ function DuotoneStyles( {
|
|
|
294
308
|
__unstableType: 'svgs',
|
|
295
309
|
} );
|
|
296
310
|
|
|
311
|
+
// Safari does not always update the duotone filter when the duotone colors
|
|
312
|
+
// are changed. When using Safari, force the block element to be repainted by
|
|
313
|
+
// the browser to ensure any changes are reflected visually. This logic matches
|
|
314
|
+
// that used on the site frontend in `block-supports/duotone.php`.
|
|
315
|
+
if ( blockElement && isSafari ) {
|
|
316
|
+
const display = blockElement.style.display;
|
|
317
|
+
// Switch to `inline-block` to force a repaint. In the editor, `inline-block`
|
|
318
|
+
// is used instead of `none` to ensure that scroll position is not affected,
|
|
319
|
+
// as `none` results in the editor scrolling to the top of the block.
|
|
320
|
+
blockElement.style.display = 'inline-block';
|
|
321
|
+
// Simply accessing el.offsetHeight flushes layout and style
|
|
322
|
+
// changes in WebKit without having to wait for setTimeout.
|
|
323
|
+
// eslint-disable-next-line no-unused-expressions
|
|
324
|
+
blockElement.offsetHeight;
|
|
325
|
+
blockElement.style.display = display;
|
|
326
|
+
}
|
|
327
|
+
|
|
297
328
|
return () => {
|
|
298
329
|
deleteStyleOverride( filterId );
|
|
299
330
|
deleteStyleOverride( `duotone-${ filterId }` );
|
|
300
331
|
};
|
|
301
332
|
}, [
|
|
302
333
|
isValidFilter,
|
|
334
|
+
blockElement,
|
|
303
335
|
colors,
|
|
304
336
|
selector,
|
|
305
337
|
filterId,
|
|
@@ -378,6 +410,7 @@ const withDuotoneStyles = createHigherOrderComponent(
|
|
|
378
410
|
<>
|
|
379
411
|
{ shouldRender && (
|
|
380
412
|
<DuotoneStyles
|
|
413
|
+
clientId={ props.clientId }
|
|
381
414
|
id={ filterClass }
|
|
382
415
|
selector={ selector }
|
|
383
416
|
attribute={ attribute }
|
package/src/hooks/layout.js
CHANGED
|
@@ -408,11 +408,11 @@ export const withLayoutStyles = createHigherOrderComponent(
|
|
|
408
408
|
|
|
409
409
|
useEffect( () => {
|
|
410
410
|
if ( ! css ) return;
|
|
411
|
-
setStyleOverride(
|
|
411
|
+
setStyleOverride( selector, { css } );
|
|
412
412
|
return () => {
|
|
413
|
-
deleteStyleOverride(
|
|
413
|
+
deleteStyleOverride( selector );
|
|
414
414
|
};
|
|
415
|
-
}, [
|
|
415
|
+
}, [ selector, css, setStyleOverride, deleteStyleOverride ] );
|
|
416
416
|
|
|
417
417
|
return (
|
|
418
418
|
<BlockListBlock
|
|
@@ -472,11 +472,11 @@ export const withChildLayoutStyles = createHigherOrderComponent(
|
|
|
472
472
|
|
|
473
473
|
useEffect( () => {
|
|
474
474
|
if ( ! css ) return;
|
|
475
|
-
setStyleOverride(
|
|
475
|
+
setStyleOverride( selector, { css } );
|
|
476
476
|
return () => {
|
|
477
|
-
deleteStyleOverride(
|
|
477
|
+
deleteStyleOverride( selector );
|
|
478
478
|
};
|
|
479
|
-
}, [
|
|
479
|
+
}, [ selector, css, setStyleOverride, deleteStyleOverride ] );
|
|
480
480
|
|
|
481
481
|
return <BlockListBlock { ...props } className={ className } />;
|
|
482
482
|
},
|
package/src/hooks/utils.js
CHANGED
package/src/lock-unlock.js
CHANGED
|
@@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri
|
|
|
5
5
|
|
|
6
6
|
export const { lock, unlock } =
|
|
7
7
|
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
|
|
8
|
-
'I know using unstable features means my
|
|
8
|
+
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
|
|
9
9
|
'@wordpress/block-editor'
|
|
10
10
|
);
|