@wordpress/edit-site 5.12.9 → 5.12.11
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/build/components/add-new-page/index.js +1 -6
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/add-new-pattern/index.js +10 -2
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/editor/index.js +10 -1
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +10 -22
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/layout/index.js +33 -25
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page-actions/index.js +2 -2
- package/build/components/page-actions/index.js.map +1 -1
- package/build/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +8 -15
- package/build/components/page-actions/trash-page-menu-item.js.map +1 -0
- package/build/components/page-patterns/grid-item.js +1 -1
- package/build/components/page-patterns/grid-item.js.map +1 -1
- package/build/components/page-patterns/patterns-list.js +2 -1
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +13 -5
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/resizable-frame/index.js +3 -4
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-status.js +3 -8
- package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +10 -14
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +11 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build/components/site-hub/index.js +16 -7
- package/build/components/site-hub/index.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +78 -20
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/components/add-new-page/index.js +1 -6
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +8 -2
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/editor/index.js +10 -1
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +10 -22
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/layout/index.js +33 -25
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page-actions/index.js +2 -2
- package/build-module/components/page-actions/index.js.map +1 -1
- package/build-module/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +8 -16
- package/build-module/components/page-actions/trash-page-menu-item.js.map +1 -0
- package/build-module/components/page-patterns/grid-item.js +1 -1
- package/build-module/components/page-patterns/grid-item.js.map +1 -1
- package/build-module/components/page-patterns/patterns-list.js +3 -2
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +13 -5
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +3 -4
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +3 -8
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +10 -14
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +10 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build-module/components/site-hub/index.js +16 -7
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +74 -20
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-style/style-rtl.css +14 -16
- package/build-style/style.css +14 -16
- package/package.json +21 -21
- package/src/components/add-new-page/index.js +0 -3
- package/src/components/add-new-pattern/index.js +8 -2
- package/src/components/editor/index.js +15 -1
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +17 -31
- package/src/components/layout/index.js +54 -45
- package/src/components/layout/style.scss +1 -1
- package/src/components/page-actions/index.js +2 -2
- package/src/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +9 -21
- package/src/components/page-patterns/grid-item.js +1 -1
- package/src/components/page-patterns/patterns-list.js +16 -6
- package/src/components/page-patterns/use-patterns.js +12 -5
- package/src/components/resizable-frame/index.js +2 -3
- package/src/components/resizable-frame/style.scss +0 -17
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +2 -5
- package/src/components/sidebar-navigation-screen-patterns/index.js +10 -13
- package/src/components/sidebar-navigation-screen-patterns/style.scss +5 -7
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +9 -0
- package/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -1
- package/src/components/site-hub/index.js +21 -7
- package/src/components/site-hub/style.scss +9 -2
- package/src/hooks/commands/use-common-commands.js +56 -23
- package/build/components/page-actions/delete-page-menu-item.js.map +0 -1
- package/build-module/components/page-actions/delete-page-menu-item.js.map +0 -1
|
@@ -56,6 +56,13 @@ const typeLabels = {
|
|
|
56
56
|
wp_template: __('Template Part'),
|
|
57
57
|
wp_template_part: __('Template Part'),
|
|
58
58
|
wp_block: __('Pattern')
|
|
59
|
+
}; // Prevent accidental removal of certain blocks, asking the user for
|
|
60
|
+
// confirmation.
|
|
61
|
+
|
|
62
|
+
const blockRemovalRules = {
|
|
63
|
+
'core/query': __('Query Loop displays a list of posts or pages.'),
|
|
64
|
+
'core/post-content': __('Post Content displays the content of a post or page.'),
|
|
65
|
+
'core/post-template': __('Post Template displays each post or page in a Query Loop.')
|
|
59
66
|
};
|
|
60
67
|
export default function Editor({
|
|
61
68
|
isLoading
|
|
@@ -166,7 +173,9 @@ export default function Editor({
|
|
|
166
173
|
'is-loading': isLoading
|
|
167
174
|
}),
|
|
168
175
|
notices: createElement(EditorSnackbars, null),
|
|
169
|
-
content: createElement(Fragment, null, createElement(GlobalStylesRenderer, null), isEditMode && createElement(EditorNotices, null), showVisualEditor && editedPost && createElement(Fragment, null, createElement(BlockEditor, null), createElement(BlockRemovalWarningModal,
|
|
176
|
+
content: createElement(Fragment, null, createElement(GlobalStylesRenderer, null), isEditMode && createElement(EditorNotices, null), showVisualEditor && editedPost && createElement(Fragment, null, createElement(BlockEditor, null), createElement(BlockRemovalWarningModal, {
|
|
177
|
+
rules: blockRemovalRules
|
|
178
|
+
})), editorMode === 'text' && editedPost && isEditMode && createElement(CodeEditor, null), hasLoadedPost && !editedPost && createElement(Notice, {
|
|
170
179
|
status: "warning",
|
|
171
180
|
isDismissible: false
|
|
172
181
|
}, __("You attempted to edit an item that doesn't exist. Perhaps it was deleted?")), isEditMode && createElement(KeyboardShortcutsEditMode, null)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/editor/index.js"],"names":["classnames","useMemo","useSelect","useDispatch","Notice","EntityProvider","store","preferencesStore","BlockContextProvider","BlockBreadcrumb","blockEditorStore","privateApis","blockEditorPrivateApis","InterfaceSkeleton","ComplementaryArea","interfaceStore","EditorNotices","EditorSnackbars","__","sprintf","SidebarComplementaryAreaFills","BlockEditor","CodeEditor","KeyboardShortcutsEditMode","InserterSidebar","ListViewSidebar","WelcomeGuide","StartTemplateOptions","editSiteStore","GlobalStylesRenderer","useTitle","CanvasSpinner","unlock","useEditedEntityRecord","SidebarFixedBottomSlot","BlockRemovalWarningModal","interfaceLabels","body","sidebar","actions","footer","typeLabels","wp_template","wp_template_part","wp_block","Editor","isLoading","record","editedPost","getTitle","isLoaded","hasLoadedPost","id","editedPostId","type","editedPostType","context","editorMode","canvasMode","blockEditorMode","isRightSidebarOpen","isInserterOpen","isListViewOpen","showIconLabels","showBlockBreadcrumbs","hasPageContentFocus","select","getEditedPostContext","getEditorMode","getCanvasMode","isInserterOpened","isListViewOpened","_hasPageContentFocus","__unstableGetEditorMode","getActiveComplementaryArea","name","get","setEditedPostContext","isViewMode","isEditMode","showVisualEditor","shouldShowBlockBreadcrumbs","shouldShowInserter","shouldShowListView","secondarySidebarLabel","blockContext","postType","postId","nonPostFields","queryContext","page","newQueryContext","title","secondarySidebar"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,cAAT,QAA+B,sBAA/B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AACA,SACCC,oBADD,EAECC,eAFD,EAGCH,KAAK,IAAII,gBAHV,EAICC,WAAW,IAAIC,sBAJhB,QAKO,yBALP;AAMA,SACCC,iBADD,EAECC,iBAFD,EAGCR,KAAK,IAAIS,cAHV,QAIO,sBAJP;AAKA,SAASC,aAAT,EAAwBC,eAAxB,QAA+C,mBAA/C;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AAEA;AACA;AACA;;AACA,SAASC,6BAAT,QAA8C,sBAA9C;AACA,OAAOC,WAAP,MAAwB,iBAAxB;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,OAAOC,yBAAP,MAAsC,iCAAtC;AACA,OAAOC,eAAP,MAA4B,uCAA5B;AACA,OAAOC,eAAP,MAA4B,wCAA5B;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AACA,OAAOC,oBAAP,MAAiC,2BAAjC;AACA,SAASrB,KAAK,IAAIsB,aAAlB,QAAuC,aAAvC;AACA,SAASC,oBAAT,QAAqC,2BAArC;AAC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,cAAC,eAAD,OALQ,CAxCZ;AAgDC,IAAA,OAAO,EACNJ,UAAU,IACVnB,kBADA,IAEC,8BACC,cAAC,iBAAD,CAAmB,IAAnB;AAAwB,MAAA,KAAK,EAAC;AAA9B,MADD,EAEC,cAAC,sBAAD,OAFD,CAnDH;AAyDC,IAAA,MAAM,EACLqB,0BAA0B,IACzB,cAAC,eAAD;AACC,MAAA,aAAa,EACZhB,mBAAmB,GAChB/C,EAAE,CAAE,MAAF,CADc,GAEhBA,EAAE,CAAE,UAAF;AAJP,MA3DH;AAoEC,IAAA,MAAM,EAAG,EACR,GAAGkB,eADK;AAERyD,MAAAA,gBAAgB,EAAET;AAFV;AApEV,IAHD,CALD,CADD,CAHD,CADD;AA2FA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Notice } from '@wordpress/components';\nimport { EntityProvider } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tBlockContextProvider,\n\tBlockBreadcrumb,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { EditorNotices, EditorSnackbars } from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { SidebarComplementaryAreaFills } from '../sidebar-edit-mode';\nimport BlockEditor from '../block-editor';\nimport CodeEditor from '../code-editor';\nimport KeyboardShortcutsEditMode from '../keyboard-shortcuts/edit-mode';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\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 CanvasSpinner from '../canvas-spinner';\nimport { unlock } from '../../lock-unlock';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { SidebarFixedBottomSlot } from '../sidebar-edit-mode/sidebar-fixed-bottom';\n\nconst { BlockRemovalWarningModal } = unlock( blockEditorPrivateApis );\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\nconst typeLabels = {\n\twp_template: __( 'Template Part' ),\n\twp_template_part: __( 'Template Part' ),\n\twp_block: __( 'Pattern' ),\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 { id: editedPostId, type: editedPostType } = editedPost;\n\n\tconst {\n\t\tcontext,\n\t\teditorMode,\n\t\tcanvasMode,\n\t\tblockEditorMode,\n\t\tisRightSidebarOpen,\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tshowIconLabels,\n\t\tshowBlockBreadcrumbs,\n\t\thasPageContentFocus,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEditedPostContext,\n\t\t\tgetEditorMode,\n\t\t\tgetCanvasMode,\n\t\t\tisInserterOpened,\n\t\t\tisListViewOpened,\n\t\t\thasPageContentFocus: _hasPageContentFocus,\n\t\t} = unlock( select( editSiteStore ) );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\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: getEditedPostContext(),\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\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\tshowBlockBreadcrumbs: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t\thasPageContentFocus: _hasPageContentFocus(),\n\t\t};\n\t}, [] );\n\tconst { setEditedPostContext } = useDispatch( editSiteStore );\n\n\tconst isViewMode = canvasMode === 'view';\n\tconst isEditMode = canvasMode === 'edit';\n\tconst showVisualEditor = isViewMode || editorMode === 'visual';\n\tconst shouldShowBlockBreadcrumbs =\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 blockContext = useMemo( () => {\n\t\tconst { postType, postId, ...nonPostFields } = context ?? {};\n\t\treturn {\n\t\t\t...( hasPageContentFocus ? context : nonPostFields ),\n\t\t\tqueryContext: [\n\t\t\t\tcontext?.queryContext || { page: 1 },\n\t\t\t\t( newQueryContext ) =>\n\t\t\t\t\tsetEditedPostContext( {\n\t\t\t\t\t\t...context,\n\t\t\t\t\t\tqueryContext: {\n\t\t\t\t\t\t\t...context?.queryContext,\n\t\t\t\t\t\t\t...newQueryContext,\n\t\t\t\t\t\t},\n\t\t\t\t\t} ),\n\t\t\t],\n\t\t};\n\t}, [ hasPageContentFocus, context, setEditedPostContext ] );\n\n\tlet title;\n\tif ( hasLoadedPost ) {\n\t\tconst type = typeLabels[ editedPostType ] ?? __( 'Template' );\n\t\ttitle = sprintf(\n\t\t\t// translators: A breadcrumb trail in browser tab. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).\n\t\t\t__( '%1$s ‹ %2$s ‹ Editor' ),\n\t\t\tgetTitle(),\n\t\t\ttype\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\treturn (\n\t\t<>\n\t\t\t{ isLoading ? <CanvasSpinner /> : null }\n\t\t\t{ isEditMode && <WelcomeGuide /> }\n\t\t\t<EntityProvider kind=\"root\" type=\"site\">\n\t\t\t\t<EntityProvider\n\t\t\t\t\tkind=\"postType\"\n\t\t\t\t\ttype={ editedPostType }\n\t\t\t\t\tid={ editedPostId }\n\t\t\t\t>\n\t\t\t\t\t<BlockContextProvider value={ blockContext }>\n\t\t\t\t\t\t<SidebarComplementaryAreaFills />\n\t\t\t\t\t\t{ isEditMode && <StartTemplateOptions /> }\n\t\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\t\tisDistractionFree={ true }\n\t\t\t\t\t\t\tenableRegionNavigation={ false }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'edit-site-editor__interface-skeleton',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t\t\t\t\t\t\t'is-loading': isLoading,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<GlobalStylesRenderer />\n\t\t\t\t\t\t\t\t\t{ isEditMode && <EditorNotices /> }\n\t\t\t\t\t\t\t\t\t{ showVisualEditor && editedPost && (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<BlockEditor />\n\t\t\t\t\t\t\t\t\t\t\t<BlockRemovalWarningModal />\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\t{ editorMode === 'text' &&\n\t\t\t\t\t\t\t\t\t\teditedPost &&\n\t\t\t\t\t\t\t\t\t\tisEditMode && <CodeEditor /> }\n\t\t\t\t\t\t\t\t\t{ hasLoadedPost && ! editedPost && (\n\t\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\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\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t\t\t\t\t<KeyboardShortcutsEditMode />\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\tsecondarySidebar={\n\t\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t\t( ( shouldShowInserter && (\n\t\t\t\t\t\t\t\t\t<InserterSidebar />\n\t\t\t\t\t\t\t\t) ) ||\n\t\t\t\t\t\t\t\t\t( shouldShowListView && (\n\t\t\t\t\t\t\t\t\t\t<ListViewSidebar />\n\t\t\t\t\t\t\t\t\t) ) )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsidebar={\n\t\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t\tisRightSidebarOpen && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t\t\t\t\t\t<SidebarFixedBottomSlot />\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\tfooter={\n\t\t\t\t\t\t\t\tshouldShowBlockBreadcrumbs && (\n\t\t\t\t\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\t\t\t\t\trootLabelText={\n\t\t\t\t\t\t\t\t\t\t\thasPageContentFocus\n\t\t\t\t\t\t\t\t\t\t\t\t? __( 'Page' )\n\t\t\t\t\t\t\t\t\t\t\t\t: __( 'Template' )\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)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabels={ {\n\t\t\t\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t</EntityProvider>\n\t\t\t</EntityProvider>\n\t\t</>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/editor/index.js"],"names":["classnames","useMemo","useSelect","useDispatch","Notice","EntityProvider","store","preferencesStore","BlockContextProvider","BlockBreadcrumb","blockEditorStore","privateApis","blockEditorPrivateApis","InterfaceSkeleton","ComplementaryArea","interfaceStore","EditorNotices","EditorSnackbars","__","sprintf","SidebarComplementaryAreaFills","BlockEditor","CodeEditor","KeyboardShortcutsEditMode","InserterSidebar","ListViewSidebar","WelcomeGuide","StartTemplateOptions","editSiteStore","GlobalStylesRenderer","useTitle","CanvasSpinner","unlock","useEditedEntityRecord","SidebarFixedBottomSlot","BlockRemovalWarningModal","interfaceLabels","body","sidebar","actions","footer","typeLabels","wp_template","wp_template_part","wp_block","blockRemovalRules","Editor","isLoading","record","editedPost","getTitle","isLoaded","hasLoadedPost","id","editedPostId","type","editedPostType","context","editorMode","canvasMode","blockEditorMode","isRightSidebarOpen","isInserterOpen","isListViewOpen","showIconLabels","showBlockBreadcrumbs","hasPageContentFocus","select","getEditedPostContext","getEditorMode","getCanvasMode","isInserterOpened","isListViewOpened","_hasPageContentFocus","__unstableGetEditorMode","getActiveComplementaryArea","name","get","setEditedPostContext","isViewMode","isEditMode","showVisualEditor","shouldShowBlockBreadcrumbs","shouldShowInserter","shouldShowListView","secondarySidebarLabel","blockContext","postType","postId","nonPostFields","queryContext","page","newQueryContext","title","secondarySidebar"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,cAAT,QAA+B,sBAA/B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AACA,SACCC,oBADD,EAECC,eAFD,EAGCH,KAAK,IAAII,gBAHV,EAICC,WAAW,IAAIC,sBAJhB,QAKO,yBALP;AAMA,SACCC,iBADD,EAECC,iBAFD,EAGCR,KAAK,IAAIS,cAHV,QAIO,sBAJP;AAKA,SAASC,aAAT,EAAwBC,eAAxB,QAA+C,mBAA/C;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AAEA;AACA;AACA;;AACA,SAASC,6BAAT,QAA8C,sBAA9C;AACA,OAAOC,WAAP,MAAwB,iBAAxB;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,OAAOC,yBAAP,MAAsC,iCAAtC;AACA,OAAOC,eAAP,MAA4B,uCAA5B;AACA,OAAOC,eAAP,MAA4B,wCAA5B;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AACA,OAAOC,oBAAP,MAAiC,2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OAbhB,EAcG5B,aAAa,IAAI,CAAEH,UAAnB,IACD,cAAC,MAAD;AACC,MAAA,MAAM,EAAC,SADR;AAEC,MAAA,aAAa,EAAG;AAFjB,OAIG/B,EAAE,CACH,2EADG,CAJL,CAfF,EAwBG8D,UAAU,IACX,cAAC,yBAAD,OAzBF,CAZF;AAyCC,IAAA,gBAAgB,EACfA,UAAU,KACNG,kBAAkB,IACrB,cAAC,eAAD,OADC,IAGCC,kBAAkB,IACnB,cAAC,eAAD,OALQ,CA1CZ;AAkDC,IAAA,OAAO,EACNJ,UAAU,IACVnB,kBADA,IAEC,8BACC,cAAC,iBAAD,CAAmB,IAAnB;AAAwB,MAAA,KAAK,EAAC;AAA9B,MADD,EAEC,cAAC,sBAAD,OAFD,CArDH;AA2DC,IAAA,MAAM,EACLqB,0BAA0B,IACzB,cAAC,eAAD;AACC,MAAA,aAAa,EACZhB,mBAAmB,GAChBhD,EAAE,CAAE,MAAF,CADc,GAEhBA,EAAE,CAAE,UAAF;AAJP,MA7DH;AAsEC,IAAA,MAAM,EAAG,EACR,GAAGkB,eADK;AAER0D,MAAAA,gBAAgB,EAAET;AAFV;AAtEV,IAHD,CALD,CADD,CAHD,CADD;AA6FA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Notice } from '@wordpress/components';\nimport { EntityProvider } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tBlockContextProvider,\n\tBlockBreadcrumb,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { EditorNotices, EditorSnackbars } from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { SidebarComplementaryAreaFills } from '../sidebar-edit-mode';\nimport BlockEditor from '../block-editor';\nimport CodeEditor from '../code-editor';\nimport KeyboardShortcutsEditMode from '../keyboard-shortcuts/edit-mode';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\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 CanvasSpinner from '../canvas-spinner';\nimport { unlock } from '../../lock-unlock';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { SidebarFixedBottomSlot } from '../sidebar-edit-mode/sidebar-fixed-bottom';\n\nconst { BlockRemovalWarningModal } = unlock( blockEditorPrivateApis );\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\nconst typeLabels = {\n\twp_template: __( 'Template Part' ),\n\twp_template_part: __( 'Template Part' ),\n\twp_block: __( 'Pattern' ),\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};\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 { id: editedPostId, type: editedPostType } = editedPost;\n\n\tconst {\n\t\tcontext,\n\t\teditorMode,\n\t\tcanvasMode,\n\t\tblockEditorMode,\n\t\tisRightSidebarOpen,\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tshowIconLabels,\n\t\tshowBlockBreadcrumbs,\n\t\thasPageContentFocus,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEditedPostContext,\n\t\t\tgetEditorMode,\n\t\t\tgetCanvasMode,\n\t\t\tisInserterOpened,\n\t\t\tisListViewOpened,\n\t\t\thasPageContentFocus: _hasPageContentFocus,\n\t\t} = unlock( select( editSiteStore ) );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\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: getEditedPostContext(),\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\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\tshowBlockBreadcrumbs: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t\thasPageContentFocus: _hasPageContentFocus(),\n\t\t};\n\t}, [] );\n\tconst { setEditedPostContext } = useDispatch( editSiteStore );\n\n\tconst isViewMode = canvasMode === 'view';\n\tconst isEditMode = canvasMode === 'edit';\n\tconst showVisualEditor = isViewMode || editorMode === 'visual';\n\tconst shouldShowBlockBreadcrumbs =\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 blockContext = useMemo( () => {\n\t\tconst { postType, postId, ...nonPostFields } = context ?? {};\n\t\treturn {\n\t\t\t...( hasPageContentFocus ? context : nonPostFields ),\n\t\t\tqueryContext: [\n\t\t\t\tcontext?.queryContext || { page: 1 },\n\t\t\t\t( newQueryContext ) =>\n\t\t\t\t\tsetEditedPostContext( {\n\t\t\t\t\t\t...context,\n\t\t\t\t\t\tqueryContext: {\n\t\t\t\t\t\t\t...context?.queryContext,\n\t\t\t\t\t\t\t...newQueryContext,\n\t\t\t\t\t\t},\n\t\t\t\t\t} ),\n\t\t\t],\n\t\t};\n\t}, [ hasPageContentFocus, context, setEditedPostContext ] );\n\n\tlet title;\n\tif ( hasLoadedPost ) {\n\t\tconst type = typeLabels[ editedPostType ] ?? __( 'Template' );\n\t\ttitle = sprintf(\n\t\t\t// translators: A breadcrumb trail in browser tab. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).\n\t\t\t__( '%1$s ‹ %2$s ‹ Editor' ),\n\t\t\tgetTitle(),\n\t\t\ttype\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\treturn (\n\t\t<>\n\t\t\t{ isLoading ? <CanvasSpinner /> : null }\n\t\t\t{ isEditMode && <WelcomeGuide /> }\n\t\t\t<EntityProvider kind=\"root\" type=\"site\">\n\t\t\t\t<EntityProvider\n\t\t\t\t\tkind=\"postType\"\n\t\t\t\t\ttype={ editedPostType }\n\t\t\t\t\tid={ editedPostId }\n\t\t\t\t>\n\t\t\t\t\t<BlockContextProvider value={ blockContext }>\n\t\t\t\t\t\t<SidebarComplementaryAreaFills />\n\t\t\t\t\t\t{ isEditMode && <StartTemplateOptions /> }\n\t\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\t\tisDistractionFree={ true }\n\t\t\t\t\t\t\tenableRegionNavigation={ false }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'edit-site-editor__interface-skeleton',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t\t\t\t\t\t\t'is-loading': isLoading,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<GlobalStylesRenderer />\n\t\t\t\t\t\t\t\t\t{ isEditMode && <EditorNotices /> }\n\t\t\t\t\t\t\t\t\t{ showVisualEditor && editedPost && (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<BlockEditor />\n\t\t\t\t\t\t\t\t\t\t\t<BlockRemovalWarningModal\n\t\t\t\t\t\t\t\t\t\t\t\trules={ blockRemovalRules }\n\t\t\t\t\t\t\t\t\t\t\t/>\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\t{ editorMode === 'text' &&\n\t\t\t\t\t\t\t\t\t\teditedPost &&\n\t\t\t\t\t\t\t\t\t\tisEditMode && <CodeEditor /> }\n\t\t\t\t\t\t\t\t\t{ hasLoadedPost && ! editedPost && (\n\t\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\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\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t\t\t\t\t<KeyboardShortcutsEditMode />\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\tsecondarySidebar={\n\t\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t\t( ( shouldShowInserter && (\n\t\t\t\t\t\t\t\t\t<InserterSidebar />\n\t\t\t\t\t\t\t\t) ) ||\n\t\t\t\t\t\t\t\t\t( shouldShowListView && (\n\t\t\t\t\t\t\t\t\t\t<ListViewSidebar />\n\t\t\t\t\t\t\t\t\t) ) )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsidebar={\n\t\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t\tisRightSidebarOpen && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t\t\t\t\t\t<SidebarFixedBottomSlot />\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\tfooter={\n\t\t\t\t\t\t\t\tshouldShowBlockBreadcrumbs && (\n\t\t\t\t\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\t\t\t\t\trootLabelText={\n\t\t\t\t\t\t\t\t\t\t\thasPageContentFocus\n\t\t\t\t\t\t\t\t\t\t\t\t? __( 'Page' )\n\t\t\t\t\t\t\t\t\t\t\t\t: __( 'Template' )\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)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabels={ {\n\t\t\t\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t</EntityProvider>\n\t\t\t</EntityProvider>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -23,24 +23,16 @@ function getRevisionLabel(revision) {
|
|
|
23
23
|
|
|
24
24
|
if ('unsaved' === revision?.id) {
|
|
25
25
|
return sprintf(
|
|
26
|
-
/* translators: %
|
|
27
|
-
__('Unsaved changes by %
|
|
28
|
-
name: authorDisplayName
|
|
29
|
-
});
|
|
26
|
+
/* translators: %s author display name */
|
|
27
|
+
__('Unsaved changes by %s'), authorDisplayName);
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
const formattedDate = dateI18n(getSettings().formats.datetimeAbbreviated, getDate(revision?.modified));
|
|
33
31
|
return revision?.isLatest ? sprintf(
|
|
34
|
-
/* translators: %
|
|
35
|
-
__('Changes saved by %
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}) : sprintf(
|
|
39
|
-
/* translators: %(name)s author display name, %(date)s: revision creation date */
|
|
40
|
-
__('Changes saved by %(name)s on %(date)s'), {
|
|
41
|
-
name: authorDisplayName,
|
|
42
|
-
date: formattedDate
|
|
43
|
-
});
|
|
32
|
+
/* translators: %1$s author display name, %2$s: revision creation date */
|
|
33
|
+
__('Changes saved by %1$s on %2$s (current)'), authorDisplayName, formattedDate) : sprintf(
|
|
34
|
+
/* translators: %1$s author display name, %2$s: revision creation date */
|
|
35
|
+
__('Changes saved by %1$s on %2$s'), authorDisplayName, formattedDate);
|
|
44
36
|
}
|
|
45
37
|
/**
|
|
46
38
|
* Returns a rendered list of revisions buttons.
|
|
@@ -95,14 +87,10 @@ function RevisionsButtons({
|
|
|
95
87
|
}, humanTimeDiff(modified)), createElement("span", {
|
|
96
88
|
className: "edit-site-global-styles-screen-revisions__meta"
|
|
97
89
|
}, isUnsaved ? sprintf(
|
|
98
|
-
/* translators: %
|
|
99
|
-
__('Unsaved changes by %
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
/* translators: %(name)s author display name */
|
|
103
|
-
__('Changes saved by %(name)s'), {
|
|
104
|
-
name: authorDisplayName
|
|
105
|
-
}), createElement("img", {
|
|
90
|
+
/* translators: %s author display name */
|
|
91
|
+
__('Unsaved changes by %s'), authorDisplayName) : sprintf(
|
|
92
|
+
/* translators: %s author display name */
|
|
93
|
+
__('Changes saved by %s'), authorDisplayName), createElement("img", {
|
|
106
94
|
alt: author?.name,
|
|
107
95
|
src: authorAvatar
|
|
108
96
|
})))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-revisions/revisions-buttons.js"],"names":["classnames","__","sprintf","Button","dateI18n","getDate","humanTimeDiff","getSettings","getRevisionLabel","revision","authorDisplayName","author","name","id","formattedDate","formats","datetimeAbbreviated","modified","isLatest","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-revisions/revisions-buttons.js"],"names":["classnames","__","sprintf","Button","dateI18n","getDate","humanTimeDiff","getSettings","getRevisionLabel","revision","authorDisplayName","author","name","id","formattedDate","formats","datetimeAbbreviated","modified","isLatest","RevisionsButtons","userRevisions","selectedRevisionId","onChange","map","index","authorAvatar","avatar_urls","isUnsaved","isSelected"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,QAAT,EAAmBC,OAAnB,EAA4BC,aAA5B,EAA2CC,WAA3C,QAA8D,iBAA9D;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,gBAAT,CAA2BC,QAA3B,EAAsC;AACrC,QAAMC,iBAAiB,GAAGD,QAAQ,EAAEE,MAAV,EAAkBC,IAAlB,IAA0BX,EAAE,CAAE,MAAF,CAAtD;;AAEA,MAAK,cAAcQ,QAAQ,EAAEI,EA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U,CACrB,yDADqB,EAErB;AACC,uBAAe4B;AADhB,OAFqB,CADvB;AAOC,MAAA,GAAG,EAAGf;AAPP,OASC,cAAC,MAAD;AACC,MAAA,SAAS,EAAC,2DADX;AAEC,MAAA,QAAQ,EAAGe,UAFZ;AAGC,MAAA,OAAO,EAAG,MAAM;AACfN,QAAAA,QAAQ,CAAEb,QAAF,CAAR;AACA,OALF;AAMC,MAAA,KAAK,EAAGD,gBAAgB,CAAEC,QAAF;AANzB,OAQC;AAAM,MAAA,SAAS,EAAC;AAAhB,OACC;AAAM,MAAA,QAAQ,EAAGQ;AAAjB,OACGX,aAAa,CAAEW,QAAF,CADhB,CADD,EAIC;AAAM,MAAA,SAAS,EAAC;AAAhB,OACGU,SAAS,GACRzB,OAAO;AACP;AACAD,IAAAA,EAAE,CAAE,uBAAF,CAFK,EAGPS,iBAHO,CADC,GAMRR,OAAO;AACP;AACAD,IAAAA,EAAE,CAAE,qBAAF,CAFK,EAGPS,iBAHO,CAPX,EAaC;AACC,MAAA,GAAG,EAAGC,MAAM,EAAEC,IADf;AAEC,MAAA,GAAG,EAAGa;AAFP,MAbD,CAJD,CARD,CATD,CADD;AA4CA,GArDC,CALH,CADD;AA8DA;;AAED,eAAeN,gBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { dateI18n, getDate, humanTimeDiff, getSettings } from '@wordpress/date';\n\n/**\n * Returns a button label for the revision.\n *\n * @param {Object} revision A revision object.\n * @return {string} Translated label.\n */\nfunction getRevisionLabel( revision ) {\n\tconst authorDisplayName = revision?.author?.name || __( 'User' );\n\n\tif ( 'unsaved' === revision?.id ) {\n\t\treturn sprintf(\n\t\t\t/* translators: %s author display name */\n\t\t\t__( 'Unsaved changes by %s' ),\n\t\t\tauthorDisplayName\n\t\t);\n\t}\n\tconst formattedDate = dateI18n(\n\t\tgetSettings().formats.datetimeAbbreviated,\n\t\tgetDate( revision?.modified )\n\t);\n\n\treturn revision?.isLatest\n\t\t? sprintf(\n\t\t\t\t/* translators: %1$s author display name, %2$s: revision creation date */\n\t\t\t\t__( 'Changes saved by %1$s on %2$s (current)' ),\n\t\t\t\tauthorDisplayName,\n\t\t\t\tformattedDate\n\t\t )\n\t\t: sprintf(\n\t\t\t\t/* translators: %1$s author display name, %2$s: revision creation date */\n\t\t\t\t__( 'Changes saved by %1$s on %2$s' ),\n\t\t\t\tauthorDisplayName,\n\t\t\t\tformattedDate\n\t\t );\n}\n\n/**\n * Returns a rendered list of revisions buttons.\n *\n * @typedef {Object} props\n * @property {Array<Object>} userRevisions A collection of user revisions.\n * @property {number} selectedRevisionId The id of the currently-selected revision.\n * @property {Function} onChange Callback fired when a revision is selected.\n *\n * @param {props} Component props.\n * @return {JSX.Element} The modal component.\n */\nfunction RevisionsButtons( { userRevisions, selectedRevisionId, onChange } ) {\n\treturn (\n\t\t<ol\n\t\t\tclassName=\"edit-site-global-styles-screen-revisions__revisions-list\"\n\t\t\taria-label={ __( 'Global styles revisions' ) }\n\t\t\trole=\"group\"\n\t\t>\n\t\t\t{ userRevisions.map( ( revision, index ) => {\n\t\t\t\tconst { id, author, modified } = revision;\n\t\t\t\tconst authorDisplayName = author?.name || __( 'User' );\n\t\t\t\tconst authorAvatar = author?.avatar_urls?.[ '48' ];\n\t\t\t\tconst isUnsaved = 'unsaved' === revision?.id;\n\t\t\t\tconst isSelected = selectedRevisionId\n\t\t\t\t\t? selectedRevisionId === revision?.id\n\t\t\t\t\t: index === 0;\n\n\t\t\t\treturn (\n\t\t\t\t\t<li\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'edit-site-global-styles-screen-revisions__revision-item',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'is-selected': isSelected,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"edit-site-global-styles-screen-revisions__revision-button\"\n\t\t\t\t\t\t\tdisabled={ isSelected }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonChange( revision );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tlabel={ getRevisionLabel( revision ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span className=\"edit-site-global-styles-screen-revisions__description\">\n\t\t\t\t\t\t\t\t<time dateTime={ modified }>\n\t\t\t\t\t\t\t\t\t{ humanTimeDiff( modified ) }\n\t\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t\t\t<span className=\"edit-site-global-styles-screen-revisions__meta\">\n\t\t\t\t\t\t\t\t\t{ isUnsaved\n\t\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %s author display name */\n\t\t\t\t\t\t\t\t\t\t\t\t__( 'Unsaved changes by %s' ),\n\t\t\t\t\t\t\t\t\t\t\t\tauthorDisplayName\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %s author display name */\n\t\t\t\t\t\t\t\t\t\t\t\t__( 'Changes saved by %s' ),\n\t\t\t\t\t\t\t\t\t\t\t\tauthorDisplayName\n\t\t\t\t\t\t\t\t\t\t ) }\n\n\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\talt={ author?.name }\n\t\t\t\t\t\t\t\t\t\tsrc={ authorAvatar }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</li>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ol>\n\t);\n}\n\nexport default RevisionsButtons;\n"]}
|
|
@@ -102,7 +102,8 @@ export default function Layout() {
|
|
|
102
102
|
const [canvasResizer, canvasSize] = useResizeObserver();
|
|
103
103
|
const [fullResizer] = useResizeObserver();
|
|
104
104
|
const [isResizing] = useState(false);
|
|
105
|
-
const isEditorLoading = useIsSiteEditorLoading();
|
|
105
|
+
const isEditorLoading = useIsSiteEditorLoading();
|
|
106
|
+
const [isResizableFrameOversized, setIsResizableFrameOversized] = useState(false); // This determines which animation variant should apply to the header.
|
|
106
107
|
// There is also a `isDistractionFreeHovering` state that gets priority
|
|
107
108
|
// when hovering the `edit-site-layout__header-container` in distraction
|
|
108
109
|
// free mode. It's set via framer and trickles down to all the children
|
|
@@ -191,51 +192,55 @@ export default function Layout() {
|
|
|
191
192
|
}
|
|
192
193
|
},
|
|
193
194
|
ref: hubRef,
|
|
195
|
+
isTransparent: isResizableFrameOversized,
|
|
194
196
|
className: "edit-site-layout__hub"
|
|
195
197
|
}), createElement(AnimatePresence, {
|
|
196
198
|
initial: false
|
|
197
199
|
}, isEditorPage && isEditing && createElement(NavigableRegion, {
|
|
200
|
+
key: "header",
|
|
198
201
|
className: "edit-site-layout__header",
|
|
199
202
|
ariaLabel: __('Editor top bar'),
|
|
200
203
|
as: motion.div,
|
|
201
204
|
variants: {
|
|
202
205
|
isDistractionFree: {
|
|
203
|
-
opacity: 0
|
|
206
|
+
opacity: 0,
|
|
207
|
+
y: 0
|
|
204
208
|
},
|
|
205
209
|
isDistractionFreeHovering: {
|
|
206
|
-
opacity: 1
|
|
210
|
+
opacity: 1,
|
|
211
|
+
y: 0
|
|
207
212
|
},
|
|
208
213
|
view: {
|
|
209
|
-
opacity: 1
|
|
214
|
+
opacity: 1,
|
|
215
|
+
y: '-100%'
|
|
210
216
|
},
|
|
211
217
|
edit: {
|
|
212
|
-
opacity: 1
|
|
218
|
+
opacity: 1,
|
|
219
|
+
y: 0
|
|
213
220
|
}
|
|
214
221
|
},
|
|
222
|
+
exit: {
|
|
223
|
+
y: '-100%'
|
|
224
|
+
},
|
|
225
|
+
initial: {
|
|
226
|
+
opacity: isDistractionFree ? 1 : 0,
|
|
227
|
+
y: isDistractionFree ? 0 : '-100%'
|
|
228
|
+
},
|
|
215
229
|
transition: {
|
|
216
230
|
type: 'tween',
|
|
217
231
|
duration: disableMotion ? 0 : 0.2,
|
|
218
232
|
ease: 'easeOut'
|
|
219
233
|
}
|
|
220
|
-
},
|
|
234
|
+
}, createElement(Header, null)))), createElement("div", {
|
|
221
235
|
className: "edit-site-layout__content"
|
|
222
|
-
}, createElement(AnimatePresence, {
|
|
223
|
-
initial: false
|
|
224
236
|
}, createElement(motion.div, {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
opacity: 0,
|
|
233
|
-
transitionEnd: {
|
|
234
|
-
display: 'none'
|
|
235
|
-
}
|
|
236
|
-
},
|
|
237
|
-
exit: {
|
|
238
|
-
opacity: 0
|
|
237
|
+
// The sidebar is needed for routing on mobile
|
|
238
|
+
// (https://github.com/WordPress/gutenberg/pull/51558/files#r1231763003),
|
|
239
|
+
// so we can't remove the element entirely. Using `inert` will make
|
|
240
|
+
// it inaccessible to screen readers and keyboard navigation.
|
|
241
|
+
inert: showSidebar ? undefined : 'inert',
|
|
242
|
+
animate: {
|
|
243
|
+
opacity: showSidebar ? 1 : 0
|
|
239
244
|
},
|
|
240
245
|
transition: {
|
|
241
246
|
type: 'tween',
|
|
@@ -246,7 +251,7 @@ export default function Layout() {
|
|
|
246
251
|
className: "edit-site-layout__sidebar"
|
|
247
252
|
}, createElement(NavigableRegion, {
|
|
248
253
|
ariaLabel: __('Navigation')
|
|
249
|
-
}, createElement(Sidebar, null)))
|
|
254
|
+
}, createElement(Sidebar, null))), createElement(SavePanel, null), showCanvas && createElement(Fragment, null, isListPage && createElement(PageMain, null), isEditorPage && createElement("div", {
|
|
250
255
|
className: classnames('edit-site-layout__canvas-container', {
|
|
251
256
|
'is-resizing': isResizing
|
|
252
257
|
})
|
|
@@ -260,7 +265,9 @@ export default function Layout() {
|
|
|
260
265
|
} : {},
|
|
261
266
|
initial: false,
|
|
262
267
|
layout: "position",
|
|
263
|
-
className:
|
|
268
|
+
className: classnames('edit-site-layout__canvas', {
|
|
269
|
+
'is-right-aligned': isResizableFrameOversized
|
|
270
|
+
}),
|
|
264
271
|
transition: {
|
|
265
272
|
type: 'tween',
|
|
266
273
|
duration: disableMotion || isResizing ? 0 : ANIMATION_DURATION,
|
|
@@ -269,7 +276,8 @@ export default function Layout() {
|
|
|
269
276
|
}, createElement(ErrorBoundary, null, createElement(ResizableFrame, {
|
|
270
277
|
isReady: !isEditorLoading,
|
|
271
278
|
isFullWidth: isEditing,
|
|
272
|
-
|
|
279
|
+
isOversized: isResizableFrameOversized,
|
|
280
|
+
setIsOversized: setIsResizableFrameOversized,
|
|
273
281
|
innerContentStyle: {
|
|
274
282
|
background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor
|
|
275
283
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/layout/index.js"],"names":["classnames","useSelect","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","__unstableUseNavigateRegions","useNavigateRegions","useReducedMotion","useViewportMatch","useResizeObserver","__","useState","useRef","NavigableRegion","store","keyboardShortcutsStore","CommandMenu","privateApis","commandsPrivateApis","preferencesStore","blockEditorPrivateApis","routerPrivateApis","coreCommandsPrivateApis","Sidebar","Editor","ErrorBoundary","editSiteStore","getIsListPage","Header","useInitEditedEntityFromURL","SiteHub","ResizableFrame","useSyncCanvasModeWithURL","unlock","SavePanel","KeyboardShortcutsRegister","KeyboardShortcutsGlobal","useCommonCommands","useEditModeCommands","PageMain","useIsSiteEditorLoading","useCommands","useCommandContext","useLocation","useGlobalStyle","ANIMATION_DURATION","Layout","hubRef","params","isMobileViewport","isListPage","isEditorPage","isDistractionFree","hasFixedToolbar","canvasMode","previousShortcut","nextShortcut","select","getAllShortcutKeyCombinations","getCanvasMode","get","isEditing","navigateRegionsProps","previous","next","disableMotion","showSidebar","showCanvas","isFullCanvas","canvasResizer","canvasSize","fullResizer","isResizing","isEditorLoading","headerAnimationState","commandContext","backgroundColor","gradientValue","ref","className","opacity","transition","type","delay","delayChildren","isDistractionFreeHovering","view","edit","undefined","div","x","duration","ease","display","transitionEnd","width","scale","background"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,gBAAgB,IAAIC,MADrB,EAECC,yBAAyB,IAAIC,eAF9B,EAGCC,4BAA4B,IAAIC,kBAHjC,QAIO,uBAJP;AAKA,SACCC,gBADD,EAECC,gBAFD,EAGCC,iBAHD,QAIO,oBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,EAAmBC,MAAnB,QAAiC,oBAAjC;AACA,SAASC,eAAT,QAAgC,sBAAhC;AACA,SAASC,KAAK,IAAIC,sBAAlB,QAAgD,+BAAhD;AACA,SACCC,WADD,EAECC,WAAW,IAAIC,mBAFhB,QAGO,qBAHP;AAIA,SAASJ,KAAK,IAAIK,gBAAlB,QAA0C,wBAA1C;AACA,SAASF,WAAW,IAAIG,sBAAxB,QAAsD,yBAAtD;AACA,SAASH,WAAW,IAAII,iBAAxB,QAAiD,mBAAjD;AACA,SAASJ,WAAW,IAAIK,uBAAxB,QAAuD,0BAAvD;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,OAAOC,MAAP,MAAmB,WAAnB;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,SAASX,KAAK,IAAIY,aAAlB,QAAuC,aAAvC;AACA,OAAOC,aAAP,MAA0B,8BAA1B;AACA,OAAOC,MAAP,MAAmB,qBAAnB;AACA,OAAOC,0BAAP,MAAuC,wDAAvC;AACA,OAAOC,OAAP,MAAoB,aAApB;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,wBAAP,MAAqC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YAAF;AADf,KAGC,cAAC,OAAD,OAHD,CA5BD,CAFF,CADD,EAwCC,cAAC,SAAD,OAxCD,EA0CGyD,UAAU,IACX,8BACGjB,UAAU,IAAI,cAAC,QAAD,OADjB,EAEGC,YAAY,IACb;AACC,IAAA,SAAS,EAAGpD,UAAU,CACrB,oCADqB,EAErB;AACC,qBAAeyE;AADhB,KAFqB;AADvB,KAQGH,aARH,EASG,CAAC,CAAEC,UAAU,CAACyB,KAAd,IACD,cAAC,MAAD,CAAQ,GAAR;AACC,IAAA,UAAU,EACT5C,YAAY,IACZG,UAAU,KAAK,MADf,GAEG;AACA0C,MAAAA,KAAK,EAAE,KADP;AAEAf,MAAAA,UAAU,EAAE;AACXU,QAAAA,QAAQ,EACP1B,aAAa,IACbO,UADA,GAEG,CAFH,GAGG,GALO;AAMXoB,QAAAA,IAAI,EAAE;AANK;AAFZ,KAFH,GAaG,EAfL;AAiBC,IAAA,OAAO,EAAG,KAjBX;AAkBC,IAAA,MAAM,EAAC,UAlBR;AAmBC,IAAA,SAAS,EAAC,0BAnBX;AAoBC,IAAA,UAAU,EAAG;AACZV,MAAAA,IAAI,EAAE,OADM;AAEZS,MAAAA,QAAQ,EACP1B,aAAa,IAAIO,UAAjB,GACG,CADH,GAEG3B,kBALQ;AAMZ+C,MAAAA,IAAI,EAAE;AANM;AApBd,KA6BC,cAAC,aAAD,QACC,cAAC,cAAD;AACC,IAAA,OAAO,EACN,CAAEnB,eAFJ;AAIC,IAAA,WAAW,EAAGZ,SAJf;AAKC,IAAA,kBAAkB,EAAC,6CALpB;AAMC,IAAA,iBAAiB,EAAG;AACnBoC,MAAAA,UAAU,EACTpB,aADS,aACTA,aADS,cACTA,aADS,GAETD;AAHkB;AANrB,KAYC,cAAC,MAAD;AACC,IAAA,SAAS,EACRH;AAFF,IAZD,CADD,CA7BD,CAVF,CAHF,CA3CF,CA/ED,CALD,CADD;AAwMA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n\t__unstableUseNavigateRegions as useNavigateRegions,\n} from '@wordpress/components';\nimport {\n\tuseReducedMotion,\n\tuseViewportMatch,\n\tuseResizeObserver,\n} from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useRef } from '@wordpress/element';\nimport { NavigableRegion } from '@wordpress/interface';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport {\n\tCommandMenu,\n\tprivateApis as commandsPrivateApis,\n} from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';\n\n/**\n * Internal dependencies\n */\nimport Sidebar from '../sidebar';\nimport Editor from '../editor';\nimport ErrorBoundary from '../error-boundary';\nimport { store as editSiteStore } from '../../store';\nimport getIsListPage from '../../utils/get-is-list-page';\nimport Header from '../header-edit-mode';\nimport useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';\nimport SiteHub from '../site-hub';\nimport ResizableFrame from '../resizable-frame';\nimport useSyncCanvasModeWithURL from '../sync-state-with-url/use-sync-canvas-mode-with-url';\nimport { unlock } from '../../lock-unlock';\nimport SavePanel from '../save-panel';\nimport KeyboardShortcutsRegister from '../keyboard-shortcuts/register';\nimport KeyboardShortcutsGlobal from '../keyboard-shortcuts/global';\nimport { useCommonCommands } from '../../hooks/commands/use-common-commands';\nimport { useEditModeCommands } from '../../hooks/commands/use-edit-mode-commands';\nimport PageMain from '../page-main';\nimport { useIsSiteEditorLoading } from './hooks';\n\nconst { useCommands } = unlock( coreCommandsPrivateApis );\nconst { useCommandContext } = unlock( commandsPrivateApis );\nconst { useLocation } = unlock( routerPrivateApis );\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nconst ANIMATION_DURATION = 0.5;\n\nexport default function Layout() {\n\t// This ensures the edited entity id and type are initialized properly.\n\tuseInitEditedEntityFromURL();\n\tuseSyncCanvasModeWithURL();\n\tuseCommands();\n\tuseEditModeCommands();\n\tuseCommonCommands();\n\n\tconst hubRef = useRef();\n\tconst { params } = useLocation();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isListPage = getIsListPage( params, isMobileViewport );\n\tconst isEditorPage = ! isListPage;\n\n\tconst {\n\t\tisDistractionFree,\n\t\thasFixedToolbar,\n\t\tcanvasMode,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\n\t} = useSelect( ( select ) => {\n\t\tconst { getAllShortcutKeyCombinations } = select(\n\t\t\tkeyboardShortcutsStore\n\t\t);\n\t\tconst { getCanvasMode } = unlock( select( editSiteStore ) );\n\t\treturn {\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tpreviousShortcut: getAllShortcutKeyCombinations(\n\t\t\t\t'core/edit-site/previous-region'\n\t\t\t),\n\t\t\tnextShortcut: getAllShortcutKeyCombinations(\n\t\t\t\t'core/edit-site/next-region'\n\t\t\t),\n\t\t\thasFixedToolbar: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tisDistractionFree: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'distractionFree'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst isEditing = canvasMode === 'edit';\n\tconst navigateRegionsProps = useNavigateRegions( {\n\t\tprevious: previousShortcut,\n\t\tnext: nextShortcut,\n\t} );\n\tconst disableMotion = useReducedMotion();\n\tconst showSidebar =\n\t\t( isMobileViewport && ! isListPage ) ||\n\t\t( ! isMobileViewport && ( canvasMode === 'view' || ! isEditorPage ) );\n\tconst showCanvas =\n\t\t( isMobileViewport && isEditorPage && isEditing ) ||\n\t\t! isMobileViewport ||\n\t\t! isEditorPage;\n\tconst isFullCanvas =\n\t\t( isMobileViewport && isListPage ) || ( isEditorPage && isEditing );\n\tconst [ canvasResizer, canvasSize ] = useResizeObserver();\n\tconst [ fullResizer ] = useResizeObserver();\n\tconst [ isResizing ] = useState( false );\n\tconst isEditorLoading = useIsSiteEditorLoading();\n\n\t// This determines which animation variant should apply to the header.\n\t// There is also a `isDistractionFreeHovering` state that gets priority\n\t// when hovering the `edit-site-layout__header-container` in distraction\n\t// free mode. It's set via framer and trickles down to all the children\n\t// so they can use this variant state too.\n\t//\n\t// TODO: The issue with this is we want to have the hover state stick when hovering\n\t// a popover opened via the header. We'll probably need to lift this state to\n\t// handle it ourselves. Also, focusWithin the header needs to be handled.\n\tlet headerAnimationState;\n\n\tif ( canvasMode === 'view' ) {\n\t\t// We need 'view' to always take priority so 'isDistractionFree'\n\t\t// doesn't bleed over into the view (sidebar) state\n\t\theaderAnimationState = 'view';\n\t} else if ( isDistractionFree ) {\n\t\theaderAnimationState = 'isDistractionFree';\n\t} else {\n\t\theaderAnimationState = canvasMode; // edit, view, init\n\t}\n\n\t// Sets the right context for the command palette\n\tconst commandContext =\n\t\tcanvasMode === 'edit' && isEditorPage\n\t\t\t? 'site-editor-edit'\n\t\t\t: 'site-editor';\n\tuseCommandContext( commandContext );\n\n\tconst [ backgroundColor ] = useGlobalStyle( 'color.background' );\n\tconst [ gradientValue ] = useGlobalStyle( 'color.gradient' );\n\n\t// Synchronizing the URL with the store value of canvasMode happens in an effect\n\t// This condition ensures the component is only rendered after the synchronization happens\n\t// which prevents any animations due to potential canvasMode value change.\n\tif ( canvasMode === 'init' ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<CommandMenu />\n\t\t\t<KeyboardShortcutsRegister />\n\t\t\t<KeyboardShortcutsGlobal />\n\t\t\t{ fullResizer }\n\t\t\t<div\n\t\t\t\t{ ...navigateRegionsProps }\n\t\t\t\tref={ navigateRegionsProps.ref }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'edit-site-layout',\n\t\t\t\t\tnavigateRegionsProps.className,\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-distraction-free': isDistractionFree && isEditing,\n\t\t\t\t\t\t'is-full-canvas': isFullCanvas,\n\t\t\t\t\t\t'is-edit-mode': isEditing,\n\t\t\t\t\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"edit-site-layout__header-container\"\n\t\t\t\t\tvariants={ {\n\t\t\t\t\t\tisDistractionFree: {\n\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\ttransition: {\n\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\tdelay: 0.8,\n\t\t\t\t\t\t\t\tdelayChildren: 0.8,\n\t\t\t\t\t\t\t}, // How long to wait before the header exits\n\t\t\t\t\t\t},\n\t\t\t\t\t\tisDistractionFreeHovering: {\n\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\ttransition: {\n\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\tdelay: 0.2,\n\t\t\t\t\t\t\t\tdelayChildren: 0.2,\n\t\t\t\t\t\t\t}, // How long to wait before the header shows\n\t\t\t\t\t\t},\n\t\t\t\t\t\tview: { opacity: 1 },\n\t\t\t\t\t\tedit: { opacity: 1 },\n\t\t\t\t\t} }\n\t\t\t\t\twhileHover={\n\t\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t\t? 'isDistractionFreeHovering'\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tanimate={ headerAnimationState }\n\t\t\t\t>\n\t\t\t\t\t<SiteHub\n\t\t\t\t\t\tas={ motion.div }\n\t\t\t\t\t\tvariants={ {\n\t\t\t\t\t\t\tisDistractionFree: { x: '-100%' },\n\t\t\t\t\t\t\tisDistractionFreeHovering: { x: 0 },\n\t\t\t\t\t\t\tview: { x: 0 },\n\t\t\t\t\t\t\tedit: { x: 0 },\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tref={ hubRef }\n\t\t\t\t\t\tclassName=\"edit-site-layout__hub\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<AnimatePresence initial={ false }>\n\t\t\t\t\t\t{ isEditorPage && isEditing && (\n\t\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\t\tclassName=\"edit-site-layout__header\"\n\t\t\t\t\t\t\t\tariaLabel={ __( 'Editor top bar' ) }\n\t\t\t\t\t\t\t\tas={ motion.div }\n\t\t\t\t\t\t\t\tvariants={ {\n\t\t\t\t\t\t\t\t\tisDistractionFree: { opacity: 0 },\n\t\t\t\t\t\t\t\t\tisDistractionFreeHovering: { opacity: 1 },\n\t\t\t\t\t\t\t\t\tview: { opacity: 1 },\n\t\t\t\t\t\t\t\t\tedit: { opacity: 1 },\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\t\tduration: disableMotion ? 0 : 0.2,\n\t\t\t\t\t\t\t\t\tease: 'easeOut',\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{ isEditing && <Header /> }\n\t\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</AnimatePresence>\n\t\t\t\t</motion.div>\n\n\t\t\t\t<div className=\"edit-site-layout__content\">\n\t\t\t\t\t<AnimatePresence initial={ false }>\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\tinitial={ {\n\t\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tanimate={\n\t\t\t\t\t\t\t\t\tshowSidebar\n\t\t\t\t\t\t\t\t\t\t? { opacity: 1, display: 'block' }\n\t\t\t\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\t\t\t\t\ttransitionEnd: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tdisplay: 'none',\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\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\texit={ {\n\t\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\t\tduration:\n\t\t\t\t\t\t\t\t\t\t// Disable transition in mobile to emulate a full page transition.\n\t\t\t\t\t\t\t\t\t\tdisableMotion || isMobileViewport\n\t\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t\t: ANIMATION_DURATION,\n\t\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tclassName=\"edit-site-layout__sidebar\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\t\t\tariaLabel={ __( 'Navigation' ) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<Sidebar />\n\t\t\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t}\n\t\t\t\t\t</AnimatePresence>\n\n\t\t\t\t\t<SavePanel />\n\n\t\t\t\t\t{ showCanvas && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ isListPage && <PageMain /> }\n\t\t\t\t\t\t\t{ isEditorPage && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t\t'edit-site-layout__canvas-container',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'is-resizing': isResizing,\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>\n\t\t\t\t\t\t\t\t\t{ canvasResizer }\n\t\t\t\t\t\t\t\t\t{ !! canvasSize.width && (\n\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\twhileHover={\n\t\t\t\t\t\t\t\t\t\t\t\tisEditorPage &&\n\t\t\t\t\t\t\t\t\t\t\t\tcanvasMode === 'view'\n\t\t\t\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tscale: 1.005,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tduration:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdisableMotion ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisResizing\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 0.5,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t\t\t\t: {}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tinitial={ false }\n\t\t\t\t\t\t\t\t\t\t\tlayout=\"position\"\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-layout__canvas\"\n\t\t\t\t\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\t\t\t\t\tduration:\n\t\t\t\t\t\t\t\t\t\t\t\t\tdisableMotion || isResizing\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: ANIMATION_DURATION,\n\t\t\t\t\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t\t<ResizableFrame\n\t\t\t\t\t\t\t\t\t\t\t\t\tisReady={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t! isEditorLoading\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tisFullWidth={ isEditing }\n\t\t\t\t\t\t\t\t\t\t\t\t\toversizedClassName=\"edit-site-layout__resizable-frame-oversized\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tinnerContentStyle={ {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbackground:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tgradientValue ??\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbackgroundColor,\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Editor\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tisLoading={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisEditorLoading\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</ResizableFrame>\n\t\t\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\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</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/layout/index.js"],"names":["classnames","useSelect","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","__unstableUseNavigateRegions","useNavigateRegions","useReducedMotion","useViewportMatch","useResizeObserver","__","useState","useRef","NavigableRegion","store","keyboardShortcutsStore","CommandMenu","privateApis","commandsPrivateApis","preferencesStore","blockEditorPrivateApis","routerPrivateApis","coreCommandsPrivateApis","Sidebar","Editor","ErrorBoundary","editSiteStore","getIsListPage","Header","useInitEditedEntityFromURL","SiteHub","ResizableFrame","useSyncCanvasModeWithURL","unlock","SavePanel","KeyboardShortcutsRegister","KeyboardShortcutsGlobal","useCommonCommands","useEditModeCommands","PageMain","useIsSiteEditorLoading","useCommands","useCommandContext","useLocation","useGlobalStyle","ANIMATION_DURATION","Layout","hubRef","params","isMobileViewport","isListPage","isEditorPage","isDistractionFree","hasFixedToolbar","canvasMode","previousShortcut","nextShortcut","select","getAllShortcutKeyCombinations","getCanvasMode","get","isEditing","navigateRegionsProps","previous","next","disableMotion","showSidebar","showCanvas","isFullCanvas","canvasResizer","canvasSize","fullResizer","isResizing","isEditorLoading","isResizableFrameOversized","setIsResizableFrameOversized","headerAnimationState","commandContext","backgroundColor","gradientValue","ref","className","opacity","transition","type","delay","delayChildren","isDistractionFreeHovering","view","edit","undefined","div","x","y","duration","ease","width","scale","background"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,gBAAgB,IAAIC,MADrB,EAECC,yBAAyB,IAAIC,eAF9B,EAGCC,4BAA4B,IAAIC,kBAHjC,QAIO,uBAJP;AAKA,SACCC,gBADD,EAECC,gBAFD,EAGCC,iBAHD,QAIO,oBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,EAAmBC,MAAnB,QAAiC,oBAAjC;AACA,SAASC,eAAT,QAAgC,sBAAhC;AACA,SAASC,KAAK,IAAIC,sBAAlB,QAAgD,+BAAhD;AACA,SACCC,WADD,EAECC,WA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KAAK,EAAE,KADP;AAEAd,MAAAA,UAAU,EAAE;AACXW,QAAAA,QAAQ,EACP7B,aAAa,IACbO,UADA,GAEG,CAFH,GAGG,GALO;AAMXuB,QAAAA,IAAI,EAAE;AANK;AAFZ,KAFH,GAaG,EAfL;AAiBC,IAAA,OAAO,EAAG,KAjBX;AAkBC,IAAA,MAAM,EAAC,UAlBR;AAmBC,IAAA,SAAS,EAAGhG,UAAU,CACrB,0BADqB,EAErB;AACC,0BACC2E;AAFF,KAFqB,CAnBvB;AA0BC,IAAA,UAAU,EAAG;AACZU,MAAAA,IAAI,EAAE,OADM;AAEZU,MAAAA,QAAQ,EACP7B,aAAa,IAAIO,UAAjB,GACG,CADH,GAEG3B,kBALQ;AAMZkD,MAAAA,IAAI,EAAE;AANM;AA1Bd,KAmCC,cAAC,aAAD,QACC,cAAC,cAAD;AACC,IAAA,OAAO,EACN,CAAEtB,eAFJ;AAIC,IAAA,WAAW,EAAGZ,SAJf;AAKC,IAAA,WAAW,EACVa,yBANF;AAQC,IAAA,cAAc,EACbC,4BATF;AAWC,IAAA,iBAAiB,EAAG;AACnBuB,MAAAA,UAAU,EACTnB,aADS,aACTA,aADS,cACTA,aADS,GAETD;AAHkB;AAXrB,KAiBC,cAAC,MAAD;AACC,IAAA,SAAS,EACRL;AAFF,IAjBD,CADD,CAnCD,CAVF,CAHF,CA3BF,CA3FD,CALD,CADD;AA+MA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n\t__unstableUseNavigateRegions as useNavigateRegions,\n} from '@wordpress/components';\nimport {\n\tuseReducedMotion,\n\tuseViewportMatch,\n\tuseResizeObserver,\n} from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useRef } from '@wordpress/element';\nimport { NavigableRegion } from '@wordpress/interface';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport {\n\tCommandMenu,\n\tprivateApis as commandsPrivateApis,\n} from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';\n\n/**\n * Internal dependencies\n */\nimport Sidebar from '../sidebar';\nimport Editor from '../editor';\nimport ErrorBoundary from '../error-boundary';\nimport { store as editSiteStore } from '../../store';\nimport getIsListPage from '../../utils/get-is-list-page';\nimport Header from '../header-edit-mode';\nimport useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';\nimport SiteHub from '../site-hub';\nimport ResizableFrame from '../resizable-frame';\nimport useSyncCanvasModeWithURL from '../sync-state-with-url/use-sync-canvas-mode-with-url';\nimport { unlock } from '../../lock-unlock';\nimport SavePanel from '../save-panel';\nimport KeyboardShortcutsRegister from '../keyboard-shortcuts/register';\nimport KeyboardShortcutsGlobal from '../keyboard-shortcuts/global';\nimport { useCommonCommands } from '../../hooks/commands/use-common-commands';\nimport { useEditModeCommands } from '../../hooks/commands/use-edit-mode-commands';\nimport PageMain from '../page-main';\nimport { useIsSiteEditorLoading } from './hooks';\n\nconst { useCommands } = unlock( coreCommandsPrivateApis );\nconst { useCommandContext } = unlock( commandsPrivateApis );\nconst { useLocation } = unlock( routerPrivateApis );\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nconst ANIMATION_DURATION = 0.5;\n\nexport default function Layout() {\n\t// This ensures the edited entity id and type are initialized properly.\n\tuseInitEditedEntityFromURL();\n\tuseSyncCanvasModeWithURL();\n\tuseCommands();\n\tuseEditModeCommands();\n\tuseCommonCommands();\n\n\tconst hubRef = useRef();\n\tconst { params } = useLocation();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isListPage = getIsListPage( params, isMobileViewport );\n\tconst isEditorPage = ! isListPage;\n\n\tconst {\n\t\tisDistractionFree,\n\t\thasFixedToolbar,\n\t\tcanvasMode,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\n\t} = useSelect( ( select ) => {\n\t\tconst { getAllShortcutKeyCombinations } = select(\n\t\t\tkeyboardShortcutsStore\n\t\t);\n\t\tconst { getCanvasMode } = unlock( select( editSiteStore ) );\n\t\treturn {\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tpreviousShortcut: getAllShortcutKeyCombinations(\n\t\t\t\t'core/edit-site/previous-region'\n\t\t\t),\n\t\t\tnextShortcut: getAllShortcutKeyCombinations(\n\t\t\t\t'core/edit-site/next-region'\n\t\t\t),\n\t\t\thasFixedToolbar: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tisDistractionFree: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'distractionFree'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst isEditing = canvasMode === 'edit';\n\tconst navigateRegionsProps = useNavigateRegions( {\n\t\tprevious: previousShortcut,\n\t\tnext: nextShortcut,\n\t} );\n\tconst disableMotion = useReducedMotion();\n\tconst showSidebar =\n\t\t( isMobileViewport && ! isListPage ) ||\n\t\t( ! isMobileViewport && ( canvasMode === 'view' || ! isEditorPage ) );\n\tconst showCanvas =\n\t\t( isMobileViewport && isEditorPage && isEditing ) ||\n\t\t! isMobileViewport ||\n\t\t! isEditorPage;\n\tconst isFullCanvas =\n\t\t( isMobileViewport && isListPage ) || ( isEditorPage && isEditing );\n\tconst [ canvasResizer, canvasSize ] = useResizeObserver();\n\tconst [ fullResizer ] = useResizeObserver();\n\tconst [ isResizing ] = useState( false );\n\tconst isEditorLoading = useIsSiteEditorLoading();\n\tconst [ isResizableFrameOversized, setIsResizableFrameOversized ] =\n\t\tuseState( false );\n\n\t// This determines which animation variant should apply to the header.\n\t// There is also a `isDistractionFreeHovering` state that gets priority\n\t// when hovering the `edit-site-layout__header-container` in distraction\n\t// free mode. It's set via framer and trickles down to all the children\n\t// so they can use this variant state too.\n\t//\n\t// TODO: The issue with this is we want to have the hover state stick when hovering\n\t// a popover opened via the header. We'll probably need to lift this state to\n\t// handle it ourselves. Also, focusWithin the header needs to be handled.\n\tlet headerAnimationState;\n\n\tif ( canvasMode === 'view' ) {\n\t\t// We need 'view' to always take priority so 'isDistractionFree'\n\t\t// doesn't bleed over into the view (sidebar) state\n\t\theaderAnimationState = 'view';\n\t} else if ( isDistractionFree ) {\n\t\theaderAnimationState = 'isDistractionFree';\n\t} else {\n\t\theaderAnimationState = canvasMode; // edit, view, init\n\t}\n\n\t// Sets the right context for the command palette\n\tconst commandContext =\n\t\tcanvasMode === 'edit' && isEditorPage\n\t\t\t? 'site-editor-edit'\n\t\t\t: 'site-editor';\n\tuseCommandContext( commandContext );\n\n\tconst [ backgroundColor ] = useGlobalStyle( 'color.background' );\n\tconst [ gradientValue ] = useGlobalStyle( 'color.gradient' );\n\n\t// Synchronizing the URL with the store value of canvasMode happens in an effect\n\t// This condition ensures the component is only rendered after the synchronization happens\n\t// which prevents any animations due to potential canvasMode value change.\n\tif ( canvasMode === 'init' ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<CommandMenu />\n\t\t\t<KeyboardShortcutsRegister />\n\t\t\t<KeyboardShortcutsGlobal />\n\t\t\t{ fullResizer }\n\t\t\t<div\n\t\t\t\t{ ...navigateRegionsProps }\n\t\t\t\tref={ navigateRegionsProps.ref }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'edit-site-layout',\n\t\t\t\t\tnavigateRegionsProps.className,\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-distraction-free': isDistractionFree && isEditing,\n\t\t\t\t\t\t'is-full-canvas': isFullCanvas,\n\t\t\t\t\t\t'is-edit-mode': isEditing,\n\t\t\t\t\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"edit-site-layout__header-container\"\n\t\t\t\t\tvariants={ {\n\t\t\t\t\t\tisDistractionFree: {\n\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\ttransition: {\n\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\tdelay: 0.8,\n\t\t\t\t\t\t\t\tdelayChildren: 0.8,\n\t\t\t\t\t\t\t}, // How long to wait before the header exits\n\t\t\t\t\t\t},\n\t\t\t\t\t\tisDistractionFreeHovering: {\n\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\ttransition: {\n\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\tdelay: 0.2,\n\t\t\t\t\t\t\t\tdelayChildren: 0.2,\n\t\t\t\t\t\t\t}, // How long to wait before the header shows\n\t\t\t\t\t\t},\n\t\t\t\t\t\tview: { opacity: 1 },\n\t\t\t\t\t\tedit: { opacity: 1 },\n\t\t\t\t\t} }\n\t\t\t\t\twhileHover={\n\t\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t\t? 'isDistractionFreeHovering'\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tanimate={ headerAnimationState }\n\t\t\t\t>\n\t\t\t\t\t<SiteHub\n\t\t\t\t\t\tas={ motion.div }\n\t\t\t\t\t\tvariants={ {\n\t\t\t\t\t\t\tisDistractionFree: { x: '-100%' },\n\t\t\t\t\t\t\tisDistractionFreeHovering: { x: 0 },\n\t\t\t\t\t\t\tview: { x: 0 },\n\t\t\t\t\t\t\tedit: { x: 0 },\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tref={ hubRef }\n\t\t\t\t\t\tisTransparent={ isResizableFrameOversized }\n\t\t\t\t\t\tclassName=\"edit-site-layout__hub\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<AnimatePresence initial={ false }>\n\t\t\t\t\t\t{ isEditorPage && isEditing && (\n\t\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\t\tkey=\"header\"\n\t\t\t\t\t\t\t\tclassName=\"edit-site-layout__header\"\n\t\t\t\t\t\t\t\tariaLabel={ __( 'Editor top bar' ) }\n\t\t\t\t\t\t\t\tas={ motion.div }\n\t\t\t\t\t\t\t\tvariants={ {\n\t\t\t\t\t\t\t\t\tisDistractionFree: { opacity: 0, y: 0 },\n\t\t\t\t\t\t\t\t\tisDistractionFreeHovering: {\n\t\t\t\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\t\t\t\ty: 0,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tview: { opacity: 1, y: '-100%' },\n\t\t\t\t\t\t\t\t\tedit: { opacity: 1, y: 0 },\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\texit={ {\n\t\t\t\t\t\t\t\t\ty: '-100%',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tinitial={ {\n\t\t\t\t\t\t\t\t\topacity: isDistractionFree ? 1 : 0,\n\t\t\t\t\t\t\t\t\ty: isDistractionFree ? 0 : '-100%',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\t\tduration: disableMotion ? 0 : 0.2,\n\t\t\t\t\t\t\t\t\tease: 'easeOut',\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<Header />\n\t\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</AnimatePresence>\n\t\t\t\t</motion.div>\n\n\t\t\t\t<div className=\"edit-site-layout__content\">\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\t// The sidebar is needed for routing on mobile\n\t\t\t\t\t\t// (https://github.com/WordPress/gutenberg/pull/51558/files#r1231763003),\n\t\t\t\t\t\t// so we can't remove the element entirely. Using `inert` will make\n\t\t\t\t\t\t// it inaccessible to screen readers and keyboard navigation.\n\t\t\t\t\t\tinert={ showSidebar ? undefined : 'inert' }\n\t\t\t\t\t\tanimate={ { opacity: showSidebar ? 1 : 0 } }\n\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\tduration:\n\t\t\t\t\t\t\t\t// Disable transition in mobile to emulate a full page transition.\n\t\t\t\t\t\t\t\tdisableMotion || isMobileViewport\n\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t: ANIMATION_DURATION,\n\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tclassName=\"edit-site-layout__sidebar\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<NavigableRegion ariaLabel={ __( 'Navigation' ) }>\n\t\t\t\t\t\t\t<Sidebar />\n\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t</motion.div>\n\n\t\t\t\t\t<SavePanel />\n\n\t\t\t\t\t{ showCanvas && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ isListPage && <PageMain /> }\n\t\t\t\t\t\t\t{ isEditorPage && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t\t'edit-site-layout__canvas-container',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'is-resizing': isResizing,\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>\n\t\t\t\t\t\t\t\t\t{ canvasResizer }\n\t\t\t\t\t\t\t\t\t{ !! canvasSize.width && (\n\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\twhileHover={\n\t\t\t\t\t\t\t\t\t\t\t\tisEditorPage &&\n\t\t\t\t\t\t\t\t\t\t\t\tcanvasMode === 'view'\n\t\t\t\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tscale: 1.005,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tduration:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdisableMotion ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisResizing\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 0.5,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t\t\t\t: {}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tinitial={ false }\n\t\t\t\t\t\t\t\t\t\t\tlayout=\"position\"\n\t\t\t\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t\t\t\t'edit-site-layout__canvas',\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t'is-right-aligned':\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tisResizableFrameOversized,\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\t\t\t\t\tduration:\n\t\t\t\t\t\t\t\t\t\t\t\t\tdisableMotion || isResizing\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: ANIMATION_DURATION,\n\t\t\t\t\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t\t<ResizableFrame\n\t\t\t\t\t\t\t\t\t\t\t\t\tisReady={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t! isEditorLoading\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tisFullWidth={ isEditing }\n\t\t\t\t\t\t\t\t\t\t\t\t\tisOversized={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tisResizableFrameOversized\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsOversized={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsResizableFrameOversized\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tinnerContentStyle={ {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbackground:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tgradientValue ??\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbackgroundColor,\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Editor\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tisLoading={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisEditorLoading\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</ResizableFrame>\n\t\t\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\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</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -10,7 +10,7 @@ import { moreVertical } from '@wordpress/icons';
|
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import
|
|
13
|
+
import TrashPageMenuItem from './trash-page-menu-item';
|
|
14
14
|
export default function PageActions({
|
|
15
15
|
postId,
|
|
16
16
|
className,
|
|
@@ -22,7 +22,7 @@ export default function PageActions({
|
|
|
22
22
|
label: __('Actions'),
|
|
23
23
|
className: className,
|
|
24
24
|
toggleProps: toggleProps
|
|
25
|
-
}, () => createElement(MenuGroup, null, createElement(
|
|
25
|
+
}, () => createElement(MenuGroup, null, createElement(TrashPageMenuItem, {
|
|
26
26
|
postId: postId,
|
|
27
27
|
onRemove: onRemove
|
|
28
28
|
})));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/page-actions/index.js"],"names":["__","DropdownMenu","MenuGroup","moreVertical","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-actions/index.js"],"names":["__","DropdownMenu","MenuGroup","moreVertical","TrashPageMenuItem","PageActions","postId","className","toggleProps","onRemove"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,EAAuBC,SAAvB,QAAwC,uBAAxC;AACA,SAASC,YAAT,QAA6B,kBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,wBAA9B;AAEA,eAAe,SAASC,WAAT,CAAsB;AACpCC,EAAAA,MADoC;AAEpCC,EAAAA,SAFoC;AAGpCC,EAAAA,WAHoC;AAIpCC,EAAAA;AAJoC,CAAtB,EAKX;AACH,SACC,cAAC,YAAD;AACC,IAAA,IAAI,EAAGN,YADR;AAEC,IAAA,KAAK,EAAGH,EAAE,CAAE,SAAF,CAFX;AAGC,IAAA,SAAS,EAAGO,SAHb;AAIC,IAAA,WAAW,EAAGC;AAJf,KAMG,MACD,cAAC,SAAD,QACC,cAAC,iBAAD;AACC,IAAA,MAAM,EAAGF,MADV;AAEC,IAAA,QAAQ,EAAGG;AAFZ,IADD,CAPF,CADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { DropdownMenu, MenuGroup } from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport TrashPageMenuItem from './trash-page-menu-item';\n\nexport default function PageActions( {\n\tpostId,\n\tclassName,\n\ttoggleProps,\n\tonRemove,\n} ) {\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Actions' ) }\n\t\t\tclassName={ className }\n\t\t\ttoggleProps={ toggleProps }\n\t\t>\n\t\t\t{ () => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<TrashPageMenuItem\n\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\tonRemove={ onRemove }\n\t\t\t\t\t/>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"]}
|
package/build-module/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js}
RENAMED
|
@@ -5,16 +5,14 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
5
5
|
*/
|
|
6
6
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
7
7
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
8
|
-
import { useState } from '@wordpress/element';
|
|
9
8
|
import { store as coreStore } from '@wordpress/core-data';
|
|
10
9
|
import { __, sprintf } from '@wordpress/i18n';
|
|
11
|
-
import { MenuItem
|
|
10
|
+
import { MenuItem } from '@wordpress/components';
|
|
12
11
|
import { store as noticesStore } from '@wordpress/notices';
|
|
13
|
-
export default function
|
|
12
|
+
export default function TrashPageMenuItem({
|
|
14
13
|
postId,
|
|
15
14
|
onRemove
|
|
16
15
|
}) {
|
|
17
|
-
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
18
16
|
const {
|
|
19
17
|
createSuccessNotice,
|
|
20
18
|
createErrorNotice
|
|
@@ -31,28 +29,22 @@ export default function DeletePageMenuItem({
|
|
|
31
29
|
});
|
|
32
30
|
createSuccessNotice(sprintf(
|
|
33
31
|
/* translators: The page's title. */
|
|
34
|
-
__('"%s"
|
|
32
|
+
__('"%s" moved to the Trash.'), decodeEntities(page.title.rendered)), {
|
|
35
33
|
type: 'snackbar',
|
|
36
|
-
id: 'edit-site-page-
|
|
34
|
+
id: 'edit-site-page-trashed'
|
|
37
35
|
});
|
|
38
36
|
onRemove?.();
|
|
39
37
|
} catch (error) {
|
|
40
|
-
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : __('An error occurred while
|
|
38
|
+
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : __('An error occurred while moving the page to the trash.');
|
|
41
39
|
createErrorNotice(errorMessage, {
|
|
42
40
|
type: 'snackbar'
|
|
43
41
|
});
|
|
44
|
-
} finally {
|
|
45
|
-
setIsModalOpen(false);
|
|
46
42
|
}
|
|
47
43
|
}
|
|
48
44
|
|
|
49
45
|
return createElement(Fragment, null, createElement(MenuItem, {
|
|
50
|
-
onClick: () =>
|
|
46
|
+
onClick: () => removePage(),
|
|
51
47
|
isDestructive: true
|
|
52
|
-
}, __('
|
|
53
|
-
isOpen: isModalOpen,
|
|
54
|
-
onConfirm: removePage,
|
|
55
|
-
onCancel: () => setIsModalOpen(false)
|
|
56
|
-
}, __('Are you sure you want to delete this page?')));
|
|
48
|
+
}, __('Move to Trash')));
|
|
57
49
|
}
|
|
58
|
-
//# sourceMappingURL=
|
|
50
|
+
//# sourceMappingURL=trash-page-menu-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-actions/trash-page-menu-item.js"],"names":["useDispatch","useSelect","decodeEntities","store","coreStore","__","sprintf","MenuItem","noticesStore","TrashPageMenuItem","postId","onRemove","createSuccessNotice","createErrorNotice","deleteEntityRecord","page","select","getEntityRecord","removePage","throwOnError","title","rendered","type","id","error","errorMessage","message","code"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASJ,KAAK,IAAIK,YAAlB,QAAsC,oBAAtC;AAEA,eAAe,SAASC,iBAAT,CAA4B;AAAEC,EAAAA,MAAF;AAAUC,EAAAA;AAAV,CAA5B,EAAmD;AACjE,QAAM;AAAEC,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,MACLb,WAAW,CAAEQ,YAAF,CADZ;AAEA,QAAM;AAAEM,IAAAA;AAAF,MAAyBd,WAAW,CAAEI,SAAF,CAA1C;AACA,QAAMW,IAAI,GAAGd,SAAS,CACnBe,MAAF,IACCA,MAAM,CAAEZ,SAAF,CAAN,CAAoBa,eAApB,CAAqC,UAArC,EAAiD,MAAjD,EAAyDP,MAAzD,CAFoB,EAGrB,CAAEA,MAAF,CAHqB,CAAtB;;AAKA,iBAAeQ,UAAf,GAA4B;AAC3B,QAAI;AACH,YAAMJ,kBAAkB,CACvB,UADuB,EAEvB,MAFuB,EAGvBJ,MAHuB,EAIvB,EAJuB,EAKvB;AAAES,QAAAA,YAAY,EAAE;AAAhB,OALuB,CAAxB;AAOAP,MAAAA,mBAAmB,CAClBN,OAAO;AACN;AACAD,MAAAA,EAAE,CAAE,0BAAF,CAFI,EAGNH,cAAc,CAAEa,IAAI,CAACK,KAAL,CAAWC,QAAb,CAHR,CADW,EAMlB;AACCC,QAAAA,IAAI,EAAE,UADP;AAECC,QAAAA,EAAE,EAAE;AAFL,OANkB,CAAnB;AAWAZ,MAAAA,QAAQ;AACR,KApBD,CAoBE,OAAQa,KAAR,EAAgB;AACjB,YAAMC,YAAY,GACjBD,KAAK,CAACE,OAAN,IAAiBF,KAAK,CAACG,IAAN,KAAe,eAAhC,GACGH,KAAK,CAACE,OADT,GAEGrB,EAAE,CACF,uDADE,CAHN;AAOAQ,MAAAA,iBAAiB,CAAEY,YAAF,EAAgB;AAAEH,QAAAA,IAAI,EAAE;AAAR,OAAhB,CAAjB;AACA;AACD;;AACD,SACC,8BACC,cAAC,QAAD;AAAU,IAAA,OAAO,EAAG,MAAMJ,UAAU,EAApC;AAAyC,IAAA,aAAa;AAAtD,KACGb,EAAE,CAAE,eAAF,CADL,CADD,CADD;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function TrashPageMenuItem( { postId, onRemove } ) {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\tconst page = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'postType', 'page', postId ),\n\t\t[ postId ]\n\t);\n\tasync function removePage() {\n\t\ttry {\n\t\t\tawait deleteEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'page',\n\t\t\t\tpostId,\n\t\t\t\t{},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The page's title. */\n\t\t\t\t\t__( '\"%s\" moved to the Trash.' ),\n\t\t\t\t\tdecodeEntities( page.title.rendered )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'edit-site-page-trashed',\n\t\t\t\t}\n\t\t\t);\n\t\t\tonRemove?.();\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'An error occurred while moving the page to the trash.'\n\t\t\t\t\t );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\treturn (\n\t\t<>\n\t\t\t<MenuItem onClick={ () => removePage() } isDestructive>\n\t\t\t\t{ __( 'Move to Trash' ) }\n\t\t\t</MenuItem>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -132,7 +132,7 @@ function GridItem({
|
|
|
132
132
|
justify: "left",
|
|
133
133
|
spacing: 3,
|
|
134
134
|
className: "edit-site-patterns__pattern-title"
|
|
135
|
-
}, itemIcon && createElement(Tooltip, {
|
|
135
|
+
}, itemIcon && !isNonUserPattern && createElement(Tooltip, {
|
|
136
136
|
position: "top center",
|
|
137
137
|
text: __('Editing this pattern will also update anywhere it is used')
|
|
138
138
|
}, createElement("span", null, createElement(Icon, {
|