@wordpress/edit-site 5.12.10 → 5.12.12
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/global-styles/screen-revisions/index.js +8 -2
- package/build/components/global-styles/screen-revisions/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/global-styles/screen-revisions/use-global-styles-revisions.js +31 -25
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +7 -5
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build/components/layout/index.js +14 -3
- package/build/components/layout/index.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 +1 -1
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-template-parts/index.js +1 -2
- package/build/components/page-template-parts/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +14 -23
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-status.js +2 -7
- package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +15 -13
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +8 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +2 -0
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +0 -9
- package/build/components/sidebar-navigation-screen-patterns/index.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/sidebar-navigation-screen-templates/index.js +1 -10
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +9 -0
- package/build/components/sidebar-navigation-screen-templates-browse/index.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/hooks/commands/use-edit-mode-commands.js +30 -0
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/store/private-actions.js +2 -1
- package/build/store/private-actions.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +9 -3
- package/build-module/components/global-styles/screen-revisions/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/global-styles/screen-revisions/use-global-styles-revisions.js +27 -21
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +7 -5
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build-module/components/layout/index.js +14 -3
- package/build-module/components/layout/index.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 +1 -1
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-template-parts/index.js +1 -2
- package/build-module/components/page-template-parts/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +15 -24
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +2 -7
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +13 -13
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +7 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +2 -0
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +0 -7
- package/build-module/components/sidebar-navigation-screen-patterns/index.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/sidebar-navigation-screen-templates/index.js +1 -8
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +7 -0
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.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-module/hooks/commands/use-edit-mode-commands.js +29 -0
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/store/private-actions.js +2 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-style/style-rtl.css +12 -11
- package/build-style/style.css +12 -11
- package/package.json +20 -20
- package/src/components/global-styles/screen-revisions/index.js +76 -58
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +17 -31
- package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +14 -1
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +63 -48
- package/src/components/keyboard-shortcuts/edit-mode.js +4 -5
- package/src/components/layout/index.js +22 -2
- package/src/components/layout/style.scss +1 -1
- package/src/components/page-patterns/patterns-list.js +5 -2
- package/src/components/page-patterns/style.scss +3 -0
- package/src/components/page-patterns/use-patterns.js +1 -0
- package/src/components/page-template-parts/index.js +0 -1
- package/src/components/resizable-frame/index.js +12 -28
- package/src/components/resizable-frame/style.scss +0 -17
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +1 -4
- package/src/components/sidebar-navigation-screen/index.js +13 -15
- package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +27 -15
- package/src/components/sidebar-navigation-screen-pages/index.js +9 -4
- package/src/components/sidebar-navigation-screen-patterns/index.js +0 -8
- package/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -1
- package/src/components/sidebar-navigation-screen-templates/index.js +1 -9
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +10 -0
- 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/src/hooks/commands/use-edit-mode-commands.js +34 -3
- package/src/store/private-actions.js +5 -1
|
@@ -101,12 +101,13 @@ function ScreenRevisions() {
|
|
|
101
101
|
};
|
|
102
102
|
|
|
103
103
|
const isLoadButtonEnabled = !!globalStylesRevision?.id && !areGlobalStyleConfigsEqual(globalStylesRevision, userConfig);
|
|
104
|
+
const shouldShowRevisions = !isLoading && revisions.length;
|
|
104
105
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_header.default, {
|
|
105
106
|
title: (0, _i18n.__)('Revisions'),
|
|
106
107
|
description: (0, _i18n.__)('Revisions are added to the timeline when style changes are saved.')
|
|
107
108
|
}), isLoading && (0, _element.createElement)(_components.Spinner, {
|
|
108
109
|
className: "edit-site-global-styles-screen-revisions__loading"
|
|
109
|
-
}),
|
|
110
|
+
}), shouldShowRevisions ? (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_revisions.default, {
|
|
110
111
|
blocks: blocks,
|
|
111
112
|
userConfig: globalStylesRevision,
|
|
112
113
|
onClose: onCloseRevisions
|
|
@@ -133,7 +134,12 @@ function ScreenRevisions() {
|
|
|
133
134
|
confirmButtonText: (0, _i18n.__)(' Discard unsaved changes'),
|
|
134
135
|
onConfirm: () => restoreRevision(globalStylesRevision),
|
|
135
136
|
onCancel: () => setIsLoadingRevisionWithUnsavedChanges(false)
|
|
136
|
-
}, (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("h2", null, (0, _i18n.__)('Loading this revision will discard all unsaved changes.')), (0, _element.createElement)("p", null, (0, _i18n.__)('Do you want to replace your unsaved changes in the editor?')))))
|
|
137
|
+
}, (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("h2", null, (0, _i18n.__)('Loading this revision will discard all unsaved changes.')), (0, _element.createElement)("p", null, (0, _i18n.__)('Do you want to replace your unsaved changes in the editor?'))))) : (0, _element.createElement)(_components.__experimentalSpacer, {
|
|
138
|
+
marginX: 4,
|
|
139
|
+
"data-testid": "global-styles-no-revisions"
|
|
140
|
+
}, // Adding an existing translation here in case these changes are shipped to WordPress 6.3.
|
|
141
|
+
// Later we could update to something better, e.g., "There are currently no style revisions.".
|
|
142
|
+
(0, _i18n.__)('No results found.')));
|
|
137
143
|
}
|
|
138
144
|
|
|
139
145
|
var _default = ScreenRevisions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-revisions/index.js"],"names":["GlobalStylesContext","areGlobalStyleConfigsEqual","blockEditorPrivateApis","ScreenRevisions","goBack","user","userConfig","setUserConfig","blocks","editorCanvasContainerView","select","editSiteStore","getEditorCanvasContainerView","blockEditorStore","getBlocks","revisions","isLoading","hasUnsavedChanges","selectedRevisionId","setSelectedRevisionId","globalStylesRevision","setGlobalStylesRevision","isLoadingRevisionWithUnsavedChanges","setIsLoadingRevisionWithUnsavedChanges","setEditorCanvasContainerView","onCloseRevisions","restoreRevision","revision","styles","settings","selectRevision","id","isLoadButtonEnabled"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-revisions/index.js"],"names":["GlobalStylesContext","areGlobalStyleConfigsEqual","blockEditorPrivateApis","ScreenRevisions","goBack","user","userConfig","setUserConfig","blocks","editorCanvasContainerView","select","editSiteStore","getEditorCanvasContainerView","blockEditorStore","getBlocks","revisions","isLoading","hasUnsavedChanges","selectedRevisionId","setSelectedRevisionId","globalStylesRevision","setGlobalStylesRevision","isLoadingRevisionWithUnsavedChanges","setIsLoadingRevisionWithUnsavedChanges","setEditorCanvasContainerView","onCloseRevisions","restoreRevision","revision","styles","settings","selectRevision","id","isLoadButtonEnabled","shouldShowRevisions","length"],"mappings":";;;;;;;;;AAYA;;AATA;;AACA;;AAOA;;AAEA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA3BA;AACA;AACA;;AAgBA;AACA;AACA;AASA,MAAM;AAAEA,EAAAA,mBAAF;AAAuBC,EAAAA;AAAvB,IAAsD,wBAC3DC,wBAD2D,CAA5D;;AAIA,SAASC,eAAT,GAA2B;AAC1B,QAAM;AAAEC,IAAAA;AAAF,MAAa,6CAAnB;AACA,QAAM;AAAEC,IAAAA,IAAI,EAAEC,UAAR;AAAoBC,IAAAA;AAApB,MACL,yBAAYP,mBAAZ,CADD;AAEA,QAAM;AAAEQ,IAAAA,MAAF;AAAUC,IAAAA;AAAV,MAAwC,qBAAaC,MAAF,IAAc;AACtE,WAAO;AACND,MAAAA,yBAAyB,EAAE,wBAC1BC,MAAM,CAAEC,YAAF,CADoB,EAEzBC,4BAFyB,EADrB;AAINJ,MAAAA,MAAM,EAAEE,MAAM,CAAEG,kBAAF,CAAN,CAA2BC,SAA3B;AAJF,KAAP;AAMA,GAP6C,EAO3C,EAP2C,CAA9C;AAQA,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,SAAb;AAAwBC,IAAAA;AAAxB,MACL,wCADD;AAEA,QAAM,CAAEC,kBAAF,EAAsBC,qBAAtB,IAAgD,wBAAtD;AACA,QAAM,CAAEC,oBAAF,EAAwBC,uBAAxB,IACL,uBAAUf,UAAV,CADD;AAEA,QAAM,CACLgB,mCADK,EAELC,sCAFK,IAGF,uBAAU,KAAV,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J,CAJF,CAjFF,CADD;AA4FA;;eAEcpB,e","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\t__experimentalUseNavigator as useNavigator,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tSpinner,\n\t__experimentalSpacer as Spacer,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useContext, useState, useEffect } from '@wordpress/element';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from '../header';\nimport { unlock } from '../../../lock-unlock';\nimport Revisions from '../../revisions';\nimport SidebarFixedBottom from '../../sidebar-edit-mode/sidebar-fixed-bottom';\nimport { store as editSiteStore } from '../../../store';\nimport useGlobalStylesRevisions from './use-global-styles-revisions';\nimport RevisionsButtons from './revisions-buttons';\n\nconst { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(\n\tblockEditorPrivateApis\n);\n\nfunction ScreenRevisions() {\n\tconst { goBack } = useNavigator();\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\tconst { blocks, editorCanvasContainerView } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\teditorCanvasContainerView: unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView(),\n\t\t\tblocks: select( blockEditorStore ).getBlocks(),\n\t\t};\n\t}, [] );\n\tconst { revisions, isLoading, hasUnsavedChanges } =\n\t\tuseGlobalStylesRevisions();\n\tconst [ selectedRevisionId, setSelectedRevisionId ] = useState();\n\tconst [ globalStylesRevision, setGlobalStylesRevision ] =\n\t\tuseState( userConfig );\n\tconst [\n\t\tisLoadingRevisionWithUnsavedChanges,\n\t\tsetIsLoadingRevisionWithUnsavedChanges,\n\t] = useState( false );\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\n\tuseEffect( () => {\n\t\tif ( editorCanvasContainerView !== 'global-styles-revisions' ) {\n\t\t\tgoBack();\n\t\t\tsetEditorCanvasContainerView( editorCanvasContainerView );\n\t\t}\n\t}, [ editorCanvasContainerView ] );\n\n\tconst onCloseRevisions = () => {\n\t\tgoBack();\n\t};\n\n\tconst restoreRevision = ( revision ) => {\n\t\tsetUserConfig( () => ( {\n\t\t\tstyles: revision?.styles,\n\t\t\tsettings: revision?.settings,\n\t\t} ) );\n\t\tsetIsLoadingRevisionWithUnsavedChanges( false );\n\t\tonCloseRevisions();\n\t};\n\n\tconst selectRevision = ( revision ) => {\n\t\tsetGlobalStylesRevision( {\n\t\t\tstyles: revision?.styles,\n\t\t\tsettings: revision?.settings,\n\t\t\tid: revision?.id,\n\t\t} );\n\t\tsetSelectedRevisionId( revision?.id );\n\t};\n\n\tconst isLoadButtonEnabled =\n\t\t!! globalStylesRevision?.id &&\n\t\t! areGlobalStyleConfigsEqual( globalStylesRevision, userConfig );\n\tconst shouldShowRevisions = ! isLoading && revisions.length;\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Revisions' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Revisions are added to the timeline when style changes are saved.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t{ isLoading && (\n\t\t\t\t<Spinner className=\"edit-site-global-styles-screen-revisions__loading\" />\n\t\t\t) }\n\t\t\t{ shouldShowRevisions ? (\n\t\t\t\t<>\n\t\t\t\t\t<Revisions\n\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\tuserConfig={ globalStylesRevision }\n\t\t\t\t\t\tonClose={ onCloseRevisions }\n\t\t\t\t\t/>\n\t\t\t\t\t<div className=\"edit-site-global-styles-screen-revisions\">\n\t\t\t\t\t\t<RevisionsButtons\n\t\t\t\t\t\t\tonChange={ selectRevision }\n\t\t\t\t\t\t\tselectedRevisionId={ selectedRevisionId }\n\t\t\t\t\t\t\tuserRevisions={ revisions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ isLoadButtonEnabled && (\n\t\t\t\t\t\t\t<SidebarFixedBottom>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-global-styles-screen-revisions__button\"\n\t\t\t\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t\t\t\t! globalStylesRevision?.id ||\n\t\t\t\t\t\t\t\t\t\tglobalStylesRevision?.id === 'unsaved'\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\tif ( hasUnsavedChanges ) {\n\t\t\t\t\t\t\t\t\t\t\tsetIsLoadingRevisionWithUnsavedChanges(\n\t\t\t\t\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\trestoreRevision(\n\t\t\t\t\t\t\t\t\t\t\t\tglobalStylesRevision\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>\n\t\t\t\t\t\t\t\t\t{ __( 'Apply' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</SidebarFixedBottom>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t\t{ isLoadingRevisionWithUnsavedChanges && (\n\t\t\t\t\t\t<ConfirmDialog\n\t\t\t\t\t\t\ttitle={ __(\n\t\t\t\t\t\t\t\t'Loading this revision will discard all unsaved changes.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tisOpen={ isLoadingRevisionWithUnsavedChanges }\n\t\t\t\t\t\t\tconfirmButtonText={ __(\n\t\t\t\t\t\t\t\t' Discard unsaved changes'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonConfirm={ () =>\n\t\t\t\t\t\t\t\trestoreRevision( globalStylesRevision )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonCancel={ () =>\n\t\t\t\t\t\t\t\tsetIsLoadingRevisionWithUnsavedChanges( false )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<h2>\n\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t'Loading this revision will discard all unsaved changes.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t'Do you want to replace your unsaved changes in the editor?'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t</ConfirmDialog>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) : (\n\t\t\t\t<Spacer marginX={ 4 } data-testid=\"global-styles-no-revisions\">\n\t\t\t\t\t{\n\t\t\t\t\t\t// Adding an existing translation here in case these changes are shipped to WordPress 6.3.\n\t\t\t\t\t\t// Later we could update to something better, e.g., \"There are currently no style revisions.\".\n\t\t\t\t\t\t__( 'No results found.' )\n\t\t\t\t\t}\n\t\t\t\t</Spacer>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenRevisions;\n"]}
|
|
@@ -36,24 +36,16 @@ function getRevisionLabel(revision) {
|
|
|
36
36
|
|
|
37
37
|
if ('unsaved' === revision?.id) {
|
|
38
38
|
return (0, _i18n.sprintf)(
|
|
39
|
-
/* translators: %
|
|
40
|
-
(0, _i18n.__)('Unsaved changes by %
|
|
41
|
-
name: authorDisplayName
|
|
42
|
-
});
|
|
39
|
+
/* translators: %s author display name */
|
|
40
|
+
(0, _i18n.__)('Unsaved changes by %s'), authorDisplayName);
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
const formattedDate = (0, _date.dateI18n)((0, _date.getSettings)().formats.datetimeAbbreviated, (0, _date.getDate)(revision?.modified));
|
|
46
44
|
return revision?.isLatest ? (0, _i18n.sprintf)(
|
|
47
|
-
/* translators: %
|
|
48
|
-
(0, _i18n.__)('Changes saved by %
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}) : (0, _i18n.sprintf)(
|
|
52
|
-
/* translators: %(name)s author display name, %(date)s: revision creation date */
|
|
53
|
-
(0, _i18n.__)('Changes saved by %(name)s on %(date)s'), {
|
|
54
|
-
name: authorDisplayName,
|
|
55
|
-
date: formattedDate
|
|
56
|
-
});
|
|
45
|
+
/* translators: %1$s author display name, %2$s: revision creation date */
|
|
46
|
+
(0, _i18n.__)('Changes saved by %1$s on %2$s (current)'), authorDisplayName, formattedDate) : (0, _i18n.sprintf)(
|
|
47
|
+
/* translators: %1$s author display name, %2$s: revision creation date */
|
|
48
|
+
(0, _i18n.__)('Changes saved by %1$s on %2$s'), authorDisplayName, formattedDate);
|
|
57
49
|
}
|
|
58
50
|
/**
|
|
59
51
|
* Returns a rendered list of revisions buttons.
|
|
@@ -106,14 +98,10 @@ function RevisionsButtons({
|
|
|
106
98
|
}, (0, _date.humanTimeDiff)(modified)), (0, _element.createElement)("span", {
|
|
107
99
|
className: "edit-site-global-styles-screen-revisions__meta"
|
|
108
100
|
}, isUnsaved ? (0, _i18n.sprintf)(
|
|
109
|
-
/* translators: %
|
|
110
|
-
(0, _i18n.__)('Unsaved changes by %
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
/* translators: %(name)s author display name */
|
|
114
|
-
(0, _i18n.__)('Changes saved by %(name)s'), {
|
|
115
|
-
name: authorDisplayName
|
|
116
|
-
}), (0, _element.createElement)("img", {
|
|
101
|
+
/* translators: %s author display name */
|
|
102
|
+
(0, _i18n.__)('Unsaved changes by %s'), authorDisplayName) : (0, _i18n.sprintf)(
|
|
103
|
+
/* translators: %s author display name */
|
|
104
|
+
(0, _i18n.__)('Changes saved by %s'), authorDisplayName), (0, _element.createElement)("img", {
|
|
117
105
|
alt: author?.name,
|
|
118
106
|
src: authorAvatar
|
|
119
107
|
})))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-revisions/revisions-buttons.js"],"names":["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":["getRevisionLabel","revision","authorDisplayName","author","name","id","formattedDate","formats","datetimeAbbreviated","modified","isLatest","RevisionsButtons","userRevisions","selectedRevisionId","onChange","map","index","authorAvatar","avatar_urls","isUnsaved","isSelected"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAT,CAA2BC,QAA3B,EAAsC;AACrC,QAAMC,iBAAiB,GAAGD,QAAQ,EAAEE,MAAV,EAAkBC,IAAlB,IAA0B,cAAI,MAAJ,CAApD;;AAEA,MAAK,cAAcH,QAAQ,EAAEI,EAA7B,EAAkC;AACjC,WAAO;AACN;AACA,kBAAI,uBAAJ,CAFM,EAGNH,iBAHM,CAAP;AAKA;;AACD,QAAMI,aAAa,GAAG,oBACrB,yBAAcC,OAAd,CAAsBC,mBADD,EAErB,mBAASP,QAAQ,EAAEQ,QAAnB,CAFqB,CAAtB;AAKA,SAAOR,QAAQ,EAAES,QAAV,GACJ;AACA;AACA,gBAAI,yCAAJ,CAFA,EAGAR,iBAHA,EAIAI,aAJA,CADI,GAOJ;AACA;AACA,gBAAI,+BAAJ,CAFA,EAGAJ,iBAHA,EAIAI,aAJA,CAPH;AAaA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASK,gBAAT,CAA2B;AAAEC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AaC;AACC,MAAA,GAAG,EAAGC,MAAM,EAAEC,IADf;AAEC,MAAA,GAAG,EAAGa;AAFP,MAbD,CAJD,CARD,CATD,CADD;AA4CA,GArDC,CALH,CADD;AA8DA;;eAEcN,gB","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"]}
|
|
@@ -41,13 +41,15 @@ function useGlobalStylesRevisions() {
|
|
|
41
41
|
authors,
|
|
42
42
|
currentUser,
|
|
43
43
|
isDirty,
|
|
44
|
-
revisions
|
|
44
|
+
revisions,
|
|
45
|
+
isLoadingGlobalStylesRevisions
|
|
45
46
|
} = (0, _data.useSelect)(select => {
|
|
46
47
|
const {
|
|
47
48
|
__experimentalGetDirtyEntityRecords,
|
|
48
49
|
getCurrentUser,
|
|
49
50
|
getUsers,
|
|
50
|
-
getCurrentThemeGlobalStylesRevisions
|
|
51
|
+
getCurrentThemeGlobalStylesRevisions,
|
|
52
|
+
isResolving
|
|
51
53
|
} = select(_coreData.store);
|
|
52
54
|
|
|
53
55
|
const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
|
|
@@ -64,13 +66,14 @@ function useGlobalStylesRevisions() {
|
|
|
64
66
|
authors: _authors,
|
|
65
67
|
currentUser: _currentUser,
|
|
66
68
|
isDirty: _isDirty,
|
|
67
|
-
revisions: globalStylesRevisions
|
|
69
|
+
revisions: globalStylesRevisions,
|
|
70
|
+
isLoadingGlobalStylesRevisions: isResolving('getCurrentThemeGlobalStylesRevisions')
|
|
68
71
|
};
|
|
69
72
|
}, []);
|
|
70
73
|
return (0, _element.useMemo)(() => {
|
|
71
74
|
let _modifiedRevisions = [];
|
|
72
75
|
|
|
73
|
-
if (!authors.length ||
|
|
76
|
+
if (!authors.length || isLoadingGlobalStylesRevisions) {
|
|
74
77
|
return {
|
|
75
78
|
revisions: _modifiedRevisions,
|
|
76
79
|
hasUnsavedChanges: isDirty,
|
|
@@ -83,26 +86,29 @@ function useGlobalStylesRevisions() {
|
|
|
83
86
|
return { ...revision,
|
|
84
87
|
author: authors.find(author => author.id === revision.author)
|
|
85
88
|
};
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
if (_modifiedRevisions
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
if (_modifiedRevisions.length) {
|
|
92
|
+
// Flags the most current saved revision.
|
|
93
|
+
if (_modifiedRevisions[0].id !== 'unsaved') {
|
|
94
|
+
_modifiedRevisions[0].isLatest = true;
|
|
95
|
+
} // Adds an item for unsaved changes.
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
if (isDirty && userConfig && Object.keys(userConfig).length > 0 && currentUser) {
|
|
99
|
+
const unsavedRevision = {
|
|
100
|
+
id: 'unsaved',
|
|
101
|
+
styles: userConfig?.styles,
|
|
102
|
+
settings: userConfig?.settings,
|
|
103
|
+
author: {
|
|
104
|
+
name: currentUser?.name,
|
|
105
|
+
avatar_urls: currentUser?.avatar_urls
|
|
106
|
+
},
|
|
107
|
+
modified: new Date()
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
_modifiedRevisions.unshift(unsavedRevision);
|
|
111
|
+
}
|
|
106
112
|
}
|
|
107
113
|
|
|
108
114
|
return {
|
|
@@ -110,6 +116,6 @@ function useGlobalStylesRevisions() {
|
|
|
110
116
|
hasUnsavedChanges: isDirty,
|
|
111
117
|
isLoading: false
|
|
112
118
|
};
|
|
113
|
-
}, [isDirty, revisions, currentUser, authors, userConfig]);
|
|
119
|
+
}, [isDirty, revisions, currentUser, authors, userConfig, isLoadingGlobalStylesRevisions]);
|
|
114
120
|
}
|
|
115
121
|
//# sourceMappingURL=use-global-styles-revisions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-revisions/use-global-styles-revisions.js"],"names":["SITE_EDITOR_AUTHORS_QUERY","per_page","_fields","context","capabilities","EMPTY_ARRAY","GlobalStylesContext","blockEditorPrivateApis","useGlobalStylesRevisions","user","userConfig","authors","currentUser","isDirty","revisions","select","__experimentalGetDirtyEntityRecords","getCurrentUser","getUsers","getCurrentThemeGlobalStylesRevisions","coreStore","dirtyEntityRecords","_currentUser","_isDirty","length","globalStylesRevisions","_authors","_modifiedRevisions","hasUnsavedChanges","isLoading","map","revision","author","find","id","isLatest","Object","keys","unsavedRevision","styles","settings","name","avatar_urls","modified","Date","unshift"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGA,MAAMA,yBAAyB,GAAG;AACjCC,EAAAA,QAAQ,EAAE,CAAC,CADsB;AAEjCC,EAAAA,OAAO,EAAE,qBAFwB;AAGjCC,EAAAA,OAAO,EAAE,MAHwB;AAIjCC,EAAAA,YAAY,EAAE,CAAE,oBAAF;AAJmB,CAAlC;AAMA,MAAMC,WAAW,GAAG,EAApB;AACA,MAAM;AAAEC,EAAAA;AAAF,IAA0B,wBAAQC,wBAAR,CAAhC;;AACe,SAASC,wBAAT,GAAoC;AAClD,QAAM;AAAEC,IAAAA,IAAI,EAAEC;AAAR,MAAuB,yBAAYJ,mBAAZ,CAA7B;AACA,QAAM;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-revisions/use-global-styles-revisions.js"],"names":["SITE_EDITOR_AUTHORS_QUERY","per_page","_fields","context","capabilities","EMPTY_ARRAY","GlobalStylesContext","blockEditorPrivateApis","useGlobalStylesRevisions","user","userConfig","authors","currentUser","isDirty","revisions","isLoadingGlobalStylesRevisions","select","__experimentalGetDirtyEntityRecords","getCurrentUser","getUsers","getCurrentThemeGlobalStylesRevisions","isResolving","coreStore","dirtyEntityRecords","_currentUser","_isDirty","length","globalStylesRevisions","_authors","_modifiedRevisions","hasUnsavedChanges","isLoading","map","revision","author","find","id","isLatest","Object","keys","unsavedRevision","styles","settings","name","avatar_urls","modified","Date","unshift"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGA,MAAMA,yBAAyB,GAAG;AACjCC,EAAAA,QAAQ,EAAE,CAAC,CADsB;AAEjCC,EAAAA,OAAO,EAAE,qBAFwB;AAGjCC,EAAAA,OAAO,EAAE,MAHwB;AAIjCC,EAAAA,YAAY,EAAE,CAAE,oBAAF;AAJmB,CAAlC;AAMA,MAAMC,WAAW,GAAG,EAApB;AACA,MAAM;AAAEC,EAAAA;AAAF,IAA0B,wBAAQC,wBAAR,CAAhC;;AACe,SAASC,wBAAT,GAAoC;AAClD,QAAM;AAAEC,IAAAA,IAAI,EAAEC;AAAR,MAAuB,yBAAYJ,mBAAZ,CAA7B;AACA,QAAM;AACLK,IAAAA,OADK;AAELC,IAAAA,WAFK;AAGLC,IAAAA,OAHK;AAILC,IAAAA,SAJK;AAKLC,IAAAA;AALK,MAMF,qBAAaC,MAAF,IAAc;AAC5B,UAAM;AACLC,MAAAA,mCADK;AAELC,MAAAA,cAFK;AAGLC,MAAAA,QAHK;AAILC,MAAAA,oCAJK;AAKLC,MAAAA;AALK,QAMFL,MAAM,CAAEM,eAAF,CANV;;AAOA,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CAMhC;;;AACA,UACCxB,OAAO,IACPH,UADA,IAEA4B,MAAM,CAACC,IAAP,CAAa7B,UAAb,EAA0BgB,MAA1B,GAAmC,CAFnC,IAGAd,WAJD,EAKE;AACD,cAAM4B,eAAe,GAAG;AACvBJ,UAAAA,EAAE,EAAE,SADmB;AAEvBK,UAAAA,MAAM,EAAE/B,UAAU,EAAE+B,MAFG;AAGvBC,UAAAA,QAAQ,EAAEhC,UAAU,EAAEgC,QAHC;AAIvBR,UAAAA,MAAM,EAAE;AACPS,YAAAA,IAAI,EAAE/B,WAAW,EAAE+B,IADZ;AAEPC,YAAAA,WAAW,EAAEhC,WAAW,EAAEgC;AAFnB,WAJe;AAQvBC,UAAAA,QAAQ,EAAE,IAAIC,IAAJ;AARa,SAAxB;;AAWAjB,QAAAA,kBAAkB,CAACkB,OAAnB,CAA4BP,eAA5B;AACA;AACD;;AAED,WAAO;AACN1B,MAAAA,SAAS,EAAEe,kBADL;AAENC,MAAAA,iBAAiB,EAAEjB,OAFb;AAGNkB,MAAAA,SAAS,EAAE;AAHL,KAAP;AAKA,GArDM,EAqDJ,CACFlB,OADE,EAEFC,SAFE,EAGFF,WAHE,EAIFD,OAJE,EAKFD,UALE,EAMFK,8BANE,CArDI,CAAP;AA6DA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst SITE_EDITOR_AUTHORS_QUERY = {\n\tper_page: -1,\n\t_fields: 'id,name,avatar_urls',\n\tcontext: 'view',\n\tcapabilities: [ 'edit_theme_options' ],\n};\nconst EMPTY_ARRAY = [];\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\nexport default function useGlobalStylesRevisions() {\n\tconst { user: userConfig } = useContext( GlobalStylesContext );\n\tconst {\n\t\tauthors,\n\t\tcurrentUser,\n\t\tisDirty,\n\t\trevisions,\n\t\tisLoadingGlobalStylesRevisions,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\t__experimentalGetDirtyEntityRecords,\n\t\t\tgetCurrentUser,\n\t\t\tgetUsers,\n\t\t\tgetCurrentThemeGlobalStylesRevisions,\n\t\t\tisResolving,\n\t\t} = select( coreStore );\n\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\tconst _currentUser = getCurrentUser();\n\t\tconst _isDirty = dirtyEntityRecords.length > 0;\n\t\tconst globalStylesRevisions =\n\t\t\tgetCurrentThemeGlobalStylesRevisions() || EMPTY_ARRAY;\n\t\tconst _authors = getUsers( SITE_EDITOR_AUTHORS_QUERY ) || EMPTY_ARRAY;\n\n\t\treturn {\n\t\t\tauthors: _authors,\n\t\t\tcurrentUser: _currentUser,\n\t\t\tisDirty: _isDirty,\n\t\t\trevisions: globalStylesRevisions,\n\t\t\tisLoadingGlobalStylesRevisions: isResolving(\n\t\t\t\t'getCurrentThemeGlobalStylesRevisions'\n\t\t\t),\n\t\t};\n\t}, [] );\n\treturn useMemo( () => {\n\t\tlet _modifiedRevisions = [];\n\t\tif ( ! authors.length || isLoadingGlobalStylesRevisions ) {\n\t\t\treturn {\n\t\t\t\trevisions: _modifiedRevisions,\n\t\t\t\thasUnsavedChanges: isDirty,\n\t\t\t\tisLoading: true,\n\t\t\t};\n\t\t}\n\n\t\t// Adds author details to each revision.\n\t\t_modifiedRevisions = revisions.map( ( revision ) => {\n\t\t\treturn {\n\t\t\t\t...revision,\n\t\t\t\tauthor: authors.find(\n\t\t\t\t\t( author ) => author.id === revision.author\n\t\t\t\t),\n\t\t\t};\n\t\t} );\n\n\t\tif ( _modifiedRevisions.length ) {\n\t\t\t// Flags the most current saved revision.\n\t\t\tif ( _modifiedRevisions[ 0 ].id !== 'unsaved' ) {\n\t\t\t\t_modifiedRevisions[ 0 ].isLatest = true;\n\t\t\t}\n\n\t\t\t// Adds an item for unsaved changes.\n\t\t\tif (\n\t\t\t\tisDirty &&\n\t\t\t\tuserConfig &&\n\t\t\t\tObject.keys( userConfig ).length > 0 &&\n\t\t\t\tcurrentUser\n\t\t\t) {\n\t\t\t\tconst unsavedRevision = {\n\t\t\t\t\tid: 'unsaved',\n\t\t\t\t\tstyles: userConfig?.styles,\n\t\t\t\t\tsettings: userConfig?.settings,\n\t\t\t\t\tauthor: {\n\t\t\t\t\t\tname: currentUser?.name,\n\t\t\t\t\t\tavatar_urls: currentUser?.avatar_urls,\n\t\t\t\t\t},\n\t\t\t\t\tmodified: new Date(),\n\t\t\t\t};\n\n\t\t\t\t_modifiedRevisions.unshift( unsavedRevision );\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\trevisions: _modifiedRevisions,\n\t\t\thasUnsavedChanges: isDirty,\n\t\t\tisLoading: false,\n\t\t};\n\t}, [\n\t\tisDirty,\n\t\trevisions,\n\t\tcurrentUser,\n\t\tauthors,\n\t\tuserConfig,\n\t\tisLoadingGlobalStylesRevisions,\n\t] );\n}\n"]}
|
|
@@ -47,10 +47,8 @@ function KeyboardShortcutsEditMode() {
|
|
|
47
47
|
undo
|
|
48
48
|
} = (0, _data.useDispatch)(_coreData.store);
|
|
49
49
|
const {
|
|
50
|
-
isFeatureActive,
|
|
51
50
|
setIsListViewOpened,
|
|
52
51
|
switchEditorMode,
|
|
53
|
-
toggleFeature,
|
|
54
52
|
setIsInserterOpened,
|
|
55
53
|
closeGeneralSidebar
|
|
56
54
|
} = (0, _data.useDispatch)(_store.store);
|
|
@@ -67,7 +65,11 @@ function KeyboardShortcutsEditMode() {
|
|
|
67
65
|
getBlockAttributes
|
|
68
66
|
} = (0, _data.useSelect)(_blockEditor.store);
|
|
69
67
|
const {
|
|
70
|
-
|
|
68
|
+
get: getPreference
|
|
69
|
+
} = (0, _data.useSelect)(_preferences.store);
|
|
70
|
+
const {
|
|
71
|
+
set: setPreference,
|
|
72
|
+
toggle
|
|
71
73
|
} = (0, _data.useDispatch)(_preferences.store);
|
|
72
74
|
const {
|
|
73
75
|
createInfoNotice
|
|
@@ -146,8 +148,8 @@ function KeyboardShortcutsEditMode() {
|
|
|
146
148
|
});
|
|
147
149
|
(0, _keyboardShortcuts.useShortcut)('core/edit-site/toggle-distraction-free', () => {
|
|
148
150
|
toggleDistractionFree();
|
|
149
|
-
|
|
150
|
-
createInfoNotice(
|
|
151
|
+
toggle('core/edit-site', 'distractionFree');
|
|
152
|
+
createInfoNotice(getPreference('core/edit-site', 'distractionFree') ? (0, _i18n.__)('Distraction free mode turned on.') : (0, _i18n.__)('Distraction free mode turned off.'), {
|
|
151
153
|
id: 'core/edit-site/distraction-free-mode/notice',
|
|
152
154
|
type: 'snackbar'
|
|
153
155
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/keyboard-shortcuts/edit-mode.js"],"names":["KeyboardShortcutsEditMode","getEditorMode","editSiteStore","isListViewOpen","select","isListViewOpened","isBlockInspectorOpen","interfaceStore","getActiveComplementaryArea","name","SIDEBAR_BLOCK","redo","undo","coreStore","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/keyboard-shortcuts/edit-mode.js"],"names":["KeyboardShortcutsEditMode","getEditorMode","editSiteStore","isListViewOpen","select","isListViewOpened","isBlockInspectorOpen","interfaceStore","getActiveComplementaryArea","name","SIDEBAR_BLOCK","redo","undo","coreStore","setIsListViewOpened","switchEditorMode","setIsInserterOpened","closeGeneralSidebar","enableComplementaryArea","disableComplementaryArea","replaceBlocks","blockEditorStore","getBlockName","getSelectedBlockClientId","getBlockAttributes","get","getPreference","preferencesStore","set","setPreference","toggle","createInfoNotice","noticesStore","toggleDistractionFree","handleTextLevelShortcut","event","level","preventDefault","destinationBlockName","currentClientId","blockName","attributes","textAlign","destinationTextAlign","content","STORE_NAME","forEach","id","type"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAC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,IAAAA,mBAAmB,CAAE,IAAF,CAAnB;AACA,GALD;AAOA,sCAAa,8CAAb,EAA+DqB,KAAF,IAAa;AACzE;AACA;AACAA,IAAAA,KAAK,CAACE,cAAN;;AAEA,QAAK/B,oBAAL,EAA4B;AAC3Ba,MAAAA,wBAAwB,CAAE0B,sBAAF,CAAxB;AACA,KAFD,MAEO;AACN3B,MAAAA,uBAAuB,CAAE2B,sBAAF,EAAcnC,wBAAd,CAAvB;AACA;AACD,GAVD;AAYA,sCAAa,4BAAb,EAA2C,MAAM;AAChDK,IAAAA,gBAAgB,CAAEd,aAAa,OAAO,QAApB,GAA+B,MAA/B,GAAwC,QAA1C,CAAhB;AACA,GAFD;AAIA,sCAAa,+CAAb,EAAgEkC,KAAF,IAC7DD,uBAAuB,CAAEC,KAAF,EAAS,CAAT,CADxB;AAIA,GAAE,CAAF,EAAK,CAAL,EAAQ,CAAR,EAAW,CAAX,EAAc,CAAd,EAAiB,CAAjB,EAAqBW,OAArB,CAAgCV,KAAF,IAAa;AAC1C;AACA;AACA;AACA,wCACE,iDAAiDA,KAAO,EAD1D,EAEGD,KAAF,IAAaD,uBAAuB,CAAEC,KAAF,EAASC,KAAT,CAFrC;AAIA,GARD;AAUA,sCAAa,wCAAb,EAAuD,MAAM;AAC5DH,IAAAA,qBAAqB;AACrBH,IAAAA,MAAM,CAAE,gBAAF,EAAoB,iBAApB,CAAN;AACAC,IAAAA,gBAAgB,CACfL,aAAa,CAAE,gBAAF,EAAoB,iBAApB,CAAb,GACG,cAAI,kCAAJ,CADH,GAEG,cAAI,mCAAJ,CAHY,EAIf;AACCqB,MAAAA,EAAE,EAAE,6CADL;AAECC,MAAAA,IAAI,EAAE;AAFP,KAJe,CAAhB;AASA,GAZD;AAcA,SAAO,IAAP;AACA;;eAEchD,yB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { createBlock } from '@wordpress/blocks';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { SIDEBAR_BLOCK } from '../sidebar-edit-mode/constants';\nimport { STORE_NAME } from '../../store/constants';\n\nfunction KeyboardShortcutsEditMode() {\n\tconst { getEditorMode } = useSelect( editSiteStore );\n\tconst isListViewOpen = useSelect(\n\t\t( select ) => select( editSiteStore ).isListViewOpened(),\n\t\t[]\n\t);\n\tconst isBlockInspectorOpen = useSelect(\n\t\t( select ) =>\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t) === SIDEBAR_BLOCK,\n\t\t[]\n\t);\n\tconst { redo, undo } = useDispatch( coreStore );\n\tconst {\n\t\tsetIsListViewOpened,\n\t\tswitchEditorMode,\n\t\tsetIsInserterOpened,\n\t\tcloseGeneralSidebar,\n\t} = useDispatch( editSiteStore );\n\tconst { enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst { getBlockName, getSelectedBlockClientId, getBlockAttributes } =\n\t\tuseSelect( blockEditorStore );\n\n\tconst { get: getPreference } = useSelect( preferencesStore );\n\tconst { set: setPreference, toggle } = useDispatch( preferencesStore );\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\n\tconst toggleDistractionFree = () => {\n\t\tsetPreference( 'core/edit-site', 'fixedToolbar', false );\n\t\tsetIsInserterOpened( false );\n\t\tsetIsListViewOpened( false );\n\t\tcloseGeneralSidebar();\n\t};\n\n\tconst handleTextLevelShortcut = ( event, level ) => {\n\t\tevent.preventDefault();\n\t\tconst destinationBlockName =\n\t\t\tlevel === 0 ? 'core/paragraph' : 'core/heading';\n\t\tconst currentClientId = getSelectedBlockClientId();\n\t\tif ( currentClientId === null ) {\n\t\t\treturn;\n\t\t}\n\t\tconst blockName = getBlockName( currentClientId );\n\t\tif ( blockName !== 'core/paragraph' && blockName !== 'core/heading' ) {\n\t\t\treturn;\n\t\t}\n\t\tconst attributes = getBlockAttributes( currentClientId );\n\t\tconst textAlign =\n\t\t\tblockName === 'core/paragraph' ? 'align' : 'textAlign';\n\t\tconst destinationTextAlign =\n\t\t\tdestinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';\n\n\t\treplaceBlocks(\n\t\t\tcurrentClientId,\n\t\t\tcreateBlock( destinationBlockName, {\n\t\t\t\tlevel,\n\t\t\t\tcontent: attributes.content,\n\t\t\t\t...{ [ destinationTextAlign ]: attributes[ textAlign ] },\n\t\t\t} )\n\t\t);\n\t};\n\n\tuseShortcut( 'core/edit-site/undo', ( event ) => {\n\t\tundo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/edit-site/redo', ( event ) => {\n\t\tredo();\n\t\tevent.preventDefault();\n\t} );\n\n\t// Only opens the list view. Other functionality for this shortcut happens in the rendered sidebar.\n\tuseShortcut( 'core/edit-site/toggle-list-view', () => {\n\t\tif ( isListViewOpen ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsListViewOpened( true );\n\t} );\n\n\tuseShortcut( 'core/edit-site/toggle-block-settings-sidebar', ( event ) => {\n\t\t// This shortcut has no known clashes, but use preventDefault to prevent any\n\t\t// obscure shortcuts from triggering.\n\t\tevent.preventDefault();\n\n\t\tif ( isBlockInspectorOpen ) {\n\t\t\tdisableComplementaryArea( STORE_NAME );\n\t\t} else {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\t\t}\n\t} );\n\n\tuseShortcut( 'core/edit-site/toggle-mode', () => {\n\t\tswitchEditorMode( getEditorMode() === 'visual' ? 'text' : 'visual' );\n\t} );\n\n\tuseShortcut( 'core/edit-site/transform-heading-to-paragraph', ( event ) =>\n\t\thandleTextLevelShortcut( event, 0 )\n\t);\n\n\t[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {\n\t\t//the loop is based off on a constant therefore\n\t\t//the hook will execute the same way every time\n\t\t//eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseShortcut(\n\t\t\t`core/edit-site/transform-paragraph-to-heading-${ level }`,\n\t\t\t( event ) => handleTextLevelShortcut( event, level )\n\t\t);\n\t} );\n\n\tuseShortcut( 'core/edit-site/toggle-distraction-free', () => {\n\t\ttoggleDistractionFree();\n\t\ttoggle( 'core/edit-site', 'distractionFree' );\n\t\tcreateInfoNotice(\n\t\t\tgetPreference( 'core/edit-site', 'distractionFree' )\n\t\t\t\t? __( 'Distraction free mode turned on.' )\n\t\t\t\t: __( 'Distraction free mode turned off.' ),\n\t\t\t{\n\t\t\t\tid: 'core/edit-site/distraction-free-mode/notice',\n\t\t\t\ttype: 'snackbar',\n\t\t\t}\n\t\t);\n\t} );\n\n\treturn null;\n}\n\nexport default KeyboardShortcutsEditMode;\n"]}
|
|
@@ -141,7 +141,8 @@ function Layout() {
|
|
|
141
141
|
const [canvasResizer, canvasSize] = (0, _compose.useResizeObserver)();
|
|
142
142
|
const [fullResizer] = (0, _compose.useResizeObserver)();
|
|
143
143
|
const [isResizing] = (0, _element.useState)(false);
|
|
144
|
-
const isEditorLoading = (0, _hooks.useIsSiteEditorLoading)();
|
|
144
|
+
const isEditorLoading = (0, _hooks.useIsSiteEditorLoading)();
|
|
145
|
+
const [isResizableFrameOversized, setIsResizableFrameOversized] = (0, _element.useState)(false); // This determines which animation variant should apply to the header.
|
|
145
146
|
// There is also a `isDistractionFreeHovering` state that gets priority
|
|
146
147
|
// when hovering the `edit-site-layout__header-container` in distraction
|
|
147
148
|
// free mode. It's set via framer and trickles down to all the children
|
|
@@ -230,6 +231,7 @@ function Layout() {
|
|
|
230
231
|
}
|
|
231
232
|
},
|
|
232
233
|
ref: hubRef,
|
|
234
|
+
isTransparent: isResizableFrameOversized,
|
|
233
235
|
className: "edit-site-layout__hub"
|
|
234
236
|
}), (0, _element.createElement)(_components.__unstableAnimatePresence, {
|
|
235
237
|
initial: false
|
|
@@ -302,7 +304,9 @@ function Layout() {
|
|
|
302
304
|
} : {},
|
|
303
305
|
initial: false,
|
|
304
306
|
layout: "position",
|
|
305
|
-
className:
|
|
307
|
+
className: (0, _classnames.default)('edit-site-layout__canvas', {
|
|
308
|
+
'is-right-aligned': isResizableFrameOversized
|
|
309
|
+
}),
|
|
306
310
|
transition: {
|
|
307
311
|
type: 'tween',
|
|
308
312
|
duration: disableMotion || isResizing ? 0 : ANIMATION_DURATION,
|
|
@@ -311,7 +315,14 @@ function Layout() {
|
|
|
311
315
|
}, (0, _element.createElement)(_errorBoundary.default, null, (0, _element.createElement)(_resizableFrame.default, {
|
|
312
316
|
isReady: !isEditorLoading,
|
|
313
317
|
isFullWidth: isEditing,
|
|
314
|
-
|
|
318
|
+
defaultSize: {
|
|
319
|
+
width: canvasSize.width - 24
|
|
320
|
+
/* $canvas-padding */
|
|
321
|
+
,
|
|
322
|
+
height: canvasSize.height
|
|
323
|
+
},
|
|
324
|
+
isOversized: isResizableFrameOversized,
|
|
325
|
+
setIsOversized: setIsResizableFrameOversized,
|
|
315
326
|
innerContentStyle: {
|
|
316
327
|
background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor
|
|
317
328
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/layout/index.js"],"names":["useCommands","coreCommandsPrivateApis","useCommandContext","commandsPrivateApis","useLocation","routerPrivateApis","useGlobalStyle","blockEditorPrivateApis","ANIMATION_DURATION","Layout","hubRef","params","isMobileViewport","isListPage","isEditorPage","isDistractionFree","hasFixedToolbar","canvasMode","previousShortcut","nextShortcut","select","getAllShortcutKeyCombinations","keyboardShortcutsStore","getCanvasMode","editSiteStore","preferencesStore","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","motion","div","x","y","duration","ease","width","scale","background"],"mappings":";;;;;;;;;AAoBA;;AAjBA;;AAKA;;AACA;;AAKA;;AAKA;;AAEA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AApDA;AACA;AACA;;AAGA;AACA;AACA;;AAyBA;AACA;AACA;AAoBA,MAAM;AAAEA,EAAAA;AAAF,IAAkB,wBAAQC,yBAAR,CAAxB;AACA,MAAM;AAAEC,EAAAA;AAAF,IAAwB,wBAAQC,qBAAR,CAA9B;AACA,MAAM;AAAEC,EAAAA;AAAF,IAAkB,wBAAQC,mBAAR,CAAxB;AACA,MAAM;AAAEC,EAAAA;AAAF,IAAqB,wBAAQC,wBAAR,CAA3B;AAEA,MAAMC,kBAAkB,GAAG,GAA3B;;AAEe,SAASC,MAAT,GAAkB;AAChC;AACA;AACA;AACAT,EAAAA,WAAW;AACX;AACA;AAEA,QAAMU,MAAM,GAAG,sBAAf;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAaP,WAAW,EAA9B;AACA,QAAMQ,gBAAgB,GAAG,+BAAkB,QAAlB,EAA4B,GAA5B,CAAzB;AACA,QAAMC,UAAU,GAAG,4BAAeF,MAAf,EAAuBC,gBAAvB,CAAnB;AACA,QAAME,YAAY,GAAG,CAAED,UAAvB;AAEA,QAAM;AACLE,IAAAA,iBADK;AAELC,IAAAA,eAFK;AAGLC,IAAAA,UAHK;AAILC,IAAAA,gBAJK;AAKLC,IAAAA;AALK,MAMF,qBAAaC,MAAF,IAAc;AAC5B,UAAM;AAAEC,MAAAA;AAAF,QAAoCD,MAAM,CAC/CE,wB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A1FD,CALD,CADD;AAmMA","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\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=\"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":["useCommands","coreCommandsPrivateApis","useCommandContext","commandsPrivateApis","useLocation","routerPrivateApis","useGlobalStyle","blockEditorPrivateApis","ANIMATION_DURATION","Layout","hubRef","params","isMobileViewport","isListPage","isEditorPage","isDistractionFree","hasFixedToolbar","canvasMode","previousShortcut","nextShortcut","select","getAllShortcutKeyCombinations","keyboardShortcutsStore","getCanvasMode","editSiteStore","preferencesStore","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","motion","div","x","y","duration","ease","width","scale","height","background"],"mappings":";;;;;;;;;AAoBA;;AAjBA;;AAKA;;AACA;;AAKA;;AAKA;;AAEA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AApDA;AACA;AACA;;AAGA;AACA;AACA;;AAyBA;AACA;AACA;AAoBA,MAAM;AAAEA,EAAAA;AAAF,IAAkB,wBAAQC,yBAAR,CAAxB;AACA,MAAM;AAAEC,EAAAA;AAAF,IAAwB,wBAAQC,qBAAR,CAA9B;AACA,MAAM;AAAEC,EAAAA;AAAF,IAAkB,wBAAQC,mBAAR,CAAxB;AACA,MAAM;AAAEC,EAAAA;AAAF,IAAqB,wBAAQC,wBAAR,CAA3B;AAEA,MAAMC,kBAAkB,GAAG,GAA3B;;AAEe,SAASC,MAAT,GAAkB;AAChC;AACA;AACA;AACAT,EAAAA,WAAW;AACX;AACA;AAEA,QAAMU,MAAM,GAAG,sBAAf;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAaP,WAAW,EAA9B;AACA,QAAMQ,gBAAgB,GAAG,+BAAkB,QAAlB,EAA4B,GAA5B,CAAzB;AACA,QAAMC,UAAU,GAAG,4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AAa,IAAIO,UAAjB,GACG,CADH,GAEG9B,kBALQ;AAMZsD,MAAAA,IAAI,EAAE;AANM;AA1Bd,KAmCC,4BAAC,sBAAD,QACC,4BAAC,uBAAD;AACC,IAAA,OAAO,EACN,CAAEvB,eAFJ;AAIC,IAAA,WAAW,EAAGZ,SAJf;AAKC,IAAA,WAAW,EAAG;AACboC,MAAAA,KAAK,EACJ3B,UAAU,CAAC2B,KAAX,GACA;AAAG;AAHS;AAIbE,MAAAA,MAAM,EAAE7B,UAAU,CAAC6B;AAJN,KALf;AAWC,IAAA,WAAW,EACVzB,yBAZF;AAcC,IAAA,cAAc,EACbC,4BAfF;AAiBC,IAAA,iBAAiB,EAAG;AACnByB,MAAAA,UAAU,EACTrB,aADS,aACTA,aADS,cACTA,aADS,GAETD;AAHkB;AAjBrB,KAuBC,4BAAC,eAAD;AACC,IAAA,SAAS,EACRL;AAFF,IAvBD,CADD,CAnCD,CAVF,CAHF,CA3BF,CA3FD,CALD,CADD;AAqNA","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\tdefaultSize={ {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcanvasSize.width -\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t24 /* $canvas-padding */,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\theight: canvasSize.height,\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\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"]}
|
|
@@ -68,10 +68,11 @@ function PatternsList({
|
|
|
68
68
|
const deferredFilterValue = (0, _element.useDeferredValue)(delayedFilterValue);
|
|
69
69
|
const [syncFilter, setSyncFilter] = (0, _element.useState)('all');
|
|
70
70
|
const deferredSyncedFilter = (0, _element.useDeferredValue)(syncFilter);
|
|
71
|
+
const isUncategorizedThemePatterns = type === _utils.PATTERNS && categoryId === 'uncategorized';
|
|
71
72
|
const {
|
|
72
73
|
patterns,
|
|
73
74
|
isResolving
|
|
74
|
-
} = (0, _usePatterns.default)(type,
|
|
75
|
+
} = (0, _usePatterns.default)(type, isUncategorizedThemePatterns ? '' : categoryId, {
|
|
75
76
|
search: deferredFilterValue,
|
|
76
77
|
syncStatus: deferredSyncedFilter === 'all' ? undefined : deferredSyncedFilter
|
|
77
78
|
});
|