@wordpress/editor 13.34.0 → 13.35.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 +10 -4
- package/build/bindings/pattern-overrides.js +70 -1
- package/build/bindings/pattern-overrides.js.map +1 -1
- package/build/components/block-settings-menu/content-only-settings-menu.js +126 -0
- package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -0
- package/build/components/block-settings-menu/content-only-settings-menu.native.js +11 -0
- package/build/components/block-settings-menu/content-only-settings-menu.native.js.map +1 -0
- package/build/components/collapsible-block-toolbar/index.js +2 -2
- package/build/components/collapsible-block-toolbar/index.js.map +1 -1
- package/build/components/document-bar/index.js +2 -2
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/document-outline/item.js +2 -2
- package/build/components/document-outline/item.js.map +1 -1
- package/build/components/document-tools/index.js +15 -18
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-canvas/index.js +19 -8
- package/build/components/editor-canvas/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/global-styles-provider/index.js +130 -0
- package/build/components/global-styles-provider/index.js.map +1 -0
- package/build/components/header/index.js +147 -0
- package/build/components/header/index.js.map +1 -0
- package/build/components/inserter-sidebar/index.js +56 -31
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/post-actions/actions.js +122 -64
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/index.js +7 -14
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-card-panel/index.js +5 -29
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-comments/index.js +28 -8
- package/build/components/post-comments/index.js.map +1 -1
- package/build/components/post-discussion/panel.js +103 -21
- package/build/components/post-discussion/panel.js.map +1 -1
- package/build/components/post-excerpt/panel.js +2 -2
- package/build/components/post-excerpt/panel.js.map +1 -1
- package/build/components/post-format/panel.js +27 -0
- package/build/components/post-format/panel.js.map +1 -0
- package/build/components/post-panel-row/index.js +2 -2
- package/build/components/post-panel-row/index.js.map +1 -1
- package/build/components/post-panel-section/index.js +28 -0
- package/build/components/post-panel-section/index.js.map +1 -0
- package/build/components/post-pingbacks/index.js +5 -2
- package/build/components/post-pingbacks/index.js.map +1 -1
- package/build/components/post-saved-state/index.js +2 -2
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-slug/panel.js +27 -0
- package/build/components/post-slug/panel.js.map +1 -0
- package/build/components/post-status/index.js +4 -4
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/post-sticky/panel.js +21 -0
- package/build/components/post-sticky/panel.js.map +1 -0
- package/build/components/post-title/index.js +2 -2
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/post-title-raw.js +2 -2
- package/build/components/post-title/post-title-raw.js.map +1 -1
- package/build/components/post-transform-panel/hooks.js +90 -0
- package/build/components/post-transform-panel/hooks.js.map +1 -0
- package/build/components/post-transform-panel/index.js +101 -0
- package/build/components/post-transform-panel/index.js.map +1 -0
- package/build/components/post-trash/panel.js +18 -0
- package/build/components/post-trash/panel.js.map +1 -0
- package/build/components/post-type-support-check/index.js +1 -1
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +3 -3
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/provider/index.js +3 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +21 -3
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/sidebar/constants.js +11 -0
- package/build/components/sidebar/constants.js.map +1 -0
- package/build/components/sidebar/header.js +53 -0
- package/build/components/sidebar/header.js.map +1 -0
- package/build/components/sidebar/index.js +157 -0
- package/build/components/sidebar/index.js.map +1 -0
- package/build/components/sidebar/post-summary.js +84 -0
- package/build/components/sidebar/post-summary.js.map +1 -0
- package/build/components/start-page-options/index.js +5 -7
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/start-template-options/index.js +192 -0
- package/build/components/start-template-options/index.js.map +1 -0
- package/build/components/template-content-panel/index.js +38 -0
- package/build/components/template-content-panel/index.js.map +1 -0
- package/build/hooks/pattern-overrides.js +10 -5
- package/build/hooks/pattern-overrides.js.map +1 -1
- package/build/private-apis.js +7 -12
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +72 -0
- package/build/private-apis.native.js.map +1 -0
- package/build/store/private-selectors.js +6 -1
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +15 -0
- package/build/store/reducer.js.map +1 -1
- package/build-module/bindings/pattern-overrides.js +69 -1
- package/build-module/bindings/pattern-overrides.js.map +1 -1
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +119 -0
- package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -0
- package/build-module/components/block-settings-menu/content-only-settings-menu.native.js +5 -0
- package/build-module/components/block-settings-menu/content-only-settings-menu.native.js.map +1 -0
- package/build-module/components/collapsible-block-toolbar/index.js +2 -2
- package/build-module/components/collapsible-block-toolbar/index.js.map +1 -1
- package/build-module/components/document-bar/index.js +2 -2
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/document-outline/item.js +2 -2
- package/build-module/components/document-outline/item.js.map +1 -1
- package/build-module/components/document-tools/index.js +16 -19
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor-canvas/index.js +19 -8
- package/build-module/components/editor-canvas/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/global-styles-provider/index.js +120 -0
- package/build-module/components/global-styles-provider/index.js.map +1 -0
- package/build-module/components/header/index.js +139 -0
- package/build-module/components/header/index.js.map +1 -0
- package/build-module/components/inserter-sidebar/index.js +59 -34
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/post-actions/actions.js +125 -66
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/index.js +7 -14
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +7 -30
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-comments/index.js +30 -10
- package/build-module/components/post-comments/index.js.map +1 -1
- package/build-module/components/post-discussion/panel.js +105 -23
- package/build-module/components/post-discussion/panel.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +2 -2
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-format/panel.js +18 -0
- package/build-module/components/post-format/panel.js.map +1 -0
- package/build-module/components/post-panel-row/index.js +2 -2
- package/build-module/components/post-panel-row/index.js.map +1 -1
- package/build-module/components/post-panel-section/index.js +20 -0
- package/build-module/components/post-panel-section/index.js.map +1 -0
- package/build-module/components/post-pingbacks/index.js +6 -3
- package/build-module/components/post-pingbacks/index.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +2 -2
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-slug/panel.js +18 -0
- package/build-module/components/post-slug/panel.js.map +1 -0
- package/build-module/components/post-status/index.js +4 -4
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-sticky/panel.js +12 -0
- package/build-module/components/post-sticky/panel.js.map +1 -0
- package/build-module/components/post-title/index.js +2 -2
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/post-title-raw.js +2 -2
- package/build-module/components/post-title/post-title-raw.js.map +1 -1
- package/build-module/components/post-transform-panel/hooks.js +83 -0
- package/build-module/components/post-transform-panel/hooks.js.map +1 -0
- package/build-module/components/post-transform-panel/index.js +94 -0
- package/build-module/components/post-transform-panel/index.js.map +1 -0
- package/build-module/components/post-trash/panel.js +10 -0
- package/build-module/components/post-trash/panel.js.map +1 -0
- package/build-module/components/post-type-support-check/index.js +1 -1
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +3 -3
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/provider/index.js +3 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +21 -3
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/sidebar/constants.js +5 -0
- package/build-module/components/sidebar/constants.js.map +1 -0
- package/build-module/components/sidebar/header.js +46 -0
- package/build-module/components/sidebar/header.js.map +1 -0
- package/build-module/components/sidebar/index.js +149 -0
- package/build-module/components/sidebar/index.js.map +1 -0
- package/build-module/components/sidebar/post-summary.js +77 -0
- package/build-module/components/sidebar/post-summary.js.map +1 -0
- package/build-module/components/start-page-options/index.js +5 -7
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +185 -0
- package/build-module/components/start-template-options/index.js.map +1 -0
- package/build-module/components/template-content-panel/index.js +31 -0
- package/build-module/components/template-content-panel/index.js.map +1 -0
- package/build-module/hooks/pattern-overrides.js +10 -5
- package/build-module/hooks/pattern-overrides.js.map +1 -1
- package/build-module/private-apis.js +7 -12
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +62 -0
- package/build-module/private-apis.native.js.map +1 -0
- package/build-module/store/private-selectors.js +3 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +14 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/style-rtl.css +328 -18
- package/build-style/style.css +328 -18
- package/package.json +38 -36
- package/src/bindings/pattern-overrides.js +83 -1
- package/src/components/autocompleters/style.scss +1 -2
- package/src/components/block-settings-menu/content-only-settings-menu.js +175 -0
- package/src/components/block-settings-menu/content-only-settings-menu.native.js +4 -0
- package/src/components/block-settings-menu/style.scss +4 -0
- package/src/components/collapsible-block-toolbar/index.js +2 -2
- package/src/components/document-bar/index.js +2 -2
- package/src/components/document-outline/item.js +2 -2
- package/src/components/document-tools/index.js +19 -21
- package/src/components/editor-canvas/index.js +18 -6
- package/src/components/global-keyboard-shortcuts/register-shortcuts.js +1 -1
- package/src/components/global-styles-provider/index.js +162 -0
- package/src/components/header/index.js +154 -0
- package/src/components/header/style.scss +231 -0
- package/src/components/inserter-sidebar/index.js +52 -29
- package/src/components/inserter-sidebar/style.scss +10 -3
- package/src/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/src/components/list-view-sidebar/style.scss +1 -0
- package/src/components/page-attributes/test/order.js +5 -1
- package/src/components/post-actions/actions.js +256 -150
- package/src/components/post-actions/index.js +5 -38
- package/src/components/post-card-panel/index.js +39 -85
- package/src/components/post-comments/index.js +47 -9
- package/src/components/post-discussion/panel.js +108 -31
- package/src/components/post-discussion/style.scss +26 -0
- package/src/components/post-excerpt/panel.js +2 -2
- package/src/components/post-format/panel.js +22 -0
- package/src/components/post-format/style.scss +6 -0
- package/src/components/post-last-revision/test/check.js +5 -1
- package/src/components/post-panel-row/index.js +2 -2
- package/src/components/post-panel-section/index.js +19 -0
- package/src/components/post-panel-section/style.scss +3 -0
- package/src/components/post-pingbacks/index.js +11 -2
- package/src/components/post-publish-panel/style.scss +5 -0
- package/src/components/post-saved-state/index.js +2 -2
- package/src/components/post-slug/panel.js +22 -0
- package/src/components/post-slug/style.scss +5 -0
- package/src/components/post-slug/test/index.js +5 -1
- package/src/components/post-status/index.js +4 -4
- package/src/components/post-sticky/panel.js +18 -0
- package/src/components/post-title/index.js +2 -2
- package/src/components/post-title/post-title-raw.js +2 -2
- package/src/components/post-transform-panel/hooks.js +114 -0
- package/src/components/post-transform-panel/index.js +99 -0
- package/src/components/post-trash/panel.js +13 -0
- package/src/components/post-type-support-check/index.js +1 -1
- package/src/components/post-type-support-check/test/index.js +2 -2
- package/src/components/preferences-modal/index.js +3 -3
- package/src/components/provider/index.js +4 -0
- package/src/components/provider/use-block-editor-settings.js +19 -4
- package/src/components/sidebar/constants.js +4 -0
- package/src/components/sidebar/header.js +49 -0
- package/src/components/sidebar/index.js +200 -0
- package/src/components/sidebar/post-summary.js +104 -0
- package/src/components/sidebar/style.scss +18 -0
- package/src/components/start-page-options/index.js +6 -4
- package/src/components/start-template-options/index.js +219 -0
- package/src/components/start-template-options/style.scss +55 -0
- package/src/components/template-areas/style.scss +0 -1
- package/src/components/template-content-panel/index.js +36 -0
- package/src/hooks/pattern-overrides.js +12 -6
- package/src/private-apis.js +10 -12
- package/src/private-apis.native.js +61 -0
- package/src/store/private-selectors.js +3 -0
- package/src/store/reducer.js +12 -0
- package/src/style.scss +7 -0
- package/src/components/post-slug/test/check.js +0 -17
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __experimentalVStack as VStack } from '@wordpress/components';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import PluginPostStatusInfo from '../plugin-post-status-info';
|
|
11
|
+
import PostActions from '../post-actions';
|
|
12
|
+
import PostAuthorPanel from '../post-author/panel';
|
|
13
|
+
import PostCardPanel from '../post-card-panel';
|
|
14
|
+
import PostContentInformation from '../post-content-information';
|
|
15
|
+
import PostDiscussionPanel from '../post-discussion/panel';
|
|
16
|
+
import { PrivatePostExcerptPanel as PostExcerptPanel } from '../post-excerpt/panel';
|
|
17
|
+
import PostFeaturedImagePanel from '../post-featured-image/panel';
|
|
18
|
+
import PostFormatPanel from '../post-format/panel';
|
|
19
|
+
import PostLastEditedPanel from '../post-last-edited-panel';
|
|
20
|
+
import PostPanelSection from '../post-panel-section';
|
|
21
|
+
import PostSchedulePanel from '../post-schedule/panel';
|
|
22
|
+
import PostStatusPanel from '../post-status';
|
|
23
|
+
import PostStickyPanel from '../post-sticky';
|
|
24
|
+
import PostSyncStatus from '../post-sync-status';
|
|
25
|
+
import PostTemplatePanel from '../post-template/panel';
|
|
26
|
+
import PostTrashPanel from '../post-trash/panel';
|
|
27
|
+
import PostURLPanel from '../post-url/panel';
|
|
28
|
+
import { store as editorStore } from '../../store';
|
|
29
|
+
import {
|
|
30
|
+
NAVIGATION_POST_TYPE,
|
|
31
|
+
PATTERN_POST_TYPE,
|
|
32
|
+
TEMPLATE_PART_POST_TYPE,
|
|
33
|
+
TEMPLATE_POST_TYPE,
|
|
34
|
+
} from '../../store/constants';
|
|
35
|
+
import TemplateAreas from '../template-areas';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Module Constants
|
|
39
|
+
*/
|
|
40
|
+
const PANEL_NAME = 'post-status';
|
|
41
|
+
|
|
42
|
+
export default function PostSummary( { onActionPerformed } ) {
|
|
43
|
+
const { isRemovedPostStatusPanel, postType } = useSelect( ( select ) => {
|
|
44
|
+
// We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do
|
|
45
|
+
// not use isEditorPanelEnabled since this panel should not be disabled through the UI.
|
|
46
|
+
const { isEditorPanelRemoved, getCurrentPostType } =
|
|
47
|
+
select( editorStore );
|
|
48
|
+
return {
|
|
49
|
+
isRemovedPostStatusPanel: isEditorPanelRemoved( PANEL_NAME ),
|
|
50
|
+
postType: getCurrentPostType(),
|
|
51
|
+
};
|
|
52
|
+
}, [] );
|
|
53
|
+
const isPattern = postType === PATTERN_POST_TYPE;
|
|
54
|
+
const isTemplate = postType === TEMPLATE_POST_TYPE;
|
|
55
|
+
const isTemplatePart = postType === TEMPLATE_PART_POST_TYPE;
|
|
56
|
+
const isNavigation = postType === NAVIGATION_POST_TYPE;
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<PostPanelSection className="editor-post-summary">
|
|
60
|
+
<PluginPostStatusInfo.Slot>
|
|
61
|
+
{ ( fills ) => (
|
|
62
|
+
<>
|
|
63
|
+
<VStack spacing={ 4 }>
|
|
64
|
+
<PostCardPanel
|
|
65
|
+
actions={
|
|
66
|
+
<PostActions
|
|
67
|
+
onActionPerformed={ onActionPerformed }
|
|
68
|
+
/>
|
|
69
|
+
}
|
|
70
|
+
/>
|
|
71
|
+
<PostFeaturedImagePanel withPanelBody={ false } />
|
|
72
|
+
<PostExcerptPanel />
|
|
73
|
+
<VStack spacing={ 1 }>
|
|
74
|
+
<PostContentInformation />
|
|
75
|
+
<PostLastEditedPanel />
|
|
76
|
+
</VStack>
|
|
77
|
+
{ ! isRemovedPostStatusPanel && (
|
|
78
|
+
<VStack spacing={ 2 }>
|
|
79
|
+
<VStack spacing={ 1 }>
|
|
80
|
+
<PostStatusPanel />
|
|
81
|
+
<PostSchedulePanel />
|
|
82
|
+
<PostTemplatePanel />
|
|
83
|
+
<PostURLPanel />
|
|
84
|
+
<PostDiscussionPanel />
|
|
85
|
+
<PostSyncStatus />
|
|
86
|
+
</VStack>
|
|
87
|
+
<PostStickyPanel />
|
|
88
|
+
<PostFormatPanel />
|
|
89
|
+
<PostAuthorPanel />
|
|
90
|
+
{ isTemplate && <TemplateAreas /> }
|
|
91
|
+
{ fills }
|
|
92
|
+
{ ! isPattern &&
|
|
93
|
+
! isTemplate &&
|
|
94
|
+
! isTemplatePart &&
|
|
95
|
+
! isNavigation && <PostTrashPanel /> }
|
|
96
|
+
</VStack>
|
|
97
|
+
) }
|
|
98
|
+
</VStack>
|
|
99
|
+
</>
|
|
100
|
+
) }
|
|
101
|
+
</PluginPostStatusInfo.Slot>
|
|
102
|
+
</PostPanelSection>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.components-panel__header.editor-sidebar__panel-tabs {
|
|
2
|
+
padding-left: 0;
|
|
3
|
+
padding-right: $grid-unit-20;
|
|
4
|
+
|
|
5
|
+
.components-button.has-icon {
|
|
6
|
+
padding: 0;
|
|
7
|
+
min-width: $icon-size;
|
|
8
|
+
height: $icon-size;
|
|
9
|
+
|
|
10
|
+
@include break-medium() {
|
|
11
|
+
display: flex;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.editor-post-summary .components-v-stack:empty {
|
|
17
|
+
display: none;
|
|
18
|
+
}
|
|
@@ -17,6 +17,7 @@ import { __unstableSerializeAndClean } from '@wordpress/blocks';
|
|
|
17
17
|
* Internal dependencies
|
|
18
18
|
*/
|
|
19
19
|
import { store as editorStore } from '../../store';
|
|
20
|
+
import { TEMPLATE_POST_TYPE } from '../../store/constants';
|
|
20
21
|
|
|
21
22
|
function useStartPatterns() {
|
|
22
23
|
// A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,
|
|
@@ -115,14 +116,15 @@ export default function StartPageOptions() {
|
|
|
115
116
|
isEditedPostEmpty,
|
|
116
117
|
getCurrentPostType,
|
|
117
118
|
getCurrentPostId,
|
|
118
|
-
getEditorSettings,
|
|
119
119
|
} = select( editorStore );
|
|
120
|
-
const
|
|
120
|
+
const _postType = getCurrentPostType();
|
|
121
121
|
|
|
122
122
|
return {
|
|
123
123
|
shouldEnableModal:
|
|
124
|
-
!
|
|
125
|
-
|
|
124
|
+
! isEditedPostDirty() &&
|
|
125
|
+
isEditedPostEmpty() &&
|
|
126
|
+
TEMPLATE_POST_TYPE !== _postType,
|
|
127
|
+
postType: _postType,
|
|
126
128
|
postId: getCurrentPostId(),
|
|
127
129
|
};
|
|
128
130
|
}, [] );
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Modal, Flex, FlexItem, Button } from '@wordpress/components';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
import { useState, useMemo, useEffect } from '@wordpress/element';
|
|
7
|
+
import { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';
|
|
8
|
+
import { useSelect } from '@wordpress/data';
|
|
9
|
+
import { useAsyncList } from '@wordpress/compose';
|
|
10
|
+
import { parse } from '@wordpress/blocks';
|
|
11
|
+
import { store as coreStore, useEntityBlockEditor } from '@wordpress/core-data';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
import { store as editorStore } from '../../store';
|
|
17
|
+
import { TEMPLATE_POST_TYPE } from '../../store/constants';
|
|
18
|
+
|
|
19
|
+
function useFallbackTemplateContent( slug, isCustom = false ) {
|
|
20
|
+
return useSelect(
|
|
21
|
+
( select ) => {
|
|
22
|
+
const { getEntityRecord, getDefaultTemplateId } =
|
|
23
|
+
select( coreStore );
|
|
24
|
+
const templateId = getDefaultTemplateId( {
|
|
25
|
+
slug,
|
|
26
|
+
is_custom: isCustom,
|
|
27
|
+
ignore_empty: true,
|
|
28
|
+
} );
|
|
29
|
+
return templateId
|
|
30
|
+
? getEntityRecord( 'postType', TEMPLATE_POST_TYPE, templateId )
|
|
31
|
+
?.content?.raw
|
|
32
|
+
: undefined;
|
|
33
|
+
},
|
|
34
|
+
[ slug, isCustom ]
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function useStartPatterns( fallbackContent ) {
|
|
39
|
+
const { slug, patterns } = useSelect( ( select ) => {
|
|
40
|
+
const { getCurrentPostType, getCurrentPostId } = select( editorStore );
|
|
41
|
+
const { getEntityRecord, getBlockPatterns } = select( coreStore );
|
|
42
|
+
const postId = getCurrentPostId();
|
|
43
|
+
const postType = getCurrentPostType();
|
|
44
|
+
const record = getEntityRecord( 'postType', postType, postId );
|
|
45
|
+
return {
|
|
46
|
+
slug: record.slug,
|
|
47
|
+
patterns: getBlockPatterns(),
|
|
48
|
+
};
|
|
49
|
+
}, [] );
|
|
50
|
+
|
|
51
|
+
const currentThemeStylesheet = useSelect(
|
|
52
|
+
( select ) => select( coreStore ).getCurrentTheme().stylesheet
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
// Duplicated from packages/block-library/src/pattern/edit.js.
|
|
56
|
+
function injectThemeAttributeInBlockTemplateContent( block ) {
|
|
57
|
+
if (
|
|
58
|
+
block.innerBlocks.find(
|
|
59
|
+
( innerBlock ) => innerBlock.name === 'core/template-part'
|
|
60
|
+
)
|
|
61
|
+
) {
|
|
62
|
+
block.innerBlocks = block.innerBlocks.map( ( innerBlock ) => {
|
|
63
|
+
if (
|
|
64
|
+
innerBlock.name === 'core/template-part' &&
|
|
65
|
+
innerBlock.attributes.theme === undefined
|
|
66
|
+
) {
|
|
67
|
+
innerBlock.attributes.theme = currentThemeStylesheet;
|
|
68
|
+
}
|
|
69
|
+
return innerBlock;
|
|
70
|
+
} );
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (
|
|
74
|
+
block.name === 'core/template-part' &&
|
|
75
|
+
block.attributes.theme === undefined
|
|
76
|
+
) {
|
|
77
|
+
block.attributes.theme = currentThemeStylesheet;
|
|
78
|
+
}
|
|
79
|
+
return block;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return useMemo( () => {
|
|
83
|
+
// filter patterns that are supposed to be used in the current template being edited.
|
|
84
|
+
return [
|
|
85
|
+
{
|
|
86
|
+
name: 'fallback',
|
|
87
|
+
blocks: parse( fallbackContent ),
|
|
88
|
+
title: __( 'Fallback content' ),
|
|
89
|
+
},
|
|
90
|
+
...patterns
|
|
91
|
+
.filter( ( pattern ) => {
|
|
92
|
+
return (
|
|
93
|
+
Array.isArray( pattern.templateTypes ) &&
|
|
94
|
+
pattern.templateTypes.some( ( templateType ) =>
|
|
95
|
+
slug.startsWith( templateType )
|
|
96
|
+
)
|
|
97
|
+
);
|
|
98
|
+
} )
|
|
99
|
+
.map( ( pattern ) => {
|
|
100
|
+
return {
|
|
101
|
+
...pattern,
|
|
102
|
+
blocks: parse( pattern.content ).map( ( block ) =>
|
|
103
|
+
injectThemeAttributeInBlockTemplateContent( block )
|
|
104
|
+
),
|
|
105
|
+
};
|
|
106
|
+
} ),
|
|
107
|
+
];
|
|
108
|
+
}, [ fallbackContent, slug, patterns ] );
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function PatternSelection( { fallbackContent, onChoosePattern, postType } ) {
|
|
112
|
+
const [ , , onChange ] = useEntityBlockEditor( 'postType', postType );
|
|
113
|
+
const blockPatterns = useStartPatterns( fallbackContent );
|
|
114
|
+
const shownBlockPatterns = useAsyncList( blockPatterns );
|
|
115
|
+
return (
|
|
116
|
+
<BlockPatternsList
|
|
117
|
+
blockPatterns={ blockPatterns }
|
|
118
|
+
shownPatterns={ shownBlockPatterns }
|
|
119
|
+
onClickPattern={ ( pattern, blocks ) => {
|
|
120
|
+
onChange( blocks, { selection: undefined } );
|
|
121
|
+
onChoosePattern();
|
|
122
|
+
} }
|
|
123
|
+
/>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function StartModal( { slug, isCustom, onClose, postType } ) {
|
|
128
|
+
const fallbackContent = useFallbackTemplateContent( slug, isCustom );
|
|
129
|
+
if ( ! fallbackContent ) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
return (
|
|
133
|
+
<Modal
|
|
134
|
+
className="editor-start-template-options__modal"
|
|
135
|
+
title={ __( 'Choose a pattern' ) }
|
|
136
|
+
closeLabel={ __( 'Cancel' ) }
|
|
137
|
+
focusOnMount="firstElement"
|
|
138
|
+
onRequestClose={ onClose }
|
|
139
|
+
isFullScreen
|
|
140
|
+
>
|
|
141
|
+
<div className="editor-start-template-options__modal-content">
|
|
142
|
+
<PatternSelection
|
|
143
|
+
fallbackContent={ fallbackContent }
|
|
144
|
+
slug={ slug }
|
|
145
|
+
isCustom={ isCustom }
|
|
146
|
+
postType={ postType }
|
|
147
|
+
onChoosePattern={ () => {
|
|
148
|
+
onClose();
|
|
149
|
+
} }
|
|
150
|
+
/>
|
|
151
|
+
</div>
|
|
152
|
+
<Flex
|
|
153
|
+
className="editor-start-template-options__modal__actions"
|
|
154
|
+
justify="flex-end"
|
|
155
|
+
expanded={ false }
|
|
156
|
+
>
|
|
157
|
+
<FlexItem>
|
|
158
|
+
<Button variant="tertiary" onClick={ onClose }>
|
|
159
|
+
{ __( 'Skip' ) }
|
|
160
|
+
</Button>
|
|
161
|
+
</FlexItem>
|
|
162
|
+
</Flex>
|
|
163
|
+
</Modal>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export default function StartTemplateOptions() {
|
|
168
|
+
const [ isClosed, setIsClosed ] = useState( false );
|
|
169
|
+
const { shouldOpenModal, slug, isCustom, postType, postId } = useSelect(
|
|
170
|
+
( select ) => {
|
|
171
|
+
const { getCurrentPostType, getCurrentPostId } =
|
|
172
|
+
select( editorStore );
|
|
173
|
+
const _postType = getCurrentPostType();
|
|
174
|
+
const _postId = getCurrentPostId();
|
|
175
|
+
const { getEditedEntityRecord, hasEditsForEntityRecord } =
|
|
176
|
+
select( coreStore );
|
|
177
|
+
const templateRecord = getEditedEntityRecord(
|
|
178
|
+
'postType',
|
|
179
|
+
_postType,
|
|
180
|
+
_postId
|
|
181
|
+
);
|
|
182
|
+
const hasEdits = hasEditsForEntityRecord(
|
|
183
|
+
'postType',
|
|
184
|
+
_postType,
|
|
185
|
+
_postId
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
return {
|
|
189
|
+
shouldOpenModal:
|
|
190
|
+
! hasEdits &&
|
|
191
|
+
'' === templateRecord.content &&
|
|
192
|
+
TEMPLATE_POST_TYPE === _postType,
|
|
193
|
+
slug: templateRecord.slug,
|
|
194
|
+
isCustom: templateRecord.is_custom,
|
|
195
|
+
postType: _postType,
|
|
196
|
+
postId: _postId,
|
|
197
|
+
};
|
|
198
|
+
},
|
|
199
|
+
[]
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
useEffect( () => {
|
|
203
|
+
// Should reset the modal state when navigating to a new page/post.
|
|
204
|
+
setIsClosed( false );
|
|
205
|
+
}, [ postType, postId ] );
|
|
206
|
+
|
|
207
|
+
if ( ! shouldOpenModal || isClosed ) {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return (
|
|
212
|
+
<StartModal
|
|
213
|
+
slug={ slug }
|
|
214
|
+
isCustom={ isCustom }
|
|
215
|
+
postType={ postType }
|
|
216
|
+
onClose={ () => setIsClosed( true ) }
|
|
217
|
+
/>
|
|
218
|
+
);
|
|
219
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
$actions-height: 92px;
|
|
2
|
+
|
|
3
|
+
.editor-start-template-options__modal {
|
|
4
|
+
.editor-start-template-options__modal__actions {
|
|
5
|
+
position: absolute;
|
|
6
|
+
bottom: 0;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: $actions-height;
|
|
9
|
+
background-color: $white;
|
|
10
|
+
margin-left: - $grid-unit-40;
|
|
11
|
+
margin-right: - $grid-unit-40;
|
|
12
|
+
padding-left: $grid-unit-40;
|
|
13
|
+
padding-right: $grid-unit-40;
|
|
14
|
+
border-top: 1px solid $gray-300;
|
|
15
|
+
z-index: z-index(".editor-start-template-options__modal__actions");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.block-editor-block-patterns-list {
|
|
19
|
+
// Since the actions container is positioned absolutely,
|
|
20
|
+
// this padding bottom ensures that the content wrapper will properly
|
|
21
|
+
// detect overflowing content and start showing scrollbars at the right
|
|
22
|
+
// moment. Without this padding, the content would render under the actions
|
|
23
|
+
// bar without causing the wrapper to show a scrollbar.
|
|
24
|
+
padding-bottom: $actions-height;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.editor-start-template-options__modal-content .block-editor-block-patterns-list {
|
|
29
|
+
column-count: 2;
|
|
30
|
+
column-gap: $grid-unit-30;
|
|
31
|
+
|
|
32
|
+
@include break-medium() {
|
|
33
|
+
column-count: 3;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@include break-wide() {
|
|
37
|
+
column-count: 4;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.block-editor-block-patterns-list__list-item {
|
|
41
|
+
break-inside: avoid-column;
|
|
42
|
+
|
|
43
|
+
.block-editor-block-patterns-list__item-title {
|
|
44
|
+
display: none;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.block-editor-block-patterns-list__item {
|
|
49
|
+
// Avoid to override the BlockPatternList component
|
|
50
|
+
// default hover and focus styles.
|
|
51
|
+
&:not(:focus):not(:hover) .block-editor-block-preview__container {
|
|
52
|
+
box-shadow: 0 0 0 1px $gray-300;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
|
+
import {
|
|
6
|
+
store as blockEditorStore,
|
|
7
|
+
privateApis as blockEditorPrivateApis,
|
|
8
|
+
} from '@wordpress/block-editor';
|
|
9
|
+
import { PanelBody } from '@wordpress/components';
|
|
10
|
+
import { __ } from '@wordpress/i18n';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
import { unlock } from '../../lock-unlock';
|
|
16
|
+
|
|
17
|
+
const { BlockQuickNavigation } = unlock( blockEditorPrivateApis );
|
|
18
|
+
|
|
19
|
+
const PAGE_CONTENT_BLOCKS = [
|
|
20
|
+
'core/post-content',
|
|
21
|
+
'core/post-featured-image',
|
|
22
|
+
'core/post-title',
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
export default function TemplateContentPanel() {
|
|
26
|
+
const clientIds = useSelect( ( select ) => {
|
|
27
|
+
const { getBlocksByName } = select( blockEditorStore );
|
|
28
|
+
return getBlocksByName( PAGE_CONTENT_BLOCKS );
|
|
29
|
+
}, [] );
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<PanelBody title={ __( 'Content' ) }>
|
|
33
|
+
<BlockQuickNavigation clientIds={ clientIds } />
|
|
34
|
+
</PanelBody>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -19,6 +19,7 @@ const {
|
|
|
19
19
|
ResetOverridesControl,
|
|
20
20
|
PATTERN_TYPES,
|
|
21
21
|
PARTIAL_SYNCING_SUPPORTED_BLOCKS,
|
|
22
|
+
PATTERN_SYNC_TYPES,
|
|
22
23
|
} = unlock( patternsPrivateApis );
|
|
23
24
|
|
|
24
25
|
/**
|
|
@@ -51,18 +52,23 @@ const withPatternOverrideControls = createHigherOrderComponent(
|
|
|
51
52
|
// on every block.
|
|
52
53
|
function ControlsWithStoreSubscription( props ) {
|
|
53
54
|
const blockEditingMode = useBlockEditingMode();
|
|
54
|
-
const { hasPatternOverridesSource,
|
|
55
|
+
const { hasPatternOverridesSource, isEditingSyncedPattern } = useSelect(
|
|
55
56
|
( select ) => {
|
|
56
57
|
const { getBlockBindingsSource } = unlock( select( blocksStore ) );
|
|
58
|
+
const { getCurrentPostType, getEditedPostAttribute } =
|
|
59
|
+
select( editorStore );
|
|
57
60
|
|
|
58
61
|
return {
|
|
59
62
|
// For editing link to the site editor if the theme and user permissions support it.
|
|
60
63
|
hasPatternOverridesSource: !! getBlockBindingsSource(
|
|
61
64
|
'core/pattern-overrides'
|
|
62
65
|
),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
isEditingSyncedPattern:
|
|
67
|
+
getCurrentPostType() === PATTERN_TYPES.user &&
|
|
68
|
+
getEditedPostAttribute( 'meta' )?.wp_pattern_sync_status !==
|
|
69
|
+
PATTERN_SYNC_TYPES.unsynced &&
|
|
70
|
+
getEditedPostAttribute( 'wp_pattern_sync_status' ) !==
|
|
71
|
+
PATTERN_SYNC_TYPES.unsynced,
|
|
66
72
|
};
|
|
67
73
|
},
|
|
68
74
|
[]
|
|
@@ -76,9 +82,9 @@ function ControlsWithStoreSubscription( props ) {
|
|
|
76
82
|
);
|
|
77
83
|
|
|
78
84
|
const shouldShowPatternOverridesControls =
|
|
79
|
-
|
|
85
|
+
isEditingSyncedPattern && blockEditingMode === 'default';
|
|
80
86
|
const shouldShowResetOverridesControl =
|
|
81
|
-
!
|
|
87
|
+
! isEditingSyncedPattern &&
|
|
82
88
|
!! props.attributes.metadata?.name &&
|
|
83
89
|
blockEditingMode !== 'disabled' &&
|
|
84
90
|
hasPatternBindings;
|
package/src/private-apis.js
CHANGED
|
@@ -6,22 +6,18 @@ import * as interfaceApis from '@wordpress/interface';
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
|
-
import CollapsableBlockToolbar from './components/collapsible-block-toolbar';
|
|
10
9
|
import EditorCanvas from './components/editor-canvas';
|
|
11
10
|
import { ExperimentalEditorProvider } from './components/provider';
|
|
12
11
|
import { lock } from './lock-unlock';
|
|
13
12
|
import { EntitiesSavedStatesExtensible } from './components/entities-saved-states';
|
|
14
13
|
import useAutoSwitchEditorSidebars from './components/provider/use-auto-switch-editor-sidebars';
|
|
15
14
|
import useBlockEditorSettings from './components/provider/use-block-editor-settings';
|
|
16
|
-
import
|
|
15
|
+
import Header from './components/header';
|
|
17
16
|
import InserterSidebar from './components/inserter-sidebar';
|
|
18
17
|
import ListViewSidebar from './components/list-view-sidebar';
|
|
19
|
-
import MoreMenu from './components/more-menu';
|
|
20
18
|
import PatternOverridesPanel from './components/pattern-overrides-panel';
|
|
21
19
|
import PluginPostExcerpt from './components/post-excerpt/plugin';
|
|
22
20
|
import PostPanelRow from './components/post-panel-row';
|
|
23
|
-
import PostViewLink from './components/post-view-link';
|
|
24
|
-
import PreviewDropdown from './components/preview-dropdown';
|
|
25
21
|
import PreferencesModal from './components/preferences-modal';
|
|
26
22
|
import PostActions from './components/post-actions';
|
|
27
23
|
import { usePostActions } from './components/post-actions/actions';
|
|
@@ -30,29 +26,31 @@ import PostStatus from './components/post-status';
|
|
|
30
26
|
import ToolsMoreMenuGroup from './components/more-menu/tools-more-menu-group';
|
|
31
27
|
import ViewMoreMenuGroup from './components/more-menu/view-more-menu-group';
|
|
32
28
|
import { PrivatePostExcerptPanel } from './components/post-excerpt/panel';
|
|
33
|
-
import PostPublishButtonOrToggle from './components/post-publish-button/post-publish-button-or-toggle';
|
|
34
29
|
import SavePublishPanels from './components/save-publish-panels';
|
|
35
30
|
import PostContentInformation from './components/post-content-information';
|
|
36
31
|
import PostLastEditedPanel from './components/post-last-edited-panel';
|
|
32
|
+
import Sidebar from './components/sidebar';
|
|
33
|
+
import {
|
|
34
|
+
mergeBaseAndUserConfigs,
|
|
35
|
+
GlobalStylesProvider,
|
|
36
|
+
} from './components/global-styles-provider';
|
|
37
37
|
|
|
38
38
|
const { store: interfaceStore, ...remainingInterfaceApis } = interfaceApis;
|
|
39
39
|
|
|
40
40
|
export const privateApis = {};
|
|
41
41
|
lock( privateApis, {
|
|
42
|
-
CollapsableBlockToolbar,
|
|
43
|
-
DocumentTools,
|
|
44
42
|
EditorCanvas,
|
|
45
43
|
ExperimentalEditorProvider,
|
|
46
44
|
EntitiesSavedStatesExtensible,
|
|
45
|
+
GlobalStylesProvider,
|
|
46
|
+
Header,
|
|
47
47
|
InserterSidebar,
|
|
48
48
|
ListViewSidebar,
|
|
49
|
-
|
|
49
|
+
mergeBaseAndUserConfigs,
|
|
50
50
|
PatternOverridesPanel,
|
|
51
51
|
PluginPostExcerpt,
|
|
52
52
|
PostActions,
|
|
53
53
|
PostPanelRow,
|
|
54
|
-
PostViewLink,
|
|
55
|
-
PreviewDropdown,
|
|
56
54
|
PreferencesModal,
|
|
57
55
|
usePostActions,
|
|
58
56
|
PostCardPanel,
|
|
@@ -60,10 +58,10 @@ lock( privateApis, {
|
|
|
60
58
|
ToolsMoreMenuGroup,
|
|
61
59
|
ViewMoreMenuGroup,
|
|
62
60
|
PrivatePostExcerptPanel,
|
|
63
|
-
PostPublishButtonOrToggle,
|
|
64
61
|
SavePublishPanels,
|
|
65
62
|
PostContentInformation,
|
|
66
63
|
PostLastEditedPanel,
|
|
64
|
+
Sidebar,
|
|
67
65
|
|
|
68
66
|
// This is a temporary private API while we're updating the site editor to use EditorProvider.
|
|
69
67
|
useAutoSwitchEditorSidebars,
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import * as interfaceApis from '@wordpress/interface';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import EditorCanvas from './components/editor-canvas';
|
|
10
|
+
import { ExperimentalEditorProvider } from './components/provider';
|
|
11
|
+
import { lock } from './lock-unlock';
|
|
12
|
+
import { EntitiesSavedStatesExtensible } from './components/entities-saved-states';
|
|
13
|
+
import useAutoSwitchEditorSidebars from './components/provider/use-auto-switch-editor-sidebars';
|
|
14
|
+
import useBlockEditorSettings from './components/provider/use-block-editor-settings';
|
|
15
|
+
import InserterSidebar from './components/inserter-sidebar';
|
|
16
|
+
import ListViewSidebar from './components/list-view-sidebar';
|
|
17
|
+
import PatternOverridesPanel from './components/pattern-overrides-panel';
|
|
18
|
+
import PluginPostExcerpt from './components/post-excerpt/plugin';
|
|
19
|
+
import PostPanelRow from './components/post-panel-row';
|
|
20
|
+
import PreferencesModal from './components/preferences-modal';
|
|
21
|
+
import PostActions from './components/post-actions';
|
|
22
|
+
import { usePostActions } from './components/post-actions/actions';
|
|
23
|
+
import PostCardPanel from './components/post-card-panel';
|
|
24
|
+
import PostStatus from './components/post-status';
|
|
25
|
+
import ToolsMoreMenuGroup from './components/more-menu/tools-more-menu-group';
|
|
26
|
+
import ViewMoreMenuGroup from './components/more-menu/view-more-menu-group';
|
|
27
|
+
import { PrivatePostExcerptPanel } from './components/post-excerpt/panel';
|
|
28
|
+
import SavePublishPanels from './components/save-publish-panels';
|
|
29
|
+
import PostContentInformation from './components/post-content-information';
|
|
30
|
+
import PostLastEditedPanel from './components/post-last-edited-panel';
|
|
31
|
+
|
|
32
|
+
const { store: interfaceStore, ...remainingInterfaceApis } = interfaceApis;
|
|
33
|
+
|
|
34
|
+
export const privateApis = {};
|
|
35
|
+
lock( privateApis, {
|
|
36
|
+
EditorCanvas,
|
|
37
|
+
ExperimentalEditorProvider,
|
|
38
|
+
EntitiesSavedStatesExtensible,
|
|
39
|
+
InserterSidebar,
|
|
40
|
+
ListViewSidebar,
|
|
41
|
+
PatternOverridesPanel,
|
|
42
|
+
PluginPostExcerpt,
|
|
43
|
+
PostActions,
|
|
44
|
+
PostPanelRow,
|
|
45
|
+
PreferencesModal,
|
|
46
|
+
usePostActions,
|
|
47
|
+
PostCardPanel,
|
|
48
|
+
PostStatus,
|
|
49
|
+
ToolsMoreMenuGroup,
|
|
50
|
+
ViewMoreMenuGroup,
|
|
51
|
+
PrivatePostExcerptPanel,
|
|
52
|
+
SavePublishPanels,
|
|
53
|
+
PostContentInformation,
|
|
54
|
+
PostLastEditedPanel,
|
|
55
|
+
|
|
56
|
+
// This is a temporary private API while we're updating the site editor to use EditorProvider.
|
|
57
|
+
useAutoSwitchEditorSidebars,
|
|
58
|
+
useBlockEditorSettings,
|
|
59
|
+
interfaceStore,
|
|
60
|
+
...remainingInterfaceApis,
|
|
61
|
+
} );
|
|
@@ -75,6 +75,9 @@ export const getInsertionPoint = createRegistrySelector( ( select ) =>
|
|
|
75
75
|
export function getListViewToggleRef( state ) {
|
|
76
76
|
return state.listViewToggleRef;
|
|
77
77
|
}
|
|
78
|
+
export function getInserterSidebarToggleRef( state ) {
|
|
79
|
+
return state.inserterSidebarToggleRef;
|
|
80
|
+
}
|
|
78
81
|
const CARD_ICONS = {
|
|
79
82
|
wp_block: symbol,
|
|
80
83
|
wp_navigation: navigation,
|
package/src/store/reducer.js
CHANGED
|
@@ -360,6 +360,17 @@ export function listViewToggleRef( state = { current: null } ) {
|
|
|
360
360
|
return state;
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
+
/**
|
|
364
|
+
* This reducer does nothing aside initializing a ref to the inserter sidebar toggle.
|
|
365
|
+
* We will have a unique ref per "editor" instance.
|
|
366
|
+
*
|
|
367
|
+
* @param {Object} state
|
|
368
|
+
* @return {Object} Reference to the inserter sidebar toggle button.
|
|
369
|
+
*/
|
|
370
|
+
export function inserterSidebarToggleRef( state = { current: null } ) {
|
|
371
|
+
return state;
|
|
372
|
+
}
|
|
373
|
+
|
|
363
374
|
export function publishSidebarActive( state = false, action ) {
|
|
364
375
|
switch ( action.type ) {
|
|
365
376
|
case 'OPEN_PUBLISH_SIDEBAR':
|
|
@@ -387,6 +398,7 @@ export default combineReducers( {
|
|
|
387
398
|
deviceType,
|
|
388
399
|
removedPanels,
|
|
389
400
|
blockInserterPanel,
|
|
401
|
+
inserterSidebarToggleRef,
|
|
390
402
|
listViewPanel,
|
|
391
403
|
listViewToggleRef,
|
|
392
404
|
publishSidebarActive,
|