@wordpress/edit-site 6.0.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/block-editor/inserter-media-categories.js +1 -1
- package/build/components/block-editor/inserter-media-categories.js.map +1 -1
- package/build/components/editor/index.js +52 -59
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor/use-editor-title.js +39 -0
- package/build/components/editor/use-editor-title.js.map +1 -0
- package/build/components/global-styles/screen-css.js +1 -1
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +1 -1
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles-sidebar/index.js +2 -0
- package/build/components/global-styles-sidebar/index.js.map +1 -1
- package/build/components/layout/index.js +16 -59
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page-patterns/index.js +5 -5
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/pagination/index.js +17 -8
- package/build/components/pagination/index.js.map +1 -1
- package/build/components/sidebar-dataviews/dataview-item.js +6 -2
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +1 -1
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/site-hub/index.js +38 -128
- package/build/components/site-hub/index.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +1 -0
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/store/private-actions.js +33 -18
- package/build/store/private-actions.js.map +1 -1
- package/build-module/components/block-editor/inserter-media-categories.js +1 -1
- package/build-module/components/block-editor/inserter-media-categories.js.map +1 -1
- package/build-module/components/editor/index.js +52 -59
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor/use-editor-title.js +31 -0
- package/build-module/components/editor/use-editor-title.js.map +1 -0
- package/build-module/components/global-styles/screen-css.js +1 -1
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +2 -2
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles-sidebar/index.js +2 -0
- package/build-module/components/global-styles-sidebar/index.js.map +1 -1
- package/build-module/components/layout/index.js +18 -61
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page-patterns/index.js +5 -5
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/pagination/index.js +17 -8
- package/build-module/components/pagination/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/dataview-item.js +6 -2
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +2 -2
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +40 -130
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +1 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/store/private-actions.js +33 -18
- package/build-module/store/private-actions.js.map +1 -1
- package/build-style/style-rtl.css +43 -85
- package/build-style/style.css +43 -85
- package/package.json +41 -41
- package/src/components/block-editor/inserter-media-categories.js +1 -3
- package/src/components/block-editor/style.scss +11 -0
- package/src/components/editor/index.js +67 -95
- package/src/components/editor/style.scss +1 -5
- package/src/components/editor/use-editor-title.js +35 -0
- package/src/components/global-styles/screen-css.js +1 -1
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/src/components/global-styles/screen-revisions/style.scss +4 -8
- package/src/components/global-styles/variations/variations-color.js +6 -3
- package/src/components/global-styles-sidebar/index.js +2 -0
- package/src/components/layout/index.js +17 -67
- package/src/components/layout/style.scss +18 -58
- package/src/components/page-patterns/index.js +15 -12
- package/src/components/pagination/index.js +21 -16
- package/src/components/sidebar-dataviews/dataview-item.js +6 -2
- package/src/components/sidebar-navigation-screen/index.js +1 -1
- package/src/components/sidebar-navigation-screen/style.scss +2 -2
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
- package/src/components/sidebar-navigation-screen-patterns/category-item.js +11 -2
- package/src/components/sidebar-navigation-screen-patterns/index.js +5 -1
- package/src/components/site-hub/index.js +55 -146
- package/src/components/site-hub/style.scss +1 -4
- package/src/components/site-icon/style.scss +0 -4
- package/src/hooks/push-changes-to-global-styles/index.js +1 -0
- package/src/store/private-actions.js +58 -30
|
@@ -20,27 +20,42 @@ const setCanvasMode = mode => ({
|
|
|
20
20
|
registry,
|
|
21
21
|
dispatch
|
|
22
22
|
}) => {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
const switchCanvasMode = () => {
|
|
24
|
+
registry.batch(() => {
|
|
25
|
+
const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches;
|
|
26
|
+
registry.dispatch(_blockEditor.store).clearSelectedBlock();
|
|
27
|
+
registry.dispatch(_editor.store).setDeviceType('Desktop');
|
|
28
|
+
registry.dispatch(_blockEditor.store).__unstableSetEditorMode('edit');
|
|
29
|
+
const isPublishSidebarOpened = registry.select(_editor.store).isPublishSidebarOpened();
|
|
30
|
+
dispatch({
|
|
31
|
+
type: 'SET_CANVAS_MODE',
|
|
32
|
+
mode
|
|
33
|
+
});
|
|
34
|
+
const isEditMode = mode === 'edit';
|
|
35
|
+
if (isPublishSidebarOpened && !isEditMode) {
|
|
36
|
+
registry.dispatch(_editor.store).closePublishSidebar();
|
|
37
|
+
}
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
// Check if the block list view should be open by default.
|
|
40
|
+
// If `distractionFree` mode is enabled, the block list view should not be open.
|
|
41
|
+
// This behavior is disabled for small viewports.
|
|
42
|
+
if (isMediumOrBigger && isEditMode && registry.select(_preferences.store).get('core', 'showListViewByDefault') && !registry.select(_preferences.store).get('core', 'distractionFree')) {
|
|
43
|
+
registry.dispatch(_editor.store).setIsListViewOpened(true);
|
|
44
|
+
} else {
|
|
45
|
+
registry.dispatch(_editor.store).setIsListViewOpened(false);
|
|
46
|
+
}
|
|
47
|
+
registry.dispatch(_editor.store).setIsInserterOpened(false);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
if (!document.startViewTransition) {
|
|
51
|
+
switchCanvasMode();
|
|
40
52
|
} else {
|
|
41
|
-
|
|
53
|
+
document.documentElement.classList.add(`canvas-mode-${mode}-transition`);
|
|
54
|
+
const transition = document.startViewTransition(() => switchCanvasMode());
|
|
55
|
+
transition.finished.finally(() => {
|
|
56
|
+
document.documentElement.classList.remove(`canvas-mode-${mode}-transition`);
|
|
57
|
+
});
|
|
42
58
|
}
|
|
43
|
-
registry.dispatch(_editor.store).setIsInserterOpened(false);
|
|
44
59
|
};
|
|
45
60
|
|
|
46
61
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_preferences","_editor","setCanvasMode","mode","registry","dispatch","isMediumOrBigger","window","matchMedia","matches","blockEditorStore","__unstableSetEditorMode","isPublishSidebarOpened","select","
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_preferences","_editor","setCanvasMode","mode","registry","dispatch","switchCanvasMode","batch","isMediumOrBigger","window","matchMedia","matches","blockEditorStore","clearSelectedBlock","editorStore","setDeviceType","__unstableSetEditorMode","isPublishSidebarOpened","select","type","isEditMode","closePublishSidebar","preferencesStore","get","setIsListViewOpened","setIsInserterOpened","document","startViewTransition","documentElement","classList","add","transition","finished","finally","remove","exports","setEditorCanvasContainerView","view"],"sources":["@wordpress/edit-site/src/store/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch } ) => {\n\t\tconst switchCanvasMode = () => {\n\t\t\tregistry.batch( () => {\n\t\t\t\tconst isMediumOrBigger =\n\t\t\t\t\twindow.matchMedia( '(min-width: 782px)' ).matches;\n\t\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t\t\tregistry.dispatch( editorStore ).setDeviceType( 'Desktop' );\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( blockEditorStore )\n\t\t\t\t\t.__unstableSetEditorMode( 'edit' );\n\t\t\t\tconst isPublishSidebarOpened = registry\n\t\t\t\t\t.select( editorStore )\n\t\t\t\t\t.isPublishSidebarOpened();\n\t\t\t\tdispatch( {\n\t\t\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\t\t\tmode,\n\t\t\t\t} );\n\t\t\t\tconst isEditMode = mode === 'edit';\n\t\t\t\tif ( isPublishSidebarOpened && ! isEditMode ) {\n\t\t\t\t\tregistry.dispatch( editorStore ).closePublishSidebar();\n\t\t\t\t}\n\n\t\t\t\t// Check if the block list view should be open by default.\n\t\t\t\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t\t\t\t// This behavior is disabled for small viewports.\n\t\t\t\tif (\n\t\t\t\t\tisMediumOrBigger &&\n\t\t\t\t\tisEditMode &&\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.select( preferencesStore )\n\t\t\t\t\t\t.get( 'core', 'showListViewByDefault' ) &&\n\t\t\t\t\t! registry\n\t\t\t\t\t\t.select( preferencesStore )\n\t\t\t\t\t\t.get( 'core', 'distractionFree' )\n\t\t\t\t) {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( editorStore )\n\t\t\t\t\t\t.setIsListViewOpened( true );\n\t\t\t\t} else {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( editorStore )\n\t\t\t\t\t\t.setIsListViewOpened( false );\n\t\t\t\t}\n\t\t\t\tregistry.dispatch( editorStore ).setIsInserterOpened( false );\n\t\t\t} );\n\t\t};\n\n\t\tif ( ! document.startViewTransition ) {\n\t\t\tswitchCanvasMode();\n\t\t} else {\n\t\t\tdocument.documentElement.classList.add(\n\t\t\t\t`canvas-mode-${ mode }-transition`\n\t\t\t);\n\t\t\tconst transition = document.startViewTransition( () =>\n\t\t\t\tswitchCanvasMode()\n\t\t\t);\n\t\t\ttransition.finished.finally( () => {\n\t\t\t\tdocument.documentElement.classList.remove(\n\t\t\t\t\t`canvas-mode-${ mode }-transition`\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAIN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AAE,MAAM,EAAE,iBAAkB,CAAC,EACjC;QACDnB,QAAQ,CACNC,QAAQ,CAAES,aAAY,CAAC,CACvBU,mBAAmB,CAAE,IAAK,CAAC;MAC9B,CAAC,MAAM;QACNpB,QAAQ,CACNC,QAAQ,CAAES,aAAY,CAAC,CACvBU,mBAAmB,CAAE,KAAM,CAAC;MAC/B;MACApB,QAAQ,CAACC,QAAQ,CAAES,aAAY,CAAC,CAACW,mBAAmB,CAAE,KAAM,CAAC;IAC9D,CAAE,CAAC;EACJ,CAAC;EAED,IAAK,CAAEC,QAAQ,CAACC,mBAAmB,EAAG;IACrCrB,gBAAgB,CAAC,CAAC;EACnB,CAAC,MAAM;IACNoB,QAAQ,CAACE,eAAe,CAACC,SAAS,CAACC,GAAG,CACpC,eAAe3B,IAAM,aACvB,CAAC;IACD,MAAM4B,UAAU,GAAGL,QAAQ,CAACC,mBAAmB,CAAE,MAChDrB,gBAAgB,CAAC,CAClB,CAAC;IACDyB,UAAU,CAACC,QAAQ,CAACC,OAAO,CAAE,MAAM;MAClCP,QAAQ,CAACE,eAAe,CAACC,SAAS,CAACK,MAAM,CACvC,eAAe/B,IAAM,aACvB,CAAC;IACF,CAAE,CAAC;EACJ;AACD,CAAC;;AAEF;AACA;AACA;AACA;AACA;AAJAgC,OAAA,CAAAjC,aAAA,GAAAA,aAAA;AAKO,MAAMkC,4BAA4B,GACtCC,IAAI,IACN,CAAE;EAAEhC;AAAS,CAAC,KAAM;EACnBA,QAAQ,CAAE;IACTc,IAAI,EAAE,kCAAkC;IACxCkB;EACD,CAAE,CAAC;AACJ,CAAC;AAACF,OAAA,CAAAC,4BAAA,GAAAA,4BAAA","ignoreList":[]}
|
|
@@ -145,7 +145,7 @@ const inserterMediaCategories = [{
|
|
|
145
145
|
per_page: 'page_size',
|
|
146
146
|
search: 'q'
|
|
147
147
|
};
|
|
148
|
-
const url = new URL('https://api.openverse.
|
|
148
|
+
const url = new URL('https://api.openverse.org/v1/images/');
|
|
149
149
|
Object.entries(finalQuery).forEach(([key, value]) => {
|
|
150
150
|
const queryKey = mapFromInserterMediaRequest[key] || key;
|
|
151
151
|
url.searchParams.set(queryKey, value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","sprintf","_x","resolveSelect","decodeEntities","store","coreStore","getExternalLink","url","text","getExternalLinkAttributes","getOpenverseLicense","license","licenseVersion","licenseName","trim","toUpperCase","replace","includes","getOpenverseCaption","item","title","foreign_landing_url","foreignLandingUrl","creator","creator_url","creatorUrl","license_version","license_url","licenseUrl","fullLicense","_creator","_caption","coreMediaFetch","query","mediaItems","getMediaItems","orderBy","search","map","mediaItem","alt","alt_text","source_url","previewUrl","media_details","sizes","medium","caption","raw","inserterMediaCategories","name","labels","search_items","mediaType","fetch","media_type","defaultArgs","mature","excluded_source","finalQuery","mapFromInserterMediaRequest","per_page","URL","Object","entries","forEach","key","value","queryKey","searchParams","set","response","window","headers","jsonResponse","json","results","result","toLowerCase","startsWith","slice","sourceId","id","undefined","thumbnail","getReportUrl","isExternalResource"],"sources":["@wordpress/edit-site/src/components/block-editor/inserter-media-categories.js"],"sourcesContent":["/**\n * The `edit-site` settings here need to be in sync with the corresponding ones in `site-editor` package.\n * See `packages/edit-site/src/components/block-editor/inserter-media-categories.js`.\n *\n * In the future we could consider creating an Openvese package that can be used in both `editor` and `site-editor`.\n * The rest of the settings would still need to be in sync though.\n */\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf, _x } from '@wordpress/i18n';\nimport { resolveSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\n\n/** @typedef {import('@wordpress/block-editor').InserterMediaRequest} InserterMediaRequest */\n/** @typedef {import('@wordpress/block-editor').InserterMediaItem} InserterMediaItem */\n/** @typedef {import('@wordpress/block-editor').InserterMediaCategory} InserterMediaCategory */\n\nconst getExternalLink = ( url, text ) =>\n\t`<a ${ getExternalLinkAttributes( url ) }>${ text }</a>`;\n\nconst getExternalLinkAttributes = ( url ) =>\n\t`href=\"${ url }\" target=\"_blank\" rel=\"noreferrer noopener\"`;\n\nconst getOpenverseLicense = ( license, licenseVersion ) => {\n\tlet licenseName = license.trim();\n\t// PDM has no abbreviation\n\tif ( license !== 'pdm' ) {\n\t\tlicenseName = license.toUpperCase().replace( 'SAMPLING', 'Sampling' );\n\t}\n\t// If version is known, append version to the name.\n\t// The license has to have a version to be valid. Only\n\t// PDM (public domain mark) doesn't have a version.\n\tif ( licenseVersion ) {\n\t\tlicenseName += ` ${ licenseVersion }`;\n\t}\n\t// For licenses other than public-domain marks, prepend 'CC' to the name.\n\tif ( ! [ 'pdm', 'cc0' ].includes( license ) ) {\n\t\tlicenseName = `CC ${ licenseName }`;\n\t}\n\treturn licenseName;\n};\n\nconst getOpenverseCaption = ( item ) => {\n\tconst {\n\t\ttitle,\n\t\tforeign_landing_url: foreignLandingUrl,\n\t\tcreator,\n\t\tcreator_url: creatorUrl,\n\t\tlicense,\n\t\tlicense_version: licenseVersion,\n\t\tlicense_url: licenseUrl,\n\t} = item;\n\tconst fullLicense = getOpenverseLicense( license, licenseVersion );\n\tconst _creator = decodeEntities( creator );\n\tlet _caption;\n\tif ( _creator ) {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Name of the work's creator; %3s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\" by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Name of the work's creator; %3s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a> by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t} else {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\"/ %2$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a>/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t}\n\treturn _caption.replace( /\\s{2}/g, ' ' );\n};\n\nconst coreMediaFetch = async ( query = {} ) => {\n\tconst mediaItems = await resolveSelect( coreStore ).getMediaItems( {\n\t\t...query,\n\t\torderBy: !! query?.search ? 'relevance' : 'date',\n\t} );\n\treturn mediaItems.map( ( mediaItem ) => ( {\n\t\t...mediaItem,\n\t\talt: mediaItem.alt_text,\n\t\turl: mediaItem.source_url,\n\t\tpreviewUrl: mediaItem.media_details?.sizes?.medium?.source_url,\n\t\tcaption: mediaItem.caption?.raw,\n\t} ) );\n};\n\n/** @type {InserterMediaCategory[]} */\nconst inserterMediaCategories = [\n\t{\n\t\tname: 'images',\n\t\tlabels: {\n\t\t\tname: __( 'Images' ),\n\t\t\tsearch_items: __( 'Search images' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'image' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'videos',\n\t\tlabels: {\n\t\t\tname: __( 'Videos' ),\n\t\t\tsearch_items: __( 'Search videos' ),\n\t\t},\n\t\tmediaType: 'video',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'video' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'audio',\n\t\tlabels: {\n\t\t\tname: __( 'Audio' ),\n\t\t\tsearch_items: __( 'Search audio' ),\n\t\t},\n\t\tmediaType: 'audio',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'audio' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'openverse',\n\t\tlabels: {\n\t\t\tname: __( 'Openverse' ),\n\t\t\tsearch_items: __( 'Search Openverse' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\tconst defaultArgs = {\n\t\t\t\tmature: false,\n\t\t\t\texcluded_source: 'flickr,inaturalist,wikimedia',\n\t\t\t\tlicense: 'pdm,cc0',\n\t\t\t};\n\t\t\tconst finalQuery = { ...query, ...defaultArgs };\n\t\t\tconst mapFromInserterMediaRequest = {\n\t\t\t\tper_page: 'page_size',\n\t\t\t\tsearch: 'q',\n\t\t\t};\n\t\t\tconst url = new URL(\n\t\t\t\t'https://api.openverse.engineering/v1/images/'\n\t\t\t);\n\t\t\tObject.entries( finalQuery ).forEach( ( [ key, value ] ) => {\n\t\t\t\tconst queryKey = mapFromInserterMediaRequest[ key ] || key;\n\t\t\t\turl.searchParams.set( queryKey, value );\n\t\t\t} );\n\t\t\tconst response = await window.fetch( url, {\n\t\t\t\theaders: {\n\t\t\t\t\t'User-Agent': 'WordPress/inserter-media-fetch',\n\t\t\t\t},\n\t\t\t} );\n\t\t\tconst jsonResponse = await response.json();\n\t\t\tconst results = jsonResponse.results;\n\t\t\treturn results.map( ( result ) => ( {\n\t\t\t\t...result,\n\t\t\t\t// This is a temp solution for better titles, until Openverse API\n\t\t\t\t// completes the cleaning up of some titles of their upstream data.\n\t\t\t\ttitle: result.title?.toLowerCase().startsWith( 'file:' )\n\t\t\t\t\t? result.title.slice( 5 )\n\t\t\t\t\t: result.title,\n\t\t\t\tsourceId: result.id,\n\t\t\t\tid: undefined,\n\t\t\t\tcaption: getOpenverseCaption( result ),\n\t\t\t\tpreviewUrl: result.thumbnail,\n\t\t\t} ) );\n\t\t},\n\t\tgetReportUrl: ( { sourceId } ) =>\n\t\t\t`https://wordpress.org/openverse/image/${ sourceId }/report/`,\n\t\tisExternalResource: true,\n\t},\n];\n\nexport default inserterMediaCategories;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,EAAEC,EAAE,QAAQ,iBAAiB;AACjD,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,cAAc,QAAQ,0BAA0B;;AAEzD;AACA;AACA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C,OAAOA,OAAO,CAACtC,GAAG,CAAIuC,MAAM,KAAQ;MACnC,GAAGA,MAAM;MACT;MACA;MACAzD,KAAK,EAAEyD,MAAM,CAACzD,KAAK,EAAE0D,WAAW,CAAC,CAAC,CAACC,UAAU,CAAE,OAAQ,CAAC,GACrDF,MAAM,CAACzD,KAAK,CAAC4D,KAAK,CAAE,CAAE,CAAC,GACvBH,MAAM,CAACzD,KAAK;MACf6D,QAAQ,EAAEJ,MAAM,CAACK,EAAE;MACnBA,EAAE,EAAEC,SAAS;MACbpC,OAAO,EAAE7B,mBAAmB,CAAE2D,MAAO,CAAC;MACtClC,UAAU,EAAEkC,MAAM,CAACO;IACpB,CAAC,CAAG,CAAC;EACN,CAAC;EACDC,YAAY,EAAEA,CAAE;IAAEJ;EAAS,CAAC,KAC1B,yCAAyCA,QAAU,UAAS;EAC9DK,kBAAkB,EAAE;AACrB,CAAC,CACD;AAED,eAAerC,uBAAuB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["__","sprintf","_x","resolveSelect","decodeEntities","store","coreStore","getExternalLink","url","text","getExternalLinkAttributes","getOpenverseLicense","license","licenseVersion","licenseName","trim","toUpperCase","replace","includes","getOpenverseCaption","item","title","foreign_landing_url","foreignLandingUrl","creator","creator_url","creatorUrl","license_version","license_url","licenseUrl","fullLicense","_creator","_caption","coreMediaFetch","query","mediaItems","getMediaItems","orderBy","search","map","mediaItem","alt","alt_text","source_url","previewUrl","media_details","sizes","medium","caption","raw","inserterMediaCategories","name","labels","search_items","mediaType","fetch","media_type","defaultArgs","mature","excluded_source","finalQuery","mapFromInserterMediaRequest","per_page","URL","Object","entries","forEach","key","value","queryKey","searchParams","set","response","window","headers","jsonResponse","json","results","result","toLowerCase","startsWith","slice","sourceId","id","undefined","thumbnail","getReportUrl","isExternalResource"],"sources":["@wordpress/edit-site/src/components/block-editor/inserter-media-categories.js"],"sourcesContent":["/**\n * The `edit-site` settings here need to be in sync with the corresponding ones in `site-editor` package.\n * See `packages/edit-site/src/components/block-editor/inserter-media-categories.js`.\n *\n * In the future we could consider creating an Openvese package that can be used in both `editor` and `site-editor`.\n * The rest of the settings would still need to be in sync though.\n */\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf, _x } from '@wordpress/i18n';\nimport { resolveSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\n\n/** @typedef {import('@wordpress/block-editor').InserterMediaRequest} InserterMediaRequest */\n/** @typedef {import('@wordpress/block-editor').InserterMediaItem} InserterMediaItem */\n/** @typedef {import('@wordpress/block-editor').InserterMediaCategory} InserterMediaCategory */\n\nconst getExternalLink = ( url, text ) =>\n\t`<a ${ getExternalLinkAttributes( url ) }>${ text }</a>`;\n\nconst getExternalLinkAttributes = ( url ) =>\n\t`href=\"${ url }\" target=\"_blank\" rel=\"noreferrer noopener\"`;\n\nconst getOpenverseLicense = ( license, licenseVersion ) => {\n\tlet licenseName = license.trim();\n\t// PDM has no abbreviation\n\tif ( license !== 'pdm' ) {\n\t\tlicenseName = license.toUpperCase().replace( 'SAMPLING', 'Sampling' );\n\t}\n\t// If version is known, append version to the name.\n\t// The license has to have a version to be valid. Only\n\t// PDM (public domain mark) doesn't have a version.\n\tif ( licenseVersion ) {\n\t\tlicenseName += ` ${ licenseVersion }`;\n\t}\n\t// For licenses other than public-domain marks, prepend 'CC' to the name.\n\tif ( ! [ 'pdm', 'cc0' ].includes( license ) ) {\n\t\tlicenseName = `CC ${ licenseName }`;\n\t}\n\treturn licenseName;\n};\n\nconst getOpenverseCaption = ( item ) => {\n\tconst {\n\t\ttitle,\n\t\tforeign_landing_url: foreignLandingUrl,\n\t\tcreator,\n\t\tcreator_url: creatorUrl,\n\t\tlicense,\n\t\tlicense_version: licenseVersion,\n\t\tlicense_url: licenseUrl,\n\t} = item;\n\tconst fullLicense = getOpenverseLicense( license, licenseVersion );\n\tconst _creator = decodeEntities( creator );\n\tlet _caption;\n\tif ( _creator ) {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Name of the work's creator; %3s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\" by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Name of the work's creator; %3s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a> by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t} else {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\"/ %2$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a>/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t}\n\treturn _caption.replace( /\\s{2}/g, ' ' );\n};\n\nconst coreMediaFetch = async ( query = {} ) => {\n\tconst mediaItems = await resolveSelect( coreStore ).getMediaItems( {\n\t\t...query,\n\t\torderBy: !! query?.search ? 'relevance' : 'date',\n\t} );\n\treturn mediaItems.map( ( mediaItem ) => ( {\n\t\t...mediaItem,\n\t\talt: mediaItem.alt_text,\n\t\turl: mediaItem.source_url,\n\t\tpreviewUrl: mediaItem.media_details?.sizes?.medium?.source_url,\n\t\tcaption: mediaItem.caption?.raw,\n\t} ) );\n};\n\n/** @type {InserterMediaCategory[]} */\nconst inserterMediaCategories = [\n\t{\n\t\tname: 'images',\n\t\tlabels: {\n\t\t\tname: __( 'Images' ),\n\t\t\tsearch_items: __( 'Search images' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'image' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'videos',\n\t\tlabels: {\n\t\t\tname: __( 'Videos' ),\n\t\t\tsearch_items: __( 'Search videos' ),\n\t\t},\n\t\tmediaType: 'video',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'video' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'audio',\n\t\tlabels: {\n\t\t\tname: __( 'Audio' ),\n\t\t\tsearch_items: __( 'Search audio' ),\n\t\t},\n\t\tmediaType: 'audio',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'audio' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'openverse',\n\t\tlabels: {\n\t\t\tname: __( 'Openverse' ),\n\t\t\tsearch_items: __( 'Search Openverse' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\tconst defaultArgs = {\n\t\t\t\tmature: false,\n\t\t\t\texcluded_source: 'flickr,inaturalist,wikimedia',\n\t\t\t\tlicense: 'pdm,cc0',\n\t\t\t};\n\t\t\tconst finalQuery = { ...query, ...defaultArgs };\n\t\t\tconst mapFromInserterMediaRequest = {\n\t\t\t\tper_page: 'page_size',\n\t\t\t\tsearch: 'q',\n\t\t\t};\n\t\t\tconst url = new URL( 'https://api.openverse.org/v1/images/' );\n\t\t\tObject.entries( finalQuery ).forEach( ( [ key, value ] ) => {\n\t\t\t\tconst queryKey = mapFromInserterMediaRequest[ key ] || key;\n\t\t\t\turl.searchParams.set( queryKey, value );\n\t\t\t} );\n\t\t\tconst response = await window.fetch( url, {\n\t\t\t\theaders: {\n\t\t\t\t\t'User-Agent': 'WordPress/inserter-media-fetch',\n\t\t\t\t},\n\t\t\t} );\n\t\t\tconst jsonResponse = await response.json();\n\t\t\tconst results = jsonResponse.results;\n\t\t\treturn results.map( ( result ) => ( {\n\t\t\t\t...result,\n\t\t\t\t// This is a temp solution for better titles, until Openverse API\n\t\t\t\t// completes the cleaning up of some titles of their upstream data.\n\t\t\t\ttitle: result.title?.toLowerCase().startsWith( 'file:' )\n\t\t\t\t\t? result.title.slice( 5 )\n\t\t\t\t\t: result.title,\n\t\t\t\tsourceId: result.id,\n\t\t\t\tid: undefined,\n\t\t\t\tcaption: getOpenverseCaption( result ),\n\t\t\t\tpreviewUrl: result.thumbnail,\n\t\t\t} ) );\n\t\t},\n\t\tgetReportUrl: ( { sourceId } ) =>\n\t\t\t`https://wordpress.org/openverse/image/${ sourceId }/report/`,\n\t\tisExternalResource: true,\n\t},\n];\n\nexport default inserterMediaCategories;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,EAAEC,EAAE,QAAQ,iBAAiB;AACjD,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,cAAc,QAAQ,0BAA0B;;AAEzD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;;AAEA,MAAMC,eAAe,GAAGA,CAAEC,GAAG,EAAEC,IAAI,KACjC,MAAMC,yBAAyB,CAAEF,GAAI,CAAG,IAAIC,IAAM,MAAK;AAEzD,MAAMC,yBAAyB,GAAKF,GAAG,IACrC,SAASA,GAAK,6CAA4C;AAE5D,MAAMG,mBAAmB,GAAGA,CAAEC,OAAO,EAAEC,cAAc,KAAM;EAC1D,IAAIC,WAAW,GAAGF,OAAO,CAACG,IAAI,CAAC,CAAC;EAChC;EACA,IAAKH,OAAO,KAAK,KAAK,EAAG;IACxBE,WAAW,GAAGF,OAAO,CAACI,WAAW,CAAC,CAAC,CAACC,OAAO,CAAE,UAAU,EAAE,UAAW,CAAC;EACtE;EACA;EACA;EACA;EACA,IAAKJ,cAAc,EAAG;IACrBC,WAAW,IAAK,IAAID,cAAgB,EAAC;EACtC;EACA;EACA,IAAK,CAAE,CAAE,KAAK,EAAE,KAAK,CAAE,CAACK,QAAQ,CAAEN,OAAQ,CAAC,EAAG;IAC7CE,WAAW,GAAI,MAAMA,WAAa,EAAC;EACpC;EACA,OAAOA,WAAW;AACnB,CAAC;AAED,MAAMK,mBAAmB,GAAKC,I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AE,CAAE,CAAEC,GAAG,EAAEC,KAAK,CAAE,KAAM;MAC3D,MAAMC,QAAQ,GAAGR,2BAA2B,CAAEM,GAAG,CAAE,IAAIA,GAAG;MAC1D3D,GAAG,CAAC8D,YAAY,CAACC,GAAG,CAAEF,QAAQ,EAAED,KAAM,CAAC;IACxC,CAAE,CAAC;IACH,MAAMI,QAAQ,GAAG,MAAMC,MAAM,CAAClB,KAAK,CAAE/C,GAAG,EAAE;MACzCkE,OAAO,EAAE;QACR,YAAY,EAAE;MACf;IACD,CAAE,CAAC;IACH,MAAMC,YAAY,GAAG,MAAMH,QAAQ,CAACI,IAAI,CAAC,CAAC;IAC1C,MAAMC,OAAO,GAAGF,YAAY,CAACE,OAAO;IACpC,OAAOA,OAAO,CAACtC,GAAG,CAAIuC,MAAM,KAAQ;MACnC,GAAGA,MAAM;MACT;MACA;MACAzD,KAAK,EAAEyD,MAAM,CAACzD,KAAK,EAAE0D,WAAW,CAAC,CAAC,CAACC,UAAU,CAAE,OAAQ,CAAC,GACrDF,MAAM,CAACzD,KAAK,CAAC4D,KAAK,CAAE,CAAE,CAAC,GACvBH,MAAM,CAACzD,KAAK;MACf6D,QAAQ,EAAEJ,MAAM,CAACK,EAAE;MACnBA,EAAE,EAAEC,SAAS;MACbpC,OAAO,EAAE7B,mBAAmB,CAAE2D,MAAO,CAAC;MACtClC,UAAU,EAAEkC,MAAM,CAACO;IACpB,CAAC,CAAG,CAAC;EACN,CAAC;EACDC,YAAY,EAAEA,CAAE;IAAEJ;EAAS,CAAC,KAC1B,yCAAyCA,QAAU,UAAS;EAC9DK,kBAAkB,EAAE;AACrB,CAAC,CACD;AAED,eAAerC,uBAAuB","ignoreList":[]}
|
|
@@ -7,7 +7,7 @@ import clsx from 'clsx';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
10
|
-
import {
|
|
10
|
+
import { Button } from '@wordpress/components';
|
|
11
11
|
import { useInstanceId } from '@wordpress/compose';
|
|
12
12
|
import { EditorKeyboardShortcutsRegister, privateApis as editorPrivateApis, store as editorStore } from '@wordpress/editor';
|
|
13
13
|
import { __, sprintf } from '@wordpress/i18n';
|
|
@@ -24,11 +24,8 @@ import { store as preferencesStore } from '@wordpress/preferences';
|
|
|
24
24
|
import WelcomeGuide from '../welcome-guide';
|
|
25
25
|
import { store as editSiteStore } from '../../store';
|
|
26
26
|
import { GlobalStylesRenderer } from '../global-styles-renderer';
|
|
27
|
-
import useTitle from '../routes/use-title';
|
|
28
27
|
import CanvasLoader from '../canvas-loader';
|
|
29
28
|
import { unlock } from '../../lock-unlock';
|
|
30
|
-
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
31
|
-
import { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';
|
|
32
29
|
import TemplatePartConverter from '../template-part-converter';
|
|
33
30
|
import { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';
|
|
34
31
|
import PluginTemplateSettingPanel from '../plugin-template-setting-panel';
|
|
@@ -37,14 +34,15 @@ import { isPreviewingTheme } from '../../utils/is-previewing-theme';
|
|
|
37
34
|
import { getEditorCanvasContainerTitle, useHasEditorCanvasContainer } from '../editor-canvas-container';
|
|
38
35
|
import SaveButton from '../save-button';
|
|
39
36
|
import SiteEditorMoreMenu from '../more-menu';
|
|
37
|
+
import SiteIcon from '../site-icon';
|
|
40
38
|
import useEditorIframeProps from '../block-editor/use-editor-iframe-props';
|
|
39
|
+
import useEditorTitle from './use-editor-title';
|
|
41
40
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
42
41
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
43
42
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
44
43
|
const {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
Sidebar
|
|
44
|
+
Editor,
|
|
45
|
+
BackButton
|
|
48
46
|
} = unlock(editorPrivateApis);
|
|
49
47
|
const {
|
|
50
48
|
useHistory
|
|
@@ -52,20 +50,14 @@ const {
|
|
|
52
50
|
const {
|
|
53
51
|
BlockKeyboardShortcuts
|
|
54
52
|
} = unlock(blockLibraryPrivateApis);
|
|
55
|
-
export default function
|
|
53
|
+
export default function EditSiteEditor({
|
|
56
54
|
isLoading
|
|
57
55
|
}) {
|
|
58
56
|
const {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const {
|
|
64
|
-
type: editedPostType
|
|
65
|
-
} = editedPost;
|
|
66
|
-
const {
|
|
67
|
-
context,
|
|
68
|
-
contextPost,
|
|
57
|
+
editedPostType,
|
|
58
|
+
editedPostId,
|
|
59
|
+
contextPostType,
|
|
60
|
+
contextPostId,
|
|
69
61
|
editorMode,
|
|
70
62
|
canvasMode,
|
|
71
63
|
isEditingPage,
|
|
@@ -77,13 +69,14 @@ export default function Editor({
|
|
|
77
69
|
const {
|
|
78
70
|
getEditedPostContext,
|
|
79
71
|
getCanvasMode,
|
|
80
|
-
isPage
|
|
72
|
+
isPage,
|
|
73
|
+
getEditedPostType,
|
|
74
|
+
getEditedPostId
|
|
81
75
|
} = unlock(select(editSiteStore));
|
|
82
76
|
const {
|
|
83
77
|
get
|
|
84
78
|
} = select(preferencesStore);
|
|
85
79
|
const {
|
|
86
|
-
getEntityRecord,
|
|
87
80
|
getCurrentTheme
|
|
88
81
|
} = select(coreDataStore);
|
|
89
82
|
const {
|
|
@@ -94,8 +87,10 @@ export default function Editor({
|
|
|
94
87
|
// The currently selected entity to display.
|
|
95
88
|
// Typically template or template part in the site editor.
|
|
96
89
|
return {
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
editedPostType: getEditedPostType(),
|
|
91
|
+
editedPostId: getEditedPostId(),
|
|
92
|
+
contextPostType: _context?.postId ? _context.postType : undefined,
|
|
93
|
+
contextPostId: _context?.postId ? _context.postId : undefined,
|
|
99
94
|
editorMode: getEditorMode(),
|
|
100
95
|
canvasMode: getCanvasMode(),
|
|
101
96
|
isEditingPage: isPage(),
|
|
@@ -105,24 +100,14 @@ export default function Editor({
|
|
|
105
100
|
currentPostIsTrashed: select(editorStore).getCurrentPostAttribute('status') === 'trash'
|
|
106
101
|
};
|
|
107
102
|
}, []);
|
|
103
|
+
useEditorTitle();
|
|
108
104
|
const _isPreviewingTheme = isPreviewingTheme();
|
|
109
105
|
const hasDefaultEditorCanvasView = !useHasEditorCanvasContainer();
|
|
110
106
|
const iframeProps = useEditorIframeProps();
|
|
111
107
|
const isViewMode = canvasMode === 'view';
|
|
112
108
|
const isEditMode = canvasMode === 'edit';
|
|
113
109
|
const showVisualEditor = isViewMode || editorMode === 'visual';
|
|
114
|
-
const postWithTemplate = !!
|
|
115
|
-
let title;
|
|
116
|
-
if (hasLoadedPost) {
|
|
117
|
-
var _POST_TYPE_LABELS$edi;
|
|
118
|
-
title = sprintf(
|
|
119
|
-
// translators: A breadcrumb trail for the Admin document title. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).
|
|
120
|
-
__('%1$s ‹ %2$s'), getTitle(), (_POST_TYPE_LABELS$edi = POST_TYPE_LABELS[editedPostType]) !== null && _POST_TYPE_LABELS$edi !== void 0 ? _POST_TYPE_LABELS$edi : POST_TYPE_LABELS[TEMPLATE_POST_TYPE]);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Only announce the title once the editor is ready to prevent "Replace"
|
|
124
|
-
// action in <URLQueryController> from double-announcing.
|
|
125
|
-
useTitle(hasLoadedPost && title);
|
|
110
|
+
const postWithTemplate = !!contextPostId;
|
|
126
111
|
const loadingProgressId = useInstanceId(CanvasLoader, 'edit-site-editor__loading-progress');
|
|
127
112
|
const settings = useSpecificEditorSettings();
|
|
128
113
|
const styles = useMemo(() => [...settings.styles, {
|
|
@@ -131,6 +116,9 @@ export default function Editor({
|
|
|
131
116
|
|
|
132
117
|
css: `body{${canvasMode === 'view' ? `min-height: 100vh; ${currentPostIsTrashed ? '' : 'cursor: pointer;'}` : ''}}}`
|
|
133
118
|
}], [settings.styles, canvasMode, currentPostIsTrashed]);
|
|
119
|
+
const {
|
|
120
|
+
setCanvasMode
|
|
121
|
+
} = unlock(useDispatch(editSiteStore));
|
|
134
122
|
const {
|
|
135
123
|
createSuccessNotice
|
|
136
124
|
} = useDispatch(noticesStore);
|
|
@@ -169,35 +157,40 @@ export default function Editor({
|
|
|
169
157
|
break;
|
|
170
158
|
}
|
|
171
159
|
}, [history, createSuccessNotice]);
|
|
172
|
-
const isReady = !isLoading
|
|
160
|
+
const isReady = !isLoading;
|
|
173
161
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
174
162
|
children: [/*#__PURE__*/_jsx(GlobalStylesRenderer, {}), /*#__PURE__*/_jsx(EditorKeyboardShortcutsRegister, {}), isEditMode && /*#__PURE__*/_jsx(BlockKeyboardShortcuts, {}), showVisualEditor && /*#__PURE__*/_jsx(TemplatePartConverter, {}), !isReady ? /*#__PURE__*/_jsx(CanvasLoader, {
|
|
175
163
|
id: loadingProgressId
|
|
176
|
-
}) : null, isEditMode && /*#__PURE__*/_jsx(WelcomeGuide, {}),
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}), isReady && /*#__PURE__*/_jsxs(EditorProvider, {
|
|
181
|
-
post: postWithTemplate ? contextPost : editedPost,
|
|
182
|
-
__unstableTemplate: postWithTemplate ? editedPost : undefined,
|
|
164
|
+
}) : null, isEditMode && /*#__PURE__*/_jsx(WelcomeGuide, {}), isReady && /*#__PURE__*/_jsxs(Editor, {
|
|
165
|
+
postType: postWithTemplate ? contextPostType : editedPostType,
|
|
166
|
+
postId: postWithTemplate ? contextPostId : editedPostId,
|
|
167
|
+
templateId: postWithTemplate ? editedPostId : undefined,
|
|
183
168
|
settings: settings,
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
169
|
+
className: clsx('edit-site-editor__editor-interface', {
|
|
170
|
+
'show-icon-labels': showIconLabels
|
|
171
|
+
}),
|
|
172
|
+
styles: styles,
|
|
173
|
+
enableRegionNavigation: false,
|
|
174
|
+
customSaveButton: _isPreviewingTheme && /*#__PURE__*/_jsx(SaveButton, {
|
|
175
|
+
size: "compact"
|
|
176
|
+
}),
|
|
177
|
+
forceDisableBlockTools: !hasDefaultEditorCanvasView,
|
|
178
|
+
title: !hasDefaultEditorCanvasView ? getEditorCanvasContainerTitle(editorCanvasView) : undefined,
|
|
179
|
+
iframeProps: iframeProps,
|
|
180
|
+
onActionPerformed: onActionPerformed,
|
|
181
|
+
extraSidebarPanels: !isEditingPage && /*#__PURE__*/_jsx(PluginTemplateSettingPanel.Slot, {}),
|
|
182
|
+
children: [isEditMode && /*#__PURE__*/_jsx(BackButton, {
|
|
183
|
+
children: ({
|
|
184
|
+
length
|
|
185
|
+
}) => length <= 1 && /*#__PURE__*/_jsx(Button, {
|
|
186
|
+
label: __('Open Navigation'),
|
|
187
|
+
className: "edit-site-layout__view-mode-toggle",
|
|
188
|
+
onClick: () => setCanvasMode('view'),
|
|
189
|
+
children: /*#__PURE__*/_jsx(SiteIcon, {
|
|
190
|
+
className: "edit-site-layout__view-mode-toggle-icon"
|
|
191
|
+
})
|
|
192
|
+
})
|
|
193
|
+
}), /*#__PURE__*/_jsx(SiteEditorMoreMenu, {}), supportsGlobalStyles && /*#__PURE__*/_jsx(GlobalStylesSidebar, {})]
|
|
201
194
|
})]
|
|
202
195
|
});
|
|
203
196
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","useDispatch","useSelect","Notice","useInstanceId","EditorKeyboardShortcutsRegister","privateApis","editorPrivateApis","store","editorStore","__","sprintf","coreDataStore","blockLibraryPrivateApis","useCallback","useMemo","noticesStore","routerPrivateApis","preferencesStore","WelcomeGuide","editSiteStore","GlobalStylesRenderer","useTitle","CanvasLoader","unlock","useEditedEntityRecord","POST_TYPE_LABELS","TEMPLATE_POST_TYPE","TemplatePartConverter","useSpecificEditorSettings","PluginTemplateSettingPanel","GlobalStylesSidebar","isPreviewingTheme","getEditorCanvasContainerTitle","useHasEditorCanvasContainer","SaveButton","SiteEditorMoreMenu","useEditorIframeProps","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","EditorInterface","ExperimentalEditorProvider","EditorProvider","Sidebar","useHistory","BlockKeyboardShortcuts","Editor","isLoading","record","editedPost","getTitle","isLoaded","hasLoadedPost","type","editedPostType","context","contextPost","editorMode","canvasMode","isEditingPage","supportsGlobalStyles","showIconLabels","editorCanvasView","currentPostIsTrashed","select","getEditedPostContext","getCanvasMode","isPage","get","getEntityRecord","getCurrentTheme","getEditorMode","_context","postId","postType","undefined","is_block_theme","getEditorCanvasContainerView","getCurrentPostAttribute","_isPreviewingTheme","hasDefaultEditorCanvasView","iframeProps","isViewMode","isEditMode","showVisualEditor","postWithTemplate","title","_POST_TYPE_LABELS$edi","loadingProgressId","settings","styles","css","createSuccessNotice","history","onActionPerformed","actionId","items","push","newItem","_title","rendered","id","actions","label","onClick","canvas","isReady","children","status","isDismissible","post","__unstableTemplate","useSubRegistry","className","enableRegionNavigation","customSaveButton","size","forceDisableBlockTools","extraPanels","Slot"],"sources":["@wordpress/edit-site/src/components/editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Notice } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport useTitle from '../routes/use-title';\nimport CanvasLoader from '../canvas-loader';\nimport { unlock } from '../../lock-unlock';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport TemplatePartConverter from '../template-part-converter';\nimport { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';\nimport PluginTemplateSettingPanel from '../plugin-template-setting-panel';\nimport GlobalStylesSidebar from '../global-styles-sidebar';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\nimport {\n\tgetEditorCanvasContainerTitle,\n\tuseHasEditorCanvasContainer,\n} from '../editor-canvas-container';\nimport SaveButton from '../save-button';\nimport SiteEditorMoreMenu from '../more-menu';\nimport useEditorIframeProps from '../block-editor/use-editor-iframe-props';\n\nconst {\n\tEditorInterface,\n\tExperimentalEditorProvider: EditorProvider,\n\tSidebar,\n} = unlock( editorPrivateApis );\nconst { useHistory } = unlock( routerPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nexport default function Editor( { isLoading } ) {\n\tconst {\n\t\trecord: editedPost,\n\t\tgetTitle,\n\t\tisLoaded: hasLoadedPost,\n\t} = useEditedEntityRecord();\n\tconst { type: editedPostType } = editedPost;\n\tconst {\n\t\tcontext,\n\t\tcontextPost,\n\t\teditorMode,\n\t\tcanvasMode,\n\t\tisEditingPage,\n\t\tsupportsGlobalStyles,\n\t\tshowIconLabels,\n\t\teditorCanvasView,\n\t\tcurrentPostIsTrashed,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditedPostContext, getCanvasMode, isPage } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getEntityRecord, getCurrentTheme } = select( coreDataStore );\n\t\tconst { getEditorMode } = select( editorStore );\n\t\tconst _context = getEditedPostContext();\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tcontext: _context,\n\t\t\tcontextPost: _context?.postId\n\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t_context.postType,\n\t\t\t\t\t\t_context.postId\n\t\t\t\t )\n\t\t\t\t: undefined,\n\t\t\teditorMode: getEditorMode(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tisEditingPage: isPage(),\n\t\t\tsupportsGlobalStyles: getCurrentTheme()?.is_block_theme,\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\teditorCanvasView: unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView(),\n\t\t\tcurrentPostIsTrashed:\n\t\t\t\tselect( editorStore ).getCurrentPostAttribute( 'status' ) ===\n\t\t\t\t'trash',\n\t\t};\n\t}, [] );\n\tconst _isPreviewingTheme = isPreviewingTheme();\n\tconst hasDefaultEditorCanvasView = ! useHasEditorCanvasContainer();\n\tconst iframeProps = useEditorIframeProps();\n\n\tconst isViewMode = canvasMode === 'view';\n\tconst isEditMode = canvasMode === 'edit';\n\tconst showVisualEditor = isViewMode || editorMode === 'visual';\n\tconst postWithTemplate = !! context?.postId;\n\n\tlet title;\n\tif ( hasLoadedPost ) {\n\t\ttitle = sprintf(\n\t\t\t// translators: A breadcrumb trail for the Admin document title. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).\n\t\t\t__( '%1$s ‹ %2$s' ),\n\t\t\tgetTitle(),\n\t\t\tPOST_TYPE_LABELS[ editedPostType ] ??\n\t\t\t\tPOST_TYPE_LABELS[ TEMPLATE_POST_TYPE ]\n\t\t);\n\t}\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URLQueryController> from double-announcing.\n\tuseTitle( hasLoadedPost && title );\n\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst settings = useSpecificEditorSettings();\n\tconst styles = useMemo(\n\t\t() => [\n\t\t\t...settings.styles,\n\t\t\t{\n\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\n\t\t\t\tcss: `body{${\n\t\t\t\t\tcanvasMode === 'view'\n\t\t\t\t\t\t? `min-height: 100vh; ${\n\t\t\t\t\t\t\t\tcurrentPostIsTrashed ? '' : 'cursor: pointer;'\n\t\t\t\t\t\t }`\n\t\t\t\t\t\t: ''\n\t\t\t\t}}}`,\n\t\t\t},\n\t\t],\n\t\t[ settings.styles, canvasMode, currentPostIsTrashed ]\n\t);\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst history = useHistory();\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\tcase 'delete-post':\n\t\t\t\t\t{\n\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\tpostType: items[ 0 ].type,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst _title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post e.g: \"Post 1\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\t_title\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\t\t\t\t\tpostId: newItem.id,\n\t\t\t\t\t\t\t\t\t\t\t\tpostType: newItem.type,\n\t\t\t\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[ history, createSuccessNotice ]\n\t);\n\n\tconst isReady =\n\t\t! isLoading &&\n\t\t( ( postWithTemplate && !! contextPost && !! editedPost ) ||\n\t\t\t( ! postWithTemplate && !! editedPost ) );\n\n\treturn (\n\t\t<>\n\t\t\t<GlobalStylesRenderer />\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t{ isEditMode && <BlockKeyboardShortcuts /> }\n\t\t\t{ showVisualEditor && <TemplatePartConverter /> }\n\t\t\t{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }\n\t\t\t{ isEditMode && <WelcomeGuide /> }\n\t\t\t{ hasLoadedPost && ! editedPost && (\n\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t) }\n\t\t\t\t</Notice>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<EditorProvider\n\t\t\t\t\tpost={ postWithTemplate ? contextPost : editedPost }\n\t\t\t\t\t__unstableTemplate={\n\t\t\t\t\t\tpostWithTemplate ? editedPost : undefined\n\t\t\t\t\t}\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t>\n\t\t\t\t\t<SiteEditorMoreMenu />\n\t\t\t\t\t<EditorInterface\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t'edit-site-editor__interface-skeleton',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t\tenableRegionNavigation={ false }\n\t\t\t\t\t\tcustomSaveButton={\n\t\t\t\t\t\t\t_isPreviewingTheme && <SaveButton size=\"compact\" />\n\t\t\t\t\t\t}\n\t\t\t\t\t\tforceDisableBlockTools={ ! hasDefaultEditorCanvasView }\n\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\t! hasDefaultEditorCanvasView\n\t\t\t\t\t\t\t\t? getEditorCanvasContainerTitle(\n\t\t\t\t\t\t\t\t\t\teditorCanvasView\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\tiframeProps={ iframeProps }\n\t\t\t\t\t/>\n\t\t\t\t\t<Sidebar\n\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\textraPanels={\n\t\t\t\t\t\t\t! isEditingPage && (\n\t\t\t\t\t\t\t\t<PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t{ supportsGlobalStyles && <GlobalStylesSidebar /> }\n\t\t\t\t</EditorProvider>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;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EAAGA,QAAU;MACrBuB,cAAc,EAAG,KAAO;MAAAL,QAAA,gBAExBxE,IAAA,CAACH,kBAAkB,IAAE,CAAC,eACtBG,IAAA,CAACK,eAAe;QACfyE,SAAS,EAAGrH,IAAI,CACf,sCAAsC,EACtC;UACC,kBAAkB,EAAEiE;QACrB,CACD,CAAG;QACH6B,MAAM,EAAGA,MAAQ;QACjBwB,sBAAsB,EAAG,KAAO;QAChCC,gBAAgB,EACfpC,kBAAkB,iBAAI5C,IAAA,CAACJ,UAAU;UAACqF,IAAI,EAAC;QAAS,CAAE,CAClD;QACDC,sBAAsB,EAAG,CAAErC,0BAA4B;QACvDM,KAAK,EACJ,CAAEN,0BAA0B,GACzBnD,6BAA6B,CAC7BiC,gBACA,CAAC,GACDa,SACH;QACDM,WAAW,EAAGA;MAAa,CAC3B,CAAC,eACF9C,IAAA,CAACQ,OAAO;QACPmD,iBAAiB,EAAGA,iBAAmB;QACvCwB,WAAW,EACV,CAAE3D,aAAa,iBACdxB,IAAA,CAACT,0BAA0B,CAAC6F,IAAI,IAAE;MAEnC,CACD,CAAC,EACA3D,oBAAoB,iBAAIzB,IAAA,CAACR,mBAAmB,IAAE,CAAC;IAAA,CAClC,CAChB;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","useDispatch","useSelect","Button","useInstanceId","EditorKeyboardShortcutsRegister","privateApis","editorPrivateApis","store","editorStore","__","sprintf","coreDataStore","blockLibraryPrivateApis","useCallback","useMemo","noticesStore","routerPrivateApis","preferencesStore","WelcomeGuide","editSiteStore","GlobalStylesRenderer","CanvasLoader","unlock","TemplatePartConverter","useSpecificEditorSettings","PluginTemplateSettingPanel","GlobalStylesSidebar","isPreviewingTheme","getEditorCanvasContainerTitle","useHasEditorCanvasContainer","SaveButton","SiteEditorMoreMenu","SiteIcon","useEditorIframeProps","useEditorTitle","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","Editor","BackButton","useHistory","BlockKeyboardShortcuts","EditSiteEditor","isLoading","editedPostType","editedPostId","contextPostType","contextPostId","editorMode","canvasMode","isEditingPage","supportsGlobalStyles","showIconLabels","editorCanvasView","currentPostIsTrashed","select","getEditedPostContext","getCanvasMode","isPage","getEditedPostType","getEditedPostId","get","getCurrentTheme","getEditorMode","_context","postId","postType","undefined","is_block_theme","getEditorCanvasContainerView","getCurrentPostAttribute","_isPreviewingTheme","hasDefaultEditorCanvasView","iframeProps","isViewMode","isEditMode","showVisualEditor","postWithTemplate","loadingProgressId","settings","styles","css","setCanvasMode","createSuccessNotice","history","onActionPerformed","actionId","items","push","type","newItem","_title","title","rendered","id","actions","label","onClick","canvas","isReady","children","templateId","className","enableRegionNavigation","customSaveButton","size","forceDisableBlockTools","extraSidebarPanels","Slot","length"],"sources":["@wordpress/edit-site/src/components/editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport CanvasLoader from '../canvas-loader';\nimport { unlock } from '../../lock-unlock';\nimport TemplatePartConverter from '../template-part-converter';\nimport { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';\nimport PluginTemplateSettingPanel from '../plugin-template-setting-panel';\nimport GlobalStylesSidebar from '../global-styles-sidebar';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\nimport {\n\tgetEditorCanvasContainerTitle,\n\tuseHasEditorCanvasContainer,\n} from '../editor-canvas-container';\nimport SaveButton from '../save-button';\nimport SiteEditorMoreMenu from '../more-menu';\nimport SiteIcon from '../site-icon';\nimport useEditorIframeProps from '../block-editor/use-editor-iframe-props';\nimport useEditorTitle from './use-editor-title';\n\nconst { Editor, BackButton } = unlock( editorPrivateApis );\nconst { useHistory } = unlock( routerPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nexport default function EditSiteEditor( { isLoading } ) {\n\tconst {\n\t\teditedPostType,\n\t\teditedPostId,\n\t\tcontextPostType,\n\t\tcontextPostId,\n\t\teditorMode,\n\t\tcanvasMode,\n\t\tisEditingPage,\n\t\tsupportsGlobalStyles,\n\t\tshowIconLabels,\n\t\teditorCanvasView,\n\t\tcurrentPostIsTrashed,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEditedPostContext,\n\t\t\tgetCanvasMode,\n\t\t\tisPage,\n\t\t\tgetEditedPostType,\n\t\t\tgetEditedPostId,\n\t\t} = unlock( select( editSiteStore ) );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getCurrentTheme } = select( coreDataStore );\n\t\tconst { getEditorMode } = select( editorStore );\n\t\tconst _context = getEditedPostContext();\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\teditedPostType: getEditedPostType(),\n\t\t\teditedPostId: getEditedPostId(),\n\t\t\tcontextPostType: _context?.postId ? _context.postType : undefined,\n\t\t\tcontextPostId: _context?.postId ? _context.postId : undefined,\n\t\t\teditorMode: getEditorMode(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tisEditingPage: isPage(),\n\t\t\tsupportsGlobalStyles: getCurrentTheme()?.is_block_theme,\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\teditorCanvasView: unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView(),\n\t\t\tcurrentPostIsTrashed:\n\t\t\t\tselect( editorStore ).getCurrentPostAttribute( 'status' ) ===\n\t\t\t\t'trash',\n\t\t};\n\t}, [] );\n\tuseEditorTitle();\n\tconst _isPreviewingTheme = isPreviewingTheme();\n\tconst hasDefaultEditorCanvasView = ! useHasEditorCanvasContainer();\n\tconst iframeProps = useEditorIframeProps();\n\tconst isViewMode = canvasMode === 'view';\n\tconst isEditMode = canvasMode === 'edit';\n\tconst showVisualEditor = isViewMode || editorMode === 'visual';\n\tconst postWithTemplate = !! contextPostId;\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst settings = useSpecificEditorSettings();\n\tconst styles = useMemo(\n\t\t() => [\n\t\t\t...settings.styles,\n\t\t\t{\n\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\n\t\t\t\tcss: `body{${\n\t\t\t\t\tcanvasMode === 'view'\n\t\t\t\t\t\t? `min-height: 100vh; ${\n\t\t\t\t\t\t\t\tcurrentPostIsTrashed ? '' : 'cursor: pointer;'\n\t\t\t\t\t\t }`\n\t\t\t\t\t\t: ''\n\t\t\t\t}}}`,\n\t\t\t},\n\t\t],\n\t\t[ settings.styles, canvasMode, currentPostIsTrashed ]\n\t);\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst history = useHistory();\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\tcase 'delete-post':\n\t\t\t\t\t{\n\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\tpostType: items[ 0 ].type,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst _title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post e.g: \"Post 1\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\t_title\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\t\t\t\t\tpostId: newItem.id,\n\t\t\t\t\t\t\t\t\t\t\t\tpostType: newItem.type,\n\t\t\t\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[ history, createSuccessNotice ]\n\t);\n\n\tconst isReady = ! isLoading;\n\n\treturn (\n\t\t<>\n\t\t\t<GlobalStylesRenderer />\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t{ isEditMode && <BlockKeyboardShortcuts /> }\n\t\t\t{ showVisualEditor && <TemplatePartConverter /> }\n\t\t\t{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }\n\t\t\t{ isEditMode && <WelcomeGuide /> }\n\t\t\t{ isReady && (\n\t\t\t\t<Editor\n\t\t\t\t\tpostType={\n\t\t\t\t\t\tpostWithTemplate ? contextPostType : editedPostType\n\t\t\t\t\t}\n\t\t\t\t\tpostId={ postWithTemplate ? contextPostId : editedPostId }\n\t\t\t\t\ttemplateId={ postWithTemplate ? editedPostId : undefined }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tclassName={ clsx( 'edit-site-editor__editor-interface', {\n\t\t\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t\t\t} ) }\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tenableRegionNavigation={ false }\n\t\t\t\t\tcustomSaveButton={\n\t\t\t\t\t\t_isPreviewingTheme && <SaveButton size=\"compact\" />\n\t\t\t\t\t}\n\t\t\t\t\tforceDisableBlockTools={ ! hasDefaultEditorCanvasView }\n\t\t\t\t\ttitle={\n\t\t\t\t\t\t! hasDefaultEditorCanvasView\n\t\t\t\t\t\t\t? getEditorCanvasContainerTitle( editorCanvasView )\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tiframeProps={ iframeProps }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\textraSidebarPanels={\n\t\t\t\t\t\t! isEditingPage && <PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t<BackButton>\n\t\t\t\t\t\t\t{ ( { length } ) =>\n\t\t\t\t\t\t\t\tlength <= 1 && (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open Navigation' ) }\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-layout__view-mode-toggle\"\n\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\tsetCanvasMode( 'view' )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-layout__view-mode-toggle-icon\" />\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</BackButton>\n\t\t\t\t\t) }\n\t\t\t\t\t<SiteEditorMoreMenu />\n\t\t\t\t\t{ supportsGlobalStyles && <GlobalStylesSidebar /> }\n\t\t\t\t</Editor>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SACCC,+BAA+B,EAC/BC,WAAW,IAAIC,iBAAiB,EAChCC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASH,KAAK,IAAII,aAAa,QAAQ,sBAAsB;AAC7D,SAASN,WAAW,IAAIO,uBAAuB,QAAQ,0BAA0B;AACjF,SAASC,WAAW,EAAEC,OAAO,QAAQ,oBAAoB;AACzD,SAASP,KAAK,IAAIQ,YAAY,QAAQ,oBAAoB;AAC1D,SAASV,WAAW,IAAIW,iBAAiB,QAAQ,mBAAmB;AACpE,SAAST,KAAK,IAAIU,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,SAASX,KAAK,IAAIY,aAAa,QAAQ,aAAa;AACpD,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,qBAAqB,MAAM,4BAA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AA,CAACN,UAAU;QAAC8E,IAAI,EAAC;MAAS,CAAE,CAClD;MACDC,sBAAsB,EAAG,CAAElC,0BAA4B;MACvDoB,KAAK,EACJ,CAAEpB,0BAA0B,GACzB/C,6BAA6B,CAAE4B,gBAAiB,CAAC,GACjDc,SACH;MACDM,WAAW,EAAGA,WAAa;MAC3BY,iBAAiB,EAAGA,iBAAmB;MACvCsB,kBAAkB,EACjB,CAAEzD,aAAa,iBAAIjB,IAAA,CAACX,0BAA0B,CAACsF,IAAI,IAAE,CACrD;MAAAR,QAAA,GAECzB,UAAU,iBACX1C,IAAA,CAACM,UAAU;QAAA6D,QAAA,EACRA,CAAE;UAAES;QAAO,CAAC,KACbA,MAAM,IAAI,CAAC,iBACV5E,IAAA,CAAClC,MAAM;UACNiG,KAAK,EAAG1F,EAAE,CAAE,iBAAkB,CAAG;UACjCgG,SAAS,EAAC,oCAAoC;UAC9CL,OAAO,EAAGA,CAAA,KACTf,aAAa,CAAE,MAAO,CACtB;UAAAkB,QAAA,eAEDnE,IAAA,CAACJ,QAAQ;YAACyE,SAAS,EAAC;UAAyC,CAAE;QAAC,CACzD;MACR,CAES,CACZ,eACDrE,IAAA,CAACL,kBAAkB,IAAE,CAAC,EACpBuB,oBAAoB,iBAAIlB,IAAA,CAACV,mBAAmB,IAAE,CAAC;IAAA,CAC1C,CACR;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
10
|
+
import useTitle from '../routes/use-title';
|
|
11
|
+
import { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';
|
|
12
|
+
function useEditorTitle() {
|
|
13
|
+
const {
|
|
14
|
+
record: editedPost,
|
|
15
|
+
getTitle,
|
|
16
|
+
isLoaded: hasLoadedPost
|
|
17
|
+
} = useEditedEntityRecord();
|
|
18
|
+
let title;
|
|
19
|
+
if (hasLoadedPost) {
|
|
20
|
+
var _POST_TYPE_LABELS$edi;
|
|
21
|
+
title = sprintf(
|
|
22
|
+
// translators: A breadcrumb trail for the Admin document title. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).
|
|
23
|
+
__('%1$s ‹ %2$s'), getTitle(), (_POST_TYPE_LABELS$edi = POST_TYPE_LABELS[editedPost.type]) !== null && _POST_TYPE_LABELS$edi !== void 0 ? _POST_TYPE_LABELS$edi : POST_TYPE_LABELS[TEMPLATE_POST_TYPE]);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Only announce the title once the editor is ready to prevent "Replace"
|
|
27
|
+
// action in <URLQueryController> from double-announcing.
|
|
28
|
+
useTitle(hasLoadedPost && title);
|
|
29
|
+
}
|
|
30
|
+
export default useEditorTitle;
|
|
31
|
+
//# sourceMappingURL=use-editor-title.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__","sprintf","useEditedEntityRecord","useTitle","POST_TYPE_LABELS","TEMPLATE_POST_TYPE","useEditorTitle","record","editedPost","getTitle","isLoaded","hasLoadedPost","title","_POST_TYPE_LABELS$edi","type"],"sources":["@wordpress/edit-site/src/components/editor/use-editor-title.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport useTitle from '../routes/use-title';\nimport { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nfunction useEditorTitle() {\n\tconst {\n\t\trecord: editedPost,\n\t\tgetTitle,\n\t\tisLoaded: hasLoadedPost,\n\t} = useEditedEntityRecord();\n\tlet title;\n\tif ( hasLoadedPost ) {\n\t\ttitle = sprintf(\n\t\t\t// translators: A breadcrumb trail for the Admin document title. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).\n\t\t\t__( '%1$s ‹ %2$s' ),\n\t\t\tgetTitle(),\n\t\t\tPOST_TYPE_LABELS[ editedPost.type ] ??\n\t\t\t\tPOST_TYPE_LABELS[ TEMPLATE_POST_TYPE ]\n\t\t);\n\t}\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URLQueryController> from double-announcing.\n\tuseTitle( hasLoadedPost && title );\n}\n\nexport default useEditorTitle;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,qBAAqB,MAAM,6BAA6B;AAC/D,OAAOC,QAAQ,MAAM,qBAAqB;AAC1C,SAASC,gBAAgB,EAAEC,kBAAkB,QAAQ,uBAAuB;AAE5E,SAASC,cAAcA,CAAA,EAAG;EACzB,MAAM;IACLC,MAAM,EAAEC,UAAU;IAClBC,QAAQ;IACRC,QAAQ,EAAEC;EACX,CAAC,GAAGT,qBAAqB,CAAC,CAAC;EAC3B,IAAIU,KAAK;EACT,IAAKD,aAAa,EAAG;IAAA,IAAAE,qBAAA;IACpBD,KAAK,GAAGX,OAAO;IACd;IACAD,EAAE,CAAE,aAAc,CAAC,EACnBS,QAAQ,CAAC,CAAC,GAAAI,qBAAA,GACVT,gBAAgB,CAAEI,UAAU,CAACM,IAAI,CAAE,cAAAD,qBAAA,cAAAA,qBAAA,GAClCT,gBAAgB,CAAEC,kBAAkB,CACtC,CAAC;EACF;;EAEA;EACA;EACAF,QAAQ,CAAEQ,aAAa,IAAIC,KAAM,CAAC;AACnC;AAEA,eAAeN,cAAc","ignoreList":[]}
|
|
@@ -30,7 +30,7 @@ function ScreenCSS() {
|
|
|
30
30
|
title: __('CSS'),
|
|
31
31
|
description: /*#__PURE__*/_jsxs(_Fragment, {
|
|
32
32
|
children: [description, /*#__PURE__*/_jsx(ExternalLink, {
|
|
33
|
-
href: "https://wordpress.org/
|
|
33
|
+
href: "https://developer.wordpress.org/advanced-administration/wordpress/css/",
|
|
34
34
|
className: "edit-site-global-styles-screen-css-help-link",
|
|
35
35
|
children: __('Learn more about CSS')
|
|
36
36
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","ExternalLink","privateApis","blockEditorPrivateApis","unlock","ScreenHeader","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useGlobalStyle","AdvancedPanel","StylesAdvancedPanel","ScreenCSS","description","style","undefined","shouldDecodeEncode","inheritedStyle","setStyle","children","title","href","className","value","onChange","inheritedValue"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-css.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ExternalLink } from '@wordpress/components';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport ScreenHeader from './header';\n\nconst { useGlobalStyle, AdvancedPanel: StylesAdvancedPanel } = unlock(\n\tblockEditorPrivateApis\n);\n\nfunction ScreenCSS() {\n\tconst description = __(\n\t\t'Add your own CSS to customize the appearance and layout of your site.'\n\t);\n\tconst [ style ] = useGlobalStyle( '', undefined, 'user', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ inheritedStyle, setStyle ] = useGlobalStyle( '', undefined, 'all', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'CSS' ) }\n\t\t\t\tdescription={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\thref=\"https://wordpress.org/
|
|
1
|
+
{"version":3,"names":["__","ExternalLink","privateApis","blockEditorPrivateApis","unlock","ScreenHeader","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useGlobalStyle","AdvancedPanel","StylesAdvancedPanel","ScreenCSS","description","style","undefined","shouldDecodeEncode","inheritedStyle","setStyle","children","title","href","className","value","onChange","inheritedValue"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-css.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ExternalLink } from '@wordpress/components';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport ScreenHeader from './header';\n\nconst { useGlobalStyle, AdvancedPanel: StylesAdvancedPanel } = unlock(\n\tblockEditorPrivateApis\n);\n\nfunction ScreenCSS() {\n\tconst description = __(\n\t\t'Add your own CSS to customize the appearance and layout of your site.'\n\t);\n\tconst [ style ] = useGlobalStyle( '', undefined, 'user', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ inheritedStyle, setStyle ] = useGlobalStyle( '', undefined, 'all', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'CSS' ) }\n\t\t\t\tdescription={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\thref=\"https://developer.wordpress.org/advanced-administration/wordpress/css/\"\n\t\t\t\t\t\t\tclassName=\"edit-site-global-styles-screen-css-help-link\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Learn more about CSS' ) }\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<div className=\"edit-site-global-styles-screen-css\">\n\t\t\t\t<StylesAdvancedPanel\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ScreenCSS;\n"],"mappings":"AAAA;AAC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rBO,cAAc,EAAGR;MAAgB,CACjC;IAAC,CACE,CAAC;EAAA,CACL,CAAC;AAEL;AAEA,eAAeL,SAAS","ignoreList":[]}
|
|
@@ -133,6 +133,7 @@ function RevisionsButtons({
|
|
|
133
133
|
"aria-current": isSelected,
|
|
134
134
|
children: [/*#__PURE__*/_jsx(Button, {
|
|
135
135
|
className: "edit-site-global-styles-screen-revisions__revision-button",
|
|
136
|
+
__experimentalIsFocusable: true,
|
|
136
137
|
disabled: isSelected,
|
|
137
138
|
onClick: () => {
|
|
138
139
|
onChange(revision);
|
|
@@ -168,7 +169,6 @@ function RevisionsButtons({
|
|
|
168
169
|
className: "edit-site-global-styles-screen-revisions__applied-text",
|
|
169
170
|
children: __('These styles are already applied to your site.')
|
|
170
171
|
}) : /*#__PURE__*/_jsx(Button, {
|
|
171
|
-
disabled: areStylesEqual,
|
|
172
172
|
size: "compact",
|
|
173
173
|
variant: "primary",
|
|
174
174
|
className: "edit-site-global-styles-screen-revisions__apply-button",
|