@wordpress/editor 14.42.0 → 14.43.1-next.v.202604091042.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +8 -0
- package/build/components/autocompleters/index.cjs +3 -0
- package/build/components/autocompleters/index.cjs.map +2 -2
- package/build/components/autocompleters/link.cjs +71 -0
- package/build/components/autocompleters/link.cjs.map +7 -0
- package/build/components/collaborators-overlay/cursor-dom-utils.cjs +1 -1
- package/build/components/collaborators-overlay/cursor-dom-utils.cjs.map +2 -2
- package/build/components/collaborators-overlay/cursor-registry.cjs +86 -0
- package/build/components/collaborators-overlay/cursor-registry.cjs.map +7 -0
- package/build/components/collaborators-overlay/index.cjs +7 -2
- package/build/components/collaborators-overlay/index.cjs.map +2 -2
- package/build/components/collaborators-overlay/overlay-iframe-styles.cjs +1 -1
- package/build/components/collaborators-overlay/overlay-iframe-styles.cjs.map +2 -2
- package/build/components/collaborators-overlay/overlay.cjs +31 -1
- package/build/components/collaborators-overlay/overlay.cjs.map +2 -2
- package/build/components/collaborators-overlay/timing-utils.cjs +1 -1
- package/build/components/collaborators-overlay/timing-utils.cjs.map +2 -2
- package/build/components/collaborators-overlay/use-render-cursors.cjs.map +2 -2
- package/build/components/collaborators-presence/index.cjs +14 -4
- package/build/components/collaborators-presence/index.cjs.map +2 -2
- package/build/components/collaborators-presence/list.cjs +20 -4
- package/build/components/collaborators-presence/list.cjs.map +2 -2
- package/build/components/error-boundary/index.cjs +1 -1
- package/build/components/error-boundary/index.cjs.map +2 -2
- package/build/components/post-card-panel/index.cjs +4 -15
- package/build/components/post-card-panel/index.cjs.map +2 -2
- package/build/components/post-content-information/index.cjs +10 -13
- package/build/components/post-content-information/index.cjs.map +2 -2
- package/build/components/post-revisions-panel/index.cjs +164 -0
- package/build/components/post-revisions-panel/index.cjs.map +7 -0
- package/build/components/post-revisions-preview/revisions-slider.cjs +23 -12
- package/build/components/post-revisions-preview/revisions-slider.cjs.map +2 -2
- package/build/components/post-template/create-new-template-modal.cjs +39 -46
- package/build/components/post-template/create-new-template-modal.cjs.map +2 -2
- package/build/components/post-template/hooks.cjs +52 -6
- package/build/components/post-template/hooks.cjs.map +2 -2
- package/build/components/post-template/swap-template-button.cjs +31 -20
- package/build/components/post-template/swap-template-button.cjs.map +2 -2
- package/build/components/post-title/index.cjs +2 -2
- package/build/components/post-title/index.cjs.map +2 -2
- package/build/components/preferences-modal/index.cjs +35 -27
- package/build/components/preferences-modal/index.cjs.map +2 -2
- package/build/components/revision-block-diff/index.cjs +9 -32
- package/build/components/revision-block-diff/index.cjs.map +3 -3
- package/build/components/revision-diff-panel/index.cjs +68 -0
- package/build/components/revision-diff-panel/index.cjs.map +7 -0
- package/build/components/revision-fields-diff/index.cjs +96 -0
- package/build/components/revision-fields-diff/index.cjs.map +7 -0
- package/build/components/sidebar/dataform-post-summary.cjs +8 -53
- package/build/components/sidebar/dataform-post-summary.cjs.map +2 -2
- package/build/components/sidebar/index.cjs +25 -22
- package/build/components/sidebar/index.cjs.map +3 -3
- package/build/components/sidebar/post-revision-summary.cjs +74 -0
- package/build/components/sidebar/post-revision-summary.cjs.map +7 -0
- package/build/components/sidebar/post-summary.cjs +35 -42
- package/build/components/sidebar/post-summary.cjs.map +3 -3
- package/build/components/style-book/index.cjs +4 -3
- package/build/components/style-book/index.cjs.map +2 -2
- package/build/components/styles-canvas/revisions.cjs +2 -2
- package/build/components/styles-canvas/revisions.cjs.map +1 -1
- package/build/components/sync-connection-error-modal/index.cjs +58 -75
- package/build/components/sync-connection-error-modal/index.cjs.map +3 -3
- package/build/components/sync-connection-error-modal/use-retry-countdown.cjs +32 -9
- package/build/components/sync-connection-error-modal/use-retry-countdown.cjs.map +2 -2
- package/build/components/template-actions-panel/block-theme-content.cjs +188 -0
- package/build/components/template-actions-panel/block-theme-content.cjs.map +7 -0
- package/build/components/template-actions-panel/classic-theme-content.cjs +159 -0
- package/build/components/template-actions-panel/classic-theme-content.cjs.map +7 -0
- package/build/components/template-actions-panel/index.cjs +59 -0
- package/build/components/template-actions-panel/index.cjs.map +7 -0
- package/build/dataviews/store/private-actions.cjs +2 -0
- package/build/dataviews/store/private-actions.cjs.map +2 -2
- package/build/hooks/default-autocompleters.cjs +1 -1
- package/build/hooks/default-autocompleters.cjs.map +2 -2
- package/build/store/private-actions.cjs +15 -1
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +42 -19
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +1 -1
- package/build/store/reducer.cjs.map +2 -2
- package/build-module/components/autocompleters/index.mjs +4 -2
- package/build-module/components/autocompleters/index.mjs.map +2 -2
- package/build-module/components/autocompleters/link.mjs +40 -0
- package/build-module/components/autocompleters/link.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/cursor-dom-utils.mjs +1 -1
- package/build-module/components/collaborators-overlay/cursor-dom-utils.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/cursor-registry.mjs +61 -0
- package/build-module/components/collaborators-overlay/cursor-registry.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/index.mjs +7 -2
- package/build-module/components/collaborators-overlay/index.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs +1 -1
- package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/overlay.mjs +32 -2
- package/build-module/components/collaborators-overlay/overlay.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/timing-utils.mjs +1 -1
- package/build-module/components/collaborators-overlay/timing-utils.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs.map +2 -2
- package/build-module/components/collaborators-presence/index.mjs +14 -4
- package/build-module/components/collaborators-presence/index.mjs.map +2 -2
- package/build-module/components/collaborators-presence/list.mjs +20 -4
- package/build-module/components/collaborators-presence/list.mjs.map +2 -2
- package/build-module/components/error-boundary/index.mjs +1 -1
- package/build-module/components/error-boundary/index.mjs.map +2 -2
- package/build-module/components/post-card-panel/index.mjs +6 -17
- package/build-module/components/post-card-panel/index.mjs.map +2 -2
- package/build-module/components/post-content-information/index.mjs +6 -13
- package/build-module/components/post-content-information/index.mjs.map +2 -2
- package/build-module/components/post-revisions-panel/index.mjs +139 -0
- package/build-module/components/post-revisions-panel/index.mjs.map +7 -0
- package/build-module/components/post-revisions-preview/revisions-slider.mjs +23 -12
- package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
- package/build-module/components/post-template/create-new-template-modal.mjs +39 -46
- package/build-module/components/post-template/create-new-template-modal.mjs.map +2 -2
- package/build-module/components/post-template/hooks.mjs +53 -7
- package/build-module/components/post-template/hooks.mjs.map +2 -2
- package/build-module/components/post-template/swap-template-button.mjs +27 -20
- package/build-module/components/post-template/swap-template-button.mjs.map +2 -2
- package/build-module/components/post-title/index.mjs +2 -2
- package/build-module/components/post-title/index.mjs.map +2 -2
- package/build-module/components/preferences-modal/index.mjs +35 -27
- package/build-module/components/preferences-modal/index.mjs.map +2 -2
- package/build-module/components/revision-block-diff/index.mjs +9 -32
- package/build-module/components/revision-block-diff/index.mjs.map +2 -2
- package/build-module/components/revision-diff-panel/index.mjs +37 -0
- package/build-module/components/revision-diff-panel/index.mjs.map +7 -0
- package/build-module/components/revision-fields-diff/index.mjs +65 -0
- package/build-module/components/revision-fields-diff/index.mjs.map +7 -0
- package/build-module/components/sidebar/dataform-post-summary.mjs +8 -53
- package/build-module/components/sidebar/dataform-post-summary.mjs.map +2 -2
- package/build-module/components/sidebar/index.mjs +25 -22
- package/build-module/components/sidebar/index.mjs.map +2 -2
- package/build-module/components/sidebar/post-revision-summary.mjs +43 -0
- package/build-module/components/sidebar/post-revision-summary.mjs.map +7 -0
- package/build-module/components/sidebar/post-summary.mjs +31 -42
- package/build-module/components/sidebar/post-summary.mjs.map +2 -2
- package/build-module/components/style-book/index.mjs +4 -3
- package/build-module/components/style-book/index.mjs.map +2 -2
- package/build-module/components/styles-canvas/revisions.mjs +2 -2
- package/build-module/components/styles-canvas/revisions.mjs.map +1 -1
- package/build-module/components/sync-connection-error-modal/index.mjs +58 -76
- package/build-module/components/sync-connection-error-modal/index.mjs.map +2 -2
- package/build-module/components/sync-connection-error-modal/use-retry-countdown.mjs +33 -10
- package/build-module/components/sync-connection-error-modal/use-retry-countdown.mjs.map +2 -2
- package/build-module/components/template-actions-panel/block-theme-content.mjs +167 -0
- package/build-module/components/template-actions-panel/block-theme-content.mjs.map +7 -0
- package/build-module/components/template-actions-panel/classic-theme-content.mjs +138 -0
- package/build-module/components/template-actions-panel/classic-theme-content.mjs.map +7 -0
- package/build-module/components/template-actions-panel/index.mjs +28 -0
- package/build-module/components/template-actions-panel/index.mjs.map +7 -0
- package/build-module/dataviews/store/private-actions.mjs +5 -1
- package/build-module/dataviews/store/private-actions.mjs.map +2 -2
- package/build-module/hooks/default-autocompleters.mjs +2 -2
- package/build-module/hooks/default-autocompleters.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +15 -1
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +42 -19
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +1 -1
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-style/style-rtl.css +124 -44
- package/build-style/style.css +124 -44
- package/build-types/bindings/post-data.d.ts +3 -3
- package/build-types/bindings/term-data.d.ts +14 -14
- package/build-types/components/autocompleters/index.d.ts +1 -0
- package/build-types/components/autocompleters/link.d.ts +12 -0
- package/build-types/components/autocompleters/link.d.ts.map +1 -0
- package/build-types/components/collaborators-overlay/cursor-registry.d.ts +36 -0
- package/build-types/components/collaborators-overlay/cursor-registry.d.ts.map +1 -0
- package/build-types/components/collaborators-overlay/index.d.ts +7 -4
- package/build-types/components/collaborators-overlay/index.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/overlay-iframe-styles.d.ts +1 -1
- package/build-types/components/collaborators-overlay/overlay-iframe-styles.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/overlay.d.ts +4 -1
- package/build-types/components/collaborators-overlay/overlay.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/use-render-cursors.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/index.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/list.d.ts +4 -1
- package/build-types/components/collaborators-presence/list.d.ts.map +1 -1
- package/build-types/components/keyboard-shortcut-help-modal/config.d.ts +11 -11
- package/build-types/components/post-actions/set-as-homepage.d.ts +1 -1
- package/build-types/components/post-actions/set-as-posts-page.d.ts +1 -1
- package/build-types/components/post-card-panel/index.d.ts.map +1 -1
- package/build-types/components/post-content-information/index.d.ts +4 -1
- package/build-types/components/post-content-information/index.d.ts.map +1 -1
- package/build-types/components/post-format/index.d.ts +10 -10
- package/build-types/components/post-locked-modal/index.d.ts +2 -2
- package/build-types/components/post-revisions-panel/index.d.ts +2 -0
- package/build-types/components/post-revisions-panel/index.d.ts.map +1 -0
- package/build-types/components/post-revisions-preview/revisions-slider.d.ts.map +1 -1
- package/build-types/components/post-status/index.d.ts +10 -10
- package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
- package/build-types/components/post-template/hooks.d.ts +1 -1
- package/build-types/components/post-template/hooks.d.ts.map +1 -1
- package/build-types/components/post-template/swap-template-button.d.ts +4 -0
- package/build-types/components/post-template/swap-template-button.d.ts.map +1 -1
- package/build-types/components/post-visibility/utils.d.ts +6 -6
- package/build-types/components/revision-block-diff/index.d.ts.map +1 -1
- package/build-types/components/revision-diff-panel/index.d.ts +14 -0
- package/build-types/components/revision-diff-panel/index.d.ts.map +1 -0
- package/build-types/components/revision-fields-diff/index.d.ts +6 -0
- package/build-types/components/revision-fields-diff/index.d.ts.map +1 -0
- package/build-types/components/sidebar/dataform-post-summary.d.ts.map +1 -1
- package/build-types/components/sidebar/index.d.ts.map +1 -1
- package/build-types/components/sidebar/post-revision-summary.d.ts +2 -0
- package/build-types/components/sidebar/post-revision-summary.d.ts.map +1 -0
- package/build-types/components/sidebar/post-summary.d.ts +3 -0
- package/build-types/components/sidebar/post-summary.d.ts.map +1 -1
- package/build-types/components/style-book/index.d.ts +2 -1
- package/build-types/components/style-book/index.d.ts.map +1 -1
- package/build-types/components/sync-connection-error-modal/index.d.ts +0 -14
- package/build-types/components/sync-connection-error-modal/index.d.ts.map +1 -1
- package/build-types/components/sync-connection-error-modal/use-retry-countdown.d.ts.map +1 -1
- package/build-types/components/template-actions-panel/block-theme-content.d.ts +2 -0
- package/build-types/components/template-actions-panel/block-theme-content.d.ts.map +1 -0
- package/build-types/components/template-actions-panel/classic-theme-content.d.ts +2 -0
- package/build-types/components/template-actions-panel/classic-theme-content.d.ts.map +1 -0
- package/build-types/components/template-actions-panel/index.d.ts +2 -0
- package/build-types/components/template-actions-panel/index.d.ts.map +1 -0
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +10 -10
- package/build-types/store/reducer.d.ts.map +1 -1
- package/build-types/utils/pageTypeBadge.d.ts +1 -1
- package/build-types/utils/pageTypeBadge.d.ts.map +1 -1
- package/package.json +45 -44
- package/src/components/autocompleters/index.js +1 -0
- package/src/components/autocompleters/link.js +47 -0
- package/src/components/autocompleters/style.scss +6 -0
- package/src/components/collaborators-overlay/cursor-dom-utils.ts +1 -1
- package/src/components/collaborators-overlay/cursor-registry.ts +96 -0
- package/src/components/collaborators-overlay/index.tsx +12 -4
- package/src/components/collaborators-overlay/overlay-iframe-styles.ts +1 -1
- package/src/components/collaborators-overlay/overlay.tsx +45 -1
- package/src/components/collaborators-overlay/timing-utils.ts +1 -1
- package/src/components/collaborators-overlay/use-render-cursors.ts +4 -2
- package/src/components/collaborators-presence/index.tsx +9 -1
- package/src/components/collaborators-presence/list.tsx +25 -1
- package/src/components/error-boundary/index.js +1 -1
- package/src/components/error-boundary/index.native.js +1 -1
- package/src/components/post-card-panel/index.js +7 -21
- package/src/components/post-content-information/index.js +5 -16
- package/src/components/post-revisions-panel/index.js +151 -0
- package/src/components/post-revisions-panel/style.scss +16 -0
- package/src/components/post-revisions-preview/revisions-slider.js +23 -19
- package/src/components/post-template/create-new-template-modal.js +1 -4
- package/src/components/post-template/hooks.js +65 -9
- package/src/components/post-template/style.scss +0 -6
- package/src/components/post-template/swap-template-button.js +30 -21
- package/src/components/post-title/index.js +3 -3
- package/src/components/preferences-modal/index.js +37 -25
- package/src/components/revision-block-diff/index.js +8 -43
- package/src/components/revision-diff-panel/index.js +59 -0
- package/src/components/revision-fields-diff/index.js +91 -0
- package/src/components/sidebar/dataform-post-summary.js +8 -55
- package/src/components/sidebar/index.js +33 -22
- package/src/components/sidebar/post-revision-summary.js +50 -0
- package/src/components/sidebar/post-summary.js +22 -40
- package/src/components/sidebar/style.scss +7 -0
- package/src/components/style-book/index.js +4 -2
- package/src/components/styles-canvas/revisions.js +2 -2
- package/src/components/sync-connection-error-modal/index.tsx +128 -155
- package/src/components/sync-connection-error-modal/use-retry-countdown.ts +46 -10
- package/src/components/template-actions-panel/block-theme-content.js +196 -0
- package/src/components/template-actions-panel/classic-theme-content.js +170 -0
- package/src/components/template-actions-panel/index.js +32 -0
- package/src/components/template-actions-panel/style.scss +39 -0
- package/src/dataviews/store/private-actions.ts +6 -0
- package/src/hooks/default-autocompleters.js +2 -2
- package/src/hooks/test/default-autocompleters.js +2 -2
- package/src/store/private-actions.js +18 -2
- package/src/store/private-selectors.js +43 -22
- package/src/store/reducer.js +9 -8
- package/src/style.scss +3 -1
- /package/src/components/{revision-block-diff → revision-diff-panel}/style.scss +0 -0
|
@@ -5,73 +5,28 @@ import { store as coreDataStore } from "@wordpress/core-data";
|
|
|
5
5
|
import { DataForm } from "@wordpress/dataviews";
|
|
6
6
|
import { __experimentalVStack as VStack } from "@wordpress/components";
|
|
7
7
|
import { useMemo } from "@wordpress/element";
|
|
8
|
+
import { useViewConfig } from "@wordpress/views";
|
|
8
9
|
import PostCardPanel from "../post-card-panel/index.mjs";
|
|
9
10
|
import PostPanelSection from "../post-panel-section/index.mjs";
|
|
10
11
|
import { store as editorStore } from "../../store/index.mjs";
|
|
11
12
|
import PostTrash from "../post-trash/index.mjs";
|
|
12
13
|
import usePostFields from "../post-fields/index.mjs";
|
|
13
|
-
import { unlock } from "../../lock-unlock.mjs";
|
|
14
14
|
import { usePostTemplatePanelMode } from "../post-template/hooks.mjs";
|
|
15
15
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
-
var
|
|
17
|
-
layout: {
|
|
18
|
-
type: "panel"
|
|
19
|
-
},
|
|
20
|
-
fields: [
|
|
21
|
-
{
|
|
22
|
-
id: "featured_media",
|
|
23
|
-
layout: {
|
|
24
|
-
type: "regular",
|
|
25
|
-
labelPosition: "none"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
id: "post-content-info",
|
|
30
|
-
layout: {
|
|
31
|
-
type: "regular",
|
|
32
|
-
labelPosition: "none"
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
id: "status",
|
|
37
|
-
label: __("Status"),
|
|
38
|
-
children: [
|
|
39
|
-
{
|
|
40
|
-
id: "status",
|
|
41
|
-
layout: { type: "regular", labelPosition: "none" }
|
|
42
|
-
},
|
|
43
|
-
"password"
|
|
44
|
-
]
|
|
45
|
-
},
|
|
46
|
-
"date",
|
|
47
|
-
"slug",
|
|
48
|
-
"author",
|
|
49
|
-
"template",
|
|
50
|
-
{
|
|
51
|
-
id: "discussion",
|
|
52
|
-
label: __("Discussion"),
|
|
53
|
-
children: [
|
|
54
|
-
{
|
|
55
|
-
id: "comment_status",
|
|
56
|
-
layout: { type: "regular", labelPosition: "none" }
|
|
57
|
-
},
|
|
58
|
-
"ping_status"
|
|
59
|
-
]
|
|
60
|
-
},
|
|
61
|
-
"parent",
|
|
62
|
-
"format"
|
|
63
|
-
]
|
|
64
|
-
};
|
|
16
|
+
var EMPTY_FORM = { layout: { type: "panel" }, fields: [] };
|
|
65
17
|
function DataFormPostSummary({ onActionPerformed }) {
|
|
66
18
|
const { postType, postId } = useSelect((select) => {
|
|
67
|
-
const { getCurrentPostType, getCurrentPostId } =
|
|
68
|
-
select(editorStore)
|
|
69
|
-
);
|
|
19
|
+
const { getCurrentPostType, getCurrentPostId } = select(editorStore);
|
|
70
20
|
return {
|
|
71
21
|
postType: getCurrentPostType(),
|
|
72
22
|
postId: getCurrentPostId()
|
|
73
23
|
};
|
|
74
24
|
}, []);
|
|
25
|
+
const { form: formConfig } = useViewConfig({
|
|
26
|
+
kind: "postType",
|
|
27
|
+
name: postType
|
|
28
|
+
});
|
|
29
|
+
const form = formConfig ?? EMPTY_FORM;
|
|
75
30
|
const record = useSelect(
|
|
76
31
|
(select) => {
|
|
77
32
|
if (!postType || !postId) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/sidebar/dataform-post-summary.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { DataForm } from '@wordpress/dataviews';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport PostCardPanel from '../post-card-panel';\nimport PostPanelSection from '../post-panel-section';\nimport { store as editorStore } from '../../store';\nimport PostTrash from '../post-trash';\nimport usePostFields from '../post-fields';\nimport {
|
|
5
|
-
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,aAAa,iBAAiB;AACvC,SAAS,SAAS,qBAAqB;AACvC,SAAS,gBAAgB;AACzB,SAAS,wBAAwB,cAAc;AAC/C,SAAS,eAAe;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { DataForm } from '@wordpress/dataviews';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { useViewConfig } from '@wordpress/views';\n\n/**\n * Internal dependencies\n */\nimport PostCardPanel from '../post-card-panel';\nimport PostPanelSection from '../post-panel-section';\nimport { store as editorStore } from '../../store';\nimport PostTrash from '../post-trash';\nimport usePostFields from '../post-fields';\nimport { usePostTemplatePanelMode } from '../post-template/hooks';\n\nconst EMPTY_FORM = { layout: { type: 'panel' }, fields: [] };\n\nexport default function DataFormPostSummary( { onActionPerformed } ) {\n\tconst { postType, postId } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getCurrentPostId } = select( editorStore );\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\tconst { form: formConfig } = useViewConfig( {\n\t\tkind: 'postType',\n\t\tname: postType,\n\t} );\n\tconst form = formConfig ?? EMPTY_FORM;\n\tconst record = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! postType || ! postId ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn select( coreDataStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst templatePanelMode = usePostTemplatePanelMode();\n\n\tconst availableTemplates = useSelect( ( select ) => {\n\t\tif ( select( coreDataStore ).getCurrentTheme()?.is_block_theme ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn (\n\t\t\tselect( editorStore ).getEditorSettings().availableTemplates ?? {}\n\t\t);\n\t}, [] );\n\n\t// Augment record only when needed(not a block theme with available templates).\n\tconst augmentedRecord = useMemo( () => {\n\t\tif ( ! record || ! availableTemplates ) {\n\t\t\treturn record;\n\t\t}\n\t\treturn {\n\t\t\t...record,\n\t\t\tavailable_templates: availableTemplates,\n\t\t};\n\t}, [ record, availableTemplates ] );\n\n\tconst { editEntityRecord } = useDispatch( coreDataStore );\n\n\tconst _fields = usePostFields( { postType } );\n\tconst fields = useMemo(\n\t\t() =>\n\t\t\t_fields\n\t\t\t\t?.map( ( field ) => {\n\t\t\t\t\tif ( field.id === 'status' ) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...field,\n\t\t\t\t\t\t\telements: field.elements.filter(\n\t\t\t\t\t\t\t\t( element ) => element.value !== 'trash'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tif ( field.id === 'template' ) {\n\t\t\t\t\t\t// `usePostTemplatePanelMode` is reused in the Post Template panel to match\n\t\t\t\t\t\t// the existing behavior. If the panel rendered nothing we should exclude the\n\t\t\t\t\t\t// template field from the form.\n\t\t\t\t\t\tif ( ! templatePanelMode ) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// In classic themes without available templates we need to make the field read-only.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttemplatePanelMode === 'classic' &&\n\t\t\t\t\t\t\tObject.keys( availableTemplates ?? {} ).length === 0\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...field,\n\t\t\t\t\t\t\t\treadOnly: true,\n\t\t\t\t\t\t\t\trender: () => __( 'Default template' ),\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn field;\n\t\t\t\t\t}\n\t\t\t\t\treturn field;\n\t\t\t\t} )\n\t\t\t\t.filter( Boolean ),\n\t\t[ _fields, templatePanelMode, availableTemplates ]\n\t);\n\n\tconst onChange = ( edits ) => {\n\t\tif (\n\t\t\tedits.status &&\n\t\t\tedits.status !== 'future' &&\n\t\t\trecord?.status === 'future' &&\n\t\t\tnew Date( record.date ) > new Date()\n\t\t) {\n\t\t\tedits.date = null;\n\t\t}\n\t\tif ( edits.status && edits.status === 'private' && record?.password ) {\n\t\t\tedits.password = '';\n\t\t}\n\n\t\teditEntityRecord( 'postType', postType, postId, edits );\n\t};\n\treturn (\n\t\t<PostPanelSection className=\"editor-post-summary\">\n\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t<PostCardPanel\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tpostId={ postId }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t/>\n\t\t\t\t<DataForm\n\t\t\t\t\tdata={ augmentedRecord }\n\t\t\t\t\tfields={ fields }\n\t\t\t\t\tform={ form }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t\t<PostTrash onActionPerformed={ onActionPerformed } />\n\t\t\t</VStack>\n\t\t</PostPanelSection>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,aAAa,iBAAiB;AACvC,SAAS,SAAS,qBAAqB;AACvC,SAAS,gBAAgB;AACzB,SAAS,wBAAwB,cAAc;AAC/C,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAK9B,OAAO,mBAAmB;AAC1B,OAAO,sBAAsB;AAC7B,SAAS,SAAS,mBAAmB;AACrC,OAAO,eAAe;AACtB,OAAO,mBAAmB;AAC1B,SAAS,gCAAgC;AA+GtC,SACC,KADD;AA7GH,IAAM,aAAa,EAAE,QAAQ,EAAE,MAAM,QAAQ,GAAG,QAAQ,CAAC,EAAE;AAE5C,SAAR,oBAAsC,EAAE,kBAAkB,GAAI;AACpE,QAAM,EAAE,UAAU,OAAO,IAAI,UAAW,CAAE,WAAY;AACrD,UAAM,EAAE,oBAAoB,iBAAiB,IAAI,OAAQ,WAAY;AACrE,WAAO;AAAA,MACN,UAAU,mBAAmB;AAAA,MAC7B,QAAQ,iBAAiB;AAAA,IAC1B;AAAA,EACD,GAAG,CAAC,CAAE;AACN,QAAM,EAAE,MAAM,WAAW,IAAI,cAAe;AAAA,IAC3C,MAAM;A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V,QAAQ,MAAM,GAAI,kBAAmB;AAAA,UACtC;AAAA,QACD;AACA,eAAO;AAAA,MACR;AACA,aAAO;AAAA,IACR,CAAE,EACD,OAAQ,OAAQ;AAAA,IACnB,CAAE,SAAS,mBAAmB,kBAAmB;AAAA,EAClD;AAEA,QAAM,WAAW,CAAE,UAAW;AAC7B,QACC,MAAM,UACN,MAAM,WAAW,YACjB,QAAQ,WAAW,YACnB,IAAI,KAAM,OAAO,IAAK,IAAI,oBAAI,KAAK,GAClC;AACD,YAAM,OAAO;AAAA,IACd;AACA,QAAK,MAAM,UAAU,MAAM,WAAW,aAAa,QAAQ,UAAW;AACrE,YAAM,WAAW;AAAA,IAClB;AAEA,qBAAkB,YAAY,UAAU,QAAQ,KAAM;AAAA,EACvD;AACA,SACC,oBAAC,oBAAiB,WAAU,uBAC3B,+BAAC,UAAO,SAAU,GACjB;AAAA;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,MAAO;AAAA,QACP;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,IACA,oBAAC,aAAU,mBAAwC;AAAA,KACpD,GACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -20,12 +20,15 @@ import PatternOverridesPanel from "../pattern-overrides-panel/index.mjs";
|
|
|
20
20
|
import PluginDocumentSettingPanel from "../plugin-document-setting-panel/index.mjs";
|
|
21
21
|
import PluginSidebar from "../plugin-sidebar/index.mjs";
|
|
22
22
|
import PostSummary from "./post-summary.mjs";
|
|
23
|
+
import PostRevisionSummary from "./post-revision-summary.mjs";
|
|
23
24
|
import PostTaxonomiesPanel from "../post-taxonomies/panel.mjs";
|
|
24
25
|
import PostTransformPanel from "../post-transform-panel/index.mjs";
|
|
25
26
|
import SidebarHeader from "./header.mjs";
|
|
27
|
+
import TemplateActionsPanel from "../template-actions-panel/index.mjs";
|
|
26
28
|
import TemplateContentPanel from "../template-content-panel/index.mjs";
|
|
27
29
|
import TemplatePartContentPanel from "../template-part-content-panel/index.mjs";
|
|
28
30
|
import { MediaMetadataPanel } from "../media/index.mjs";
|
|
31
|
+
import PostRevisionsPanel from "../post-revisions-panel/index.mjs";
|
|
29
32
|
import RevisionBlockDiffPanel from "../revision-block-diff/index.mjs";
|
|
30
33
|
import useAutoSwitchEditorSidebars from "../provider/use-auto-switch-editor-sidebars.mjs";
|
|
31
34
|
import { sidebars } from "./constants.mjs";
|
|
@@ -74,6 +77,27 @@ var SidebarContent = ({
|
|
|
74
77
|
selectedTabElement?.focus();
|
|
75
78
|
}
|
|
76
79
|
}, [tabName]);
|
|
80
|
+
let tabContent;
|
|
81
|
+
if (isAttachment) {
|
|
82
|
+
tabContent = /* @__PURE__ */ jsx(MediaMetadataPanel, { onActionPerformed });
|
|
83
|
+
} else if (isRevisionsMode) {
|
|
84
|
+
tabContent = /* @__PURE__ */ jsx(PostRevisionSummary, {});
|
|
85
|
+
} else {
|
|
86
|
+
tabContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
87
|
+
/* @__PURE__ */ jsx(PostSummary, { onActionPerformed }),
|
|
88
|
+
/* @__PURE__ */ jsx(PluginDocumentSettingPanel.Slot, {}),
|
|
89
|
+
/* @__PURE__ */ jsx(TemplateContentPanel, {}),
|
|
90
|
+
window?.__experimentalDataFormInspector && ["post", "page"].includes(postType) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
91
|
+
/* @__PURE__ */ jsx(TemplateActionsPanel, {}),
|
|
92
|
+
/* @__PURE__ */ jsx(PostRevisionsPanel, {})
|
|
93
|
+
] }),
|
|
94
|
+
/* @__PURE__ */ jsx(TemplatePartContentPanel, {}),
|
|
95
|
+
/* @__PURE__ */ jsx(PostTransformPanel, {}),
|
|
96
|
+
/* @__PURE__ */ jsx(PostTaxonomiesPanel, {}),
|
|
97
|
+
/* @__PURE__ */ jsx(PatternOverridesPanel, {}),
|
|
98
|
+
extraPanels
|
|
99
|
+
] });
|
|
100
|
+
}
|
|
77
101
|
return /* @__PURE__ */ jsx(
|
|
78
102
|
PluginSidebar,
|
|
79
103
|
{
|
|
@@ -90,28 +114,7 @@ var SidebarContent = ({
|
|
|
90
114
|
icon: isRTL() ? drawerLeft : drawerRight,
|
|
91
115
|
isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT,
|
|
92
116
|
children: /* @__PURE__ */ jsxs(Tabs.Context.Provider, { value: tabsContextValue, children: [
|
|
93
|
-
/* @__PURE__ */ jsx(Tabs.TabPanel, { tabId: sidebars.document, focusable: false, children:
|
|
94
|
-
MediaMetadataPanel,
|
|
95
|
-
{
|
|
96
|
-
onActionPerformed
|
|
97
|
-
}
|
|
98
|
-
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
99
|
-
/* @__PURE__ */ jsx(
|
|
100
|
-
PostSummary,
|
|
101
|
-
{
|
|
102
|
-
onActionPerformed
|
|
103
|
-
}
|
|
104
|
-
),
|
|
105
|
-
!isRevisionsMode && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
106
|
-
/* @__PURE__ */ jsx(PluginDocumentSettingPanel.Slot, {}),
|
|
107
|
-
/* @__PURE__ */ jsx(TemplateContentPanel, {}),
|
|
108
|
-
/* @__PURE__ */ jsx(TemplatePartContentPanel, {}),
|
|
109
|
-
/* @__PURE__ */ jsx(PostTransformPanel, {}),
|
|
110
|
-
/* @__PURE__ */ jsx(PostTaxonomiesPanel, {}),
|
|
111
|
-
/* @__PURE__ */ jsx(PatternOverridesPanel, {}),
|
|
112
|
-
extraPanels
|
|
113
|
-
] })
|
|
114
|
-
] }) }),
|
|
117
|
+
/* @__PURE__ */ jsx(Tabs.TabPanel, { tabId: sidebars.document, focusable: false, children: tabContent }),
|
|
115
118
|
!isAttachment && /* @__PURE__ */ jsxs(Tabs.TabPanel, { tabId: sidebars.block, focusable: false, children: [
|
|
116
119
|
/* @__PURE__ */ jsx(BlockInspector, {}),
|
|
117
120
|
isRevisionsMode && /* @__PURE__ */ jsx(RevisionBlockDiffPanel, {})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/sidebar/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPlatform,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseRef,\n} from '@wordpress/element';\nimport { isRTL, __, _x } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport PatternOverridesPanel from '../pattern-overrides-panel';\nimport PluginDocumentSettingPanel from '../plugin-document-setting-panel';\nimport PluginSidebar from '../plugin-sidebar';\nimport PostSummary from './post-summary';\nimport PostTaxonomiesPanel from '../post-taxonomies/panel';\nimport PostTransformPanel from '../post-transform-panel';\nimport SidebarHeader from './header';\nimport TemplateContentPanel from '../template-content-panel';\nimport TemplatePartContentPanel from '../template-part-content-panel';\nimport { MediaMetadataPanel } from '../media';\nimport RevisionBlockDiffPanel from '../revision-block-diff';\nimport useAutoSwitchEditorSidebars from '../provider/use-auto-switch-editor-sidebars';\nimport { sidebars } from './constants';\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport {\n\tATTACHMENT_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n} from '../../store/constants';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\n\nconst SidebarContent = ( {\n\ttabName,\n\tkeyboardShortcut,\n\tonActionPerformed,\n\textraPanels,\n\tpostType,\n} ) => {\n\tconst tabListRef = useRef( null );\n\t// Because `PluginSidebar` renders a `ComplementaryArea`, we\n\t// need to forward the `Tabs` context so it can be passed through the\n\t// underlying slot/fill.\n\tconst tabsContextValue = useContext( Tabs.Context );\n\tconst isAttachment = postType === ATTACHMENT_POST_TYPE;\n\tconst isRevisionsMode = useSelect( ( select ) => {\n\t\treturn unlock( select( editorStore ) ).isRevisionsMode();\n\t} );\n\n\t// This effect addresses a race condition caused by tabbing from the last\n\t// block in the editor into the settings sidebar. Without this effect, the\n\t// selected tab and browser focus can become separated in an unexpected way\n\t// (e.g the \"block\" tab is focused, but the \"post\" tab is selected).\n\tuseEffect( () => {\n\t\tconst tabsElements = Array.from(\n\t\t\ttabListRef.current?.querySelectorAll( '[role=\"tab\"]' ) || []\n\t\t);\n\t\tconst selectedTabElement = tabsElements.find(\n\t\t\t// We are purposefully using a custom `data-tab-id` attribute here\n\t\t\t// because we don't want rely on any assumptions about `Tabs`\n\t\t\t// component internals.\n\t\t\t( element ) => element.getAttribute( 'data-tab-id' ) === tabName\n\t\t);\n\t\tconst activeElement = selectedTabElement?.ownerDocument.activeElement;\n\t\tconst tabsHasFocus = tabsElements.some( ( element ) => {\n\t\t\treturn activeElement && activeElement.id === element.id;\n\t\t} );\n\t\tif (\n\t\t\ttabsHasFocus &&\n\t\t\tselectedTabElement &&\n\t\t\tselectedTabElement.id !== activeElement?.id\n\t\t) {\n\t\t\tselectedTabElement?.focus();\n\t\t}\n\t}, [ tabName ] );\n\n\
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,WAAW,mBAAmB;AACvC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,OAAO,IAAI,UAAU;AAC9B,SAAS,YAAY,mBAAmB;AACxC,SAAS,SAAS,8BAA8B;AAChD,SAAS,eAAe,6BAA6B;AACrD,SAAS,SAAS,sBAAsB;AAKxC,OAAO,2BAA2B;AAClC,OAAO,gCAAgC;AACvC,OAAO,mBAAmB;AAC1B,OAAO,iBAAiB;AACxB,OAAO,yBAAyB;AAChC,OAAO,wBAAwB;AAC/B,OAAO,mBAAmB;AAC1B,OAAO,0BAA0B;AACjC,OAAO,8BAA8B;AACrC,SAAS,0BAA0B;AACnC,OAAO,4BAA4B;AACnC,OAAO,iCAAiC;AACxC,SAAS,gBAAgB;AACzB,SAAS,cAAc;AACvB,SAAS,SAAS,mBAAmB;AACrC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPlatform,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseRef,\n} from '@wordpress/element';\nimport { isRTL, __, _x } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport PatternOverridesPanel from '../pattern-overrides-panel';\nimport PluginDocumentSettingPanel from '../plugin-document-setting-panel';\nimport PluginSidebar from '../plugin-sidebar';\nimport PostSummary from './post-summary';\nimport PostRevisionSummary from './post-revision-summary';\nimport PostTaxonomiesPanel from '../post-taxonomies/panel';\nimport PostTransformPanel from '../post-transform-panel';\nimport SidebarHeader from './header';\nimport TemplateActionsPanel from '../template-actions-panel';\nimport TemplateContentPanel from '../template-content-panel';\nimport TemplatePartContentPanel from '../template-part-content-panel';\nimport { MediaMetadataPanel } from '../media';\nimport PostRevisionsPanel from '../post-revisions-panel';\nimport RevisionBlockDiffPanel from '../revision-block-diff';\nimport useAutoSwitchEditorSidebars from '../provider/use-auto-switch-editor-sidebars';\nimport { sidebars } from './constants';\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport {\n\tATTACHMENT_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n} from '../../store/constants';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\n\nconst SidebarContent = ( {\n\ttabName,\n\tkeyboardShortcut,\n\tonActionPerformed,\n\textraPanels,\n\tpostType,\n} ) => {\n\tconst tabListRef = useRef( null );\n\t// Because `PluginSidebar` renders a `ComplementaryArea`, we\n\t// need to forward the `Tabs` context so it can be passed through the\n\t// underlying slot/fill.\n\tconst tabsContextValue = useContext( Tabs.Context );\n\tconst isAttachment = postType === ATTACHMENT_POST_TYPE;\n\tconst isRevisionsMode = useSelect( ( select ) => {\n\t\treturn unlock( select( editorStore ) ).isRevisionsMode();\n\t} );\n\n\t// This effect addresses a race condition caused by tabbing from the last\n\t// block in the editor into the settings sidebar. Without this effect, the\n\t// selected tab and browser focus can become separated in an unexpected way\n\t// (e.g the \"block\" tab is focused, but the \"post\" tab is selected).\n\tuseEffect( () => {\n\t\tconst tabsElements = Array.from(\n\t\t\ttabListRef.current?.querySelectorAll( '[role=\"tab\"]' ) || []\n\t\t);\n\t\tconst selectedTabElement = tabsElements.find(\n\t\t\t// We are purposefully using a custom `data-tab-id` attribute here\n\t\t\t// because we don't want rely on any assumptions about `Tabs`\n\t\t\t// component internals.\n\t\t\t( element ) => element.getAttribute( 'data-tab-id' ) === tabName\n\t\t);\n\t\tconst activeElement = selectedTabElement?.ownerDocument.activeElement;\n\t\tconst tabsHasFocus = tabsElements.some( ( element ) => {\n\t\t\treturn activeElement && activeElement.id === element.id;\n\t\t} );\n\t\tif (\n\t\t\ttabsHasFocus &&\n\t\t\tselectedTabElement &&\n\t\t\tselectedTabElement.id !== activeElement?.id\n\t\t) {\n\t\t\tselectedTabElement?.focus();\n\t\t}\n\t}, [ tabName ] );\n\n\tlet tabContent;\n\tif ( isAttachment ) {\n\t\ttabContent = (\n\t\t\t<MediaMetadataPanel onActionPerformed={ onActionPerformed } />\n\t\t);\n\t} else if ( isRevisionsMode ) {\n\t\ttabContent = <PostRevisionSummary />;\n\t} else {\n\t\ttabContent = (\n\t\t\t<>\n\t\t\t\t<PostSummary onActionPerformed={ onActionPerformed } />\n\t\t\t\t<PluginDocumentSettingPanel.Slot />\n\t\t\t\t<TemplateContentPanel />\n\t\t\t\t{ window?.__experimentalDataFormInspector &&\n\t\t\t\t\t[ 'post', 'page' ].includes( postType ) && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<TemplateActionsPanel />\n\t\t\t\t\t\t\t<PostRevisionsPanel />\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t<TemplatePartContentPanel />\n\t\t\t\t<PostTransformPanel />\n\t\t\t\t<PostTaxonomiesPanel />\n\t\t\t\t<PatternOverridesPanel />\n\t\t\t\t{ extraPanels }\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<PluginSidebar\n\t\t\tidentifier={ tabName }\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<SidebarHeader ref={ tabListRef } />\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t}\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\t// This classname is added so we can apply a corrective negative\n\t\t\t// margin to the panel.\n\t\t\t// see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049\n\t\t\tclassName=\"editor-sidebar__panel\"\n\t\t\theaderClassName=\"editor-sidebar__panel-tabs\"\n\t\t\ttitle={\n\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t_x( 'Settings', 'panel button label' )\n\t\t\t}\n\t\t\ttoggleShortcut={ keyboardShortcut }\n\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<Tabs.TabPanel tabId={ sidebars.document } focusable={ false }>\n\t\t\t\t\t{ tabContent }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t{ ! isAttachment && (\n\t\t\t\t\t<Tabs.TabPanel tabId={ sidebars.block } focusable={ false }>\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t\t{ isRevisionsMode && <RevisionBlockDiffPanel /> }\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t) }\n\t\t\t</Tabs.Context.Provider>\n\t\t</PluginSidebar>\n\t);\n};\n\nconst Sidebar = ( { extraPanels, onActionPerformed } ) => {\n\tuseAutoSwitchEditorSidebars();\n\tconst { tabName, keyboardShortcut, showSummary, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst shortcut = select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation( 'core/editor/toggle-sidebar' );\n\n\t\t\tconst sidebar =\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea( 'core' );\n\t\t\tconst _isEditorSidebarOpened = [\n\t\t\t\tsidebars.block,\n\t\t\t\tsidebars.document,\n\t\t\t].includes( sidebar );\n\t\t\tlet _tabName = sidebar;\n\t\t\tif ( ! _isEditorSidebarOpened ) {\n\t\t\t\t_tabName = !! select(\n\t\t\t\t\tblockEditorStore\n\t\t\t\t).getBlockSelectionStart()\n\t\t\t\t\t? sidebars.block\n\t\t\t\t\t: sidebars.document;\n\t\t\t}\n\n\t\t\tconst _postType = select( editorStore ).getCurrentPostType();\n\n\t\t\treturn {\n\t\t\t\ttabName: _tabName,\n\t\t\t\tkeyboardShortcut: shortcut,\n\t\t\t\tshowSummary: ! [\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t\tNAVIGATION_POST_TYPE,\n\t\t\t\t].includes( _postType ),\n\t\t\t\tpostType: _postType,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea( 'core', newSelectedTabId );\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\tselectedTabId={ tabName }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<SidebarContent\n\t\t\t\ttabName={ tabName }\n\t\t\t\tkeyboardShortcut={ keyboardShortcut }\n\t\t\t\tshowSummary={ showSummary }\n\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\textraPanels={ extraPanels }\n\t\t\t\tpostType={ postType }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n};\n\nexport default Sidebar;\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,WAAW,mBAAmB;AACvC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,OAAO,IAAI,UAAU;AAC9B,SAAS,YAAY,mBAAmB;AACxC,SAAS,SAAS,8BAA8B;AAChD,SAAS,eAAe,6BAA6B;AACrD,SAAS,SAAS,sBAAsB;AAKxC,OAAO,2BAA2B;AAClC,OAAO,gCAAgC;AACvC,OAAO,mBAAmB;AAC1B,OAAO,iBAAiB;AACxB,OAAO,yBAAyB;AAChC,OAAO,yBAAyB;AAChC,OAAO,wBAAwB;AAC/B,OAAO,mBAAmB;AAC1B,OAAO,0BAA0B;AACjC,O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B,aAAa,SAAS,IAAI;AAAA,IAC5D,CAAE,WAAY;AACb,YAAM,WAAW;AAAA,QAChB;AAAA,MACD,EAAE,0BAA2B,4BAA6B;AAE1D,YAAM,UACL,OAAQ,cAAe,EAAE,2BAA4B,MAAO;AAC7D,YAAM,yBAAyB;AAAA,QAC9B,SAAS;AAAA,QACT,SAAS;AAAA,MACV,EAAE,SAAU,OAAQ;AACpB,UAAI,WAAW;AACf,UAAK,CAAE,wBAAyB;AAC/B,mBAAW,CAAC,CAAE;AAAA,UACb;AAAA,QACD,EAAE,uBAAuB,IACtB,SAAS,QACT,SAAS;AAAA,MACb;AAEA,YAAM,YAAY,OAAQ,WAAY,EAAE,mBAAmB;AAE3D,aAAO;AAAA,QACN,SAAS;AAAA,QACT,kBAAkB;AAAA,QAClB,aAAa,CAAE;AAAA,UACd;AAAA,UACA;AAAA,UACA;AAAA,QACD,EAAE,SAAU,SAAU;AAAA,QACtB,UAAU;AAAA,MACX;AAAA,IACD;AAAA,IACA,CAAC;AAAA,EACF;AAEA,QAAM,EAAE,wBAAwB,IAAI,YAAa,cAAe;AAEhE,QAAM,cAAc;AAAA,IACnB,CAAE,qBAAsB;AACvB,UAAK,CAAC,CAAE,kBAAmB;AAC1B,gCAAyB,QAAQ,gBAAiB;AAAA,MACnD;AAAA,IACD;AAAA,IACA,CAAE,uBAAwB;AAAA,EAC3B;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,eAAgB;AAAA,MAChB,UAAW;AAAA,MACX,cAAe;AAAA,MAEf;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;AAEA,IAAO,kBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// packages/editor/src/components/sidebar/post-revision-summary.js
|
|
2
|
+
import { useSelect } from "@wordpress/data";
|
|
3
|
+
import { __experimentalVStack as VStack } from "@wordpress/components";
|
|
4
|
+
import { store as editorStore } from "../../store/index.mjs";
|
|
5
|
+
import { unlock } from "../../lock-unlock.mjs";
|
|
6
|
+
import RevisionAuthorPanel from "../revision-author-panel/index.mjs";
|
|
7
|
+
import RevisionCreatedPanel from "../revision-created-panel/index.mjs";
|
|
8
|
+
import { PostContentInformationUI } from "../post-content-information/index.mjs";
|
|
9
|
+
import RevisionFieldsDiffPanel from "../revision-fields-diff/index.mjs";
|
|
10
|
+
import PostPanelSection from "../post-panel-section/index.mjs";
|
|
11
|
+
import PostCardPanel from "../post-card-panel/index.mjs";
|
|
12
|
+
import { OpenRevisionsClassicScreen } from "./post-summary.mjs";
|
|
13
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
function PostRevisionSummary() {
|
|
15
|
+
const { revisionId, postId, postContent } = useSelect((select) => {
|
|
16
|
+
const { getCurrentRevisionId, getCurrentRevision, getCurrentPostId } = unlock(select(editorStore));
|
|
17
|
+
const _revisionId = getCurrentRevisionId();
|
|
18
|
+
return {
|
|
19
|
+
revisionId: _revisionId,
|
|
20
|
+
postId: getCurrentPostId(),
|
|
21
|
+
postContent: _revisionId && getCurrentRevision()?.content?.raw
|
|
22
|
+
};
|
|
23
|
+
}, []);
|
|
24
|
+
if (!revisionId) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
28
|
+
/* @__PURE__ */ jsx(PostPanelSection, { className: "editor-post-summary", children: /* @__PURE__ */ jsxs(VStack, { spacing: 4, children: [
|
|
29
|
+
/* @__PURE__ */ jsx(PostCardPanel, { postId, hideActions: true }),
|
|
30
|
+
/* @__PURE__ */ jsxs(VStack, { spacing: 1, children: [
|
|
31
|
+
/* @__PURE__ */ jsx(PostContentInformationUI, { postContent }),
|
|
32
|
+
/* @__PURE__ */ jsx(RevisionCreatedPanel, {})
|
|
33
|
+
] }),
|
|
34
|
+
/* @__PURE__ */ jsx(OpenRevisionsClassicScreen, { revisionId }),
|
|
35
|
+
/* @__PURE__ */ jsx(RevisionAuthorPanel, {})
|
|
36
|
+
] }) }),
|
|
37
|
+
/* @__PURE__ */ jsx(RevisionFieldsDiffPanel, {})
|
|
38
|
+
] });
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
PostRevisionSummary as default
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=post-revision-summary.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/sidebar/post-revision-summary.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport RevisionAuthorPanel from '../revision-author-panel';\nimport RevisionCreatedPanel from '../revision-created-panel';\nimport { PostContentInformationUI } from '../post-content-information';\nimport RevisionFieldsDiffPanel from '../revision-fields-diff';\nimport PostPanelSection from '../post-panel-section';\nimport PostCardPanel from '../post-card-panel';\nimport { OpenRevisionsClassicScreen } from './post-summary';\n\nexport default function PostRevisionSummary() {\n\tconst { revisionId, postId, postContent } = useSelect( ( select ) => {\n\t\tconst { getCurrentRevisionId, getCurrentRevision, getCurrentPostId } =\n\t\t\tunlock( select( editorStore ) );\n\t\tconst _revisionId = getCurrentRevisionId();\n\t\treturn {\n\t\t\trevisionId: _revisionId,\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostContent: _revisionId && getCurrentRevision()?.content?.raw,\n\t\t};\n\t}, [] );\n\tif ( ! revisionId ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<>\n\t\t\t<PostPanelSection className=\"editor-post-summary\">\n\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t<PostCardPanel postId={ postId } hideActions />\n\t\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t\t<PostContentInformationUI postContent={ postContent } />\n\t\t\t\t\t\t<RevisionCreatedPanel />\n\t\t\t\t\t</VStack>\n\t\t\t\t\t<OpenRevisionsClassicScreen revisionId={ revisionId } />\n\t\t\t\t\t<RevisionAuthorPanel />\n\t\t\t\t</VStack>\n\t\t\t</PostPanelSection>\n\t\t\t<RevisionFieldsDiffPanel />\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB,cAAc;AAK/C,SAAS,SAAS,mBAAmB;AACrC,SAAS,cAAc;AACvB,OAAO,yBAAyB;AAChC,OAAO,0BAA0B;AACjC,SAAS,gCAAgC;AACzC,OAAO,6BAA6B;AACpC,OAAO,sBAAsB;AAC7B,OAAO,mBAAmB;AAC1B,SAAS,kCAAkC;AAiBzC,mBAGG,KACA,YAJH;AAfa,SAAR,sBAAuC;AAC7C,QAAM,EAAE,YAAY,QAAQ,YAAY,IAAI,UAAW,CAAE,WAAY;AACpE,UAAM,EAAE,sBAAsB,oBAAoB,iBAAiB,IAClE,OAAQ,OAAQ,WAAY,CAAE;AAC/B,UAAM,cAAc,qBAAqB;AACzC,WAAO;AAAA,MACN,YAAY;AAAA,MACZ,QAAQ,iBAAiB;AAAA,MACzB,aAAa,eAAe,mBAAmB,GAAG,SAAS;AAAA,IAC5D;AAAA,EACD,GAAG,CAAC,CAAE;AACN,MAAK,CAAE,YAAa;AACnB,WAAO;AAAA,EACR;AACA,SACC,iCACC;AAAA,wBAAC,oBAAiB,WAAU,uBAC3B,+BAAC,UAAO,SAAU,GACjB;AAAA,0BAAC,iBAAc,QAAkB,aAAW,MAAC;AAAA,MAC7C,qBAAC,UAAO,SAAU,GACjB;AAAA,4BAAC,4BAAyB,aAA4B;AAAA,QACtD,oBAAC,wBAAqB;AAAA,SACvB;AAAA,MACA,oBAAC,8BAA2B,YAA0B;AAAA,MACtD,oBAAC,uBAAoB;AAAA,OACtB,GACD;AAAA,IACA,oBAAC,2BAAwB;AAAA,KAC1B;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -17,7 +17,6 @@ import { PrivatePostExcerptPanel as PostExcerptPanel } from "../post-excerpt/pan
|
|
|
17
17
|
import PostFeaturedImagePanel from "../post-featured-image/panel.mjs";
|
|
18
18
|
import PostFormatPanel from "../post-format/panel.mjs";
|
|
19
19
|
import PostLastEditedPanel from "../post-last-edited-panel/index.mjs";
|
|
20
|
-
import RevisionCreatedPanel from "../revision-created-panel/index.mjs";
|
|
21
20
|
import PostPanelSection from "../post-panel-section/index.mjs";
|
|
22
21
|
import PostSchedulePanel from "../post-schedule/panel.mjs";
|
|
23
22
|
import PostStatusPanel from "../post-status/index.mjs";
|
|
@@ -30,10 +29,19 @@ import SiteDiscussion from "../site-discussion/index.mjs";
|
|
|
30
29
|
import { store as editorStore } from "../../store/index.mjs";
|
|
31
30
|
import { PrivatePostLastRevision } from "../post-last-revision/index.mjs";
|
|
32
31
|
import PostTrash from "../post-trash/index.mjs";
|
|
33
|
-
import RevisionAuthorPanel from "../revision-author-panel/index.mjs";
|
|
34
|
-
import { unlock } from "../../lock-unlock.mjs";
|
|
35
32
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
36
33
|
var PANEL_NAME = "post-status";
|
|
34
|
+
function OpenRevisionsClassicScreen({ revisionId }) {
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
36
|
+
ExternalLink,
|
|
37
|
+
{
|
|
38
|
+
href: addQueryArgs("revision.php", {
|
|
39
|
+
revision: revisionId
|
|
40
|
+
}),
|
|
41
|
+
children: __("Open classic revisions screen")
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
37
45
|
function PostSummary({ onActionPerformed }) {
|
|
38
46
|
const postType = useSelect(
|
|
39
47
|
(select) => select(editorStore).getCurrentPostType(),
|
|
@@ -45,22 +53,21 @@ function PostSummary({ onActionPerformed }) {
|
|
|
45
53
|
return /* @__PURE__ */ jsx(ClassicPostSummary, { onActionPerformed });
|
|
46
54
|
}
|
|
47
55
|
function ClassicPostSummary({ onActionPerformed }) {
|
|
48
|
-
const { isRemovedPostStatusPanel, postType, postId
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const shouldShowPostStatusPanel = !isRemovedPostStatusPanel && !isRevisionsMode;
|
|
56
|
+
const { isRemovedPostStatusPanel, postType, postId } = useSelect(
|
|
57
|
+
(select) => {
|
|
58
|
+
const {
|
|
59
|
+
isEditorPanelRemoved,
|
|
60
|
+
getCurrentPostType,
|
|
61
|
+
getCurrentPostId
|
|
62
|
+
} = select(editorStore);
|
|
63
|
+
return {
|
|
64
|
+
isRemovedPostStatusPanel: isEditorPanelRemoved(PANEL_NAME),
|
|
65
|
+
postType: getCurrentPostType(),
|
|
66
|
+
postId: getCurrentPostId()
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
[]
|
|
70
|
+
);
|
|
64
71
|
return /* @__PURE__ */ jsx(PostPanelSection, { className: "editor-post-summary", children: /* @__PURE__ */ jsx(PluginPostStatusInfo.Slot, { children: (fills) => /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(VStack, { spacing: 4, children: [
|
|
65
72
|
/* @__PURE__ */ jsx(
|
|
66
73
|
PostCardPanel,
|
|
@@ -70,32 +77,13 @@ function ClassicPostSummary({ onActionPerformed }) {
|
|
|
70
77
|
onActionPerformed
|
|
71
78
|
}
|
|
72
79
|
),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
{
|
|
76
|
-
withPanelBody: false
|
|
77
|
-
}
|
|
78
|
-
),
|
|
79
|
-
!isRevisionsMode && /* @__PURE__ */ jsx(PostExcerptPanel, {}),
|
|
80
|
+
/* @__PURE__ */ jsx(PostFeaturedImagePanel, { withPanelBody: false }),
|
|
81
|
+
/* @__PURE__ */ jsx(PostExcerptPanel, {}),
|
|
80
82
|
/* @__PURE__ */ jsxs(VStack, { spacing: 1, children: [
|
|
81
83
|
/* @__PURE__ */ jsx(PostContentInformation, {}),
|
|
82
|
-
|
|
83
|
-
] }),
|
|
84
|
-
isRevisionsMode && revisionId && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
85
|
-
/* @__PURE__ */ jsx(
|
|
86
|
-
ExternalLink,
|
|
87
|
-
{
|
|
88
|
-
href: addQueryArgs("revision.php", {
|
|
89
|
-
revision: revisionId
|
|
90
|
-
}),
|
|
91
|
-
children: __(
|
|
92
|
-
"Open classic revisions screen"
|
|
93
|
-
)
|
|
94
|
-
}
|
|
95
|
-
),
|
|
96
|
-
/* @__PURE__ */ jsx(RevisionAuthorPanel, {})
|
|
84
|
+
/* @__PURE__ */ jsx(PostLastEditedPanel, {})
|
|
97
85
|
] }),
|
|
98
|
-
|
|
86
|
+
!isRemovedPostStatusPanel && /* @__PURE__ */ jsxs(VStack, { spacing: 4, children: [
|
|
99
87
|
/* @__PURE__ */ jsxs(VStack, { spacing: 1, children: [
|
|
100
88
|
/* @__PURE__ */ jsx(PostStatusPanel, {}),
|
|
101
89
|
/* @__PURE__ */ jsx(PostSchedulePanel, {}),
|
|
@@ -122,6 +110,7 @@ function ClassicPostSummary({ onActionPerformed }) {
|
|
|
122
110
|
] }) }) }) });
|
|
123
111
|
}
|
|
124
112
|
export {
|
|
113
|
+
OpenRevisionsClassicScreen,
|
|
125
114
|
PostSummary as default
|
|
126
115
|
};
|
|
127
116
|
//# sourceMappingURL=post-summary.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/sidebar/post-summary.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalVStack as VStack,\n\tExternalLink,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport DataFormPostSummary from './dataform-post-summary';\nimport PluginPostStatusInfo from '../plugin-post-status-info';\nimport PostAuthorPanel from '../post-author/panel';\nimport PostCardPanel from '../post-card-panel';\nimport PostContentInformation from '../post-content-information';\nimport PageAttributesPanel from '../page-attributes/panel';\nimport PostDiscussionPanel from '../post-discussion/panel';\nimport { PrivatePostExcerptPanel as PostExcerptPanel } from '../post-excerpt/panel';\nimport PostFeaturedImagePanel from '../post-featured-image/panel';\nimport PostFormatPanel from '../post-format/panel';\nimport PostLastEditedPanel from '../post-last-edited-panel';\nimport
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC,wBAAwB;AAAA,EACxB;AAAA,OACM;AACP,SAAS,iBAAiB;AAC1B,SAAS,UAAU;AACnB,SAAS,oBAAoB;AAK7B,OAAO,yBAAyB;AAChC,OAAO,0BAA0B;AACjC,OAAO,qBAAqB;AAC5B,OAAO,mBAAmB;AAC1B,OAAO,4BAA4B;AACnC,OAAO,yBAAyB;AAChC,OAAO,yBAAyB;AAChC,SAAS,2BAA2B,wBAAwB;AAC5D,OAAO,4BAA4B;AACnC,OAAO,qBAAqB;AAC5B,OAAO,yBAAyB;AAChC,OAAO,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalVStack as VStack,\n\tExternalLink,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport DataFormPostSummary from './dataform-post-summary';\nimport PluginPostStatusInfo from '../plugin-post-status-info';\nimport PostAuthorPanel from '../post-author/panel';\nimport PostCardPanel from '../post-card-panel';\nimport PostContentInformation from '../post-content-information';\nimport PageAttributesPanel from '../page-attributes/panel';\nimport PostDiscussionPanel from '../post-discussion/panel';\nimport { PrivatePostExcerptPanel as PostExcerptPanel } from '../post-excerpt/panel';\nimport PostFeaturedImagePanel from '../post-featured-image/panel';\nimport PostFormatPanel from '../post-format/panel';\nimport PostLastEditedPanel from '../post-last-edited-panel';\nimport PostPanelSection from '../post-panel-section';\nimport PostSchedulePanel from '../post-schedule/panel';\nimport PostStatusPanel from '../post-status';\nimport PostSyncStatus from '../post-sync-status';\nimport PostTemplatePanel from '../post-template/panel';\nimport PostURLPanel from '../post-url/panel';\nimport BlogTitle from '../blog-title';\nimport PostsPerPage from '../posts-per-page';\nimport SiteDiscussion from '../site-discussion';\nimport { store as editorStore } from '../../store';\nimport { PrivatePostLastRevision } from '../post-last-revision';\nimport PostTrash from '../post-trash';\n\n/**\n * Module Constants\n */\nconst PANEL_NAME = 'post-status';\n\nexport function OpenRevisionsClassicScreen( { revisionId } ) {\n\treturn (\n\t\t<ExternalLink\n\t\t\thref={ addQueryArgs( 'revision.php', {\n\t\t\t\trevision: revisionId,\n\t\t\t} ) }\n\t\t>\n\t\t\t{ __( 'Open classic revisions screen' ) }\n\t\t</ExternalLink>\n\t);\n}\n\nexport default function PostSummary( { onActionPerformed } ) {\n\tconst postType = useSelect(\n\t\t( select ) => select( editorStore ).getCurrentPostType(),\n\t\t[]\n\t);\n\tif (\n\t\twindow?.__experimentalDataFormInspector &&\n\t\t[ 'page', 'post' ].includes( postType )\n\t) {\n\t\treturn <DataFormPostSummary onActionPerformed={ onActionPerformed } />;\n\t}\n\treturn <ClassicPostSummary onActionPerformed={ onActionPerformed } />;\n}\n\nfunction ClassicPostSummary( { onActionPerformed } ) {\n\tconst { isRemovedPostStatusPanel, postType, postId } = useSelect(\n\t\t( select ) => {\n\t\t\t// We use isEditorPanelRemoved to hide the panel if it was programmatically removed. We do\n\t\t\t// not use isEditorPanelEnabled since this panel should not be disabled through the UI.\n\t\t\tconst {\n\t\t\t\tisEditorPanelRemoved,\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPostId,\n\t\t\t} = select( editorStore );\n\t\t\treturn {\n\t\t\t\tisRemovedPostStatusPanel: isEditorPanelRemoved( PANEL_NAME ),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t\tpostId: getCurrentPostId(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\treturn (\n\t\t<PostPanelSection className=\"editor-post-summary\">\n\t\t\t<PluginPostStatusInfo.Slot>\n\t\t\t\t{ ( fills ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t\t<PostCardPanel\n\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PostFeaturedImagePanel withPanelBody={ false } />\n\t\t\t\t\t\t\t<PostExcerptPanel />\n\t\t\t\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t\t\t\t<PostContentInformation />\n\t\t\t\t\t\t\t\t<PostLastEditedPanel />\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t{ ! isRemovedPostStatusPanel && (\n\t\t\t\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t\t\t\t\t\t<PostStatusPanel />\n\t\t\t\t\t\t\t\t\t\t<PostSchedulePanel />\n\t\t\t\t\t\t\t\t\t\t<PostURLPanel />\n\t\t\t\t\t\t\t\t\t\t<PostAuthorPanel />\n\t\t\t\t\t\t\t\t\t\t<PostTemplatePanel />\n\t\t\t\t\t\t\t\t\t\t<PostDiscussionPanel />\n\t\t\t\t\t\t\t\t\t\t<PrivatePostLastRevision />\n\t\t\t\t\t\t\t\t\t\t<PageAttributesPanel />\n\t\t\t\t\t\t\t\t\t\t<PostSyncStatus />\n\t\t\t\t\t\t\t\t\t\t<BlogTitle />\n\t\t\t\t\t\t\t\t\t\t<PostsPerPage />\n\t\t\t\t\t\t\t\t\t\t<SiteDiscussion />\n\t\t\t\t\t\t\t\t\t\t<PostFormatPanel />\n\t\t\t\t\t\t\t\t\t\t{ fills }\n\t\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t\t\t<PostTrash\n\t\t\t\t\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</PluginPostStatusInfo.Slot>\n\t\t</PostPanelSection>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC,wBAAwB;AAAA,EACxB;AAAA,OACM;AACP,SAAS,iBAAiB;AAC1B,SAAS,UAAU;AACnB,SAAS,oBAAoB;AAK7B,OAAO,yBAAyB;AAChC,OAAO,0BAA0B;AACjC,OAAO,qBAAqB;AAC5B,OAAO,mBAAmB;AAC1B,OAAO,4BAA4B;AACnC,OAAO,yBAAyB;AAChC,OAAO,yBAAyB;AAChC,SAAS,2BAA2B,wBAAwB;AAC5D,OAAO,4BAA4B;AACnC,OAAO,qBAAqB;AAC5B,OAAO,yBAAyB;AAChC,OAAO,sBAAsB;AAC7B,OAAO,uBAAuB;AAC9B,OAAO,qBAAqB;AAC5B,OAAO,oBAAoB;AAC3B,OAAO,uBAAuB;AAC9B,OAAO,kBAAkB;AACzB,OAAO,eAAe;AACtB,OAAO,kBAAkB;AACzB,OAAO,oBAAoB;AAC3B,SAAS,SAAS,mBAAmB;AACrC,SAAS,+BAA+B;AACxC,OAAO,eAAe;AASpB,SA8CG,UA9CH,KAuDK,YAvDL;AAJF,IAAM,aAAa;AAEZ,SAAS,2BAA4B,EAAE,WAAW,GAAI;AAC5D,SACC;AAAA,IAAC;AAAA;AAAA,MACA,MAAO,aAAc,gBAAgB;AAAA,Q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mBAAgB;AAAA,QACjB,oBAAC,qBAAkB;AAAA,QACnB,oBAAC,uBAAoB;AAAA,QACrB,oBAAC,2BAAwB;AAAA,QACzB,oBAAC,uBAAoB;AAAA,QACrB,oBAAC,kBAAe;AAAA,QAChB,oBAAC,aAAU;AAAA,QACX,oBAAC,gBAAa;AAAA,QACd,oBAAC,kBAAe;AAAA,QAChB,oBAAC,mBAAgB;AAAA,QACf;AAAA,SACH;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACA;AAAA;AAAA,MACD;AAAA,OACD;AAAA,KAEF,GACD,GAEF,GACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -272,11 +272,12 @@ var StyleBookPreview = ({
|
|
|
272
272
|
userConfig = {},
|
|
273
273
|
isStatic = false,
|
|
274
274
|
path,
|
|
275
|
-
onPathChange
|
|
275
|
+
onPathChange,
|
|
276
|
+
settings: settingsProp
|
|
276
277
|
}) => {
|
|
277
278
|
const editorSettings = useSelect(
|
|
278
|
-
(select) => select(editorStore).getEditorSettings(),
|
|
279
|
-
[]
|
|
279
|
+
(select) => settingsProp ?? select(editorStore).getEditorSettings(),
|
|
280
|
+
[settingsProp]
|
|
280
281
|
);
|
|
281
282
|
const canUserUploadMedia = useSelect(
|
|
282
283
|
(select) => select(coreStore).canUser("create", {
|