@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
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
5
|
-
import { useEffect } from '@wordpress/element';
|
|
5
|
+
import { useEffect, useMemo } from '@wordpress/element';
|
|
6
|
+
import { usePrevious } from '@wordpress/compose';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
@@ -11,13 +12,15 @@ import { store as blockEditorStore } from '../../store';
|
|
|
11
12
|
import { GridRect } from './utils';
|
|
12
13
|
|
|
13
14
|
export function useGridLayoutSync( { clientId: gridClientId } ) {
|
|
14
|
-
const { gridLayout, blockOrder } = useSelect(
|
|
15
|
+
const { gridLayout, blockOrder, selectedBlockLayout } = useSelect(
|
|
15
16
|
( select ) => {
|
|
16
17
|
const { getBlockAttributes, getBlockOrder } =
|
|
17
18
|
select( blockEditorStore );
|
|
19
|
+
const selectedBlock = select( blockEditorStore ).getSelectedBlock();
|
|
18
20
|
return {
|
|
19
21
|
gridLayout: getBlockAttributes( gridClientId ).layout ?? {},
|
|
20
22
|
blockOrder: getBlockOrder( gridClientId ),
|
|
23
|
+
selectedBlockLayout: selectedBlock?.attributes.style?.layout,
|
|
21
24
|
};
|
|
22
25
|
},
|
|
23
26
|
[ gridClientId ]
|
|
@@ -27,27 +30,32 @@ export function useGridLayoutSync( { clientId: gridClientId } ) {
|
|
|
27
30
|
const { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } =
|
|
28
31
|
useDispatch( blockEditorStore );
|
|
29
32
|
|
|
33
|
+
const selectedBlockRect = useMemo(
|
|
34
|
+
() =>
|
|
35
|
+
selectedBlockLayout ? new GridRect( selectedBlockLayout ) : null,
|
|
36
|
+
[ selectedBlockLayout ]
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const previouslySelectedBlockRect = usePrevious( selectedBlockRect );
|
|
40
|
+
|
|
30
41
|
useEffect( () => {
|
|
31
42
|
const updates = {};
|
|
32
43
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if ( isManualPlacement ) {
|
|
36
|
-
const rects = [];
|
|
44
|
+
if ( gridLayout.isManualPlacement ) {
|
|
45
|
+
const occupiedRects = [];
|
|
37
46
|
|
|
38
47
|
// Respect the position of blocks that already have a columnStart and rowStart value.
|
|
39
48
|
for ( const clientId of blockOrder ) {
|
|
40
|
-
const attributes = getBlockAttributes( clientId );
|
|
41
49
|
const {
|
|
42
50
|
columnStart,
|
|
43
51
|
rowStart,
|
|
44
52
|
columnSpan = 1,
|
|
45
53
|
rowSpan = 1,
|
|
46
|
-
} =
|
|
54
|
+
} = getBlockAttributes( clientId ).style?.layout ?? {};
|
|
47
55
|
if ( ! columnStart || ! rowStart ) {
|
|
48
56
|
continue;
|
|
49
57
|
}
|
|
50
|
-
|
|
58
|
+
occupiedRects.push(
|
|
51
59
|
new GridRect( {
|
|
52
60
|
columnStart,
|
|
53
61
|
rowStart,
|
|
@@ -65,17 +73,19 @@ export function useGridLayoutSync( { clientId: gridClientId } ) {
|
|
|
65
73
|
rowStart,
|
|
66
74
|
columnSpan = 1,
|
|
67
75
|
rowSpan = 1,
|
|
68
|
-
} = attributes.style?.layout
|
|
76
|
+
} = attributes.style?.layout ?? {};
|
|
69
77
|
if ( columnStart && rowStart ) {
|
|
70
78
|
continue;
|
|
71
79
|
}
|
|
72
|
-
const [ newColumnStart, newRowStart ] =
|
|
73
|
-
|
|
74
|
-
columnCount,
|
|
80
|
+
const [ newColumnStart, newRowStart ] = placeBlock(
|
|
81
|
+
occupiedRects,
|
|
82
|
+
gridLayout.columnCount,
|
|
75
83
|
columnSpan,
|
|
76
|
-
rowSpan
|
|
84
|
+
rowSpan,
|
|
85
|
+
previouslySelectedBlockRect?.columnEnd,
|
|
86
|
+
previouslySelectedBlockRect?.rowEnd
|
|
77
87
|
);
|
|
78
|
-
|
|
88
|
+
occupiedRects.push(
|
|
79
89
|
new GridRect( {
|
|
80
90
|
columnStart: newColumnStart,
|
|
81
91
|
rowStart: newRowStart,
|
|
@@ -96,8 +106,13 @@ export function useGridLayoutSync( { clientId: gridClientId } ) {
|
|
|
96
106
|
}
|
|
97
107
|
|
|
98
108
|
// Ensure there's enough rows to fit all blocks.
|
|
99
|
-
const bottomMostRow = Math.max(
|
|
100
|
-
|
|
109
|
+
const bottomMostRow = Math.max(
|
|
110
|
+
...occupiedRects.map( ( r ) => r.rowEnd )
|
|
111
|
+
);
|
|
112
|
+
if (
|
|
113
|
+
! gridLayout.rowCount ||
|
|
114
|
+
gridLayout.rowCount < bottomMostRow
|
|
115
|
+
) {
|
|
101
116
|
updates[ gridClientId ] = {
|
|
102
117
|
layout: {
|
|
103
118
|
...gridLayout,
|
|
@@ -110,7 +125,7 @@ export function useGridLayoutSync( { clientId: gridClientId } ) {
|
|
|
110
125
|
for ( const clientId of blockOrder ) {
|
|
111
126
|
const attributes = getBlockAttributes( clientId );
|
|
112
127
|
const { columnStart, rowStart, ...layout } =
|
|
113
|
-
attributes.style?.layout
|
|
128
|
+
attributes.style?.layout ?? {};
|
|
114
129
|
// Only update attributes if columnStart or rowStart are set.
|
|
115
130
|
if ( columnStart || rowStart ) {
|
|
116
131
|
updates[ clientId ] = {
|
|
@@ -123,7 +138,7 @@ export function useGridLayoutSync( { clientId: gridClientId } ) {
|
|
|
123
138
|
}
|
|
124
139
|
|
|
125
140
|
// Remove row styles in auto mode
|
|
126
|
-
if ( rowCount ) {
|
|
141
|
+
if ( gridLayout.rowCount ) {
|
|
127
142
|
updates[ gridClientId ] = {
|
|
128
143
|
layout: {
|
|
129
144
|
...gridLayout,
|
|
@@ -146,23 +161,47 @@ export function useGridLayoutSync( { clientId: gridClientId } ) {
|
|
|
146
161
|
gridClientId,
|
|
147
162
|
gridLayout,
|
|
148
163
|
blockOrder,
|
|
149
|
-
|
|
164
|
+
previouslySelectedBlockRect,
|
|
165
|
+
// These won't change, but the linter thinks they might:
|
|
150
166
|
__unstableMarkNextChangeAsNotPersistent,
|
|
151
167
|
getBlockAttributes,
|
|
152
168
|
updateBlockAttributes,
|
|
153
169
|
] );
|
|
154
170
|
}
|
|
155
171
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
172
|
+
/**
|
|
173
|
+
* @param {GridRect[]} occupiedRects
|
|
174
|
+
* @param {number} gridColumnCount
|
|
175
|
+
* @param {number} blockColumnSpan
|
|
176
|
+
* @param {number} blockRowSpan
|
|
177
|
+
* @param {number?} startColumn
|
|
178
|
+
* @param {number?} startRow
|
|
179
|
+
*/
|
|
180
|
+
function placeBlock(
|
|
181
|
+
occupiedRects,
|
|
182
|
+
gridColumnCount,
|
|
183
|
+
blockColumnSpan,
|
|
184
|
+
blockRowSpan,
|
|
185
|
+
startColumn = 1,
|
|
186
|
+
startRow = 1
|
|
187
|
+
) {
|
|
188
|
+
for ( let row = startRow; ; row++ ) {
|
|
189
|
+
for (
|
|
190
|
+
let column = row === startRow ? startColumn : 1;
|
|
191
|
+
column <= gridColumnCount;
|
|
192
|
+
column++
|
|
193
|
+
) {
|
|
194
|
+
const candidateRect = new GridRect( {
|
|
160
195
|
columnStart: column,
|
|
161
196
|
rowStart: row,
|
|
162
|
-
columnSpan,
|
|
163
|
-
rowSpan,
|
|
197
|
+
columnSpan: blockColumnSpan,
|
|
198
|
+
rowSpan: blockRowSpan,
|
|
164
199
|
} );
|
|
165
|
-
if (
|
|
200
|
+
if (
|
|
201
|
+
! occupiedRects.some( ( r ) =>
|
|
202
|
+
r.intersectsRect( candidateRect )
|
|
203
|
+
)
|
|
204
|
+
) {
|
|
166
205
|
return [ column, row ];
|
|
167
206
|
}
|
|
168
207
|
}
|
package/src/components/index.js
CHANGED
|
@@ -170,8 +170,3 @@ export { useBlockEditingMode } from './block-editing-mode';
|
|
|
170
170
|
export { default as BlockEditorProvider } from './provider';
|
|
171
171
|
export { useSettings, useSetting } from './use-settings';
|
|
172
172
|
export { useBlockCommands } from './use-block-commands';
|
|
173
|
-
|
|
174
|
-
/*
|
|
175
|
-
* The following rename hint component can be removed in 6.4.
|
|
176
|
-
*/
|
|
177
|
-
export { default as ReusableBlocksRenameHint } from './inserter/reusable-block-rename-hint';
|
|
@@ -132,7 +132,10 @@ function UncontrolledInnerBlocks( props ) {
|
|
|
132
132
|
/>
|
|
133
133
|
);
|
|
134
134
|
|
|
135
|
-
if (
|
|
135
|
+
if (
|
|
136
|
+
! blockType?.providesContext ||
|
|
137
|
+
Object.keys( blockType.providesContext ).length === 0
|
|
138
|
+
) {
|
|
136
139
|
return items;
|
|
137
140
|
}
|
|
138
141
|
|
|
@@ -22,11 +22,31 @@ import {
|
|
|
22
22
|
INSERTER_PATTERN_TYPES,
|
|
23
23
|
} from './utils';
|
|
24
24
|
|
|
25
|
-
const getShouldDisableSyncFilter = ( sourceFilter ) =>
|
|
26
|
-
|
|
25
|
+
const getShouldDisableSyncFilter = ( sourceFilter ) =>
|
|
26
|
+
sourceFilter !== 'all' && sourceFilter !== 'user';
|
|
27
|
+
const getShouldHideSourcesFilter = ( category ) => {
|
|
27
28
|
return category.name === myPatternsCategory.name;
|
|
28
29
|
};
|
|
29
30
|
|
|
31
|
+
const PATTERN_SOURCE_MENU_OPTIONS = [
|
|
32
|
+
{
|
|
33
|
+
value: 'all',
|
|
34
|
+
label: _x( 'All', 'patterns' ),
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
value: INSERTER_PATTERN_TYPES.directory,
|
|
38
|
+
label: __( 'Pattern Directory' ),
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
value: INSERTER_PATTERN_TYPES.theme,
|
|
42
|
+
label: __( 'Theme & Plugins' ),
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
value: INSERTER_PATTERN_TYPES.user,
|
|
46
|
+
label: __( 'User' ),
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
|
|
30
50
|
export function PatternsFilter( {
|
|
31
51
|
setPatternSyncFilter,
|
|
32
52
|
setPatternSourceFilter,
|
|
@@ -50,10 +70,9 @@ export function PatternsFilter( {
|
|
|
50
70
|
currentPatternSourceFilter
|
|
51
71
|
);
|
|
52
72
|
|
|
53
|
-
// We also
|
|
54
|
-
//
|
|
55
|
-
const
|
|
56
|
-
getShouldDisableNonUserSources( category );
|
|
73
|
+
// We also hide the directory and theme source filter if the category is `myPatterns`
|
|
74
|
+
// otherwise there will only be one option available.
|
|
75
|
+
const shouldHideSourcesFilter = getShouldHideSourcesFilter( category );
|
|
57
76
|
|
|
58
77
|
const patternSyncMenuOptions = useMemo(
|
|
59
78
|
() => [
|
|
@@ -75,31 +94,6 @@ export function PatternsFilter( {
|
|
|
75
94
|
[ shouldDisableSyncFilter ]
|
|
76
95
|
);
|
|
77
96
|
|
|
78
|
-
const patternSourceMenuOptions = useMemo(
|
|
79
|
-
() => [
|
|
80
|
-
{
|
|
81
|
-
value: 'all',
|
|
82
|
-
label: _x( 'All', 'patterns' ),
|
|
83
|
-
disabled: shouldDisableNonUserSources,
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
value: INSERTER_PATTERN_TYPES.directory,
|
|
87
|
-
label: __( 'Pattern Directory' ),
|
|
88
|
-
disabled: shouldDisableNonUserSources,
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
value: INSERTER_PATTERN_TYPES.theme,
|
|
92
|
-
label: __( 'Theme & Plugins' ),
|
|
93
|
-
disabled: shouldDisableNonUserSources,
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
value: INSERTER_PATTERN_TYPES.user,
|
|
97
|
-
label: __( 'User' ),
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
[ shouldDisableNonUserSources ]
|
|
101
|
-
);
|
|
102
|
-
|
|
103
97
|
function handleSetSourceFilterChange( newSourceFilter ) {
|
|
104
98
|
setPatternSourceFilter( newSourceFilter );
|
|
105
99
|
if ( getShouldDisableSyncFilter( newSourceFilter ) ) {
|
|
@@ -136,19 +130,21 @@ export function PatternsFilter( {
|
|
|
136
130
|
>
|
|
137
131
|
{ () => (
|
|
138
132
|
<>
|
|
139
|
-
|
|
140
|
-
<
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
133
|
+
{ ! shouldHideSourcesFilter && (
|
|
134
|
+
<MenuGroup label={ __( 'Source' ) }>
|
|
135
|
+
<MenuItemsChoice
|
|
136
|
+
choices={ PATTERN_SOURCE_MENU_OPTIONS }
|
|
137
|
+
onSelect={ ( value ) => {
|
|
138
|
+
handleSetSourceFilterChange( value );
|
|
139
|
+
scrollContainerRef.current?.scrollTo(
|
|
140
|
+
0,
|
|
141
|
+
0
|
|
142
|
+
);
|
|
143
|
+
} }
|
|
144
|
+
value={ currentPatternSourceFilter }
|
|
145
|
+
/>
|
|
146
|
+
</MenuGroup>
|
|
147
|
+
) }
|
|
152
148
|
<MenuGroup label={ __( 'Type' ) }>
|
|
153
149
|
<MenuItemsChoice
|
|
154
150
|
choices={ patternSyncMenuOptions }
|
|
@@ -147,7 +147,7 @@ function InserterMenu(
|
|
|
147
147
|
const showMediaPanel = selectedTab === 'media' && !! selectedMediaCategory;
|
|
148
148
|
|
|
149
149
|
const showZoomOut =
|
|
150
|
-
showPatternPanel && window.__experimentalEnableZoomedOutPatternsTab;
|
|
150
|
+
showPatternPanel && !! window.__experimentalEnableZoomedOutPatternsTab;
|
|
151
151
|
|
|
152
152
|
useZoomOut( showZoomOut );
|
|
153
153
|
|
|
@@ -30,6 +30,15 @@ function InserterPreviewPanel( { item } ) {
|
|
|
30
30
|
innerBlocks: example.innerBlocks,
|
|
31
31
|
} );
|
|
32
32
|
}, [ name, example, initialAttributes ] );
|
|
33
|
+
// Same as height of BlockPreviewPanel.
|
|
34
|
+
const previewHeight = 144;
|
|
35
|
+
const sidebarWidth = 280;
|
|
36
|
+
const viewportWidth = example?.viewportWidth ?? 500;
|
|
37
|
+
const scale = sidebarWidth / viewportWidth;
|
|
38
|
+
const minHeight =
|
|
39
|
+
scale !== 0 && scale < 1 && previewHeight
|
|
40
|
+
? previewHeight / scale
|
|
41
|
+
: previewHeight;
|
|
33
42
|
|
|
34
43
|
return (
|
|
35
44
|
<div className="block-editor-inserter__preview-container">
|
|
@@ -38,10 +47,24 @@ function InserterPreviewPanel( { item } ) {
|
|
|
38
47
|
<div className="block-editor-inserter__preview-content">
|
|
39
48
|
<BlockPreview
|
|
40
49
|
blocks={ blocks }
|
|
41
|
-
viewportWidth={
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
50
|
+
viewportWidth={ viewportWidth }
|
|
51
|
+
minHeight={ previewHeight }
|
|
52
|
+
additionalStyles={
|
|
53
|
+
//We want this CSS to be in sync with the one in BlockPreviewPanel.
|
|
54
|
+
[
|
|
55
|
+
{
|
|
56
|
+
css: `
|
|
57
|
+
body {
|
|
58
|
+
padding: 24px;
|
|
59
|
+
min-height:${ Math.round( minHeight ) }px;
|
|
60
|
+
display:flex;
|
|
61
|
+
align-items:center;
|
|
62
|
+
}
|
|
63
|
+
.is-root-container { width: 100%; }
|
|
64
|
+
`,
|
|
65
|
+
},
|
|
66
|
+
]
|
|
67
|
+
}
|
|
45
68
|
/>
|
|
46
69
|
</div>
|
|
47
70
|
) : (
|
|
@@ -228,6 +228,13 @@ $block-inserter-tabs-height: 44px;
|
|
|
228
228
|
margin-top: auto;
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
+
// Temporarily disable the component's indicator animation.
|
|
232
|
+
// TODO: remove in favor of using the native component's styles and behavior,
|
|
233
|
+
// see https://github.com/WordPress/gutenberg/pull/62879#issuecomment-2219720582
|
|
234
|
+
&[aria-orientation="vertical"]::after {
|
|
235
|
+
content: none;
|
|
236
|
+
}
|
|
237
|
+
|
|
231
238
|
.block-editor-inserter__category-tab {
|
|
232
239
|
// Account for the icon on the right so that it's visually balanced.
|
|
233
240
|
padding: $grid-unit-10 $grid-unit-05 $grid-unit-10 $grid-unit-15;
|
|
@@ -284,34 +291,35 @@ $block-inserter-tabs-height: 44px;
|
|
|
284
291
|
}
|
|
285
292
|
|
|
286
293
|
.block-editor-inserter__category-panel {
|
|
287
|
-
background: $gray-100;
|
|
288
|
-
border-top: $border-width solid $gray-200;
|
|
289
|
-
box-shadow: $border-width $border-width 0 0 rgba($color: #000, $alpha: 0.133); // 0.133 = $gray-200 but with alpha.
|
|
290
294
|
outline: 1px solid transparent; // Shown for Windows 10 High Contrast mode.
|
|
291
|
-
position: absolute;
|
|
292
|
-
top: -$border-width;
|
|
293
|
-
left: 0;
|
|
294
|
-
height: calc(100% + #{$border-width});
|
|
295
|
-
width: 100%;
|
|
296
|
-
padding: 0 $grid-unit-20;
|
|
297
295
|
display: flex;
|
|
298
296
|
flex-direction: column;
|
|
297
|
+
padding: 0 $grid-unit-20;
|
|
299
298
|
|
|
300
299
|
@include break-medium {
|
|
301
300
|
border-left: $border-width solid $gray-200;
|
|
302
301
|
padding: 0;
|
|
303
302
|
left: 100%;
|
|
304
303
|
width: 300px;
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
304
|
+
position: absolute;
|
|
305
|
+
top: -$border-width;
|
|
306
|
+
height: calc(100% + #{$border-width});
|
|
307
|
+
background: $gray-100;
|
|
308
|
+
border-top: $border-width solid $gray-200;
|
|
309
|
+
box-shadow: $border-width $border-width 0 0 rgba($color: #000, $alpha: 0.133); // 0.133 = $gray-200 but with alpha.
|
|
310
|
+
|
|
311
|
+
.block-editor-inserter__media-list,
|
|
312
|
+
.block-editor-block-patterns-list {
|
|
313
|
+
padding: 0 $grid-unit-30 $grid-unit-20;
|
|
314
|
+
}
|
|
310
315
|
}
|
|
311
316
|
}
|
|
312
317
|
|
|
313
318
|
.block-editor-inserter__patterns-category-panel-header {
|
|
314
|
-
padding: $grid-unit-10
|
|
319
|
+
padding: $grid-unit-10 0;
|
|
320
|
+
@include break-medium {
|
|
321
|
+
padding: $grid-unit-10 $grid-unit-30;
|
|
322
|
+
}
|
|
315
323
|
}
|
|
316
324
|
|
|
317
325
|
.block-editor-inserter__patterns-category-no-results {
|
|
@@ -326,7 +334,6 @@ $block-inserter-tabs-height: 44px;
|
|
|
326
334
|
}
|
|
327
335
|
|
|
328
336
|
.block-editor-inserter__preview-content {
|
|
329
|
-
min-height: $grid-unit-60 * 3;
|
|
330
337
|
background: $gray-100;
|
|
331
338
|
display: grid;
|
|
332
339
|
flex-grow: 1;
|
|
@@ -516,10 +523,15 @@ $block-inserter-tabs-height: 44px;
|
|
|
516
523
|
}
|
|
517
524
|
|
|
518
525
|
.block-editor-inserter__media-panel-search {
|
|
519
|
-
|
|
526
|
+
margin-bottom: $grid-unit-30;
|
|
520
527
|
// TODO: Consider using the Theme component to automatically adapt to a gray background.
|
|
521
|
-
|
|
522
|
-
|
|
528
|
+
@include break-medium() {
|
|
529
|
+
margin-bottom: 0;
|
|
530
|
+
padding: $grid-unit-20 $grid-unit-30 $grid-unit-20;
|
|
531
|
+
|
|
532
|
+
&:not(:focus-within) {
|
|
533
|
+
--wp-components-color-background: #{$white};
|
|
534
|
+
}
|
|
523
535
|
}
|
|
524
536
|
}
|
|
525
537
|
}
|
|
@@ -643,30 +655,6 @@ $block-inserter-tabs-height: 44px;
|
|
|
643
655
|
margin: $grid-unit-20 $grid-unit-20 0;
|
|
644
656
|
}
|
|
645
657
|
|
|
646
|
-
.reusable-blocks-menu-items__rename-hint {
|
|
647
|
-
align-items: top;
|
|
648
|
-
background: $gray-100;
|
|
649
|
-
border-radius: $radius-block-ui;
|
|
650
|
-
color: $gray-900;
|
|
651
|
-
display: flex;
|
|
652
|
-
flex-direction: row;
|
|
653
|
-
max-width: 380px;
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
.reusable-blocks-menu-items__rename-hint-content {
|
|
657
|
-
margin: $grid-unit-15 0 $grid-unit-15 $grid-unit-15;
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
.reusable-blocks-menu-items__rename-hint-dismiss {
|
|
661
|
-
// The dismiss button has a lot of empty space through its padding.
|
|
662
|
-
// Apply margin to visually align the icon with the top of the text to its left.
|
|
663
|
-
margin: $grid-unit-05 $grid-unit-05 $grid-unit-05 0;
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
.components-menu-group .reusable-blocks-menu-items__rename-hint {
|
|
667
|
-
margin: 0;
|
|
668
|
-
}
|
|
669
|
-
|
|
670
658
|
.block-editor-patterns__sync-status-filter {
|
|
671
659
|
.components-input-control__container {
|
|
672
660
|
select.components-select-control__input {
|
|
@@ -691,4 +679,30 @@ $block-inserter-tabs-height: 44px;
|
|
|
691
679
|
height: 100%;
|
|
692
680
|
}
|
|
693
681
|
}
|
|
682
|
+
|
|
683
|
+
// Remove doubled-up shadow that occurs when categories panel is opened, only in zoom out.
|
|
684
|
+
// Shadow cannot be removed from the source, as it is required when not zoomed out.
|
|
685
|
+
.block-editor-inserter__category-panel {
|
|
686
|
+
box-shadow: none;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
.show-icon-labels {
|
|
691
|
+
@media (max-width: #{ ($break-large - 1) }) {
|
|
692
|
+
.block-editor-block-patterns-explorer .block-editor-patterns__grid-pagination {
|
|
693
|
+
flex-direction: column;
|
|
694
|
+
.block-editor-patterns__grid-pagination-previous,
|
|
695
|
+
.block-editor-patterns__grid-pagination-next {
|
|
696
|
+
flex-direction: column;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
.block-editor-inserter__category-panel .block-editor-patterns__grid-pagination {
|
|
702
|
+
flex-direction: column;
|
|
703
|
+
.block-editor-patterns__grid-pagination-previous,
|
|
704
|
+
.block-editor-patterns__grid-pagination-next {
|
|
705
|
+
flex-direction: column;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
694
708
|
}
|
|
@@ -43,6 +43,14 @@ const InserterDraggableBlocks = ( {
|
|
|
43
43
|
useDispatch( blockEditorStore )
|
|
44
44
|
);
|
|
45
45
|
|
|
46
|
+
if ( ! isEnabled ) {
|
|
47
|
+
return children( {
|
|
48
|
+
draggable: false,
|
|
49
|
+
onDragStart: undefined,
|
|
50
|
+
onDragEnd: undefined,
|
|
51
|
+
} );
|
|
52
|
+
}
|
|
53
|
+
|
|
46
54
|
return (
|
|
47
55
|
<Draggable
|
|
48
56
|
__experimentalTransferDataType="wp-blocks"
|
|
@@ -72,9 +80,9 @@ const InserterDraggableBlocks = ( {
|
|
|
72
80
|
>
|
|
73
81
|
{ ( { onDraggableStart, onDraggableEnd } ) => {
|
|
74
82
|
return children( {
|
|
75
|
-
draggable:
|
|
76
|
-
onDragStart:
|
|
77
|
-
onDragEnd:
|
|
83
|
+
draggable: true,
|
|
84
|
+
onDragStart: onDraggableStart,
|
|
85
|
+
onDragEnd: onDraggableEnd,
|
|
78
86
|
} );
|
|
79
87
|
} }
|
|
80
88
|
</Draggable>
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import AdvancedControls from './advanced-controls-panel';
|
|
5
5
|
import PositionControls from './position-controls-panel';
|
|
6
6
|
import { default as InspectorControls } from '../inspector-controls';
|
|
7
|
-
import SettingsTabHint from './settings-tab-hint';
|
|
8
7
|
|
|
9
8
|
const SettingsTab = ( { showAdvancedControls = false } ) => (
|
|
10
9
|
<>
|
|
@@ -15,7 +14,6 @@ const SettingsTab = ( { showAdvancedControls = false } ) => (
|
|
|
15
14
|
<AdvancedControls />
|
|
16
15
|
</div>
|
|
17
16
|
) }
|
|
18
|
-
<SettingsTabHint />
|
|
19
17
|
</>
|
|
20
18
|
);
|
|
21
19
|
|
|
@@ -5,24 +5,3 @@
|
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
.block-editor-inspector-controls-tabs__hint {
|
|
10
|
-
align-items: flex-start;
|
|
11
|
-
background: $gray-100;
|
|
12
|
-
border-radius: $radius-block-ui;
|
|
13
|
-
color: $gray-900;
|
|
14
|
-
display: flex;
|
|
15
|
-
flex-direction: row;
|
|
16
|
-
margin: $grid-unit-20;
|
|
17
|
-
font-size: $default-font-size;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.block-editor-inspector-controls-tabs__hint-content {
|
|
21
|
-
margin: $grid-unit-15 0 $grid-unit-15 $grid-unit-15;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.block-editor-inspector-controls-tabs__hint-dismiss {
|
|
25
|
-
// The dismiss button has a lot of empty space through its padding.
|
|
26
|
-
// Apply margin to visually align the icon with the top of the text to its left.
|
|
27
|
-
margin: $grid-unit-05 $grid-unit-05 $grid-unit-05 0;
|
|
28
|
-
}
|
|
@@ -10,12 +10,10 @@ import {
|
|
|
10
10
|
Button,
|
|
11
11
|
__experimentalHStack as HStack,
|
|
12
12
|
__experimentalTruncate as Truncate,
|
|
13
|
-
Tooltip,
|
|
14
13
|
} from '@wordpress/components';
|
|
15
14
|
import { forwardRef } from '@wordpress/element';
|
|
16
15
|
import { Icon, lockSmall as lock, pinSmall } from '@wordpress/icons';
|
|
17
16
|
import { SPACE, ENTER } from '@wordpress/keycodes';
|
|
18
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
19
17
|
import { useSelect } from '@wordpress/data';
|
|
20
18
|
|
|
21
19
|
/**
|
|
@@ -65,14 +63,6 @@ function ListViewBlockSelectButton(
|
|
|
65
63
|
const isSticky = blockInformation?.positionType === 'sticky';
|
|
66
64
|
const images = useListViewImages( { clientId, isExpanded } );
|
|
67
65
|
|
|
68
|
-
const positionLabel = blockInformation?.positionLabel
|
|
69
|
-
? sprintf(
|
|
70
|
-
// translators: 1: Position of selected block, e.g. "Sticky" or "Fixed".
|
|
71
|
-
__( 'Position: %1$s' ),
|
|
72
|
-
blockInformation.positionLabel
|
|
73
|
-
)
|
|
74
|
-
: '';
|
|
75
|
-
|
|
76
66
|
// The `href` attribute triggers the browser's native HTML drag operations.
|
|
77
67
|
// When the link is dragged, the element's outerHTML is set in DataTransfer object as text/html.
|
|
78
68
|
// We need to clear any HTML drag data to prevent `pasteHandler` from firing
|
|
@@ -136,10 +126,10 @@ function ListViewBlockSelectButton(
|
|
|
136
126
|
</Truncate>
|
|
137
127
|
</span>
|
|
138
128
|
) }
|
|
139
|
-
{
|
|
140
|
-
<
|
|
129
|
+
{ isSticky && (
|
|
130
|
+
<span className="block-editor-list-view-block-select-button__sticky">
|
|
141
131
|
<Icon icon={ pinSmall } />
|
|
142
|
-
</
|
|
132
|
+
</span>
|
|
143
133
|
) }
|
|
144
134
|
{ images.length ? (
|
|
145
135
|
<span
|
|
@@ -465,8 +465,10 @@ function ListViewBlock( {
|
|
|
465
465
|
level
|
|
466
466
|
);
|
|
467
467
|
|
|
468
|
-
const blockPropertiesDescription =
|
|
469
|
-
|
|
468
|
+
const blockPropertiesDescription = getBlockPropertiesDescription(
|
|
469
|
+
blockInformation,
|
|
470
|
+
isLocked
|
|
471
|
+
);
|
|
470
472
|
|
|
471
473
|
const hasSiblings = siblingBlockCount > 0;
|
|
472
474
|
const hasRenderedMovers = showBlockMovers && hasSiblings;
|
|
@@ -562,7 +564,12 @@ function ListViewBlock( {
|
|
|
562
564
|
ariaDescribedBy={ descriptionId }
|
|
563
565
|
/>
|
|
564
566
|
<AriaReferencedText id={ descriptionId }>
|
|
565
|
-
{
|
|
567
|
+
{ [
|
|
568
|
+
blockPositionDescription,
|
|
569
|
+
blockPropertiesDescription,
|
|
570
|
+
]
|
|
571
|
+
.filter( Boolean )
|
|
572
|
+
.join( ' ' ) }
|
|
566
573
|
</AriaReferencedText>
|
|
567
574
|
</div>
|
|
568
575
|
) }
|