@wordpress/edit-site 5.28.3 → 5.29.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/block-editor/use-site-editor-settings.js +2 -1
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/code-editor/index.js +3 -2
- package/build/components/code-editor/index.js.map +1 -1
- package/build/components/editor/index.js +4 -4
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +1 -1
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/header-edit-mode/document-tools/index.js +1 -2
- package/build/components/header-edit-mode/document-tools/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +3 -1
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +7 -4
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +0 -13
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +0 -18
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/index.js +0 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page-patterns/dataviews-pattern-actions.js +25 -8
- package/build/components/page-patterns/dataviews-pattern-actions.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 +0 -1
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/save-button/index.js +2 -1
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/sidebar/index.js +3 -2
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +5 -5
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/hooks.js +20 -5
- package/build/components/sidebar-edit-mode/template-panel/hooks.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +48 -5
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/template-actions.js +2 -9
- package/build/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +6 -2
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/style-book/index.js +2 -0
- package/build/components/style-book/index.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +3 -171
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/hooks/index.js +0 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +4 -5
- 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 +91 -0
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -0
- package/build/store/actions.js +19 -50
- package/build/store/actions.js.map +1 -1
- package/build/utils/clone-deep.js +15 -0
- package/build/utils/clone-deep.js.map +1 -0
- package/build-module/components/block-editor/use-site-editor-settings.js +2 -1
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/code-editor/index.js +3 -2
- package/build-module/components/code-editor/index.js.map +1 -1
- package/build-module/components/editor/index.js +4 -4
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +2 -2
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/header-edit-mode/document-tools/index.js +1 -2
- package/build-module/components/header-edit-mode/document-tools/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +3 -1
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +6 -3
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +0 -13
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +0 -18
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/index.js +1 -2
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page-patterns/dataviews-pattern-actions.js +25 -8
- package/build-module/components/page-patterns/dataviews-pattern-actions.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 +0 -1
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/save-button/index.js +2 -1
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +3 -2
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +5 -5
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/hooks.js +20 -5
- package/build-module/components/sidebar-edit-mode/template-panel/hooks.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +50 -7
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js +2 -9
- package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +6 -2
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/style-book/index.js +2 -0
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +4 -172
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/hooks/index.js +0 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +1 -3
- 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 +82 -0
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -0
- package/build-module/store/actions.js +19 -50
- package/build-module/store/actions.js.map +1 -1
- package/build-module/utils/clone-deep.js +9 -0
- package/build-module/utils/clone-deep.js.map +1 -0
- package/build-style/style-rtl.css +24 -208
- package/build-style/style.css +24 -208
- package/package.json +43 -42
- package/src/components/block-editor/use-site-editor-settings.js +1 -0
- package/src/components/code-editor/index.js +3 -2
- package/src/components/editor/index.js +10 -7
- package/src/components/editor-canvas-container/index.js +2 -5
- package/src/components/{test → error-boundary/test}/error-boundary.js +7 -5
- package/src/components/global-styles/screen-revisions/style.scss +2 -2
- package/src/components/global-styles/style.scss +1 -1
- package/src/components/header-edit-mode/document-tools/index.js +1 -2
- package/src/components/header-edit-mode/index.js +1 -1
- package/src/components/header-edit-mode/more-menu/index.js +8 -3
- package/src/components/keyboard-shortcuts/edit-mode.js +0 -11
- package/src/components/keyboard-shortcuts/register.js +0 -19
- package/src/components/layout/index.js +0 -2
- package/src/components/page-patterns/dataviews-pattern-actions.js +41 -10
- package/src/components/page-patterns/header.js +1 -0
- package/src/components/page-patterns/index.js +0 -1
- package/src/components/page-patterns/style.scss +0 -182
- package/src/components/save-button/index.js +2 -1
- package/src/components/save-hub/style.scss +1 -1
- package/src/components/sidebar/index.js +2 -1
- package/src/components/sidebar-button/style.scss +1 -1
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +5 -7
- package/src/components/sidebar-edit-mode/style.scss +4 -0
- package/src/components/sidebar-edit-mode/template-panel/hooks.js +37 -24
- package/src/components/sidebar-edit-mode/template-panel/index.js +76 -18
- package/src/components/sidebar-edit-mode/template-panel/style.scss +5 -14
- package/src/components/sidebar-edit-mode/template-panel/template-actions.js +1 -12
- package/src/components/sidebar-navigation-screen-global-styles/index.js +4 -1
- package/src/components/style-book/index.js +5 -1
- package/src/hooks/commands/use-edit-mode-commands.js +3 -184
- package/src/hooks/index.js +0 -1
- package/src/hooks/push-changes-to-global-styles/index.js +1 -4
- package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +964 -0
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +92 -0
- package/src/store/actions.js +21 -85
- package/src/store/test/actions.js +0 -75
- package/src/style.scss +1 -6
- package/src/utils/clone-deep.js +8 -0
- package/build/components/header-edit-mode/mode-switcher/index.js +0 -62
- package/build/components/header-edit-mode/mode-switcher/index.js.map +0 -1
- package/build/components/page-patterns/duplicate-menu-item.js +0 -93
- package/build/components/page-patterns/duplicate-menu-item.js.map +0 -1
- package/build/components/page-patterns/grid-item.js +0 -223
- package/build/components/page-patterns/grid-item.js.map +0 -1
- package/build/components/page-patterns/grid.js +0 -31
- package/build/components/page-patterns/grid.js.map +0 -1
- package/build/components/page-patterns/no-patterns.js +0 -18
- package/build/components/page-patterns/no-patterns.js.map +0 -1
- package/build/components/page-patterns/patterns-list.js +0 -168
- package/build/components/page-patterns/patterns-list.js.map +0 -1
- package/build/components/page-patterns/rename-menu-item.js +0 -105
- package/build/components/page-patterns/rename-menu-item.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/replace-template-button.js +0 -83
- package/build/components/sidebar-edit-mode/template-panel/replace-template-button.js.map +0 -1
- package/build/hooks/navigation-menu-edit.js +0 -82
- package/build/hooks/navigation-menu-edit.js.map +0 -1
- package/build-module/components/header-edit-mode/mode-switcher/index.js +0 -56
- package/build-module/components/header-edit-mode/mode-switcher/index.js.map +0 -1
- package/build-module/components/page-patterns/duplicate-menu-item.js +0 -85
- package/build-module/components/page-patterns/duplicate-menu-item.js.map +0 -1
- package/build-module/components/page-patterns/grid-item.js +0 -215
- package/build-module/components/page-patterns/grid-item.js.map +0 -1
- package/build-module/components/page-patterns/grid.js +0 -23
- package/build-module/components/page-patterns/grid.js.map +0 -1
- package/build-module/components/page-patterns/no-patterns.js +0 -11
- package/build-module/components/page-patterns/no-patterns.js.map +0 -1
- package/build-module/components/page-patterns/patterns-list.js +0 -160
- package/build-module/components/page-patterns/patterns-list.js.map +0 -1
- package/build-module/components/page-patterns/rename-menu-item.js +0 -98
- package/build-module/components/page-patterns/rename-menu-item.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/replace-template-button.js +0 -76
- package/build-module/components/sidebar-edit-mode/template-panel/replace-template-button.js.map +0 -1
- package/build-module/hooks/navigation-menu-edit.js +0 -75
- package/build-module/hooks/navigation-menu-edit.js.map +0 -1
- package/src/components/header-edit-mode/mode-switcher/index.js +0 -60
- package/src/components/page-patterns/duplicate-menu-item.js +0 -105
- package/src/components/page-patterns/grid-item.js +0 -331
- package/src/components/page-patterns/grid.js +0 -22
- package/src/components/page-patterns/no-patterns.js +0 -12
- package/src/components/page-patterns/patterns-list.js +0 -229
- package/src/components/page-patterns/rename-menu-item.js +0 -132
- package/src/components/sidebar-edit-mode/template-panel/replace-template-button.js +0 -89
- package/src/hooks/navigation-menu-edit.js +0 -92
package/CHANGELOG.md
CHANGED
|
@@ -156,7 +156,8 @@ function useSpecificEditorSettings() {
|
|
|
156
156
|
onNavigateToPreviousEntityRecord,
|
|
157
157
|
// I wonder if they should be set in the post editor too
|
|
158
158
|
__experimentalArchiveTitleTypeLabel: archiveLabels.archiveTypeLabel,
|
|
159
|
-
__experimentalArchiveTitleNameLabel: archiveLabels.archiveNameLabel
|
|
159
|
+
__experimentalArchiveTitleNameLabel: archiveLabels.archiveNameLabel,
|
|
160
|
+
__unstableIsPreviewMode: canvasMode === 'view'
|
|
160
161
|
};
|
|
161
162
|
}, [settings, canvasMode, defaultRenderingMode, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord, archiveLabels.archiveTypeLabel, archiveLabels.archiveNameLabel]);
|
|
162
163
|
return defaultEditorSettings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_element","_coreData","_editor","_router","_compose","_store","_lockUnlock","_useNavigateToEntityRecord","_interopRequireDefault","_constants","useBlockEditorSettings","unlock","editorPrivateApis","useLocation","useHistory","routerPrivateApis","useArchiveLabel","templateSlug","taxonomyMatches","match","taxonomy","term","isAuthor","authorSlug","authorMatches","useSelect","select","getEntityRecords","getTaxonomy","getAuthors","coreStore","archiveTypeLabel","archiveNameLabel","labels","singular_name","records","slug","per_page","name","authorRecords","useNavigateToPreviousEntityRecord","location","previousLocation","usePrevious","history","goBack","useMemo","isFocusMode","params","focusMode","postId","FOCUSABLE_ENTITIES","includes","postType","didComeFromEditorCanvas","canvas","showBackButton","back","undefined","useSpecificEditorSettings","onNavigateToEntityRecord","useNavigateToEntityRecord","canvasMode","settings","postWithTemplate","getEditedPostType","getEditedPostId","getEditedPostContext","getCanvasMode","getSettings","editSiteStore","getEditedEntityRecord","usedPostType","usedPostId","_record","_context","archiveLabels","defaultRenderingMode","onNavigateToPreviousEntityRecord","defaultEditorSettings","richEditingEnabled","supportsTemplateMode","__experimentalArchiveTitleTypeLabel","__experimentalArchiveTitleNameLabel","useSiteEditorSettings"],"sources":["@wordpress/edit-site/src/components/block-editor/use-site-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport useNavigateToEntityRecord from './use-navigate-to-entity-record';\nimport { FOCUSABLE_ENTITIES } from '../../utils/constants';\n\nconst { useBlockEditorSettings } = unlock( editorPrivateApis );\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nfunction useArchiveLabel( templateSlug ) {\n\tconst taxonomyMatches = templateSlug?.match(\n\t\t/^(category|tag|taxonomy-([^-]+))$|^(((category|tag)|taxonomy-([^-]+))-(.+))$/\n\t);\n\tlet taxonomy;\n\tlet term;\n\tlet isAuthor = false;\n\tlet authorSlug;\n\tif ( taxonomyMatches ) {\n\t\t// If is for a all taxonomies of a type\n\t\tif ( taxonomyMatches[ 1 ] ) {\n\t\t\ttaxonomy = taxonomyMatches[ 2 ]\n\t\t\t\t? taxonomyMatches[ 2 ]\n\t\t\t\t: taxonomyMatches[ 1 ];\n\t\t}\n\t\t// If is for a all taxonomies of a type\n\t\telse if ( taxonomyMatches[ 3 ] ) {\n\t\t\ttaxonomy = taxonomyMatches[ 6 ]\n\t\t\t\t? taxonomyMatches[ 6 ]\n\t\t\t\t: taxonomyMatches[ 4 ];\n\t\t\tterm = taxonomyMatches[ 7 ];\n\t\t}\n\t\ttaxonomy = taxonomy === 'tag' ? 'post_tag' : taxonomy;\n\n\t\t//getTaxonomy( 'category' );\n\t\t//wp.data.select('core').getEntityRecords( 'taxonomy', 'category', {slug: 'newcat'} );\n\t} else {\n\t\tconst authorMatches = templateSlug?.match( /^(author)$|^author-(.+)$/ );\n\t\tif ( authorMatches ) {\n\t\t\tisAuthor = true;\n\t\t\tif ( authorMatches[ 2 ] ) {\n\t\t\t\tauthorSlug = authorMatches[ 2 ];\n\t\t\t}\n\t\t}\n\t}\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getTaxonomy, getAuthors } =\n\t\t\t\tselect( coreStore );\n\t\t\tlet archiveTypeLabel;\n\t\t\tlet archiveNameLabel;\n\t\t\tif ( taxonomy ) {\n\t\t\t\tarchiveTypeLabel =\n\t\t\t\t\tgetTaxonomy( taxonomy )?.labels?.singular_name;\n\t\t\t}\n\t\t\tif ( term ) {\n\t\t\t\tconst records = getEntityRecords( 'taxonomy', taxonomy, {\n\t\t\t\t\tslug: term,\n\t\t\t\t\tper_page: 1,\n\t\t\t\t} );\n\t\t\t\tif ( records && records[ 0 ] ) {\n\t\t\t\t\tarchiveNameLabel = records[ 0 ].name;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( isAuthor ) {\n\t\t\t\tarchiveTypeLabel = 'Author';\n\t\t\t\tif ( authorSlug ) {\n\t\t\t\t\tconst authorRecords = getAuthors( { slug: authorSlug } );\n\t\t\t\t\tif ( authorRecords && authorRecords[ 0 ] ) {\n\t\t\t\t\t\tarchiveNameLabel = authorRecords[ 0 ].name;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tarchiveTypeLabel,\n\t\t\t\tarchiveNameLabel,\n\t\t\t};\n\t\t},\n\t\t[ authorSlug, isAuthor, taxonomy, term ]\n\t);\n}\n\nfunction useNavigateToPreviousEntityRecord() {\n\tconst location = useLocation();\n\tconst previousLocation = usePrevious( location );\n\tconst history = useHistory();\n\tconst goBack = useMemo( () => {\n\t\tconst isFocusMode =\n\t\t\tlocation.params.focusMode ||\n\t\t\t( location.params.postId &&\n\t\t\t\tFOCUSABLE_ENTITIES.includes( location.params.postType ) );\n\t\tconst didComeFromEditorCanvas =\n\t\t\tpreviousLocation?.params.postId &&\n\t\t\tpreviousLocation?.params.postType &&\n\t\t\tpreviousLocation?.params.canvas === 'edit';\n\t\tconst showBackButton = isFocusMode && didComeFromEditorCanvas;\n\t\treturn showBackButton ? () => history.back() : undefined;\n\t\t// Disable reason: previousLocation changes when the component updates for any reason, not\n\t\t// just when location changes. Until this is fixed we can't add it to deps. See\n\t\t// https://github.com/WordPress/gutenberg/pull/58710#discussion_r1479219465.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ location, history ] );\n\treturn goBack;\n}\n\nexport function useSpecificEditorSettings() {\n\tconst onNavigateToEntityRecord = useNavigateToEntityRecord();\n\tconst { templateSlug, canvasMode, settings, postWithTemplate } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostType,\n\t\t\t\tgetEditedPostId,\n\t\t\t\tgetEditedPostContext,\n\t\t\t\tgetCanvasMode,\n\t\t\t\tgetSettings,\n\t\t\t} = unlock( select( editSiteStore ) );\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst usedPostType = getEditedPostType();\n\t\t\tconst usedPostId = getEditedPostId();\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tusedPostType,\n\t\t\t\tusedPostId\n\t\t\t);\n\t\t\tconst _context = getEditedPostContext();\n\t\t\treturn {\n\t\t\t\ttemplateSlug: _record.slug,\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t\tsettings: getSettings(),\n\t\t\t\tpostWithTemplate: _context?.postId,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst archiveLabels = useArchiveLabel( templateSlug );\n\tconst defaultRenderingMode = postWithTemplate\n\t\t? 'template-locked'\n\t\t: 'post-only';\n\tconst onNavigateToPreviousEntityRecord =\n\t\tuseNavigateToPreviousEntityRecord();\n\tconst defaultEditorSettings = useMemo( () => {\n\t\treturn {\n\t\t\t...settings,\n\n\t\t\trichEditingEnabled: true,\n\t\t\tsupportsTemplateMode: true,\n\t\t\tfocusMode: canvasMode !== 'view',\n\t\t\tdefaultRenderingMode,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t\t// I wonder if they should be set in the post editor too\n\t\t\t__experimentalArchiveTitleTypeLabel: archiveLabels.archiveTypeLabel,\n\t\t\t__experimentalArchiveTitleNameLabel: archiveLabels.archiveNameLabel,\n\t\t};\n\t}, [\n\t\tsettings,\n\t\tcanvasMode,\n\t\tdefaultRenderingMode,\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord,\n\t\tarchiveLabels.archiveTypeLabel,\n\t\tarchiveLabels.archiveNameLabel,\n\t] );\n\n\treturn defaultEditorSettings;\n}\n\nexport default function useSiteEditorSettings() {\n\tconst defaultEditorSettings = useSpecificEditorSettings();\n\tconst { postType, postId } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst usedPostType = getEditedPostType();\n\t\tconst usedPostId = getEditedPostId();\n\t\treturn {\n\t\t\tpostType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A,EAAG;EAC/C,MAAML,qBAAqB,GAAGpB,yBAAyB,CAAC,CAAC;EACzD,MAAM;IAAEN,QAAQ;IAAEH;EAAO,CAAC,GAAG,IAAAzB,eAAS,EAAIC,MAAM,IAAM;IACrD,MAAM;MAAEuC,iBAAiB;MAAEC;IAAgB,CAAC,GAAG,IAAAvD,kBAAM,EACpDe,MAAM,CAAE4C,YAAc,CACvB,CAAC;IACD,MAAME,YAAY,GAAGP,iBAAiB,CAAC,CAAC;IACxC,MAAMQ,UAAU,GAAGP,eAAe,CAAC,CAAC;IACpC,OAAO;MACNb,QAAQ,EAAEmB,YAAY;MACtBtB,MAAM,EAAEuB;IACT,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,OAAO/D,sBAAsB,CAAEqE,qBAAqB,EAAE1B,QAAQ,EAAEH,MAAO,CAAC;AACzE"}
|
|
1
|
+
{"version":3,"names":["_data","require","_element","_coreData","_editor","_router","_compose","_store","_lockUnlock","_useNavigateToEntityRecord","_interopRequireDefault","_constants","useBlockEditorSettings","unlock","editorPrivateApis","useLocation","useHistory","routerPrivateApis","useArchiveLabel","templateSlug","taxonomyMatches","match","taxonomy","term","isAuthor","authorSlug","authorMatches","useSelect","select","getEntityRecords","getTaxonomy","getAuthors","coreStore","archiveTypeLabel","archiveNameLabel","labels","singular_name","records","slug","per_page","name","authorRecords","useNavigateToPreviousEntityRecord","location","previousLocation","usePrevious","history","goBack","useMemo","isFocusMode","params","focusMode","postId","FOCUSABLE_ENTITIES","includes","postType","didComeFromEditorCanvas","canvas","showBackButton","back","undefined","useSpecificEditorSettings","onNavigateToEntityRecord","useNavigateToEntityRecord","canvasMode","settings","postWithTemplate","getEditedPostType","getEditedPostId","getEditedPostContext","getCanvasMode","getSettings","editSiteStore","getEditedEntityRecord","usedPostType","usedPostId","_record","_context","archiveLabels","defaultRenderingMode","onNavigateToPreviousEntityRecord","defaultEditorSettings","richEditingEnabled","supportsTemplateMode","__experimentalArchiveTitleTypeLabel","__experimentalArchiveTitleNameLabel","__unstableIsPreviewMode","useSiteEditorSettings"],"sources":["@wordpress/edit-site/src/components/block-editor/use-site-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport useNavigateToEntityRecord from './use-navigate-to-entity-record';\nimport { FOCUSABLE_ENTITIES } from '../../utils/constants';\n\nconst { useBlockEditorSettings } = unlock( editorPrivateApis );\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nfunction useArchiveLabel( templateSlug ) {\n\tconst taxonomyMatches = templateSlug?.match(\n\t\t/^(category|tag|taxonomy-([^-]+))$|^(((category|tag)|taxonomy-([^-]+))-(.+))$/\n\t);\n\tlet taxonomy;\n\tlet term;\n\tlet isAuthor = false;\n\tlet authorSlug;\n\tif ( taxonomyMatches ) {\n\t\t// If is for a all taxonomies of a type\n\t\tif ( taxonomyMatches[ 1 ] ) {\n\t\t\ttaxonomy = taxonomyMatches[ 2 ]\n\t\t\t\t? taxonomyMatches[ 2 ]\n\t\t\t\t: taxonomyMatches[ 1 ];\n\t\t}\n\t\t// If is for a all taxonomies of a type\n\t\telse if ( taxonomyMatches[ 3 ] ) {\n\t\t\ttaxonomy = taxonomyMatches[ 6 ]\n\t\t\t\t? taxonomyMatches[ 6 ]\n\t\t\t\t: taxonomyMatches[ 4 ];\n\t\t\tterm = taxonomyMatches[ 7 ];\n\t\t}\n\t\ttaxonomy = taxonomy === 'tag' ? 'post_tag' : taxonomy;\n\n\t\t//getTaxonomy( 'category' );\n\t\t//wp.data.select('core').getEntityRecords( 'taxonomy', 'category', {slug: 'newcat'} );\n\t} else {\n\t\tconst authorMatches = templateSlug?.match( /^(author)$|^author-(.+)$/ );\n\t\tif ( authorMatches ) {\n\t\t\tisAuthor = true;\n\t\t\tif ( authorMatches[ 2 ] ) {\n\t\t\t\tauthorSlug = authorMatches[ 2 ];\n\t\t\t}\n\t\t}\n\t}\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getTaxonomy, getAuthors } =\n\t\t\t\tselect( coreStore );\n\t\t\tlet archiveTypeLabel;\n\t\t\tlet archiveNameLabel;\n\t\t\tif ( taxonomy ) {\n\t\t\t\tarchiveTypeLabel =\n\t\t\t\t\tgetTaxonomy( taxonomy )?.labels?.singular_name;\n\t\t\t}\n\t\t\tif ( term ) {\n\t\t\t\tconst records = getEntityRecords( 'taxonomy', taxonomy, {\n\t\t\t\t\tslug: term,\n\t\t\t\t\tper_page: 1,\n\t\t\t\t} );\n\t\t\t\tif ( records && records[ 0 ] ) {\n\t\t\t\t\tarchiveNameLabel = records[ 0 ].name;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( isAuthor ) {\n\t\t\t\tarchiveTypeLabel = 'Author';\n\t\t\t\tif ( authorSlug ) {\n\t\t\t\t\tconst authorRecords = getAuthors( { slug: authorSlug } );\n\t\t\t\t\tif ( authorRecords && authorRecords[ 0 ] ) {\n\t\t\t\t\t\tarchiveNameLabel = authorRecords[ 0 ].name;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tarchiveTypeLabel,\n\t\t\t\tarchiveNameLabel,\n\t\t\t};\n\t\t},\n\t\t[ authorSlug, isAuthor, taxonomy, term ]\n\t);\n}\n\nfunction useNavigateToPreviousEntityRecord() {\n\tconst location = useLocation();\n\tconst previousLocation = usePrevious( location );\n\tconst history = useHistory();\n\tconst goBack = useMemo( () => {\n\t\tconst isFocusMode =\n\t\t\tlocation.params.focusMode ||\n\t\t\t( location.params.postId &&\n\t\t\t\tFOCUSABLE_ENTITIES.includes( location.params.postType ) );\n\t\tconst didComeFromEditorCanvas =\n\t\t\tpreviousLocation?.params.postId &&\n\t\t\tpreviousLocation?.params.postType &&\n\t\t\tpreviousLocation?.params.canvas === 'edit';\n\t\tconst showBackButton = isFocusMode && didComeFromEditorCanvas;\n\t\treturn showBackButton ? () => history.back() : undefined;\n\t\t// Disable reason: previousLocation changes when the component updates for any reason, not\n\t\t// just when location changes. Until this is fixed we can't add it to deps. See\n\t\t// https://github.com/WordPress/gutenberg/pull/58710#discussion_r1479219465.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ location, history ] );\n\treturn goBack;\n}\n\nexport function useSpecificEditorSettings() {\n\tconst onNavigateToEntityRecord = useNavigateToEntityRecord();\n\tconst { templateSlug, canvasMode, settings, postWithTemplate } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostType,\n\t\t\t\tgetEditedPostId,\n\t\t\t\tgetEditedPostContext,\n\t\t\t\tgetCanvasMode,\n\t\t\t\tgetSettings,\n\t\t\t} = unlock( select( editSiteStore ) );\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst usedPostType = getEditedPostType();\n\t\t\tconst usedPostId = getEditedPostId();\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tusedPostType,\n\t\t\t\tusedPostId\n\t\t\t);\n\t\t\tconst _context = getEditedPostContext();\n\t\t\treturn {\n\t\t\t\ttemplateSlug: _record.slug,\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t\tsettings: getSettings(),\n\t\t\t\tpostWithTemplate: _context?.postId,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst archiveLabels = useArchiveLabel( templateSlug );\n\tconst defaultRenderingMode = postWithTemplate\n\t\t? 'template-locked'\n\t\t: 'post-only';\n\tconst onNavigateToPreviousEntityRecord =\n\t\tuseNavigateToPreviousEntityRecord();\n\tconst defaultEditorSettings = useMemo( () => {\n\t\treturn {\n\t\t\t...settings,\n\n\t\t\trichEditingEnabled: true,\n\t\t\tsupportsTemplateMode: true,\n\t\t\tfocusMode: canvasMode !== 'view',\n\t\t\tdefaultRenderingMode,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t\t// I wonder if they should be set in the post editor too\n\t\t\t__experimentalArchiveTitleTypeLabel: archiveLabels.archiveTypeLabel,\n\t\t\t__experimentalArchiveTitleNameLabel: archiveLabels.archiveNameLabel,\n\t\t\t__unstableIsPreviewMode: canvasMode === 'view',\n\t\t};\n\t}, [\n\t\tsettings,\n\t\tcanvasMode,\n\t\tdefaultRenderingMode,\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord,\n\t\tarchiveLabels.archiveTypeLabel,\n\t\tarchiveLabels.archiveNameLabel,\n\t] );\n\n\treturn defaultEditorSettings;\n}\n\nexport default function useSiteEditorSettings() {\n\tconst defaultEditorSettings = useSpecificEditorSettings();\n\tconst { postType, postId } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst usedPostType = getEditedPostType();\n\t\tconst usedPostId = getEditedPostId();\n\t\treturn {\n\t\t\tpostType: usedPostType,\n\t\t\tpostId: usedPostId,\n\t\t};\n\t}, [] );\n\treturn useBlockEditorSettings( defaultEditorSettings, postType, postId );\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,0BAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,UAAA,GAAAV,OAAA;AAhBA;AACA;AACA;;AAQA;AACA;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EAAE,EAAG,CAAC;EACP,OAAO/D,sBAAsB,CAAEqE,qBAAqB,EAAE1B,QAAQ,EAAEH,MAAO,CAAC;AACzE"}
|
|
@@ -15,6 +15,7 @@ var _i18n = require("@wordpress/i18n");
|
|
|
15
15
|
var _components = require("@wordpress/components");
|
|
16
16
|
var _element = require("@wordpress/element");
|
|
17
17
|
var _compose = require("@wordpress/compose");
|
|
18
|
+
var _editor = require("@wordpress/editor");
|
|
18
19
|
var _store = require("../../store");
|
|
19
20
|
/**
|
|
20
21
|
* External dependencies
|
|
@@ -51,7 +52,7 @@ function CodeEditor() {
|
|
|
51
52
|
const _id = getEditedPostId();
|
|
52
53
|
const editedRecord = getEditedEntityRecord('postType', _type, _id);
|
|
53
54
|
return {
|
|
54
|
-
shortcut: getShortcutRepresentation('core/
|
|
55
|
+
shortcut: getShortcutRepresentation('core/editor/toggle-mode'),
|
|
55
56
|
content: editedRecord?.content,
|
|
56
57
|
blocks: editedRecord?.blocks,
|
|
57
58
|
type: _type,
|
|
@@ -77,7 +78,7 @@ function CodeEditor() {
|
|
|
77
78
|
}, [content, blocks]);
|
|
78
79
|
const {
|
|
79
80
|
switchEditorMode
|
|
80
|
-
} = (0, _data.useDispatch)(
|
|
81
|
+
} = (0, _data.useDispatch)(_editor.store);
|
|
81
82
|
return (0, _react.createElement)("div", {
|
|
82
83
|
className: "edit-site-code-editor"
|
|
83
84
|
}, (0, _react.createElement)("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactAutosizeTextarea","_interopRequireDefault","require","_blocks","_coreData","_data","_keyboardShortcuts","_i18n","_components","_element","_compose","_store","CodeEditor","instanceId","useInstanceId","shortcut","content","blocks","type","id","useSelect","select","getEditedEntityRecord","coreStore","getEditedPostType","getEditedPostId","editSiteStore","getShortcutRepresentation","keyboardShortcutsStore","_type","_id","editedRecord","editEntityRecord","useDispatch","realContent","useMemo","Function","__unstableSerializeAndClean","switchEditorMode","_react","createElement","className","__","Button","variant","onClick","VisuallyHidden","as","htmlFor","default","autoComplete","dir","value","onChange","event","target","undefined","selection","placeholder"],"sources":["@wordpress/edit-site/src/components/code-editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport Textarea from 'react-autosize-textarea';\n\n/**\n * WordPress dependencies\n */\nimport { __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function CodeEditor() {\n\tconst instanceId = useInstanceId( CodeEditor );\n\tconst { shortcut, content, blocks, type, id } = useSelect( ( select ) => {\n\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\tconst { getEditedPostType, getEditedPostId } = select( editSiteStore );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\t\tconst _type = getEditedPostType();\n\t\tconst _id = getEditedPostId();\n\t\tconst editedRecord = getEditedEntityRecord( 'postType', _type, _id );\n\n\t\treturn {\n\t\t\tshortcut: getShortcutRepresentation( 'core/
|
|
1
|
+
{"version":3,"names":["_reactAutosizeTextarea","_interopRequireDefault","require","_blocks","_coreData","_data","_keyboardShortcuts","_i18n","_components","_element","_compose","_editor","_store","CodeEditor","instanceId","useInstanceId","shortcut","content","blocks","type","id","useSelect","select","getEditedEntityRecord","coreStore","getEditedPostType","getEditedPostId","editSiteStore","getShortcutRepresentation","keyboardShortcutsStore","_type","_id","editedRecord","editEntityRecord","useDispatch","realContent","useMemo","Function","__unstableSerializeAndClean","switchEditorMode","editorStore","_react","createElement","className","__","Button","variant","onClick","VisuallyHidden","as","htmlFor","default","autoComplete","dir","value","onChange","event","target","undefined","selection","placeholder"],"sources":["@wordpress/edit-site/src/components/code-editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport Textarea from 'react-autosize-textarea';\n\n/**\n * WordPress dependencies\n */\nimport { __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function CodeEditor() {\n\tconst instanceId = useInstanceId( CodeEditor );\n\tconst { shortcut, content, blocks, type, id } = useSelect( ( select ) => {\n\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\tconst { getEditedPostType, getEditedPostId } = select( editSiteStore );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\t\tconst _type = getEditedPostType();\n\t\tconst _id = getEditedPostId();\n\t\tconst editedRecord = getEditedEntityRecord( 'postType', _type, _id );\n\n\t\treturn {\n\t\t\tshortcut: getShortcutRepresentation( 'core/editor/toggle-mode' ),\n\t\t\tcontent: editedRecord?.content,\n\t\t\tblocks: editedRecord?.blocks,\n\t\t\ttype: _type,\n\t\t\tid: _id,\n\t\t};\n\t}, [] );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\t// Replicates the logic found in getEditedPostContent().\n\tconst realContent = useMemo( () => {\n\t\tif ( content instanceof Function ) {\n\t\t\treturn content( { blocks } );\n\t\t} else if ( blocks ) {\n\t\t\t// If we have parsed blocks already, they should be our source of truth.\n\t\t\t// Parsing applies block deprecations and legacy block conversions that\n\t\t\t// unparsed content will not have.\n\t\t\treturn __unstableSerializeAndClean( blocks );\n\t\t}\n\t\treturn content;\n\t}, [ content, blocks ] );\n\n\tconst { switchEditorMode } = useDispatch( editorStore );\n\treturn (\n\t\t<div className=\"edit-site-code-editor\">\n\t\t\t<div className=\"edit-site-code-editor__toolbar\">\n\t\t\t\t<h2>{ __( 'Editing code' ) }</h2>\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\tonClick={ () => switchEditorMode( 'visual' ) }\n\t\t\t\t\tshortcut={ shortcut }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Exit code editor' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t\t<div className=\"edit-site-code-editor__body\">\n\t\t\t\t<VisuallyHidden\n\t\t\t\t\tas=\"label\"\n\t\t\t\t\thtmlFor={ `code-editor-text-area-${ instanceId }` }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Type text or HTML' ) }\n\t\t\t\t</VisuallyHidden>\n\t\t\t\t<Textarea\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tdir=\"auto\"\n\t\t\t\t\tvalue={ realContent }\n\t\t\t\t\tonChange={ ( event ) => {\n\t\t\t\t\t\teditEntityRecord( 'postType', type, id, {\n\t\t\t\t\t\t\tcontent: event.target.value,\n\t\t\t\t\t\t\tblocks: undefined,\n\t\t\t\t\t\t\tselection: undefined,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tclassName=\"edit-site-code-editor-text-area\"\n\t\t\t\t\tid={ `code-editor-text-area-${ instanceId }` }\n\t\t\t\t\tplaceholder={ __( 'Start writing with text or HTML' ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,QAA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AED;MACZ,CAAE,CAAC;IACJ,CAAG;IACHf,SAAS,EAAC,iCAAiC;IAC3CvB,EAAE,EAAI,yBAAyBN,UAAY,EAAG;IAC9C8C,WAAW,EAAG,IAAAhB,QAAE,EAAE,iCAAkC;EAAG,CACvD,CACG,CACD,CAAC;AAER"}
|
|
@@ -102,7 +102,6 @@ function Editor({
|
|
|
102
102
|
} = select(_preferences.store);
|
|
103
103
|
const {
|
|
104
104
|
getEditedPostContext,
|
|
105
|
-
getEditorMode,
|
|
106
105
|
getCanvasMode
|
|
107
106
|
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
108
107
|
const {
|
|
@@ -117,7 +116,8 @@ function Editor({
|
|
|
117
116
|
const {
|
|
118
117
|
isInserterOpened,
|
|
119
118
|
isListViewOpened,
|
|
120
|
-
getPostTypeLabel
|
|
119
|
+
getPostTypeLabel,
|
|
120
|
+
getEditorMode
|
|
121
121
|
} = select(_editor.store);
|
|
122
122
|
const _context = getEditedPostContext();
|
|
123
123
|
|
|
@@ -183,9 +183,9 @@ function Editor({
|
|
|
183
183
|
rules: blockRemovalRules
|
|
184
184
|
}), (0, _react.createElement)(_patternModal.default, null)), editorMode === 'text' && isEditMode && (0, _react.createElement)(_codeEditor.default, null), isEditMode && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_editMode.default, null), (0, _react.createElement)(_editor.EditorKeyboardShortcutsRegister, null), (0, _react.createElement)(_editor.EditorKeyboardShortcuts, null))),
|
|
185
185
|
secondarySidebar: isEditMode && (shouldShowInserter && (0, _react.createElement)(InserterSidebar, null) || shouldShowListView && (0, _react.createElement)(ListViewSidebar, null)),
|
|
186
|
-
sidebar: !isDistractionFree && isEditMode && isRightSidebarOpen &&
|
|
186
|
+
sidebar: !isDistractionFree && isEditMode && isRightSidebarOpen && !isDistractionFree && (0, _react.createElement)(_interface.ComplementaryArea.Slot, {
|
|
187
187
|
scope: "core/edit-site"
|
|
188
|
-
})
|
|
188
|
+
}),
|
|
189
189
|
footer: shouldShowBlockBreadcrumbs && (0, _react.createElement)(_blockEditor.BlockBreadcrumb, {
|
|
190
190
|
rootLabelText: postTypeLabel
|
|
191
191
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_data","_components","_compose","_preferences","_blockEditor","_interface","_editor","_i18n","_coreData","_sidebarEditMode","_codeEditor","_editMode","_welcomeGuide","_startTemplateOptions","_store","_globalStylesRenderer","_useTitle","_canvasLoader","_lockUnlock","_useEditedEntityRecord","_patternModal","_constants","_siteEditorCanvas","_templatePartConverter","_useSiteEditorSettings","BlockRemovalWarningModal","unlock","blockEditorPrivateApis","ExperimentalEditorProvider","EditorProvider","InserterSidebar","ListViewSidebar","editorPrivateApis","interfaceLabels","body","__","sidebar","actions","footer","blockRemovalRules","Editor","isLoading","record","editedPost","getTitle","isLoaded","hasLoadedPost","useEditedEntityRecord","type","editedPostType","isLargeViewport","useViewportMatch","context","contextPost","editorMode","canvasMode","blockEditorMode","isRightSidebarOpen","isInserterOpen","isListViewOpen","isDistractionFree","showIconLabels","showBlockBreadcrumbs","postTypeLabel","useSelect","select","get","preferencesStore","getEditedPostContext","getEditorMode","getCanvasMode","editSiteStore","__unstableGetEditorMode","blockEditorStore","getActiveComplementaryArea","interfaceStore","getEntityRecord","coreDataStore","isInserterOpened","isListViewOpened","getPostTypeLabel","editorStore","_context","postId","postType","undefined","name","isViewMode","isEditMode","showVisualEditor","shouldShowBlockBreadcrumbs","shouldShowInserter","shouldShowListView","secondarySidebarLabel","postWithTemplate","title","_POST_TYPE_LABELS$edi","sprintf","POST_TYPE_LABELS","TEMPLATE_POST_TYPE","useTitle","loadingProgressId","useInstanceId","CanvasLoader","settings","useSpecificEditorSettings","isReady","_react","createElement","Fragment","default","id","Notice","status","isDismissible","post","__unstableTemplate","useSubRegistry","SidebarComplementaryAreaFills","InterfaceSkeleton","enableRegionNavigation","className","classnames","notices","EditorSnackbars","content","GlobalStylesRenderer","EditorNotices","SidebarInspectorFill","BlockInspector","BlockToolbar","hideDragHandle","rules","EditorKeyboardShortcutsRegister","EditorKeyboardShortcuts","secondarySidebar","ComplementaryArea","Slot","scope","BlockBreadcrumb","rootLabelText","labels"],"sources":["@wordpress/edit-site/src/components/editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { Notice } from '@wordpress/components';\nimport { useInstanceId, useViewportMatch } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tBlockBreadcrumb,\n\tBlockToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n\tBlockInspector,\n} from '@wordpress/block-editor';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tEditorKeyboardShortcuts,\n\tEditorNotices,\n\tEditorSnackbars,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tSidebarComplementaryAreaFills,\n\tSidebarInspectorFill,\n} from '../sidebar-edit-mode';\nimport CodeEditor from '../code-editor';\nimport KeyboardShortcutsEditMode from '../keyboard-shortcuts/edit-mode';\nimport WelcomeGuide from '../welcome-guide';\nimport StartTemplateOptions from '../start-template-options';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport useTitle from '../routes/use-title';\nimport CanvasLoader from '../canvas-loader';\nimport { unlock } from '../../lock-unlock';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport PatternModal from '../pattern-modal';\nimport { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport SiteEditorCanvas from '../block-editor/site-editor-canvas';\nimport TemplatePartConverter from '../template-part-converter';\nimport { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';\n\nconst { BlockRemovalWarningModal } = unlock( blockEditorPrivateApis );\nconst {\n\tExperimentalEditorProvider: EditorProvider,\n\tInserterSidebar,\n\tListViewSidebar,\n} = unlock( editorPrivateApis );\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\n// Prevent accidental removal of certain blocks, asking the user for\n// confirmation.\nconst blockRemovalRules = {\n\t'core/query': __( 'Query Loop displays a list of posts or pages.' ),\n\t'core/post-content': __(\n\t\t'Post Content displays the content of a post or page.'\n\t),\n\t'core/post-template': __(\n\t\t'Post Template displays each post or page in a Query Loop.'\n\t),\n\t'bindings/core/pattern-overrides': __(\n\t\t'Blocks from synced patterns that can have overriden content.'\n\t),\n};\n\nexport default function Editor( { isLoading } ) {\n\tconst {\n\t\trecord: editedPost,\n\t\tgetTitle,\n\t\tisLoaded: hasLoadedPost,\n\t} = useEditedEntityRecord();\n\n\tconst { type: editedPostType } = editedPost;\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\tconst {\n\t\tcontext,\n\t\tcontextPost,\n\t\teditorMode,\n\t\tcanvasMode,\n\t\tblockEditorMode,\n\t\tisRightSidebarOpen,\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tisDistractionFree,\n\t\tshowIconLabels,\n\t\tshowBlockBreadcrumbs,\n\t\tpostTypeLabel,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getEditedPostContext, getEditorMode, getCanvasMode } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\t\tconst { getEntityRecord } = select( coreDataStore );\n\t\tconst { isInserterOpened, isListViewOpened, getPostTypeLabel } =\n\t\t\tselect( editorStore );\n\t\tconst _context = getEditedPostContext();\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tcontext: _context,\n\t\t\tcontextPost: _context?.postId\n\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t_context.postType,\n\t\t\t\t\t\t_context.postId\n\t\t\t\t )\n\t\t\t\t: undefined,\n\t\t\teditorMode: getEditorMode(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisRightSidebarOpen: getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\tpostTypeLabel: getPostTypeLabel(),\n\t\t};\n\t}, [] );\n\n\tconst isViewMode = canvasMode === 'view';\n\tconst isEditMode = canvasMode === 'edit';\n\tconst showVisualEditor = isViewMode || editorMode === 'visual';\n\tconst shouldShowBlockBreadcrumbs =\n\t\t! isDistractionFree &&\n\t\tshowBlockBreadcrumbs &&\n\t\tisEditMode &&\n\t\tshowVisualEditor &&\n\t\tblockEditorMode !== 'zoom-out';\n\tconst shouldShowInserter = isEditMode && showVisualEditor && isInserterOpen;\n\tconst shouldShowListView = isEditMode && showVisualEditor && isListViewOpen;\n\tconst secondarySidebarLabel = isListViewOpen\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\tconst postWithTemplate = !! context?.postId;\n\n\tlet title;\n\tif ( hasLoadedPost ) {\n\t\ttitle = sprintf(\n\t\t\t// 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).\n\t\t\t__( '%1$s ‹ %2$s' ),\n\t\t\tgetTitle(),\n\t\t\tPOST_TYPE_LABELS[ editedPostType ] ??\n\t\t\t\tPOST_TYPE_LABELS[ TEMPLATE_POST_TYPE ]\n\t\t);\n\t}\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URLQueryController> from double-announcing.\n\tuseTitle( hasLoadedPost && title );\n\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst settings = useSpecificEditorSettings();\n\tconst isReady =\n\t\t! isLoading &&\n\t\t( ( postWithTemplate && !! contextPost && !! editedPost ) ||\n\t\t\t( ! postWithTemplate && !! editedPost ) );\n\n\treturn (\n\t\t<>\n\t\t\t{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }\n\t\t\t{ isEditMode && <WelcomeGuide /> }\n\t\t\t{ hasLoadedPost && ! editedPost && (\n\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t) }\n\t\t\t\t</Notice>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<EditorProvider\n\t\t\t\t\tpost={ postWithTemplate ? contextPost : editedPost }\n\t\t\t\t\t__unstableTemplate={\n\t\t\t\t\t\tpostWithTemplate ? editedPost : undefined\n\t\t\t\t\t}\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t>\n\t\t\t\t\t<SidebarComplementaryAreaFills />\n\t\t\t\t\t{ isEditMode && <StartTemplateOptions /> }\n\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\tisDistractionFree={ isDistractionFree }\n\t\t\t\t\t\tenableRegionNavigation={ false }\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'edit-site-editor__interface-skeleton',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<GlobalStylesRenderer />\n\t\t\t\t\t\t\t\t{ isEditMode && <EditorNotices /> }\n\t\t\t\t\t\t\t\t{ showVisualEditor && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<TemplatePartConverter />\n\t\t\t\t\t\t\t\t\t\t<SidebarInspectorFill>\n\t\t\t\t\t\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t\t\t\t\t\t</SidebarInspectorFill>\n\t\t\t\t\t\t\t\t\t\t{ ! isLargeViewport && (\n\t\t\t\t\t\t\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t<SiteEditorCanvas />\n\t\t\t\t\t\t\t\t\t\t<BlockRemovalWarningModal\n\t\t\t\t\t\t\t\t\t\t\trules={ blockRemovalRules }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<PatternModal />\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\t{ editorMode === 'text' && isEditMode && (\n\t\t\t\t\t\t\t\t\t<CodeEditor />\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<KeyboardShortcutsEditMode />\n\t\t\t\t\t\t\t\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t\t\t\t\t\t\t\t<EditorKeyboardShortcuts />\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\tsecondarySidebar={\n\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t( ( shouldShowInserter && <InserterSidebar /> ) ||\n\t\t\t\t\t\t\t\t( shouldShowListView && <ListViewSidebar /> ) )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsidebar={\n\t\t\t\t\t\t\t! isDistractionFree &&\n\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\tisRightSidebarOpen && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-site\" />\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\tfooter={\n\t\t\t\t\t\t\tshouldShowBlockBreadcrumbs && (\n\t\t\t\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\t\t\t\trootLabelText={ postTypeLabel }\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\tlabels={ {\n\t\t\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</EditorProvider>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAOA,IAAAM,UAAA,GAAAN,OAAA;AAKA,IAAAO,OAAA,GAAAP,OAAA;AAQA,IAAAQ,KAAA,GAAAR,OAAA;AACA,IAAAS,SAAA,GAAA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A0B,IACzB,IAAAiB,MAAA,CAAAC,aAAA,EAACxG,YAAA,CAAAuI,eAAe;MACfC,aAAa,EAAG7E;IAAe,CAC/B,CAEF;IACD8E,MAAM,EAAG;MACR,GAAG5G,eAAe;MAClBsG,gBAAgB,EAAE1C;IACnB;EAAG,CACH,CACc,CAEhB,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_data","_components","_compose","_preferences","_blockEditor","_interface","_editor","_i18n","_coreData","_sidebarEditMode","_codeEditor","_editMode","_welcomeGuide","_startTemplateOptions","_store","_globalStylesRenderer","_useTitle","_canvasLoader","_lockUnlock","_useEditedEntityRecord","_patternModal","_constants","_siteEditorCanvas","_templatePartConverter","_useSiteEditorSettings","BlockRemovalWarningModal","unlock","blockEditorPrivateApis","ExperimentalEditorProvider","EditorProvider","InserterSidebar","ListViewSidebar","editorPrivateApis","interfaceLabels","body","__","sidebar","actions","footer","blockRemovalRules","Editor","isLoading","record","editedPost","getTitle","isLoaded","hasLoadedPost","useEditedEntityRecord","type","editedPostType","isLargeViewport","useViewportMatch","context","contextPost","editorMode","canvasMode","blockEditorMode","isRightSidebarOpen","isInserterOpen","isListViewOpen","isDistractionFree","showIconLabels","showBlockBreadcrumbs","postTypeLabel","useSelect","select","get","preferencesStore","getEditedPostContext","getCanvasMode","editSiteStore","__unstableGetEditorMode","blockEditorStore","getActiveComplementaryArea","interfaceStore","getEntityRecord","coreDataStore","isInserterOpened","isListViewOpened","getPostTypeLabel","getEditorMode","editorStore","_context","postId","postType","undefined","name","isViewMode","isEditMode","showVisualEditor","shouldShowBlockBreadcrumbs","shouldShowInserter","shouldShowListView","secondarySidebarLabel","postWithTemplate","title","_POST_TYPE_LABELS$edi","sprintf","POST_TYPE_LABELS","TEMPLATE_POST_TYPE","useTitle","loadingProgressId","useInstanceId","CanvasLoader","settings","useSpecificEditorSettings","isReady","_react","createElement","Fragment","default","id","Notice","status","isDismissible","post","__unstableTemplate","useSubRegistry","SidebarComplementaryAreaFills","InterfaceSkeleton","enableRegionNavigation","className","classnames","notices","EditorSnackbars","content","GlobalStylesRenderer","EditorNotices","SidebarInspectorFill","BlockInspector","BlockToolbar","hideDragHandle","rules","EditorKeyboardShortcutsRegister","EditorKeyboardShortcuts","secondarySidebar","ComplementaryArea","Slot","scope","BlockBreadcrumb","rootLabelText","labels"],"sources":["@wordpress/edit-site/src/components/editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { Notice } from '@wordpress/components';\nimport { useInstanceId, useViewportMatch } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tBlockBreadcrumb,\n\tBlockToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n\tBlockInspector,\n} from '@wordpress/block-editor';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tEditorKeyboardShortcuts,\n\tEditorNotices,\n\tEditorSnackbars,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tSidebarComplementaryAreaFills,\n\tSidebarInspectorFill,\n} from '../sidebar-edit-mode';\nimport CodeEditor from '../code-editor';\nimport KeyboardShortcutsEditMode from '../keyboard-shortcuts/edit-mode';\nimport WelcomeGuide from '../welcome-guide';\nimport StartTemplateOptions from '../start-template-options';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport useTitle from '../routes/use-title';\nimport CanvasLoader from '../canvas-loader';\nimport { unlock } from '../../lock-unlock';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport PatternModal from '../pattern-modal';\nimport { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport SiteEditorCanvas from '../block-editor/site-editor-canvas';\nimport TemplatePartConverter from '../template-part-converter';\nimport { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';\n\nconst { BlockRemovalWarningModal } = unlock( blockEditorPrivateApis );\nconst {\n\tExperimentalEditorProvider: EditorProvider,\n\tInserterSidebar,\n\tListViewSidebar,\n} = unlock( editorPrivateApis );\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\n// Prevent accidental removal of certain blocks, asking the user for\n// confirmation.\nconst blockRemovalRules = {\n\t'core/query': __( 'Query Loop displays a list of posts or pages.' ),\n\t'core/post-content': __(\n\t\t'Post Content displays the content of a post or page.'\n\t),\n\t'core/post-template': __(\n\t\t'Post Template displays each post or page in a Query Loop.'\n\t),\n\t'bindings/core/pattern-overrides': __(\n\t\t'Blocks from synced patterns that can have overriden content.'\n\t),\n};\n\nexport default function Editor( { isLoading } ) {\n\tconst {\n\t\trecord: editedPost,\n\t\tgetTitle,\n\t\tisLoaded: hasLoadedPost,\n\t} = useEditedEntityRecord();\n\n\tconst { type: editedPostType } = editedPost;\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\tconst {\n\t\tcontext,\n\t\tcontextPost,\n\t\teditorMode,\n\t\tcanvasMode,\n\t\tblockEditorMode,\n\t\tisRightSidebarOpen,\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tisDistractionFree,\n\t\tshowIconLabels,\n\t\tshowBlockBreadcrumbs,\n\t\tpostTypeLabel,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getEditedPostContext, getCanvasMode } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\t\tconst { getEntityRecord } = select( coreDataStore );\n\t\tconst {\n\t\t\tisInserterOpened,\n\t\t\tisListViewOpened,\n\t\t\tgetPostTypeLabel,\n\t\t\tgetEditorMode,\n\t\t} = select( editorStore );\n\t\tconst _context = getEditedPostContext();\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tcontext: _context,\n\t\t\tcontextPost: _context?.postId\n\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t_context.postType,\n\t\t\t\t\t\t_context.postId\n\t\t\t\t )\n\t\t\t\t: undefined,\n\t\t\teditorMode: getEditorMode(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisRightSidebarOpen: getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\tpostTypeLabel: getPostTypeLabel(),\n\t\t};\n\t}, [] );\n\n\tconst isViewMode = canvasMode === 'view';\n\tconst isEditMode = canvasMode === 'edit';\n\tconst showVisualEditor = isViewMode || editorMode === 'visual';\n\tconst shouldShowBlockBreadcrumbs =\n\t\t! isDistractionFree &&\n\t\tshowBlockBreadcrumbs &&\n\t\tisEditMode &&\n\t\tshowVisualEditor &&\n\t\tblockEditorMode !== 'zoom-out';\n\tconst shouldShowInserter = isEditMode && showVisualEditor && isInserterOpen;\n\tconst shouldShowListView = isEditMode && showVisualEditor && isListViewOpen;\n\tconst secondarySidebarLabel = isListViewOpen\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\tconst postWithTemplate = !! context?.postId;\n\n\tlet title;\n\tif ( hasLoadedPost ) {\n\t\ttitle = sprintf(\n\t\t\t// 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).\n\t\t\t__( '%1$s ‹ %2$s' ),\n\t\t\tgetTitle(),\n\t\t\tPOST_TYPE_LABELS[ editedPostType ] ??\n\t\t\t\tPOST_TYPE_LABELS[ TEMPLATE_POST_TYPE ]\n\t\t);\n\t}\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URLQueryController> from double-announcing.\n\tuseTitle( hasLoadedPost && title );\n\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst settings = useSpecificEditorSettings();\n\tconst isReady =\n\t\t! isLoading &&\n\t\t( ( postWithTemplate && !! contextPost && !! editedPost ) ||\n\t\t\t( ! postWithTemplate && !! editedPost ) );\n\n\treturn (\n\t\t<>\n\t\t\t{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }\n\t\t\t{ isEditMode && <WelcomeGuide /> }\n\t\t\t{ hasLoadedPost && ! editedPost && (\n\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t) }\n\t\t\t\t</Notice>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<EditorProvider\n\t\t\t\t\tpost={ postWithTemplate ? contextPost : editedPost }\n\t\t\t\t\t__unstableTemplate={\n\t\t\t\t\t\tpostWithTemplate ? editedPost : undefined\n\t\t\t\t\t}\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t>\n\t\t\t\t\t<SidebarComplementaryAreaFills />\n\t\t\t\t\t{ isEditMode && <StartTemplateOptions /> }\n\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\tisDistractionFree={ isDistractionFree }\n\t\t\t\t\t\tenableRegionNavigation={ false }\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'edit-site-editor__interface-skeleton',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<GlobalStylesRenderer />\n\t\t\t\t\t\t\t\t{ isEditMode && <EditorNotices /> }\n\t\t\t\t\t\t\t\t{ showVisualEditor && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<TemplatePartConverter />\n\t\t\t\t\t\t\t\t\t\t<SidebarInspectorFill>\n\t\t\t\t\t\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t\t\t\t\t\t</SidebarInspectorFill>\n\t\t\t\t\t\t\t\t\t\t{ ! isLargeViewport && (\n\t\t\t\t\t\t\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t<SiteEditorCanvas />\n\t\t\t\t\t\t\t\t\t\t<BlockRemovalWarningModal\n\t\t\t\t\t\t\t\t\t\t\trules={ blockRemovalRules }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<PatternModal />\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\t{ editorMode === 'text' && isEditMode && (\n\t\t\t\t\t\t\t\t\t<CodeEditor />\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<KeyboardShortcutsEditMode />\n\t\t\t\t\t\t\t\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t\t\t\t\t\t\t\t<EditorKeyboardShortcuts />\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\tsecondarySidebar={\n\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t( ( shouldShowInserter && <InserterSidebar /> ) ||\n\t\t\t\t\t\t\t\t( shouldShowListView && <ListViewSidebar /> ) )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsidebar={\n\t\t\t\t\t\t\t! isDistractionFree &&\n\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\tisRightSidebarOpen &&\n\t\t\t\t\t\t\t! isDistractionFree && (\n\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfooter={\n\t\t\t\t\t\t\tshouldShowBlockBreadcrumbs && (\n\t\t\t\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\t\t\t\trootLabelText={ postTypeLabel }\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\tlabels={ {\n\t\t\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</EditorProvider>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAOA,IAAAM,U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AACC,KAAK,EAAC;IAAgB,CAAE,CAEjD;IACDpG,MAAM,EACLoD,0BAA0B,IACzB,IAAAiB,MAAA,CAAAC,aAAA,EAACxG,YAAA,CAAAuI,eAAe;MACfC,aAAa,EAAG7E;IAAe,CAC/B,CAEF;IACD8E,MAAM,EAAG;MACR,GAAG5G,eAAe;MAClBsG,gBAAgB,EAAE1C;IACnB;EAAG,CACH,CACc,CAEhB,CAAC;AAEL"}
|
|
@@ -83,7 +83,6 @@ function EditorCanvasContainer({
|
|
|
83
83
|
} = (0, _data.useDispatch)(_editor.store);
|
|
84
84
|
const focusOnMountRef = (0, _compose.useFocusOnMount)('firstElement');
|
|
85
85
|
const sectionFocusReturnRef = (0, _compose.useFocusReturn)();
|
|
86
|
-
const title = (0, _element.useMemo)(() => getEditorCanvasContainerTitle(editorCanvasContainerView), [editorCanvasContainerView]);
|
|
87
86
|
function onCloseContainer() {
|
|
88
87
|
setIsListViewOpened(showListViewByDefault);
|
|
89
88
|
setEditorCanvasContainerView(undefined);
|
|
@@ -106,6 +105,7 @@ function EditorCanvasContainer({
|
|
|
106
105
|
if (isClosed) {
|
|
107
106
|
return null;
|
|
108
107
|
}
|
|
108
|
+
const title = getEditorCanvasContainerTitle(editorCanvasContainerView);
|
|
109
109
|
const shouldShowCloseButton = onClose || closeButtonLabel;
|
|
110
110
|
return (0, _react.createElement)(EditorCanvasContainerFill, null, (0, _react.createElement)(_resizableEditor.default, {
|
|
111
111
|
enableResizing: enableResizing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_components","_keycodes","_i18n","_data","_icons","_compose","_preferences","_editor","_lockUnlock","_store","_resizableEditor","_interopRequireDefault","getEditorCanvasContainerTitle","view","__","createPrivateSlotFill","unlock","componentsPrivateApis","SLOT_FILL_NAME","privateKey","Slot","EditorCanvasContainerSlot","Fill","EditorCanvasContainerFill","EditorCanvasContainer","children","closeButtonLabel","onClose","enableResizing","editorCanvasContainerView","showListViewByDefault","useSelect","select","_editorCanvasContainerView","editSiteStore","getEditorCanvasContainerView","_showListViewByDefault","preferencesStore","get","isClosed","setIsClosed","useState","setEditorCanvasContainerView","useDispatch","setIsListViewOpened","editorStore","focusOnMountRef","useFocusOnMount","sectionFocusReturnRef","useFocusReturn","
|
|
1
|
+
{"version":3,"names":["_element","require","_components","_keycodes","_i18n","_data","_icons","_compose","_preferences","_editor","_lockUnlock","_store","_resizableEditor","_interopRequireDefault","getEditorCanvasContainerTitle","view","__","createPrivateSlotFill","unlock","componentsPrivateApis","SLOT_FILL_NAME","privateKey","Slot","EditorCanvasContainerSlot","Fill","EditorCanvasContainerFill","EditorCanvasContainer","children","closeButtonLabel","onClose","enableResizing","editorCanvasContainerView","showListViewByDefault","useSelect","select","_editorCanvasContainerView","editSiteStore","getEditorCanvasContainerView","_showListViewByDefault","preferencesStore","get","isClosed","setIsClosed","useState","setEditorCanvasContainerView","useDispatch","setIsListViewOpened","editorStore","focusOnMountRef","useFocusOnMount","sectionFocusReturnRef","useFocusReturn","onCloseContainer","undefined","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","childrenWithProps","Array","isArray","Children","map","child","index","cloneElement","ref","title","shouldShowCloseButton","_react","createElement","default","className","onKeyDown","Button","icon","closeSmall","label","onClick","showTooltip","useHasEditorCanvasContainer","fills","useSlotFills","length","_default","exports"],"sources":["@wordpress/edit-site/src/components/editor-canvas-container/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Children, cloneElement, useState } from '@wordpress/element';\nimport {\n\tButton,\n\tprivateApis as componentsPrivateApis,\n\t__experimentalUseSlotFills as useSlotFills,\n} 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';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport ResizableEditor from '../block-editor/resizable-editor';\n\n/**\n * Returns a translated string for the title of the editor canvas container.\n *\n * @param {string} view Editor canvas container view.\n *\n * @return {string} Translated string corresponding to value of view. Default is ''.\n */\nfunction getEditorCanvasContainerTitle( view ) {\n\tswitch ( view ) {\n\t\tcase 'style-book':\n\t\t\treturn __( 'Style Book' );\n\t\tcase 'global-styles-revisions':\n\t\tcase 'global-styles-revisions:style-book':\n\t\t\treturn __( 'Style Revisions' );\n\t\tdefault:\n\t\t\treturn '';\n\t}\n}\n\n// Creates a private slot fill.\nconst { createPrivateSlotFill } = unlock( componentsPrivateApis );\nconst SLOT_FILL_NAME = 'EditSiteEditorCanvasContainerSlot';\nconst {\n\tprivateKey,\n\tSlot: EditorCanvasContainerSlot,\n\tFill: EditorCanvasContainerFill,\n} = createPrivateSlotFill( SLOT_FILL_NAME );\n\nfunction EditorCanvasContainer( {\n\tchildren,\n\tcloseButtonLabel,\n\tonClose,\n\tenableResizing = false,\n} ) {\n\tconst { editorCanvasContainerView, showListViewByDefault } = useSelect(\n\t\t( select ) => {\n\t\t\tconst _editorCanvasContainerView = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView();\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\teditorCanvasContainerView: _editorCanvasContainerView,\n\t\t\t\tshowListViewByDefault: _showListViewByDefault,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst sectionFocusReturnRef = useFocusReturn();\n\n\tfunction onCloseContainer() {\n\t\tsetIsListViewOpened( showListViewByDefault );\n\t\tsetEditorCanvasContainerView( undefined );\n\t\tsetIsClosed( true );\n\t\tif ( typeof onClose === 'function' ) {\n\t\t\tonClose();\n\t\t}\n\t}\n\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tonCloseContainer();\n\t\t}\n\t}\n\n\tconst childrenWithProps = Array.isArray( children )\n\t\t? Children.map( children, ( child, index ) =>\n\t\t\t\tindex === 0\n\t\t\t\t\t? cloneElement( child, {\n\t\t\t\t\t\t\tref: sectionFocusReturnRef,\n\t\t\t\t\t } )\n\t\t\t\t\t: child\n\t\t )\n\t\t: cloneElement( children, {\n\t\t\t\tref: sectionFocusReturnRef,\n\t\t } );\n\n\tif ( isClosed ) {\n\t\treturn null;\n\t}\n\n\tconst title = getEditorCanvasContainerTitle( editorCanvasContainerView );\n\tconst shouldShowCloseButton = onClose || closeButtonLabel;\n\n\treturn (\n\t\t<EditorCanvasContainerFill>\n\t\t\t<ResizableEditor enableResizing={ enableResizing }>\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=\"edit-site-editor-canvas-container\"\n\t\t\t\t\tref={ shouldShowCloseButton ? focusOnMountRef : null }\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{ shouldShowCloseButton && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"edit-site-editor-canvas-container__close-button\"\n\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\tlabel={ closeButtonLabel || __( 'Close' ) }\n\t\t\t\t\t\t\tonClick={ onCloseContainer }\n\t\t\t\t\t\t\tshowTooltip={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ childrenWithProps }\n\t\t\t\t</section>\n\t\t\t</ResizableEditor>\n\t\t</EditorCanvasContainerFill>\n\t);\n}\nfunction useHasEditorCanvasContainer() {\n\tconst fills = useSlotFills( privateKey );\n\treturn !! fills?.length;\n}\n\nEditorCanvasContainer.Slot = EditorCanvasContainerSlot;\nexport default EditorCanvasContainer;\nexport { useHasEditorCanvasContainer, getEditorCanvasContainerTitle };\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAKA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,gBAAA,GAAAC,sBAAA,CAAAZ,OAAA;AAtBA;AACA;AACA;;AAeA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASa,6BAA6BA,CAAEC,IAAI,EAAG;EAC9C,QAASA,IAAI;IACZ,KAAK,YAAY;MAChB,OAAO,IAAAC,QAAE,EAAE,YAAa,CAAC;IAC1B,KAAK,yBAAyB;IAC9B,KAAK,oCAAoC;MACxC,OAAO,IAAAA,QAAE,EAAE,iBAAkB,CAAC;IAC/B;MACC,OAAO,EAAE;EACX;AACD;;AAEA;AACA,MAAM;EAAEC;AAAsB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;AACjE,MAAMC,cAAc,GAAG,mCAAmC;AAC1D,MAAM;EACLC,UAAU;EACVC,IAAI,EAAEC,yBAAyB;EAC/BC,IAAI,EAAEC;AACP,CAAC,GAAGR,qBAAqB,CAAEG,cAAe,CAAC;AAE3C,SAASM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AAG,IAAAC,sCAAY,EAAE/D,UAAW,CAAC;EACxC,OAAO,CAAC,CAAE8D,KAAK,EAAEE,MAAM;AACxB;AAEA3D,qBAAqB,CAACJ,IAAI,GAAGC,yBAAyB;AAAC,IAAA+D,QAAA,GAAAC,OAAA,CAAAd,OAAA,GACxC/C,qBAAqB"}
|
|
@@ -12,7 +12,6 @@ var _i18n = require("@wordpress/i18n");
|
|
|
12
12
|
var _icons = require("@wordpress/icons");
|
|
13
13
|
var _components = require("@wordpress/components");
|
|
14
14
|
var _editor = require("@wordpress/editor");
|
|
15
|
-
var _store = require("../../../store");
|
|
16
15
|
var _lockUnlock = require("../../../lock-unlock");
|
|
17
16
|
/**
|
|
18
17
|
* WordPress dependencies
|
|
@@ -35,7 +34,7 @@ function DocumentTools({
|
|
|
35
34
|
} = (0, _data.useSelect)(select => {
|
|
36
35
|
const {
|
|
37
36
|
getEditorMode
|
|
38
|
-
} = select(
|
|
37
|
+
} = select(_editor.store);
|
|
39
38
|
return {
|
|
40
39
|
isVisualMode: getEditorMode() === 'visual'
|
|
41
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_compose","require","_blockEditor","_data","_i18n","_icons","_components","_editor","
|
|
1
|
+
{"version":3,"names":["_compose","require","_blockEditor","_data","_i18n","_icons","_components","_editor","_lockUnlock","DocumentTools","EditorDocumentTools","unlock","editorPrivateApis","blockEditorMode","hasFixedToolbar","isDistractionFree","isVisualMode","useSelect","select","getEditorMode","editorStore","__unstableSetEditorMode","useDispatch","blockEditorStore","setDeviceType","isLargeViewport","useViewportMatch","isZoomedOutViewExperimentEnabled","window","__experimentalEnableZoomedOutView","isZoomedOutView","_react","createElement","disableBlockTools","listViewLabel","__","ToolbarItem","as","Button","className","icon","chevronUpDown","isPressed","label","onClick","size"],"sources":["@wordpress/edit-site/src/components/header-edit-mode/document-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { chevronUpDown } from '@wordpress/icons';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst { DocumentTools: EditorDocumentTools } = unlock( editorPrivateApis );\n\nexport default function DocumentTools( {\n\tblockEditorMode,\n\thasFixedToolbar,\n\tisDistractionFree,\n} ) {\n\tconst { isVisualMode } = useSelect( ( select ) => {\n\t\tconst { getEditorMode } = select( editorStore );\n\n\t\treturn {\n\t\t\tisVisualMode: getEditorMode() === 'visual',\n\t\t};\n\t}, [] );\n\tconst { __unstableSetEditorMode } = useDispatch( blockEditorStore );\n\tconst { setDeviceType } = useDispatch( editorStore );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isZoomedOutViewExperimentEnabled =\n\t\twindow?.__experimentalEnableZoomedOutView && isVisualMode;\n\tconst isZoomedOutView = blockEditorMode === 'zoom-out';\n\n\treturn (\n\t\t<EditorDocumentTools\n\t\t\tdisableBlockTools={ ! isVisualMode }\n\t\t\tlistViewLabel={ __( 'List View' ) }\n\t\t>\n\t\t\t{ isZoomedOutViewExperimentEnabled &&\n\t\t\t\tisLargeViewport &&\n\t\t\t\t! isDistractionFree &&\n\t\t\t\t! hasFixedToolbar && (\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\tclassName=\"edit-site-header-edit-mode__zoom-out-view-toggle\"\n\t\t\t\t\t\ticon={ chevronUpDown }\n\t\t\t\t\t\tisPressed={ isZoomedOutView }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'Zoom-out View' ) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetDeviceType( 'Desktop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EAEtD,OACC,IAAAkB,MAAA,CAAAC,aAAA,EAACtB,mBAAmB;IACnBuB,iBAAiB,EAAG,CAAEjB,YAAc;IACpCkB,aAAa,EAAG,IAAAC,QAAE,EAAE,WAAY;EAAG,GAEjCR,gCAAgC,IACjCF,eAAe,IACf,CAAEV,iBAAiB,IACnB,CAAED,eAAe,IAChB,IAAAiB,MAAA,CAAAC,aAAA,EAAC1B,WAAA,CAAA8B,WAAW;IACXC,EAAE,EAAGC,kBAAQ;IACbC,SAAS,EAAC,kDAAkD;IAC5DC,IAAI,EAAGC,oBAAe;IACtBC,SAAS,EAAGZ;IACZ;IACAa,KAAK,EAAG,IAAAR,QAAE,EAAE,eAAgB,CAAG;IAC/BS,OAAO,EAAGA,CAAA,KAAM;MACfpB,aAAa,CAAE,SAAU,CAAC;MAC1BH,uBAAuB,CACtBS,eAAe,GAAG,MAAM,GAAG,UAC5B,CAAC;IACF,CAAG;IACHe,IAAI,EAAC;EAAS,CACd,CAEiB,CAAC;AAExB"}
|
|
@@ -153,7 +153,9 @@ function HeaderEditMode() {
|
|
|
153
153
|
})
|
|
154
154
|
}, (0, _react.createElement)(PreviewDropdown, {
|
|
155
155
|
disabled: isFocusMode || !hasDefaultEditorCanvasView
|
|
156
|
-
})), (0, _react.createElement)(PostViewLink, null), (0, _react.createElement)(_saveButton.default,
|
|
156
|
+
})), (0, _react.createElement)(PostViewLink, null), (0, _react.createElement)(_saveButton.default, {
|
|
157
|
+
size: "compact"
|
|
158
|
+
}), !isDistractionFree && (0, _react.createElement)(_interface.PinnedItems.Slot, {
|
|
157
159
|
scope: "core/edit-site"
|
|
158
160
|
}), (0, _react.createElement)(_moreMenu.default, {
|
|
159
161
|
showIconLabels: showIconLabels
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_compose","_blockEditor","_data","_element","_interface","_i18n","_icons","_components","_preferences","_editor","_moreMenu","_saveButton","_documentTools","_store","_editorCanvasContainer","_lockUnlock","_constants","PostViewLink","PreviewDropdown","unlock","editorPrivateApis","HeaderEditMode","templateType","isDistractionFree","blockEditorMode","blockSelectionStart","showIconLabels","editorCanvasView","hasFixedToolbar","isZoomOutMode","useSelect","select","getEditedPostType","editSiteStore","getBlockSelectionStart","__unstableGetEditorMode","blockEditorStore","get","getPreference","preferencesStore","getDeviceType","editorStore","deviceType","getEditorCanvasContainerView","isLargeViewport","useViewportMatch","isTopToolbar","blockToolbarRef","useRef","disableMotion","useReducedMotion","hasDefaultEditorCanvasView","useHasEditorCanvasContainer","isFocusMode","FOCUSABLE_ENTITIES","includes","isZoomedOutView","isBlockToolsCollapsed","setIsBlockToolsCollapsed","useState","hasBlockSelected","useEffect","toolbarVariants","y","isDistractionFreeHovering","view","edit","toolbarTransition","type","duration","ease","_react","createElement","className","classnames","__unstableMotion","div","variants","transition","default","Fragment","BlockToolbar","hideDragHandle","Popover","Slot","ref","name","Button","icon","next","previous","onClick","collapsed","label","__","getEditorCanvasContainerTitle","DocumentBar","disabled","PinnedItems","scope"],"sources":["@wordpress/edit-site/src/components/header-edit-mode/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch, useReducedMotion } from '@wordpress/compose';\nimport {\n\tBlockToolbar,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { PinnedItems } from '@wordpress/interface';\nimport { __ } from '@wordpress/i18n';\nimport { next, previous } from '@wordpress/icons';\nimport {\n\tButton,\n\t__unstableMotion as motion,\n\tPopover,\n} from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tDocumentBar,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport MoreMenu from './more-menu';\nimport SaveButton from '../save-button';\nimport DocumentTools from './document-tools';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tgetEditorCanvasContainerTitle,\n\tuseHasEditorCanvasContainer,\n} from '../editor-canvas-container';\nimport { unlock } from '../../lock-unlock';\nimport { FOCUSABLE_ENTITIES } from '../../utils/constants';\n\nconst { PostViewLink, PreviewDropdown } = unlock( editorPrivateApis );\n\nexport default function HeaderEditMode() {\n\tconst {\n\t\ttemplateType,\n\t\tisDistractionFree,\n\t\tblockEditorMode,\n\t\tblockSelectionStart,\n\t\tshowIconLabels,\n\t\teditorCanvasView,\n\t\thasFixedToolbar,\n\t\tisZoomOutMode,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditedPostType } = select( editSiteStore );\n\t\tconst { getBlockSelectionStart, __unstableGetEditorMode } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst { getDeviceType } = select( editorStore );\n\n\t\treturn {\n\t\t\tdeviceType: getDeviceType(),\n\t\t\ttemplateType: getEditedPostType(),\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t\tblockSelectionStart: getBlockSelectionStart(),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t\teditorCanvasView: unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView(),\n\t\t\thasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),\n\t\t\tisDistractionFree: getPreference( 'core', 'distractionFree' ),\n\t\t\tisZoomOutMode: __unstableGetEditorMode() === 'zoom-out',\n\t\t};\n\t}, [] );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isTopToolbar = ! isZoomOutMode && hasFixedToolbar && isLargeViewport;\n\tconst blockToolbarRef = useRef();\n\tconst disableMotion = useReducedMotion();\n\n\tconst hasDefaultEditorCanvasView = ! useHasEditorCanvasContainer();\n\n\tconst isFocusMode = FOCUSABLE_ENTITIES.includes( templateType );\n\n\tconst isZoomedOutView = blockEditorMode === 'zoom-out';\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\tconst hasBlockSelected = !! blockSelectionStart;\n\n\tuseEffect( () => {\n\t\t// If we have a new block selection, show the block tools\n\t\tif ( blockSelectionStart ) {\n\t\t\tsetIsBlockToolsCollapsed( false );\n\t\t}\n\t}, [ blockSelectionStart ] );\n\n\tconst toolbarVariants = {\n\t\tisDistractionFree: { y: '-50px' },\n\t\tisDistractionFreeHovering: { y: 0 },\n\t\tview: { y: 0 },\n\t\tedit: { y: 0 },\n\t};\n\n\tconst toolbarTransition = {\n\t\ttype: 'tween',\n\t\tduration: disableMotion ? 0 : 0.2,\n\t\tease: 'easeOut',\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames( 'edit-site-header-edit-mode', {\n\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t} ) }\n\t\t>\n\t\t\t{ hasDefaultEditorCanvasView && (\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"edit-site-header-edit-mode__start\"\n\t\t\t\t\tvariants={ toolbarVariants }\n\t\t\t\t\ttransition={ toolbarTransition }\n\t\t\t\t>\n\t\t\t\t\t<DocumentTools\n\t\t\t\t\t\tblockEditorMode={ blockEditorMode }\n\t\t\t\t\t\tisDistractionFree={ isDistractionFree }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isTopToolbar && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t'selected-block-tools-wrapper',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'is-collapsed': isBlockToolsCollapsed,\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\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ hasBlockSelected && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-header-edit-mode__block-tools-toggle\"\n\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\tisBlockToolsCollapsed ? next : previous\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetIsBlockToolsCollapsed(\n\t\t\t\t\t\t\t\t\t\t\t( collapsed ) => ! collapsed\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\tisBlockToolsCollapsed\n\t\t\t\t\t\t\t\t\t\t\t? __( 'Show block tools' )\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Hide block tools' )\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) }\n\t\t\t\t</motion.div>\n\t\t\t) }\n\n\t\t\t{ ! isDistractionFree && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'edit-site-header-edit-mode__center',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-collapsed':\n\t\t\t\t\t\t\t\t! isBlockToolsCollapsed && isLargeViewport,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ ! hasDefaultEditorCanvasView ? (\n\t\t\t\t\t\tgetEditorCanvasContainerTitle( editorCanvasView )\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<DocumentBar />\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t<div className=\"edit-site-header-edit-mode__end\">\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"edit-site-header-edit-mode__actions\"\n\t\t\t\t\tvariants={ toolbarVariants }\n\t\t\t\t\ttransition={ toolbarTransition }\n\t\t\t\t>\n\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'edit-site-header-edit-mode__preview-options',\n\t\t\t\t\t\t\t\t{ 'is-zoomed-out': isZoomedOutView }\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PreviewDropdown\n\t\t\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t\t\tisFocusMode || ! hasDefaultEditorCanvasView\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<PostViewLink />\n\t\t\t\t\t<SaveButton />\n\t\t\t\t\t{ ! isDistractionFree && (\n\t\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t) }\n\t\t\t\t\t<MoreMenu showIconLabels={ showIconLabels } />\n\t\t\t\t</motion.div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAIA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAKA,IAAAS,YAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AASA,IAAAW,SAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,WAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAA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","_element","_interface","_i18n","_icons","_components","_preferences","_editor","_moreMenu","_saveButton","_documentTools","_store","_editorCanvasContainer","_lockUnlock","_constants","PostViewLink","PreviewDropdown","unlock","editorPrivateApis","HeaderEditMode","templateType","isDistractionFree","blockEditorMode","blockSelectionStart","showIconLabels","editorCanvasView","hasFixedToolbar","isZoomOutMode","useSelect","select","getEditedPostType","editSiteStore","getBlockSelectionStart","__unstableGetEditorMode","blockEditorStore","get","getPreference","preferencesStore","getDeviceType","editorStore","deviceType","getEditorCanvasContainerView","isLargeViewport","useViewportMatch","isTopToolbar","blockToolbarRef","useRef","disableMotion","useReducedMotion","hasDefaultEditorCanvasView","useHasEditorCanvasContainer","isFocusMode","FOCUSABLE_ENTITIES","includes","isZoomedOutView","isBlockToolsCollapsed","setIsBlockToolsCollapsed","useState","hasBlockSelected","useEffect","toolbarVariants","y","isDistractionFreeHovering","view","edit","toolbarTransition","type","duration","ease","_react","createElement","className","classnames","__unstableMotion","div","variants","transition","default","Fragment","BlockToolbar","hideDragHandle","Popover","Slot","ref","name","Button","icon","next","previous","onClick","collapsed","label","__","getEditorCanvasContainerTitle","DocumentBar","disabled","size","PinnedItems","scope"],"sources":["@wordpress/edit-site/src/components/header-edit-mode/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch, useReducedMotion } from '@wordpress/compose';\nimport {\n\tBlockToolbar,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { PinnedItems } from '@wordpress/interface';\nimport { __ } from '@wordpress/i18n';\nimport { next, previous } from '@wordpress/icons';\nimport {\n\tButton,\n\t__unstableMotion as motion,\n\tPopover,\n} from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tDocumentBar,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport MoreMenu from './more-menu';\nimport SaveButton from '../save-button';\nimport DocumentTools from './document-tools';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tgetEditorCanvasContainerTitle,\n\tuseHasEditorCanvasContainer,\n} from '../editor-canvas-container';\nimport { unlock } from '../../lock-unlock';\nimport { FOCUSABLE_ENTITIES } from '../../utils/constants';\n\nconst { PostViewLink, PreviewDropdown } = unlock( editorPrivateApis );\n\nexport default function HeaderEditMode() {\n\tconst {\n\t\ttemplateType,\n\t\tisDistractionFree,\n\t\tblockEditorMode,\n\t\tblockSelectionStart,\n\t\tshowIconLabels,\n\t\teditorCanvasView,\n\t\thasFixedToolbar,\n\t\tisZoomOutMode,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditedPostType } = select( editSiteStore );\n\t\tconst { getBlockSelectionStart, __unstableGetEditorMode } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst { getDeviceType } = select( editorStore );\n\n\t\treturn {\n\t\t\tdeviceType: getDeviceType(),\n\t\t\ttemplateType: getEditedPostType(),\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t\tblockSelectionStart: getBlockSelectionStart(),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t\teditorCanvasView: unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView(),\n\t\t\thasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),\n\t\t\tisDistractionFree: getPreference( 'core', 'distractionFree' ),\n\t\t\tisZoomOutMode: __unstableGetEditorMode() === 'zoom-out',\n\t\t};\n\t}, [] );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isTopToolbar = ! isZoomOutMode && hasFixedToolbar && isLargeViewport;\n\tconst blockToolbarRef = useRef();\n\tconst disableMotion = useReducedMotion();\n\n\tconst hasDefaultEditorCanvasView = ! useHasEditorCanvasContainer();\n\n\tconst isFocusMode = FOCUSABLE_ENTITIES.includes( templateType );\n\n\tconst isZoomedOutView = blockEditorMode === 'zoom-out';\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\tconst hasBlockSelected = !! blockSelectionStart;\n\n\tuseEffect( () => {\n\t\t// If we have a new block selection, show the block tools\n\t\tif ( blockSelectionStart ) {\n\t\t\tsetIsBlockToolsCollapsed( false );\n\t\t}\n\t}, [ blockSelectionStart ] );\n\n\tconst toolbarVariants = {\n\t\tisDistractionFree: { y: '-50px' },\n\t\tisDistractionFreeHovering: { y: 0 },\n\t\tview: { y: 0 },\n\t\tedit: { y: 0 },\n\t};\n\n\tconst toolbarTransition = {\n\t\ttype: 'tween',\n\t\tduration: disableMotion ? 0 : 0.2,\n\t\tease: 'easeOut',\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames( 'edit-site-header-edit-mode', {\n\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t} ) }\n\t\t>\n\t\t\t{ hasDefaultEditorCanvasView && (\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"edit-site-header-edit-mode__start\"\n\t\t\t\t\tvariants={ toolbarVariants }\n\t\t\t\t\ttransition={ toolbarTransition }\n\t\t\t\t>\n\t\t\t\t\t<DocumentTools\n\t\t\t\t\t\tblockEditorMode={ blockEditorMode }\n\t\t\t\t\t\tisDistractionFree={ isDistractionFree }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isTopToolbar && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t'selected-block-tools-wrapper',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'is-collapsed': isBlockToolsCollapsed,\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\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ hasBlockSelected && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-header-edit-mode__block-tools-toggle\"\n\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\tisBlockToolsCollapsed ? next : previous\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetIsBlockToolsCollapsed(\n\t\t\t\t\t\t\t\t\t\t\t( collapsed ) => ! collapsed\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\tisBlockToolsCollapsed\n\t\t\t\t\t\t\t\t\t\t\t? __( 'Show block tools' )\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Hide block tools' )\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) }\n\t\t\t\t</motion.div>\n\t\t\t) }\n\n\t\t\t{ ! isDistractionFree && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'edit-site-header-edit-mode__center',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-collapsed':\n\t\t\t\t\t\t\t\t! isBlockToolsCollapsed && isLargeViewport,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ ! hasDefaultEditorCanvasView ? (\n\t\t\t\t\t\tgetEditorCanvasContainerTitle( editorCanvasView )\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<DocumentBar />\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t<div className=\"edit-site-header-edit-mode__end\">\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"edit-site-header-edit-mode__actions\"\n\t\t\t\t\tvariants={ toolbarVariants }\n\t\t\t\t\ttransition={ toolbarTransition }\n\t\t\t\t>\n\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'edit-site-header-edit-mode__preview-options',\n\t\t\t\t\t\t\t\t{ 'is-zoomed-out': isZoomedOutView }\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PreviewDropdown\n\t\t\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t\t\tisFocusMode || ! hasDefaultEditorCanvasView\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<PostViewLink />\n\t\t\t\t\t<SaveButton size=\"compact\" />\n\t\t\t\t\t{ ! isDistractionFree && (\n\t\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t) }\n\t\t\t\t\t<MoreMenu showIconLabels={ showIconLabels } />\n\t\t\t\t</motion.div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAIA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAKA,IAAAS,YAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AASA,I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;IAACrD,cAAc,EAAGA;EAAgB,CAAE,CAClC,CACR,CACD,CAAC;AAER"}
|
|
@@ -14,14 +14,14 @@ var _components = require("@wordpress/components");
|
|
|
14
14
|
var _interface = require("@wordpress/interface");
|
|
15
15
|
var _preferences = require("@wordpress/preferences");
|
|
16
16
|
var _coreData = require("@wordpress/core-data");
|
|
17
|
+
var _editor = require("@wordpress/editor");
|
|
17
18
|
var _keyboardShortcutHelpModal = _interopRequireWildcard(require("../../keyboard-shortcut-help-modal"));
|
|
18
19
|
var _preferencesModal = _interopRequireWildcard(require("../../preferences-modal"));
|
|
19
20
|
var _toolsMoreMenuGroup = _interopRequireDefault(require("../tools-more-menu-group"));
|
|
20
21
|
var _siteExport = _interopRequireDefault(require("./site-export"));
|
|
21
22
|
var _welcomeGuideMenuItem = _interopRequireDefault(require("./welcome-guide-menu-item"));
|
|
22
23
|
var _copyContentMenuItem = _interopRequireDefault(require("./copy-content-menu-item"));
|
|
23
|
-
var
|
|
24
|
-
var _store = require("../../../store");
|
|
24
|
+
var _lockUnlock = require("../../../lock-unlock");
|
|
25
25
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
26
26
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
27
27
|
/**
|
|
@@ -32,6 +32,9 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
32
32
|
* Internal dependencies
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
|
+
const {
|
|
36
|
+
ModeSwitcher
|
|
37
|
+
} = (0, _lockUnlock.unlock)(_editor.privateApis);
|
|
35
38
|
function MoreMenu({
|
|
36
39
|
showIconLabels
|
|
37
40
|
}) {
|
|
@@ -46,7 +49,7 @@ function MoreMenu({
|
|
|
46
49
|
}, []);
|
|
47
50
|
const {
|
|
48
51
|
toggleDistractionFree
|
|
49
|
-
} = (0, _data.useDispatch)(
|
|
52
|
+
} = (0, _data.useDispatch)(_editor.store);
|
|
50
53
|
const turnOffDistractionFree = () => {
|
|
51
54
|
setPreference('core', 'distractionFree', false);
|
|
52
55
|
};
|
|
@@ -86,7 +89,7 @@ function MoreMenu({
|
|
|
86
89
|
info: (0, _i18n.__)('Focus on one block at a time'),
|
|
87
90
|
messageActivated: (0, _i18n.__)('Spotlight mode activated'),
|
|
88
91
|
messageDeactivated: (0, _i18n.__)('Spotlight mode deactivated')
|
|
89
|
-
})), (0, _react.createElement)(
|
|
92
|
+
})), (0, _react.createElement)(ModeSwitcher, null), (0, _react.createElement)(_interface.ActionItem.Slot, {
|
|
90
93
|
name: "core/edit-site/plugin-more-menu",
|
|
91
94
|
label: (0, _i18n.__)('Plugins'),
|
|
92
95
|
as: _components.MenuGroup,
|