@wordpress/block-editor 12.21.0 → 12.22.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/build/components/block-actions/index.js +2 -4
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.js +5 -5
- package/build/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.native.js +5 -4
- package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
- package/build/components/block-list/block-crash-boundary.native.js +49 -0
- package/build/components/block-list/block-crash-boundary.native.js.map +1 -0
- package/build/components/block-list/block-crash-warning.native.js +24 -0
- package/build/components/block-list/block-crash-warning.native.js.map +1 -0
- package/build/components/block-list/block.native.js +7 -2
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-settings/container.native.js +2 -1
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +29 -29
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +1 -3
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +3 -1
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +1 -1
- package/build/components/block-toolbar/shuffle.js.map +1 -1
- package/build/components/child-layout-control/index.js +108 -11
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/toolbar.js +11 -0
- package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +8 -33
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +1 -1
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +1 -3
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +34 -30
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/index.js +3 -6
- package/build/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/menu.js +3 -9
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js +1 -1
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build/components/inserter/search-results.js +2 -3
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +1 -2
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js +36 -0
- package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
- package/build/components/list-view/block-select-button.js +2 -12
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +4 -11
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/utils.js +5 -3
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
- package/build/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +4 -0
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/warning/index.native.js +9 -4
- package/build/components/warning/index.native.js.map +1 -1
- package/build/hooks/anchor.js +7 -8
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/background.js +39 -2
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/index.js +2 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout-child.js +28 -6
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/layout.js +21 -10
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +1 -1
- package/build/hooks/position.js.map +1 -1
- package/build/private-apis.native.js +3 -1
- package/build/private-apis.native.js.map +1 -1
- package/build/store/reducer.js +31 -26
- package/build/store/reducer.js.map +1 -1
- package/build-module/components/block-actions/index.js +2 -4
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.js +5 -5
- package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.native.js +5 -4
- package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
- package/build-module/components/block-list/block-crash-boundary.native.js +42 -0
- package/build-module/components/block-list/block-crash-boundary.native.js.map +1 -0
- package/build-module/components/block-list/block-crash-warning.native.js +15 -0
- package/build-module/components/block-list/block-crash-warning.native.js.map +1 -0
- package/build-module/components/block-list/block.native.js +7 -2
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +3 -2
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +30 -30
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +1 -3
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +3 -1
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +1 -1
- package/build-module/components/block-toolbar/shuffle.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +109 -12
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js +12 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +9 -34
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +0 -2
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +34 -30
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/index.js +3 -6
- package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build-module/components/inserter/menu.js +3 -9
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build-module/components/inserter/search-results.js +2 -3
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +1 -2
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js +28 -0
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
- package/build-module/components/list-view/block-select-button.js +3 -13
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +6 -13
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/utils.js +2 -1
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
- package/build-module/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +4 -0
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/warning/index.native.js +9 -4
- package/build-module/components/warning/index.native.js.map +1 -1
- package/build-module/hooks/anchor.js +8 -9
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/background.js +38 -1
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/index.js +2 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout-child.js +28 -6
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/layout.js +21 -10
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +1 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/private-apis.native.js +3 -1
- package/build-module/private-apis.native.js.map +1 -1
- package/build-module/store/reducer.js +31 -26
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/content-rtl.css +14 -0
- package/build-style/content.css +14 -0
- package/build-style/style-rtl.css +8 -20
- package/build-style/style.css +8 -20
- package/package.json +31 -31
- package/src/components/block-actions/index.js +2 -8
- package/src/components/block-bindings-toolbar-indicator/style.scss +10 -8
- package/src/components/block-heading-level-dropdown/README.md +5 -5
- package/src/components/block-heading-level-dropdown/index.js +5 -5
- package/src/components/block-heading-level-dropdown/index.native.js +5 -4
- package/src/components/block-list/block-crash-boundary.native.js +43 -0
- package/src/components/block-list/block-crash-warning.native.js +19 -0
- package/src/components/block-list/block.native.js +14 -7
- package/src/components/block-list/content.scss +16 -0
- package/src/components/block-settings/container.native.js +5 -1
- package/src/components/block-settings-menu/block-settings-dropdown.js +41 -56
- package/src/components/block-settings-menu-controls/README.md +0 -9
- package/src/components/block-settings-menu-controls/index.js +1 -6
- package/src/components/block-toolbar/index.js +3 -1
- package/src/components/block-toolbar/shuffle.js +1 -1
- package/src/components/block-toolbar/test/index.native.js +1 -7
- package/src/components/child-layout-control/index.js +147 -35
- package/src/components/convert-to-group-buttons/toolbar.js +13 -1
- package/src/components/global-styles/dimensions-panel.js +9 -34
- package/src/components/global-styles/test/use-global-styles-output.js +31 -0
- package/src/components/global-styles/use-global-styles-output.js +3 -1
- package/src/components/global-styles/utils.js +0 -18
- package/src/components/iframe/index.js +60 -44
- package/src/components/inserter/block-patterns-explorer/index.js +2 -9
- package/src/components/inserter/block-patterns-explorer/pattern-list.js +7 -1
- package/src/components/inserter/menu.js +4 -10
- package/src/components/inserter/mobile-tab-navigation.js +1 -1
- package/src/components/inserter/search-results.js +1 -2
- package/src/components/inserter/tabs.js +1 -2
- package/src/components/inspector-controls-tabs/advanced-controls-panel.native.js +31 -0
- package/src/components/link-control/style.scss +0 -5
- package/src/components/list-view/block-select-button.js +2 -18
- package/src/components/list-view/block.js +12 -21
- package/src/components/list-view/style.scss +34 -24
- package/src/components/list-view/utils.js +4 -1
- package/src/components/rich-text/README.md +6 -0
- package/src/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
- package/src/components/use-moving-animation/index.js +1 -0
- package/src/components/warning/index.native.js +19 -15
- package/src/hooks/anchor.js +41 -61
- package/src/hooks/background.js +48 -3
- package/src/hooks/index.js +2 -0
- package/src/hooks/layout-child.js +44 -8
- package/src/hooks/layout.js +22 -18
- package/src/hooks/position.js +1 -1
- package/src/hooks/test/__snapshots__/anchor.native.js.snap +7 -0
- package/src/hooks/test/anchor.native.js +32 -0
- package/src/private-apis.native.js +2 -0
- package/src/store/reducer.js +41 -41
- package/tsconfig.json +1 -0
- package/build/utils/calculate-scale.js +0 -17
- package/build/utils/calculate-scale.js.map +0 -1
- package/build-module/utils/calculate-scale.js +0 -11
- package/build-module/utils/calculate-scale.js.map +0 -1
- package/src/utils/calculate-scale.js +0 -20
|
@@ -47,10 +47,16 @@ function PatternsListHeader( { filterValue, filteredBlockPatternsLength } ) {
|
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
function PatternList( {
|
|
50
|
+
function PatternList( {
|
|
51
|
+
searchValue,
|
|
52
|
+
selectedCategory,
|
|
53
|
+
patternCategories,
|
|
54
|
+
rootClientId,
|
|
55
|
+
} ) {
|
|
51
56
|
const container = useRef();
|
|
52
57
|
const debouncedSpeak = useDebounce( speak, 500 );
|
|
53
58
|
const [ destinationRootClientId, onInsertBlocks ] = useInsertionPoint( {
|
|
59
|
+
rootClientId,
|
|
54
60
|
shouldFocusBlock: true,
|
|
55
61
|
} );
|
|
56
62
|
const [ patterns, , onClickPattern ] = usePatternsState(
|
|
@@ -66,13 +66,10 @@ function InserterMenu(
|
|
|
66
66
|
insertionIndex: __experimentalInsertionIndex,
|
|
67
67
|
shouldFocusBlock,
|
|
68
68
|
} );
|
|
69
|
-
const {
|
|
69
|
+
const { showPatterns } = useSelect(
|
|
70
70
|
( select ) => {
|
|
71
|
-
const { hasAllowedPatterns
|
|
72
|
-
select( blockEditorStore )
|
|
73
|
-
);
|
|
71
|
+
const { hasAllowedPatterns } = unlock( select( blockEditorStore ) );
|
|
74
72
|
return {
|
|
75
|
-
isZoomOutMode: __unstableGetEditorMode() === 'zoom-out',
|
|
76
73
|
showPatterns: hasAllowedPatterns( destinationRootClientId ),
|
|
77
74
|
};
|
|
78
75
|
},
|
|
@@ -80,8 +77,7 @@ function InserterMenu(
|
|
|
80
77
|
);
|
|
81
78
|
|
|
82
79
|
const mediaCategories = useMediaCategories( destinationRootClientId );
|
|
83
|
-
const showMedia = mediaCategories.length > 0
|
|
84
|
-
const showBlocks = ! isZoomOutMode;
|
|
80
|
+
const showMedia = mediaCategories.length > 0;
|
|
85
81
|
|
|
86
82
|
const onInsert = useCallback(
|
|
87
83
|
( blocks, meta, shouldForceFocusBlock ) => {
|
|
@@ -253,21 +249,19 @@ function InserterMenu(
|
|
|
253
249
|
__experimentalInsertionIndex
|
|
254
250
|
}
|
|
255
251
|
showBlockDirectory
|
|
256
|
-
showBlocks={ showBlocks }
|
|
257
252
|
shouldFocusBlock={ shouldFocusBlock }
|
|
258
253
|
/>
|
|
259
254
|
</div>
|
|
260
255
|
) }
|
|
261
256
|
{ showAsTabs && (
|
|
262
257
|
<InserterTabs
|
|
263
|
-
showBlocks={ showBlocks }
|
|
264
258
|
showPatterns={ showPatterns }
|
|
265
259
|
showMedia={ showMedia }
|
|
266
260
|
onSelect={ handleSetSelectedTab }
|
|
267
261
|
tabsContents={ inserterTabsContents }
|
|
268
262
|
/>
|
|
269
263
|
) }
|
|
270
|
-
{ ! delayedFilterValue && ! showAsTabs &&
|
|
264
|
+
{ ! delayedFilterValue && ! showAsTabs && (
|
|
271
265
|
<div className="block-editor-inserter__no-tab-container">
|
|
272
266
|
{ blocksTab }
|
|
273
267
|
</div>
|
|
@@ -50,7 +50,6 @@ function InserterSearchResults( {
|
|
|
50
50
|
shouldFocusBlock = true,
|
|
51
51
|
prioritizePatterns,
|
|
52
52
|
selectBlockOnInsert,
|
|
53
|
-
showBlocks = true,
|
|
54
53
|
} ) {
|
|
55
54
|
const debouncedSpeak = useDebounce( speak, 500 );
|
|
56
55
|
|
|
@@ -168,7 +167,7 @@ function InserterSearchResults( {
|
|
|
168
167
|
const hasItems =
|
|
169
168
|
filteredBlockTypes.length > 0 || filteredBlockPatterns.length > 0;
|
|
170
169
|
|
|
171
|
-
const blocksUI =
|
|
170
|
+
const blocksUI = !! filteredBlockTypes.length && (
|
|
172
171
|
<InserterPanel
|
|
173
172
|
title={ <VisuallyHidden>{ __( 'Blocks' ) }</VisuallyHidden> }
|
|
174
173
|
>
|
|
@@ -29,14 +29,13 @@ const mediaTab = {
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
function InserterTabs( {
|
|
32
|
-
showBlocks = true,
|
|
33
32
|
showPatterns = false,
|
|
34
33
|
showMedia = false,
|
|
35
34
|
onSelect,
|
|
36
35
|
tabsContents,
|
|
37
36
|
} ) {
|
|
38
37
|
const tabs = [
|
|
39
|
-
|
|
38
|
+
blocksTab,
|
|
40
39
|
showPatterns && patternsTab,
|
|
41
40
|
showMedia && mediaTab,
|
|
42
41
|
].filter( Boolean );
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { PanelBody } from '@wordpress/components';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import groups from '../inspector-controls/groups';
|
|
11
|
+
|
|
12
|
+
export default function AdvancedControls( props ) {
|
|
13
|
+
const Slot = groups.advanced?.Slot;
|
|
14
|
+
if ( ! Slot ) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Slot { ...props }>
|
|
20
|
+
{ ( fills ) => {
|
|
21
|
+
if ( ! fills.length ) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<PanelBody title={ __( 'Advanced' ) }>{ fills }</PanelBody>
|
|
27
|
+
);
|
|
28
|
+
} }
|
|
29
|
+
</Slot>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -93,11 +93,6 @@ $block-editor-link-control-number-of-actions: 1;
|
|
|
93
93
|
position: absolute;
|
|
94
94
|
right: 19px; // specific to place the button properly.
|
|
95
95
|
top: 3px;
|
|
96
|
-
|
|
97
|
-
svg {
|
|
98
|
-
position: relative;
|
|
99
|
-
top: -2px; // the icon itself is not centered within the bounds; this centers it.
|
|
100
|
-
}
|
|
101
96
|
}
|
|
102
97
|
|
|
103
98
|
.block-editor-link-control__search-actions {
|
|
@@ -14,12 +14,7 @@ import {
|
|
|
14
14
|
Tooltip,
|
|
15
15
|
} from '@wordpress/components';
|
|
16
16
|
import { forwardRef } from '@wordpress/element';
|
|
17
|
-
import {
|
|
18
|
-
Icon,
|
|
19
|
-
connection,
|
|
20
|
-
lockSmall as lock,
|
|
21
|
-
pinSmall,
|
|
22
|
-
} from '@wordpress/icons';
|
|
17
|
+
import { Icon, lockSmall as lock, pinSmall } from '@wordpress/icons';
|
|
23
18
|
import { SPACE, ENTER, BACKSPACE, DELETE } from '@wordpress/keycodes';
|
|
24
19
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
25
20
|
import { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';
|
|
@@ -37,12 +32,11 @@ import { useBlockLock } from '../block-lock';
|
|
|
37
32
|
import { store as blockEditorStore } from '../../store';
|
|
38
33
|
import useListViewImages from './use-list-view-images';
|
|
39
34
|
import { useListViewContext } from './context';
|
|
40
|
-
import { canBindBlock } from '../../hooks/use-bindings-attributes';
|
|
41
35
|
|
|
42
36
|
function ListViewBlockSelectButton(
|
|
43
37
|
{
|
|
44
38
|
className,
|
|
45
|
-
block: { clientId
|
|
39
|
+
block: { clientId },
|
|
46
40
|
onClick,
|
|
47
41
|
onContextMenu,
|
|
48
42
|
onMouseDown,
|
|
@@ -53,7 +47,6 @@ function ListViewBlockSelectButton(
|
|
|
53
47
|
onDragEnd,
|
|
54
48
|
draggable,
|
|
55
49
|
isExpanded,
|
|
56
|
-
ariaLabel,
|
|
57
50
|
ariaDescribedBy,
|
|
58
51
|
updateFocusAndSelection,
|
|
59
52
|
},
|
|
@@ -72,7 +65,6 @@ function ListViewBlockSelectButton(
|
|
|
72
65
|
getBlockRootClientId,
|
|
73
66
|
getBlockOrder,
|
|
74
67
|
getBlocksByClientId,
|
|
75
|
-
getBlockAttributes,
|
|
76
68
|
canRemoveBlocks,
|
|
77
69
|
} = useSelect( blockEditorStore );
|
|
78
70
|
const { duplicateBlocks, multiSelect, removeBlocks } =
|
|
@@ -82,8 +74,6 @@ function ListViewBlockSelectButton(
|
|
|
82
74
|
const images = useListViewImages( { clientId, isExpanded } );
|
|
83
75
|
const { rootClientId } = useListViewContext();
|
|
84
76
|
|
|
85
|
-
const isConnected = getBlockAttributes( clientId )?.metadata?.bindings;
|
|
86
|
-
|
|
87
77
|
const positionLabel = blockInformation?.positionLabel
|
|
88
78
|
? sprintf(
|
|
89
79
|
// translators: 1: Position of selected block, e.g. "Sticky" or "Fixed".
|
|
@@ -258,7 +248,6 @@ function ListViewBlockSelectButton(
|
|
|
258
248
|
onDragEnd={ onDragEnd }
|
|
259
249
|
draggable={ draggable }
|
|
260
250
|
href={ `#block-${ clientId }` }
|
|
261
|
-
aria-label={ ariaLabel }
|
|
262
251
|
aria-describedby={ ariaDescribedBy }
|
|
263
252
|
aria-expanded={ isExpanded }
|
|
264
253
|
>
|
|
@@ -287,11 +276,6 @@ function ListViewBlockSelectButton(
|
|
|
287
276
|
</Truncate>
|
|
288
277
|
</span>
|
|
289
278
|
) }
|
|
290
|
-
{ isConnected && canBindBlock( blockName ) && (
|
|
291
|
-
<span className="block-editor-list-view-block-select-button__bindings">
|
|
292
|
-
<Icon icon={ connection } />
|
|
293
|
-
</span>
|
|
294
|
-
) }
|
|
295
279
|
{ positionLabel && isSticky && (
|
|
296
280
|
<Tooltip text={ positionLabel }>
|
|
297
281
|
<Icon icon={ pinSmall } />
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
memo,
|
|
22
22
|
} from '@wordpress/element';
|
|
23
23
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
24
|
-
import {
|
|
24
|
+
import { __ } from '@wordpress/i18n';
|
|
25
25
|
import { ESCAPE } from '@wordpress/keycodes';
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -35,7 +35,11 @@ import {
|
|
|
35
35
|
} from '../block-mover/button';
|
|
36
36
|
import ListViewBlockContents from './block-contents';
|
|
37
37
|
import { useListViewContext } from './context';
|
|
38
|
-
import {
|
|
38
|
+
import {
|
|
39
|
+
getBlockPositionDescription,
|
|
40
|
+
getBlockPropertiesDescription,
|
|
41
|
+
focusListItem,
|
|
42
|
+
} from './utils';
|
|
39
43
|
import { store as blockEditorStore } from '../../store';
|
|
40
44
|
import useBlockDisplayInformation from '../use-block-display-information';
|
|
41
45
|
import { useBlockLock } from '../block-lock';
|
|
@@ -77,8 +81,6 @@ function ListViewBlock( {
|
|
|
77
81
|
const { toggleBlockHighlight } = useDispatch( blockEditorStore );
|
|
78
82
|
|
|
79
83
|
const blockInformation = useBlockDisplayInformation( clientId );
|
|
80
|
-
const blockTitle =
|
|
81
|
-
blockInformation?.name || blockInformation?.title || __( 'Untitled' );
|
|
82
84
|
|
|
83
85
|
const { block, blockName, blockEditingMode } = useSelect(
|
|
84
86
|
( select ) => {
|
|
@@ -93,6 +95,7 @@ function ListViewBlock( {
|
|
|
93
95
|
},
|
|
94
96
|
[ clientId ]
|
|
95
97
|
);
|
|
98
|
+
|
|
96
99
|
const allowRightClickOverrides = useSelect(
|
|
97
100
|
( select ) =>
|
|
98
101
|
select( blockEditorStore ).getSettings().allowRightClickOverrides,
|
|
@@ -107,7 +110,7 @@ function ListViewBlock( {
|
|
|
107
110
|
// Don't show the settings menu if block is disabled or content only.
|
|
108
111
|
blockEditingMode === 'default';
|
|
109
112
|
const instanceId = useInstanceId( ListViewBlock );
|
|
110
|
-
const descriptionId = `list-view-block-select-
|
|
113
|
+
const descriptionId = `list-view-block-select-button__description-${ instanceId }`;
|
|
111
114
|
|
|
112
115
|
const {
|
|
113
116
|
expand,
|
|
@@ -247,19 +250,8 @@ function ListViewBlock( {
|
|
|
247
250
|
level
|
|
248
251
|
);
|
|
249
252
|
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
// translators: %s: The title of the block. This string indicates a link to select the locked block.
|
|
253
|
-
__( '%s (locked)' ),
|
|
254
|
-
blockTitle
|
|
255
|
-
)
|
|
256
|
-
: blockTitle;
|
|
257
|
-
|
|
258
|
-
const settingsAriaLabel = sprintf(
|
|
259
|
-
// translators: %s: The title of the block.
|
|
260
|
-
__( 'Options for %s' ),
|
|
261
|
-
blockTitle
|
|
262
|
-
);
|
|
253
|
+
const blockPropertiesDescription =
|
|
254
|
+
getBlockPropertiesDescription( isLocked );
|
|
263
255
|
|
|
264
256
|
const hasSiblings = siblingBlockCount > 0;
|
|
265
257
|
const hasRenderedMovers = showBlockMovers && hasSiblings;
|
|
@@ -352,12 +344,11 @@ function ListViewBlock( {
|
|
|
352
344
|
onFocus={ onFocus }
|
|
353
345
|
isExpanded={ canEdit ? isExpanded : undefined }
|
|
354
346
|
selectedClientIds={ selectedClientIds }
|
|
355
|
-
ariaLabel={ blockAriaLabel }
|
|
356
347
|
ariaDescribedBy={ descriptionId }
|
|
357
348
|
updateFocusAndSelection={ updateFocusAndSelection }
|
|
358
349
|
/>
|
|
359
350
|
<AriaReferencedText id={ descriptionId }>
|
|
360
|
-
{ blockPositionDescription }
|
|
351
|
+
{ `${ blockPositionDescription } ${ blockPropertiesDescription }` }
|
|
361
352
|
</AriaReferencedText>
|
|
362
353
|
</div>
|
|
363
354
|
) }
|
|
@@ -405,7 +396,7 @@ function ListViewBlock( {
|
|
|
405
396
|
clientIds={ dropdownClientIds }
|
|
406
397
|
block={ block }
|
|
407
398
|
icon={ moreVertical }
|
|
408
|
-
label={
|
|
399
|
+
label={ __( 'Actions' ) }
|
|
409
400
|
popoverProps={ {
|
|
410
401
|
anchor: settingsPopoverAnchor, // Used to position the settings at the cursor on right-click.
|
|
411
402
|
} }
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// Move upwards when in modal.
|
|
8
8
|
.components-modal__content & {
|
|
9
9
|
margin: (-$grid-unit-15) (-$grid-unit-15 * 0.5) 0;
|
|
10
|
-
width: calc(100% + #{
|
|
10
|
+
width: calc(100% + #{$grid-unit-15});
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
// Without setting `pointer-events: none`, when dragging over list view items,
|
|
@@ -71,7 +71,8 @@
|
|
|
71
71
|
&:focus::after {
|
|
72
72
|
box-shadow:
|
|
73
73
|
inset 0 0 0 1px $white,
|
|
74
|
-
0 0 0 var(--wp-admin-border-width-focus)
|
|
74
|
+
0 0 0 var(--wp-admin-border-width-focus)
|
|
75
|
+
var(--wp-block-synced-color);
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
&.is-selected .block-editor-list-view-block-contents,
|
|
@@ -82,14 +83,16 @@
|
|
|
82
83
|
&::after {
|
|
83
84
|
box-shadow:
|
|
84
85
|
inset 0 0 0 1px $white,
|
|
85
|
-
0 0 0 var(--wp-admin-border-width-focus)
|
|
86
|
+
0 0 0 var(--wp-admin-border-width-focus)
|
|
87
|
+
var(--wp-admin-theme-color);
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
90
|
&.is-selected.is-synced .block-editor-list-view-block-contents:focus {
|
|
89
91
|
&::after {
|
|
90
92
|
box-shadow:
|
|
91
93
|
inset 0 0 0 1px $white,
|
|
92
|
-
0 0 0 var(--wp-admin-border-width-focus)
|
|
94
|
+
0 0 0 var(--wp-admin-border-width-focus)
|
|
95
|
+
var(--wp-block-synced-color);
|
|
93
96
|
}
|
|
94
97
|
}
|
|
95
98
|
&.is-selected .block-editor-list-view-block__menu:focus {
|
|
@@ -181,7 +184,9 @@
|
|
|
181
184
|
|
|
182
185
|
&.is-after-dragged-blocks.is-displacement-down {
|
|
183
186
|
transition: transform 0.2s;
|
|
184
|
-
transform:
|
|
187
|
+
transform:
|
|
188
|
+
translateY(calc(36px + var(--wp-admin--list-view-dragged-items-height, 36px) *
|
|
189
|
+
-1));
|
|
185
190
|
@include reduce-motion("transition");
|
|
186
191
|
}
|
|
187
192
|
|
|
@@ -217,7 +222,10 @@
|
|
|
217
222
|
content: "";
|
|
218
223
|
position: absolute;
|
|
219
224
|
pointer-events: none;
|
|
220
|
-
transition:
|
|
225
|
+
transition:
|
|
226
|
+
border-color 0.1s linear,
|
|
227
|
+
border-style 0.1s linear,
|
|
228
|
+
box-shadow 0.1s linear;
|
|
221
229
|
top: -2px;
|
|
222
230
|
right: 0;
|
|
223
231
|
left: 0;
|
|
@@ -242,7 +250,9 @@
|
|
|
242
250
|
bottom: 0;
|
|
243
251
|
left: 0;
|
|
244
252
|
border-radius: inherit;
|
|
245
|
-
box-shadow:
|
|
253
|
+
box-shadow:
|
|
254
|
+
inset 0 0 0 var(--wp-admin-border-width-focus)
|
|
255
|
+
var(--wp-admin-theme-color);
|
|
246
256
|
z-index: 2;
|
|
247
257
|
pointer-events: none;
|
|
248
258
|
}
|
|
@@ -255,7 +265,9 @@
|
|
|
255
265
|
|
|
256
266
|
&.is-nesting .block-editor-list-view__menu,
|
|
257
267
|
.block-editor-list-view-block__menu:focus {
|
|
258
|
-
box-shadow:
|
|
268
|
+
box-shadow:
|
|
269
|
+
inset 0 0 0 var(--wp-admin-border-width-focus)
|
|
270
|
+
var(--wp-admin-theme-color);
|
|
259
271
|
z-index: 1;
|
|
260
272
|
}
|
|
261
273
|
|
|
@@ -458,7 +470,9 @@ $block-navigation-max-indent: 8;
|
|
|
458
470
|
}
|
|
459
471
|
|
|
460
472
|
.block-editor-list-view-leaf[aria-level] .block-editor-list-view__expander {
|
|
461
|
-
margin-left:
|
|
473
|
+
margin-left:
|
|
474
|
+
($icon-size) * $block-navigation-max-indent + 4 *
|
|
475
|
+
($block-navigation-max-indent - 1);
|
|
462
476
|
}
|
|
463
477
|
|
|
464
478
|
.block-editor-list-view-leaf:not([aria-level="1"]) {
|
|
@@ -471,12 +485,12 @@ $block-navigation-max-indent: 8;
|
|
|
471
485
|
// indentation in `use-list-view-drop-zone.js` must be updated as well
|
|
472
486
|
// to ensure the drop zone is aligned with the indentation.
|
|
473
487
|
@for $i from 0 to $block-navigation-max-indent {
|
|
474
|
-
.block-editor-list-view-leaf[aria-level="#{ $i + 1 }"]
|
|
488
|
+
.block-editor-list-view-leaf[aria-level="#{ $i + 1 }"]
|
|
489
|
+
.block-editor-list-view__expander {
|
|
475
490
|
@if $i - 1 >= 0 {
|
|
476
|
-
margin-left: (
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
margin-left: ( $icon-size * $i );
|
|
491
|
+
margin-left: ($icon-size * $i) + 4 * ($i - 1);
|
|
492
|
+
} @else {
|
|
493
|
+
margin-left: ($icon-size * $i);
|
|
480
494
|
}
|
|
481
495
|
}
|
|
482
496
|
}
|
|
@@ -486,7 +500,9 @@ $block-navigation-max-indent: 8;
|
|
|
486
500
|
}
|
|
487
501
|
|
|
488
502
|
// Point downwards when open.
|
|
489
|
-
.block-editor-list-view-leaf[data-expanded="true"]
|
|
503
|
+
.block-editor-list-view-leaf[data-expanded="true"]
|
|
504
|
+
.block-editor-list-view__expander
|
|
505
|
+
svg {
|
|
490
506
|
visibility: visible;
|
|
491
507
|
transition: transform 0.2s ease;
|
|
492
508
|
transform: rotate(90deg);
|
|
@@ -494,7 +510,9 @@ $block-navigation-max-indent: 8;
|
|
|
494
510
|
}
|
|
495
511
|
|
|
496
512
|
// Point rightwards when closed
|
|
497
|
-
.block-editor-list-view-leaf[data-expanded="false"]
|
|
513
|
+
.block-editor-list-view-leaf[data-expanded="false"]
|
|
514
|
+
.block-editor-list-view__expander
|
|
515
|
+
svg {
|
|
498
516
|
visibility: visible;
|
|
499
517
|
transform: rotate(0deg);
|
|
500
518
|
transition: transform 0.2s ease;
|
|
@@ -557,11 +575,3 @@ $block-navigation-max-indent: 8;
|
|
|
557
575
|
.list-view-appender__description {
|
|
558
576
|
display: none;
|
|
559
577
|
}
|
|
560
|
-
|
|
561
|
-
.block-editor-list-view-block-select-button__bindings svg g {
|
|
562
|
-
stroke: var(--wp-bound-block-color);
|
|
563
|
-
fill: transparent;
|
|
564
|
-
stroke-width: 1.5;
|
|
565
|
-
stroke-linecap: round;
|
|
566
|
-
stroke-linejoin: round;
|
|
567
|
-
}
|
|
@@ -7,12 +7,15 @@ import { focus } from '@wordpress/dom';
|
|
|
7
7
|
export const getBlockPositionDescription = ( position, siblingCount, level ) =>
|
|
8
8
|
sprintf(
|
|
9
9
|
/* translators: 1: The numerical position of the block. 2: The total number of blocks. 3. The level of nesting for the block. */
|
|
10
|
-
__( 'Block %1$d of %2$d, Level %3$d' ),
|
|
10
|
+
__( 'Block %1$d of %2$d, Level %3$d.' ),
|
|
11
11
|
position,
|
|
12
12
|
siblingCount,
|
|
13
13
|
level
|
|
14
14
|
);
|
|
15
15
|
|
|
16
|
+
export const getBlockPropertiesDescription = ( isLocked ) =>
|
|
17
|
+
isLocked ? __( 'This block is locked.' ) : '';
|
|
18
|
+
|
|
16
19
|
/**
|
|
17
20
|
* Returns true if the client ID occurs within the block selection or multi-selection,
|
|
18
21
|
* or false otherwise.
|
|
@@ -12,6 +12,10 @@ _Required._ HTML string to make editable. The HTML should be valid, and valid in
|
|
|
12
12
|
|
|
13
13
|
_Required._ Called when the value changes.
|
|
14
14
|
|
|
15
|
+
### `identifier: String`
|
|
16
|
+
|
|
17
|
+
_Optional._ If the editable field is bound to a block attribute (through the `value` and `onChange` props) then this prop should specify the attribute name. The field will use this value to set the block editor selection correctly, specifying in which attribute and at what offset does the selection start or end.
|
|
18
|
+
|
|
15
19
|
### `tagName: String`
|
|
16
20
|
|
|
17
21
|
_Default: `div`._ The [tag name](https://www.w3.org/TR/html51/syntax.html#tag-name) of the editable element.
|
|
@@ -50,6 +54,7 @@ _Optional._ By default, all registered formats are allowed. This setting can be
|
|
|
50
54
|
```js
|
|
51
55
|
<RichText
|
|
52
56
|
tagName="h2"
|
|
57
|
+
identifier="content"
|
|
53
58
|
value={ attributes.content }
|
|
54
59
|
allowedFormats={ [ 'core/bold', 'core/italic' ] } // Allow the content to be made bold or italic, but do not allow othe formatting options
|
|
55
60
|
onChange={ ( content ) => setAttributes( { content } ) }
|
|
@@ -99,6 +104,7 @@ registerBlockType( /* ... */, {
|
|
|
99
104
|
<RichText
|
|
100
105
|
tagName="h2"
|
|
101
106
|
className={ className }
|
|
107
|
+
identifier="content"
|
|
102
108
|
value={ attributes.content }
|
|
103
109
|
onChange={ ( content ) => setAttributes( { content } ) }
|
|
104
110
|
/>
|
|
@@ -16,33 +16,36 @@ import { normalizeIconObject } from '@wordpress/blocks';
|
|
|
16
16
|
import styles from './style.scss';
|
|
17
17
|
|
|
18
18
|
function Warning( {
|
|
19
|
+
actions,
|
|
19
20
|
title,
|
|
20
21
|
message,
|
|
21
22
|
icon,
|
|
22
23
|
iconClass,
|
|
23
24
|
preferredColorScheme,
|
|
24
25
|
getStylesFromColorScheme,
|
|
26
|
+
containerStyle: extraContainerStyle,
|
|
27
|
+
titleStyle: extraTitleStyle,
|
|
28
|
+
messageStyle: extraMessageStyle,
|
|
25
29
|
...viewProps
|
|
26
30
|
} ) {
|
|
27
31
|
icon = icon && normalizeIconObject( icon );
|
|
28
32
|
const internalIconClass = 'warning-icon' + '-' + preferredColorScheme;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
styles.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
styles.
|
|
36
|
-
|
|
33
|
+
|
|
34
|
+
const containerStyle = [
|
|
35
|
+
getStylesFromColorScheme( styles.container, styles.containerDark ),
|
|
36
|
+
extraContainerStyle,
|
|
37
|
+
];
|
|
38
|
+
const titleStyle = [
|
|
39
|
+
getStylesFromColorScheme( styles.title, styles.titleDark ),
|
|
40
|
+
extraTitleStyle,
|
|
41
|
+
];
|
|
42
|
+
const messageStyle = [
|
|
43
|
+
getStylesFromColorScheme( styles.message, styles.messageDark ),
|
|
44
|
+
extraMessageStyle,
|
|
45
|
+
];
|
|
37
46
|
|
|
38
47
|
return (
|
|
39
|
-
<View
|
|
40
|
-
style={ getStylesFromColorScheme(
|
|
41
|
-
styles.container,
|
|
42
|
-
styles.containerDark
|
|
43
|
-
) }
|
|
44
|
-
{ ...viewProps }
|
|
45
|
-
>
|
|
48
|
+
<View style={ containerStyle } { ...viewProps }>
|
|
46
49
|
{ icon && (
|
|
47
50
|
<View style={ styles.icon }>
|
|
48
51
|
<Icon
|
|
@@ -53,6 +56,7 @@ function Warning( {
|
|
|
53
56
|
) }
|
|
54
57
|
{ title && <Text style={ titleStyle }>{ title }</Text> }
|
|
55
58
|
{ message && <Text style={ messageStyle }>{ message }</Text> }
|
|
59
|
+
{ actions }
|
|
56
60
|
</View>
|
|
57
61
|
);
|
|
58
62
|
}
|