@wordpress/edit-site 3.0.26 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/LICENSE.md +1 -1
- package/build/components/block-editor/resizable-editor.js +1 -0
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/code-editor/code-editor-text-area.js +95 -0
- package/build/components/code-editor/code-editor-text-area.js.map +1 -0
- package/build/components/code-editor/index.js +79 -0
- package/build/components/code-editor/index.js.map +1 -0
- package/build/components/editor/index.js +10 -5
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +81 -22
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +4 -6
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +1 -0
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/header.js +2 -7
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/navigation-button.js +27 -12
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/palette.js +2 -2
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview.js +46 -15
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +9 -12
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +2 -3
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +0 -1
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +0 -2
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +5 -6
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +0 -2
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +6 -12
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-root.js +22 -3
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +138 -0
- package/build/components/global-styles/screen-style-variations.js.map +1 -0
- package/build/components/global-styles/screen-text-color.js +6 -12
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +0 -2
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +2 -3
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/ui.js +31 -14
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/header/index.js +12 -4
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/mode-switcher/index.js +78 -0
- package/build/components/header/mode-switcher/index.js.map +1 -0
- package/build/components/header/more-menu/copy-content-menu-item.js +74 -0
- package/build/components/header/more-menu/copy-content-menu-item.js.map +1 -0
- package/build/components/header/more-menu/index.js +72 -39
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/{plugins → components/header/more-menu}/site-export.js +0 -0
- package/build/components/header/more-menu/site-export.js.map +1 -0
- package/build/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
- package/build/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build/components/header/tools-more-menu-group/index.js +1 -5
- package/build/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +45 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +56 -0
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/index.js +137 -0
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +65 -0
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
- package/build/components/keyboard-shortcuts/index.js +26 -1
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/list/actions/index.js +5 -4
- package/build/components/list/actions/index.js.map +1 -1
- package/build/components/list/actions/rename-menu-item.js +3 -3
- package/build/components/list/actions/rename-menu-item.js.map +1 -1
- package/build/components/list/added-by.js +51 -50
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/routes/redirect-to-homepage.js +87 -0
- package/build/components/routes/redirect-to-homepage.js.map +1 -0
- package/build/components/secondary-sidebar/inserter-sidebar.js +13 -3
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +7 -5
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/default-sidebar.js +4 -2
- package/build/components/sidebar/default-sidebar.js.map +1 -1
- package/build/components/sidebar/global-styles-sidebar.js +1 -0
- package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build/components/url-query-controller/index.js +1 -38
- package/build/components/url-query-controller/index.js.map +1 -1
- package/build/index.js +9 -4
- package/build/index.js.map +1 -1
- package/build/store/actions.js +26 -25
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +2 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +11 -0
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +13 -0
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +1 -0
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/code-editor/code-editor-text-area.js +83 -0
- package/build-module/components/code-editor/code-editor-text-area.js.map +1 -0
- package/build-module/components/code-editor/index.js +62 -0
- package/build-module/components/code-editor/index.js.map +1 -0
- package/build-module/components/editor/index.js +9 -5
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +82 -23
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +1 -1
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +1 -1
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/header.js +2 -5
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/navigation-button.js +27 -10
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/palette.js +1 -1
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview.js +45 -15
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +9 -13
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +1 -2
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +0 -1
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +0 -2
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +2 -3
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +0 -2
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +7 -13
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +21 -4
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +119 -0
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -0
- package/build-module/components/global-styles/screen-text-color.js +7 -13
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +0 -2
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +1 -2
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/ui.js +29 -14
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/header/index.js +13 -5
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/mode-switcher/index.js +65 -0
- package/build-module/components/header/mode-switcher/index.js.map +1 -0
- package/build-module/components/header/more-menu/copy-content-menu-item.js +59 -0
- package/build-module/components/header/more-menu/copy-content-menu-item.js.map +1 -0
- package/build-module/components/header/more-menu/index.js +67 -40
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/{plugins → components/header/more-menu}/site-export.js +0 -0
- package/build-module/components/header/more-menu/site-export.js.map +1 -0
- package/build-module/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
- package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build-module/components/header/tools-more-menu-group/index.js +2 -5
- package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +36 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +44 -0
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/index.js +120 -0
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +58 -0
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/index.js +26 -1
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/list/actions/index.js +5 -4
- package/build-module/components/list/actions/index.js.map +1 -1
- package/build-module/components/list/actions/rename-menu-item.js +3 -3
- package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
- package/build-module/components/list/added-by.js +52 -51
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/routes/redirect-to-homepage.js +75 -0
- package/build-module/components/routes/redirect-to-homepage.js.map +1 -0
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +14 -4
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +7 -5
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/default-sidebar.js +4 -2
- package/build-module/components/sidebar/default-sidebar.js.map +1 -1
- package/build-module/components/sidebar/global-styles-sidebar.js +1 -0
- package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build-module/components/url-query-controller/index.js +3 -40
- package/build-module/components/url-query-controller/index.js.map +1 -1
- package/build-module/index.js +8 -3
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +22 -23
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +2 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +11 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +11 -0
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +199 -68
- package/build-style/style.css +199 -68
- package/package.json +29 -28
- package/src/components/block-editor/resizable-editor.js +1 -0
- package/src/components/block-editor/style.scss +10 -18
- package/src/components/code-editor/code-editor-text-area.js +79 -0
- package/src/components/code-editor/index.js +65 -0
- package/src/components/code-editor/style.scss +100 -0
- package/src/components/editor/index.js +16 -7
- package/src/components/global-styles/border-panel.js +106 -42
- package/src/components/global-styles/context-menu.js +1 -1
- package/src/components/global-styles/global-styles-provider.js +1 -2
- package/src/components/global-styles/header.js +3 -5
- package/src/components/global-styles/navigation-button.js +14 -10
- package/src/components/global-styles/palette.js +1 -1
- package/src/components/global-styles/preview.js +46 -18
- package/src/components/global-styles/screen-background-color.js +7 -12
- package/src/components/global-styles/screen-block-list.js +1 -2
- package/src/components/global-styles/screen-block.js +1 -1
- package/src/components/global-styles/screen-color-palette.js +0 -2
- package/src/components/global-styles/screen-colors.js +2 -3
- package/src/components/global-styles/screen-layout.js +1 -5
- package/src/components/global-styles/screen-link-color.js +6 -16
- package/src/components/global-styles/screen-root.js +32 -3
- package/src/components/global-styles/screen-style-variations.js +130 -0
- package/src/components/global-styles/screen-text-color.js +6 -16
- package/src/components/global-styles/screen-typography-element.js +0 -4
- package/src/components/global-styles/screen-typography.js +2 -3
- package/src/components/global-styles/style.scss +24 -25
- package/src/components/global-styles/ui.js +55 -25
- package/src/components/header/document-actions/style.scss +1 -9
- package/src/components/header/index.js +10 -2
- package/src/components/header/mode-switcher/index.js +67 -0
- package/src/components/header/more-menu/copy-content-menu-item.js +53 -0
- package/src/components/header/more-menu/index.js +107 -44
- package/src/{plugins → components/header/more-menu}/site-export.js +0 -0
- package/src/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
- package/src/components/header/style.scss +2 -1
- package/src/components/header/tools-more-menu-group/index.js +2 -7
- package/src/components/keyboard-shortcut-help-modal/config.js +27 -0
- package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +41 -0
- package/src/components/keyboard-shortcut-help-modal/index.js +135 -0
- package/src/components/keyboard-shortcut-help-modal/shortcut.js +73 -0
- package/src/components/keyboard-shortcut-help-modal/style.scss +66 -0
- package/src/components/keyboard-shortcuts/index.js +27 -1
- package/src/components/list/actions/index.js +5 -4
- package/src/components/list/actions/rename-menu-item.js +3 -3
- package/src/components/list/added-by.js +57 -63
- package/src/components/routes/redirect-to-homepage.js +71 -0
- package/src/components/secondary-sidebar/inserter-sidebar.js +14 -3
- package/src/components/secondary-sidebar/list-view-sidebar.js +12 -5
- package/src/components/secondary-sidebar/style.scss +0 -4
- package/src/components/sidebar/default-sidebar.js +2 -0
- package/src/components/sidebar/global-styles-sidebar.js +1 -0
- package/src/components/sidebar/style.scss +21 -14
- package/src/components/url-query-controller/index.js +3 -35
- package/src/index.js +9 -2
- package/src/store/actions.js +22 -35
- package/src/store/defaults.js +1 -0
- package/src/store/reducer.js +6 -0
- package/src/store/selectors.js +11 -0
- package/src/store/test/actions.js +2 -92
- package/src/style.scss +2 -0
- package/build/plugins/index.js +0 -28
- package/build/plugins/index.js.map +0 -1
- package/build/plugins/site-export.js.map +0 -1
- package/build/plugins/welcome-guide-menu-item.js.map +0 -1
- package/build-module/plugins/index.js +0 -20
- package/build-module/plugins/index.js.map +0 -1
- package/build-module/plugins/site-export.js.map +0 -1
- package/build-module/plugins/welcome-guide-menu-item.js.map +0 -1
- package/src/plugins/index.js +0 -24
|
@@ -45,67 +45,75 @@ function CustomizedTooltip(_ref) {
|
|
|
45
45
|
}, children);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
function
|
|
49
|
-
var _theme$name;
|
|
50
|
-
|
|
48
|
+
function BaseAddedBy(_ref2) {
|
|
51
49
|
let {
|
|
52
|
-
|
|
50
|
+
text,
|
|
51
|
+
icon,
|
|
52
|
+
imageUrl,
|
|
53
53
|
isCustomized
|
|
54
54
|
} = _ref2;
|
|
55
|
-
const
|
|
55
|
+
const [isImageLoaded, setIsImageLoaded] = (0, _element.useState)(false);
|
|
56
56
|
return (0, _element.createElement)(_components.__experimentalHStack, {
|
|
57
57
|
alignment: "left"
|
|
58
58
|
}, (0, _element.createElement)(CustomizedTooltip, {
|
|
59
59
|
isCustomized: isCustomized
|
|
60
|
-
}, (0, _element.createElement)("div", {
|
|
60
|
+
}, imageUrl ? (0, _element.createElement)("div", {
|
|
61
|
+
className: (0, _classnames.default)('edit-site-list-added-by__avatar', {
|
|
62
|
+
'is-loaded': isImageLoaded
|
|
63
|
+
})
|
|
64
|
+
}, (0, _element.createElement)("img", {
|
|
65
|
+
onLoad: () => setIsImageLoaded(true),
|
|
66
|
+
alt: "",
|
|
67
|
+
src: imageUrl
|
|
68
|
+
})) : (0, _element.createElement)("div", {
|
|
61
69
|
className: (0, _classnames.default)('edit-site-list-added-by__icon', {
|
|
62
70
|
'is-customized': isCustomized
|
|
63
71
|
})
|
|
64
72
|
}, (0, _element.createElement)(_components.Icon, {
|
|
65
|
-
icon:
|
|
66
|
-
}))), (0, _element.createElement)("span", null,
|
|
73
|
+
icon: icon
|
|
74
|
+
}))), (0, _element.createElement)("span", null, text));
|
|
67
75
|
}
|
|
68
76
|
|
|
69
|
-
function
|
|
77
|
+
function AddedByTheme(_ref3) {
|
|
78
|
+
var _theme$name;
|
|
79
|
+
|
|
70
80
|
let {
|
|
71
81
|
slug,
|
|
72
82
|
isCustomized
|
|
73
83
|
} = _ref3;
|
|
84
|
+
const theme = (0, _data.useSelect)(select => select(_coreData.store).getTheme(slug), [slug]);
|
|
85
|
+
return (0, _element.createElement)(BaseAddedBy, {
|
|
86
|
+
icon: _icons.layout,
|
|
87
|
+
text: (theme === null || theme === void 0 ? void 0 : (_theme$name = theme.name) === null || _theme$name === void 0 ? void 0 : _theme$name.rendered) || slug,
|
|
88
|
+
isCustomized: isCustomized
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function AddedByPlugin(_ref4) {
|
|
93
|
+
let {
|
|
94
|
+
slug,
|
|
95
|
+
isCustomized
|
|
96
|
+
} = _ref4;
|
|
74
97
|
const plugin = (0, _data.useSelect)(select => select(_coreData.store).getPlugin(slug), [slug]);
|
|
75
|
-
return (0, _element.createElement)(
|
|
76
|
-
|
|
77
|
-
|
|
98
|
+
return (0, _element.createElement)(BaseAddedBy, {
|
|
99
|
+
icon: _icons.plugins,
|
|
100
|
+
text: (plugin === null || plugin === void 0 ? void 0 : plugin.name) || slug,
|
|
78
101
|
isCustomized: isCustomized
|
|
79
|
-
}
|
|
80
|
-
className: "edit-site-list-added-by__icon"
|
|
81
|
-
}, (0, _element.createElement)(_components.Icon, {
|
|
82
|
-
icon: _icons.plugins
|
|
83
|
-
}))), (0, _element.createElement)("span", null, (plugin === null || plugin === void 0 ? void 0 : plugin.name) || slug));
|
|
102
|
+
});
|
|
84
103
|
}
|
|
85
104
|
|
|
86
|
-
function AddedByAuthor(
|
|
105
|
+
function AddedByAuthor(_ref5) {
|
|
87
106
|
var _user$avatar_urls;
|
|
88
107
|
|
|
89
108
|
let {
|
|
90
109
|
id
|
|
91
|
-
} =
|
|
110
|
+
} = _ref5;
|
|
92
111
|
const user = (0, _data.useSelect)(select => select(_coreData.store).getUser(id), [id]);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}, (0, _element.createElement)("div", {
|
|
99
|
-
className: (0, _classnames.default)(hasAvatar ? 'edit-site-list-added-by__avatar' : 'edit-site-list-added-by__icon', {
|
|
100
|
-
'is-loaded': isImageLoaded
|
|
101
|
-
})
|
|
102
|
-
}, hasAvatar ? (0, _element.createElement)("img", {
|
|
103
|
-
onLoad: () => setIsImageLoaded(true),
|
|
104
|
-
alt: "",
|
|
105
|
-
src: avatarURL
|
|
106
|
-
}) : (0, _element.createElement)(_components.Icon, {
|
|
107
|
-
icon: _icons.commentAuthorAvatar
|
|
108
|
-
})), (0, _element.createElement)("span", null, user === null || user === void 0 ? void 0 : user.nickname));
|
|
112
|
+
return (0, _element.createElement)(BaseAddedBy, {
|
|
113
|
+
icon: _icons.commentAuthorAvatar,
|
|
114
|
+
imageUrl: user === null || user === void 0 ? void 0 : (_user$avatar_urls = user.avatar_urls) === null || _user$avatar_urls === void 0 ? void 0 : _user$avatar_urls[48],
|
|
115
|
+
text: user === null || user === void 0 ? void 0 : user.nickname
|
|
116
|
+
});
|
|
109
117
|
}
|
|
110
118
|
|
|
111
119
|
function AddedBySite() {
|
|
@@ -121,29 +129,22 @@ function AddedBySite() {
|
|
|
121
129
|
} = select(_coreData.store);
|
|
122
130
|
const siteData = getEntityRecord('root', '__unstableBase');
|
|
123
131
|
return {
|
|
124
|
-
name: siteData.name,
|
|
132
|
+
name: siteData === null || siteData === void 0 ? void 0 : siteData.name,
|
|
125
133
|
logoURL: siteData !== null && siteData !== void 0 && siteData.site_logo ? (_getMedia = getMedia(siteData.site_logo)) === null || _getMedia === void 0 ? void 0 : _getMedia.source_url : undefined
|
|
126
134
|
};
|
|
127
135
|
}, []);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
'is-loaded': isImageLoaded
|
|
134
|
-
})
|
|
135
|
-
}, (0, _element.createElement)("img", {
|
|
136
|
-
onLoad: () => setIsImageLoaded(true),
|
|
137
|
-
alt: "",
|
|
138
|
-
src: logoURL
|
|
139
|
-
})), (0, _element.createElement)("span", null, name));
|
|
136
|
+
return (0, _element.createElement)(BaseAddedBy, {
|
|
137
|
+
icon: _icons.globe,
|
|
138
|
+
imageUrl: logoURL,
|
|
139
|
+
text: name
|
|
140
|
+
});
|
|
140
141
|
}
|
|
141
142
|
|
|
142
|
-
function AddedBy(
|
|
143
|
+
function AddedBy(_ref6) {
|
|
143
144
|
let {
|
|
144
145
|
templateType,
|
|
145
146
|
template
|
|
146
|
-
} =
|
|
147
|
+
} = _ref6;
|
|
147
148
|
|
|
148
149
|
if (!template) {
|
|
149
150
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/list/added-by.js"],"names":["TEMPLATE_POST_TYPE_NAMES","CustomizedTooltip","isCustomized","children","AddedByTheme","slug","theme","select","coreStore","getTheme","themeIcon","name","rendered","AddedByPlugin","plugin","getPlugin","pluginIcon","AddedByAuthor","id","user","getUser","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/list/added-by.js"],"names":["TEMPLATE_POST_TYPE_NAMES","CustomizedTooltip","isCustomized","children","BaseAddedBy","text","icon","imageUrl","isImageLoaded","setIsImageLoaded","AddedByTheme","slug","theme","select","coreStore","getTheme","themeIcon","name","rendered","AddedByPlugin","plugin","getPlugin","pluginIcon","AddedByAuthor","id","user","getUser","authorIcon","avatar_urls","nickname","AddedBySite","logoURL","getEntityRecord","getMedia","siteData","site_logo","source_url","undefined","globeIcon","AddedBy","templateType","template","includes","has_theme_file","origin","source","author"],"mappings":";;;;;;;;;AAeA;;AAZA;;AAKA;;AAKA;;AACA;;AAEA;;AAMA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;AAiBA,MAAMA,wBAAwB,GAAG,CAAE,aAAF,EAAiB,k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C,QAAA,IAAI,EAAGH,QAAQ,CAAC7B,KADjB;AAEC,QAAA,YAAY,EAAG6B,QAAQ,CAACI,MAAT,KAAoB;AAFpC,QADD;AAMA,KA3BuD,CA6BxD;AACA;AACA;;;AACA,QACC,CAAEJ,QAAQ,CAACE,cAAX,IACAF,QAAQ,CAACI,MAAT,KAAoB,QADpB,IAEA,CAAEJ,QAAQ,CAACK,MAHZ,EAIE;AACD,aAAO,4BAAC,WAAD,OAAP;AACA;AACD,GA5C4D,CA8C7D;AACA;;;AACA,SAAO,4BAAC,aAAD;AAAe,IAAA,EAAE,EAAGL,QAAQ,CAACK;AAA7B,IAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\tIcon,\n\tTooltip,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport {\n\tcommentAuthorAvatar as authorIcon,\n\tlayout as themeIcon,\n\tplugins as pluginIcon,\n\tglobe as globeIcon,\n} from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\nconst TEMPLATE_POST_TYPE_NAMES = [ 'wp_template', 'wp_template_part' ];\n\nfunction CustomizedTooltip( { isCustomized, children } ) {\n\tif ( ! isCustomized ) {\n\t\treturn children;\n\t}\n\n\treturn (\n\t\t<Tooltip text={ __( 'This template has been customized' ) }>\n\t\t\t{ children }\n\t\t</Tooltip>\n\t);\n}\n\nfunction BaseAddedBy( { text, icon, imageUrl, isCustomized } ) {\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\n\treturn (\n\t\t<HStack alignment=\"left\">\n\t\t\t<CustomizedTooltip isCustomized={ isCustomized }>\n\t\t\t\t{ imageUrl ? (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'edit-site-list-added-by__avatar',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'is-loaded': isImageLoaded,\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\t\t<img\n\t\t\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\tsrc={ imageUrl }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'edit-site-list-added-by__icon',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'is-customized': isCustomized,\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\t\t<Icon icon={ icon } />\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</CustomizedTooltip>\n\t\t\t<span>{ text }</span>\n\t\t</HStack>\n\t);\n}\n\nfunction AddedByTheme( { slug, isCustomized } ) {\n\tconst theme = useSelect(\n\t\t( select ) => select( coreStore ).getTheme( slug ),\n\t\t[ slug ]\n\t);\n\n\treturn (\n\t\t<BaseAddedBy\n\t\t\ticon={ themeIcon }\n\t\t\ttext={ theme?.name?.rendered || slug }\n\t\t\tisCustomized={ isCustomized }\n\t\t/>\n\t);\n}\n\nfunction AddedByPlugin( { slug, isCustomized } ) {\n\tconst plugin = useSelect(\n\t\t( select ) => select( coreStore ).getPlugin( slug ),\n\t\t[ slug ]\n\t);\n\n\treturn (\n\t\t<BaseAddedBy\n\t\t\ticon={ pluginIcon }\n\t\t\ttext={ plugin?.name || slug }\n\t\t\tisCustomized={ isCustomized }\n\t\t/>\n\t);\n}\n\nfunction AddedByAuthor( { id } ) {\n\tconst user = useSelect( ( select ) => select( coreStore ).getUser( id ), [\n\t\tid,\n\t] );\n\n\treturn (\n\t\t<BaseAddedBy\n\t\t\ticon={ authorIcon }\n\t\t\timageUrl={ user?.avatar_urls?.[ 48 ] }\n\t\t\ttext={ user?.nickname }\n\t\t/>\n\t);\n}\n\nfunction AddedBySite() {\n\tconst { name, logoURL } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, getMedia } = select( coreStore );\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase' );\n\n\t\treturn {\n\t\t\tname: siteData?.name,\n\t\t\tlogoURL: siteData?.site_logo\n\t\t\t\t? getMedia( siteData.site_logo )?.source_url\n\t\t\t\t: undefined,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<BaseAddedBy icon={ globeIcon } imageUrl={ logoURL } text={ name } />\n\t);\n}\n\nexport default function AddedBy( { templateType, template } ) {\n\tif ( ! template ) {\n\t\treturn;\n\t}\n\n\tif ( TEMPLATE_POST_TYPE_NAMES.includes( templateType ) ) {\n\t\t// Template originally provided by a theme, but customized by a user.\n\t\t// Templates originally didn't have the 'origin' field so identify\n\t\t// older customized templates by checking for no origin and a 'theme'\n\t\t// or 'custom' source.\n\t\tif (\n\t\t\ttemplate.has_theme_file &&\n\t\t\t( template.origin === 'theme' ||\n\t\t\t\t( ! template.origin &&\n\t\t\t\t\t[ 'theme', 'custom' ].includes( template.source ) ) )\n\t\t) {\n\t\t\treturn (\n\t\t\t\t<AddedByTheme\n\t\t\t\t\tslug={ template.theme }\n\t\t\t\t\tisCustomized={ template.source === 'custom' }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\t// Template originally provided by a plugin, but customized by a user.\n\t\tif ( template.has_theme_file && template.origin === 'plugin' ) {\n\t\t\treturn (\n\t\t\t\t<AddedByPlugin\n\t\t\t\t\tslug={ template.theme }\n\t\t\t\t\tisCustomized={ template.source === 'custom' }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\t// Template was created from scratch, but has no author. Author support\n\t\t// was only added to templates in WordPress 5.9. Fallback to showing the\n\t\t// site logo and title.\n\t\tif (\n\t\t\t! template.has_theme_file &&\n\t\t\ttemplate.source === 'custom' &&\n\t\t\t! template.author\n\t\t) {\n\t\t\treturn <AddedBySite />;\n\t\t}\n\t}\n\n\t// Simply show the author for templates created from scratch that have an\n\t// author or for any other post type.\n\treturn <AddedByAuthor id={ template.author } />;\n}\n"]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = redirectToHomepage;
|
|
9
|
+
|
|
10
|
+
var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
|
|
11
|
+
|
|
12
|
+
var _url = require("@wordpress/url");
|
|
13
|
+
|
|
14
|
+
var _history = _interopRequireDefault(require("../../utils/history"));
|
|
15
|
+
|
|
16
|
+
var _getIsListPage = _interopRequireDefault(require("../../utils/get-is-list-page"));
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* WordPress dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Internal dependencies
|
|
24
|
+
*/
|
|
25
|
+
function getNeedsHomepageRedirect(params) {
|
|
26
|
+
const {
|
|
27
|
+
postType
|
|
28
|
+
} = params;
|
|
29
|
+
return !(0, _getIsListPage.default)(params) && !['post', 'page', 'wp_template', 'wp_template_part'].includes(postType);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function getHomepageParams(siteUrl) {
|
|
33
|
+
const siteSettings = await (0, _apiFetch.default)({
|
|
34
|
+
path: '/wp/v2/settings'
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
if (!siteSettings) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const {
|
|
42
|
+
show_on_front: showOnFront,
|
|
43
|
+
page_on_front: frontpageId
|
|
44
|
+
} = siteSettings; // If the user has set a page as the homepage, use those details.
|
|
45
|
+
|
|
46
|
+
if (showOnFront === 'page') {
|
|
47
|
+
return {
|
|
48
|
+
postType: 'page',
|
|
49
|
+
postId: frontpageId
|
|
50
|
+
};
|
|
51
|
+
} // Else get the home template.
|
|
52
|
+
// This matches the logic in `__experimentalGetTemplateForLink`.
|
|
53
|
+
// (packages/core-data/src/resolvers.js)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
const template = await window.fetch((0, _url.addQueryArgs)(siteUrl, {
|
|
57
|
+
'_wp-find-template': true
|
|
58
|
+
})).then(res => res.json()).then(_ref => {
|
|
59
|
+
let {
|
|
60
|
+
data
|
|
61
|
+
} = _ref;
|
|
62
|
+
return data;
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
if (!(template !== null && template !== void 0 && template.id)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
postType: 'wp_template',
|
|
71
|
+
postId: template.id
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async function redirectToHomepage(siteUrl) {
|
|
76
|
+
const searchParams = new URLSearchParams(_history.default.location.search);
|
|
77
|
+
const params = Object.fromEntries(searchParams.entries());
|
|
78
|
+
|
|
79
|
+
if (getNeedsHomepageRedirect(params)) {
|
|
80
|
+
const homepageParams = await getHomepageParams(siteUrl);
|
|
81
|
+
|
|
82
|
+
if (homepageParams) {
|
|
83
|
+
_history.default.replace(homepageParams);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=redirect-to-homepage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/routes/redirect-to-homepage.js"],"names":["getNeedsHomepageRedirect","params","postType","includes","getHomepageParams","siteUrl","siteSettings","path","show_on_front","showOnFront","page_on_front","frontpageId","postId","template","window","fetch","then","res","json","data","id","redirectToHomepage","searchParams","URLSearchParams","history","location","search","Object","fromEntries","entries","homepageParams","replace"],"mappings":";;;;;;;;;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;AAC3D,QAAMiB,YAAY,GAAG,IAAIC,eAAJ,CAAqBC,iBAAQC,QAAR,CAAiBC,MAAtC,CAArB;AACA,QAAMzB,MAAM,GAAG0B,MAAM,CAACC,WAAP,CAAoBN,YAAY,CAACO,OAAb,EAApB,CAAf;;AAEA,MAAK7B,wBAAwB,CAAEC,MAAF,CAA7B,EAA0C;AACzC,UAAM6B,cAAc,GAAG,MAAM1B,iBAAiB,CAAEC,OAAF,CAA9C;;AAEA,QAAKyB,cAAL,EAAsB;AACrBN,uBAAQO,OAAR,CAAiBD,cAAjB;AACA;AACD;AACD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport history from '../../utils/history';\nimport getIsListPage from '../../utils/get-is-list-page';\n\nfunction getNeedsHomepageRedirect( params ) {\n\tconst { postType } = params;\n\treturn (\n\t\t! getIsListPage( params ) &&\n\t\t! [ 'post', 'page', 'wp_template', 'wp_template_part' ].includes(\n\t\t\tpostType\n\t\t)\n\t);\n}\n\nasync function getHomepageParams( siteUrl ) {\n\tconst siteSettings = await apiFetch( { path: '/wp/v2/settings' } );\n\tif ( ! siteSettings ) {\n\t\treturn;\n\t}\n\n\tconst {\n\t\tshow_on_front: showOnFront,\n\t\tpage_on_front: frontpageId,\n\t} = siteSettings;\n\n\t// If the user has set a page as the homepage, use those details.\n\tif ( showOnFront === 'page' ) {\n\t\treturn {\n\t\t\tpostType: 'page',\n\t\t\tpostId: frontpageId,\n\t\t};\n\t}\n\n\t// Else get the home template.\n\t// This matches the logic in `__experimentalGetTemplateForLink`.\n\t// (packages/core-data/src/resolvers.js)\n\tconst template = await window\n\t\t.fetch( addQueryArgs( siteUrl, { '_wp-find-template': true } ) )\n\t\t.then( ( res ) => res.json() )\n\t\t.then( ( { data } ) => data );\n\n\tif ( ! template?.id ) {\n\t\treturn;\n\t}\n\n\treturn {\n\t\tpostType: 'wp_template',\n\t\tpostId: template.id,\n\t};\n}\n\nexport default async function redirectToHomepage( siteUrl ) {\n\tconst searchParams = new URLSearchParams( history.location.search );\n\tconst params = Object.fromEntries( searchParams.entries() );\n\n\tif ( getNeedsHomepageRedirect( params ) ) {\n\t\tconst homepageParams = await getHomepageParams( siteUrl );\n\n\t\tif ( homepageParams ) {\n\t\t\thistory.replace( homepageParams );\n\t\t}\n\t}\n}\n"]}
|
|
@@ -21,6 +21,8 @@ var _icons = require("@wordpress/icons");
|
|
|
21
21
|
|
|
22
22
|
var _compose = require("@wordpress/compose");
|
|
23
23
|
|
|
24
|
+
var _i18n = require("@wordpress/i18n");
|
|
25
|
+
|
|
24
26
|
var _store = require("../../store");
|
|
25
27
|
|
|
26
28
|
/**
|
|
@@ -36,17 +38,24 @@ function InserterSidebar() {
|
|
|
36
38
|
} = (0, _data.useDispatch)(_store.store);
|
|
37
39
|
const insertionPoint = (0, _data.useSelect)(select => select(_store.store).__experimentalGetInsertionPoint(), []);
|
|
38
40
|
const isMobile = (0, _compose.useViewportMatch)('medium', '<');
|
|
41
|
+
const TagName = !isMobile ? _components.VisuallyHidden : 'div';
|
|
39
42
|
const [inserterDialogRef, inserterDialogProps] = (0, _compose.__experimentalUseDialog)({
|
|
40
|
-
onClose: () => setIsInserterOpened(false)
|
|
43
|
+
onClose: () => setIsInserterOpened(false),
|
|
44
|
+
focusOnMount: null
|
|
41
45
|
});
|
|
46
|
+
const libraryRef = (0, _element.useRef)();
|
|
47
|
+
(0, _element.useEffect)(() => {
|
|
48
|
+
libraryRef.current.focusSearch();
|
|
49
|
+
}, []);
|
|
42
50
|
return (0, _element.createElement)("div", (0, _extends2.default)({
|
|
43
51
|
ref: inserterDialogRef
|
|
44
52
|
}, inserterDialogProps, {
|
|
45
53
|
className: "edit-site-editor__inserter-panel"
|
|
46
|
-
}), (0, _element.createElement)(
|
|
54
|
+
}), (0, _element.createElement)(TagName, {
|
|
47
55
|
className: "edit-site-editor__inserter-panel-header"
|
|
48
56
|
}, (0, _element.createElement)(_components.Button, {
|
|
49
57
|
icon: _icons.close,
|
|
58
|
+
label: (0, _i18n.__)('Close block inserter'),
|
|
50
59
|
onClick: () => setIsInserterOpened(false)
|
|
51
60
|
})), (0, _element.createElement)("div", {
|
|
52
61
|
className: "edit-site-editor__inserter-panel-content"
|
|
@@ -55,7 +64,8 @@ function InserterSidebar() {
|
|
|
55
64
|
shouldFocusBlock: isMobile,
|
|
56
65
|
rootClientId: insertionPoint.rootClientId,
|
|
57
66
|
__experimentalInsertionIndex: insertionPoint.insertionIndex,
|
|
58
|
-
__experimentalFilterValue: insertionPoint.filterValue
|
|
67
|
+
__experimentalFilterValue: insertionPoint.filterValue,
|
|
68
|
+
ref: libraryRef
|
|
59
69
|
})));
|
|
60
70
|
}
|
|
61
71
|
//# sourceMappingURL=inserter-sidebar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/secondary-sidebar/inserter-sidebar.js"],"names":["InserterSidebar","setIsInserterOpened","editSiteStore","insertionPoint","select","__experimentalGetInsertionPoint","isMobile","inserterDialogRef","inserterDialogProps","onClose","close","rootClientId","insertionIndex","filterValue"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/secondary-sidebar/inserter-sidebar.js"],"names":["InserterSidebar","setIsInserterOpened","editSiteStore","insertionPoint","select","__experimentalGetInsertionPoint","isMobile","TagName","VisuallyHidden","inserterDialogRef","inserterDialogProps","onClose","focusOnMount","libraryRef","current","focusSearch","close","rootClientId","insertionIndex","filterValue"],"mappings":";;;;;;;;;AAYA;;;;AATA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AAMA;;AAjBA;AACA;AACA;;AAYA;AACA;AACA;AAGe,SAASA,eAAT,GAA2B;AACzC,QAAM;AAAEC,IAAAA;AAAF,MAA0B,uBAAaC,YAAb,CAAhC;AACA,QAAMC,cAAc,GAAG,qBACpBC,MAAF,IAAcA,MAAM,CAAEF,YAAF,CAAN,CAAwBG,+BAAxB,EADQ,EAEtB,EAFsB,CAAvB;AAKA,QAAMC,QAAQ,GAAG,+BAAkB,QAAlB,EAA4B,GAA5B,CAAjB;AACA,QAAMC,OAAO,GAAG,CAAED,QAAF,GAAaE,0BAAb,GAA8B,KAA9C;AACA,QAAM,CAAEC,iBAAF,EAAqBC,mBAArB,IAA6C,sCAAW;AAC7DC,IAAAA,OAAO,EAAE,MAAMV,mBAAmB,CAAE,KAAF,CAD2B;AAE7DW,IAAAA,YAAY,EAAE;AAF+C,GAAX,CAAnD;AAKA,QAAMC,UAAU,GAAG,sBAAnB;AACA,0BAAW,MAAM;AAChBA,IAAAA,UAAU,CAACC,OAAX,CAAmBC,WAAnB;AACA,GAFD,EAEG,EAFH;AAIA,SACC;AACC,IAAA,GAAG,EAAGN;AADP,KAEMC,mBAFN;AAGC,IAAA,SAAS,EAAC;AAHX,MAKC,4BAAC,OAAD;AAAS,IAAA,SAAS,EAAC;AAAnB,KACC,4BAAC,kBAAD;AACC,IAAA,IAAI,EAAGM,YADR;AAEC,IAAA,KAAK,EAAG,cAAI,sBAAJ,CAFT;AAGC,IAAA,OAAO,EAAG,MAAMf,mBAAmB,CAAE,KAAF;AAHpC,IADD,CALD,EAYC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,kCAAD;AACC,IAAA,qBAAqB,MADtB;AAEC,IAAA,gBAAgB,EAAGK,QAFpB;AAGC,IAAA,YAAY,EAAGH,cAAc,CAACc,YAH/B;AAIC,IAAA,4BAA4B,EAC3Bd,cAAc,CAACe,cALjB;AAOC,IAAA,yBAAyB,EAAGf,cAAc,CAACgB,WAP5C;AAQC,IAAA,GAAG,EAAGN;AARP,IADD,CAZD,CADD;AA2BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport { close } from '@wordpress/icons';\nimport {\n\tuseViewportMatch,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function InserterSidebar() {\n\tconst { setIsInserterOpened } = useDispatch( editSiteStore );\n\tconst insertionPoint = useSelect(\n\t\t( select ) => select( editSiteStore ).__experimentalGetInsertionPoint(),\n\t\t[]\n\t);\n\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\tconst TagName = ! isMobile ? VisuallyHidden : 'div';\n\tconst [ inserterDialogRef, inserterDialogProps ] = useDialog( {\n\t\tonClose: () => setIsInserterOpened( false ),\n\t\tfocusOnMount: null,\n\t} );\n\n\tconst libraryRef = useRef();\n\tuseEffect( () => {\n\t\tlibraryRef.current.focusSearch();\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tref={ inserterDialogRef }\n\t\t\t{ ...inserterDialogProps }\n\t\t\tclassName=\"edit-site-editor__inserter-panel\"\n\t\t>\n\t\t\t<TagName className=\"edit-site-editor__inserter-panel-header\">\n\t\t\t\t<Button\n\t\t\t\t\ticon={ close }\n\t\t\t\t\tlabel={ __( 'Close block inserter' ) }\n\t\t\t\t\tonClick={ () => setIsInserterOpened( false ) }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t\t<div className=\"edit-site-editor__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tshouldFocusBlock={ isMobile }\n\t\t\t\t\trootClientId={ insertionPoint.rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\tinsertionPoint.insertionIndex\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalFilterValue={ insertionPoint.filterValue }\n\t\t\t\t\tref={ libraryRef }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -45,7 +45,8 @@ function ListViewSidebar() {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
const focusOnMountRef = (0, _compose.useFocusOnMount)('firstElement');
|
|
48
|
-
const
|
|
48
|
+
const headerFocusReturnRef = (0, _compose.useFocusReturn)();
|
|
49
|
+
const contentFocusReturnRef = (0, _compose.useFocusReturn)();
|
|
49
50
|
|
|
50
51
|
function closeOnEscape(event) {
|
|
51
52
|
if (event.keyCode === _keycodes.ESCAPE && !event.defaultPrevented) {
|
|
@@ -61,16 +62,17 @@ function ListViewSidebar() {
|
|
|
61
62
|
className: "edit-site-editor__list-view-panel",
|
|
62
63
|
onKeyDown: closeOnEscape
|
|
63
64
|
}, (0, _element.createElement)("div", {
|
|
64
|
-
className: "edit-site-editor__list-view-panel-header"
|
|
65
|
+
className: "edit-site-editor__list-view-panel-header",
|
|
66
|
+
ref: headerFocusReturnRef
|
|
65
67
|
}, (0, _element.createElement)("strong", {
|
|
66
68
|
id: labelId
|
|
67
|
-
}, (0, _i18n.__)('List
|
|
69
|
+
}, (0, _i18n.__)('List View')), (0, _element.createElement)(_components.Button, {
|
|
68
70
|
icon: _icons.closeSmall,
|
|
69
|
-
label: (0, _i18n.__)('Close
|
|
71
|
+
label: (0, _i18n.__)('Close List View Sidebar'),
|
|
70
72
|
onClick: () => setIsListViewOpened(false)
|
|
71
73
|
})), (0, _element.createElement)("div", {
|
|
72
74
|
className: "edit-site-editor__list-view-panel-content",
|
|
73
|
-
ref: (0, _compose.useMergeRefs)([
|
|
75
|
+
ref: (0, _compose.useMergeRefs)([contentFocusReturnRef, focusOnMountRef])
|
|
74
76
|
}, (0, _element.createElement)(_blockEditor.__experimentalListView, {
|
|
75
77
|
onSelect: selectEditorBlock,
|
|
76
78
|
showNestedBlocks: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/secondary-sidebar/list-view-sidebar.js"],"names":["ListViewSidebar","setIsListViewOpened","editSiteStore","clearSelectedBlock","selectBlock","blockEditorStore","selectEditorBlock","clientId","focusOnMountRef","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/secondary-sidebar/list-view-sidebar.js"],"names":["ListViewSidebar","setIsListViewOpened","editSiteStore","clearSelectedBlock","selectBlock","blockEditorStore","selectEditorBlock","clientId","focusOnMountRef","headerFocusReturnRef","contentFocusReturnRef","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","instanceId","labelId","closeSmall"],"mappings":";;;;;;;;;AAGA;;AAIA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AAKA;;AAtBA;AACA;AACA;;AAiBA;AACA;AACA;AAGe,SAASA,eAAT,GAA2B;AACzC,QAAM;AAAEC,IAAAA;AAAF,MAA0B,uBAAaC,YAAb,CAAhC;AAEA,QAAM;AAAEC,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,MAAsC,uBAAaC,kBAAb,CAA5C;;AACA,iBAAeC,iBAAf,CAAkCC,QAAlC,EAA6C;AAC5C,UAAMJ,kBAAkB,EAAxB;AACAC,IAAAA,WAAW,CAAEG,QAAF,EAAY,CAAC,CAAb,CAAX;AACA;;AAED,QAAMC,eAAe,GAAG,8BAAiB,cAAjB,CAAxB;AACA,QAAMC,oBAAoB,GAAG,8BAA7B;AACA,QAAMC,qBAAqB,GAAG,8BAA9B;;AACA,WAASC,aAAT,CAAwBC,KAAxB,EAAgC;AAC/B,QAAKA,KAAK,CAACC,OAAN,KAAkBC,gBAAlB,IAA4B,CAAEF,KAAK,CAACG,gBAAzC,EAA4D;AAC3Dd,MAAAA,mBAAmB,CAAE,KAAF,CAAnB;AACA;AACD;;AAED,QAAMe,UAAU,GAAG,4BAAehB,eAAf,CAAnB;AACA,QAAMiB,OAAO,GAAI,2CAA2CD,UAAY,EAAxE;AAEA,SACC;AACA;AACC,yBAAkBC,OADnB;AAEC,MAAA,SAAS,EAAC,mCAFX;AAGC,MAAA,SAAS,EAAGN;AAHb,OAKC;AACC,MAAA,SAAS,EAAC,0CADX;AAEC,MAAA,GAAG,EAAGF;AAFP,OAIC;AAAQ,MAAA,EAAE,EAAGQ;AAAb,OAAyB,cAAI,WAAJ,CAAzB,CAJD,EAKC,4BAAC,kBAAD;AACC,MAAA,IAAI,EAAGC,iBADR;AAEC,MAAA,KAAK,EAAG,cAAI,yBAAJ,CAFT;AAGC,MAAA,OAAO,EAAG,MAAMjB,mBAAmB,CAAE,KAAF;AAHpC,MALD,CALD,EAgBC;AACC,MAAA,SAAS,EAAC,2CADX;AAEC,MAAA,GAAG,EAAG,2BAAc,CACnBS,qBADmB,EAEnBF,eAFmB,CAAd;AAFP,OAOC,4BAAC,mCAAD;AACC,MAAA,QAAQ,EAAGF,iBADZ;AAEC,MAAA,gBAAgB,MAFjB;AAGC,MAAA,sBAAsB,MAHvB;AAIC,MAAA,wCAAwC;AAJzC,MAPD,CAhBD;AAFD;AAkCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalListView as ListView,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport {\n\tuseFocusOnMount,\n\tuseFocusReturn,\n\tuseInstanceId,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editSiteStore );\n\n\tconst { clearSelectedBlock, selectBlock } = useDispatch( blockEditorStore );\n\tasync function selectEditorBlock( clientId ) {\n\t\tawait clearSelectedBlock();\n\t\tselectBlock( clientId, -1 );\n\t}\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst headerFocusReturnRef = useFocusReturn();\n\tconst contentFocusReturnRef = useFocusReturn();\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}\n\n\tconst instanceId = useInstanceId( ListViewSidebar );\n\tconst labelId = `edit-site-editor__list-view-panel-label-${ instanceId }`;\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\taria-labelledby={ labelId }\n\t\t\tclassName=\"edit-site-editor__list-view-panel\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-editor__list-view-panel-header\"\n\t\t\t\tref={ headerFocusReturnRef }\n\t\t\t>\n\t\t\t\t<strong id={ labelId }>{ __( 'List View' ) }</strong>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close List View Sidebar' ) }\n\t\t\t\t\tonClick={ () => setIsListViewOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-editor__list-view-panel-content\"\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\tcontentFocusReturnRef,\n\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t] ) }\n\t\t\t>\n\t\t\t\t<ListView\n\t\t\t\t\tonSelect={ selectEditorBlock }\n\t\t\t\t\tshowNestedBlocks\n\t\t\t\t\t__experimentalFeatures\n\t\t\t\t\t__experimentalPersistentListViewFeatures\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -21,7 +21,8 @@ function DefaultSidebar(_ref) {
|
|
|
21
21
|
children,
|
|
22
22
|
closeLabel,
|
|
23
23
|
header,
|
|
24
|
-
headerClassName
|
|
24
|
+
headerClassName,
|
|
25
|
+
panelClassName
|
|
25
26
|
} = _ref;
|
|
26
27
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_interface.ComplementaryArea, {
|
|
27
28
|
className: className,
|
|
@@ -31,7 +32,8 @@ function DefaultSidebar(_ref) {
|
|
|
31
32
|
icon: icon,
|
|
32
33
|
closeLabel: closeLabel,
|
|
33
34
|
header: header,
|
|
34
|
-
headerClassName: headerClassName
|
|
35
|
+
headerClassName: headerClassName,
|
|
36
|
+
panelClassName: panelClassName
|
|
35
37
|
}, children), (0, _element.createElement)(_interface.ComplementaryAreaMoreMenuItem, {
|
|
36
38
|
scope: "core/edit-site",
|
|
37
39
|
identifier: identifier,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/default-sidebar.js"],"names":["DefaultSidebar","className","identifier","title","icon","children","closeLabel","header","headerClassName"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAMe,SAASA,cAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/default-sidebar.js"],"names":["DefaultSidebar","className","identifier","title","icon","children","closeLabel","header","headerClassName","panelClassName"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAMe,SAASA,cAAT,OAUX;AAAA,MAVoC;AACvCC,IAAAA,SADuC;AAEvCC,IAAAA,UAFuC;AAGvCC,IAAAA,KAHuC;AAIvCC,IAAAA,IAJuC;AAKvCC,IAAAA,QALuC;AAMvCC,IAAAA,UANuC;AAOvCC,IAAAA,MAPuC;AAQvCC,IAAAA,eARuC;AASvCC,IAAAA;AATuC,GAUpC;AACH,SACC,qDACC,4BAAC,4BAAD;AACC,IAAA,SAAS,EAAGR,SADb;AAEC,IAAA,KAAK,EAAC,gBAFP;AAGC,IAAA,UAAU,EAAGC,UAHd;AAIC,IAAA,KAAK,EAAGC,KAJT;AAKC,IAAA,IAAI,EAAGC,IALR;AAMC,IAAA,UAAU,EAAGE,UANd;AAOC,IAAA,MAAM,EAAGC,MAPV;AAQC,IAAA,eAAe,EAAGC,eARnB;AASC,IAAA,cAAc,EAAGC;AATlB,KAWGJ,QAXH,CADD,EAcC,4BAAC,wCAAD;AACC,IAAA,KAAK,EAAC,gBADP;AAEC,IAAA,UAAU,EAAGH,UAFd;AAGC,IAAA,IAAI,EAAGE;AAHR,KAKGD,KALH,CAdD,CADD;AAwBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tComplementaryArea,\n\tComplementaryAreaMoreMenuItem,\n} from '@wordpress/interface';\n\nexport default function DefaultSidebar( {\n\tclassName,\n\tidentifier,\n\ttitle,\n\ticon,\n\tchildren,\n\tcloseLabel,\n\theader,\n\theaderClassName,\n\tpanelClassName,\n} ) {\n\treturn (\n\t\t<>\n\t\t\t<ComplementaryArea\n\t\t\t\tclassName={ className }\n\t\t\t\tscope=\"core/edit-site\"\n\t\t\t\tidentifier={ identifier }\n\t\t\t\ttitle={ title }\n\t\t\t\ticon={ icon }\n\t\t\t\tcloseLabel={ closeLabel }\n\t\t\t\theader={ header }\n\t\t\t\theaderClassName={ headerClassName }\n\t\t\t\tpanelClassName={ panelClassName }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</ComplementaryArea>\n\t\t\t<ComplementaryAreaMoreMenuItem\n\t\t\t\tscope=\"core/edit-site\"\n\t\t\t\tidentifier={ identifier }\n\t\t\t\ticon={ icon }\n\t\t\t>\n\t\t\t\t{ title }\n\t\t\t</ComplementaryAreaMoreMenuItem>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -41,6 +41,7 @@ function GlobalStylesSidebar() {
|
|
|
41
41
|
title: (0, _i18n.__)('Styles'),
|
|
42
42
|
icon: _icons.styles,
|
|
43
43
|
closeLabel: (0, _i18n.__)('Close global styles sidebar'),
|
|
44
|
+
panelClassName: "edit-site-global-styles-sidebar__panel",
|
|
44
45
|
header: (0, _element.createElement)(_components.Flex, null, (0, _element.createElement)(_components.FlexBlock, null, (0, _element.createElement)("strong", null, (0, _i18n.__)('Styles')), (0, _element.createElement)("span", {
|
|
45
46
|
className: "edit-site-global-styles-sidebar__beta"
|
|
46
47
|
}, (0, _i18n.__)('Beta'))), (0, _element.createElement)(_components.FlexItem, null, (0, _element.createElement)(_components.DropdownMenu, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/global-styles-sidebar.js"],"names":["GlobalStylesSidebar","canReset","onReset","toggleFeature","editSiteStore","styles","moreVertical","disabled","title","onClick"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAbA;AACA;AACA;;AAMA;AACA;AACA;AAKe,SAASA,mBAAT,GAA+B;AAC7C,QAAM,CAAEC,QAAF,EAAYC,OAAZ,IAAwB,yCAA9B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAoB,uBAAaC,YAAb,CAA1B;AAEA,SACC,4BAAC,uBAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,UAAU,EAAC,yBAFZ;AAGC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAHT;AAIC,IAAA,IAAI,EAAGC,aAJR;AAKC,IAAA,UAAU,EAAG,cAAI,6BAAJ,CALd;AAMC,IAAA,MAAM,EACL,4BAAC,gBAAD,QACC,4BAAC,qBAAD,QACC,4CAAU,cAAI,QAAJ,CAAV,CADD,EAEC;AAAM,MAAA,SAAS,EAAC;AAAhB,OACG,cAAI,MAAJ,CADH,CAFD,CADD,EAOC,4BAAC,oBAAD,QACC,4BAAC,wBAAD;AACC,MAAA,IAAI,EAAGC,mBADR;AAEC,MAAA,KAAK,EAAG,cAAI,4BAAJ,CAFT;AAGC,MAAA,WAAW,EAAG;AAAEC,QAAAA,QAAQ,EAAE,CAAEN;AAAd,OAHf;AAIC,MAAA,QAAQ,EAAG,CACV;AACCO,QAAAA,KAAK,EAAE,cAAI,mBAAJ,CADR;AAECC,QAAAA,OAAO,EAAEP;AAFV,OADU,EAKV;AACCM,QAAAA,KAAK,EAAE,cAAI,eAAJ,CADR;AAECC,QAAAA,OAAO,EAAE,MACRN,aAAa,CAAE,oBAAF;AAHf,OALU;AAJZ,MADD,CAPD;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/global-styles-sidebar.js"],"names":["GlobalStylesSidebar","canReset","onReset","toggleFeature","editSiteStore","styles","moreVertical","disabled","title","onClick"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAbA;AACA;AACA;;AAMA;AACA;AACA;AAKe,SAASA,mBAAT,GAA+B;AAC7C,QAAM,CAAEC,QAAF,EAAYC,OAAZ,IAAwB,yCAA9B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAoB,uBAAaC,YAAb,CAA1B;AAEA,SACC,4BAAC,uBAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,UAAU,EAAC,yBAFZ;AAGC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAHT;AAIC,IAAA,IAAI,EAAGC,aAJR;AAKC,IAAA,UAAU,EAAG,cAAI,6BAAJ,CALd;AAMC,IAAA,cAAc,EAAC,wCANhB;AAOC,IAAA,MAAM,EACL,4BAAC,gBAAD,QACC,4BAAC,qBAAD,QACC,4CAAU,cAAI,QAAJ,CAAV,CADD,EAEC;AAAM,MAAA,SAAS,EAAC;AAAhB,OACG,cAAI,MAAJ,CADH,CAFD,CADD,EAOC,4BAAC,oBAAD,QACC,4BAAC,wBAAD;AACC,MAAA,IAAI,EAAGC,mBADR;AAEC,MAAA,KAAK,EAAG,cAAI,4BAAJ,CAFT;AAGC,MAAA,WAAW,EAAG;AAAEC,QAAAA,QAAQ,EAAE,CAAEN;AAAd,OAHf;AAIC,MAAA,QAAQ,EAAG,CACV;AACCO,QAAAA,KAAK,EAAE,cAAI,mBAAJ,CADR;AAECC,QAAAA,OAAO,EAAEP;AAFV,OADU,EAKV;AACCM,QAAAA,KAAK,EAAE,cAAI,eAAJ,CADR;AAECC,QAAAA,OAAO,EAAE,MACRN,aAAa,CAAE,oBAAF;AAHf,OALU;AAJZ,MADD,CAPD;AARF,KAoCC,4BAAC,4BAAD,OApCD,CADD;AAwCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu, FlexItem, FlexBlock, Flex } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { styles, moreVertical } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport { GlobalStylesUI, useGlobalStylesReset } from '../global-styles';\nimport { store as editSiteStore } from '../../store';\n\nexport default function GlobalStylesSidebar() {\n\tconst [ canReset, onReset ] = useGlobalStylesReset();\n\tconst { toggleFeature } = useDispatch( editSiteStore );\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\tpanelClassName=\"edit-site-global-styles-sidebar__panel\"\n\t\t\theader={\n\t\t\t\t<Flex>\n\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t<strong>{ __( 'Styles' ) }</strong>\n\t\t\t\t\t\t<span className=\"edit-site-global-styles-sidebar__beta\">\n\t\t\t\t\t\t\t{ __( 'Beta' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ __( 'More Global Styles Actions' ) }\n\t\t\t\t\t\t\ttoggleProps={ { disabled: ! canReset } }\n\t\t\t\t\t\t\tcontrols={ [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttitle: __( 'Reset to defaults' ),\n\t\t\t\t\t\t\t\t\tonClick: onReset,\n\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\ttitle: __( 'Welcome Guide' ),\n\t\t\t\t\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\t\t\t\t\ttoggleFeature( 'welcomeGuideStyles' ),\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</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t}\n\t\t>\n\t\t\t<GlobalStylesUI />\n\t\t</DefaultSidebar>\n\t);\n}\n"]}
|
|
@@ -24,25 +24,16 @@ function URLQueryController() {
|
|
|
24
24
|
const {
|
|
25
25
|
setTemplate,
|
|
26
26
|
setTemplatePart,
|
|
27
|
-
showHomepage,
|
|
28
27
|
setPage
|
|
29
28
|
} = (0, _data.useDispatch)(_store.store);
|
|
30
|
-
const history = (0, _routes.useHistory)();
|
|
31
29
|
const {
|
|
32
30
|
params: {
|
|
33
31
|
postId,
|
|
34
32
|
postType
|
|
35
33
|
}
|
|
36
|
-
} = (0, _routes.useLocation)();
|
|
37
|
-
const {
|
|
38
|
-
getPage,
|
|
39
|
-
getEditedPostId,
|
|
40
|
-
getEditedPostType
|
|
41
|
-
} = (0, _data.useSelect)(_store.store); // Set correct entity on page navigation.
|
|
34
|
+
} = (0, _routes.useLocation)(); // Set correct entity on page navigation.
|
|
42
35
|
|
|
43
36
|
(0, _element.useEffect)(() => {
|
|
44
|
-
let isMounted = true;
|
|
45
|
-
|
|
46
37
|
if ('page' === postType || 'post' === postType) {
|
|
47
38
|
setPage({
|
|
48
39
|
context: {
|
|
@@ -54,35 +45,7 @@ function URLQueryController() {
|
|
|
54
45
|
setTemplate(postId);
|
|
55
46
|
} else if ('wp_template_part' === postType) {
|
|
56
47
|
setTemplatePart(postId);
|
|
57
|
-
} else {
|
|
58
|
-
showHomepage().then(() => {
|
|
59
|
-
var _page$context, _page$context2;
|
|
60
|
-
|
|
61
|
-
if (!isMounted) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const page = getPage();
|
|
66
|
-
const editedPostId = getEditedPostId();
|
|
67
|
-
const editedPostType = getEditedPostType();
|
|
68
|
-
|
|
69
|
-
if (page !== null && page !== void 0 && (_page$context = page.context) !== null && _page$context !== void 0 && _page$context.postId && page !== null && page !== void 0 && (_page$context2 = page.context) !== null && _page$context2 !== void 0 && _page$context2.postType) {
|
|
70
|
-
history.replace({
|
|
71
|
-
postId: page.context.postId,
|
|
72
|
-
postType: page.context.postType
|
|
73
|
-
});
|
|
74
|
-
} else if (editedPostId && editedPostType) {
|
|
75
|
-
history.replace({
|
|
76
|
-
postId: editedPostId,
|
|
77
|
-
postType: editedPostType
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
48
|
}
|
|
82
|
-
|
|
83
|
-
return () => {
|
|
84
|
-
isMounted = false;
|
|
85
|
-
};
|
|
86
49
|
}, [postId, postType]);
|
|
87
50
|
return null;
|
|
88
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/url-query-controller/index.js"],"names":["URLQueryController","setTemplate","setTemplatePart","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/url-query-controller/index.js"],"names":["URLQueryController","setTemplate","setTemplatePart","setPage","editSiteStore","params","postId","postType","context"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIe,SAASA,kBAAT,GAA8B;AAC5C,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,eAAf;AAAgCC,IAAAA;AAAhC,MAA4C,uBACjDC,YADiD,CAAlD;AAGA,QAAM;AACLC,IAAAA,MAAM,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA;AAAV;AADH,MAEF,0BAFJ,CAJ4C,CAQ5C;;AACA,0BAAW,MAAM;AAChB,QAAK,WAAWA,QAAX,IAAuB,WAAWA,QAAvC,EAAkD;AACjDJ,MAAAA,OAAO,CAAE;AAAEK,QAAAA,OAAO,EAAE;AAAED,UAAAA,QAAF;AAAYD,UAAAA;AAAZ;AAAX,OAAF,CAAP,CADiD,CACH;AAC9C,KAFD,MAEO,IAAK,kBAAkBC,QAAvB,EAAkC;AACxCN,MAAAA,WAAW,CAAEK,MAAF,CAAX;AACA,KAFM,MAEA,IAAK,uBAAuBC,QAA5B,EAAuC;AAC7CL,MAAAA,eAAe,CAAEI,MAAF,CAAf;AACA;AACD,GARD,EAQG,CAAEA,MAAF,EAAUC,QAAV,CARH;AAUA,SAAO,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useLocation } from '../routes';\nimport { store as editSiteStore } from '../../store';\n\nexport default function URLQueryController() {\n\tconst { setTemplate, setTemplatePart, setPage } = useDispatch(\n\t\teditSiteStore\n\t);\n\tconst {\n\t\tparams: { postId, postType },\n\t} = useLocation();\n\n\t// Set correct entity on page navigation.\n\tuseEffect( () => {\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}\n\t}, [ postId, postType ] );\n\n\treturn null;\n}\n"]}
|
package/build/index.js
CHANGED
|
@@ -54,8 +54,6 @@ var _viewport = require("@wordpress/viewport");
|
|
|
54
54
|
|
|
55
55
|
var _url = require("@wordpress/url");
|
|
56
56
|
|
|
57
|
-
require("./plugins");
|
|
58
|
-
|
|
59
57
|
require("./hooks");
|
|
60
58
|
|
|
61
59
|
var _store = require("./store");
|
|
@@ -64,6 +62,8 @@ var _app = _interopRequireDefault(require("./components/app"));
|
|
|
64
62
|
|
|
65
63
|
var _getIsListPage = _interopRequireDefault(require("./utils/get-is-list-page"));
|
|
66
64
|
|
|
65
|
+
var _redirectToHomepage = _interopRequireDefault(require("./components/routes/redirect-to-homepage"));
|
|
66
|
+
|
|
67
67
|
var _mainDashboardButton = _interopRequireDefault(require("./components/main-dashboard-button"));
|
|
68
68
|
|
|
69
69
|
var _navigationToggle = _interopRequireDefault(require("./components/navigation-sidebar/navigation-toggle"));
|
|
@@ -90,8 +90,13 @@ var _pluginMoreMenuItem = _interopRequireDefault(require("./components/header/pl
|
|
|
90
90
|
* @param {Element} target DOM node in which editor is rendered.
|
|
91
91
|
* @param {?Object} settings Editor settings object.
|
|
92
92
|
*/
|
|
93
|
-
function reinitializeEditor(target, settings) {
|
|
94
|
-
//
|
|
93
|
+
async function reinitializeEditor(target, settings) {
|
|
94
|
+
// The site editor relies on `postType` and `postId` params in the URL to
|
|
95
|
+
// define what's being edited. When visiting via the dashboard link, these
|
|
96
|
+
// won't be present. Do a client side redirect to the 'homepage' if that's
|
|
97
|
+
// the case.
|
|
98
|
+
await (0, _redirectToHomepage.default)(settings.siteUrl); // This will be a no-op if the target doesn't have any React nodes.
|
|
99
|
+
|
|
95
100
|
(0, _element.unmountComponentAtNode)(target);
|
|
96
101
|
const reboot = reinitializeEditor.bind(null, target, settings); // We dispatch actions and update the store synchronously before rendering
|
|
97
102
|
// so that we won't trigger unnecessary re-renders with useEffect.
|