@wordpress/block-editor 8.0.8 → 8.0.12-next.33ec3857e2.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/README.md +4 -0
- package/build/components/block-caption/index.native.js +14 -3
- package/build/components/block-caption/index.native.js.map +1 -1
- package/build/components/block-inspector/index.js +12 -23
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list-appender/index.js +3 -11
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-preview/auto.js +10 -2
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js +51 -0
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-settings/container.native.js +2 -1
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-styles/index.js +110 -134
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/menu-items.js +63 -0
- package/build/components/block-styles/menu-items.js.map +1 -0
- package/build/components/block-styles/preview-panel.js +45 -0
- package/build/components/block-styles/preview-panel.js.map +1 -0
- package/build/components/block-styles/use-styles-for-block.js +119 -0
- package/build/components/block-styles/use-styles-for-block.js.map +1 -0
- package/build/components/block-styles/utils.js +39 -0
- package/build/components/block-styles/utils.js.map +1 -1
- package/build/components/block-switcher/block-styles-menu.js +3 -23
- package/build/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build/components/block-tools/back-compat.js +2 -1
- package/build/components/block-tools/back-compat.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +11 -1
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/button-block-appender/index.js +2 -1
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/colors-gradients/control.js +1 -0
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +51 -10
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/default-block-appender/index.js +16 -19
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/default-style-picker/index.js +18 -3
- package/build/components/default-style-picker/index.js.map +1 -1
- package/build/components/iframe/index.js +3 -4
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/index.js +17 -10
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/default-block-appender.js +2 -4
- package/build/components/inner-blocks/default-block-appender.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/tabs.native.js +7 -4
- package/build/components/inserter/tabs.native.js.map +1 -1
- package/build/components/inspector-controls/block-support-slot-container.js +2 -1
- package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +3 -5
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls/groups.js +2 -0
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls/slot.js +1 -3
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +6 -6
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +23 -3
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/media-placeholder/index.js +2 -0
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +2 -0
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/rich-text/file-paste-handler.js +1 -1
- package/build/components/rich-text/file-paste-handler.js.map +1 -1
- package/build/components/rich-text/prevent-event-discovery.js +33 -0
- package/build/components/rich-text/prevent-event-discovery.js.map +1 -0
- package/build/components/rich-text/use-input-rules.js +3 -1
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/selection-scroll-into-view/index.js +2 -1
- package/build/components/selection-scroll-into-view/index.js.map +1 -1
- package/build/components/use-display-block-controls/index.native.js +45 -0
- package/build/components/use-display-block-controls/index.native.js.map +1 -0
- package/build/components/use-on-block-drop/index.js +7 -3
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/writing-flow/use-multi-selection.js +3 -1
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/hooks/border-color.js +63 -5
- package/build/hooks/border-color.js.map +1 -1
- package/build/hooks/border-radius.js +47 -0
- package/build/hooks/border-radius.js.map +1 -1
- package/build/hooks/border-style.js +41 -0
- package/build/hooks/border-style.js.map +1 -1
- package/build/hooks/border-width.js +70 -31
- package/build/hooks/border-width.js.map +1 -1
- package/build/hooks/border.js +81 -11
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/letter-spacing.js +1 -1
- package/build/hooks/letter-spacing.js.map +1 -1
- package/build/hooks/typography.js +1 -1
- package/build/hooks/typography.js.map +1 -1
- package/build/store/actions.js +1 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +5 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +10 -82
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +25 -7
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-paste-event-data.js +1 -1
- package/build/utils/get-paste-event-data.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +1 -1
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build/utils/transform-styles/index.js +2 -3
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/components/block-caption/index.native.js +13 -3
- package/build-module/components/block-caption/index.native.js.map +1 -1
- package/build-module/components/block-inspector/index.js +12 -23
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +3 -10
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +10 -2
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-preview/index.js +46 -0
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +2 -1
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-styles/index.js +112 -133
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/menu-items.js +50 -0
- package/build-module/components/block-styles/menu-items.js.map +1 -0
- package/build-module/components/block-styles/preview-panel.js +35 -0
- package/build-module/components/block-styles/preview-panel.js.map +1 -0
- package/build-module/components/block-styles/use-styles-for-block.js +107 -0
- package/build-module/components/block-styles/use-styles-for-block.js.map +1 -0
- package/build-module/components/block-styles/utils.js +34 -0
- package/build-module/components/block-styles/utils.js.map +1 -1
- package/build-module/components/block-switcher/block-styles-menu.js +3 -21
- package/build-module/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build-module/components/block-tools/back-compat.js +2 -1
- package/build-module/components/block-tools/back-compat.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +11 -1
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/button-block-appender/index.js +2 -1
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +1 -0
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +54 -13
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +15 -18
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/default-style-picker/index.js +17 -3
- package/build-module/components/default-style-picker/index.js.map +1 -1
- package/build-module/components/iframe/index.js +3 -4
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/index.js +2 -2
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/default-block-appender.js +2 -4
- package/build-module/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build-module/components/inserter/index.native.js +2 -2
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/tabs.native.js +7 -4
- package/build-module/components/inserter/tabs.native.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-slot-container.js +2 -1
- package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +3 -5
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +2 -0
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +1 -3
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +6 -6
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +22 -3
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +2 -0
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +2 -0
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/rich-text/file-paste-handler.js +1 -1
- package/build-module/components/rich-text/file-paste-handler.js.map +1 -1
- package/build-module/components/rich-text/prevent-event-discovery.js +25 -0
- package/build-module/components/rich-text/prevent-event-discovery.js.map +1 -0
- package/build-module/components/rich-text/use-input-rules.js +2 -1
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/selection-scroll-into-view/index.js +2 -1
- package/build-module/components/selection-scroll-into-view/index.js.map +1 -1
- package/build-module/components/use-display-block-controls/index.native.js +34 -0
- package/build-module/components/use-display-block-controls/index.native.js.map +1 -0
- package/build-module/components/use-on-block-drop/index.js +7 -3
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/writing-flow/use-multi-selection.js +3 -4
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/hooks/border-color.js +61 -7
- package/build-module/hooks/border-color.js.map +1 -1
- package/build-module/hooks/border-radius.js +42 -0
- package/build-module/hooks/border-radius.js.map +1 -1
- package/build-module/hooks/border-style.js +36 -0
- package/build-module/hooks/border-style.js.map +1 -1
- package/build-module/hooks/border-width.js +66 -32
- package/build-module/hooks/border-width.js.map +1 -1
- package/build-module/hooks/border.js +80 -12
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/letter-spacing.js +1 -1
- package/build-module/hooks/letter-spacing.js.map +1 -1
- package/build-module/hooks/typography.js +1 -1
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/store/actions.js +1 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +5 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +11 -83
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +24 -7
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-paste-event-data.js +1 -1
- package/build-module/utils/get-paste-event-data.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +1 -1
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +2 -3
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/style-rtl.css +229 -182
- package/build-style/style.css +229 -182
- package/package.json +27 -27
- package/src/components/block-caption/index.native.js +22 -4
- package/src/components/block-inspector/index.js +14 -17
- package/src/components/block-list-appender/index.js +5 -21
- package/src/components/block-preview/auto.js +7 -2
- package/src/components/block-preview/index.js +60 -0
- package/src/components/block-preview/style.scss +23 -0
- package/src/components/block-preview/test/index.js +114 -0
- package/src/components/block-settings/container.native.js +1 -0
- package/src/components/block-styles/index.js +125 -145
- package/src/components/block-styles/menu-items.js +49 -0
- package/src/components/block-styles/preview-panel.js +36 -0
- package/src/components/block-styles/style.scss +59 -51
- package/src/components/block-styles/test/{index.js → utils.js} +60 -1
- package/src/components/block-styles/use-styles-for-block.js +99 -0
- package/src/components/block-styles/utils.js +39 -0
- package/src/components/block-switcher/block-styles-menu.js +3 -38
- package/src/components/block-tools/back-compat.js +1 -0
- package/src/components/block-tools/insertion-point.js +10 -1
- package/src/components/border-style-control/style.scss +3 -3
- package/src/components/button-block-appender/index.js +1 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -0
- package/src/components/colors-gradients/control.js +3 -0
- package/src/components/colors-gradients/panel-color-gradient-settings.js +75 -19
- package/src/components/colors-gradients/style.scss +42 -5
- package/src/components/default-block-appender/index.js +17 -24
- package/src/components/default-block-appender/style.scss +4 -0
- package/src/components/default-block-appender/test/__snapshots__/index.js.snap +12 -24
- package/src/components/default-block-appender/test/index.js +4 -14
- package/src/components/default-style-picker/index.js +18 -6
- package/src/components/iframe/index.js +6 -3
- package/src/components/index.js +5 -2
- package/src/components/inner-blocks/README.md +2 -0
- package/src/components/inner-blocks/default-block-appender.js +2 -7
- package/src/components/inserter/index.native.js +2 -2
- package/src/components/inserter/tabs.native.js +5 -4
- package/src/components/inspector-controls/block-support-slot-container.js +3 -1
- package/src/components/inspector-controls/fill.native.js +4 -3
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls/slot.js +2 -7
- package/src/components/letter-spacing-control/index.js +6 -6
- package/src/components/link-control/README.md +1 -1
- package/src/components/link-control/test/index.js +2 -0
- package/src/components/list-view/block-select-button.js +20 -1
- package/src/components/media-placeholder/index.js +2 -0
- package/src/components/media-replace-flow/index.js +2 -0
- package/src/components/rich-text/file-paste-handler.js +3 -1
- package/src/components/rich-text/prevent-event-discovery.js +23 -0
- package/src/components/rich-text/use-input-rules.js +2 -1
- package/src/components/selection-scroll-into-view/index.js +1 -0
- package/src/components/url-input/README.md +5 -0
- package/src/components/use-display-block-controls/index.native.js +38 -0
- package/src/components/use-on-block-drop/index.js +7 -3
- package/src/components/writing-flow/test/use-multi-selection.js +36 -0
- package/src/components/writing-flow/use-multi-selection.js +12 -9
- package/src/hooks/border-color.js +55 -3
- package/src/hooks/border-radius.js +32 -0
- package/src/hooks/border-style.js +26 -0
- package/src/hooks/border-width.js +56 -32
- package/src/hooks/border.js +115 -20
- package/src/hooks/border.scss +3 -17
- package/src/hooks/dimensions.scss +5 -0
- package/src/hooks/letter-spacing.js +1 -1
- package/src/hooks/typography.js +1 -1
- package/src/store/actions.js +1 -2
- package/src/store/defaults.js +2 -0
- package/src/store/reducer.js +13 -104
- package/src/store/selectors.js +37 -7
- package/src/style.scss +4 -3
- package/src/utils/get-paste-event-data.js +1 -1
- package/src/utils/parse-css-unit-to-px.js +1 -1
- package/src/utils/test/parse-css-unit-to-px.js +1 -0
- package/src/utils/transform-styles/index.js +13 -16
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/use-canvas-click-redirect/index.js +0 -66
- package/build/components/use-canvas-click-redirect/index.js.map +0 -1
- package/build-module/components/use-canvas-click-redirect/index.js +0 -54
- package/build-module/components/use-canvas-click-redirect/index.js.map +0 -1
- package/src/components/use-canvas-click-redirect/index.js +0 -57
|
@@ -6,12 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.getActiveStyle = getActiveStyle;
|
|
9
|
+
exports.getDefaultStyle = getDefaultStyle;
|
|
10
|
+
exports.getRenderedStyles = getRenderedStyles;
|
|
9
11
|
exports.replaceActiveStyle = replaceActiveStyle;
|
|
10
12
|
|
|
11
13
|
var _lodash = require("lodash");
|
|
12
14
|
|
|
13
15
|
var _tokenList = _interopRequireDefault(require("@wordpress/token-list"));
|
|
14
16
|
|
|
17
|
+
var _i18n = require("@wordpress/i18n");
|
|
18
|
+
|
|
15
19
|
/**
|
|
16
20
|
* External dependencies
|
|
17
21
|
*/
|
|
@@ -67,4 +71,39 @@ function replaceActiveStyle(className, activeStyle, newStyle) {
|
|
|
67
71
|
list.add('is-style-' + newStyle.name);
|
|
68
72
|
return list.value;
|
|
69
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Returns a collection of styles that can be represented on the frontend.
|
|
76
|
+
* The function checks a style collection for a default style. If none is found, it adds one to
|
|
77
|
+
* act as a fallback for when there is no active style applied to a block. The default item also serves
|
|
78
|
+
* as a switch on the frontend to deactivate non-default styles.
|
|
79
|
+
*
|
|
80
|
+
* @param {Array} styles Block style variations.
|
|
81
|
+
*
|
|
82
|
+
* @return {Array<Object?>} The style collection.
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
function getRenderedStyles(styles) {
|
|
87
|
+
if (!styles || styles.length === 0) {
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return getDefaultStyle(styles) ? styles : [{
|
|
92
|
+
name: 'default',
|
|
93
|
+
label: (0, _i18n._x)('Default', 'block style'),
|
|
94
|
+
isDefault: true
|
|
95
|
+
}, ...styles];
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Returns a style object from a collection of styles where that style object is the default block style.
|
|
99
|
+
*
|
|
100
|
+
* @param {Array} styles Block style variations.
|
|
101
|
+
*
|
|
102
|
+
* @return {Object?} The default style object, if found.
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
function getDefaultStyle(styles) {
|
|
107
|
+
return (0, _lodash.find)(styles, 'isDefault');
|
|
108
|
+
}
|
|
70
109
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-styles/utils.js"],"names":["getActiveStyle","styles","className","style","TokenList","values","indexOf","potentialStyleName","substring","activeStyle","name","replaceActiveStyle","newStyle","list","remove","add","value"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-styles/utils.js"],"names":["getActiveStyle","styles","className","style","TokenList","values","indexOf","potentialStyleName","substring","activeStyle","name","replaceActiveStyle","newStyle","list","remove","add","value","getRenderedStyles","length","getDefaultStyle","label","isDefault"],"mappings":";;;;;;;;;;;;AAGA;;AAIA;;AACA;;AARA;AACA;AACA;;AAEA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAT,CAAyBC,MAAzB,EAAiCC,SAAjC,EAA6C;AACnD,OAAM,MAAMC,KAAZ,IAAqB,IAAIC,kBAAJ,CAAeF,SAAf,EAA2BG,MAA3B,EAArB,EAA2D;AAC1D,QAAKF,KAAK,CAACG,OAAN,CAAe,WAAf,MAAiC,CAAC,CAAvC,EAA2C;AAC1C;AACA;;AAED,UAAMC,kBAAkB,GAAGJ,KAAK,CAACK,SAAN,CAAiB,CAAjB,CAA3B;AACA,UAAMC,WAAW,GAAG,kBAAMR,MAAN,EAAc;AAAES,MAAAA,IAAI,EAAEH;AAAR,KAAd,CAApB;;AACA,QAAKE,WAAL,EAAmB;AAClB,aAAOA,WAAP;AACA;AACD;;AAED,SAAO,kBAAMR,MAAN,EAAc,WAAd,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASU,kBAAT,CAA6BT,SAA7B,EAAwCO,WAAxC,EAAqDG,QAArD,EAAgE;AACtE,QAAMC,IAAI,GAAG,IAAIT,kBAAJ,CAAeF,SAAf,CAAb;;AAEA,MAAKO,WAAL,EAAmB;AAClBI,IAAAA,IAAI,CAACC,MAAL,CAAa,cAAcL,WAAW,CAACC,IAAvC;AACA;;AAEDG,EAAAA,IAAI,CAACE,GAAL,CAAU,cAAcH,QAAQ,CAACF,IAAjC;AAEA,SAAOG,IAAI,CAACG,KAAZ;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,iBAAT,CAA4BhB,MAA5B,EAAqC;AAC3C,MAAK,CAAEA,MAAF,IAAYA,MAAM,CAACiB,MAAP,KAAkB,CAAnC,EAAuC;AACtC,WAAO,EAAP;AACA;;AAED,SAAOC,eAAe,CAAElB,MAAF,CAAf,GACJA,MADI,GAEJ,CACA;AACCS,IAAAA,IAAI,EAAE,SADP;AAECU,IAAAA,KAAK,EAAE,cAAI,SAAJ,EAAe,aAAf,CAFR;AAGCC,IAAAA,SAAS,EAAE;AAHZ,GADA,EAMA,GAAGpB,MANH,CAFH;AAUA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASkB,eAAT,CAA0BlB,MAA1B,EAAmC;AACzC,SAAO,kBAAMA,MAAN,EAAc,WAAd,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { find } from 'lodash';\n/**\n * WordPress dependencies\n */\nimport TokenList from '@wordpress/token-list';\nimport { _x } from '@wordpress/i18n';\n\n/**\n * Returns the active style from the given className.\n *\n * @param {Array} styles Block style variations.\n * @param {string} className Class name\n *\n * @return {Object?} The active style.\n */\nexport function getActiveStyle( styles, className ) {\n\tfor ( const style of new TokenList( className ).values() ) {\n\t\tif ( style.indexOf( 'is-style-' ) === -1 ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst potentialStyleName = style.substring( 9 );\n\t\tconst activeStyle = find( styles, { name: potentialStyleName } );\n\t\tif ( activeStyle ) {\n\t\t\treturn activeStyle;\n\t\t}\n\t}\n\n\treturn find( styles, 'isDefault' );\n}\n\n/**\n * Replaces the active style in the block's className.\n *\n * @param {string} className Class name.\n * @param {Object?} activeStyle The replaced style.\n * @param {Object} newStyle The replacing style.\n *\n * @return {string} The updated className.\n */\nexport function replaceActiveStyle( className, activeStyle, newStyle ) {\n\tconst list = new TokenList( className );\n\n\tif ( activeStyle ) {\n\t\tlist.remove( 'is-style-' + activeStyle.name );\n\t}\n\n\tlist.add( 'is-style-' + newStyle.name );\n\n\treturn list.value;\n}\n\n/**\n * Returns a collection of styles that can be represented on the frontend.\n * The function checks a style collection for a default style. If none is found, it adds one to\n * act as a fallback for when there is no active style applied to a block. The default item also serves\n * as a switch on the frontend to deactivate non-default styles.\n *\n * @param {Array} styles Block style variations.\n *\n * @return {Array<Object?>} The style collection.\n */\nexport function getRenderedStyles( styles ) {\n\tif ( ! styles || styles.length === 0 ) {\n\t\treturn [];\n\t}\n\n\treturn getDefaultStyle( styles )\n\t\t? styles\n\t\t: [\n\t\t\t\t{\n\t\t\t\t\tname: 'default',\n\t\t\t\t\tlabel: _x( 'Default', 'block style' ),\n\t\t\t\t\tisDefault: true,\n\t\t\t\t},\n\t\t\t\t...styles,\n\t\t ];\n}\n\n/**\n * Returns a style object from a collection of styles where that style object is the default block style.\n *\n * @param {Array} styles Block style variations.\n *\n * @return {Object?} The default style object, if found.\n */\nexport function getDefaultStyle( styles ) {\n\treturn find( styles, 'isDefault' );\n}\n"]}
|
|
@@ -13,13 +13,7 @@ var _i18n = require("@wordpress/i18n");
|
|
|
13
13
|
|
|
14
14
|
var _components = require("@wordpress/components");
|
|
15
15
|
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
var _blocks = require("@wordpress/blocks");
|
|
19
|
-
|
|
20
|
-
var _blockStyles = _interopRequireDefault(require("../block-styles"));
|
|
21
|
-
|
|
22
|
-
var _previewBlockPopover = _interopRequireDefault(require("./preview-block-popover"));
|
|
16
|
+
var _menuItems = _interopRequireDefault(require("../block-styles/menu-items"));
|
|
23
17
|
|
|
24
18
|
/**
|
|
25
19
|
* WordPress dependencies
|
|
@@ -34,28 +28,14 @@ function BlockStylesMenu(_ref) {
|
|
|
34
28
|
onSwitch
|
|
35
29
|
} = _ref;
|
|
36
30
|
const {
|
|
37
|
-
name,
|
|
38
31
|
clientId
|
|
39
32
|
} = hoveredBlock;
|
|
40
|
-
const [hoveredClassName, setHoveredClassName] = (0, _element.useState)();
|
|
41
|
-
const blockType = (0, _data.useSelect)(select => select(_blocks.store).getBlockType(name), [name]);
|
|
42
33
|
return (0, _element.createElement)(_components.MenuGroup, {
|
|
43
34
|
label: (0, _i18n.__)('Styles'),
|
|
44
35
|
className: "block-editor-block-switcher__styles__menugroup"
|
|
45
|
-
},
|
|
46
|
-
blocks: blockType && blockType.example ? (0, _blocks.getBlockFromExample)(blockType.name, {
|
|
47
|
-
attributes: { ...blockType.example.attributes,
|
|
48
|
-
className: hoveredClassName
|
|
49
|
-
},
|
|
50
|
-
innerBlocks: blockType.example.innerBlocks
|
|
51
|
-
}) : (0, _blocks.cloneBlock)(hoveredBlock, {
|
|
52
|
-
className: hoveredClassName
|
|
53
|
-
})
|
|
54
|
-
}), (0, _element.createElement)(_blockStyles.default, {
|
|
36
|
+
}, (0, _element.createElement)(_menuItems.default, {
|
|
55
37
|
clientId: clientId,
|
|
56
|
-
onSwitch: onSwitch
|
|
57
|
-
onHoverClassName: setHoveredClassName,
|
|
58
|
-
itemRole: "menuitem"
|
|
38
|
+
onSwitch: onSwitch
|
|
59
39
|
}));
|
|
60
40
|
}
|
|
61
41
|
//# sourceMappingURL=block-styles-menu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-switcher/block-styles-menu.js"],"names":["BlockStylesMenu","hoveredBlock","onSwitch","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-switcher/block-styles-menu.js"],"names":["BlockStylesMenu","hoveredBlock","onSwitch","clientId"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGe,SAASA,eAAT,OAAuD;AAAA,MAA7B;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,GAA6B;AACrE,QAAM;AAAEC,IAAAA;AAAF,MAAeF,YAArB;AAEA,SACC,4BAAC,qBAAD;AACC,IAAA,KAAK,EAAG,cAAI,QAAJ,CADT;AAEC,IAAA,SAAS,EAAC;AAFX,KAIC,4BAAC,kBAAD;AAAsB,IAAA,QAAQ,EAAGE,QAAjC;AAA4C,IAAA,QAAQ,EAAGD;AAAvD,IAJD,CADD;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockStylesMenuItems from '../block-styles/menu-items';\n\nexport default function BlockStylesMenu( { hoveredBlock, onSwitch } ) {\n\tconst { clientId } = hoveredBlock;\n\n\treturn (\n\t\t<MenuGroup\n\t\t\tlabel={ __( 'Styles' ) }\n\t\t\tclassName=\"block-editor-block-switcher__styles__menugroup\"\n\t\t>\n\t\t\t<BlockStylesMenuItems clientId={ clientId } onSwitch={ onSwitch } />\n\t\t</MenuGroup>\n\t);\n}\n"]}
|
|
@@ -40,7 +40,8 @@ function BlockToolsBackCompat(_ref) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
(0, _deprecated.default)('wp.components.Popover.Slot name="block-toolbar"', {
|
|
43
|
-
alternative: 'wp.blockEditor.BlockTools'
|
|
43
|
+
alternative: 'wp.blockEditor.BlockTools',
|
|
44
|
+
since: '5.8'
|
|
44
45
|
});
|
|
45
46
|
return (0, _element.createElement)(_insertionPoint.default, {
|
|
46
47
|
__unstablePopoverSlot: "block-toolbar"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/back-compat.js"],"names":["BlockToolsBackCompat","children","openRef","InsertionPointOpenRef","isDisabled","Disabled","Context","alternative"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;;;;;AAXA;AACA;AACA;;AAKA;AACA;AACA;AAIe,SAASA,oBAAT,OAA8C;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AAC5D,QAAMC,OAAO,GAAG,yBAAYC,qCAAZ,CAAhB;AACA,QAAMC,UAAU,GAAG,yBAAYC,qBAASC,OAArB,CAAnB,CAF4D,CAI5D;;AACA,MAAKJ,OAAO,IAAIE,UAAhB,EAA6B;AAC5B,WAAOH,QAAP;AACA;;AAED,2BAAY,iDAAZ,EAA+D;AAC9DM,IAAAA,WAAW,EAAE;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/back-compat.js"],"names":["BlockToolsBackCompat","children","openRef","InsertionPointOpenRef","isDisabled","Disabled","Context","alternative","since"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;;;;;AAXA;AACA;AACA;;AAKA;AACA;AACA;AAIe,SAASA,oBAAT,OAA8C;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AAC5D,QAAMC,OAAO,GAAG,yBAAYC,qCAAZ,CAAhB;AACA,QAAMC,UAAU,GAAG,yBAAYC,qBAASC,OAArB,CAAnB,CAF4D,CAI5D;;AACA,MAAKJ,OAAO,IAAIE,UAAhB,EAA6B;AAC5B,WAAOH,QAAP;AACA;;AAED,2BAAY,iDAAZ,EAA+D;AAC9DM,IAAAA,WAAW,EAAE,2BADiD;AAE9DC,IAAAA,KAAK,EAAE;AAFuD,GAA/D;AAKA,SACC,4BAAC,uBAAD;AAAgB,IAAA,qBAAqB,EAAC;AAAtC,KACC,4BAAC,qBAAD;AAAc,IAAA,qBAAqB,EAAC;AAApC,IADD,EAEGP,QAFH,CADD;AAMA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { Disabled } from '@wordpress/components';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport InsertionPoint, { InsertionPointOpenRef } from './insertion-point';\nimport BlockPopover from './block-popover';\n\nexport default function BlockToolsBackCompat( { children } ) {\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst isDisabled = useContext( Disabled.Context );\n\n\t// If context is set, `BlockTools` is a parent component.\n\tif ( openRef || isDisabled ) {\n\t\treturn children;\n\t}\n\n\tdeprecated( 'wp.components.Popover.Slot name=\"block-toolbar\"', {\n\t\talternative: 'wp.blockEditor.BlockTools',\n\t\tsince: '5.8',\n\t} );\n\n\treturn (\n\t\t<InsertionPoint __unstablePopoverSlot=\"block-toolbar\">\n\t\t\t<BlockPopover __unstablePopoverSlot=\"block-toolbar\" />\n\t\t\t{ children }\n\t\t</InsertionPoint>\n\t);\n}\n"]}
|
|
@@ -48,7 +48,8 @@ function InsertionPointPopover(_ref) {
|
|
|
48
48
|
__unstableContentRef
|
|
49
49
|
} = _ref;
|
|
50
50
|
const {
|
|
51
|
-
selectBlock
|
|
51
|
+
selectBlock,
|
|
52
|
+
hideInsertionPoint
|
|
52
53
|
} = (0, _data.useDispatch)(_store.store);
|
|
53
54
|
const openRef = (0, _element.useContext)(InsertionPointOpenRef);
|
|
54
55
|
const ref = (0, _element.useRef)();
|
|
@@ -189,6 +190,14 @@ function InsertionPointPopover(_ref) {
|
|
|
189
190
|
if (event.target !== ref.current) {
|
|
190
191
|
openRef.current = true;
|
|
191
192
|
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function maybeHideInserterPoint(event) {
|
|
196
|
+
// Only hide the inserter if it's triggered on the wrapper,
|
|
197
|
+
// and the inserter is not open.
|
|
198
|
+
if (event.target === ref.current && !openRef.current) {
|
|
199
|
+
hideInsertionPoint();
|
|
200
|
+
}
|
|
192
201
|
} // Only show the in-between inserter between blocks, so when there's a
|
|
193
202
|
// previous and a next element.
|
|
194
203
|
|
|
@@ -303,6 +312,7 @@ function InsertionPointPopover(_ref) {
|
|
|
303
312
|
className: (0, _classnames.default)(className, {
|
|
304
313
|
'is-with-inserter': showInsertionPointInserter
|
|
305
314
|
}),
|
|
315
|
+
onHoverEnd: maybeHideInserterPoint,
|
|
306
316
|
style: style
|
|
307
317
|
}, (0, _element.createElement)(_components.__unstableMotion.div, {
|
|
308
318
|
variants: lineVariants,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/insertion-point.js"],"names":["InsertionPointOpenRef","InsertionPointPopover","__unstablePopoverSlot","__unstableContentRef","selectBlock","blockEditorStore","openRef","ref","orientation","previousClientId","nextClientId","rootClientId","isInserterShown","select","getBlockOrder","getBlockListSettings","getBlockInsertionPoint","isBlockBeingDragged","getPreviousBlockClientId","getNextBlockClientId","insertionPoint","order","length","_previousClientId","index","_nextClientId","__unstableWithInserter","previousElement","nextElement","isVertical","style","previousRect","getBoundingClientRect","nextRect","width","offsetWidth","height","top","bottom","left","right","offsetHeight","getAnchorRect","ownerDocument","popoverScrollRef","disableMotion","className","onClick","event","target","current","onFocus","showInsertionPointInserter","horizontalLine","start","x","rest","hover","verticalLine","y","lineVariants","opacity","borderRadius","transition","delay","inserterVariants","scale","isOpen","InsertionPoint","children","isVisible","isBlockInsertionPointVisible"],"mappings":";;;;;;;;;;AASA;;AANA;;AAKA;;AAQA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AA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OAAR,GAAkBiB,MAAlB;AACA,KAPF;AAQC,IAAA,eAAe,EAAG,MAAM;AACvB7D,MAAAA,OAAO,CAAC4C,OAAR,GAAkB,KAAlB;AACA;AAVF,IAND,CArBF,CAdD,CADD;AA2DA;AACA;;AAEc,SAASkB,cAAT,QAIX;AAAA,MAJoC;AACvCC,IAAAA,QADuC;AAEvCnE,IAAAA,qBAFuC;AAGvCC,IAAAA;AAHuC,GAIpC;AACH,QAAMmE,SAAS,GAAG,qBAAazD,MAAF,IAAc;AAC1C,WAAOA,MAAM,CAAER,YAAF,CAAN,CAA2BkE,4BAA3B,EAAP;AACA,GAFiB,EAEf,EAFe,CAAlB;AAIA,SACC,4BAAC,qBAAD,CAAuB,QAAvB;AAAgC,IAAA,KAAK,EAAG,qBAAQ,KAAR;AAAxC,KACGD,SAAS,IACV,4BAAC,qBAAD;AACC,IAAA,qBAAqB,EAAGpE,qBADzB;AAEC,IAAA,oBAAoB,EAAGC;AAFxB,IAFF,EAOGkE,QAPH,CADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseCallback,\n\tuseRef,\n\tuseMemo,\n\tcreateContext,\n\tuseContext,\n} from '@wordpress/element';\nimport { Popover, __unstableMotion as motion } from '@wordpress/components';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\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\nexport const InsertionPointOpenRef = createContext();\n\nfunction InsertionPointPopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst ref = useRef();\n\tconst {\n\t\torientation,\n\t\tpreviousClientId,\n\t\tnextClientId,\n\t\trootClientId,\n\t\tisInserterShown,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockOrder,\n\t\t\tgetBlockListSettings,\n\t\t\tgetBlockInsertionPoint,\n\t\t\tisBlockBeingDragged,\n\t\t\tgetPreviousBlockClientId,\n\t\t\tgetNextBlockClientId,\n\t\t} = select( blockEditorStore );\n\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet _previousClientId = order[ insertionPoint.index - 1 ];\n\t\tlet _nextClientId = order[ insertionPoint.index ];\n\n\t\twhile ( isBlockBeingDragged( _previousClientId ) ) {\n\t\t\t_previousClientId = getPreviousBlockClientId( _previousClientId );\n\t\t}\n\n\t\twhile ( isBlockBeingDragged( _nextClientId ) ) {\n\t\t\t_nextClientId = getNextBlockClientId( _nextClientId );\n\t\t}\n\n\t\treturn {\n\t\t\tpreviousClientId: _previousClientId,\n\t\t\tnextClientId: _nextClientId,\n\t\t\torientation:\n\t\t\t\tgetBlockListSettings( insertionPoint.rootClientId )\n\t\t\t\t\t?.orientation || 'vertical',\n\t\t\trootClientId: insertionPoint.rootClientId,\n\t\t\tisInserterShown: insertionPoint?.__unstableWithInserter,\n\t\t};\n\t}, [] );\n\tconst previousElement = useBlockElement( previousClientId );\n\tconst nextElement = useBlockElement( nextClientId );\n\tconst isVertical = orientation === 'vertical';\n\tconst style = useMemo( () => {\n\t\tif ( ! previousElement && ! nextElement ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst previousRect = previousElement\n\t\t\t? previousElement.getBoundingClientRect()\n\t\t\t: null;\n\t\tconst nextRect = nextElement\n\t\t\t? nextElement.getBoundingClientRect()\n\t\t\t: null;\n\n\t\tif ( isVertical ) {\n\t\t\treturn {\n\t\t\t\twidth: previousElement\n\t\t\t\t\t? previousElement.offsetWidth\n\t\t\t\t\t: nextElement.offsetWidth,\n\t\t\t\theight:\n\t\t\t\t\tnextRect && previousRect\n\t\t\t\t\t\t? nextRect.top - previousRect.bottom\n\t\t\t\t\t\t: 0,\n\t\t\t};\n\t\t}\n\n\t\tlet width = 0;\n\t\tif ( previousRect && nextRect ) {\n\t\t\twidth = isRTL()\n\t\t\t\t? previousRect.left - nextRect.right\n\t\t\t\t: nextRect.left - previousRect.right;\n\t\t}\n\n\t\treturn {\n\t\t\twidth,\n\t\t\theight: previousElement\n\t\t\t\t? previousElement.offsetHeight\n\t\t\t\t: nextElement.offsetHeight,\n\t\t};\n\t}, [ previousElement, nextElement ] );\n\n\tconst getAnchorRect = useCallback( () => {\n\t\tif ( ! previousElement && ! nextElement ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst { ownerDocument } = previousElement || nextElement;\n\n\t\tconst previousRect = previousElement\n\t\t\t? previousElement.getBoundingClientRect()\n\t\t\t: null;\n\t\tconst nextRect = nextElement\n\t\t\t? nextElement.getBoundingClientRect()\n\t\t\t: null;\n\n\t\tif ( isVertical ) {\n\t\t\tif ( isRTL() ) {\n\t\t\t\treturn {\n\t\t\t\t\ttop: previousRect ? previousRect.bottom : nextRect.top,\n\t\t\t\t\tleft: previousRect ? previousRect.right : nextRect.right,\n\t\t\t\t\tright: previousRect ? previousRect.left : nextRect.left,\n\t\t\t\t\tbottom: nextRect ? nextRect.top : previousRect.bottom,\n\t\t\t\t\townerDocument,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttop: previousRect ? previousRect.bottom : nextRect.top,\n\t\t\t\tleft: previousRect ? previousRect.left : nextRect.left,\n\t\t\t\tright: previousRect ? previousRect.right : nextRect.right,\n\t\t\t\tbottom: nextRect ? nextRect.top : previousRect.bottom,\n\t\t\t\townerDocument,\n\t\t\t};\n\t\t}\n\n\t\tif ( isRTL() ) {\n\t\t\treturn {\n\t\t\t\ttop: previousRect ? previousRect.top : nextRect.top,\n\t\t\t\tleft: previousRect ? previousRect.left : nextRect.right,\n\t\t\t\tright: nextRect ? nextRect.right : previousRect.left,\n\t\t\t\tbottom: previousRect ? previousRect.bottom : nextRect.bottom,\n\t\t\t\townerDocument,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\ttop: previousRect ? previousRect.top : nextRect.top,\n\t\t\tleft: previousRect ? previousRect.right : nextRect.left,\n\t\t\tright: nextRect ? nextRect.left : previousRect.right,\n\t\t\tbottom: previousRect ? previousRect.bottom : nextRect.bottom,\n\t\t\townerDocument,\n\t\t};\n\t}, [ previousElement, nextElement ] );\n\n\tconst popoverScrollRef = usePopoverScroll( __unstableContentRef );\n\tconst disableMotion = useReducedMotion();\n\n\tconst className = classnames(\n\t\t'block-editor-block-list__insertion-point',\n\t\t'is-' + orientation\n\t);\n\n\tfunction onClick( event ) {\n\t\tif ( event.target === ref.current && nextClientId ) {\n\t\t\tselectBlock( nextClientId, -1 );\n\t\t}\n\t}\n\n\tfunction onFocus( event ) {\n\t\t// Only handle click on the wrapper specifically, and not an event\n\t\t// bubbled from the inserter itself.\n\t\tif ( event.target !== ref.current ) {\n\t\t\topenRef.current = true;\n\t\t}\n\t}\n\n\t// Only show the in-between inserter between blocks, so when there's a\n\t// previous and a next element.\n\tconst showInsertionPointInserter =\n\t\tpreviousElement && nextElement && isInserterShown;\n\n\t// Define animation variants for the line element.\n\tconst horizontalLine = {\n\t\tstart: {\n\t\t\twidth: 0,\n\t\t\ttop: '50%',\n\t\t\tbottom: '50%',\n\t\t\tx: 0,\n\t\t},\n\t\trest: {\n\t\t\twidth: 4,\n\t\t\ttop: 0,\n\t\t\tbottom: 0,\n\t\t\tx: -2,\n\t\t},\n\t\thover: {\n\t\t\twidth: 4,\n\t\t\ttop: 0,\n\t\t\tbottom: 0,\n\t\t\tx: -2,\n\t\t},\n\t};\n\tconst verticalLine = {\n\t\tstart: {\n\t\t\theight: 0,\n\t\t\tleft: '50%',\n\t\t\tright: '50%',\n\t\t\ty: 0,\n\t\t},\n\t\trest: {\n\t\t\theight: 4,\n\t\t\tleft: 0,\n\t\t\tright: 0,\n\t\t\ty: -2,\n\t\t},\n\t\thover: {\n\t\t\theight: 4,\n\t\t\tleft: 0,\n\t\t\tright: 0,\n\t\t\ty: -2,\n\t\t},\n\t};\n\tconst lineVariants = {\n\t\t// Initial position starts from the center and invisible.\n\t\tstart: {\n\t\t\t...( ! isVertical ? horizontalLine.start : verticalLine.start ),\n\t\t\topacity: 0,\n\t\t},\n\t\t// The line expands to fill the container. If the inserter is visible it\n\t\t// is delayed so it appears orchestrated.\n\t\trest: {\n\t\t\t...( ! isVertical ? horizontalLine.rest : verticalLine.rest ),\n\t\t\topacity: 1,\n\t\t\tborderRadius: '2px',\n\t\t\ttransition: { delay: showInsertionPointInserter ? 0.4 : 0 },\n\t\t},\n\t\thover: {\n\t\t\t...( ! isVertical ? horizontalLine.hover : verticalLine.hover ),\n\t\t\topacity: 1,\n\t\t\tborderRadius: '2px',\n\t\t\ttransition: { delay: 0.4 },\n\t\t},\n\t};\n\n\tconst inserterVariants = {\n\t\tstart: {\n\t\t\tscale: disableMotion ? 1 : 0,\n\t\t},\n\t\trest: {\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: 0.2 },\n\t\t},\n\t};\n\n\t/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n\t// While ideally it would be enough to capture the\n\t// bubbling focus event from the Inserter, due to the\n\t// characteristics of click focusing of `button`s in\n\t// Firefox and Safari, it is not reliable.\n\t//\n\t// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n\treturn (\n\t\t<Popover\n\t\t\tref={ popoverScrollRef }\n\t\t\tnoArrow\n\t\t\tanimate={ false }\n\t\t\tgetAnchorRect={ getAnchorRect }\n\t\t\tfocusOnMount={ false }\n\t\t\tclassName=\"block-editor-block-list__insertion-point-popover\"\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// Forces a remount of the popover when its position changes\n\t\t\t// This makes sure the popover doesn't animate from its previous position.\n\t\t\tkey={ nextClientId + '--' + rootClientId }\n\t\t>\n\t\t\t<motion.div\n\t\t\t\tlayout={ ! disableMotion }\n\t\t\t\tinitial={ disableMotion ? 'rest' : 'start' }\n\t\t\t\tanimate=\"rest\"\n\t\t\t\twhileHover=\"hover\"\n\t\t\t\twhileTap=\"pressed\"\n\t\t\t\texit=\"start\"\n\t\t\t\tref={ ref }\n\t\t\t\ttabIndex={ -1 }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tonFocus={ onFocus }\n\t\t\t\tclassName={ classnames( className, {\n\t\t\t\t\t'is-with-inserter': showInsertionPointInserter,\n\t\t\t\t} ) }\n\t\t\t\tstyle={ style }\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ lineVariants }\n\t\t\t\t\tclassName=\"block-editor-block-list__insertion-point-indicator\"\n\t\t\t\t/>\n\t\t\t\t{ showInsertionPointInserter && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tvariants={ inserterVariants }\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'block-editor-block-list__insertion-point-inserter'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Inserter\n\t\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\t\tclientId={ nextClientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t\t\tonToggle={ ( isOpen ) => {\n\t\t\t\t\t\t\t\topenRef.current = isOpen;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonSelectOrClose={ () => {\n\t\t\t\t\t\t\t\topenRef.current = false;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</motion.div>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t</Popover>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n}\n\nexport default function InsertionPoint( {\n\tchildren,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst isVisible = useSelect( ( select ) => {\n\t\treturn select( blockEditorStore ).isBlockInsertionPointVisible();\n\t}, [] );\n\n\treturn (\n\t\t<InsertionPointOpenRef.Provider value={ useRef( false ) }>\n\t\t\t{ isVisible && (\n\t\t\t\t<InsertionPointPopover\n\t\t\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ children }\n\t\t</InsertionPointOpenRef.Provider>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/insertion-point.js"],"names":["InsertionPointOpenRef","InsertionPointPopover","__unstablePopoverSlot","__unstableContentRef","selectBlock","hideInsertionPoint","blockEditorStore","openRef","ref","orientation","previousClientId","nextClientId","rootClientId","isInserterShown","select","getBlockOrder","getBlockListSettings","getBlockInsertionPoint","isBlockBeingDragged","getPreviousBlockClientId","getNextBlockClientId","insertionPoint","order","length","_previousClientId","index","_nextClientId","__unstableWithInserter","previousElement","nextElement","isVertical","style","previousRect","getBoundingClientRect","nextRect","width","offsetWidth","height","top","bottom","left","right","offsetHeight","getAnchorRect","ownerDocument","popoverScrollRef","disableMotion","className","onClick","event","target","current","onFocus","maybeHideInserterPoint","showInsertionPointInserter","horizontalLine","start","x","rest","hover","verticalLine","y","lineVariants","opacity","borderRadius","transition","delay","inserterVariants","scale","isOpen","InsertionPoint","children","isVisible","isBlockInsertionPointVisible"],"mappings":";;;;;;;;;;AASA;;AANA;;AAKA;;AAQA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AA1BA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;AAMO,MAAMA,qBAAq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AA,QAAQ,EAAC,eADV;AAEC,IAAA,QAAQ,EAAGxD,YAFZ;AAGC,IAAA,YAAY,EAAGC,YAHhB;AAIC,IAAA,qBAAqB,MAJtB;AAKC,IAAA,QAAQ,EAAKyD,MAAF,IAAc;AACxB9D,MAAAA,OAAO,CAAC4C,OAAR,GAAkBkB,MAAlB;AACA,KAPF;AAQC,IAAA,eAAe,EAAG,MAAM;AACvB9D,MAAAA,OAAO,CAAC4C,OAAR,GAAkB,KAAlB;AACA;AAVF,IAND,CAtBF,CAdD,CADD;AA4DA;AACA;;AAEc,SAASmB,cAAT,QAIX;AAAA,MAJoC;AACvCC,IAAAA,QADuC;AAEvCrE,IAAAA,qBAFuC;AAGvCC,IAAAA;AAHuC,GAIpC;AACH,QAAMqE,SAAS,GAAG,qBAAa1D,MAAF,IAAc;AAC1C,WAAOA,MAAM,CAAER,YAAF,CAAN,CAA2BmE,4BAA3B,EAAP;AACA,GAFiB,EAEf,EAFe,CAAlB;AAIA,SACC,4BAAC,qBAAD,CAAuB,QAAvB;AAAgC,IAAA,KAAK,EAAG,qBAAQ,KAAR;AAAxC,KACGD,SAAS,IACV,4BAAC,qBAAD;AACC,IAAA,qBAAqB,EAAGtE,qBADzB;AAEC,IAAA,oBAAoB,EAAGC;AAFxB,IAFF,EAOGoE,QAPH,CADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseCallback,\n\tuseRef,\n\tuseMemo,\n\tcreateContext,\n\tuseContext,\n} from '@wordpress/element';\nimport { Popover, __unstableMotion as motion } from '@wordpress/components';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\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\nexport const InsertionPointOpenRef = createContext();\n\nfunction InsertionPointPopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst { selectBlock, hideInsertionPoint } = useDispatch( blockEditorStore );\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst ref = useRef();\n\tconst {\n\t\torientation,\n\t\tpreviousClientId,\n\t\tnextClientId,\n\t\trootClientId,\n\t\tisInserterShown,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockOrder,\n\t\t\tgetBlockListSettings,\n\t\t\tgetBlockInsertionPoint,\n\t\t\tisBlockBeingDragged,\n\t\t\tgetPreviousBlockClientId,\n\t\t\tgetNextBlockClientId,\n\t\t} = select( blockEditorStore );\n\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet _previousClientId = order[ insertionPoint.index - 1 ];\n\t\tlet _nextClientId = order[ insertionPoint.index ];\n\n\t\twhile ( isBlockBeingDragged( _previousClientId ) ) {\n\t\t\t_previousClientId = getPreviousBlockClientId( _previousClientId );\n\t\t}\n\n\t\twhile ( isBlockBeingDragged( _nextClientId ) ) {\n\t\t\t_nextClientId = getNextBlockClientId( _nextClientId );\n\t\t}\n\n\t\treturn {\n\t\t\tpreviousClientId: _previousClientId,\n\t\t\tnextClientId: _nextClientId,\n\t\t\torientation:\n\t\t\t\tgetBlockListSettings( insertionPoint.rootClientId )\n\t\t\t\t\t?.orientation || 'vertical',\n\t\t\trootClientId: insertionPoint.rootClientId,\n\t\t\tisInserterShown: insertionPoint?.__unstableWithInserter,\n\t\t};\n\t}, [] );\n\tconst previousElement = useBlockElement( previousClientId );\n\tconst nextElement = useBlockElement( nextClientId );\n\tconst isVertical = orientation === 'vertical';\n\tconst style = useMemo( () => {\n\t\tif ( ! previousElement && ! nextElement ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst previousRect = previousElement\n\t\t\t? previousElement.getBoundingClientRect()\n\t\t\t: null;\n\t\tconst nextRect = nextElement\n\t\t\t? nextElement.getBoundingClientRect()\n\t\t\t: null;\n\n\t\tif ( isVertical ) {\n\t\t\treturn {\n\t\t\t\twidth: previousElement\n\t\t\t\t\t? previousElement.offsetWidth\n\t\t\t\t\t: nextElement.offsetWidth,\n\t\t\t\theight:\n\t\t\t\t\tnextRect && previousRect\n\t\t\t\t\t\t? nextRect.top - previousRect.bottom\n\t\t\t\t\t\t: 0,\n\t\t\t};\n\t\t}\n\n\t\tlet width = 0;\n\t\tif ( previousRect && nextRect ) {\n\t\t\twidth = isRTL()\n\t\t\t\t? previousRect.left - nextRect.right\n\t\t\t\t: nextRect.left - previousRect.right;\n\t\t}\n\n\t\treturn {\n\t\t\twidth,\n\t\t\theight: previousElement\n\t\t\t\t? previousElement.offsetHeight\n\t\t\t\t: nextElement.offsetHeight,\n\t\t};\n\t}, [ previousElement, nextElement ] );\n\n\tconst getAnchorRect = useCallback( () => {\n\t\tif ( ! previousElement && ! nextElement ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst { ownerDocument } = previousElement || nextElement;\n\n\t\tconst previousRect = previousElement\n\t\t\t? previousElement.getBoundingClientRect()\n\t\t\t: null;\n\t\tconst nextRect = nextElement\n\t\t\t? nextElement.getBoundingClientRect()\n\t\t\t: null;\n\n\t\tif ( isVertical ) {\n\t\t\tif ( isRTL() ) {\n\t\t\t\treturn {\n\t\t\t\t\ttop: previousRect ? previousRect.bottom : nextRect.top,\n\t\t\t\t\tleft: previousRect ? previousRect.right : nextRect.right,\n\t\t\t\t\tright: previousRect ? previousRect.left : nextRect.left,\n\t\t\t\t\tbottom: nextRect ? nextRect.top : previousRect.bottom,\n\t\t\t\t\townerDocument,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttop: previousRect ? previousRect.bottom : nextRect.top,\n\t\t\t\tleft: previousRect ? previousRect.left : nextRect.left,\n\t\t\t\tright: previousRect ? previousRect.right : nextRect.right,\n\t\t\t\tbottom: nextRect ? nextRect.top : previousRect.bottom,\n\t\t\t\townerDocument,\n\t\t\t};\n\t\t}\n\n\t\tif ( isRTL() ) {\n\t\t\treturn {\n\t\t\t\ttop: previousRect ? previousRect.top : nextRect.top,\n\t\t\t\tleft: previousRect ? previousRect.left : nextRect.right,\n\t\t\t\tright: nextRect ? nextRect.right : previousRect.left,\n\t\t\t\tbottom: previousRect ? previousRect.bottom : nextRect.bottom,\n\t\t\t\townerDocument,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\ttop: previousRect ? previousRect.top : nextRect.top,\n\t\t\tleft: previousRect ? previousRect.right : nextRect.left,\n\t\t\tright: nextRect ? nextRect.left : previousRect.right,\n\t\t\tbottom: previousRect ? previousRect.bottom : nextRect.bottom,\n\t\t\townerDocument,\n\t\t};\n\t}, [ previousElement, nextElement ] );\n\n\tconst popoverScrollRef = usePopoverScroll( __unstableContentRef );\n\tconst disableMotion = useReducedMotion();\n\n\tconst className = classnames(\n\t\t'block-editor-block-list__insertion-point',\n\t\t'is-' + orientation\n\t);\n\n\tfunction onClick( event ) {\n\t\tif ( event.target === ref.current && nextClientId ) {\n\t\t\tselectBlock( nextClientId, -1 );\n\t\t}\n\t}\n\n\tfunction onFocus( event ) {\n\t\t// Only handle click on the wrapper specifically, and not an event\n\t\t// bubbled from the inserter itself.\n\t\tif ( event.target !== ref.current ) {\n\t\t\topenRef.current = true;\n\t\t}\n\t}\n\n\tfunction maybeHideInserterPoint( event ) {\n\t\t// Only hide the inserter if it's triggered on the wrapper,\n\t\t// and the inserter is not open.\n\t\tif ( event.target === ref.current && ! openRef.current ) {\n\t\t\thideInsertionPoint();\n\t\t}\n\t}\n\n\t// Only show the in-between inserter between blocks, so when there's a\n\t// previous and a next element.\n\tconst showInsertionPointInserter =\n\t\tpreviousElement && nextElement && isInserterShown;\n\n\t// Define animation variants for the line element.\n\tconst horizontalLine = {\n\t\tstart: {\n\t\t\twidth: 0,\n\t\t\ttop: '50%',\n\t\t\tbottom: '50%',\n\t\t\tx: 0,\n\t\t},\n\t\trest: {\n\t\t\twidth: 4,\n\t\t\ttop: 0,\n\t\t\tbottom: 0,\n\t\t\tx: -2,\n\t\t},\n\t\thover: {\n\t\t\twidth: 4,\n\t\t\ttop: 0,\n\t\t\tbottom: 0,\n\t\t\tx: -2,\n\t\t},\n\t};\n\tconst verticalLine = {\n\t\tstart: {\n\t\t\theight: 0,\n\t\t\tleft: '50%',\n\t\t\tright: '50%',\n\t\t\ty: 0,\n\t\t},\n\t\trest: {\n\t\t\theight: 4,\n\t\t\tleft: 0,\n\t\t\tright: 0,\n\t\t\ty: -2,\n\t\t},\n\t\thover: {\n\t\t\theight: 4,\n\t\t\tleft: 0,\n\t\t\tright: 0,\n\t\t\ty: -2,\n\t\t},\n\t};\n\tconst lineVariants = {\n\t\t// Initial position starts from the center and invisible.\n\t\tstart: {\n\t\t\t...( ! isVertical ? horizontalLine.start : verticalLine.start ),\n\t\t\topacity: 0,\n\t\t},\n\t\t// The line expands to fill the container. If the inserter is visible it\n\t\t// is delayed so it appears orchestrated.\n\t\trest: {\n\t\t\t...( ! isVertical ? horizontalLine.rest : verticalLine.rest ),\n\t\t\topacity: 1,\n\t\t\tborderRadius: '2px',\n\t\t\ttransition: { delay: showInsertionPointInserter ? 0.4 : 0 },\n\t\t},\n\t\thover: {\n\t\t\t...( ! isVertical ? horizontalLine.hover : verticalLine.hover ),\n\t\t\topacity: 1,\n\t\t\tborderRadius: '2px',\n\t\t\ttransition: { delay: 0.4 },\n\t\t},\n\t};\n\n\tconst inserterVariants = {\n\t\tstart: {\n\t\t\tscale: disableMotion ? 1 : 0,\n\t\t},\n\t\trest: {\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: 0.2 },\n\t\t},\n\t};\n\n\t/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n\t// While ideally it would be enough to capture the\n\t// bubbling focus event from the Inserter, due to the\n\t// characteristics of click focusing of `button`s in\n\t// Firefox and Safari, it is not reliable.\n\t//\n\t// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n\treturn (\n\t\t<Popover\n\t\t\tref={ popoverScrollRef }\n\t\t\tnoArrow\n\t\t\tanimate={ false }\n\t\t\tgetAnchorRect={ getAnchorRect }\n\t\t\tfocusOnMount={ false }\n\t\t\tclassName=\"block-editor-block-list__insertion-point-popover\"\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// Forces a remount of the popover when its position changes\n\t\t\t// This makes sure the popover doesn't animate from its previous position.\n\t\t\tkey={ nextClientId + '--' + rootClientId }\n\t\t>\n\t\t\t<motion.div\n\t\t\t\tlayout={ ! disableMotion }\n\t\t\t\tinitial={ disableMotion ? 'rest' : 'start' }\n\t\t\t\tanimate=\"rest\"\n\t\t\t\twhileHover=\"hover\"\n\t\t\t\twhileTap=\"pressed\"\n\t\t\t\texit=\"start\"\n\t\t\t\tref={ ref }\n\t\t\t\ttabIndex={ -1 }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tonFocus={ onFocus }\n\t\t\t\tclassName={ classnames( className, {\n\t\t\t\t\t'is-with-inserter': showInsertionPointInserter,\n\t\t\t\t} ) }\n\t\t\t\tonHoverEnd={ maybeHideInserterPoint }\n\t\t\t\tstyle={ style }\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ lineVariants }\n\t\t\t\t\tclassName=\"block-editor-block-list__insertion-point-indicator\"\n\t\t\t\t/>\n\t\t\t\t{ showInsertionPointInserter && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tvariants={ inserterVariants }\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'block-editor-block-list__insertion-point-inserter'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Inserter\n\t\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\t\tclientId={ nextClientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t\t\tonToggle={ ( isOpen ) => {\n\t\t\t\t\t\t\t\topenRef.current = isOpen;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonSelectOrClose={ () => {\n\t\t\t\t\t\t\t\topenRef.current = false;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</motion.div>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t</Popover>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n}\n\nexport default function InsertionPoint( {\n\tchildren,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst isVisible = useSelect( ( select ) => {\n\t\treturn select( blockEditorStore ).isBlockInsertionPointVisible();\n\t}, [] );\n\n\treturn (\n\t\t<InsertionPointOpenRef.Provider value={ useRef( false ) }>\n\t\t\t{ isVisible && (\n\t\t\t\t<InsertionPointPopover\n\t\t\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ children }\n\t\t</InsertionPointOpenRef.Provider>\n\t);\n}\n"]}
|
|
@@ -97,7 +97,8 @@ function ButtonBlockAppender(_ref, ref) {
|
|
|
97
97
|
|
|
98
98
|
const ButtonBlockerAppender = (0, _element.forwardRef)((props, ref) => {
|
|
99
99
|
(0, _deprecated.default)(`wp.blockEditor.ButtonBlockerAppender`, {
|
|
100
|
-
alternative: 'wp.blockEditor.ButtonBlockAppender'
|
|
100
|
+
alternative: 'wp.blockEditor.ButtonBlockAppender',
|
|
101
|
+
since: '5.9'
|
|
101
102
|
});
|
|
102
103
|
return ButtonBlockAppender(props, ref);
|
|
103
104
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/button-block-appender/index.js"],"names":["ButtonBlockAppender","ref","rootClientId","className","onFocus","tabIndex","onToggle","disabled","isOpen","blockTitle","hasSingleBlockType","label","isToggleButton","inserterButton","undefined","plus","ButtonBlockerAppender","props","alternative"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AACA;;AAKA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAGA,SAASA,mBAAT,OAECC,GAFD,EAGE;AAAA,MAFD;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,SAAhB;AAA2BC,IAAAA,OAA3B;AAAoCC,IAAAA;AAApC,GAEC;AACD,SACC,4BAAC,iBAAD;AACC,IAAA,QAAQ,EAAC,eADV;AAEC,IAAA,YAAY,EAAGH,YAFhB;AAGC,IAAA,qBAAqB,MAHtB;AAIC,IAAA,YAAY,EAAG,SAMR;AAAA,UANU;AAChBI,QAAAA,QADgB;AAEhBC,QAAAA,QAFgB;AAGhBC,QAAAA,MAHgB;AAIhBC,QAAAA,UAJgB;AAKhBC,QAAAA;AALgB,OAMV;AACN,UAAIC,KAAJ;;AACA,UAAKD,kBAAL,EAA0B;AACzBC,QAAAA,KAAK,GAAG,oBACP;AACA,sBAAI,QAAJ,EAAc,qCAAd,CAFO,EAGPF,UAHO,CAAR;AAKA,OAND,MAMO;AACNE,QAAAA,KAAK,GAAG,cACP,WADO,EAEP,yCAFO,CAAR;AAIA;;AACD,YAAMC,cAAc,GAAG,CAAEF,kBAAzB;AAEA,UAAIG,cAAc,GACjB,4BAAC,kBAAD;AACC,QAAA,GAAG,EAAGZ,GADP;AAEC,QAAA,OAAO,EAAGG,OAFX;AAGC,QAAA,QAAQ,EAAGC,QAHZ;AAIC,QAAA,SAAS,EAAG,yBACXF,SADW,EAEX,oCAFW,CAJb;AAQC,QAAA,OAAO,EAAGG,QARX;AASC,yBAAgBM,cAAc,GAAG,MAAH,GAAYE,SAT3C;AAUC,yBAAgBF,cAAc,GAAGJ,MAAH,GAAYM,SAV3C;AAWC,QAAA,QAAQ,EAAGP,QAXZ;AAYC,QAAA,KAAK,EAAGI;AAZT,SAcG,CAAED,kBAAF,IACD,4BAAC,0BAAD;AAAgB,QAAA,EAAE,EAAC;AAAnB,SAA4BC,KAA5B,CAfF,EAiBC,4BAAC,WAAD;AAAM,QAAA,IAAI,EAAGI;AAAb,QAjBD,CADD;;AAsBA,UAAKH,cAAc,IAAIF,kBAAvB,EAA4C;AAC3CG,QAAAA,cAAc,GACb,4BAAC,mBAAD;AAAS,UAAA,IAAI,EAAGF;AAAhB,WAA0BE,cAA1B,CADD;AAGA;;AACD,aAAOA,cAAP;AACA,KAtDF;AAuDC,IAAA,UAAU;AAvDX,IADD;AA2DA;AAED;AACA;AACA;AACA;AACA;;;AACO,MAAMG,qBAAqB,GAAG,yBAAY,CAAEC,KAAF,EAAShB,GAAT,KAAkB;AAClE,2BAAa,sCAAb,EAAoD;AACnDiB,IAAAA,WAAW,EAAE;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/button-block-appender/index.js"],"names":["ButtonBlockAppender","ref","rootClientId","className","onFocus","tabIndex","onToggle","disabled","isOpen","blockTitle","hasSingleBlockType","label","isToggleButton","inserterButton","undefined","plus","ButtonBlockerAppender","props","alternative","since"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AACA;;AAKA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAGA,SAASA,mBAAT,OAECC,GAFD,EAGE;AAAA,MAFD;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,SAAhB;AAA2BC,IAAAA,OAA3B;AAAoCC,IAAAA;AAApC,GAEC;AACD,SACC,4BAAC,iBAAD;AACC,IAAA,QAAQ,EAAC,eADV;AAEC,IAAA,YAAY,EAAGH,YAFhB;AAGC,IAAA,qBAAqB,MAHtB;AAIC,IA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AAShB,GAAT,KAAkB;AAClE,2BAAa,sCAAb,EAAoD;AACnDiB,IAAAA,WAAW,EAAE,oCADsC;AAEnDC,IAAAA,KAAK,EAAE;AAF4C,GAApD;AAKA,SAAOnB,mBAAmB,CAAEiB,KAAF,EAAShB,GAAT,CAA1B;AACA,CAPoC,CAA9B;AASP;AACA;AACA;;;;eACe,yBAAYD,mBAAZ,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Tooltip, VisuallyHidden } from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\nimport { _x, sprintf } from '@wordpress/i18n';\nimport { Icon, plus } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\n\nfunction ButtonBlockAppender(\n\t{ rootClientId, className, onFocus, tabIndex },\n\tref\n) {\n\treturn (\n\t\t<Inserter\n\t\t\tposition=\"bottom center\"\n\t\t\trootClientId={ rootClientId }\n\t\t\t__experimentalIsQuick\n\t\t\trenderToggle={ ( {\n\t\t\t\tonToggle,\n\t\t\t\tdisabled,\n\t\t\t\tisOpen,\n\t\t\t\tblockTitle,\n\t\t\t\thasSingleBlockType,\n\t\t\t} ) => {\n\t\t\t\tlet label;\n\t\t\t\tif ( hasSingleBlockType ) {\n\t\t\t\t\tlabel = sprintf(\n\t\t\t\t\t\t// translators: %s: the name of the block when there is only one\n\t\t\t\t\t\t_x( 'Add %s', 'directly add the only allowed block' ),\n\t\t\t\t\t\tblockTitle\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tlabel = _x(\n\t\t\t\t\t\t'Add block',\n\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst isToggleButton = ! hasSingleBlockType;\n\n\t\t\t\tlet inserterButton = (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t'block-editor-button-block-appender'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\taria-haspopup={ isToggleButton ? 'true' : undefined }\n\t\t\t\t\t\taria-expanded={ isToggleButton ? isOpen : undefined }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! hasSingleBlockType && (\n\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">{ label }</VisuallyHidden>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<Icon icon={ plus } />\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\n\t\t\t\tif ( isToggleButton || hasSingleBlockType ) {\n\t\t\t\t\tinserterButton = (\n\t\t\t\t\t\t<Tooltip text={ label }>{ inserterButton }</Tooltip>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn inserterButton;\n\t\t\t} }\n\t\t\tisAppender\n\t\t/>\n\t);\n}\n\n/**\n * Use `ButtonBlockAppender` instead.\n *\n * @deprecated\n */\nexport const ButtonBlockerAppender = forwardRef( ( props, ref ) => {\n\tdeprecated( `wp.blockEditor.ButtonBlockerAppender`, {\n\t\talternative: 'wp.blockEditor.ButtonBlockAppender',\n\t\tsince: '5.9',\n\t} );\n\n\treturn ButtonBlockAppender( props, ref );\n} );\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/button-block-appender/README.md\n */\nexport default forwardRef( ButtonBlockAppender );\n"]}
|
|
@@ -99,6 +99,7 @@ function ColorGradientControlInner(_ref) {
|
|
|
99
99
|
gradients,
|
|
100
100
|
disableCustomGradients,
|
|
101
101
|
__experimentalHasMultipleOrigins: __experimentalHasMultipleOrigins,
|
|
102
|
+
__experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
|
|
102
103
|
clearable: clearable
|
|
103
104
|
}))));
|
|
104
105
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/colors-gradients/control.js"],"names":["colorsAndGradientKeys","ColorGradientControlInner","colors","gradients","disableCustomColors","disableCustomGradients","__experimentalHasMultipleOrigins","__experimentalIsRenderedInSidebar","className","label","onColorChange","onGradientChange","colorValue","gradientValue","clearable","showTitle","enableAlpha","canChooseAColor","canChooseAGradient","currentTab","setCurrentTab","newColor","newGradient","ColorGradientControlSelect","props","colorGradientSettings","ColorGradientControl","key","hasOwnProperty"],"mappings":";;;;;;;;;AASA;;;;AANA;;AACA;;AAMA;;AAQA;;AAKA;;AAvBA;AACA;AACA;;AAIA;AACA;AACA;;AAYA;AACA;AACA;AAGA,MAAMA,qBAAqB,GAAG,CAC7B,QAD6B,EAE7B,qBAF6B,EAG7B,WAH6B,EAI7B,wBAJ6B,CAA9B;;AAOA,SAASC,yBAAT,OAgBI;AAAA,MAhBgC;AACnCC,IAAAA,MADmC;AAEnCC,IAAAA,SAFmC;AAGnCC,IAAAA,mBAHmC;AAInCC,IAAAA,sBAJmC;AAKnCC,IAAAA,gCALmC;AAMnCC,IAAAA,iCANmC;AAOnCC,IAAAA,SAPmC;AAQnCC,IAAAA,KARmC;AASnCC,IAAAA,aATmC;AAUnCC,IAAAA,gBAVmC;AAWnCC,IAAAA,UAXmC;AAYnCC,IAAAA,aAZmC;AAanCC,IAAAA,SAbmC;AAcnCC,IAAAA,SAAS,GAAG,IAduB;AAenCC,IAAAA;AAfmC,GAgBhC;AACH,QAAMC,eAAe,GACpBP,aAAa,KAAM,CAAE,qBAASR,MAAT,CAAF,IAAuB,CAAEE,mBAA/B,CADd;AAEA,QAAMc,kBAAkB,GACvBP,gBAAgB,KACd,CAAE,qBAASR,SAAT,CAAF,IAA0B,CAAEE,sBADd,CADjB;AAGA,QAAM,CAAEc,UAAF,EAAcC,aAAd,IAAgC,uBAC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EAkDG,CAAEG,UAAU,KAAK,UAAf,IAA6B,CAAEF,eAAjC,KACD,4BAAC,0BAAD;AACC,IAAA,KAAK,EAAGJ,aADT;AAEC,IAAA,QAAQ,EACPI,eAAe,GACVK,WAAF,IAAmB;AACnBX,MAAAA,gBAAgB,CAAEW,WAAF,CAAhB;AACAZ,MAAAA,aAAa;AACZ,KAJW,GAKZC,gBARL;AAUQR,IAAAA,SAVR;AAUmBE,IAAAA,sBAVnB;AAWC,IAAA,gCAAgC,EAC/BC,gCAZF;AAcC,IAAA,SAAS,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/colors-gradients/control.js"],"names":["colorsAndGradientKeys","ColorGradientControlInner","colors","gradients","disableCustomColors","disableCustomGradients","__experimentalHasMultipleOrigins","__experimentalIsRenderedInSidebar","className","label","onColorChange","onGradientChange","colorValue","gradientValue","clearable","showTitle","enableAlpha","canChooseAColor","canChooseAGradient","currentTab","setCurrentTab","newColor","newGradient","ColorGradientControlSelect","props","colorGradientSettings","ColorGradientControl","key","hasOwnProperty"],"mappings":";;;;;;;;;AASA;;;;AANA;;AACA;;AAMA;;AAQA;;AAKA;;AAvBA;AACA;AACA;;AAIA;AACA;AACA;;AAYA;AACA;AACA;AAGA,MAAMA,qBAAqB,GAAG,CAC7B,QAD6B,EAE7B,qBAF6B,EAG7B,WAH6B,EAI7B,wBAJ6B,CAA9B;;AAOA,SAASC,yBAAT,OAgBI;AAAA,MAhBgC;AACnCC,IAAAA,MADmC;AAEnCC,IAAAA,SAFmC;AAGnCC,IAAAA,mBAHmC;AAInCC,IAAAA,sBAJmC;AAKnCC,IAAAA,gCALmC;AAMnCC,IAAAA,iCANmC;AAOnCC,IAAAA,SAPmC;AAQnCC,IAAAA,KARmC;AASnCC,IAAAA,aATmC;AAUnCC,IAAAA,gBAVmC;AAWnCC,IAAAA,UAXmC;AAYnCC,IAAAA,aAZmC;AAanCC,IAAAA,SAbmC;AAcnCC,IAAAA,SAAS,GAAG,IAduB;AAen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C,CADD,EAEE;AACD,WAAO,4BAAC,yBAAD,EAAgCH,KAAhC,CAAP;AACA;;AACD,SAAO,4BAAC,0BAAD,EAAiCA,KAAjC,CAAP;AACA;;eAEcE,oB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { every, isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport {\n\tBaseControl,\n\t__experimentalVStack as VStack,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\tColorPalette,\n\tGradientPicker,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../use-setting';\n\nconst colorsAndGradientKeys = [\n\t'colors',\n\t'disableCustomColors',\n\t'gradients',\n\t'disableCustomGradients',\n];\n\nfunction ColorGradientControlInner( {\n\tcolors,\n\tgradients,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\t__experimentalHasMultipleOrigins,\n\t__experimentalIsRenderedInSidebar,\n\tclassName,\n\tlabel,\n\tonColorChange,\n\tonGradientChange,\n\tcolorValue,\n\tgradientValue,\n\tclearable,\n\tshowTitle = true,\n\tenableAlpha,\n} ) {\n\tconst canChooseAColor =\n\t\tonColorChange && ( ! isEmpty( colors ) || ! disableCustomColors );\n\tconst canChooseAGradient =\n\t\tonGradientChange &&\n\t\t( ! isEmpty( gradients ) || ! disableCustomGradients );\n\tconst [ currentTab, setCurrentTab ] = useState(\n\t\tgradientValue ? 'gradient' : !! canChooseAColor && 'color'\n\t);\n\n\tif ( ! canChooseAColor && ! canChooseAGradient ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-color-gradient-control',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t<fieldset>\n\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t{ showTitle && (\n\t\t\t\t\t\t<legend>\n\t\t\t\t\t\t\t<div className=\"block-editor-color-gradient-control__color-indicator\">\n\t\t\t\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</legend>\n\t\t\t\t\t) }\n\t\t\t\t\t{ canChooseAColor && canChooseAGradient && (\n\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\tvalue={ currentTab }\n\t\t\t\t\t\t\tonChange={ setCurrentTab }\n\t\t\t\t\t\t\tlabel={ __( 'Select color type' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"color\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Solid' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"gradient\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Gradient' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ( currentTab === 'color' || ! canChooseAGradient ) && (\n\t\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\t\tvalue={ colorValue }\n\t\t\t\t\t\t\tonChange={\n\t\t\t\t\t\t\t\tcanChooseAGradient\n\t\t\t\t\t\t\t\t\t? ( newColor ) => {\n\t\t\t\t\t\t\t\t\t\t\tonColorChange( newColor );\n\t\t\t\t\t\t\t\t\t\t\tonGradientChange();\n\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t: onColorChange\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t{ ...{ colors, disableCustomColors } }\n\t\t\t\t\t\t\t__experimentalHasMultipleOrigins={\n\t\t\t\t\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclearable={ clearable }\n\t\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ( currentTab === 'gradient' || ! canChooseAColor ) && (\n\t\t\t\t\t\t<GradientPicker\n\t\t\t\t\t\t\tvalue={ gradientValue }\n\t\t\t\t\t\t\tonChange={\n\t\t\t\t\t\t\t\tcanChooseAColor\n\t\t\t\t\t\t\t\t\t? ( newGradient ) => {\n\t\t\t\t\t\t\t\t\t\t\tonGradientChange( newGradient );\n\t\t\t\t\t\t\t\t\t\t\tonColorChange();\n\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t: onGradientChange\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t{ ...{ gradients, disableCustomGradients } }\n\t\t\t\t\t\t\t__experimentalHasMultipleOrigins={\n\t\t\t\t\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclearable={ clearable }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</VStack>\n\t\t\t</fieldset>\n\t\t</BaseControl>\n\t);\n}\n\nfunction ColorGradientControlSelect( props ) {\n\tconst colorGradientSettings = {};\n\tcolorGradientSettings.colors = useSetting( 'color.palette' );\n\tcolorGradientSettings.gradients = useSetting( 'color.gradients' );\n\tcolorGradientSettings.disableCustomColors = ! useSetting( 'color.custom' );\n\tcolorGradientSettings.disableCustomGradients = ! useSetting(\n\t\t'color.customGradient'\n\t);\n\n\treturn (\n\t\t<ColorGradientControlInner\n\t\t\t{ ...{ ...colorGradientSettings, ...props } }\n\t\t/>\n\t);\n}\n\nfunction ColorGradientControl( props ) {\n\tif (\n\t\tevery( colorsAndGradientKeys, ( key ) => props.hasOwnProperty( key ) )\n\t) {\n\t\treturn <ColorGradientControlInner { ...props } />;\n\t}\n\treturn <ColorGradientControlSelect { ...props } />;\n}\n\nexport default ColorGradientControl;\n"]}
|
|
@@ -113,20 +113,61 @@ const PanelColorGradientSettingsInner = _ref3 => {
|
|
|
113
113
|
gradients: gradients,
|
|
114
114
|
settings: settings
|
|
115
115
|
}));
|
|
116
|
+
let dropdownPosition;
|
|
117
|
+
let popoverProps;
|
|
118
|
+
|
|
119
|
+
if (__experimentalIsRenderedInSidebar) {
|
|
120
|
+
dropdownPosition = (0, _i18n.isRTL)() ? 'bottom right' : 'bottom left';
|
|
121
|
+
popoverProps = {
|
|
122
|
+
__unstableForcePosition: true
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
116
126
|
return (0, _element.createElement)(_components.PanelBody, (0, _extends2.default)({
|
|
117
127
|
className: (0, _classnames.default)('block-editor-panel-color-gradient-settings', className),
|
|
118
128
|
title: showTitle ? titleElement : undefined
|
|
119
|
-
}, props),
|
|
120
|
-
|
|
129
|
+
}, props), (0, _element.createElement)(_components.__experimentalItemGroup, {
|
|
130
|
+
isBordered: true,
|
|
131
|
+
isSeparated: true,
|
|
132
|
+
className: "block-editor-panel-color-gradient-settings__item-group"
|
|
133
|
+
}, settings.map((setting, index) => (0, _element.createElement)(_components.Dropdown, {
|
|
134
|
+
position: dropdownPosition,
|
|
135
|
+
popoverProps: popoverProps,
|
|
136
|
+
className: "block-editor-panel-color-gradient-settings__dropdown",
|
|
121
137
|
key: index,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
138
|
+
contentClassName: "block-editor-panel-color-gradient-settings__dropdown-content",
|
|
139
|
+
renderToggle: _ref4 => {
|
|
140
|
+
var _setting$gradientValu;
|
|
141
|
+
|
|
142
|
+
let {
|
|
143
|
+
isOpen,
|
|
144
|
+
onToggle
|
|
145
|
+
} = _ref4;
|
|
146
|
+
return (0, _element.createElement)(_components.__experimentalItem, {
|
|
147
|
+
onClick: onToggle,
|
|
148
|
+
className: (0, _classnames.default)('block-editor-panel-color-gradient-settings__item', {
|
|
149
|
+
'is-open': isOpen
|
|
150
|
+
})
|
|
151
|
+
}, (0, _element.createElement)(_components.__experimentalHStack, {
|
|
152
|
+
justify: "flex-start"
|
|
153
|
+
}, (0, _element.createElement)(_components.ColorIndicator, {
|
|
154
|
+
className: "block-editor-panel-color-gradient-settings__color-indicator",
|
|
155
|
+
colorValue: (_setting$gradientValu = setting.gradientValue) !== null && _setting$gradientValu !== void 0 ? _setting$gradientValu : setting.colorValue
|
|
156
|
+
}), (0, _element.createElement)(_components.FlexItem, null, setting.label)));
|
|
157
|
+
},
|
|
158
|
+
renderContent: () => (0, _element.createElement)(_control.default, (0, _extends2.default)({
|
|
159
|
+
showTitle: false,
|
|
160
|
+
colors,
|
|
161
|
+
gradients,
|
|
162
|
+
disableCustomColors,
|
|
163
|
+
disableCustomGradients,
|
|
164
|
+
__experimentalHasMultipleOrigins,
|
|
165
|
+
__experimentalIsRenderedInSidebar,
|
|
166
|
+
enableAlpha
|
|
167
|
+
}, setting))
|
|
168
|
+
}))), !!children && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.__experimentalSpacer, {
|
|
169
|
+
marginY: 4
|
|
170
|
+
}), " ", children));
|
|
130
171
|
};
|
|
131
172
|
|
|
132
173
|
exports.PanelColorGradientSettingsInner = PanelColorGradientSettingsInner;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/colors-gradients/panel-color-gradient-settings.js"],"names":["colorIndicatorAriaLabel","gradientIndicatorAriaLabel","colorsAndGradientKeys","Indicators","colors","gradients","settings","map","index","colorValue","gradientValue","label","availableColors","availableGradients","ariaLabel","colorObject","toLowerCase","name","gradientObject","PanelColorGradientSettingsInner","className","disableCustomColors","disableCustomGradients","children","title","showTitle","__experimentalHasMultipleOrigins","__experimentalIsRenderedInSidebar","enableAlpha","props","setting","undefined","titleElement","PanelColorGradientSettingsSingleSelect","colorGradientSettings","PanelColorGradientSettingsMultipleSelect","PanelColorGradientSettings","key","hasOwnProperty"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AApBA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AAQA;AACA,MAAMA,uBAAuB,GAAG,cAAI,gBAAJ,CAAhC,C,CAEA;;AACA,MAAMC,0BAA0B,GAAG,cAAI,mBAAJ,CAAnC;AAEA,MAAMC,qBAAqB,GAAG,CAC7B,QAD6B,EAE7B,qBAF6B,EAG7B,WAH6B,EAI7B,wBAJ6B,CAA9B;;AAOA,MAAMC,UAAU,GAAG,QAAuC;AAAA,MAArC;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,SAAV;AAAqBC,IAAAA;AAArB,GAAqC;AACzD,SAAOA,QAAQ,CAACC,GAAT,CACN,QAQCC,KARD,KASK;AAAA,QARJ;AACCC,MAAAA,UADD;AAECC,MAAAA,aAFD;AAGCC,MAAAA,KAHD;AAICP,MAAAA,MAAM,EAAEQ,eAJT;AAKCP,MAAAA,SAAS,EAAEQ;AALZ,KAQI;;AACJ,QAAK,CAAEJ,UAAF,IAAgB,CAAEC,aAAvB,EAAuC;AACtC,aAAO,IAAP;AACA;;AACD,QAAII,SAAJ;;AACA,QAAKL,UAAL,EAAkB;AACjB,YAAMM,WAAW,GAAG,wCACnBH,eAAe,IAAIR,MADA,EAEnBK,UAFmB,CAApB;AAIAK,MAAAA,SAAS,GAAG,mBACXd,uBADW,EAEXW,KAAK,CAACK,WAAN,EAFW,EAGTD,WAAW,IAAIA,WAAW,CAACE,IAA7B,IAAuCR,U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CAACH,gCAAX,EAA8C;AAC7C,WAAO,4BAAC,wCAAD,EAA+CG,KAA/C,CAAP;AACA;;AACD,SAAO,4BAAC,sCAAD,EAA6CA,KAA7C,CAAP;AACA,CAVD;;eAYeO,0B","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { every, isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { PanelBody, ColorIndicator } from '@wordpress/components';\nimport { sprintf, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ColorGradientControl from './control';\nimport { getColorObjectByColorValue } from '../colors';\nimport { __experimentalGetGradientObjectByGradientValue } from '../gradients';\nimport useSetting from '../use-setting';\nimport useCommonSingleMultipleSelects from './use-common-single-multiple-selects';\nimport useMultipleOriginColorsAndGradients from './use-multiple-origin-colors-and-gradients';\n\n// translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)\nconst colorIndicatorAriaLabel = __( '(%s: color %s)' );\n\n// translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)\nconst gradientIndicatorAriaLabel = __( '(%s: gradient %s)' );\n\nconst colorsAndGradientKeys = [\n\t'colors',\n\t'disableCustomColors',\n\t'gradients',\n\t'disableCustomGradients',\n];\n\nconst Indicators = ( { colors, gradients, settings } ) => {\n\treturn settings.map(\n\t\t(\n\t\t\t{\n\t\t\t\tcolorValue,\n\t\t\t\tgradientValue,\n\t\t\t\tlabel,\n\t\t\t\tcolors: availableColors,\n\t\t\t\tgradients: availableGradients,\n\t\t\t},\n\t\t\tindex\n\t\t) => {\n\t\t\tif ( ! colorValue && ! gradientValue ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tlet ariaLabel;\n\t\t\tif ( colorValue ) {\n\t\t\t\tconst colorObject = getColorObjectByColorValue(\n\t\t\t\t\tavailableColors || colors,\n\t\t\t\t\tcolorValue\n\t\t\t\t);\n\t\t\t\tariaLabel = sprintf(\n\t\t\t\t\tcolorIndicatorAriaLabel,\n\t\t\t\t\tlabel.toLowerCase(),\n\t\t\t\t\t( colorObject && colorObject.name ) || colorValue\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconst gradientObject = __experimentalGetGradientObjectByGradientValue(\n\t\t\t\t\tavailableGradients || gradients,\n\t\t\t\t\tcolorValue\n\t\t\t\t);\n\t\t\t\tariaLabel = sprintf(\n\t\t\t\t\tgradientIndicatorAriaLabel,\n\t\t\t\t\tlabel.toLowerCase(),\n\t\t\t\t\t( gradientObject && gradientObject.name ) || gradientValue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<ColorIndicator\n\t\t\t\t\tkey={ index }\n\t\t\t\t\tcolorValue={ colorValue || gradientValue }\n\t\t\t\t\taria-label={ ariaLabel }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t);\n};\n\nexport const PanelColorGradientSettingsInner = ( {\n\tclassName,\n\tcolors,\n\tgradients,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\tchildren,\n\tsettings,\n\ttitle,\n\tshowTitle = true,\n\t__experimentalHasMultipleOrigins,\n\t__experimentalIsRenderedInSidebar,\n\tenableAlpha,\n\t...props\n} ) => {\n\tif (\n\t\tisEmpty( colors ) &&\n\t\tisEmpty( gradients ) &&\n\t\tdisableCustomColors &&\n\t\tdisableCustomGradients &&\n\t\tevery(\n\t\t\tsettings,\n\t\t\t( setting ) =>\n\t\t\t\tisEmpty( setting.colors ) &&\n\t\t\t\tisEmpty( setting.gradients ) &&\n\t\t\t\t( setting.disableCustomColors === undefined ||\n\t\t\t\t\tsetting.disableCustomColors ) &&\n\t\t\t\t( setting.disableCustomGradients === undefined ||\n\t\t\t\t\tsetting.disableCustomGradients )\n\t\t)\n\t) {\n\t\treturn null;\n\t}\n\n\tconst titleElement = (\n\t\t<span className=\"block-editor-panel-color-gradient-settings__panel-title\">\n\t\t\t{ title }\n\t\t\t<Indicators\n\t\t\t\tcolors={ colors }\n\t\t\t\tgradients={ gradients }\n\t\t\t\tsettings={ settings }\n\t\t\t/>\n\t\t</span>\n\t);\n\n\treturn (\n\t\t<PanelBody\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-panel-color-gradient-settings',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\ttitle={ showTitle ? titleElement : undefined }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ settings.map( ( setting, index ) => (\n\t\t\t\t<ColorGradientControl\n\t\t\t\t\tshowTitle={ showTitle }\n\t\t\t\t\tkey={ index }\n\t\t\t\t\t{ ...{\n\t\t\t\t\t\tcolors,\n\t\t\t\t\t\tgradients,\n\t\t\t\t\t\tdisableCustomColors,\n\t\t\t\t\t\tdisableCustomGradients,\n\t\t\t\t\t\t__experimentalHasMultipleOrigins,\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar,\n\t\t\t\t\t\tenableAlpha,\n\t\t\t\t\t\t...setting,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ children }\n\t\t</PanelBody>\n\t);\n};\n\nconst PanelColorGradientSettingsSingleSelect = ( props ) => {\n\tconst colorGradientSettings = useCommonSingleMultipleSelects();\n\tcolorGradientSettings.colors = useSetting( 'color.palette' );\n\tcolorGradientSettings.gradients = useSetting( 'color.gradients' );\n\treturn (\n\t\t<PanelColorGradientSettingsInner\n\t\t\t{ ...{ ...colorGradientSettings, ...props } }\n\t\t/>\n\t);\n};\n\nconst PanelColorGradientSettingsMultipleSelect = ( props ) => {\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\treturn (\n\t\t<PanelColorGradientSettingsInner\n\t\t\t{ ...{ ...colorGradientSettings, ...props } }\n\t\t/>\n\t);\n};\n\nconst PanelColorGradientSettings = ( props ) => {\n\tif (\n\t\tevery( colorsAndGradientKeys, ( key ) => props.hasOwnProperty( key ) )\n\t) {\n\t\treturn <PanelColorGradientSettingsInner { ...props } />;\n\t}\n\tif ( props.__experimentalHasMultipleOrigins ) {\n\t\treturn <PanelColorGradientSettingsMultipleSelect { ...props } />;\n\t}\n\treturn <PanelColorGradientSettingsSingleSelect { ...props } />;\n};\n\nexport default PanelColorGradientSettings;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/colors-gradients/panel-color-gradient-settings.js"],"names":["colorIndicatorAriaLabel","gradientIndicatorAriaLabel","colorsAndGradientKeys","Indicators","colors","gradients","settings","map","index","colorValue","gradientValue","label","availableColors","availableGradients","ariaLabel","colorObject","toLowerCase","name","gradientObject","PanelColorGradientSettingsInner","className","disableCustomColors","disableCustomGradients","children","title","showTitle","__experimentalHasMultipleOrigins","__experimentalIsRenderedInSidebar","enableAlpha","props","setting","undefined","titleElement","dropdownPosition","popoverProps","__unstableForcePosition","isOpen","onToggle","PanelColorGradientSettingsSingleSelect","colorGradientSettings","PanelColorGradientSettingsMultipleSelect","PanelColorGradientSettings","key","hasOwnProperty"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AAUA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA7BA;AACA;AACA;;AAIA;AACA;AACA;;AAaA;AACA;AACA;AAQA;AACA,MAAMA,uBAAuB,GAAG,cAAI,gBAAJ,CAAhC,C,CAEA;;AACA,MAAMC,0BAA0B,GAAG,cAAI,mBAAJ,CAAnC;AAEA,MAAMC,qBAAqB,GAAG,CAC7B,QAD6B,EAE7B,qBAF6B,EAG7B,WAH6B,EAI7B,wBAJ6B,CAA9B;;AAOA,MAAMC,UAAU,GAAG,QAAuC;AAAA,MAArC;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,SAAV;AAAqBC,IAAAA;AAArB,GAAqC;AACzD,SAAOA,QAAQ,CAACC,GAAT,CACN,QAQCC,KARD,KASK;AAAA,QARJ;AACCC,MAAAA,UADD;AAECC,MAAAA,aAFD;AAGCC,MAAAA,KAHD;AAICP,MAAAA,MAAM,EAAEQ,eAJT;AAKCP,MAAAA,SAAS,EAAEQ;AAL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3B,qBAAP,EAAgCwC,GAAF,IAAWb,KAAK,CAACc,cAAN,CAAsBD,GAAtB,CAAzC,CADD,EAEE;AACD,WAAO,4BAAC,+BAAD,EAAsCb,KAAtC,CAAP;AACA;;AACD,MAAKA,KAAK,CAACH,gCAAX,EAA8C;AAC7C,WAAO,4BAAC,wCAAD,EAA+CG,KAA/C,CAAP;AACA;;AACD,SAAO,4BAAC,sCAAD,EAA6CA,KAA7C,CAAP;AACA,CAVD;;eAYeY,0B","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { every, isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalHStack as HStack,\n\t__experimentalSpacer as Spacer,\n\tFlexItem,\n\tColorIndicator,\n\tPanelBody,\n\tDropdown,\n} from '@wordpress/components';\nimport { sprintf, __, isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ColorGradientControl from './control';\nimport { getColorObjectByColorValue } from '../colors';\nimport { __experimentalGetGradientObjectByGradientValue } from '../gradients';\nimport useSetting from '../use-setting';\nimport useCommonSingleMultipleSelects from './use-common-single-multiple-selects';\nimport useMultipleOriginColorsAndGradients from './use-multiple-origin-colors-and-gradients';\n\n// translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)\nconst colorIndicatorAriaLabel = __( '(%s: color %s)' );\n\n// translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)\nconst gradientIndicatorAriaLabel = __( '(%s: gradient %s)' );\n\nconst colorsAndGradientKeys = [\n\t'colors',\n\t'disableCustomColors',\n\t'gradients',\n\t'disableCustomGradients',\n];\n\nconst Indicators = ( { colors, gradients, settings } ) => {\n\treturn settings.map(\n\t\t(\n\t\t\t{\n\t\t\t\tcolorValue,\n\t\t\t\tgradientValue,\n\t\t\t\tlabel,\n\t\t\t\tcolors: availableColors,\n\t\t\t\tgradients: availableGradients,\n\t\t\t},\n\t\t\tindex\n\t\t) => {\n\t\t\tif ( ! colorValue && ! gradientValue ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tlet ariaLabel;\n\t\t\tif ( colorValue ) {\n\t\t\t\tconst colorObject = getColorObjectByColorValue(\n\t\t\t\t\tavailableColors || colors,\n\t\t\t\t\tcolorValue\n\t\t\t\t);\n\t\t\t\tariaLabel = sprintf(\n\t\t\t\t\tcolorIndicatorAriaLabel,\n\t\t\t\t\tlabel.toLowerCase(),\n\t\t\t\t\t( colorObject && colorObject.name ) || colorValue\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconst gradientObject = __experimentalGetGradientObjectByGradientValue(\n\t\t\t\t\tavailableGradients || gradients,\n\t\t\t\t\tcolorValue\n\t\t\t\t);\n\t\t\t\tariaLabel = sprintf(\n\t\t\t\t\tgradientIndicatorAriaLabel,\n\t\t\t\t\tlabel.toLowerCase(),\n\t\t\t\t\t( gradientObject && gradientObject.name ) || gradientValue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<ColorIndicator\n\t\t\t\t\tkey={ index }\n\t\t\t\t\tcolorValue={ colorValue || gradientValue }\n\t\t\t\t\taria-label={ ariaLabel }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t);\n};\n\nexport const PanelColorGradientSettingsInner = ( {\n\tclassName,\n\tcolors,\n\tgradients,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\tchildren,\n\tsettings,\n\ttitle,\n\tshowTitle = true,\n\t__experimentalHasMultipleOrigins,\n\t__experimentalIsRenderedInSidebar,\n\tenableAlpha,\n\t...props\n} ) => {\n\tif (\n\t\tisEmpty( colors ) &&\n\t\tisEmpty( gradients ) &&\n\t\tdisableCustomColors &&\n\t\tdisableCustomGradients &&\n\t\tevery(\n\t\t\tsettings,\n\t\t\t( setting ) =>\n\t\t\t\tisEmpty( setting.colors ) &&\n\t\t\t\tisEmpty( setting.gradients ) &&\n\t\t\t\t( setting.disableCustomColors === undefined ||\n\t\t\t\t\tsetting.disableCustomColors ) &&\n\t\t\t\t( setting.disableCustomGradients === undefined ||\n\t\t\t\t\tsetting.disableCustomGradients )\n\t\t)\n\t) {\n\t\treturn null;\n\t}\n\n\tconst titleElement = (\n\t\t<span className=\"block-editor-panel-color-gradient-settings__panel-title\">\n\t\t\t{ title }\n\t\t\t<Indicators\n\t\t\t\tcolors={ colors }\n\t\t\t\tgradients={ gradients }\n\t\t\t\tsettings={ settings }\n\t\t\t/>\n\t\t</span>\n\t);\n\n\tlet dropdownPosition;\n\tlet popoverProps;\n\tif ( __experimentalIsRenderedInSidebar ) {\n\t\tdropdownPosition = isRTL() ? 'bottom right' : 'bottom left';\n\t\tpopoverProps = { __unstableForcePosition: true };\n\t}\n\n\treturn (\n\t\t<PanelBody\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-panel-color-gradient-settings',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\ttitle={ showTitle ? titleElement : undefined }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<ItemGroup\n\t\t\t\tisBordered\n\t\t\t\tisSeparated\n\t\t\t\tclassName=\"block-editor-panel-color-gradient-settings__item-group\"\n\t\t\t>\n\t\t\t\t{ settings.map( ( setting, index ) => (\n\t\t\t\t\t<Dropdown\n\t\t\t\t\t\tposition={ dropdownPosition }\n\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\tclassName=\"block-editor-panel-color-gradient-settings__dropdown\"\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\tcontentClassName=\"block-editor-panel-color-gradient-settings__dropdown-content\"\n\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t\t'block-editor-panel-color-gradient-settings__item',\n\t\t\t\t\t\t\t\t\t\t{ 'is-open': isOpen }\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\t\t<HStack justify=\"flex-start\">\n\t\t\t\t\t\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-panel-color-gradient-settings__color-indicator\"\n\t\t\t\t\t\t\t\t\t\t\tcolorValue={\n\t\t\t\t\t\t\t\t\t\t\t\tsetting.gradientValue ??\n\t\t\t\t\t\t\t\t\t\t\t\tsetting.colorValue\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<FlexItem>{ setting.label }</FlexItem>\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t\trenderContent={ () => (\n\t\t\t\t\t\t\t<ColorGradientControl\n\t\t\t\t\t\t\t\tshowTitle={ false }\n\t\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\t\tcolors,\n\t\t\t\t\t\t\t\t\tgradients,\n\t\t\t\t\t\t\t\t\tdisableCustomColors,\n\t\t\t\t\t\t\t\t\tdisableCustomGradients,\n\t\t\t\t\t\t\t\t\t__experimentalHasMultipleOrigins,\n\t\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar,\n\t\t\t\t\t\t\t\t\tenableAlpha,\n\t\t\t\t\t\t\t\t\t...setting,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t\t{ !! children && (\n\t\t\t\t<>\n\t\t\t\t\t<Spacer marginY={ 4 } /> { children }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</PanelBody>\n\t);\n};\n\nconst PanelColorGradientSettingsSingleSelect = ( props ) => {\n\tconst colorGradientSettings = useCommonSingleMultipleSelects();\n\tcolorGradientSettings.colors = useSetting( 'color.palette' );\n\tcolorGradientSettings.gradients = useSetting( 'color.gradients' );\n\treturn (\n\t\t<PanelColorGradientSettingsInner\n\t\t\t{ ...{ ...colorGradientSettings, ...props } }\n\t\t/>\n\t);\n};\n\nconst PanelColorGradientSettingsMultipleSelect = ( props ) => {\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\treturn (\n\t\t<PanelColorGradientSettingsInner\n\t\t\t{ ...{ ...colorGradientSettings, ...props } }\n\t\t/>\n\t);\n};\n\nconst PanelColorGradientSettings = ( props ) => {\n\tif (\n\t\tevery( colorsAndGradientKeys, ( key ) => props.hasOwnProperty( key ) )\n\t) {\n\t\treturn <PanelColorGradientSettingsInner { ...props } />;\n\t}\n\tif ( props.__experimentalHasMultipleOrigins ) {\n\t\treturn <PanelColorGradientSettingsMultipleSelect { ...props } />;\n\t}\n\treturn <PanelColorGradientSettingsSingleSelect { ...props } />;\n};\n\nexport default PanelColorGradientSettings;\n"]}
|
|
@@ -16,12 +16,12 @@ var _i18n = require("@wordpress/i18n");
|
|
|
16
16
|
|
|
17
17
|
var _compose = require("@wordpress/compose");
|
|
18
18
|
|
|
19
|
-
var _blocks = require("@wordpress/blocks");
|
|
20
|
-
|
|
21
19
|
var _htmlEntities = require("@wordpress/html-entities");
|
|
22
20
|
|
|
23
21
|
var _data = require("@wordpress/data");
|
|
24
22
|
|
|
23
|
+
var _keycodes = require("@wordpress/keycodes");
|
|
24
|
+
|
|
25
25
|
var _inserter = _interopRequireDefault(require("../inserter"));
|
|
26
26
|
|
|
27
27
|
var _store = require("../../store");
|
|
@@ -48,14 +48,13 @@ exports.ZWNBSP = ZWNBSP;
|
|
|
48
48
|
function DefaultBlockAppender(_ref) {
|
|
49
49
|
let {
|
|
50
50
|
isLocked,
|
|
51
|
-
isVisible,
|
|
52
51
|
onAppend,
|
|
53
52
|
showPrompt,
|
|
54
53
|
placeholder,
|
|
55
54
|
rootClientId
|
|
56
55
|
} = _ref;
|
|
57
56
|
|
|
58
|
-
if (isLocked
|
|
57
|
+
if (isLocked) {
|
|
59
58
|
return null;
|
|
60
59
|
}
|
|
61
60
|
|
|
@@ -66,21 +65,24 @@ function DefaultBlockAppender(_ref) {
|
|
|
66
65
|
'has-visible-prompt': showPrompt
|
|
67
66
|
})
|
|
68
67
|
}, (0, _element.createElement)("p", {
|
|
69
|
-
tabIndex: "0" //
|
|
70
|
-
// as a target. Ideally it should consider any tabbable target,
|
|
71
|
-
// but the inserter is rendered in place while it should be
|
|
72
|
-
// rendered in a popover, just like it does for an empty
|
|
73
|
-
// paragraph block.
|
|
74
|
-
,
|
|
75
|
-
contentEditable: true,
|
|
76
|
-
suppressContentEditableWarning: true // We want this element to be styled as a paragraph by themes.
|
|
68
|
+
tabIndex: "0" // We want this element to be styled as a paragraph by themes.
|
|
77
69
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
|
|
78
70
|
,
|
|
79
71
|
role: "button",
|
|
80
|
-
"aria-label": (0, _i18n.__)('Add block') // A wrapping container for this one already has the wp-block className.
|
|
72
|
+
"aria-label": (0, _i18n.__)('Add default block') // A wrapping container for this one already has the wp-block className.
|
|
81
73
|
,
|
|
82
74
|
className: "block-editor-default-block-appender__content",
|
|
83
|
-
|
|
75
|
+
onKeyDown: event => {
|
|
76
|
+
if (_keycodes.ENTER === event.keyCode || _keycodes.SPACE === event.keyCode) {
|
|
77
|
+
onAppend();
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
onClick: () => onAppend(),
|
|
81
|
+
onFocus: () => {
|
|
82
|
+
if (showPrompt) {
|
|
83
|
+
onAppend();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
84
86
|
}, showPrompt ? value : ZWNBSP), (0, _element.createElement)(_inserter.default, {
|
|
85
87
|
rootClientId: rootClientId,
|
|
86
88
|
position: "bottom right",
|
|
@@ -92,19 +94,14 @@ function DefaultBlockAppender(_ref) {
|
|
|
92
94
|
var _default = (0, _compose.compose)((0, _data.withSelect)((select, ownProps) => {
|
|
93
95
|
const {
|
|
94
96
|
getBlockCount,
|
|
95
|
-
getBlockName,
|
|
96
|
-
isBlockValid,
|
|
97
97
|
getSettings,
|
|
98
98
|
getTemplateLock
|
|
99
99
|
} = select(_store.store);
|
|
100
100
|
const isEmpty = !getBlockCount(ownProps.rootClientId);
|
|
101
|
-
const isLastBlockDefault = getBlockName(ownProps.lastBlockClientId) === (0, _blocks.getDefaultBlockName)();
|
|
102
|
-
const isLastBlockValid = isBlockValid(ownProps.lastBlockClientId);
|
|
103
101
|
const {
|
|
104
102
|
bodyPlaceholder
|
|
105
103
|
} = getSettings();
|
|
106
104
|
return {
|
|
107
|
-
isVisible: isEmpty || !isLastBlockDefault || !isLastBlockValid,
|
|
108
105
|
showPrompt: isEmpty,
|
|
109
106
|
isLocked: !!getTemplateLock(ownProps.rootClientId),
|
|
110
107
|
placeholder: bodyPlaceholder
|