@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
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
ComplementaryArea,
|
|
6
|
+
ComplementaryAreaMoreMenuItem,
|
|
7
|
+
} from '@wordpress/interface';
|
|
8
|
+
|
|
9
|
+
export default function DefaultSidebar( {
|
|
10
|
+
className,
|
|
11
|
+
identifier,
|
|
12
|
+
title,
|
|
13
|
+
icon,
|
|
14
|
+
children,
|
|
15
|
+
closeLabel,
|
|
16
|
+
header,
|
|
17
|
+
headerClassName,
|
|
18
|
+
panelClassName,
|
|
19
|
+
isActiveByDefault,
|
|
20
|
+
} ) {
|
|
21
|
+
return (
|
|
22
|
+
<>
|
|
23
|
+
<ComplementaryArea
|
|
24
|
+
className={ className }
|
|
25
|
+
scope="core"
|
|
26
|
+
identifier={ identifier }
|
|
27
|
+
title={ title }
|
|
28
|
+
icon={ icon }
|
|
29
|
+
closeLabel={ closeLabel }
|
|
30
|
+
header={ header }
|
|
31
|
+
headerClassName={ headerClassName }
|
|
32
|
+
panelClassName={ panelClassName }
|
|
33
|
+
isActiveByDefault={ isActiveByDefault }
|
|
34
|
+
>
|
|
35
|
+
{ children }
|
|
36
|
+
</ComplementaryArea>
|
|
37
|
+
<ComplementaryAreaMoreMenuItem
|
|
38
|
+
scope="core"
|
|
39
|
+
identifier={ identifier }
|
|
40
|
+
icon={ icon }
|
|
41
|
+
>
|
|
42
|
+
{ title }
|
|
43
|
+
</ComplementaryAreaMoreMenuItem>
|
|
44
|
+
</>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { FlexItem, Flex, Button } from '@wordpress/components';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
import { styles, seen, backup } from '@wordpress/icons';
|
|
7
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
8
|
+
import { useEffect } from '@wordpress/element';
|
|
9
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
10
|
+
import { useViewportMatch, usePrevious } from '@wordpress/compose';
|
|
11
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
12
|
+
import { store as interfaceStore } from '@wordpress/interface';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
import GlobalStylesUI from '../global-styles';
|
|
18
|
+
import { GlobalStylesActionMenu } from '../global-styles/menu';
|
|
19
|
+
import { store as editorStore } from '../../store';
|
|
20
|
+
import { unlock } from '../../lock-unlock';
|
|
21
|
+
import DefaultSidebar from './default-sidebar';
|
|
22
|
+
import WelcomeGuideStyles from './welcome-guide';
|
|
23
|
+
|
|
24
|
+
export default function GlobalStylesSidebar() {
|
|
25
|
+
const {
|
|
26
|
+
shouldResetNavigation,
|
|
27
|
+
stylesPath,
|
|
28
|
+
showStylebook,
|
|
29
|
+
showListViewByDefault,
|
|
30
|
+
hasRevisions,
|
|
31
|
+
activeComplementaryArea,
|
|
32
|
+
} = useSelect( ( select ) => {
|
|
33
|
+
const { getActiveComplementaryArea } = select( interfaceStore );
|
|
34
|
+
const { getStylesPath, getShowStylebook } = unlock(
|
|
35
|
+
select( editorStore )
|
|
36
|
+
);
|
|
37
|
+
const _isVisualEditorMode =
|
|
38
|
+
'visual' === select( editorStore ).getEditorMode();
|
|
39
|
+
const _showListViewByDefault = select( preferencesStore ).get(
|
|
40
|
+
'core',
|
|
41
|
+
'showListViewByDefault'
|
|
42
|
+
);
|
|
43
|
+
const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
|
|
44
|
+
select( coreStore );
|
|
45
|
+
|
|
46
|
+
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
|
|
47
|
+
const globalStyles = globalStylesId
|
|
48
|
+
? getEntityRecord( 'root', 'globalStyles', globalStylesId )
|
|
49
|
+
: undefined;
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
stylesPath: getStylesPath(),
|
|
53
|
+
showStylebook: getShowStylebook(),
|
|
54
|
+
shouldResetNavigation:
|
|
55
|
+
'edit-site/global-styles' !==
|
|
56
|
+
getActiveComplementaryArea( 'core' ) ||
|
|
57
|
+
! _isVisualEditorMode,
|
|
58
|
+
showListViewByDefault: _showListViewByDefault,
|
|
59
|
+
hasRevisions:
|
|
60
|
+
!! globalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count,
|
|
61
|
+
activeComplementaryArea:
|
|
62
|
+
select( interfaceStore ).getActiveComplementaryArea( 'core' ),
|
|
63
|
+
};
|
|
64
|
+
}, [] );
|
|
65
|
+
const { setStylesPath, setShowStylebook, resetStylesNavigation } = unlock(
|
|
66
|
+
useDispatch( editorStore )
|
|
67
|
+
);
|
|
68
|
+
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
69
|
+
|
|
70
|
+
// Derive state from path and showStylebook
|
|
71
|
+
const isRevisionsOpened =
|
|
72
|
+
stylesPath.startsWith( '/revisions' ) && ! showStylebook;
|
|
73
|
+
const isRevisionsStyleBookOpened =
|
|
74
|
+
stylesPath.startsWith( '/revisions' ) && showStylebook;
|
|
75
|
+
|
|
76
|
+
const previousActiveArea = usePrevious( activeComplementaryArea );
|
|
77
|
+
|
|
78
|
+
// Reset navigation when sidebar opens
|
|
79
|
+
useEffect( () => {
|
|
80
|
+
if (
|
|
81
|
+
activeComplementaryArea === 'edit-site/global-styles' &&
|
|
82
|
+
previousActiveArea !== 'edit-site/global-styles'
|
|
83
|
+
) {
|
|
84
|
+
resetStylesNavigation();
|
|
85
|
+
}
|
|
86
|
+
}, [ activeComplementaryArea, previousActiveArea, resetStylesNavigation ] );
|
|
87
|
+
|
|
88
|
+
useEffect( () => {
|
|
89
|
+
if ( shouldResetNavigation ) {
|
|
90
|
+
resetStylesNavigation();
|
|
91
|
+
}
|
|
92
|
+
}, [ shouldResetNavigation, resetStylesNavigation ] );
|
|
93
|
+
|
|
94
|
+
const { setIsListViewOpened } = useDispatch( editorStore );
|
|
95
|
+
|
|
96
|
+
const toggleRevisions = () => {
|
|
97
|
+
setIsListViewOpened( false );
|
|
98
|
+
if ( isRevisionsOpened || isRevisionsStyleBookOpened ) {
|
|
99
|
+
// Close revisions, go back to root
|
|
100
|
+
setStylesPath( '/' );
|
|
101
|
+
} else {
|
|
102
|
+
// Open revisions
|
|
103
|
+
setStylesPath( '/revisions' );
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
const toggleStyleBook = () => {
|
|
107
|
+
setIsListViewOpened( showStylebook && showListViewByDefault );
|
|
108
|
+
setShowStylebook( ! showStylebook );
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<>
|
|
113
|
+
<DefaultSidebar
|
|
114
|
+
className="editor-global-styles-sidebar"
|
|
115
|
+
identifier="edit-site/global-styles"
|
|
116
|
+
title={ __( 'Styles' ) }
|
|
117
|
+
icon={ styles }
|
|
118
|
+
closeLabel={ __( 'Close Styles' ) }
|
|
119
|
+
panelClassName="editor-global-styles-sidebar__panel"
|
|
120
|
+
header={
|
|
121
|
+
<Flex
|
|
122
|
+
className="editor-global-styles-sidebar__header"
|
|
123
|
+
gap={ 1 }
|
|
124
|
+
>
|
|
125
|
+
<FlexItem>
|
|
126
|
+
<h2 className="editor-global-styles-sidebar__header-title">
|
|
127
|
+
{ __( 'Styles' ) }
|
|
128
|
+
</h2>
|
|
129
|
+
</FlexItem>
|
|
130
|
+
<Flex
|
|
131
|
+
justify="flex-end"
|
|
132
|
+
gap={ 1 }
|
|
133
|
+
className="editor-global-styles-sidebar__header-actions"
|
|
134
|
+
>
|
|
135
|
+
{ ! isMobileViewport && (
|
|
136
|
+
<FlexItem>
|
|
137
|
+
<Button
|
|
138
|
+
icon={ seen }
|
|
139
|
+
label={ __( 'Style Book' ) }
|
|
140
|
+
isPressed={ showStylebook }
|
|
141
|
+
accessibleWhenDisabled
|
|
142
|
+
disabled={ shouldResetNavigation }
|
|
143
|
+
onClick={ toggleStyleBook }
|
|
144
|
+
size="compact"
|
|
145
|
+
/>
|
|
146
|
+
</FlexItem>
|
|
147
|
+
) }
|
|
148
|
+
<FlexItem>
|
|
149
|
+
<Button
|
|
150
|
+
label={ __( 'Revisions' ) }
|
|
151
|
+
icon={ backup }
|
|
152
|
+
onClick={ toggleRevisions }
|
|
153
|
+
accessibleWhenDisabled
|
|
154
|
+
disabled={ ! hasRevisions }
|
|
155
|
+
isPressed={
|
|
156
|
+
isRevisionsOpened ||
|
|
157
|
+
isRevisionsStyleBookOpened
|
|
158
|
+
}
|
|
159
|
+
size="compact"
|
|
160
|
+
/>
|
|
161
|
+
</FlexItem>
|
|
162
|
+
<GlobalStylesActionMenu
|
|
163
|
+
onChangePath={ setStylesPath }
|
|
164
|
+
/>
|
|
165
|
+
</Flex>
|
|
166
|
+
</Flex>
|
|
167
|
+
}
|
|
168
|
+
>
|
|
169
|
+
<GlobalStylesUI
|
|
170
|
+
path={ stylesPath }
|
|
171
|
+
onPathChange={ setStylesPath }
|
|
172
|
+
/>
|
|
173
|
+
</DefaultSidebar>
|
|
174
|
+
<WelcomeGuideStyles />
|
|
175
|
+
</>
|
|
176
|
+
);
|
|
177
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
@use "@wordpress/base-styles/colors" as *;
|
|
2
|
+
@use "@wordpress/base-styles/variables" as *;
|
|
3
|
+
|
|
4
|
+
.editor-global-styles-sidebar {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
min-height: 100%;
|
|
8
|
+
|
|
9
|
+
&__panel {
|
|
10
|
+
flex: 1;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.components-navigator-screen {
|
|
14
|
+
padding: 0;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.editor-global-styles-sidebar .editor-global-styles-sidebar__header-title {
|
|
19
|
+
margin: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.editor-global-styles-sidebar .editor-global-styles-sidebar__header-actions {
|
|
23
|
+
flex: 1;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.editor-global-styles-sidebar .components-navigation__menu-title-heading {
|
|
27
|
+
font-size: $default-font-size * 1.2;
|
|
28
|
+
font-weight: $font-weight-medium;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.editor-global-styles-sidebar .components-navigation__item > button span {
|
|
32
|
+
font-weight: $font-weight-medium;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.editor-global-styles-sidebar .block-editor-panel-color-gradient-settings {
|
|
36
|
+
border: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.editor-global-styles-sidebar .single-column {
|
|
40
|
+
grid-column: span 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.editor-global-styles-sidebar .components-tools-panel .span-columns {
|
|
44
|
+
grid-column: 1 / -1;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.editor-global-styles-sidebar__blocks-group {
|
|
48
|
+
padding-top: $grid-unit-30;
|
|
49
|
+
border-top: $border-width solid $gray-200;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.editor-global-styles-sidebar__blocks-group-help {
|
|
53
|
+
padding: 0 $grid-unit-20;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.global-styles-ui-color-palette-panel,
|
|
57
|
+
.global-styles-ui-gradient-palette-panel {
|
|
58
|
+
padding: $grid-unit-20;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Override the `hr` styles defined in the `ComplementaryArea` component
|
|
62
|
+
// from the `@wordpress/interface` package.
|
|
63
|
+
.editor-global-styles-sidebar hr {
|
|
64
|
+
margin: 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.show-icon-labels {
|
|
68
|
+
.editor-global-styles-sidebar__header {
|
|
69
|
+
.components-button.has-icon {
|
|
70
|
+
width: auto;
|
|
71
|
+
|
|
72
|
+
// Hide the button icons when labels are set to display...
|
|
73
|
+
svg {
|
|
74
|
+
display: none;
|
|
75
|
+
}
|
|
76
|
+
// ... and display labels.
|
|
77
|
+
&::after {
|
|
78
|
+
content: attr(aria-label);
|
|
79
|
+
font-size: $helptext-font-size;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.editor-welcome-guide {
|
|
86
|
+
width: 312px;
|
|
87
|
+
|
|
88
|
+
&.guide-styles .editor-welcome-guide__image {
|
|
89
|
+
background: #00a0d2;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&__image {
|
|
93
|
+
margin: 0 0 $grid-unit-20;
|
|
94
|
+
> img {
|
|
95
|
+
display: block;
|
|
96
|
+
max-width: 100%;
|
|
97
|
+
object-fit: cover;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&__heading {
|
|
102
|
+
font-family: $default-font;
|
|
103
|
+
font-size: 24px;
|
|
104
|
+
line-height: 1.4;
|
|
105
|
+
margin: $grid-unit-20 0 $grid-unit-20 0;
|
|
106
|
+
padding: 0 $grid-unit-40;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&__text {
|
|
110
|
+
font-size: $default-font-size;
|
|
111
|
+
line-height: 1.4;
|
|
112
|
+
margin: 0 0 $grid-unit-20 0;
|
|
113
|
+
padding: 0 $grid-unit-40;
|
|
114
|
+
|
|
115
|
+
img {
|
|
116
|
+
vertical-align: bottom;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default function WelcomeGuideImage( { nonAnimatedSrc, animatedSrc } ) {
|
|
2
|
+
return (
|
|
3
|
+
<picture className="editor-welcome-guide__image">
|
|
4
|
+
<source
|
|
5
|
+
srcSet={ nonAnimatedSrc }
|
|
6
|
+
media="(prefers-reduced-motion: reduce)"
|
|
7
|
+
/>
|
|
8
|
+
<img src={ animatedSrc } width="312" height="240" alt="" />
|
|
9
|
+
</picture>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
5
|
+
import { ExternalLink, Guide } from '@wordpress/components';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
8
|
+
import { store as interfaceStore } from '@wordpress/interface';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import WelcomeGuideImage from './welcome-guide-image';
|
|
14
|
+
|
|
15
|
+
export default function WelcomeGuideStyles() {
|
|
16
|
+
const { toggle } = useDispatch( preferencesStore );
|
|
17
|
+
|
|
18
|
+
const { isActive, isStylesOpen } = useSelect( ( select ) => {
|
|
19
|
+
const sidebar =
|
|
20
|
+
select( interfaceStore ).getActiveComplementaryArea( 'core' );
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
isActive: !! select( preferencesStore ).get(
|
|
24
|
+
'core/edit-site',
|
|
25
|
+
'welcomeGuideStyles'
|
|
26
|
+
),
|
|
27
|
+
isStylesOpen: sidebar === 'edit-site/global-styles',
|
|
28
|
+
};
|
|
29
|
+
}, [] );
|
|
30
|
+
|
|
31
|
+
if ( ! isActive || ! isStylesOpen ) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const welcomeLabel = __( 'Welcome to Styles' );
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Guide
|
|
39
|
+
className="editor-welcome-guide guide-styles"
|
|
40
|
+
contentLabel={ welcomeLabel }
|
|
41
|
+
finishButtonText={ __( 'Get started' ) }
|
|
42
|
+
onFinish={ () => toggle( 'core/edit-site', 'welcomeGuideStyles' ) }
|
|
43
|
+
pages={ [
|
|
44
|
+
{
|
|
45
|
+
image: (
|
|
46
|
+
<WelcomeGuideImage
|
|
47
|
+
nonAnimatedSrc="https://s.w.org/images/block-editor/welcome-to-styles.svg?1"
|
|
48
|
+
animatedSrc="https://s.w.org/images/block-editor/welcome-to-styles.gif?1"
|
|
49
|
+
/>
|
|
50
|
+
),
|
|
51
|
+
content: (
|
|
52
|
+
<>
|
|
53
|
+
<h1 className="editor-welcome-guide__heading">
|
|
54
|
+
{ welcomeLabel }
|
|
55
|
+
</h1>
|
|
56
|
+
<p className="editor-welcome-guide__text">
|
|
57
|
+
{ __(
|
|
58
|
+
'Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.'
|
|
59
|
+
) }
|
|
60
|
+
</p>
|
|
61
|
+
</>
|
|
62
|
+
),
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
image: (
|
|
66
|
+
<WelcomeGuideImage
|
|
67
|
+
nonAnimatedSrc="https://s.w.org/images/block-editor/set-the-design.svg?1"
|
|
68
|
+
animatedSrc="https://s.w.org/images/block-editor/set-the-design.gif?1"
|
|
69
|
+
/>
|
|
70
|
+
),
|
|
71
|
+
content: (
|
|
72
|
+
<>
|
|
73
|
+
<h1 className="editor-welcome-guide__heading">
|
|
74
|
+
{ __( 'Set the design' ) }
|
|
75
|
+
</h1>
|
|
76
|
+
<p className="editor-welcome-guide__text">
|
|
77
|
+
{ __(
|
|
78
|
+
'You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle!'
|
|
79
|
+
) }
|
|
80
|
+
</p>
|
|
81
|
+
</>
|
|
82
|
+
),
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
image: (
|
|
86
|
+
<WelcomeGuideImage
|
|
87
|
+
nonAnimatedSrc="https://s.w.org/images/block-editor/personalize-blocks.svg?1"
|
|
88
|
+
animatedSrc="https://s.w.org/images/block-editor/personalize-blocks.gif?1"
|
|
89
|
+
/>
|
|
90
|
+
),
|
|
91
|
+
content: (
|
|
92
|
+
<>
|
|
93
|
+
<h1 className="editor-welcome-guide__heading">
|
|
94
|
+
{ __( 'Personalize blocks' ) }
|
|
95
|
+
</h1>
|
|
96
|
+
<p className="editor-welcome-guide__text">
|
|
97
|
+
{ __(
|
|
98
|
+
'You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.'
|
|
99
|
+
) }
|
|
100
|
+
</p>
|
|
101
|
+
</>
|
|
102
|
+
),
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
image: (
|
|
106
|
+
<WelcomeGuideImage
|
|
107
|
+
nonAnimatedSrc="https://s.w.org/images/block-editor/welcome-documentation.svg"
|
|
108
|
+
animatedSrc="https://s.w.org/images/block-editor/welcome-documentation.gif"
|
|
109
|
+
/>
|
|
110
|
+
),
|
|
111
|
+
content: (
|
|
112
|
+
<>
|
|
113
|
+
<h1 className="editor-welcome-guide__heading">
|
|
114
|
+
{ __( 'Learn more' ) }
|
|
115
|
+
</h1>
|
|
116
|
+
<p className="editor-welcome-guide__text">
|
|
117
|
+
{ __(
|
|
118
|
+
'New to block themes and styling your site?'
|
|
119
|
+
) }{ ' ' }
|
|
120
|
+
<ExternalLink
|
|
121
|
+
href={ __(
|
|
122
|
+
'https://wordpress.org/documentation/article/styles-overview/'
|
|
123
|
+
) }
|
|
124
|
+
>
|
|
125
|
+
{ __(
|
|
126
|
+
'Here’s a detailed guide to learn how to make the most of it.'
|
|
127
|
+
) }
|
|
128
|
+
</ExternalLink>
|
|
129
|
+
</p>
|
|
130
|
+
</>
|
|
131
|
+
),
|
|
132
|
+
},
|
|
133
|
+
] }
|
|
134
|
+
/>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
@@ -50,9 +50,7 @@ const backButtonVariations = {
|
|
|
50
50
|
function Header( {
|
|
51
51
|
customSaveButton,
|
|
52
52
|
forceIsDirty,
|
|
53
|
-
forceDisableBlockTools,
|
|
54
53
|
setEntitiesSavedStatesCallback,
|
|
55
|
-
title,
|
|
56
54
|
} ) {
|
|
57
55
|
const isWideViewport = useViewportMatch( 'large' );
|
|
58
56
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
@@ -65,6 +63,7 @@ function Header( {
|
|
|
65
63
|
hasFixedToolbar,
|
|
66
64
|
hasBlockSelection,
|
|
67
65
|
hasSectionRootClientId,
|
|
66
|
+
isStylesCanvasActive,
|
|
68
67
|
} = useSelect( ( select ) => {
|
|
69
68
|
const { get: getPreference } = select( preferencesStore );
|
|
70
69
|
const {
|
|
@@ -72,6 +71,9 @@ function Header( {
|
|
|
72
71
|
getCurrentPostType,
|
|
73
72
|
isPublishSidebarOpened: _isPublishSidebarOpened,
|
|
74
73
|
} = select( editorStore );
|
|
74
|
+
const { getStylesPath, getShowStylebook } = unlock(
|
|
75
|
+
select( editorStore )
|
|
76
|
+
);
|
|
75
77
|
const { getBlockSelectionStart, getSectionRootClientId } = unlock(
|
|
76
78
|
select( blockEditorStore )
|
|
77
79
|
);
|
|
@@ -84,6 +86,9 @@ function Header( {
|
|
|
84
86
|
hasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),
|
|
85
87
|
hasBlockSelection: !! getBlockSelectionStart(),
|
|
86
88
|
hasSectionRootClientId: !! getSectionRootClientId(),
|
|
89
|
+
isStylesCanvasActive:
|
|
90
|
+
!! getStylesPath()?.startsWith( '/revisions' ) ||
|
|
91
|
+
getShowStylebook(),
|
|
87
92
|
};
|
|
88
93
|
}, [] );
|
|
89
94
|
|
|
@@ -96,7 +101,7 @@ function Header( {
|
|
|
96
101
|
NAVIGATION_POST_TYPE,
|
|
97
102
|
TEMPLATE_PART_POST_TYPE,
|
|
98
103
|
PATTERN_POST_TYPE,
|
|
99
|
-
].includes( postType ) ||
|
|
104
|
+
].includes( postType ) || isStylesCanvasActive;
|
|
100
105
|
|
|
101
106
|
const [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =
|
|
102
107
|
useState( true );
|
|
@@ -129,7 +134,7 @@ function Header( {
|
|
|
129
134
|
transition={ { type: 'tween' } }
|
|
130
135
|
>
|
|
131
136
|
<DocumentTools
|
|
132
|
-
disableBlockTools={
|
|
137
|
+
disableBlockTools={ isStylesCanvasActive || isTextEditor }
|
|
133
138
|
/>
|
|
134
139
|
{ hasFixedToolbar && isLargeViewport && (
|
|
135
140
|
<CollapsibleBlockToolbar
|
|
@@ -144,7 +149,7 @@ function Header( {
|
|
|
144
149
|
variants={ toolbarVariations }
|
|
145
150
|
transition={ { type: 'tween' } }
|
|
146
151
|
>
|
|
147
|
-
<DocumentBar
|
|
152
|
+
<DocumentBar />
|
|
148
153
|
</motion.div>
|
|
149
154
|
) }
|
|
150
155
|
<motion.div
|
|
@@ -176,7 +181,7 @@ function Header( {
|
|
|
176
181
|
/>
|
|
177
182
|
|
|
178
183
|
{ isWideViewport && canBeZoomedOut && (
|
|
179
|
-
<ZoomOutToggle disabled={
|
|
184
|
+
<ZoomOutToggle disabled={ isStylesCanvasActive } />
|
|
180
185
|
) }
|
|
181
186
|
|
|
182
187
|
{ ( isWideViewport || ! showIconLabels ) && (
|
|
@@ -25,15 +25,19 @@ import {
|
|
|
25
25
|
MediaUpload,
|
|
26
26
|
MediaUploadCheck,
|
|
27
27
|
store as blockEditorStore,
|
|
28
|
+
privateApis as blockEditorPrivateApis,
|
|
28
29
|
} from '@wordpress/block-editor';
|
|
29
30
|
import { store as coreStore } from '@wordpress/core-data';
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* Internal dependencies
|
|
33
34
|
*/
|
|
35
|
+
import { unlock } from '../../lock-unlock';
|
|
34
36
|
import PostFeaturedImageCheck from './check';
|
|
35
37
|
import { store as editorStore } from '../../store';
|
|
36
38
|
|
|
39
|
+
const { MediaUploadModal } = unlock( blockEditorPrivateApis );
|
|
40
|
+
|
|
37
41
|
const ALLOWED_MEDIA_TYPES = [ 'image' ];
|
|
38
42
|
|
|
39
43
|
// Used when labels from post type were not yet loaded or when they are not present.
|
|
@@ -48,6 +52,45 @@ const instructions = (
|
|
|
48
52
|
</p>
|
|
49
53
|
);
|
|
50
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Conditional Media component that uses MediaUploadModal when experiment is enabled,
|
|
57
|
+
* otherwise falls back to MediaUpload.
|
|
58
|
+
*
|
|
59
|
+
* @param {Object} root0 Component props.
|
|
60
|
+
* @param {Function} root0.render Render prop function that receives { open } object.
|
|
61
|
+
* @return {JSX.Element} The component.
|
|
62
|
+
*/
|
|
63
|
+
function ConditionalMediaUpload( { render, ...props } ) {
|
|
64
|
+
const [ isModalOpen, setIsModalOpen ] = useState( false );
|
|
65
|
+
const mediaUpload = useSelect( ( select ) => {
|
|
66
|
+
const { getSettings } = select( blockEditorStore );
|
|
67
|
+
return getSettings().mediaUpload;
|
|
68
|
+
}, [] );
|
|
69
|
+
|
|
70
|
+
if ( window.__experimentalDataViewsMediaModal ) {
|
|
71
|
+
return (
|
|
72
|
+
<>
|
|
73
|
+
{ render && render( { open: () => setIsModalOpen( true ) } ) }
|
|
74
|
+
<MediaUploadModal
|
|
75
|
+
{ ...props }
|
|
76
|
+
isOpen={ isModalOpen }
|
|
77
|
+
onClose={ () => {
|
|
78
|
+
setIsModalOpen( false );
|
|
79
|
+
props.onClose?.();
|
|
80
|
+
} }
|
|
81
|
+
onSelect={ ( media ) => {
|
|
82
|
+
setIsModalOpen( false );
|
|
83
|
+
props.onSelect?.( media );
|
|
84
|
+
} }
|
|
85
|
+
onUpload={ mediaUpload }
|
|
86
|
+
/>
|
|
87
|
+
</>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return <MediaUpload { ...props } render={ render } />;
|
|
92
|
+
}
|
|
93
|
+
|
|
51
94
|
function getMediaDetails( media, postId ) {
|
|
52
95
|
if ( ! media ) {
|
|
53
96
|
return {};
|
|
@@ -181,7 +224,7 @@ function PostFeaturedImage( {
|
|
|
181
224
|
</div>
|
|
182
225
|
) }
|
|
183
226
|
<MediaUploadCheck fallback={ instructions }>
|
|
184
|
-
<
|
|
227
|
+
<ConditionalMediaUpload
|
|
185
228
|
title={
|
|
186
229
|
postType?.labels?.featured_image ||
|
|
187
230
|
DEFAULT_FEATURE_IMAGE_LABEL
|
|
@@ -19,7 +19,7 @@ exports[`PostPublishPanel should render the post-publish panel if the post is pu
|
|
|
19
19
|
|
|
20
20
|
.emotion-4 {
|
|
21
21
|
font-size: 11px;
|
|
22
|
-
font-weight:
|
|
22
|
+
font-weight: 499;
|
|
23
23
|
line-height: 1.4;
|
|
24
24
|
text-transform: uppercase;
|
|
25
25
|
display: block;
|
|
@@ -246,7 +246,7 @@ exports[`PostPublishPanel should render the post-publish panel if the post is sc
|
|
|
246
246
|
|
|
247
247
|
.emotion-4 {
|
|
248
248
|
font-size: 11px;
|
|
249
|
-
font-weight:
|
|
249
|
+
font-weight: 499;
|
|
250
250
|
line-height: 1.4;
|
|
251
251
|
text-transform: uppercase;
|
|
252
252
|
display: block;
|
|
@@ -32,7 +32,6 @@ import useCommands from '../commands';
|
|
|
32
32
|
import BlockRemovalWarnings from '../block-removal-warnings';
|
|
33
33
|
import StartPageOptions from '../start-page-options';
|
|
34
34
|
import KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';
|
|
35
|
-
import ContentOnlySettingsMenu from '../block-settings-menu/content-only-settings-menu';
|
|
36
35
|
import StartTemplateOptions from '../start-template-options';
|
|
37
36
|
import EditorKeyboardShortcuts from '../global-keyboard-shortcuts';
|
|
38
37
|
import PatternRenameModal from '../pattern-rename-modal';
|
|
@@ -370,7 +369,6 @@ export const ExperimentalEditorProvider = withRegistryProvider(
|
|
|
370
369
|
<>
|
|
371
370
|
<PatternsMenuItems />
|
|
372
371
|
<TemplatePartMenuItems />
|
|
373
|
-
<ContentOnlySettingsMenu />
|
|
374
372
|
{ mode === 'template-locked' && (
|
|
375
373
|
<DisableNonPageContentBlocks />
|
|
376
374
|
) }
|