@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,44 @@
|
|
|
1
|
+
@use "@wordpress/base-styles/colors" as *;
|
|
2
|
+
@use "@wordpress/base-styles/variables" as *;
|
|
3
|
+
|
|
4
|
+
.editor-style-book {
|
|
5
|
+
// Ensure the style book fills the available vertical space.
|
|
6
|
+
// This is useful when the style book is used to fill a frame.
|
|
7
|
+
height: 100%;
|
|
8
|
+
&.is-button {
|
|
9
|
+
border-radius: $radius-large;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
align-items: stretch;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.editor-style-book__iframe {
|
|
18
|
+
display: block;
|
|
19
|
+
height: 100%;
|
|
20
|
+
width: 100%;
|
|
21
|
+
|
|
22
|
+
&.is-button {
|
|
23
|
+
border-radius: $radius-large;
|
|
24
|
+
}
|
|
25
|
+
&.is-focused {
|
|
26
|
+
outline: calc(2 * var(--wp-admin-border-width-focus)) solid var(--wp-admin-theme-color);
|
|
27
|
+
outline-offset: calc(-2 * var(--wp-admin-border-width-focus));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.editor-style-book__tablist-container {
|
|
32
|
+
flex: none;
|
|
33
|
+
|
|
34
|
+
display: flex;
|
|
35
|
+
width: 100%;
|
|
36
|
+
padding-right: 56px;
|
|
37
|
+
background: $white;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.editor-style-book__tabpanel {
|
|
41
|
+
flex: 1 0 auto;
|
|
42
|
+
|
|
43
|
+
overflow: auto;
|
|
44
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
getExamplesByCategory,
|
|
6
|
+
getTopLevelStyleBookCategories,
|
|
7
|
+
} from '../categories';
|
|
8
|
+
import { STYLE_BOOK_CATEGORIES } from '../constants';
|
|
9
|
+
|
|
10
|
+
jest.mock( '@wordpress/blocks', () => {
|
|
11
|
+
return {
|
|
12
|
+
getCategories() {
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
slug: 'text',
|
|
16
|
+
title: 'Text Registered',
|
|
17
|
+
icon: 'text',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
slug: 'design',
|
|
21
|
+
title: 'Design Registered',
|
|
22
|
+
icon: 'design',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
slug: 'funky',
|
|
26
|
+
title: 'Funky',
|
|
27
|
+
icon: 'funky',
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
} );
|
|
33
|
+
|
|
34
|
+
// Fixtures
|
|
35
|
+
const exampleThemeBlocks = [
|
|
36
|
+
{
|
|
37
|
+
name: 'core/post-content',
|
|
38
|
+
title: 'Post Content',
|
|
39
|
+
category: 'theme',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'core/post-terms',
|
|
43
|
+
title: 'Post Terms',
|
|
44
|
+
category: 'theme',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'core/home-link',
|
|
48
|
+
title: 'Home Link',
|
|
49
|
+
category: 'design',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'core/site-logo',
|
|
53
|
+
title: 'Site Logo',
|
|
54
|
+
category: 'theme',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'core/site-title',
|
|
58
|
+
title: 'Site Title',
|
|
59
|
+
category: 'theme',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'core/site-tagline',
|
|
63
|
+
title: 'Site Tagline',
|
|
64
|
+
category: 'theme',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'core/group',
|
|
68
|
+
title: 'Group',
|
|
69
|
+
category: 'design',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'core/comments-pagination-numbers',
|
|
73
|
+
title: 'Comments Page Numbers',
|
|
74
|
+
category: 'theme',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'core/post-featured-image',
|
|
78
|
+
title: 'Featured Image',
|
|
79
|
+
category: 'theme',
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
describe( 'utils', () => {
|
|
84
|
+
describe( 'getTopLevelStyleBookCategories', () => {
|
|
85
|
+
it( 'returns theme subcategories examples', () => {
|
|
86
|
+
expect( getTopLevelStyleBookCategories() ).toEqual( [
|
|
87
|
+
...STYLE_BOOK_CATEGORIES,
|
|
88
|
+
{
|
|
89
|
+
slug: 'funky',
|
|
90
|
+
title: 'Funky',
|
|
91
|
+
icon: 'funky',
|
|
92
|
+
},
|
|
93
|
+
] );
|
|
94
|
+
} );
|
|
95
|
+
} );
|
|
96
|
+
|
|
97
|
+
describe( 'getExamplesByCategory', () => {
|
|
98
|
+
it( 'returns theme subcategories examples', () => {
|
|
99
|
+
const themeCategory = STYLE_BOOK_CATEGORIES.find(
|
|
100
|
+
( category ) => category.slug === 'theme'
|
|
101
|
+
);
|
|
102
|
+
const themeCategoryExamples = getExamplesByCategory(
|
|
103
|
+
themeCategory,
|
|
104
|
+
exampleThemeBlocks
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
expect( themeCategoryExamples.slug ).toEqual( 'theme' );
|
|
108
|
+
|
|
109
|
+
const siteIdentity = themeCategoryExamples.subcategories.find(
|
|
110
|
+
( subcategory ) => subcategory.slug === 'site-identity'
|
|
111
|
+
);
|
|
112
|
+
expect( siteIdentity ).toEqual( {
|
|
113
|
+
title: 'Site Identity',
|
|
114
|
+
slug: 'site-identity',
|
|
115
|
+
examples: [
|
|
116
|
+
{
|
|
117
|
+
name: 'core/site-logo',
|
|
118
|
+
title: 'Site Logo',
|
|
119
|
+
category: 'theme',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: 'core/site-title',
|
|
123
|
+
title: 'Site Title',
|
|
124
|
+
category: 'theme',
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: 'core/site-tagline',
|
|
128
|
+
title: 'Site Tagline',
|
|
129
|
+
category: 'theme',
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
} );
|
|
133
|
+
|
|
134
|
+
const design = themeCategoryExamples.subcategories.find(
|
|
135
|
+
( subcategory ) => subcategory.slug === 'design'
|
|
136
|
+
);
|
|
137
|
+
expect( design ).toEqual( {
|
|
138
|
+
title: 'Design',
|
|
139
|
+
slug: 'design',
|
|
140
|
+
examples: [
|
|
141
|
+
{
|
|
142
|
+
name: 'core/group',
|
|
143
|
+
title: 'Group',
|
|
144
|
+
category: 'design',
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
} );
|
|
148
|
+
|
|
149
|
+
const posts = themeCategoryExamples.subcategories.find(
|
|
150
|
+
( subcategory ) => subcategory.slug === 'posts'
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
expect( posts ).toEqual( {
|
|
154
|
+
title: 'Posts',
|
|
155
|
+
slug: 'posts',
|
|
156
|
+
examples: [
|
|
157
|
+
{
|
|
158
|
+
name: 'core/post-terms',
|
|
159
|
+
title: 'Post Terms',
|
|
160
|
+
category: 'theme',
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
} );
|
|
164
|
+
} );
|
|
165
|
+
} );
|
|
166
|
+
} );
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export type Block = {
|
|
2
|
+
name: string;
|
|
3
|
+
attributes: Record< string, unknown >;
|
|
4
|
+
innerBlocks?: Block[];
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type StyleBookCategory = {
|
|
8
|
+
title: string;
|
|
9
|
+
slug: string;
|
|
10
|
+
blocks?: string[];
|
|
11
|
+
exclude?: string[];
|
|
12
|
+
include?: string[];
|
|
13
|
+
subcategories?: StyleBookCategory[];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type BlockExample = {
|
|
17
|
+
name: string;
|
|
18
|
+
title: string;
|
|
19
|
+
category: string;
|
|
20
|
+
content?: JSX.Element;
|
|
21
|
+
blocks?: Block | Block[];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type CategoryExamples = {
|
|
25
|
+
title: string;
|
|
26
|
+
slug: string;
|
|
27
|
+
examples?: BlockExample[];
|
|
28
|
+
subcategories?: CategoryExamples[];
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type StyleBookColorGroup = {
|
|
32
|
+
origin: string;
|
|
33
|
+
slug: string;
|
|
34
|
+
title: string;
|
|
35
|
+
type: 'colors' | 'gradients' | 'duotones';
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type Color = { slug: string };
|
|
39
|
+
export type Gradient = { slug: string };
|
|
40
|
+
export type Duotone = {
|
|
41
|
+
colors: string[];
|
|
42
|
+
slug: string;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type ColorExampleProps = {
|
|
46
|
+
colors: Color[] | Gradient[];
|
|
47
|
+
type: StyleBookColorGroup[ 'type' ];
|
|
48
|
+
templateColumns?: string | number;
|
|
49
|
+
itemHeight?: string;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type ColorOrigin = {
|
|
53
|
+
name: string;
|
|
54
|
+
slug: string;
|
|
55
|
+
colors?: Color[];
|
|
56
|
+
gradients?: Gradient[];
|
|
57
|
+
duotones?: Duotone[];
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export type MultiOriginPalettes = {
|
|
61
|
+
disableCustomColors: boolean;
|
|
62
|
+
disableCustomGradients: boolean;
|
|
63
|
+
hasColorsOrGradients: boolean;
|
|
64
|
+
colors: Omit< ColorOrigin, 'gradients' | 'duotones' >;
|
|
65
|
+
duotones: Omit< ColorOrigin, 'colors' | 'gradients' >;
|
|
66
|
+
gradients: Omit< ColorOrigin, 'colors' | 'duotones' >;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/*
|
|
70
|
+
* Typing the items from getBlockTypes from '@wordpress/blocks'
|
|
71
|
+
* to appease the TS linter.
|
|
72
|
+
*/
|
|
73
|
+
export type BlockType = {
|
|
74
|
+
name: string;
|
|
75
|
+
title: string;
|
|
76
|
+
category: string;
|
|
77
|
+
example: BlockType;
|
|
78
|
+
attributes: Record< string, unknown >;
|
|
79
|
+
supports: Record< string, unknown >;
|
|
80
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Button } from '@wordpress/components';
|
|
5
|
+
import { ESCAPE } from '@wordpress/keycodes';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
|
+
import { closeSmall } from '@wordpress/icons';
|
|
9
|
+
import { useFocusOnMount, useFocusReturn } from '@wordpress/compose';
|
|
10
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import { unlock } from '../../lock-unlock';
|
|
15
|
+
import StylesCanvasStyleBook from './style-book';
|
|
16
|
+
import StylesCanvasRevisions from './revisions';
|
|
17
|
+
import { store as editorStore } from '../../store';
|
|
18
|
+
import ResizableEditor from '../resizable-editor';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Helper function to get the title for the styles canvas based on current state.
|
|
22
|
+
*
|
|
23
|
+
* @param {string} path Current styles path.
|
|
24
|
+
* @param {boolean} showStylebook Whether stylebook is visible.
|
|
25
|
+
* @return {string} Translated string for the canvas title.
|
|
26
|
+
*/
|
|
27
|
+
export function getStylesCanvasTitle( path, showStylebook ) {
|
|
28
|
+
if ( showStylebook ) {
|
|
29
|
+
return __( 'Style Book' );
|
|
30
|
+
}
|
|
31
|
+
if ( path?.startsWith( '/revisions' ) ) {
|
|
32
|
+
return __( 'Style Revisions' );
|
|
33
|
+
}
|
|
34
|
+
return '';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Styles canvas component - orchestrates rendering of style book and revisions.
|
|
39
|
+
* Determines what content to show based on global styles navigation state.
|
|
40
|
+
*
|
|
41
|
+
* @return {JSX.Element|null} The styles canvas or null if nothing to render.
|
|
42
|
+
*/
|
|
43
|
+
export default function StylesCanvas() {
|
|
44
|
+
const { stylesPath, showStylebook, showListViewByDefault } = useSelect(
|
|
45
|
+
( select ) => {
|
|
46
|
+
const { getStylesPath, getShowStylebook } = unlock(
|
|
47
|
+
select( editorStore )
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const _showListViewByDefault = select( preferencesStore ).get(
|
|
51
|
+
'core',
|
|
52
|
+
'showListViewByDefault'
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
stylesPath: getStylesPath(),
|
|
57
|
+
showStylebook: getShowStylebook(),
|
|
58
|
+
showListViewByDefault: _showListViewByDefault,
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
[]
|
|
62
|
+
);
|
|
63
|
+
const { resetStylesNavigation, setStylesPath } = unlock(
|
|
64
|
+
useDispatch( editorStore )
|
|
65
|
+
);
|
|
66
|
+
const { setIsListViewOpened } = useDispatch( editorStore );
|
|
67
|
+
|
|
68
|
+
const focusOnMountRef = useFocusOnMount( 'firstElement' );
|
|
69
|
+
const sectionFocusReturnRef = useFocusReturn();
|
|
70
|
+
|
|
71
|
+
// Determine what content to render
|
|
72
|
+
let content = null;
|
|
73
|
+
|
|
74
|
+
if ( showStylebook ) {
|
|
75
|
+
content = (
|
|
76
|
+
<StylesCanvasStyleBook
|
|
77
|
+
path={ stylesPath }
|
|
78
|
+
onPathChange={ setStylesPath }
|
|
79
|
+
ref={ sectionFocusReturnRef }
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
} else if ( stylesPath?.startsWith( '/revisions' ) ) {
|
|
83
|
+
content = (
|
|
84
|
+
<StylesCanvasRevisions
|
|
85
|
+
path={ stylesPath }
|
|
86
|
+
ref={ sectionFocusReturnRef }
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const title = getStylesCanvasTitle( stylesPath, showStylebook );
|
|
92
|
+
const onCloseCanvas = () => {
|
|
93
|
+
setIsListViewOpened( showListViewByDefault );
|
|
94
|
+
resetStylesNavigation();
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const closeOnEscape = ( event ) => {
|
|
98
|
+
if ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
onCloseCanvas();
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<div className="editor-styles-canvas">
|
|
106
|
+
<ResizableEditor enableResizing={ false }>
|
|
107
|
+
{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }
|
|
108
|
+
<section
|
|
109
|
+
className="editor-styles-canvas__section"
|
|
110
|
+
ref={ focusOnMountRef }
|
|
111
|
+
onKeyDown={ closeOnEscape }
|
|
112
|
+
aria-label={ title }
|
|
113
|
+
>
|
|
114
|
+
<Button
|
|
115
|
+
size="compact"
|
|
116
|
+
className="editor-styles-canvas__close-button"
|
|
117
|
+
icon={ closeSmall }
|
|
118
|
+
label={ __( 'Close' ) }
|
|
119
|
+
onClick={ onCloseCanvas }
|
|
120
|
+
/>
|
|
121
|
+
{ content }
|
|
122
|
+
</section>
|
|
123
|
+
</ResizableEditor>
|
|
124
|
+
</div>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Disabled } from '@wordpress/components';
|
|
5
|
+
import {
|
|
6
|
+
BlockList,
|
|
7
|
+
privateApis as blockEditorPrivateApis,
|
|
8
|
+
store as blockEditorStore,
|
|
9
|
+
__unstableEditorStyles as EditorStyles,
|
|
10
|
+
__unstableIframe as Iframe,
|
|
11
|
+
} from '@wordpress/block-editor';
|
|
12
|
+
import { useSelect } from '@wordpress/data';
|
|
13
|
+
import { useMemo, forwardRef } from '@wordpress/element';
|
|
14
|
+
import { useGlobalStylesRevisions } from '@wordpress/global-styles-ui';
|
|
15
|
+
import { mergeGlobalStyles } from '@wordpress/global-styles-engine';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Internal dependencies
|
|
19
|
+
*/
|
|
20
|
+
import { useGlobalStyles } from '../global-styles/hooks';
|
|
21
|
+
import { useGlobalStylesOutputWithConfig } from '../../hooks/use-global-styles-output';
|
|
22
|
+
import { unlock } from '../../lock-unlock';
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
ExperimentalBlockEditorProvider,
|
|
26
|
+
__unstableBlockStyleVariationOverridesWithConfig,
|
|
27
|
+
} = unlock( blockEditorPrivateApis );
|
|
28
|
+
|
|
29
|
+
function isObjectEmpty( object ) {
|
|
30
|
+
return ! object || Object.keys( object ).length === 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Revisions content component for global styles.
|
|
35
|
+
* Coordinates with ScreenRevisions through the path parameter to display
|
|
36
|
+
* the currently selected revision.
|
|
37
|
+
*
|
|
38
|
+
* @param {Object} props Component props.
|
|
39
|
+
* @param {string} props.path Current path in global styles.
|
|
40
|
+
* @param {import('react').ForwardedRef} ref Ref to the Revisions component.
|
|
41
|
+
* @return {JSX.Element|null} The Revisions component or null if loading.
|
|
42
|
+
*/
|
|
43
|
+
function StylesCanvasRevisions( { path }, ref ) {
|
|
44
|
+
const blocks = useSelect( ( select ) => {
|
|
45
|
+
// This is not ideal: it's like a loop (reading from block-editor to render it).
|
|
46
|
+
return select( blockEditorStore ).getBlocks();
|
|
47
|
+
}, [] );
|
|
48
|
+
const { user: userConfig, base: baseConfig } = useGlobalStyles();
|
|
49
|
+
|
|
50
|
+
// Fetch all revisions (includes unsaved, parent, and enriched with authors)
|
|
51
|
+
const { revisions, isLoading } = useGlobalStylesRevisions();
|
|
52
|
+
|
|
53
|
+
// Parse revision ID from path (e.g., "/revisions/123" -> "123")
|
|
54
|
+
const revisionId = useMemo( () => {
|
|
55
|
+
const match = path?.match( /^\/revisions\/(.+)$/ );
|
|
56
|
+
return match ? match[ 1 ] : null;
|
|
57
|
+
}, [ path ] );
|
|
58
|
+
|
|
59
|
+
// Find the selected revision from the fetched list
|
|
60
|
+
const selectedRevision = useMemo( () => {
|
|
61
|
+
if ( ! revisionId || ! revisions.length ) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
return revisions.find(
|
|
65
|
+
( rev ) => String( rev.id ) === String( revisionId )
|
|
66
|
+
);
|
|
67
|
+
}, [ revisionId, revisions ] );
|
|
68
|
+
|
|
69
|
+
// Use the selected revision's config if available, otherwise use current user config
|
|
70
|
+
const displayConfig = selectedRevision || userConfig;
|
|
71
|
+
|
|
72
|
+
// Merge the display config with the base config
|
|
73
|
+
const mergedConfig = useMemo( () => {
|
|
74
|
+
if (
|
|
75
|
+
! isObjectEmpty( displayConfig ) &&
|
|
76
|
+
! isObjectEmpty( baseConfig )
|
|
77
|
+
) {
|
|
78
|
+
return mergeGlobalStyles( baseConfig, displayConfig );
|
|
79
|
+
}
|
|
80
|
+
return {};
|
|
81
|
+
}, [ baseConfig, displayConfig ] );
|
|
82
|
+
|
|
83
|
+
const renderedBlocksArray = useMemo(
|
|
84
|
+
() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),
|
|
85
|
+
[ blocks ]
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
const originalSettings = useSelect(
|
|
89
|
+
( select ) => select( blockEditorStore ).getSettings(),
|
|
90
|
+
[]
|
|
91
|
+
);
|
|
92
|
+
const settings = useMemo(
|
|
93
|
+
() => ( {
|
|
94
|
+
...originalSettings,
|
|
95
|
+
isPreviewMode: true,
|
|
96
|
+
} ),
|
|
97
|
+
[ originalSettings ]
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
const [ globalStyles ] = useGlobalStylesOutputWithConfig( mergedConfig );
|
|
101
|
+
|
|
102
|
+
const editorStyles =
|
|
103
|
+
! isObjectEmpty( globalStyles ) && ! isObjectEmpty( displayConfig )
|
|
104
|
+
? globalStyles
|
|
105
|
+
: settings.styles;
|
|
106
|
+
|
|
107
|
+
if ( isLoading ) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<Iframe
|
|
113
|
+
ref={ ref }
|
|
114
|
+
className="editor-revisions__iframe"
|
|
115
|
+
name="revisions"
|
|
116
|
+
tabIndex={ 0 }
|
|
117
|
+
>
|
|
118
|
+
<style>
|
|
119
|
+
{
|
|
120
|
+
// Forming a "block formatting context" to prevent margin collapsing.
|
|
121
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
|
|
122
|
+
`.is-root-container { display: flow-root; }`
|
|
123
|
+
}
|
|
124
|
+
</style>
|
|
125
|
+
<Disabled className="editor-revisions__example-preview__content">
|
|
126
|
+
<ExperimentalBlockEditorProvider
|
|
127
|
+
value={ renderedBlocksArray }
|
|
128
|
+
settings={ settings }
|
|
129
|
+
>
|
|
130
|
+
<BlockList renderAppender={ false } />
|
|
131
|
+
{ /*
|
|
132
|
+
* Styles are printed inside the block editor provider,
|
|
133
|
+
* so they can access any registered style overrides.
|
|
134
|
+
*/ }
|
|
135
|
+
<EditorStyles styles={ editorStyles } />
|
|
136
|
+
<__unstableBlockStyleVariationOverridesWithConfig
|
|
137
|
+
config={ mergedConfig }
|
|
138
|
+
/>
|
|
139
|
+
</ExperimentalBlockEditorProvider>
|
|
140
|
+
</Disabled>
|
|
141
|
+
</Iframe>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
export default forwardRef( StylesCanvasRevisions );
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { forwardRef } from '@wordpress/element';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import StyleBook from '../style-book';
|
|
10
|
+
import { STYLE_BOOK_COLOR_GROUPS } from '../style-book/constants';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Style Book content component for global styles.
|
|
14
|
+
* Provides the business logic for StyleBook behavior in the global styles context.
|
|
15
|
+
*
|
|
16
|
+
* @param {Object} props Component props.
|
|
17
|
+
* @param {string} props.path Current path in global styles.
|
|
18
|
+
* @param {Function} props.onPathChange Callback when the path changes.
|
|
19
|
+
* @param {import('react').ForwardedRef} ref Ref to the Style Book component.
|
|
20
|
+
* @return {JSX.Element} The Style Book component.
|
|
21
|
+
*/
|
|
22
|
+
function StylesCanvasStyleBook( { path, onPathChange }, ref ) {
|
|
23
|
+
return (
|
|
24
|
+
<StyleBook
|
|
25
|
+
ref={ ref }
|
|
26
|
+
isSelected={ ( blockName ) =>
|
|
27
|
+
// Match '/blocks/core%2Fbutton' and
|
|
28
|
+
// '/blocks/core%2Fbutton/typography', but not
|
|
29
|
+
// '/blocks/core%2Fbuttons'.
|
|
30
|
+
path === `/blocks/${ encodeURIComponent( blockName ) }` ||
|
|
31
|
+
path?.startsWith(
|
|
32
|
+
`/blocks/${ encodeURIComponent( blockName ) }/`
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
onSelect={ ( blockName ) => {
|
|
36
|
+
if (
|
|
37
|
+
STYLE_BOOK_COLOR_GROUPS.find(
|
|
38
|
+
( group ) => group.slug === blockName
|
|
39
|
+
)
|
|
40
|
+
) {
|
|
41
|
+
// Go to color palettes Global Styles.
|
|
42
|
+
onPathChange?.( '/colors/palette' );
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if ( blockName === 'typography' ) {
|
|
46
|
+
// Go to typography Global Styles.
|
|
47
|
+
onPathChange?.( '/typography' );
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Now go to the selected block.
|
|
52
|
+
onPathChange?.( '/blocks/' + encodeURIComponent( blockName ) );
|
|
53
|
+
} }
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
export default forwardRef( StylesCanvasStyleBook );
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
@use "@wordpress/base-styles/colors" as *;
|
|
2
|
+
@use "@wordpress/base-styles/variables" as *;
|
|
3
|
+
|
|
4
|
+
.editor-styles-canvas {
|
|
5
|
+
height: 100%;
|
|
6
|
+
padding: $grid-unit-20;
|
|
7
|
+
|
|
8
|
+
// This is the gray background color that's applied behind "isolation mode".
|
|
9
|
+
// The color normally comes from .editor-visual-editor, but that class is missing here.
|
|
10
|
+
background-color: var(--wp-editor-canvas-background);
|
|
11
|
+
|
|
12
|
+
// Controls height of editor and styles canvas (style book, global styles revisions previews etc.)
|
|
13
|
+
iframe {
|
|
14
|
+
display: block;
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 100%;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.editor-styles-canvas__section {
|
|
21
|
+
background: $white; // Fallback color, overridden by JavaScript.
|
|
22
|
+
border-radius: $radius-large;
|
|
23
|
+
bottom: 0;
|
|
24
|
+
left: 0;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
position: absolute;
|
|
27
|
+
right: 0;
|
|
28
|
+
top: 0;
|
|
29
|
+
@media not (prefers-reduced-motion) {
|
|
30
|
+
transition: all 0.3s; // Match .block-editor-iframe__body transition.
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.editor-styles-canvas__close-button {
|
|
35
|
+
position: absolute;
|
|
36
|
+
right: $grid-unit-10;
|
|
37
|
+
top: $grid-unit-10;
|
|
38
|
+
z-index: 2;
|
|
39
|
+
background: $white;
|
|
40
|
+
}
|
|
@@ -96,7 +96,6 @@ function checkForPostContentAtRootLevel( blocks ) {
|
|
|
96
96
|
function VisualEditor( {
|
|
97
97
|
// Ideally as we unify post and site editors, we won't need these props.
|
|
98
98
|
autoFocus,
|
|
99
|
-
styles,
|
|
100
99
|
disableIframe = false,
|
|
101
100
|
iframeProps,
|
|
102
101
|
contentRef,
|
|
@@ -114,6 +113,7 @@ function VisualEditor( {
|
|
|
114
113
|
isDesignPostType,
|
|
115
114
|
postType,
|
|
116
115
|
isPreview,
|
|
116
|
+
styles,
|
|
117
117
|
} = useSelect( ( select ) => {
|
|
118
118
|
const {
|
|
119
119
|
getCurrentPostId,
|
|
@@ -162,6 +162,7 @@ function VisualEditor( {
|
|
|
162
162
|
isFocusedEntity: !! editorSettings.onNavigateToPreviousEntityRecord,
|
|
163
163
|
postType: postTypeSlug,
|
|
164
164
|
isPreview: editorSettings.isPreviewMode,
|
|
165
|
+
styles: editorSettings.styles,
|
|
165
166
|
};
|
|
166
167
|
}, [] );
|
|
167
168
|
const { isCleanNewPost } = useSelect( editorStore );
|
package/src/hooks/index.js
CHANGED