@wordpress/edit-site 6.0.0 → 6.1.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/add-new-page/index.js +2 -1
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/app/index.js +17 -1
- package/build/components/app/index.js.map +1 -1
- package/build/components/editor/index.js +55 -69
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor/use-editor-title.js +39 -0
- package/build/components/editor/use-editor-title.js.map +1 -0
- package/build/components/global-styles/font-library-modal/installed-fonts.js +1 -0
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/screen-css.js +1 -1
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +4 -23
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/shadows-edit-panel.js +1 -0
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build/components/global-styles/variations/variation.js +11 -16
- package/build/components/global-styles/variations/variation.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +2 -1
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +1 -0
- package/build/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build/components/global-styles-sidebar/index.js +2 -0
- package/build/components/global-styles-sidebar/index.js.map +1 -1
- package/build/components/layout/index.js +23 -95
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page/header.js +1 -0
- package/build/components/page/header.js.map +1 -1
- package/build/components/page-patterns/header.js +2 -1
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/index.js +5 -5
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/pagination/index.js +17 -8
- package/build/components/pagination/index.js.map +1 -1
- package/build/components/posts-app/index.js +50 -0
- package/build/components/posts-app/index.js.map +1 -0
- package/build/components/sidebar-dataviews/dataview-item.js +6 -2
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +1 -1
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/site-hub/index.js +38 -128
- package/build/components/site-hub/index.js.map +1 -1
- package/build/hooks/commands/use-set-command-context.js +53 -0
- package/build/hooks/commands/use-set-command-context.js.map +1 -0
- package/build/hooks/push-changes-to-global-styles/index.js +3 -2
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +20 -88
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/index.js +15 -2
- package/build/index.js.map +1 -1
- package/build/posts.js +34 -0
- package/build/posts.js.map +1 -0
- package/build/store/private-actions.js +33 -18
- package/build/store/private-actions.js.map +1 -1
- package/build-module/components/add-new-page/index.js +2 -1
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/app/index.js +17 -1
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/editor/index.js +55 -69
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor/use-editor-title.js +31 -0
- package/build-module/components/editor/use-editor-title.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +1 -0
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +1 -1
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +4 -23
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/shadows-edit-panel.js +1 -0
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build-module/components/global-styles/variations/variation.js +11 -16
- package/build-module/components/global-styles/variations/variation.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +3 -2
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +1 -0
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build-module/components/global-styles-sidebar/index.js +2 -0
- package/build-module/components/global-styles-sidebar/index.js.map +1 -1
- package/build-module/components/layout/index.js +27 -99
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page/header.js +1 -0
- package/build-module/components/page/header.js.map +1 -1
- package/build-module/components/page-patterns/header.js +2 -1
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/index.js +5 -5
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/pagination/index.js +17 -8
- package/build-module/components/pagination/index.js.map +1 -1
- package/build-module/components/posts-app/index.js +43 -0
- package/build-module/components/posts-app/index.js.map +1 -0
- package/build-module/components/sidebar-dataviews/dataview-item.js +6 -2
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +2 -2
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +40 -130
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/hooks/commands/use-set-command-context.js +46 -0
- package/build-module/hooks/commands/use-set-command-context.js.map +1 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js +3 -2
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +19 -86
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/index.js +8 -2
- package/build-module/index.js.map +1 -1
- package/build-module/posts.js +27 -0
- package/build-module/posts.js.map +1 -0
- package/build-module/store/private-actions.js +33 -18
- package/build-module/store/private-actions.js.map +1 -1
- package/build-style/posts-rtl.css +1707 -0
- package/build-style/posts.css +1707 -0
- package/build-style/style-rtl.css +59 -104
- package/build-style/style.css +59 -104
- package/package.json +41 -41
- package/src/components/add-new-page/index.js +2 -1
- package/src/components/app/index.js +17 -1
- package/src/components/block-editor/style.scss +11 -0
- package/src/components/editor/index.js +69 -103
- package/src/components/editor/style.scss +1 -5
- package/src/components/editor/use-editor-title.js +35 -0
- package/src/components/global-styles/font-library-modal/installed-fonts.js +1 -0
- package/src/components/global-styles/screen-css.js +1 -1
- package/src/components/global-styles/screen-revisions/index.js +4 -24
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/src/components/global-styles/screen-revisions/style.scss +4 -8
- package/src/components/global-styles/shadows-edit-panel.js +1 -0
- package/src/components/global-styles/style.scss +1 -7
- package/src/components/global-styles/variations/variation.js +14 -19
- package/src/components/global-styles/variations/variations-color.js +12 -4
- package/src/components/global-styles/variations/variations-typography.js +5 -1
- package/src/components/global-styles-sidebar/index.js +2 -0
- package/src/components/global-styles-sidebar/style.scss +0 -1
- package/src/components/layout/index.js +41 -137
- package/src/components/layout/style.scss +18 -58
- package/src/components/page/header.js +1 -0
- package/src/components/page/style.scss +6 -0
- package/src/components/page-patterns/header.js +8 -2
- package/src/components/page-patterns/index.js +15 -12
- package/src/components/page-patterns/style.scss +6 -0
- package/src/components/pagination/index.js +21 -16
- package/src/components/posts-app/index.js +39 -0
- package/src/components/sidebar/style.scss +4 -4
- package/src/components/sidebar-dataviews/dataview-item.js +6 -2
- package/src/components/sidebar-navigation-screen/index.js +1 -1
- package/src/components/sidebar-navigation-screen/style.scss +2 -2
- package/src/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
- package/src/components/sidebar-navigation-screen-patterns/category-item.js +11 -2
- package/src/components/sidebar-navigation-screen-patterns/index.js +5 -1
- package/src/components/site-hub/index.js +55 -146
- package/src/components/site-hub/style.scss +1 -4
- package/src/components/site-icon/style.scss +0 -4
- package/src/hooks/commands/use-set-command-context.js +37 -0
- package/src/hooks/push-changes-to-global-styles/index.js +3 -2
- package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +1 -875
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +29 -117
- package/src/index.js +10 -2
- package/src/posts.js +29 -0
- package/src/posts.scss +46 -0
- package/src/store/private-actions.js +58 -30
- package/build/components/block-editor/block-inspector-button.js +0 -57
- package/build/components/block-editor/block-inspector-button.js.map +0 -1
- package/build/components/block-editor/inserter-media-categories.js +0 -183
- package/build/components/block-editor/inserter-media-categories.js.map +0 -1
- package/build/components/template-part-converter/convert-to-regular.js +0 -38
- package/build/components/template-part-converter/convert-to-regular.js.map +0 -1
- package/build/components/template-part-converter/convert-to-template-part.js +0 -84
- package/build/components/template-part-converter/convert-to-template-part.js.map +0 -1
- package/build/components/template-part-converter/index.js +0 -67
- package/build/components/template-part-converter/index.js.map +0 -1
- package/build-module/components/block-editor/block-inspector-button.js +0 -50
- package/build-module/components/block-editor/block-inspector-button.js.map +0 -1
- package/build-module/components/block-editor/inserter-media-categories.js +0 -177
- package/build-module/components/block-editor/inserter-media-categories.js.map +0 -1
- package/build-module/components/template-part-converter/convert-to-regular.js +0 -31
- package/build-module/components/template-part-converter/convert-to-regular.js.map +0 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +0 -79
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +0 -1
- package/build-module/components/template-part-converter/index.js +0 -59
- package/build-module/components/template-part-converter/index.js.map +0 -1
- package/src/components/block-editor/block-inspector-button.js +0 -60
- package/src/components/block-editor/inserter-media-categories.js +0 -227
- package/src/components/template-part-converter/convert-to-regular.js +0 -32
- package/src/components/template-part-converter/convert-to-template-part.js +0 -78
- package/src/components/template-part-converter/index.js +0 -59
package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_coreData","_element","_blockEditor","_editor","_i18n","_cloneDeep","_interopRequireDefault","_lockUnlock","GlobalStylesContext","unlock","blockEditorPrivateApis","mergeBaseAndUserConfigs","editorPrivateApis","removePropertyFromObject","object","property","Object","keys","length","key","useCurrentMergeThemeStyleVariationsWithUserConfig","filter","variationsFromTheme","useSelect","select","_variationsFromTheme","coreStore","__experimentalGetCurrentThemeGlobalStylesVariations","user","baseVariation","useContext","variations","useMemo","title","__","settings","styles","useThemeStyleVariationsByProperty","cloneDeep","filterObjectByProperty","newObject","forEach","newFilter","exports","clonedBaseVariation","processedStyleVariations","reduce","accumulator","variation","variationFilteredByProperty","result","description","isDuplicate","some","item","JSON","stringify","push","isVariationWithSingleProperty","variationWithProperty"],"sources":["@wordpress/edit-site/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport cloneDeep from '../../utils/clone-deep';\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\nconst { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );\n\n/**\n * Removes all instances of a property from an object.\n *\n * @param {Object} object The object to remove the property from.\n * @param {string} property The property to remove.\n * @return {Object} The modified object.\n */\nexport function removePropertyFromObject( object, property ) {\n\tif ( ! property || typeof property !== 'string' ) {\n\t\treturn object;\n\t}\n\n\tif (\n\t\ttypeof object !== 'object' ||\n\t\t! object ||\n\t\t! Object.keys( object ).length\n\t) {\n\t\treturn object;\n\t}\n\n\tfor ( const key in object ) {\n\t\tif ( key === property ) {\n\t\t\tdelete object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tremovePropertyFromObject( object[ key ], property );\n\t\t}\n\t}\n\treturn object;\n}\n\n/**\n * A convenience wrapper for `useThemeStyleVariationsByProperty()` that fetches the current theme style variations,\n * and user-defined global style/settings object.\n *\n * @param {Object} props Object of hook args.\n * @param {string} props.property The property to filter by.\n * @param {Function} props.filter Optional. The filter function to apply to the variations.\n * @return {Object[]|*} The merged object.\n */\nexport function useCurrentMergeThemeStyleVariationsWithUserConfig( {\n\tproperty,\n\tfilter,\n} ) {\n\tconst { variationsFromTheme } = useSelect( ( select ) => {\n\t\tconst _variationsFromTheme =\n\t\t\tselect(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations();\n\n\t\treturn {\n\t\t\tvariationsFromTheme: _variationsFromTheme || [],\n\t\t};\n\t}, [] );\n\tconst { user: baseVariation } = useContext( GlobalStylesContext );\n\n\tconst variations = useMemo( () => {\n\t\treturn [\n\t\t\t{\n\t\t\t\ttitle: __( 'Default' ),\n\t\t\t\tsettings: {},\n\t\t\t\tstyles: {},\n\t\t\t},\n\t\t\t...variationsFromTheme,\n\t\t];\n\t}, [ variationsFromTheme ] );\n\n\treturn useThemeStyleVariationsByProperty( {\n\t\tvariations,\n\t\tproperty,\n\t\tfilter,\n\t\tbaseVariation: removePropertyFromObject(\n\t\t\tcloneDeep( baseVariation ),\n\t\t\tproperty\n\t\t),\n\t} );\n}\n\n/**\n * Returns a new object, with properties specified in `property`,\n * maintain the original object tree structure.\n * The function is recursive, so it will perform a deep search for the given property.\n * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the property is `test`.\n *\n * @param {Object} object The object to filter\n * @param {Object} property The property to filter by\n * @return {Object} The merged object.\n */\nexport const filterObjectByProperty = ( object, property ) => {\n\tif ( ! object ) {\n\t\treturn {};\n\t}\n\n\tconst newObject = {};\n\tObject.keys( object ).forEach( ( key ) => {\n\t\tif ( key === property ) {\n\t\t\tnewObject[ key ] = object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tconst newFilter = filterObjectByProperty( object[ key ], property );\n\t\t\tif ( Object.keys( newFilter ).length ) {\n\t\t\t\tnewObject[ key ] = newFilter;\n\t\t\t}\n\t\t}\n\t} );\n\treturn newObject;\n};\n\n/**\n * Returns a new object with only the properties specified in `property`.\n * Optional merges the baseVariation object with the variation object.\n * Note: this function will only overwrite the specified property in baseVariation if it exists.\n * The baseVariation will not be otherwise modified. To strip a property from the baseVariation object, use `removePropertyFromObject`.\n * See useCurrentMergeThemeStyleVariationsWithUserConfig for an example of how to use this function.\n *\n * @param {Object} props Object of hook args.\n * @param {Object[]} props.variations The theme style variations to filter.\n * @param {string} props.property The property to filter by.\n * @param {Function} props.filter Optional. The filter function to apply to the variations.\n * @param {Object} props.baseVariation Optional. Base or user settings to be updated with variation properties.\n * @return {Object[]|*} The merged object.\n */\nexport default function useThemeStyleVariationsByProperty( {\n\tvariations,\n\tproperty,\n\tfilter,\n\tbaseVariation,\n} ) {\n\treturn useMemo( () => {\n\t\tif ( ! property || ! variations || variations?.length === 0 ) {\n\t\t\treturn variations;\n\t\t}\n\n\t\tconst clonedBaseVariation =\n\t\t\ttypeof baseVariation === 'object' &&\n\t\t\tObject.keys( baseVariation ).length > 0\n\t\t\t\t? cloneDeep( baseVariation )\n\t\t\t\t: null;\n\n\t\tlet processedStyleVariations = variations.reduce(\n\t\t\t( accumulator, variation ) => {\n\t\t\t\tconst variationFilteredByProperty = filterObjectByProperty(\n\t\t\t\t\tcloneDeep( variation ),\n\t\t\t\t\tproperty\n\t\t\t\t);\n\n\t\t\t\t// Remove variations that are empty once the property is filtered out.\n\t\t\t\tif (\n\t\t\t\t\tvariation.title !== __( 'Default' ) &&\n\t\t\t\t\tObject.keys( variationFilteredByProperty ).length === 0\n\t\t\t\t) {\n\t\t\t\t\treturn accumulator;\n\t\t\t\t}\n\n\t\t\t\tlet result = {\n\t\t\t\t\t...variationFilteredByProperty,\n\t\t\t\t\ttitle: variation?.title,\n\t\t\t\t\tdescription: variation?.description,\n\t\t\t\t};\n\n\t\t\t\tif ( clonedBaseVariation ) {\n\t\t\t\t\t/*\n\t\t\t\t\t * Overwrites all baseVariation object `styleProperty` properties\n\t\t\t\t\t * with the theme variation `styleProperty` properties.\n\t\t\t\t\t */\n\t\t\t\t\tresult = mergeBaseAndUserConfigs(\n\t\t\t\t\t\tclonedBaseVariation,\n\t\t\t\t\t\tresult\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Detect if this is a duplicate variation.\n\t\t\t\tconst isDuplicate = accumulator.some( ( item ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\tJSON.stringify( item.styles ) ===\n\t\t\t\t\t\t\tJSON.stringify( result?.styles ) &&\n\t\t\t\t\t\tJSON.stringify( item.settings ) ===\n\t\t\t\t\t\t\tJSON.stringify( result?.settings )\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t\tif ( isDuplicate ) {\n\t\t\t\t\treturn accumulator;\n\t\t\t\t}\n\n\t\t\t\t// If the variation is not a duplicate, add it to the accumulator.\n\t\t\t\taccumulator.push( result );\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t[] // Initial accumulator value.\n\t\t);\n\n\t\tif ( 'function' === typeof filter ) {\n\t\t\tprocessedStyleVariations =\n\t\t\t\tprocessedStyleVariations.filter( filter );\n\t\t}\n\n\t\treturn processedStyleVariations;\n\t}, [ variations, property, baseVariation, filter ] );\n}\n\n/**\n * Compares a style variation to the same variation filtered by a single property.\n * Returns true if the variation contains only the property specified.\n *\n * @param {Object} variation The variation to compare.\n * @param {string} property The property to compare.\n * @return {boolean} Whether the variation contains only a single property.\n */\nexport function isVariationWithSingleProperty( variation, property ) {\n\tconst variationWithProperty = filterObjectByProperty(\n\t\tcloneDeep( variation ),\n\t\tproperty\n\t);\n\n\treturn (\n\t\tJSON.stringify( variationWithProperty?.styles ) ===\n\t\t\tJSON.stringify( variation?.styles ) &&\n\t\tJSON.stringify( variationWithProperty?.settings ) ===\n\t\t\tJSON.stringify( variation?.settings )\n\t);\n}\n"],"mappings":";;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,UAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAdA;AACA;AACA;;AAQA;AACA;AACA;;AAIA,MAAM;EAAES;AAAoB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAChE,MAAM;EAAEC;AAAwB,CAA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KAC9BoB,IAAI,CAACC,SAAS,CAAEN,MAAM,EAAEf,QAAS,CAAC;MAErC,CAAE,CAAC;MACH,IAAKiB,WAAW,EAAG;QAClB,OAAOL,WAAW;MACnB;;MAEA;MACAA,WAAW,CAACU,IAAI,CAAEP,MAAO,CAAC;MAC1B,OAAOH,WAAW;IACnB,CAAC,EACD,EAAE,CAAC;IACJ,CAAC;IAED,IAAK,UAAU,KAAK,OAAO1B,MAAM,EAAG;MACnCwB,wBAAwB,GACvBA,wBAAwB,CAACxB,MAAM,CAAEA,MAAO,CAAC;IAC3C;IAEA,OAAOwB,wBAAwB;EAChC,CAAC,EAAE,CAAEd,UAAU,EAAEhB,QAAQ,EAAEc,aAAa,EAAER,MAAM,CAAG,CAAC;AACrD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASqC,6BAA6BA,CAAEV,SAAS,EAAEjC,QAAQ,EAAG;EACpE,MAAM4C,qBAAqB,GAAGpB,sBAAsB,CACnD,IAAAD,kBAAS,EAAEU,SAAU,CAAC,EACtBjC,QACD,CAAC;EAED,OACCwC,IAAI,CAACC,SAAS,CAAEG,qBAAqB,EAAEvB,MAAO,CAAC,KAC9CmB,IAAI,CAACC,SAAS,CAAER,SAAS,EAAEZ,MAAO,CAAC,IACpCmB,IAAI,CAACC,SAAS,CAAEG,qBAAqB,EAAExB,QAAS,CAAC,KAChDoB,IAAI,CAACC,SAAS,CAAER,SAAS,EAAEb,QAAS,CAAC;AAExC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_data","require","_coreData","_element","_blockEditor","_editor","_i18n","_cloneDeep","_interopRequireDefault","_lockUnlock","GlobalStylesContext","unlock","blockEditorPrivateApis","mergeBaseAndUserConfigs","editorPrivateApis","removePropertyFromObject","object","property","Object","keys","length","key","useCurrentMergeThemeStyleVariationsWithUserConfig","variationsFromTheme","useSelect","select","_variationsFromTheme","coreStore","__experimentalGetCurrentThemeGlobalStylesVariations","user","userVariation","useContext","useMemo","clonedUserVariation","cloneDeep","userVariationWithoutProperty","title","__","variationsWithSinglePropertyAndBase","filter","variation","isVariationWithSingleProperty","map","filterObjectByProperty","newObject","forEach","newFilter","exports","variationWithProperty","JSON","stringify","styles","settings"],"sources":["@wordpress/edit-site/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport cloneDeep from '../../utils/clone-deep';\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\nconst { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );\n\n/**\n * Removes all instances of a property from an object.\n *\n * @param {Object} object The object to remove the property from.\n * @param {string} property The property to remove.\n * @return {Object} The modified object.\n */\nexport function removePropertyFromObject( object, property ) {\n\tif ( ! property || typeof property !== 'string' ) {\n\t\treturn object;\n\t}\n\n\tif (\n\t\ttypeof object !== 'object' ||\n\t\t! object ||\n\t\t! Object.keys( object ).length\n\t) {\n\t\treturn object;\n\t}\n\n\tfor ( const key in object ) {\n\t\tif ( key === property ) {\n\t\t\tdelete object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tremovePropertyFromObject( object[ key ], property );\n\t\t}\n\t}\n\treturn object;\n}\n\n/**\n * Fetches the current theme style variations that contain only the specified property\n * and merges them with the user config.\n *\n * @param {Object} props Object of hook args.\n * @param {string} props.property The property to filter by.\n * @return {Object[]|*} The merged object.\n */\nexport function useCurrentMergeThemeStyleVariationsWithUserConfig( {\n\tproperty,\n} ) {\n\tconst { variationsFromTheme } = useSelect( ( select ) => {\n\t\tconst _variationsFromTheme =\n\t\t\tselect(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations();\n\n\t\treturn {\n\t\t\tvariationsFromTheme: _variationsFromTheme || [],\n\t\t};\n\t}, [] );\n\tconst { user: userVariation } = useContext( GlobalStylesContext );\n\n\treturn useMemo( () => {\n\t\tconst clonedUserVariation = cloneDeep( userVariation );\n\n\t\t// Get user variation and remove the settings for the given property.\n\t\tconst userVariationWithoutProperty = removePropertyFromObject(\n\t\t\tclonedUserVariation,\n\t\t\tproperty\n\t\t);\n\t\tuserVariationWithoutProperty.title = __( 'Default' );\n\n\t\tconst variationsWithSinglePropertyAndBase = variationsFromTheme\n\t\t\t.filter( ( variation ) => {\n\t\t\t\treturn isVariationWithSingleProperty( variation, property );\n\t\t\t} )\n\t\t\t.map( ( variation ) => {\n\t\t\t\treturn mergeBaseAndUserConfigs(\n\t\t\t\t\tuserVariationWithoutProperty,\n\t\t\t\t\tvariation\n\t\t\t\t);\n\t\t\t} );\n\n\t\treturn [\n\t\t\tuserVariationWithoutProperty,\n\t\t\t...variationsWithSinglePropertyAndBase,\n\t\t];\n\t}, [ property, userVariation, variationsFromTheme ] );\n}\n\n/**\n * Returns a new object, with properties specified in `property`,\n * maintain the original object tree structure.\n * The function is recursive, so it will perform a deep search for the given property.\n * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the property is `test`.\n *\n * @param {Object} object The object to filter\n * @param {Object} property The property to filter by\n * @return {Object} The merged object.\n */\nexport const filterObjectByProperty = ( object, property ) => {\n\tif ( ! object ) {\n\t\treturn {};\n\t}\n\n\tconst newObject = {};\n\tObject.keys( object ).forEach( ( key ) => {\n\t\tif ( key === property ) {\n\t\t\tnewObject[ key ] = object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tconst newFilter = filterObjectByProperty( object[ key ], property );\n\t\t\tif ( Object.keys( newFilter ).length ) {\n\t\t\t\tnewObject[ key ] = newFilter;\n\t\t\t}\n\t\t}\n\t} );\n\treturn newObject;\n};\n\n/**\n * Compares a style variation to the same variation filtered by a single property.\n * Returns true if the variation contains only the property specified.\n *\n * @param {Object} variation The variation to compare.\n * @param {string} property The property to compare.\n * @return {boolean} Whether the variation contains only a single property.\n */\nexport function isVariationWithSingleProperty( variation, property ) {\n\tconst variationWithProperty = filterObjectByProperty(\n\t\tcloneDeep( variation ),\n\t\tproperty\n\t);\n\n\treturn (\n\t\tJSON.stringify( variationWithProperty?.styles ) ===\n\t\t\tJSON.stringify( variation?.styles ) &&\n\t\tJSON.stringify( variationWithProperty?.settings ) ===\n\t\t\tJSON.stringify( variation?.settings )\n\t);\n}\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,UAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAdA;AACA;AACA;;AAQA;AACA;AACA;;AAIA,MAAM;EAAES;AAAoB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAChE,MAAM;EAAEC;AAAwB,CAAC,GAAG,IAAAF,kBAAM,EAAEG,mBAAkB,CAAC;;AAE/D;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,wBAAwBA,CAAEC,MAAM,EAAEC,QAAQ,EAAG;EAC5D,IAAK,CAAEA,QAAQ,IAAI,OAAOA,QAAQ,KAAK,QAAQ,EAAG;IACjD,OAAOD,MAAM;EACd;EAEA,IACC,OAAOA,MAAM,KAAK,QAAQ,IAC1B,CAAEA,MAAM,IACR,CAAEE,MAAM,CAACC,IAAI,CAAEH,MAAO,CAAC,CAACI,MAAM,EAC7B;IACD,OAAOJ,MAAM;EACd;EAEA,KAAM,MAAMK,GAAG,IAAIL,MAAM,EAAG;IAC3B,IAAK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AS,CAAC,KAChDH,IAAI,CAACC,SAAS,CAAEV,SAAS,EAAEY,QAAS,CAAC;AAExC","ignoreList":[]}
|
package/build/index.js
CHANGED
|
@@ -8,7 +8,8 @@ var _exportNames = {
|
|
|
8
8
|
initializeEditor: true,
|
|
9
9
|
reinitializeEditor: true,
|
|
10
10
|
store: true,
|
|
11
|
-
PluginTemplateSettingPanel: true
|
|
11
|
+
PluginTemplateSettingPanel: true,
|
|
12
|
+
initializePostsDashboard: true
|
|
12
13
|
};
|
|
13
14
|
Object.defineProperty(exports, "PluginTemplateSettingPanel", {
|
|
14
15
|
enumerable: true,
|
|
@@ -17,6 +18,12 @@ Object.defineProperty(exports, "PluginTemplateSettingPanel", {
|
|
|
17
18
|
}
|
|
18
19
|
});
|
|
19
20
|
exports.initializeEditor = initializeEditor;
|
|
21
|
+
Object.defineProperty(exports, "initializePostsDashboard", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _posts.initializePostsDashboard;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
20
27
|
exports.reinitializeEditor = reinitializeEditor;
|
|
21
28
|
Object.defineProperty(exports, "store", {
|
|
22
29
|
enumerable: true,
|
|
@@ -49,6 +56,7 @@ Object.keys(_deprecated2).forEach(function (key) {
|
|
|
49
56
|
}
|
|
50
57
|
});
|
|
51
58
|
});
|
|
59
|
+
var _posts = require("./posts");
|
|
52
60
|
/**
|
|
53
61
|
* WordPress dependencies
|
|
54
62
|
*/
|
|
@@ -118,7 +126,9 @@ function initializeEditor(id, settings) {
|
|
|
118
126
|
// Prevent the default browser action for files dropped outside of dropzones.
|
|
119
127
|
window.addEventListener('dragover', e => e.preventDefault(), false);
|
|
120
128
|
window.addEventListener('drop', e => e.preventDefault(), false);
|
|
121
|
-
root.render( /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
129
|
+
root.render( /*#__PURE__*/(0, _jsxRuntime.jsx)(_element.StrictMode, {
|
|
130
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_app.default, {})
|
|
131
|
+
}));
|
|
122
132
|
return root;
|
|
123
133
|
}
|
|
124
134
|
function reinitializeEditor() {
|
|
@@ -127,4 +137,7 @@ function reinitializeEditor() {
|
|
|
127
137
|
version: '6.3'
|
|
128
138
|
});
|
|
129
139
|
}
|
|
140
|
+
|
|
141
|
+
// Temporary: While the posts dashboard is being iterated on
|
|
142
|
+
// it's being built in the same package as the site editor.
|
|
130
143
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_blockLibrary","_data","_deprecated","_interopRequireDefault","_element","_editor","_preferences","_widgets","_store","_app","_jsxRuntime","_pluginTemplateSettingPanel","_deprecated2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","initializeEditor","id","settings","target","document","getElementById","root","createRoot","dispatch","blocksStore","reapplyBlockTypeFilters","coreBlocks","__experimentalGetCoreBlocks","filter","name","registerCoreBlocks","setFreeformFallbackBlockName","registerLegacyWidgetBlock","inserter","registerWidgetGroupBlock","globalThis","IS_GUTENBERG_PLUGIN","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","preferencesStore","setDefaults","welcomeGuide","welcomeGuideStyles","welcomeGuidePage","welcomeGuideTemplate","allowRightClickOverrides","distractionFree","editorMode","fixedToolbar","focusMode","inactivePanels","keepCaretInsideBlock","openPanels","showBlockBreadcrumbs","showListViewByDefault","editSiteStore","updateSettings","editorStore","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","render","jsx","default","reinitializeEditor","deprecated","since","version"],"sources":["@wordpress/edit-site/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport App from './components/app';\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\twelcomeGuidePage: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\tdistractionFree: false,\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tinactivePanels: [],\n\t\tkeepCaretInsideBlock: false,\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowListViewByDefault: false,\n\t} );\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t// so that they can be selected with core/editor selectors in any editor.\n\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t// which internally uses updateEditorSettings as well.\n\tdispatch( editorStore ).updateEditorSettings( {\n\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t} );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(
|
|
1
|
+
{"version":3,"names":["_blocks","require","_blockLibrary","_data","_deprecated","_interopRequireDefault","_element","_editor","_preferences","_widgets","_store","_app","_jsxRuntime","_pluginTemplateSettingPanel","_deprecated2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_posts","initializeEditor","id","settings","target","document","getElementById","root","createRoot","dispatch","blocksStore","reapplyBlockTypeFilters","coreBlocks","__experimentalGetCoreBlocks","filter","name","registerCoreBlocks","setFreeformFallbackBlockName","registerLegacyWidgetBlock","inserter","registerWidgetGroupBlock","globalThis","IS_GUTENBERG_PLUGIN","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","preferencesStore","setDefaults","welcomeGuide","welcomeGuideStyles","welcomeGuidePage","welcomeGuideTemplate","allowRightClickOverrides","distractionFree","editorMode","fixedToolbar","focusMode","inactivePanels","keepCaretInsideBlock","openPanels","showBlockBreadcrumbs","showListViewByDefault","editSiteStore","updateSettings","editorStore","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","render","jsx","StrictMode","children","default","reinitializeEditor","deprecated","since","version"],"sources":["@wordpress/edit-site/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot, StrictMode } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport App from './components/app';\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\twelcomeGuidePage: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\tdistractionFree: false,\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tinactivePanels: [],\n\t\tkeepCaretInsideBlock: false,\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowListViewByDefault: false,\n\t} );\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t// so that they can be selected with core/editor selectors in any editor.\n\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t// which internally uses updateEditorSettings as well.\n\tdispatch( editorStore ).updateEditorSettings( {\n\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t} );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<App />\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editSite.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginTemplateSettingPanel } from './components/plugin-template-setting-panel';\nexport { store } from './store';\nexport * from './deprecated';\n\n// Temporary: While the posts dashboard is being iterated on\n// it's being built in the same package as the site editor.\nexport { initializePostsDashboard } from './posts';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAQAA,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,IAAA,GAAAN,sBAAA,CAAAJ,OAAA;AAAmC,IAAAW,WAAA,GAAAX,OAAA;AA+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E,QAAA,CAAA0E,UAAU;IAAAC,QAAA,eACV,IAAArE,WAAA,CAAAmE,GAAA,EAACpE,IAAA,CAAAuE,OAAG,IAAE;EAAC,CACI,CACb,CAAC;EAED,OAAOhD,IAAI;AACZ;AAEO,SAASiD,kBAAkBA,CAAA,EAAG;EACpC,IAAAC,mBAAU,EAAE,gCAAgC,EAAE;IAC7CC,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAMA;AACA","ignoreList":[]}
|
package/build/posts.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.initializePostsDashboard = initializePostsDashboard;
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
var _postsApp = _interopRequireDefault(require("./components/posts-app"));
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
/**
|
|
12
|
+
* WordPress dependencies
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Initializes the "Posts Dashboard"
|
|
21
|
+
* @param {string} id DOM element id.
|
|
22
|
+
*/
|
|
23
|
+
function initializePostsDashboard(id) {
|
|
24
|
+
if (!globalThis.IS_GUTENBERG_PLUGIN) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const target = document.getElementById(id);
|
|
28
|
+
const root = (0, _element.createRoot)(target);
|
|
29
|
+
root.render( /*#__PURE__*/(0, _jsxRuntime.jsx)(_element.StrictMode, {
|
|
30
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_postsApp.default, {})
|
|
31
|
+
}));
|
|
32
|
+
return root;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=posts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_element","require","_postsApp","_interopRequireDefault","_jsxRuntime","initializePostsDashboard","id","globalThis","IS_GUTENBERG_PLUGIN","target","document","getElementById","root","createRoot","render","jsx","StrictMode","children","default"],"sources":["@wordpress/edit-site/src/posts.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createRoot, StrictMode } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport PostsApp from './components/posts-app';\n\n/**\n * Initializes the \"Posts Dashboard\"\n * @param {string} id DOM element id.\n */\nexport function initializePostsDashboard( id ) {\n\tif ( ! globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\treturn;\n\t}\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<PostsApp />\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA8C,IAAAG,WAAA,GAAAH,OAAA;AAR9C;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACO,SAASI,wBAAwBA,CAAEC,EAAE,EAAG;EAC9C,IAAK,CAAEC,UAAU,CAACC,mBAAmB,EAAG;IACvC;EACD;EACA,MAAMC,MAAM,GAAGC,QAAQ,CAACC,cAAc,CAAEL,EAAG,CAAC;EAC5C,MAAMM,IAAI,GAAG,IAAAC,mBAAU,EAAEJ,MAAO,CAAC;EAEjCG,IAAI,CAACE,MAAM,eACV,IAAAV,WAAA,CAAAW,GAAA,EAACf,QAAA,CAAAgB,UAAU;IAAAC,QAAA,eACV,IAAAb,WAAA,CAAAW,GAAA,EAACb,SAAA,CAAAgB,OAAQ,IAAE;EAAC,CACD,CACb,CAAC;EAED,OAAON,IAAI;AACZ","ignoreList":[]}
|
|
@@ -20,27 +20,42 @@ const setCanvasMode = mode => ({
|
|
|
20
20
|
registry,
|
|
21
21
|
dispatch
|
|
22
22
|
}) => {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
const switchCanvasMode = () => {
|
|
24
|
+
registry.batch(() => {
|
|
25
|
+
const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches;
|
|
26
|
+
registry.dispatch(_blockEditor.store).clearSelectedBlock();
|
|
27
|
+
registry.dispatch(_editor.store).setDeviceType('Desktop');
|
|
28
|
+
registry.dispatch(_blockEditor.store).__unstableSetEditorMode('edit');
|
|
29
|
+
const isPublishSidebarOpened = registry.select(_editor.store).isPublishSidebarOpened();
|
|
30
|
+
dispatch({
|
|
31
|
+
type: 'SET_CANVAS_MODE',
|
|
32
|
+
mode
|
|
33
|
+
});
|
|
34
|
+
const isEditMode = mode === 'edit';
|
|
35
|
+
if (isPublishSidebarOpened && !isEditMode) {
|
|
36
|
+
registry.dispatch(_editor.store).closePublishSidebar();
|
|
37
|
+
}
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
// Check if the block list view should be open by default.
|
|
40
|
+
// If `distractionFree` mode is enabled, the block list view should not be open.
|
|
41
|
+
// This behavior is disabled for small viewports.
|
|
42
|
+
if (isMediumOrBigger && isEditMode && registry.select(_preferences.store).get('core', 'showListViewByDefault') && !registry.select(_preferences.store).get('core', 'distractionFree')) {
|
|
43
|
+
registry.dispatch(_editor.store).setIsListViewOpened(true);
|
|
44
|
+
} else {
|
|
45
|
+
registry.dispatch(_editor.store).setIsListViewOpened(false);
|
|
46
|
+
}
|
|
47
|
+
registry.dispatch(_editor.store).setIsInserterOpened(false);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
if (!document.startViewTransition) {
|
|
51
|
+
switchCanvasMode();
|
|
40
52
|
} else {
|
|
41
|
-
|
|
53
|
+
document.documentElement.classList.add(`canvas-mode-${mode}-transition`);
|
|
54
|
+
const transition = document.startViewTransition(() => switchCanvasMode());
|
|
55
|
+
transition.finished.finally(() => {
|
|
56
|
+
document.documentElement.classList.remove(`canvas-mode-${mode}-transition`);
|
|
57
|
+
});
|
|
42
58
|
}
|
|
43
|
-
registry.dispatch(_editor.store).setIsInserterOpened(false);
|
|
44
59
|
};
|
|
45
60
|
|
|
46
61
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_preferences","_editor","setCanvasMode","mode","registry","dispatch","isMediumOrBigger","window","matchMedia","matches","blockEditorStore","__unstableSetEditorMode","isPublishSidebarOpened","select","
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_preferences","_editor","setCanvasMode","mode","registry","dispatch","switchCanvasMode","batch","isMediumOrBigger","window","matchMedia","matches","blockEditorStore","clearSelectedBlock","editorStore","setDeviceType","__unstableSetEditorMode","isPublishSidebarOpened","select","type","isEditMode","closePublishSidebar","preferencesStore","get","setIsListViewOpened","setIsInserterOpened","document","startViewTransition","documentElement","classList","add","transition","finished","finally","remove","exports","setEditorCanvasContainerView","view"],"sources":["@wordpress/edit-site/src/store/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch } ) => {\n\t\tconst switchCanvasMode = () => {\n\t\t\tregistry.batch( () => {\n\t\t\t\tconst isMediumOrBigger =\n\t\t\t\t\twindow.matchMedia( '(min-width: 782px)' ).matches;\n\t\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t\t\tregistry.dispatch( editorStore ).setDeviceType( 'Desktop' );\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( blockEditorStore )\n\t\t\t\t\t.__unstableSetEditorMode( 'edit' );\n\t\t\t\tconst isPublishSidebarOpened = registry\n\t\t\t\t\t.select( editorStore )\n\t\t\t\t\t.isPublishSidebarOpened();\n\t\t\t\tdispatch( {\n\t\t\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\t\t\tmode,\n\t\t\t\t} );\n\t\t\t\tconst isEditMode = mode === 'edit';\n\t\t\t\tif ( isPublishSidebarOpened && ! isEditMode ) {\n\t\t\t\t\tregistry.dispatch( editorStore ).closePublishSidebar();\n\t\t\t\t}\n\n\t\t\t\t// Check if the block list view should be open by default.\n\t\t\t\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t\t\t\t// This behavior is disabled for small viewports.\n\t\t\t\tif (\n\t\t\t\t\tisMediumOrBigger &&\n\t\t\t\t\tisEditMode &&\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.select( preferencesStore )\n\t\t\t\t\t\t.get( 'core', 'showListViewByDefault' ) &&\n\t\t\t\t\t! registry\n\t\t\t\t\t\t.select( preferencesStore )\n\t\t\t\t\t\t.get( 'core', 'distractionFree' )\n\t\t\t\t) {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( editorStore )\n\t\t\t\t\t\t.setIsListViewOpened( true );\n\t\t\t\t} else {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( editorStore )\n\t\t\t\t\t\t.setIsListViewOpened( false );\n\t\t\t\t}\n\t\t\t\tregistry.dispatch( editorStore ).setIsInserterOpened( false );\n\t\t\t} );\n\t\t};\n\n\t\tif ( ! document.startViewTransition ) {\n\t\t\tswitchCanvasMode();\n\t\t} else {\n\t\t\tdocument.documentElement.classList.add(\n\t\t\t\t`canvas-mode-${ mode }-transition`\n\t\t\t);\n\t\t\tconst transition = document.startViewTransition( () =>\n\t\t\t\tswitchCanvasMode()\n\t\t\t);\n\t\t\ttransition.finished.finally( () => {\n\t\t\t\tdocument.documentElement.classList.remove(\n\t\t\t\t\t`canvas-mode-${ mode }-transition`\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',\n\t\t\tview,\n\t\t} );\n\t};\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACO,MAAMG,aAAa,GACvBC,IAAI,IACN,CAAE;EAAEC,QAAQ;EAAEC;AAAS,CAAC,KAAM;EAC7B,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;IAC9BF,QAAQ,CAACG,KAAK,CAAE,MAAM;MACrB,MAAMC,gBAAgB,GACrBC,MAAM,CAACC,UAAU,CAAE,oBAAqB,CAAC,CAACC,OAAO;MAClDP,QAAQ,CAACC,QAAQ,CAAEO,kBAAiB,CAAC,CAACC,kBAAkB,CAAC,CAAC;MAC1DT,QAAQ,CAACC,QAAQ,CAAES,aAAY,CAAC,CAACC,aAAa,CAAE,SAAU,CAAC;MAC3DX,QAAQ,CACNC,QAAQ,CAAEO,kBAAiB,CAAC,CAC5BI,uBAAuB,CAAE,MAAO,CAAC;MACnC,MAAMC,sBAAsB,GAAGb,QAAQ,CACrCc,MAAM,CAAEJ,aAAY,CAAC,CACrBG,sBAAsB,CAAC,CAAC;MAC1BZ,QAAQ,CAAE;QACTc,IAAI,EAAE,iBAAiB;QACvBhB;MACD,CAAE,CAAC;MACH,MAAMiB,UAAU,GAAGjB,IAAI,KAAK,MAAM;MAClC,IAAKc,sBAAsB,IAAI,CAAEG,UAAU,EAAG;QAC7ChB,QAAQ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;IACxCkB;EACD,CAAE,CAAC;AACJ,CAAC;AAACF,OAAA,CAAAC,4BAAA,GAAAA,4BAAA","ignoreList":[]}
|
|
@@ -7,6 +7,7 @@ import { useDispatch } from '@wordpress/data';
|
|
|
7
7
|
import { useState } from '@wordpress/element';
|
|
8
8
|
import { store as coreStore } from '@wordpress/core-data';
|
|
9
9
|
import { store as noticesStore } from '@wordpress/notices';
|
|
10
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
13
|
export default function AddNewPageModal({
|
|
@@ -39,7 +40,7 @@ export default function AddNewPageModal({
|
|
|
39
40
|
onSave(newPage);
|
|
40
41
|
createSuccessNotice(sprintf(
|
|
41
42
|
// translators: %s: Title of the created template e.g: "Category".
|
|
42
|
-
__('"%s" successfully created.'), newPage.title?.rendered || title), {
|
|
43
|
+
__('"%s" successfully created.'), decodeEntities(newPage.title?.rendered || title)), {
|
|
43
44
|
type: 'snackbar'
|
|
44
45
|
});
|
|
45
46
|
} catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Button","Modal","__experimentalHStack","HStack","__experimentalVStack","VStack","TextControl","__","sprintf","useDispatch","useState","store","coreStore","noticesStore","jsx","_jsx","jsxs","_jsxs","AddNewPageModal","onSave","onClose","isCreatingPage","setIsCreatingPage","title","setTitle","saveEntityRecord","createErrorNotice","createSuccessNotice","createPage","event","preventDefault","newPage","status","slug","throwOnError","rendered","type","error","errorMessage","message","code","onRequestClose","children","onSubmit","spacing","__next40pxDefaultSize","label","onChange","placeholder","value","justify","variant","onClick","isBusy"],"sources":["@wordpress/edit-site/src/components/add-new-page/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tTextControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function AddNewPageModal( { onSave, onClose } ) {\n\tconst [ isCreatingPage, setIsCreatingPage ] = useState( false );\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tasync function createPage( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isCreatingPage ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsCreatingPage( true );\n\t\ttry {\n\t\t\tconst newPage = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'page',\n\t\t\t\t{\n\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\ttitle,\n\t\t\t\t\tslug: title || __( 'No title' ),\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\tonSave( newPage );\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\
|
|
1
|
+
{"version":3,"names":["Button","Modal","__experimentalHStack","HStack","__experimentalVStack","VStack","TextControl","__","sprintf","useDispatch","useState","store","coreStore","noticesStore","decodeEntities","jsx","_jsx","jsxs","_jsxs","AddNewPageModal","onSave","onClose","isCreatingPage","setIsCreatingPage","title","setTitle","saveEntityRecord","createErrorNotice","createSuccessNotice","createPage","event","preventDefault","newPage","status","slug","throwOnError","rendered","type","error","errorMessage","message","code","onRequestClose","children","onSubmit","spacing","__next40pxDefaultSize","label","onChange","placeholder","value","justify","variant","onClick","isBusy"],"sources":["@wordpress/edit-site/src/components/add-new-page/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tTextControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\n\nexport default function AddNewPageModal( { onSave, onClose } ) {\n\tconst [ isCreatingPage, setIsCreatingPage ] = useState( false );\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tasync function createPage( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isCreatingPage ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsCreatingPage( true );\n\t\ttry {\n\t\t\tconst newPage = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'page',\n\t\t\t\t{\n\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\ttitle,\n\t\t\t\t\tslug: title || __( 'No title' ),\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\tonSave( newPage );\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tdecodeEntities( newPage.title?.rendered || title )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while creating the page.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsCreatingPage( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Modal title={ __( 'Draft a new page' ) } onRequestClose={ onClose }>\n\t\t\t<form onSubmit={ createPage }>\n\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Page title' ) }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ __( 'No title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isCreatingPage }\n\t\t\t\t\t\t\taria-disabled={ isCreatingPage }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create draft' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,MAAM,EACNC,KAAK,EACLC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,WAAW,QACL,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,YAAY,QAAQ,oBAAoB;AA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,CAAE,4CAA6C,CAAC;MAEtDoB,iBAAiB,CAAEY,YAAY,EAAE;QAChCF,IAAI,EAAE;MACP,CAAE,CAAC;IACJ,CAAC,SAAS;MACTd,iBAAiB,CAAE,KAAM,CAAC;IAC3B;EACD;EAEA,oBACCP,IAAA,CAACf,KAAK;IAACuB,KAAK,EAAGjB,EAAE,CAAE,kBAAmB,CAAG;IAACmC,cAAc,EAAGrB,OAAS;IAAAsB,QAAA,eACnE3B,IAAA;MAAM4B,QAAQ,EAAGf,UAAY;MAAAc,QAAA,eAC5BzB,KAAA,CAACb,MAAM;QAACwC,OAAO,EAAG,CAAG;QAAAF,QAAA,gBACpB3B,IAAA,CAACV,WAAW;UACXwC,qBAAqB;UACrBC,KAAK,EAAGxC,EAAE,CAAE,YAAa,CAAG;UAC5ByC,QAAQ,EAAGvB,QAAU;UACrBwB,WAAW,EAAG1C,EAAE,CAAE,UAAW,CAAG;UAChC2C,KAAK,EAAG1B;QAAO,CACf,CAAC,eACFN,KAAA,CAACf,MAAM;UAAC0C,OAAO,EAAG,CAAG;UAACM,OAAO,EAAC,KAAK;UAAAR,QAAA,gBAClC3B,IAAA,CAAChB,MAAM;YACN8C,qBAAqB;YACrBM,OAAO,EAAC,UAAU;YAClBC,OAAO,EAAGhC,OAAS;YAAAsB,QAAA,EAEjBpC,EAAE,CAAE,QAAS;UAAC,CACT,CAAC,eACTS,IAAA,CAAChB,MAAM;YACN8C,qBAAqB;YACrBM,OAAO,EAAC,SAAS;YACjBf,IAAI,EAAC,QAAQ;YACbiB,MAAM,EAAGhC,cAAgB;YACzB,iBAAgBA,cAAgB;YAAAqB,QAAA,EAE9BpC,EAAE,CAAE,cAAe;UAAC,CACf,CAAC;QAAA,CACF,CAAC;MAAA,CACF;IAAC,CACJ;EAAC,CACD,CAAC;AAEV","ignoreList":[]}
|
|
@@ -14,6 +14,11 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
|
14
14
|
*/
|
|
15
15
|
import Layout from '../layout';
|
|
16
16
|
import { unlock } from '../../lock-unlock';
|
|
17
|
+
import { useCommonCommands } from '../../hooks/commands/use-common-commands';
|
|
18
|
+
import { useEditModeCommands } from '../../hooks/commands/use-edit-mode-commands';
|
|
19
|
+
import useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';
|
|
20
|
+
import useLayoutAreas from '../layout/router';
|
|
21
|
+
import useSetCommandContext from '../../hooks/commands/use-set-command-context';
|
|
17
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
23
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
24
|
const {
|
|
@@ -22,6 +27,17 @@ const {
|
|
|
22
27
|
const {
|
|
23
28
|
GlobalStylesProvider
|
|
24
29
|
} = unlock(editorPrivateApis);
|
|
30
|
+
function AppLayout() {
|
|
31
|
+
// This ensures the edited entity id and type are initialized properly.
|
|
32
|
+
useInitEditedEntityFromURL();
|
|
33
|
+
useEditModeCommands();
|
|
34
|
+
useCommonCommands();
|
|
35
|
+
useSetCommandContext();
|
|
36
|
+
const route = useLayoutAreas();
|
|
37
|
+
return /*#__PURE__*/_jsx(Layout, {
|
|
38
|
+
route: route
|
|
39
|
+
});
|
|
40
|
+
}
|
|
25
41
|
export default function App() {
|
|
26
42
|
const {
|
|
27
43
|
createErrorNotice
|
|
@@ -33,7 +49,7 @@ export default function App() {
|
|
|
33
49
|
return /*#__PURE__*/_jsx(SlotFillProvider, {
|
|
34
50
|
children: /*#__PURE__*/_jsxs(GlobalStylesProvider, {
|
|
35
51
|
children: [/*#__PURE__*/_jsx(UnsavedChangesWarning, {}), /*#__PURE__*/_jsxs(RouterProvider, {
|
|
36
|
-
children: [/*#__PURE__*/_jsx(
|
|
52
|
+
children: [/*#__PURE__*/_jsx(AppLayout, {}), /*#__PURE__*/_jsx(PluginArea, {
|
|
37
53
|
onError: onPluginAreaError
|
|
38
54
|
})]
|
|
39
55
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SlotFillProvider","UnsavedChangesWarning","privateApis","editorPrivateApis","store","noticesStore","useDispatch","__","sprintf","PluginArea","routerPrivateApis","Layout","unlock","jsx","_jsx","jsxs","_jsxs","RouterProvider","GlobalStylesProvider","App","createErrorNotice","onPluginAreaError","name","children","onError"],"sources":["@wordpress/edit-site/src/components/app/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SlotFillProvider } from '@wordpress/components';\nimport {\n\tUnsavedChangesWarning,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useDispatch } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { PluginArea } from '@wordpress/plugins';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport Layout from '../layout';\nimport { unlock } from '../../lock-unlock';\n\nconst { RouterProvider } = unlock( routerPrivateApis );\nconst { GlobalStylesProvider } = unlock( editorPrivateApis );\n\nexport default function App() {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<GlobalStylesProvider>\n\t\t\t\t<UnsavedChangesWarning />\n\t\t\t\t<RouterProvider>\n\t\t\t\t\t<
|
|
1
|
+
{"version":3,"names":["SlotFillProvider","UnsavedChangesWarning","privateApis","editorPrivateApis","store","noticesStore","useDispatch","__","sprintf","PluginArea","routerPrivateApis","Layout","unlock","useCommonCommands","useEditModeCommands","useInitEditedEntityFromURL","useLayoutAreas","useSetCommandContext","jsx","_jsx","jsxs","_jsxs","RouterProvider","GlobalStylesProvider","AppLayout","route","App","createErrorNotice","onPluginAreaError","name","children","onError"],"sources":["@wordpress/edit-site/src/components/app/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SlotFillProvider } from '@wordpress/components';\nimport {\n\tUnsavedChangesWarning,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useDispatch } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { PluginArea } from '@wordpress/plugins';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport Layout from '../layout';\nimport { unlock } from '../../lock-unlock';\nimport { useCommonCommands } from '../../hooks/commands/use-common-commands';\nimport { useEditModeCommands } from '../../hooks/commands/use-edit-mode-commands';\nimport useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';\nimport useLayoutAreas from '../layout/router';\nimport useSetCommandContext from '../../hooks/commands/use-set-command-context';\n\nconst { RouterProvider } = unlock( routerPrivateApis );\nconst { GlobalStylesProvider } = unlock( editorPrivateApis );\n\nfunction AppLayout() {\n\t// This ensures the edited entity id and type are initialized properly.\n\tuseInitEditedEntityFromURL();\n\tuseEditModeCommands();\n\tuseCommonCommands();\n\tuseSetCommandContext();\n\tconst route = useLayoutAreas();\n\n\treturn <Layout route={ route } />;\n}\n\nexport default function App() {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<GlobalStylesProvider>\n\t\t\t\t<UnsavedChangesWarning />\n\t\t\t\t<RouterProvider>\n\t\t\t\t\t<AppLayout />\n\t\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t</RouterPro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Aa,CAAC;EAEzD,SAASuB,iBAAiBA,CAAEC,IAAI,EAAG;IAClCF,iBAAiB,CAChBnB,OAAO,EACN;IACAD,EAAE,CACD,kEACD,CAAC,EACDsB,IACD,CACD,CAAC;EACF;EAEA,oBACCV,IAAA,CAACnB,gBAAgB;IAAA8B,QAAA,eAChBT,KAAA,CAACE,oBAAoB;MAAAO,QAAA,gBACpBX,IAAA,CAAClB,qBAAqB,IAAE,CAAC,eACzBoB,KAAA,CAACC,cAAc;QAAAQ,QAAA,gBACdX,IAAA,CAACK,SAAS,IAAE,CAAC,eACbL,IAAA,CAACV,UAAU;UAACsB,OAAO,EAAGH;QAAmB,CAAE,CAAC;MAAA,CAC7B,CAAC;IAAA,CACI;EAAC,CACN,CAAC;AAErB","ignoreList":[]}
|
|
@@ -7,7 +7,7 @@ import clsx from 'clsx';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
10
|
-
import {
|
|
10
|
+
import { Button } from '@wordpress/components';
|
|
11
11
|
import { useInstanceId } from '@wordpress/compose';
|
|
12
12
|
import { EditorKeyboardShortcutsRegister, privateApis as editorPrivateApis, store as editorStore } from '@wordpress/editor';
|
|
13
13
|
import { __, sprintf } from '@wordpress/i18n';
|
|
@@ -17,6 +17,7 @@ import { useCallback, useMemo } from '@wordpress/element';
|
|
|
17
17
|
import { store as noticesStore } from '@wordpress/notices';
|
|
18
18
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
19
19
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
20
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Internal dependencies
|
|
@@ -24,12 +25,8 @@ import { store as preferencesStore } from '@wordpress/preferences';
|
|
|
24
25
|
import WelcomeGuide from '../welcome-guide';
|
|
25
26
|
import { store as editSiteStore } from '../../store';
|
|
26
27
|
import { GlobalStylesRenderer } from '../global-styles-renderer';
|
|
27
|
-
import useTitle from '../routes/use-title';
|
|
28
28
|
import CanvasLoader from '../canvas-loader';
|
|
29
29
|
import { unlock } from '../../lock-unlock';
|
|
30
|
-
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
31
|
-
import { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';
|
|
32
|
-
import TemplatePartConverter from '../template-part-converter';
|
|
33
30
|
import { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';
|
|
34
31
|
import PluginTemplateSettingPanel from '../plugin-template-setting-panel';
|
|
35
32
|
import GlobalStylesSidebar from '../global-styles-sidebar';
|
|
@@ -37,14 +34,15 @@ import { isPreviewingTheme } from '../../utils/is-previewing-theme';
|
|
|
37
34
|
import { getEditorCanvasContainerTitle, useHasEditorCanvasContainer } from '../editor-canvas-container';
|
|
38
35
|
import SaveButton from '../save-button';
|
|
39
36
|
import SiteEditorMoreMenu from '../more-menu';
|
|
37
|
+
import SiteIcon from '../site-icon';
|
|
40
38
|
import useEditorIframeProps from '../block-editor/use-editor-iframe-props';
|
|
39
|
+
import useEditorTitle from './use-editor-title';
|
|
41
40
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
42
41
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
43
42
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
44
43
|
const {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
Sidebar
|
|
44
|
+
Editor,
|
|
45
|
+
BackButton
|
|
48
46
|
} = unlock(editorPrivateApis);
|
|
49
47
|
const {
|
|
50
48
|
useHistory
|
|
@@ -52,21 +50,14 @@ const {
|
|
|
52
50
|
const {
|
|
53
51
|
BlockKeyboardShortcuts
|
|
54
52
|
} = unlock(blockLibraryPrivateApis);
|
|
55
|
-
export default function
|
|
53
|
+
export default function EditSiteEditor({
|
|
56
54
|
isLoading
|
|
57
55
|
}) {
|
|
58
56
|
const {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const {
|
|
64
|
-
type: editedPostType
|
|
65
|
-
} = editedPost;
|
|
66
|
-
const {
|
|
67
|
-
context,
|
|
68
|
-
contextPost,
|
|
69
|
-
editorMode,
|
|
57
|
+
editedPostType,
|
|
58
|
+
editedPostId,
|
|
59
|
+
contextPostType,
|
|
60
|
+
contextPostId,
|
|
70
61
|
canvasMode,
|
|
71
62
|
isEditingPage,
|
|
72
63
|
supportsGlobalStyles,
|
|
@@ -77,26 +68,25 @@ export default function Editor({
|
|
|
77
68
|
const {
|
|
78
69
|
getEditedPostContext,
|
|
79
70
|
getCanvasMode,
|
|
80
|
-
isPage
|
|
71
|
+
isPage,
|
|
72
|
+
getEditedPostType,
|
|
73
|
+
getEditedPostId
|
|
81
74
|
} = unlock(select(editSiteStore));
|
|
82
75
|
const {
|
|
83
76
|
get
|
|
84
77
|
} = select(preferencesStore);
|
|
85
78
|
const {
|
|
86
|
-
getEntityRecord,
|
|
87
79
|
getCurrentTheme
|
|
88
80
|
} = select(coreDataStore);
|
|
89
|
-
const {
|
|
90
|
-
getEditorMode
|
|
91
|
-
} = select(editorStore);
|
|
92
81
|
const _context = getEditedPostContext();
|
|
93
82
|
|
|
94
83
|
// The currently selected entity to display.
|
|
95
84
|
// Typically template or template part in the site editor.
|
|
96
85
|
return {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
86
|
+
editedPostType: getEditedPostType(),
|
|
87
|
+
editedPostId: getEditedPostId(),
|
|
88
|
+
contextPostType: _context?.postId ? _context.postType : undefined,
|
|
89
|
+
contextPostId: _context?.postId ? _context.postId : undefined,
|
|
100
90
|
canvasMode: getCanvasMode(),
|
|
101
91
|
isEditingPage: isPage(),
|
|
102
92
|
supportsGlobalStyles: getCurrentTheme()?.is_block_theme,
|
|
@@ -105,24 +95,12 @@ export default function Editor({
|
|
|
105
95
|
currentPostIsTrashed: select(editorStore).getCurrentPostAttribute('status') === 'trash'
|
|
106
96
|
};
|
|
107
97
|
}, []);
|
|
98
|
+
useEditorTitle();
|
|
108
99
|
const _isPreviewingTheme = isPreviewingTheme();
|
|
109
100
|
const hasDefaultEditorCanvasView = !useHasEditorCanvasContainer();
|
|
110
101
|
const iframeProps = useEditorIframeProps();
|
|
111
|
-
const isViewMode = canvasMode === 'view';
|
|
112
102
|
const isEditMode = canvasMode === 'edit';
|
|
113
|
-
const
|
|
114
|
-
const postWithTemplate = !!context?.postId;
|
|
115
|
-
let title;
|
|
116
|
-
if (hasLoadedPost) {
|
|
117
|
-
var _POST_TYPE_LABELS$edi;
|
|
118
|
-
title = sprintf(
|
|
119
|
-
// translators: A breadcrumb trail for the Admin document title. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).
|
|
120
|
-
__('%1$s ‹ %2$s'), getTitle(), (_POST_TYPE_LABELS$edi = POST_TYPE_LABELS[editedPostType]) !== null && _POST_TYPE_LABELS$edi !== void 0 ? _POST_TYPE_LABELS$edi : POST_TYPE_LABELS[TEMPLATE_POST_TYPE]);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Only announce the title once the editor is ready to prevent "Replace"
|
|
124
|
-
// action in <URLQueryController> from double-announcing.
|
|
125
|
-
useTitle(hasLoadedPost && title);
|
|
103
|
+
const postWithTemplate = !!contextPostId;
|
|
126
104
|
const loadingProgressId = useInstanceId(CanvasLoader, 'edit-site-editor__loading-progress');
|
|
127
105
|
const settings = useSpecificEditorSettings();
|
|
128
106
|
const styles = useMemo(() => [...settings.styles, {
|
|
@@ -131,6 +109,9 @@ export default function Editor({
|
|
|
131
109
|
|
|
132
110
|
css: `body{${canvasMode === 'view' ? `min-height: 100vh; ${currentPostIsTrashed ? '' : 'cursor: pointer;'}` : ''}}}`
|
|
133
111
|
}], [settings.styles, canvasMode, currentPostIsTrashed]);
|
|
112
|
+
const {
|
|
113
|
+
setCanvasMode
|
|
114
|
+
} = unlock(useDispatch(editSiteStore));
|
|
134
115
|
const {
|
|
135
116
|
createSuccessNotice
|
|
136
117
|
} = useDispatch(noticesStore);
|
|
@@ -151,7 +132,7 @@ export default function Editor({
|
|
|
151
132
|
const _title = typeof newItem.title === 'string' ? newItem.title : newItem.title?.rendered;
|
|
152
133
|
createSuccessNotice(sprintf(
|
|
153
134
|
// translators: %s: Title of the created post e.g: "Post 1".
|
|
154
|
-
__('"%s" successfully created.'), _title), {
|
|
135
|
+
__('"%s" successfully created.'), decodeEntities(_title)), {
|
|
155
136
|
type: 'snackbar',
|
|
156
137
|
id: 'duplicate-post-action',
|
|
157
138
|
actions: [{
|
|
@@ -169,35 +150,40 @@ export default function Editor({
|
|
|
169
150
|
break;
|
|
170
151
|
}
|
|
171
152
|
}, [history, createSuccessNotice]);
|
|
172
|
-
const isReady = !isLoading
|
|
153
|
+
const isReady = !isLoading;
|
|
173
154
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
174
|
-
children: [/*#__PURE__*/_jsx(GlobalStylesRenderer, {}), /*#__PURE__*/_jsx(EditorKeyboardShortcutsRegister, {}), isEditMode && /*#__PURE__*/_jsx(BlockKeyboardShortcuts, {}),
|
|
155
|
+
children: [/*#__PURE__*/_jsx(GlobalStylesRenderer, {}), /*#__PURE__*/_jsx(EditorKeyboardShortcutsRegister, {}), isEditMode && /*#__PURE__*/_jsx(BlockKeyboardShortcuts, {}), !isReady ? /*#__PURE__*/_jsx(CanvasLoader, {
|
|
175
156
|
id: loadingProgressId
|
|
176
|
-
}) : null, isEditMode && /*#__PURE__*/_jsx(WelcomeGuide, {}),
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}), isReady && /*#__PURE__*/_jsxs(EditorProvider, {
|
|
181
|
-
post: postWithTemplate ? contextPost : editedPost,
|
|
182
|
-
__unstableTemplate: postWithTemplate ? editedPost : undefined,
|
|
157
|
+
}) : null, isEditMode && /*#__PURE__*/_jsx(WelcomeGuide, {}), isReady && /*#__PURE__*/_jsxs(Editor, {
|
|
158
|
+
postType: postWithTemplate ? contextPostType : editedPostType,
|
|
159
|
+
postId: postWithTemplate ? contextPostId : editedPostId,
|
|
160
|
+
templateId: postWithTemplate ? editedPostId : undefined,
|
|
183
161
|
settings: settings,
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
162
|
+
className: clsx('edit-site-editor__editor-interface', {
|
|
163
|
+
'show-icon-labels': showIconLabels
|
|
164
|
+
}),
|
|
165
|
+
styles: styles,
|
|
166
|
+
enableRegionNavigation: false,
|
|
167
|
+
customSaveButton: _isPreviewingTheme && /*#__PURE__*/_jsx(SaveButton, {
|
|
168
|
+
size: "compact"
|
|
169
|
+
}),
|
|
170
|
+
forceDisableBlockTools: !hasDefaultEditorCanvasView,
|
|
171
|
+
title: !hasDefaultEditorCanvasView ? getEditorCanvasContainerTitle(editorCanvasView) : undefined,
|
|
172
|
+
iframeProps: iframeProps,
|
|
173
|
+
onActionPerformed: onActionPerformed,
|
|
174
|
+
extraSidebarPanels: !isEditingPage && /*#__PURE__*/_jsx(PluginTemplateSettingPanel.Slot, {}),
|
|
175
|
+
children: [isEditMode && /*#__PURE__*/_jsx(BackButton, {
|
|
176
|
+
children: ({
|
|
177
|
+
length
|
|
178
|
+
}) => length <= 1 && /*#__PURE__*/_jsx(Button, {
|
|
179
|
+
label: __('Open Navigation'),
|
|
180
|
+
className: "edit-site-layout__view-mode-toggle",
|
|
181
|
+
onClick: () => setCanvasMode('view'),
|
|
182
|
+
children: /*#__PURE__*/_jsx(SiteIcon, {
|
|
183
|
+
className: "edit-site-layout__view-mode-toggle-icon"
|
|
184
|
+
})
|
|
185
|
+
})
|
|
186
|
+
}), /*#__PURE__*/_jsx(SiteEditorMoreMenu, {}), supportsGlobalStyles && /*#__PURE__*/_jsx(GlobalStylesSidebar, {})]
|
|
201
187
|
})]
|
|
202
188
|
});
|
|
203
189
|
}
|