@wordpress/edit-site 3.0.2 → 3.0.3
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 +1 -1
- package/build/components/block-editor/back-button.js +60 -0
- package/build/components/block-editor/back-button.js.map +1 -0
- package/build/components/block-editor/index.js +18 -4
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/edit-template-part-menu-button/index.js +63 -0
- package/build/components/edit-template-part-menu-button/index.js.map +1 -0
- package/build/components/editor/global-styles-provider.js +1 -1
- package/build/components/editor/global-styles-provider.js.map +1 -1
- package/build/components/editor/index.js +7 -7
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor/utils.js +1 -1
- package/build/components/editor/utils.js.map +1 -1
- package/build/components/{sidebar → global-styles}/border-panel.js +0 -0
- package/build/components/global-styles/border-panel.js.map +1 -0
- package/build/components/{sidebar → global-styles}/color-palette-panel.js +4 -2
- package/build/components/global-styles/color-palette-panel.js.map +1 -0
- package/build/components/{sidebar → global-styles}/color-panel.js +7 -11
- package/build/components/global-styles/color-panel.js.map +1 -0
- package/build/components/global-styles/context-menu.js +58 -0
- package/build/components/global-styles/context-menu.js.map +1 -0
- package/build/components/{sidebar → global-styles}/dimensions-panel.js +6 -7
- package/build/components/global-styles/dimensions-panel.js.map +1 -0
- package/build/components/global-styles/header.js +54 -0
- package/build/components/global-styles/header.js.map +1 -0
- package/build/components/global-styles/index.js +89 -0
- package/build/components/global-styles/index.js.map +1 -0
- package/build/components/global-styles/navigation-button.js +43 -0
- package/build/components/global-styles/navigation-button.js.map +1 -0
- package/build/components/global-styles/palette.js +57 -0
- package/build/components/global-styles/palette.js.map +1 -0
- package/build/components/global-styles/preview.js +59 -0
- package/build/components/global-styles/preview.js.map +1 -0
- package/build/components/global-styles/screen-block-list.js +76 -0
- package/build/components/global-styles/screen-block-list.js.map +1 -0
- package/build/components/global-styles/screen-block.js +45 -0
- package/build/components/global-styles/screen-block.js.map +1 -0
- package/build/components/global-styles/screen-color-palette.js +48 -0
- package/build/components/global-styles/screen-color-palette.js.map +1 -0
- package/build/components/global-styles/screen-colors.js +51 -0
- package/build/components/global-styles/screen-colors.js.map +1 -0
- package/build/components/global-styles/screen-layout.js +60 -0
- package/build/components/global-styles/screen-layout.js.map +1 -0
- package/build/components/global-styles/screen-root.js +44 -0
- package/build/components/global-styles/screen-root.js.map +1 -0
- package/build/components/global-styles/screen-typography.js +50 -0
- package/build/components/global-styles/screen-typography.js.map +1 -0
- package/build/components/global-styles/subtitle.js +25 -0
- package/build/components/global-styles/subtitle.js.map +1 -0
- package/build/components/{sidebar → global-styles}/typography-panel.js +1 -3
- package/build/components/global-styles/typography-panel.js.map +1 -0
- package/build/components/header/plugin-more-menu-item/index.js +82 -0
- package/build/components/header/plugin-more-menu-item/index.js.map +1 -0
- package/build/components/header/plugin-sidebar-more-menu-item/index.js +75 -0
- package/build/components/header/plugin-sidebar-more-menu-item/index.js.map +1 -0
- package/build/components/header/undo-redo/redo.js +1 -1
- package/build/components/header/undo-redo/redo.js.map +1 -1
- package/build/components/header/undo-redo/undo.js +1 -1
- package/build/components/header/undo-redo/undo.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +2 -10
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/navigation-sidebar/index.js +1 -1
- package/build/components/navigation-sidebar/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/constants.js +10 -10
- package/build/components/navigation-sidebar/navigation-panel/constants.js.map +1 -1
- package/build/components/save-button/index.js +1 -1
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +2 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/sidebar/global-styles-sidebar.js +11 -161
- package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +1 -6
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/plugin-sidebar/index.js +95 -0
- package/build/components/sidebar/plugin-sidebar/index.js.map +1 -0
- package/build/components/template-details/index.js +12 -6
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-details/template-areas.js +73 -0
- package/build/components/template-details/template-areas.js.map +1 -0
- package/build/components/template-part-converter/index.js +1 -1
- package/build/components/template-part-converter/index.js.map +1 -1
- package/build/components/url-query-controller/index.js +1 -1
- package/build/components/url-query-controller/index.js.map +1 -1
- package/build/index.js +24 -0
- package/build/index.js.map +1 -1
- package/build/store/actions.js +54 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +19 -1
- package/build/store/constants.js.map +1 -1
- package/build/store/reducer.js +16 -7
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +91 -9
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-editor/back-button.js +48 -0
- package/build-module/components/block-editor/back-button.js.map +1 -0
- package/build-module/components/block-editor/index.js +15 -4
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/edit-template-part-menu-button/index.js +49 -0
- package/build-module/components/edit-template-part-menu-button/index.js.map +1 -0
- package/build-module/components/editor/global-styles-provider.js +1 -1
- package/build-module/components/editor/global-styles-provider.js.map +1 -1
- package/build-module/components/editor/index.js +4 -5
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor/utils.js +1 -1
- package/build-module/components/editor/utils.js.map +1 -1
- package/build-module/components/{sidebar → global-styles}/border-panel.js +0 -0
- package/build-module/components/global-styles/border-panel.js.map +1 -0
- package/build-module/components/{sidebar → global-styles}/color-palette-panel.js +4 -2
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -0
- package/build-module/components/{sidebar → global-styles}/color-panel.js +8 -12
- package/build-module/components/global-styles/color-panel.js.map +1 -0
- package/build-module/components/global-styles/context-menu.js +41 -0
- package/build-module/components/global-styles/context-menu.js.map +1 -0
- package/build-module/components/{sidebar → global-styles}/dimensions-panel.js +6 -7
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -0
- package/build-module/components/global-styles/header.js +41 -0
- package/build-module/components/global-styles/header.js.map +1 -0
- package/build-module/components/global-styles/index.js +70 -0
- package/build-module/components/global-styles/index.js.map +1 -0
- package/build-module/components/global-styles/navigation-button.js +31 -0
- package/build-module/components/global-styles/navigation-button.js.map +1 -0
- package/build-module/components/global-styles/palette.js +43 -0
- package/build-module/components/global-styles/palette.js.map +1 -0
- package/build-module/components/global-styles/preview.js +50 -0
- package/build-module/components/global-styles/preview.js.map +1 -0
- package/build-module/components/global-styles/screen-block-list.js +58 -0
- package/build-module/components/global-styles/screen-block-list.js.map +1 -0
- package/build-module/components/global-styles/screen-block.js +32 -0
- package/build-module/components/global-styles/screen-block.js.map +1 -0
- package/build-module/components/global-styles/screen-color-palette.js +35 -0
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -0
- package/build-module/components/global-styles/screen-colors.js +38 -0
- package/build-module/components/global-styles/screen-colors.js.map +1 -0
- package/build-module/components/global-styles/screen-layout.js +44 -0
- package/build-module/components/global-styles/screen-layout.js.map +1 -0
- package/build-module/components/global-styles/screen-root.js +29 -0
- package/build-module/components/global-styles/screen-root.js.map +1 -0
- package/build-module/components/global-styles/screen-typography.js +37 -0
- package/build-module/components/global-styles/screen-typography.js.map +1 -0
- package/build-module/components/global-styles/subtitle.js +17 -0
- package/build-module/components/global-styles/subtitle.js.map +1 -0
- package/build-module/components/{sidebar → global-styles}/typography-panel.js +1 -2
- package/build-module/components/global-styles/typography-panel.js.map +1 -0
- package/build-module/components/header/plugin-more-menu-item/index.js +70 -0
- package/build-module/components/header/plugin-more-menu-item/index.js.map +1 -0
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js +64 -0
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js.map +1 -0
- package/build-module/components/header/undo-redo/redo.js +1 -1
- package/build-module/components/header/undo-redo/redo.js.map +1 -1
- package/build-module/components/header/undo-redo/undo.js +1 -1
- package/build-module/components/header/undo-redo/undo.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +3 -11
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/index.js +1 -1
- package/build-module/components/navigation-sidebar/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js +5 -3
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js.map +1 -1
- package/build-module/components/save-button/index.js +1 -1
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +2 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/sidebar/global-styles-sidebar.js +13 -159
- package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +2 -7
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js +84 -0
- package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -0
- package/build-module/components/template-details/index.js +13 -8
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-details/template-areas.js +60 -0
- package/build-module/components/template-details/template-areas.js.map +1 -0
- package/build-module/components/template-part-converter/index.js +1 -1
- package/build-module/components/template-part-converter/index.js.map +1 -1
- package/build-module/components/url-query-controller/index.js +1 -1
- package/build-module/components/url-query-controller/index.js.map +1 -1
- package/build-module/index.js +3 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +45 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js +13 -0
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/reducer.js +16 -7
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +85 -9
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +122 -17
- package/build-style/style.css +122 -17
- package/package.json +26 -26
- package/src/components/block-editor/back-button.js +44 -0
- package/src/components/block-editor/index.js +16 -1
- package/src/components/block-editor/style.scss +26 -0
- package/src/components/edit-template-part-menu-button/index.js +57 -0
- package/src/components/editor/global-styles-provider.js +1 -1
- package/src/components/editor/index.js +5 -8
- package/src/components/editor/utils.js +1 -0
- package/src/components/{sidebar → global-styles}/border-panel.js +0 -0
- package/src/components/{sidebar → global-styles}/color-palette-panel.js +13 -11
- package/src/components/{sidebar → global-styles}/color-panel.js +12 -17
- package/src/components/global-styles/context-menu.js +54 -0
- package/src/components/{sidebar → global-styles}/dimensions-panel.js +6 -10
- package/src/components/global-styles/header.js +50 -0
- package/src/components/global-styles/index.js +81 -0
- package/src/components/global-styles/navigation-button.js +35 -0
- package/src/components/global-styles/palette.js +67 -0
- package/src/components/global-styles/preview.js +41 -0
- package/src/components/global-styles/screen-block-list.js +59 -0
- package/src/components/global-styles/screen-block.js +28 -0
- package/src/components/global-styles/screen-color-palette.js +33 -0
- package/src/components/global-styles/screen-colors.js +36 -0
- package/src/components/global-styles/screen-layout.js +45 -0
- package/src/components/global-styles/screen-root.js +43 -0
- package/src/components/global-styles/screen-typography.js +33 -0
- package/src/components/global-styles/style.scss +35 -0
- package/src/components/global-styles/subtitle.js +10 -0
- package/src/components/{sidebar → global-styles}/typography-panel.js +1 -2
- package/src/components/header/plugin-more-menu-item/index.js +71 -0
- package/src/components/header/plugin-sidebar-more-menu-item/index.js +64 -0
- package/src/components/header/undo-redo/redo.js +4 -1
- package/src/components/header/undo-redo/undo.js +4 -1
- package/src/components/keyboard-shortcuts/index.js +25 -40
- package/src/components/navigation-sidebar/index.js +1 -1
- package/src/components/navigation-sidebar/navigation-panel/constants.js +9 -4
- package/src/components/navigation-sidebar/navigation-panel/style.scss +1 -0
- package/src/components/save-button/index.js +1 -1
- package/src/components/secondary-sidebar/inserter-sidebar.js +1 -0
- package/src/components/sidebar/global-styles-sidebar.js +14 -187
- package/src/components/sidebar/index.js +2 -7
- package/src/components/sidebar/plugin-sidebar/index.js +80 -0
- package/src/components/sidebar/style.scss +40 -0
- package/src/components/template-details/index.js +17 -7
- package/src/components/template-details/style.scss +36 -27
- package/src/components/template-details/template-areas.js +66 -0
- package/src/components/template-part-converter/index.js +1 -1
- package/src/components/url-query-controller/index.js +1 -1
- package/src/index.js +3 -0
- package/src/store/actions.js +53 -1
- package/src/store/constants.js +15 -0
- package/src/store/reducer.js +26 -12
- package/src/store/selectors.js +96 -9
- package/src/store/test/reducer.js +40 -23
- package/src/store/test/selectors.js +34 -3
- package/src/style.scss +1 -0
- package/build/components/sidebar/border-panel.js.map +0 -1
- package/build/components/sidebar/color-palette-panel.js.map +0 -1
- package/build/components/sidebar/color-panel.js.map +0 -1
- package/build/components/sidebar/dimensions-panel.js.map +0 -1
- package/build/components/sidebar/typography-panel.js.map +0 -1
- package/build-module/components/sidebar/border-panel.js.map +0 -1
- package/build-module/components/sidebar/color-palette-panel.js.map +0 -1
- package/build-module/components/sidebar/color-panel.js.map +0 -1
- package/build-module/components/sidebar/dimensions-panel.js.map +0 -1
- package/build-module/components/sidebar/typography-panel.js.map +0 -1
|
@@ -1,181 +1,35 @@
|
|
|
1
1
|
import { createElement, Fragment } from "@wordpress/element";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* External dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { map, sortBy } from 'lodash';
|
|
7
3
|
/**
|
|
8
4
|
* WordPress dependencies
|
|
9
5
|
*/
|
|
10
|
-
|
|
11
|
-
import { Button, PanelBody, TabPanel } from '@wordpress/components';
|
|
6
|
+
import { Button } from '@wordpress/components';
|
|
12
7
|
import { __ } from '@wordpress/i18n';
|
|
13
|
-
import {
|
|
14
|
-
import { useMemo } from '@wordpress/element';
|
|
8
|
+
import { styles } from '@wordpress/icons';
|
|
15
9
|
/**
|
|
16
10
|
* Internal dependencies
|
|
17
11
|
*/
|
|
18
12
|
|
|
19
|
-
import {
|
|
13
|
+
import { useGlobalStylesReset } from '../editor/global-styles-provider';
|
|
20
14
|
import DefaultSidebar from './default-sidebar';
|
|
21
|
-
import
|
|
22
|
-
|
|
23
|
-
import { default as ColorPanel, useHasColorPanel } from './color-panel';
|
|
24
|
-
import { default as DimensionsPanel, useHasDimensionsPanel } from './dimensions-panel';
|
|
25
|
-
|
|
26
|
-
function GlobalStylesPanel({
|
|
27
|
-
wrapperPanelTitle,
|
|
28
|
-
context,
|
|
29
|
-
getStyle,
|
|
30
|
-
setStyle,
|
|
31
|
-
getSetting,
|
|
32
|
-
setSetting
|
|
33
|
-
}) {
|
|
34
|
-
const hasBorderPanel = useHasBorderPanel(context);
|
|
35
|
-
const hasColorPanel = useHasColorPanel(context);
|
|
36
|
-
const hasTypographyPanel = useHasTypographyPanel(context);
|
|
37
|
-
const hasDimensionsPanel = useHasDimensionsPanel(context);
|
|
38
|
-
|
|
39
|
-
if (!hasColorPanel && !hasTypographyPanel && !hasDimensionsPanel) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const content = createElement(Fragment, null, hasTypographyPanel && createElement(TypographyPanel, {
|
|
44
|
-
context: context,
|
|
45
|
-
getStyle: getStyle,
|
|
46
|
-
setStyle: setStyle
|
|
47
|
-
}), hasColorPanel && createElement(ColorPanel, {
|
|
48
|
-
context: context,
|
|
49
|
-
getStyle: getStyle,
|
|
50
|
-
setStyle: setStyle,
|
|
51
|
-
getSetting: getSetting,
|
|
52
|
-
setSetting: setSetting
|
|
53
|
-
}), hasDimensionsPanel && createElement(DimensionsPanel, {
|
|
54
|
-
context: context,
|
|
55
|
-
getStyle: getStyle,
|
|
56
|
-
setStyle: setStyle
|
|
57
|
-
}), hasBorderPanel && createElement(BorderPanel, {
|
|
58
|
-
context: context,
|
|
59
|
-
getStyle: getStyle,
|
|
60
|
-
setStyle: setStyle
|
|
61
|
-
}));
|
|
62
|
-
|
|
63
|
-
if (!wrapperPanelTitle) {
|
|
64
|
-
return content;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return createElement(PanelBody, {
|
|
68
|
-
title: wrapperPanelTitle,
|
|
69
|
-
initialOpen: false
|
|
70
|
-
}, content);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function getPanelTitle(blockName) {
|
|
74
|
-
const blockType = getBlockType(blockName); // Protect against blocks that aren't registered
|
|
75
|
-
// eg: widget-area
|
|
76
|
-
|
|
77
|
-
if (blockType === undefined) {
|
|
78
|
-
return blockName;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return blockType.title;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function GlobalStylesBlockPanels({
|
|
85
|
-
blocks,
|
|
86
|
-
getStyle,
|
|
87
|
-
setStyle,
|
|
88
|
-
getSetting,
|
|
89
|
-
setSetting
|
|
90
|
-
}) {
|
|
91
|
-
const panels = useMemo(() => sortBy(map(blocks, (block, name) => {
|
|
92
|
-
return {
|
|
93
|
-
block,
|
|
94
|
-
name,
|
|
95
|
-
wrapperPanelTitle: getPanelTitle(name)
|
|
96
|
-
};
|
|
97
|
-
}), ({
|
|
98
|
-
wrapperPanelTitle
|
|
99
|
-
}) => wrapperPanelTitle), [blocks]);
|
|
100
|
-
return map(panels, ({
|
|
101
|
-
block,
|
|
102
|
-
name,
|
|
103
|
-
wrapperPanelTitle
|
|
104
|
-
}) => {
|
|
105
|
-
return createElement(GlobalStylesPanel, {
|
|
106
|
-
key: 'panel-' + name,
|
|
107
|
-
wrapperPanelTitle: wrapperPanelTitle,
|
|
108
|
-
context: block,
|
|
109
|
-
getStyle: getStyle,
|
|
110
|
-
setStyle: setStyle,
|
|
111
|
-
getSetting: getSetting,
|
|
112
|
-
setSetting: setSetting
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export default function GlobalStylesSidebar({
|
|
118
|
-
identifier,
|
|
119
|
-
title,
|
|
120
|
-
icon,
|
|
121
|
-
closeLabel
|
|
122
|
-
}) {
|
|
123
|
-
const {
|
|
124
|
-
root,
|
|
125
|
-
blocks,
|
|
126
|
-
getStyle,
|
|
127
|
-
setStyle,
|
|
128
|
-
getSetting,
|
|
129
|
-
setSetting
|
|
130
|
-
} = useGlobalStylesContext();
|
|
15
|
+
import GlobalStyles from '../global-styles';
|
|
16
|
+
export default function GlobalStylesSidebar() {
|
|
131
17
|
const [canRestart, onReset] = useGlobalStylesReset();
|
|
132
|
-
|
|
133
|
-
if (typeof blocks !== 'object' || !root) {
|
|
134
|
-
// No sidebar is shown.
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
18
|
return createElement(DefaultSidebar, {
|
|
139
19
|
className: "edit-site-global-styles-sidebar",
|
|
140
|
-
identifier:
|
|
141
|
-
title:
|
|
142
|
-
icon:
|
|
143
|
-
closeLabel:
|
|
144
|
-
header: createElement(Fragment, null, createElement("strong", null,
|
|
20
|
+
identifier: "edit-site/global-styles",
|
|
21
|
+
title: __('Styles'),
|
|
22
|
+
icon: styles,
|
|
23
|
+
closeLabel: __('Close global styles sidebar'),
|
|
24
|
+
header: createElement(Fragment, null, createElement("strong", null, __('Styles')), createElement("span", {
|
|
25
|
+
className: "edit-site-global-styles-sidebar__beta"
|
|
26
|
+
}, __('Beta')), createElement(Button, {
|
|
145
27
|
className: "edit-site-global-styles-sidebar__reset-button",
|
|
146
28
|
isSmall: true,
|
|
147
29
|
variant: "tertiary",
|
|
148
30
|
disabled: !canRestart,
|
|
149
31
|
onClick: onReset
|
|
150
32
|
}, __('Reset to defaults')))
|
|
151
|
-
}, createElement(
|
|
152
|
-
tabs: [{
|
|
153
|
-
name: 'root',
|
|
154
|
-
title: __('Root')
|
|
155
|
-
}, {
|
|
156
|
-
name: 'block',
|
|
157
|
-
title: __('By Block Type')
|
|
158
|
-
}]
|
|
159
|
-
}, tab => {
|
|
160
|
-
/* Per Block Context */
|
|
161
|
-
if ('block' === tab.name) {
|
|
162
|
-
return createElement(GlobalStylesBlockPanels, {
|
|
163
|
-
blocks: blocks,
|
|
164
|
-
getStyle: getStyle,
|
|
165
|
-
setStyle: setStyle,
|
|
166
|
-
getSetting: getSetting,
|
|
167
|
-
setSetting: setSetting
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return createElement(GlobalStylesPanel, {
|
|
172
|
-
hasWrapper: false,
|
|
173
|
-
context: root,
|
|
174
|
-
getStyle: getStyle,
|
|
175
|
-
setStyle: setStyle,
|
|
176
|
-
getSetting: getSetting,
|
|
177
|
-
setSetting: setSetting
|
|
178
|
-
});
|
|
179
|
-
}));
|
|
33
|
+
}, createElement(GlobalStyles, null));
|
|
180
34
|
}
|
|
181
35
|
//# sourceMappingURL=global-styles-sidebar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/global-styles-sidebar.js"],"names":["map","sortBy","Button","PanelBody","TabPanel","__","getBlockType","useMemo","useGlobalStylesContext","useGlobalStylesReset","DefaultSidebar","default","TypographyPanel","useHasTypographyPanel","BorderPanel","useHasBorderPanel","ColorPanel","useHasColorPanel","DimensionsPanel","useHasDimensionsPanel","GlobalStylesPanel","wrapperPanelTitle","context","getStyle","setStyle","getSetting","setSetting","hasBorderPanel","hasColorPanel","hasTypographyPanel","hasDimensionsPanel","content","getPanelTitle","blockName","blockType","undefined","title","GlobalStylesBlockPanels","blocks","panels","block","name","GlobalStylesSidebar","identifier","icon","closeLabel","root","canRestart","onReset","tab"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,MAAd,QAA4B,QAA5B;AAEA;AACA;AACA;;AACA,SAASC,MAAT,EAAiBC,SAAjB,EAA4BC,QAA5B,QAA4C,uBAA5C;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,QAA6B,mBAA7B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SACCC,sBADD,EAECC,oBAFD,QAGO,kCAHP;AAIA,OAAOC,cAAP,MAA2B,mBAA3B;AACA,SACCC,OAAO,IAAIC,eADZ,EAECC,qBAFD,QAGO,oBAHP;AAIA,SAASF,OAAO,IAAIG,WAApB,EAAiCC,iBAAjC,QAA0D,gBAA1D;AACA,SAASJ,OAAO,IAAIK,UAAp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YAAYA,GAAG,CAACR,IAArB,EAA4B;AAC3B,aACC,cAAC,uBAAD;AACC,QAAA,MAAM,EAAGH,MADV;AAEC,QAAA,QAAQ,EAAGf,QAFZ;AAGC,QAAA,QAAQ,EAAGC,QAHZ;AAIC,QAAA,UAAU,EAAGC,UAJd;AAKC,QAAA,UAAU,EAAGC;AALd,QADD;AASA;;AACD,WACC,cAAC,iBAAD;AACC,MAAA,UAAU,EAAG,KADd;AAEC,MAAA,OAAO,EAAGoB,IAFX;AAGC,MAAA,QAAQ,EAAGvB,QAHZ;AAIC,MAAA,QAAQ,EAAGC,QAJZ;AAKC,MAAA,UAAU,EAAGC,UALd;AAMC,MAAA,UAAU,EAAGC;AANd,MADD;AAUA,GA7BF,CArBD,CADD;AAuDA","sourcesContent":["/**\n * External dependencies\n */\nimport { map, sortBy } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Button, PanelBody, TabPanel } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseGlobalStylesContext,\n\tuseGlobalStylesReset,\n} from '../editor/global-styles-provider';\nimport DefaultSidebar from './default-sidebar';\nimport {\n\tdefault as TypographyPanel,\n\tuseHasTypographyPanel,\n} from './typography-panel';\nimport { default as BorderPanel, useHasBorderPanel } from './border-panel';\nimport { default as ColorPanel, useHasColorPanel } from './color-panel';\nimport {\n\tdefault as DimensionsPanel,\n\tuseHasDimensionsPanel,\n} from './dimensions-panel';\n\nfunction GlobalStylesPanel( {\n\twrapperPanelTitle,\n\tcontext,\n\tgetStyle,\n\tsetStyle,\n\tgetSetting,\n\tsetSetting,\n} ) {\n\tconst hasBorderPanel = useHasBorderPanel( context );\n\tconst hasColorPanel = useHasColorPanel( context );\n\tconst hasTypographyPanel = useHasTypographyPanel( context );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( context );\n\n\tif ( ! hasColorPanel && ! hasTypographyPanel && ! hasDimensionsPanel ) {\n\t\treturn null;\n\t}\n\n\tconst content = (\n\t\t<>\n\t\t\t{ hasTypographyPanel && (\n\t\t\t\t<TypographyPanel\n\t\t\t\t\tcontext={ context }\n\t\t\t\t\tgetStyle={ getStyle }\n\t\t\t\t\tsetStyle={ setStyle }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasColorPanel && (\n\t\t\t\t<ColorPanel\n\t\t\t\t\tcontext={ context }\n\t\t\t\t\tgetStyle={ getStyle }\n\t\t\t\t\tsetStyle={ setStyle }\n\t\t\t\t\tgetSetting={ getSetting }\n\t\t\t\t\tsetSetting={ setSetting }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasDimensionsPanel && (\n\t\t\t\t<DimensionsPanel\n\t\t\t\t\tcontext={ context }\n\t\t\t\t\tgetStyle={ getStyle }\n\t\t\t\t\tsetStyle={ setStyle }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBorderPanel && (\n\t\t\t\t<BorderPanel\n\t\t\t\t\tcontext={ context }\n\t\t\t\t\tgetStyle={ getStyle }\n\t\t\t\t\tsetStyle={ setStyle }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n\tif ( ! wrapperPanelTitle ) {\n\t\treturn content;\n\t}\n\treturn (\n\t\t<PanelBody title={ wrapperPanelTitle } initialOpen={ false }>\n\t\t\t{ content }\n\t\t</PanelBody>\n\t);\n}\n\nfunction getPanelTitle( blockName ) {\n\tconst blockType = getBlockType( blockName );\n\n\t// Protect against blocks that aren't registered\n\t// eg: widget-area\n\tif ( blockType === undefined ) {\n\t\treturn blockName;\n\t}\n\n\treturn blockType.title;\n}\n\nfunction GlobalStylesBlockPanels( {\n\tblocks,\n\tgetStyle,\n\tsetStyle,\n\tgetSetting,\n\tsetSetting,\n} ) {\n\tconst panels = useMemo(\n\t\t() =>\n\t\t\tsortBy(\n\t\t\t\tmap( blocks, ( block, name ) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tblock,\n\t\t\t\t\t\tname,\n\t\t\t\t\t\twrapperPanelTitle: getPanelTitle( name ),\n\t\t\t\t\t};\n\t\t\t\t} ),\n\t\t\t\t( { wrapperPanelTitle } ) => wrapperPanelTitle\n\t\t\t),\n\t\t[ blocks ]\n\t);\n\n\treturn map( panels, ( { block, name, wrapperPanelTitle } ) => {\n\t\treturn (\n\t\t\t<GlobalStylesPanel\n\t\t\t\tkey={ 'panel-' + name }\n\t\t\t\twrapperPanelTitle={ wrapperPanelTitle }\n\t\t\t\tcontext={ block }\n\t\t\t\tgetStyle={ getStyle }\n\t\t\t\tsetStyle={ setStyle }\n\t\t\t\tgetSetting={ getSetting }\n\t\t\t\tsetSetting={ setSetting }\n\t\t\t/>\n\t\t);\n\t} );\n}\n\nexport default function GlobalStylesSidebar( {\n\tidentifier,\n\ttitle,\n\ticon,\n\tcloseLabel,\n} ) {\n\tconst {\n\t\troot,\n\t\tblocks,\n\t\tgetStyle,\n\t\tsetStyle,\n\t\tgetSetting,\n\t\tsetSetting,\n\t} = useGlobalStylesContext();\n\tconst [ canRestart, onReset ] = useGlobalStylesReset();\n\n\tif ( typeof blocks !== 'object' || ! root ) {\n\t\t// No sidebar is shown.\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<DefaultSidebar\n\t\t\tclassName=\"edit-site-global-styles-sidebar\"\n\t\t\tidentifier={ identifier }\n\t\t\ttitle={ title }\n\t\t\ticon={ icon }\n\t\t\tcloseLabel={ closeLabel }\n\t\t\theader={\n\t\t\t\t<>\n\t\t\t\t\t<strong>{ title }</strong>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-site-global-styles-sidebar__reset-button\"\n\t\t\t\t\t\tisSmall\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tdisabled={ ! canRestart }\n\t\t\t\t\t\tonClick={ onReset }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset to defaults' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</>\n\t\t\t}\n\t\t>\n\t\t\t<TabPanel\n\t\t\t\ttabs={ [\n\t\t\t\t\t{ name: 'root', title: __( 'Root' ) },\n\t\t\t\t\t{ name: 'block', title: __( 'By Block Type' ) },\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t{ ( tab ) => {\n\t\t\t\t\t/* Per Block Context */\n\t\t\t\t\tif ( 'block' === tab.name ) {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<GlobalStylesBlockPanels\n\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\tgetStyle={ getStyle }\n\t\t\t\t\t\t\t\tsetStyle={ setStyle }\n\t\t\t\t\t\t\t\tgetSetting={ getSetting }\n\t\t\t\t\t\t\t\tsetSetting={ setSetting }\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\treturn (\n\t\t\t\t\t\t<GlobalStylesPanel\n\t\t\t\t\t\t\thasWrapper={ false }\n\t\t\t\t\t\t\tcontext={ root }\n\t\t\t\t\t\t\tgetStyle={ getStyle }\n\t\t\t\t\t\t\tsetStyle={ setStyle }\n\t\t\t\t\t\t\tgetSetting={ getSetting }\n\t\t\t\t\t\t\tsetSetting={ setSetting }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</TabPanel>\n\t\t</DefaultSidebar>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/global-styles-sidebar.js"],"names":["Button","__","styles","useGlobalStylesReset","DefaultSidebar","GlobalStyles","GlobalStylesSidebar","canRestart","onReset"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,QAAuB,kBAAvB;AAEA;AACA;AACA;;AACA,SAASC,oBAAT,QAAqC,kCAArC;AACA,OAAOC,cAAP,MAA2B,mBAA3B;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AAEA,eAAe,SAASC,mBAAT,GAA+B;AAC7C,QAAM,CAAEC,UAAF,EAAcC,OAAd,IAA0BL,oBAAoB,EAApD;AAEA,SACC,cAAC,cAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,UAAU,EAAC,yBAFZ;AAGC,IAAA,KAAK,EAAGF,EAAE,CAAE,QAAF,CAHX;AAIC,IAAA,IAAI,EAAGC,MAJR;AAKC,IAAA,UAAU,EAAGD,EAAE,CAAE,6BAAF,CALhB;AAMC,IAAA,MAAM,EACL,8BACC,8BAAUA,EAAE,CAAE,QAAF,CAAZ,CADD,EAEC;AAAM,MAAA,SAAS,EAAC;AAAhB,OACGA,EAAE,CAAE,MAAF,CADL,CAFD,EAKC,cAAC,MAAD;AACC,MAAA,SAAS,EAAC,+CADX;AAEC,MAAA,OAAO,MAFR;AAGC,MAAA,OAAO,EAAC,UAHT;AAIC,MAAA,QAAQ,EAAG,CAAEM,UAJd;AAKC,MAAA,OAAO,EAAGC;AALX,OAOGP,EAAE,CAAE,mBAAF,CAPL,CALD;AAPF,KAwBC,cAAC,YAAD,OAxBD,CADD;AA4BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { styles } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { useGlobalStylesReset } from '../editor/global-styles-provider';\nimport DefaultSidebar from './default-sidebar';\nimport GlobalStyles from '../global-styles';\n\nexport default function GlobalStylesSidebar() {\n\tconst [ canRestart, onReset ] = useGlobalStylesReset();\n\n\treturn (\n\t\t<DefaultSidebar\n\t\t\tclassName=\"edit-site-global-styles-sidebar\"\n\t\t\tidentifier=\"edit-site/global-styles\"\n\t\t\ttitle={ __( 'Styles' ) }\n\t\t\ticon={ styles }\n\t\t\tcloseLabel={ __( 'Close global styles sidebar' ) }\n\t\t\theader={\n\t\t\t\t<>\n\t\t\t\t\t<strong>{ __( 'Styles' ) }</strong>\n\t\t\t\t\t<span className=\"edit-site-global-styles-sidebar__beta\">\n\t\t\t\t\t\t{ __( 'Beta' ) }\n\t\t\t\t\t</span>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-site-global-styles-sidebar__reset-button\"\n\t\t\t\t\t\tisSmall\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tdisabled={ ! canRestart }\n\t\t\t\t\t\tonClick={ onReset }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset to defaults' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</>\n\t\t\t}\n\t\t>\n\t\t\t<GlobalStyles />\n\t\t</DefaultSidebar>\n\t);\n}\n"]}
|
|
@@ -5,7 +5,7 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
5
5
|
*/
|
|
6
6
|
import { createSlotFill, PanelBody } from '@wordpress/components';
|
|
7
7
|
import { __ } from '@wordpress/i18n';
|
|
8
|
-
import { cog
|
|
8
|
+
import { cog } from '@wordpress/icons';
|
|
9
9
|
import { useEffect } from '@wordpress/element';
|
|
10
10
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
11
11
|
import { store as interfaceStore } from '@wordpress/interface';
|
|
@@ -70,11 +70,6 @@ export function SidebarComplementaryAreaFills() {
|
|
|
70
70
|
headerClassName: "edit-site-sidebar__panel-tabs"
|
|
71
71
|
}, sidebarName === SIDEBAR_TEMPLATE && createElement(PanelBody, null, createElement(TemplateCard, null)), sidebarName === SIDEBAR_BLOCK && createElement(InspectorSlot, {
|
|
72
72
|
bubblesVirtually: true
|
|
73
|
-
})), createElement(GlobalStylesSidebar,
|
|
74
|
-
identifier: "edit-site/global-styles",
|
|
75
|
-
title: __('Global Styles'),
|
|
76
|
-
closeLabel: __('Close global styles sidebar'),
|
|
77
|
-
icon: typography
|
|
78
|
-
}));
|
|
73
|
+
})), createElement(GlobalStylesSidebar, null));
|
|
79
74
|
}
|
|
80
75
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["createSlotFill","PanelBody","__","cog","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["createSlotFill","PanelBody","__","cog","useEffect","useSelect","useDispatch","store","interfaceStore","blockEditorStore","DefaultSidebar","GlobalStylesSidebar","STORE_NAME","SettingsHeader","TemplateCard","SIDEBAR_BLOCK","SIDEBAR_TEMPLATE","Slot","InspectorSlot","Fill","InspectorFill","SidebarInspectorFill","SidebarComplementaryAreaFills","sidebar","isEditorSidebarOpened","hasBlockSelection","select","_sidebar","getActiveComplementaryArea","_isEditorSidebarOpened","includes","getBlockSelectionStart","enableComplementaryArea","sidebarName"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,cAAT,EAAyBC,SAAzB,QAA0C,uBAA1C;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,GAAT,QAAoB,kBAApB;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,sBAAxC;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,yBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,mBAA3B;AACA,OAAOC,mBAAP,MAAgC,yBAAhC;AACA,SAASC,UAAT,QAA2B,uBAA3B;AACA,OAAOC,cAAP,MAA2B,mBAA3B;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,SAASC,aAAT,EAAwBC,gBAAxB,QAAgD,aAAhD;AAEA,MAAM;AAAEC,EAAAA,IAAI,EAAEC,aAAR;AAAuBC,EAAAA,IAAI,EAAEC;AAA7B,IAA+CpB,cAAc,CAClE,0BADkE,CAAnE;AAGA,OAAO,MAAMqB,oBAAoB,GAAGD,aAA7B;AAEP,OAAO,SAASE,6BAAT,GAAyC;AA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IAAA,MAAM,EAAG,cAAC,cAAD;AAAgB,MAAA,WAAW,EAAG+B;AAA9B,MALV;AAMC,IAAA,eAAe,EAAC;AANjB,KAQGA,WAAW,KAAKjB,gBAAhB,IACD,cAAC,SAAD,QACC,cAAC,YAAD,OADD,CATF,EAaGiB,WAAW,KAAKlB,aAAhB,IACD,cAAC,aAAD;AAAe,IAAA,gBAAgB;AAA/B,IAdF,CADD,EAkBC,cAAC,mBAAD,OAlBD,CADD;AAsBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelBody } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { cog } from '@wordpress/icons';\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport GlobalStylesSidebar from './global-styles-sidebar';\nimport { STORE_NAME } from '../../store/constants';\nimport SettingsHeader from './settings-header';\nimport TemplateCard from './template-card';\nimport { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from './constants';\n\nconst { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(\n\t'EditSiteSidebarInspector'\n);\nexport const SidebarInspectorFill = InspectorFill;\n\nexport function SidebarComplementaryAreaFills() {\n\tconst { sidebar, isEditorSidebarOpened, hasBlockSelection } = useSelect(\n\t\t( select ) => {\n\t\t\tconst _sidebar = select(\n\t\t\t\tinterfaceStore\n\t\t\t).getActiveComplementaryArea( STORE_NAME );\n\t\t\tconst _isEditorSidebarOpened = [\n\t\t\t\tSIDEBAR_BLOCK,\n\t\t\t\tSIDEBAR_TEMPLATE,\n\t\t\t].includes( _sidebar );\n\t\t\treturn {\n\t\t\t\tsidebar: _sidebar,\n\t\t\t\tisEditorSidebarOpened: _isEditorSidebarOpened,\n\t\t\t\thasBlockSelection: !! select(\n\t\t\t\t\tblockEditorStore\n\t\t\t\t).getBlockSelectionStart(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tuseEffect( () => {\n\t\tif ( ! isEditorSidebarOpened ) return;\n\t\tif ( hasBlockSelection ) {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\t\t} else {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_TEMPLATE );\n\t\t}\n\t}, [ hasBlockSelection, isEditorSidebarOpened ] );\n\tlet sidebarName = sidebar;\n\tif ( ! isEditorSidebarOpened ) {\n\t\tsidebarName = hasBlockSelection ? SIDEBAR_BLOCK : SIDEBAR_TEMPLATE;\n\t}\n\treturn (\n\t\t<>\n\t\t\t<DefaultSidebar\n\t\t\t\tidentifier={ sidebarName }\n\t\t\t\ttitle={ __( 'Settings' ) }\n\t\t\t\ticon={ cog }\n\t\t\t\tcloseLabel={ __( 'Close settings sidebar' ) }\n\t\t\t\theader={ <SettingsHeader sidebarName={ sidebarName } /> }\n\t\t\t\theaderClassName=\"edit-site-sidebar__panel-tabs\"\n\t\t\t>\n\t\t\t\t{ sidebarName === SIDEBAR_TEMPLATE && (\n\t\t\t\t\t<PanelBody>\n\t\t\t\t\t\t<TemplateCard />\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t\t{ sidebarName === SIDEBAR_BLOCK && (\n\t\t\t\t\t<InspectorSlot bubblesVirtually />\n\t\t\t\t) }\n\t\t\t</DefaultSidebar>\n\t\t\t<GlobalStylesSidebar />\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { createElement } from "@wordpress/element";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* WordPress dependencies
|
|
6
|
+
*/
|
|
7
|
+
import { ComplementaryArea } from '@wordpress/interface';
|
|
8
|
+
/**
|
|
9
|
+
* Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.
|
|
10
|
+
* It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.
|
|
11
|
+
* If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:
|
|
12
|
+
*
|
|
13
|
+
* ```js
|
|
14
|
+
* wp.data.dispatch( 'core/edit-site' ).openGeneralSidebar( 'plugin-name/sidebar-name' );
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @see PluginSidebarMoreMenuItem
|
|
18
|
+
*
|
|
19
|
+
* @param {Object} props Element props.
|
|
20
|
+
* @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.
|
|
21
|
+
* @param {string} [props.className] An optional class name added to the sidebar body.
|
|
22
|
+
* @param {string} props.title Title displayed at the top of the sidebar.
|
|
23
|
+
* @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.
|
|
24
|
+
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```js
|
|
28
|
+
* // Using ES5 syntax
|
|
29
|
+
* var __ = wp.i18n.__;
|
|
30
|
+
* var el = wp.element.createElement;
|
|
31
|
+
* var PanelBody = wp.components.PanelBody;
|
|
32
|
+
* var PluginSidebar = wp.editSite.PluginSidebar;
|
|
33
|
+
* var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
|
|
34
|
+
*
|
|
35
|
+
* function MyPluginSidebar() {
|
|
36
|
+
* return el(
|
|
37
|
+
* PluginSidebar,
|
|
38
|
+
* {
|
|
39
|
+
* name: 'my-sidebar',
|
|
40
|
+
* title: 'My sidebar title',
|
|
41
|
+
* icon: moreIcon,
|
|
42
|
+
* },
|
|
43
|
+
* el(
|
|
44
|
+
* PanelBody,
|
|
45
|
+
* {},
|
|
46
|
+
* __( 'My sidebar content' )
|
|
47
|
+
* )
|
|
48
|
+
* );
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```jsx
|
|
54
|
+
* // Using ESNext syntax
|
|
55
|
+
* import { __ } from '@wordpress/i18n';
|
|
56
|
+
* import { PanelBody } from '@wordpress/components';
|
|
57
|
+
* import { PluginSidebar } from '@wordpress/edit-site';
|
|
58
|
+
* import { more } from '@wordpress/icons';
|
|
59
|
+
*
|
|
60
|
+
* const MyPluginSidebar = () => (
|
|
61
|
+
* <PluginSidebar
|
|
62
|
+
* name="my-sidebar"
|
|
63
|
+
* title="My sidebar title"
|
|
64
|
+
* icon={ more }
|
|
65
|
+
* >
|
|
66
|
+
* <PanelBody>
|
|
67
|
+
* { __( 'My sidebar content' ) }
|
|
68
|
+
* </PanelBody>
|
|
69
|
+
* </PluginSidebar>
|
|
70
|
+
* );
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
export default function PluginSidebarEditSite({
|
|
75
|
+
className,
|
|
76
|
+
...props
|
|
77
|
+
}) {
|
|
78
|
+
return createElement(ComplementaryArea, _extends({
|
|
79
|
+
panelClassName: className,
|
|
80
|
+
className: "edit-site-sidebar",
|
|
81
|
+
scope: "core/edit-site"
|
|
82
|
+
}, props));
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/plugin-sidebar/index.js"],"names":["ComplementaryArea","PluginSidebarEditSite","className","props"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,iBAAT,QAAkC,sBAAlC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,qBAAT,CAAgC;AAAEC,EAAAA,SAAF;AAAa,KAAGC;AAAhB,CAAhC,EAA0D;AACxE,SACC,cAAC,iBAAD;AACC,IAAA,cAAc,EAAGD,SADlB;AAEC,IAAA,SAAS,EAAC,mBAFX;AAGC,IAAA,KAAK,EAAC;AAHP,KAIMC,KAJN,EADD;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ComplementaryArea } from '@wordpress/interface';\n\n/**\n * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.\n * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.\n * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:\n *\n * ```js\n * wp.data.dispatch( 'core/edit-site' ).openGeneralSidebar( 'plugin-name/sidebar-name' );\n * ```\n *\n * @see PluginSidebarMoreMenuItem\n *\n * @param {Object} props Element props.\n * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.\n * @param {string} [props.className] An optional class name added to the sidebar body.\n * @param {string} props.title Title displayed at the top of the sidebar.\n * @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var el = wp.element.createElement;\n * var PanelBody = wp.components.PanelBody;\n * var PluginSidebar = wp.editSite.PluginSidebar;\n * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.\n *\n * function MyPluginSidebar() {\n * \treturn el(\n * \t\t\tPluginSidebar,\n * \t\t\t{\n * \t\t\t\tname: 'my-sidebar',\n * \t\t\t\ttitle: 'My sidebar title',\n * \t\t\t\ticon: moreIcon,\n * \t\t\t},\n * \t\t\tel(\n * \t\t\t\tPanelBody,\n * \t\t\t\t{},\n * \t\t\t\t__( 'My sidebar content' )\n * \t\t\t)\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PanelBody } from '@wordpress/components';\n * import { PluginSidebar } from '@wordpress/edit-site';\n * import { more } from '@wordpress/icons';\n *\n * const MyPluginSidebar = () => (\n * \t<PluginSidebar\n * \t\tname=\"my-sidebar\"\n * \t\ttitle=\"My sidebar title\"\n * \t\ticon={ more }\n * \t>\n * \t\t<PanelBody>\n * \t\t\t{ __( 'My sidebar content' ) }\n * \t\t</PanelBody>\n * \t</PluginSidebar>\n * );\n * ```\n */\nexport default function PluginSidebarEditSite( { className, ...props } ) {\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tpanelClassName={ className }\n\t\t\tclassName=\"edit-site-sidebar\"\n\t\t\tscope=\"core/edit-site\"\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { createElement
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import { Button, MenuItem, __experimentalText as Text } from '@wordpress/components';
|
|
7
|
+
import { Button, MenuGroup, MenuItem, __experimentalHeading as Heading, __experimentalText as Text } from '@wordpress/components';
|
|
8
8
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
9
9
|
import { store as editorStore } from '@wordpress/editor';
|
|
10
10
|
/**
|
|
@@ -14,6 +14,7 @@ import { store as editorStore } from '@wordpress/editor';
|
|
|
14
14
|
import isTemplateRevertable from '../../utils/is-template-revertable';
|
|
15
15
|
import { MENU_TEMPLATES } from '../navigation-sidebar/navigation-panel/constants';
|
|
16
16
|
import { store as editSiteStore } from '../../store';
|
|
17
|
+
import TemplateAreas from './template-areas';
|
|
17
18
|
export default function TemplateDetails({
|
|
18
19
|
template,
|
|
19
20
|
onClose
|
|
@@ -41,17 +42,21 @@ export default function TemplateDetails({
|
|
|
41
42
|
onClose();
|
|
42
43
|
};
|
|
43
44
|
|
|
44
|
-
return createElement(
|
|
45
|
+
return createElement("div", {
|
|
45
46
|
className: "edit-site-template-details"
|
|
46
|
-
}, createElement(
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
}, createElement("div", {
|
|
48
|
+
className: "edit-site-template-details__group"
|
|
49
|
+
}, createElement(Heading, {
|
|
50
|
+
level: 4,
|
|
51
|
+
weight: 600,
|
|
52
|
+
className: "edit-site-template-details__title"
|
|
49
53
|
}, title), description && createElement(Text, {
|
|
50
54
|
size: "body",
|
|
51
55
|
className: "edit-site-template-details__description"
|
|
52
|
-
}, description)), isTemplateRevertable(template) && createElement(
|
|
53
|
-
className: "edit-site-template-
|
|
56
|
+
}, description)), createElement(TemplateAreas, null), isTemplateRevertable(template) && createElement(MenuGroup, {
|
|
57
|
+
className: "edit-site-template-details__group"
|
|
54
58
|
}, createElement(MenuItem, {
|
|
59
|
+
className: "edit-site-template-details__revert-button",
|
|
55
60
|
info: __('Restore template to theme default'),
|
|
56
61
|
onClick: revert
|
|
57
62
|
}, __('Clear customizations'))), createElement(Button, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["__","Button","MenuItem","__experimentalText","Text","useDispatch","useSelect","store","editorStore","isTemplateRevertable","MENU_TEMPLATES","editSiteStore","TemplateDetails","template","onClose","title","description","select","__experimentalGetTemplateInfo","openNavigationPanelToMenu","revertTemplate","showTemplateInSidebar","revert"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,MADD,EAECC,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["__","Button","MenuGroup","MenuItem","__experimentalHeading","Heading","__experimentalText","Text","useDispatch","useSelect","store","editorStore","isTemplateRevertable","MENU_TEMPLATES","editSiteStore","TemplateAreas","TemplateDetails","template","onClose","title","description","select","__experimentalGetTemplateInfo","openNavigationPanelToMenu","revertTemplate","showTemplateInSidebar","revert"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,MADD,EAECC,SAFD,EAGCC,QAHD,EAICC,qBAAqB,IAAIC,OAJ1B,EAKCC,kBAAkB,IAAIC,IALvB,QAMO,uBANP;AAOA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,SAASC,cAAT,QAA+B,kDAA/B;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,aAAvC;AACA,OAAOC,aAAP,MAA0B,kBAA1B;AAEA,eAAe,SAASC,eAAT,CAA0B;AAAEC,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,CAA1B,EAAkD;AAChE,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAyBX,SAAS,CACrCY,MAAF,IACCA,MAAM,CAAEV,WAAF,CAAN,CAAsBW,6BAAtB,CAAqDL,QAArD,CAFsC,EAGvC,EAHuC,CAAxC;AAKA,QAAM;AAAEM,IAAAA,yBAAF;AAA6BC,IAAAA;AAA7B,MAAgDhB,WAAW,CAChEM,aADgE,CAAjE;;AAIA,MAAK,CAAEG,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,QAAMQ,qBAAqB,GAAG,MAAM;AACnCP,IAAAA,OAAO;AACPK,IAAAA,yBAAyB,CAAEV,cAAF,CAAzB;AACA,GAHD;;AAKA,QAAMa,MAAM,GAAG,MAAM;AACpBF,IAAAA,cAAc,CAAEP,QAAF,CAAd;AACAC,IAAAA,OAAO;AACP,GAHD;;AAKA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,OAAD;AACC,IAAA,KAAK,EAAG,CADT;AAEC,IAAA,MAAM,EAAG,GAFV;AAGC,IAAA,SAAS,EAAC;AAHX,KAKGC,KALH,CADD,EASGC,WAAW,IACZ,cAAC,IAAD;AACC,IAAA,IAAI,EAAC,MADN;AAEC,IAAA,SAAS,EAAC;AAFX,KAIGA,WAJH,CAVF,CADD,EAoBC,cAAC,aAAD,OApBD,EAsBGR,oBAAoB,CAAEK,QAAF,CAApB,IACD,cAAC,SAAD;AAAW,IAAA,SAAS,EAAC;AAArB,KACC,cAAC,QAAD;AACC,IAAA,SAAS,EAAC,2CADX;AAEC,IAAA,IAAI,EAAGjB,EAAE,CAAE,mCAAF,CAFV;AAGC,IAAA,OAAO,EAAG0B;AAHX,KAKG1B,EAAE,CAAE,sBAAF,CALL,CADD,CAvBF,EAkCC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,6CADX;AAEC,IAAA,OAAO,EAAGyB,qBAFX;AAGC,kBAAazB,EAAE,CACd,sFADc;AAHhB,KAOGA,EAAE,CAAE,sBAAF,CAPL,CAlCD,CADD;AA8CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { MENU_TEMPLATES } from '../navigation-sidebar/navigation-panel/constants';\nimport { store as editSiteStore } from '../../store';\nimport TemplateAreas from './template-areas';\n\nexport default function TemplateDetails( { template, onClose } ) {\n\tconst { title, description } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetTemplateInfo( template ),\n\t\t[]\n\t);\n\tconst { openNavigationPanelToMenu, revertTemplate } = useDispatch(\n\t\teditSiteStore\n\t);\n\n\tif ( ! template ) {\n\t\treturn null;\n\t}\n\n\tconst showTemplateInSidebar = () => {\n\t\tonClose();\n\t\topenNavigationPanelToMenu( MENU_TEMPLATES );\n\t};\n\n\tconst revert = () => {\n\t\trevertTemplate( template );\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<div className=\"edit-site-template-details\">\n\t\t\t<div className=\"edit-site-template-details__group\">\n\t\t\t\t<Heading\n\t\t\t\t\tlevel={ 4 }\n\t\t\t\t\tweight={ 600 }\n\t\t\t\t\tclassName=\"edit-site-template-details__title\"\n\t\t\t\t>\n\t\t\t\t\t{ title }\n\t\t\t\t</Heading>\n\n\t\t\t\t{ description && (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize=\"body\"\n\t\t\t\t\t\tclassName=\"edit-site-template-details__description\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</div>\n\n\t\t\t<TemplateAreas />\n\n\t\t\t{ isTemplateRevertable( template ) && (\n\t\t\t\t<MenuGroup className=\"edit-site-template-details__group\">\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tclassName=\"edit-site-template-details__revert-button\"\n\t\t\t\t\t\tinfo={ __( 'Restore template to theme default' ) }\n\t\t\t\t\t\tonClick={ revert }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-template-details__show-all-button\"\n\t\t\t\tonClick={ showTemplateInSidebar }\n\t\t\t\taria-label={ __(\n\t\t\t\t\t'Browse all templates. This will open the template menu in the navigation side panel.'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t{ __( 'Browse all templates' ) }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { MenuGroup, MenuItem } from '@wordpress/components';
|
|
8
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
9
|
+
import { getTemplatePartIcon } from '@wordpress/editor';
|
|
10
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { store as editSiteStore } from '../../store';
|
|
16
|
+
import { TEMPLATE_PART_AREA_TO_NAME } from '../../store/constants';
|
|
17
|
+
|
|
18
|
+
function TemplatePartItem({
|
|
19
|
+
area,
|
|
20
|
+
clientId
|
|
21
|
+
}) {
|
|
22
|
+
const {
|
|
23
|
+
selectBlock,
|
|
24
|
+
toggleBlockHighlight
|
|
25
|
+
} = useDispatch(blockEditorStore);
|
|
26
|
+
|
|
27
|
+
const highlightBlock = () => toggleBlockHighlight(clientId, true);
|
|
28
|
+
|
|
29
|
+
const cancelHighlightBlock = () => toggleBlockHighlight(clientId, false);
|
|
30
|
+
|
|
31
|
+
return createElement(MenuItem, {
|
|
32
|
+
icon: getTemplatePartIcon(area),
|
|
33
|
+
iconPosition: "left",
|
|
34
|
+
onClick: () => {
|
|
35
|
+
selectBlock(clientId);
|
|
36
|
+
},
|
|
37
|
+
onMouseOver: highlightBlock,
|
|
38
|
+
onMouseLeave: cancelHighlightBlock,
|
|
39
|
+
onFocus: highlightBlock,
|
|
40
|
+
onBlur: cancelHighlightBlock
|
|
41
|
+
}, TEMPLATE_PART_AREA_TO_NAME[area]);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default function TemplateAreas() {
|
|
45
|
+
const templateAreaBlocks = useSelect(select => select(editSiteStore).getTemplateAreaBlocks(), []);
|
|
46
|
+
|
|
47
|
+
if (!Object.keys(templateAreaBlocks).length) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return createElement(MenuGroup, {
|
|
52
|
+
label: __('Template areas'),
|
|
53
|
+
className: "edit-site-template-details__group edit-site-template-details__template-areas"
|
|
54
|
+
}, Object.entries(templateAreaBlocks).map(([area, templateAreaBlock]) => createElement(TemplatePartItem, {
|
|
55
|
+
key: area,
|
|
56
|
+
area: area,
|
|
57
|
+
clientId: templateAreaBlock.clientId
|
|
58
|
+
})));
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=template-areas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/template-areas.js"],"names":["__","MenuGroup","MenuItem","useSelect","useDispatch","getTemplatePartIcon","store","blockEditorStore","editSiteStore","TEMPLATE_PART_AREA_TO_NAME","TemplatePartItem","area","clientId","selectBlock","toggleBlockHighlight","highlightBlock","cancelHighlightBlock","TemplateAreas","templateAreaBlocks","select","getTemplateAreaBlocks","Object","keys","length","entries","map","templateAreaBlock"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,uBAApC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,mBAAT,QAAoC,mBAApC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,aAAlB,QAAuC,aAAvC;AACA,SAASC,0BAAT,QAA2C,uBAA3C;;AAEA,SAASC,gBAAT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iB,CAACd;AAH9B,IAFA,CAJH,CADD;AAgBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuGroup, MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { getTemplatePartIcon } from '@wordpress/editor';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { TEMPLATE_PART_AREA_TO_NAME } from '../../store/constants';\n\nfunction TemplatePartItem( { area, clientId } ) {\n\tconst { selectBlock, toggleBlockHighlight } = useDispatch(\n\t\tblockEditorStore\n\t);\n\tconst highlightBlock = () => toggleBlockHighlight( clientId, true );\n\tconst cancelHighlightBlock = () => toggleBlockHighlight( clientId, false );\n\n\treturn (\n\t\t<MenuItem\n\t\t\ticon={ getTemplatePartIcon( area ) }\n\t\t\ticonPosition=\"left\"\n\t\t\tonClick={ () => {\n\t\t\t\tselectBlock( clientId );\n\t\t\t} }\n\t\t\tonMouseOver={ highlightBlock }\n\t\t\tonMouseLeave={ cancelHighlightBlock }\n\t\t\tonFocus={ highlightBlock }\n\t\t\tonBlur={ cancelHighlightBlock }\n\t\t>\n\t\t\t{ TEMPLATE_PART_AREA_TO_NAME[ area ] }\n\t\t</MenuItem>\n\t);\n}\n\nexport default function TemplateAreas() {\n\tconst templateAreaBlocks = useSelect(\n\t\t( select ) => select( editSiteStore ).getTemplateAreaBlocks(),\n\t\t[]\n\t);\n\n\tif ( ! Object.keys( templateAreaBlocks ).length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuGroup\n\t\t\tlabel={ __( 'Template areas' ) }\n\t\t\tclassName=\"edit-site-template-details__group edit-site-template-details__template-areas\"\n\t\t>\n\t\t\t{ Object.entries( templateAreaBlocks ).map(\n\t\t\t\t( [ area, templateAreaBlock ] ) => (\n\t\t\t\t\t<TemplatePartItem\n\t\t\t\t\t\tkey={ area }\n\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\tclientId={ templateAreaBlock.clientId }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t) }\n\t\t</MenuGroup>\n\t);\n}\n"]}
|
|
@@ -27,7 +27,7 @@ export default function TemplatePartConverter() {
|
|
|
27
27
|
clientIds: selectedBlockClientIds,
|
|
28
28
|
blocks: getBlocksByClientId(selectedBlockClientIds)
|
|
29
29
|
};
|
|
30
|
-
}); // Allow converting a single template part to standard blocks.
|
|
30
|
+
}, []); // Allow converting a single template part to standard blocks.
|
|
31
31
|
|
|
32
32
|
if (blocks.length === 1 && ((_blocks$ = blocks[0]) === null || _blocks$ === void 0 ? void 0 : _blocks$.name) === 'core/template-part') {
|
|
33
33
|
return createElement(ConvertToRegularBlocks, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/index.js"],"names":["useSelect","store","blockEditorStore","ConvertToRegularBlocks","ConvertToTemplatePart","TemplatePartConverter","clientIds","blocks","select","getSelectedBlockClientIds","getBlocksByClientId","selectedBlockClientIds","length","name"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,sBAAP,MAAmC,sBAAnC;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AAEA,eAAe,SAASC,qBAAT,GAAiC;AAAA;;AAC/C,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAAwBP,SAAS,CAAIQ,MAAF,IAAc;AACtD,UAAM;AAAEC,MAAAA,yBAAF;AAA6BC,MAAAA;AAA7B,QAAqDF,MAAM,CAChEN,gBADgE,CAAjE;AAGA,UAAMS,sBAAsB,GAAGF,yBAAyB,EAAxD;AACA,WAAO;AACNH,MAAAA,SAAS,EAAEK,sBADL;AAENJ,MAAAA,MAAM,EAAEG,mBAAmB,CAAEC,sBAAF;AAFrB,KAAP;AAIA,GATsC,CAAvC,CAD+C,CAY/C;;AACA,MAAKJ,MAAM,CAACK,MAAP,KAAkB,CAAlB,IAAuB,aAAAL,MAAM,CAAE,CAAF,CAAN,sDAAaM,IAAb,MAAsB,oBAAlD,EAAyE;AACxE,WAAO,cAAC,sBAAD;AAAwB,MAAA,QAAQ,EAAGP,SAAS,CAAE,CAAF;AAA5C,MAAP;AACA;;AAED,SAAO,cAAC,qBAAD;AAAuB,IAAA,SAAS,EAAGA,SAAnC;AAA+C,IAAA,MAAM,EAAGC;AAAxD,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ConvertToRegularBlocks from './convert-to-regular';\nimport ConvertToTemplatePart from './convert-to-template-part';\n\nexport default function TemplatePartConverter() {\n\tconst { clientIds, blocks } = useSelect( ( select ) => {\n\t\tconst { getSelectedBlockClientIds, getBlocksByClientId } = select(\n\t\t\tblockEditorStore\n\t\t);\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\treturn {\n\t\t\tclientIds: selectedBlockClientIds,\n\t\t\tblocks: getBlocksByClientId( selectedBlockClientIds ),\n\t\t};\n\t} );\n\n\t// Allow converting a single template part to standard blocks.\n\tif ( blocks.length === 1 && blocks[ 0 ]?.name === 'core/template-part' ) {\n\t\treturn <ConvertToRegularBlocks clientId={ clientIds[ 0 ] } />;\n\t}\n\n\treturn <ConvertToTemplatePart clientIds={ clientIds } blocks={ blocks } />;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/index.js"],"names":["useSelect","store","blockEditorStore","ConvertToRegularBlocks","ConvertToTemplatePart","TemplatePartConverter","clientIds","blocks","select","getSelectedBlockClientIds","getBlocksByClientId","selectedBlockClientIds","length","name"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,sBAAP,MAAmC,sBAAnC;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AAEA,eAAe,SAASC,qBAAT,GAAiC;AAAA;;AAC/C,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAAwBP,SAAS,CAAIQ,MAAF,IAAc;AACtD,UAAM;AAAEC,MAAAA,yBAAF;AAA6BC,MAAAA;AAA7B,QAAqDF,MAAM,CAChEN,gBADgE,CAAjE;AAGA,UAAMS,sBAAsB,GAAGF,yBAAyB,EAAxD;AACA,WAAO;AACNH,MAAAA,SAAS,EAAEK,sBADL;AAENJ,MAAAA,MAAM,EAAEG,mBAAmB,CAAEC,sBAAF;AAFrB,KAAP;AAIA,GATsC,EASpC,EAToC,CAAvC,CAD+C,CAY/C;;AACA,MAAKJ,MAAM,CAACK,MAAP,KAAkB,CAAlB,IAAuB,aAAAL,MAAM,CAAE,CAAF,CAAN,sDAAaM,IAAb,MAAsB,oBAAlD,EAAyE;AACxE,WAAO,cAAC,sBAAD;AAAwB,MAAA,QAAQ,EAAGP,SAAS,CAAE,CAAF;AAA5C,MAAP;AACA;;AAED,SAAO,cAAC,qBAAD;AAAuB,IAAA,SAAS,EAAGA,SAAnC;AAA+C,IAAA,MAAM,EAAGC;AAAxD,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ConvertToRegularBlocks from './convert-to-regular';\nimport ConvertToTemplatePart from './convert-to-template-part';\n\nexport default function TemplatePartConverter() {\n\tconst { clientIds, blocks } = useSelect( ( select ) => {\n\t\tconst { getSelectedBlockClientIds, getBlocksByClientId } = select(\n\t\t\tblockEditorStore\n\t\t);\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\treturn {\n\t\t\tclientIds: selectedBlockClientIds,\n\t\t\tblocks: getBlocksByClientId( selectedBlockClientIds ),\n\t\t};\n\t}, [] );\n\n\t// Allow converting a single template part to standard blocks.\n\tif ( blocks.length === 1 && blocks[ 0 ]?.name === 'core/template-part' ) {\n\t\treturn <ConvertToRegularBlocks clientId={ clientIds[ 0 ] } />;\n\t}\n\n\treturn <ConvertToTemplatePart clientIds={ clientIds } blocks={ blocks } />;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/url-query-controller/index.js"],"names":["useEffect","useDispatch","useSelect","getQueryArg","addQueryArgs","removeQueryArgs","store","editSiteStore","URLQueryController","setTemplate","setTemplatePart","showHomepage","setPage","url","window","location","href","postId","postType","context","pageContext","useCurrentPageContext","newUrl","history","replaceState","select","getEditedPostType","getEditedPostId","getPage","page","_postId","_postType"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,WAAT,EAAsBC,YAAtB,EAAoCC,eAApC,QAA2D,gBAA3D;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,kBAAT,GAA8B;AAC5C,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,eAAf;AAAgCC,IAAAA,YAAhC;AAA8CC,IAAAA;AAA9C,MAA0DX,WAAW,CAC1EM,aAD0E,CAA3E,CAD4C,CAK5C;;AACAP,EAAAA,SAAS,CAAE,MAAM;AAChB,UAAMa,GAAG,GAAGC,MAAM,CAACC,QAAP,CAAgBC,IAA5B;AACA,UAAMC,MAAM,GAAGd,WAAW,CAAEU,GAAF,EAAO,QAAP,CAA1B;;AAEA,QAAK,CAAEI,MAAP,EAAgB;AACfN,MAAAA,YAAY;AACZ;AACA;;AAED,UAAMO,QAAQ,GAAGf,WAAW,CAAEU,GAAF,EAAO,UAAP,CAA5B;;AACA,Q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AAA,IAAI,WAAJ,qBAAAA,IAAI,CAAEV,OAAN,wDAAeF,MAAf,IAAyBY,IAAzB,aAAyBA,IAAzB,iCAAyBA,IAAI,CAAEV,OAA/B,2CAAyB,eAAeD,QAA7C,EAAwD;AACvDY,MAAAA,OAAO,GAAGD,IAAI,CAACV,OAAL,CAAaF,MAAvB;AACAc,MAAAA,SAAS,GAAGF,IAAI,CAACV,OAAL,CAAaD,QAAzB;AACA;;AAED,QAAKY,OAAO,IAAIC,SAAhB,EAA4B;AAC3B,aAAO;AAAEd,QAAAA,MAAM,EAAEa,OAAV;AAAmBZ,QAAAA,QAAQ,EAAEa;AAA7B,OAAP;AACA;;AAED,WAAO,IAAP;AACA,GArBe,CAAhB;AAsBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { getQueryArg, addQueryArgs, removeQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function URLQueryController() {\n\tconst { setTemplate, setTemplatePart, showHomepage, setPage } = useDispatch(\n\t\teditSiteStore\n\t);\n\n\t// Set correct entity on load.\n\tuseEffect( () => {\n\t\tconst url = window.location.href;\n\t\tconst postId = getQueryArg( url, 'postId' );\n\n\t\tif ( ! postId ) {\n\t\t\tshowHomepage();\n\t\t\treturn;\n\t\t}\n\n\t\tconst postType = getQueryArg( url, 'postType' );\n\t\tif ( 'page' === postType || 'post' === postType ) {\n\t\t\tsetPage( { context: { postType, postId } } ); // Resolves correct template based on ID.\n\t\t} else if ( 'wp_template' === postType ) {\n\t\t\tsetTemplate( postId );\n\t\t} else if ( 'wp_template_part' === postType ) {\n\t\t\tsetTemplatePart( postId );\n\t\t} else {\n\t\t\tshowHomepage();\n\t\t}\n\t}, [] );\n\n\t// Update page URL when context changes.\n\tconst pageContext = useCurrentPageContext();\n\tuseEffect( () => {\n\t\tconst newUrl = pageContext\n\t\t\t? addQueryArgs( window.location.href, pageContext )\n\t\t\t: removeQueryArgs( window.location.href, 'postType', 'postId' );\n\n\t\twindow.history.replaceState( {}, '', newUrl );\n\t}, [ pageContext ] );\n\n\treturn null;\n}\n\nfunction useCurrentPageContext() {\n\treturn useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId, getPage } = select(\n\t\t\teditSiteStore\n\t\t);\n\n\t\tconst page = getPage();\n\t\tlet _postId = getEditedPostId(),\n\t\t\t_postType = getEditedPostType();\n\t\t// This doesn't seem right to me,\n\t\t// we shouldn't be using the \"page\" and the \"template\" in the same way.\n\t\t// This need to be investigated.\n\t\tif ( page?.context?.postId && page?.context?.postType ) {\n\t\t\t_postId = page.context.postId;\n\t\t\t_postType = page.context.postType;\n\t\t}\n\n\t\tif ( _postId && _postType ) {\n\t\t\treturn { postId: _postId, postType: _postType };\n\t\t}\n\n\t\treturn null;\n\t} );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/url-query-controller/index.js"],"names":["useEffect","useDispatch","useSelect","getQueryArg","addQueryArgs","removeQueryArgs","store","editSiteStore","URLQueryController","setTemplate","setTemplatePart","showHomepage","setPage","url","window","location","href","postId","postType","context","pageContext","useCurrentPageContext","newUrl","history","replaceState","select","getEditedPostType","getEditedPostId","getPage","page","_postId","_postType"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,WAAT,EAAsBC,YAAtB,EAAoCC,eAApC,QAA2D,gBAA3D;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,kBAAT,GAA8B;AAC5C,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,eAAf;AAAgCC,IAAAA,YAAhC;AAA8CC,IAAAA;AAA9C,MAA0DX,WAAW,CAC1EM,aAD0E,CAA3E,CAD4C,CAK5C;;A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C/B,UAAM;AAAEC,MAAAA,iBAAF;AAAqBC,MAAAA,eAArB;AAAsCC,MAAAA;AAAtC,QAAkDH,MAAM,CAC7DlB,aAD6D,CAA9D;AAIA,UAAMsB,IAAI,GAAGD,OAAO,EAApB;;AACA,QAAIE,OAAO,GAAGH,eAAe,EAA7B;AAAA,QACCI,SAAS,GAAGL,iBAAiB,EAD9B,CAN+B,CAQ/B;AACA;AACA;;;AACA,QAAKG,IAAI,SAAJ,IAAAA,IAAI,WAAJ,qBAAAA,IAAI,CAAEV,OAAN,wDAAeF,MAAf,IAAyBY,IAAzB,aAAyBA,IAAzB,iCAAyBA,IAAI,CAAEV,OAA/B,2CAAyB,eAAeD,QAA7C,EAAwD;AACvDY,MAAAA,OAAO,GAAGD,IAAI,CAACV,OAAL,CAAaF,MAAvB;AACAc,MAAAA,SAAS,GAAGF,IAAI,CAACV,OAAL,CAAaD,QAAzB;AACA;;AAED,QAAKY,OAAO,IAAIC,SAAhB,EAA4B;AAC3B,aAAO;AAAEd,QAAAA,MAAM,EAAEa,OAAV;AAAmBZ,QAAAA,QAAQ,EAAEa;AAA7B,OAAP;AACA;;AAED,WAAO,IAAP;AACA,GArBe,EAqBb,EArBa,CAAhB;AAsBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { getQueryArg, addQueryArgs, removeQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function URLQueryController() {\n\tconst { setTemplate, setTemplatePart, showHomepage, setPage } = useDispatch(\n\t\teditSiteStore\n\t);\n\n\t// Set correct entity on load.\n\tuseEffect( () => {\n\t\tconst url = window.location.href;\n\t\tconst postId = getQueryArg( url, 'postId' );\n\n\t\tif ( ! postId ) {\n\t\t\tshowHomepage();\n\t\t\treturn;\n\t\t}\n\n\t\tconst postType = getQueryArg( url, 'postType' );\n\t\tif ( 'page' === postType || 'post' === postType ) {\n\t\t\tsetPage( { context: { postType, postId } } ); // Resolves correct template based on ID.\n\t\t} else if ( 'wp_template' === postType ) {\n\t\t\tsetTemplate( postId );\n\t\t} else if ( 'wp_template_part' === postType ) {\n\t\t\tsetTemplatePart( postId );\n\t\t} else {\n\t\t\tshowHomepage();\n\t\t}\n\t}, [] );\n\n\t// Update page URL when context changes.\n\tconst pageContext = useCurrentPageContext();\n\tuseEffect( () => {\n\t\tconst newUrl = pageContext\n\t\t\t? addQueryArgs( window.location.href, pageContext )\n\t\t\t: removeQueryArgs( window.location.href, 'postType', 'postId' );\n\n\t\twindow.history.replaceState( {}, '', newUrl );\n\t}, [ pageContext ] );\n\n\treturn null;\n}\n\nfunction useCurrentPageContext() {\n\treturn useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId, getPage } = select(\n\t\t\teditSiteStore\n\t\t);\n\n\t\tconst page = getPage();\n\t\tlet _postId = getEditedPostId(),\n\t\t\t_postType = getEditedPostType();\n\t\t// This doesn't seem right to me,\n\t\t// we shouldn't be using the \"page\" and the \"template\" in the same way.\n\t\t// This need to be investigated.\n\t\tif ( page?.context?.postId && page?.context?.postType ) {\n\t\t\t_postId = page.context.postId;\n\t\t\t_postType = page.context.postType;\n\t\t}\n\n\t\tif ( _postId && _postType ) {\n\t\t\treturn { postId: _postId, postType: _postType };\n\t\t}\n\n\t\treturn null;\n\t}, [] );\n}\n"]}
|
package/build-module/index.js
CHANGED
|
@@ -59,4 +59,7 @@ export function initialize(id, settings) {
|
|
|
59
59
|
}
|
|
60
60
|
export { default as __experimentalMainDashboardButton } from './components/main-dashboard-button';
|
|
61
61
|
export { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle';
|
|
62
|
+
export { default as PluginSidebar } from './components/sidebar/plugin-sidebar';
|
|
63
|
+
export { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';
|
|
64
|
+
export { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';
|
|
62
65
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","render","unmountComponentAtNode","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","Editor","reinitializeEditor","target","settings","reboot","bind","initialize","id","search","searchOptions","__experimentalSpotlightEntityBlocks","document","getElementById","process","env","GUTENBERG_PHASE","enableFSEBlocks","default","__experimentalMainDashboardButton","__experimentalNavigationToggle"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,kBADD,EAECC,4CAFD,QAGO,0BAHP;AAIA,SAASC,MAAT,EAAiBC,sBAAjB,QAA+C,oBAA/C;AACA,SAASC,kCAAkC,IAAIC,oBAA/C,QAA2E,sBAA3E;AAEA;AACA;AACA;;AACA,OAAO,WAAP;AACA,OAAO,SAAP;AACA,OAAO,SAAP;AACA,OAAOC,MAAP,MAAmB,qBAAnB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,kBAAT,CAA6BC,MAA7B,EAAqCC,QAArC,EAAgD;AACtDN,EAAAA,sBAAsB,CAAEK,MAAF,CAAtB;AACA,QAAME,MAAM,GAAGH,kBAAkB,CAACI,IAAnB,CAAyB,IAAzB,EAA+BH,MAA/B,EAAuCC,QAAvC,CAAf;AACAP,EAAAA,MAAM,CACL,cAAC,MAAD;AAAQ,IAAA,eAAe,EAAGO,QAA1B;AAAqC,IAAA,OAAO,EAAGC;AAA/C,IADK,EAELF,MAFK,CAAN;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASI,UAAT,CAAqBC,EAArB,EAAyBJ,QAAzB,EAAoC;AAC1CA,EAAAA,QAAQ,CAACL,kCAAT,GAA8C,CAAEU,MAAF,EAAUC,aAAV,KAC7CV,oBAAoB,CAAES,MAAF,EAAUC,aAAV,EAAyBN,QAAzB,CADrB;;AAEAA,EAAAA,QAAQ,CAACO,mCAAT,GAA+C,CAAE,oBAAF,CAA/C;AAEA,QAAMR,MAAM,GAAGS,QAAQ,CAACC,cAAT,CAAyBL,EAAzB,CAAf;AACA,QAAMH,MAAM,GAAGH,kBAAkB,CAACI,IAAnB,CAAyB,IAAzB,EAA+BH,MAA/B,EAAuCC,QAAvC,CAAf;AAEAT,EAAAA,kBAAkB;;AAClB,MAAKmB,OAAO,CAACC,GAAR,CAAYC,eAAZ,KAAgC,CAArC,EAAyC;AACxCpB,IAAAA,4CAA4C,CAAE;AAC7CqB,MAAAA,eAAe,EAAE;AAD4B,KAAF,CAA5C;AAGA;;AAEDpB,EAAAA,MAAM,CACL,cAAC,MAAD;AAAQ,IAAA,eAAe,EAAGO,QAA1B;AAAqC,IAAA,OAAO,EAAGC;AAA/C,IADK,EAELF,MAFK,CAAN;AAIA;AAED,SAASe,OAAO,IAAIC,iCAApB,QAA6D,oCAA7D;AACA,SAASD,OAAO,IAAIE,8BAApB,QAA0D,mDAA1D","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport { __experimentalFetchLinkSuggestions as fetchLinkSuggestions } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport './plugins';\nimport './hooks';\nimport './store';\nimport Editor from './components/editor';\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n */\nexport function reinitializeEditor( target, settings ) {\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\trender(\n\t\t<Editor initialSettings={ settings } onError={ reboot } />,\n\t\ttarget\n\t);\n}\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initialize( id, settings ) {\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalSpotlightEntityBlocks = [ 'core/template-part' ];\n\n\tconst target = document.getElementById( id );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\n\tregisterCoreBlocks();\n\tif ( process.env.GUTENBERG_PHASE === 2 ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\trender(\n\t\t<Editor initialSettings={ settings } onError={ reboot } />,\n\t\ttarget\n\t);\n}\n\nexport { default as __experimentalMainDashboardButton } from './components/main-dashboard-button';\nexport { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle';\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","render","unmountComponentAtNode","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","Editor","reinitializeEditor","target","settings","reboot","bind","initialize","id","search","searchOptions","__experimentalSpotlightEntityBlocks","document","getElementById","process","env","GUTENBERG_PHASE","enableFSEBlocks","default","__experimentalMainDashboardButton","__experimentalNavigationToggle","PluginSidebar","PluginSidebarMoreMenuItem","PluginMoreMenuItem"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,kBADD,EAECC,4CAFD,QAGO,0BAHP;AAIA,SAASC,MAAT,EAAiBC,sBAAjB,QAA+C,oBAA/C;AACA,SAASC,kCAAkC,IAAIC,oBAA/C,QAA2E,sBAA3E;AAEA;AACA;AACA;;AACA,OAAO,WAAP;AACA,OAAO,SAAP;AACA,OAAO,SAAP;AACA,OAAOC,MAAP,MAAmB,qBAAnB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,kBAAT,CAA6BC,MAA7B,EAAqCC,QAArC,EAAgD;AACtDN,EAAAA,sBAAsB,CA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QAA8C,2CAA9C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport { __experimentalFetchLinkSuggestions as fetchLinkSuggestions } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport './plugins';\nimport './hooks';\nimport './store';\nimport Editor from './components/editor';\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n */\nexport function reinitializeEditor( target, settings ) {\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\trender(\n\t\t<Editor initialSettings={ settings } onError={ reboot } />,\n\t\ttarget\n\t);\n}\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initialize( id, settings ) {\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalSpotlightEntityBlocks = [ 'core/template-part' ];\n\n\tconst target = document.getElementById( id );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\n\tregisterCoreBlocks();\n\tif ( process.env.GUTENBERG_PHASE === 2 ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\trender(\n\t\t<Editor initialSettings={ settings } onError={ reboot } />,\n\t\ttarget\n\t);\n}\n\nexport { default as __experimentalMainDashboardButton } from './components/main-dashboard-button';\nexport { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\n"]}
|