@wordpress/editor 14.33.3 → 14.34.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/build/components/collab-sidebar/comment-author-info.js +26 -14
- package/build/components/collab-sidebar/comment-author-info.js.map +2 -2
- package/build/components/document-bar/index.js +16 -3
- package/build/components/document-bar/index.js.map +2 -2
- package/build/components/editor/index.js +23 -4
- package/build/components/editor/index.js.map +3 -3
- package/build/components/editor-interface/index.js +15 -10
- package/build/components/editor-interface/index.js.map +3 -3
- package/build/components/entities-saved-states/entity-type-list.js +19 -15
- package/build/components/entities-saved-states/entity-type-list.js.map +3 -3
- package/build/components/global-styles/block-link.js +70 -0
- package/build/components/global-styles/block-link.js.map +7 -0
- package/build/components/global-styles/header.js +54 -0
- package/build/components/global-styles/header.js.map +7 -0
- package/build/components/global-styles/hooks.js +176 -0
- package/build/components/global-styles/hooks.js.map +7 -0
- package/build/components/global-styles/index.js +138 -0
- package/build/components/global-styles/index.js.map +7 -0
- package/build/components/global-styles/menu.js +95 -0
- package/build/components/global-styles/menu.js.map +7 -0
- package/build/components/global-styles-provider/index.js +3 -49
- package/build/components/global-styles-provider/index.js.map +3 -3
- package/build/components/global-styles-renderer/index.js +55 -0
- package/build/components/global-styles-renderer/index.js.map +7 -0
- package/build/components/global-styles-sidebar/default-sidebar.js +66 -0
- package/build/components/global-styles-sidebar/default-sidebar.js.map +7 -0
- package/build/components/global-styles-sidebar/index.js +182 -0
- package/build/components/global-styles-sidebar/index.js.map +7 -0
- package/build/components/global-styles-sidebar/welcome-guide-image.js +37 -0
- package/build/components/global-styles-sidebar/welcome-guide-image.js.map +7 -0
- package/build/components/global-styles-sidebar/welcome-guide.js +143 -0
- package/build/components/global-styles-sidebar/welcome-guide.js.map +7 -0
- package/build/components/header/index.js +12 -9
- package/build/components/header/index.js.map +2 -2
- package/build/components/post-featured-image/index.js +32 -1
- package/build/components/post-featured-image/index.js.map +3 -3
- package/build/components/provider/index.js +0 -2
- package/build/components/provider/index.js.map +3 -3
- package/build/components/style-book/categories.js +86 -0
- package/build/components/style-book/categories.js.map +7 -0
- package/build/components/style-book/color-examples.js +64 -0
- package/build/components/style-book/color-examples.js.map +7 -0
- package/build/components/style-book/constants.js +319 -0
- package/build/components/style-book/constants.js.map +7 -0
- package/build/components/style-book/duotone-examples.js +68 -0
- package/build/components/style-book/duotone-examples.js.map +7 -0
- package/build/components/style-book/examples.js +237 -0
- package/build/components/style-book/examples.js.map +7 -0
- package/build/components/style-book/index.js +627 -0
- package/build/components/style-book/index.js.map +7 -0
- package/build/components/style-book/types.js +17 -0
- package/build/components/style-book/types.js.map +7 -0
- package/build/components/styles-canvas/index.js +138 -0
- package/build/components/styles-canvas/index.js.map +7 -0
- package/build/components/styles-canvas/revisions.js +121 -0
- package/build/components/styles-canvas/revisions.js.map +7 -0
- package/build/components/styles-canvas/style-book.js +68 -0
- package/build/components/styles-canvas/style-book.js.map +7 -0
- package/build/components/visual-editor/index.js +4 -3
- package/build/components/visual-editor/index.js.map +2 -2
- package/build/dataviews/fields/content-preview/content-preview-view.js.map +2 -2
- package/build/hooks/index.js +1 -0
- package/build/hooks/index.js.map +2 -2
- package/build/hooks/media-upload.js +15 -4
- package/build/hooks/media-upload.js.map +3 -3
- package/build/hooks/push-changes-to-global-styles/index.js +322 -0
- package/build/hooks/push-changes-to-global-styles/index.js.map +7 -0
- package/build/hooks/use-global-styles-output.js +74 -0
- package/build/hooks/use-global-styles-output.js.map +7 -0
- package/build/private-apis.js +10 -5
- package/build/private-apis.js.map +3 -3
- package/build/store/private-actions.js +23 -0
- package/build/store/private-actions.js.map +2 -2
- package/build/store/private-selectors.js +10 -0
- package/build/store/private-selectors.js.map +2 -2
- package/build/store/reducer.js +24 -0
- package/build/store/reducer.js.map +2 -2
- package/build/{components/editor-interface/content-slot-fill.js → utils/set-nested-value.js} +24 -10
- package/build/utils/set-nested-value.js.map +7 -0
- package/build-module/components/collab-sidebar/comment-author-info.js +26 -14
- package/build-module/components/collab-sidebar/comment-author-info.js.map +2 -2
- package/build-module/components/document-bar/index.js +16 -3
- package/build-module/components/document-bar/index.js.map +2 -2
- package/build-module/components/editor/index.js +23 -4
- package/build-module/components/editor/index.js.map +2 -2
- package/build-module/components/editor-interface/index.js +15 -10
- package/build-module/components/editor-interface/index.js.map +2 -2
- package/build-module/components/entities-saved-states/entity-type-list.js +18 -14
- package/build-module/components/entities-saved-states/entity-type-list.js.map +2 -2
- package/build-module/components/global-styles/block-link.js +46 -0
- package/build-module/components/global-styles/block-link.js.map +7 -0
- package/build-module/components/global-styles/header.js +41 -0
- package/build-module/components/global-styles/header.js.map +7 -0
- package/build-module/components/global-styles/hooks.js +154 -0
- package/build-module/components/global-styles/hooks.js.map +7 -0
- package/build-module/components/global-styles/index.js +112 -0
- package/build-module/components/global-styles/index.js.map +7 -0
- package/build-module/components/global-styles/menu.js +71 -0
- package/build-module/components/global-styles/menu.js.map +7 -0
- package/build-module/components/global-styles-provider/index.js +3 -37
- package/build-module/components/global-styles-provider/index.js.map +2 -2
- package/build-module/components/global-styles-renderer/index.js +31 -0
- package/build-module/components/global-styles-renderer/index.js.map +7 -0
- package/build-module/components/global-styles-sidebar/default-sidebar.js +49 -0
- package/build-module/components/global-styles-sidebar/default-sidebar.js.map +7 -0
- package/build-module/components/global-styles-sidebar/index.js +152 -0
- package/build-module/components/global-styles-sidebar/index.js.map +7 -0
- package/build-module/components/global-styles-sidebar/welcome-guide-image.js +17 -0
- package/build-module/components/global-styles-sidebar/welcome-guide-image.js.map +7 -0
- package/build-module/components/global-styles-sidebar/welcome-guide.js +113 -0
- package/build-module/components/global-styles-sidebar/welcome-guide.js.map +7 -0
- package/build-module/components/header/index.js +12 -9
- package/build-module/components/header/index.js.map +2 -2
- package/build-module/components/post-featured-image/index.js +35 -3
- package/build-module/components/post-featured-image/index.js.map +2 -2
- package/build-module/components/provider/index.js +0 -2
- package/build-module/components/provider/index.js.map +2 -2
- package/build-module/components/style-book/categories.js +64 -0
- package/build-module/components/style-book/categories.js.map +7 -0
- package/build-module/components/style-book/color-examples.js +37 -0
- package/build-module/components/style-book/color-examples.js.map +7 -0
- package/build-module/components/style-book/constants.js +290 -0
- package/build-module/components/style-book/constants.js.map +7 -0
- package/build-module/components/style-book/duotone-examples.js +48 -0
- package/build-module/components/style-book/duotone-examples.js.map +7 -0
- package/build-module/components/style-book/examples.js +208 -0
- package/build-module/components/style-book/examples.js.map +7 -0
- package/build-module/components/style-book/index.js +618 -0
- package/build-module/components/style-book/index.js.map +7 -0
- package/build-module/components/style-book/types.js +1 -0
- package/build-module/components/style-book/types.js.map +7 -0
- package/build-module/components/styles-canvas/index.js +104 -0
- package/build-module/components/styles-canvas/index.js.map +7 -0
- package/build-module/components/styles-canvas/revisions.js +107 -0
- package/build-module/components/styles-canvas/revisions.js.map +7 -0
- package/build-module/components/styles-canvas/style-book.js +38 -0
- package/build-module/components/styles-canvas/style-book.js.map +7 -0
- package/build-module/components/visual-editor/index.js +4 -3
- package/build-module/components/visual-editor/index.js.map +2 -2
- package/build-module/dataviews/fields/content-preview/content-preview-view.js.map +2 -2
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +2 -2
- package/build-module/hooks/media-upload.js +19 -5
- package/build-module/hooks/media-upload.js.map +2 -2
- package/build-module/hooks/push-changes-to-global-styles/index.js +309 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +7 -0
- package/build-module/hooks/use-global-styles-output.js +49 -0
- package/build-module/hooks/use-global-styles-output.js.map +7 -0
- package/build-module/private-apis.js +10 -8
- package/build-module/private-apis.js.map +2 -2
- package/build-module/store/private-actions.js +20 -0
- package/build-module/store/private-actions.js.map +2 -2
- package/build-module/store/private-selectors.js +8 -0
- package/build-module/store/private-selectors.js.map +2 -2
- package/build-module/store/reducer.js +22 -0
- package/build-module/store/reducer.js.map +2 -2
- package/build-module/utils/set-nested-value.js +23 -0
- package/build-module/utils/set-nested-value.js.map +7 -0
- package/build-style/style-rtl.css +3017 -11
- package/build-style/style.css +3018 -11
- package/build-types/components/collab-sidebar/comment-author-info.d.ts +5 -16
- package/build-types/components/collab-sidebar/comment-author-info.d.ts.map +1 -1
- package/build-types/components/document-bar/index.d.ts +2 -2
- package/build-types/components/document-bar/index.d.ts.map +1 -1
- package/build-types/components/editor/index.d.ts.map +1 -1
- package/build-types/components/editor-interface/index.d.ts +1 -3
- package/build-types/components/editor-interface/index.d.ts.map +1 -1
- package/build-types/components/entities-saved-states/entity-type-list.d.ts.map +1 -1
- package/build-types/components/global-styles/block-link.d.ts +12 -0
- package/build-types/components/global-styles/block-link.d.ts.map +1 -0
- package/build-types/components/global-styles/header.d.ts +7 -0
- package/build-types/components/global-styles/header.d.ts.map +1 -0
- package/build-types/components/global-styles/hooks.d.ts +24 -0
- package/build-types/components/global-styles/hooks.d.ts.map +1 -0
- package/build-types/components/global-styles/index.d.ts +6 -0
- package/build-types/components/global-styles/index.d.ts.map +1 -0
- package/build-types/components/global-styles/menu.d.ts +13 -0
- package/build-types/components/global-styles/menu.d.ts.map +1 -0
- package/build-types/components/global-styles-provider/index.d.ts +1 -5
- package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
- package/build-types/components/global-styles-renderer/index.d.ts +4 -0
- package/build-types/components/global-styles-renderer/index.d.ts.map +1 -0
- package/build-types/components/global-styles-sidebar/default-sidebar.d.ts +13 -0
- package/build-types/components/global-styles-sidebar/default-sidebar.d.ts.map +1 -0
- package/build-types/components/global-styles-sidebar/index.d.ts +2 -0
- package/build-types/components/global-styles-sidebar/index.d.ts.map +1 -0
- package/build-types/components/global-styles-sidebar/welcome-guide-image.d.ts +5 -0
- package/build-types/components/global-styles-sidebar/welcome-guide-image.d.ts.map +1 -0
- package/build-types/components/global-styles-sidebar/welcome-guide.d.ts +2 -0
- package/build-types/components/global-styles-sidebar/welcome-guide.d.ts.map +1 -0
- package/build-types/components/header/index.d.ts +1 -3
- package/build-types/components/header/index.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/style-book/categories.d.ts +18 -0
- package/build-types/components/style-book/categories.d.ts.map +1 -0
- package/build-types/components/style-book/color-examples.d.ts +7 -0
- package/build-types/components/style-book/color-examples.d.ts.map +1 -0
- package/build-types/components/style-book/constants.d.ts +11 -0
- package/build-types/components/style-book/constants.d.ts.map +1 -0
- package/build-types/components/style-book/duotone-examples.d.ts +9 -0
- package/build-types/components/style-book/duotone-examples.d.ts.map +1 -0
- package/build-types/components/style-book/examples.d.ts +12 -0
- package/build-types/components/style-book/examples.d.ts.map +1 -0
- package/build-types/components/style-book/index.d.ts +31 -0
- package/build-types/components/style-book/index.d.ts.map +1 -0
- package/build-types/components/style-book/types.d.ts +72 -0
- package/build-types/components/style-book/types.d.ts.map +1 -0
- package/build-types/components/styles-canvas/index.d.ts +16 -0
- package/build-types/components/styles-canvas/index.d.ts.map +1 -0
- package/build-types/components/styles-canvas/revisions.d.ts +5 -0
- package/build-types/components/styles-canvas/revisions.d.ts.map +1 -0
- package/build-types/components/styles-canvas/style-book.d.ts +6 -0
- package/build-types/components/styles-canvas/style-book.d.ts.map +1 -0
- package/build-types/components/visual-editor/index.d.ts +1 -2
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/dataviews/fields/content-preview/content-preview-view.d.ts.map +1 -1
- package/build-types/hooks/push-changes-to-global-styles/index.d.ts +2 -0
- package/build-types/hooks/push-changes-to-global-styles/index.d.ts.map +1 -0
- package/build-types/hooks/use-global-styles-output.d.ts +18 -0
- package/build-types/hooks/use-global-styles-output.d.ts.map +1 -0
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts +20 -0
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +14 -0
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +20 -0
- package/build-types/store/reducer.d.ts.map +1 -1
- package/build-types/utils/set-nested-value.d.ts +20 -0
- package/build-types/utils/set-nested-value.d.ts.map +1 -0
- package/package.json +40 -40
- package/src/components/collab-sidebar/comment-author-info.js +32 -25
- package/src/components/collab-sidebar/style.scss +1 -1
- package/src/components/document-bar/index.js +18 -3
- package/src/components/editor/index.js +25 -1
- package/src/components/editor-help/style.scss +1 -1
- package/src/components/editor-interface/index.js +40 -39
- package/src/components/entities-saved-states/entity-type-list.js +19 -17
- package/src/components/global-styles/block-link.js +65 -0
- package/src/components/global-styles/header.js +48 -0
- package/src/components/global-styles/hooks.js +216 -0
- package/src/components/global-styles/index.js +125 -0
- package/src/components/global-styles/menu.js +101 -0
- package/src/components/global-styles/style.scss +11 -0
- package/src/components/global-styles-provider/index.js +3 -45
- package/src/components/global-styles-renderer/index.js +39 -0
- package/src/components/global-styles-sidebar/default-sidebar.js +46 -0
- package/src/components/global-styles-sidebar/index.js +177 -0
- package/src/components/global-styles-sidebar/style.scss +119 -0
- package/src/components/global-styles-sidebar/welcome-guide-image.js +11 -0
- package/src/components/global-styles-sidebar/welcome-guide.js +136 -0
- package/src/components/header/index.js +11 -6
- package/src/components/post-featured-image/index.js +44 -1
- package/src/components/post-last-revision/style.scss +1 -1
- package/src/components/post-panel-row/style.scss +1 -0
- package/src/components/post-publish-panel/style.scss +1 -1
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +2 -2
- package/src/components/provider/index.js +0 -2
- package/src/components/style-book/categories.ts +97 -0
- package/src/components/style-book/color-examples.tsx +56 -0
- package/src/components/style-book/constants.ts +308 -0
- package/src/components/style-book/duotone-examples.tsx +56 -0
- package/src/components/style-book/examples.tsx +273 -0
- package/src/components/style-book/index.js +794 -0
- package/src/components/style-book/style.scss +44 -0
- package/src/components/style-book/test/categories.js +166 -0
- package/src/components/style-book/types.ts +80 -0
- package/src/components/styles-canvas/index.js +126 -0
- package/src/components/styles-canvas/revisions.js +144 -0
- package/src/components/styles-canvas/style-book.js +57 -0
- package/src/components/styles-canvas/style.scss +40 -0
- package/src/components/visual-editor/index.js +2 -1
- package/src/dataviews/fields/content-preview/content-preview-view.tsx +2 -0
- package/src/hooks/index.js +1 -0
- package/src/hooks/media-upload.js +25 -5
- package/src/hooks/push-changes-to-global-styles/index.js +391 -0
- package/src/hooks/push-changes-to-global-styles/style.scss +4 -0
- package/src/hooks/use-global-styles-output.js +76 -0
- package/src/private-apis.js +10 -8
- package/src/store/private-actions.js +37 -0
- package/src/store/private-selectors.js +20 -0
- package/src/store/reducer.js +36 -0
- package/src/style.scss +7 -1
- package/src/utils/set-nested-value.js +39 -0
- package/tsconfig.json +3 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-settings-menu/content-only-settings-menu.js +0 -186
- package/build/components/block-settings-menu/content-only-settings-menu.js.map +0 -7
- package/build/components/editor-interface/content-slot-fill.js.map +0 -7
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +0 -161
- package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +0 -7
- package/build-module/components/editor-interface/content-slot-fill.js +0 -9
- package/build-module/components/editor-interface/content-slot-fill.js.map +0 -7
- package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts +0 -2
- package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts.map +0 -1
- package/build-types/components/editor-interface/content-slot-fill.d.ts +0 -14
- package/build-types/components/editor-interface/content-slot-fill.d.ts.map +0 -1
- package/src/components/block-settings-menu/content-only-settings-menu.js +0 -185
- package/src/components/block-settings-menu/content-only-settings-menu.native.js +0 -4
- package/src/components/block-settings-menu/style.scss +0 -6
- package/src/components/editor-interface/content-slot-fill.js +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -30,26 +30,38 @@ var import_data = require("@wordpress/data");
|
|
|
30
30
|
var import_block_editor = require("@wordpress/block-editor");
|
|
31
31
|
var import_utils = require("./utils");
|
|
32
32
|
function CommentAuthorInfo({ avatar, name, date, userId }) {
|
|
33
|
+
const hasAvatar = !!avatar;
|
|
33
34
|
const dateSettings = (0, import_date.getSettings)();
|
|
34
35
|
const {
|
|
35
36
|
currentUserAvatar,
|
|
36
37
|
currentUserName,
|
|
37
38
|
currentUserId,
|
|
38
39
|
dateFormat = dateSettings.formats.date
|
|
39
|
-
} = (0, import_data.useSelect)(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
40
|
+
} = (0, import_data.useSelect)(
|
|
41
|
+
(select) => {
|
|
42
|
+
const { canUser, getCurrentUser, getEntityRecord } = select(import_core_data.store);
|
|
43
|
+
const siteSettings = canUser("read", {
|
|
44
|
+
kind: "root",
|
|
45
|
+
name: "site"
|
|
46
|
+
}) ? getEntityRecord("root", "site") : void 0;
|
|
47
|
+
if (hasAvatar) {
|
|
48
|
+
return {
|
|
49
|
+
dateFormat: siteSettings?.date_format
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const { getSettings } = select(import_block_editor.store);
|
|
53
|
+
const { __experimentalDiscussionSettings } = getSettings();
|
|
54
|
+
const defaultAvatar = __experimentalDiscussionSettings?.avatarURL;
|
|
55
|
+
const userData = getCurrentUser();
|
|
56
|
+
return {
|
|
57
|
+
currentUserAvatar: userData?.avatar_urls?.[48] ?? defaultAvatar,
|
|
58
|
+
currentUserName: userData?.name,
|
|
59
|
+
currentUserId: userData?.id,
|
|
60
|
+
dateFormat: siteSettings?.date_format
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
[hasAvatar]
|
|
64
|
+
);
|
|
53
65
|
const commentDate = (0, import_date.getDate)(date);
|
|
54
66
|
const commentDateTime = (0, import_date.dateI18n)("c", commentDate);
|
|
55
67
|
const shouldShowHumanTimeDiff = Math.floor((/* @__PURE__ */ new Date() - commentDate) / (1e3 * 60 * 60 * 24)) < 30;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/collab-sidebar/comment-author-info.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Tooltip, __experimentalVStack as VStack } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tdateI18n,\n\tgetSettings as getDateSettings,\n\thumanTimeDiff,\n\tgetDate,\n} from '@wordpress/date';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { getAvatarBorderColor } from './utils';\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Tooltip, __experimentalVStack as VStack } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tdateI18n,\n\tgetSettings as getDateSettings,\n\thumanTimeDiff,\n\tgetDate,\n} from '@wordpress/date';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { getAvatarBorderColor } from './utils';\n\nfunction CommentAuthorInfo( { avatar, name, date, userId } ) {\n\tconst hasAvatar = !! avatar;\n\tconst dateSettings = getDateSettings();\n\tconst {\n\t\tcurrentUserAvatar,\n\t\tcurrentUserName,\n\t\tcurrentUserId,\n\t\tdateFormat = dateSettings.formats.date,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser, getCurrentUser, getEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\n\t\t\tif ( hasAvatar ) {\n\t\t\t\treturn {\n\t\t\t\t\tdateFormat: siteSettings?.date_format,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\tconst { __experimentalDiscussionSettings } = getSettings();\n\t\t\tconst defaultAvatar = __experimentalDiscussionSettings?.avatarURL;\n\t\t\tconst userData = getCurrentUser();\n\t\t\treturn {\n\t\t\t\tcurrentUserAvatar:\n\t\t\t\t\tuserData?.avatar_urls?.[ 48 ] ?? defaultAvatar,\n\t\t\t\tcurrentUserName: userData?.name,\n\t\t\t\tcurrentUserId: userData?.id,\n\t\t\t\tdateFormat: siteSettings?.date_format,\n\t\t\t};\n\t\t},\n\t\t[ hasAvatar ]\n\t);\n\n\tconst commentDate = getDate( date );\n\tconst commentDateTime = dateI18n( 'c', commentDate );\n\tconst shouldShowHumanTimeDiff =\n\t\tMath.floor( ( new Date() - commentDate ) / ( 1000 * 60 * 60 * 24 ) ) <\n\t\t30;\n\n\tconst commentDateText = shouldShowHumanTimeDiff\n\t\t? humanTimeDiff( commentDate )\n\t\t: dateI18n( dateFormat, commentDate );\n\n\tconst tooltipText = dateI18n(\n\t\t// translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.\n\t\t_x( 'F j, Y g:i\\xa0a', 'Note date full date format' ),\n\t\tdate\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<img\n\t\t\t\tsrc={ avatar || currentUserAvatar }\n\t\t\t\tclassName=\"editor-collab-sidebar-panel__user-avatar\"\n\t\t\t\t// translators: alt text for user avatar image\n\t\t\t\talt={ __( 'User avatar' ) }\n\t\t\t\twidth={ 32 }\n\t\t\t\theight={ 32 }\n\t\t\t\tstyle={ {\n\t\t\t\t\tborderColor: getAvatarBorderColor(\n\t\t\t\t\t\tuserId ?? currentUserId\n\t\t\t\t\t),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<VStack spacing=\"0\">\n\t\t\t\t<span className=\"editor-collab-sidebar-panel__user-name\">\n\t\t\t\t\t{ name ?? currentUserName }\n\t\t\t\t</span>\n\t\t\t\t{ date && (\n\t\t\t\t\t<Tooltip placement=\"top\" text={ tooltipText }>\n\t\t\t\t\t\t<time\n\t\t\t\t\t\t\tdateTime={ commentDateTime }\n\t\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__user-time\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ commentDateText }\n\t\t\t\t\t\t</time>\n\t\t\t\t\t</Tooltip>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</>\n\t);\n}\n\nexport default CommentAuthorInfo;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA6EE;AA1EF,wBAAwD;AACxD,kBAAuB;AACvB,kBAKO;AACP,uBAAmC;AACnC,kBAA0B;AAC1B,0BAA0C;AAK1C,mBAAqC;AAErC,SAAS,kBAAmB,EAAE,QAAQ,MAAM,MAAM,OAAO,GAAI;AAC5D,QAAM,YAAY,CAAC,CAAE;AACrB,QAAM,mBAAe,YAAAA,aAAgB;AACrC,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa,aAAa,QAAQ;AAAA,EACnC,QAAI;AAAA,IACH,CAAE,WAAY;AACb,YAAM,EAAE,SAAS,gBAAgB,gBAAgB,IAChD,OAAQ,iBAAAC,KAAU;AACnB,YAAM,eAAe,QAAS,QAAQ;AAAA,QACrC,MAAM;AAAA,QACN,MAAM;AAAA,MACP,CAAE,IACC,gBAAiB,QAAQ,MAAO,IAChC;AAEH,UAAK,WAAY;AAChB,eAAO;AAAA,UACN,YAAY,cAAc;AAAA,QAC3B;AAAA,MACD;AAEA,YAAM,EAAE,YAAY,IAAI,OAAQ,oBAAAC,KAAiB;AACjD,YAAM,EAAE,iCAAiC,IAAI,YAAY;AACzD,YAAM,gBAAgB,kCAAkC;AACxD,YAAM,WAAW,eAAe;AAChC,aAAO;AAAA,QACN,mBACC,UAAU,cAAe,EAAG,KAAK;AAAA,QAClC,iBAAiB,UAAU;AAAA,QAC3B,eAAe,UAAU;AAAA,QACzB,YAAY,cAAc;AAAA,MAC3B;AAAA,IACD;AAAA,IACA,CAAE,SAAU;AAAA,EACb;AAEA,QAAM,kBAAc,qBAAS,IAAK;AAClC,QAAM,sBAAkB,sBAAU,KAAK,WAAY;AACnD,QAAM,0BACL,KAAK,OAAS,oBAAI,KAAK,IAAI,gBAAkB,MAAO,KAAK,KAAK,GAAK,IACnE;AAED,QAAM,kBAAkB,8BACrB,2BAAe,WAAY,QAC3B,sBAAU,YAAY,WAAY;AAErC,QAAM,kBAAc;AAAA;AAAA,QAEnB,gBAAI,mBAAmB,4BAA6B;AAAA,IACpD;AAAA,EACD;AAEA,SACC,4EACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,KAAM,UAAU;AAAA,QAChB,WAAU;AAAA,QAEV,SAAM,gBAAI,aAAc;AAAA,QACxB,OAAQ;AAAA,QACR,QAAS;AAAA,QACT,OAAQ;AAAA,UACP,iBAAa;AAAA,YACZ,UAAU;AAAA,UACX;AAAA,QACD;AAAA;AAAA,IACD;AAAA,IACA,6CAAC,kBAAAC,sBAAA,EAAO,SAAQ,KACf;AAAA,kDAAC,UAAK,WAAU,0CACb,kBAAQ,iBACX;AAAA,MACE,QACD,4CAAC,6BAAQ,WAAU,OAAM,MAAO,aAC/B;AAAA,QAAC;AAAA;AAAA,UACA,UAAW;AAAA,UACX,WAAU;AAAA,UAER;AAAA;AAAA,MACH,GACD;AAAA,OAEF;AAAA,KACD;AAEF;AAEA,IAAO,8BAAQ;",
|
|
6
6
|
"names": ["getDateSettings", "coreStore", "blockEditorStore", "VStack"]
|
|
7
7
|
}
|
|
@@ -49,6 +49,8 @@ var import_constants = require("../../store/constants");
|
|
|
49
49
|
var import_store = require("../../store");
|
|
50
50
|
var import_pageTypeBadge = __toESM(require("../../utils/pageTypeBadge"));
|
|
51
51
|
var import_get_template_info = require("../../utils/get-template-info");
|
|
52
|
+
var import_styles_canvas = require("../styles-canvas");
|
|
53
|
+
var import_lock_unlock = require("../../lock-unlock");
|
|
52
54
|
const MotionButton = import_components.__unstableMotion.create(import_components.Button);
|
|
53
55
|
function DocumentBar(props) {
|
|
54
56
|
const {
|
|
@@ -59,7 +61,8 @@ function DocumentBar(props) {
|
|
|
59
61
|
isNotFound,
|
|
60
62
|
templateTitle,
|
|
61
63
|
onNavigateToPreviousEntityRecord,
|
|
62
|
-
isTemplatePreview
|
|
64
|
+
isTemplatePreview,
|
|
65
|
+
stylesCanvasTitle
|
|
63
66
|
} = (0, import_data.useSelect)((select) => {
|
|
64
67
|
const {
|
|
65
68
|
getCurrentPostType,
|
|
@@ -86,6 +89,15 @@ function DocumentBar(props) {
|
|
|
86
89
|
template: _document
|
|
87
90
|
});
|
|
88
91
|
const _postTypeLabel = getPostType(_postType)?.labels?.singular_name;
|
|
92
|
+
const { getStylesPath, getShowStylebook } = (0, import_lock_unlock.unlock)(
|
|
93
|
+
select(import_store.store)
|
|
94
|
+
);
|
|
95
|
+
const _stylesPath = getStylesPath();
|
|
96
|
+
const _showStylebook = getShowStylebook();
|
|
97
|
+
const _stylesCanvasTitle = (0, import_styles_canvas.getStylesCanvasTitle)(
|
|
98
|
+
_stylesPath,
|
|
99
|
+
_showStylebook
|
|
100
|
+
);
|
|
89
101
|
return {
|
|
90
102
|
postId: _postId,
|
|
91
103
|
postType: _postType,
|
|
@@ -99,7 +111,8 @@ function DocumentBar(props) {
|
|
|
99
111
|
),
|
|
100
112
|
templateTitle: _templateInfo.title,
|
|
101
113
|
onNavigateToPreviousEntityRecord: getEditorSettings().onNavigateToPreviousEntityRecord,
|
|
102
|
-
isTemplatePreview: getRenderingMode() === "template-locked"
|
|
114
|
+
isTemplatePreview: getRenderingMode() === "template-locked",
|
|
115
|
+
stylesCanvasTitle: _stylesCanvasTitle
|
|
103
116
|
};
|
|
104
117
|
}, []);
|
|
105
118
|
const { open: openCommandCenter } = (0, import_data.useDispatch)(import_commands.store);
|
|
@@ -107,7 +120,7 @@ function DocumentBar(props) {
|
|
|
107
120
|
const isTemplate = import_constants.TEMPLATE_POST_TYPES.includes(postType);
|
|
108
121
|
const hasBackButton = !!onNavigateToPreviousEntityRecord;
|
|
109
122
|
const entityTitle = isTemplate ? templateTitle : documentTitle;
|
|
110
|
-
const title = props.title || entityTitle;
|
|
123
|
+
const title = props.title || stylesCanvasTitle || entityTitle;
|
|
111
124
|
const icon = props.icon;
|
|
112
125
|
const pageTypeBadge = (0, import_pageTypeBadge.default)(postId);
|
|
113
126
|
const mountedRef = (0, import_element.useRef)(false);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/document-bar/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { chevronLeftSmall, chevronRightSmall, layout } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as commandsStore } from '@wordpress/commands';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPES } from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport usePageTypeBadge from '../../utils/pageTypeBadge';\nimport { getTemplateInfo } from '../../utils/get-template-info';\n\n/** @typedef {import(\"@wordpress/components\").IconType} IconType */\n\nconst MotionButton = motion.create( Button );\n\n/**\n * This component renders a navigation bar at the top of the editor. It displays the title of the current document,\n * a back button (if applicable), and a command center button. It also handles different states of the document,\n * such as \"not found\" or \"unsynced\".\n *\n * @example\n * ```jsx\n * <DocumentBar />\n * ```\n * @param {Object} props The component props.\n * @param {string} props.title A title for the document, defaulting to the document or
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { chevronLeftSmall, chevronRightSmall, layout } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as commandsStore } from '@wordpress/commands';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPES } from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport usePageTypeBadge from '../../utils/pageTypeBadge';\nimport { getTemplateInfo } from '../../utils/get-template-info';\nimport { getStylesCanvasTitle } from '../styles-canvas';\nimport { unlock } from '../../lock-unlock';\n\n/** @typedef {import(\"@wordpress/components\").IconType} IconType */\n\nconst MotionButton = motion.create( Button );\n\n/**\n * This component renders a navigation bar at the top of the editor. It displays the title of the current document,\n * a back button (if applicable), and a command center button. It also handles different states of the document,\n * such as \"not found\" or \"unsynced\".\n *\n * @example\n * ```jsx\n * <DocumentBar />\n * ```\n *\n * @param {Object} props The component props.\n * @param {string} props.title A title for the document, defaulting to the document or template title currently being edited.\n * @param {IconType} props.icon An icon for the document, no default.\n * (A default icon indicating the document post type is no longer used.)\n *\n * @return {React.ReactNode} The rendered DocumentBar component.\n */\nexport default function DocumentBar( props ) {\n\tconst {\n\t\tpostId,\n\t\tpostType,\n\t\tpostTypeLabel,\n\t\tdocumentTitle,\n\t\tisNotFound,\n\t\ttemplateTitle,\n\t\tonNavigateToPreviousEntityRecord,\n\t\tisTemplatePreview,\n\t\tstylesCanvasTitle,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t\tgetEditorSettings,\n\t\t\tgetRenderingMode,\n\t\t} = select( editorStore );\n\n\t\tconst {\n\t\t\tgetEditedEntityRecord,\n\t\t\tgetPostType,\n\t\t\tgetCurrentTheme,\n\t\t\tisResolving: isResolvingSelector,\n\t\t} = select( coreStore );\n\t\tconst _postType = getCurrentPostType();\n\t\tconst _postId = getCurrentPostId();\n\t\tconst _document = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t_postType,\n\t\t\t_postId\n\t\t);\n\n\t\tconst { default_template_types: templateTypes = [] } =\n\t\t\tgetCurrentTheme() ?? {};\n\n\t\tconst _templateInfo = getTemplateInfo( {\n\t\t\ttemplateTypes,\n\t\t\ttemplate: _document,\n\t\t} );\n\t\tconst _postTypeLabel = getPostType( _postType )?.labels?.singular_name;\n\n\t\t// Check if styles canvas is active and get its title\n\t\tconst { getStylesPath, getShowStylebook } = unlock(\n\t\t\tselect( editorStore )\n\t\t);\n\t\tconst _stylesPath = getStylesPath();\n\t\tconst _showStylebook = getShowStylebook();\n\t\tconst _stylesCanvasTitle = getStylesCanvasTitle(\n\t\t\t_stylesPath,\n\t\t\t_showStylebook\n\t\t);\n\n\t\treturn {\n\t\t\tpostId: _postId,\n\t\t\tpostType: _postType,\n\t\t\tpostTypeLabel: _postTypeLabel,\n\t\t\tdocumentTitle: _document.title,\n\t\t\tisNotFound:\n\t\t\t\t! _document &&\n\t\t\t\t! isResolvingSelector(\n\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\t'postType',\n\t\t\t\t\t_postType,\n\t\t\t\t\t_postId\n\t\t\t\t),\n\t\t\ttemplateTitle: _templateInfo.title,\n\t\t\tonNavigateToPreviousEntityRecord:\n\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t\tisTemplatePreview: getRenderingMode() === 'template-locked',\n\t\t\tstylesCanvasTitle: _stylesCanvasTitle,\n\t\t};\n\t}, [] );\n\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\tconst isReducedMotion = useReducedMotion();\n\n\tconst isTemplate = TEMPLATE_POST_TYPES.includes( postType );\n\tconst hasBackButton = !! onNavigateToPreviousEntityRecord;\n\tconst entityTitle = isTemplate ? templateTitle : documentTitle;\n\tconst title = props.title || stylesCanvasTitle || entityTitle;\n\tconst icon = props.icon;\n\n\tconst pageTypeBadge = usePageTypeBadge( postId );\n\n\tconst mountedRef = useRef( false );\n\tuseEffect( () => {\n\t\tmountedRef.current = true;\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'editor-document-bar', {\n\t\t\t\t'has-back-button': hasBackButton,\n\t\t\t} ) }\n\t\t>\n\t\t\t<AnimatePresence>\n\t\t\t\t{ hasBackButton && (\n\t\t\t\t\t<MotionButton\n\t\t\t\t\t\tclassName=\"editor-document-bar__back\"\n\t\t\t\t\t\ticon={ isRTL() ? chevronRightSmall : chevronLeftSmall }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\tonNavigateToPreviousEntityRecord();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmountedRef.current\n\t\t\t\t\t\t\t\t? { opacity: 0, transform: 'translateX(15%)' }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ { opacity: 1, transform: 'translateX(0%)' } }\n\t\t\t\t\t\texit={ { opacity: 0, transform: 'translateX(15%)' } }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</MotionButton>\n\t\t\t\t) }\n\t\t\t</AnimatePresence>\n\t\t\t{ ! isTemplate && isTemplatePreview && ! hasBackButton && (\n\t\t\t\t<BlockIcon\n\t\t\t\t\ticon={ layout }\n\t\t\t\t\tclassName=\"editor-document-bar__icon-layout\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isNotFound ? (\n\t\t\t\t<Text>{ __( 'Document not found' ) }</Text>\n\t\t\t) : (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"editor-document-bar__command\"\n\t\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName=\"editor-document-bar__title\"\n\t\t\t\t\t\t// Force entry animation when the back button is added or removed.\n\t\t\t\t\t\tkey={ hasBackButton }\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmountedRef.current\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\t\t\ttransform: hasBackButton\n\t\t\t\t\t\t\t\t\t\t\t? 'translateX(15%)'\n\t\t\t\t\t\t\t\t\t\t\t: 'translateX(-15%)',\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\ttransform: 'translateX(0%)',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ icon && <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\t<Text size=\"body\" as=\"h1\">\n\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-title\">\n\t\t\t\t\t\t\t\t{ title\n\t\t\t\t\t\t\t\t\t? stripHTML( title )\n\t\t\t\t\t\t\t\t\t: __( 'No title' ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t{ pageTypeBadge && (\n\t\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-type-label\">\n\t\t\t\t\t\t\t\t\t{ `\u00B7 ${ pageTypeBadge }` }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ postTypeLabel &&\n\t\t\t\t\t\t\t\t! props.title &&\n\t\t\t\t\t\t\t\t! pageTypeBadge && (\n\t\t\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-type-label\">\n\t\t\t\t\t\t\t\t\t\t{ `\u00B7 ${ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\tpostTypeLabel\n\t\t\t\t\t\t\t\t\t\t) }` }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</motion.div>\n\t\t\t\t\t<span className=\"editor-document-bar__shortcut\">\n\t\t\t\t\t\t{ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t</span>\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2JK;AAxJL,kBAAiB;AAKjB,kBAA0B;AAC1B,kBAAuC;AACvC,wBAKO;AACP,0BAA0B;AAC1B,mBAA4D;AAC5D,sBAAgC;AAChC,uBAAmC;AACnC,sBAAuC;AACvC,qBAAkC;AAClC,qBAAiC;AACjC,2BAA+B;AAC/B,iBAAiD;AAKjD,uBAAoC;AACp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BAAA,EAAO,8BAAI,oBAAqB,GAAG,IAEpC;AAAA,UAAC;AAAA;AAAA,YACA,WAAU;AAAA,YACV,SAAU,MAAM,kBAAkB;AAAA,YAClC,MAAK;AAAA,YAEL;AAAA;AAAA,gBAAC,kBAAAP,iBAAO;AAAA,gBAAP;AAAA,kBACA,WAAU;AAAA,kBAGV,SACC,WAAW,UACR;AAAA,oBACA,SAAS;AAAA,oBACT,WAAW,gBACR,oBACA;AAAA,kBACH,IACA;AAAA,kBAEJ,SAAU;AAAA,oBACT,SAAS;AAAA,oBACT,WAAW;AAAA,kBACZ;AAAA,kBACA,YACC,kBAAkB,EAAE,UAAU,EAAE,IAAI;AAAA,kBAGnC;AAAA,4BAAQ,4CAAC,iCAAU,MAAc;AAAA,oBACnC,6CAAC,kBAAAO,oBAAA,EAAK,MAAK,QAAO,IAAG,MACpB;AAAA,kEAAC,UAAK,WAAU,mCACb,sBACC,WAAAC,qBAAW,KAAM,QACjB,gBAAI,UAAW,GACnB;AAAA,sBACE,iBACD,4CAAC,UAAK,WAAU,wCACb,kBAAM,aAAc,IACvB;AAAA,sBAEC,iBACD,CAAE,MAAM,SACR,CAAE,iBACD,4CAAC,UAAK,WAAU,wCACb,sBAAM;AAAA,wBACP;AAAA,sBACD,CAAE,IACH;AAAA,uBAEH;AAAA;AAAA;AAAA,gBAxCM;AAAA,cAyCP;AAAA,cACA,4CAAC,UAAK,WAAU,iCACb,0CAAgB,QAAS,GAAI,GAChC;AAAA;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EAEF;AAEF;",
|
|
6
6
|
"names": ["motion", "editorStore", "coreStore", "commandsStore", "usePageTypeBadge", "clsx", "AnimatePresence", "Text", "stripHTML"]
|
|
7
7
|
}
|
|
@@ -36,11 +36,14 @@ var import_data = require("@wordpress/data");
|
|
|
36
36
|
var import_core_data = require("@wordpress/core-data");
|
|
37
37
|
var import_components = require("@wordpress/components");
|
|
38
38
|
var import_i18n = require("@wordpress/i18n");
|
|
39
|
+
var import_store = require("../../store");
|
|
39
40
|
var import_constants = require("../../store/constants");
|
|
40
41
|
var import_editor_interface = __toESM(require("../editor-interface"));
|
|
41
42
|
var import_provider = require("../provider");
|
|
42
43
|
var import_sidebar = __toESM(require("../sidebar"));
|
|
43
44
|
var import_collab_sidebar = __toESM(require("../collab-sidebar"));
|
|
45
|
+
var import_global_styles_sidebar = __toESM(require("../global-styles-sidebar"));
|
|
46
|
+
var import_global_styles_renderer = require("../global-styles-renderer");
|
|
44
47
|
function Editor({
|
|
45
48
|
postType,
|
|
46
49
|
postId,
|
|
@@ -56,14 +59,26 @@ function Editor({
|
|
|
56
59
|
extraSidebarPanels,
|
|
57
60
|
...props
|
|
58
61
|
}) {
|
|
59
|
-
const {
|
|
62
|
+
const {
|
|
63
|
+
post,
|
|
64
|
+
template,
|
|
65
|
+
hasLoadedPost,
|
|
66
|
+
error,
|
|
67
|
+
isBlockTheme,
|
|
68
|
+
showGlobalStyles
|
|
69
|
+
} = (0, import_data.useSelect)(
|
|
60
70
|
(select) => {
|
|
61
71
|
const {
|
|
62
72
|
getEntityRecord,
|
|
63
73
|
getResolutionError,
|
|
64
|
-
hasFinishedResolution
|
|
74
|
+
hasFinishedResolution,
|
|
75
|
+
getCurrentTheme
|
|
65
76
|
} = select(import_core_data.store);
|
|
77
|
+
const { getRenderingMode, getCurrentPostType } = select(import_store.store);
|
|
66
78
|
const postArgs = ["postType", postType, postId];
|
|
79
|
+
const renderingMode = getRenderingMode();
|
|
80
|
+
const currentPostType = getCurrentPostType();
|
|
81
|
+
const _isBlockTheme = getCurrentTheme()?.is_block_theme;
|
|
67
82
|
return {
|
|
68
83
|
post: getEntityRecord(...postArgs),
|
|
69
84
|
template: templateId ? getEntityRecord(
|
|
@@ -75,7 +90,9 @@ function Editor({
|
|
|
75
90
|
"getEntityRecord",
|
|
76
91
|
postArgs
|
|
77
92
|
),
|
|
78
|
-
error: getResolutionError("getEntityRecord", postArgs)?.message
|
|
93
|
+
error: getResolutionError("getEntityRecord", postArgs)?.message,
|
|
94
|
+
isBlockTheme: _isBlockTheme,
|
|
95
|
+
showGlobalStyles: _isBlockTheme && (currentPostType === "wp_template" || renderingMode === "template-locked")
|
|
79
96
|
};
|
|
80
97
|
},
|
|
81
98
|
[postType, postId, templateId]
|
|
@@ -109,7 +126,9 @@ function Editor({
|
|
|
109
126
|
onActionPerformed,
|
|
110
127
|
extraPanels: extraSidebarPanels
|
|
111
128
|
}
|
|
112
|
-
)
|
|
129
|
+
),
|
|
130
|
+
isBlockTheme && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_global_styles_renderer.GlobalStylesRenderer, {}),
|
|
131
|
+
showGlobalStyles && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_global_styles_sidebar.default, {})
|
|
113
132
|
]
|
|
114
133
|
}
|
|
115
134
|
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/editor/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { Notice } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\nimport EditorInterface from '../editor-interface';\nimport { ExperimentalEditorProvider } from '../provider';\nimport Sidebar from '../sidebar';\nimport NotesSidebar from '../collab-sidebar';\n\nfunction Editor( {\n\tpostType,\n\tpostId,\n\ttemplateId,\n\tsettings,\n\tchildren,\n\tinitialEdits,\n\n\t// This could be part of the settings.\n\tonActionPerformed,\n\n\t// The following abstractions are not ideal but necessary\n\t// to account for site editor and post editor differences for now.\n\textraContent,\n\textraSidebarPanels,\n\t...props\n} ) {\n\tconst {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
6
|
-
"names": ["coreStore", "EditorInterface", "NotesSidebar", "Sidebar"]
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { Notice } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\nimport EditorInterface from '../editor-interface';\nimport { ExperimentalEditorProvider } from '../provider';\nimport Sidebar from '../sidebar';\nimport NotesSidebar from '../collab-sidebar';\nimport GlobalStylesSidebar from '../global-styles-sidebar';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\n\nfunction Editor( {\n\tpostType,\n\tpostId,\n\ttemplateId,\n\tsettings,\n\tchildren,\n\tinitialEdits,\n\n\t// This could be part of the settings.\n\tonActionPerformed,\n\n\t// The following abstractions are not ideal but necessary\n\t// to account for site editor and post editor differences for now.\n\textraContent,\n\textraSidebarPanels,\n\t...props\n} ) {\n\tconst {\n\t\tpost,\n\t\ttemplate,\n\t\thasLoadedPost,\n\t\terror,\n\t\tisBlockTheme,\n\t\tshowGlobalStyles,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetResolutionError,\n\t\t\t\thasFinishedResolution,\n\t\t\t\tgetCurrentTheme,\n\t\t\t} = select( coreStore );\n\t\t\tconst { getRenderingMode, getCurrentPostType } =\n\t\t\t\tselect( editorStore );\n\n\t\t\tconst postArgs = [ 'postType', postType, postId ];\n\t\t\tconst renderingMode = getRenderingMode();\n\t\t\tconst currentPostType = getCurrentPostType();\n\t\t\tconst _isBlockTheme = getCurrentTheme()?.is_block_theme;\n\n\t\t\treturn {\n\t\t\t\tpost: getEntityRecord( ...postArgs ),\n\t\t\t\ttemplate: templateId\n\t\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\t\t\ttemplateId\n\t\t\t\t\t )\n\t\t\t\t\t: undefined,\n\t\t\t\thasLoadedPost: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecord',\n\t\t\t\t\tpostArgs\n\t\t\t\t),\n\t\t\t\terror: getResolutionError( 'getEntityRecord', postArgs )\n\t\t\t\t\t?.message,\n\t\t\t\tisBlockTheme: _isBlockTheme,\n\t\t\t\tshowGlobalStyles:\n\t\t\t\t\t_isBlockTheme &&\n\t\t\t\t\t( currentPostType === 'wp_template' ||\n\t\t\t\t\t\trenderingMode === 'template-locked' ),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, templateId ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ hasLoadedPost && ! post && (\n\t\t\t\t<Notice\n\t\t\t\t\tstatus={ !! error ? 'error' : 'warning' }\n\t\t\t\t\tisDismissible={ false }\n\t\t\t\t>\n\t\t\t\t\t{ ! error\n\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: error }\n\t\t\t\t</Notice>\n\t\t\t) }\n\t\t\t{ !! post && (\n\t\t\t\t<ExperimentalEditorProvider\n\t\t\t\t\tpost={ post }\n\t\t\t\t\t__unstableTemplate={ template }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t>\n\t\t\t\t\t<EditorInterface { ...props }>\n\t\t\t\t\t\t{ extraContent }\n\t\t\t\t\t</EditorInterface>\n\t\t\t\t\t{ children }\n\t\t\t\t\t<NotesSidebar />\n\t\t\t\t\t<Sidebar\n\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\textraPanels={ extraSidebarPanels }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isBlockTheme && <GlobalStylesRenderer /> }\n\t\t\t\t\t{ showGlobalStyles && <Global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,IACD;AAAA,IACA,CAAE,UAAU,QAAQ,UAAW;AAAA,EAChC;AAEA,SACC,4EACG;AAAA,qBAAiB,CAAE,QACpB;AAAA,MAAC;AAAA;AAAA,QACA,QAAS,CAAC,CAAE,QAAQ,UAAU;AAAA,QAC9B,eAAgB;AAAA,QAEd,WAAE,YACD;AAAA,UACA;AAAA,QACA,IACA;AAAA;AAAA,IACJ;AAAA,IAEC,CAAC,CAAE,QACJ;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA,oBAAqB;AAAA,QACrB;AAAA,QACA;AAAA,QACA,gBAAiB;AAAA,QAEjB;AAAA,sDAAC,wBAAAC,SAAA,EAAkB,GAAG,OACnB,wBACH;AAAA,UACE;AAAA,UACF,4CAAC,sBAAAC,SAAA,EAAa;AAAA,UACd;AAAA,YAAC,eAAAC;AAAA,YAAA;AAAA,cACA;AAAA,cACA,aAAc;AAAA;AAAA,UACf;AAAA,UACE,gBAAgB,4CAAC,sDAAqB;AAAA,UACtC,oBAAoB,4CAAC,6BAAAC,SAAA,EAAoB;AAAA;AAAA;AAAA,IAC5C;AAAA,KAEF;AAEF;AAEA,IAAO,iBAAQ;",
|
|
6
|
+
"names": ["coreStore", "editorStore", "EditorInterface", "NotesSidebar", "Sidebar", "GlobalStylesSidebar"]
|
|
7
7
|
}
|
|
@@ -41,6 +41,7 @@ var import_block_editor = require("@wordpress/block-editor");
|
|
|
41
41
|
var import_compose = require("@wordpress/compose");
|
|
42
42
|
var import_element = require("@wordpress/element");
|
|
43
43
|
var import_store = require("../../store");
|
|
44
|
+
var import_lock_unlock = require("../../lock-unlock");
|
|
44
45
|
var import_editor_notices = __toESM(require("../editor-notices"));
|
|
45
46
|
var import_header = __toESM(require("../header"));
|
|
46
47
|
var import_inserter_sidebar = __toESM(require("../inserter-sidebar"));
|
|
@@ -48,7 +49,7 @@ var import_list_view_sidebar = __toESM(require("../list-view-sidebar"));
|
|
|
48
49
|
var import_save_publish_panels = __toESM(require("../save-publish-panels"));
|
|
49
50
|
var import_text_editor = __toESM(require("../text-editor"));
|
|
50
51
|
var import_visual_editor = __toESM(require("../visual-editor"));
|
|
51
|
-
var
|
|
52
|
+
var import_styles_canvas = __toESM(require("../styles-canvas"));
|
|
52
53
|
const interfaceLabels = {
|
|
53
54
|
/* translators: accessibility text for the editor top bar landmark region. */
|
|
54
55
|
header: (0, import_i18n.__)("Editor top bar"),
|
|
@@ -63,7 +64,6 @@ const interfaceLabels = {
|
|
|
63
64
|
};
|
|
64
65
|
function EditorInterface({
|
|
65
66
|
className,
|
|
66
|
-
styles,
|
|
67
67
|
children,
|
|
68
68
|
forceIsDirty,
|
|
69
69
|
contentRef,
|
|
@@ -72,7 +72,6 @@ function EditorInterface({
|
|
|
72
72
|
customSaveButton,
|
|
73
73
|
customSavePanel,
|
|
74
74
|
forceDisableBlockTools,
|
|
75
|
-
title,
|
|
76
75
|
iframeProps
|
|
77
76
|
}) {
|
|
78
77
|
const {
|
|
@@ -82,10 +81,15 @@ function EditorInterface({
|
|
|
82
81
|
isDistractionFree,
|
|
83
82
|
isPreviewMode,
|
|
84
83
|
showBlockBreadcrumbs,
|
|
85
|
-
documentLabel
|
|
84
|
+
documentLabel,
|
|
85
|
+
stylesPath,
|
|
86
|
+
showStylebook
|
|
86
87
|
} = (0, import_data.useSelect)((select) => {
|
|
87
88
|
const { get } = select(import_preferences.store);
|
|
88
89
|
const { getEditorSettings, getPostTypeLabel } = select(import_store.store);
|
|
90
|
+
const { getStylesPath, getShowStylebook } = (0, import_lock_unlock.unlock)(
|
|
91
|
+
select(import_store.store)
|
|
92
|
+
);
|
|
89
93
|
const editorSettings = getEditorSettings();
|
|
90
94
|
const postTypeLabel = getPostTypeLabel();
|
|
91
95
|
let _mode = select(import_store.store).getEditorMode();
|
|
@@ -105,11 +109,14 @@ function EditorInterface({
|
|
|
105
109
|
documentLabel: (
|
|
106
110
|
// translators: Default label for the Document in the Block Breadcrumb.
|
|
107
111
|
postTypeLabel || (0, import_i18n._x)("Document", "noun, breadcrumb")
|
|
108
|
-
)
|
|
112
|
+
),
|
|
113
|
+
stylesPath: getStylesPath(),
|
|
114
|
+
showStylebook: getShowStylebook()
|
|
109
115
|
};
|
|
110
116
|
}, []);
|
|
111
117
|
const isLargeViewport = (0, import_compose.useViewportMatch)("medium");
|
|
112
118
|
const secondarySidebarLabel = isListViewOpened ? (0, import_i18n.__)("Document Overview") : (0, import_i18n.__)("Block Library");
|
|
119
|
+
const shouldShowStylesCanvas = showStylebook || stylesPath?.startsWith("/revisions");
|
|
113
120
|
const [entitiesSavedStatesCallback, setEntitiesSavedStatesCallback] = (0, import_element.useState)(false);
|
|
114
121
|
const closeEntitiesSavedStates = (0, import_element.useCallback)(
|
|
115
122
|
(arg) => {
|
|
@@ -138,8 +145,7 @@ function EditorInterface({
|
|
|
138
145
|
forceIsDirty,
|
|
139
146
|
setEntitiesSavedStatesCallback,
|
|
140
147
|
customSaveButton,
|
|
141
|
-
forceDisableBlockTools
|
|
142
|
-
title
|
|
148
|
+
forceDisableBlockTools
|
|
143
149
|
}
|
|
144
150
|
),
|
|
145
151
|
editorNotices: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_editor_notices.default, {}),
|
|
@@ -147,7 +153,7 @@ function EditorInterface({
|
|
|
147
153
|
sidebar: !isPreviewMode && !isDistractionFree && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_interface.ComplementaryArea.Slot, { scope: "core" }),
|
|
148
154
|
content: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
149
155
|
!isDistractionFree && !isPreviewMode && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_editor_notices.default, {}),
|
|
150
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
156
|
+
shouldShowStylesCanvas ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles_canvas.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
151
157
|
!isPreviewMode && mode === "text" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
152
158
|
import_text_editor.default,
|
|
153
159
|
{
|
|
@@ -158,7 +164,6 @@ function EditorInterface({
|
|
|
158
164
|
(isPreviewMode || mode === "visual") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
159
165
|
import_visual_editor.default,
|
|
160
166
|
{
|
|
161
|
-
styles,
|
|
162
167
|
contentRef,
|
|
163
168
|
disableIframe,
|
|
164
169
|
autoFocus,
|
|
@@ -166,7 +171,7 @@ function EditorInterface({
|
|
|
166
171
|
}
|
|
167
172
|
),
|
|
168
173
|
children
|
|
169
|
-
] })
|
|
174
|
+
] })
|
|
170
175
|
] }),
|
|
171
176
|
footer: !isPreviewMode && !isDistractionFree && isLargeViewport && showBlockBreadcrumbs && mode === "visual" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockBreadcrumb, { rootLabelText: documentLabel }),
|
|
172
177
|
actions: !isPreviewMode ? customSavePanel || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/editor-interface/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { InterfaceSkeleton, ComplementaryArea } from '@wordpress/interface';\nimport { useSelect } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { BlockBreadcrumb, BlockToolbar } from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useState, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport EditorNotices from '../editor-notices';\nimport Header from '../header';\nimport InserterSidebar from '../inserter-sidebar';\nimport ListViewSidebar from '../list-view-sidebar';\nimport SavePublishPanels from '../save-publish-panels';\nimport TextEditor from '../text-editor';\nimport VisualEditor from '../visual-editor';\nimport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
6
|
-
"names": ["preferencesStore", "editorStore", "clsx", "Header", "EditorNotices", "InserterSidebar", "ListViewSidebar", "
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { InterfaceSkeleton, ComplementaryArea } from '@wordpress/interface';\nimport { useSelect } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { BlockBreadcrumb, BlockToolbar } from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useState, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport EditorNotices from '../editor-notices';\nimport Header from '../header';\nimport InserterSidebar from '../inserter-sidebar';\nimport ListViewSidebar from '../list-view-sidebar';\nimport SavePublishPanels from '../save-publish-panels';\nimport TextEditor from '../text-editor';\nimport VisualEditor from '../visual-editor';\nimport StylesCanvas from '../styles-canvas';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor top bar landmark region. */\n\theader: __( 'Editor top bar' ),\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\nexport default function EditorInterface( {\n\tclassName,\n\tchildren,\n\tforceIsDirty,\n\tcontentRef,\n\tdisableIframe,\n\tautoFocus,\n\tcustomSaveButton,\n\tcustomSavePanel,\n\tforceDisableBlockTools,\n\tiframeProps,\n} ) {\n\tconst {\n\t\tmode,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t\tisDistractionFree,\n\t\tisPreviewMode,\n\t\tshowBlockBreadcrumbs,\n\t\tdocumentLabel,\n\t\tstylesPath,\n\t\tshowStylebook,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getEditorSettings, getPostTypeLabel } = select( editorStore );\n\t\tconst { getStylesPath, getShowStylebook } = unlock(\n\t\t\tselect( editorStore )\n\t\t);\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst postTypeLabel = getPostTypeLabel();\n\n\t\tlet _mode = select( editorStore ).getEditorMode();\n\t\tif ( ! editorSettings.richEditingEnabled && _mode === 'visual' ) {\n\t\t\t_mode = 'text';\n\t\t}\n\t\tif ( ! editorSettings.codeEditingEnabled && _mode === 'text' ) {\n\t\t\t_mode = 'visual';\n\t\t}\n\n\t\treturn {\n\t\t\tmode: _mode,\n\t\t\tisInserterOpened: select( editorStore ).isInserterOpened(),\n\t\t\tisListViewOpened: select( editorStore ).isListViewOpened(),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tisPreviewMode: editorSettings.isPreviewMode,\n\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\tdocumentLabel:\n\t\t\t\t// translators: Default label for the Document in the Block Breadcrumb.\n\t\t\t\tpostTypeLabel || _x( 'Document', 'noun, breadcrumb' ),\n\t\t\tstylesPath: getStylesPath(),\n\t\t\tshowStylebook: getShowStylebook(),\n\t\t};\n\t}, [] );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst secondarySidebarLabel = isListViewOpened\n\t\t? __( 'Document Overview' )\n\t\t: __( 'Block Library' );\n\tconst shouldShowStylesCanvas =\n\t\tshowStylebook || stylesPath?.startsWith( '/revisions' );\n\n\t// Local state for save panel.\n\t// Note 'truthy' callback implies an open panel.\n\tconst [ entitiesSavedStatesCallback, setEntitiesSavedStatesCallback ] =\n\t\tuseState( false );\n\tconst closeEntitiesSavedStates = useCallback(\n\t\t( arg ) => {\n\t\t\tif ( typeof entitiesSavedStatesCallback === 'function' ) {\n\t\t\t\tentitiesSavedStatesCallback( arg );\n\t\t\t}\n\t\t\tsetEntitiesSavedStatesCallback( false );\n\t\t},\n\t\t[ entitiesSavedStatesCallback ]\n\t);\n\n\treturn (\n\t\t<InterfaceSkeleton\n\t\t\tisDistractionFree={ isDistractionFree }\n\t\t\tclassName={ clsx( 'editor-editor-interface', className, {\n\t\t\t\t'is-entity-save-view-open': !! entitiesSavedStatesCallback,\n\t\t\t\t'is-distraction-free': isDistractionFree && ! isPreviewMode,\n\t\t\t} ) }\n\t\t\tlabels={ {\n\t\t\t\t...interfaceLabels,\n\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t} }\n\t\t\theader={\n\t\t\t\t! isPreviewMode && (\n\t\t\t\t\t<Header\n\t\t\t\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcustomSaveButton={ customSaveButton }\n\t\t\t\t\t\tforceDisableBlockTools={ forceDisableBlockTools }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\teditorNotices={ <EditorNotices /> }\n\t\t\tsecondarySidebar={\n\t\t\t\t! isPreviewMode &&\n\t\t\t\tmode === 'visual' &&\n\t\t\t\t( ( isInserterOpened && <InserterSidebar /> ) ||\n\t\t\t\t\t( isListViewOpened && <ListViewSidebar /> ) )\n\t\t\t}\n\t\t\tsidebar={\n\t\t\t\t! isPreviewMode &&\n\t\t\t\t! isDistractionFree && <ComplementaryArea.Slot scope=\"core\" />\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ ! isDistractionFree && ! isPreviewMode && (\n\t\t\t\t\t\t<EditorNotices />\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ shouldShowStylesCanvas ? (\n\t\t\t\t\t\t<StylesCanvas />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isPreviewMode && mode === 'text' && (\n\t\t\t\t\t\t\t\t<TextEditor\n\t\t\t\t\t\t\t\t\t// We should auto-focus the canvas (title) on load.\n\t\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\t\t\t\t\t\tautoFocus={ autoFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ ! isPreviewMode &&\n\t\t\t\t\t\t\t\t! isLargeViewport &&\n\t\t\t\t\t\t\t\tmode === 'visual' && (\n\t\t\t\t\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ ( isPreviewMode || mode === 'visual' ) && (\n\t\t\t\t\t\t\t\t<VisualEditor\n\t\t\t\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\t\t\t\tdisableIframe={ disableIframe }\n\t\t\t\t\t\t\t\t\t// We should auto-focus the canvas (title) on load.\n\t\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\t\t\t\t\t\tautoFocus={ autoFocus }\n\t\t\t\t\t\t\t\t\tiframeProps={ iframeProps }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\t! isPreviewMode &&\n\t\t\t\t! isDistractionFree &&\n\t\t\t\tisLargeViewport &&\n\t\t\t\tshowBlockBreadcrumbs &&\n\t\t\t\tmode === 'visual' && (\n\t\t\t\t\t<BlockBreadcrumb rootLabelText={ documentLabel } />\n\t\t\t\t)\n\t\t\t}\n\t\t\tactions={\n\t\t\t\t! isPreviewMode\n\t\t\t\t\t? customSavePanel || (\n\t\t\t\t\t\t\t<SavePublishPanels\n\t\t\t\t\t\t\t\tcloseEntitiesSavedStates={\n\t\t\t\t\t\t\t\t\tcloseEntitiesSavedStates\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisEntitiesSavedStatesOpen={\n\t\t\t\t\t\t\t\t\tentitiesSavedStatesCallback\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tforceIsDirtyPublishPanel={ forceIsDirty }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkIK;AA/HL,kBAAiB;AAKjB,uBAAqD;AACrD,kBAA0B;AAC1B,kBAAuB;AACvB,yBAA0C;AAC1C,0BAA8C;AAC9C,qBAAiC;AACjC,qBAAsC;AAKtC,mBAAqC;AACrC,yBAAuB;AACvB,4BAA0B;AAC1B,oBAAmB;AACnB,8BAA4B;AAC5B,+BAA4B;AAC5B,iCAA8B;AAC9B,yBAAuB;AACvB,2BAAyB;AACzB,2BAAyB;AAEzB,MAAM,kBAAkB;AAAA;AAAA,EAEvB,YAAQ,gBAAI,gBAAiB;AAAA;AAAA,EAE7B,UAAM,gBAAI,gBAAiB;AAAA;AAAA,EAE3B,aAAS,gBAAI,iBAAkB;AAAA;AAAA,EAE/B,aAAS,gBAAI,gBAAiB;AAAA;AAAA,EAE9B,YAAQ,gBAAI,eAAgB;AAC7B;AAEe,SAAR,gBAAkC;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,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UACD;AAAA,UAEC;AAAA,WACH;AAAA,SAEF;AAAA,MAED,QACC,CAAE,iBACF,CAAE,qBACF,mBACA,wBACA,SAAS,YACR,4CAAC,uCAAgB,eAAgB,eAAgB;AAAA,MAGnD,SACC,CAAE,gBACC,mBACA;AAAA,QAAC,2BAAAC;AAAA,QAAA;AAAA,UACA;AAAA,UAGA,2BACC;AAAA,UAED;AAAA,UAGA,0BAA2B;AAAA;AAAA,MAC5B,IAEA;AAAA;AAAA,EAEL;AAEF;",
|
|
6
|
+
"names": ["preferencesStore", "editorStore", "clsx", "Header", "EditorNotices", "InserterSidebar", "ListViewSidebar", "StylesCanvas", "TextEditor", "VisualEditor", "SavePublishPanels"]
|
|
7
7
|
}
|
|
@@ -36,13 +36,8 @@ var import_i18n = require("@wordpress/i18n");
|
|
|
36
36
|
var import_data = require("@wordpress/data");
|
|
37
37
|
var import_components = require("@wordpress/components");
|
|
38
38
|
var import_core_data = require("@wordpress/core-data");
|
|
39
|
-
var
|
|
40
|
-
var import_element = require("@wordpress/element");
|
|
39
|
+
var import_global_styles_engine = require("@wordpress/global-styles-engine");
|
|
41
40
|
var import_entity_record_item = __toESM(require("./entity-record-item"));
|
|
42
|
-
var import_lock_unlock = require("../../lock-unlock");
|
|
43
|
-
const { getGlobalStylesChanges, GlobalStylesContext } = (0, import_lock_unlock.unlock)(
|
|
44
|
-
import_block_editor.privateApis
|
|
45
|
-
);
|
|
46
41
|
function getEntityDescription(entity, count) {
|
|
47
42
|
switch (entity) {
|
|
48
43
|
case "site":
|
|
@@ -57,17 +52,26 @@ function getEntityDescription(entity, count) {
|
|
|
57
52
|
}
|
|
58
53
|
}
|
|
59
54
|
function GlobalStylesDescription({ record }) {
|
|
60
|
-
const {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
const { editedRecord, savedRecord } = (0, import_data.useSelect)(
|
|
56
|
+
(select) => {
|
|
57
|
+
const { getEditedEntityRecord, getEntityRecord } = select(import_core_data.store);
|
|
58
|
+
return {
|
|
59
|
+
editedRecord: getEditedEntityRecord(
|
|
60
|
+
record.kind,
|
|
61
|
+
record.name,
|
|
62
|
+
record.key
|
|
63
|
+
),
|
|
64
|
+
savedRecord: getEntityRecord(
|
|
65
|
+
record.kind,
|
|
66
|
+
record.name,
|
|
67
|
+
record.key
|
|
68
|
+
)
|
|
69
|
+
};
|
|
70
|
+
},
|
|
67
71
|
[record.kind, record.name, record.key]
|
|
68
72
|
);
|
|
69
|
-
const globalStylesChanges = getGlobalStylesChanges(
|
|
70
|
-
|
|
73
|
+
const globalStylesChanges = (0, import_global_styles_engine.getGlobalStylesChanges)(
|
|
74
|
+
editedRecord,
|
|
71
75
|
savedRecord,
|
|
72
76
|
{
|
|
73
77
|
maxResults: 10
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/entities-saved-states/entity-type-list.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { getGlobalStylesChanges } from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport EntityRecordItem from './entity-record-item';\n\nfunction getEntityDescription( entity, count ) {\n\tswitch ( entity ) {\n\t\tcase 'site':\n\t\t\treturn 1 === count\n\t\t\t\t? __( 'This change will affect your whole site.' )\n\t\t\t\t: __( 'These changes will affect your whole site.' );\n\t\tcase 'wp_template':\n\t\t\treturn __(\n\t\t\t\t'This change will affect other parts of your site that use this template.'\n\t\t\t);\n\t\tcase 'page':\n\t\tcase 'post':\n\t\t\treturn __( 'The following has been modified.' );\n\t}\n}\n\nfunction GlobalStylesDescription( { record } ) {\n\tconst { editedRecord, savedRecord } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\treturn {\n\t\t\t\teditedRecord: getEditedEntityRecord(\n\t\t\t\t\trecord.kind,\n\t\t\t\t\trecord.name,\n\t\t\t\t\trecord.key\n\t\t\t\t),\n\t\t\t\tsavedRecord: getEntityRecord(\n\t\t\t\t\trecord.kind,\n\t\t\t\t\trecord.name,\n\t\t\t\t\trecord.key\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ record.kind, record.name, record.key ]\n\t);\n\n\tconst globalStylesChanges = getGlobalStylesChanges(\n\t\teditedRecord,\n\t\tsavedRecord,\n\t\t{\n\t\t\tmaxResults: 10,\n\t\t}\n\t);\n\treturn globalStylesChanges.length ? (\n\t\t<ul className=\"entities-saved-states__changes\">\n\t\t\t{ globalStylesChanges.map( ( change ) => (\n\t\t\t\t<li key={ change }>{ change }</li>\n\t\t\t) ) }\n\t\t</ul>\n\t) : null;\n}\n\nfunction EntityDescription( { record, count } ) {\n\tif ( 'globalStyles' === record?.name ) {\n\t\treturn null;\n\t}\n\tconst description = getEntityDescription( record?.name, count );\n\treturn description ? <PanelRow>{ description }</PanelRow> : null;\n}\n\nexport default function EntityTypeList( {\n\tlist,\n\tunselectedEntities,\n\tsetUnselectedEntities,\n} ) {\n\tconst count = list.length;\n\tconst firstRecord = list[ 0 ];\n\tconst entityConfig = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityConfig(\n\t\t\t\tfirstRecord.kind,\n\t\t\t\tfirstRecord.name\n\t\t\t),\n\t\t[ firstRecord.kind, firstRecord.name ]\n\t);\n\n\tlet entityLabel = entityConfig.label;\n\tif ( firstRecord?.name === 'wp_template_part' ) {\n\t\tentityLabel =\n\t\t\t1 === count ? __( 'Template Part' ) : __( 'Template Parts' );\n\t}\n\n\treturn (\n\t\t<PanelBody\n\t\t\ttitle={ entityLabel }\n\t\t\tinitialOpen\n\t\t\tclassName=\"entities-saved-states__panel-body\"\n\t\t>\n\t\t\t<EntityDescription record={ firstRecord } count={ count } />\n\t\t\t{ list.map( ( record ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<EntityRecordItem\n\t\t\t\t\t\tkey={ record.key || record.property }\n\t\t\t\t\t\trecord={ record }\n\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t! unselectedEntities.some(\n\t\t\t\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\t\t\t\telt.kind === record.kind &&\n\t\t\t\t\t\t\t\t\telt.name === record.name &&\n\t\t\t\t\t\t\t\t\telt.key === record.key &&\n\t\t\t\t\t\t\t\t\telt.property === record.property\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetUnselectedEntities( record, value )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\t{ 'globalStyles' === firstRecord?.name && (\n\t\t\t\t<GlobalStylesDescription record={ firstRecord } />\n\t\t\t) }\n\t\t</PanelBody>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA6DI;AA1DJ,kBAAmB;AACnB,kBAA0B;AAC1B,wBAAoC;AACpC,uBAAmC;AACnC,kCAAuC;AAKvC,gCAA6B;AAE7B,SAAS,qBAAsB,QAAQ,OAAQ;AAC9C,UAAS,QAAS;AAAA,IACjB,KAAK;AACJ,aAAO,MAAM,YACV,gBAAI,0CAA2C,QAC/C,gBAAI,4CAA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