@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,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/style-book/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tDisabled,\n\tComposite,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport {\n\tBlockList,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\tuseSettings,\n\tBlockEditorProvider,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n} from '@wordpress/block-editor';\nimport { useSelect, dispatch } from '@wordpress/data';\nimport { mergeGlobalStyles } from '@wordpress/global-styles-engine';\nimport {\n\tuseMemo,\n\tuseState,\n\tmemo,\n\tuseRef,\n\tuseLayoutEffect,\n\tuseEffect,\n\tforwardRef,\n} from '@wordpress/element';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { STYLE_BOOK_IFRAME_STYLES } from './constants';\nimport {\n\tgetExamplesByCategory,\n\tgetTopLevelStyleBookCategories,\n} from './categories';\nimport { getExamples } from './examples';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport {\n\tSTYLE_BOOK_COLOR_GROUPS,\n\tSTYLE_BOOK_PREVIEW_CATEGORIES,\n} from '../style-book/constants';\nimport { useGlobalStylesOutputWithConfig } from '../../hooks/use-global-styles-output';\nimport { useStyle, useGlobalStyles } from '../global-styles';\nimport { store as editorStore } from '../../store';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\nconst { Tabs } = unlock( componentsPrivateApis );\n\nfunction isObjectEmpty( object ) {\n\treturn ! object || Object.keys( object ).length === 0;\n}\n\n/**\n * Scrolls to a section within an iframe.\n *\n * @param {string} anchorId The id of the element to scroll to.\n * @param {HTMLIFrameElement} iframe The target iframe.\n */\nconst scrollToSection = ( anchorId, iframe ) => {\n\tif ( ! anchorId || ! iframe || ! iframe?.contentDocument ) {\n\t\treturn;\n\t}\n\n\tconst element =\n\t\tanchorId === 'top'\n\t\t\t? iframe.contentDocument.body\n\t\t\t: iframe.contentDocument.getElementById( anchorId );\n\tif ( element ) {\n\t\telement.scrollIntoView( {\n\t\t\tbehavior: 'smooth',\n\t\t} );\n\t}\n};\n\n/**\n * Parses a Block Editor navigation path to build a style book navigation path.\n * The object can be extended to include a category, representing a style book tab/section.\n *\n * @param {string} path An internal Block Editor navigation path.\n * @return {null|{block: string}} An object containing the example to navigate to.\n */\nconst getStyleBookNavigationFromPath = ( path ) => {\n\tif ( path && typeof path === 'string' ) {\n\t\tif (\n\t\t\tpath === '/' ||\n\t\t\tpath.startsWith( '/typography' ) ||\n\t\t\tpath.startsWith( '/colors' ) ||\n\t\t\tpath.startsWith( '/blocks' )\n\t\t) {\n\t\t\treturn {\n\t\t\t\ttop: true,\n\t\t\t};\n\t\t}\n\t}\n\treturn null;\n};\n\n/**\n * Retrieves colors, gradients, and duotone filters from Global Styles.\n * The inclusion of default (Core) palettes is controlled by the relevant\n * theme.json property e.g. defaultPalette, defaultGradients, defaultDuotone.\n *\n * @return {Object} Object containing properties for each type of palette.\n */\nfunction useMultiOriginPalettes() {\n\tconst { colors, gradients } = useMultipleOriginColorsAndGradients();\n\n\t// Add duotone filters to the palettes data.\n\tconst [\n\t\tshouldDisplayDefaultDuotones,\n\t\tcustomDuotones,\n\t\tthemeDuotones,\n\t\tdefaultDuotones,\n\t] = useSettings(\n\t\t'color.defaultDuotone',\n\t\t'color.duotone.custom',\n\t\t'color.duotone.theme',\n\t\t'color.duotone.default'\n\t);\n\n\tconst palettes = useMemo( () => {\n\t\tconst result = { colors, gradients, duotones: [] };\n\n\t\tif ( themeDuotones && themeDuotones.length ) {\n\t\t\tresult.duotones.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates these duotone filters come from the theme.'\n\t\t\t\t),\n\t\t\t\tslug: 'theme',\n\t\t\t\tduotones: themeDuotones,\n\t\t\t} );\n\t\t}\n\n\t\tif (\n\t\t\tshouldDisplayDefaultDuotones &&\n\t\t\tdefaultDuotones &&\n\t\t\tdefaultDuotones.length\n\t\t) {\n\t\t\tresult.duotones.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates these duotone filters come from WordPress.'\n\t\t\t\t),\n\t\t\t\tslug: 'default',\n\t\t\t\tduotones: defaultDuotones,\n\t\t\t} );\n\t\t}\n\t\tif ( customDuotones && customDuotones.length ) {\n\t\t\tresult.duotones.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates these doutone filters are created by the user.'\n\t\t\t\t),\n\t\t\t\tslug: 'custom',\n\t\t\t\tduotones: customDuotones,\n\t\t\t} );\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tcolors,\n\t\tgradients,\n\t\tcustomDuotones,\n\t\tthemeDuotones,\n\t\tdefaultDuotones,\n\t\tshouldDisplayDefaultDuotones,\n\t] );\n\n\treturn palettes;\n}\n\n/**\n * Get deduped examples for single page stylebook.\n * @param {Array} examples Array of examples.\n * @return {Array} Deduped examples.\n */\nexport function getExamplesForSinglePageUse( examples ) {\n\tconst examplesForSinglePageUse = [];\n\tconst overviewCategoryExamples = getExamplesByCategory(\n\t\t{ slug: 'overview' },\n\t\texamples\n\t);\n\texamplesForSinglePageUse.push( ...overviewCategoryExamples.examples );\n\tconst otherExamples = examples.filter( ( example ) => {\n\t\treturn (\n\t\t\texample.category !== 'overview' &&\n\t\t\t! overviewCategoryExamples.examples.find(\n\t\t\t\t( overviewExample ) => overviewExample.name === example.name\n\t\t\t)\n\t\t);\n\t} );\n\texamplesForSinglePageUse.push( ...otherExamples );\n\n\treturn examplesForSinglePageUse;\n}\n\n/**\n * Applies a block variation to each example by updating its attributes.\n *\n * @param {Array} examples Array of examples\n * @param {string} variation Block variation name.\n * @return {Array} Updated examples with variation applied.\n */\nfunction applyBlockVariationsToExamples( examples, variation ) {\n\tif ( ! variation ) {\n\t\treturn examples;\n\t}\n\treturn examples.map( ( example ) => {\n\t\treturn {\n\t\t\t...example,\n\t\t\tvariation,\n\t\t\tblocks: Array.isArray( example.blocks )\n\t\t\t\t? example.blocks.map( ( block ) => ( {\n\t\t\t\t\t\t...block,\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t...block.attributes,\n\t\t\t\t\t\t\tstyle: undefined,\n\t\t\t\t\t\t\tclassName: `is-style-${ variation }`,\n\t\t\t\t\t\t},\n\t\t\t\t } ) )\n\t\t\t\t: {\n\t\t\t\t\t\t...example.blocks,\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t...example.blocks.attributes,\n\t\t\t\t\t\t\tstyle: undefined,\n\t\t\t\t\t\t\tclassName: `is-style-${ variation }`,\n\t\t\t\t\t\t},\n\t\t\t\t },\n\t\t};\n\t} );\n}\n\nfunction StyleBook(\n\t{\n\t\tisSelected,\n\t\tonClick,\n\t\tonSelect,\n\t\tshowTabs = true,\n\t\tuserConfig = {},\n\t\tpath = '',\n\t},\n\tref\n) {\n\tconst textColor = useStyle( 'color.text' );\n\tconst backgroundColor = useStyle( 'color.background' );\n\tconst colors = useMultiOriginPalettes();\n\tconst examples = useMemo( () => getExamples( colors ), [ colors ] );\n\tconst tabs = useMemo(\n\t\t() =>\n\t\t\tgetTopLevelStyleBookCategories().filter( ( category ) =>\n\t\t\t\texamples.some(\n\t\t\t\t\t( example ) => example.category === category.slug\n\t\t\t\t)\n\t\t\t),\n\t\t[ examples ]\n\t);\n\n\tconst examplesForSinglePageUse = getExamplesForSinglePageUse( examples );\n\n\tconst { base: baseConfig } = useGlobalStyles();\n\tconst goTo = getStyleBookNavigationFromPath( path );\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! isObjectEmpty( userConfig ) && ! isObjectEmpty( baseConfig ) ) {\n\t\t\treturn mergeGlobalStyles( baseConfig, userConfig );\n\t\t}\n\t\treturn {};\n\t}, [ baseConfig, userConfig ] );\n\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst [ globalStyles ] = useGlobalStylesOutputWithConfig( mergedConfig );\n\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...originalSettings,\n\t\t\tstyles:\n\t\t\t\t! isObjectEmpty( globalStyles ) && ! isObjectEmpty( userConfig )\n\t\t\t\t\t? globalStyles\n\t\t\t\t\t: originalSettings.styles,\n\t\t\tisPreviewMode: true,\n\t\t} ),\n\t\t[ globalStyles, originalSettings, userConfig ]\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tref={ ref }\n\t\t\tclassName={ clsx( 'editor-style-book', {\n\t\t\t\t'is-button': !! onClick,\n\t\t\t} ) }\n\t\t\tstyle={ {\n\t\t\t\tcolor: textColor,\n\t\t\t\tbackground: backgroundColor,\n\t\t\t} }\n\t\t>\n\t\t\t{ showTabs ? (\n\t\t\t\t<Tabs>\n\t\t\t\t\t<div className=\"editor-style-book__tablist-container\">\n\t\t\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t\t\t<Tabs.Tab tabId={ tab.slug } key={ tab.slug }>\n\t\t\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t</Tabs.TabList>\n\t\t\t\t\t</div>\n\t\t\t\t\t{ tabs.map( ( tab ) => {\n\t\t\t\t\t\tconst categoryDefinition = tab.slug\n\t\t\t\t\t\t\t? getTopLevelStyleBookCategories().find(\n\t\t\t\t\t\t\t\t\t( _category ) => _category.slug === tab.slug\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: null;\n\t\t\t\t\t\tconst filteredExamples = categoryDefinition\n\t\t\t\t\t\t\t? getExamplesByCategory(\n\t\t\t\t\t\t\t\t\tcategoryDefinition,\n\t\t\t\t\t\t\t\t\texamples\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: { examples };\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\t\tkey={ tab.slug }\n\t\t\t\t\t\t\t\ttabId={ tab.slug }\n\t\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t\t\tclassName=\"editor-style-book__tabpanel\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<StyleBookBody\n\t\t\t\t\t\t\t\t\tcategory={ tab.slug }\n\t\t\t\t\t\t\t\t\texamples={ filteredExamples }\n\t\t\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\t\ttitle={ tab.title }\n\t\t\t\t\t\t\t\t\tgoTo={ goTo }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</Tabs>\n\t\t\t) : (\n\t\t\t\t<StyleBookBody\n\t\t\t\t\texamples={ { examples: examplesForSinglePageUse } }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tgoTo={ goTo }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\n/**\n * Style Book Preview component renders the stylebook without the Editor dependency.\n *\n * @param {Object} props Component props.\n * @param {string} props.path Current path in global styles.\n * @param {Function} props.onPathChange Callback when the path changes.\n * @param {Object} props.userConfig User configuration.\n * @param {boolean} props.isStatic Whether the stylebook is static or clickable.\n * @return {Object} Style Book Preview component.\n */\nexport const StyleBookPreview = ( {\n\tuserConfig = {},\n\tisStatic = false,\n\tpath,\n\tonPathChange,\n} ) => {\n\tconst editorSettings = useSelect(\n\t\t( select ) => select( editorStore ).getEditorSettings(),\n\t\t[]\n\t);\n\n\tconst canUserUploadMedia = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'attachment',\n\t\t\t} ),\n\t\t[]\n\t);\n\n\t// Update block editor settings because useMultipleOriginColorsAndGradients fetch colours from there.\n\tuseEffect( () => {\n\t\tdispatch( blockEditorStore ).updateSettings( {\n\t\t\t...editorSettings,\n\t\t\tmediaUpload: canUserUploadMedia ? uploadMedia : undefined,\n\t\t} );\n\t}, [ editorSettings, canUserUploadMedia ] );\n\n\tconst [ internalPath, setInternalPath ] = useState( '/' );\n\tconst section = path ?? internalPath;\n\tconst onChangeSection = onPathChange ?? setInternalPath;\n\n\tconst isSelected = ( blockName ) => {\n\t\t// Match '/blocks/core%2Fbutton' and\n\t\t// '/blocks/core%2Fbutton/typography', but not\n\t\t// '/blocks/core%2Fbuttons'.\n\t\treturn (\n\t\t\tsection === `/blocks/${ encodeURIComponent( blockName ) }` ||\n\t\t\tsection.startsWith(\n\t\t\t\t`/blocks/${ encodeURIComponent( blockName ) }/`\n\t\t\t)\n\t\t);\n\t};\n\n\tconst onSelect = ( blockName, isBlockVariation = false ) => {\n\t\tif (\n\t\t\tSTYLE_BOOK_COLOR_GROUPS.find(\n\t\t\t\t( group ) => group.slug === blockName\n\t\t\t)\n\t\t) {\n\t\t\t// Go to color palettes Global Styles.\n\t\t\tonChangeSection( '/colors/palette' );\n\t\t\treturn;\n\t\t}\n\t\tif ( blockName === 'typography' ) {\n\t\t\t// Go to typography Global Styles.\n\t\t\tonChangeSection( '/typography' );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlockVariation ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Now go to the selected block.\n\t\tonChangeSection( `/blocks/${ encodeURIComponent( blockName ) }` );\n\t};\n\n\tconst colors = useMultiOriginPalettes();\n\tconst examples = getExamples( colors );\n\tconst examplesForSinglePageUse = getExamplesForSinglePageUse( examples );\n\n\tlet previewCategory = null;\n\tlet blockVariation = null;\n\tif ( section.includes( '/colors' ) ) {\n\t\tpreviewCategory = 'colors';\n\t} else if ( section.includes( '/typography' ) ) {\n\t\tpreviewCategory = 'text';\n\t} else if ( section.includes( '/blocks' ) ) {\n\t\tpreviewCategory = 'blocks';\n\t\tlet blockName = decodeURIComponent( section ).split( '/blocks/' )[ 1 ];\n\n\t\t// The blockName can contain variations, if so, extract the variation.\n\t\tif ( blockName?.includes( '/variations' ) ) {\n\t\t\t[ blockName, blockVariation ] = blockName.split( '/variations/' );\n\t\t}\n\n\t\tif (\n\t\t\tblockName &&\n\t\t\texamples.find( ( example ) => example.name === blockName )\n\t\t) {\n\t\t\tpreviewCategory = blockName;\n\t\t}\n\t} else if ( ! isStatic ) {\n\t\tpreviewCategory = 'overview';\n\t}\n\tconst categoryDefinition = STYLE_BOOK_PREVIEW_CATEGORIES.find(\n\t\t( category ) => category.slug === previewCategory\n\t);\n\n\tconst filteredExamples = useMemo( () => {\n\t\t// If there's no category definition there may be a single block.\n\t\tif ( ! categoryDefinition ) {\n\t\t\treturn {\n\t\t\t\texamples: [\n\t\t\t\t\texamples.find(\n\t\t\t\t\t\t( example ) => example.name === previewCategory\n\t\t\t\t\t),\n\t\t\t\t],\n\t\t\t};\n\t\t}\n\n\t\treturn getExamplesByCategory( categoryDefinition, examples );\n\t}, [ categoryDefinition, examples, previewCategory ] );\n\n\tconst displayedExamples = useMemo( () => {\n\t\t// If there's no preview category, show all examples.\n\t\tif ( ! previewCategory ) {\n\t\t\treturn { examples: examplesForSinglePageUse };\n\t\t}\n\n\t\tif ( blockVariation ) {\n\t\t\treturn {\n\t\t\t\texamples: applyBlockVariationsToExamples(\n\t\t\t\t\tfilteredExamples.examples,\n\t\t\t\t\tblockVariation\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\n\t\treturn filteredExamples;\n\t}, [\n\t\tpreviewCategory,\n\t\texamplesForSinglePageUse,\n\t\tblockVariation,\n\t\tfilteredExamples,\n\t] );\n\n\tconst { base: baseConfig } = useGlobalStyles();\n\tconst goTo = getStyleBookNavigationFromPath( section );\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! isObjectEmpty( userConfig ) && ! isObjectEmpty( baseConfig ) ) {\n\t\t\treturn mergeGlobalStyles( baseConfig, userConfig );\n\t\t}\n\t\treturn {};\n\t}, [ baseConfig, userConfig ] );\n\n\tconst [ globalStyles ] = useGlobalStylesOutputWithConfig( mergedConfig );\n\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...editorSettings,\n\t\t\tstyles:\n\t\t\t\t! isObjectEmpty( globalStyles ) && ! isObjectEmpty( userConfig )\n\t\t\t\t\t? globalStyles\n\t\t\t\t\t: editorSettings.styles,\n\t\t\tisPreviewMode: true,\n\t\t} ),\n\t\t[ globalStyles, editorSettings, userConfig ]\n\t);\n\n\treturn (\n\t\t<div className=\"editor-style-book\">\n\t\t\t<BlockEditorProvider settings={ settings }>\n\t\t\t\t<GlobalStylesRenderer disableRootPadding />\n\t\t\t\t<StyleBookBody\n\t\t\t\t\texamples={ displayedExamples }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tgoTo={ goTo }\n\t\t\t\t\tisSelected={ ! isStatic ? isSelected : null }\n\t\t\t\t\tonSelect={ ! isStatic ? onSelect : null }\n\t\t\t\t/>\n\t\t\t</BlockEditorProvider>\n\t\t</div>\n\t);\n};\n\nexport const StyleBookBody = ( {\n\texamples,\n\tisSelected,\n\tonClick,\n\tonSelect,\n\tsettings,\n\ttitle,\n\tgoTo,\n} ) => {\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\tconst [ hasIframeLoaded, setHasIframeLoaded ] = useState( false );\n\tconst iframeRef = useRef( null );\n\t// The presence of an `onClick` prop indicates that the Style Book is being used as a button.\n\t// In this case, add additional props to the iframe to make it behave like a button.\n\tconst buttonModeProps = {\n\t\trole: 'button',\n\t\tonFocus: () => setIsFocused( true ),\n\t\tonBlur: () => setIsFocused( false ),\n\t\tonKeyDown: ( event ) => {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { keyCode } = event;\n\t\t\tif ( onClick && ( keyCode === ENTER || keyCode === SPACE ) ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonClick( event );\n\t\t\t}\n\t\t},\n\t\tonClick: ( event ) => {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( onClick ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonClick( event );\n\t\t\t}\n\t\t},\n\t\treadonly: true,\n\t};\n\n\tconst handleLoad = () => setHasIframeLoaded( true );\n\tuseLayoutEffect( () => {\n\t\tif ( hasIframeLoaded && iframeRef?.current ) {\n\t\t\tif ( goTo?.top ) {\n\t\t\t\tscrollToSection( 'top', iframeRef?.current );\n\t\t\t}\n\t\t}\n\t}, [ iframeRef?.current, goTo, scrollToSection, hasIframeLoaded ] );\n\n\treturn (\n\t\t<Iframe\n\t\t\tonLoad={ handleLoad }\n\t\t\tref={ iframeRef }\n\t\t\tclassName={ clsx( 'editor-style-book__iframe', {\n\t\t\t\t'is-focused': isFocused && !! onClick,\n\t\t\t\t'is-button': !! onClick,\n\t\t\t} ) }\n\t\t\tname=\"style-book-canvas\"\n\t\t\ttabIndex={ 0 }\n\t\t\t{ ...( onClick ? buttonModeProps : {} ) }\n\t\t>\n\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t<style>\n\t\t\t\t{ STYLE_BOOK_IFRAME_STYLES }\n\t\t\t\t{ !! onClick &&\n\t\t\t\t\t'body { cursor: pointer; } body * { pointer-events: none; }' }\n\t\t\t</style>\n\t\t\t<Examples\n\t\t\t\tclassName=\"editor-style-book__examples\"\n\t\t\t\tfilteredExamples={ examples }\n\t\t\t\tlabel={\n\t\t\t\t\ttitle\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Category of blocks, e.g. Text.\n\t\t\t\t\t\t\t\t__( 'Examples of blocks in the %s category' ),\n\t\t\t\t\t\t\t\ttitle\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __( 'Examples of blocks' )\n\t\t\t\t}\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t\tkey={ title }\n\t\t\t/>\n\t\t</Iframe>\n\t);\n};\n\nconst Examples = memo(\n\t( { className, filteredExamples, label, isSelected, onSelect } ) => {\n\t\treturn (\n\t\t\t<Composite\n\t\t\t\torientation=\"vertical\"\n\t\t\t\tclassName={ className }\n\t\t\t\taria-label={ label }\n\t\t\t\trole=\"grid\"\n\t\t\t>\n\t\t\t\t{ !! filteredExamples?.examples?.length &&\n\t\t\t\t\tfilteredExamples.examples.map( ( example ) => (\n\t\t\t\t\t\t<Example\n\t\t\t\t\t\t\tkey={ example.name }\n\t\t\t\t\t\t\tid={ `example-${ example.name }` }\n\t\t\t\t\t\t\ttitle={ example.title }\n\t\t\t\t\t\t\tcontent={ example.content }\n\t\t\t\t\t\t\tblocks={ example.blocks }\n\t\t\t\t\t\t\tisSelected={ isSelected?.( example.name ) }\n\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t!! onSelect\n\t\t\t\t\t\t\t\t\t? () =>\n\t\t\t\t\t\t\t\t\t\t\tonSelect(\n\t\t\t\t\t\t\t\t\t\t\t\texample.name,\n\t\t\t\t\t\t\t\t\t\t\t\t!! example.variation\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t{ !! filteredExamples?.subcategories?.length &&\n\t\t\t\t\tfilteredExamples.subcategories.map( ( subcategory ) => (\n\t\t\t\t\t\t<Composite.Group\n\t\t\t\t\t\t\tclassName=\"editor-style-book__subcategory\"\n\t\t\t\t\t\t\tkey={ `subcategory-${ subcategory.slug }` }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Composite.GroupLabel>\n\t\t\t\t\t\t\t\t<h2 className=\"editor-style-book__subcategory-title\">\n\t\t\t\t\t\t\t\t\t{ subcategory.title }\n\t\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t\t</Composite.GroupLabel>\n\t\t\t\t\t\t\t<Subcategory\n\t\t\t\t\t\t\t\texamples={ subcategory.examples }\n\t\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Composite.Group>\n\t\t\t\t\t) ) }\n\t\t\t</Composite>\n\t\t);\n\t}\n);\n\nconst Subcategory = ( { examples, isSelected, onSelect } ) => {\n\treturn (\n\t\t!! examples?.length &&\n\t\texamples.map( ( example ) => (\n\t\t\t<Example\n\t\t\t\tkey={ example.name }\n\t\t\t\tid={ `example-${ example.name }` }\n\t\t\t\ttitle={ example.title }\n\t\t\t\tcontent={ example.content }\n\t\t\t\tblocks={ example.blocks }\n\t\t\t\tisSelected={ isSelected?.( example.name ) }\n\t\t\t\tonClick={ !! onSelect ? () => onSelect( example.name ) : null }\n\t\t\t/>\n\t\t) )\n\t);\n};\n\nconst disabledExamples = [ 'example-duotones' ];\n\nconst Example = ( { id, title, blocks, isSelected, onClick, content } ) => {\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...originalSettings,\n\t\t\tfocusMode: false, // Disable \"Spotlight mode\".\n\t\t\tisPreviewMode: true,\n\t\t} ),\n\t\t[ originalSettings ]\n\t);\n\n\t// Cache the list of blocks to avoid additional processing when the component is re-rendered.\n\tconst renderedBlocks = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tconst disabledProps =\n\t\tdisabledExamples.includes( id ) || ! onClick\n\t\t\t? {\n\t\t\t\t\tdisabled: true,\n\t\t\t\t\taccessibleWhenDisabled: !! onClick,\n\t\t\t }\n\t\t\t: {};\n\n\treturn (\n\t\t<div role=\"row\">\n\t\t\t<div role=\"gridcell\">\n\t\t\t\t<Composite.Item\n\t\t\t\t\tclassName={ clsx( 'editor-style-book__example', {\n\t\t\t\t\t\t'is-selected': isSelected,\n\t\t\t\t\t\t'is-disabled-example': !! disabledProps?.disabled,\n\t\t\t\t\t} ) }\n\t\t\t\t\tid={ id }\n\t\t\t\t\taria-label={\n\t\t\t\t\t\t!! onClick\n\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t// translators: %s: Title of a block, e.g. Heading.\n\t\t\t\t\t\t\t\t\t__( 'Open %s styles in Styles panel' ),\n\t\t\t\t\t\t\t\t\ttitle\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\trender={ <div /> }\n\t\t\t\t\trole={ !! onClick ? 'button' : null }\n\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t{ ...disabledProps }\n\t\t\t\t>\n\t\t\t\t\t<span className=\"editor-style-book__example-title\">\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</span>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"editor-style-book__example-preview\"\n\t\t\t\t\t\taria-hidden\n\t\t\t\t\t>\n\t\t\t\t\t\t<Disabled className=\"editor-style-book__example-preview__content\">\n\t\t\t\t\t\t\t{ content ? (\n\t\t\t\t\t\t\t\tcontent\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<ExperimentalBlockEditorProvider\n\t\t\t\t\t\t\t\t\tvalue={ renderedBlocks }\n\t\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<EditorStyles />\n\t\t\t\t\t\t\t\t\t<BlockList renderAppender={ false } />\n\t\t\t\t\t\t\t\t</ExperimentalBlockEditorProvider>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Disabled>\n\t\t\t\t\t</div>\n\t\t\t\t</Composite.Item>\n\t\t\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AAK,OACT,8BAAC,SAAI,MAAK,YACT;AAAA,IAAC,UAAU;AAAA,IAAV;AAAA,MACA,WAAY,KAAM,8BAA8B;AAAA,QAC/C,eAAe;AAAA,QACf,uBAAuB,CAAC,CAAE,eAAe;AAAA,MAC1C,CAAE;AAAA,MACF;AAAA,MACA,cACC,CAAC,CAAE,UACA;AAAA;AAAA,QAEA,GAAI,gCAAiC;AAAA,QACrC;AAAA,MACA,IACA;AAAA,MAEJ,QAAS,oBAAC,SAAI;AAAA,MACd,MAAO,CAAC,CAAE,UAAU,WAAW;AAAA,MAC/B;AAAA,MACE,GAAG;AAAA,MAEL;AAAA,4BAAC,UAAK,WAAU,oCACb,iBACH;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACA,WAAU;AAAA,YACV,eAAW;AAAA,YAEX,8BAAC,YAAS,WAAU,+CACjB,oBACD,UAEA;AAAA,cAAC;AAAA;AAAA,gBACA,OAAQ;AAAA,gBACR;AAAA,gBAEA;AAAA,sCAAC,gBAAa;AAAA,kBACd,oBAAC,aAAU,gBAAiB,OAAQ;AAAA;AAAA;AAAA,YACrC,GAEF;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EACD,GACD,GACD;AAEF;AAEA,IAAO,qBAAQ,WAAY,SAAU;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "@wordpress/components";
|
|
3
|
+
import { ESCAPE } from "@wordpress/keycodes";
|
|
4
|
+
import { __ } from "@wordpress/i18n";
|
|
5
|
+
import { useDispatch, useSelect } from "@wordpress/data";
|
|
6
|
+
import { closeSmall } from "@wordpress/icons";
|
|
7
|
+
import { useFocusOnMount, useFocusReturn } from "@wordpress/compose";
|
|
8
|
+
import { store as preferencesStore } from "@wordpress/preferences";
|
|
9
|
+
import { unlock } from "../../lock-unlock";
|
|
10
|
+
import StylesCanvasStyleBook from "./style-book";
|
|
11
|
+
import StylesCanvasRevisions from "./revisions";
|
|
12
|
+
import { store as editorStore } from "../../store";
|
|
13
|
+
import ResizableEditor from "../resizable-editor";
|
|
14
|
+
function getStylesCanvasTitle(path, showStylebook) {
|
|
15
|
+
if (showStylebook) {
|
|
16
|
+
return __("Style Book");
|
|
17
|
+
}
|
|
18
|
+
if (path?.startsWith("/revisions")) {
|
|
19
|
+
return __("Style Revisions");
|
|
20
|
+
}
|
|
21
|
+
return "";
|
|
22
|
+
}
|
|
23
|
+
function StylesCanvas() {
|
|
24
|
+
const { stylesPath, showStylebook, showListViewByDefault } = useSelect(
|
|
25
|
+
(select) => {
|
|
26
|
+
const { getStylesPath, getShowStylebook } = unlock(
|
|
27
|
+
select(editorStore)
|
|
28
|
+
);
|
|
29
|
+
const _showListViewByDefault = select(preferencesStore).get(
|
|
30
|
+
"core",
|
|
31
|
+
"showListViewByDefault"
|
|
32
|
+
);
|
|
33
|
+
return {
|
|
34
|
+
stylesPath: getStylesPath(),
|
|
35
|
+
showStylebook: getShowStylebook(),
|
|
36
|
+
showListViewByDefault: _showListViewByDefault
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
[]
|
|
40
|
+
);
|
|
41
|
+
const { resetStylesNavigation, setStylesPath } = unlock(
|
|
42
|
+
useDispatch(editorStore)
|
|
43
|
+
);
|
|
44
|
+
const { setIsListViewOpened } = useDispatch(editorStore);
|
|
45
|
+
const focusOnMountRef = useFocusOnMount("firstElement");
|
|
46
|
+
const sectionFocusReturnRef = useFocusReturn();
|
|
47
|
+
let content = null;
|
|
48
|
+
if (showStylebook) {
|
|
49
|
+
content = /* @__PURE__ */ jsx(
|
|
50
|
+
StylesCanvasStyleBook,
|
|
51
|
+
{
|
|
52
|
+
path: stylesPath,
|
|
53
|
+
onPathChange: setStylesPath,
|
|
54
|
+
ref: sectionFocusReturnRef
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
} else if (stylesPath?.startsWith("/revisions")) {
|
|
58
|
+
content = /* @__PURE__ */ jsx(
|
|
59
|
+
StylesCanvasRevisions,
|
|
60
|
+
{
|
|
61
|
+
path: stylesPath,
|
|
62
|
+
ref: sectionFocusReturnRef
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
const title = getStylesCanvasTitle(stylesPath, showStylebook);
|
|
67
|
+
const onCloseCanvas = () => {
|
|
68
|
+
setIsListViewOpened(showListViewByDefault);
|
|
69
|
+
resetStylesNavigation();
|
|
70
|
+
};
|
|
71
|
+
const closeOnEscape = (event) => {
|
|
72
|
+
if (event.keyCode === ESCAPE && !event.defaultPrevented) {
|
|
73
|
+
event.preventDefault();
|
|
74
|
+
onCloseCanvas();
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
return /* @__PURE__ */ jsx("div", { className: "editor-styles-canvas", children: /* @__PURE__ */ jsx(ResizableEditor, { enableResizing: false, children: /* @__PURE__ */ jsxs(
|
|
78
|
+
"section",
|
|
79
|
+
{
|
|
80
|
+
className: "editor-styles-canvas__section",
|
|
81
|
+
ref: focusOnMountRef,
|
|
82
|
+
onKeyDown: closeOnEscape,
|
|
83
|
+
"aria-label": title,
|
|
84
|
+
children: [
|
|
85
|
+
/* @__PURE__ */ jsx(
|
|
86
|
+
Button,
|
|
87
|
+
{
|
|
88
|
+
size: "compact",
|
|
89
|
+
className: "editor-styles-canvas__close-button",
|
|
90
|
+
icon: closeSmall,
|
|
91
|
+
label: __("Close"),
|
|
92
|
+
onClick: onCloseCanvas
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
content
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
) }) });
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
StylesCanvas as default,
|
|
102
|
+
getStylesCanvasTitle
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/styles-canvas/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { closeSmall } from '@wordpress/icons';\nimport { useFocusOnMount, useFocusReturn } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport StylesCanvasStyleBook from './style-book';\nimport StylesCanvasRevisions from './revisions';\nimport { store as editorStore } from '../../store';\nimport ResizableEditor from '../resizable-editor';\n\n/**\n * Helper function to get the title for the styles canvas based on current state.\n *\n * @param {string} path Current styles path.\n * @param {boolean} showStylebook Whether stylebook is visible.\n * @return {string} Translated string for the canvas title.\n */\nexport function getStylesCanvasTitle( path, showStylebook ) {\n\tif ( showStylebook ) {\n\t\treturn __( 'Style Book' );\n\t}\n\tif ( path?.startsWith( '/revisions' ) ) {\n\t\treturn __( 'Style Revisions' );\n\t}\n\treturn '';\n}\n\n/**\n * Styles canvas component - orchestrates rendering of style book and revisions.\n * Determines what content to show based on global styles navigation state.\n *\n * @return {JSX.Element|null} The styles canvas or null if nothing to render.\n */\nexport default function StylesCanvas() {\n\tconst { stylesPath, showStylebook, showListViewByDefault } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getStylesPath, getShowStylebook } = unlock(\n\t\t\t\tselect( editorStore )\n\t\t\t);\n\n\t\t\tconst _showListViewByDefault = select( preferencesStore ).get(\n\t\t\t\t'core',\n\t\t\t\t'showListViewByDefault'\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tstylesPath: getStylesPath(),\n\t\t\t\tshowStylebook: getShowStylebook(),\n\t\t\t\tshowListViewByDefault: _showListViewByDefault,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { resetStylesNavigation, setStylesPath } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst sectionFocusReturnRef = useFocusReturn();\n\n\t// Determine what content to render\n\tlet content = null;\n\n\tif ( showStylebook ) {\n\t\tcontent = (\n\t\t\t<StylesCanvasStyleBook\n\t\t\t\tpath={ stylesPath }\n\t\t\t\tonPathChange={ setStylesPath }\n\t\t\t\tref={ sectionFocusReturnRef }\n\t\t\t/>\n\t\t);\n\t} else if ( stylesPath?.startsWith( '/revisions' ) ) {\n\t\tcontent = (\n\t\t\t<StylesCanvasRevisions\n\t\t\t\tpath={ stylesPath }\n\t\t\t\tref={ sectionFocusReturnRef }\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst title = getStylesCanvasTitle( stylesPath, showStylebook );\n\tconst onCloseCanvas = () => {\n\t\tsetIsListViewOpened( showListViewByDefault );\n\t\tresetStylesNavigation();\n\t};\n\n\tconst closeOnEscape = ( event ) => {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tonCloseCanvas();\n\t\t}\n\t};\n\n\treturn (\n\t\t<div className=\"editor-styles-canvas\">\n\t\t\t<ResizableEditor enableResizing={ false }>\n\t\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t\t<section\n\t\t\t\t\tclassName=\"editor-styles-canvas__section\"\n\t\t\t\t\tref={ focusOnMountRef }\n\t\t\t\t\tonKeyDown={ closeOnEscape }\n\t\t\t\t\taria-label={ title }\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tclassName=\"editor-styles-canvas__close-button\"\n\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\tlabel={ __( 'Close' ) }\n\t\t\t\t\t\tonClick={ onCloseCanvas }\n\t\t\t\t\t/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QACf,KAAM;AAAA;AAAA,IACP;AAAA,EAEF,WAAY,YAAY,WAAY,YAAa,GAAI;AACpD,cACC;AAAA,MAAC;AAAA;AAAA,QACA,MAAO;AAAA,QACP,KAAM;AAAA;AAAA,IACP;AAAA,EAEF;AAEA,QAAM,QAAQ,qBAAsB,YAAY,aAAc;AAC9D,QAAM,gBAAgB,MAAM;AAC3B,wBAAqB,qBAAsB;AAC3C,0BAAsB;AAAA,EACvB;AAEA,QAAM,gBAAgB,CAAE,UAAW;AAClC,QAAK,MAAM,YAAY,UAAU,CAAE,MAAM,kBAAmB;AAC3D,YAAM,eAAe;AACrB,oBAAc;AAAA,IACf;AAAA,EACD;AAEA,SACC,oBAAC,SAAI,WAAU,wBACd,8BAAC,mBAAgB,gBAAiB,OAEjC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,KAAM;AAAA,MACN,WAAY;AAAA,MACZ,cAAa;AAAA,MAEb;AAAA;AAAA,UAAC;AAAA;AAAA,YACA,MAAK;AAAA,YACL,WAAU;AAAA,YACV,MAAO;AAAA,YACP,OAAQ,GAAI,OAAQ;AAAA,YACpB,SAAU;AAAA;AAAA,QACX;AAAA,QACE;AAAA;AAAA;AAAA,EACH,GACD,GACD;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Disabled } from "@wordpress/components";
|
|
3
|
+
import {
|
|
4
|
+
BlockList,
|
|
5
|
+
privateApis as blockEditorPrivateApis,
|
|
6
|
+
store as blockEditorStore,
|
|
7
|
+
__unstableEditorStyles as EditorStyles,
|
|
8
|
+
__unstableIframe as Iframe
|
|
9
|
+
} from "@wordpress/block-editor";
|
|
10
|
+
import { useSelect } from "@wordpress/data";
|
|
11
|
+
import { useMemo, forwardRef } from "@wordpress/element";
|
|
12
|
+
import { useGlobalStylesRevisions } from "@wordpress/global-styles-ui";
|
|
13
|
+
import { mergeGlobalStyles } from "@wordpress/global-styles-engine";
|
|
14
|
+
import { useGlobalStyles } from "../global-styles/hooks";
|
|
15
|
+
import { useGlobalStylesOutputWithConfig } from "../../hooks/use-global-styles-output";
|
|
16
|
+
import { unlock } from "../../lock-unlock";
|
|
17
|
+
const {
|
|
18
|
+
ExperimentalBlockEditorProvider,
|
|
19
|
+
__unstableBlockStyleVariationOverridesWithConfig
|
|
20
|
+
} = unlock(blockEditorPrivateApis);
|
|
21
|
+
function isObjectEmpty(object) {
|
|
22
|
+
return !object || Object.keys(object).length === 0;
|
|
23
|
+
}
|
|
24
|
+
function StylesCanvasRevisions({ path }, ref) {
|
|
25
|
+
const blocks = useSelect((select) => {
|
|
26
|
+
return select(blockEditorStore).getBlocks();
|
|
27
|
+
}, []);
|
|
28
|
+
const { user: userConfig, base: baseConfig } = useGlobalStyles();
|
|
29
|
+
const { revisions, isLoading } = useGlobalStylesRevisions();
|
|
30
|
+
const revisionId = useMemo(() => {
|
|
31
|
+
const match = path?.match(/^\/revisions\/(.+)$/);
|
|
32
|
+
return match ? match[1] : null;
|
|
33
|
+
}, [path]);
|
|
34
|
+
const selectedRevision = useMemo(() => {
|
|
35
|
+
if (!revisionId || !revisions.length) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
return revisions.find(
|
|
39
|
+
(rev) => String(rev.id) === String(revisionId)
|
|
40
|
+
);
|
|
41
|
+
}, [revisionId, revisions]);
|
|
42
|
+
const displayConfig = selectedRevision || userConfig;
|
|
43
|
+
const mergedConfig = useMemo(() => {
|
|
44
|
+
if (!isObjectEmpty(displayConfig) && !isObjectEmpty(baseConfig)) {
|
|
45
|
+
return mergeGlobalStyles(baseConfig, displayConfig);
|
|
46
|
+
}
|
|
47
|
+
return {};
|
|
48
|
+
}, [baseConfig, displayConfig]);
|
|
49
|
+
const renderedBlocksArray = useMemo(
|
|
50
|
+
() => Array.isArray(blocks) ? blocks : [blocks],
|
|
51
|
+
[blocks]
|
|
52
|
+
);
|
|
53
|
+
const originalSettings = useSelect(
|
|
54
|
+
(select) => select(blockEditorStore).getSettings(),
|
|
55
|
+
[]
|
|
56
|
+
);
|
|
57
|
+
const settings = useMemo(
|
|
58
|
+
() => ({
|
|
59
|
+
...originalSettings,
|
|
60
|
+
isPreviewMode: true
|
|
61
|
+
}),
|
|
62
|
+
[originalSettings]
|
|
63
|
+
);
|
|
64
|
+
const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig);
|
|
65
|
+
const editorStyles = !isObjectEmpty(globalStyles) && !isObjectEmpty(displayConfig) ? globalStyles : settings.styles;
|
|
66
|
+
if (isLoading) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
return /* @__PURE__ */ jsxs(
|
|
70
|
+
Iframe,
|
|
71
|
+
{
|
|
72
|
+
ref,
|
|
73
|
+
className: "editor-revisions__iframe",
|
|
74
|
+
name: "revisions",
|
|
75
|
+
tabIndex: 0,
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ jsx("style", {
|
|
78
|
+
// Forming a "block formatting context" to prevent margin collapsing.
|
|
79
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
|
|
80
|
+
children: `.is-root-container { display: flow-root; }`
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ jsx(Disabled, { className: "editor-revisions__example-preview__content", children: /* @__PURE__ */ jsxs(
|
|
83
|
+
ExperimentalBlockEditorProvider,
|
|
84
|
+
{
|
|
85
|
+
value: renderedBlocksArray,
|
|
86
|
+
settings,
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ jsx(BlockList, { renderAppender: false }),
|
|
89
|
+
/* @__PURE__ */ jsx(EditorStyles, { styles: editorStyles }),
|
|
90
|
+
/* @__PURE__ */ jsx(
|
|
91
|
+
__unstableBlockStyleVariationOverridesWithConfig,
|
|
92
|
+
{
|
|
93
|
+
config: mergedConfig
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
) })
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
var revisions_default = forwardRef(StylesCanvasRevisions);
|
|
104
|
+
export {
|
|
105
|
+
revisions_default as default
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=revisions.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/styles-canvas/revisions.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Disabled } from '@wordpress/components';\nimport {\n\tBlockList,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, forwardRef } from '@wordpress/element';\nimport { useGlobalStylesRevisions } from '@wordpress/global-styles-ui';\nimport { mergeGlobalStyles } from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport { useGlobalStyles } from '../global-styles/hooks';\nimport { useGlobalStylesOutputWithConfig } from '../../hooks/use-global-styles-output';\nimport { unlock } from '../../lock-unlock';\n\nconst {\n\tExperimentalBlockEditorProvider,\n\t__unstableBlockStyleVariationOverridesWithConfig,\n} = unlock( blockEditorPrivateApis );\n\nfunction isObjectEmpty( object ) {\n\treturn ! object || Object.keys( object ).length === 0;\n}\n\n/**\n * Revisions content component for global styles.\n * Coordinates with ScreenRevisions through the path parameter to display\n * the currently selected revision.\n *\n * @param {Object} props Component props.\n * @param {string} props.path Current path in global styles.\n * @param {import('react').ForwardedRef} ref Ref to the Revisions component.\n * @return {JSX.Element|null} The Revisions component or null if loading.\n */\nfunction StylesCanvasRevisions( { path }, ref ) {\n\tconst blocks = useSelect( ( select ) => {\n\t\t// This is not ideal: it's like a loop (reading from block-editor to render it).\n\t\treturn select( blockEditorStore ).getBlocks();\n\t}, [] );\n\tconst { user: userConfig, base: baseConfig } = useGlobalStyles();\n\n\t// Fetch all revisions (includes unsaved, parent, and enriched with authors)\n\tconst { revisions, isLoading } = useGlobalStylesRevisions();\n\n\t// Parse revision ID from path (e.g., \"/revisions/123\" -> \"123\")\n\tconst revisionId = useMemo( () => {\n\t\tconst match = path?.match( /^\\/revisions\\/(.+)$/ );\n\t\treturn match ? match[ 1 ] : null;\n\t}, [ path ] );\n\n\t// Find the selected revision from the fetched list\n\tconst selectedRevision = useMemo( () => {\n\t\tif ( ! revisionId || ! revisions.length ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn revisions.find(\n\t\t\t( rev ) => String( rev.id ) === String( revisionId )\n\t\t);\n\t}, [ revisionId, revisions ] );\n\n\t// Use the selected revision's config if available, otherwise use current user config\n\tconst displayConfig = selectedRevision || userConfig;\n\n\t// Merge the display config with the base config\n\tconst mergedConfig = useMemo( () => {\n\t\tif (\n\t\t\t! isObjectEmpty( displayConfig ) &&\n\t\t\t! isObjectEmpty( baseConfig )\n\t\t) {\n\t\t\treturn mergeGlobalStyles( baseConfig, displayConfig );\n\t\t}\n\t\treturn {};\n\t}, [ baseConfig, displayConfig ] );\n\n\tconst renderedBlocksArray = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...originalSettings,\n\t\t\tisPreviewMode: true,\n\t\t} ),\n\t\t[ originalSettings ]\n\t);\n\n\tconst [ globalStyles ] = useGlobalStylesOutputWithConfig( mergedConfig );\n\n\tconst editorStyles =\n\t\t! isObjectEmpty( globalStyles ) && ! isObjectEmpty( displayConfig )\n\t\t\t? globalStyles\n\t\t\t: settings.styles;\n\n\tif ( isLoading ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Iframe\n\t\t\tref={ ref }\n\t\t\tclassName=\"editor-revisions__iframe\"\n\t\t\tname=\"revisions\"\n\t\t\ttabIndex={ 0 }\n\t\t>\n\t\t\t<style>\n\t\t\t\t{\n\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t\t`.is-root-container { display: flow-root; }`\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<Disabled className=\"editor-revisions__example-preview__content\">\n\t\t\t\t<ExperimentalBlockEditorProvider\n\t\t\t\t\tvalue={ renderedBlocksArray }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t>\n\t\t\t\t\t<BlockList renderAppender={ false } />\n\t\t\t\t\t{ /*\n\t\t\t\t\t * Styles are printed inside the block editor provider,\n\t\t\t\t\t * so they can access any registered style overrides.\n\t\t\t\t\t */ }\n\t\t\t\t\t<EditorStyles styles={ editorStyles } />\n\t\t\t\t\t<__unstableBlockStyleVariationOverridesWithConfig\n\t\t\t\t\t\tconfig={ mergedConfig }\n\t\t\t\t\t/>\n\t\t\t\t</ExperimentalBlockEditorProvider>\n\t\t\t</Disabled>\n\t\t</Iframe>\n\t);\n}\nexport default forwardRef( StylesCanvasRevisions );\n"],
|
|
5
|
+
"mappings": "AAqHG,cAQC,YARD;AAlHH,SAAS,gBAAgB;AACzB;AAAA,EACC;AAAA,EACA,eAAe;AAAA,EACf,SAAS;AAAA,EACT,0BAA0B;AAAA,EAC1B,oBAAoB;AAAA,OACd;AACP,SAAS,iBAAiB;AAC1B,SAAS,SAAS,kBAAkB;AACpC,SAAS,gCAAgC;AACzC,SAAS,yBAAyB;AAKlC,SAAS,uBAAuB;AAChC,SAAS,uCAAuC;AAChD,SAAS,cAAc;AAEvB,MAAM;AAAA,EACL;AAAA,EACA;AACD,IAAI,OAAQ,sBAAuB;AAEnC,SAAS,cAAe,QAAS;AAChC,SAAO,CAAE,UAAU,OAAO,KAAM,MA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E,YAAa,IAAI,gCAAiC,YAAa;AAEvE,QAAM,eACL,CAAE,cAAe,YAAa,KAAK,CAAE,cAAe,aAAc,IAC/D,eACA,SAAS;AAEb,MAAK,WAAY;AAChB,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,WAAU;AAAA,MACV,MAAK;AAAA,MACL,UAAW;AAAA,MAEX;AAAA,4BAAC;AAAA;AAAA;AAAA,UAIC;AAAA,SAEF;AAAA,QACA,oBAAC,YAAS,WAAU,8CACnB;AAAA,UAAC;AAAA;AAAA,YACA,OAAQ;AAAA,YACR;AAAA,YAEA;AAAA,kCAAC,aAAU,gBAAiB,OAAQ;AAAA,cAKpC,oBAAC,gBAAa,QAAS,cAAe;AAAA,cACtC;AAAA,gBAAC;AAAA;AAAA,kBACA,QAAS;AAAA;AAAA,cACV;AAAA;AAAA;AAAA,QACD,GACD;AAAA;AAAA;AAAA,EACD;AAEF;AACA,IAAO,oBAAQ,WAAY,qBAAsB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "@wordpress/element";
|
|
3
|
+
import StyleBook from "../style-book";
|
|
4
|
+
import { STYLE_BOOK_COLOR_GROUPS } from "../style-book/constants";
|
|
5
|
+
function StylesCanvasStyleBook({ path, onPathChange }, ref) {
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
StyleBook,
|
|
8
|
+
{
|
|
9
|
+
ref,
|
|
10
|
+
isSelected: (blockName) => (
|
|
11
|
+
// Match '/blocks/core%2Fbutton' and
|
|
12
|
+
// '/blocks/core%2Fbutton/typography', but not
|
|
13
|
+
// '/blocks/core%2Fbuttons'.
|
|
14
|
+
path === `/blocks/${encodeURIComponent(blockName)}` || path?.startsWith(
|
|
15
|
+
`/blocks/${encodeURIComponent(blockName)}/`
|
|
16
|
+
)
|
|
17
|
+
),
|
|
18
|
+
onSelect: (blockName) => {
|
|
19
|
+
if (STYLE_BOOK_COLOR_GROUPS.find(
|
|
20
|
+
(group) => group.slug === blockName
|
|
21
|
+
)) {
|
|
22
|
+
onPathChange?.("/colors/palette");
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (blockName === "typography") {
|
|
26
|
+
onPathChange?.("/typography");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
onPathChange?.("/blocks/" + encodeURIComponent(blockName));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
var style_book_default = forwardRef(StylesCanvasStyleBook);
|
|
35
|
+
export {
|
|
36
|
+
style_book_default as default
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=style-book.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/styles-canvas/style-book.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport StyleBook from '../style-book';\nimport { STYLE_BOOK_COLOR_GROUPS } from '../style-book/constants';\n\n/**\n * Style Book content component for global styles.\n * Provides the business logic for StyleBook behavior in the global styles context.\n *\n * @param {Object} props Component props.\n * @param {string} props.path Current path in global styles.\n * @param {Function} props.onPathChange Callback when the path changes.\n * @param {import('react').ForwardedRef} ref Ref to the Style Book component.\n * @return {JSX.Element} The Style Book component.\n */\nfunction StylesCanvasStyleBook( { path, onPathChange }, ref ) {\n\treturn (\n\t\t<StyleBook\n\t\t\tref={ ref }\n\t\t\tisSelected={ ( blockName ) =>\n\t\t\t\t// Match '/blocks/core%2Fbutton' and\n\t\t\t\t// '/blocks/core%2Fbutton/typography', but not\n\t\t\t\t// '/blocks/core%2Fbuttons'.\n\t\t\t\tpath === `/blocks/${ encodeURIComponent( blockName ) }` ||\n\t\t\t\tpath?.startsWith(\n\t\t\t\t\t`/blocks/${ encodeURIComponent( blockName ) }/`\n\t\t\t\t)\n\t\t\t}\n\t\t\tonSelect={ ( blockName ) => {\n\t\t\t\tif (\n\t\t\t\t\tSTYLE_BOOK_COLOR_GROUPS.find(\n\t\t\t\t\t\t( group ) => group.slug === blockName\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\t// Go to color palettes Global Styles.\n\t\t\t\t\tonPathChange?.( '/colors/palette' );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ( blockName === 'typography' ) {\n\t\t\t\t\t// Go to typography Global Styles.\n\t\t\t\t\tonPathChange?.( '/typography' );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Now go to the selected block.\n\t\t\t\tonPathChange?.( '/blocks/' + encodeURIComponent( blockName ) );\n\t\t\t} }\n\t\t/>\n\t);\n}\nexport default forwardRef( StylesCanvasStyleBook );\n"],
|
|
5
|
+
"mappings": "AAuBE;AApBF,SAAS,kBAAkB;AAK3B,OAAO,eAAe;AACtB,SAAS,+BAA+B;AAYxC,SAAS,sBAAuB,EAAE,MAAM,aAAa,GAAG,KAAM;AAC7D,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,YAAa,CAAE;AAAA;AAAA;AAAA;AAAA,QAId,SAAS,WAAY,mBAAoB,SAAU,CAAE,MACrD,MAAM;AAAA,UACL,WAAY,mBAAoB,SAAU,CAAE;AAAA,QAC7C;AAAA;AAAA,MAED,UAAW,CAAE,cAAe;AAC3B,YACC,wBAAwB;AAAA,UACvB,CAAE,UAAW,MAAM,SAAS;AAAA,QAC7B,GACC;AAED,yBAAgB,iBAAkB;AAClC;AAAA,QACD;AACA,YAAK,cAAc,cAAe;AAEjC,yBAAgB,aAAc;AAC9B;AAAA,QACD;AAGA,uBAAgB,aAAa,mBAAoB,SAAU,CAAE;AAAA,MAC9D;AAAA;AAAA,EACD;AAEF;AACA,IAAO,qBAAQ,WAAY,qBAAsB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -67,7 +67,6 @@ function checkForPostContentAtRootLevel(blocks) {
|
|
|
67
67
|
function VisualEditor({
|
|
68
68
|
// Ideally as we unify post and site editors, we won't need these props.
|
|
69
69
|
autoFocus,
|
|
70
|
-
styles,
|
|
71
70
|
disableIframe = false,
|
|
72
71
|
iframeProps,
|
|
73
72
|
contentRef,
|
|
@@ -84,7 +83,8 @@ function VisualEditor({
|
|
|
84
83
|
isFocusedEntity,
|
|
85
84
|
isDesignPostType,
|
|
86
85
|
postType,
|
|
87
|
-
isPreview
|
|
86
|
+
isPreview,
|
|
87
|
+
styles
|
|
88
88
|
} = useSelect((select) => {
|
|
89
89
|
const {
|
|
90
90
|
getCurrentPostId,
|
|
@@ -124,7 +124,8 @@ function VisualEditor({
|
|
|
124
124
|
deviceType: getDeviceType(),
|
|
125
125
|
isFocusedEntity: !!editorSettings.onNavigateToPreviousEntityRecord,
|
|
126
126
|
postType: postTypeSlug,
|
|
127
|
-
isPreview: editorSettings.isPreviewMode
|
|
127
|
+
isPreview: editorSettings.isPreviewMode,
|
|
128
|
+
styles: editorSettings.styles
|
|
128
129
|
};
|
|
129
130
|
}, []);
|
|
130
131
|
const { isCleanNewPost } = useSelect(editorStore);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/visual-editor/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockList,\n\tstore as blockEditorStore,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tuseSettings,\n\tRecursionProvider,\n\tprivateApis as blockEditorPrivateApis,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useMergeRefs, useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PostTitle from '../post-title';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport EditTemplateBlocksNotification from './edit-template-blocks-notification';\nimport ResizableEditor from '../resizable-editor';\nimport useSelectNearestEditableBlock from './use-select-nearest-editable-block';\nimport {\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n} from '../../store/constants';\nimport { useZoomOutModeExit } from './use-zoom-out-mode-exit';\n\nconst {\n\tLayoutStyle,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tExperimentalBlockCanvas: BlockCanvas,\n\tuseFlashEditableBlocks,\n} = unlock( blockEditorPrivateApis );\n\n/**\n * These post types have a special editor where they don't allow you to fill the title\n * and they don't apply the layout styles.\n */\nconst DESIGN_POST_TYPES = [\n\tPATTERN_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n];\n\n/**\n * Given an array of nested blocks, find the first Post Content\n * block inside it, recursing through any nesting levels,\n * and return its attributes.\n *\n * @param {Array} blocks A list of blocks.\n *\n * @return {Object | undefined} The Post Content block.\n */\nfunction getPostContentAttributes( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn blocks[ i ].attributes;\n\t\t}\n\t\tif ( blocks[ i ].innerBlocks.length ) {\n\t\t\tconst nestedPostContent = getPostContentAttributes(\n\t\t\t\tblocks[ i ].innerBlocks\n\t\t\t);\n\n\t\t\tif ( nestedPostContent ) {\n\t\t\t\treturn nestedPostContent;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction checkForPostContentAtRootLevel( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\nfunction VisualEditor( {\n\t// Ideally as we unify post and site editors, we won't need these props.\n\tautoFocus,\n\tstyles,\n\tdisableIframe = false,\n\tiframeProps,\n\tcontentRef,\n\tclassName,\n} ) {\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst {\n\t\trenderingMode,\n\t\tpostContentAttributes,\n\t\teditedPostTemplate = {},\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t\tdeviceType,\n\t\tisFocusedEntity,\n\t\tisDesignPostType,\n\t\tpostType,\n\t\tisPreview,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentPostId,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentTemplateId,\n\t\t\tgetEditorSettings,\n\t\t\tgetRenderingMode,\n\t\t\tgetDeviceType,\n\t\t} = select( editorStore );\n\t\tconst { getPostType, getEditedEntityRecord } = select( coreStore );\n\t\tconst postTypeSlug = getCurrentPostType();\n\t\tconst _renderingMode = getRenderingMode();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( postTypeSlug === PATTERN_POST_TYPE ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( _renderingMode === 'post-only' ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst supportsTemplateMode = editorSettings.supportsTemplateMode;\n\t\tconst postTypeObject = getPostType( postTypeSlug );\n\t\tconst currentTemplateId = getCurrentTemplateId();\n\t\tconst template = currentTemplateId\n\t\t\t? getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tcurrentTemplateId\n\t\t\t )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\trenderingMode: _renderingMode,\n\t\t\tpostContentAttributes: editorSettings.postContentAttributes,\n\t\t\tisDesignPostType: DESIGN_POST_TYPES.includes( postTypeSlug ),\n\t\t\t// Post template fetch returns a 404 on classic themes, which\n\t\t\t// messes with e2e tests, so check it's a block theme first.\n\t\t\teditedPostTemplate:\n\t\t\t\tpostTypeObject?.viewable && supportsTemplateMode\n\t\t\t\t\t? template\n\t\t\t\t\t: undefined,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t\tdeviceType: getDeviceType(),\n\t\t\tisFocusedEntity: !! editorSettings.onNavigateToPreviousEntityRecord,\n\t\t\tpostType: postTypeSlug,\n\t\t\tisPreview: editorSettings.isPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst {\n\t\thasRootPaddingAwareAlignments,\n\t\tthemeHasDisabledLayoutStyles,\n\t\tthemeSupportsLayout,\n\t\tisZoomedOut,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSettings, isZoomOut: _isZoomOut } = unlock(\n\t\t\tselect( blockEditorStore )\n\t\t);\n\n\t\tconst _settings = getSettings();\n\t\treturn {\n\t\t\tthemeHasDisabledLayoutStyles: _settings.disableLayoutStyles,\n\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\thasRootPaddingAwareAlignments:\n\t\t\t\t_settings.__experimentalFeatures?.useRootPaddingAwareAlignments,\n\t\t\tisZoomedOut: _isZoomOut(),\n\t\t};\n\t}, [] );\n\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst [ globalLayoutSettings ] = useSettings( 'layout' );\n\n\t// fallbackLayout is used if there is no Post Content,\n\t// and for Post Title.\n\tconst fallbackLayout = useMemo( () => {\n\t\tif ( renderingMode !== 'post-only' || isDesignPostType ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\t// We need to ensure support for wide and full alignments,\n\t\t\t// so we add the constrained type.\n\t\t\treturn { ...globalLayoutSettings, type: 'constrained' };\n\t\t}\n\t\t// Set default layout for classic themes so all alignments are supported.\n\t\treturn { type: 'default' };\n\t}, [\n\t\trenderingMode,\n\t\tthemeSupportsLayout,\n\t\tglobalLayoutSettings,\n\t\tisDesignPostType,\n\t] );\n\n\tconst newestPostContentAttributes = useMemo( () => {\n\t\tif (\n\t\t\t! editedPostTemplate?.content &&\n\t\t\t! editedPostTemplate?.blocks &&\n\t\t\tpostContentAttributes\n\t\t) {\n\t\t\treturn postContentAttributes;\n\t\t}\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn getPostContentAttributes( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn getPostContentAttributes( parse( parseableContent ) ) || {};\n\t}, [\n\t\teditedPostTemplate?.content,\n\t\teditedPostTemplate?.blocks,\n\t\tpostContentAttributes,\n\t] );\n\n\tconst hasPostContentAtRootLevel = useMemo( () => {\n\t\tif ( ! editedPostTemplate?.content && ! editedPostTemplate?.blocks ) {\n\t\t\treturn false;\n\t\t}\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn checkForPostContentAtRootLevel( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn (\n\t\t\tcheckForPostContentAtRootLevel( parse( parseableContent ) ) || false\n\t\t);\n\t}, [ editedPostTemplate?.content, editedPostTemplate?.blocks ] );\n\n\tconst { layout = {}, align = '' } = newestPostContentAttributes || {};\n\n\tconst postContentLayoutClasses = useLayoutClasses(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content'\n\t);\n\n\tconst blockListLayoutClass = clsx(\n\t\t{\n\t\t\t'is-layout-flow': ! themeSupportsLayout,\n\t\t},\n\t\tthemeSupportsLayout && postContentLayoutClasses,\n\t\talign && `align${ align }`\n\t);\n\n\tconst postContentLayoutStyles = useLayoutStyles(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content',\n\t\t'.block-editor-block-list__layout.is-root-container'\n\t);\n\n\t// Update type for blocks using legacy layouts.\n\tconst postContentLayout = useMemo( () => {\n\t\treturn layout &&\n\t\t\t( layout?.type === 'constrained' ||\n\t\t\t\tlayout?.inherit ||\n\t\t\t\tlayout?.contentSize ||\n\t\t\t\tlayout?.wideSize )\n\t\t\t? { ...globalLayoutSettings, ...layout, type: 'constrained' }\n\t\t\t: { ...globalLayoutSettings, ...layout, type: 'default' };\n\t}, [\n\t\tlayout?.type,\n\t\tlayout?.inherit,\n\t\tlayout?.contentSize,\n\t\tlayout?.wideSize,\n\t\tglobalLayoutSettings,\n\t] );\n\n\t// If there is a Post Content block we use its layout for the block list;\n\t// if not, this must be a classic theme, in which case we use the fallback layout.\n\tconst blockListLayout = postContentAttributes\n\t\t? postContentLayout\n\t\t: fallbackLayout;\n\n\tconst postEditorLayout =\n\t\tblockListLayout?.type === 'default' && ! hasPostContentAtRootLevel\n\t\t\t? fallbackLayout\n\t\t\t: blockListLayout;\n\tconst observeTypingRef = useTypingObserver();\n\tconst titleRef = useRef();\n\tuseEffect( () => {\n\t\tif ( ! autoFocus || ! isCleanNewPost() ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ autoFocus, isCleanNewPost ] );\n\n\t// Add some styles for alignwide/alignfull Post Content and its children.\n\tconst alignCSS = `.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);}\n\t\t.is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`;\n\n\tconst enableResizing =\n\t\t[\n\t\t\tNAVIGATION_POST_TYPE,\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\tPATTERN_POST_TYPE,\n\t\t].includes( postType ) &&\n\t\t// Disable in previews / view mode.\n\t\t! isPreview &&\n\t\t// Disable resizing in mobile viewport.\n\t\t! isMobileViewport &&\n\t\t// Disable resizing in zoomed-out mode.\n\t\t! isZoomedOut;\n\n\tconst iframeStyles = useMemo( () => {\n\t\treturn [\n\t\t\t...( styles ?? [] ),\n\t\t\t{\n\t\t\t\t// Ensures margins of children are contained so that the body background paints behind them.\n\t\t\t\t// Otherwise, the background of html (when zoomed out) would show there and appear broken. It\u2019s\n\t\t\t\t// important mostly for post-only views yet conceivably an issue in templated views too.\n\t\t\t\tcss: `:where(.block-editor-iframe__body){display:flow-root;}.is-root-container{display:flow-root;${\n\t\t\t\t\t// Some themes will have `min-height: 100vh` for the root container,\n\t\t\t\t\t// which isn't a requirement in auto resize mode.\n\t\t\t\t\tenableResizing ? 'min-height:0!important;' : ''\n\t\t\t\t}}\n\t\t\t\t${\n\t\t\t\t\tenableResizing\n\t\t\t\t\t\t? '.block-editor-iframe__html{background:var(--wp-editor-canvas-background);display:flex;align-items:center;justify-content:center;min-height:100vh;}.block-editor-iframe__body{width:100%;}'\n\t\t\t\t\t\t: ''\n\t\t\t\t}`,\n\t\t\t\t// The CSS above centers the body content vertically when resizing is enabled and applies a background\n\t\t\t\t// color to the iframe HTML element to match the background color of the editor canvas.\n\t\t\t},\n\t\t];\n\t}, [ styles, enableResizing ] );\n\n\tconst localRef = useRef();\n\tconst typewriterRef = useTypewriter();\n\tcontentRef = useMergeRefs( [\n\t\tlocalRef,\n\t\tcontentRef,\n\t\trenderingMode === 'post-only' ? typewriterRef : null,\n\t\tuseFlashEditableBlocks( {\n\t\t\tisEnabled: renderingMode === 'template-locked',\n\t\t} ),\n\t\tuseSelectNearestEditableBlock( {\n\t\t\tisEnabled: renderingMode === 'template-locked',\n\t\t} ),\n\t\tuseZoomOutModeExit(),\n\t] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-visual-editor',\n\t\t\t\t// this class is here for backward compatibility reasons.\n\t\t\t\t'edit-post-visual-editor',\n\t\t\t\tclassName,\n\t\t\t\t{\n\t\t\t\t\t'has-padding': isFocusedEntity || enableResizing,\n\t\t\t\t\t'is-resizable': enableResizing,\n\t\t\t\t\t'is-iframed': ! disableIframe,\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t<ResizableEditor enableResizing={ enableResizing } height=\"100%\">\n\t\t\t\t<BlockCanvas\n\t\t\t\t\tshouldIframe={ ! disableIframe }\n\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\tstyles={ iframeStyles }\n\t\t\t\t\theight=\"100%\"\n\t\t\t\t\tiframeProps={ {\n\t\t\t\t\t\t...iframeProps,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...iframeProps?.style,\n\t\t\t\t\t\t\t...deviceStyles,\n\t\t\t\t\t\t},\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ themeSupportsLayout &&\n\t\t\t\t\t\t! themeHasDisabledLayoutStyles &&\n\t\t\t\t\t\trenderingMode === 'post-only' &&\n\t\t\t\t\t\t! isDesignPostType && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\tselector=\".editor-visual-editor__post-title-wrapper\"\n\t\t\t\t\t\t\t\t\tlayout={ fallbackLayout }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\tselector=\".block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\t\tlayout={ postEditorLayout }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ align && <LayoutStyle css={ alignCSS } /> }\n\t\t\t\t\t\t\t\t{ postContentLayoutStyles && (\n\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\tlayout={ postContentLayout }\n\t\t\t\t\t\t\t\t\t\tcss={ postContentLayoutStyles }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t{ renderingMode === 'post-only' && ! isDesignPostType && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'editor-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t// The following class is only here for backward compatibility\n\t\t\t\t\t\t\t\t// some themes might be using it to style the post title.\n\t\t\t\t\t\t\t\t'edit-post-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'has-global-padding':\n\t\t\t\t\t\t\t\t\t\thasRootPaddingAwareAlignments,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tcontentEditable={ false }\n\t\t\t\t\t\t\tref={ observeTypingRef }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t// This is using inline styles\n\t\t\t\t\t\t\t\t// so it's applied for both iframed and non iframed editors.\n\t\t\t\t\t\t\t\tmarginTop: '4rem',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PostTitle ref={ titleRef } />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<RecursionProvider\n\t\t\t\t\t\tblockName={ wrapperBlockName }\n\t\t\t\t\t\tuniqueId={ wrapperUniqueId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'is-' + deviceType.toLowerCase() + '-preview',\n\t\t\t\t\t\t\t\trenderingMode !== 'post-only' ||\n\t\t\t\t\t\t\t\t\tisDesignPostType\n\t\t\t\t\t\t\t\t\t? 'wp-site-blocks'\n\t\t\t\t\t\t\t\t\t: `${ blockListLayoutClass } wp-block-post-content`, // Ensure root level blocks receive default/flow blockGap styling rules.\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'has-global-padding':\n\t\t\t\t\t\t\t\t\t\trenderingMode === 'post-only' &&\n\t\t\t\t\t\t\t\t\t\t! isDesignPostType &&\n\t\t\t\t\t\t\t\t\t\thasRootPaddingAwareAlignments,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlayout={ blockListLayout }\n\t\t\t\t\t\t\tdropZoneElement={\n\t\t\t\t\t\t\t\t// When iframed, pass in the html element of the iframe to\n\t\t\t\t\t\t\t\t// ensure the drop zone extends to the edges of the iframe.\n\t\t\t\t\t\t\t\tdisableIframe\n\t\t\t\t\t\t\t\t\t? localRef.current\n\t\t\t\t\t\t\t\t\t: localRef.current?.parentNode\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t__unstableDisableDropZone={\n\t\t\t\t\t\t\t\t// In template preview mode, disable drop zones at the root of the template.\n\t\t\t\t\t\t\t\trenderingMode === 'template-locked'\n\t\t\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t\t\t: false\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ renderingMode === 'template-locked' && (\n\t\t\t\t\t\t\t<EditTemplateBlocksNotification\n\t\t\t\t\t\t\t\tcontentRef={ localRef }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</RecursionProvider>\n\t\t\t\t</BlockCanvas>\n\t\t\t</ResizableEditor>\n\t\t</div>\n\t);\n}\n\nexport default VisualEditor;\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockList,\n\tstore as blockEditorStore,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tuseSettings,\n\tRecursionProvider,\n\tprivateApis as blockEditorPrivateApis,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useMergeRefs, useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PostTitle from '../post-title';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport EditTemplateBlocksNotification from './edit-template-blocks-notification';\nimport ResizableEditor from '../resizable-editor';\nimport useSelectNearestEditableBlock from './use-select-nearest-editable-block';\nimport {\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n} from '../../store/constants';\nimport { useZoomOutModeExit } from './use-zoom-out-mode-exit';\n\nconst {\n\tLayoutStyle,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tExperimentalBlockCanvas: BlockCanvas,\n\tuseFlashEditableBlocks,\n} = unlock( blockEditorPrivateApis );\n\n/**\n * These post types have a special editor where they don't allow you to fill the title\n * and they don't apply the layout styles.\n */\nconst DESIGN_POST_TYPES = [\n\tPATTERN_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n];\n\n/**\n * Given an array of nested blocks, find the first Post Content\n * block inside it, recursing through any nesting levels,\n * and return its attributes.\n *\n * @param {Array} blocks A list of blocks.\n *\n * @return {Object | undefined} The Post Content block.\n */\nfunction getPostContentAttributes( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn blocks[ i ].attributes;\n\t\t}\n\t\tif ( blocks[ i ].innerBlocks.length ) {\n\t\t\tconst nestedPostContent = getPostContentAttributes(\n\t\t\t\tblocks[ i ].innerBlocks\n\t\t\t);\n\n\t\t\tif ( nestedPostContent ) {\n\t\t\t\treturn nestedPostContent;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction checkForPostContentAtRootLevel( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\nfunction VisualEditor( {\n\t// Ideally as we unify post and site editors, we won't need these props.\n\tautoFocus,\n\tdisableIframe = false,\n\tiframeProps,\n\tcontentRef,\n\tclassName,\n} ) {\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst {\n\t\trenderingMode,\n\t\tpostContentAttributes,\n\t\teditedPostTemplate = {},\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t\tdeviceType,\n\t\tisFocusedEntity,\n\t\tisDesignPostType,\n\t\tpostType,\n\t\tisPreview,\n\t\tstyles,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentPostId,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentTemplateId,\n\t\t\tgetEditorSettings,\n\t\t\tgetRenderingMode,\n\t\t\tgetDeviceType,\n\t\t} = select( editorStore );\n\t\tconst { getPostType, getEditedEntityRecord } = select( coreStore );\n\t\tconst postTypeSlug = getCurrentPostType();\n\t\tconst _renderingMode = getRenderingMode();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( postTypeSlug === PATTERN_POST_TYPE ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( _renderingMode === 'post-only' ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst supportsTemplateMode = editorSettings.supportsTemplateMode;\n\t\tconst postTypeObject = getPostType( postTypeSlug );\n\t\tconst currentTemplateId = getCurrentTemplateId();\n\t\tconst template = currentTemplateId\n\t\t\t? getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tcurrentTemplateId\n\t\t\t )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\trenderingMode: _renderingMode,\n\t\t\tpostContentAttributes: editorSettings.postContentAttributes,\n\t\t\tisDesignPostType: DESIGN_POST_TYPES.includes( postTypeSlug ),\n\t\t\t// Post template fetch returns a 404 on classic themes, which\n\t\t\t// messes with e2e tests, so check it's a block theme first.\n\t\t\teditedPostTemplate:\n\t\t\t\tpostTypeObject?.viewable && supportsTemplateMode\n\t\t\t\t\t? template\n\t\t\t\t\t: undefined,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t\tdeviceType: getDeviceType(),\n\t\t\tisFocusedEntity: !! editorSettings.onNavigateToPreviousEntityRecord,\n\t\t\tpostType: postTypeSlug,\n\t\t\tisPreview: editorSettings.isPreviewMode,\n\t\t\tstyles: editorSettings.styles,\n\t\t};\n\t}, [] );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst {\n\t\thasRootPaddingAwareAlignments,\n\t\tthemeHasDisabledLayoutStyles,\n\t\tthemeSupportsLayout,\n\t\tisZoomedOut,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSettings, isZoomOut: _isZoomOut } = unlock(\n\t\t\tselect( blockEditorStore )\n\t\t);\n\n\t\tconst _settings = getSettings();\n\t\treturn {\n\t\t\tthemeHasDisabledLayoutStyles: _settings.disableLayoutStyles,\n\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\thasRootPaddingAwareAlignments:\n\t\t\t\t_settings.__experimentalFeatures?.useRootPaddingAwareAlignments,\n\t\t\tisZoomedOut: _isZoomOut(),\n\t\t};\n\t}, [] );\n\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst [ globalLayoutSettings ] = useSettings( 'layout' );\n\n\t// fallbackLayout is used if there is no Post Content,\n\t// and for Post Title.\n\tconst fallbackLayout = useMemo( () => {\n\t\tif ( renderingMode !== 'post-only' || isDesignPostType ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\t// We need to ensure support for wide and full alignments,\n\t\t\t// so we add the constrained type.\n\t\t\treturn { ...globalLayoutSettings, type: 'constrained' };\n\t\t}\n\t\t// Set default layout for classic themes so all alignments are supported.\n\t\treturn { type: 'default' };\n\t}, [\n\t\trenderingMode,\n\t\tthemeSupportsLayout,\n\t\tglobalLayoutSettings,\n\t\tisDesignPostType,\n\t] );\n\n\tconst newestPostContentAttributes = useMemo( () => {\n\t\tif (\n\t\t\t! editedPostTemplate?.content &&\n\t\t\t! editedPostTemplate?.blocks &&\n\t\t\tpostContentAttributes\n\t\t) {\n\t\t\treturn postContentAttributes;\n\t\t}\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn getPostContentAttributes( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn getPostContentAttributes( parse( parseableContent ) ) || {};\n\t}, [\n\t\teditedPostTemplate?.content,\n\t\teditedPostTemplate?.blocks,\n\t\tpostContentAttributes,\n\t] );\n\n\tconst hasPostContentAtRootLevel = useMemo( () => {\n\t\tif ( ! editedPostTemplate?.content && ! editedPostTemplate?.blocks ) {\n\t\t\treturn false;\n\t\t}\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn checkForPostContentAtRootLevel( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn (\n\t\t\tcheckForPostContentAtRootLevel( parse( parseableContent ) ) || false\n\t\t);\n\t}, [ editedPostTemplate?.content, editedPostTemplate?.blocks ] );\n\n\tconst { layout = {}, align = '' } = newestPostContentAttributes || {};\n\n\tconst postContentLayoutClasses = useLayoutClasses(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content'\n\t);\n\n\tconst blockListLayoutClass = clsx(\n\t\t{\n\t\t\t'is-layout-flow': ! themeSupportsLayout,\n\t\t},\n\t\tthemeSupportsLayout && postContentLayoutClasses,\n\t\talign && `align${ align }`\n\t);\n\n\tconst postContentLayoutStyles = useLayoutStyles(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content',\n\t\t'.block-editor-block-list__layout.is-root-container'\n\t);\n\n\t// Update type for blocks using legacy layouts.\n\tconst postContentLayout = useMemo( () => {\n\t\treturn layout &&\n\t\t\t( layout?.type === 'constrained' ||\n\t\t\t\tlayout?.inherit ||\n\t\t\t\tlayout?.contentSize ||\n\t\t\t\tlayout?.wideSize )\n\t\t\t? { ...globalLayoutSettings, ...layout, type: 'constrained' }\n\t\t\t: { ...globalLayoutSettings, ...layout, type: 'default' };\n\t}, [\n\t\tlayout?.type,\n\t\tlayout?.inherit,\n\t\tlayout?.contentSize,\n\t\tlayout?.wideSize,\n\t\tglobalLayoutSettings,\n\t] );\n\n\t// If there is a Post Content block we use its layout for the block list;\n\t// if not, this must be a classic theme, in which case we use the fallback layout.\n\tconst blockListLayout = postContentAttributes\n\t\t? postContentLayout\n\t\t: fallbackLayout;\n\n\tconst postEditorLayout =\n\t\tblockListLayout?.type === 'default' && ! hasPostContentAtRootLevel\n\t\t\t? fallbackLayout\n\t\t\t: blockListLayout;\n\tconst observeTypingRef = useTypingObserver();\n\tconst titleRef = useRef();\n\tuseEffect( () => {\n\t\tif ( ! autoFocus || ! isCleanNewPost() ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ autoFocus, isCleanNewPost ] );\n\n\t// Add some styles for alignwide/alignfull Post Content and its children.\n\tconst alignCSS = `.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);}\n\t\t.is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`;\n\n\tconst enableResizing =\n\t\t[\n\t\t\tNAVIGATION_POST_TYPE,\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\tPATTERN_POST_TYPE,\n\t\t].includes( postType ) &&\n\t\t// Disable in previews / view mode.\n\t\t! isPreview &&\n\t\t// Disable resizing in mobile viewport.\n\t\t! isMobileViewport &&\n\t\t// Disable resizing in zoomed-out mode.\n\t\t! isZoomedOut;\n\n\tconst iframeStyles = useMemo( () => {\n\t\treturn [\n\t\t\t...( styles ?? [] ),\n\t\t\t{\n\t\t\t\t// Ensures margins of children are contained so that the body background paints behind them.\n\t\t\t\t// Otherwise, the background of html (when zoomed out) would show there and appear broken. It\u2019s\n\t\t\t\t// important mostly for post-only views yet conceivably an issue in templated views too.\n\t\t\t\tcss: `:where(.block-editor-iframe__body){display:flow-root;}.is-root-container{display:flow-root;${\n\t\t\t\t\t// Some themes will have `min-height: 100vh` for the root container,\n\t\t\t\t\t// which isn't a requirement in auto resize mode.\n\t\t\t\t\tenableResizing ? 'min-height:0!important;' : ''\n\t\t\t\t}}\n\t\t\t\t${\n\t\t\t\t\tenableResizing\n\t\t\t\t\t\t? '.block-editor-iframe__html{background:var(--wp-editor-canvas-background);display:flex;align-items:center;justify-content:center;min-height:100vh;}.block-editor-iframe__body{width:100%;}'\n\t\t\t\t\t\t: ''\n\t\t\t\t}`,\n\t\t\t\t// The CSS above centers the body content vertically when resizing is enabled and applies a background\n\t\t\t\t// color to the iframe HTML element to match the background color of the editor canvas.\n\t\t\t},\n\t\t];\n\t}, [ styles, enableResizing ] );\n\n\tconst localRef = useRef();\n\tconst typewriterRef = useTypewriter();\n\tcontentRef = useMergeRefs( [\n\t\tlocalRef,\n\t\tcontentRef,\n\t\trenderingMode === 'post-only' ? typewriterRef : null,\n\t\tuseFlashEditableBlocks( {\n\t\t\tisEnabled: renderingMode === 'template-locked',\n\t\t} ),\n\t\tuseSelectNearestEditableBlock( {\n\t\t\tisEnabled: renderingMode === 'template-locked',\n\t\t} ),\n\t\tuseZoomOutModeExit(),\n\t] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-visual-editor',\n\t\t\t\t// this class is here for backward compatibility reasons.\n\t\t\t\t'edit-post-visual-editor',\n\t\t\t\tclassName,\n\t\t\t\t{\n\t\t\t\t\t'has-padding': isFocusedEntity || enableResizing,\n\t\t\t\t\t'is-resizable': enableResizing,\n\t\t\t\t\t'is-iframed': ! disableIframe,\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t<ResizableEditor enableResizing={ enableResizing } height=\"100%\">\n\t\t\t\t<BlockCanvas\n\t\t\t\t\tshouldIframe={ ! disableIframe }\n\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\tstyles={ iframeStyles }\n\t\t\t\t\theight=\"100%\"\n\t\t\t\t\tiframeProps={ {\n\t\t\t\t\t\t...iframeProps,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...iframeProps?.style,\n\t\t\t\t\t\t\t...deviceStyles,\n\t\t\t\t\t\t},\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ themeSupportsLayout &&\n\t\t\t\t\t\t! themeHasDisabledLayoutStyles &&\n\t\t\t\t\t\trenderingMode === 'post-only' &&\n\t\t\t\t\t\t! isDesignPostType && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\tselector=\".editor-visual-editor__post-title-wrapper\"\n\t\t\t\t\t\t\t\t\tlayout={ fallbackLayout }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\tselector=\".block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\t\tlayout={ postEditorLayout }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ align && <LayoutStyle css={ alignCSS } /> }\n\t\t\t\t\t\t\t\t{ postContentLayoutStyles && (\n\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\tlayout={ postContentLayout }\n\t\t\t\t\t\t\t\t\t\tcss={ postContentLayoutStyles }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t{ renderingMode === 'post-only' && ! isDesignPostType && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'editor-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t// The following class is only here for backward compatibility\n\t\t\t\t\t\t\t\t// some themes might be using it to style the post title.\n\t\t\t\t\t\t\t\t'edit-post-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'has-global-padding':\n\t\t\t\t\t\t\t\t\t\thasRootPaddingAwareAlignments,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tcontentEditable={ false }\n\t\t\t\t\t\t\tref={ observeTypingRef }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t// This is using inline styles\n\t\t\t\t\t\t\t\t// so it's applied for both iframed and non iframed editors.\n\t\t\t\t\t\t\t\tmarginTop: '4rem',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PostTitle ref={ titleRef } />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<RecursionProvider\n\t\t\t\t\t\tblockName={ wrapperBlockName }\n\t\t\t\t\t\tuniqueId={ wrapperUniqueId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'is-' + deviceType.toLowerCase() + '-preview',\n\t\t\t\t\t\t\t\trenderingMode !== 'post-only' ||\n\t\t\t\t\t\t\t\t\tisDesignPostType\n\t\t\t\t\t\t\t\t\t? 'wp-site-blocks'\n\t\t\t\t\t\t\t\t\t: `${ blockListLayoutClass } wp-block-post-content`, // Ensure root level blocks receive default/flow blockGap styling rules.\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'has-global-padding':\n\t\t\t\t\t\t\t\t\t\trenderingMode === 'post-only' &&\n\t\t\t\t\t\t\t\t\t\t! isDesignPostType &&\n\t\t\t\t\t\t\t\t\t\thasRootPaddingAwareAlignments,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlayout={ blockListLayout }\n\t\t\t\t\t\t\tdropZoneElement={\n\t\t\t\t\t\t\t\t// When iframed, pass in the html element of the iframe to\n\t\t\t\t\t\t\t\t// ensure the drop zone extends to the edges of the iframe.\n\t\t\t\t\t\t\t\tdisableIframe\n\t\t\t\t\t\t\t\t\t? localRef.current\n\t\t\t\t\t\t\t\t\t: localRef.current?.parentNode\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t__unstableDisableDropZone={\n\t\t\t\t\t\t\t\t// In template preview mode, disable drop zones at the root of the template.\n\t\t\t\t\t\t\t\trenderingMode === 'template-locked'\n\t\t\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t\t\t: false\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ renderingMode === 'template-locked' && (\n\t\t\t\t\t\t\t<EditTemplateBlocksNotification\n\t\t\t\t\t\t\t\tcontentRef={ localRef }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</RecursionProvider>\n\t\t\t\t</BlockCanvas>\n\t\t\t</ResizableEditor>\n\t\t</div>\n\t);\n}\n\nexport default VisualEditor;\n"],
|
|
5
|
+
"mappings": "AAoZO,mBACC,KADD;AAjZP,OAAO,UAAU;AAKjB;AAAA,EACC;AAAA,EACA,SAAS;AAAA,EACT,2BAA2B;AAAA,EAC3B,+BAA+B;AAAA,EAC/B;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,iCAAiC;AAAA,OAC3B;AACP,SAAS,WAAW,QAAQ,eAAe;AAC3C,SAAS,iBAAiB;AAC1B,SAAS,aAAa;AACtB,SAAS,SAAS,iBAAiB;AACnC,SAAS,cAAc,wBAAwB;AAK/C,OAAO,eAAe;AACtB,SAAS,SAAS,mBAAmB;AACrC,SAAS,cAAc;AACvB,OAAO,oCAAoC;AAC3C,OAAO,qBAAqB;AAC5B,OAAO,mCAAmC;AAC1C;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,0BAA0B;AAEnC,MAAM;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA,yBAAyB;AAAA,EACzB;AACD,IAAI,OAAQ,sBAAuB;AAMnC,MAAM,oBAAoB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAWA,SAAS,yBAA0B,QAAS;AAC3C,WAAU,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAM;AACzC,QAAK,OAAQ,CAAE,EAAE,SAAS,qBAAsB;AAC/C,aAAO,OAAQ,CAAE,EAAE;AAAA,I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AkB,eAClB,CAAE,oBACF;AAAA,wBACF;AAAA,sBACD;AAAA,sBACA,QAAS;AAAA,sBACT;AAAA;AAAA;AAAA,wBAGC,gBACG,SAAS,UACT,SAAS,SAAS;AAAA;AAAA,sBAEtB;AAAA;AAAA,wBAEC,kBAAkB,oBACf,OACA;AAAA;AAAA;AAAA,kBAEL;AAAA,kBACE,kBAAkB,qBACnB;AAAA,oBAAC;AAAA;AAAA,sBACA,YAAa;AAAA;AAAA,kBACd;AAAA;AAAA;AAAA,YAEF;AAAA;AAAA;AAAA,MACD,GACD;AAAA;AAAA,EACD;AAEF;AAEA,IAAO,wBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/dataviews/fields/content-preview/content-preview-view.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockPreview,\n\tprivateApis as blockEditorPrivateApis,\n\t// @ts-ignore\n} from '@wordpress/block-editor';\nimport type { BasePost } from '@wordpress/fields';\nimport { useSelect } from '@wordpress/data';\nimport { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { EditorProvider } from '../../../components/provider';\nimport { unlock } from '../../../lock-unlock';\n// @ts-ignore\nimport { store as editorStore } from '../../../store';\n\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nfunction PostPreviewContainer( {\n\ttemplate,\n\tpost,\n}: {\n\ttemplate: any;\n\tpost: any;\n} ) {\n\tconst [ backgroundColor = 'white' ] = useGlobalStyle( 'color.background' );\n\tconst [ postBlocks ] = useEntityBlockEditor( 'postType', post.type, {\n\t\tid: post.id,\n\t} );\n\tconst [ templateBlocks ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplate?.type,\n\t\t{\n\t\t\tid: template?.id,\n\t\t}\n\t);\n\tconst blocks = template && templateBlocks ? templateBlocks : postBlocks;\n\tconst isEmpty = ! blocks?.length;\n\treturn (\n\t\t<div\n\t\t\tclassName=\"editor-fields-content-preview\"\n\t\t\tstyle={ {\n\t\t\t\tbackgroundColor,\n\t\t\t} }\n\t\t>\n\t\t\t{ isEmpty && (\n\t\t\t\t<span className=\"editor-fields-content-preview__empty\">\n\t\t\t\t\t{ __( 'Empty content' ) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<BlockPreview.Async>\n\t\t\t\t\t<BlockPreview blocks={ blocks } />\n\t\t\t\t</BlockPreview.Async>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default function PostPreviewView( { item }: { item: BasePost } ) {\n\tconst { settings, template } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser, getPostType, getTemplateId, getEntityRecord } =\n\t\t\t\tunlock( select( coreStore ) );\n\t\t\tconst canViewTemplate = canUser( 'read', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} );\n\t\t\tconst _settings = select( editorStore ).getEditorSettings();\n\t\t\t// @ts-ignore\n\t\t\tconst supportsTemplateMode = _settings.supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( item.type )?.viewable ?? false;\n\n\t\t\tconst templateId =\n\t\t\t\tsupportsTemplateMode && isViewable && canViewTemplate\n\t\t\t\t\t? getTemplateId( item.type, item.id )\n\t\t\t\t\t: null;\n\t\t\treturn {\n\t\t\t\tsettings: _settings,\n\t\t\t\ttemplate: templateId\n\t\t\t\t\t? getEntityRecord( 'postType', 'wp_template', templateId )\n\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t},\n\t\t[ item.type, item.id ]\n\t);\n\t// Wrap everything in a block editor provider to ensure 'styles' that are needed\n\t// for the previews are synced between the site editor store and the block editor store.\n\t// Additionally we need to have the `__experimentalBlockPatterns` setting in order to\n\t// render patterns inside the previews.\n\t// TODO: Same approach is used in the patterns list and it becomes obvious that some of\n\t// the block editor settings are needed in context where we don't have the block editor.\n\t// Explore how we can solve this in a better way.\n\treturn (\n\t\t<EditorProvider\n\t\t\tpost={ item }\n\t\t\tsettings={ settings }\n\t\t\t__unstableTemplate={ template }\n\t\t>\n\t\t\t<PostPreviewContainer template={ template } post={ item } />\n\t\t</EditorProvider>\n\t);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t// @ts-ignore\n\tBlockPreview,\n\t// @ts-ignore\n\tprivateApis as blockEditorPrivateApis,\n\t// @ts-ignore\n} from '@wordpress/block-editor';\nimport type { BasePost } from '@wordpress/fields';\nimport { useSelect } from '@wordpress/data';\nimport { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { EditorProvider } from '../../../components/provider';\nimport { unlock } from '../../../lock-unlock';\n// @ts-ignore\nimport { store as editorStore } from '../../../store';\n\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nfunction PostPreviewContainer( {\n\ttemplate,\n\tpost,\n}: {\n\ttemplate: any;\n\tpost: any;\n} ) {\n\tconst [ backgroundColor = 'white' ] = useGlobalStyle( 'color.background' );\n\tconst [ postBlocks ] = useEntityBlockEditor( 'postType', post.type, {\n\t\tid: post.id,\n\t} );\n\tconst [ templateBlocks ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplate?.type,\n\t\t{\n\t\t\tid: template?.id,\n\t\t}\n\t);\n\tconst blocks = template && templateBlocks ? templateBlocks : postBlocks;\n\tconst isEmpty = ! blocks?.length;\n\treturn (\n\t\t<div\n\t\t\tclassName=\"editor-fields-content-preview\"\n\t\t\tstyle={ {\n\t\t\t\tbackgroundColor,\n\t\t\t} }\n\t\t>\n\t\t\t{ isEmpty && (\n\t\t\t\t<span className=\"editor-fields-content-preview__empty\">\n\t\t\t\t\t{ __( 'Empty content' ) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<BlockPreview.Async>\n\t\t\t\t\t<BlockPreview blocks={ blocks } />\n\t\t\t\t</BlockPreview.Async>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default function PostPreviewView( { item }: { item: BasePost } ) {\n\tconst { settings, template } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser, getPostType, getTemplateId, getEntityRecord } =\n\t\t\t\tunlock( select( coreStore ) );\n\t\t\tconst canViewTemplate = canUser( 'read', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} );\n\t\t\tconst _settings = select( editorStore ).getEditorSettings();\n\t\t\t// @ts-ignore\n\t\t\tconst supportsTemplateMode = _settings.supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( item.type )?.viewable ?? false;\n\n\t\t\tconst templateId =\n\t\t\t\tsupportsTemplateMode && isViewable && canViewTemplate\n\t\t\t\t\t? getTemplateId( item.type, item.id )\n\t\t\t\t\t: null;\n\t\t\treturn {\n\t\t\t\tsettings: _settings,\n\t\t\t\ttemplate: templateId\n\t\t\t\t\t? getEntityRecord( 'postType', 'wp_template', templateId )\n\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t},\n\t\t[ item.type, item.id ]\n\t);\n\t// Wrap everything in a block editor provider to ensure 'styles' that are needed\n\t// for the previews are synced between the site editor store and the block editor store.\n\t// Additionally we need to have the `__experimentalBlockPatterns` setting in order to\n\t// render patterns inside the previews.\n\t// TODO: Same approach is used in the patterns list and it becomes obvious that some of\n\t// the block editor settings are needed in context where we don't have the block editor.\n\t// Explore how we can solve this in a better way.\n\treturn (\n\t\t<EditorProvider\n\t\t\tpost={ item }\n\t\t\tsettings={ settings }\n\t\t\t__unstableTemplate={ template }\n\t\t>\n\t\t\t<PostPreviewContainer template={ template } post={ item } />\n\t\t</EditorProvider>\n\t);\n}\n"],
|
|
5
|
+
"mappings": "AA8CE,SAOE,KAPF;AA3CF,SAAS,U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YAAa,KAAK,IAAK,GAAG,YAAY;AAEzD,YAAM,aACL,wBAAwB,cAAc,kBACnC,cAAe,KAAK,MAAM,KAAK,EAAG,IAClC;AACJ,aAAO;AAAA,QACN,UAAU;AAAA,QACV,UAAU,aACP,gBAAiB,YAAY,eAAe,UAAW,IACvD;AAAA,MACJ;AAAA,IACD;AAAA,IACA,CAAE,KAAK,MAAM,KAAK,EAAG;AAAA,EACtB;AAQA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,MAAO;AAAA,MACP;AAAA,MACA,oBAAqB;AAAA,MAErB,8BAAC,wBAAqB,UAAsB,MAAO,MAAO;AAAA;AAAA,EAC3D;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/hooks/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport './custom-sources-backwards-compatibility';\nimport './default-autocompleters';\nimport './media-upload';\nimport './pattern-overrides';\nimport './navigation-link-view-button';\nimport './template-part-navigation-edit-button';\n"],
|
|
5
|
-
"mappings": "AAGA,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;",
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport './custom-sources-backwards-compatibility';\nimport './default-autocompleters';\nimport './media-upload';\nimport './pattern-overrides';\nimport './navigation-link-view-button';\nimport './template-part-navigation-edit-button';\nimport './push-changes-to-global-styles';\n"],
|
|
5
|
+
"mappings": "AAGA,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|