@wordpress/block-editor 15.11.0 → 15.11.1-next.v.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/build/components/block-controls/index.cjs +1 -1
- package/build/components/block-controls/index.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +6 -19
- package/build/components/block-inspector/index.cjs.map +3 -3
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.cjs +37 -13
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.cjs.map +2 -2
- package/build/components/block-settings-menu-controls/index.cjs +1 -1
- package/build/components/block-settings-menu-controls/index.cjs.map +2 -2
- package/build/components/block-toolbar/index.cjs +1 -1
- package/build/components/block-toolbar/index.cjs.map +2 -2
- package/build/components/block-tools/index.cjs +2 -26
- package/build/components/block-tools/index.cjs.map +2 -2
- package/build/components/block-visibility/index.cjs +7 -9
- package/build/components/block-visibility/index.cjs.map +3 -3
- package/build/components/block-visibility/modal.cjs +13 -11
- package/build/components/block-visibility/modal.cjs.map +2 -2
- package/build/components/block-visibility/use-block-visibility.cjs +1 -1
- package/build/components/block-visibility/use-block-visibility.cjs.map +2 -2
- package/build/components/block-visibility/utils.cjs +5 -1
- package/build/components/block-visibility/utils.cjs.map +2 -2
- package/build/components/block-visibility/viewport-menu-item.cjs +11 -4
- package/build/components/block-visibility/viewport-menu-item.cjs.map +2 -2
- package/build/components/block-visibility/viewport-toolbar.cjs +4 -6
- package/build/components/block-visibility/viewport-toolbar.cjs.map +2 -2
- package/build/components/block-visibility/viewport-visibility-info.cjs +121 -0
- package/build/components/block-visibility/viewport-visibility-info.cjs.map +7 -0
- package/build/components/color-palette/with-color-context.cjs +1 -1
- package/build/components/color-palette/with-color-context.cjs.map +2 -2
- package/build/components/color-style-selector/index.cjs +1 -1
- package/build/components/color-style-selector/index.cjs.map +2 -2
- package/build/components/colors/with-colors.cjs +5 -3
- package/build/components/colors/with-colors.cjs.map +2 -2
- package/build/components/colors-gradients/dropdown.cjs +1 -1
- package/build/components/colors-gradients/dropdown.cjs.map +2 -2
- package/build/components/editable-text/index.cjs +5 -1
- package/build/components/editable-text/index.cjs.map +2 -2
- package/build/components/font-sizes/with-font-sizes.cjs +5 -3
- package/build/components/font-sizes/with-font-sizes.cjs.map +2 -2
- package/build/components/global-styles/advanced-panel.cjs +26 -13
- package/build/components/global-styles/advanced-panel.cjs.map +2 -2
- package/build/components/global-styles/filters-panel.cjs +1 -1
- package/build/components/global-styles/filters-panel.cjs.map +2 -2
- package/build/components/global-styles/shadow-panel-components.cjs +1 -1
- package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
- package/build/components/gradients/with-gradient.cjs +1 -1
- package/build/components/gradients/with-gradient.cjs.map +2 -2
- package/build/components/inspector-controls/fill.cjs +12 -2
- package/build/components/inspector-controls/fill.cjs.map +2 -2
- package/build/components/inspector-controls/index.cjs +1 -1
- package/build/components/inspector-controls/index.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/index.cjs +1 -1
- package/build/components/inspector-controls-tabs/index.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs +2 -2
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs.map +2 -2
- package/build/components/list-view/block-select-button.cjs +8 -16
- package/build/components/list-view/block-select-button.cjs.map +2 -2
- package/build/components/list-view/block.cjs +29 -34
- package/build/components/list-view/block.cjs.map +3 -3
- package/build/components/list-view/utils.cjs +3 -1
- package/build/components/list-view/utils.cjs.map +2 -2
- package/build/components/provider/index.cjs +7 -8
- package/build/components/provider/index.cjs.map +2 -2
- package/build/components/provider/with-registry-provider.cjs +1 -1
- package/build/components/provider/with-registry-provider.cjs.map +2 -2
- package/build/components/use-block-commands/index.cjs +2 -34
- package/build/components/use-block-commands/index.cjs.map +2 -2
- package/build/hooks/cross-origin-isolation.cjs +1 -1
- package/build/hooks/cross-origin-isolation.cjs.map +2 -2
- package/build/hooks/custom-css.cjs +141 -0
- package/build/hooks/custom-css.cjs.map +7 -0
- package/build/hooks/fit-text.cjs +14 -7
- package/build/hooks/fit-text.cjs.map +2 -2
- package/build/hooks/grid-visualizer.cjs +1 -1
- package/build/hooks/grid-visualizer.cjs.map +2 -2
- package/build/hooks/index.cjs +4 -0
- package/build/hooks/index.cjs.map +3 -3
- package/build/hooks/layout.cjs +10 -4
- package/build/hooks/layout.cjs.map +2 -2
- package/build/hooks/list-view.cjs +9 -5
- package/build/hooks/list-view.cjs.map +3 -3
- package/build/hooks/utils.cjs +2 -2
- package/build/hooks/utils.cjs.map +2 -2
- package/build/layouts/grid.cjs +12 -1
- package/build/layouts/grid.cjs.map +2 -2
- package/build/store/defaults.cjs +3 -0
- package/build/store/defaults.cjs.map +2 -2
- package/build/store/private-selectors.cjs +45 -37
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/utils/fit-text-utils.cjs +5 -1
- package/build/utils/fit-text-utils.cjs.map +2 -2
- package/build-module/components/block-controls/index.mjs +1 -1
- package/build-module/components/block-controls/index.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +6 -19
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.mjs +37 -13
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.mjs.map +2 -2
- package/build-module/components/block-settings-menu-controls/index.mjs +2 -2
- package/build-module/components/block-settings-menu-controls/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/index.mjs +2 -2
- package/build-module/components/block-toolbar/index.mjs.map +2 -2
- package/build-module/components/block-tools/index.mjs +2 -26
- package/build-module/components/block-tools/index.mjs.map +2 -2
- package/build-module/components/block-visibility/index.mjs +6 -9
- package/build-module/components/block-visibility/index.mjs.map +2 -2
- package/build-module/components/block-visibility/modal.mjs +13 -11
- package/build-module/components/block-visibility/modal.mjs.map +2 -2
- package/build-module/components/block-visibility/use-block-visibility.mjs +1 -1
- package/build-module/components/block-visibility/use-block-visibility.mjs.map +2 -2
- package/build-module/components/block-visibility/utils.mjs +5 -1
- package/build-module/components/block-visibility/utils.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-menu-item.mjs +11 -4
- package/build-module/components/block-visibility/viewport-menu-item.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-toolbar.mjs +4 -6
- package/build-module/components/block-visibility/viewport-toolbar.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-visibility-info.mjs +95 -0
- package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +7 -0
- package/build-module/components/color-palette/with-color-context.mjs +1 -1
- package/build-module/components/color-palette/with-color-context.mjs.map +2 -2
- package/build-module/components/color-style-selector/index.mjs +1 -1
- package/build-module/components/color-style-selector/index.mjs.map +2 -2
- package/build-module/components/colors/with-colors.mjs +5 -3
- package/build-module/components/colors/with-colors.mjs.map +2 -2
- package/build-module/components/colors-gradients/dropdown.mjs +1 -1
- package/build-module/components/colors-gradients/dropdown.mjs.map +2 -2
- package/build-module/components/editable-text/index.mjs +5 -1
- package/build-module/components/editable-text/index.mjs.map +2 -2
- package/build-module/components/font-sizes/with-font-sizes.mjs +5 -3
- package/build-module/components/font-sizes/with-font-sizes.mjs.map +2 -2
- package/build-module/components/global-styles/advanced-panel.mjs +22 -13
- package/build-module/components/global-styles/advanced-panel.mjs.map +2 -2
- package/build-module/components/global-styles/filters-panel.mjs +1 -1
- package/build-module/components/global-styles/filters-panel.mjs.map +2 -2
- package/build-module/components/global-styles/shadow-panel-components.mjs +1 -1
- package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
- package/build-module/components/gradients/with-gradient.mjs +1 -1
- package/build-module/components/gradients/with-gradient.mjs.map +2 -2
- package/build-module/components/inspector-controls/fill.mjs +12 -2
- package/build-module/components/inspector-controls/fill.mjs.map +2 -2
- package/build-module/components/inspector-controls/index.mjs +1 -1
- package/build-module/components/inspector-controls/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/index.mjs +1 -1
- package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs +2 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs.map +2 -2
- package/build-module/components/list-view/block-select-button.mjs +8 -16
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/block.mjs +31 -36
- package/build-module/components/list-view/block.mjs.map +2 -2
- package/build-module/components/list-view/utils.mjs +3 -1
- package/build-module/components/list-view/utils.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +7 -8
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/with-registry-provider.mjs +1 -1
- package/build-module/components/provider/with-registry-provider.mjs.map +2 -2
- package/build-module/components/use-block-commands/index.mjs +3 -37
- package/build-module/components/use-block-commands/index.mjs.map +2 -2
- package/build-module/hooks/cross-origin-isolation.mjs +1 -1
- package/build-module/hooks/cross-origin-isolation.mjs.map +2 -2
- package/build-module/hooks/custom-css.mjs +112 -0
- package/build-module/hooks/custom-css.mjs.map +7 -0
- package/build-module/hooks/fit-text.mjs +14 -7
- package/build-module/hooks/fit-text.mjs.map +2 -2
- package/build-module/hooks/grid-visualizer.mjs +1 -1
- package/build-module/hooks/grid-visualizer.mjs.map +2 -2
- package/build-module/hooks/index.mjs +4 -0
- package/build-module/hooks/index.mjs.map +2 -2
- package/build-module/hooks/layout.mjs +10 -4
- package/build-module/hooks/layout.mjs.map +2 -2
- package/build-module/hooks/list-view.mjs +10 -6
- package/build-module/hooks/list-view.mjs.map +2 -2
- package/build-module/hooks/utils.mjs +2 -2
- package/build-module/hooks/utils.mjs.map +2 -2
- package/build-module/layouts/grid.mjs +12 -1
- package/build-module/layouts/grid.mjs.map +2 -2
- package/build-module/store/defaults.mjs +3 -0
- package/build-module/store/defaults.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +42 -40
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/utils/fit-text-utils.mjs +5 -1
- package/build-module/utils/fit-text-utils.mjs.map +2 -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-controls/index.js +1 -1
- package/src/components/block-controls/test/index.js +1 -0
- package/src/components/block-edit/test/edit.js +10 -0
- package/src/components/block-inspector/index.js +14 -32
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +49 -29
- package/src/components/block-preview/test/index.js +11 -7
- package/src/components/block-settings-menu-controls/index.js +2 -2
- package/src/components/block-switcher/test/index.js +2 -0
- package/src/components/block-switcher/test/use-transformed.patterns.js +2 -0
- package/src/components/block-switcher/test/utils.js +2 -0
- package/src/components/block-toolbar/index.js +2 -2
- package/src/components/block-tools/index.js +2 -29
- package/src/components/block-visibility/index.js +3 -19
- package/src/components/block-visibility/modal.js +16 -14
- package/src/components/block-visibility/test/use-block-visibility.js +27 -25
- package/src/components/block-visibility/test/utils.js +24 -8
- package/src/components/block-visibility/use-block-visibility.js +1 -4
- package/src/components/block-visibility/utils.js +9 -1
- package/src/components/block-visibility/viewport-menu-item.js +11 -5
- package/src/components/block-visibility/viewport-toolbar.js +5 -6
- package/src/components/block-visibility/viewport-visibility-info.js +131 -0
- package/src/components/color-palette/with-color-context.js +1 -1
- package/src/components/color-style-selector/index.js +2 -3
- package/src/components/colors/with-colors.js +23 -20
- package/src/components/colors-gradients/dropdown.js +2 -3
- package/src/components/editable-text/index.js +5 -1
- package/src/components/font-sizes/with-font-sizes.js +13 -10
- package/src/components/global-styles/advanced-panel.js +35 -16
- package/src/components/global-styles/filters-panel.js +2 -3
- package/src/components/global-styles/shadow-panel-components.js +1 -1
- package/src/components/global-styles/style.scss +9 -5
- package/src/components/gradients/with-gradient.js +7 -4
- package/src/components/inner-blocks/test/index.js +2 -0
- package/src/components/inspector-controls/fill.js +25 -5
- package/src/components/inspector-controls/index.js +1 -1
- package/src/components/inspector-controls-tabs/index.js +5 -1
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -4
- package/src/components/link-control/test/index.js +6 -1
- package/src/components/list-view/block-select-button.js +16 -25
- package/src/components/list-view/block.js +38 -43
- package/src/components/list-view/utils.js +4 -2
- package/src/components/media-replace-flow/test/index.js +13 -11
- package/src/components/provider/index.js +11 -10
- package/src/components/provider/test/use-block-sync.js +1 -0
- package/src/components/provider/with-registry-provider.js +1 -1
- package/src/components/use-block-commands/index.js +0 -41
- package/src/hooks/cross-origin-isolation.js +19 -18
- package/src/hooks/custom-css.js +176 -0
- package/src/hooks/fit-text.js +20 -5
- package/src/hooks/grid-visualizer.js +15 -14
- package/src/hooks/index.js +4 -0
- package/src/hooks/layout.js +55 -43
- package/src/hooks/list-view.js +10 -6
- package/src/hooks/test/align.js +1 -0
- package/src/hooks/test/allowed-blocks.js +8 -0
- package/src/hooks/test/auto-inspector-controls.js +4 -0
- package/src/hooks/test/font-size.js +1 -0
- package/src/hooks/test/metadata.js +4 -0
- package/src/hooks/test/text-align.js +1 -0
- package/src/hooks/utils.js +123 -119
- package/src/layouts/grid.js +19 -3
- package/src/layouts/test/grid.js +1 -1
- package/src/store/defaults.js +4 -0
- package/src/store/private-selectors.js +94 -63
- package/src/store/test/actions.js +7 -0
- package/src/store/test/private-selectors.js +116 -119
- package/src/store/test/reducer.js +4 -0
- package/src/store/test/registry-selectors.js +2 -0
- package/src/store/test/selectors.js +19 -0
- package/src/utils/fit-text-utils.js +12 -2
- package/build/components/block-visibility/block-visibility-info.cjs +0 -63
- package/build/components/block-visibility/block-visibility-info.cjs.map +0 -7
- package/build/components/block-visibility/menu-item.cjs +0 -109
- package/build/components/block-visibility/menu-item.cjs.map +0 -7
- package/build/components/block-visibility/toolbar.cjs +0 -92
- package/build/components/block-visibility/toolbar.cjs.map +0 -7
- package/build-module/components/block-visibility/block-visibility-info.mjs +0 -47
- package/build-module/components/block-visibility/block-visibility-info.mjs.map +0 -7
- package/build-module/components/block-visibility/menu-item.mjs +0 -88
- package/build-module/components/block-visibility/menu-item.mjs.map +0 -7
- package/build-module/components/block-visibility/toolbar.mjs +0 -71
- package/build-module/components/block-visibility/toolbar.mjs.map +0 -7
- package/src/components/block-visibility/block-visibility-info.js +0 -62
- package/src/components/block-visibility/menu-item.js +0 -96
- package/src/components/block-visibility/toolbar.js +0 -88
|
@@ -136,7 +136,7 @@ export function ShadowPopover( { shadow, onShadowChange, settings } ) {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
function renderShadowToggle( shadow, onShadowChange ) {
|
|
139
|
-
return ( { onToggle, isOpen } )
|
|
139
|
+
return function ShadowToggle( { onToggle, isOpen } ) {
|
|
140
140
|
const shadowButtonRef = useRef( undefined );
|
|
141
141
|
|
|
142
142
|
const toggleProps = {
|
|
@@ -100,11 +100,15 @@
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
.block-editor-global-styles-advanced-panel__custom-css-input
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
.block-editor-global-styles-advanced-panel__custom-css-input {
|
|
104
|
+
margin-bottom: $grid-unit-20;
|
|
105
|
+
|
|
106
|
+
textarea {
|
|
107
|
+
font-family: $editor_html_font;
|
|
108
|
+
// CSS input is always LTR regardless of language.
|
|
109
|
+
/*rtl:ignore*/
|
|
110
|
+
direction: ltr;
|
|
111
|
+
}
|
|
108
112
|
}
|
|
109
113
|
|
|
110
114
|
.block-editor-panel-duotone-settings__reset {
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __experimentalUseGradient } from './use-gradient';
|
|
5
5
|
|
|
6
|
-
export const withGradient = ( WrappedComponent ) =>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
export const withGradient = ( WrappedComponent ) =>
|
|
7
|
+
function WithGradient( props ) {
|
|
8
|
+
const { gradientValue } = __experimentalUseGradient();
|
|
9
|
+
return (
|
|
10
|
+
<WrappedComponent { ...props } gradientValue={ gradientValue } />
|
|
11
|
+
);
|
|
12
|
+
};
|
|
@@ -27,6 +27,7 @@ describe( 'InnerBlocks', () => {
|
|
|
27
27
|
|
|
28
28
|
it( 'should return element as string, with inner blocks', () => {
|
|
29
29
|
registerBlockType( 'core/fruit', {
|
|
30
|
+
apiVersion: 3,
|
|
30
31
|
category: 'text',
|
|
31
32
|
|
|
32
33
|
title: 'fruit',
|
|
@@ -62,6 +63,7 @@ describe( 'InnerBlocks', () => {
|
|
|
62
63
|
|
|
63
64
|
it( 'should force serialize for invalid block with inner blocks', () => {
|
|
64
65
|
const blockType = {
|
|
66
|
+
apiVersion: 3,
|
|
65
67
|
attributes: {
|
|
66
68
|
throw: {
|
|
67
69
|
type: 'boolean',
|
|
@@ -19,6 +19,9 @@ import {
|
|
|
19
19
|
} from '../block-edit/context';
|
|
20
20
|
import groups from './groups';
|
|
21
21
|
|
|
22
|
+
const PATTERN_EDITING_GROUPS = [ 'content', 'list' ];
|
|
23
|
+
const TEMPLATE_PART_GROUPS = [ 'default', 'settings', 'advanced' ];
|
|
24
|
+
|
|
22
25
|
export default function InspectorControlsFill( {
|
|
23
26
|
children,
|
|
24
27
|
group = 'default',
|
|
@@ -43,13 +46,30 @@ export default function InspectorControlsFill( {
|
|
|
43
46
|
warning( `Unknown InspectorControls group "${ group }" provided.` );
|
|
44
47
|
return null;
|
|
45
48
|
}
|
|
46
|
-
const shouldDisplayForPatternEditing =
|
|
47
|
-
context[ mayDisplayPatternEditingControlsKey ] &&
|
|
48
|
-
( group === 'list' || group === 'content' );
|
|
49
49
|
|
|
50
|
+
// During pattern editing:
|
|
51
|
+
// - All blocks can show pattern editing groups (content, list).
|
|
52
|
+
// - Template parts can show a settings tab (default, settings, advanced groups).
|
|
53
|
+
// - Other blocks cannot show a settings tab.
|
|
54
|
+
if ( context[ mayDisplayPatternEditingControlsKey ] ) {
|
|
55
|
+
// Template parts are allowed to show a settings tab to allow access to the
|
|
56
|
+
// 'Design' and 'Advanced' panels.
|
|
57
|
+
const isTemplatePart = context.name === 'core/template-part';
|
|
58
|
+
const isTemplatePartGroup = TEMPLATE_PART_GROUPS.includes( group );
|
|
59
|
+
const isPatternEditingGroup = PATTERN_EDITING_GROUPS.includes( group );
|
|
60
|
+
|
|
61
|
+
const canShowGroup =
|
|
62
|
+
( isTemplatePart && isTemplatePartGroup ) || isPatternEditingGroup;
|
|
63
|
+
|
|
64
|
+
if ( ! canShowGroup ) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Outside pattern editing, use the standard rules for displaying controls.
|
|
50
70
|
if (
|
|
51
|
-
! context[
|
|
52
|
-
!
|
|
71
|
+
! context[ mayDisplayPatternEditingControlsKey ] &&
|
|
72
|
+
! context[ mayDisplayControlsKey ]
|
|
53
73
|
) {
|
|
54
74
|
return null;
|
|
55
75
|
}
|
|
@@ -12,7 +12,7 @@ InspectorControls.Slot = InspectorControlsSlot;
|
|
|
12
12
|
export const InspectorAdvancedControls = ( props ) => {
|
|
13
13
|
return <InspectorControlsFill { ...props } group="advanced" />;
|
|
14
14
|
};
|
|
15
|
-
InspectorAdvancedControls.Slot = ( props )
|
|
15
|
+
InspectorAdvancedControls.Slot = function Slot( props ) {
|
|
16
16
|
return <InspectorControlsSlot { ...props } group="advanced" />;
|
|
17
17
|
};
|
|
18
18
|
InspectorAdvancedControls.slotName = 'InspectorAdvancedControls';
|
|
@@ -44,7 +44,11 @@ export default function InspectorControlsTabs( {
|
|
|
44
44
|
|
|
45
45
|
// Auto-select first available tab unless user has made a selection
|
|
46
46
|
useEffect( () => {
|
|
47
|
-
if (
|
|
47
|
+
if (
|
|
48
|
+
! tabs?.length ||
|
|
49
|
+
( hasUserSelectionRef.current &&
|
|
50
|
+
tabs.some( ( tab ) => tab.name === selectedTabId ) )
|
|
51
|
+
) {
|
|
48
52
|
return;
|
|
49
53
|
}
|
|
50
54
|
|
|
@@ -104,10 +104,9 @@ export default function useInspectorControlsTabs(
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
if (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
! isSectionBlock
|
|
107
|
+
settingsFills.length ||
|
|
108
|
+
// Advanced fills show up in settings tab if available or they blend into the default tab, if there's only one tab.
|
|
109
|
+
( advancedFills.length && ( hasContentTab || hasListFills ) )
|
|
111
110
|
) {
|
|
112
111
|
tabs.push( TAB_SETTINGS );
|
|
113
112
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
5
|
fireEvent,
|
|
6
|
-
render,
|
|
6
|
+
render as baseRender,
|
|
7
7
|
screen,
|
|
8
8
|
waitFor,
|
|
9
9
|
within,
|
|
@@ -13,6 +13,7 @@ import userEvent from '@testing-library/user-event';
|
|
|
13
13
|
/**
|
|
14
14
|
* WordPress dependencies
|
|
15
15
|
*/
|
|
16
|
+
import { SlotFillProvider } from '@wordpress/components';
|
|
16
17
|
import { useState, createElement } from '@wordpress/element';
|
|
17
18
|
import { useSelect } from '@wordpress/data';
|
|
18
19
|
|
|
@@ -79,6 +80,10 @@ afterEach( () => {
|
|
|
79
80
|
mockFetchRichUrlData?.mockReset(); // Conditionally reset as it may NOT be a mock.
|
|
80
81
|
} );
|
|
81
82
|
|
|
83
|
+
function render( ui ) {
|
|
84
|
+
return baseRender( ui, { wrapper: SlotFillProvider } );
|
|
85
|
+
}
|
|
86
|
+
|
|
82
87
|
/**
|
|
83
88
|
* Workaround to trigger an arrow up keypress event.
|
|
84
89
|
*
|
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
} from '@wordpress/icons';
|
|
22
22
|
import { SPACE, ENTER } from '@wordpress/keycodes';
|
|
23
23
|
import { useSelect } from '@wordpress/data';
|
|
24
|
-
import { hasBlockSupport } from '@wordpress/blocks';
|
|
25
24
|
|
|
26
25
|
/**
|
|
27
26
|
* Internal dependencies
|
|
@@ -61,30 +60,22 @@ function ListViewBlockSelectButton(
|
|
|
61
60
|
context: 'list-view',
|
|
62
61
|
} );
|
|
63
62
|
const { isLocked } = useBlockLock( clientId );
|
|
64
|
-
const {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
isBlockHidden: areBlocksHiddenAnywhere( [ clientId ] ),
|
|
80
|
-
hasPatternName: !! blockAttributes?.metadata?.patternName,
|
|
81
|
-
};
|
|
82
|
-
},
|
|
83
|
-
[ clientId ]
|
|
84
|
-
);
|
|
63
|
+
const { isBlockHidden, hasPatternName } = useSelect(
|
|
64
|
+
( select ) => {
|
|
65
|
+
const {
|
|
66
|
+
isBlockHiddenAnywhere: _isBlockHidden,
|
|
67
|
+
getBlockAttributes,
|
|
68
|
+
} = unlock( select( blockEditorStore ) );
|
|
69
|
+
return {
|
|
70
|
+
isBlockHidden: _isBlockHidden( clientId ),
|
|
71
|
+
hasPatternName:
|
|
72
|
+
!! getBlockAttributes( clientId )?.metadata?.patternName,
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
[ clientId ]
|
|
76
|
+
);
|
|
77
|
+
|
|
85
78
|
const shouldShowLockIcon = isLocked;
|
|
86
|
-
const shouldShowBlockVisibilityIcon =
|
|
87
|
-
canToggleBlockVisibility && isBlockHidden;
|
|
88
79
|
const isSticky = blockInformation?.positionType === 'sticky';
|
|
89
80
|
const images = useListViewImages( { clientId, isExpanded } );
|
|
90
81
|
|
|
@@ -170,7 +161,7 @@ function ListViewBlockSelectButton(
|
|
|
170
161
|
) ) }
|
|
171
162
|
</span>
|
|
172
163
|
) : null }
|
|
173
|
-
{
|
|
164
|
+
{ isBlockHidden && (
|
|
174
165
|
<span className="block-editor-list-view-block-select-button__block-visibility">
|
|
175
166
|
<Icon icon={ unseen } />
|
|
176
167
|
</span>
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
memo,
|
|
26
26
|
} from '@wordpress/element';
|
|
27
27
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
28
|
-
import { __ } from '@wordpress/i18n';
|
|
28
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
29
29
|
import { BACKSPACE, DELETE } from '@wordpress/keycodes';
|
|
30
30
|
import { isShallowEqual } from '@wordpress/is-shallow-equal';
|
|
31
31
|
import { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';
|
|
@@ -53,8 +53,9 @@ import { useBlockLock } from '../block-lock';
|
|
|
53
53
|
import AriaReferencedText from './aria-referenced-text';
|
|
54
54
|
import { unlock } from '../../lock-unlock';
|
|
55
55
|
import usePasteStyles from '../use-paste-styles';
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
56
|
+
import { useBlockVisibility, BlockVisibilityModal } from '../block-visibility';
|
|
57
|
+
import { deviceTypeKey } from '../../store/private-keys';
|
|
58
|
+
import { BLOCK_VISIBILITY_VIEWPORTS } from '../block-visibility/constants';
|
|
58
59
|
|
|
59
60
|
function ListViewBlock( {
|
|
60
61
|
block: { clientId },
|
|
@@ -98,7 +99,6 @@ function ListViewBlock( {
|
|
|
98
99
|
removeBlocks,
|
|
99
100
|
insertAfterBlock,
|
|
100
101
|
insertBeforeBlock,
|
|
101
|
-
updateBlockAttributes,
|
|
102
102
|
} = unlock( useDispatch( blockEditorStore ) );
|
|
103
103
|
|
|
104
104
|
const debouncedToggleBlockHighlight = useDebounce(
|
|
@@ -125,29 +125,52 @@ function ListViewBlock( {
|
|
|
125
125
|
|
|
126
126
|
const pasteStyles = usePasteStyles();
|
|
127
127
|
|
|
128
|
-
const { block, blockName, allowRightClickOverrides,
|
|
128
|
+
const { block, blockName, allowRightClickOverrides, selectedDeviceType } =
|
|
129
129
|
useSelect(
|
|
130
130
|
( select ) => {
|
|
131
|
-
const {
|
|
132
|
-
getBlock,
|
|
133
|
-
getBlockName: _getBlockName,
|
|
134
|
-
getSettings,
|
|
135
|
-
} = select( blockEditorStore );
|
|
136
|
-
const { isBlockHidden: _isBlockHidden } = unlock(
|
|
131
|
+
const { getBlock, getBlockName, getSettings } = unlock(
|
|
137
132
|
select( blockEditorStore )
|
|
138
133
|
);
|
|
139
134
|
|
|
140
135
|
return {
|
|
141
136
|
block: getBlock( clientId ),
|
|
142
|
-
blockName:
|
|
137
|
+
blockName: getBlockName( clientId ),
|
|
143
138
|
allowRightClickOverrides:
|
|
144
139
|
getSettings().allowRightClickOverrides,
|
|
145
|
-
|
|
140
|
+
selectedDeviceType:
|
|
141
|
+
getSettings()?.[ deviceTypeKey ]?.toLowerCase() ||
|
|
142
|
+
BLOCK_VISIBILITY_VIEWPORTS.desktop.value,
|
|
146
143
|
};
|
|
147
144
|
},
|
|
148
145
|
[ clientId ]
|
|
149
146
|
);
|
|
150
147
|
|
|
148
|
+
// Use hook to get current viewport and if block is currently hidden (accurate viewport detection)
|
|
149
|
+
const { isBlockCurrentlyHidden, currentViewport } = useBlockVisibility( {
|
|
150
|
+
blockVisibility: block?.attributes?.metadata?.blockVisibility,
|
|
151
|
+
deviceType: selectedDeviceType,
|
|
152
|
+
} );
|
|
153
|
+
|
|
154
|
+
// Determine label based on whether block or parent is hidden
|
|
155
|
+
const blockVisibilityDescription = useMemo( () => {
|
|
156
|
+
if ( isBlockCurrentlyHidden ) {
|
|
157
|
+
if ( block?.attributes?.metadata?.blockVisibility === false ) {
|
|
158
|
+
return __( 'Block is hidden' );
|
|
159
|
+
}
|
|
160
|
+
return sprintf(
|
|
161
|
+
/* translators: %s: viewport name (Desktop, Tablet, Mobile) */
|
|
162
|
+
__( 'Block is hidden on %s' ),
|
|
163
|
+
BLOCK_VISIBILITY_VIEWPORTS[ currentViewport ]?.label ||
|
|
164
|
+
currentViewport
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
return null;
|
|
168
|
+
}, [
|
|
169
|
+
isBlockCurrentlyHidden,
|
|
170
|
+
block?.attributes?.metadata?.blockVisibility,
|
|
171
|
+
currentViewport,
|
|
172
|
+
] );
|
|
173
|
+
|
|
151
174
|
const showBlockActions =
|
|
152
175
|
// When a block hides its toolbar it also hides the block settings menu,
|
|
153
176
|
// since that menu is part of the toolbar in the editor canvas.
|
|
@@ -387,32 +410,8 @@ function ListViewBlock( {
|
|
|
387
410
|
return;
|
|
388
411
|
}
|
|
389
412
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
setVisibilityModalClientIds( blocksToUpdate );
|
|
393
|
-
} else {
|
|
394
|
-
const hasHiddenBlock = blocks.some(
|
|
395
|
-
( blockToUpdate ) =>
|
|
396
|
-
blockToUpdate.attributes.metadata?.blockVisibility ===
|
|
397
|
-
false
|
|
398
|
-
);
|
|
399
|
-
const attributesByClientId = Object.fromEntries(
|
|
400
|
-
blocks.map( ( { clientId: mapClientId, attributes } ) => [
|
|
401
|
-
mapClientId,
|
|
402
|
-
{
|
|
403
|
-
metadata: cleanEmptyObject( {
|
|
404
|
-
...attributes?.metadata,
|
|
405
|
-
blockVisibility: hasHiddenBlock
|
|
406
|
-
? undefined
|
|
407
|
-
: false,
|
|
408
|
-
} ),
|
|
409
|
-
},
|
|
410
|
-
] )
|
|
411
|
-
);
|
|
412
|
-
updateBlockAttributes( blocksToUpdate, attributesByClientId, {
|
|
413
|
-
uniqueByBlock: true,
|
|
414
|
-
} );
|
|
415
|
-
}
|
|
413
|
+
// Open the visibility breakpoints modal.
|
|
414
|
+
setVisibilityModalClientIds( blocksToUpdate );
|
|
416
415
|
}
|
|
417
416
|
}
|
|
418
417
|
|
|
@@ -540,10 +539,6 @@ function ListViewBlock( {
|
|
|
540
539
|
isLocked
|
|
541
540
|
);
|
|
542
541
|
|
|
543
|
-
const blockVisibilityDescription = isBlockHidden
|
|
544
|
-
? __( 'Block is hidden.' )
|
|
545
|
-
: null;
|
|
546
|
-
|
|
547
542
|
const hasSiblings = siblingBlockCount > 0;
|
|
548
543
|
const hasRenderedMovers = showBlockMovers && hasSiblings;
|
|
549
544
|
const moverCellClassName = clsx(
|
|
@@ -113,8 +113,10 @@ export function focusListItem( focusClientId, treeGridElement ) {
|
|
|
113
113
|
resolve( null );
|
|
114
114
|
}, 3000 );
|
|
115
115
|
} ).then( ( element ) => {
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
if ( element && element.isConnected ) {
|
|
117
|
+
// Focus the first focusable in the row, which is the ListViewBlockSelectButton.
|
|
118
|
+
focus.focusable.find( element )?.[ 0 ]?.focus();
|
|
119
|
+
}
|
|
118
120
|
} );
|
|
119
121
|
}
|
|
120
122
|
|
|
@@ -8,7 +8,7 @@ import userEvent from '@testing-library/user-event';
|
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
10
|
import { useState } from '@wordpress/element';
|
|
11
|
-
|
|
11
|
+
import { SlotFillProvider } from '@wordpress/components';
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
@@ -19,16 +19,18 @@ const noop = () => {};
|
|
|
19
19
|
function TestWrapper() {
|
|
20
20
|
const [ mediaURL, setMediaURL ] = useState( 'https://example.media' );
|
|
21
21
|
return (
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
<SlotFillProvider>
|
|
23
|
+
<MediaReplaceFlow
|
|
24
|
+
mediaId={ 1 }
|
|
25
|
+
mediaURL={ mediaURL }
|
|
26
|
+
allowedTypes={ [ 'png' ] }
|
|
27
|
+
accept="image/*"
|
|
28
|
+
onSelect={ noop }
|
|
29
|
+
onSelectURL={ setMediaURL }
|
|
30
|
+
onError={ noop }
|
|
31
|
+
onCloseModal={ noop }
|
|
32
|
+
/>
|
|
33
|
+
</SlotFillProvider>
|
|
32
34
|
);
|
|
33
35
|
}
|
|
34
36
|
|
|
@@ -71,18 +71,19 @@ export const ExperimentalBlockEditorProvider = withRegistryProvider(
|
|
|
71
71
|
|
|
72
72
|
const mediaUploadSettings = useMediaUploadSettings( _settings );
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
const settings = useMemo( () => {
|
|
75
|
+
if (
|
|
76
|
+
window.__experimentalMediaProcessing &&
|
|
77
|
+
_settings?.mediaUpload
|
|
78
|
+
) {
|
|
79
|
+
// Create a new object so that the original props.settings.mediaUpload is not modified.
|
|
80
|
+
return {
|
|
80
81
|
..._settings,
|
|
81
82
|
mediaUpload: mediaUpload.bind( null, registry ),
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return _settings;
|
|
86
|
+
}, [ _settings, registry ] );
|
|
86
87
|
|
|
87
88
|
const { __experimentalUpdateSettings } = unlock(
|
|
88
89
|
useDispatch( blockEditorStore )
|
|
@@ -26,7 +26,7 @@ function getSubRegistry( subRegistries, registry, useSubRegistry ) {
|
|
|
26
26
|
|
|
27
27
|
const withRegistryProvider = createHigherOrderComponent(
|
|
28
28
|
( WrappedComponent ) =>
|
|
29
|
-
( { useSubRegistry = true, ...props } )
|
|
29
|
+
function WithRegistryProvider( { useSubRegistry = true, ...props } ) {
|
|
30
30
|
const registry = useRegistry();
|
|
31
31
|
const [ subRegistries ] = useState( () => new WeakMap() );
|
|
32
32
|
const subRegistry = getSubRegistry(
|
|
@@ -16,8 +16,6 @@ import {
|
|
|
16
16
|
plus as add,
|
|
17
17
|
group,
|
|
18
18
|
ungroup,
|
|
19
|
-
seen,
|
|
20
|
-
unseen,
|
|
21
19
|
} from '@wordpress/icons';
|
|
22
20
|
|
|
23
21
|
/**
|
|
@@ -25,7 +23,6 @@ import {
|
|
|
25
23
|
*/
|
|
26
24
|
import BlockIcon from '../block-icon';
|
|
27
25
|
import { store as blockEditorStore } from '../../store';
|
|
28
|
-
import { cleanEmptyObject } from '../../hooks/utils';
|
|
29
26
|
|
|
30
27
|
const getTransformCommands = () =>
|
|
31
28
|
function useTransformCommands() {
|
|
@@ -160,7 +157,6 @@ const getQuickActionsCommands = () =>
|
|
|
160
157
|
getBlockRootClientId,
|
|
161
158
|
getBlocksByClientId,
|
|
162
159
|
canRemoveBlocks,
|
|
163
|
-
getBlockName,
|
|
164
160
|
} = useSelect( blockEditorStore );
|
|
165
161
|
const { getDefaultBlockName, getGroupingBlockName } =
|
|
166
162
|
useSelect( blocksStore );
|
|
@@ -173,7 +169,6 @@ const getQuickActionsCommands = () =>
|
|
|
173
169
|
duplicateBlocks,
|
|
174
170
|
insertAfterBlock,
|
|
175
171
|
insertBeforeBlock,
|
|
176
|
-
updateBlockAttributes,
|
|
177
172
|
} = useDispatch( blockEditorStore );
|
|
178
173
|
|
|
179
174
|
const onGroup = () => {
|
|
@@ -223,11 +218,6 @@ const getQuickActionsCommands = () =>
|
|
|
223
218
|
} );
|
|
224
219
|
const canRemove = canRemoveBlocks( clientIds );
|
|
225
220
|
|
|
226
|
-
const canToggleBlockVisibility =
|
|
227
|
-
blocks.every( ( { clientId } ) =>
|
|
228
|
-
hasBlockSupport( getBlockName( clientId ), 'visibility', true )
|
|
229
|
-
) && ! window.__experimentalHideBlocksBasedOnScreenSize;
|
|
230
|
-
|
|
231
221
|
const commands = [];
|
|
232
222
|
|
|
233
223
|
if ( canDuplicate ) {
|
|
@@ -293,37 +283,6 @@ const getQuickActionsCommands = () =>
|
|
|
293
283
|
} );
|
|
294
284
|
}
|
|
295
285
|
|
|
296
|
-
if ( canToggleBlockVisibility ) {
|
|
297
|
-
const hasHiddenBlock = blocks.some(
|
|
298
|
-
( block ) =>
|
|
299
|
-
block.attributes.metadata?.blockVisibility === false
|
|
300
|
-
);
|
|
301
|
-
|
|
302
|
-
commands.push( {
|
|
303
|
-
name: 'core/toggle-block-visibility',
|
|
304
|
-
label: hasHiddenBlock ? __( 'Show' ) : __( 'Hide' ),
|
|
305
|
-
callback: () => {
|
|
306
|
-
const attributesByClientId = Object.fromEntries(
|
|
307
|
-
blocks?.map( ( { clientId, attributes } ) => [
|
|
308
|
-
clientId,
|
|
309
|
-
{
|
|
310
|
-
metadata: cleanEmptyObject( {
|
|
311
|
-
...attributes?.metadata,
|
|
312
|
-
blockVisibility: hasHiddenBlock
|
|
313
|
-
? undefined
|
|
314
|
-
: false,
|
|
315
|
-
} ),
|
|
316
|
-
},
|
|
317
|
-
] )
|
|
318
|
-
);
|
|
319
|
-
updateBlockAttributes( clientIds, attributesByClientId, {
|
|
320
|
-
uniqueByBlock: true,
|
|
321
|
-
} );
|
|
322
|
-
},
|
|
323
|
-
icon: hasHiddenBlock ? seen : unseen,
|
|
324
|
-
} );
|
|
325
|
-
}
|
|
326
|
-
|
|
327
286
|
return {
|
|
328
287
|
isLoading: false,
|
|
329
288
|
commands: commands.map( ( command ) => ( {
|
|
@@ -113,25 +113,26 @@ if ( window.crossOriginIsolated ) {
|
|
|
113
113
|
'credentialless' in window.HTMLIFrameElement.prototype;
|
|
114
114
|
|
|
115
115
|
const disableEmbedPreviews = createHigherOrderComponent(
|
|
116
|
-
( BlockEdit ) =>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
116
|
+
( BlockEdit ) =>
|
|
117
|
+
function DisableEmbedPreviews( props ) {
|
|
118
|
+
if ( 'core/embed' !== props.name ) {
|
|
119
|
+
return <BlockEdit { ...props } />;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// List of embeds that do not support a preview is from packages/block-library/src/embed/variations.js.
|
|
123
|
+
const previewable =
|
|
124
|
+
supportsCredentialless &&
|
|
125
|
+
! [ 'facebook', 'smugmug' ].includes(
|
|
126
|
+
props.attributes.providerNameSlug
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<BlockEdit
|
|
131
|
+
{ ...props }
|
|
132
|
+
attributes={ { ...props.attributes, previewable } }
|
|
133
|
+
/>
|
|
126
134
|
);
|
|
127
|
-
|
|
128
|
-
return (
|
|
129
|
-
<BlockEdit
|
|
130
|
-
{ ...props }
|
|
131
|
-
attributes={ { ...props.attributes, previewable } }
|
|
132
|
-
/>
|
|
133
|
-
);
|
|
134
|
-
},
|
|
135
|
+
},
|
|
135
136
|
'withDisabledEmbedPreview'
|
|
136
137
|
);
|
|
137
138
|
|