@wordpress/block-editor 8.5.4 → 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 +9 -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-content-overlay/index.js +13 -4
- package/build/components/block-content-overlay/index.js.map +1 -1
- package/build/components/block-list/block.native.js +3 -1
- package/build/components/block-list/block.native.js.map +1 -1
- 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-lock/modal.js +34 -4
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-lock/toolbar.js +2 -1
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-lock/use-block-lock.js +4 -1
- package/build/components/block-lock/use-block-lock.js.map +1 -1
- package/build/components/block-mover/button.js +4 -4
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +39 -65
- package/build/components/block-mover/index.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/inbetween.js +183 -0
- package/build/components/block-popover/inbetween.js.map +1 -0
- package/build/components/block-popover/index.js +97 -0
- package/build/components/block-popover/index.js.map +1 -0
- package/build/components/{block-tools → block-popover}/use-popover-scroll.js +4 -1
- package/build/components/block-popover/use-popover-scroll.js.map +1 -0
- package/build/components/block-styles/index.js +1 -10
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-tools/back-compat.js +2 -2
- package/build/components/block-tools/back-compat.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +4 -2
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js +5 -5
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +14 -121
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/{block-popover.js → selected-block-popover.js} +25 -108
- package/build/components/block-tools/selected-block-popover.js.map +1 -0
- package/build/components/color-style-selector/index.js +9 -0
- package/build/components/color-style-selector/index.js.map +1 -1
- package/build/components/duotone-control/index.js +5 -1
- package/build/components/duotone-control/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.native.js +30 -8
- package/build/components/inserter/index.native.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/rich-text/index.js +0 -5
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +0 -4
- package/build/components/rich-text/index.native.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-block-display-information/index.js +3 -1
- package/build/components/use-block-display-information/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/hooks/border.js +468 -44
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/dimensions.js +2 -2
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/index.js +3 -1
- 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/hooks/use-border-props.js +22 -32
- package/build/hooks/use-border-props.js.map +1 -1
- package/build/store/actions.js +14 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +0 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +0 -26
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +47 -15
- 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-content-overlay/index.js +13 -4
- package/build-module/components/block-content-overlay/index.js.map +1 -1
- package/build-module/components/block-list/block.native.js +3 -1
- package/build-module/components/block-list/block.native.js.map +1 -1
- 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-lock/modal.js +34 -5
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +2 -1
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-lock/use-block-lock.js +4 -1
- package/build-module/components/block-lock/use-block-lock.js.map +1 -1
- package/build-module/components/block-mover/button.js +5 -5
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +38 -63
- package/build-module/components/block-mover/index.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/inbetween.js +165 -0
- package/build-module/components/block-popover/inbetween.js.map +1 -0
- package/build-module/components/block-popover/index.js +83 -0
- package/build-module/components/block-popover/index.js.map +1 -0
- package/build-module/components/{block-tools → block-popover}/use-popover-scroll.js +3 -1
- package/build-module/components/block-popover/use-popover-scroll.js.map +1 -0
- package/build-module/components/block-styles/index.js +1 -9
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-tools/back-compat.js +1 -1
- package/build-module/components/block-tools/back-compat.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +3 -2
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js +3 -3
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +16 -121
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/{block-popover.js → selected-block-popover.js} +25 -105
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -0
- 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/duotone-control/index.js +4 -1
- package/build-module/components/duotone-control/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.native.js +31 -10
- package/build-module/components/inserter/index.native.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/rich-text/index.js +0 -4
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +0 -4
- package/build-module/components/rich-text/index.native.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-block-display-information/index.js +3 -1
- package/build-module/components/use-block-display-information/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/hooks/border.js +458 -44
- package/build-module/hooks/border.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 +2 -1
- 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/hooks/use-border-props.js +21 -30
- package/build-module/hooks/use-border-props.js.map +1 -1
- package/build-module/store/actions.js +14 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +0 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +0 -24
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +44 -15
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +128 -276
- package/build-style/style.css +128 -276
- 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/index.js +19 -2
- package/src/components/block-list/block.native.js +2 -0
- 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-lock/modal.js +42 -3
- package/src/components/block-lock/toolbar.js +2 -2
- package/src/components/block-lock/use-block-lock.js +4 -1
- package/src/components/block-mover/button.js +5 -7
- package/src/components/block-mover/index.js +37 -60
- package/src/components/block-mover/stories/index.js +110 -0
- package/src/components/block-mover/style.scss +48 -138
- package/src/components/block-navigation/dropdown.js +12 -8
- package/src/components/block-popover/README.md +41 -0
- package/src/components/block-popover/inbetween.js +180 -0
- package/src/components/block-popover/index.js +90 -0
- package/src/components/block-popover/style.scss +27 -0
- package/src/components/{block-tools → block-popover}/use-popover-scroll.js +3 -1
- package/src/components/block-styles/index.js +1 -12
- package/src/components/block-switcher/style.scss +0 -4
- package/src/components/block-toolbar/style.scss +0 -12
- package/src/components/block-tools/back-compat.js +1 -1
- package/src/components/block-tools/block-selection-button.js +3 -1
- package/src/components/block-tools/index.js +6 -4
- package/src/components/block-tools/insertion-point.js +19 -152
- package/src/components/block-tools/{block-popover.js → selected-block-popover.js} +24 -116
- package/src/components/block-tools/style.scss +11 -123
- package/src/components/border-radius-control/style.scss +5 -2
- 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/default-block-appender/style.scss +1 -2
- package/src/components/duotone-control/index.js +8 -1
- package/src/components/gradients/README.md +29 -0
- package/src/components/image-size-control/README.md +1 -1
- package/src/components/index.js +0 -1
- package/src/components/inserter/index.native.js +60 -25
- package/src/components/inserter/style.native.scss +25 -3
- 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/navigable-toolbar/README.md +16 -0
- package/src/components/rich-text/index.js +0 -2
- package/src/components/rich-text/index.native.js +0 -4
- package/src/components/url-input/index.js +6 -3
- package/src/components/use-block-display-information/index.js +2 -0
- package/src/components/use-setting/index.js +57 -21
- package/src/hooks/border.js +438 -72
- package/src/hooks/border.scss +48 -0
- package/src/hooks/dimensions.js +44 -38
- package/src/hooks/index.js +2 -1
- 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/hooks/use-border-props.js +15 -32
- package/src/store/actions.js +14 -2
- package/src/store/defaults.js +0 -1
- package/src/store/reducer.js +0 -21
- package/src/store/selectors.js +46 -15
- package/src/store/test/actions.js +0 -18
- package/src/store/test/reducer.js +0 -19
- package/src/store/test/selectors.js +17 -19
- package/src/style.scss +2 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-mobile-toolbar/index.js +0 -42
- package/build/components/block-mobile-toolbar/index.js.map +0 -1
- package/build/components/block-tools/block-popover.js.map +0 -1
- package/build/components/block-tools/use-popover-scroll.js.map +0 -1
- package/build/components/border-style-control/index.js +0 -60
- package/build/components/border-style-control/index.js.map +0 -1
- package/build/components/list-view/appender.js +0 -93
- package/build/components/list-view/appender.js.map +0 -1
- package/build/components/list-view/list-item.js +0 -62
- package/build/components/list-view/list-item.js.map +0 -1
- package/build/components/rich-text/use-caret-in-format.js +0 -43
- package/build/components/rich-text/use-caret-in-format.js.map +0 -1
- package/build/hooks/border-color.js +0 -302
- package/build/hooks/border-color.js.map +0 -1
- package/build/hooks/border-style.js +0 -96
- package/build/hooks/border-style.js.map +0 -1
- package/build/hooks/border-width.js +0 -162
- package/build/hooks/border-width.js.map +0 -1
- package/build-module/components/block-mobile-toolbar/index.js +0 -31
- package/build-module/components/block-mobile-toolbar/index.js.map +0 -1
- package/build-module/components/block-tools/block-popover.js.map +0 -1
- package/build-module/components/block-tools/use-popover-scroll.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/build-module/components/list-view/appender.js +0 -76
- package/build-module/components/list-view/appender.js.map +0 -1
- package/build-module/components/list-view/list-item.js +0 -47
- package/build-module/components/list-view/list-item.js.map +0 -1
- package/build-module/components/rich-text/use-caret-in-format.js +0 -33
- package/build-module/components/rich-text/use-caret-in-format.js.map +0 -1
- package/build-module/hooks/border-color.js +0 -276
- package/build-module/hooks/border-color.js.map +0 -1
- package/build-module/hooks/border-style.js +0 -78
- package/build-module/hooks/border-style.js.map +0 -1
- package/build-module/hooks/border-width.js +0 -143
- package/build-module/hooks/border-width.js.map +0 -1
- package/src/components/block-mobile-toolbar/index.js +0 -24
- package/src/components/block-mobile-toolbar/style.scss +0 -29
- package/src/components/border-style-control/index.js +0 -47
- package/src/components/border-style-control/style.scss +0 -18
- package/src/components/list-view/appender.js +0 -82
- package/src/components/list-view/list-item.js +0 -59
- package/src/components/rich-text/use-caret-in-format.js +0 -28
- package/src/hooks/border-color.js +0 -315
- package/src/hooks/border-style.js +0 -64
- package/src/hooks/border-width.js +0 -139
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.BorderWidthEdit = void 0;
|
|
9
|
-
exports.hasBorderWidthValue = hasBorderWidthValue;
|
|
10
|
-
exports.resetBorderWidth = resetBorderWidth;
|
|
11
|
-
|
|
12
|
-
var _element = require("@wordpress/element");
|
|
13
|
-
|
|
14
|
-
var _components = require("@wordpress/components");
|
|
15
|
-
|
|
16
|
-
var _i18n = require("@wordpress/i18n");
|
|
17
|
-
|
|
18
|
-
var _utils = require("./utils");
|
|
19
|
-
|
|
20
|
-
var _border = require("./border");
|
|
21
|
-
|
|
22
|
-
var _useSetting = _interopRequireDefault(require("../components/use-setting"));
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* WordPress dependencies
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Internal dependencies
|
|
30
|
-
*/
|
|
31
|
-
const MIN_BORDER_WIDTH = 0;
|
|
32
|
-
/**
|
|
33
|
-
* Inspector control for configuring border width property.
|
|
34
|
-
*
|
|
35
|
-
* @param {Object} props Block properties.
|
|
36
|
-
*
|
|
37
|
-
* @return {WPElement} Border width edit element.
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
const BorderWidthEdit = props => {
|
|
41
|
-
const {
|
|
42
|
-
attributes: {
|
|
43
|
-
borderColor,
|
|
44
|
-
style
|
|
45
|
-
},
|
|
46
|
-
setAttributes
|
|
47
|
-
} = props;
|
|
48
|
-
const {
|
|
49
|
-
width,
|
|
50
|
-
color: customBorderColor,
|
|
51
|
-
style: borderStyle
|
|
52
|
-
} = (style === null || style === void 0 ? void 0 : style.border) || {}; // Used to temporarily track previous border color & style selections to be
|
|
53
|
-
// able to restore them when border width changes from zero value.
|
|
54
|
-
|
|
55
|
-
const [styleSelection, setStyleSelection] = (0, _element.useState)();
|
|
56
|
-
const [colorSelection, setColorSelection] = (0, _element.useState)();
|
|
57
|
-
const [customColorSelection, setCustomColorSelection] = (0, _element.useState)();
|
|
58
|
-
|
|
59
|
-
const onChange = newWidth => {
|
|
60
|
-
let newStyle = { ...style,
|
|
61
|
-
border: { ...(style === null || style === void 0 ? void 0 : style.border),
|
|
62
|
-
width: newWidth
|
|
63
|
-
}
|
|
64
|
-
}; // Used to clear named border color attribute.
|
|
65
|
-
|
|
66
|
-
let borderPaletteColor = borderColor;
|
|
67
|
-
const hasZeroWidth = parseFloat(newWidth) === 0;
|
|
68
|
-
const hadPreviousZeroWidth = parseFloat(width) === 0; // Setting the border width explicitly to zero will also set the
|
|
69
|
-
// border style to `none` and clear border color attributes.
|
|
70
|
-
|
|
71
|
-
if (hasZeroWidth && !hadPreviousZeroWidth) {
|
|
72
|
-
// Before clearing color and style selections, keep track of
|
|
73
|
-
// the current selections so they can be restored when the width
|
|
74
|
-
// changes to a non-zero value.
|
|
75
|
-
setColorSelection(borderColor);
|
|
76
|
-
setCustomColorSelection(customBorderColor);
|
|
77
|
-
setStyleSelection(borderStyle); // Clear style and color attributes.
|
|
78
|
-
|
|
79
|
-
borderPaletteColor = undefined;
|
|
80
|
-
newStyle.border.color = undefined;
|
|
81
|
-
newStyle.border.style = 'none';
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (!hasZeroWidth && hadPreviousZeroWidth) {
|
|
85
|
-
// Restore previous border style selection if width is now not zero and
|
|
86
|
-
// border style was 'none'. This is to support changes to the UI which
|
|
87
|
-
// change the border style UI to a segmented control without a "none"
|
|
88
|
-
// option.
|
|
89
|
-
if (borderStyle === 'none') {
|
|
90
|
-
newStyle.border.style = styleSelection;
|
|
91
|
-
} // Restore previous border color selection if width is no longer zero
|
|
92
|
-
// and current border color is undefined.
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (borderColor === undefined) {
|
|
96
|
-
borderPaletteColor = colorSelection;
|
|
97
|
-
newStyle.border.color = customColorSelection;
|
|
98
|
-
}
|
|
99
|
-
} // If width was reset, clean out undefined styles.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (newWidth === undefined || newWidth === '') {
|
|
103
|
-
newStyle = (0, _utils.cleanEmptyObject)(newStyle);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
setAttributes({
|
|
107
|
-
borderColor: borderPaletteColor,
|
|
108
|
-
style: newStyle
|
|
109
|
-
});
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
const units = (0, _components.__experimentalUseCustomUnits)({
|
|
113
|
-
availableUnits: (0, _useSetting.default)('spacing.units') || ['px', 'em', 'rem']
|
|
114
|
-
});
|
|
115
|
-
return (0, _element.createElement)(_components.__experimentalUnitControl, {
|
|
116
|
-
value: width,
|
|
117
|
-
label: (0, _i18n.__)('Width'),
|
|
118
|
-
min: MIN_BORDER_WIDTH,
|
|
119
|
-
onChange: onChange,
|
|
120
|
-
units: units
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
/**
|
|
124
|
-
* Checks if there is a current value in the border width block support
|
|
125
|
-
* attributes.
|
|
126
|
-
*
|
|
127
|
-
* @param {Object} props Block props.
|
|
128
|
-
* @return {boolean} Whether or not the block has a border width value set.
|
|
129
|
-
*/
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
exports.BorderWidthEdit = BorderWidthEdit;
|
|
133
|
-
|
|
134
|
-
function hasBorderWidthValue(props) {
|
|
135
|
-
var _props$attributes$sty, _props$attributes$sty2;
|
|
136
|
-
|
|
137
|
-
return !!((_props$attributes$sty = props.attributes.style) !== null && _props$attributes$sty !== void 0 && (_props$attributes$sty2 = _props$attributes$sty.border) !== null && _props$attributes$sty2 !== void 0 && _props$attributes$sty2.width);
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Resets the border width block support attribute. This can be used when
|
|
141
|
-
* disabling the border width support control for a block via a progressive
|
|
142
|
-
* discovery panel.
|
|
143
|
-
*
|
|
144
|
-
* @param {Object} props Block props.
|
|
145
|
-
* @param {Object} props.attributes Block's attributes.
|
|
146
|
-
* @param {Object} props.setAttributes Function to set block's attributes.
|
|
147
|
-
*/
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
function resetBorderWidth(_ref) {
|
|
151
|
-
let {
|
|
152
|
-
attributes = {},
|
|
153
|
-
setAttributes
|
|
154
|
-
} = _ref;
|
|
155
|
-
const {
|
|
156
|
-
style
|
|
157
|
-
} = attributes;
|
|
158
|
-
setAttributes({
|
|
159
|
-
style: (0, _border.removeBorderAttribute)(style, 'width')
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
//# sourceMappingURL=border-width.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/border-width.js"],"names":["MIN_BORDER_WIDTH","BorderWidthEdit","props","attributes","borderColor","style","setAttributes","width","color","customBorderColor","borderStyle","border","styleSelection","setStyleSelection","colorSelection","setColorSelection","customColorSelection","setCustomColorSelection","onChange","newWidth","newStyle","borderPaletteColor","hasZeroWidth","parseFloat","hadPreviousZeroWidth","undefined","units","availableUnits","hasBorderWidthValue","resetBorderWidth"],"mappings":";;;;;;;;;;;AAOA;;AAJA;;AAKA;;AAKA;;AACA;;AACA;;AAfA;AACA;AACA;;AAQA;AACA;AACA;AAKA,MAAMA,gBAAgB,GAAG,CAAzB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,MAAMC,eAAe,GAAKC,KAAF,IAAa;AAC3C,QAAM;AACLC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,WAAF;AAAeC,MAAAA;AAAf,KADP;AAELC,IAAAA;AAFK,MAGFJ,KAHJ;AAKA,QAAM;AAAEK,IAAAA,KAAF;AAASC,IAAAA,KAAK,EAAEC,iBAAhB;AAAmCJ,IAAAA,KAAK,EAAEK;AAA1C,MACL,CAAAL,KAAK,SAAL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,IAAAA,KAAK,EAAE,mCAAuBA,KAAvB,EAA8B,OAA9B;AAAT,GAAF,CAAb;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { cleanEmptyObject } from './utils';\nimport { removeBorderAttribute } from './border';\nimport useSetting from '../components/use-setting';\n\nconst MIN_BORDER_WIDTH = 0;\n\n/**\n * Inspector control for configuring border width property.\n *\n * @param {Object} props Block properties.\n *\n * @return {WPElement} Border width edit element.\n */\nexport const BorderWidthEdit = ( props ) => {\n\tconst {\n\t\tattributes: { borderColor, style },\n\t\tsetAttributes,\n\t} = props;\n\n\tconst { width, color: customBorderColor, style: borderStyle } =\n\t\tstyle?.border || {};\n\n\t// Used to temporarily track previous border color & style selections to be\n\t// able to restore them when border width changes from zero value.\n\tconst [ styleSelection, setStyleSelection ] = useState();\n\tconst [ colorSelection, setColorSelection ] = useState();\n\tconst [ customColorSelection, setCustomColorSelection ] = useState();\n\n\tconst onChange = ( newWidth ) => {\n\t\tlet newStyle = {\n\t\t\t...style,\n\t\t\tborder: {\n\t\t\t\t...style?.border,\n\t\t\t\twidth: newWidth,\n\t\t\t},\n\t\t};\n\n\t\t// Used to clear named border color attribute.\n\t\tlet borderPaletteColor = borderColor;\n\n\t\tconst hasZeroWidth = parseFloat( newWidth ) === 0;\n\t\tconst hadPreviousZeroWidth = parseFloat( width ) === 0;\n\n\t\t// Setting the border width explicitly to zero will also set the\n\t\t// border style to `none` and clear border color attributes.\n\t\tif ( hasZeroWidth && ! hadPreviousZeroWidth ) {\n\t\t\t// Before clearing color and style selections, keep track of\n\t\t\t// the current selections so they can be restored when the width\n\t\t\t// changes to a non-zero value.\n\t\t\tsetColorSelection( borderColor );\n\t\t\tsetCustomColorSelection( customBorderColor );\n\t\t\tsetStyleSelection( borderStyle );\n\n\t\t\t// Clear style and color attributes.\n\t\t\tborderPaletteColor = undefined;\n\t\t\tnewStyle.border.color = undefined;\n\t\t\tnewStyle.border.style = 'none';\n\t\t}\n\n\t\tif ( ! hasZeroWidth && hadPreviousZeroWidth ) {\n\t\t\t// Restore previous border style selection if width is now not zero and\n\t\t\t// border style was 'none'. This is to support changes to the UI which\n\t\t\t// change the border style UI to a segmented control without a \"none\"\n\t\t\t// option.\n\t\t\tif ( borderStyle === 'none' ) {\n\t\t\t\tnewStyle.border.style = styleSelection;\n\t\t\t}\n\n\t\t\t// Restore previous border color selection if width is no longer zero\n\t\t\t// and current border color is undefined.\n\t\t\tif ( borderColor === undefined ) {\n\t\t\t\tborderPaletteColor = colorSelection;\n\t\t\t\tnewStyle.border.color = customColorSelection;\n\t\t\t}\n\t\t}\n\n\t\t// If width was reset, clean out undefined styles.\n\t\tif ( newWidth === undefined || newWidth === '' ) {\n\t\t\tnewStyle = cleanEmptyObject( newStyle );\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\tborderColor: borderPaletteColor,\n\t\t\tstyle: newStyle,\n\t\t} );\n\t};\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [ 'px', 'em', 'rem' ],\n\t} );\n\n\treturn (\n\t\t<UnitControl\n\t\t\tvalue={ width }\n\t\t\tlabel={ __( 'Width' ) }\n\t\t\tmin={ MIN_BORDER_WIDTH }\n\t\t\tonChange={ onChange }\n\t\t\tunits={ units }\n\t\t/>\n\t);\n};\n\n/**\n * Checks if there is a current value in the border width block support\n * attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a border width value set.\n */\nexport function hasBorderWidthValue( props ) {\n\treturn !! props.attributes.style?.border?.width;\n}\n\n/**\n * Resets the border width block support attribute. This can be used when\n * disabling the border width support control for a block via a progressive\n * discovery panel.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetBorderWidth( { attributes = {}, setAttributes } ) {\n\tconst { style } = attributes;\n\tsetAttributes( { style: removeBorderAttribute( style, 'width' ) } );\n}\n"]}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* WordPress dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { useViewportMatch } from '@wordpress/compose';
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import BlockMover from '../block-mover';
|
|
12
|
-
|
|
13
|
-
function BlockMobileToolbar(_ref) {
|
|
14
|
-
let {
|
|
15
|
-
clientId
|
|
16
|
-
} = _ref;
|
|
17
|
-
const isMobile = useViewportMatch('small', '<');
|
|
18
|
-
|
|
19
|
-
if (!isMobile) {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return createElement("div", {
|
|
24
|
-
className: "block-editor-block-mobile-toolbar"
|
|
25
|
-
}, createElement(BlockMover, {
|
|
26
|
-
clientIds: [clientId]
|
|
27
|
-
}));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export default BlockMobileToolbar;
|
|
31
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-mobile-toolbar/index.js"],"names":["useViewportMatch","BlockMover","BlockMobileToolbar","clientId","isMobile"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,gBAAT,QAAiC,oBAAjC;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,gBAAvB;;AAEA,SAASC,kBAAT,OAA4C;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AAC3C,QAAMC,QAAQ,GAAGJ,gBAAgB,CAAE,OAAF,EAAW,GAAX,CAAjC;;AACA,MAAK,CAAEI,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,UAAD;AAAY,IAAA,SAAS,EAAG,CAAED,QAAF;AAAxB,IADD,CADD;AAKA;;AAED,eAAeD,kBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockMover from '../block-mover';\n\nfunction BlockMobileToolbar( { clientId } ) {\n\tconst isMobile = useViewportMatch( 'small', '<' );\n\tif ( ! isMobile ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"block-editor-block-mobile-toolbar\">\n\t\t\t<BlockMover clientIds={ [ clientId ] } />\n\t\t</div>\n\t);\n}\n\nexport default BlockMobileToolbar;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/block-popover.js"],"names":["find","classnames","useState","useRef","useEffect","isUnmodifiedDefaultBlock","Popover","useDispatch","useSelect","useShortcut","useViewportMatch","getScrollContainer","BlockSelectionButton","BlockContextualToolbar","Inserter","store","blockEditorStore","__unstableUseBlockElement","useBlockElement","usePopoverScroll","selector","select","isNavigationMode","isMultiSelecting","hasMultiSelection","isTyping","isCaretWithinFormattedText","getSettings","getLastMultiSelectedBlockClientId","hasFixedToolbar","lastClientId","BlockPopover","clientId","rootClientId","isValid","isEmptyDefaultBlock","capturingClientId","__unstablePopoverSlot","__unstableContentRef","isInsertionPointVisible","isBlockInsertionPointVisible","getBlockInsertionPoint","getBlockOrder","insertionPoint","order","index","isLargeViewport","isToolbarForced","setIsToolbarForced","isInserterShown","setIsInserterShown","stopTyping","showEmptyBlockSideInserter","shouldShowBreadcrumb","shouldShowContextualToolbar","canFocusHiddenToolbar","isDisabled","initialToolbarItemIndexRef","selectedElement","lastSelectedElement","capturingElement","popoverScrollRef","node","anchorRef","top","bottom","onFocus","onBlur","popoverPosition","ownerDocument","stickyBoundaryElement","undefined","defaultView","frameElement","body","current","wrapperSelector","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getBlockRootClientId","getBlock","getBlockParents","__experimentalGetBlockListSettingsForBlocks","name","attributes","blockParentsClientIds","parentBlockListSettings","parentClientId","__experimentalCaptureToolbars","WrappedBlockPopover","selected"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,QAAT,EAAmBC,MAAnB,EAA2BC,SAA3B,QAA4C,oBAA5C;AACA,SAASC,wBAAT,QAAyC,mBAAzC;AACA,SAASC,OAAT,QAAwB,uBAAxB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,WAAT,QAA4B,+BAA5B;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,kBAAT,QAAmC,gBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,0BAAjC;AACA,OAAOC,sBAAP,MAAmC,4BAAnC;AACA,OAAOC,QAAP,MAAqB,aAArB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AACA,SAASC,yBAAyB,IAAIC,eAAtC,QAA6D,8CAA7D;AACA,SAASC,gBAAT,QAAiC,sBAAjC;;AAEA,SAASC,QAAT,CAAmBC,MAAnB,EAA4B;AAC3B,QAAM;AACLC,IAAAA,gBADK;AAELC,IAAAA,gBAFK;AAGLC,IAAAA,iBAHK;AAILC,IAAAA,QAJK;AAKLC,IAAAA,0BALK;AAMLC,IAAAA,WANK;AAOLC,IAAAA;AAPK,MAQFP,MAAM,CAAEL,gBAAF,CARV;AASA,SAAO;AACNM,IAAAA,gBAAgB,EAAEA,gBAAgB,EAD5B;AAENC,IAAAA,gBAAgB,EAAEA,gBAAgB,EAF5B;AAGNE,IAAAA,QAAQ,EAAEA,QAAQ,EAHZ;AAINC,IAAAA,0BAA0B,EAAEA,0BAA0B,EAJhD;AAKNF,IAAAA,iB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,CAAEoE,eAAF,EAAmB,EAAnB,CAA1B;;AAEA,MAAK,CAAEc,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,QAAM;AACL1D,IAAAA,QADK;AAELC,IAAAA,YAFK;AAGLkD,IAAAA,IAHK;AAILjD,IAAAA,OAJK;AAKLC,IAAAA,mBALK;AAMLC,IAAAA;AANK,MAOFsD,QAPJ;;AASA,MAAK,CAAEP,IAAP,EAAc;AACb,WAAO,IAAP;AACA;;AAED,SACC,cAAC,YAAD;AACC,IAAA,QAAQ,EAAGnD,QADZ;AAEC,IAAA,YAAY,EAAGC,YAFhB;AAGC,IAAA,OAAO,EAAGC,OAHX;AAIC,IAAA,mBAAmB,EAAGC,mBAJvB;AAKC,IAAA,iBAAiB,EAAGC,iBALrB;AAMC,IAAA,qBAAqB,EAAGC,qBANzB;AAOC,IAAA,oBAAoB,EAAGC;AAPxB,IADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport { find } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef, useEffect } from '@wordpress/element';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\nimport { Popover } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { getScrollContainer } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport BlockSelectionButton from './block-selection-button';\nimport BlockContextualToolbar from './block-contextual-toolbar';\nimport Inserter from '../inserter';\nimport { store as blockEditorStore } from '../../store';\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport { usePopoverScroll } from './use-popover-scroll';\n\nfunction selector( select ) {\n\tconst {\n\t\tisNavigationMode,\n\t\tisMultiSelecting,\n\t\thasMultiSelection,\n\t\tisTyping,\n\t\tisCaretWithinFormattedText,\n\t\tgetSettings,\n\t\tgetLastMultiSelectedBlockClientId,\n\t} = select( blockEditorStore );\n\treturn {\n\t\tisNavigationMode: isNavigationMode(),\n\t\tisMultiSelecting: isMultiSelecting(),\n\t\tisTyping: isTyping(),\n\t\tisCaretWithinFormattedText: isCaretWithinFormattedText(),\n\t\thasMultiSelection: hasMultiSelection(),\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tlastClientId: getLastMultiSelectedBlockClientId(),\n\t};\n}\n\nfunction BlockPopover( {\n\tclientId,\n\trootClientId,\n\tisValid,\n\tisEmptyDefaultBlock,\n\tcapturingClientId,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst {\n\t\tisNavigationMode,\n\t\tisMultiSelecting,\n\t\tisTyping,\n\t\tisCaretWithinFormattedText,\n\t\thasMultiSelection,\n\t\thasFixedToolbar,\n\t\tlastClientId,\n\t} = useSelect( selector, [] );\n\tconst isInsertionPointVisible = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tgetBlockOrder,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tif ( ! isBlockInsertionPointVisible() ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\t\t\treturn order[ insertionPoint.index ] === clientId;\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst [ isToolbarForced, setIsToolbarForced ] = useState( false );\n\tconst [ isInserterShown, setIsInserterShown ] = useState( false );\n\tconst { stopTyping } = useDispatch( blockEditorStore );\n\n\t// Controls when the side inserter on empty lines should\n\t// be shown, including writing and selection modes.\n\tconst showEmptyBlockSideInserter =\n\t\t! isTyping && ! isNavigationMode && isEmptyDefaultBlock && isValid;\n\tconst shouldShowBreadcrumb = isNavigationMode;\n\tconst shouldShowContextualToolbar =\n\t\t! isNavigationMode &&\n\t\t! hasFixedToolbar &&\n\t\tisLargeViewport &&\n\t\t! showEmptyBlockSideInserter &&\n\t\t! isMultiSelecting &&\n\t\t( ! isTyping || isCaretWithinFormattedText );\n\tconst canFocusHiddenToolbar =\n\t\t! isNavigationMode &&\n\t\t! shouldShowContextualToolbar &&\n\t\t! hasFixedToolbar &&\n\t\t! isEmptyDefaultBlock;\n\n\tuseShortcut(\n\t\t'core/block-editor/focus-toolbar',\n\t\t() => {\n\t\t\tsetIsToolbarForced( true );\n\t\t\tstopTyping( true );\n\t\t},\n\t\t{\n\t\t\tisDisabled: ! canFocusHiddenToolbar,\n\t\t}\n\t);\n\n\tuseEffect( () => {\n\t\tif ( ! shouldShowContextualToolbar ) {\n\t\t\tsetIsToolbarForced( false );\n\t\t}\n\t}, [ shouldShowContextualToolbar ] );\n\n\t// Stores the active toolbar item index so the block toolbar can return focus\n\t// to it when re-mounting.\n\tconst initialToolbarItemIndexRef = useRef();\n\n\tconst selectedElement = useBlockElement( clientId );\n\tconst lastSelectedElement = useBlockElement( lastClientId );\n\tconst capturingElement = useBlockElement( capturingClientId );\n\n\tconst popoverScrollRef = usePopoverScroll( __unstableContentRef );\n\n\tif (\n\t\t! shouldShowBreadcrumb &&\n\t\t! shouldShowContextualToolbar &&\n\t\t! isToolbarForced &&\n\t\t! showEmptyBlockSideInserter\n\t) {\n\t\treturn null;\n\t}\n\n\tlet node = selectedElement;\n\n\tif ( ! node ) {\n\t\treturn null;\n\t}\n\n\tif ( capturingClientId ) {\n\t\tnode = capturingElement;\n\t}\n\n\tlet anchorRef = node;\n\n\tif ( hasMultiSelection ) {\n\t\t// Wait to render the popover until the bottom reference is available\n\t\t// as well.\n\t\tif ( ! lastSelectedElement ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tanchorRef = {\n\t\t\ttop: node,\n\t\t\tbottom: lastSelectedElement,\n\t\t};\n\t}\n\n\tfunction onFocus() {\n\t\tsetIsInserterShown( true );\n\t}\n\n\tfunction onBlur() {\n\t\tsetIsInserterShown( false );\n\t}\n\n\t// Position above the anchor, pop out towards the right, and position in the\n\t// left corner. For the side inserter, pop out towards the left, and\n\t// position in the right corner.\n\t// To do: refactor `Popover` to make this prop clearer.\n\tconst popoverPosition = showEmptyBlockSideInserter\n\t\t? 'top left right'\n\t\t: 'top right left';\n\tconst { ownerDocument } = node;\n\tconst stickyBoundaryElement = showEmptyBlockSideInserter\n\t\t? undefined\n\t\t: // The sticky boundary element should be the boundary at which the\n\t\t // the block toolbar becomes sticky when the block scolls out of view.\n\t\t // In case of an iframe, this should be the iframe boundary, otherwise\n\t\t // the scroll container.\n\t\t ownerDocument.defaultView.frameElement ||\n\t\t getScrollContainer( node ) ||\n\t\t ownerDocument.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={ popoverPosition }\n\t\t\tfocusOnMount={ false }\n\t\t\tanchorRef={ anchorRef }\n\t\t\tclassName={ classnames( 'block-editor-block-list__block-popover', {\n\t\t\t\t'is-insertion-point-visible': isInsertionPointVisible,\n\t\t\t} ) }\n\t\t\t__unstableStickyBoundaryElement={ stickyBoundaryElement }\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={ node }\n\t\t\tshouldAnchorIncludePadding\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>\n\t\t\t{ ( shouldShowContextualToolbar || isToolbarForced ) && (\n\t\t\t\t<div\n\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\tonBlur={ onBlur }\n\t\t\t\t\t// While ideally it would be enough to capture the\n\t\t\t\t\t// bubbling focus event from the Inserter, due to the\n\t\t\t\t\t// characteristics of click focusing of `button`s in\n\t\t\t\t\t// Firefox and Safari, it is not reliable.\n\t\t\t\t\t//\n\t\t\t\t\t// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'block-editor-block-list__block-popover-inserter',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-visible': isInserterShown,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t<Inserter\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ ( shouldShowContextualToolbar || isToolbarForced ) && (\n\t\t\t\t<BlockContextualToolbar\n\t\t\t\t\t// If the toolbar is being shown because of being forced\n\t\t\t\t\t// it should focus the toolbar right after the mount.\n\t\t\t\t\tfocusOnMount={ isToolbarForced }\n\t\t\t\t\t__experimentalInitialIndex={\n\t\t\t\t\t\tinitialToolbarItemIndexRef.current\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalOnIndexChange={ ( index ) => {\n\t\t\t\t\t\tinitialToolbarItemIndexRef.current = index;\n\t\t\t\t\t} }\n\t\t\t\t\t// Resets the index whenever the active block changes so\n\t\t\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\t\t\tkey={ clientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ shouldShowBreadcrumb && (\n\t\t\t\t<BlockSelectionButton\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\tblockElement={ node }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showEmptyBlockSideInserter && (\n\t\t\t\t<div className=\"block-editor-block-list__empty-block-inserter\">\n\t\t\t\t\t<Inserter\n\t\t\t\t\t\tposition=\"bottom right\"\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</Popover>\n\t);\n}\n\nfunction wrapperSelector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetBlockRootClientId,\n\t\tgetBlock,\n\t\tgetBlockParents,\n\t\t__experimentalGetBlockListSettingsForBlocks,\n\t} = select( blockEditorStore );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\tif ( ! clientId ) {\n\t\treturn;\n\t}\n\n\tconst { name, attributes = {}, isValid } = getBlock( clientId ) || {};\n\tconst blockParentsClientIds = getBlockParents( clientId );\n\n\t// Get Block List Settings for all ancestors of the current Block clientId.\n\tconst parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(\n\t\tblockParentsClientIds\n\t);\n\n\t// Get the clientId of the topmost parent with the capture toolbars setting.\n\tconst capturingClientId = find(\n\t\tblockParentsClientIds,\n\t\t( parentClientId ) =>\n\t\t\tparentBlockListSettings[ parentClientId ]\n\t\t\t\t?.__experimentalCaptureToolbars\n\t);\n\n\treturn {\n\t\tclientId,\n\t\trootClientId: getBlockRootClientId( clientId ),\n\t\tname,\n\t\tisValid,\n\t\tisEmptyDefaultBlock:\n\t\t\tname && isUnmodifiedDefaultBlock( { name, attributes } ),\n\t\tcapturingClientId,\n\t};\n}\n\nexport default function WrappedBlockPopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst selected = useSelect( wrapperSelector, [] );\n\n\tif ( ! selected ) {\n\t\treturn null;\n\t}\n\n\tconst {\n\t\tclientId,\n\t\trootClientId,\n\t\tname,\n\t\tisValid,\n\t\tisEmptyDefaultBlock,\n\t\tcapturingClientId,\n\t} = selected;\n\n\tif ( ! name ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPopover\n\t\t\tclientId={ clientId }\n\t\t\trootClientId={ rootClientId }\n\t\t\tisValid={ isValid }\n\t\t\tisEmptyDefaultBlock={ isEmptyDefaultBlock }\n\t\t\tcapturingClientId={ capturingClientId }\n\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/use-popover-scroll.js"],"names":["useRefEffect","usePopoverScroll","scrollableRef","node","onWheel","event","deltaX","deltaY","current","scrollBy","options","passive","addEventListener","removeEventListener"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAT,QAA6B,oBAA7B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,gBAAT,CAA2BC,aAA3B,EAA2C;AACjD,SAAOF,YAAY,CAChBG,IAAF,IAAY;AACX,QAAK,CAAED,aAAP,EAAuB;AACtB;AACA;;AAED,aAASE,OAAT,CAAkBC,KAAlB,EAA0B;AACzB,YAAM;AAAEC,QAAAA,MAAF;AAAUC,QAAAA;AAAV,UAAqBF,KAA3B;AACAH,MAAAA,aAAa,CAACM,OAAd,CAAsBC,QAAtB,CAAgCH,MAAhC,EAAwCC,MAAxC;AACA,KARU,CASX;AACA;;;AACA,UAAMG,OAAO,GAAG;AAAEC,MAAAA,OAAO,EAAE;AAAX,KAAhB;AACAR,IAAAA,IAAI,CAACS,gBAAL,CAAuB,OAAvB,EAAgCR,OAAhC,EAAyCM,OAAzC;AACA,WAAO,MAAM;AACZP,MAAAA,IAAI,CAACU,mBAAL,CAA0B,OAA1B,EAAmCT,OAAnC,EAA4CM,OAA5C;AACA,KAFD;AAGA,GAjBiB,EAkBlB,CAAER,aAAF,CAlBkB,CAAnB;AAoBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Allow scrolling \"through\" popovers over the canvas. This is only called for\n * as long as the pointer is over a popover. Do not use React events because it\n * will bubble through portals.\n *\n * @param {Object} scrollableRef\n */\nexport function usePopoverScroll( scrollableRef ) {\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tif ( ! scrollableRef ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfunction onWheel( event ) {\n\t\t\t\tconst { deltaX, deltaY } = event;\n\t\t\t\tscrollableRef.current.scrollBy( deltaX, deltaY );\n\t\t\t}\n\t\t\t// Tell the browser that we do not call event.preventDefault\n\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners\n\t\t\tconst options = { passive: true };\n\t\t\tnode.addEventListener( 'wheel', onWheel, options );\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'wheel', onWheel, options );\n\t\t\t};\n\t\t},\n\t\t[ scrollableRef ]\n\t);\n}\n"]}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* WordPress dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { Button } from '@wordpress/components';
|
|
7
|
-
import { __ } from '@wordpress/i18n';
|
|
8
|
-
import { lineDashed, lineDotted, lineSolid } from '@wordpress/icons';
|
|
9
|
-
const BORDER_STYLES = [{
|
|
10
|
-
label: __('Solid'),
|
|
11
|
-
icon: lineSolid,
|
|
12
|
-
value: 'solid'
|
|
13
|
-
}, {
|
|
14
|
-
label: __('Dashed'),
|
|
15
|
-
icon: lineDashed,
|
|
16
|
-
value: 'dashed'
|
|
17
|
-
}, {
|
|
18
|
-
label: __('Dotted'),
|
|
19
|
-
icon: lineDotted,
|
|
20
|
-
value: 'dotted'
|
|
21
|
-
}];
|
|
22
|
-
/**
|
|
23
|
-
* Control to display border style options.
|
|
24
|
-
*
|
|
25
|
-
* @param {Object} props Component props.
|
|
26
|
-
* @param {Function} props.onChange Handler for changing border style selection.
|
|
27
|
-
* @param {string} props.value Currently selected border style value.
|
|
28
|
-
*
|
|
29
|
-
* @return {WPElement} Custom border style segmented control.
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
export default function BorderStyleControl(_ref) {
|
|
33
|
-
let {
|
|
34
|
-
onChange,
|
|
35
|
-
value
|
|
36
|
-
} = _ref;
|
|
37
|
-
return createElement("fieldset", {
|
|
38
|
-
className: "components-border-style-control"
|
|
39
|
-
}, createElement("legend", null, __('Style')), createElement("div", {
|
|
40
|
-
className: "components-border-style-control__buttons"
|
|
41
|
-
}, BORDER_STYLES.map(borderStyle => createElement(Button, {
|
|
42
|
-
key: borderStyle.value,
|
|
43
|
-
icon: borderStyle.icon,
|
|
44
|
-
isSmall: true,
|
|
45
|
-
isPressed: borderStyle.value === value,
|
|
46
|
-
onClick: () => onChange(borderStyle.value === value ? undefined : borderStyle.value),
|
|
47
|
-
"aria-label": borderStyle.label
|
|
48
|
-
}))));
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/border-style-control/index.js"],"names":["Button","__","lineDashed","lineDotted","lineSolid","BORDER_STYLES","label","icon","value","BorderStyleControl","onChange","map","borderStyle","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,EAAqBC,UAArB,EAAiCC,SAAjC,QAAkD,kBAAlD;AAEA,MAAMC,aAAa,GAAG,CACrB;AAAEC,EAAAA,KAAK,EAAEL,EAAE,CAAE,OAAF,CAAX;AAAwBM,EAAAA,IAAI,EAAEH,SAA9B;AAAyCI,EAAAA,KAAK,EAAE;AAAhD,CADqB,EAErB;AAAEF,EAAAA,KAAK,EAAEL,EAAE,CAAE,QAAF,CAAX;AAAyBM,EAAAA,IAAI,EAAEL,UAA/B;AAA2CM,EAAAA,KAAK,EAAE;AAAlD,CAFqB,EAGrB;AAAEF,EAAAA,KAAK,EAAEL,EAAE,CAAE,QAAF,CAAX;AAAyBM,EAAAA,IAAI,EAAEJ,UAA/B;AAA2CK,EAAAA,KAAK,EAAE;AAAlD,CAHqB,CAAtB;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,kBAAT,OAAmD;AAAA,MAAtB;AAAEC,IAAAA,QAAF;AAAYF,IAAAA;AAAZ,GAAsB;AACjE,SACC;AAAU,IAAA,SAAS,EAAC;AAApB,KACC,8BAAUP,EAAE,CAAE,OAAF,CAAZ,CADD,EAEC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGI,aAAa,CAACM,GAAd,CAAqBC,WAAF,IACpB,cAAC,MAAD;AACC,IAAA,GAAG,EAAGA,WAAW,CAACJ,KADnB;AAEC,IAAA,IAAI,EAAGI,WAAW,CAACL,IAFpB;AAGC,IAAA,OAAO,MAHR;AAIC,IAAA,SAAS,EAAGK,WAAW,CAACJ,KAAZ,KAAsBA,KAJnC;AAKC,IAAA,OAAO,EAAG,MACTE,QAAQ,CACPE,WAAW,CAACJ,KAAZ,KAAsBA,KAAtB,GACGK,SADH,GAEGD,WAAW,CAACJ,KAHR,CANV;AAYC,kBAAaI,WAAW,CAACN;AAZ1B,IADC,CADH,CAFD,CADD;AAuBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { lineDashed, lineDotted, lineSolid } from '@wordpress/icons';\n\nconst BORDER_STYLES = [\n\t{ label: __( 'Solid' ), icon: lineSolid, value: 'solid' },\n\t{ label: __( 'Dashed' ), icon: lineDashed, value: 'dashed' },\n\t{ label: __( 'Dotted' ), icon: lineDotted, value: 'dotted' },\n];\n\n/**\n * Control to display border style options.\n *\n * @param {Object} props Component props.\n * @param {Function} props.onChange Handler for changing border style selection.\n * @param {string} props.value Currently selected border style value.\n *\n * @return {WPElement} Custom border style segmented control.\n */\nexport default function BorderStyleControl( { onChange, value } ) {\n\treturn (\n\t\t<fieldset className=\"components-border-style-control\">\n\t\t\t<legend>{ __( 'Style' ) }</legend>\n\t\t\t<div className=\"components-border-style-control__buttons\">\n\t\t\t\t{ BORDER_STYLES.map( ( borderStyle ) => (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ borderStyle.value }\n\t\t\t\t\t\ticon={ borderStyle.icon }\n\t\t\t\t\t\tisSmall\n\t\t\t\t\t\tisPressed={ borderStyle.value === value }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\tborderStyle.value === value\n\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t: borderStyle.value\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\taria-label={ borderStyle.label }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</div>\n\t\t</fieldset>\n\t);\n}\n"]}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* External dependencies
|
|
5
|
-
*/
|
|
6
|
-
import classnames from 'classnames';
|
|
7
|
-
/**
|
|
8
|
-
* WordPress dependencies
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { __experimentalTreeGridCell as TreeGridCell } from '@wordpress/components';
|
|
12
|
-
import { useInstanceId } from '@wordpress/compose';
|
|
13
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
14
|
-
import { useSelect } from '@wordpress/data';
|
|
15
|
-
/**
|
|
16
|
-
* Internal dependencies
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import ListViewLeaf from './leaf';
|
|
20
|
-
import Inserter from '../inserter';
|
|
21
|
-
import { store as blockEditorStore } from '../../store';
|
|
22
|
-
export default function ListViewAppender(_ref) {
|
|
23
|
-
let {
|
|
24
|
-
parentBlockClientId,
|
|
25
|
-
position,
|
|
26
|
-
level,
|
|
27
|
-
rowCount,
|
|
28
|
-
path
|
|
29
|
-
} = _ref;
|
|
30
|
-
const isDragging = useSelect(select => {
|
|
31
|
-
const {
|
|
32
|
-
isBlockBeingDragged,
|
|
33
|
-
isAncestorBeingDragged
|
|
34
|
-
} = select(blockEditorStore);
|
|
35
|
-
return isBlockBeingDragged(parentBlockClientId) || isAncestorBeingDragged(parentBlockClientId);
|
|
36
|
-
}, [parentBlockClientId]);
|
|
37
|
-
const instanceId = useInstanceId(ListViewAppender);
|
|
38
|
-
const descriptionId = `list-view-appender-row__description_${instanceId}`;
|
|
39
|
-
const appenderPositionDescription = sprintf(
|
|
40
|
-
/* translators: 1: The numerical position of the block that will be inserted. 2: The level of nesting for the block that will be inserted. */
|
|
41
|
-
__('Add block at position %1$d, Level %2$d'), position, level);
|
|
42
|
-
return createElement(ListViewLeaf, {
|
|
43
|
-
className: classnames({
|
|
44
|
-
'is-dragging': isDragging
|
|
45
|
-
}),
|
|
46
|
-
level: level,
|
|
47
|
-
position: position,
|
|
48
|
-
rowCount: rowCount,
|
|
49
|
-
path: path
|
|
50
|
-
}, createElement(TreeGridCell, {
|
|
51
|
-
className: "block-editor-list-view-appender__cell",
|
|
52
|
-
colSpan: "3"
|
|
53
|
-
}, _ref2 => {
|
|
54
|
-
let {
|
|
55
|
-
ref,
|
|
56
|
-
tabIndex,
|
|
57
|
-
onFocus
|
|
58
|
-
} = _ref2;
|
|
59
|
-
return createElement("div", {
|
|
60
|
-
className: "block-editor-list-view-appender__container"
|
|
61
|
-
}, createElement(Inserter, {
|
|
62
|
-
rootClientId: parentBlockClientId,
|
|
63
|
-
__experimentalIsQuick: true,
|
|
64
|
-
"aria-describedby": descriptionId,
|
|
65
|
-
toggleProps: {
|
|
66
|
-
ref,
|
|
67
|
-
tabIndex,
|
|
68
|
-
onFocus
|
|
69
|
-
}
|
|
70
|
-
}), createElement("div", {
|
|
71
|
-
className: "block-editor-list-view-appender__description",
|
|
72
|
-
id: descriptionId
|
|
73
|
-
}, appenderPositionDescription));
|
|
74
|
-
}));
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=appender.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/appender.js"],"names":["classnames","__experimentalTreeGridCell","TreeGridCell","useInstanceId","__","sprintf","useSelect","ListViewLeaf","Inserter","store","blockEditorStore","ListViewAppender","parentBlockClientId","position","level","rowCount","path","isDragging","select","isBlockBeingDragged","isAncestorBeingDragged","instanceId","descriptionId","appenderPositionDescription","ref","tabIndex","onFocus"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,0BAA0B,IAAIC,YAAvC,QAA2D,uBAA3D;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,QAAzB;AACA,OAAOC,QAAP,MAAqB,aAArB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,eAAe,SAASC,gBAAT,OAMX;AAAA,MANsC;AACzCC,IAAAA,mBADyC;AAEzCC,IAAAA,QAFyC;AAGzCC,IAAAA,KAHyC;AAIzCC,IAAAA,QAJyC;AAKzCC,IAAAA;AALyC,GAMtC;AACH,QAAMC,UAAU,GAAGX,SAAS,CACzBY,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,mBAAF;AAAuBC,MAAAA;AAAvB,QAAkDF,MAAM,CAC7DR,gBAD6D,CAA9D;AAIA,WACCS,mBAAmB,CAAEP,mBAAF,CAAnB,IACAQ,sBAAsB,CAAER,mBAAF,CAFvB;AAIA,GAV0B,EAW3B,CAAEA,mBAAF,CAX2B,CAA5B;AAaA,QAAMS,UAAU,GAAGlB,aAAa,CAAEQ,gBAAF,CAAhC;AACA,QAAMW,aAAa,GAAI,uCAAuCD,UAAY,EAA1E;AAEA,QAAME,2BAA2B,GAAGlB,OAAO;AAC1C;AACAD,EAAAA,EAAE,CAAE,wCAAF,CAFwC,EAG1CS,QAH0C,EAI1CC,KAJ0C,CAA3C;AAOA,SACC,cAAC,YAAD;AACC,IAAA,SAAS,EAAGd,UAAU,CAAE;AAAE,qBAAeiB;AAAjB,KAAF,CADvB;AAEC,IAAA,KAAK,EAAGH,KAFT;AAGC,IAAA,QAAQ,EAAGD,QAHZ;AAIC,IAAA,QAAQ,EAAGE,QAJZ;AAKC,IAAA,IAAI,EAAGC;AALR,KAOC,cAAC,YAAD;AACC,IAAA,SAAS,EAAC,uCADX;AAEC,IAAA,OAAO,EAAC;AAFT,KAIG;AAAA,QAAE;AAAEQ,MAAAA,GAAF;AAAOC,MAAAA,QAAP;AAAiBC,MAAAA;AAAjB,KAAF;AAAA,WACD;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,cAAC,QAAD;AACC,MAAA,YAAY,EAAGd,mBADhB;AAEC,MAAA,qBAAqB,MAFtB;AAGC,0BAAmBU,aAHpB;AAIC,MAAA,WAAW,EAAG;AAAEE,QAAAA,GAAF;AAAOC,QAAAA,QAAP;AAAiBC,QAAAA;AAAjB;AAJf,MADD,EAOC;AACC,MAAA,SAAS,EAAC,8CADX;AAEC,MAAA,EAAE,EAAGJ;AAFN,OAIGC,2BAJH,CAPD,CADC;AAAA,GAJH,CAPD,CADD;AA+BA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __experimentalTreeGridCell as TreeGridCell } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport ListViewLeaf from './leaf';\nimport Inserter from '../inserter';\nimport { store as blockEditorStore } from '../../store';\n\nexport default function ListViewAppender( {\n\tparentBlockClientId,\n\tposition,\n\tlevel,\n\trowCount,\n\tpath,\n} ) {\n\tconst isDragging = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isBlockBeingDragged, isAncestorBeingDragged } = select(\n\t\t\t\tblockEditorStore\n\t\t\t);\n\n\t\t\treturn (\n\t\t\t\tisBlockBeingDragged( parentBlockClientId ) ||\n\t\t\t\tisAncestorBeingDragged( parentBlockClientId )\n\t\t\t);\n\t\t},\n\t\t[ parentBlockClientId ]\n\t);\n\tconst instanceId = useInstanceId( ListViewAppender );\n\tconst descriptionId = `list-view-appender-row__description_${ instanceId }`;\n\n\tconst appenderPositionDescription = sprintf(\n\t\t/* translators: 1: The numerical position of the block that will be inserted. 2: The level of nesting for the block that will be inserted. */\n\t\t__( 'Add block at position %1$d, Level %2$d' ),\n\t\tposition,\n\t\tlevel\n\t);\n\n\treturn (\n\t\t<ListViewLeaf\n\t\t\tclassName={ classnames( { 'is-dragging': isDragging } ) }\n\t\t\tlevel={ level }\n\t\t\tposition={ position }\n\t\t\trowCount={ rowCount }\n\t\t\tpath={ path }\n\t\t>\n\t\t\t<TreeGridCell\n\t\t\t\tclassName=\"block-editor-list-view-appender__cell\"\n\t\t\t\tcolSpan=\"3\"\n\t\t\t>\n\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t<div className=\"block-editor-list-view-appender__container\">\n\t\t\t\t\t\t<Inserter\n\t\t\t\t\t\t\trootClientId={ parentBlockClientId }\n\t\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\t\t\t\ttoggleProps={ { ref, tabIndex, onFocus } }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"block-editor-list-view-appender__description\"\n\t\t\t\t\t\t\tid={ descriptionId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ appenderPositionDescription }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</TreeGridCell>\n\t\t</ListViewLeaf>\n\t);\n}\n"]}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* External dependencies
|
|
5
|
-
*/
|
|
6
|
-
import classnames from 'classnames';
|
|
7
|
-
/**
|
|
8
|
-
* WordPress dependencies
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { Button, VisuallyHidden } from '@wordpress/components';
|
|
12
|
-
import { __experimentalGetBlockLabel as getBlockLabel, getBlockType } from '@wordpress/blocks';
|
|
13
|
-
import { __ } from '@wordpress/i18n';
|
|
14
|
-
/**
|
|
15
|
-
* Internal dependencies
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
import BlockIcon from '../block-icon';
|
|
19
|
-
export default function ListViewListItem(_ref) {
|
|
20
|
-
let {
|
|
21
|
-
block,
|
|
22
|
-
onClick,
|
|
23
|
-
isSelected,
|
|
24
|
-
wrapperComponent: WrapperComponent,
|
|
25
|
-
children
|
|
26
|
-
} = _ref;
|
|
27
|
-
const blockType = getBlockType(block.name);
|
|
28
|
-
const blockLabel = blockType ? getBlockLabel(blockType, block.attributes) : null;
|
|
29
|
-
return createElement("div", {
|
|
30
|
-
className: "block-editor-list-view__list-item"
|
|
31
|
-
}, createElement(WrapperComponent, {
|
|
32
|
-
className: classnames('block-editor-list-view__list-item-button', {
|
|
33
|
-
'is-selected': isSelected
|
|
34
|
-
}),
|
|
35
|
-
onClick: onClick
|
|
36
|
-
}, createElement(BlockIcon, {
|
|
37
|
-
icon: blockType === null || blockType === void 0 ? void 0 : blockType.icon,
|
|
38
|
-
showColors: true
|
|
39
|
-
}), children ? children : blockLabel, isSelected && createElement(VisuallyHidden, {
|
|
40
|
-
as: "span"
|
|
41
|
-
}, __('(selected block)'))));
|
|
42
|
-
}
|
|
43
|
-
ListViewListItem.defaultProps = {
|
|
44
|
-
onClick: () => {},
|
|
45
|
-
wrapperComponent: props => createElement(Button, props)
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=list-item.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/list-item.js"],"names":["classnames","Button","VisuallyHidden","__experimentalGetBlockLabel","getBlockLabel","getBlockType","__","BlockIcon","ListViewListItem","block","onClick","isSelected","wrapperComponent","WrapperComponent","children","blockType","name","blockLabel","attributes","icon","defaultProps","props"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,EAAiBC,cAAjB,QAAuC,uBAAvC;AACA,SACCC,2BAA2B,IAAIC,aADhC,EAECC,YAFD,QAGO,mBAHP;AAIA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,eAAtB;AAEA,eAAe,SAASC,gBAAT,OAMX;AAAA,MANsC;AACzCC,IAAAA,KADyC;AAEzCC,IAAAA,OAFyC;AAGzCC,IAAAA,UAHyC;AAIzCC,IAAAA,gBAAgB,EAAEC,gBAJuB;AAKzCC,IAAAA;AALyC,GAMtC;AACH,QAAMC,SAAS,GAAGV,YAAY,CAAEI,KAAK,CAACO,IAAR,CAA9B;AACA,QAAMC,UAAU,GAAGF,SAAS,GACzBX,aAAa,CAAEW,SAAF,EAAaN,KAAK,CAACS,UAAnB,CADY,GAEzB,IAFH;AAIA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,gBAAD;AACC,IAAA,SAAS,EAAGlB,UAAU,CACrB,0CADqB,EAErB;AACC,qBAAeW;AADhB,KAFqB,CADvB;AAOC,IAAA,OAAO,EAAGD;AAPX,KASC,cAAC,SAAD;AAAW,IAAA,IAAI,EAAGK,SAAH,aAAGA,SAAH,uBAAGA,SAAS,CAAEI,IAA7B;AAAoC,IAAA,UAAU;AAA9C,IATD,EAUGL,QAAQ,GAAGA,QAAH,GAAcG,UAVzB,EAWGN,UAAU,IACX,cAAC,cAAD;AAAgB,IAAA,EAAE,EAAC;AAAnB,KACGL,EAAE,CAAE,kBAAF,CADL,CAZF,CADD,CADD;AAqBA;AAEDE,gBAAgB,CAACY,YAAjB,GAAgC;AAC/BV,EAAAA,OAAO,EAAE,MAAM,CAAE,CADc;AAE/BE,EAAAA,gBAAgB,EAAIS,KAAF,IAAa,cAAC,MAAD,EAAaA,KAAb;AAFA,CAAhC","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport {\n\t__experimentalGetBlockLabel as getBlockLabel,\n\tgetBlockType,\n} from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\n\nexport default function ListViewListItem( {\n\tblock,\n\tonClick,\n\tisSelected,\n\twrapperComponent: WrapperComponent,\n\tchildren,\n} ) {\n\tconst blockType = getBlockType( block.name );\n\tconst blockLabel = blockType\n\t\t? getBlockLabel( blockType, block.attributes )\n\t\t: null;\n\n\treturn (\n\t\t<div className=\"block-editor-list-view__list-item\">\n\t\t\t<WrapperComponent\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-list-view__list-item-button',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-selected': isSelected,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\tonClick={ onClick }\n\t\t\t>\n\t\t\t\t<BlockIcon icon={ blockType?.icon } showColors />\n\t\t\t\t{ children ? children : blockLabel }\n\t\t\t\t{ isSelected && (\n\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t{ __( '(selected block)' ) }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t) }\n\t\t\t</WrapperComponent>\n\t\t</div>\n\t);\n}\n\nListViewListItem.defaultProps = {\n\tonClick: () => {},\n\twrapperComponent: ( props ) => <Button { ...props } />,\n};\n"]}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useEffect } from '@wordpress/element';
|
|
5
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { store as blockEditorStore } from '../../store';
|
|
11
|
-
export function useCaretInFormat(_ref) {
|
|
12
|
-
let {
|
|
13
|
-
value
|
|
14
|
-
} = _ref;
|
|
15
|
-
const hasActiveFormats = value.activeFormats && !!value.activeFormats.length;
|
|
16
|
-
const {
|
|
17
|
-
isCaretWithinFormattedText
|
|
18
|
-
} = useSelect(blockEditorStore);
|
|
19
|
-
const {
|
|
20
|
-
enterFormattedText,
|
|
21
|
-
exitFormattedText
|
|
22
|
-
} = useDispatch(blockEditorStore);
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
if (hasActiveFormats) {
|
|
25
|
-
if (!isCaretWithinFormattedText()) {
|
|
26
|
-
enterFormattedText();
|
|
27
|
-
}
|
|
28
|
-
} else if (isCaretWithinFormattedText()) {
|
|
29
|
-
exitFormattedText();
|
|
30
|
-
}
|
|
31
|
-
}, [hasActiveFormats]);
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=use-caret-in-format.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/rich-text/use-caret-in-format.js"],"names":["useEffect","useDispatch","useSelect","store","blockEditorStore","useCaretInFormat","value","hasActiveFormats","activeFormats","length","isCaretWithinFormattedText","enterFormattedText","exitFormattedText"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,OAAO,SAASC,gBAAT,OAAuC;AAAA,MAAZ;AAAEC,IAAAA;AAAF,GAAY;AAC7C,QAAMC,gBAAgB,GACrBD,KAAK,CAACE,aAAN,IAAuB,CAAC,CAAEF,KAAK,CAACE,aAAN,CAAoBC,MAD/C;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAAiCR,SAAS,CAAEE,gBAAF,CAAhD;AACA,QAAM;AAAEO,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,MAA4CX,WAAW,CAC5DG,gBAD4D,CAA7D;AAGAJ,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAKO,gBAAL,EAAwB;AACvB,UAAK,CAAEG,0BAA0B,EAAjC,EAAsC;AACrCC,QAAAA,kBAAkB;AAClB;AACD,KAJD,MAIO,IAAKD,0BAA0B,EAA/B,EAAoC;AAC1CE,MAAAA,iBAAiB;AACjB;AACD,GARQ,EAQN,CAAEL,gBAAF,CARM,CAAT;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nexport function useCaretInFormat( { value } ) {\n\tconst hasActiveFormats =\n\t\tvalue.activeFormats && !! value.activeFormats.length;\n\tconst { isCaretWithinFormattedText } = useSelect( blockEditorStore );\n\tconst { enterFormattedText, exitFormattedText } = useDispatch(\n\t\tblockEditorStore\n\t);\n\tuseEffect( () => {\n\t\tif ( hasActiveFormats ) {\n\t\t\tif ( ! isCaretWithinFormattedText() ) {\n\t\t\t\tenterFormattedText();\n\t\t\t}\n\t\t} else if ( isCaretWithinFormattedText() ) {\n\t\t\texitFormattedText();\n\t\t}\n\t}, [ hasActiveFormats ] );\n}\n"]}
|