@wordpress/block-editor 8.6.0 → 9.0.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 +7 -0
- package/README.md +4 -2
- package/build/components/block-alignment-control/constants.js +48 -0
- package/build/components/block-alignment-control/constants.js.map +1 -0
- package/build/components/block-alignment-control/ui.js +9 -40
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/ui.native.js +92 -0
- package/build/components/block-alignment-control/ui.native.js.map +1 -0
- package/build/components/block-list/use-block-props/use-block-class-names.js +1 -7
- package/build/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +11 -5
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-popover/index.js +20 -5
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/color-style-selector/index.js +9 -0
- package/build/components/color-style-selector/index.js.map +1 -1
- package/build/components/index.js +0 -9
- package/build/components/index.js.map +1 -1
- package/build/components/inserter/index.js +21 -7
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +1 -1
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +4 -5
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/list-view/block.js +15 -15
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +9 -13
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/context.js +1 -4
- package/build/components/list-view/context.js.map +1 -1
- package/build/components/list-view/index.js +15 -32
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/url-input/index.js +7 -3
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-setting/index.js +42 -18
- package/build/components/use-setting/index.js.map +1 -1
- package/build/components/writing-flow/use-click-selection.js +1 -3
- package/build/components/writing-flow/use-click-selection.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +49 -8
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/hooks/dimensions.js +2 -2
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/margin.js +64 -12
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +60 -12
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/settings.js +32 -0
- package/build/hooks/settings.js.map +1 -0
- package/build/store/defaults.js +0 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/selectors.js +14 -12
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-alignment-control/constants.js +36 -0
- package/build-module/components/block-alignment-control/constants.js.map +1 -0
- package/build-module/components/block-alignment-control/ui.js +4 -35
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.native.js +78 -0
- package/build-module/components/block-alignment-control/ui.native.js.map +1 -0
- package/build-module/components/block-list/use-block-props/use-block-class-names.js +1 -7
- package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +10 -5
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-popover/index.js +21 -5
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/color-style-selector/index.js +6 -0
- package/build-module/components/color-style-selector/index.js.map +1 -1
- package/build-module/components/index.js +0 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter/index.js +21 -7
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +1 -1
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +4 -5
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/list-view/block.js +15 -16
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +9 -13
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/context.js +1 -4
- package/build-module/components/list-view/context.js.map +1 -1
- package/build-module/components/list-view/index.js +15 -31
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/url-input/index.js +7 -3
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-setting/index.js +43 -19
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/components/writing-flow/use-click-selection.js +1 -3
- package/build-module/components/writing-flow/use-click-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +49 -8
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/hooks/dimensions.js +5 -5
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/margin.js +61 -13
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +57 -13
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/settings.js +29 -0
- package/build-module/hooks/settings.js.map +1 -0
- package/build-module/store/defaults.js +0 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/selectors.js +14 -12
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +17 -31
- package/build-style/style.css +17 -31
- package/package.json +28 -28
- package/src/components/block-alignment-control/constants.js +45 -0
- package/src/components/block-alignment-control/ui.js +69 -109
- package/src/components/block-alignment-control/ui.native.js +86 -0
- package/src/components/block-content-overlay/style.scss +0 -1
- package/src/components/block-list/style.scss +7 -18
- package/src/components/block-list/use-block-props/use-block-class-names.js +1 -11
- package/src/components/block-navigation/dropdown.js +12 -8
- package/src/components/block-popover/index.js +20 -3
- package/src/components/block-popover/style.scss +3 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
- package/src/components/color-style-selector/index.js +18 -9
- package/src/components/image-size-control/README.md +1 -1
- package/src/components/index.js +0 -1
- package/src/components/inserter/index.js +20 -0
- package/src/components/inserter/index.native.js +1 -1
- package/src/components/inserter/quick-inserter.js +3 -11
- package/src/components/inserter/style.native.scss +1 -0
- package/src/components/list-view/block.js +24 -34
- package/src/components/list-view/branch.js +10 -20
- package/src/components/list-view/context.js +1 -4
- package/src/components/list-view/index.js +11 -41
- package/src/components/url-input/index.js +6 -3
- package/src/components/use-setting/index.js +57 -21
- package/src/components/writing-flow/use-click-selection.js +1 -4
- package/src/components/writing-flow/use-selection-observer.js +55 -10
- package/src/hooks/dimensions.js +44 -38
- package/src/hooks/index.js +1 -0
- package/src/hooks/margin.js +64 -15
- package/src/hooks/padding.js +60 -15
- package/src/hooks/padding.scss +12 -0
- package/src/hooks/settings.js +32 -0
- package/src/hooks/test/settings.js +48 -0
- package/src/store/defaults.js +0 -1
- package/src/store/selectors.js +14 -12
- package/src/store/test/selectors.js +17 -0
- package/src/style.scss +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/border-style-control/index.js +0 -60
- package/build/components/border-style-control/index.js.map +0 -1
- package/build-module/components/border-style-control/index.js +0 -50
- package/build-module/components/border-style-control/index.js.map +0 -1
- package/src/components/border-style-control/index.js +0 -47
- package/src/components/border-style-control/style.scss +0 -18
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 9.0.0 (2022-05-04)
|
|
6
|
+
|
|
7
|
+
### Breaking change
|
|
8
|
+
|
|
9
|
+
- `BlockNavigationDropdown` is now deprecated. Use the `Dropdown` component from the `@wordpress/components` package and the `ListView` component from this package ([#40777](https://github.com/WordPress/gutenberg/pull/40777)).
|
|
10
|
+
- `ListView` no longer accepts the `__experimentalFeatures`, `__experimentalPersistentListViewFeatures`, `__experimentalHideContainerBlockActions`, and `showNestedBlocks` props. Passing additional undocumented props through to `ListView` is also now disallowed. ([#40777](https://github.com/WordPress/gutenberg/pull/40777)).
|
|
11
|
+
|
|
5
12
|
## 8.6.0 (2022-04-21)
|
|
6
13
|
|
|
7
14
|
## 8.5.0 (2022-04-08)
|
package/README.md
CHANGED
|
@@ -762,8 +762,10 @@ _Parameters_
|
|
|
762
762
|
|
|
763
763
|
### useSetting
|
|
764
764
|
|
|
765
|
-
Hook that retrieves the
|
|
766
|
-
|
|
765
|
+
Hook that retrieves the given setting for the block instance in use.
|
|
766
|
+
|
|
767
|
+
It looks up the settings first in the block instance hierarchy.
|
|
768
|
+
If none is found, it'll look it up in the block editor store.
|
|
767
769
|
|
|
768
770
|
_Usage_
|
|
769
771
|
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.POPOVER_PROPS = exports.DEFAULT_CONTROL = exports.BLOCK_ALIGNMENTS_CONTROLS = void 0;
|
|
7
|
+
|
|
8
|
+
var _i18n = require("@wordpress/i18n");
|
|
9
|
+
|
|
10
|
+
var _icons = require("@wordpress/icons");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* WordPress dependencies
|
|
14
|
+
*/
|
|
15
|
+
const BLOCK_ALIGNMENTS_CONTROLS = {
|
|
16
|
+
none: {
|
|
17
|
+
icon: _icons.alignNone,
|
|
18
|
+
title: (0, _i18n._x)('None', 'Alignment option')
|
|
19
|
+
},
|
|
20
|
+
left: {
|
|
21
|
+
icon: _icons.positionLeft,
|
|
22
|
+
title: (0, _i18n.__)('Align left')
|
|
23
|
+
},
|
|
24
|
+
center: {
|
|
25
|
+
icon: _icons.positionCenter,
|
|
26
|
+
title: (0, _i18n.__)('Align center')
|
|
27
|
+
},
|
|
28
|
+
right: {
|
|
29
|
+
icon: _icons.positionRight,
|
|
30
|
+
title: (0, _i18n.__)('Align right')
|
|
31
|
+
},
|
|
32
|
+
wide: {
|
|
33
|
+
icon: _icons.stretchWide,
|
|
34
|
+
title: (0, _i18n.__)('Wide width')
|
|
35
|
+
},
|
|
36
|
+
full: {
|
|
37
|
+
icon: _icons.stretchFullWidth,
|
|
38
|
+
title: (0, _i18n.__)('Full width')
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
exports.BLOCK_ALIGNMENTS_CONTROLS = BLOCK_ALIGNMENTS_CONTROLS;
|
|
42
|
+
const DEFAULT_CONTROL = 'none';
|
|
43
|
+
exports.DEFAULT_CONTROL = DEFAULT_CONTROL;
|
|
44
|
+
const POPOVER_PROPS = {
|
|
45
|
+
isAlternate: true
|
|
46
|
+
};
|
|
47
|
+
exports.POPOVER_PROPS = POPOVER_PROPS;
|
|
48
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-alignment-control/constants.js"],"names":["BLOCK_ALIGNMENTS_CONTROLS","none","icon","alignNone","title","left","positionLeft","center","positionCenter","right","positionRight","wide","stretchWide","full","stretchFullWidth","DEFAULT_CONTROL","POPOVER_PROPS","isAlternate"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAWO,MAAMA,yBAAyB,GAAG;AACxCC,EAAAA,IAAI,EAAE;AACLC,IAAAA,IAAI,EAAEC,gBADD;AAELC,IAAAA,KAAK,EAAE,cAAI,MAAJ,EAAY,kBAAZ;AAFF,GADkC;AAKxCC,EAAAA,IAAI,EAAE;AACLH,IAAAA,IAAI,EAAEI,mBADD;AAELF,IAAAA,KAAK,EAAE,cAAI,YAAJ;AAFF,GALkC;AASxCG,EAAAA,MAAM,EAAE;AACPL,IAAAA,IAAI,EAAEM,qBADC;AAEPJ,IAAAA,KAAK,EAAE,cAAI,cAAJ;AAFA,GATgC;AAaxCK,EAAAA,KAAK,EAAE;AACNP,IAAAA,IAAI,EAAEQ,oBADA;AAENN,IAAAA,KAAK,EAAE,cAAI,aAAJ;AAFD,GAbiC;AAiBxCO,EAAAA,IAAI,EAAE;AACLT,IAAAA,IAAI,EAAEU,kBADD;AAELR,IAAAA,KAAK,EAAE,cAAI,YAAJ;AAFF,GAjBkC;AAqBxCS,EAAAA,IAAI,EAAE;AACLX,IAAAA,IAAI,EAAEY,uBADD;AAELV,IAAAA,KAAK,EAAE,cAAI,YAAJ;AAFF;AArBkC,CAAlC;;AA2BA,MAAMW,eAAe,GAAG,MAAxB;;AAEA,MAAMC,aAAa,GAAG;AAC5BC,EAAAA,WAAW,EAAE;AADe,CAAtB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\talignNone,\n\tpositionCenter,\n\tpositionLeft,\n\tpositionRight,\n\tstretchFullWidth,\n\tstretchWide,\n} from '@wordpress/icons';\n\nexport const BLOCK_ALIGNMENTS_CONTROLS = {\n\tnone: {\n\t\ticon: alignNone,\n\t\ttitle: _x( 'None', 'Alignment option' ),\n\t},\n\tleft: {\n\t\ticon: positionLeft,\n\t\ttitle: __( 'Align left' ),\n\t},\n\tcenter: {\n\t\ticon: positionCenter,\n\t\ttitle: __( 'Align center' ),\n\t},\n\tright: {\n\t\ticon: positionRight,\n\t\ttitle: __( 'Align right' ),\n\t},\n\twide: {\n\t\ticon: stretchWide,\n\t\ttitle: __( 'Wide width' ),\n\t},\n\tfull: {\n\t\ticon: stretchFullWidth,\n\t\ttitle: __( 'Full width' ),\n\t},\n};\n\nexport const DEFAULT_CONTROL = 'none';\n\nexport const POPOVER_PROPS = {\n\tisAlternate: true,\n};\n"]}
|
|
@@ -17,10 +17,10 @@ var _i18n = require("@wordpress/i18n");
|
|
|
17
17
|
|
|
18
18
|
var _components = require("@wordpress/components");
|
|
19
19
|
|
|
20
|
-
var _icons = require("@wordpress/icons");
|
|
21
|
-
|
|
22
20
|
var _useAvailableAlignments = _interopRequireDefault(require("./use-available-alignments"));
|
|
23
21
|
|
|
22
|
+
var _constants = require("./constants");
|
|
23
|
+
|
|
24
24
|
/**
|
|
25
25
|
* External dependencies
|
|
26
26
|
*/
|
|
@@ -32,37 +32,6 @@ var _useAvailableAlignments = _interopRequireDefault(require("./use-available-al
|
|
|
32
32
|
/**
|
|
33
33
|
* Internal dependencies
|
|
34
34
|
*/
|
|
35
|
-
const BLOCK_ALIGNMENTS_CONTROLS = {
|
|
36
|
-
none: {
|
|
37
|
-
icon: _icons.alignNone,
|
|
38
|
-
title: (0, _i18n._x)('None', 'Alignment option')
|
|
39
|
-
},
|
|
40
|
-
left: {
|
|
41
|
-
icon: _icons.positionLeft,
|
|
42
|
-
title: (0, _i18n.__)('Align left')
|
|
43
|
-
},
|
|
44
|
-
center: {
|
|
45
|
-
icon: _icons.positionCenter,
|
|
46
|
-
title: (0, _i18n.__)('Align center')
|
|
47
|
-
},
|
|
48
|
-
right: {
|
|
49
|
-
icon: _icons.positionRight,
|
|
50
|
-
title: (0, _i18n.__)('Align right')
|
|
51
|
-
},
|
|
52
|
-
wide: {
|
|
53
|
-
icon: _icons.stretchWide,
|
|
54
|
-
title: (0, _i18n.__)('Wide width')
|
|
55
|
-
},
|
|
56
|
-
full: {
|
|
57
|
-
icon: _icons.stretchFullWidth,
|
|
58
|
-
title: (0, _i18n.__)('Full width')
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
const DEFAULT_CONTROL = 'none';
|
|
62
|
-
const POPOVER_PROPS = {
|
|
63
|
-
isAlternate: true
|
|
64
|
-
};
|
|
65
|
-
|
|
66
35
|
function BlockAlignmentUI(_ref) {
|
|
67
36
|
let {
|
|
68
37
|
value,
|
|
@@ -82,24 +51,24 @@ function BlockAlignmentUI(_ref) {
|
|
|
82
51
|
onChange([value, 'none'].includes(align) ? undefined : align);
|
|
83
52
|
}
|
|
84
53
|
|
|
85
|
-
const activeAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[value];
|
|
86
|
-
const defaultAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[DEFAULT_CONTROL];
|
|
54
|
+
const activeAlignmentControl = _constants.BLOCK_ALIGNMENTS_CONTROLS[value];
|
|
55
|
+
const defaultAlignmentControl = _constants.BLOCK_ALIGNMENTS_CONTROLS[_constants.DEFAULT_CONTROL];
|
|
87
56
|
const UIComponent = isToolbar ? _components.ToolbarGroup : _components.ToolbarDropdownMenu;
|
|
88
57
|
const commonProps = {
|
|
89
|
-
popoverProps: POPOVER_PROPS,
|
|
58
|
+
popoverProps: _constants.POPOVER_PROPS,
|
|
90
59
|
icon: activeAlignmentControl ? activeAlignmentControl.icon : defaultAlignmentControl.icon,
|
|
91
60
|
label: (0, _i18n.__)('Align'),
|
|
92
61
|
toggleProps: {
|
|
93
62
|
describedBy: (0, _i18n.__)('Change alignment')
|
|
94
63
|
}
|
|
95
64
|
};
|
|
96
|
-
const extraProps = isToolbar
|
|
97
|
-
isCollapsed
|
|
65
|
+
const extraProps = isToolbar ? {
|
|
66
|
+
isCollapsed,
|
|
98
67
|
controls: enabledControls.map(_ref2 => {
|
|
99
68
|
let {
|
|
100
69
|
name: controlName
|
|
101
70
|
} = _ref2;
|
|
102
|
-
return { ...BLOCK_ALIGNMENTS_CONTROLS[controlName],
|
|
71
|
+
return { ..._constants.BLOCK_ALIGNMENTS_CONTROLS[controlName],
|
|
103
72
|
isActive: value === controlName || !value && controlName === 'none',
|
|
104
73
|
role: isCollapsed ? 'menuitemradio' : undefined,
|
|
105
74
|
onClick: () => onChangeAlignment(controlName)
|
|
@@ -120,7 +89,7 @@ function BlockAlignmentUI(_ref) {
|
|
|
120
89
|
const {
|
|
121
90
|
icon,
|
|
122
91
|
title
|
|
123
|
-
} = BLOCK_ALIGNMENTS_CONTROLS[controlName]; // If no value is provided, mark as selected the `none` option.
|
|
92
|
+
} = _constants.BLOCK_ALIGNMENTS_CONTROLS[controlName]; // If no value is provided, mark as selected the `none` option.
|
|
124
93
|
|
|
125
94
|
const isSelected = controlName === value || !value && controlName === 'none';
|
|
126
95
|
return (0, _element.createElement)(_components.MenuItem, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-alignment-control/ui.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-alignment-control/ui.js"],"names":["BlockAlignmentUI","value","onChange","controls","isToolbar","isCollapsed","enabledControls","hasEnabledControls","length","onChangeAlignment","align","includes","undefined","activeAlignmentControl","BLOCK_ALIGNMENTS_CONTROLS","defaultAlignmentControl","DEFAULT_CONTROL","UIComponent","ToolbarGroup","ToolbarDropdownMenu","commonProps","popoverProps","POPOVER_PROPS","icon","label","toggleProps","describedBy","extraProps","map","name","controlName","isActive","role","onClick","children","onClose","info","title","isSelected"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AAUA;;AACA;;AApBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AAQA,SAASA,gBAAT,OAMI;AAAA,MANuB;AAC1BC,IAAAA,KAD0B;AAE1BC,IAAAA,QAF0B;AAG1BC,IAAAA,QAH0B;AAI1BC,IAAAA,SAJ0B;AAK1BC,IAAAA,WAAW,GAAG;AALY,GAMvB;AACH,QAAMC,eAAe,GAAG,qCAAwBH,QAAxB,CAAxB;AACA,QAAMI,kBAAkB,GAAG,CAAC,CAAED,eAAe,CAACE,MAA9C;;AAEA,MAAK,CAAED,kBAAP,EAA4B;AAC3B,WAAO,IAAP;AACA;;AAED,WAASE,iBAAT,CAA4BC,KAA5B,EAAoC;AACnCR,IAAAA,QAAQ,CAAE,CAAED,KAAF,EAAS,MAAT,EAAkBU,QAAlB,CAA4BD,KAA5B,IAAsCE,SAAtC,GAAkDF,KAApD,CAAR;AACA;;AAED,QAAMG,sBAAsB,GAAGC,qCAA2Bb,KAA3B,CAA/B;AACA,QAAMc,uBAAuB,GAC5BD,qCAA2BE,0BAA3B,CADD;AAGA,QAAMC,WAAW,GAAGb,SAAS,GAAGc,wBAAH,GAAkBC,+BAA/C;AACA,QAAMC,WAAW,GAAG;AACnBC,IAAAA,YAAY,EAAEC,wBADK;AAEnBC,IAAAA,IAAI,EAAEV,sBAAsB,GACzBA,sBAAsB,CAACU,IADE,GAEzBR,uBAAuB,CAACQ,IAJR;AAKnBC,IAAAA,KAAK,EAAE,cAAI,OAAJ,CALY;AAMnBC,IAAAA,WAAW,EAAE;AAAEC,MAAAA,WAAW,EAAE,cAAI,kBAAJ;AAAf;AANM,GAApB;AAQA,QAAMC,UAAU,GAAGvB,SAAS,GACzB;AACAC,IAAAA,WADA;AAEAF,IAAAA,QAAQ,EAAEG,eAAe,CAACsB,GAAhB,CAAqB,SAA6B;AAAA,UAA3B;AAAEC,QAAAA,IAAI,EAAEC;AAAR,OAA2B;AAC3D,aAAO,EACN,GAAGhB,qCAA2BgB,WAA3B,CADG;AAENC,QAAAA,QAAQ,EACP9B,KAAK,KAAK6B,WAAV,IACE,CAAE7B,KAAF,IAAW6B,WAAW,KAAK,MAJxB;AAKNE,QAAAA,IAAI,EAAE3B,WAAW,GAAG,eAAH,GAAqBO,SALhC;AAMNqB,QAAAA,OAAO,EAAE,MAAMxB,iBAAiB,CAAEqB,WAAF;AAN1B,OAAP;AAQA,KATS;AAFV,GADyB,GAczB;AACAI,IAAAA,QAAQ,EAAE,SAAmB;AAAA,UAAjB;AAAEC,QAAAA;AAAF,OAAiB;AAC5B,aACC,qDACC,4BAAC,qBAAD;AAAW,QAAA,SAAS,EAAC;AAArB,SACG7B,eAAe,CAACsB,GAAhB,CACD,SAAmC;AAAA,YAAjC;AAAEC,UAAAA,IAAI,EAAEC,WAAR;AAAqBM,UAAAA;AAArB,SAAiC;AAClC,cAAM;AACLb,UAAAA,IADK;AAELc,UAAAA;AAFK,YAGFvB,qCACHgB,WADG,CAHJ,CADkC,CAOlC;;AACA,cAAMQ,UAAU,GACfR,WAAW,KAAK7B,KAAhB,IACE,CAAEA,KAAF,IACD6B,WAAW,KAAK,MAHlB;AAIA,eACC,4BAAC,oBAAD;AACC,UAAA,GAAG,EAAGA,WADP;AAEC,UAAA,IAAI,EAAGP,IAFR;AAGC,UAAA,YAAY,EAAC,MAHd;AAIC,UAAA,SAAS,EAAG,yBACX,qCADW,EAEX;AACC,yBAAae;AADd,WAFW,CAJb;AAUC,UAAA,UAAU,EAAGA,UAVd;AAWC,UAAA,OAAO,EAAG,MAAM;AACf7B,YAAAA,iBAAiB,CAChBqB,WADgB,CAAjB;AAGAK,YAAAA,OAAO;AACP,WAhBF;AAiBC,UAAA,IAAI,EAAC,eAjBN;AAkBC,UAAA,IAAI,EAAGC;AAlBR,WAoBGC,KApBH,CADD;AAwBA,OArCA,CADH,CADD,CADD;AA6CA;AA/CD,GAdH;AAgEA,SAAO,4BAAC,WAAD,6BAAkBjB,WAAlB,EAAqCO,UAArC,EAAP;AACA;;eAEc3B,gB","sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tToolbarDropdownMenu,\n\tToolbarGroup,\n\tMenuGroup,\n\tMenuItem,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport useAvailableAlignments from './use-available-alignments';\nimport {\n\tBLOCK_ALIGNMENTS_CONTROLS,\n\tDEFAULT_CONTROL,\n\tPOPOVER_PROPS,\n} from './constants';\n\nfunction BlockAlignmentUI( {\n\tvalue,\n\tonChange,\n\tcontrols,\n\tisToolbar,\n\tisCollapsed = true,\n} ) {\n\tconst enabledControls = useAvailableAlignments( controls );\n\tconst hasEnabledControls = !! enabledControls.length;\n\n\tif ( ! hasEnabledControls ) {\n\t\treturn null;\n\t}\n\n\tfunction onChangeAlignment( align ) {\n\t\tonChange( [ value, 'none' ].includes( align ) ? undefined : align );\n\t}\n\n\tconst activeAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[ value ];\n\tconst defaultAlignmentControl =\n\t\tBLOCK_ALIGNMENTS_CONTROLS[ DEFAULT_CONTROL ];\n\n\tconst UIComponent = isToolbar ? ToolbarGroup : ToolbarDropdownMenu;\n\tconst commonProps = {\n\t\tpopoverProps: POPOVER_PROPS,\n\t\ticon: activeAlignmentControl\n\t\t\t? activeAlignmentControl.icon\n\t\t\t: defaultAlignmentControl.icon,\n\t\tlabel: __( 'Align' ),\n\t\ttoggleProps: { describedBy: __( 'Change alignment' ) },\n\t};\n\tconst extraProps = isToolbar\n\t\t? {\n\t\t\t\tisCollapsed,\n\t\t\t\tcontrols: enabledControls.map( ( { name: controlName } ) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...BLOCK_ALIGNMENTS_CONTROLS[ controlName ],\n\t\t\t\t\t\tisActive:\n\t\t\t\t\t\t\tvalue === controlName ||\n\t\t\t\t\t\t\t( ! value && controlName === 'none' ),\n\t\t\t\t\t\trole: isCollapsed ? 'menuitemradio' : undefined,\n\t\t\t\t\t\tonClick: () => onChangeAlignment( controlName ),\n\t\t\t\t\t};\n\t\t\t\t} ),\n\t\t }\n\t\t: {\n\t\t\t\tchildren: ( { onClose } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<MenuGroup className=\"block-editor-block-alignment-control__menu-group\">\n\t\t\t\t\t\t\t\t{ enabledControls.map(\n\t\t\t\t\t\t\t\t\t( { name: controlName, info } ) => {\n\t\t\t\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\t\t\t\ticon,\n\t\t\t\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\t\t\t} = BLOCK_ALIGNMENTS_CONTROLS[\n\t\t\t\t\t\t\t\t\t\t\tcontrolName\n\t\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t\t\t// If no value is provided, mark as selected the `none` option.\n\t\t\t\t\t\t\t\t\t\tconst isSelected =\n\t\t\t\t\t\t\t\t\t\t\tcontrolName === value ||\n\t\t\t\t\t\t\t\t\t\t\t( ! value &&\n\t\t\t\t\t\t\t\t\t\t\t\tcontrolName === 'none' );\n\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ controlName }\n\t\t\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={ classNames(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'components-dropdown-menu__menu-item',\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'is-active': isSelected,\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tonChangeAlignment(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolName\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\t\t\t\t\tinfo={ info }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t</>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t };\n\n\treturn <UIComponent { ...commonProps } { ...extraProps } />;\n}\n\nexport default BlockAlignmentUI;\n"]}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _i18n = require("@wordpress/i18n");
|
|
15
|
+
|
|
16
|
+
var _components = require("@wordpress/components");
|
|
17
|
+
|
|
18
|
+
var _useAvailableAlignments = _interopRequireDefault(require("./use-available-alignments"));
|
|
19
|
+
|
|
20
|
+
var _constants = require("./constants");
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* WordPress dependencies
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Internal dependencies
|
|
28
|
+
*/
|
|
29
|
+
function BlockAlignmentUI(_ref) {
|
|
30
|
+
let {
|
|
31
|
+
value,
|
|
32
|
+
onChange,
|
|
33
|
+
controls,
|
|
34
|
+
isToolbar,
|
|
35
|
+
isCollapsed = true,
|
|
36
|
+
isBottomSheetControl = false
|
|
37
|
+
} = _ref;
|
|
38
|
+
const enabledControls = (0, _useAvailableAlignments.default)(controls);
|
|
39
|
+
const hasEnabledControls = !!enabledControls.length;
|
|
40
|
+
|
|
41
|
+
if (!hasEnabledControls) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function onChangeAlignment(align) {
|
|
46
|
+
onChange([value, 'none'].includes(align) ? undefined : align);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const activeAlignmentControl = _constants.BLOCK_ALIGNMENTS_CONTROLS[value];
|
|
50
|
+
const defaultAlignmentControl = _constants.BLOCK_ALIGNMENTS_CONTROLS[_constants.DEFAULT_CONTROL];
|
|
51
|
+
const toolbarUIComponent = isToolbar ? _components.ToolbarGroup : _components.ToolbarDropdownMenu;
|
|
52
|
+
const UIComponent = isBottomSheetControl ? _components.BottomSheetSelectControl : toolbarUIComponent;
|
|
53
|
+
const commonProps = {
|
|
54
|
+
label: (0, _i18n.__)('Align')
|
|
55
|
+
};
|
|
56
|
+
const extraProps = isBottomSheetControl ? {
|
|
57
|
+
options: enabledControls.map(_ref2 => {
|
|
58
|
+
let {
|
|
59
|
+
name: controlName
|
|
60
|
+
} = _ref2;
|
|
61
|
+
const control = _constants.BLOCK_ALIGNMENTS_CONTROLS[controlName];
|
|
62
|
+
return {
|
|
63
|
+
value: controlName,
|
|
64
|
+
label: control.title,
|
|
65
|
+
icon: control.icon
|
|
66
|
+
};
|
|
67
|
+
}),
|
|
68
|
+
value: activeAlignmentControl ? value : 'none',
|
|
69
|
+
onChange: align => onChangeAlignment(align)
|
|
70
|
+
} : {
|
|
71
|
+
icon: activeAlignmentControl ? activeAlignmentControl.icon : defaultAlignmentControl.icon,
|
|
72
|
+
isCollapsed: isToolbar ? isCollapsed : undefined,
|
|
73
|
+
controls: enabledControls.map(_ref3 => {
|
|
74
|
+
let {
|
|
75
|
+
name: controlName
|
|
76
|
+
} = _ref3;
|
|
77
|
+
return { ..._constants.BLOCK_ALIGNMENTS_CONTROLS[controlName],
|
|
78
|
+
isActive: value === controlName || !value && controlName === 'none',
|
|
79
|
+
onClick: () => onChangeAlignment(controlName)
|
|
80
|
+
};
|
|
81
|
+
}),
|
|
82
|
+
popoverProps: _constants.POPOVER_PROPS,
|
|
83
|
+
toggleProps: {
|
|
84
|
+
describedBy: (0, _i18n.__)('Change alignment')
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
return (0, _element.createElement)(UIComponent, (0, _extends2.default)({}, commonProps, extraProps));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
var _default = BlockAlignmentUI;
|
|
91
|
+
exports.default = _default;
|
|
92
|
+
//# sourceMappingURL=ui.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-alignment-control/ui.native.js"],"names":["BlockAlignmentUI","value","onChange","controls","isToolbar","isCollapsed","isBottomSheetControl","enabledControls","hasEnabledControls","length","onChangeAlignment","align","includes","undefined","activeAlignmentControl","BLOCK_ALIGNMENTS_CONTROLS","defaultAlignmentControl","DEFAULT_CONTROL","toolbarUIComponent","ToolbarGroup","ToolbarDropdownMenu","UIComponent","BottomSheetSelectControl","commonProps","label","extraProps","options","map","name","controlName","control","title","icon","isActive","onClick","popoverProps","POPOVER_PROPS","toggleProps","describedBy"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AASA;;AACA;;AAdA;AACA;AACA;;AAQA;AACA;AACA;AAQA,SAASA,gBAAT,OAOI;AAAA,MAPuB;AAC1BC,IAAAA,KAD0B;AAE1BC,IAAAA,QAF0B;AAG1BC,IAAAA,QAH0B;AAI1BC,IAAAA,SAJ0B;AAK1BC,IAAAA,WAAW,GAAG,IALY;AAM1BC,IAAAA,oBAAoB,GAAG;AANG,GAOvB;AACH,QAAMC,eAAe,GAAG,qCAAwBJ,QAAxB,CAAxB;AACA,QAAMK,kBAAkB,GAAG,CAAC,CAAED,eAAe,CAACE,MAA9C;;AAEA,MAAK,CAAED,kBAAP,EAA4B;AAC3B,WAAO,IAAP;AACA;;AAED,WAASE,iBAAT,CAA4BC,KAA5B,EAAoC;AACnCT,IAAAA,QAAQ,CAAE,CAAED,KAAF,EAAS,MAAT,EAAkBW,QAAlB,CAA4BD,KAA5B,IAAsCE,SAAtC,GAAkDF,KAApD,CAAR;AACA;;AAED,QAAMG,sBAAsB,GAAGC,qCAA2Bd,KAA3B,CAA/B;AACA,QAAMe,uBAAuB,GAC5BD,qCAA2BE,0BAA3B,CADD;AAGA,QAAMC,kBAAkB,GAAGd,SAAS,GAAGe,wBAAH,GAAkBC,+BAAtD;AACA,QAAMC,WAAW,GAAGf,oBAAoB,GACrCgB,oCADqC,GAErCJ,kBAFH;AAIA,QAAMK,WAAW,GAAG;AACnBC,IAAAA,KAAK,EAAE,cAAI,OAAJ;AADY,GAApB;AAGA,QAAMC,UAAU,GAAGnB,oBAAoB,GACpC;AACAoB,IAAAA,OAAO,EAAEnB,eAAe,CAACoB,GAAhB,CAAqB,SAA6B;AAAA,UAA3B;AAAEC,QAAAA,IAAI,EAAEC;AAAR,OAA2B;AAC1D,YAAMC,OAAO,GAAGf,qCAA2Bc,WAA3B,CAAhB;AACA,aAAO;AACN5B,QAAAA,KAAK,EAAE4B,WADD;AAENL,QAAAA,KAAK,EAAEM,OAAO,CAACC,KAFT;AAGNC,QAAAA,IAAI,EAAEF,OAAO,CAACE;AAHR,OAAP;AAKA,KAPQ,CADT;AASA/B,IAAAA,KAAK,EAAEa,sBAAsB,GAAGb,KAAH,GAAW,MATxC;AAUAC,IAAAA,QAAQ,EAAIS,KAAF,IAAaD,iBAAiB,CAAEC,KAAF;AAVxC,GADoC,GAapC;AACAqB,IAAAA,IAAI,EAAElB,sBAAsB,GACzBA,sBAAsB,CAACkB,IADE,GAEzBhB,uBAAuB,CAACgB,IAH3B;AAIA3B,IAAAA,WAAW,EAAED,SAAS,GAAGC,WAAH,GAAiBQ,SAJvC;AAKAV,IAAAA,QAAQ,EAAEI,eAAe,CAACoB,GAAhB,CAAqB,SAA6B;AAAA,UAA3B;AAAEC,QAAAA,IAAI,EAAEC;AAAR,OAA2B;AAC3D,aAAO,EACN,GAAGd,qCAA2Bc,WAA3B,CADG;AAENI,QAAAA,QAAQ,EACPhC,KAAK,KAAK4B,WAAV,IACE,CAAE5B,KAAF,IAAW4B,WAAW,KAAK,MAJxB;AAKNK,QAAAA,OAAO,EAAE,MAAMxB,iBAAiB,CAAEmB,WAAF;AAL1B,OAAP;AAOA,KARS,CALV;AAcAM,IAAAA,YAAY,EAAEC,wBAdd;AAeAC,IAAAA,WAAW,EAAE;AAAEC,MAAAA,WAAW,EAAE,cAAI,kBAAJ;AAAf;AAfb,GAbH;AA+BA,SAAO,4BAAC,WAAD,6BAAkBf,WAAlB,EAAqCE,UAArC,EAAP;AACA;;eAEczB,gB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tToolbarDropdownMenu,\n\tToolbarGroup,\n\tBottomSheetSelectControl,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport useAvailableAlignments from './use-available-alignments';\nimport {\n\tBLOCK_ALIGNMENTS_CONTROLS,\n\tDEFAULT_CONTROL,\n\tPOPOVER_PROPS,\n} from './constants';\n\nfunction BlockAlignmentUI( {\n\tvalue,\n\tonChange,\n\tcontrols,\n\tisToolbar,\n\tisCollapsed = true,\n\tisBottomSheetControl = false,\n} ) {\n\tconst enabledControls = useAvailableAlignments( controls );\n\tconst hasEnabledControls = !! enabledControls.length;\n\n\tif ( ! hasEnabledControls ) {\n\t\treturn null;\n\t}\n\n\tfunction onChangeAlignment( align ) {\n\t\tonChange( [ value, 'none' ].includes( align ) ? undefined : align );\n\t}\n\n\tconst activeAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[ value ];\n\tconst defaultAlignmentControl =\n\t\tBLOCK_ALIGNMENTS_CONTROLS[ DEFAULT_CONTROL ];\n\n\tconst toolbarUIComponent = isToolbar ? ToolbarGroup : ToolbarDropdownMenu;\n\tconst UIComponent = isBottomSheetControl\n\t\t? BottomSheetSelectControl\n\t\t: toolbarUIComponent;\n\n\tconst commonProps = {\n\t\tlabel: __( 'Align' ),\n\t};\n\tconst extraProps = isBottomSheetControl\n\t\t? {\n\t\t\t\toptions: enabledControls.map( ( { name: controlName } ) => {\n\t\t\t\t\tconst control = BLOCK_ALIGNMENTS_CONTROLS[ controlName ];\n\t\t\t\t\treturn {\n\t\t\t\t\t\tvalue: controlName,\n\t\t\t\t\t\tlabel: control.title,\n\t\t\t\t\t\ticon: control.icon,\n\t\t\t\t\t};\n\t\t\t\t} ),\n\t\t\t\tvalue: activeAlignmentControl ? value : 'none',\n\t\t\t\tonChange: ( align ) => onChangeAlignment( align ),\n\t\t }\n\t\t: {\n\t\t\t\ticon: activeAlignmentControl\n\t\t\t\t\t? activeAlignmentControl.icon\n\t\t\t\t\t: defaultAlignmentControl.icon,\n\t\t\t\tisCollapsed: isToolbar ? isCollapsed : undefined,\n\t\t\t\tcontrols: enabledControls.map( ( { name: controlName } ) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...BLOCK_ALIGNMENTS_CONTROLS[ controlName ],\n\t\t\t\t\t\tisActive:\n\t\t\t\t\t\t\tvalue === controlName ||\n\t\t\t\t\t\t\t( ! value && controlName === 'none' ),\n\t\t\t\t\t\tonClick: () => onChangeAlignment( controlName ),\n\t\t\t\t\t};\n\t\t\t\t} ),\n\t\t\t\tpopoverProps: POPOVER_PROPS,\n\t\t\t\ttoggleProps: { describedBy: __( 'Change alignment' ) },\n\t\t };\n\n\treturn <UIComponent { ...commonProps } { ...extraProps } />;\n}\n\nexport default BlockAlignmentUI;\n"]}
|
|
@@ -44,11 +44,9 @@ function useBlockClassNames(clientId) {
|
|
|
44
44
|
getBlockName,
|
|
45
45
|
getSettings,
|
|
46
46
|
hasSelectedInnerBlock,
|
|
47
|
-
isTyping
|
|
48
|
-
__experimentalGetActiveBlockIdByBlockNames: getActiveBlockIdByBlockNames
|
|
47
|
+
isTyping
|
|
49
48
|
} = select(_store.store);
|
|
50
49
|
const {
|
|
51
|
-
__experimentalSpotlightEntityBlocks: spotlightEntityBlocks,
|
|
52
50
|
outlineMode
|
|
53
51
|
} = getSettings();
|
|
54
52
|
const isDragging = isBlockBeingDragged(clientId);
|
|
@@ -57,7 +55,6 @@ function useBlockClassNames(clientId) {
|
|
|
57
55
|
const checkDeep = true; // "ancestor" is the more appropriate label due to "deep" check.
|
|
58
56
|
|
|
59
57
|
const isAncestorOfSelectedBlock = hasSelectedInnerBlock(clientId, checkDeep);
|
|
60
|
-
const activeEntityBlockId = getActiveBlockIdByBlockNames(spotlightEntityBlocks);
|
|
61
58
|
return (0, _classnames.default)({
|
|
62
59
|
'is-selected': isSelected,
|
|
63
60
|
'is-highlighted': isBlockHighlighted(clientId),
|
|
@@ -65,9 +62,6 @@ function useBlockClassNames(clientId) {
|
|
|
65
62
|
'is-reusable': (0, _blocks.isReusableBlock)((0, _blocks.getBlockType)(name)),
|
|
66
63
|
'is-dragging': isDragging,
|
|
67
64
|
'has-child-selected': isAncestorOfSelectedBlock,
|
|
68
|
-
'has-active-entity': activeEntityBlockId,
|
|
69
|
-
// Determine if there is an active entity area to spotlight.
|
|
70
|
-
'is-active-entity': activeEntityBlockId === clientId,
|
|
71
65
|
'remove-outline': isSelected && outlineMode && isTyping()
|
|
72
66
|
});
|
|
73
67
|
}, [clientId]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-block-class-names.js"],"names":["useBlockClassNames","clientId","select","isBlockBeingDragged","isBlockHighlighted","isBlockSelected","isBlockMultiSelected","getBlockName","getSettings","hasSelectedInnerBlock","isTyping","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-block-class-names.js"],"names":["useBlockClassNames","clientId","select","isBlockBeingDragged","isBlockHighlighted","isBlockSelected","isBlockMultiSelected","getBlockName","getSettings","hasSelectedInnerBlock","isTyping","blockEditorStore","outlineMode","isDragging","isSelected","name","checkDeep","isAncestorOfSelectedBlock"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kBAAT,CAA6BC,QAA7B,EAAwC;AAC9C,SAAO,qBACJC,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,mBADK;AAELC,MAAAA,kBAFK;AAGLC,MAAAA,eAHK;AAILC,MAAAA,oBAJK;AAKLC,MAAAA,YALK;AAMLC,MAAAA,WANK;AAOLC,MAAAA,qBAPK;AAQLC,MAAAA;AARK,QASFR,MAAM,CAAES,YAAF,CATV;AAUA,UAAM;AAAEC,MAAAA;AAAF,QAAkBJ,WAAW,EAAnC;AACA,UAAMK,UAAU,GAAGV,mBAAmB,CAAEF,QAAF,CAAtC;AACA,UAAMa,UAAU,GAAGT,eAAe,CAAEJ,QAAF,CAAlC;AACA,UAAMc,IAAI,GAAGR,YAAY,CAAEN,QAAF,CAAzB;AACA,UAAMe,SAAS,GAAG,IAAlB,CAfa,CAgBb;;AACA,UAAMC,yBAAyB,GAAGR,qBAAqB,CACtDR,QADsD,EAEtDe,SAFsD,CAAvD;AAIA,WAAO,yBAAY;AAClB,qBAAeF,UADG;AAElB,wBAAkBV,kBAAkB,CAAEH,QAAF,CAFlB;AAGlB,2BAAqBK,oBAAoB,CAAEL,QAAF,CAHvB;AAIlB,qBAAe,6BAAiB,0BAAcc,IAAd,CAAjB,CAJG;AAKlB,qBAAeF,UALG;AAMlB,4BAAsBI,yBANJ;AAOlB,wBAAkBH,UAAU,IAAIF,WAAd,IAA6BF,QAAQ;AAPrC,KAAZ,CAAP;AASA,GA/BK,EAgCN,CAAET,QAAF,CAhCM,CAAP;AAkCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { isReusableBlock, getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\n\n/**\n * Returns the class names used for the different states of the block.\n *\n * @param {string} clientId The block client ID.\n *\n * @return {string} The class names.\n */\nexport function useBlockClassNames( clientId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisBlockBeingDragged,\n\t\t\t\tisBlockHighlighted,\n\t\t\t\tisBlockSelected,\n\t\t\t\tisBlockMultiSelected,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetSettings,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tisTyping,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { outlineMode } = getSettings();\n\t\t\tconst isDragging = isBlockBeingDragged( clientId );\n\t\t\tconst isSelected = isBlockSelected( clientId );\n\t\t\tconst name = getBlockName( clientId );\n\t\t\tconst checkDeep = true;\n\t\t\t// \"ancestor\" is the more appropriate label due to \"deep\" check.\n\t\t\tconst isAncestorOfSelectedBlock = hasSelectedInnerBlock(\n\t\t\t\tclientId,\n\t\t\t\tcheckDeep\n\t\t\t);\n\t\t\treturn classnames( {\n\t\t\t\t'is-selected': isSelected,\n\t\t\t\t'is-highlighted': isBlockHighlighted( clientId ),\n\t\t\t\t'is-multi-selected': isBlockMultiSelected( clientId ),\n\t\t\t\t'is-reusable': isReusableBlock( getBlockType( name ) ),\n\t\t\t\t'is-dragging': isDragging,\n\t\t\t\t'has-child-selected': isAncestorOfSelectedBlock,\n\t\t\t\t'remove-outline': isSelected && outlineMode && isTyping(),\n\t\t\t} );\n\t\t},\n\t\t[ clientId ]\n\t);\n}\n"]}
|
|
@@ -11,6 +11,8 @@ var _element = require("@wordpress/element");
|
|
|
11
11
|
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
13
|
|
|
14
|
+
var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
|
|
15
|
+
|
|
14
16
|
var _components = require("@wordpress/components");
|
|
15
17
|
|
|
16
18
|
var _i18n = require("@wordpress/i18n");
|
|
@@ -23,6 +25,10 @@ var _listView = _interopRequireDefault(require("../list-view"));
|
|
|
23
25
|
|
|
24
26
|
var _store = require("../../store");
|
|
25
27
|
|
|
28
|
+
/**
|
|
29
|
+
* WordPress dependencies
|
|
30
|
+
*/
|
|
31
|
+
|
|
26
32
|
/**
|
|
27
33
|
* WordPress dependencies
|
|
28
34
|
*/
|
|
@@ -55,9 +61,12 @@ function BlockNavigationDropdownToggle(_ref) {
|
|
|
55
61
|
function BlockNavigationDropdown(_ref2, ref) {
|
|
56
62
|
let {
|
|
57
63
|
isDisabled,
|
|
58
|
-
__experimentalFeatures,
|
|
59
64
|
...props
|
|
60
65
|
} = _ref2;
|
|
66
|
+
(0, _deprecated.default)('wp.blockEditor.BlockNavigationDropdown', {
|
|
67
|
+
since: '6.1',
|
|
68
|
+
alternative: 'wp.components.Dropdown and wp.blockEditor.ListView'
|
|
69
|
+
});
|
|
61
70
|
const hasBlocks = (0, _data.useSelect)(select => !!select(_store.store).getBlockCount(), []);
|
|
62
71
|
const isEnabled = hasBlocks && !isDisabled;
|
|
63
72
|
return (0, _element.createElement)(_components.Dropdown, {
|
|
@@ -79,10 +88,7 @@ function BlockNavigationDropdown(_ref2, ref) {
|
|
|
79
88
|
className: "block-editor-block-navigation__container"
|
|
80
89
|
}, (0, _element.createElement)("p", {
|
|
81
90
|
className: "block-editor-block-navigation__label"
|
|
82
|
-
}, (0, _i18n.__)('List view')), (0, _element.createElement)(_listView.default,
|
|
83
|
-
showNestedBlocks: true,
|
|
84
|
-
__experimentalFeatures: __experimentalFeatures
|
|
85
|
-
}))
|
|
91
|
+
}, (0, _i18n.__)('List view')), (0, _element.createElement)(_listView.default, null))
|
|
86
92
|
});
|
|
87
93
|
}
|
|
88
94
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-navigation/dropdown.js"],"names":["BlockNavigationDropdownToggle","isEnabled","onToggle","isOpen","innerRef","props","listView","undefined","BlockNavigationDropdown","ref","isDisabled","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-navigation/dropdown.js"],"names":["BlockNavigationDropdownToggle","isEnabled","onToggle","isOpen","innerRef","props","listView","undefined","BlockNavigationDropdown","ref","isDisabled","since","alternative","hasBlocks","select","blockEditorStore","getBlockCount"],"mappings":";;;;;;;;;AAWA;;;;AARA;;AAKA;;AACA;;AACA;;AAEA;;AAKA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAIA,SAASA,6BAAT,OAMI;AAAA,MANoC;AACvCC,IAAAA,SADuC;AAEvCC,IAAAA,QAFuC;AAGvCC,IAAAA,MAHuC;AAIvCC,IAAAA,QAJuC;AAKvC,OAAGC;AALoC,GAMpC;AACH,SACC,4BAAC,kBAAD,6BACMA,KADN;AAEC,IAAA,GAAG,EAAGD,QAFP;AAGC,IAAA,IAAI,EAAGE,eAHR;AAIC,qBAAgBH,MAJjB;AAKC,qBAAc,MALf;AAMC,IAAA,OAAO,EAAGF,SAAS,GAAGC,QAAH,GAAcK;AACjC;AAPD;AAQC,IAAA,KAAK,EAAG,cAAI,WAAJ,CART;AASC,IAAA,SAAS,EAAC,+BATX;AAUC,qBAAgB,CAAEN;AAVnB,KADD;AAcA;;AAED,SAASO,uBAAT,QAA4DC,GAA5D,EAAkE;AAAA,MAAhC;AAAEC,IAAAA,UAAF;AAAc,OAAGL;AAAjB,GAAgC;AACjE,2BAAY,wCAAZ,EAAsD;AACrDM,IAAAA,KAAK,EAAE,KAD8C;AAErDC,IAAAA,WAAW,EAAE;AAFwC,GAAtD;AAKA,QAAMC,SAAS,GAAG,qBACfC,MAAF,IAAc,CAAC,CAAEA,MAAM,CAAEC,YAAF,CAAN,CAA2BC,aAA3B,EADA,EAEjB,EAFiB,CAAlB;AAIA,QAAMf,SAAS,GAAGY,SAAS,IAAI,CAAEH,UAAjC;AAEA,SACC,4BAAC,oBAAD;AACC,IAAA,gBAAgB,EAAC,wCADlB;AAEC,IAAA,QAAQ,EAAC,cAFV;AAGC,IAAA,YAAY,EAAG;AAAA,UAAE;AAAEP,QAAAA,MAAF;AAAUD,QAAAA;AAAV,OAAF;AAAA,aACd,4BAAC,6BAAD,6BACMG,KADN;AAEC,QAAA,QAAQ,EAAGI,GAFZ;AAGC,QAAA,MAAM,EAAGN,MAHV;AAIC,QAAA,QAAQ,EAAGD,QAJZ;AAKC,QAAA,SAAS,EAAGD;AALb,SADc;AAAA,KAHhB;AAYC,IAAA,aAAa,EAAG,MACf;AAAK,MAAA,SAAS,EAAC;AAAf,OACC;AAAG,MAAA,SAAS,EAAC;AAAb,OACG,cAAI,WAAJ,CADH,CADD,EAKC,4BAAC,iBAAD,OALD;AAbF,IADD;AAwBA;;eAEc,yBAAYO,uBAAZ,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Dropdown } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\nimport { listView } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport ListView from '../list-view';\nimport { store as blockEditorStore } from '../../store';\n\nfunction BlockNavigationDropdownToggle( {\n\tisEnabled,\n\tonToggle,\n\tisOpen,\n\tinnerRef,\n\t...props\n} ) {\n\treturn (\n\t\t<Button\n\t\t\t{ ...props }\n\t\t\tref={ innerRef }\n\t\t\ticon={ listView }\n\t\t\taria-expanded={ isOpen }\n\t\t\taria-haspopup=\"true\"\n\t\t\tonClick={ isEnabled ? onToggle : undefined }\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\tlabel={ __( 'List view' ) }\n\t\t\tclassName=\"block-editor-block-navigation\"\n\t\t\taria-disabled={ ! isEnabled }\n\t\t/>\n\t);\n}\n\nfunction BlockNavigationDropdown( { isDisabled, ...props }, ref ) {\n\tdeprecated( 'wp.blockEditor.BlockNavigationDropdown', {\n\t\tsince: '6.1',\n\t\talternative: 'wp.components.Dropdown and wp.blockEditor.ListView',\n\t} );\n\n\tconst hasBlocks = useSelect(\n\t\t( select ) => !! select( blockEditorStore ).getBlockCount(),\n\t\t[]\n\t);\n\tconst isEnabled = hasBlocks && ! isDisabled;\n\n\treturn (\n\t\t<Dropdown\n\t\t\tcontentClassName=\"block-editor-block-navigation__popover\"\n\t\t\tposition=\"bottom right\"\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<BlockNavigationDropdownToggle\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tinnerRef={ ref }\n\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\tonToggle={ onToggle }\n\t\t\t\t\tisEnabled={ isEnabled }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\trenderContent={ () => (\n\t\t\t\t<div className=\"block-editor-block-navigation__container\">\n\t\t\t\t\t<p className=\"block-editor-block-navigation__label\">\n\t\t\t\t\t\t{ __( 'List view' ) }\n\t\t\t\t\t</p>\n\n\t\t\t\t\t<ListView />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( BlockNavigationDropdown );\n"]}
|
|
@@ -37,6 +37,8 @@ function BlockPopover(_ref) {
|
|
|
37
37
|
clientId,
|
|
38
38
|
bottomClientId,
|
|
39
39
|
children,
|
|
40
|
+
__unstableRefreshSize,
|
|
41
|
+
__unstableCoverTarget = false,
|
|
40
42
|
__unstablePopoverSlot,
|
|
41
43
|
__unstableContentRef,
|
|
42
44
|
...props
|
|
@@ -44,6 +46,17 @@ function BlockPopover(_ref) {
|
|
|
44
46
|
const selectedElement = (0, _useBlockRefs.__unstableUseBlockElement)(clientId);
|
|
45
47
|
const lastSelectedElement = (0, _useBlockRefs.__unstableUseBlockElement)(bottomClientId !== null && bottomClientId !== void 0 ? bottomClientId : clientId);
|
|
46
48
|
const popoverScrollRef = (0, _usePopoverScroll.default)(__unstableContentRef);
|
|
49
|
+
const style = (0, _element.useMemo)(() => {
|
|
50
|
+
if (!selectedElement || lastSelectedElement !== selectedElement) {
|
|
51
|
+
return {};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
position: 'absolute',
|
|
56
|
+
width: selectedElement.offsetWidth,
|
|
57
|
+
height: selectedElement.offsetHeight
|
|
58
|
+
};
|
|
59
|
+
}, [selectedElement, lastSelectedElement, __unstableRefreshSize]);
|
|
47
60
|
|
|
48
61
|
if (!selectedElement || bottomClientId && !lastSelectedElement) {
|
|
49
62
|
return null;
|
|
@@ -64,19 +77,21 @@ function BlockPopover(_ref) {
|
|
|
64
77
|
position: "top right left",
|
|
65
78
|
focusOnMount: false,
|
|
66
79
|
anchorRef: anchorRef,
|
|
67
|
-
__unstableStickyBoundaryElement: stickyBoundaryElement // Render in the old slot if needed for backward compatibility,
|
|
80
|
+
__unstableStickyBoundaryElement: __unstableCoverTarget ? undefined : stickyBoundaryElement // Render in the old slot if needed for backward compatibility,
|
|
68
81
|
// otherwise render in place (not in the the default popover slot).
|
|
69
82
|
,
|
|
70
83
|
__unstableSlotName: __unstablePopoverSlot || null,
|
|
71
84
|
__unstableBoundaryParent: true // Observe movement for block animations (especially horizontal).
|
|
72
85
|
,
|
|
73
|
-
__unstableObserveElement: selectedElement
|
|
74
|
-
shouldAnchorIncludePadding: true // Used to safeguard sticky position behavior against cases where it would permanently
|
|
86
|
+
__unstableObserveElement: selectedElement // Used to safeguard sticky position behavior against cases where it would permanently
|
|
75
87
|
// obscure specific sections of a block.
|
|
76
88
|
,
|
|
77
|
-
__unstableEditorCanvasWrapper: __unstableContentRef === null || __unstableContentRef === void 0 ? void 0 : __unstableContentRef.current
|
|
89
|
+
__unstableEditorCanvasWrapper: __unstableContentRef === null || __unstableContentRef === void 0 ? void 0 : __unstableContentRef.current,
|
|
90
|
+
__unstableForcePosition: __unstableCoverTarget
|
|
78
91
|
}, props, {
|
|
79
92
|
className: (0, _classnames.default)('block-editor-block-popover', props.className)
|
|
80
|
-
}),
|
|
93
|
+
}), __unstableCoverTarget && (0, _element.createElement)("div", {
|
|
94
|
+
style: style
|
|
95
|
+
}, children), !__unstableCoverTarget && children);
|
|
81
96
|
}
|
|
82
97
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-popover/index.js"],"names":["BlockPopover","clientId","bottomClientId","children","__unstablePopoverSlot","__unstableContentRef","props","selectedElement","lastSelectedElement","popoverScrollRef","anchorRef","top","bottom","ownerDocument","stickyBoundaryElement","defaultView","frameElement","body","current","className"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-popover/index.js"],"names":["BlockPopover","clientId","bottomClientId","children","__unstableRefreshSize","__unstableCoverTarget","__unstablePopoverSlot","__unstableContentRef","props","selectedElement","lastSelectedElement","popoverScrollRef","style","position","width","offsetWidth","height","offsetHeight","anchorRef","top","bottom","ownerDocument","stickyBoundaryElement","defaultView","frameElement","body","undefined","current","className"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AAKA;;AACA;;AAMA;;AACA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AAIe,SAASA,YAAT,OASX;AAAA,MATkC;AACrCC,IAAAA,QADqC;AAErCC,IAAAA,cAFqC;AAGrCC,IAAAA,QAHqC;AAIrCC,IAAAA,qBAJqC;AAKrCC,IAAAA,qBAAqB,GAAG,KALa;AAMrCC,IAAAA,qBANqC;AAOrCC,IAAAA,oBAPqC;AAQrC,OAAGC;AARkC,GASlC;AACH,QAAMC,eAAe,GAAG,6CAAiBR,QAAjB,CAAxB;AACA,QAAMS,mBAAmB,GAAG,6CAAiBR,cAAjB,aAAiBA,cAAjB,cAAiBA,cAAjB,GAAmCD,QAAnC,CAA5B;AACA,QAAMU,gBAAgB,GAAG,+BAAkBJ,oBAAlB,CAAzB;AACA,QAAMK,KAAK,GAAG,sBAAS,MAAM;AAC5B,QAAK,CAAEH,eAAF,IAAqBC,mBAAmB,KAAKD,eAAlD,EAAoE;AACnE,aAAO,EAAP;AACA;;AAED,WAAO;AACNI,MAAAA,QAAQ,EAAE,UADJ;AAENC,MAAAA,KAAK,EAAEL,eAAe,CAACM,WAFjB;AAGNC,MAAAA,MAAM,EAAEP,eAAe,CAACQ;AAHlB,KAAP;AAKA,GAVa,EAUX,CAAER,eAAF,EAAmBC,mBAAnB,EAAwCN,qBAAxC,CAVW,CAAd;;AAYA,MAAK,CAAEK,eAAF,IAAuBP,cAAc,IAAI,CAAEQ,mBAAhD,EAAwE;AACvE,WAAO,IAAP;AACA;;AAED,QAAMQ,SAAS,GAAG;AACjBC,IAAAA,GAAG,EAAEV,eADY;AAEjBW,IAAAA,MAAM,EAAEV;AAFS,GAAlB;AAKA,QAAM;AAAEW,IAAAA;AAAF,MAAoBZ,eAA1B;AACA,QAAMa,qBAAqB,GAC1BD,aAAa,CAACE,WAAd,CAA0BC,YAA1B,IACA,6BAAoBf,eAApB,CADA,IAEAY,aAAa,CAACI,IAHf;AAKA,SACC,4BAAC,mBAAD;AACC,IAAA,GAAG,EAAGd,gBADP;AAEC,IAAA,OAAO,MAFR;AAGC,IAAA,OAAO,EAAG,KAHX;AAIC,IAAA,QAAQ,EAAC,gBAJV;AAKC,IAAA,YAAY,EAAG,KALhB;AAMC,IAAA,SAAS,EAAGO,SANb;AAOC,IAAA,+BAA+B,EAC9Bb,qBAAqB,GAAGqB,SAAH,GAAeJ,qBARtC,CAUC;AACA;AAXD;AAYC,IAAA,kBAAkB,EAAGhB,qBAAqB,IAAI,IAZ/C;AAaC,IAAA,wBAAwB,MAbzB,CAcC;AAdD;AAeC,IAAA,wBAAwB,EAAGG,eAf5B,CAgBC;AACA;AAjBD;AAkBC,IAAA,6BAA6B,EAAGF,oBAAH,aAAGA,oBAAH,uBAAGA,oBAAoB,CAAEoB,OAlBvD;AAmBC,IAAA,uBAAuB,EAAGtB;AAnB3B,KAoBMG,KApBN;AAqBC,IAAA,SAAS,EAAG,yBACX,4BADW,EAEXA,KAAK,CAACoB,SAFK;AArBb,MA0BGvB,qBAAqB,IAAI;AAAK,IAAA,KAAK,EAAGO;AAAb,KAAuBT,QAAvB,CA1B5B,EA2BG,CAAEE,qBAAF,IAA2BF,QA3B9B,CADD;AA+BA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Popover } from '@wordpress/components';\nimport { getScrollContainer } from '@wordpress/dom';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport usePopoverScroll from './use-popover-scroll';\n\nexport default function BlockPopover( {\n\tclientId,\n\tbottomClientId,\n\tchildren,\n\t__unstableRefreshSize,\n\t__unstableCoverTarget = false,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n\t...props\n} ) {\n\tconst selectedElement = useBlockElement( clientId );\n\tconst lastSelectedElement = useBlockElement( bottomClientId ?? clientId );\n\tconst popoverScrollRef = usePopoverScroll( __unstableContentRef );\n\tconst style = useMemo( () => {\n\t\tif ( ! selectedElement || lastSelectedElement !== selectedElement ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\tposition: 'absolute',\n\t\t\twidth: selectedElement.offsetWidth,\n\t\t\theight: selectedElement.offsetHeight,\n\t\t};\n\t}, [ selectedElement, lastSelectedElement, __unstableRefreshSize ] );\n\n\tif ( ! selectedElement || ( bottomClientId && ! lastSelectedElement ) ) {\n\t\treturn null;\n\t}\n\n\tconst anchorRef = {\n\t\ttop: selectedElement,\n\t\tbottom: lastSelectedElement,\n\t};\n\n\tconst { ownerDocument } = selectedElement;\n\tconst stickyBoundaryElement =\n\t\townerDocument.defaultView.frameElement ||\n\t\tgetScrollContainer( selectedElement ) ||\n\t\townerDocument.body;\n\n\treturn (\n\t\t<Popover\n\t\t\tref={ popoverScrollRef }\n\t\t\tnoArrow\n\t\t\tanimate={ false }\n\t\t\tposition=\"top right left\"\n\t\t\tfocusOnMount={ false }\n\t\t\tanchorRef={ anchorRef }\n\t\t\t__unstableStickyBoundaryElement={\n\t\t\t\t__unstableCoverTarget ? undefined : stickyBoundaryElement\n\t\t\t}\n\t\t\t// Render in the old slot if needed for backward compatibility,\n\t\t\t// otherwise render in place (not in the the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot || null }\n\t\t\t__unstableBoundaryParent\n\t\t\t// Observe movement for block animations (especially horizontal).\n\t\t\t__unstableObserveElement={ selectedElement }\n\t\t\t// Used to safeguard sticky position behavior against cases where it would permanently\n\t\t\t// obscure specific sections of a block.\n\t\t\t__unstableEditorCanvasWrapper={ __unstableContentRef?.current }\n\t\t\t__unstableForcePosition={ __unstableCoverTarget }\n\t\t\t{ ...props }\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-block-popover',\n\t\t\t\tprops.className\n\t\t\t) }\n\t\t>\n\t\t\t{ __unstableCoverTarget && <div style={ style }>{ children }</div> }\n\t\t\t{ ! __unstableCoverTarget && children }\n\t\t</Popover>\n\t);\n}\n"]}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -13,6 +15,8 @@ var _i18n = require("@wordpress/i18n");
|
|
|
13
15
|
|
|
14
16
|
var _keycodes = require("@wordpress/keycodes");
|
|
15
17
|
|
|
18
|
+
var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
|
|
19
|
+
|
|
16
20
|
/**
|
|
17
21
|
* WordPress dependencies
|
|
18
22
|
*/
|
|
@@ -89,6 +93,11 @@ const BlockColorsStyleSelector = _ref4 => {
|
|
|
89
93
|
children,
|
|
90
94
|
...other
|
|
91
95
|
} = _ref4;
|
|
96
|
+
(0, _deprecated.default)(`wp.blockEditor.BlockColorsStyleSelector`, {
|
|
97
|
+
alternative: 'block supports API',
|
|
98
|
+
since: '6.1',
|
|
99
|
+
version: '6.3'
|
|
100
|
+
});
|
|
92
101
|
return (0, _element.createElement)(_components.Dropdown, {
|
|
93
102
|
position: "bottom right",
|
|
94
103
|
className: "block-library-colors-selector",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/color-style-selector/index.js"],"names":["ColorSelectorSVGIcon","ColorSelectorIcon","style","className","renderToggleComponent","TextColor","BackgroundColor","onToggle","isOpen","openOnArrowDown","event","keyCode","DOWN","preventDefault","BlockColorsStyleSelector","children","other"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/color-style-selector/index.js"],"names":["ColorSelectorSVGIcon","ColorSelectorIcon","style","className","renderToggleComponent","TextColor","BackgroundColor","onToggle","isOpen","openOnArrowDown","event","keyCode","DOWN","preventDefault","BlockColorsStyleSelector","children","other","alternative","since","version"],"mappings":";;;;;;;;;;;AAGA;;AAOA;;AACA;;AACA;;AAZA;AACA;AACA;AAYA,MAAMA,oBAAoB,GAAG,MAC5B,4BAAC,eAAD;AAAK,EAAA,KAAK,EAAC,6BAAX;AAAyC,EAAA,OAAO,EAAC;AAAjD,GACC,4BAAC,gBAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADD;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMC,iBAAiB,GAAG,QAA4B;AAAA,MAA1B;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAA0B;AACrD,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AACC,IAAA,SAAS,EAAI,GAAGA,SAAW,iDAD5B;AAEC,IAAA,KAAK,EAAGD;AAFT,KAIC,4BAAC,oBAAD,OAJD,CADD,CADD;AAUA,CAXD;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,qBAAqB,GAAG;AAAA,MAAE;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,GAAF;AAAA,SAAsC,SAG7D;AAAA,QAH+D;AACrEC,MAAAA,QADqE;AAErEC,MAAAA;AAFqE,KAG/D;;AACN,UAAMC,eAAe,GAAKC,KAAF,IAAa;AACpC,UAAK,CAAEF,MAAF,IAAYE,KAAK,CAACC,OAAN,KAAkBC,cAAnC,EAA0C;AACzCF,QAAAA,KAAK,CAACG,cAAN;AACAN,QAAAA,QAAQ;AACR;AACD,KALD;;AAOA,WACC,4BAAC,wBAAD,QACC,4BAAC,yBAAD;AACC,MAAA,SAAS,EAAC,mEADX;AAEC,MAAA,KAAK,EAAG,cAAI,sBAAJ,CAFT;AAGC,MAAA,OAAO,EAAGA,QAHX;AAIC,MAAA,SAAS,EAAGE,eAJb;AAKC,MAAA,IAAI,EACH,4BAAC,eAAD,QACC,4BAAC,SAAD,QACC,4BAAC,iBAAD,OADD,CADD;AANF,MADD,CADD;AAiBA,GA5B6B;AAAA,CAA9B;;AA8BA,MAAMK,wBAAwB,GAAG,SAA8B;AAAA,MAA5B;AAAEC,IAAAA,QAAF;AAAY,OAAGC;AAAf,GAA4B;AAC9D,2BAAa,yCAAb,EAAuD;AACtDC,IAAAA,WAAW,EAAE,oBADyC;AAEtDC,IAAAA,KAAK,EAAE,KAF+C;AAGtDC,IAAAA,OAAO,EAAE;AAH6C,GAAvD;AAMA,SACC,4BAAC,oBAAD;AACC,IAAA,QAAQ,EAAC,cADV;AAEC,IAAA,SAAS,EAAC,+BAFX;AAGC,IAAA,gBAAgB,EAAC,wCAHlB;AAIC,IAAA,YAAY,EAAGf,qBAAqB,CAAEY,KAAF,CAJrC;AAKC,IAAA,aAAa,EAAG,MAAMD;AALvB,IADD;AASA,CAhBD;;eAkBeD,wB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tToolbarButton,\n\tDropdown,\n\tToolbarGroup,\n\tSVG,\n\tPath,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { DOWN } from '@wordpress/keycodes';\nimport deprecated from '@wordpress/deprecated';\n\nconst ColorSelectorSVGIcon = () => (\n\t<SVG xmlns=\"https://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\">\n\t\t<Path d=\"M7.434 5l3.18 9.16H8.538l-.692-2.184H4.628l-.705 2.184H2L5.18 5h2.254zm-1.13 1.904h-.115l-1.148 3.593H7.44L6.304 6.904zM14.348 7.006c1.853 0 2.9.876 2.9 2.374v4.78h-1.79v-.914h-.114c-.362.64-1.123 1.022-2.031 1.022-1.346 0-2.292-.826-2.292-2.108 0-1.27.972-2.006 2.71-2.107l1.696-.102V9.38c0-.584-.42-.914-1.18-.914-.667 0-1.112.228-1.264.647h-1.701c.12-1.295 1.307-2.107 3.066-2.107zm1.079 4.1l-1.416.09c-.793.056-1.18.342-1.18.844 0 .52.45.837 1.091.837.857 0 1.505-.545 1.505-1.256v-.515z\" />\n\t</SVG>\n);\n\n/**\n * Color Selector Icon component.\n *\n * @param {Object} props Component properties.\n * @param {Object} props.style Style object.\n * @param {string} props.className Class name for component.\n *\n * @return {*} React Icon component.\n */\nconst ColorSelectorIcon = ( { style, className } ) => {\n\treturn (\n\t\t<div className=\"block-library-colors-selector__icon-container\">\n\t\t\t<div\n\t\t\t\tclassName={ `${ className } block-library-colors-selector__state-selection` }\n\t\t\t\tstyle={ style }\n\t\t\t>\n\t\t\t\t<ColorSelectorSVGIcon />\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\n/**\n * Renders the Colors Selector Toolbar with the icon button.\n *\n * @param {Object} props Component properties.\n * @param {Object} props.TextColor Text color component that wraps icon.\n * @param {Object} props.BackgroundColor Background color component that wraps icon.\n *\n * @return {*} React toggle button component.\n */\nconst renderToggleComponent = ( { TextColor, BackgroundColor } ) => ( {\n\tonToggle,\n\tisOpen,\n} ) => {\n\tconst openOnArrowDown = ( event ) => {\n\t\tif ( ! isOpen && event.keyCode === DOWN ) {\n\t\t\tevent.preventDefault();\n\t\t\tonToggle();\n\t\t}\n\t};\n\n\treturn (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName=\"components-toolbar__control block-library-colors-selector__toggle\"\n\t\t\t\tlabel={ __( 'Open Colors Selector' ) }\n\t\t\t\tonClick={ onToggle }\n\t\t\t\tonKeyDown={ openOnArrowDown }\n\t\t\t\ticon={\n\t\t\t\t\t<BackgroundColor>\n\t\t\t\t\t\t<TextColor>\n\t\t\t\t\t\t\t<ColorSelectorIcon />\n\t\t\t\t\t\t</TextColor>\n\t\t\t\t\t</BackgroundColor>\n\t\t\t\t}\n\t\t\t/>\n\t\t</ToolbarGroup>\n\t);\n};\n\nconst BlockColorsStyleSelector = ( { children, ...other } ) => {\n\tdeprecated( `wp.blockEditor.BlockColorsStyleSelector`, {\n\t\talternative: 'block supports API',\n\t\tsince: '6.1',\n\t\tversion: '6.3',\n\t} );\n\n\treturn (\n\t\t<Dropdown\n\t\t\tposition=\"bottom right\"\n\t\t\tclassName=\"block-library-colors-selector\"\n\t\t\tcontentClassName=\"block-library-colors-selector__popover\"\n\t\t\trenderToggle={ renderToggleComponent( other ) }\n\t\t\trenderContent={ () => children }\n\t\t/>\n\t);\n};\n\nexport default BlockColorsStyleSelector;\n"]}
|
|
@@ -30,7 +30,6 @@ var _exportNames = {
|
|
|
30
30
|
BlockVerticalAlignmentToolbar: true,
|
|
31
31
|
BlockVerticalAlignmentControl: true,
|
|
32
32
|
__experimentalBorderRadiusControl: true,
|
|
33
|
-
__experimentalBorderStyleControl: true,
|
|
34
33
|
ButtonBlockerAppender: true,
|
|
35
34
|
ButtonBlockAppender: true,
|
|
36
35
|
ColorPalette: true,
|
|
@@ -544,12 +543,6 @@ Object.defineProperty(exports, "__experimentalBorderRadiusControl", {
|
|
|
544
543
|
return _borderRadiusControl.default;
|
|
545
544
|
}
|
|
546
545
|
});
|
|
547
|
-
Object.defineProperty(exports, "__experimentalBorderStyleControl", {
|
|
548
|
-
enumerable: true,
|
|
549
|
-
get: function () {
|
|
550
|
-
return _borderStyleControl.default;
|
|
551
|
-
}
|
|
552
|
-
});
|
|
553
546
|
Object.defineProperty(exports, "__experimentalColorGradientControl", {
|
|
554
547
|
enumerable: true,
|
|
555
548
|
get: function () {
|
|
@@ -907,8 +900,6 @@ var _blockVerticalAlignmentControl = require("./block-vertical-alignment-control
|
|
|
907
900
|
|
|
908
901
|
var _borderRadiusControl = _interopRequireDefault(require("./border-radius-control"));
|
|
909
902
|
|
|
910
|
-
var _borderStyleControl = _interopRequireDefault(require("./border-style-control"));
|
|
911
|
-
|
|
912
903
|
var _buttonBlockAppender = _interopRequireWildcard(require("./button-block-appender"));
|
|
913
904
|
|
|
914
905
|
var _colorPalette = _interopRequireDefault(require("./color-palette"));
|