@wordpress/edit-site 6.48.0 → 6.48.2-next.v.202606191442.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -1
- package/build/components/editor/use-editor-title.cjs +1 -1
- package/build/components/editor/use-editor-title.cjs.map +2 -2
- package/build/components/layout/index.cjs +47 -9
- package/build/components/layout/index.cjs.map +3 -3
- package/build/components/page-templates/index-legacy.cjs +12 -8
- package/build/components/page-templates/index-legacy.cjs.map +2 -2
- package/build/components/post-list/quick-edit-modal.cjs +0 -1
- package/build/components/post-list/quick-edit-modal.cjs.map +2 -2
- package/build/components/resizable-frame/index.cjs.map +2 -2
- package/build/components/routes/use-title.cjs +1 -1
- package/build/components/routes/use-title.cjs.map +2 -2
- package/build/components/save-button/index.cjs +2 -2
- package/build/components/save-button/index.cjs.map +1 -1
- package/build/components/save-hub/index.cjs +3 -3
- package/build/components/save-hub/index.cjs.map +3 -3
- package/build/components/sidebar-navigation-item/index.cjs +8 -3
- package/build/components/sidebar-navigation-item/index.cjs.map +3 -3
- package/build/components/sidebar-navigation-screen/index.cjs +0 -1
- package/build/components/sidebar-navigation-screen/index.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-global-styles/index.cjs +2 -18
- package/build/components/sidebar-navigation-screen-global-styles/index.cjs.map +3 -3
- package/build/components/sidebar-navigation-screen-identity/index.cjs +0 -19
- package/build/components/sidebar-navigation-screen-identity/index.cjs.map +3 -3
- package/build/components/sidebar-navigation-screen-main/index.cjs +25 -25
- package/build/components/sidebar-navigation-screen-main/index.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-patterns/index.cjs +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.cjs.map +2 -2
- package/build/components/site-editor-routes/home.cjs +1 -1
- package/build/components/site-editor-routes/home.cjs.map +2 -2
- package/build/components/site-editor-routes/identity.cjs +1 -12
- package/build/components/site-editor-routes/identity.cjs.map +3 -3
- package/build/components/site-editor-routes/navigation-item.cjs +2 -10
- package/build/components/site-editor-routes/navigation-item.cjs.map +3 -3
- package/build/components/site-editor-routes/navigation.cjs +2 -10
- package/build/components/site-editor-routes/navigation.cjs.map +3 -3
- package/build/components/site-editor-routes/notfound.cjs +1 -1
- package/build/components/site-editor-routes/notfound.cjs.map +2 -2
- package/build/components/site-editor-routes/page-item.cjs +1 -6
- package/build/components/site-editor-routes/page-item.cjs.map +2 -2
- package/build/components/site-editor-routes/pages.cjs +6 -9
- package/build/components/site-editor-routes/pages.cjs.map +3 -3
- package/build/components/site-editor-routes/pattern-item.cjs +1 -1
- package/build/components/site-editor-routes/pattern-item.cjs.map +2 -2
- package/build/components/site-editor-routes/patterns.cjs +8 -3
- package/build/components/site-editor-routes/patterns.cjs.map +2 -2
- package/build/components/site-editor-routes/stylebook.cjs +1 -1
- package/build/components/site-editor-routes/stylebook.cjs.map +2 -2
- package/build/components/site-editor-routes/styles.cjs +1 -9
- package/build/components/site-editor-routes/styles.cjs.map +2 -2
- package/build/components/site-editor-routes/template-item.cjs +1 -6
- package/build/components/site-editor-routes/template-item.cjs.map +2 -2
- package/build/components/site-editor-routes/template-part-item.cjs +1 -1
- package/build/components/site-editor-routes/template-part-item.cjs.map +2 -2
- package/build/components/site-editor-routes/templates.cjs +8 -1
- package/build/components/site-editor-routes/templates.cjs.map +2 -2
- package/build/components/welcome-guide/editor.cjs +1 -1
- package/build/components/welcome-guide/editor.cjs.map +1 -1
- package/build/components/welcome-guide/page.cjs +1 -1
- package/build/components/welcome-guide/page.cjs.map +1 -1
- package/build/components/welcome-guide/template.cjs +1 -1
- package/build/components/welcome-guide/template.cjs.map +1 -1
- package/build/store/selectors.cjs +2 -4
- package/build/store/selectors.cjs.map +2 -2
- package/build-module/components/editor/use-editor-title.mjs +1 -1
- package/build-module/components/editor/use-editor-title.mjs.map +2 -2
- package/build-module/components/layout/index.mjs +49 -11
- package/build-module/components/layout/index.mjs.map +2 -2
- package/build-module/components/page-templates/index-legacy.mjs +13 -9
- package/build-module/components/page-templates/index-legacy.mjs.map +2 -2
- package/build-module/components/post-list/quick-edit-modal.mjs +0 -1
- package/build-module/components/post-list/quick-edit-modal.mjs.map +2 -2
- package/build-module/components/resizable-frame/index.mjs.map +2 -2
- package/build-module/components/routes/use-title.mjs +1 -1
- package/build-module/components/routes/use-title.mjs.map +2 -2
- package/build-module/components/save-button/index.mjs +2 -2
- package/build-module/components/save-button/index.mjs.map +1 -1
- package/build-module/components/save-hub/index.mjs +3 -3
- package/build-module/components/save-hub/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-item/index.mjs +9 -8
- package/build-module/components/sidebar-navigation-item/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen/index.mjs +0 -1
- package/build-module/components/sidebar-navigation-screen/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-global-styles/index.mjs +2 -14
- package/build-module/components/sidebar-navigation-screen-global-styles/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-identity/index.mjs +0 -15
- package/build-module/components/sidebar-navigation-screen-identity/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-main/index.mjs +25 -25
- package/build-module/components/sidebar-navigation-screen-main/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-patterns/index.mjs +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.mjs.map +2 -2
- package/build-module/components/site-editor-routes/home.mjs +1 -1
- package/build-module/components/site-editor-routes/home.mjs.map +2 -2
- package/build-module/components/site-editor-routes/identity.mjs +1 -12
- package/build-module/components/site-editor-routes/identity.mjs.map +2 -2
- package/build-module/components/site-editor-routes/navigation-item.mjs +2 -10
- package/build-module/components/site-editor-routes/navigation-item.mjs.map +2 -2
- package/build-module/components/site-editor-routes/navigation.mjs +2 -10
- package/build-module/components/site-editor-routes/navigation.mjs.map +2 -2
- package/build-module/components/site-editor-routes/notfound.mjs +1 -1
- package/build-module/components/site-editor-routes/notfound.mjs.map +2 -2
- package/build-module/components/site-editor-routes/page-item.mjs +2 -7
- package/build-module/components/site-editor-routes/page-item.mjs.map +2 -2
- package/build-module/components/site-editor-routes/pages.mjs +6 -9
- package/build-module/components/site-editor-routes/pages.mjs.map +2 -2
- package/build-module/components/site-editor-routes/pattern-item.mjs +1 -1
- package/build-module/components/site-editor-routes/pattern-item.mjs.map +2 -2
- package/build-module/components/site-editor-routes/patterns.mjs +8 -3
- package/build-module/components/site-editor-routes/patterns.mjs.map +2 -2
- package/build-module/components/site-editor-routes/stylebook.mjs +1 -1
- package/build-module/components/site-editor-routes/stylebook.mjs.map +2 -2
- package/build-module/components/site-editor-routes/styles.mjs +1 -9
- package/build-module/components/site-editor-routes/styles.mjs.map +2 -2
- package/build-module/components/site-editor-routes/template-item.mjs +2 -7
- package/build-module/components/site-editor-routes/template-item.mjs.map +2 -2
- package/build-module/components/site-editor-routes/template-part-item.mjs +1 -1
- package/build-module/components/site-editor-routes/template-part-item.mjs.map +2 -2
- package/build-module/components/site-editor-routes/templates.mjs +8 -1
- package/build-module/components/site-editor-routes/templates.mjs.map +2 -2
- package/build-module/components/welcome-guide/editor.mjs +1 -1
- package/build-module/components/welcome-guide/editor.mjs.map +1 -1
- package/build-module/components/welcome-guide/page.mjs +1 -1
- package/build-module/components/welcome-guide/page.mjs.map +1 -1
- package/build-module/components/welcome-guide/template.mjs +1 -1
- package/build-module/components/welcome-guide/template.mjs.map +1 -1
- package/build-module/store/selectors.mjs +2 -4
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-style/{experimental-admin-bar-in-editor-rtl.css → experimental-omnibar-rtl.css} +49 -2
- package/build-style/{experimental-admin-bar-in-editor.css → experimental-omnibar.css} +49 -2
- package/build-style/style-rtl.css +476 -248
- package/build-style/style.css +476 -249
- package/package.json +49 -49
- package/src/components/layout/index.js +64 -18
- package/src/components/layout/style.scss +28 -13
- package/src/components/page-patterns/style.scss +1 -2
- package/src/components/page-templates/index-legacy.js +17 -9
- package/src/components/page-templates/style.scss +0 -5
- package/src/components/post-list/quick-edit-modal.js +0 -1
- package/src/components/resizable-frame/index.js +0 -1
- package/src/components/save-hub/index.js +4 -4
- package/src/components/save-hub/style.scss +5 -5
- package/src/components/sidebar-button/style.scss +2 -4
- package/src/components/sidebar-dataviews/style.scss +0 -1
- package/src/components/sidebar-global-styles/style.scss +1 -2
- package/src/components/sidebar-navigation-item/index.js +11 -9
- package/src/components/sidebar-navigation-item/style.scss +6 -7
- package/src/components/sidebar-navigation-screen/index.js +0 -1
- package/src/components/sidebar-navigation-screen/style.scss +9 -9
- package/src/components/sidebar-navigation-screen-global-styles/index.js +2 -15
- package/src/components/sidebar-navigation-screen-identity/index.js +0 -15
- package/src/components/sidebar-navigation-screen-main/index.js +24 -22
- package/src/components/sidebar-navigation-screen-navigation-menu/style.scss +2 -4
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +15 -5
- package/src/components/sidebar-navigation-screen-patterns/style.scss +2 -3
- package/src/components/site-editor-routes/README.md +4 -4
- package/src/components/site-editor-routes/home.js +1 -1
- package/src/components/site-editor-routes/identity.js +1 -20
- package/src/components/site-editor-routes/navigation-item.js +2 -21
- package/src/components/site-editor-routes/navigation.js +2 -21
- package/src/components/site-editor-routes/notfound.js +1 -1
- package/src/components/site-editor-routes/page-item.js +1 -10
- package/src/components/site-editor-routes/pages.js +6 -14
- package/src/components/site-editor-routes/pattern-item.js +1 -1
- package/src/components/site-editor-routes/patterns.js +8 -7
- package/src/components/site-editor-routes/stylebook.js +1 -1
- package/src/components/site-editor-routes/styles.js +1 -12
- package/src/components/site-editor-routes/template-item.js +1 -10
- package/src/components/site-editor-routes/template-part-item.js +1 -1
- package/src/components/site-editor-routes/templates.js +8 -1
- package/src/components/site-hub/style.scss +5 -6
- package/src/components/welcome-guide/page.js +1 -1
- package/src/{experimental-admin-bar-in-editor.scss → experimental-omnibar.scss} +6 -2
- package/src/store/selectors.js +3 -7
- package/src/style.scss +2 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/welcome-guide/template.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Guide } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function WelcomeGuideTemplate() {\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst { isActive, hasPreviousEntity } = useSelect( ( select ) => {\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst { get } = select( preferencesStore );\n\t\treturn {\n\t\t\tisActive: get( 'core/edit-site', 'welcomeGuideTemplate' ),\n\t\t\thasPreviousEntity:\n\t\t\t\t!! getEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t};\n\t}, [] );\n\tconst isVisible = isActive && hasPreviousEntity;\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\tconst heading = __( 'Editing a template' );\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-site-welcome-guide guide-template\"\n\t\t\tcontentLabel={ heading }\n\t\t\tfinishButtonText={ __( 'Continue' ) }\n\t\t\tonFinish={ () =>\n\t\t\t\ttoggle( 'core/edit-site', 'welcomeGuideTemplate' )\n\t\t\t}\n\t\t\tpages={ [\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<video\n\t\t\t\t\t\t\tclassName=\"edit-site-welcome-guide__video\"\n\t\t\t\t\t\t\tautoPlay\n\t\t\t\t\t\t\tloop\n\t\t\t\t\t\t\tmuted\n\t\t\t\t\t\t\twidth=\"312\"\n\t\t\t\t\t\t\theight=\"240\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<source\n\t\t\t\t\t\t\t\tsrc=\"https://s.w.org/images/block-editor/editing-your-template.mp4\"\n\t\t\t\t\t\t\t\ttype=\"video/mp4\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</video>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ heading }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Guide } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function WelcomeGuideTemplate() {\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst { isActive, hasPreviousEntity } = useSelect( ( select ) => {\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst { get } = select( preferencesStore );\n\t\treturn {\n\t\t\tisActive: get( 'core/edit-site', 'welcomeGuideTemplate' ),\n\t\t\thasPreviousEntity:\n\t\t\t\t!! getEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t};\n\t}, [] );\n\tconst isVisible = isActive && hasPreviousEntity;\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\tconst heading = __( 'Editing a template' );\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-site-welcome-guide guide-template\"\n\t\t\tcontentLabel={ heading }\n\t\t\tfinishButtonText={ __( 'Continue' ) }\n\t\t\tonFinish={ () =>\n\t\t\t\ttoggle( 'core/edit-site', 'welcomeGuideTemplate' )\n\t\t\t}\n\t\t\tpages={ [\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<video\n\t\t\t\t\t\t\tclassName=\"edit-site-welcome-guide__video\"\n\t\t\t\t\t\t\tautoPlay\n\t\t\t\t\t\t\tloop\n\t\t\t\t\t\t\tmuted\n\t\t\t\t\t\t\twidth=\"312\"\n\t\t\t\t\t\t\theight=\"240\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<source\n\t\t\t\t\t\t\t\tsrc=\"https://s.w.org/images/block-editor/editing-your-template.mp4\"\n\t\t\t\t\t\t\t\ttype=\"video/mp4\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</video>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ heading }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the ‘Back’ button in the toolbar.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t] }\n\t\t/>\n\t);\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuC;AACvC,wBAAsB;AACtB,kBAAmB;AACnB,yBAA0C;AAC1C,oBAAqC;AAyC9B;AAvCQ,SAAR,uBAAwC;AAC9C,QAAM,EAAE,OAAO,QAAI,yBAAa,mBAAAA,KAAiB;AAEjD,QAAM,EAAE,UAAU,kBAAkB,QAAI,uBAAW,CAAE,WAAY;AAChE,UAAM,EAAE,kBAAkB,IAAI,OAAQ,cAAAC,KAAY;AAClD,UAAM,EAAE,IAAI,IAAI,OAAQ,mBAAAD,KAAiB;AACzC,WAAO;AAAA,MACN,UAAU,IAAK,kBAAkB,sBAAuB;AAAA,MACxD,mBACC,CAAC,CAAE,kBAAkB,EAAE;AAAA,IACzB;AAAA,EACD,GAAG,CAAC,CAAE;AACN,QAAM,YAAY,YAAY;AAE9B,MAAK,CAAE,WAAY;AAClB,WAAO;AAAA,EACR;AAEA,QAAM,cAAU,gBAAI,oBAAqB;AAEzC,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,cAAe;AAAA,MACf,sBAAmB,gBAAI,UAAW;AAAA,MAClC,UAAW,MACV,OAAQ,kBAAkB,sBAAuB;AAAA,MAElD,OAAQ;AAAA,QACP;AAAA,UACC,OACC;AAAA,YAAC;AAAA;AAAA,cACA,WAAU;AAAA,cACV,UAAQ;AAAA,cACR,MAAI;AAAA,cACJ,OAAK;AAAA,cACL,OAAM;AAAA,cACN,QAAO;AAAA,cAEP;AAAA,gBAAC;AAAA;AAAA,kBACA,KAAI;AAAA,kBACJ,MAAK;AAAA;AAAA,cACN;AAAA;AAAA,UACD;AAAA,UAED,SACC,4EACC;AAAA,wDAAC,QAAG,WAAU,oCACX,mBACH;AAAA,YACA,4CAAC,OAAE,WAAU,iCACV;AAAA,cACD;AAAA,YACD,GACD;AAAA,aACD;AAAA,QAEF;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": ["preferencesStore", "editorStore"]
|
|
7
7
|
}
|
|
@@ -56,7 +56,6 @@ module.exports = __toCommonJS(selectors_exports);
|
|
|
56
56
|
var import_core_data = require("@wordpress/core-data");
|
|
57
57
|
var import_data = require("@wordpress/data");
|
|
58
58
|
var import_deprecated = __toESM(require("@wordpress/deprecated"));
|
|
59
|
-
var import_element = require("@wordpress/element");
|
|
60
59
|
var import_preferences = require("@wordpress/preferences");
|
|
61
60
|
var import_editor = require("@wordpress/editor");
|
|
62
61
|
var import_block_editor = require("@wordpress/block-editor");
|
|
@@ -106,10 +105,9 @@ var getReusableBlocks = (0, import_data.createRegistrySelector)((select) => () =
|
|
|
106
105
|
version: "6.8",
|
|
107
106
|
alternative: `select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )`
|
|
108
107
|
});
|
|
109
|
-
|
|
110
|
-
return isWeb ? select(import_core_data.store).getEntityRecords("postType", "wp_block", {
|
|
108
|
+
return select(import_core_data.store).getEntityRecords("postType", "wp_block", {
|
|
111
109
|
per_page: -1
|
|
112
|
-
})
|
|
110
|
+
});
|
|
113
111
|
});
|
|
114
112
|
function getSettings(state) {
|
|
115
113
|
return state.settings;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/selectors.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector, createSelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport { TEMPLATE_PART_POST_TYPE } from '../utils/constants';\nimport getFilteredTemplatePartBlocks from '../utils/get-filtered-template-parts';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @deprecated\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( _, featureName ) => {\n\t\tdeprecated( `select( 'core/edit-site' ).isFeatureActive`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `select( 'core/preferences' ).get`,\n\t\t} );\n\n\t\treturn !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\tfeatureName\n\t\t);\n\t}\n);\n\n/**\n * Returns the current editing canvas device type.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport const __experimentalGetPreviewDeviceType = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\talternative: `select( 'core/editor' ).getDeviceType`,\n\t\t\t}\n\t\t);\n\t\treturn select( editorStore ).getDeviceType();\n\t}\n);\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`wp.data.select( 'core/edit-site' ).getCanUserCreateMedia()`,\n\t\t\t{\n\t\t\t\tsince: '6.7',\n\t\t\t\talternative: `wp.data.select( 'core' ).canUser( 'create', { kind: 'postType', type: 'attachment' } )`,\n\t\t\t}\n\t\t);\n\n\t\treturn select( coreDataStore ).canUser( 'create', 'media' );\n\t}\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).getReusableBlocks()`, {\n\t\tsince: '6.5',\n\t\tversion: '6.8',\n\t\talternative: `select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )`,\n\t} );\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the site editor settings.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Settings.\n */\nexport function getSettings( state ) {\n\t// It is important that we don't inject anything into these settings locally.\n\t// The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings.\n\t// If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected.\n\treturn state.settings;\n}\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {?TemplateType} Template type.\n */\nexport function getEditedPostType( state ) {\n\tdeprecated( \"select( 'core/edit-site' ).getEditedPostType\", {\n\t\tsince: '6.8',\n\t\talternative: \"select( 'core/editor' ).getCurrentPostType\",\n\t} );\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {?string} Post ID.\n */\nexport function getEditedPostId( state ) {\n\tdeprecated( \"select( 'core/edit-site' ).getEditedPostId\", {\n\t\tsince: '6.8',\n\t\talternative: \"select( 'core/editor' ).getCurrentPostId\",\n\t} );\n\treturn state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\tdeprecated( \"select( 'core/edit-site' ).getEditedPostContext\", {\n\t\tsince: '6.8',\n\t} );\n\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\tdeprecated( \"select( 'core/edit-site' ).getPage\", {\n\t\tsince: '6.8',\n\t} );\n\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport const isInserterOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isInserterOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isInserterOpened`,\n\t} );\n\treturn select( editorStore ).isInserterOpened();\n} );\n\n/**\n * Get the insertion point for the inserter.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport const __experimentalGetInsertionPoint = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetInsertionPoint`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t}\n\t\t);\n\t\treturn unlock( select( editorStore ) ).getInserter();\n\t}\n);\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport const isListViewOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isListViewOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isListViewOpened`,\n\t} );\n\treturn select( editorStore ).isListViewOpened();\n} );\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\n}\n\nfunction getBlocksAndTemplateParts( select ) {\n\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t'postType',\n\t\tTEMPLATE_PART_POST_TYPE,\n\t\t{ per_page: -1 }\n\t);\n\n\tconst { getBlocksByName, getBlocksByClientId } = select( blockEditorStore );\n\n\tconst clientIds = getBlocksByName( 'core/template-part' );\n\tconst blocks = getBlocksByClientId( clientIds );\n\treturn [ blocks, templateParts ];\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @deprecated\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) =>\n\t\tcreateSelector(\n\t\t\t() => {\n\t\t\t\tdeprecated(\n\t\t\t\t\t`select( 'core/edit-site' ).getCurrentTemplateTemplateParts()`,\n\t\t\t\t\t{\n\t\t\t\t\t\tsince: '6.7',\n\t\t\t\t\t\tversion: '6.9',\n\t\t\t\t\t\talternative: `select( 'core/block-editor' ).getBlocksByName( 'core/template-part' )`,\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\treturn getFilteredTemplatePartBlocks(\n\t\t\t\t\t...getBlocksAndTemplateParts( select )\n\t\t\t\t);\n\t\t\t},\n\t\t\t() => getBlocksAndTemplateParts( select )\n\t\t)\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector( ( select ) => () => {\n\treturn select( preferencesStore ).get( 'core', 'editorMode' );\n} );\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Whether or not the editor has a page loaded into it.\n *\n * @see setPage\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not the editor has a page loaded into it.\n */\nexport function isPage( state ) {\n\tdeprecated( \"select( 'core/edit-site' ).isPage\", {\n\t\tsince: '6.8',\n\t\talternative: \"select( 'core/editor' ).getCurrentPostType\",\n\t} );\n\n\treturn !! state.editedPost.context?.postId;\n}\n\n/**\n * Whether or not the editor allows only page content to be edited.\n *\n * @deprecated\n *\n * @return {boolean} Whether or not focus is on editing page content.\n */\nexport function hasPageContentFocus() {\n\tdeprecated( `select( 'core/edit-site' ).hasPageContentFocus`, {\n\t\tsince: '6.5',\n\t} );\n\n\treturn false;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAuC;AACvC,kBAAuD;AACvD,wBAAuB;AACvB,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector, createSelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport { TEMPLATE_PART_POST_TYPE } from '../utils/constants';\nimport getFilteredTemplatePartBlocks from '../utils/get-filtered-template-parts';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @deprecated\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( _, featureName ) => {\n\t\tdeprecated( `select( 'core/edit-site' ).isFeatureActive`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `select( 'core/preferences' ).get`,\n\t\t} );\n\n\t\treturn !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\tfeatureName\n\t\t);\n\t}\n);\n\n/**\n * Returns the current editing canvas device type.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport const __experimentalGetPreviewDeviceType = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\talternative: `select( 'core/editor' ).getDeviceType`,\n\t\t\t}\n\t\t);\n\t\treturn select( editorStore ).getDeviceType();\n\t}\n);\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`wp.data.select( 'core/edit-site' ).getCanUserCreateMedia()`,\n\t\t\t{\n\t\t\t\tsince: '6.7',\n\t\t\t\talternative: `wp.data.select( 'core' ).canUser( 'create', { kind: 'postType', type: 'attachment' } )`,\n\t\t\t}\n\t\t);\n\n\t\treturn select( coreDataStore ).canUser( 'create', 'media' );\n\t}\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).getReusableBlocks()`, {\n\t\tsince: '6.5',\n\t\tversion: '6.8',\n\t\talternative: `select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )`,\n\t} );\n\treturn select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\tper_page: -1,\n\t} );\n} );\n\n/**\n * Returns the site editor settings.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Settings.\n */\nexport function getSettings( state ) {\n\t// It is important that we don't inject anything into these settings locally.\n\t// The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings.\n\t// If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected.\n\treturn state.settings;\n}\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {?TemplateType} Template type.\n */\nexport function getEditedPostType( state ) {\n\tdeprecated( \"select( 'core/edit-site' ).getEditedPostType\", {\n\t\tsince: '6.8',\n\t\talternative: \"select( 'core/editor' ).getCurrentPostType\",\n\t} );\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {?string} Post ID.\n */\nexport function getEditedPostId( state ) {\n\tdeprecated( \"select( 'core/edit-site' ).getEditedPostId\", {\n\t\tsince: '6.8',\n\t\talternative: \"select( 'core/editor' ).getCurrentPostId\",\n\t} );\n\treturn state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\tdeprecated( \"select( 'core/edit-site' ).getEditedPostContext\", {\n\t\tsince: '6.8',\n\t} );\n\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\tdeprecated( \"select( 'core/edit-site' ).getPage\", {\n\t\tsince: '6.8',\n\t} );\n\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport const isInserterOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isInserterOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isInserterOpened`,\n\t} );\n\treturn select( editorStore ).isInserterOpened();\n} );\n\n/**\n * Get the insertion point for the inserter.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport const __experimentalGetInsertionPoint = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetInsertionPoint`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t}\n\t\t);\n\t\treturn unlock( select( editorStore ) ).getInserter();\n\t}\n);\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport const isListViewOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isListViewOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isListViewOpened`,\n\t} );\n\treturn select( editorStore ).isListViewOpened();\n} );\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\n}\n\nfunction getBlocksAndTemplateParts( select ) {\n\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t'postType',\n\t\tTEMPLATE_PART_POST_TYPE,\n\t\t{ per_page: -1 }\n\t);\n\n\tconst { getBlocksByName, getBlocksByClientId } = select( blockEditorStore );\n\n\tconst clientIds = getBlocksByName( 'core/template-part' );\n\tconst blocks = getBlocksByClientId( clientIds );\n\treturn [ blocks, templateParts ];\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @deprecated\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) =>\n\t\tcreateSelector(\n\t\t\t() => {\n\t\t\t\tdeprecated(\n\t\t\t\t\t`select( 'core/edit-site' ).getCurrentTemplateTemplateParts()`,\n\t\t\t\t\t{\n\t\t\t\t\t\tsince: '6.7',\n\t\t\t\t\t\tversion: '6.9',\n\t\t\t\t\t\talternative: `select( 'core/block-editor' ).getBlocksByName( 'core/template-part' )`,\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\treturn getFilteredTemplatePartBlocks(\n\t\t\t\t\t...getBlocksAndTemplateParts( select )\n\t\t\t\t);\n\t\t\t},\n\t\t\t() => getBlocksAndTemplateParts( select )\n\t\t)\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector( ( select ) => () => {\n\treturn select( preferencesStore ).get( 'core', 'editorMode' );\n} );\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Whether or not the editor has a page loaded into it.\n *\n * @see setPage\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not the editor has a page loaded into it.\n */\nexport function isPage( state ) {\n\tdeprecated( \"select( 'core/edit-site' ).isPage\", {\n\t\tsince: '6.8',\n\t\talternative: \"select( 'core/editor' ).getCurrentPostType\",\n\t} );\n\n\treturn !! state.editedPost.context?.postId;\n}\n\n/**\n * Whether or not the editor allows only page content to be edited.\n *\n * @deprecated\n *\n * @return {boolean} Whether or not focus is on editing page content.\n */\nexport function hasPageContentFocus() {\n\tdeprecated( `select( 'core/edit-site' ).hasPageContentFocus`, {\n\t\tsince: '6.5',\n\t} );\n\n\treturn false;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;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;AAAA,IACP,aAAa;AAAA,EACd,CAAE;AAEF,SAAO,CAAC,CAAE,MAAM,WAAW,SAAS;AACrC;AASO,SAAS,sBAAsB;AACrC,wBAAAA,SAAY,kDAAkD;AAAA,IAC7D,OAAO;AAAA,EACR,CAAE;AAEF,SAAO;AACR;",
|
|
6
6
|
"names": ["deprecated", "preferencesStore", "editorStore", "coreDataStore", "blockEditorStore", "getFilteredTemplatePartBlocks"]
|
|
7
7
|
}
|
|
@@ -45,7 +45,7 @@ function useEditorTitle(postType, postId) {
|
|
|
45
45
|
if (isLoaded) {
|
|
46
46
|
editorTitle = sprintf(
|
|
47
47
|
// translators: A breadcrumb trail for the Admin document title. 1: title of template being edited, 2: type of template (Template or Template Part).
|
|
48
|
-
_x("%1$s
|
|
48
|
+
_x("%1$s ‹ %2$s", "breadcrumb trail"),
|
|
49
49
|
decodeEntities(title),
|
|
50
50
|
POST_TYPE_LABELS[postType] ?? POST_TYPE_LABELS[TEMPLATE_POST_TYPE]
|
|
51
51
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/editor/use-editor-title.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { _x, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport useTitle from '../routes/use-title';\nimport { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\n\nconst { getTemplateInfo } = unlock( editorPrivateApis );\n\nfunction useEditorTitle( postType, postId ) {\n\tconst { title, isLoaded } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\tgetCurrentTheme,\n\t\t\t\thasFinishedResolution,\n\t\t\t} = select( coreStore );\n\n\t\t\tif ( ! postId ) {\n\t\t\t\treturn { isLoaded: false };\n\t\t\t}\n\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\n\t\t\tconst { default_template_types: templateTypes = [] } =\n\t\t\t\tgetCurrentTheme() ?? {};\n\n\t\t\tconst templateInfo = getTemplateInfo( {\n\t\t\t\ttemplate: _record,\n\t\t\t\ttemplateTypes,\n\t\t\t} );\n\n\t\t\tconst _isLoaded = hasFinishedResolution( 'getEditedEntityRecord', [\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t] );\n\n\t\t\treturn {\n\t\t\t\ttitle: templateInfo.title,\n\t\t\t\tisLoaded: _isLoaded,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tlet editorTitle;\n\tif ( isLoaded ) {\n\t\teditorTitle = sprintf(\n\t\t\t// translators: A breadcrumb trail for the Admin document title. 1: title of template being edited, 2: type of template (Template or Template Part).\n\t\t\t_x( '%1$s
|
|
5
|
-
"mappings": ";AAGA,SAAS,IAAI,eAAe;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC,SAAS,sBAAsB;AAC/B,SAAS,eAAe,yBAAyB;AAKjD,OAAO,cAAc;AACrB,SAAS,kBAAkB,0BAA0B;AACrD,SAAS,cAAc;AAEvB,IAAM,EAAE,gBAAgB,IAAI,OAAQ,iBAAkB;AAEtD,SAAS,eAAgB,UAAU,QAAS;AAC3C,QAAM,EAAE,OAAO,SAAS,IAAI;AAAA,IAC3B,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,SAAU;AAEtB,UAAK,CAAE,QAAS;AACf,eAAO,EAAE,UAAU,MAAM;AAAA,MAC1B;AAEA,YAAM,UAAU;AAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAEA,YAAM,EAAE,wBAAwB,gBAAgB,CAAC,EAAE,IAClD,gBAAgB,KAAK,CAAC;AAEvB,YAAM,eAAe,gBAAiB;AAAA,QACrC,UAAU;AAAA,QACV;AAAA,MACD,CAAE;AAEF,YAAM,YAAY,sBAAuB,yBAAyB;AAAA,QACjE;AAAA,QACA;AAAA,QACA;AAAA,MACD,CAAE;AAEF,aAAO;AAAA,QACN,OAAO,aAAa;AAAA,QACpB,UAAU;AAAA,MACX;AAAA,IACD;AAAA,IACA,CAAE,UAAU,MAAO;AAAA,EACpB;AAEA,MAAI;AACJ,MAAK,UAAW;AACf,kBAAc;AAAA;AAAA,MAEb,GAAI,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { _x, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport useTitle from '../routes/use-title';\nimport { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\n\nconst { getTemplateInfo } = unlock( editorPrivateApis );\n\nfunction useEditorTitle( postType, postId ) {\n\tconst { title, isLoaded } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\tgetCurrentTheme,\n\t\t\t\thasFinishedResolution,\n\t\t\t} = select( coreStore );\n\n\t\t\tif ( ! postId ) {\n\t\t\t\treturn { isLoaded: false };\n\t\t\t}\n\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\n\t\t\tconst { default_template_types: templateTypes = [] } =\n\t\t\t\tgetCurrentTheme() ?? {};\n\n\t\t\tconst templateInfo = getTemplateInfo( {\n\t\t\t\ttemplate: _record,\n\t\t\t\ttemplateTypes,\n\t\t\t} );\n\n\t\t\tconst _isLoaded = hasFinishedResolution( 'getEditedEntityRecord', [\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t] );\n\n\t\t\treturn {\n\t\t\t\ttitle: templateInfo.title,\n\t\t\t\tisLoaded: _isLoaded,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tlet editorTitle;\n\tif ( isLoaded ) {\n\t\teditorTitle = sprintf(\n\t\t\t// translators: A breadcrumb trail for the Admin document title. 1: title of template being edited, 2: type of template (Template or Template Part).\n\t\t\t_x( '%1$s ‹ %2$s', 'breadcrumb trail' ),\n\t\t\tdecodeEntities( title ),\n\t\t\tPOST_TYPE_LABELS[ postType ] ??\n\t\t\t\tPOST_TYPE_LABELS[ TEMPLATE_POST_TYPE ]\n\t\t);\n\t}\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URLQueryController> from double-announcing.\n\tuseTitle( isLoaded && editorTitle );\n}\n\nexport default useEditorTitle;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,IAAI,eAAe;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC,SAAS,sBAAsB;AAC/B,SAAS,eAAe,yBAAyB;AAKjD,OAAO,cAAc;AACrB,SAAS,kBAAkB,0BAA0B;AACrD,SAAS,cAAc;AAEvB,IAAM,EAAE,gBAAgB,IAAI,OAAQ,iBAAkB;AAEtD,SAAS,eAAgB,UAAU,QAAS;AAC3C,QAAM,EAAE,OAAO,SAAS,IAAI;AAAA,IAC3B,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,SAAU;AAEtB,UAAK,CAAE,QAAS;AACf,eAAO,EAAE,UAAU,MAAM;AAAA,MAC1B;AAEA,YAAM,UAAU;AAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAEA,YAAM,EAAE,wBAAwB,gBAAgB,CAAC,EAAE,IAClD,gBAAgB,KAAK,CAAC;AAEvB,YAAM,eAAe,gBAAiB;AAAA,QACrC,UAAU;AAAA,QACV;AAAA,MACD,CAAE;AAEF,YAAM,YAAY,sBAAuB,yBAAyB;AAAA,QACjE;AAAA,QACA;AAAA,QACA;AAAA,MACD,CAAE;AAEF,aAAO;AAAA,QACN,OAAO,aAAa;AAAA,QACpB,UAAU;AAAA,MACX;AAAA,IACD;AAAA,IACA,CAAE,UAAU,MAAO;AAAA,EACpB;AAEA,MAAI;AACJ,MAAK,UAAW;AACf,kBAAc;AAAA;AAAA,MAEb,GAAI,eAAe,kBAAmB;AAAA,MACtC,eAAgB,KAAM;AAAA,MACtB,iBAAkB,QAAS,KAC1B,iBAAkB,kBAAmB;AAAA,IACvC;AAAA,EACD;AAIA,WAAU,YAAY,WAAY;AACnC;AAEA,IAAO,2BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// packages/edit-site/src/components/layout/index.js
|
|
2
2
|
import clsx from "clsx";
|
|
3
|
-
import { NavigableRegion } from "@wordpress/admin-ui";
|
|
3
|
+
import { NavigableRegion, getAdminThemeColors } from "@wordpress/admin-ui";
|
|
4
4
|
import {
|
|
5
5
|
__unstableMotion as motion,
|
|
6
6
|
__unstableAnimatePresence as AnimatePresence,
|
|
@@ -14,13 +14,14 @@ import {
|
|
|
14
14
|
usePrevious
|
|
15
15
|
} from "@wordpress/compose";
|
|
16
16
|
import { __, sprintf } from "@wordpress/i18n";
|
|
17
|
-
import { useState, useRef, useEffect } from "@wordpress/element";
|
|
17
|
+
import { useState, useRef, useEffect, useMemo } from "@wordpress/element";
|
|
18
18
|
import {
|
|
19
19
|
UnsavedChangesWarning,
|
|
20
20
|
ErrorBoundary,
|
|
21
21
|
privateApis as editorPrivateApis
|
|
22
22
|
} from "@wordpress/editor";
|
|
23
23
|
import { privateApis as routerPrivateApis } from "@wordpress/router";
|
|
24
|
+
import { privateApis as themePrivateApis } from "@wordpress/theme";
|
|
24
25
|
import { PluginArea } from "@wordpress/plugins";
|
|
25
26
|
import { SnackbarNotices, store as noticesStore } from "@wordpress/notices";
|
|
26
27
|
import { useDispatch, useSelect } from "@wordpress/data";
|
|
@@ -37,14 +38,17 @@ import SaveHub from "../save-hub/index.mjs";
|
|
|
37
38
|
import SavePanel from "../save-panel/index.mjs";
|
|
38
39
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
39
40
|
var { useLocation } = unlock(routerPrivateApis);
|
|
40
|
-
var { useStyle } = unlock(editorPrivateApis);
|
|
41
|
+
var { useStyle, UploadProgressSnackbar } = unlock(editorPrivateApis);
|
|
42
|
+
var { ThemeProvider } = unlock(themePrivateApis);
|
|
41
43
|
var ANIMATION_DURATION = 0.3;
|
|
44
|
+
var CONTENT_COLOR = { background: "#ffffff" };
|
|
42
45
|
function Layout() {
|
|
43
46
|
const { query, name: routeKey, areas, widths } = useLocation();
|
|
44
47
|
const canvas = routeKey === "notfound" ? "view" : query?.canvas ?? "view";
|
|
45
48
|
const hasAdminBarInEditor = window.__experimentalAdminBarInEditor;
|
|
46
49
|
const showDesktopSiteHub = !hasAdminBarInEditor;
|
|
47
50
|
const showMobileSiteHub = !hasAdminBarInEditor || routeKey !== "home";
|
|
51
|
+
const hasMobileAreas = areas.mobileSidebar || areas.mobileContent || areas.preview;
|
|
48
52
|
const isMobileViewport = useViewportMatch("medium", "<");
|
|
49
53
|
const toggleRef = useRef();
|
|
50
54
|
const navigateRegionsProps = useNavigateRegions();
|
|
@@ -88,7 +92,7 @@ function Layout() {
|
|
|
88
92
|
}
|
|
89
93
|
),
|
|
90
94
|
children: /* @__PURE__ */ jsxs("div", { className: "edit-site-layout__content", children: [
|
|
91
|
-
(!isMobileViewport || !
|
|
95
|
+
(!isMobileViewport || !hasMobileAreas) && /* @__PURE__ */ jsx(
|
|
92
96
|
NavigableRegion,
|
|
93
97
|
{
|
|
94
98
|
ariaLabel: __("Navigation"),
|
|
@@ -132,7 +136,8 @@ function Layout() {
|
|
|
132
136
|
}
|
|
133
137
|
),
|
|
134
138
|
/* @__PURE__ */ jsx(SnackbarNotices, { className: "edit-site-layout__snackbar" }),
|
|
135
|
-
|
|
139
|
+
/* @__PURE__ */ jsx(UploadProgressSnackbar, {}),
|
|
140
|
+
isMobileViewport && hasMobileAreas && /* @__PURE__ */ jsx("div", { className: "edit-site-layout__mobile", children: /* @__PURE__ */ jsx(SidebarNavigationProvider, { children: canvas !== "edit" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
136
141
|
showMobileSiteHub && /* @__PURE__ */ jsx(
|
|
137
142
|
SiteHubMobile,
|
|
138
143
|
{
|
|
@@ -140,10 +145,36 @@ function Layout() {
|
|
|
140
145
|
isTransparent: isResizableFrameOversized
|
|
141
146
|
}
|
|
142
147
|
),
|
|
143
|
-
|
|
148
|
+
areas.mobileContent ? (
|
|
149
|
+
/*
|
|
150
|
+
* ThemeProvider wraps SidebarContent (rather than
|
|
151
|
+
* just the content) so the scroll wrapper it renders
|
|
152
|
+
* inherits the content background tokens. See
|
|
153
|
+
* `.edit-site-sidebar__screen-wrapper` in style.scss.
|
|
154
|
+
*/
|
|
155
|
+
/* @__PURE__ */ jsx(
|
|
156
|
+
ThemeProvider,
|
|
157
|
+
{
|
|
158
|
+
color: CONTENT_COLOR,
|
|
159
|
+
children: /* @__PURE__ */ jsx(
|
|
160
|
+
SidebarContent,
|
|
161
|
+
{
|
|
162
|
+
routeKey,
|
|
163
|
+
children: /* @__PURE__ */ jsx("div", { className: "edit-site-layout__mobile-content", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: areas.mobileContent }) })
|
|
164
|
+
}
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
) : /* @__PURE__ */ jsx(
|
|
169
|
+
SidebarContent,
|
|
170
|
+
{
|
|
171
|
+
routeKey,
|
|
172
|
+
children: /* @__PURE__ */ jsx(ErrorBoundary, { children: areas.mobileSidebar })
|
|
173
|
+
}
|
|
174
|
+
),
|
|
144
175
|
/* @__PURE__ */ jsx(SaveHub, {}),
|
|
145
176
|
/* @__PURE__ */ jsx(SavePanel, {})
|
|
146
|
-
] }) : /* @__PURE__ */ jsx(ErrorBoundary, { children: areas.
|
|
177
|
+
] }) : /* @__PURE__ */ jsx(ThemeProvider, { color: CONTENT_COLOR, children: /* @__PURE__ */ jsx(ErrorBoundary, { children: areas.preview }) }) }) }),
|
|
147
178
|
!isMobileViewport && areas.content && canvas !== "edit" && /* @__PURE__ */ jsx(
|
|
148
179
|
"div",
|
|
149
180
|
{
|
|
@@ -151,7 +182,7 @@ function Layout() {
|
|
|
151
182
|
style: {
|
|
152
183
|
maxWidth: widths?.content
|
|
153
184
|
},
|
|
154
|
-
children: /* @__PURE__ */ jsx(ErrorBoundary, { children: areas.content })
|
|
185
|
+
children: /* @__PURE__ */ jsx(ThemeProvider, { color: CONTENT_COLOR, children: /* @__PURE__ */ jsx(ErrorBoundary, { children: areas.content }) })
|
|
155
186
|
}
|
|
156
187
|
),
|
|
157
188
|
!isMobileViewport && areas.edit && canvas !== "edit" && /* @__PURE__ */ jsx(
|
|
@@ -161,7 +192,7 @@ function Layout() {
|
|
|
161
192
|
style: {
|
|
162
193
|
maxWidth: widths?.edit
|
|
163
194
|
},
|
|
164
|
-
children: /* @__PURE__ */ jsx(ErrorBoundary, { children: areas.edit })
|
|
195
|
+
children: /* @__PURE__ */ jsx(ThemeProvider, { color: CONTENT_COLOR, children: /* @__PURE__ */ jsx(ErrorBoundary, { children: areas.edit }) })
|
|
165
196
|
}
|
|
166
197
|
),
|
|
167
198
|
!isMobileViewport && areas.preview && /* @__PURE__ */ jsxs("div", { className: "edit-site-layout__canvas-container", children: [
|
|
@@ -190,7 +221,13 @@ function Layout() {
|
|
|
190
221
|
innerContentStyle: {
|
|
191
222
|
background: gradientValue ?? backgroundColor
|
|
192
223
|
},
|
|
193
|
-
children:
|
|
224
|
+
children: /* @__PURE__ */ jsx(
|
|
225
|
+
ThemeProvider,
|
|
226
|
+
{
|
|
227
|
+
color: CONTENT_COLOR,
|
|
228
|
+
children: areas.preview
|
|
229
|
+
}
|
|
230
|
+
)
|
|
194
231
|
}
|
|
195
232
|
) })
|
|
196
233
|
}
|
|
@@ -202,6 +239,7 @@ function Layout() {
|
|
|
202
239
|
] });
|
|
203
240
|
}
|
|
204
241
|
function LayoutWithGlobalStylesProvider(props) {
|
|
242
|
+
const themeColors = useMemo(getAdminThemeColors, []);
|
|
205
243
|
const { createErrorNotice } = useDispatch(noticesStore);
|
|
206
244
|
function onPluginAreaError(name) {
|
|
207
245
|
createErrorNotice(
|
|
@@ -216,7 +254,7 @@ function LayoutWithGlobalStylesProvider(props) {
|
|
|
216
254
|
}
|
|
217
255
|
return /* @__PURE__ */ jsx(SlotFillProvider, { children: /* @__PURE__ */ jsxs(Tooltip.Provider, { children: [
|
|
218
256
|
/* @__PURE__ */ jsx(PluginArea, { onError: onPluginAreaError }),
|
|
219
|
-
/* @__PURE__ */ jsx(Layout, { ...props })
|
|
257
|
+
/* @__PURE__ */ jsx(ThemeProvider, { color: themeColors, children: /* @__PURE__ */ jsx(Layout, { ...props }) })
|
|
220
258
|
] }) });
|
|
221
259
|
}
|
|
222
260
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/layout/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { NavigableRegion } from '@wordpress/admin-ui';\nimport {\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n\t__unstableUseNavigateRegions as useNavigateRegions,\n\tSlotFillProvider,\n} from '@wordpress/components';\nimport {\n\tuseReducedMotion,\n\tuseViewportMatch,\n\tuseResizeObserver,\n\tusePrevious,\n} from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useState, useRef, useEffect } from '@wordpress/element';\nimport {\n\tUnsavedChangesWarning,\n\tErrorBoundary,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { PluginArea } from '@wordpress/plugins';\nimport { SnackbarNotices, store as noticesStore } from '@wordpress/notices';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n// eslint-disable-next-line @wordpress/use-recommended-components -- `Tooltip` is not yet on the recommended `@wordpress/ui` allow-list; landing as a migration step ahead of the wider rollout.\nimport { Tooltip } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { default as SiteHub, SiteHubMobile } from '../site-hub';\nimport ResizableFrame from '../resizable-frame';\nimport { unlock } from '../../lock-unlock';\nimport SaveKeyboardShortcut from '../save-keyboard-shortcut';\nimport { useIsSiteEditorLoading } from './hooks';\nimport useMovingAnimation from './animation';\nimport { SidebarContent, SidebarNavigationProvider } from '../sidebar';\nimport SaveHub from '../save-hub';\nimport SavePanel from '../save-panel';\n\nconst { useLocation } = unlock( routerPrivateApis );\nconst { useStyle } = unlock( editorPrivateApis );\n\nconst ANIMATION_DURATION = 0.3;\n\nfunction Layout() {\n\tconst { query, name: routeKey, areas, widths } = useLocation();\n\t// Force canvas to 'view' on notfound route to show the error message and allow navigation.\n\tconst canvas = routeKey === 'notfound' ? 'view' : query?.canvas ?? 'view';\n\tconst hasAdminBarInEditor = window.__experimentalAdminBarInEditor;\n\tconst showDesktopSiteHub = ! hasAdminBarInEditor;\n\tconst showMobileSiteHub = ! hasAdminBarInEditor || routeKey !== 'home';\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst toggleRef = useRef();\n\tconst navigateRegionsProps = useNavigateRegions();\n\tconst disableMotion = useReducedMotion();\n\tconst [ canvasResizer, canvasSize ] = useResizeObserver();\n\tconst isEditorLoading = useIsSiteEditorLoading();\n\tconst [ isResizableFrameOversized, setIsResizableFrameOversized ] =\n\t\tuseState( false );\n\tconst animationRef = useMovingAnimation( {\n\t\ttriggerAnimationOnChange: routeKey + '-' + canvas,\n\t} );\n\n\tconst { showIconLabels } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t'core',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t};\n\t} );\n\n\tconst backgroundColor = useStyle( 'color.background' );\n\tconst gradientValue = useStyle( 'color.gradient' );\n\tconst previousCanvaMode = usePrevious( canvas );\n\tuseEffect( () => {\n\t\tif ( previousCanvaMode === 'edit' ) {\n\t\t\ttoggleRef.current?.focus();\n\t\t}\n\t\t// Should not depend on the previous canvas mode value but the next.\n\t}, [ canvas ] );\n\n\treturn (\n\t\t<>\n\t\t\t<UnsavedChangesWarning />\n\t\t\t{ canvas === 'view' && <SaveKeyboardShortcut /> }\n\t\t\t<div\n\t\t\t\t{ ...navigateRegionsProps }\n\t\t\t\tref={ navigateRegionsProps.ref }\n\t\t\t\tclassName={ clsx(\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-full-canvas': canvas === 'edit',\n\t\t\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<div className=\"edit-site-layout__content\">\n\t\t\t\t\t{ /*\n\t\t\t\t\t\tThe NavigableRegion must always be rendered and not use\n\t\t\t\t\t\t`inert` otherwise `useNavigateRegions` will fail.\n\t\t\t\t\t*/ }\n\t\t\t\t\t{ ( ! isMobileViewport || ! areas.mobile ) && (\n\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\tariaLabel={ __( 'Navigation' ) }\n\t\t\t\t\t\t\tclassName=\"edit-site-layout__sidebar-region\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<AnimatePresence>\n\t\t\t\t\t\t\t\t{ canvas === 'view' && (\n\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\tinitial={ { opacity: 0 } }\n\t\t\t\t\t\t\t\t\t\tanimate={ { opacity: 1 } }\n\t\t\t\t\t\t\t\t\t\texit={ { opacity: 0 } }\n\t\t\t\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\t\t\t\tduration:\n\t\t\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\t\t\tdisableMotion ||\n\t\t\t\t\t\t\t\t\t\t\t\tisMobileViewport\n\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: ANIMATION_DURATION,\n\t\t\t\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-layout__sidebar\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ showDesktopSiteHub && (\n\t\t\t\t\t\t\t\t\t\t\t<SiteHub\n\t\t\t\t\t\t\t\t\t\t\t\tref={ toggleRef }\n\t\t\t\t\t\t\t\t\t\t\t\tisTransparent={\n\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) }\n\t\t\t\t\t\t\t\t\t\t<SidebarNavigationProvider>\n\t\t\t\t\t\t\t\t\t\t\t<SidebarContent\n\t\t\t\t\t\t\t\t\t\t\t\tshouldAnimate={\n\t\t\t\t\t\t\t\t\t\t\t\t\trouteKey !== 'styles' &&\n\t\t\t\t\t\t\t\t\t\t\t\t\trouteKey !== 'identity'\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\trouteKey={ routeKey }\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<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ areas.sidebar }\n\t\t\t\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t</SidebarContent>\n\t\t\t\t\t\t\t\t\t\t</SidebarNavigationProvider>\n\t\t\t\t\t\t\t\t\t\t<SaveHub />\n\t\t\t\t\t\t\t\t\t\t<SavePanel />\n\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</AnimatePresence>\n\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<SnackbarNotices className=\"edit-site-layout__snackbar\" />\n\n\t\t\t\t\t{ isMobileViewport && areas.mobile && (\n\t\t\t\t\t\t<div className=\"edit-site-layout__mobile\">\n\t\t\t\t\t\t\t<SidebarNavigationProvider>\n\t\t\t\t\t\t\t\t{ canvas !== 'edit' ? (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{ showMobileSiteHub && (\n\t\t\t\t\t\t\t\t\t\t\t<SiteHubMobile\n\t\t\t\t\t\t\t\t\t\t\t\tref={ toggleRef }\n\t\t\t\t\t\t\t\t\t\t\t\tisTransparent={\n\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) }\n\t\t\t\t\t\t\t\t\t\t<SidebarContent routeKey={ routeKey }>\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{ areas.mobile }\n\t\t\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t</SidebarContent>\n\t\t\t\t\t\t\t\t\t\t<SaveHub />\n\t\t\t\t\t\t\t\t\t\t<SavePanel />\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<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t{ areas.mobile }\n\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</SidebarNavigationProvider>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! isMobileViewport &&\n\t\t\t\t\t\tareas.content &&\n\t\t\t\t\t\tcanvas !== 'edit' && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName=\"edit-site-layout__area\"\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\tmaxWidth: widths?.content,\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<ErrorBoundary>{ areas.content }</ErrorBoundary>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! isMobileViewport && areas.edit && canvas !== 'edit' && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"edit-site-layout__area\"\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tmaxWidth: widths?.edit,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ErrorBoundary>{ areas.edit }</ErrorBoundary>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! isMobileViewport && areas.preview && (\n\t\t\t\t\t\t<div className=\"edit-site-layout__canvas-container\">\n\t\t\t\t\t\t\t{ canvasResizer }\n\t\t\t\t\t\t\t{ !! canvasSize.width && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\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{\n\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\tisResizableFrameOversized,\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\tref={ animationRef }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t<ResizableFrame\n\t\t\t\t\t\t\t\t\t\t\tisReady={ ! isEditorLoading }\n\t\t\t\t\t\t\t\t\t\t\tisFullWidth={ canvas === 'edit' }\n\t\t\t\t\t\t\t\t\t\t\tdefaultSize={ {\n\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\tcanvasSize.width -\n\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\theight: canvasSize.height,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\tisOversized={\n\t\t\t\t\t\t\t\t\t\t\t\tisResizableFrameOversized\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tsetIsOversized={\n\t\t\t\t\t\t\t\t\t\t\t\tsetIsResizableFrameOversized\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tinnerContentStyle={ {\n\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\tgradientValue ??\n\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} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ areas.preview }\n\t\t\t\t\t\t\t\t\t\t</ResizableFrame>\n\t\t\t\t\t\t\t\t\t</ErrorBoundary>\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</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default function LayoutWithGlobalStylesProvider( props ) {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<Tooltip.Provider>\n\t\t\t\t{ /** This needs to be within the SlotFillProvider */ }\n\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t<Layout { ...props } />\n\t\t\t</Tooltip.Provider>\n\t\t</SlotFillProvider>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { NavigableRegion, getAdminThemeColors } from '@wordpress/admin-ui';\nimport {\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n\t__unstableUseNavigateRegions as useNavigateRegions,\n\tSlotFillProvider,\n} from '@wordpress/components';\nimport {\n\tuseReducedMotion,\n\tuseViewportMatch,\n\tuseResizeObserver,\n\tusePrevious,\n} from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useState, useRef, useEffect, useMemo } from '@wordpress/element';\nimport {\n\tUnsavedChangesWarning,\n\tErrorBoundary,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { privateApis as themePrivateApis } from '@wordpress/theme';\nimport { PluginArea } from '@wordpress/plugins';\nimport { SnackbarNotices, store as noticesStore } from '@wordpress/notices';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { Tooltip } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { default as SiteHub, SiteHubMobile } from '../site-hub';\nimport ResizableFrame from '../resizable-frame';\nimport { unlock } from '../../lock-unlock';\nimport SaveKeyboardShortcut from '../save-keyboard-shortcut';\nimport { useIsSiteEditorLoading } from './hooks';\nimport useMovingAnimation from './animation';\nimport { SidebarContent, SidebarNavigationProvider } from '../sidebar';\nimport SaveHub from '../save-hub';\nimport SavePanel from '../save-panel';\n\nconst { useLocation } = unlock( routerPrivateApis );\nconst { useStyle, UploadProgressSnackbar } = unlock( editorPrivateApis );\nconst { ThemeProvider } = unlock( themePrivateApis );\n\nconst ANIMATION_DURATION = 0.3;\nconst CONTENT_COLOR = { background: '#ffffff' };\n\nfunction Layout() {\n\tconst { query, name: routeKey, areas, widths } = useLocation();\n\t// Force canvas to 'view' on notfound route to show the error message and allow navigation.\n\tconst canvas = routeKey === 'notfound' ? 'view' : query?.canvas ?? 'view';\n\tconst hasAdminBarInEditor = window.__experimentalAdminBarInEditor;\n\tconst showDesktopSiteHub = ! hasAdminBarInEditor;\n\tconst showMobileSiteHub = ! hasAdminBarInEditor || routeKey !== 'home';\n\tconst hasMobileAreas =\n\t\tareas.mobileSidebar || areas.mobileContent || areas.preview;\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst toggleRef = useRef();\n\tconst navigateRegionsProps = useNavigateRegions();\n\tconst disableMotion = useReducedMotion();\n\tconst [ canvasResizer, canvasSize ] = useResizeObserver();\n\tconst isEditorLoading = useIsSiteEditorLoading();\n\tconst [ isResizableFrameOversized, setIsResizableFrameOversized ] =\n\t\tuseState( false );\n\tconst animationRef = useMovingAnimation( {\n\t\ttriggerAnimationOnChange: routeKey + '-' + canvas,\n\t} );\n\n\tconst { showIconLabels } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t'core',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t};\n\t} );\n\n\tconst backgroundColor = useStyle( 'color.background' );\n\tconst gradientValue = useStyle( 'color.gradient' );\n\tconst previousCanvaMode = usePrevious( canvas );\n\tuseEffect( () => {\n\t\tif ( previousCanvaMode === 'edit' ) {\n\t\t\ttoggleRef.current?.focus();\n\t\t}\n\t\t// Should not depend on the previous canvas mode value but the next.\n\t}, [ canvas ] );\n\n\treturn (\n\t\t<>\n\t\t\t<UnsavedChangesWarning />\n\t\t\t{ canvas === 'view' && <SaveKeyboardShortcut /> }\n\t\t\t<div\n\t\t\t\t{ ...navigateRegionsProps }\n\t\t\t\tref={ navigateRegionsProps.ref }\n\t\t\t\tclassName={ clsx(\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-full-canvas': canvas === 'edit',\n\t\t\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<div className=\"edit-site-layout__content\">\n\t\t\t\t\t{ /*\n\t\t\t\t\t\tThe NavigableRegion must always be rendered and not use\n\t\t\t\t\t\t`inert` otherwise `useNavigateRegions` will fail.\n\t\t\t\t\t*/ }\n\t\t\t\t\t{ ( ! isMobileViewport || ! hasMobileAreas ) && (\n\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\tariaLabel={ __( 'Navigation' ) }\n\t\t\t\t\t\t\tclassName=\"edit-site-layout__sidebar-region\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<AnimatePresence>\n\t\t\t\t\t\t\t\t{ canvas === 'view' && (\n\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\tinitial={ { opacity: 0 } }\n\t\t\t\t\t\t\t\t\t\tanimate={ { opacity: 1 } }\n\t\t\t\t\t\t\t\t\t\texit={ { opacity: 0 } }\n\t\t\t\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\t\t\t\tduration:\n\t\t\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\t\t\tdisableMotion ||\n\t\t\t\t\t\t\t\t\t\t\t\tisMobileViewport\n\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: ANIMATION_DURATION,\n\t\t\t\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-layout__sidebar\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ showDesktopSiteHub && (\n\t\t\t\t\t\t\t\t\t\t\t<SiteHub\n\t\t\t\t\t\t\t\t\t\t\t\tref={ toggleRef }\n\t\t\t\t\t\t\t\t\t\t\t\tisTransparent={\n\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) }\n\t\t\t\t\t\t\t\t\t\t<SidebarNavigationProvider>\n\t\t\t\t\t\t\t\t\t\t\t<SidebarContent\n\t\t\t\t\t\t\t\t\t\t\t\tshouldAnimate={\n\t\t\t\t\t\t\t\t\t\t\t\t\trouteKey !== 'styles' &&\n\t\t\t\t\t\t\t\t\t\t\t\t\trouteKey !== 'identity'\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\trouteKey={ routeKey }\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<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ areas.sidebar }\n\t\t\t\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t</SidebarContent>\n\t\t\t\t\t\t\t\t\t\t</SidebarNavigationProvider>\n\t\t\t\t\t\t\t\t\t\t<SaveHub />\n\t\t\t\t\t\t\t\t\t\t<SavePanel />\n\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</AnimatePresence>\n\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<SnackbarNotices className=\"edit-site-layout__snackbar\" />\n\t\t\t\t\t<UploadProgressSnackbar />\n\n\t\t\t\t\t{ isMobileViewport && hasMobileAreas && (\n\t\t\t\t\t\t<div className=\"edit-site-layout__mobile\">\n\t\t\t\t\t\t\t<SidebarNavigationProvider>\n\t\t\t\t\t\t\t\t{ canvas !== 'edit' ? (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{ showMobileSiteHub && (\n\t\t\t\t\t\t\t\t\t\t\t<SiteHubMobile\n\t\t\t\t\t\t\t\t\t\t\t\tref={ toggleRef }\n\t\t\t\t\t\t\t\t\t\t\t\tisTransparent={\n\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) }\n\t\t\t\t\t\t\t\t\t\t{ areas.mobileContent ? (\n\t\t\t\t\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\t\t\t\t * ThemeProvider wraps SidebarContent (rather than\n\t\t\t\t\t\t\t\t\t\t\t * just the content) so the scroll wrapper it renders\n\t\t\t\t\t\t\t\t\t\t\t * inherits the content background tokens. See\n\t\t\t\t\t\t\t\t\t\t\t * `.edit-site-sidebar__screen-wrapper` in style.scss.\n\t\t\t\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\t\t\t\t<ThemeProvider\n\t\t\t\t\t\t\t\t\t\t\t\tcolor={ CONTENT_COLOR }\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<SidebarContent\n\t\t\t\t\t\t\t\t\t\t\t\t\trouteKey={ routeKey }\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<div className=\"edit-site-layout__mobile-content\">\n\t\t\t\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\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tareas.mobileContent\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\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t</SidebarContent>\n\t\t\t\t\t\t\t\t\t\t\t</ThemeProvider>\n\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t<SidebarContent\n\t\t\t\t\t\t\t\t\t\t\t\trouteKey={ routeKey }\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<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ areas.mobileSidebar }\n\t\t\t\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t</SidebarContent>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t<SaveHub />\n\t\t\t\t\t\t\t\t\t\t<SavePanel />\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<ThemeProvider color={ CONTENT_COLOR }>\n\t\t\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t{ areas.preview }\n\t\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t\t</ThemeProvider>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</SidebarNavigationProvider>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! isMobileViewport &&\n\t\t\t\t\t\tareas.content &&\n\t\t\t\t\t\tcanvas !== 'edit' && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName=\"edit-site-layout__area\"\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\tmaxWidth: widths?.content,\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<ThemeProvider color={ CONTENT_COLOR }>\n\t\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t{ areas.content }\n\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t</ThemeProvider>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! isMobileViewport && areas.edit && canvas !== 'edit' && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"edit-site-layout__area\"\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tmaxWidth: widths?.edit,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ThemeProvider color={ CONTENT_COLOR }>\n\t\t\t\t\t\t\t\t<ErrorBoundary>{ areas.edit }</ErrorBoundary>\n\t\t\t\t\t\t\t</ThemeProvider>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! isMobileViewport && areas.preview && (\n\t\t\t\t\t\t<div className=\"edit-site-layout__canvas-container\">\n\t\t\t\t\t\t\t{ canvasResizer }\n\t\t\t\t\t\t\t{ !! canvasSize.width && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\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{\n\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\tisResizableFrameOversized,\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\tref={ animationRef }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t<ResizableFrame\n\t\t\t\t\t\t\t\t\t\t\tisReady={ ! isEditorLoading }\n\t\t\t\t\t\t\t\t\t\t\tisFullWidth={ canvas === 'edit' }\n\t\t\t\t\t\t\t\t\t\t\tdefaultSize={ {\n\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\tcanvasSize.width -\n\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\theight: canvasSize.height,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\tisOversized={\n\t\t\t\t\t\t\t\t\t\t\t\tisResizableFrameOversized\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tsetIsOversized={\n\t\t\t\t\t\t\t\t\t\t\t\tsetIsResizableFrameOversized\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tinnerContentStyle={ {\n\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\tgradientValue ??\n\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} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<ThemeProvider\n\t\t\t\t\t\t\t\t\t\t\t\tcolor={ CONTENT_COLOR }\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{ areas.preview }\n\t\t\t\t\t\t\t\t\t\t\t</ThemeProvider>\n\t\t\t\t\t\t\t\t\t\t</ResizableFrame>\n\t\t\t\t\t\t\t\t\t</ErrorBoundary>\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</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default function LayoutWithGlobalStylesProvider( props ) {\n\tconst themeColors = useMemo( getAdminThemeColors, [] );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<Tooltip.Provider>\n\t\t\t\t{ /** This needs to be within the SlotFillProvider */ }\n\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t<ThemeProvider color={ themeColors }>\n\t\t\t\t\t<Layout { ...props } />\n\t\t\t\t</ThemeProvider>\n\t\t\t</Tooltip.Provider>\n\t\t</SlotFillProvider>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,iBAAiB,2BAA2B;AACrD;AAAA,EACC,oBAAoB;AAAA,EACpB,6BAA6B;AAAA,EAC7B,gCAAgC;AAAA,EAChC;AAAA,OACM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,IAAI,eAAe;AAC5B,SAAS,UAAU,QAAQ,WAAW,eAAe;AACrD;AAAA,EACC;AAAA,EACA;AAAA,EACA,eAAe;AAAA,OACT;AACP,SAAS,eAAe,yBAAyB;AACjD,SAAS,eAAe,wBAAwB;AAChD,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB,SAAS,oBAAoB;AACvD,SAAS,aAAa,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9 +13,9 @@ import AddNewTemplate from "../add-new-template-legacy/index.mjs";
|
|
|
13
13
|
import { TEMPLATE_POST_TYPE } from "../../utils/constants.mjs";
|
|
14
14
|
import { unlock } from "../../lock-unlock.mjs";
|
|
15
15
|
import { useEditPostAction } from "../dataviews-actions/index.mjs";
|
|
16
|
-
import { authorField,
|
|
16
|
+
import { authorField, previewField } from "./fields.mjs";
|
|
17
17
|
import { jsx } from "react/jsx-runtime";
|
|
18
|
-
var { usePostActions,
|
|
18
|
+
var { usePostActions, usePostFields } = unlock(editorPrivateApis);
|
|
19
19
|
var { useHistory, useLocation } = unlock(routerPrivateApis);
|
|
20
20
|
var { useEntityRecordsWithPermissions } = unlock(corePrivateApis);
|
|
21
21
|
function PageTemplates() {
|
|
@@ -85,18 +85,22 @@ function PageTemplates() {
|
|
|
85
85
|
label: author
|
|
86
86
|
}));
|
|
87
87
|
}, [records]);
|
|
88
|
-
const
|
|
89
|
-
|
|
88
|
+
const postFields = usePostFields({ postType: TEMPLATE_POST_TYPE });
|
|
89
|
+
const fields = useMemo(() => {
|
|
90
|
+
const __fields = [
|
|
90
91
|
previewField,
|
|
91
|
-
templateTitleField,
|
|
92
|
-
descriptionField,
|
|
93
92
|
{
|
|
94
93
|
...authorField,
|
|
95
94
|
elements: authors
|
|
96
95
|
}
|
|
97
|
-
]
|
|
98
|
-
[
|
|
99
|
-
|
|
96
|
+
];
|
|
97
|
+
return [
|
|
98
|
+
...__fields,
|
|
99
|
+
...(postFields || []).filter(
|
|
100
|
+
(field) => ["description", "title"].includes(field.id)
|
|
101
|
+
)
|
|
102
|
+
];
|
|
103
|
+
}, [authors, postFields]);
|
|
100
104
|
const { data, paginationInfo } = useMemo(() => {
|
|
101
105
|
return filterSortAndPaginate(records, view, fields);
|
|
102
106
|
}, [records, view, fields]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/page-templates/index-legacy.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Page } from '@wordpress/admin-ui';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useCallback } from '@wordpress/element';\nimport { privateApis as corePrivateApis } from '@wordpress/core-data';\nimport { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useEvent } from '@wordpress/compose';\nimport { useView, useViewConfig } from '@wordpress/views';\n\n/**\n * Internal dependencies\n */\nimport AddNewTemplate from '../add-new-template-legacy';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\nimport { useEditPostAction } from '../dataviews-actions';\nimport { authorField,
|
|
5
|
-
"mappings": ";AAGA,SAAS,YAAY;AACrB,SAAS,UAAU;AACnB,SAAS,UAAU,SAAS,mBAAmB;AAC/C,SAAS,eAAe,uBAAuB;AAC/C,SAAS,WAAW,6BAA6B;AACjD,SAAS,eAAe,yBAAyB;AACjD,SAAS,eAAe,yBAAyB;AACjD,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;AACzB,SAAS,SAAS,qBAAqB;AAKvC,OAAO,oBAAoB;AAC3B,SAAS,0BAA0B;AACnC,SAAS,cAAc;AACvB,SAAS,yBAAyB;AAClC,SAAS,aAAa,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Page } from '@wordpress/admin-ui';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useCallback } from '@wordpress/element';\nimport { privateApis as corePrivateApis } from '@wordpress/core-data';\nimport { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useEvent } from '@wordpress/compose';\nimport { useView, useViewConfig } from '@wordpress/views';\n\n/**\n * Internal dependencies\n */\nimport AddNewTemplate from '../add-new-template-legacy';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\nimport { useEditPostAction } from '../dataviews-actions';\nimport { authorField, previewField } from './fields';\n\nconst { usePostActions, usePostFields } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { useEntityRecordsWithPermissions } = unlock( corePrivateApis );\n\nexport default function PageTemplates() {\n\tconst { path, query } = useLocation();\n\tconst { activeView = 'all', postId } = query;\n\tconst [ selection, setSelection ] = useState( [ postId ] );\n\n\tconst {\n\t\tdefault_view: defaultView,\n\t\tdefault_layouts: defaultLayouts,\n\t\tview_list: viewList,\n\t} = useViewConfig( {\n\t\tkind: 'postType',\n\t\tname: TEMPLATE_POST_TYPE,\n\t} );\n\tconst activeViewOverrides = useMemo(\n\t\t() => viewList?.find( ( v ) => v.slug === activeView )?.view ?? {},\n\t\t[ viewList, activeView ]\n\t);\n\tconst { view, updateView, isModified, resetToDefault } = useView( {\n\t\tkind: 'postType',\n\t\tname: TEMPLATE_POST_TYPE,\n\t\tslug: 'default',\n\t\tdefaultView,\n\t\tactiveViewOverrides,\n\t\tdefaultLayouts,\n\t\tqueryParams: {\n\t\t\tpage: query.pageNumber,\n\t\t\tsearch: query.search,\n\t\t},\n\t\tonChangeQueryParams: ( newQueryParams ) => {\n\t\t\thistory.navigate(\n\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t...query,\n\t\t\t\t\tpageNumber: newQueryParams.page,\n\t\t\t\t\tsearch: newQueryParams.search || undefined,\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\t} );\n\n\tconst { records, isResolving: isLoadingData } =\n\t\tuseEntityRecordsWithPermissions( 'postType', TEMPLATE_POST_TYPE, {\n\t\t\tper_page: -1,\n\t\t} );\n\tconst history = useHistory();\n\tconst onChangeSelection = useCallback(\n\t\t( items ) => {\n\t\t\tsetSelection( items );\n\t\t\tif ( view?.type === 'list' ) {\n\t\t\t\thistory.navigate(\n\t\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t\tpostId: items.length === 1 ? items[ 0 ] : undefined,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ history, path, view?.type ]\n\t);\n\n\tconst authors = useMemo( () => {\n\t\tif ( ! records ) {\n\t\t\treturn [];\n\t\t}\n\t\tconst authorsSet = new Set();\n\t\trecords.forEach( ( template ) => {\n\t\t\tauthorsSet.add( template.author_text );\n\t\t} );\n\t\treturn Array.from( authorsSet ).map( ( author ) => ( {\n\t\t\tvalue: author,\n\t\t\tlabel: author,\n\t\t} ) );\n\t}, [ records ] );\n\n\tconst postFields = usePostFields( { postType: TEMPLATE_POST_TYPE } );\n\tconst fields = useMemo( () => {\n\t\tconst __fields = [\n\t\t\tpreviewField,\n\t\t\t{\n\t\t\t\t...authorField,\n\t\t\t\telements: authors,\n\t\t\t},\n\t\t];\n\t\t// TODO: Only `description` and `title` are sourced from the shared\n\t\t// `@wordpress/fields` registry so far. The remaining local fields\n\t\t// (e.g. `previewField`, `authorField`) should also be evaluated for\n\t\t// migration to the shared registry.\n\t\treturn [\n\t\t\t...__fields,\n\t\t\t...( postFields || [] ).filter( ( field ) =>\n\t\t\t\t[ 'description', 'title' ].includes( field.id )\n\t\t\t),\n\t\t];\n\t}, [ authors, postFields ] );\n\n\tconst { data, paginationInfo } = useMemo( () => {\n\t\treturn filterSortAndPaginate( records, view, fields );\n\t}, [ records, view, fields ] );\n\n\tconst postTypeActions = usePostActions( {\n\t\tpostType: TEMPLATE_POST_TYPE,\n\t\tcontext: 'list',\n\t} );\n\tconst editAction = useEditPostAction();\n\tconst actions = useMemo(\n\t\t() => [ editAction, ...postTypeActions ],\n\t\t[ postTypeActions, editAction ]\n\t);\n\n\tconst onChangeView = useEvent( ( newView ) => {\n\t\tupdateView( newView );\n\t\tif ( newView.type !== view.type ) {\n\t\t\t// Retrigger the routing areas resolution.\n\t\t\thistory.invalidate();\n\t\t}\n\t} );\n\n\treturn (\n\t\t<Page\n\t\t\tclassName=\"edit-site-page-templates\"\n\t\t\ttitle={ __( 'Templates' ) }\n\t\t\theadingLevel={ 2 }\n\t\t\tactions={ <AddNewTemplate /> }\n\t\t>\n\t\t\t<DataViews\n\t\t\t\tkey={ activeView }\n\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\tfields={ fields }\n\t\t\t\tactions={ actions }\n\t\t\t\tdata={ data }\n\t\t\t\tisLoading={ isLoadingData }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\tisItemClickable={ () => true }\n\t\t\t\tonClickItem={ ( { id } ) => {\n\t\t\t\t\thistory.navigate( `/wp_template/${ id }?canvas=edit` );\n\t\t\t\t} }\n\t\t\t\tselection={ selection }\n\t\t\t\tdefaultLayouts={ defaultLayouts }\n\t\t\t\tonReset={\n\t\t\t\t\tisModified\n\t\t\t\t\t\t? () => {\n\t\t\t\t\t\t\t\tresetToDefault();\n\t\t\t\t\t\t\t\thistory.invalidate();\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: false\n\t\t\t\t}\n\t\t\t/>\n\t\t</Page>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,YAAY;AACrB,SAAS,UAAU;AACnB,SAAS,UAAU,SAAS,mBAAmB;AAC/C,SAAS,eAAe,uBAAuB;AAC/C,SAAS,WAAW,6BAA6B;AACjD,SAAS,eAAe,yBAAyB;AACjD,SAAS,eAAe,yBAAyB;AACjD,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;AACzB,SAAS,SAAS,qBAAqB;AAKvC,OAAO,oBAAoB;AAC3B,SAAS,0BAA0B;AACnC,SAAS,cAAc;AACvB,SAAS,yBAAyB;AAClC,SAAS,aAAa,oBAAoB;AA8H7B;AA5Hb,IAAM,EAAE,gBAAgB,cAAc,IAAI,OAAQ,iBAAkB;AACpE,IAA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,YAAa;AAC7C,eAAY,OAAQ;AACpB,QAAK,QAAQ,SAAS,KAAK,MAAO;AAEjC,cAAQ,WAAW;AAAA,IACpB;AAAA,EACD,CAAE;AAEF,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,OAAQ,GAAI,WAAY;AAAA,MACxB,cAAe;AAAA,MACf,SAAU,oBAAC,kBAAe;AAAA,MAE1B;AAAA,QAAC;AAAA;AAAA,UAEA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,WAAY;AAAA,UACZ;AAAA,UACA;AAAA,UACA;AAAA,UACA,iBAAkB,MAAM;AAAA,UACxB,aAAc,CAAE,EAAE,GAAG,MAAO;AAC3B,oBAAQ,SAAU,gBAAiB,EAAG,cAAe;AAAA,UACtD;AAAA,UACA;AAAA,UACA;AAAA,UACA,SACC,aACG,MAAM;AACN,2BAAe;AACf,oBAAQ,WAAW;AAAA,UACnB,IACA;AAAA;AAAA,QArBE;AAAA,MAuBP;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/post-list/quick-edit-modal.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { DataForm } from '@wordpress/dataviews';\nimport {\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useEffect, useMemo, useState } from '@wordpress/element';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { usePostFields, PostCardPanel } = unlock( editorPrivateApis );\n\nconst fieldsWithBulkEditSupport = [ 'status', 'date', 'author', 'discussion' ];\n\nexport function QuickEditModal( {\n\tpostType,\n\tpostId,\n\tcloseModal,\n\tquickEditForm,\n} ) {\n\tconst isBulk = postId.length > 1;\n\n\tconst [ localEdits, setLocalEdits ] = useState( {} );\n\tconst { record, hasFinishedResolution, canSwitchTemplate } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\thasFinishedResolution: hasFinished,\n\t\t\t} = select( coreDataStore );\n\n\t\t\tif ( isBulk ) {\n\t\t\t\treturn {\n\t\t\t\t\trecord: null,\n\t\t\t\t\thasFinishedResolution: true,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst args = [ 'postType', postType, postId[ 0 ] ];\n\n\t\t\tconst { getHomePage, getPostsPageId } = unlock(\n\t\t\t\tselect( coreDataStore )\n\t\t\t);\n\t\t\tconst singlePostId = String( postId[ 0 ] );\n\t\t\tconst isPostsPage =\n\t\t\t\tsinglePostId !== undefined && getPostsPageId() === singlePostId;\n\t\t\tconst isFrontPage =\n\t\t\t\tsinglePostId !== undefined &&\n\t\t\t\tpostType === 'page' &&\n\t\t\t\tgetHomePage()?.postId === singlePostId;\n\n\t\t\treturn {\n\t\t\t\trecord: getEditedEntityRecord( ...args ),\n\t\t\t\thasFinishedResolution: hasFinished(\n\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\targs\n\t\t\t\t),\n\t\t\t\tcanSwitchTemplate: ! isPostsPage && ! isFrontPage,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, isBulk ]\n\t);\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreDataStore );\n\n\tconst _fields = usePostFields( { postType } );\n\tconst fields = useMemo(\n\t\t() =>\n\t\t\t_fields?.map( ( field ) => {\n\t\t\t\tif ( field.id === 'status' ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...field,\n\t\t\t\t\t\telements: field.elements.filter(\n\t\t\t\t\t\t\t( element ) => element.value !== 'trash'\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tif ( field.id === 'template' ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...field,\n\t\t\t\t\t\treadOnly: ! canSwitchTemplate,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn field;\n\t\t\t} ),\n\t\t[ _fields, canSwitchTemplate ]\n\t);\n\n\tconst form = useMemo( () => {\n\t\tif ( ! quickEditForm ) {\n\t\t\treturn { layout: { type: 'panel' }, fields: [] };\n\t\t}\n\t\tif ( ! isBulk ) {\n\t\t\treturn quickEditForm;\n\t\t}\n\t\treturn {\n\t\t\t...quickEditForm,\n\t\t\tfields: ( quickEditForm.fields ?? [] ).filter( ( field ) =>\n\t\t\t\tfieldsWithBulkEditSupport.includes(\n\t\t\t\t\ttypeof field === 'string' ? field : field.id\n\t\t\t\t)\n\t\t\t),\n\t\t};\n\t}, [ isBulk, quickEditForm ] );\n\n\tconst onChange = ( edits ) => {\n\t\tconst currentData = { ...record, ...localEdits };\n\n\t\tif (\n\t\t\tedits.status &&\n\t\t\tedits.status !== 'future' &&\n\t\t\tcurrentData?.status === 'future' &&\n\t\t\tnew Date( currentData.date ) > new Date()\n\t\t) {\n\t\t\tedits.date = null;\n\t\t}\n\t\tif (\n\t\t\tedits.status &&\n\t\t\tedits.status === 'private' &&\n\t\t\tcurrentData?.password\n\t\t) {\n\t\t\tedits.password = '';\n\t\t}\n\n\t\tsetLocalEdits( ( prev ) => ( { ...prev, ...edits } ) );\n\t};\n\tuseEffect( () => {\n\t\tsetLocalEdits( {} );\n\t}, [ postId ] );\n\n\tconst onSave = async () => {\n\t\tfor ( const id of postId ) {\n\t\t\teditEntityRecord( 'postType', postType, id, localEdits );\n\t\t}\n\n\t\tif ( isBulk ) {\n\t\t\tawait Promise.allSettled(\n\t\t\t\tpostId.map( ( id ) =>\n\t\t\t\t\tsaveEditedEntityRecord( 'postType', postType, id )\n\t\t\t\t)\n\t\t\t);\n\t\t} else {\n\t\t\tawait saveEditedEntityRecord( 'postType', postType, postId[ 0 ] );\n\t\t}\n\t\tcloseModal?.();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\toverlayClassName=\"dataviews-action-modal__quick-edit\"\n\t\t\t__experimentalHideHeader\n\t\t\tonRequestClose={ closeModal }\n\t\t\tfocusOnMount=\"firstElement\"\n\t\t>\n\t\t\t<div className=\"dataviews-action-modal__quick-edit-header\">\n\t\t\t\t<PostCardPanel\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tpostId={ postId }\n\t\t\t\t\
|
|
5
|
-
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,aAAa,iBAAiB;AACvC,SAAS,SAAS,qBAAqB;AACvC,SAAS,gBAAgB;AACzB;AAAA,EACC;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,OAClB;AACP,SAAS,WAAW,SAAS,gBAAgB;AAC7C,SAAS,eAAe,yBAAyB;AAKjD,SAAS,cAAc;AAoJnB,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { DataForm } from '@wordpress/dataviews';\nimport {\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useEffect, useMemo, useState } from '@wordpress/element';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { usePostFields, PostCardPanel } = unlock( editorPrivateApis );\n\nconst fieldsWithBulkEditSupport = [ 'status', 'date', 'author', 'discussion' ];\n\nexport function QuickEditModal( {\n\tpostType,\n\tpostId,\n\tcloseModal,\n\tquickEditForm,\n} ) {\n\tconst isBulk = postId.length > 1;\n\n\tconst [ localEdits, setLocalEdits ] = useState( {} );\n\tconst { record, hasFinishedResolution, canSwitchTemplate } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\thasFinishedResolution: hasFinished,\n\t\t\t} = select( coreDataStore );\n\n\t\t\tif ( isBulk ) {\n\t\t\t\treturn {\n\t\t\t\t\trecord: null,\n\t\t\t\t\thasFinishedResolution: true,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst args = [ 'postType', postType, postId[ 0 ] ];\n\n\t\t\tconst { getHomePage, getPostsPageId } = unlock(\n\t\t\t\tselect( coreDataStore )\n\t\t\t);\n\t\t\tconst singlePostId = String( postId[ 0 ] );\n\t\t\tconst isPostsPage =\n\t\t\t\tsinglePostId !== undefined && getPostsPageId() === singlePostId;\n\t\t\tconst isFrontPage =\n\t\t\t\tsinglePostId !== undefined &&\n\t\t\t\tpostType === 'page' &&\n\t\t\t\tgetHomePage()?.postId === singlePostId;\n\n\t\t\treturn {\n\t\t\t\trecord: getEditedEntityRecord( ...args ),\n\t\t\t\thasFinishedResolution: hasFinished(\n\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\targs\n\t\t\t\t),\n\t\t\t\tcanSwitchTemplate: ! isPostsPage && ! isFrontPage,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, isBulk ]\n\t);\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreDataStore );\n\n\tconst _fields = usePostFields( { postType } );\n\tconst fields = useMemo(\n\t\t() =>\n\t\t\t_fields?.map( ( field ) => {\n\t\t\t\tif ( field.id === 'status' ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...field,\n\t\t\t\t\t\telements: field.elements.filter(\n\t\t\t\t\t\t\t( element ) => element.value !== 'trash'\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tif ( field.id === 'template' ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...field,\n\t\t\t\t\t\treadOnly: ! canSwitchTemplate,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn field;\n\t\t\t} ),\n\t\t[ _fields, canSwitchTemplate ]\n\t);\n\n\tconst form = useMemo( () => {\n\t\tif ( ! quickEditForm ) {\n\t\t\treturn { layout: { type: 'panel' }, fields: [] };\n\t\t}\n\t\tif ( ! isBulk ) {\n\t\t\treturn quickEditForm;\n\t\t}\n\t\treturn {\n\t\t\t...quickEditForm,\n\t\t\tfields: ( quickEditForm.fields ?? [] ).filter( ( field ) =>\n\t\t\t\tfieldsWithBulkEditSupport.includes(\n\t\t\t\t\ttypeof field === 'string' ? field : field.id\n\t\t\t\t)\n\t\t\t),\n\t\t};\n\t}, [ isBulk, quickEditForm ] );\n\n\tconst onChange = ( edits ) => {\n\t\tconst currentData = { ...record, ...localEdits };\n\n\t\tif (\n\t\t\tedits.status &&\n\t\t\tedits.status !== 'future' &&\n\t\t\tcurrentData?.status === 'future' &&\n\t\t\tnew Date( currentData.date ) > new Date()\n\t\t) {\n\t\t\tedits.date = null;\n\t\t}\n\t\tif (\n\t\t\tedits.status &&\n\t\t\tedits.status === 'private' &&\n\t\t\tcurrentData?.password\n\t\t) {\n\t\t\tedits.password = '';\n\t\t}\n\n\t\tsetLocalEdits( ( prev ) => ( { ...prev, ...edits } ) );\n\t};\n\tuseEffect( () => {\n\t\tsetLocalEdits( {} );\n\t}, [ postId ] );\n\n\tconst onSave = async () => {\n\t\tfor ( const id of postId ) {\n\t\t\teditEntityRecord( 'postType', postType, id, localEdits );\n\t\t}\n\n\t\tif ( isBulk ) {\n\t\t\tawait Promise.allSettled(\n\t\t\t\tpostId.map( ( id ) =>\n\t\t\t\t\tsaveEditedEntityRecord( 'postType', postType, id )\n\t\t\t\t)\n\t\t\t);\n\t\t} else {\n\t\t\tawait saveEditedEntityRecord( 'postType', postType, postId[ 0 ] );\n\t\t}\n\t\tcloseModal?.();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\toverlayClassName=\"dataviews-action-modal__quick-edit\"\n\t\t\t__experimentalHideHeader\n\t\t\tonRequestClose={ closeModal }\n\t\t\tfocusOnMount=\"firstElement\"\n\t\t>\n\t\t\t<div className=\"dataviews-action-modal__quick-edit-header\">\n\t\t\t\t<PostCardPanel\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tpostId={ postId }\n\t\t\t\t\thideActions\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div className=\"dataviews-action-modal__quick-edit-content\">\n\t\t\t\t{ hasFinishedResolution && (\n\t\t\t\t\t<DataForm\n\t\t\t\t\t\tdata={ { ...record, ...localEdits } }\n\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\tform={ form }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t<HStack className=\"dataviews-action-modal__quick-edit-footer\">\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tonClick={ closeModal }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</Button>\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tonClick={ onSave }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Done' ) }\n\t\t\t\t</Button>\n\t\t\t</HStack>\n\t\t</Modal>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,aAAa,iBAAiB;AACvC,SAAS,SAAS,qBAAqB;AACvC,SAAS,gBAAgB;AACzB;AAAA,EACC;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,OAClB;AACP,SAAS,WAAW,SAAS,gBAAgB;AAC7C,SAAS,eAAe,yBAAyB;AAKjD,SAAS,cAAc;AAoJnB,cAgBD,YAhBC;AAlJJ,IAAM,EAAE,eAAe,cAAc,IAAI,OAAQ,iBAAkB;AAEnE,IAAM,4BAA4B,CAAE,UAAU,QAAQ,UAAU,YAAa;AAEtE,SAAS,eAAgB;AAAA,EAC/B;AAAA,EACA;AA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