@wordpress/block-editor 15.17.0 → 15.18.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 +6 -0
- package/build/components/autocomplete/index.cjs.map +3 -3
- package/build/components/background-image-control/index.cjs +2 -1
- package/build/components/background-image-control/index.cjs.map +2 -2
- package/build/components/block-allowed-blocks/modal.cjs.map +2 -2
- package/build/components/block-bindings/attribute-control.cjs.map +3 -3
- package/build/components/block-card/index.cjs +2 -2
- package/build/components/block-card/index.cjs.map +3 -3
- package/build/components/block-mover/button.cjs +9 -3
- package/build/components/block-mover/button.cjs.map +2 -2
- package/build/components/block-pattern-setup/index.cjs +3 -2
- package/build/components/block-pattern-setup/index.cjs.map +2 -2
- package/build/components/block-patterns-list/index.cjs +2 -1
- package/build/components/block-patterns-list/index.cjs.map +2 -2
- package/build/components/block-patterns-paging/index.cjs.map +3 -3
- package/build/components/block-settings-menu/block-settings-dropdown.cjs +2 -2
- package/build/components/block-settings-menu/block-settings-dropdown.cjs.map +3 -3
- package/build/components/block-settings-menu/index.cjs +2 -2
- package/build/components/block-settings-menu/index.cjs.map +3 -3
- package/build/components/block-styles/menu-items.cjs.map +3 -3
- package/build/components/block-switcher/index.cjs.map +3 -3
- package/build/components/block-switcher/pattern-transformations-menu.cjs +2 -1
- package/build/components/block-switcher/pattern-transformations-menu.cjs.map +2 -2
- package/build/components/block-toolbar/pattern-overrides-dropdown.cjs.map +3 -3
- package/build/components/block-variation-transforms/index.cjs +2 -1
- package/build/components/block-variation-transforms/index.cjs.map +2 -2
- package/build/components/block-visibility/viewport-visibility-info.cjs +4 -4
- package/build/components/block-visibility/viewport-visibility-info.cjs.map +3 -3
- package/build/components/collab/{block-comment-icon-slot.cjs → note-icon-slot.cjs} +8 -8
- package/build/components/collab/note-icon-slot.cjs.map +7 -0
- package/build/components/collab/{block-comment-icon-toolbar-slot.cjs → note-icon-toolbar-slot.cjs} +9 -9
- package/build/components/collab/note-icon-toolbar-slot.cjs.map +7 -0
- package/build/components/date-format-picker/index.cjs +2 -1
- package/build/components/date-format-picker/index.cjs.map +2 -2
- package/build/components/global-styles/color-panel.cjs.map +2 -2
- package/build/components/global-styles/dimensions-panel.cjs +87 -62
- package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
- package/build/components/global-styles/filters-panel.cjs.map +2 -2
- package/build/components/global-styles/hooks.cjs +9 -7
- package/build/components/global-styles/hooks.cjs.map +2 -2
- package/build/components/grid/grid-item-movers.cjs +2 -1
- package/build/components/grid/grid-item-movers.cjs.map +2 -2
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.cjs.map +2 -2
- package/build/components/inserter/menu.cjs +2 -1
- package/build/components/inserter/menu.cjs.map +2 -2
- package/build/components/inserter/search-results.cjs +3 -3
- package/build/components/inserter/search-results.cjs.map +2 -2
- package/build/components/inspector-popover-header/index.cjs.map +3 -3
- package/build/components/link-control/link-preview.cjs +2 -2
- package/build/components/link-control/link-preview.cjs.map +2 -2
- package/build/components/link-control/settings.cjs +2 -1
- package/build/components/link-control/settings.cjs.map +2 -2
- package/build/components/link-picker/link-picker.cjs +3 -2
- package/build/components/link-picker/link-picker.cjs.map +2 -2
- package/build/components/link-picker/link-preview.cjs +2 -2
- package/build/components/link-picker/link-preview.cjs.map +2 -2
- package/build/components/list-view/block-select-button.cjs +2 -2
- package/build/components/list-view/block-select-button.cjs.map +2 -2
- package/build/components/list-view/index.cjs +2 -1
- package/build/components/list-view/index.cjs.map +2 -2
- package/build/components/provider/index.cjs +80 -7
- package/build/components/provider/index.cjs.map +2 -2
- package/build/components/responsive-block-control/label.cjs +9 -2
- package/build/components/responsive-block-control/label.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/paste-handler.cjs +12 -5
- package/build/components/rich-text/event-listeners/paste-handler.cjs.map +3 -3
- package/build/components/url-popover/image-url-input-ui.cjs +1 -1
- package/build/components/url-popover/image-url-input-ui.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/block-bindings.cjs.map +3 -3
- package/build/hooks/block-fields/link/index.cjs +1 -1
- package/build/hooks/block-fields/link/index.cjs.map +1 -1
- package/build/hooks/custom-css.cjs +21 -0
- package/build/hooks/custom-css.cjs.map +3 -3
- package/build/hooks/dimensions.cjs +5 -1
- package/build/hooks/dimensions.cjs.map +2 -2
- package/build/hooks/grid-visualizer.cjs +1 -1
- package/build/hooks/grid-visualizer.cjs.map +1 -1
- package/build/hooks/layout-child.cjs +1 -1
- package/build/hooks/layout-child.cjs.map +1 -1
- package/build/hooks/utils.cjs +4 -0
- package/build/hooks/utils.cjs.map +2 -2
- package/build/layouts/flex.cjs +5 -8
- package/build/layouts/flex.cjs.map +3 -3
- package/build/layouts/grid.cjs +5 -5
- package/build/layouts/grid.cjs.map +2 -2
- package/build/private-apis.cjs +5 -4
- package/build/private-apis.cjs.map +3 -3
- package/build/store/private-keys.cjs +3 -0
- package/build/store/private-keys.cjs.map +2 -2
- package/build/utils/dom.cjs +3 -1
- package/build/utils/dom.cjs.map +2 -2
- package/build-module/components/autocomplete/index.mjs +2 -2
- package/build-module/components/autocomplete/index.mjs.map +2 -2
- package/build-module/components/background-image-control/index.mjs +2 -2
- package/build-module/components/background-image-control/index.mjs.map +2 -2
- package/build-module/components/block-allowed-blocks/modal.mjs +2 -2
- package/build-module/components/block-allowed-blocks/modal.mjs.map +2 -2
- package/build-module/components/block-bindings/attribute-control.mjs +3 -3
- package/build-module/components/block-bindings/attribute-control.mjs.map +2 -2
- package/build-module/components/block-card/index.mjs +4 -4
- package/build-module/components/block-card/index.mjs.map +2 -2
- package/build-module/components/block-mover/button.mjs +11 -5
- package/build-module/components/block-mover/button.mjs.map +2 -2
- package/build-module/components/block-pattern-setup/index.mjs +2 -1
- package/build-module/components/block-pattern-setup/index.mjs.map +2 -2
- package/build-module/components/block-patterns-list/index.mjs +1 -1
- package/build-module/components/block-patterns-list/index.mjs.map +2 -2
- package/build-module/components/block-patterns-paging/index.mjs +3 -3
- package/build-module/components/block-patterns-paging/index.mjs.map +2 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.mjs +2 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.mjs.map +2 -2
- package/build-module/components/block-settings-menu/index.mjs +2 -2
- package/build-module/components/block-settings-menu/index.mjs.map +2 -2
- package/build-module/components/block-styles/menu-items.mjs +2 -2
- package/build-module/components/block-styles/menu-items.mjs.map +2 -2
- package/build-module/components/block-switcher/index.mjs +2 -2
- package/build-module/components/block-switcher/index.mjs.map +2 -2
- package/build-module/components/block-switcher/pattern-transformations-menu.mjs +2 -7
- package/build-module/components/block-switcher/pattern-transformations-menu.mjs.map +2 -2
- package/build-module/components/block-toolbar/pattern-overrides-dropdown.mjs +2 -2
- package/build-module/components/block-toolbar/pattern-overrides-dropdown.mjs.map +2 -2
- package/build-module/components/block-variation-transforms/index.mjs +2 -2
- package/build-module/components/block-variation-transforms/index.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-visibility-info.mjs +6 -6
- package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +2 -2
- package/build-module/components/collab/note-icon-slot.mjs +8 -0
- package/build-module/components/collab/note-icon-slot.mjs.map +7 -0
- package/build-module/components/collab/note-icon-toolbar-slot.mjs +10 -0
- package/build-module/components/collab/note-icon-toolbar-slot.mjs.map +7 -0
- package/build-module/components/date-format-picker/index.mjs +2 -2
- package/build-module/components/date-format-picker/index.mjs.map +2 -2
- package/build-module/components/global-styles/color-panel.mjs.map +2 -2
- package/build-module/components/global-styles/dimensions-panel.mjs +87 -62
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/filters-panel.mjs.map +2 -2
- package/build-module/components/global-styles/hooks.mjs +9 -7
- package/build-module/components/global-styles/hooks.mjs.map +2 -2
- package/build-module/components/grid/grid-item-movers.mjs +2 -5
- package/build-module/components/grid/grid-item-movers.mjs.map +2 -2
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.mjs +3 -3
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.mjs.map +1 -1
- package/build-module/components/inserter/menu.mjs +3 -2
- package/build-module/components/inserter/menu.mjs.map +2 -2
- package/build-module/components/inserter/search-results.mjs +1 -1
- package/build-module/components/inserter/search-results.mjs.map +1 -1
- package/build-module/components/inspector-popover-header/index.mjs +2 -2
- package/build-module/components/inspector-popover-header/index.mjs.map +2 -2
- package/build-module/components/link-control/link-preview.mjs +2 -2
- package/build-module/components/link-control/link-preview.mjs.map +2 -2
- package/build-module/components/link-control/settings.mjs +3 -2
- package/build-module/components/link-control/settings.mjs.map +2 -2
- package/build-module/components/link-picker/link-picker.mjs +1 -1
- package/build-module/components/link-picker/link-picker.mjs.map +2 -2
- package/build-module/components/link-picker/link-preview.mjs +2 -2
- package/build-module/components/link-picker/link-preview.mjs.map +2 -2
- package/build-module/components/list-view/block-select-button.mjs +2 -2
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/index.mjs +2 -4
- package/build-module/components/list-view/index.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +82 -8
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/responsive-block-control/label.mjs +9 -2
- package/build-module/components/responsive-block-control/label.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs +12 -5
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +2 -2
- package/build-module/components/url-popover/image-url-input-ui.mjs +1 -1
- package/build-module/components/url-popover/image-url-input-ui.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/block-bindings.mjs +2 -2
- package/build-module/hooks/block-bindings.mjs.map +2 -2
- package/build-module/hooks/block-fields/link/index.mjs +1 -1
- package/build-module/hooks/block-fields/link/index.mjs.map +1 -1
- package/build-module/hooks/custom-css.mjs +23 -2
- package/build-module/hooks/custom-css.mjs.map +2 -2
- package/build-module/hooks/dimensions.mjs +5 -1
- package/build-module/hooks/dimensions.mjs.map +2 -2
- package/build-module/hooks/grid-visualizer.mjs +1 -1
- package/build-module/hooks/grid-visualizer.mjs.map +1 -1
- package/build-module/hooks/layout-child.mjs +1 -1
- package/build-module/hooks/layout-child.mjs.map +1 -1
- package/build-module/hooks/utils.mjs +4 -0
- package/build-module/hooks/utils.mjs.map +2 -2
- package/build-module/layouts/flex.mjs +4 -7
- package/build-module/layouts/flex.mjs.map +2 -2
- package/build-module/layouts/grid.mjs +4 -4
- package/build-module/layouts/grid.mjs.map +2 -2
- package/build-module/private-apis.mjs +7 -5
- package/build-module/private-apis.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/utils/dom.mjs +2 -1
- package/build-module/utils/dom.mjs.map +2 -2
- package/build-style/content-rtl.css +1 -4
- package/build-style/content.css +1 -4
- package/build-style/style-rtl.css +12 -12
- package/build-style/style.css +12 -12
- package/build-types/utils/dom.d.ts +7 -0
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +39 -38
- package/src/components/autocomplete/index.js +4 -2
- package/src/components/background-image-control/index.js +2 -2
- package/src/components/background-image-control/style.scss +1 -1
- package/src/components/block-allowed-blocks/modal.js +3 -3
- package/src/components/block-bindings/attribute-control.js +4 -4
- package/src/components/block-card/index.js +5 -5
- package/src/components/block-list/content.scss +0 -4
- package/src/components/block-mover/button.js +17 -7
- package/src/components/block-pattern-setup/index.js +2 -1
- package/src/components/block-pattern-setup/style.scss +2 -2
- package/src/components/block-patterns-list/index.js +1 -1
- package/src/components/block-patterns-list/style.scss +1 -1
- package/src/components/block-patterns-paging/index.js +5 -6
- package/src/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/src/components/block-settings-menu/index.js +2 -2
- package/src/components/block-styles/menu-items.js +3 -3
- package/src/components/block-switcher/index.js +3 -3
- package/src/components/block-switcher/pattern-transformations-menu.js +2 -7
- package/src/components/block-switcher/style.scss +2 -2
- package/src/components/block-toolbar/pattern-overrides-dropdown.js +2 -2
- package/src/components/block-variation-transforms/index.js +2 -2
- package/src/components/block-visibility/viewport-visibility-info.js +7 -7
- package/src/components/collab/note-icon-slot.js +8 -0
- package/src/components/collab/note-icon-toolbar-slot.js +10 -0
- package/src/components/date-format-picker/index.js +4 -2
- package/src/components/global-styles/color-panel.js +0 -2
- package/src/components/global-styles/dimensions-panel.js +100 -73
- package/src/components/global-styles/filters-panel.js +0 -2
- package/src/components/global-styles/hooks.js +9 -7
- package/src/components/global-styles/style.scss +1 -1
- package/src/components/grid/grid-item-movers.js +2 -5
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +5 -5
- package/src/components/inserter/menu.js +3 -2
- package/src/components/inserter/search-results.js +1 -1
- package/src/components/inserter/style.scss +2 -2
- package/src/components/inserter-list-item/style.scss +1 -1
- package/src/components/inspector-popover-header/index.js +2 -2
- package/src/components/link-control/link-preview.js +3 -3
- package/src/components/link-control/settings.js +3 -2
- package/src/components/link-picker/link-picker.js +1 -1
- package/src/components/link-picker/link-preview.js +3 -3
- package/src/components/list-view/block-select-button.js +3 -3
- package/src/components/list-view/index.js +2 -4
- package/src/components/list-view/style.scss +1 -1
- package/src/components/media-placeholder/content.scss +1 -1
- package/src/components/provider/index.js +149 -8
- package/src/components/responsive-block-control/label.js +5 -2
- package/src/components/rich-text/event-listeners/paste-handler.js +18 -4
- package/src/components/url-input/style.scss +1 -1
- package/src/components/url-popover/image-url-input-ui.js +1 -1
- package/src/components/writing-flow/use-arrow-nav.js +9 -2
- package/src/hooks/block-bindings.js +3 -3
- package/src/hooks/block-fields/link/index.js +1 -1
- package/src/hooks/custom-css.js +30 -9
- package/src/hooks/dimensions.js +6 -1
- package/src/hooks/grid-visualizer.js +1 -1
- package/src/hooks/layout-child.js +1 -1
- package/src/hooks/test/dimensions.js +16 -0
- package/src/hooks/test/style.js +2 -0
- package/src/hooks/utils.js +4 -0
- package/src/layouts/flex.js +7 -9
- package/src/layouts/grid.js +7 -4
- package/src/private-apis.js +6 -4
- package/src/store/private-keys.js +1 -0
- package/src/utils/dom.js +3 -3
- package/src/utils/test/dom.js +47 -4
- package/build/components/collab/block-comment-icon-slot.cjs.map +0 -7
- package/build/components/collab/block-comment-icon-toolbar-slot.cjs.map +0 -7
- package/build-module/components/collab/block-comment-icon-slot.mjs +0 -8
- package/build-module/components/collab/block-comment-icon-slot.mjs.map +0 -7
- package/build-module/components/collab/block-comment-icon-toolbar-slot.mjs +0 -10
- package/build-module/components/collab/block-comment-icon-toolbar-slot.mjs.map +0 -7
- package/src/components/collab/block-comment-icon-slot.js +0 -8
- package/src/components/collab/block-comment-icon-toolbar-slot.js +0 -10
package/src/hooks/dimensions.js
CHANGED
|
@@ -102,6 +102,10 @@ export function DimensionsPanel( { clientId, name, setAttributes, settings } ) {
|
|
|
102
102
|
'__experimentalDefaultControls',
|
|
103
103
|
] );
|
|
104
104
|
const defaultControls = {
|
|
105
|
+
// In the block inspector, minHeight and minWidth should not
|
|
106
|
+
// be shown by default unless the block explicitly opts in.
|
|
107
|
+
minHeight: false,
|
|
108
|
+
minWidth: false,
|
|
105
109
|
...defaultDimensionsControls,
|
|
106
110
|
...defaultSpacingControls,
|
|
107
111
|
};
|
|
@@ -161,7 +165,8 @@ export function hasDimensionsSupport( blockName, feature = 'any' ) {
|
|
|
161
165
|
support?.aspectRatio ||
|
|
162
166
|
!! support?.height ||
|
|
163
167
|
!! support?.minHeight ||
|
|
164
|
-
!! support?.width
|
|
168
|
+
!! support?.width ||
|
|
169
|
+
!! support?.minWidth
|
|
165
170
|
);
|
|
166
171
|
}
|
|
167
172
|
|
|
@@ -54,7 +54,7 @@ function GridTools( { clientId, layout } ) {
|
|
|
54
54
|
const settings = getSettings();
|
|
55
55
|
const currentDeviceType =
|
|
56
56
|
settings?.[ deviceTypeKey ]?.toLowerCase() ||
|
|
57
|
-
BLOCK_VISIBILITY_VIEWPORTS.desktop.
|
|
57
|
+
BLOCK_VISIBILITY_VIEWPORTS.desktop.key;
|
|
58
58
|
|
|
59
59
|
return {
|
|
60
60
|
isVisible: true,
|
|
@@ -244,7 +244,7 @@ function GridTools( {
|
|
|
244
244
|
blockAttributes?.metadata?.blockVisibility,
|
|
245
245
|
deviceType:
|
|
246
246
|
settings?.[ deviceTypeKey ]?.toLowerCase() ||
|
|
247
|
-
BLOCK_VISIBILITY_VIEWPORTS.desktop.
|
|
247
|
+
BLOCK_VISIBILITY_VIEWPORTS.desktop.key,
|
|
248
248
|
// Check if the selected child block is itself a grid.
|
|
249
249
|
isChildBlockAGrid: blockAttributes?.layout?.type === 'grid',
|
|
250
250
|
};
|
|
@@ -76,6 +76,22 @@ describe( 'getDimensionsClassesAndStyles', () => {
|
|
|
76
76
|
} );
|
|
77
77
|
} );
|
|
78
78
|
|
|
79
|
+
it( 'should return minWidth style', () => {
|
|
80
|
+
const attributes = {
|
|
81
|
+
style: {
|
|
82
|
+
dimensions: {
|
|
83
|
+
minWidth: '200px',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
expect( getDimensionsClassesAndStyles( attributes ) ).toEqual( {
|
|
88
|
+
className: undefined,
|
|
89
|
+
style: {
|
|
90
|
+
minWidth: '200px',
|
|
91
|
+
},
|
|
92
|
+
} );
|
|
93
|
+
} );
|
|
94
|
+
|
|
79
95
|
it( 'should return all dimension styles when multiple are provided', () => {
|
|
80
96
|
const attributes = {
|
|
81
97
|
style: {
|
package/src/hooks/test/style.js
CHANGED
|
@@ -25,6 +25,7 @@ describe( 'getInlineStyles', () => {
|
|
|
25
25
|
},
|
|
26
26
|
dimensions: {
|
|
27
27
|
minHeight: '50vh',
|
|
28
|
+
minWidth: '200px',
|
|
28
29
|
},
|
|
29
30
|
spacing: {
|
|
30
31
|
blockGap: '1em',
|
|
@@ -44,6 +45,7 @@ describe( 'getInlineStyles', () => {
|
|
|
44
45
|
fontSize: 10,
|
|
45
46
|
marginBottom: '15px',
|
|
46
47
|
minHeight: '50vh',
|
|
48
|
+
minWidth: '200px',
|
|
47
49
|
paddingTop: '10px',
|
|
48
50
|
} );
|
|
49
51
|
} );
|
package/src/hooks/utils.js
CHANGED
|
@@ -269,6 +269,7 @@ export function useBlockSettings( name, parentLayout ) {
|
|
|
269
269
|
aspectRatio,
|
|
270
270
|
height,
|
|
271
271
|
minHeight,
|
|
272
|
+
minWidth,
|
|
272
273
|
width,
|
|
273
274
|
dimensionSizes,
|
|
274
275
|
layout,
|
|
@@ -332,6 +333,7 @@ export function useBlockSettings( name, parentLayout ) {
|
|
|
332
333
|
'dimensions.aspectRatio',
|
|
333
334
|
'dimensions.height',
|
|
334
335
|
'dimensions.minHeight',
|
|
336
|
+
'dimensions.minWidth',
|
|
335
337
|
'dimensions.width',
|
|
336
338
|
'dimensions.dimensionSizes',
|
|
337
339
|
'layout',
|
|
@@ -446,6 +448,7 @@ export function useBlockSettings( name, parentLayout ) {
|
|
|
446
448
|
aspectRatio,
|
|
447
449
|
height,
|
|
448
450
|
minHeight,
|
|
451
|
+
minWidth,
|
|
449
452
|
width,
|
|
450
453
|
dimensionSizes,
|
|
451
454
|
},
|
|
@@ -487,6 +490,7 @@ export function useBlockSettings( name, parentLayout ) {
|
|
|
487
490
|
aspectRatio,
|
|
488
491
|
height,
|
|
489
492
|
minHeight,
|
|
493
|
+
minWidth,
|
|
490
494
|
width,
|
|
491
495
|
dimensionSizes,
|
|
492
496
|
layout,
|
package/src/layouts/flex.js
CHANGED
|
@@ -23,7 +23,8 @@ import {
|
|
|
23
23
|
* Internal dependencies
|
|
24
24
|
*/
|
|
25
25
|
import { appendSelectors, getBlockGapCSS } from './utils';
|
|
26
|
-
import { getGapCSSValue } from '../hooks/gap';
|
|
26
|
+
import { getGapCSSValue, getGapBoxControlValueFromStyle } from '../hooks/gap';
|
|
27
|
+
import { getSpacingPresetCssVar } from '../components/spacing-sizes-control/utils';
|
|
27
28
|
import {
|
|
28
29
|
BlockControls,
|
|
29
30
|
JustifyContentControl,
|
|
@@ -147,15 +148,12 @@ export default {
|
|
|
147
148
|
// falling back to '0.5em' for backwards compatibility.
|
|
148
149
|
let fallbackGapValue = '0.5em';
|
|
149
150
|
if ( globalBlockGapValue ) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
globalBlockGapValue,
|
|
153
|
-
'0.5em'
|
|
154
|
-
);
|
|
155
|
-
// Use the column gap value (second value if two values exist)
|
|
156
|
-
const gapParts = processedGlobalGap.split( ' ' );
|
|
151
|
+
const gapBox =
|
|
152
|
+
getGapBoxControlValueFromStyle( globalBlockGapValue );
|
|
157
153
|
fallbackGapValue =
|
|
158
|
-
|
|
154
|
+
getSpacingPresetCssVar( gapBox?.left ) ||
|
|
155
|
+
getSpacingPresetCssVar( gapBox?.top ) ||
|
|
156
|
+
'0.5em';
|
|
159
157
|
}
|
|
160
158
|
|
|
161
159
|
// If a block's block.json skips serialization for spacing or spacing.blockGap,
|
package/src/layouts/grid.js
CHANGED
|
@@ -21,7 +21,8 @@ import { useState } from '@wordpress/element';
|
|
|
21
21
|
* Internal dependencies
|
|
22
22
|
*/
|
|
23
23
|
import { appendSelectors, getBlockGapCSS } from './utils';
|
|
24
|
-
import { getGapCSSValue } from '../hooks/gap';
|
|
24
|
+
import { getGapCSSValue, getGapBoxControlValueFromStyle } from '../hooks/gap';
|
|
25
|
+
import { getSpacingPresetCssVar } from '../components/spacing-sizes-control/utils';
|
|
25
26
|
import { shouldSkipSerialization } from '../hooks/utils';
|
|
26
27
|
import { LAYOUT_DEFINITIONS } from './definitions';
|
|
27
28
|
|
|
@@ -143,10 +144,12 @@ export default {
|
|
|
143
144
|
// If the gap value has both top and left (separated by space), use the left value for horizontal calculations.
|
|
144
145
|
let fallbackGapValue = '1.2rem';
|
|
145
146
|
if ( globalBlockGapValue ) {
|
|
146
|
-
const
|
|
147
|
-
|
|
147
|
+
const gapBox =
|
|
148
|
+
getGapBoxControlValueFromStyle( globalBlockGapValue );
|
|
148
149
|
fallbackGapValue =
|
|
149
|
-
|
|
150
|
+
getSpacingPresetCssVar( gapBox?.left ) ||
|
|
151
|
+
getSpacingPresetCssVar( gapBox?.top ) ||
|
|
152
|
+
'1.2rem';
|
|
150
153
|
}
|
|
151
154
|
|
|
152
155
|
// If a block's block.json skips serialization for spacing or spacing.blockGap,
|
package/src/private-apis.js
CHANGED
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
isNavigationOverlayContextKey,
|
|
51
51
|
isNavigationPostEditorKey,
|
|
52
52
|
mediaUploadOnSuccessKey,
|
|
53
|
+
openMediaEditorModalKey,
|
|
53
54
|
} from './store/private-keys';
|
|
54
55
|
import { requiresWrapperOnCopy } from './components/writing-flow/utils';
|
|
55
56
|
import { PrivateRichText } from './components/rich-text/';
|
|
@@ -59,8 +60,8 @@ import { PrivatePublishDateTimePicker } from './components/publish-date-time-pic
|
|
|
59
60
|
import useSpacingSizes from './components/spacing-sizes-control/hooks/use-spacing-sizes';
|
|
60
61
|
import useBlockDisplayTitle from './components/block-title/use-block-display-title';
|
|
61
62
|
import TabbedSidebar from './components/tabbed-sidebar';
|
|
62
|
-
import
|
|
63
|
-
import
|
|
63
|
+
import NoteIconSlotFill from './components/collab/note-icon-slot';
|
|
64
|
+
import NoteIconToolbarSlotFill from './components/collab/note-icon-toolbar-slot';
|
|
64
65
|
import HTMLElementControl from './components/html-element-control';
|
|
65
66
|
import {
|
|
66
67
|
useBlockElementRef,
|
|
@@ -124,8 +125,8 @@ lock( privateApis, {
|
|
|
124
125
|
BlockStyleVariationOverridesWithConfig,
|
|
125
126
|
setBackgroundStyleDefaults,
|
|
126
127
|
sectionRootClientIdKey,
|
|
127
|
-
|
|
128
|
-
|
|
128
|
+
NoteIconSlotFill,
|
|
129
|
+
NoteIconToolbarSlotFill,
|
|
129
130
|
mediaEditKey,
|
|
130
131
|
getMediaSelectKey,
|
|
131
132
|
deviceTypeKey,
|
|
@@ -133,6 +134,7 @@ lock( privateApis, {
|
|
|
133
134
|
isNavigationOverlayContextKey,
|
|
134
135
|
isNavigationPostEditorKey,
|
|
135
136
|
mediaUploadOnSuccessKey,
|
|
137
|
+
openMediaEditorModalKey,
|
|
136
138
|
useBlockElement,
|
|
137
139
|
useBlockElementRef,
|
|
138
140
|
LinkPicker,
|
|
@@ -12,3 +12,4 @@ export const isNavigationOverlayContextKey = Symbol(
|
|
|
12
12
|
);
|
|
13
13
|
export const isNavigationPostEditorKey = Symbol( 'isNavigationPostEditor' );
|
|
14
14
|
export const mediaUploadOnSuccessKey = Symbol( 'mediaUploadOnSuccess' );
|
|
15
|
+
export const openMediaEditorModalKey = Symbol( 'openMediaEditorModal' );
|
package/src/utils/dom.js
CHANGED
|
@@ -80,14 +80,14 @@ export function rectUnion( rect1, rect2 ) {
|
|
|
80
80
|
* @param {Element} element Element.
|
|
81
81
|
* @return {boolean} Whether the element is visible.
|
|
82
82
|
*/
|
|
83
|
-
function isElementVisible( element ) {
|
|
83
|
+
export function isElementVisible( element ) {
|
|
84
84
|
const viewport = element.ownerDocument.defaultView;
|
|
85
85
|
if ( ! viewport ) {
|
|
86
86
|
return false;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
// Check for <VisuallyHidden>
|
|
90
|
-
if ( element.
|
|
89
|
+
// Check for <VisuallyHidden> components.
|
|
90
|
+
if ( element.hasAttribute( 'data-visually-hidden' ) ) {
|
|
91
91
|
return false;
|
|
92
92
|
}
|
|
93
93
|
|
package/src/utils/test/dom.js
CHANGED
|
@@ -1,8 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
// eslint-disable-next-line @wordpress/use-recommended-components -- Required for testing
|
|
3
|
+
import { VisuallyHidden as WCVisuallyHidden } from '@wordpress/components';
|
|
4
|
+
import { VisuallyHidden } from '@wordpress/ui';
|
|
5
|
+
import {
|
|
6
|
+
getElementBounds,
|
|
7
|
+
isElementVisible,
|
|
8
|
+
WITH_OVERFLOW_ELEMENT_BLOCKS,
|
|
9
|
+
} from '../dom';
|
|
10
|
+
|
|
11
|
+
function mockVisibleBoundingClientRect( element ) {
|
|
12
|
+
element.getBoundingClientRect = jest.fn().mockReturnValue( {
|
|
13
|
+
left: 0,
|
|
14
|
+
top: 0,
|
|
15
|
+
right: 100,
|
|
16
|
+
bottom: 20,
|
|
17
|
+
width: 100,
|
|
18
|
+
height: 20,
|
|
19
|
+
x: 0,
|
|
20
|
+
y: 0,
|
|
21
|
+
} );
|
|
22
|
+
}
|
|
23
|
+
|
|
5
24
|
describe( 'dom', () => {
|
|
25
|
+
describe( 'isElementVisible', () => {
|
|
26
|
+
it( 'returns false for @wordpress/components VisuallyHidden', () => {
|
|
27
|
+
render(
|
|
28
|
+
<WCVisuallyHidden data-testid="wc-visually-hidden">
|
|
29
|
+
Hidden
|
|
30
|
+
</WCVisuallyHidden>
|
|
31
|
+
);
|
|
32
|
+
const element = screen.getByTestId( 'wc-visually-hidden' );
|
|
33
|
+
mockVisibleBoundingClientRect( element );
|
|
34
|
+
expect( isElementVisible( element ) ).toBe( false );
|
|
35
|
+
} );
|
|
36
|
+
|
|
37
|
+
it( 'returns false for @wordpress/ui VisuallyHidden', () => {
|
|
38
|
+
render(
|
|
39
|
+
<VisuallyHidden data-testid="ui-visually-hidden">
|
|
40
|
+
Hidden
|
|
41
|
+
</VisuallyHidden>
|
|
42
|
+
);
|
|
43
|
+
const element = screen.getByTestId( 'ui-visually-hidden' );
|
|
44
|
+
mockVisibleBoundingClientRect( element );
|
|
45
|
+
expect( isElementVisible( element ) ).toBe( false );
|
|
46
|
+
} );
|
|
47
|
+
} );
|
|
48
|
+
|
|
6
49
|
describe( 'getElementBounds', () => {
|
|
7
50
|
it( 'should return a DOMRectReadOnly object if the viewport is not available', () => {
|
|
8
51
|
const element = {
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/collab/block-comment-icon-slot.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst CommentIconSlotFill = createSlotFill( Symbol( 'CommentIconSlotFill' ) );\n\nexport default CommentIconSlotFill;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA+B;AAE/B,IAAM,0BAAsB,kCAAgB,uBAAQ,qBAAsB,CAAE;AAE5E,IAAO,kCAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/collab/block-comment-icon-toolbar-slot.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst CommentIconToolbarSlotFill = createSlotFill(\n\tSymbol( 'CommentIconToolbarSlotFill' )\n);\n\nexport default CommentIconToolbarSlotFill;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA+B;AAE/B,IAAM,iCAA6B;AAAA,EAClC,uBAAQ,4BAA6B;AACtC;AAEA,IAAO,0CAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// packages/block-editor/src/components/collab/block-comment-icon-slot.js
|
|
2
|
-
import { createSlotFill } from "@wordpress/components";
|
|
3
|
-
var CommentIconSlotFill = createSlotFill(/* @__PURE__ */ Symbol("CommentIconSlotFill"));
|
|
4
|
-
var block_comment_icon_slot_default = CommentIconSlotFill;
|
|
5
|
-
export {
|
|
6
|
-
block_comment_icon_slot_default as default
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=block-comment-icon-slot.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/collab/block-comment-icon-slot.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst CommentIconSlotFill = createSlotFill( Symbol( 'CommentIconSlotFill' ) );\n\nexport default CommentIconSlotFill;\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,sBAAsB;AAE/B,IAAM,sBAAsB,eAAgB,uBAAQ,qBAAsB,CAAE;AAE5E,IAAO,kCAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// packages/block-editor/src/components/collab/block-comment-icon-toolbar-slot.js
|
|
2
|
-
import { createSlotFill } from "@wordpress/components";
|
|
3
|
-
var CommentIconToolbarSlotFill = createSlotFill(
|
|
4
|
-
/* @__PURE__ */ Symbol("CommentIconToolbarSlotFill")
|
|
5
|
-
);
|
|
6
|
-
var block_comment_icon_toolbar_slot_default = CommentIconToolbarSlotFill;
|
|
7
|
-
export {
|
|
8
|
-
block_comment_icon_toolbar_slot_default as default
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=block-comment-icon-toolbar-slot.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/collab/block-comment-icon-toolbar-slot.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst CommentIconToolbarSlotFill = createSlotFill(\n\tSymbol( 'CommentIconToolbarSlotFill' )\n);\n\nexport default CommentIconToolbarSlotFill;\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,sBAAsB;AAE/B,IAAM,6BAA6B;AAAA,EAClC,uBAAQ,4BAA6B;AACtC;AAEA,IAAO,0CAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|