@wordpress/edit-site 4.15.1-next.4d3b314fd5.0 → 4.17.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 +4 -0
- package/build/components/block-editor/block-inspector-button.js +1 -1
- package/build/components/block-editor/block-inspector-button.js.map +1 -1
- package/build/components/block-editor/index.js +17 -11
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +11 -35
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/editor/index.js +5 -7
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/preview.js +85 -50
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +35 -4
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +49 -2
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +143 -83
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-preview.js +54 -0
- package/build/components/global-styles/typography-preview.js.map +1 -0
- package/build/components/global-styles/typography-utils.js +39 -176
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +34 -16
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/{header → header-edit-mode}/document-actions/index.js +58 -24
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -0
- package/build/components/{header → header-edit-mode}/index.js +13 -49
- package/build/components/header-edit-mode/index.js.map +1 -0
- package/build/components/{header → header-edit-mode}/mode-switcher/index.js +0 -0
- package/build/components/header-edit-mode/mode-switcher/index.js.map +1 -0
- package/build/components/{header → header-edit-mode}/more-menu/copy-content-menu-item.js +0 -0
- package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +1 -0
- package/build/components/{header → header-edit-mode}/more-menu/index.js +0 -0
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -0
- package/build/components/{header → header-edit-mode}/more-menu/site-export.js +0 -0
- package/build/components/header-edit-mode/more-menu/site-export.js.map +1 -0
- package/build/components/{header → header-edit-mode}/more-menu/welcome-guide-menu-item.js +0 -0
- package/build/components/header-edit-mode/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build/components/{header → header-edit-mode}/plugin-more-menu-item/index.js +0 -0
- package/build/components/header-edit-mode/plugin-more-menu-item/index.js.map +1 -0
- package/build/components/{header → header-edit-mode}/plugin-sidebar-more-menu-item/index.js +0 -0
- package/build/components/header-edit-mode/plugin-sidebar-more-menu-item/index.js.map +1 -0
- package/build/components/{header → header-edit-mode}/tools-more-menu-group/index.js +0 -0
- package/build/components/header-edit-mode/tools-more-menu-group/index.js.map +1 -0
- package/build/components/{header → header-edit-mode}/undo-redo/redo.js +0 -0
- package/build/components/header-edit-mode/undo-redo/redo.js.map +1 -0
- package/build/components/{header → header-edit-mode}/undo-redo/undo.js +0 -0
- package/build/components/header-edit-mode/undo-redo/undo.js.map +1 -0
- package/build/components/keyboard-shortcuts/index.js +1 -1
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/main-dashboard-button/index.js +2 -2
- package/build/components/main-dashboard-button/index.js.map +1 -1
- package/build/components/{sidebar → sidebar-edit-mode}/constants.js +0 -0
- package/build/components/sidebar-edit-mode/constants.js.map +1 -0
- package/build/components/{sidebar → sidebar-edit-mode}/default-sidebar.js +0 -0
- package/build/components/sidebar-edit-mode/default-sidebar.js.map +1 -0
- package/build/components/{sidebar → sidebar-edit-mode}/global-styles-sidebar.js +0 -0
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -0
- package/build/components/{sidebar → sidebar-edit-mode}/index.js +1 -1
- package/build/components/sidebar-edit-mode/index.js.map +1 -0
- package/build/components/{sidebar → sidebar-edit-mode}/navigation-menu-sidebar/index.js +0 -0
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +1 -0
- package/build/components/{sidebar → sidebar-edit-mode}/navigation-menu-sidebar/navigation-inspector.js +0 -0
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +1 -0
- package/build/components/{sidebar → sidebar-edit-mode}/navigation-menu-sidebar/navigation-menu.js +0 -0
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +1 -0
- package/build/components/{sidebar → sidebar-edit-mode}/plugin-sidebar/index.js +1 -1
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -0
- package/build/components/{sidebar → sidebar-edit-mode}/settings-header/index.js +2 -2
- package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -0
- package/build/components/{sidebar → sidebar-edit-mode}/template-card/index.js +0 -0
- package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -0
- package/build/components/{sidebar → sidebar-edit-mode}/template-card/template-actions.js +0 -0
- package/build/components/sidebar-edit-mode/template-card/template-actions.js.map +1 -0
- package/build/components/{sidebar → sidebar-edit-mode}/template-card/template-areas.js +0 -0
- package/build/components/sidebar-edit-mode/template-card/template-areas.js.map +1 -0
- package/build/index.js +23 -4
- package/build/index.js.map +1 -1
- package/build-module/components/block-editor/block-inspector-button.js +1 -1
- package/build-module/components/block-editor/block-inspector-button.js.map +1 -1
- package/build-module/components/block-editor/index.js +16 -10
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +10 -34
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/editor/index.js +4 -6
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/preview.js +85 -50
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +36 -6
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +48 -2
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +143 -85
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-preview.js +46 -0
- package/build-module/components/global-styles/typography-preview.js.map +1 -0
- package/build-module/components/global-styles/typography-utils.js +37 -169
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +33 -16
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/{header → header-edit-mode}/document-actions/index.js +53 -24
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -0
- package/build-module/components/{header → header-edit-mode}/index.js +13 -46
- package/build-module/components/header-edit-mode/index.js.map +1 -0
- package/build-module/components/{header → header-edit-mode}/mode-switcher/index.js +0 -0
- package/build-module/components/header-edit-mode/mode-switcher/index.js.map +1 -0
- package/build-module/components/{header → header-edit-mode}/more-menu/copy-content-menu-item.js +0 -0
- package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +1 -0
- package/build-module/components/{header → header-edit-mode}/more-menu/index.js +0 -0
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -0
- package/build-module/components/{header → header-edit-mode}/more-menu/site-export.js +0 -0
- package/build-module/components/header-edit-mode/more-menu/site-export.js.map +1 -0
- package/build-module/components/{header → header-edit-mode}/more-menu/welcome-guide-menu-item.js +0 -0
- package/build-module/components/header-edit-mode/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build-module/components/{header → header-edit-mode}/plugin-more-menu-item/index.js +0 -0
- package/build-module/components/header-edit-mode/plugin-more-menu-item/index.js.map +1 -0
- package/build-module/components/{header → header-edit-mode}/plugin-sidebar-more-menu-item/index.js +0 -0
- package/build-module/components/header-edit-mode/plugin-sidebar-more-menu-item/index.js.map +1 -0
- package/build-module/components/{header → header-edit-mode}/tools-more-menu-group/index.js +0 -0
- package/build-module/components/header-edit-mode/tools-more-menu-group/index.js.map +1 -0
- package/build-module/components/{header → header-edit-mode}/undo-redo/redo.js +0 -0
- package/build-module/components/header-edit-mode/undo-redo/redo.js.map +1 -0
- package/build-module/components/{header → header-edit-mode}/undo-redo/undo.js +0 -0
- package/build-module/components/header-edit-mode/undo-redo/undo.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/index.js +1 -1
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/main-dashboard-button/index.js +3 -3
- package/build-module/components/main-dashboard-button/index.js.map +1 -1
- package/build-module/components/{sidebar → sidebar-edit-mode}/constants.js +0 -0
- package/build-module/components/sidebar-edit-mode/constants.js.map +1 -0
- package/build-module/components/{sidebar → sidebar-edit-mode}/default-sidebar.js +0 -0
- package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +1 -0
- package/build-module/components/{sidebar → sidebar-edit-mode}/global-styles-sidebar.js +0 -0
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -0
- package/build-module/components/{sidebar → sidebar-edit-mode}/index.js +1 -1
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -0
- package/build-module/components/{sidebar → sidebar-edit-mode}/navigation-menu-sidebar/index.js +0 -0
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +1 -0
- package/build-module/components/{sidebar → sidebar-edit-mode}/navigation-menu-sidebar/navigation-inspector.js +0 -0
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +1 -0
- package/build-module/components/{sidebar → sidebar-edit-mode}/navigation-menu-sidebar/navigation-menu.js +0 -0
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +1 -0
- package/build-module/components/{sidebar → sidebar-edit-mode}/plugin-sidebar/index.js +1 -1
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -0
- package/build-module/components/{sidebar → sidebar-edit-mode}/settings-header/index.js +2 -2
- package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -0
- package/build-module/components/{sidebar → sidebar-edit-mode}/template-card/index.js +0 -0
- package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -0
- package/build-module/components/{sidebar → sidebar-edit-mode}/template-card/template-actions.js +0 -0
- package/build-module/components/sidebar-edit-mode/template-card/template-actions.js.map +1 -0
- package/build-module/components/{sidebar → sidebar-edit-mode}/template-card/template-areas.js +0 -0
- package/build-module/components/sidebar-edit-mode/template-card/template-areas.js.map +1 -0
- package/build-module/index.js +22 -4
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +64 -89
- package/build-style/style.css +64 -89
- package/package.json +29 -29
- package/src/components/block-editor/block-inspector-button.js +1 -1
- package/src/components/block-editor/index.js +29 -11
- package/src/components/block-editor/resizable-editor.js +8 -37
- package/src/components/editor/index.js +2 -4
- package/src/components/global-styles/preview.js +81 -60
- package/src/components/global-styles/screen-style-variations.js +39 -4
- package/src/components/global-styles/screen-typography-element.js +65 -1
- package/src/components/global-styles/style.scss +2 -2
- package/src/components/global-styles/test/typography-utils.js +333 -103
- package/src/components/global-styles/test/use-global-styles-output.js +57 -3
- package/src/components/global-styles/typography-panel.js +205 -150
- package/src/components/global-styles/typography-preview.js +49 -0
- package/src/components/global-styles/typography-utils.js +34 -195
- package/src/components/global-styles/use-global-styles-output.js +31 -9
- package/src/components/{header → header-edit-mode}/document-actions/index.js +67 -46
- package/src/components/{header → header-edit-mode}/document-actions/style.scss +0 -0
- package/src/components/{header → header-edit-mode}/index.js +12 -44
- package/src/components/{header → header-edit-mode}/mode-switcher/index.js +0 -0
- package/src/components/{header → header-edit-mode}/more-menu/copy-content-menu-item.js +0 -0
- package/src/components/{header → header-edit-mode}/more-menu/index.js +0 -0
- package/src/components/{header → header-edit-mode}/more-menu/site-export.js +0 -0
- package/src/components/{header → header-edit-mode}/more-menu/welcome-guide-menu-item.js +0 -0
- package/src/components/{header → header-edit-mode}/plugin-more-menu-item/index.js +0 -0
- package/src/components/{header → header-edit-mode}/plugin-sidebar-more-menu-item/index.js +0 -0
- package/src/components/{header → header-edit-mode}/style.scss +20 -50
- package/src/components/{header → header-edit-mode}/tools-more-menu-group/index.js +0 -0
- package/src/components/{header → header-edit-mode}/undo-redo/redo.js +0 -0
- package/src/components/{header → header-edit-mode}/undo-redo/undo.js +0 -0
- package/src/components/keyboard-shortcuts/index.js +1 -1
- package/src/components/main-dashboard-button/index.js +3 -3
- package/src/components/{sidebar → sidebar-edit-mode}/constants.js +0 -0
- package/src/components/{sidebar → sidebar-edit-mode}/default-sidebar.js +0 -0
- package/src/components/{sidebar → sidebar-edit-mode}/global-styles-sidebar.js +0 -0
- package/src/components/{sidebar → sidebar-edit-mode}/index.js +1 -1
- package/src/components/{sidebar → sidebar-edit-mode}/navigation-menu-sidebar/index.js +0 -0
- package/src/components/{sidebar → sidebar-edit-mode}/navigation-menu-sidebar/navigation-inspector.js +0 -0
- package/src/components/{sidebar → sidebar-edit-mode}/navigation-menu-sidebar/navigation-menu.js +0 -0
- package/src/components/{sidebar → sidebar-edit-mode}/navigation-menu-sidebar/style.scss +0 -0
- package/src/components/{sidebar → sidebar-edit-mode}/plugin-sidebar/index.js +1 -1
- package/src/components/{sidebar → sidebar-edit-mode}/settings-header/index.js +2 -2
- package/src/components/{sidebar → sidebar-edit-mode}/settings-header/style.scss +2 -2
- package/src/components/{sidebar → sidebar-edit-mode}/style.scss +2 -2
- package/src/components/{sidebar → sidebar-edit-mode}/template-card/index.js +0 -0
- package/src/components/{sidebar → sidebar-edit-mode}/template-card/style.scss +0 -0
- package/src/components/{sidebar → sidebar-edit-mode}/template-card/template-actions.js +0 -0
- package/src/components/{sidebar → sidebar-edit-mode}/template-card/template-areas.js +0 -0
- package/src/index.js +24 -3
- package/src/style.scss +6 -6
- package/build/components/header/document-actions/index.js.map +0 -1
- package/build/components/header/index.js.map +0 -1
- package/build/components/header/mode-switcher/index.js.map +0 -1
- package/build/components/header/more-menu/copy-content-menu-item.js.map +0 -1
- package/build/components/header/more-menu/index.js.map +0 -1
- package/build/components/header/more-menu/site-export.js.map +0 -1
- package/build/components/header/more-menu/welcome-guide-menu-item.js.map +0 -1
- package/build/components/header/plugin-more-menu-item/index.js.map +0 -1
- package/build/components/header/plugin-sidebar-more-menu-item/index.js.map +0 -1
- package/build/components/header/tools-more-menu-group/index.js.map +0 -1
- package/build/components/header/undo-redo/redo.js.map +0 -1
- package/build/components/header/undo-redo/undo.js.map +0 -1
- package/build/components/sidebar/constants.js.map +0 -1
- package/build/components/sidebar/default-sidebar.js.map +0 -1
- package/build/components/sidebar/global-styles-sidebar.js.map +0 -1
- package/build/components/sidebar/index.js.map +0 -1
- package/build/components/sidebar/navigation-menu-sidebar/index.js.map +0 -1
- package/build/components/sidebar/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
- package/build/components/sidebar/navigation-menu-sidebar/navigation-menu.js.map +0 -1
- package/build/components/sidebar/plugin-sidebar/index.js.map +0 -1
- package/build/components/sidebar/settings-header/index.js.map +0 -1
- package/build/components/sidebar/template-card/index.js.map +0 -1
- package/build/components/sidebar/template-card/template-actions.js.map +0 -1
- package/build/components/sidebar/template-card/template-areas.js.map +0 -1
- package/build-module/components/header/document-actions/index.js.map +0 -1
- package/build-module/components/header/index.js.map +0 -1
- package/build-module/components/header/mode-switcher/index.js.map +0 -1
- package/build-module/components/header/more-menu/copy-content-menu-item.js.map +0 -1
- package/build-module/components/header/more-menu/index.js.map +0 -1
- package/build-module/components/header/more-menu/site-export.js.map +0 -1
- package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +0 -1
- package/build-module/components/header/plugin-more-menu-item/index.js.map +0 -1
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js.map +0 -1
- package/build-module/components/header/tools-more-menu-group/index.js.map +0 -1
- package/build-module/components/header/undo-redo/redo.js.map +0 -1
- package/build-module/components/header/undo-redo/undo.js.map +0 -1
- package/build-module/components/sidebar/constants.js.map +0 -1
- package/build-module/components/sidebar/default-sidebar.js.map +0 -1
- package/build-module/components/sidebar/global-styles-sidebar.js.map +0 -1
- package/build-module/components/sidebar/index.js.map +0 -1
- package/build-module/components/sidebar/navigation-menu-sidebar/index.js.map +0 -1
- package/build-module/components/sidebar/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
- package/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js.map +0 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js.map +0 -1
- package/build-module/components/sidebar/settings-header/index.js.map +0 -1
- package/build-module/components/sidebar/template-card/index.js.map +0 -1
- package/build-module/components/sidebar/template-card/template-actions.js.map +0 -1
- package/build-module/components/sidebar/template-card/template-areas.js.map +0 -1
|
@@ -25,7 +25,7 @@ import { store as interfaceStore } from '@wordpress/interface';
|
|
|
25
25
|
|
|
26
26
|
import TemplatePartConverter from '../template-part-converter';
|
|
27
27
|
import NavigateToLink from '../navigate-to-link';
|
|
28
|
-
import { SidebarInspectorFill } from '../sidebar';
|
|
28
|
+
import { SidebarInspectorFill } from '../sidebar-edit-mode';
|
|
29
29
|
import { store as editSiteStore } from '../../store';
|
|
30
30
|
import BlockInspectorButton from './block-inspector-button';
|
|
31
31
|
import BackButton from './back-button';
|
|
@@ -35,6 +35,7 @@ const LAYOUT = {
|
|
|
35
35
|
// At the root level of the site editor, no alignments should be allowed.
|
|
36
36
|
alignments: []
|
|
37
37
|
};
|
|
38
|
+
const NAVIGATION_SIDEBAR_NAME = 'edit-site/navigation-menu';
|
|
38
39
|
export default function BlockEditor(_ref) {
|
|
39
40
|
var _storedSettings$__exp, _storedSettings$__exp2;
|
|
40
41
|
|
|
@@ -45,7 +46,8 @@ export default function BlockEditor(_ref) {
|
|
|
45
46
|
storedSettings,
|
|
46
47
|
templateType,
|
|
47
48
|
templateId,
|
|
48
|
-
page
|
|
49
|
+
page,
|
|
50
|
+
isNavigationSidebarOpen
|
|
49
51
|
} = useSelect(select => {
|
|
50
52
|
const {
|
|
51
53
|
getSettings,
|
|
@@ -57,7 +59,8 @@ export default function BlockEditor(_ref) {
|
|
|
57
59
|
storedSettings: getSettings(setIsInserterOpen),
|
|
58
60
|
templateType: getEditedPostType(),
|
|
59
61
|
templateId: getEditedPostId(),
|
|
60
|
-
page: getPage()
|
|
62
|
+
page: getPage(),
|
|
63
|
+
isNavigationSidebarOpen: select(interfaceStore).getActiveComplementaryArea(editSiteStore.name) === NAVIGATION_SIDEBAR_NAME
|
|
61
64
|
};
|
|
62
65
|
}, [setIsInserterOpen]);
|
|
63
66
|
const settingsBlockPatterns = (_storedSettings$__exp = storedSettings.__experimentalAdditionalBlockPatterns) !== null && _storedSettings$__exp !== void 0 ? _storedSettings$__exp : // WP 6.0
|
|
@@ -96,11 +99,13 @@ export default function BlockEditor(_ref) {
|
|
|
96
99
|
setPage
|
|
97
100
|
} = useDispatch(editSiteStore);
|
|
98
101
|
const {
|
|
99
|
-
enableComplementaryArea
|
|
102
|
+
enableComplementaryArea,
|
|
103
|
+
disableComplementaryArea
|
|
100
104
|
} = useDispatch(interfaceStore);
|
|
101
|
-
const
|
|
102
|
-
enableComplementaryArea
|
|
103
|
-
|
|
105
|
+
const toggleNavigationSidebar = useCallback(() => {
|
|
106
|
+
const toggleComplementaryArea = isNavigationSidebarOpen ? disableComplementaryArea : enableComplementaryArea;
|
|
107
|
+
toggleComplementaryArea(editSiteStore.name, NAVIGATION_SIDEBAR_NAME);
|
|
108
|
+
}, [isNavigationSidebarOpen]);
|
|
104
109
|
const contentRef = useRef();
|
|
105
110
|
const mergedRefs = useMergeRefs([contentRef, useTypingObserver()]);
|
|
106
111
|
const isMobileViewport = useViewportMatch('small', '<');
|
|
@@ -112,9 +117,10 @@ export default function BlockEditor(_ref) {
|
|
|
112
117
|
|
|
113
118
|
const NavMenuSidebarToggle = () => createElement(ToolbarGroup, null, createElement(ToolbarButton, {
|
|
114
119
|
className: "components-toolbar__control",
|
|
115
|
-
label: __('Open list view'),
|
|
116
|
-
onClick:
|
|
117
|
-
icon: listView
|
|
120
|
+
label: isNavigationSidebarOpen ? __('Close list view') : __('Open list view'),
|
|
121
|
+
onClick: toggleNavigationSidebar,
|
|
122
|
+
icon: listView,
|
|
123
|
+
isActive: isNavigationSidebarOpen
|
|
118
124
|
})); // Conditionally include NavMenu sidebar in Plugin only.
|
|
119
125
|
// Optimise for dead code elimination.
|
|
120
126
|
// See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["classnames","useSelect","useDispatch","useCallback","useMemo","useRef","Fragment","useEntityBlockEditor","store","coreStore","BlockList","BlockEditorProvider","__experimentalLinkControl","BlockInspector","BlockTools","__unstableBlockToolbarLastItem","__unstableBlockSettingsMenuFirstItem","__unstableUseTypingObserver","useTypingObserver","BlockEditorKeyboardShortcuts","blockEditorStore","__unstableBlockNameContext","useMergeRefs","useViewportMatch","ReusableBlocksMenuItems","listView","ToolbarButton","ToolbarGroup","__","interfaceStore","TemplatePartConverter","NavigateToLink","SidebarInspectorFill","editSiteStore","BlockInspectorButton","BackButton","ResizableEditor","LAYOUT","type","alignments","BlockEditor","setIsInserterOpen","storedSettings","templateType","templateId","page","select","getSettings","getEditedPostType","getEditedPostId","getPage","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","getBlockPatterns","getBlockPatternCategories","blockPatterns","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","settings","restStoredSettings","blocks","onInput","onChange","setPage","enableComplementaryArea","openNavigationSidebar","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","isTemplatePart","hasBlocks","length","NavMenuSidebarToggle","MaybeNavMenuSidebarToggle","process","env","IS_GUTENBERG_PLUGIN","fillProps","event","target","currentTarget","undefined","onClose","blockName"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,WAAT,EAAsBC,OAAtB,EAA+BC,MAA/B,EAAuCC,QAAvC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D,uBAAiBsF;AADiC,KAA7B,CADvB;AAIC,IAAA,oBAAoB,EAAGJ,UAJxB;AAKC,IAAA,OAAO,EAAKa,KAAF,IAAa;AACtB;AACA,UAAKA,KAAK,CAACC,MAAN,KAAiBD,KAAK,CAACE,aAA5B,EAA4C;AAC3CZ,QAAAA,kBAAkB;AAClB;AACD;AAVF,KAYC,cAAC,4BAAD,CAA8B,QAA9B,OAZD,EAaC,cAAC,UAAD,OAbD,EAcC,cAAC,eAAD,CACC;AADD;AAEC,IAAA,GAAG,EAAGzC,UAFP;AAGC,IAAA,cAAc,EACb0C,cAAc,IACd;AACA,KAAEF,gBANJ;AAQC,IAAA,QAAQ,EAAGV,QARZ;AASC,IAAA,UAAU,EAAGS;AATd,KAWC,cAAC,SAAD;AACC,IAAA,SAAS,EAAC,mDADX;AAEC,IAAA,oBAAoB,EAAG9C,MAFxB;AAGC,IAAA,cAAc,EACbiD,cAAc,IAAIC,SAAlB,GAA8B,KAA9B,GAAsCW;AAJxC,IAXD,CAdD,EAiCC,cAAC,oCAAD,QACG;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WACD,cAAC,oBAAD;AAAsB,MAAA,OAAO,EAAGA;AAAhC,MADC;AAAA,GADH,CAjCD,EAsCC,cAAC,8BAAD,QACC,cAAC,0BAAD,CAA4B,QAA5B,QACKC,SAAF,IACDA,SAAS,KAAK,iBAAd,IACC,cAAC,yBAAD,OAHH,CADD,CAtCD,CAvBD,EAuEC,cAAC,uBAAD,OAvED,CADD;AA2EA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCallback, useMemo, useRef, Fragment } from '@wordpress/element';\nimport { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data';\nimport {\n\tBlockList,\n\tBlockEditorProvider,\n\t__experimentalLinkControl,\n\tBlockInspector,\n\tBlockTools,\n\t__unstableBlockToolbarLastItem,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tBlockEditorKeyboardShortcuts,\n\tstore as blockEditorStore,\n\t__unstableBlockNameContext,\n} from '@wordpress/block-editor';\nimport { useMergeRefs, useViewportMatch } from '@wordpress/compose';\nimport { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';\nimport { listView } from '@wordpress/icons';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartConverter from '../template-part-converter';\nimport NavigateToLink from '../navigate-to-link';\nimport { SidebarInspectorFill } from '../sidebar';\nimport { store as editSiteStore } from '../../store';\nimport BlockInspectorButton from './block-inspector-button';\nimport BackButton from './back-button';\nimport ResizableEditor from './resizable-editor';\n\nconst LAYOUT = {\n\ttype: 'default',\n\t// At the root level of the site editor, no alignments should be allowed.\n\talignments: [],\n};\n\nexport default function BlockEditor( { setIsInserterOpen } ) {\n\tconst { storedSettings, templateType, templateId, page } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, getEditedPostType, getEditedPostId, getPage } =\n\t\t\t\tselect( editSiteStore );\n\n\t\t\treturn {\n\t\t\t\tstoredSettings: getSettings( setIsInserterOpen ),\n\t\t\t\ttemplateType: getEditedPostType(),\n\t\t\t\ttemplateId: getEditedPostId(),\n\t\t\t\tpage: getPage(),\n\t\t\t};\n\t\t},\n\t\t[ setIsInserterOpen ]\n\t);\n\n\tconst settingsBlockPatterns =\n\t\tstoredSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tstoredSettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories:\n\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( templateType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, templateType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst settings = useMemo( () => {\n\t\tconst {\n\t\t\t__experimentalAdditionalBlockPatterns,\n\t\t\t__experimentalAdditionalBlockPatternCategories,\n\t\t\t...restStoredSettings\n\t\t} = storedSettings;\n\n\t\treturn {\n\t\t\t...restStoredSettings,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t};\n\t}, [ storedSettings, blockPatterns, blockPatternCategories ] );\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplateType\n\t);\n\tconst { setPage } = useDispatch( editSiteStore );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst openNavigationSidebar = useCallback( () => {\n\t\tenableComplementaryArea(\n\t\t\t'core/edit-site',\n\t\t\t'edit-site/navigation-menu'\n\t\t);\n\t}, [ enableComplementaryArea ] );\n\tconst contentRef = useRef();\n\tconst mergedRefs = useMergeRefs( [ contentRef, useTypingObserver() ] );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\n\tconst isTemplatePart = templateType === 'wp_template_part';\n\tconst hasBlocks = blocks.length !== 0;\n\n\tconst NavMenuSidebarToggle = () => (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName=\"components-toolbar__control\"\n\t\t\t\tlabel={ __( 'Open list view' ) }\n\t\t\t\tonClick={ openNavigationSidebar }\n\t\t\t\ticon={ listView }\n\t\t\t/>\n\t\t</ToolbarGroup>\n\t);\n\n\t// Conditionally include NavMenu sidebar in Plugin only.\n\t// Optimise for dead code elimination.\n\t// See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination.\n\tlet MaybeNavMenuSidebarToggle = Fragment;\n\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\tMaybeNavMenuSidebarToggle = NavMenuSidebarToggle;\n\t}\n\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ settings }\n\t\t\tvalue={ blocks }\n\t\t\tonInput={ onInput }\n\t\t\tonChange={ onChange }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t<TemplatePartConverter />\n\t\t\t<__experimentalLinkControl.ViewerFill>\n\t\t\t\t{ useCallback(\n\t\t\t\t\t( fillProps ) => (\n\t\t\t\t\t\t<NavigateToLink\n\t\t\t\t\t\t\t{ ...fillProps }\n\t\t\t\t\t\t\tactivePage={ page }\n\t\t\t\t\t\t\tonActivePageChange={ setPage }\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\t[ page ]\n\t\t\t\t) }\n\t\t\t</__experimentalLinkControl.ViewerFill>\n\t\t\t<SidebarInspectorFill>\n\t\t\t\t<BlockInspector />\n\t\t\t</SidebarInspectorFill>\n\t\t\t<BlockTools\n\t\t\t\tclassName={ classnames( 'edit-site-visual-editor', {\n\t\t\t\t\t'is-focus-mode': isTemplatePart,\n\t\t\t\t} ) }\n\t\t\t\t__unstableContentRef={ contentRef }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t// Clear selected block when clicking on the gray background.\n\t\t\t\t\tif ( event.target === event.currentTarget ) {\n\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t\t<BackButton />\n\t\t\t\t<ResizableEditor\n\t\t\t\t\t// Reinitialize the editor and reset the states when the template changes.\n\t\t\t\t\tkey={ templateId }\n\t\t\t\t\tenableResizing={\n\t\t\t\t\t\tisTemplatePart &&\n\t\t\t\t\t\t// Disable resizing in mobile viewport.\n\t\t\t\t\t\t! isMobileViewport\n\t\t\t\t\t}\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tcontentRef={ mergedRefs }\n\t\t\t\t>\n\t\t\t\t\t<BlockList\n\t\t\t\t\t\tclassName=\"edit-site-block-editor__block-list wp-site-blocks\"\n\t\t\t\t\t\t__experimentalLayout={ LAYOUT }\n\t\t\t\t\t\trenderAppender={\n\t\t\t\t\t\t\tisTemplatePart && hasBlocks ? false : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ResizableEditor>\n\t\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t<__unstableBlockToolbarLastItem>\n\t\t\t\t\t<__unstableBlockNameContext.Consumer>\n\t\t\t\t\t\t{ ( blockName ) =>\n\t\t\t\t\t\t\tblockName === 'core/navigation' && (\n\t\t\t\t\t\t\t\t<MaybeNavMenuSidebarToggle />\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t</__unstableBlockNameContext.Consumer>\n\t\t\t\t</__unstableBlockToolbarLastItem>\n\t\t\t</BlockTools>\n\t\t\t<ReusableBlocksMenuItems />\n\t\t</BlockEditorProvider>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["classnames","useSelect","useDispatch","useCallback","useMemo","useRef","Fragment","useEntityBlockEditor","store","coreStore","BlockList","BlockEditorProvider","__experimentalLinkControl","BlockInspector","BlockTools","__unstableBlockToolbarLastItem","__unstableBlockSettingsMenuFirstItem","__unstableUseTypingObserver","useTypingObserver","BlockEditorKeyboardShortcuts","blockEditorStore","__unstableBlockNameContext","useMergeRefs","useViewportMatch","ReusableBlocksMenuItems","listView","ToolbarButton","ToolbarGroup","__","interfaceStore","TemplatePartConverter","NavigateToLink","SidebarInspectorFill","editSiteStore","BlockInspectorButton","BackButton","ResizableEditor","LAYOUT","type","alignments","NAVIGATION_SIDEBAR_NAME","BlockEditor","setIsInserterOpen","storedSettings","templateType","templateId","page","isNavigationSidebarOpen","select","getSettings","getEditedPostType","getEditedPostId","getPage","getActiveComplementaryArea","name","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","getBlockPatterns","getBlockPatternCategories","blockPatterns","filter","x","index","arr","findIndex","y","postTypes","Array","isArray","includes","blockPatternCategories","settings","restStoredSettings","blocks","onInput","onChange","setPage","enableComplementaryArea","disableComplementaryArea","toggleNavigationSidebar","toggleComplementaryArea","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","isTemplatePart","hasBlocks","length","NavMenuSidebarToggle","MaybeNavMenuSidebarToggle","process","env","IS_GUTENBERG_PLUGIN","fillProps","event","target","currentTarget","undefined","onClose","blockName"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,WAAT,EAAsBC,OAAtB,EAA+BC,MAA/B,EAAuCC,QAAvC,QAAuD,oBAAvD;AACA,SAASC,oBAAT,EAA+BC,KAAK,IAAIC,SAAxC,QAAyD,sBAAzD;AACA,SACCC,SADD,EAECC,mBAFD,EAGCC,yBAHD,EAICC,cAJD,EAKCC,UALD,EAMCC,8BAND,EAOCC,oCAPD,EAQCC,2BAA2B,IAAIC,iBARhC,EASCC,4BATD,EAUCX,KAAK,IAAIY,gBAVV,EAWCC,0BAXD,QAYO,yBAZP;AAaA,SAASC,YAAT,EAAuBC,gBAAvB,QAA+C,oBAA/C;AACA,SAASC,uBAAT,QAAwC,4BAAxC;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,aAAT,EAAwBC,YAAxB,QAA4C,uBAA5C;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASpB,KAAK,IAAIqB,cAAlB,QAAwC,sBAAxC;AAEA;AACA;AACA;;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,OAAOC,cAAP,MAA2B,qBAA3B;AACA,SAASC,oBAAT,QAAqC,sBAArC;AACA,SAASxB,KAAK,IAAIyB,aAAlB,QAAuC,aAAvC;AACA,OAAOC,oBAAP,MAAiC,0BAAjC;AACA,OAAOC,UAAP,MAAuB,eAAvB;AACA,OAAOC,eAAP,MAA4B,oBAA5B;AAEA,MAAMC,MAAM,GAAG;AACdC,EAAAA,IAAI,EAAE,SADQ;AAEd;AACAC,EAAAA,UAAU,EAAE;AAHE,CAAf;AAMA,MAAMC,uBAAuB,GAAG,2BAAhC;AAEA,eAAe,SAASC,WAAT,OAA8C;AAAA;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AAsCW;AAJxC,IAXD,CAdD,EAiCC,cAAC,oCAAD,QACG;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WACD,cAAC,oBAAD;AAAsB,MAAA,OAAO,EAAGA;AAAhC,MADC;AAAA,GADH,CAjCD,EAsCC,cAAC,8BAAD,QACC,cAAC,0BAAD,CAA4B,QAA5B,QACKC,SAAF,IACDA,SAAS,KAAK,iBAAd,IACC,cAAC,yBAAD,OAHH,CADD,CAtCD,CAvBD,EAuEC,cAAC,uBAAD,OAvED,CADD;AA2EA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCallback, useMemo, useRef, Fragment } from '@wordpress/element';\nimport { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data';\nimport {\n\tBlockList,\n\tBlockEditorProvider,\n\t__experimentalLinkControl,\n\tBlockInspector,\n\tBlockTools,\n\t__unstableBlockToolbarLastItem,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tBlockEditorKeyboardShortcuts,\n\tstore as blockEditorStore,\n\t__unstableBlockNameContext,\n} from '@wordpress/block-editor';\nimport { useMergeRefs, useViewportMatch } from '@wordpress/compose';\nimport { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';\nimport { listView } from '@wordpress/icons';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartConverter from '../template-part-converter';\nimport NavigateToLink from '../navigate-to-link';\nimport { SidebarInspectorFill } from '../sidebar-edit-mode';\nimport { store as editSiteStore } from '../../store';\nimport BlockInspectorButton from './block-inspector-button';\nimport BackButton from './back-button';\nimport ResizableEditor from './resizable-editor';\n\nconst LAYOUT = {\n\ttype: 'default',\n\t// At the root level of the site editor, no alignments should be allowed.\n\talignments: [],\n};\n\nconst NAVIGATION_SIDEBAR_NAME = 'edit-site/navigation-menu';\n\nexport default function BlockEditor( { setIsInserterOpen } ) {\n\tconst {\n\t\tstoredSettings,\n\t\ttemplateType,\n\t\ttemplateId,\n\t\tpage,\n\t\tisNavigationSidebarOpen,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, getEditedPostType, getEditedPostId, getPage } =\n\t\t\t\tselect( editSiteStore );\n\n\t\t\treturn {\n\t\t\t\tstoredSettings: getSettings( setIsInserterOpen ),\n\t\t\t\ttemplateType: getEditedPostType(),\n\t\t\t\ttemplateId: getEditedPostId(),\n\t\t\t\tpage: getPage(),\n\t\t\t\tisNavigationSidebarOpen:\n\t\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t\t\teditSiteStore.name\n\t\t\t\t\t) === NAVIGATION_SIDEBAR_NAME,\n\t\t\t};\n\t\t},\n\t\t[ setIsInserterOpen ]\n\t);\n\n\tconst settingsBlockPatterns =\n\t\tstoredSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tstoredSettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories:\n\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( templateType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, templateType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst settings = useMemo( () => {\n\t\tconst {\n\t\t\t__experimentalAdditionalBlockPatterns,\n\t\t\t__experimentalAdditionalBlockPatternCategories,\n\t\t\t...restStoredSettings\n\t\t} = storedSettings;\n\n\t\treturn {\n\t\t\t...restStoredSettings,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t};\n\t}, [ storedSettings, blockPatterns, blockPatternCategories ] );\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplateType\n\t);\n\tconst { setPage } = useDispatch( editSiteStore );\n\tconst { enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\tconst toggleNavigationSidebar = useCallback( () => {\n\t\tconst toggleComplementaryArea = isNavigationSidebarOpen\n\t\t\t? disableComplementaryArea\n\t\t\t: enableComplementaryArea;\n\t\ttoggleComplementaryArea( editSiteStore.name, NAVIGATION_SIDEBAR_NAME );\n\t}, [ isNavigationSidebarOpen ] );\n\tconst contentRef = useRef();\n\tconst mergedRefs = useMergeRefs( [ contentRef, useTypingObserver() ] );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\n\tconst isTemplatePart = templateType === 'wp_template_part';\n\tconst hasBlocks = blocks.length !== 0;\n\n\tconst NavMenuSidebarToggle = () => (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName=\"components-toolbar__control\"\n\t\t\t\tlabel={\n\t\t\t\t\tisNavigationSidebarOpen\n\t\t\t\t\t\t? __( 'Close list view' )\n\t\t\t\t\t\t: __( 'Open list view' )\n\t\t\t\t}\n\t\t\t\tonClick={ toggleNavigationSidebar }\n\t\t\t\ticon={ listView }\n\t\t\t\tisActive={ isNavigationSidebarOpen }\n\t\t\t/>\n\t\t</ToolbarGroup>\n\t);\n\n\t// Conditionally include NavMenu sidebar in Plugin only.\n\t// Optimise for dead code elimination.\n\t// See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination.\n\tlet MaybeNavMenuSidebarToggle = Fragment;\n\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\tMaybeNavMenuSidebarToggle = NavMenuSidebarToggle;\n\t}\n\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ settings }\n\t\t\tvalue={ blocks }\n\t\t\tonInput={ onInput }\n\t\t\tonChange={ onChange }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t<TemplatePartConverter />\n\t\t\t<__experimentalLinkControl.ViewerFill>\n\t\t\t\t{ useCallback(\n\t\t\t\t\t( fillProps ) => (\n\t\t\t\t\t\t<NavigateToLink\n\t\t\t\t\t\t\t{ ...fillProps }\n\t\t\t\t\t\t\tactivePage={ page }\n\t\t\t\t\t\t\tonActivePageChange={ setPage }\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\t[ page ]\n\t\t\t\t) }\n\t\t\t</__experimentalLinkControl.ViewerFill>\n\t\t\t<SidebarInspectorFill>\n\t\t\t\t<BlockInspector />\n\t\t\t</SidebarInspectorFill>\n\t\t\t<BlockTools\n\t\t\t\tclassName={ classnames( 'edit-site-visual-editor', {\n\t\t\t\t\t'is-focus-mode': isTemplatePart,\n\t\t\t\t} ) }\n\t\t\t\t__unstableContentRef={ contentRef }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t// Clear selected block when clicking on the gray background.\n\t\t\t\t\tif ( event.target === event.currentTarget ) {\n\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t\t<BackButton />\n\t\t\t\t<ResizableEditor\n\t\t\t\t\t// Reinitialize the editor and reset the states when the template changes.\n\t\t\t\t\tkey={ templateId }\n\t\t\t\t\tenableResizing={\n\t\t\t\t\t\tisTemplatePart &&\n\t\t\t\t\t\t// Disable resizing in mobile viewport.\n\t\t\t\t\t\t! isMobileViewport\n\t\t\t\t\t}\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tcontentRef={ mergedRefs }\n\t\t\t\t>\n\t\t\t\t\t<BlockList\n\t\t\t\t\t\tclassName=\"edit-site-block-editor__block-list wp-site-blocks\"\n\t\t\t\t\t\t__experimentalLayout={ LAYOUT }\n\t\t\t\t\t\trenderAppender={\n\t\t\t\t\t\t\tisTemplatePart && hasBlocks ? false : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ResizableEditor>\n\t\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t<__unstableBlockToolbarLastItem>\n\t\t\t\t\t<__unstableBlockNameContext.Consumer>\n\t\t\t\t\t\t{ ( blockName ) =>\n\t\t\t\t\t\t\tblockName === 'core/navigation' && (\n\t\t\t\t\t\t\t\t<MaybeNavMenuSidebarToggle />\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t</__unstableBlockNameContext.Consumer>\n\t\t\t\t</__unstableBlockToolbarLastItem>\n\t\t\t</BlockTools>\n\t\t\t<ReusableBlocksMenuItems />\n\t\t</BlockEditorProvider>\n\t);\n}\n"]}
|
|
@@ -53,34 +53,14 @@ function ResizableEditor(_ref) {
|
|
|
53
53
|
const mouseMoveTypingResetRef = useMouseMoveTypingReset();
|
|
54
54
|
const ref = useMergeRefs([iframeRef, mouseMoveTypingResetRef]);
|
|
55
55
|
useEffect(function autoResizeIframeHeight() {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (!iframe || !enableResizing) {
|
|
56
|
+
if (!iframeRef.current || !enableResizing) {
|
|
59
57
|
return;
|
|
60
58
|
}
|
|
61
59
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
function resizeHeight() {
|
|
65
|
-
if (!timeoutId) {
|
|
66
|
-
// Throttle the updates on timeout. This code previously
|
|
67
|
-
// used `requestAnimationFrame`, but that seems to not
|
|
68
|
-
// always work before an iframe is ready.
|
|
69
|
-
timeoutId = iframe.contentWindow.setTimeout(() => {
|
|
70
|
-
const {
|
|
71
|
-
readyState
|
|
72
|
-
} = iframe.contentDocument; // Continue deferring the timeout until the document is ready.
|
|
73
|
-
// Only then will it have a height.
|
|
74
|
-
|
|
75
|
-
if (readyState !== 'interactive' && readyState !== 'complete') {
|
|
76
|
-
resizeHeight();
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
60
|
+
const iframe = iframeRef.current;
|
|
79
61
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}, 1000 / 30);
|
|
83
|
-
}
|
|
62
|
+
function setFrameHeight() {
|
|
63
|
+
setHeight(iframe.contentDocument.body.scrollHeight);
|
|
84
64
|
}
|
|
85
65
|
|
|
86
66
|
let resizeObserver;
|
|
@@ -89,25 +69,21 @@ function ResizableEditor(_ref) {
|
|
|
89
69
|
var _resizeObserver;
|
|
90
70
|
|
|
91
71
|
(_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : _resizeObserver.disconnect();
|
|
92
|
-
resizeObserver = new iframe.contentWindow.ResizeObserver(
|
|
72
|
+
resizeObserver = new iframe.contentWindow.ResizeObserver(setFrameHeight); // Observe the body, since the `html` element seems to always
|
|
93
73
|
// have a height of `100%`.
|
|
94
74
|
|
|
95
75
|
resizeObserver.observe(iframe.contentDocument.body);
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
iframe.addEventListener('load', registerObserver); // This is required in Chrome and Safari.
|
|
76
|
+
setFrameHeight();
|
|
77
|
+
}
|
|
101
78
|
|
|
102
|
-
registerObserver
|
|
79
|
+
iframe.addEventListener('load', registerObserver);
|
|
103
80
|
return () => {
|
|
104
|
-
var
|
|
81
|
+
var _resizeObserver2;
|
|
105
82
|
|
|
106
|
-
(_iframe$contentWindow = iframe.contentWindow) === null || _iframe$contentWindow === void 0 ? void 0 : _iframe$contentWindow.clearTimeout(timeoutId);
|
|
107
83
|
(_resizeObserver2 = resizeObserver) === null || _resizeObserver2 === void 0 ? void 0 : _resizeObserver2.disconnect();
|
|
108
84
|
iframe.removeEventListener('load', registerObserver);
|
|
109
85
|
};
|
|
110
|
-
}, [enableResizing]);
|
|
86
|
+
}, [enableResizing, iframeRef.current]);
|
|
111
87
|
const resizeWidthBy = useCallback(deltaPixels => {
|
|
112
88
|
if (iframeRef.current) {
|
|
113
89
|
setWidth(iframeRef.current.offsetWidth + deltaPixels);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/resizable-editor.js"],"names":["useState","useEffect","useRef","useCallback","ResizableBox","__experimentalUseResizeCanvas","useResizeCanvas","__unstableEditorStyles","EditorStyles","__unstableIframe","Iframe","__unstableUseMouseMoveTypingReset","useMouseMoveTypingReset","store","blockEditorStore","useSelect","useMergeRefs","editSiteStore","ResizeHandle","DEFAULT_STYLES","width","height","HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","top","right","bottom","left","ResizableEditor","enableResizing","settings","children","props","deviceType","isZoomOutMode","select","__experimentalGetPreviewDeviceType","__unstableGetEditorMode","deviceStyles","setWidth","setHeight","iframeRef","mouseMoveTypingResetRef","ref","autoResizeIframeHeight","iframe","current","timeoutId","resizeHeight","contentWindow","setTimeout","readyState","contentDocument","body","scrollHeight","resizeObserver","registerObserver","disconnect","ResizeObserver","observe","addEventListener","clearTimeout","removeEventListener","resizeWidthBy","deltaPixels","offsetWidth","event","direction","element","style","styles","__unstableResolvedAssets","svgFilters"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,SAAnB,EAA8BC,MAA9B,EAAsCC,WAAtC,QAAyD,oBAAzD;AACA,SAASC,YAAT,QAA6B,uBAA7B;AACA,SACCC,6BAA6B,IAAIC,eADlC,EAECC,sBAAsB,IAAIC,YAF3B,EAGCC,gBAAgB,IAAIC,MAHrB,EAICC,iCAAiC,IAAIC,uBAJtC,EAKCC,KAAK,IAAIC,gBALV,QAMO,yBANP;AAOA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,YAAT,QAA6B,oBAA7B;AAEA;AACA;AACA;;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,aAAvC;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AAEA,MAAMC,cAAc,GAAG;AACtBC,EAAAA,KAAK,EAAE,MADe;AAEtBC,EAAAA,MAAM,EAAE;AAFc,CAAvB,C,CAKA;;AACA,MAAMC,sBAAsB,GAAG;AAC9BC,EAAAA,QAAQ,EAAEC,SADoB;AAE9BC,EAAAA,UAAU,EAAED,SAFkB;AAG9BE,EAAAA,MAAM,EAAEF,SAHsB;AAI9BJ,EAAAA,KAAK,EAAEI,SAJuB;AAK9BH,EAAAA,MAAM,EAAEG,SALsB;AAM9BG,EAAAA,GAAG,EAAEH,SANyB;AAO9BI,EAAAA,KAAK,EAAEJ,SAPuB;AAQ9BK,EAAAA,MAAM,E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H,CARF,CAJF;AA0BC,IAAA,MAAM,EAAGC,QAAQ,CAACyC,wBA1BnB;AA2BC,IAAA,GAAG,EAAG5B,GA3BP;AA4BC,IAAA,IAAI,EAAC,eA5BN;AA6BC,IAAA,SAAS,EAAC;AA7BX,KA8BMX,KA9BN,GAiCGF,QAAQ,CAAC0C,UAjCZ,EAkCGzC,QAlCH,CAxCD,CADD;AA+EA;;AAED,eAAeH,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useRef, useCallback } from '@wordpress/element';\nimport { ResizableBox } from '@wordpress/components';\nimport {\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport ResizeHandle from './resize-handle';\n\nconst DEFAULT_STYLES = {\n\twidth: '100%',\n\theight: '100%',\n};\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\nfunction ResizableEditor( { enableResizing, settings, children, ...props } ) {\n\tconst { deviceType, isZoomOutMode } = useSelect(\n\t\t( select ) => ( {\n\t\t\tdeviceType:\n\t\t\t\tselect( editSiteStore ).__experimentalGetPreviewDeviceType(),\n\t\t\tisZoomOutMode:\n\t\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() ===\n\t\t\t\t'zoom-out',\n\t\t} ),\n\t\t[]\n\t);\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst [ width, setWidth ] = useState( DEFAULT_STYLES.width );\n\tconst [ height, setHeight ] = useState( DEFAULT_STYLES.height );\n\tconst iframeRef = useRef();\n\tconst mouseMoveTypingResetRef = useMouseMoveTypingReset();\n\tconst ref = useMergeRefs( [ iframeRef, mouseMoveTypingResetRef ] );\n\n\tuseEffect(\n\t\tfunction autoResizeIframeHeight() {\n\t\t\tconst iframe = iframeRef.current;\n\n\t\t\tif ( ! iframe || ! enableResizing ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet timeoutId = null;\n\n\t\t\tfunction resizeHeight() {\n\t\t\t\tif ( ! timeoutId ) {\n\t\t\t\t\t// Throttle the updates on timeout. This code previously\n\t\t\t\t\t// used `requestAnimationFrame`, but that seems to not\n\t\t\t\t\t// always work before an iframe is ready.\n\t\t\t\t\ttimeoutId = iframe.contentWindow.setTimeout( () => {\n\t\t\t\t\t\tconst { readyState } = iframe.contentDocument;\n\n\t\t\t\t\t\t// Continue deferring the timeout until the document is ready.\n\t\t\t\t\t\t// Only then will it have a height.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\treadyState !== 'interactive' &&\n\t\t\t\t\t\t\treadyState !== 'complete'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tresizeHeight();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsetHeight( iframe.contentDocument.body.scrollHeight );\n\t\t\t\t\t\ttimeoutId = null;\n\n\t\t\t\t\t\t// 30 frames per second.\n\t\t\t\t\t}, 1000 / 30 );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet resizeObserver;\n\n\t\t\tfunction registerObserver() {\n\t\t\t\tresizeObserver?.disconnect();\n\n\t\t\t\tresizeObserver = new iframe.contentWindow.ResizeObserver(\n\t\t\t\t\tresizeHeight\n\t\t\t\t);\n\n\t\t\t\t// Observe the body, since the `html` element seems to always\n\t\t\t\t// have a height of `100%`.\n\t\t\t\tresizeObserver.observe( iframe.contentDocument.body );\n\n\t\t\t\tresizeHeight();\n\t\t\t}\n\n\t\t\t// This is only required in Firefox for some unknown reasons.\n\t\t\tiframe.addEventListener( 'load', registerObserver );\n\t\t\t// This is required in Chrome and Safari.\n\t\t\tregisterObserver();\n\n\t\t\treturn () => {\n\t\t\t\tiframe.contentWindow?.clearTimeout( timeoutId );\n\t\t\t\tresizeObserver?.disconnect();\n\t\t\t\tiframe.removeEventListener( 'load', registerObserver );\n\t\t\t};\n\t\t},\n\t\t[ enableResizing ]\n\t);\n\n\tconst resizeWidthBy = useCallback( ( deltaPixels ) => {\n\t\tif ( iframeRef.current ) {\n\t\t\tsetWidth( iframeRef.current.offsetWidth + deltaPixels );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tsize={ {\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t} }\n\t\t\tonResizeStop={ ( event, direction, element ) => {\n\t\t\t\tsetWidth( element.style.width );\n\t\t\t} }\n\t\t\tminWidth={ 300 }\n\t\t\tmaxWidth=\"100%\"\n\t\t\tmaxHeight=\"100%\"\n\t\t\tenable={ {\n\t\t\t\tright: enableResizing,\n\t\t\t\tleft: enableResizing,\n\t\t\t} }\n\t\t\tshowHandle={ enableResizing }\n\t\t\t// The editor is centered horizontally, resizing it only\n\t\t\t// moves half the distance. Hence double the ratio to correctly\n\t\t\t// align the cursor to the resizer handle.\n\t\t\tresizeRatio={ 2 }\n\t\t\thandleComponent={ {\n\t\t\t\tleft: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"left\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t\tright: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"right\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t} }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t>\n\t\t\t<Iframe\n\t\t\t\tisZoomedOut={ isZoomOutMode }\n\t\t\t\tstyle={ enableResizing ? { height } : deviceStyles }\n\t\t\t\thead={\n\t\t\t\t\t<>\n\t\t\t\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t\t\t\t<style>{\n\t\t\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t\t\t\t`.is-root-container { display: flow-root; }`\n\t\t\t\t\t\t}</style>\n\t\t\t\t\t\t{ enableResizing && (\n\t\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// Force the <html> and <body>'s heights to fit the content.\n\t\t\t\t\t\t\t\t\t`html, body { height: -moz-fit-content !important; height: fit-content !important; min-height: 0 !important; }`\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\t// Some themes will have `min-height: 100vh` for the root container,\n\t\t\t\t\t\t\t\t\t// which isn't a requirement in auto resize mode.\n\t\t\t\t\t\t\t\t\t`.is-root-container { min-height: 0 !important; }`\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</style>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tassets={ settings.__unstableResolvedAssets }\n\t\t\t\tref={ ref }\n\t\t\t\tname=\"editor-canvas\"\n\t\t\t\tclassName=\"edit-site-visual-editor__editor-canvas\"\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ /* Filters need to be rendered before children to avoid Safari rendering issues. */ }\n\t\t\t\t{ settings.svgFilters }\n\t\t\t\t{ children }\n\t\t\t</Iframe>\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableEditor;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/resizable-editor.js"],"names":["useState","useEffect","useRef","useCallback","ResizableBox","__experimentalUseResizeCanvas","useResizeCanvas","__unstableEditorStyles","EditorStyles","__unstableIframe","Iframe","__unstableUseMouseMoveTypingReset","useMouseMoveTypingReset","store","blockEditorStore","useSelect","useMergeRefs","editSiteStore","ResizeHandle","DEFAULT_STYLES","width","height","HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","top","right","bottom","left","ResizableEditor","enableResizing","settings","children","props","deviceType","isZoomOutMode","select","__experimentalGetPreviewDeviceType","__unstableGetEditorMode","deviceStyles","setWidth","setHeight","iframeRef","mouseMoveTypingResetRef","ref","autoResizeIframeHeight","current","iframe","setFrameHeight","contentDocument","body","scrollHeight","resizeObserver","registerObserver","disconnect","contentWindow","ResizeObserver","observe","addEventListener","removeEventListener","resizeWidthBy","deltaPixels","offsetWidth","event","direction","element","style","styles","__unstableResolvedAssets","svgFilters"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,SAAnB,EAA8BC,MAA9B,EAAsCC,WAAtC,QAAyD,oBAAzD;AACA,SAASC,YAAT,QAA6B,uBAA7B;AACA,SACCC,6BAA6B,IAAIC,eADlC,EAECC,sBAAsB,IAAIC,YAF3B,EAGCC,gBAAgB,IAAIC,MAHrB,EAICC,iCAAiC,IAAIC,uBAJtC,EAKCC,KAAK,IAAIC,gBALV,QAMO,yBANP;AAOA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,YAAT,QAA6B,oBAA7B;AAEA;AACA;AACA;;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,aAAvC;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AAEA,MAAMC,cAAc,GAAG;AACtBC,EAAAA,KAAK,EAAE,MADe;AAEtBC,EAAAA,MAAM,EAAE;AAFc,CAAvB,C,CAKA;;AACA,MAAMC,sBAAsB,GAAG;AAC9BC,EAAAA,QAAQ,EAAEC,SADoB;AAE9BC,EAAAA,UAAU,EAA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\n */\nimport { useState, useEffect, useRef, useCallback } from '@wordpress/element';\nimport { ResizableBox } from '@wordpress/components';\nimport {\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport ResizeHandle from './resize-handle';\n\nconst DEFAULT_STYLES = {\n\twidth: '100%',\n\theight: '100%',\n};\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\nfunction ResizableEditor( { enableResizing, settings, children, ...props } ) {\n\tconst { deviceType, isZoomOutMode } = useSelect(\n\t\t( select ) => ( {\n\t\t\tdeviceType:\n\t\t\t\tselect( editSiteStore ).__experimentalGetPreviewDeviceType(),\n\t\t\tisZoomOutMode:\n\t\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() ===\n\t\t\t\t'zoom-out',\n\t\t} ),\n\t\t[]\n\t);\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst [ width, setWidth ] = useState( DEFAULT_STYLES.width );\n\tconst [ height, setHeight ] = useState( DEFAULT_STYLES.height );\n\tconst iframeRef = useRef();\n\tconst mouseMoveTypingResetRef = useMouseMoveTypingReset();\n\tconst ref = useMergeRefs( [ iframeRef, mouseMoveTypingResetRef ] );\n\n\tuseEffect(\n\t\tfunction autoResizeIframeHeight() {\n\t\t\tif ( ! iframeRef.current || ! enableResizing ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst iframe = iframeRef.current;\n\n\t\t\tfunction setFrameHeight() {\n\t\t\t\tsetHeight( iframe.contentDocument.body.scrollHeight );\n\t\t\t}\n\n\t\t\tlet resizeObserver;\n\n\t\t\tfunction registerObserver() {\n\t\t\t\tresizeObserver?.disconnect();\n\n\t\t\t\tresizeObserver = new iframe.contentWindow.ResizeObserver(\n\t\t\t\t\tsetFrameHeight\n\t\t\t\t);\n\n\t\t\t\t// Observe the body, since the `html` element seems to always\n\t\t\t\t// have a height of `100%`.\n\t\t\t\tresizeObserver.observe( iframe.contentDocument.body );\n\t\t\t\tsetFrameHeight();\n\t\t\t}\n\n\t\t\tiframe.addEventListener( 'load', registerObserver );\n\n\t\t\treturn () => {\n\t\t\t\tresizeObserver?.disconnect();\n\t\t\t\tiframe.removeEventListener( 'load', registerObserver );\n\t\t\t};\n\t\t},\n\t\t[ enableResizing, iframeRef.current ]\n\t);\n\n\tconst resizeWidthBy = useCallback( ( deltaPixels ) => {\n\t\tif ( iframeRef.current ) {\n\t\t\tsetWidth( iframeRef.current.offsetWidth + deltaPixels );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tsize={ {\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t} }\n\t\t\tonResizeStop={ ( event, direction, element ) => {\n\t\t\t\tsetWidth( element.style.width );\n\t\t\t} }\n\t\t\tminWidth={ 300 }\n\t\t\tmaxWidth=\"100%\"\n\t\t\tmaxHeight=\"100%\"\n\t\t\tenable={ {\n\t\t\t\tright: enableResizing,\n\t\t\t\tleft: enableResizing,\n\t\t\t} }\n\t\t\tshowHandle={ enableResizing }\n\t\t\t// The editor is centered horizontally, resizing it only\n\t\t\t// moves half the distance. Hence double the ratio to correctly\n\t\t\t// align the cursor to the resizer handle.\n\t\t\tresizeRatio={ 2 }\n\t\t\thandleComponent={ {\n\t\t\t\tleft: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"left\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t\tright: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"right\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t} }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t>\n\t\t\t<Iframe\n\t\t\t\tisZoomedOut={ isZoomOutMode }\n\t\t\t\tstyle={ enableResizing ? { height } : deviceStyles }\n\t\t\t\thead={\n\t\t\t\t\t<>\n\t\t\t\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t\t\t\t<style>{\n\t\t\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t\t\t\t`.is-root-container { display: flow-root; }`\n\t\t\t\t\t\t}</style>\n\t\t\t\t\t\t{ enableResizing && (\n\t\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// Force the <html> and <body>'s heights to fit the content.\n\t\t\t\t\t\t\t\t\t`html, body { height: -moz-fit-content !important; height: fit-content !important; min-height: 0 !important; }`\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\t// Some themes will have `min-height: 100vh` for the root container,\n\t\t\t\t\t\t\t\t\t// which isn't a requirement in auto resize mode.\n\t\t\t\t\t\t\t\t\t`.is-root-container { min-height: 0 !important; }`\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</style>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tassets={ settings.__unstableResolvedAssets }\n\t\t\t\tref={ ref }\n\t\t\t\tname=\"editor-canvas\"\n\t\t\t\tclassName=\"edit-site-visual-editor__editor-canvas\"\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ /* Filters need to be rendered before children to avoid Safari rendering issues. */ }\n\t\t\t\t{ settings.svgFilters }\n\t\t\t\t{ children }\n\t\t\t</Iframe>\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableEditor;\n"]}
|
|
@@ -7,7 +7,7 @@ import { useEffect, useState, useMemo, useCallback } from '@wordpress/element';
|
|
|
7
7
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
8
8
|
import { Popover, Button, Notice } from '@wordpress/components';
|
|
9
9
|
import { EntityProvider, store as coreStore } from '@wordpress/core-data';
|
|
10
|
-
import { BlockContextProvider, BlockBreadcrumb,
|
|
10
|
+
import { BlockContextProvider, BlockBreadcrumb, store as blockEditorStore } from '@wordpress/block-editor';
|
|
11
11
|
import { InterfaceSkeleton, ComplementaryArea, store as interfaceStore } from '@wordpress/interface';
|
|
12
12
|
import { EditorNotices, EditorSnackbars, EntitiesSavedStates } from '@wordpress/editor';
|
|
13
13
|
import { __ } from '@wordpress/i18n';
|
|
@@ -17,8 +17,8 @@ import { store as preferencesStore } from '@wordpress/preferences';
|
|
|
17
17
|
* Internal dependencies
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import Header from '../header';
|
|
21
|
-
import { SidebarComplementaryAreaFills } from '../sidebar';
|
|
20
|
+
import Header from '../header-edit-mode';
|
|
21
|
+
import { SidebarComplementaryAreaFills } from '../sidebar-edit-mode';
|
|
22
22
|
import NavigationSidebar from '../navigation-sidebar';
|
|
23
23
|
import BlockEditor from '../block-editor';
|
|
24
24
|
import CodeEditor from '../code-editor';
|
|
@@ -193,9 +193,7 @@ function Editor(_ref) {
|
|
|
193
193
|
showIconLabels: showIconLabels
|
|
194
194
|
}),
|
|
195
195
|
notices: createElement(EditorSnackbars, null),
|
|
196
|
-
content: createElement(Fragment, null, createElement(EditorNotices, null), createElement(
|
|
197
|
-
scope: "core/block-inspector"
|
|
198
|
-
}), editorMode === 'visual' && template && createElement(BlockEditor, {
|
|
196
|
+
content: createElement(Fragment, null, createElement(EditorNotices, null), editorMode === 'visual' && template && createElement(BlockEditor, {
|
|
199
197
|
setIsInserterOpen: setIsInserterOpened
|
|
200
198
|
}), editorMode === 'text' && template && createElement(CodeEditor, null), templateResolved && !template && (settings === null || settings === void 0 ? void 0 : settings.siteUrl) && entityId && createElement(Notice, {
|
|
201
199
|
status: "warning",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/editor/index.js"],"names":["useEffect","useState","useMemo","useCallback","useSelect","useDispatch","Popover","Button","Notice","EntityProvider","store","coreStore","BlockContextProvider","BlockBreadcrumb","BlockStyles","blockEditorStore","InterfaceSkeleton","ComplementaryArea","interfaceStore","EditorNotices","EditorSnackbars","EntitiesSavedStates","__","ShortcutProvider","keyboardShortcutsStore","preferencesStore","Header","SidebarComplementaryAreaFills","NavigationSidebar","BlockEditor","CodeEditor","KeyboardShortcuts","URLQueryController","InserterSidebar","ListViewSidebar","ErrorBoundary","WelcomeGuide","editSiteStore","GlobalStylesRenderer","GlobalStylesProvider","useTitle","interfaceLabels","header","body","sidebar","actions","footer","drawer","Editor","onError","isInserterOpen","isListViewOpen","sidebarIsOpened","settings","entityId","templateType","page","template","templateResolved","isNavigationOpen","previousShortcut","nextShortcut","editorMode","showIconLabels","blockEditorMode","select","isInserterOpened","isListViewOpened","getSettings","getEditedPostType","getEditedPostId","getPage","isNavigationOpened","getEditorMode","hasFinishedResolution","getEntityRecord","__unstableGetEditorMode","postType","postId","getActiveComplementaryArea","name","getAllShortcutKeyCombinations","get","setPage","setIsInserterOpened","enableComplementaryArea","isEntitiesSavedStatesOpen","setIsEntitiesSavedStatesOpen","openEntitiesSavedStates","closeEntitiesSavedStates","blockContext","context","queryContext","newQueryContext","document","classList","add","remove","openGlobalStylesOnLoad","searchParams","URLSearchParams","window","location","search","isReady","siteUrl","undefined","secondarySidebarLabel","secondarySideb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E;AAFF,MA9BD,CA/BF;AAoEC,IAAA,OAAO,EACN,8BACGF,yBAAyB,GAC1B,cAAC,mBAAD;AACC,MAAA,KAAK,EACJG;AAFF,MAD0B,GAO1B;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,cAAC,MAAD;AACC,MAAA,OAAO,EAAC,WADT;AAEC,MAAA,SAAS,EAAC,4CAFX;AAGC,MAAA,OAAO,EACND,uBAJF;AAMC,uBACC;AAPF,OAUGlE,EAAE,CACH,iBADG,CAVL,CADD,CARF,CArEF;AAgGC,IAAA,MAAM,EACL0C,eAAe,KACf,UADA,GAEC,cAAC,eAAD;AACC,MAAA,aAAa,EAAG1C,EAAE,CACjB,UADiB;AADnB,MAFD,GAOIoF,SAxGN;AA0GC,IAAA,SAAS,EAAG;AACXG,MAAAA,QAAQ,EAAEjD,gBADC;AAEXkD,MAAAA,IAAI,EAAEjD;AAFK;AA1Gb,IAHD,EAkHC,cAAC,YAAD,OAlHD,EAmHC,cAAC,OAAD,CAAS,IAAT,OAnHD,CAFD,CADD,CALD,CADD,CADD,CAHF,CADD;AA2IA;;AACD,eAAeb,MAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState, useMemo, useCallback } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Popover, Button, Notice } from '@wordpress/components';\nimport { EntityProvider, store as coreStore } from '@wordpress/core-data';\nimport {\n\tBlockContextProvider,\n\tBlockBreadcrumb,\n\tBlockStyles,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tEditorNotices,\n\tEditorSnackbars,\n\tEntitiesSavedStates,\n} from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tShortcutProvider,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Header from '../header';\nimport { SidebarComplementaryAreaFills } from '../sidebar';\nimport NavigationSidebar from '../navigation-sidebar';\nimport BlockEditor from '../block-editor';\nimport CodeEditor from '../code-editor';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport URLQueryController from '../url-query-controller';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\nimport ErrorBoundary from '../error-boundary';\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from './global-styles-renderer';\nimport { GlobalStylesProvider } from '../global-styles/global-styles-provider';\nimport useTitle from '../routes/use-title';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor top bar landmark region. */\n\theader: __( 'Editor top bar' ),\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n\t/* translators: accessibility text for the navigation sidebar landmark region. */\n\tdrawer: __( 'Navigation Sidebar' ),\n};\n\nfunction Editor( { onError } ) {\n\tconst {\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tsidebarIsOpened,\n\t\tsettings,\n\t\tentityId,\n\t\ttemplateType,\n\t\tpage,\n\t\ttemplate,\n\t\ttemplateResolved,\n\t\tisNavigationOpen,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\n\t\teditorMode,\n\t\tshowIconLabels,\n\t\tblockEditorMode,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisInserterOpened,\n\t\t\tisListViewOpened,\n\t\t\tgetSettings,\n\t\t\tgetEditedPostType,\n\t\t\tgetEditedPostId,\n\t\t\tgetPage,\n\t\t\tisNavigationOpened,\n\t\t\tgetEditorMode,\n\t\t} = select( editSiteStore );\n\t\tconst { hasFinishedResolution, getEntityRecord } = select( coreStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst postType = getEditedPostType();\n\t\tconst postId = getEditedPostId();\n\n\t\t// The currently selected entity to display. Typically template or template part.\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tsidebarIsOpened: !! select(\n\t\t\t\tinterfaceStore\n\t\t\t).getActiveComplementaryArea( editSiteStore.name ),\n\t\t\tsettings: getSettings(),\n\t\t\ttemplateType: postType,\n\t\t\tpage: getPage(),\n\t\t\ttemplate: postId\n\t\t\t\t? getEntityRecord( 'postType', postType, postId )\n\t\t\t\t: null,\n\t\t\ttemplateResolved: postId\n\t\t\t\t? hasFinishedResolution( 'getEntityRecord', [\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpostType,\n\t\t\t\t\t\tpostId,\n\t\t\t\t ] )\n\t\t\t\t: false,\n\t\t\tentityId: postId,\n\t\t\tisNavigationOpen: isNavigationOpened(),\n\t\t\tpreviousShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-site/previous-region' ),\n\t\t\tnextShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-site/next-region' ),\n\t\t\teditorMode: getEditorMode(),\n\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t};\n\t}, [] );\n\tconst { setPage, setIsInserterOpened } = useDispatch( editSiteStore );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst [ isEntitiesSavedStatesOpen, setIsEntitiesSavedStatesOpen ] =\n\t\tuseState( false );\n\tconst openEntitiesSavedStates = useCallback(\n\t\t() => setIsEntitiesSavedStatesOpen( true ),\n\t\t[]\n\t);\n\tconst closeEntitiesSavedStates = useCallback( () => {\n\t\tsetIsEntitiesSavedStatesOpen( false );\n\t}, [] );\n\n\tconst blockContext = useMemo(\n\t\t() => ( {\n\t\t\t...page?.context,\n\t\t\tqueryContext: [\n\t\t\t\tpage?.context.queryContext || { page: 1 },\n\t\t\t\t( newQueryContext ) =>\n\t\t\t\t\tsetPage( {\n\t\t\t\t\t\t...page,\n\t\t\t\t\t\tcontext: {\n\t\t\t\t\t\t\t...page?.context,\n\t\t\t\t\t\t\tqueryContext: {\n\t\t\t\t\t\t\t\t...page?.context.queryContext,\n\t\t\t\t\t\t\t\t...newQueryContext,\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],\n\t\t} ),\n\t\t[ page?.context ]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( isNavigationOpen ) {\n\t\t\tdocument.body.classList.add( 'is-navigation-sidebar-open' );\n\t\t} else {\n\t\t\tdocument.body.classList.remove( 'is-navigation-sidebar-open' );\n\t\t}\n\t}, [ isNavigationOpen ] );\n\n\tuseEffect(\n\t\tfunction openGlobalStylesOnLoad() {\n\t\t\tconst searchParams = new URLSearchParams( window.location.search );\n\t\t\tif ( searchParams.get( 'styles' ) === 'open' ) {\n\t\t\t\tenableComplementaryArea(\n\t\t\t\t\t'core/edit-site',\n\t\t\t\t\t'edit-site/global-styles'\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\t// Don't render the Editor until the settings are set and loaded.\n\tconst isReady =\n\t\tsettings?.siteUrl &&\n\t\ttemplateType !== undefined &&\n\t\tentityId !== undefined;\n\n\tconst secondarySidebarLabel = isListViewOpen\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\n\tconst secondarySidebar = () => {\n\t\tif ( editorMode === 'visual' && isInserterOpen ) {\n\t\t\treturn <InserterSidebar />;\n\t\t}\n\t\tif ( editorMode === 'visual' && isListViewOpen ) {\n\t\t\treturn <ListViewSidebar />;\n\t\t}\n\t\treturn null;\n\t};\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URlQueryController> from double-announcing.\n\tuseTitle( isReady && __( 'Editor (beta)' ) );\n\n\treturn (\n\t\t<>\n\t\t\t<URLQueryController />\n\t\t\t{ isReady && (\n\t\t\t\t<ShortcutProvider>\n\t\t\t\t\t<EntityProvider kind=\"root\" type=\"site\">\n\t\t\t\t\t\t<EntityProvider\n\t\t\t\t\t\t\tkind=\"postType\"\n\t\t\t\t\t\t\ttype={ templateType }\n\t\t\t\t\t\t\tid={ entityId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<GlobalStylesProvider>\n\t\t\t\t\t\t\t\t<BlockContextProvider value={ blockContext }>\n\t\t\t\t\t\t\t\t\t<GlobalStylesRenderer />\n\t\t\t\t\t\t\t\t\t<ErrorBoundary onError={ onError }>\n\t\t\t\t\t\t\t\t\t\t<KeyboardShortcuts.Register />\n\t\t\t\t\t\t\t\t\t\t<SidebarComplementaryAreaFills />\n\t\t\t\t\t\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\t\t\t\t\t\tlabels={ {\n\t\t\t\t\t\t\t\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\t\t\t\t\t\t\t\tsecondarySidebar:\n\t\t\t\t\t\t\t\t\t\t\t\t\tsecondarySidebarLabel,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t\t\tshowIconLabels &&\n\t\t\t\t\t\t\t\t\t\t\t\t'show-icon-labels'\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tsecondarySidebar={ secondarySidebar() }\n\t\t\t\t\t\t\t\t\t\t\tsidebar={\n\t\t\t\t\t\t\t\t\t\t\t\tsidebarIsOpened && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tdrawer={\n\t\t\t\t\t\t\t\t\t\t\t\t<NavigationSidebar.Slot />\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\theader={\n\t\t\t\t\t\t\t\t\t\t\t\t<Header\n\t\t\t\t\t\t\t\t\t\t\t\t\topenEntitiesSavedStates={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\topenEntitiesSavedStates\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowIconLabels={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tshowIconLabels\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\t\t\t\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<EditorNotices />\n\t\t\t\t\t\t\t\t\t\t\t\t\t<BlockStyles.Slot scope=\"core/block-inspector\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ editorMode === 'visual' &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttemplate && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<BlockEditor\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsInserterOpen={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsInserterOpened\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ editorMode === 'text' &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttemplate && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CodeEditor />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ templateResolved &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t! template &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsettings?.siteUrl &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tentityId && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisDismissible={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t<KeyboardShortcuts\n\t\t\t\t\t\t\t\t\t\t\t\t\t\topenEntitiesSavedStates={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\topenEntitiesSavedStates\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tactions={\n\t\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ isEntitiesSavedStatesOpen ? (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<EntitiesSavedStates\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclose={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcloseEntitiesSavedStates\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"edit-site-editor__toggle-save-panel\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-editor__toggle-save-panel-button\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\topenEntitiesSavedStates\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taria-expanded={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Open save panel'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tfooter={\n\t\t\t\t\t\t\t\t\t\t\t\tblockEditorMode !==\n\t\t\t\t\t\t\t\t\t\t\t\t'zoom-out' ? (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trootLabelText={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Template'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t) : undefined\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tshortcuts={ {\n\t\t\t\t\t\t\t\t\t\t\t\tprevious: previousShortcut,\n\t\t\t\t\t\t\t\t\t\t\t\tnext: nextShortcut,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<WelcomeGuide />\n\t\t\t\t\t\t\t\t\t\t<Popover.Slot />\n\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t\t\t\t</GlobalStylesProvider>\n\t\t\t\t\t\t</EntityProvider>\n\t\t\t\t\t</EntityProvider>\n\t\t\t\t</ShortcutProvider>\n\t\t\t) }\n\t\t</>\n\t);\n}\nexport default Editor;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/editor/index.js"],"names":["useEffect","useState","useMemo","useCallback","useSelect","useDispatch","Popover","Button","Notice","EntityProvider","store","coreStore","BlockContextProvider","BlockBreadcrumb","blockEditorStore","InterfaceSkeleton","ComplementaryArea","interfaceStore","EditorNotices","EditorSnackbars","EntitiesSavedStates","__","ShortcutProvider","keyboardShortcutsStore","preferencesStore","Header","SidebarComplementaryAreaFills","NavigationSidebar","BlockEditor","CodeEditor","KeyboardShortcuts","URLQueryController","InserterSidebar","ListViewSidebar","ErrorBoundary","WelcomeGuide","editSiteStore","GlobalStylesRenderer","GlobalStylesProvider","useTitle","interfaceLabels","header","body","sidebar","actions","footer","drawer","Editor","onError","isInserterOpen","isListViewOpen","sidebarIsOpened","settings","entityId","templateType","page","template","templateResolved","isNavigationOpen","previousShortcut","nextShortcut","editorMode","showIconLabels","blockEditorMode","select","isInserterOpened","isListViewOpened","getSettings","getEditedPostType","getEditedPostId","getPage","isNavigationOpened","getEditorMode","hasFinishedResolution","getEntityRecord","__unstableGetEditorMode","postType","postId","getActiveComplementaryArea","name","getAllShortcutKeyCombinations","get","setPage","setIsInserterOpened","enableComplementaryArea","isEntitiesSavedStatesOpen","setIsEntitiesSavedStatesOpen","openEntitiesSavedStates","closeEntitiesSavedStates","blockContext","context","queryContext","newQueryContext","document","classList","add","remove","openGlobalStylesOnLoad","searchParams","URLSearchParams","window","location","search","isReady","siteUrl","undefined","secondarySidebarLabel","secondarySidebar","previous","next"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,QAApB,EAA8BC,OAA9B,EAAuCC,WAAvC,QAA0D,oBAA1D;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,OAAT,EAAkBC,MAAlB,EAA0BC,MAA1B,QAAwC,uBAAxC;AACA,SAASC,cAAT,EAAyBC,KAAK,IAAIC,SAAlC,QAAmD,sBAAnD;AACA,SACCC,oBADD,EAECC,eAFD,EAGCH,KAAK,IAAII,gBAHV,QAIO,yBAJP;AAKA,SACCC,iBADD,EAECC,iBAFD,EAGCN,KAAK,IAAIO,cAHV,QAIO,sBAJP;AAKA,SACCC,aADD,EAECC,eAFD,EAGCC,mBAHD,QAIO,mBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,gBADD,EAECZ,KAAK,IAAIa,sBAFV,QAGO,+BAHP;AAIA,SAASb,KAAK,IAAIc,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,qBAAnB;AACA,SAASC,6BAAT,QAA8C,sBAA9C;AACA,OAAOC,iBAA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aAAD,OADD,EAEGD,UAAU,KAAK,QAAf,IACDL,QADC,IAEA,cAAC,WAAD;AACC,MAAA,iBAAiB,EAChB2B;AAFF,MAJH,EAUGtB,UAAU,KAAK,MAAf,IACDL,QADC,IAEA,cAAC,UAAD,OAZH,EAcGC,gBAAgB,IACjB,CAAED,QADD,KAEDJ,QAFC,aAEDA,QAFC,uBAEDA,QAAQ,CAAEoD,OAFT,KAGDnD,QAHC,IAIA,cAAC,MAAD;AACC,MAAA,MAAM,EAAC,SADR;AAEC,MAAA,aAAa,EACZ;AAHF,OAMGhC,EAAE,CACH,2EADG,CANL,CAlBH,EA6BC,cAAC,iBAAD;AACC,MAAA,uBAAuB,EACtBkE;AAFF,MA7BD,CA/BF;AAmEC,IAAA,OAAO,EACN,8BACGF,yBAAyB,GAC1B,cAAC,mBAAD;AACC,MAAA,KAAK,EACJG;AAFF,MAD0B,GAO1B;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,cAAC,MAAD;AACC,MAAA,OAAO,EAAC,WADT;AAEC,MAAA,SAAS,EAAC,4CAFX;AAGC,MAAA,OAAO,EACND,uBAJF;AAMC,uBACC;AAPF,OAUGlE,EAAE,CACH,iBADG,CAVL,CADD,CARF,CApEF;AA+FC,IAAA,MAAM,EACL0C,eAAe,KACf,UADA,GAEC,cAAC,eAAD;AACC,MAAA,aAAa,EAAG1C,EAAE,CACjB,UADiB;AADnB,MAFD,GAOIoF,SAvGN;AAyGC,IAAA,SAAS,EAAG;AACXG,MAAAA,QAAQ,EAAEjD,gBADC;AAEXkD,MAAAA,IAAI,EAAEjD;AAFK;AAzGb,IAHD,EAiHC,cAAC,YAAD,OAjHD,EAkHC,cAAC,OAAD,CAAS,IAAT,OAlHD,CAFD,CADD,CALD,CADD,CADD,CAHF,CADD;AA0IA;;AACD,eAAeb,MAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState, useMemo, useCallback } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Popover, Button, Notice } from '@wordpress/components';\nimport { EntityProvider, store as coreStore } from '@wordpress/core-data';\nimport {\n\tBlockContextProvider,\n\tBlockBreadcrumb,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tEditorNotices,\n\tEditorSnackbars,\n\tEntitiesSavedStates,\n} from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tShortcutProvider,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Header from '../header-edit-mode';\nimport { SidebarComplementaryAreaFills } from '../sidebar-edit-mode';\nimport NavigationSidebar from '../navigation-sidebar';\nimport BlockEditor from '../block-editor';\nimport CodeEditor from '../code-editor';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport URLQueryController from '../url-query-controller';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\nimport ErrorBoundary from '../error-boundary';\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from './global-styles-renderer';\nimport { GlobalStylesProvider } from '../global-styles/global-styles-provider';\nimport useTitle from '../routes/use-title';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor top bar landmark region. */\n\theader: __( 'Editor top bar' ),\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n\t/* translators: accessibility text for the navigation sidebar landmark region. */\n\tdrawer: __( 'Navigation Sidebar' ),\n};\n\nfunction Editor( { onError } ) {\n\tconst {\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tsidebarIsOpened,\n\t\tsettings,\n\t\tentityId,\n\t\ttemplateType,\n\t\tpage,\n\t\ttemplate,\n\t\ttemplateResolved,\n\t\tisNavigationOpen,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\n\t\teditorMode,\n\t\tshowIconLabels,\n\t\tblockEditorMode,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisInserterOpened,\n\t\t\tisListViewOpened,\n\t\t\tgetSettings,\n\t\t\tgetEditedPostType,\n\t\t\tgetEditedPostId,\n\t\t\tgetPage,\n\t\t\tisNavigationOpened,\n\t\t\tgetEditorMode,\n\t\t} = select( editSiteStore );\n\t\tconst { hasFinishedResolution, getEntityRecord } = select( coreStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst postType = getEditedPostType();\n\t\tconst postId = getEditedPostId();\n\n\t\t// The currently selected entity to display. Typically template or template part.\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tsidebarIsOpened: !! select(\n\t\t\t\tinterfaceStore\n\t\t\t).getActiveComplementaryArea( editSiteStore.name ),\n\t\t\tsettings: getSettings(),\n\t\t\ttemplateType: postType,\n\t\t\tpage: getPage(),\n\t\t\ttemplate: postId\n\t\t\t\t? getEntityRecord( 'postType', postType, postId )\n\t\t\t\t: null,\n\t\t\ttemplateResolved: postId\n\t\t\t\t? hasFinishedResolution( 'getEntityRecord', [\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpostType,\n\t\t\t\t\t\tpostId,\n\t\t\t\t ] )\n\t\t\t\t: false,\n\t\t\tentityId: postId,\n\t\t\tisNavigationOpen: isNavigationOpened(),\n\t\t\tpreviousShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-site/previous-region' ),\n\t\t\tnextShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-site/next-region' ),\n\t\t\teditorMode: getEditorMode(),\n\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t};\n\t}, [] );\n\tconst { setPage, setIsInserterOpened } = useDispatch( editSiteStore );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst [ isEntitiesSavedStatesOpen, setIsEntitiesSavedStatesOpen ] =\n\t\tuseState( false );\n\tconst openEntitiesSavedStates = useCallback(\n\t\t() => setIsEntitiesSavedStatesOpen( true ),\n\t\t[]\n\t);\n\tconst closeEntitiesSavedStates = useCallback( () => {\n\t\tsetIsEntitiesSavedStatesOpen( false );\n\t}, [] );\n\n\tconst blockContext = useMemo(\n\t\t() => ( {\n\t\t\t...page?.context,\n\t\t\tqueryContext: [\n\t\t\t\tpage?.context.queryContext || { page: 1 },\n\t\t\t\t( newQueryContext ) =>\n\t\t\t\t\tsetPage( {\n\t\t\t\t\t\t...page,\n\t\t\t\t\t\tcontext: {\n\t\t\t\t\t\t\t...page?.context,\n\t\t\t\t\t\t\tqueryContext: {\n\t\t\t\t\t\t\t\t...page?.context.queryContext,\n\t\t\t\t\t\t\t\t...newQueryContext,\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],\n\t\t} ),\n\t\t[ page?.context ]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( isNavigationOpen ) {\n\t\t\tdocument.body.classList.add( 'is-navigation-sidebar-open' );\n\t\t} else {\n\t\t\tdocument.body.classList.remove( 'is-navigation-sidebar-open' );\n\t\t}\n\t}, [ isNavigationOpen ] );\n\n\tuseEffect(\n\t\tfunction openGlobalStylesOnLoad() {\n\t\t\tconst searchParams = new URLSearchParams( window.location.search );\n\t\t\tif ( searchParams.get( 'styles' ) === 'open' ) {\n\t\t\t\tenableComplementaryArea(\n\t\t\t\t\t'core/edit-site',\n\t\t\t\t\t'edit-site/global-styles'\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\t// Don't render the Editor until the settings are set and loaded.\n\tconst isReady =\n\t\tsettings?.siteUrl &&\n\t\ttemplateType !== undefined &&\n\t\tentityId !== undefined;\n\n\tconst secondarySidebarLabel = isListViewOpen\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\n\tconst secondarySidebar = () => {\n\t\tif ( editorMode === 'visual' && isInserterOpen ) {\n\t\t\treturn <InserterSidebar />;\n\t\t}\n\t\tif ( editorMode === 'visual' && isListViewOpen ) {\n\t\t\treturn <ListViewSidebar />;\n\t\t}\n\t\treturn null;\n\t};\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URlQueryController> from double-announcing.\n\tuseTitle( isReady && __( 'Editor (beta)' ) );\n\n\treturn (\n\t\t<>\n\t\t\t<URLQueryController />\n\t\t\t{ isReady && (\n\t\t\t\t<ShortcutProvider>\n\t\t\t\t\t<EntityProvider kind=\"root\" type=\"site\">\n\t\t\t\t\t\t<EntityProvider\n\t\t\t\t\t\t\tkind=\"postType\"\n\t\t\t\t\t\t\ttype={ templateType }\n\t\t\t\t\t\t\tid={ entityId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<GlobalStylesProvider>\n\t\t\t\t\t\t\t\t<BlockContextProvider value={ blockContext }>\n\t\t\t\t\t\t\t\t\t<GlobalStylesRenderer />\n\t\t\t\t\t\t\t\t\t<ErrorBoundary onError={ onError }>\n\t\t\t\t\t\t\t\t\t\t<KeyboardShortcuts.Register />\n\t\t\t\t\t\t\t\t\t\t<SidebarComplementaryAreaFills />\n\t\t\t\t\t\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\t\t\t\t\t\tlabels={ {\n\t\t\t\t\t\t\t\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\t\t\t\t\t\t\t\tsecondarySidebar:\n\t\t\t\t\t\t\t\t\t\t\t\t\tsecondarySidebarLabel,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t\t\tshowIconLabels &&\n\t\t\t\t\t\t\t\t\t\t\t\t'show-icon-labels'\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tsecondarySidebar={ secondarySidebar() }\n\t\t\t\t\t\t\t\t\t\t\tsidebar={\n\t\t\t\t\t\t\t\t\t\t\t\tsidebarIsOpened && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tdrawer={\n\t\t\t\t\t\t\t\t\t\t\t\t<NavigationSidebar.Slot />\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\theader={\n\t\t\t\t\t\t\t\t\t\t\t\t<Header\n\t\t\t\t\t\t\t\t\t\t\t\t\topenEntitiesSavedStates={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\topenEntitiesSavedStates\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowIconLabels={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tshowIconLabels\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\t\t\t\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<EditorNotices />\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ editorMode === 'visual' &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttemplate && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<BlockEditor\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsInserterOpen={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsInserterOpened\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ editorMode === 'text' &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttemplate && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CodeEditor />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ templateResolved &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t! template &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsettings?.siteUrl &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tentityId && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisDismissible={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t<KeyboardShortcuts\n\t\t\t\t\t\t\t\t\t\t\t\t\t\topenEntitiesSavedStates={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\topenEntitiesSavedStates\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tactions={\n\t\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ isEntitiesSavedStatesOpen ? (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<EntitiesSavedStates\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclose={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcloseEntitiesSavedStates\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"edit-site-editor__toggle-save-panel\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-editor__toggle-save-panel-button\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\topenEntitiesSavedStates\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taria-expanded={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Open save panel'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tfooter={\n\t\t\t\t\t\t\t\t\t\t\t\tblockEditorMode !==\n\t\t\t\t\t\t\t\t\t\t\t\t'zoom-out' ? (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trootLabelText={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Template'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t) : undefined\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tshortcuts={ {\n\t\t\t\t\t\t\t\t\t\t\t\tprevious: previousShortcut,\n\t\t\t\t\t\t\t\t\t\t\t\tnext: nextShortcut,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<WelcomeGuide />\n\t\t\t\t\t\t\t\t\t\t<Popover.Slot />\n\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t\t\t\t</GlobalStylesProvider>\n\t\t\t\t\t\t</EntityProvider>\n\t\t\t\t\t</EntityProvider>\n\t\t\t\t</ShortcutProvider>\n\t\t\t) }\n\t\t</>\n\t);\n}\nexport default Editor;\n"]}
|