@wordpress/block-editor 15.13.2-next.v.202602271551.0 → 15.13.2
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-bindings/attribute-control.cjs +5 -2
- package/build/components/block-bindings/attribute-control.cjs.map +2 -2
- package/build/components/block-inspector/edit-contents.cjs +5 -4
- package/build/components/block-inspector/edit-contents.cjs.map +2 -2
- package/build/components/block-list/block-html.cjs +6 -2
- package/build/components/block-list/block-html.cjs.map +2 -2
- package/build/components/block-list/block.cjs +9 -1
- package/build/components/block-list/block.cjs.map +2 -2
- package/build/components/block-list/use-block-props/index.cjs +10 -1
- package/build/components/block-list/use-block-props/index.cjs.map +2 -2
- package/build/components/block-quick-navigation/index.cjs +1 -6
- package/build/components/block-quick-navigation/index.cjs.map +3 -3
- package/build/components/block-settings-menu/block-settings-dropdown.cjs +4 -47
- package/build/components/block-settings-menu/block-settings-dropdown.cjs.map +2 -2
- package/build/components/block-settings-menu-controls/index.cjs +1 -0
- package/build/components/block-settings-menu-controls/index.cjs.map +2 -2
- package/build/components/block-styles/index.cjs +7 -1
- package/build/components/block-styles/index.cjs.map +3 -3
- package/build/components/block-styles/menu-items.cjs +16 -10
- package/build/components/block-styles/menu-items.cjs.map +3 -3
- package/build/components/block-switcher/block-styles-menu.cjs +2 -50
- package/build/components/block-switcher/block-styles-menu.cjs.map +3 -3
- package/build/components/block-toolbar/block-toolbar-icon.cjs +1 -1
- package/build/components/block-toolbar/block-toolbar-icon.cjs.map +2 -2
- package/build/components/block-toolbar/index.cjs +8 -4
- package/build/components/block-toolbar/index.cjs.map +2 -2
- package/build/components/block-tools/index.cjs +4 -3
- package/build/components/block-tools/index.cjs.map +2 -2
- package/build/components/block-variation-transforms/index.cjs +11 -5
- package/build/components/block-variation-transforms/index.cjs.map +2 -2
- package/build/components/block-visibility/modal.cjs +2 -2
- package/build/components/block-visibility/modal.cjs.map +2 -2
- package/build/components/block-visibility/use-block-visibility.cjs +4 -3
- package/build/components/block-visibility/use-block-visibility.cjs.map +2 -2
- package/build/components/block-visibility/viewport-visibility-info.cjs +6 -1
- package/build/components/block-visibility/viewport-visibility-info.cjs.map +2 -2
- package/build/components/dimensions-tool/scale-tool.cjs +2 -2
- package/build/components/dimensions-tool/scale-tool.cjs.map +2 -2
- package/build/components/grid/grid-visualizer.cjs +0 -3
- package/build/components/grid/grid-visualizer.cjs.map +2 -2
- package/build/components/iframe/index.cjs +1 -3
- package/build/components/iframe/index.cjs.map +2 -2
- package/build/components/iframe/use-scale-canvas.cjs +0 -1
- package/build/components/iframe/use-scale-canvas.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs +8 -4
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs.map +2 -2
- package/build/components/link-picker/link-preview.cjs +2 -1
- package/build/components/link-picker/link-preview.cjs.map +3 -3
- package/build/components/list-view/block.cjs +1 -2
- package/build/components/list-view/block.cjs.map +2 -2
- package/build/components/provider/index.cjs +23 -7
- package/build/components/provider/index.cjs.map +2 -2
- package/build/components/provider/use-media-upload-settings.cjs +1 -0
- package/build/components/provider/use-media-upload-settings.cjs.map +2 -2
- package/build/components/writing-flow/use-arrow-nav.cjs +1 -1
- package/build/components/writing-flow/use-arrow-nav.cjs.map +2 -2
- package/build/hooks/auto-inspector-controls.cjs +26 -2
- package/build/hooks/auto-inspector-controls.cjs.map +3 -3
- package/build/hooks/cross-origin-isolation.cjs +9 -75
- package/build/hooks/cross-origin-isolation.cjs.map +2 -2
- package/build/hooks/custom-css.cjs +26 -0
- package/build/hooks/custom-css.cjs.map +3 -3
- package/build/private-apis.cjs +1 -0
- package/build/private-apis.cjs.map +2 -2
- package/build/store/actions.cjs +0 -8
- package/build/store/actions.cjs.map +2 -2
- package/build/store/private-keys.cjs +3 -0
- package/build/store/private-keys.cjs.map +2 -2
- package/build/store/private-selectors.cjs +4 -3
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +65 -59
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +16 -14
- package/build/store/selectors.cjs.map +2 -2
- package/build-module/components/block-bindings/attribute-control.mjs +5 -2
- package/build-module/components/block-bindings/attribute-control.mjs.map +2 -2
- package/build-module/components/block-inspector/edit-contents.mjs +5 -4
- package/build-module/components/block-inspector/edit-contents.mjs.map +2 -2
- package/build-module/components/block-list/block-html.mjs +7 -3
- package/build-module/components/block-list/block-html.mjs.map +2 -2
- package/build-module/components/block-list/block.mjs +10 -2
- package/build-module/components/block-list/block.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/index.mjs +11 -2
- package/build-module/components/block-list/use-block-props/index.mjs.map +2 -2
- package/build-module/components/block-quick-navigation/index.mjs +1 -6
- package/build-module/components/block-quick-navigation/index.mjs.map +2 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.mjs +5 -48
- package/build-module/components/block-settings-menu/block-settings-dropdown.mjs.map +2 -2
- package/build-module/components/block-settings-menu-controls/index.mjs +1 -0
- package/build-module/components/block-settings-menu-controls/index.mjs.map +2 -2
- package/build-module/components/block-styles/index.mjs +7 -1
- package/build-module/components/block-styles/index.mjs.map +2 -2
- package/build-module/components/block-styles/menu-items.mjs +6 -10
- package/build-module/components/block-styles/menu-items.mjs.map +2 -2
- package/build-module/components/block-switcher/block-styles-menu.mjs +3 -51
- package/build-module/components/block-switcher/block-styles-menu.mjs.map +2 -2
- package/build-module/components/block-toolbar/block-toolbar-icon.mjs +1 -1
- package/build-module/components/block-toolbar/block-toolbar-icon.mjs.map +2 -2
- package/build-module/components/block-toolbar/index.mjs +8 -4
- package/build-module/components/block-toolbar/index.mjs.map +2 -2
- package/build-module/components/block-tools/index.mjs +4 -3
- package/build-module/components/block-tools/index.mjs.map +2 -2
- package/build-module/components/block-variation-transforms/index.mjs +11 -5
- package/build-module/components/block-variation-transforms/index.mjs.map +2 -2
- package/build-module/components/block-visibility/modal.mjs +2 -2
- package/build-module/components/block-visibility/modal.mjs.map +2 -2
- package/build-module/components/block-visibility/use-block-visibility.mjs +4 -3
- package/build-module/components/block-visibility/use-block-visibility.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-visibility-info.mjs +6 -1
- package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +2 -2
- package/build-module/components/dimensions-tool/scale-tool.mjs +2 -2
- package/build-module/components/dimensions-tool/scale-tool.mjs.map +2 -2
- package/build-module/components/grid/grid-visualizer.mjs +0 -3
- package/build-module/components/grid/grid-visualizer.mjs.map +2 -2
- package/build-module/components/iframe/index.mjs +2 -9
- package/build-module/components/iframe/index.mjs.map +2 -2
- package/build-module/components/iframe/use-scale-canvas.mjs +0 -1
- package/build-module/components/iframe/use-scale-canvas.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs +8 -4
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs.map +2 -2
- package/build-module/components/link-picker/link-preview.mjs +2 -1
- package/build-module/components/link-picker/link-preview.mjs.map +2 -2
- package/build-module/components/list-view/block.mjs +1 -2
- package/build-module/components/list-view/block.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +23 -7
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/use-media-upload-settings.mjs +1 -0
- package/build-module/components/provider/use-media-upload-settings.mjs.map +2 -2
- package/build-module/components/writing-flow/use-arrow-nav.mjs +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.mjs.map +2 -2
- package/build-module/hooks/auto-inspector-controls.mjs +28 -4
- package/build-module/hooks/auto-inspector-controls.mjs.map +2 -2
- package/build-module/hooks/cross-origin-isolation.mjs +9 -75
- package/build-module/hooks/cross-origin-isolation.mjs.map +2 -2
- package/build-module/hooks/custom-css.mjs +28 -2
- package/build-module/hooks/custom-css.mjs.map +2 -2
- package/build-module/private-apis.mjs +3 -1
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/actions.mjs +0 -8
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/private-keys.mjs +2 -0
- package/build-module/store/private-keys.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +4 -3
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +65 -58
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +16 -14
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-style/content-rtl.css +25 -1
- package/build-style/content.css +25 -2
- package/build-style/style-rtl.css +3 -0
- package/build-style/style.css +3 -0
- package/package.json +39 -39
- package/src/components/block-bindings/attribute-control.js +8 -3
- package/src/components/block-inspector/edit-contents.js +5 -3
- package/src/components/block-list/block-html.js +13 -3
- package/src/components/block-list/block.js +10 -1
- package/src/components/block-list/content.scss +35 -4
- package/src/components/block-list/use-block-props/index.js +11 -1
- package/src/components/block-quick-navigation/index.js +1 -6
- package/src/components/block-settings-menu/block-settings-dropdown.js +2 -46
- package/src/components/block-settings-menu-controls/index.js +1 -0
- package/src/components/block-styles/index.js +7 -1
- package/src/components/block-styles/menu-items.js +11 -10
- package/src/components/block-switcher/block-styles-menu.js +1 -47
- package/src/components/block-toolbar/block-toolbar-icon.js +6 -1
- package/src/components/block-toolbar/index.js +7 -2
- package/src/components/block-tools/index.js +11 -4
- package/src/components/block-tools/style.scss +5 -0
- package/src/components/block-variation-transforms/index.js +41 -36
- package/src/components/block-visibility/use-block-visibility.js +4 -2
- package/src/components/block-visibility/viewport-visibility-info.js +8 -1
- package/src/components/dimensions-tool/scale-tool.js +2 -2
- package/src/components/grid/grid-visualizer.js +0 -3
- package/src/components/iframe/index.js +2 -12
- package/src/components/iframe/use-scale-canvas.js +0 -1
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +9 -5
- package/src/components/link-picker/link-preview.js +2 -1
- package/src/components/list-view/block.js +0 -5
- package/src/components/provider/index.js +49 -6
- package/src/components/provider/use-media-upload-settings.js +1 -0
- package/src/components/writing-flow/use-arrow-nav.js +9 -2
- package/src/hooks/auto-inspector-controls.js +31 -4
- package/src/hooks/cross-origin-isolation.js +10 -109
- package/src/hooks/custom-css.js +36 -2
- package/src/hooks/test/cross-origin-isolation.js +15 -42
- package/src/private-apis.js +2 -0
- package/src/store/actions.js +0 -8
- package/src/store/private-keys.js +1 -0
- package/src/store/private-selectors.js +6 -3
- package/src/store/reducer.js +96 -77
- package/src/store/selectors.js +59 -22
- package/src/store/test/private-selectors.js +67 -34
- package/src/store/test/reducer.js +436 -57
- package/src/store/test/selectors.js +611 -53
|
@@ -199,6 +199,7 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection=true] .blo
|
|
|
199
199
|
outline-style: solid;
|
|
200
200
|
outline-width: calc(1 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));
|
|
201
201
|
outline-offset: calc(1 * -1 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));
|
|
202
|
+
box-shadow: inset 0 0 0 calc(1 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1) + 0.5px) rgba(255, 255, 255, 0.7);
|
|
202
203
|
z-index: 1;
|
|
203
204
|
}
|
|
204
205
|
.block-editor-block-list__layout .block-editor-block-list__block.is-block-hidden {
|
|
@@ -264,6 +265,18 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection=true] .blo
|
|
|
264
265
|
.block-editor-block-list__layout .block-editor-block-list__block.has-warning .block-editor-warning {
|
|
265
266
|
pointer-events: all;
|
|
266
267
|
}
|
|
268
|
+
.block-editor-block-list__layout .block-editor-block-list__block.has-warning::after {
|
|
269
|
+
content: "";
|
|
270
|
+
position: absolute;
|
|
271
|
+
top: 0;
|
|
272
|
+
left: 0;
|
|
273
|
+
bottom: 0;
|
|
274
|
+
right: 0;
|
|
275
|
+
background-color: rgba(255, 255, 255, 0.4);
|
|
276
|
+
}
|
|
277
|
+
.block-editor-block-list__layout .block-editor-block-list__block.has-warning.is-multi-selected::after {
|
|
278
|
+
background-color: transparent;
|
|
279
|
+
}
|
|
267
280
|
.block-editor-block-list__layout .block-editor-block-list__block[data-clear=true] {
|
|
268
281
|
float: none;
|
|
269
282
|
}
|
|
@@ -293,6 +306,7 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection=true] .blo
|
|
|
293
306
|
outline-style: solid;
|
|
294
307
|
outline-width: calc(1 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));
|
|
295
308
|
outline-offset: calc(1 * -1 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));
|
|
309
|
+
box-shadow: inset 0 0 0 calc(1 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1) + 0.5px) rgba(255, 255, 255, 0.7);
|
|
296
310
|
}
|
|
297
311
|
|
|
298
312
|
.is-outline-mode .block-editor-block-list__block:not(.remove-outline).wp-block-template-part.is-hovered::after, .is-outline-mode .block-editor-block-list__block:not(.remove-outline).wp-block-template-part.is-selected::after, .is-outline-mode .block-editor-block-list__block:not(.remove-outline).wp-block-template-part.is-highlighted::after,
|
|
@@ -432,7 +446,6 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection=true] .blo
|
|
|
432
446
|
font-family: Menlo, Consolas, monaco, monospace;
|
|
433
447
|
font-size: 15px;
|
|
434
448
|
line-height: 1.5;
|
|
435
|
-
direction: ltr;
|
|
436
449
|
}
|
|
437
450
|
@media not (prefers-reduced-motion) {
|
|
438
451
|
.block-editor-block-list__block .block-editor-block-list__block-html-textarea {
|
|
@@ -443,6 +456,17 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection=true] .blo
|
|
|
443
456
|
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
444
457
|
}
|
|
445
458
|
|
|
459
|
+
/**
|
|
460
|
+
* Warnings.
|
|
461
|
+
*/
|
|
462
|
+
.block-editor-block-list__block .block-editor-warning {
|
|
463
|
+
z-index: 5;
|
|
464
|
+
position: relative;
|
|
465
|
+
}
|
|
466
|
+
.block-editor-block-list__block .block-editor-warning.block-editor-block-list__block-crash-warning {
|
|
467
|
+
margin-bottom: auto;
|
|
468
|
+
}
|
|
469
|
+
|
|
446
470
|
.block-editor-block-list__zoom-out-separator {
|
|
447
471
|
/* same color as the iframe's background */
|
|
448
472
|
background: #ddd;
|
package/build-style/content.css
CHANGED
|
@@ -199,6 +199,7 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection=true] .blo
|
|
|
199
199
|
outline-style: solid;
|
|
200
200
|
outline-width: calc(1 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));
|
|
201
201
|
outline-offset: calc(1 * -1 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));
|
|
202
|
+
box-shadow: inset 0 0 0 calc(1 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1) + 0.5px) rgba(255, 255, 255, 0.7);
|
|
202
203
|
z-index: 1;
|
|
203
204
|
}
|
|
204
205
|
.block-editor-block-list__layout .block-editor-block-list__block.is-block-hidden {
|
|
@@ -264,6 +265,18 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection=true] .blo
|
|
|
264
265
|
.block-editor-block-list__layout .block-editor-block-list__block.has-warning .block-editor-warning {
|
|
265
266
|
pointer-events: all;
|
|
266
267
|
}
|
|
268
|
+
.block-editor-block-list__layout .block-editor-block-list__block.has-warning::after {
|
|
269
|
+
content: "";
|
|
270
|
+
position: absolute;
|
|
271
|
+
top: 0;
|
|
272
|
+
right: 0;
|
|
273
|
+
bottom: 0;
|
|
274
|
+
left: 0;
|
|
275
|
+
background-color: rgba(255, 255, 255, 0.4);
|
|
276
|
+
}
|
|
277
|
+
.block-editor-block-list__layout .block-editor-block-list__block.has-warning.is-multi-selected::after {
|
|
278
|
+
background-color: transparent;
|
|
279
|
+
}
|
|
267
280
|
.block-editor-block-list__layout .block-editor-block-list__block[data-clear=true] {
|
|
268
281
|
float: none;
|
|
269
282
|
}
|
|
@@ -293,6 +306,7 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection=true] .blo
|
|
|
293
306
|
outline-style: solid;
|
|
294
307
|
outline-width: calc(1 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));
|
|
295
308
|
outline-offset: calc(1 * -1 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));
|
|
309
|
+
box-shadow: inset 0 0 0 calc(1 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1) + 0.5px) rgba(255, 255, 255, 0.7);
|
|
296
310
|
}
|
|
297
311
|
|
|
298
312
|
.is-outline-mode .block-editor-block-list__block:not(.remove-outline).wp-block-template-part.is-hovered::after, .is-outline-mode .block-editor-block-list__block:not(.remove-outline).wp-block-template-part.is-selected::after, .is-outline-mode .block-editor-block-list__block:not(.remove-outline).wp-block-template-part.is-highlighted::after,
|
|
@@ -432,8 +446,6 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection=true] .blo
|
|
|
432
446
|
font-family: Menlo, Consolas, monaco, monospace;
|
|
433
447
|
font-size: 15px;
|
|
434
448
|
line-height: 1.5;
|
|
435
|
-
/*rtl:ignore*/
|
|
436
|
-
direction: ltr;
|
|
437
449
|
}
|
|
438
450
|
@media not (prefers-reduced-motion) {
|
|
439
451
|
.block-editor-block-list__block .block-editor-block-list__block-html-textarea {
|
|
@@ -444,6 +456,17 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection=true] .blo
|
|
|
444
456
|
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
445
457
|
}
|
|
446
458
|
|
|
459
|
+
/**
|
|
460
|
+
* Warnings.
|
|
461
|
+
*/
|
|
462
|
+
.block-editor-block-list__block .block-editor-warning {
|
|
463
|
+
z-index: 5;
|
|
464
|
+
position: relative;
|
|
465
|
+
}
|
|
466
|
+
.block-editor-block-list__block .block-editor-warning.block-editor-block-list__block-crash-warning {
|
|
467
|
+
margin-bottom: auto;
|
|
468
|
+
}
|
|
469
|
+
|
|
447
470
|
.block-editor-block-list__zoom-out-separator {
|
|
448
471
|
/* same color as the iframe's background */
|
|
449
472
|
background: #ddd;
|
|
@@ -502,6 +502,9 @@ iframe[name=editor-canvas] {
|
|
|
502
502
|
right: auto;
|
|
503
503
|
margin-right: -1px;
|
|
504
504
|
}
|
|
505
|
+
.show-icon-labels .components-popover.block-editor-block-list__block-popover .block-editor-block-parent-selector::after {
|
|
506
|
+
display: inline-flex;
|
|
507
|
+
}
|
|
505
508
|
.show-icon-labels .components-popover.block-editor-block-list__block-popover .block-editor-block-mover__move-button-container,
|
|
506
509
|
.show-icon-labels .components-popover.block-editor-block-list__block-popover .block-editor-block-toolbar__block-controls .block-editor-block-mover {
|
|
507
510
|
border-right: 1px solid #1e1e1e;
|
package/build-style/style.css
CHANGED
|
@@ -502,6 +502,9 @@ iframe[name=editor-canvas] {
|
|
|
502
502
|
left: auto;
|
|
503
503
|
margin-left: -1px;
|
|
504
504
|
}
|
|
505
|
+
.show-icon-labels .components-popover.block-editor-block-list__block-popover .block-editor-block-parent-selector::after {
|
|
506
|
+
display: inline-flex;
|
|
507
|
+
}
|
|
505
508
|
.show-icon-labels .components-popover.block-editor-block-list__block-popover .block-editor-block-mover__move-button-container,
|
|
506
509
|
.show-icon-labels .components-popover.block-editor-block-list__block-popover .block-editor-block-toolbar__block-controls .block-editor-block-mover {
|
|
507
510
|
border-left: 1px solid #1e1e1e;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "15.13.2
|
|
3
|
+
"version": "15.13.2",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -61,43 +61,43 @@
|
|
|
61
61
|
],
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@react-spring/web": "^9.4.5",
|
|
64
|
-
"@wordpress/a11y": "^4.40.1
|
|
65
|
-
"@wordpress/api-fetch": "^7.40.1
|
|
66
|
-
"@wordpress/base-styles": "^6.16.1
|
|
67
|
-
"@wordpress/blob": "^4.40.1
|
|
68
|
-
"@wordpress/block-serialization-default-parser": "^5.40.1
|
|
69
|
-
"@wordpress/blocks": "^15.13.1
|
|
70
|
-
"@wordpress/commands": "^1.40.1
|
|
71
|
-
"@wordpress/components": "^32.
|
|
72
|
-
"@wordpress/compose": "^7.40.1
|
|
73
|
-
"@wordpress/data": "^10.40.1
|
|
74
|
-
"@wordpress/dataviews": "^12.
|
|
75
|
-
"@wordpress/date": "^5.40.1
|
|
76
|
-
"@wordpress/deprecated": "^4.40.1
|
|
77
|
-
"@wordpress/dom": "^4.40.1
|
|
78
|
-
"@wordpress/element": "^6.40.1
|
|
79
|
-
"@wordpress/escape-html": "^3.40.1
|
|
80
|
-
"@wordpress/global-styles-engine": "^1.7.1
|
|
81
|
-
"@wordpress/hooks": "^4.40.1
|
|
82
|
-
"@wordpress/html-entities": "^4.40.1
|
|
83
|
-
"@wordpress/i18n": "^6.13.1
|
|
84
|
-
"@wordpress/icons": "^11.7.1
|
|
85
|
-
"@wordpress/image-cropper": "^1.4.1
|
|
86
|
-
"@wordpress/interactivity": "^6.40.1
|
|
87
|
-
"@wordpress/is-shallow-equal": "^5.40.1
|
|
88
|
-
"@wordpress/keyboard-shortcuts": "^5.40.1
|
|
89
|
-
"@wordpress/keycodes": "^4.40.1
|
|
90
|
-
"@wordpress/notices": "^5.40.1
|
|
91
|
-
"@wordpress/preferences": "^4.40.1
|
|
92
|
-
"@wordpress/priority-queue": "^3.40.1
|
|
93
|
-
"@wordpress/private-apis": "^1.40.1
|
|
94
|
-
"@wordpress/rich-text": "^7.40.1
|
|
95
|
-
"@wordpress/style-engine": "^2.40.1
|
|
96
|
-
"@wordpress/token-list": "^3.40.1
|
|
97
|
-
"@wordpress/upload-media": "^0.25.2
|
|
98
|
-
"@wordpress/url": "^4.40.1
|
|
99
|
-
"@wordpress/warning": "^3.40.1
|
|
100
|
-
"@wordpress/wordcount": "^4.40.1
|
|
64
|
+
"@wordpress/a11y": "^4.40.1",
|
|
65
|
+
"@wordpress/api-fetch": "^7.40.1",
|
|
66
|
+
"@wordpress/base-styles": "^6.16.1",
|
|
67
|
+
"@wordpress/blob": "^4.40.1",
|
|
68
|
+
"@wordpress/block-serialization-default-parser": "^5.40.1",
|
|
69
|
+
"@wordpress/blocks": "^15.13.1",
|
|
70
|
+
"@wordpress/commands": "^1.40.1",
|
|
71
|
+
"@wordpress/components": "^32.2.1",
|
|
72
|
+
"@wordpress/compose": "^7.40.1",
|
|
73
|
+
"@wordpress/data": "^10.40.1",
|
|
74
|
+
"@wordpress/dataviews": "^12.0.1",
|
|
75
|
+
"@wordpress/date": "^5.40.1",
|
|
76
|
+
"@wordpress/deprecated": "^4.40.1",
|
|
77
|
+
"@wordpress/dom": "^4.40.1",
|
|
78
|
+
"@wordpress/element": "^6.40.1",
|
|
79
|
+
"@wordpress/escape-html": "^3.40.1",
|
|
80
|
+
"@wordpress/global-styles-engine": "^1.7.1",
|
|
81
|
+
"@wordpress/hooks": "^4.40.1",
|
|
82
|
+
"@wordpress/html-entities": "^4.40.1",
|
|
83
|
+
"@wordpress/i18n": "^6.13.1",
|
|
84
|
+
"@wordpress/icons": "^11.7.1",
|
|
85
|
+
"@wordpress/image-cropper": "^1.4.1",
|
|
86
|
+
"@wordpress/interactivity": "^6.40.1",
|
|
87
|
+
"@wordpress/is-shallow-equal": "^5.40.1",
|
|
88
|
+
"@wordpress/keyboard-shortcuts": "^5.40.1",
|
|
89
|
+
"@wordpress/keycodes": "^4.40.1",
|
|
90
|
+
"@wordpress/notices": "^5.40.1",
|
|
91
|
+
"@wordpress/preferences": "^4.40.1",
|
|
92
|
+
"@wordpress/priority-queue": "^3.40.1",
|
|
93
|
+
"@wordpress/private-apis": "^1.40.1",
|
|
94
|
+
"@wordpress/rich-text": "^7.40.1",
|
|
95
|
+
"@wordpress/style-engine": "^2.40.1",
|
|
96
|
+
"@wordpress/token-list": "^3.40.1",
|
|
97
|
+
"@wordpress/upload-media": "^0.25.2",
|
|
98
|
+
"@wordpress/url": "^4.40.1",
|
|
99
|
+
"@wordpress/warning": "^3.40.1",
|
|
100
|
+
"@wordpress/wordcount": "^4.40.1",
|
|
101
101
|
"change-case": "^4.1.2",
|
|
102
102
|
"clsx": "^2.1.1",
|
|
103
103
|
"colord": "^2.7.0",
|
|
@@ -124,5 +124,5 @@
|
|
|
124
124
|
"publishConfig": {
|
|
125
125
|
"access": "public"
|
|
126
126
|
},
|
|
127
|
-
"gitHead": "
|
|
127
|
+
"gitHead": "adb6623c9f32490cfc73c7ac7f122578c1f10c65"
|
|
128
128
|
}
|
|
@@ -50,10 +50,15 @@ export default function BlockBindingsAttributeControl( {
|
|
|
50
50
|
getBlockType,
|
|
51
51
|
} = unlock( select( blocksStore ) );
|
|
52
52
|
|
|
53
|
-
const
|
|
54
|
-
getBlockType( blockName ).attributes?.[ attribute ]
|
|
53
|
+
const _attribute =
|
|
54
|
+
getBlockType( blockName ).attributes?.[ attribute ];
|
|
55
|
+
|
|
56
|
+
if ( _attribute?.enum ) {
|
|
57
|
+
return {};
|
|
58
|
+
}
|
|
59
|
+
|
|
55
60
|
const attributeType =
|
|
56
|
-
|
|
61
|
+
_attribute?.type === 'rich-text' ? 'string' : _attribute?.type;
|
|
57
62
|
|
|
58
63
|
const sourceFields = {};
|
|
59
64
|
Object.entries( getAllBlockBindingsSources() ).forEach(
|
|
@@ -92,19 +92,21 @@ export default function EditContents( { clientId } ) {
|
|
|
92
92
|
stopEditingContentOnlySection,
|
|
93
93
|
} = useContentOnlySectionEdit( clientId );
|
|
94
94
|
|
|
95
|
-
const { block, onNavigateToEntityRecord } = useSelect(
|
|
95
|
+
const { block, onNavigateToEntityRecord, canEdit } = useSelect(
|
|
96
96
|
( select ) => {
|
|
97
|
-
const { getBlock, getSettings } =
|
|
97
|
+
const { getBlock, getSettings, canEditBlock } =
|
|
98
|
+
select( blockEditorStore );
|
|
98
99
|
return {
|
|
99
100
|
block: getBlock( clientId ),
|
|
100
101
|
onNavigateToEntityRecord:
|
|
101
102
|
getSettings().onNavigateToEntityRecord,
|
|
103
|
+
canEdit: canEditBlock( clientId ),
|
|
102
104
|
};
|
|
103
105
|
},
|
|
104
106
|
[ clientId ]
|
|
105
107
|
);
|
|
106
108
|
|
|
107
|
-
if ( ! isWithinSection && ! isWithinEditedSection ) {
|
|
109
|
+
if ( ! canEdit || ( ! isWithinSection && ! isWithinEditedSection ) ) {
|
|
108
110
|
return null;
|
|
109
111
|
}
|
|
110
112
|
|
|
@@ -6,7 +6,7 @@ import TextareaAutosize from 'react-autosize-textarea';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { useEffect, useState } from '@wordpress/element';
|
|
9
|
+
import { useEffect, useMemo, useState } from '@wordpress/element';
|
|
10
10
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
11
11
|
import {
|
|
12
12
|
getBlockAttributes,
|
|
@@ -28,6 +28,16 @@ function BlockHTML( { clientId } ) {
|
|
|
28
28
|
[ clientId ]
|
|
29
29
|
);
|
|
30
30
|
const { updateBlock } = useDispatch( blockEditorStore );
|
|
31
|
+
|
|
32
|
+
// Derive block content as a primitive string so the effect only fires
|
|
33
|
+
// when the serialized content genuinely changes, not when the block
|
|
34
|
+
// object reference changes (which happens on every RESET_BLOCKS during
|
|
35
|
+
// RTC sync, even for unchanged blocks).
|
|
36
|
+
const blockContent = useMemo(
|
|
37
|
+
() => ( block ? getBlockContent( block ) : '' ),
|
|
38
|
+
[ block ]
|
|
39
|
+
);
|
|
40
|
+
|
|
31
41
|
const onChange = () => {
|
|
32
42
|
const blockType = getBlockType( block.name );
|
|
33
43
|
|
|
@@ -64,8 +74,8 @@ function BlockHTML( { clientId } ) {
|
|
|
64
74
|
};
|
|
65
75
|
|
|
66
76
|
useEffect( () => {
|
|
67
|
-
setHtml(
|
|
68
|
-
}, [
|
|
77
|
+
setHtml( blockContent );
|
|
78
|
+
}, [ blockContent ] );
|
|
69
79
|
|
|
70
80
|
return (
|
|
71
81
|
<TextareaAutosize
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
} from '@wordpress/blocks';
|
|
24
24
|
import { withFilters } from '@wordpress/components';
|
|
25
25
|
import { withDispatch, useSelect } from '@wordpress/data';
|
|
26
|
-
import { compose } from '@wordpress/compose';
|
|
26
|
+
import { compose, useRefEffect } from '@wordpress/compose';
|
|
27
27
|
import { safeHTML } from '@wordpress/dom';
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -741,10 +741,19 @@ function BlockListBlockProvider( props ) {
|
|
|
741
741
|
[ clientId, rootClientId ]
|
|
742
742
|
);
|
|
743
743
|
|
|
744
|
+
const defaultViewRef = useRefEffect( ( element ) => {
|
|
745
|
+
if ( element ) {
|
|
746
|
+
const { ownerDocument } = element;
|
|
747
|
+
const { defaultView } = ownerDocument;
|
|
748
|
+
defaultViewRef.current = defaultView;
|
|
749
|
+
}
|
|
750
|
+
}, [] );
|
|
751
|
+
|
|
744
752
|
// Use block visibility hook with data from existing useSelect to avoid extra subscription
|
|
745
753
|
const { isBlockCurrentlyHidden } = useBlockVisibility( {
|
|
746
754
|
blockVisibility: selectedProps?.blockVisibility,
|
|
747
755
|
deviceType: selectedProps?.deviceType,
|
|
756
|
+
view: defaultViewRef.current,
|
|
748
757
|
} );
|
|
749
758
|
|
|
750
759
|
// Users of the editor.BlockListBlock filter used to be able to
|
|
@@ -191,6 +191,22 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection="true"] .b
|
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
+
// Scrim overlay.
|
|
195
|
+
&.has-warning::after {
|
|
196
|
+
content: "";
|
|
197
|
+
position: absolute;
|
|
198
|
+
top: 0;
|
|
199
|
+
right: 0;
|
|
200
|
+
bottom: 0;
|
|
201
|
+
left: 0;
|
|
202
|
+
background-color: rgba($white, 0.4);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Avoid conflict with the multi-selection highlight color.
|
|
206
|
+
&.has-warning.is-multi-selected::after {
|
|
207
|
+
background-color: transparent;
|
|
208
|
+
}
|
|
209
|
+
|
|
194
210
|
// Clear floats.
|
|
195
211
|
&[data-clear="true"] {
|
|
196
212
|
float: none;
|
|
@@ -390,10 +406,6 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection="true"] .b
|
|
|
390
406
|
font-family: $editor-html-font;
|
|
391
407
|
font-size: $text-editor-font-size;
|
|
392
408
|
line-height: 1.5;
|
|
393
|
-
// HTML input is always LTR regardless of language.
|
|
394
|
-
/*rtl:ignore*/
|
|
395
|
-
direction: ltr;
|
|
396
|
-
|
|
397
409
|
@media not ( prefers-reduced-motion ) {
|
|
398
410
|
transition: padding 0.2s linear;
|
|
399
411
|
}
|
|
@@ -403,6 +415,25 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection="true"] .b
|
|
|
403
415
|
}
|
|
404
416
|
}
|
|
405
417
|
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Warnings.
|
|
421
|
+
*/
|
|
422
|
+
|
|
423
|
+
.block-editor-block-list__block .block-editor-warning {
|
|
424
|
+
z-index: z-index(".block-editor-warning");
|
|
425
|
+
position: relative;
|
|
426
|
+
|
|
427
|
+
&.block-editor-block-list__block-crash-warning {
|
|
428
|
+
// The block crash warning has no block preview underneath it.
|
|
429
|
+
// The lack of a preview combined with the negative margin that
|
|
430
|
+
// the warning normally has results in crashed blocks overlapping
|
|
431
|
+
// any blocks that come after them. Resetting the margin to `auto`
|
|
432
|
+
// solves this.
|
|
433
|
+
margin-bottom: auto;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
406
437
|
.block-editor-block-list__zoom-out-separator {
|
|
407
438
|
/* same color as the iframe's background */
|
|
408
439
|
background: $gray-300;
|
|
@@ -9,7 +9,7 @@ import clsx from 'clsx';
|
|
|
9
9
|
import { useContext } from '@wordpress/element';
|
|
10
10
|
import { __, sprintf } from '@wordpress/i18n';
|
|
11
11
|
import { __unstableGetBlockProps as getBlockProps } from '@wordpress/blocks';
|
|
12
|
-
import { useMergeRefs, useDisabled } from '@wordpress/compose';
|
|
12
|
+
import { useMergeRefs, useDisabled, useRefEffect } from '@wordpress/compose';
|
|
13
13
|
import warning from '@wordpress/warning';
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -107,6 +107,14 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
|
|
|
107
107
|
deviceType,
|
|
108
108
|
} = useContext( PrivateBlockContext );
|
|
109
109
|
|
|
110
|
+
const defaultViewRef = useRefEffect( ( element ) => {
|
|
111
|
+
if ( element ) {
|
|
112
|
+
const { ownerDocument } = element;
|
|
113
|
+
const { defaultView } = ownerDocument;
|
|
114
|
+
defaultViewRef.current = defaultView;
|
|
115
|
+
}
|
|
116
|
+
}, [] );
|
|
117
|
+
|
|
110
118
|
// translators: %s: Type of block (i.e. Text, Image etc)
|
|
111
119
|
const blockLabel = sprintf( __( 'Block: %s' ), blockTitle );
|
|
112
120
|
const htmlSuffix = mode === 'html' && ! __unstableIsHtml ? '-visual' : '';
|
|
@@ -114,6 +122,7 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
|
|
|
114
122
|
const isHoverEnabled = ! isWithinSectionBlock;
|
|
115
123
|
const mergedRefs = useMergeRefs( [
|
|
116
124
|
props.ref,
|
|
125
|
+
defaultViewRef,
|
|
117
126
|
useFocusFirstElement( { clientId, initialPosition } ),
|
|
118
127
|
useBlockRefProvider( clientId ),
|
|
119
128
|
useFocusHandler( clientId ),
|
|
@@ -144,6 +153,7 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
|
|
|
144
153
|
const { isBlockCurrentlyHidden } = useBlockVisibility( {
|
|
145
154
|
blockVisibility,
|
|
146
155
|
deviceType,
|
|
156
|
+
view: defaultViewRef.current,
|
|
147
157
|
} );
|
|
148
158
|
|
|
149
159
|
// Ensures it warns only inside the `edit` implementation for the block.
|
|
@@ -19,7 +19,6 @@ import { Icon, chevronRight } from '@wordpress/icons';
|
|
|
19
19
|
import { store as blockEditorStore } from '../../store';
|
|
20
20
|
import BlockIcon from '../block-icon';
|
|
21
21
|
import useBlockDisplayInformation from '../use-block-display-information';
|
|
22
|
-
import useBlockDisplayTitle from '../block-title/use-block-display-title';
|
|
23
22
|
|
|
24
23
|
export default function BlockQuickNavigation( {
|
|
25
24
|
clientIds,
|
|
@@ -79,11 +78,7 @@ function BlockQuickNavigationItem( {
|
|
|
79
78
|
);
|
|
80
79
|
|
|
81
80
|
const blockType = getBlockType( blockName );
|
|
82
|
-
const
|
|
83
|
-
clientId,
|
|
84
|
-
context: 'list-view',
|
|
85
|
-
} );
|
|
86
|
-
const blockTitle = displayTitle || blockType?.title || blockName;
|
|
81
|
+
const blockTitle = blockType?.title || blockName;
|
|
87
82
|
const { selectBlock } = useDispatch( blockEditorStore );
|
|
88
83
|
|
|
89
84
|
const hasChildren = childBlocks && childBlocks.length > 0;
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from '@wordpress/blocks';
|
|
9
9
|
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
|
|
10
10
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
11
|
-
import {
|
|
11
|
+
import { moreVertical } from '@wordpress/icons';
|
|
12
12
|
import { Children, cloneElement } from '@wordpress/element';
|
|
13
13
|
import { __ } from '@wordpress/i18n';
|
|
14
14
|
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
@@ -74,7 +74,6 @@ export function BlockSettingsDropdown( {
|
|
|
74
74
|
clientIds,
|
|
75
75
|
children,
|
|
76
76
|
__experimentalSelectBlock,
|
|
77
|
-
isContentOnlyListView,
|
|
78
77
|
...props
|
|
79
78
|
} ) {
|
|
80
79
|
// Get the client id of the current block for this menu, if one is set.
|
|
@@ -89,9 +88,6 @@ export function BlockSettingsDropdown( {
|
|
|
89
88
|
isContentOnly,
|
|
90
89
|
isZoomOut,
|
|
91
90
|
canEdit,
|
|
92
|
-
canMove,
|
|
93
|
-
isFirst,
|
|
94
|
-
isLast,
|
|
95
91
|
} = useSelect(
|
|
96
92
|
( select ) => {
|
|
97
93
|
const {
|
|
@@ -103,9 +99,6 @@ export function BlockSettingsDropdown( {
|
|
|
103
99
|
getBlockEditingMode,
|
|
104
100
|
isZoomOut: _isZoomOut,
|
|
105
101
|
canEditBlock,
|
|
106
|
-
canMoveBlocks,
|
|
107
|
-
getBlockIndex,
|
|
108
|
-
getBlockCount,
|
|
109
102
|
} = unlock( select( blockEditorStore ) );
|
|
110
103
|
|
|
111
104
|
const { getActiveBlockVariation } = select( blocksStore );
|
|
@@ -131,21 +124,14 @@ export function BlockSettingsDropdown( {
|
|
|
131
124
|
getBlockEditingMode( firstBlockClientId ) === 'contentOnly',
|
|
132
125
|
isZoomOut: _isZoomOut(),
|
|
133
126
|
canEdit: canEditBlock( firstBlockClientId ),
|
|
134
|
-
canMove: canMoveBlocks( clientIds ),
|
|
135
|
-
isFirst: getBlockIndex( firstBlockClientId ) === 0,
|
|
136
|
-
isLast:
|
|
137
|
-
getBlockIndex( firstBlockClientId ) ===
|
|
138
|
-
getBlockCount( _firstParentClientId ) - 1,
|
|
139
127
|
};
|
|
140
128
|
},
|
|
141
|
-
[ firstBlockClientId
|
|
129
|
+
[ firstBlockClientId ]
|
|
142
130
|
);
|
|
143
131
|
|
|
144
132
|
const { getBlockOrder, getSelectedBlockClientIds } =
|
|
145
133
|
useSelect( blockEditorStore );
|
|
146
134
|
|
|
147
|
-
const { moveBlocksDown, moveBlocksUp } = useDispatch( blockEditorStore );
|
|
148
|
-
|
|
149
135
|
const shortcuts = useSelect( ( select ) => {
|
|
150
136
|
const { getShortcutRepresentation } = select( keyboardShortcutsStore );
|
|
151
137
|
return {
|
|
@@ -257,36 +243,6 @@ export function BlockSettingsDropdown( {
|
|
|
257
243
|
parentBlockType={ parentBlockType }
|
|
258
244
|
/>
|
|
259
245
|
) }
|
|
260
|
-
{ canMove && isContentOnlyListView && (
|
|
261
|
-
<>
|
|
262
|
-
<MenuItem
|
|
263
|
-
icon={ chevronUp }
|
|
264
|
-
disabled={ isFirst }
|
|
265
|
-
accessibleWhenDisabled
|
|
266
|
-
onClick={ pipe( onClose, () => {
|
|
267
|
-
moveBlocksUp(
|
|
268
|
-
clientIds,
|
|
269
|
-
firstParentClientId
|
|
270
|
-
);
|
|
271
|
-
} ) }
|
|
272
|
-
>
|
|
273
|
-
{ __( 'Move up' ) }
|
|
274
|
-
</MenuItem>
|
|
275
|
-
<MenuItem
|
|
276
|
-
icon={ chevronDown }
|
|
277
|
-
disabled={ isLast }
|
|
278
|
-
accessibleWhenDisabled
|
|
279
|
-
onClick={ pipe( onClose, () => {
|
|
280
|
-
moveBlocksDown(
|
|
281
|
-
clientIds,
|
|
282
|
-
firstParentClientId
|
|
283
|
-
);
|
|
284
|
-
} ) }
|
|
285
|
-
>
|
|
286
|
-
{ __( 'Move down' ) }
|
|
287
|
-
</MenuItem>
|
|
288
|
-
</>
|
|
289
|
-
) }
|
|
290
246
|
{ canEdit && count === 1 && (
|
|
291
247
|
<BlockHTMLConvertButton
|
|
292
248
|
clientId={ firstBlockClientId }
|
|
@@ -7,6 +7,7 @@ import clsx from 'clsx';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { useState } from '@wordpress/element';
|
|
10
|
+
import { useSelect } from '@wordpress/data';
|
|
10
11
|
import { debounce, useViewportMatch } from '@wordpress/compose';
|
|
11
12
|
import {
|
|
12
13
|
Button,
|
|
@@ -24,11 +25,16 @@ import BlockStylesPreviewPanel from './preview-panel';
|
|
|
24
25
|
import useStylesForBlocks from './use-styles-for-block';
|
|
25
26
|
import { useToolsPanelDropdownMenuProps } from '../global-styles/utils';
|
|
26
27
|
import { getDefaultStyle } from './utils';
|
|
28
|
+
import { store as blockEditorStore } from '../../store';
|
|
27
29
|
|
|
28
30
|
const noop = () => {};
|
|
29
31
|
|
|
30
32
|
// Block Styles component for the Settings Sidebar.
|
|
31
33
|
function BlockStyles( { clientId, onSwitch = noop, onHoverClassName = noop } ) {
|
|
34
|
+
const canEdit = useSelect(
|
|
35
|
+
( select ) => select( blockEditorStore ).canEditBlock( clientId ),
|
|
36
|
+
[ clientId ]
|
|
37
|
+
);
|
|
32
38
|
const {
|
|
33
39
|
onSelect,
|
|
34
40
|
stylesToRender,
|
|
@@ -43,7 +49,7 @@ function BlockStyles( { clientId, onSwitch = noop, onHoverClassName = noop } ) {
|
|
|
43
49
|
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
44
50
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
45
51
|
|
|
46
|
-
if ( ! stylesToRender || stylesToRender.length === 0 ) {
|
|
52
|
+
if ( ! canEdit || ! stylesToRender || stylesToRender.length === 0 ) {
|
|
47
53
|
return null;
|
|
48
54
|
}
|
|
49
55
|
|
|
@@ -4,14 +4,19 @@
|
|
|
4
4
|
import { MenuItem, __experimentalText as Text } from '@wordpress/components';
|
|
5
5
|
import { check } from '@wordpress/icons';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import useStylesForBlocks from './use-styles-for-block';
|
|
11
|
+
|
|
7
12
|
const noop = () => {};
|
|
8
13
|
|
|
9
|
-
export default function BlockStylesMenuItems( {
|
|
10
|
-
stylesToRender,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
export default function BlockStylesMenuItems( { clientId, onSwitch = noop } ) {
|
|
15
|
+
const { onSelect, stylesToRender, activeStyle } = useStylesForBlocks( {
|
|
16
|
+
clientId,
|
|
17
|
+
onSwitch,
|
|
18
|
+
} );
|
|
19
|
+
|
|
15
20
|
if ( ! stylesToRender || stylesToRender.length === 0 ) {
|
|
16
21
|
return null;
|
|
17
22
|
}
|
|
@@ -24,10 +29,6 @@ export default function BlockStylesMenuItems( {
|
|
|
24
29
|
key={ style.name }
|
|
25
30
|
icon={ activeStyle.name === style.name ? check : null }
|
|
26
31
|
onClick={ () => onSelect( style ) }
|
|
27
|
-
onFocus={ () => onHoverStyle( style ) }
|
|
28
|
-
onBlur={ () => onHoverStyle( null ) }
|
|
29
|
-
onMouseEnter={ () => onHoverStyle( style ) }
|
|
30
|
-
onMouseLeave={ () => onHoverStyle( null ) }
|
|
31
32
|
>
|
|
32
33
|
<Text
|
|
33
34
|
as="span"
|