@wordpress/block-editor 13.3.0 → 13.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +0 -4
- package/build/components/alignment-control/ui.js +2 -2
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/ui.js +1 -1
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/ui.native.js +1 -1
- package/build/components/block-alignment-control/ui.native.js.map +1 -1
- package/build/components/block-inspector/index.js +6 -3
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +3 -1
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-refs.js +9 -2
- package/build/components/block-list/use-block-props/use-block-refs.js.map +1 -1
- package/build/components/block-list/use-block-props/use-is-hovered.js +25 -9
- package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +3 -2
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-lock/modal.js +2 -0
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +2 -0
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-switcher/index.js +1 -1
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +11 -12
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/preview-block-popover.js +20 -17
- package/build/components/block-switcher/preview-block-popover.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +5 -2
- package/build/components/block-toolbar/shuffle.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +7 -8
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserter-button.js +45 -0
- package/build/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -0
- package/build/components/block-tools/zoom-out-mode-inserters.js +27 -27
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-popover.js +2 -1
- package/build/components/block-tools/zoom-out-popover.js.map +1 -1
- package/build/components/block-tools/zoom-out-toolbar.js +1 -1
- package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build/components/date-format-picker/index.js +2 -11
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/default-block-appender/index.js +7 -4
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +2 -7
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +8 -1
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +5 -1
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +26 -43
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +78 -7
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +24 -5
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/grid/grid-item-movers.js +89 -44
- package/build/components/grid/grid-item-movers.js.map +1 -1
- package/build/components/grid/grid-visualizer.js +1 -1
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/grid/use-grid-layout-sync.js +40 -28
- package/build/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build/components/index.js +1 -9
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +1 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js +20 -23
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build/components/inserter/media-tab/media-panel.js +1 -0
- package/build/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build/components/inserter/menu.js +1 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/preview-panel.js +20 -3
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +10 -3
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inspector-controls-tabs/settings-tab.js +1 -2
- package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build/components/list-view/block-select-button.js +2 -6
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +2 -2
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/utils.js +3 -1
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js +1 -1
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/index.js +1 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -2
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +3 -3
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/hooks/grid-visualizer.js +5 -8
- package/build/hooks/grid-visualizer.js.map +1 -1
- package/build/hooks/layout-child.js +9 -2
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/position.js +3 -7
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +81 -50
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/layouts/constrained.js +6 -2
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/grid.js +2 -0
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +0 -3
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +18 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +19 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +13 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +2 -2
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +1 -1
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.native.js +1 -1
- package/build-module/components/block-alignment-control/ui.native.js.map +1 -1
- package/build-module/components/block-inspector/index.js +6 -3
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +3 -1
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-refs.js +11 -4
- package/build-module/components/block-list/use-block-props/use-block-refs.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-is-hovered.js +26 -9
- package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +3 -2
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-lock/modal.js +2 -0
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +2 -0
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +1 -1
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +12 -13
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/preview-block-popover.js +20 -17
- package/build-module/components/block-switcher/preview-block-popover.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +5 -2
- package/build-module/components/block-toolbar/shuffle.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +7 -8
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserter-button.js +37 -0
- package/build-module/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -0
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +28 -28
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-popover.js +2 -1
- package/build-module/components/block-tools/zoom-out-popover.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js +1 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +4 -12
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +7 -4
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +3 -6
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +8 -1
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +5 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +27 -44
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +76 -7
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +24 -5
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/grid/grid-item-movers.js +92 -46
- package/build-module/components/grid/grid-item-movers.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js +1 -1
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/grid/use-grid-layout-sync.js +41 -29
- package/build-module/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build-module/components/index.js +0 -5
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +1 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +20 -23
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js +1 -0
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build-module/components/inserter/menu.js +1 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +20 -3
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +10 -3
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/settings-tab.js +1 -2
- package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +3 -7
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +2 -2
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/utils.js +3 -1
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -2
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +3 -3
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/hooks/grid-visualizer.js +5 -8
- package/build-module/hooks/grid-visualizer.js.map +1 -1
- package/build-module/hooks/layout-child.js +9 -2
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/position.js +3 -7
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +81 -51
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/layouts/constrained.js +6 -2
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/grid.js +2 -0
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +0 -3
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +15 -0
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +18 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +10 -0
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/content-rtl.css +6 -6
- package/build-style/content.css +6 -6
- package/build-style/style-rtl.css +167 -103
- package/build-style/style.css +167 -103
- package/build-types/components/block-context/index.d.ts +2 -2
- package/build-types/components/block-context/index.d.ts.map +1 -1
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +31 -31
- package/src/components/alignment-control/ui.js +2 -2
- package/src/components/block-alignment-control/ui.js +1 -1
- package/src/components/block-alignment-control/ui.native.js +1 -1
- package/src/components/block-context/README.md +4 -4
- package/src/components/block-inspector/index.js +8 -4
- package/src/components/block-list/content.scss +2 -16
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-list/use-block-props/use-block-refs.js +19 -3
- package/src/components/block-list/use-block-props/use-is-hovered.js +26 -11
- package/src/components/block-list/use-in-between-inserter.js +5 -1
- package/src/components/block-lock/modal.js +10 -2
- package/src/components/block-lock/style.scss +4 -8
- package/src/components/block-patterns-paging/style.scss +0 -23
- package/src/components/block-removal-warning-modal/index.js +10 -2
- package/src/components/block-switcher/index.js +1 -1
- package/src/components/block-switcher/pattern-transformations-menu.js +17 -15
- package/src/components/block-switcher/preview-block-popover.js +20 -14
- package/src/components/block-switcher/style.scss +8 -17
- package/src/components/block-toolbar/shuffle.js +8 -1
- package/src/components/block-tools/style.scss +8 -0
- package/src/components/block-tools/use-show-block-tools.js +12 -9
- package/src/components/block-tools/zoom-out-mode-inserter-button.js +47 -0
- package/src/components/block-tools/zoom-out-mode-inserters.js +43 -33
- package/src/components/block-tools/zoom-out-popover.js +1 -0
- package/src/components/block-tools/zoom-out-toolbar.js +1 -1
- package/src/components/date-format-picker/index.js +2 -11
- package/src/components/default-block-appender/index.js +11 -4
- package/src/components/font-appearance-control/index.js +1 -5
- package/src/components/global-styles/background-panel.js +21 -1
- package/src/components/global-styles/hooks.js +5 -1
- package/src/components/global-styles/style.scss +12 -0
- package/src/components/global-styles/test/typography-utils.js +325 -0
- package/src/components/global-styles/test/use-global-styles-output.js +3 -1
- package/src/components/global-styles/typography-panel.js +36 -44
- package/src/components/global-styles/typography-utils.js +103 -7
- package/src/components/global-styles/use-global-styles-output.js +22 -2
- package/src/components/grid/grid-item-movers.js +139 -69
- package/src/components/grid/grid-visualizer.js +1 -1
- package/src/components/grid/style.scss +114 -0
- package/src/components/grid/use-grid-layout-sync.js +66 -27
- package/src/components/iframe/content.scss +1 -1
- package/src/components/index.js +0 -5
- package/src/components/inner-blocks/index.js +4 -1
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +40 -44
- package/src/components/inserter/media-tab/media-panel.js +1 -0
- package/src/components/inserter/menu.js +1 -1
- package/src/components/inserter/preview-panel.js +27 -4
- package/src/components/inserter/style.scss +57 -43
- package/src/components/inserter-draggable-blocks/index.js +11 -3
- package/src/components/inspector-controls-tabs/settings-tab.js +0 -2
- package/src/components/inspector-controls-tabs/style.scss +0 -21
- package/src/components/list-view/block-select-button.js +3 -13
- package/src/components/list-view/block.js +10 -3
- package/src/components/list-view/style.scss +2 -1
- package/src/components/list-view/utils.js +13 -2
- package/src/components/rich-text/format-toolbar/index.js +1 -1
- package/src/components/rich-text/index.js +1 -1
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -1
- package/src/components/url-popover/image-url-input-ui.js +3 -3
- package/src/components/url-popover/style.scss +1 -0
- package/src/hooks/grid-visualizer.js +5 -7
- package/src/hooks/layout-child.js +12 -3
- package/src/hooks/position.js +3 -13
- package/src/hooks/use-bindings-attributes.js +89 -59
- package/src/layouts/constrained.js +10 -2
- package/src/layouts/grid.js +2 -0
- package/src/private-apis.js +0 -6
- package/src/store/actions.js +15 -0
- package/src/store/reducer.js +18 -0
- package/src/store/selectors.js +10 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/inserter/reusable-block-rename-hint.js +0 -71
- package/build/components/inserter/reusable-block-rename-hint.js.map +0 -1
- package/build/components/inspector-controls-tabs/settings-tab-hint.js +0 -53
- package/build/components/inspector-controls-tabs/settings-tab-hint.js.map +0 -1
- package/build-module/components/inserter/reusable-block-rename-hint.js +0 -64
- package/build-module/components/inserter/reusable-block-rename-hint.js.map +0 -1
- package/build-module/components/inspector-controls-tabs/settings-tab-hint.js +0 -47
- package/build-module/components/inspector-controls-tabs/settings-tab-hint.js.map +0 -1
- package/src/components/inserter/reusable-block-rename-hint.js +0 -69
- package/src/components/inspector-controls-tabs/settings-tab-hint.js +0 -52
|
@@ -13,8 +13,19 @@ export const getBlockPositionDescription = ( position, siblingCount, level ) =>
|
|
|
13
13
|
level
|
|
14
14
|
);
|
|
15
15
|
|
|
16
|
-
export const getBlockPropertiesDescription = ( isLocked ) =>
|
|
17
|
-
|
|
16
|
+
export const getBlockPropertiesDescription = ( blockInformation, isLocked ) =>
|
|
17
|
+
[
|
|
18
|
+
blockInformation?.positionLabel
|
|
19
|
+
? `${ sprintf(
|
|
20
|
+
// translators: %s: Position of selected block, e.g. "Sticky" or "Fixed".
|
|
21
|
+
__( 'Position: %s' ),
|
|
22
|
+
blockInformation.positionLabel
|
|
23
|
+
) }.`
|
|
24
|
+
: undefined,
|
|
25
|
+
isLocked ? __( 'This block is locked.' ) : undefined,
|
|
26
|
+
]
|
|
27
|
+
.filter( Boolean )
|
|
28
|
+
.join( ' ' );
|
|
18
29
|
|
|
19
30
|
/**
|
|
20
31
|
* Returns true if the client ID occurs within the block selection or multi-selection,
|
|
@@ -303,9 +303,11 @@ export default function SpacingInputControl( {
|
|
|
303
303
|
<CustomSelectControl
|
|
304
304
|
className="spacing-sizes-control__custom-select-control"
|
|
305
305
|
value={
|
|
306
|
+
// passing empty string as a fallback to continue using the
|
|
307
|
+
// component in controlled mode
|
|
306
308
|
options.find(
|
|
307
309
|
( option ) => option.key === currentValue
|
|
308
|
-
) || ''
|
|
310
|
+
) || ''
|
|
309
311
|
}
|
|
310
312
|
onChange={ ( selection ) => {
|
|
311
313
|
onChange(
|
|
@@ -272,7 +272,7 @@ const ImageURLInputUI = ( {
|
|
|
272
272
|
icon={ linkOff }
|
|
273
273
|
label={ __( 'Disable expand on click' ) }
|
|
274
274
|
onClick={ () => {
|
|
275
|
-
onSetLightbox( false );
|
|
275
|
+
onSetLightbox?.( false );
|
|
276
276
|
} }
|
|
277
277
|
size="compact"
|
|
278
278
|
/>
|
|
@@ -302,7 +302,7 @@ const ImageURLInputUI = ( {
|
|
|
302
302
|
label={ __( 'Remove link' ) }
|
|
303
303
|
onClick={ () => {
|
|
304
304
|
onLinkRemove();
|
|
305
|
-
resetLightbox();
|
|
305
|
+
resetLightbox?.();
|
|
306
306
|
} }
|
|
307
307
|
size="compact"
|
|
308
308
|
/>
|
|
@@ -366,7 +366,7 @@ const ImageURLInputUI = ( {
|
|
|
366
366
|
LINK_DESTINATION_NONE,
|
|
367
367
|
href: '',
|
|
368
368
|
} );
|
|
369
|
-
onSetLightbox( true );
|
|
369
|
+
onSetLightbox?.( true );
|
|
370
370
|
stopEditLink();
|
|
371
371
|
} }
|
|
372
372
|
>
|
|
@@ -26,14 +26,12 @@ function GridTools( { clientId, layout } ) {
|
|
|
26
26
|
};
|
|
27
27
|
} );
|
|
28
28
|
|
|
29
|
-
if ( ! isSelected && ! isDragging ) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
29
|
return (
|
|
34
30
|
<>
|
|
35
|
-
<GridVisualizer clientId={ clientId } parentLayout={ layout } />
|
|
36
31
|
<GridLayoutSync clientId={ clientId } />
|
|
32
|
+
{ ( isSelected || isDragging ) && (
|
|
33
|
+
<GridVisualizer clientId={ clientId } parentLayout={ layout } />
|
|
34
|
+
) }
|
|
37
35
|
</>
|
|
38
36
|
);
|
|
39
37
|
}
|
|
@@ -41,7 +39,7 @@ function GridTools( { clientId, layout } ) {
|
|
|
41
39
|
const addGridVisualizerToBlockEdit = createHigherOrderComponent(
|
|
42
40
|
( BlockEdit ) => ( props ) => {
|
|
43
41
|
if ( props.attributes.layout?.type !== 'grid' ) {
|
|
44
|
-
return <BlockEdit { ...props } />;
|
|
42
|
+
return <BlockEdit key="edit" { ...props } />;
|
|
45
43
|
}
|
|
46
44
|
|
|
47
45
|
return (
|
|
@@ -50,7 +48,7 @@ const addGridVisualizerToBlockEdit = createHigherOrderComponent(
|
|
|
50
48
|
clientId={ props.clientId }
|
|
51
49
|
layout={ props.attributes.layout }
|
|
52
50
|
/>
|
|
53
|
-
<BlockEdit { ...props } />
|
|
51
|
+
<BlockEdit key="edit" { ...props } />
|
|
54
52
|
</>
|
|
55
53
|
);
|
|
56
54
|
},
|
|
@@ -119,11 +119,20 @@ function useBlockPropsChildLayoutStyles( { style } ) {
|
|
|
119
119
|
parentColumnUnit = 'rem';
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
let numColsToBreakAt = 2;
|
|
123
|
+
|
|
124
|
+
if ( columnSpan && columnStart ) {
|
|
125
|
+
numColsToBreakAt = columnSpan + columnStart - 1;
|
|
126
|
+
} else if ( columnSpan ) {
|
|
127
|
+
numColsToBreakAt = columnSpan;
|
|
128
|
+
} else {
|
|
129
|
+
numColsToBreakAt = columnStart;
|
|
130
|
+
}
|
|
131
|
+
|
|
123
132
|
const defaultGapValue = parentColumnUnit === 'px' ? 24 : 1.5;
|
|
124
133
|
const containerQueryValue =
|
|
125
|
-
|
|
126
|
-
(
|
|
134
|
+
numColsToBreakAt * parentColumnValue +
|
|
135
|
+
( numColsToBreakAt - 1 ) * defaultGapValue;
|
|
127
136
|
// For blocks that only span one column, we want to remove any rowStart values as
|
|
128
137
|
// the container reduces in size, so that blocks are still arranged in markup order.
|
|
129
138
|
const minimumContainerQueryValue =
|
package/src/hooks/position.js
CHANGED
|
@@ -8,10 +8,7 @@ import clsx from 'clsx';
|
|
|
8
8
|
*/
|
|
9
9
|
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
10
10
|
import { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';
|
|
11
|
-
import {
|
|
12
|
-
BaseControl,
|
|
13
|
-
privateApis as componentsPrivateApis,
|
|
14
|
-
} from '@wordpress/components';
|
|
11
|
+
import { BaseControl, CustomSelectControl } from '@wordpress/components';
|
|
15
12
|
import { useInstanceId } from '@wordpress/compose';
|
|
16
13
|
import { useSelect } from '@wordpress/data';
|
|
17
14
|
import { useMemo, Platform } from '@wordpress/element';
|
|
@@ -23,13 +20,8 @@ import { useSettings } from '../components/use-settings';
|
|
|
23
20
|
import InspectorControls from '../components/inspector-controls';
|
|
24
21
|
import useBlockDisplayInformation from '../components/use-block-display-information';
|
|
25
22
|
import { cleanEmptyObject, useStyleOverride } from './utils';
|
|
26
|
-
import { unlock } from '../lock-unlock';
|
|
27
23
|
import { store as blockEditorStore } from '../store';
|
|
28
24
|
|
|
29
|
-
const { CustomSelectControlV2Legacy: CustomSelectControl } = unlock(
|
|
30
|
-
componentsPrivateApis
|
|
31
|
-
);
|
|
32
|
-
|
|
33
25
|
const POSITION_SUPPORT_KEY = 'position';
|
|
34
26
|
|
|
35
27
|
const DEFAULT_OPTION = {
|
|
@@ -42,7 +34,7 @@ const STICKY_OPTION = {
|
|
|
42
34
|
key: 'sticky',
|
|
43
35
|
value: 'sticky',
|
|
44
36
|
name: _x( 'Sticky', 'Name for the value of the CSS position property' ),
|
|
45
|
-
|
|
37
|
+
hint: __(
|
|
46
38
|
'The block will stick to the top of the window instead of scrolling.'
|
|
47
39
|
),
|
|
48
40
|
};
|
|
@@ -51,9 +43,7 @@ const FIXED_OPTION = {
|
|
|
51
43
|
key: 'fixed',
|
|
52
44
|
value: 'fixed',
|
|
53
45
|
name: _x( 'Fixed', 'Name for the value of the CSS position property' ),
|
|
54
|
-
|
|
55
|
-
'The block will not move when the page is scrolled.'
|
|
56
|
-
),
|
|
46
|
+
hint: __( 'The block will not move when the page is scrolled.' ),
|
|
57
47
|
};
|
|
58
48
|
|
|
59
49
|
const POSITION_SIDES = [ 'top', 'right', 'bottom', 'left' ];
|
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
import { store as blocksStore } from '@wordpress/blocks';
|
|
5
5
|
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
6
6
|
import { useRegistry, useSelect } from '@wordpress/data';
|
|
7
|
-
import { useCallback, useMemo } from '@wordpress/element';
|
|
7
|
+
import { useCallback, useMemo, useContext } from '@wordpress/element';
|
|
8
8
|
import { addFilter } from '@wordpress/hooks';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
13
|
import { unlock } from '../lock-unlock';
|
|
14
|
+
import BlockContext from '../components/block-context';
|
|
14
15
|
|
|
15
16
|
/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */
|
|
16
17
|
/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */
|
|
@@ -93,15 +94,16 @@ export function canBindAttribute( blockName, attributeName ) {
|
|
|
93
94
|
export const withBlockBindingSupport = createHigherOrderComponent(
|
|
94
95
|
( BlockEdit ) => ( props ) => {
|
|
95
96
|
const registry = useRegistry();
|
|
97
|
+
const blockContext = useContext( BlockContext );
|
|
96
98
|
const sources = useSelect( ( select ) =>
|
|
97
99
|
unlock( select( blocksStore ) ).getAllBlockBindingsSources()
|
|
98
100
|
);
|
|
99
|
-
const { name, clientId
|
|
101
|
+
const { name, clientId } = props;
|
|
100
102
|
const hasParentPattern = !! props.context[ 'pattern/overrides' ];
|
|
101
103
|
const hasPatternOverridesDefaultBinding =
|
|
102
104
|
props.attributes.metadata?.bindings?.[ DEFAULT_ATTRIBUTE ]
|
|
103
105
|
?.source === 'core/pattern-overrides';
|
|
104
|
-
const
|
|
106
|
+
const blockBindings = useMemo(
|
|
105
107
|
() =>
|
|
106
108
|
replacePatternOverrideDefaultBindings(
|
|
107
109
|
name,
|
|
@@ -115,110 +117,138 @@ export const withBlockBindingSupport = createHigherOrderComponent(
|
|
|
115
117
|
// there are attribute updates.
|
|
116
118
|
// `source.getValues` may also call a selector via `registry.select`.
|
|
117
119
|
const boundAttributes = useSelect( () => {
|
|
118
|
-
if ( !
|
|
120
|
+
if ( ! blockBindings ) {
|
|
119
121
|
return;
|
|
120
122
|
}
|
|
121
123
|
|
|
122
124
|
const attributes = {};
|
|
123
125
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
const blockBindingsBySource = new Map();
|
|
127
|
+
|
|
128
|
+
for ( const [ attributeName, binding ] of Object.entries(
|
|
129
|
+
blockBindings
|
|
126
130
|
) ) {
|
|
127
|
-
const source
|
|
131
|
+
const { source: sourceName, args: sourceArgs } = binding;
|
|
132
|
+
const source = sources[ sourceName ];
|
|
128
133
|
if (
|
|
129
|
-
! source?.
|
|
134
|
+
! source?.getValues ||
|
|
130
135
|
! canBindAttribute( name, attributeName )
|
|
131
136
|
) {
|
|
132
137
|
continue;
|
|
133
138
|
}
|
|
134
139
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
140
|
+
blockBindingsBySource.set( source, {
|
|
141
|
+
...blockBindingsBySource.get( source ),
|
|
142
|
+
[ attributeName ]: {
|
|
143
|
+
args: sourceArgs,
|
|
144
|
+
},
|
|
145
|
+
} );
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if ( blockBindingsBySource.size ) {
|
|
149
|
+
for ( const [ source, bindings ] of blockBindingsBySource ) {
|
|
150
|
+
// Populate context.
|
|
151
|
+
const context = {};
|
|
152
|
+
|
|
153
|
+
if ( source.usesContext?.length ) {
|
|
154
|
+
for ( const key of source.usesContext ) {
|
|
155
|
+
context[ key ] = blockContext[ key ];
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Get values in batch if the source supports it.
|
|
160
|
+
const values = source.getValues( {
|
|
161
|
+
registry,
|
|
162
|
+
context,
|
|
163
|
+
clientId,
|
|
164
|
+
bindings,
|
|
165
|
+
} );
|
|
166
|
+
for ( const [ attributeName, value ] of Object.entries(
|
|
167
|
+
values
|
|
168
|
+
) ) {
|
|
169
|
+
// Use placeholder when value is undefined.
|
|
170
|
+
if ( value === undefined ) {
|
|
171
|
+
if ( attributeName === 'url' ) {
|
|
172
|
+
attributes[ attributeName ] = null;
|
|
173
|
+
} else {
|
|
174
|
+
attributes[ attributeName ] =
|
|
175
|
+
source.getPlaceholder?.( {
|
|
176
|
+
registry,
|
|
177
|
+
context,
|
|
178
|
+
clientId,
|
|
179
|
+
attributeName,
|
|
180
|
+
args: bindings[ attributeName ].args,
|
|
181
|
+
} );
|
|
182
|
+
}
|
|
183
|
+
} else {
|
|
184
|
+
attributes[ attributeName ] = value;
|
|
185
|
+
}
|
|
151
186
|
}
|
|
152
187
|
}
|
|
153
188
|
}
|
|
154
189
|
|
|
155
190
|
return attributes;
|
|
156
|
-
}, [
|
|
191
|
+
}, [ blockBindings, name, clientId, blockContext, registry, sources ] );
|
|
157
192
|
|
|
158
193
|
const { setAttributes } = props;
|
|
159
194
|
|
|
160
195
|
const _setAttributes = useCallback(
|
|
161
196
|
( nextAttributes ) => {
|
|
162
197
|
registry.batch( () => {
|
|
163
|
-
if ( !
|
|
198
|
+
if ( ! blockBindings ) {
|
|
164
199
|
setAttributes( nextAttributes );
|
|
165
200
|
return;
|
|
166
201
|
}
|
|
167
202
|
|
|
168
203
|
const keptAttributes = { ...nextAttributes };
|
|
169
|
-
const
|
|
204
|
+
const blockBindingsBySource = new Map();
|
|
170
205
|
|
|
171
206
|
// Loop only over the updated attributes to avoid modifying the bound ones that haven't changed.
|
|
172
207
|
for ( const [ attributeName, newValue ] of Object.entries(
|
|
173
208
|
keptAttributes
|
|
174
209
|
) ) {
|
|
175
210
|
if (
|
|
176
|
-
!
|
|
211
|
+
! blockBindings[ attributeName ] ||
|
|
177
212
|
! canBindAttribute( name, attributeName )
|
|
178
213
|
) {
|
|
179
214
|
continue;
|
|
180
215
|
}
|
|
181
216
|
|
|
182
|
-
const binding =
|
|
217
|
+
const binding = blockBindings[ attributeName ];
|
|
183
218
|
const source = sources[ binding?.source ];
|
|
184
|
-
if ( ! source?.
|
|
219
|
+
if ( ! source?.setValues ) {
|
|
185
220
|
continue;
|
|
186
221
|
}
|
|
187
|
-
|
|
188
|
-
...
|
|
189
|
-
[ attributeName ]:
|
|
222
|
+
blockBindingsBySource.set( source, {
|
|
223
|
+
...blockBindingsBySource.get( source ),
|
|
224
|
+
[ attributeName ]: {
|
|
225
|
+
args: binding.args,
|
|
226
|
+
newValue,
|
|
227
|
+
},
|
|
190
228
|
} );
|
|
191
229
|
delete keptAttributes[ attributeName ];
|
|
192
230
|
}
|
|
193
231
|
|
|
194
|
-
if (
|
|
232
|
+
if ( blockBindingsBySource.size ) {
|
|
195
233
|
for ( const [
|
|
196
234
|
source,
|
|
197
|
-
|
|
198
|
-
] of
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
} );
|
|
206
|
-
} else {
|
|
207
|
-
for ( const [
|
|
208
|
-
attributeName,
|
|
209
|
-
value,
|
|
210
|
-
] of Object.entries( attributes ) ) {
|
|
211
|
-
const binding = bindings[ attributeName ];
|
|
212
|
-
source.setValue( {
|
|
213
|
-
registry,
|
|
214
|
-
context,
|
|
215
|
-
clientId,
|
|
216
|
-
attributeName,
|
|
217
|
-
args: binding.args,
|
|
218
|
-
value,
|
|
219
|
-
} );
|
|
235
|
+
bindings,
|
|
236
|
+
] of blockBindingsBySource ) {
|
|
237
|
+
// Populate context.
|
|
238
|
+
const context = {};
|
|
239
|
+
|
|
240
|
+
if ( source.usesContext?.length ) {
|
|
241
|
+
for ( const key of source.usesContext ) {
|
|
242
|
+
context[ key ] = blockContext[ key ];
|
|
220
243
|
}
|
|
221
244
|
}
|
|
245
|
+
|
|
246
|
+
source.setValues( {
|
|
247
|
+
registry,
|
|
248
|
+
context,
|
|
249
|
+
clientId,
|
|
250
|
+
bindings,
|
|
251
|
+
} );
|
|
222
252
|
}
|
|
223
253
|
}
|
|
224
254
|
|
|
@@ -242,10 +272,10 @@ export const withBlockBindingSupport = createHigherOrderComponent(
|
|
|
242
272
|
},
|
|
243
273
|
[
|
|
244
274
|
registry,
|
|
245
|
-
|
|
275
|
+
blockBindings,
|
|
246
276
|
name,
|
|
247
277
|
clientId,
|
|
248
|
-
|
|
278
|
+
blockContext,
|
|
249
279
|
setAttributes,
|
|
250
280
|
sources,
|
|
251
281
|
hasPatternOverridesDefaultBinding,
|
|
@@ -234,15 +234,23 @@ export default {
|
|
|
234
234
|
const paddingValues = getCSSRules( style );
|
|
235
235
|
paddingValues.forEach( ( rule ) => {
|
|
236
236
|
if ( rule.key === 'paddingRight' ) {
|
|
237
|
+
// Add unit if 0, to avoid calc(0 * -1) which is invalid.
|
|
238
|
+
const paddingRightValue =
|
|
239
|
+
rule.value === '0' ? '0px' : rule.value;
|
|
240
|
+
|
|
237
241
|
output += `
|
|
238
242
|
${ appendSelectors( selector, '> .alignfull' ) } {
|
|
239
|
-
margin-right: calc(${
|
|
243
|
+
margin-right: calc(${ paddingRightValue } * -1);
|
|
240
244
|
}
|
|
241
245
|
`;
|
|
242
246
|
} else if ( rule.key === 'paddingLeft' ) {
|
|
247
|
+
// Add unit if 0, to avoid calc(0 * -1) which is invalid.
|
|
248
|
+
const paddingLeftValue =
|
|
249
|
+
rule.value === '0' ? '0px' : rule.value;
|
|
250
|
+
|
|
243
251
|
output += `
|
|
244
252
|
${ appendSelectors( selector, '> .alignfull' ) } {
|
|
245
|
-
margin-left: calc(${
|
|
253
|
+
margin-left: calc(${ paddingLeftValue } * -1);
|
|
246
254
|
}
|
|
247
255
|
`;
|
|
248
256
|
}
|
package/src/layouts/grid.js
CHANGED
|
@@ -264,6 +264,7 @@ function GridLayoutMinimumWidthControl( { layout, onChange } ) {
|
|
|
264
264
|
</FlexItem>
|
|
265
265
|
<FlexItem isBlock>
|
|
266
266
|
<RangeControl
|
|
267
|
+
__nextHasNoMarginBottom
|
|
267
268
|
onChange={ handleSliderChange }
|
|
268
269
|
value={ quantity || 0 }
|
|
269
270
|
min={ 0 }
|
|
@@ -367,6 +368,7 @@ function GridLayoutColumnsAndRowsControl( {
|
|
|
367
368
|
/>
|
|
368
369
|
) : (
|
|
369
370
|
<RangeControl
|
|
371
|
+
__nextHasNoMarginBottom
|
|
370
372
|
value={ columnCount ?? 0 }
|
|
371
373
|
onChange={ ( value ) =>
|
|
372
374
|
onChange( {
|
package/src/private-apis.js
CHANGED
|
@@ -29,10 +29,6 @@ import {
|
|
|
29
29
|
import DimensionsTool from './components/dimensions-tool';
|
|
30
30
|
import ResolutionTool from './components/resolution-tool';
|
|
31
31
|
import TextAlignmentControl from './components/text-alignment-control';
|
|
32
|
-
import {
|
|
33
|
-
default as ReusableBlocksRenameHint,
|
|
34
|
-
useReusableBlocksRenameHint,
|
|
35
|
-
} from './components/inserter/reusable-block-rename-hint';
|
|
36
32
|
import { usesContextKey } from './components/rich-text/format-edit';
|
|
37
33
|
import { ExperimentalBlockCanvas } from './components/block-canvas';
|
|
38
34
|
import { getDuotoneFilter } from './components/duotone/utils';
|
|
@@ -82,8 +78,6 @@ lock( privateApis, {
|
|
|
82
78
|
ResolutionTool,
|
|
83
79
|
TabbedSidebar,
|
|
84
80
|
TextAlignmentControl,
|
|
85
|
-
ReusableBlocksRenameHint,
|
|
86
|
-
useReusableBlocksRenameHint,
|
|
87
81
|
usesContextKey,
|
|
88
82
|
useFlashEditableBlocks,
|
|
89
83
|
globalStylesDataKey,
|
package/src/store/actions.js
CHANGED
|
@@ -213,6 +213,21 @@ export function selectBlock( clientId, initialPosition = 0 ) {
|
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
+
/**
|
|
217
|
+
* Returns an action object used in signalling that the block with the
|
|
218
|
+
* specified client ID has been hovered.
|
|
219
|
+
*
|
|
220
|
+
* @param {string} clientId Block client ID.
|
|
221
|
+
*
|
|
222
|
+
* @return {Object} Action object.
|
|
223
|
+
*/
|
|
224
|
+
export function hoverBlock( clientId ) {
|
|
225
|
+
return {
|
|
226
|
+
type: 'HOVER_BLOCK',
|
|
227
|
+
clientId,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
216
231
|
/**
|
|
217
232
|
* Yields action objects used in signalling that the block preceding the given
|
|
218
233
|
* clientId (or optionally, its first parent from bottom to top)
|
package/src/store/reducer.js
CHANGED
|
@@ -2068,6 +2068,23 @@ export function lastFocus( state = false, action ) {
|
|
|
2068
2068
|
return state;
|
|
2069
2069
|
}
|
|
2070
2070
|
|
|
2071
|
+
/**
|
|
2072
|
+
* Reducer setting currently hovered block.
|
|
2073
|
+
*
|
|
2074
|
+
* @param {boolean} state Current state.
|
|
2075
|
+
* @param {Object} action Dispatched action.
|
|
2076
|
+
*
|
|
2077
|
+
* @return {boolean} Updated state.
|
|
2078
|
+
*/
|
|
2079
|
+
export function hoveredBlockClientId( state = false, action ) {
|
|
2080
|
+
switch ( action.type ) {
|
|
2081
|
+
case 'HOVER_BLOCK':
|
|
2082
|
+
return action.clientId;
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
return state;
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2071
2088
|
const combinedReducers = combineReducers( {
|
|
2072
2089
|
blocks,
|
|
2073
2090
|
isDragging,
|
|
@@ -2100,6 +2117,7 @@ const combinedReducers = combineReducers( {
|
|
|
2100
2117
|
blockRemovalRules,
|
|
2101
2118
|
openedBlockSettingsMenu,
|
|
2102
2119
|
registeredInserterMediaCategories,
|
|
2120
|
+
hoveredBlockClientId,
|
|
2103
2121
|
} );
|
|
2104
2122
|
|
|
2105
2123
|
function withAutomaticChangeReset( reducer ) {
|
package/src/store/selectors.js
CHANGED
|
@@ -2809,6 +2809,16 @@ export function isBlockVisible( state, clientId ) {
|
|
|
2809
2809
|
return state.blockVisibility?.[ clientId ] ?? true;
|
|
2810
2810
|
}
|
|
2811
2811
|
|
|
2812
|
+
/**
|
|
2813
|
+
* Returns the currently hovered block.
|
|
2814
|
+
*
|
|
2815
|
+
* @param {Object} state Global application state.
|
|
2816
|
+
* @return {Object} Client Id of the hovered block.
|
|
2817
|
+
*/
|
|
2818
|
+
export function getHoveredBlockClientId( state ) {
|
|
2819
|
+
return state.hoveredBlockClientId;
|
|
2820
|
+
}
|
|
2821
|
+
|
|
2812
2822
|
/**
|
|
2813
2823
|
* Returns the list of all hidden blocks.
|
|
2814
2824
|
*
|