@wordpress/edit-site 6.12.0 → 6.12.1-next.082ed6819.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/build/components/add-new-template/utils.js +1 -2
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/app/index.js +0 -3
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +4 -12
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/editor/index.js +18 -27
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor/use-editor-title.js +13 -5
- package/build/components/editor/use-editor-title.js.map +1 -1
- package/build/components/editor/use-resolve-edited-entity.js +133 -0
- package/build/components/editor/use-resolve-edited-entity.js.map +1 -0
- package/build/components/editor-canvas-container/index.js +1 -1
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +8 -10
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/screen-block.js +18 -5
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +11 -5
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles-sidebar/index.js +17 -1
- package/build/components/global-styles-sidebar/index.js.map +1 -1
- package/build/components/page-patterns/header.js +2 -2
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +4 -8
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/post-edit/index.js +10 -12
- package/build/components/post-edit/index.js.map +1 -1
- package/build/components/post-list/index.js +3 -3
- package/build/components/post-list/index.js.map +1 -1
- package/build/components/posts-app/index.js +3 -4
- package/build/components/posts-app/index.js.map +1 -1
- package/build/components/posts-app-routes/home.js +48 -0
- package/build/components/posts-app-routes/home.js.map +1 -0
- package/build/components/posts-app-routes/index.js +37 -0
- package/build/components/posts-app-routes/index.js.map +1 -0
- package/build/components/posts-app-routes/posts-edit.js +44 -0
- package/build/components/posts-app-routes/posts-edit.js.map +1 -0
- package/build/components/posts-app-routes/posts-list-view-quick-edit.js +63 -0
- package/build/components/posts-app-routes/posts-list-view-quick-edit.js.map +1 -0
- package/build/components/posts-app-routes/posts-list-view.js +48 -0
- package/build/components/posts-app-routes/posts-list-view.js.map +1 -0
- package/build/components/posts-app-routes/posts-view-quick-edit.js +60 -0
- package/build/components/posts-app-routes/posts-view-quick-edit.js.map +1 -0
- package/build/components/posts-app-routes/posts-view.js +41 -0
- package/build/components/posts-app-routes/posts-view.js.map +1 -0
- package/build/components/sidebar-navigation-screen-details-footer/index.js +17 -23
- package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +4 -18
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +2 -3
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build/components/site-editor-routes/index.js +1 -2
- package/build/components/site-editor-routes/index.js.map +1 -1
- package/build/components/style-book/examples.js +24 -2
- package/build/components/style-book/examples.js.map +1 -1
- package/build/index.js +0 -9
- package/build/index.js.map +1 -1
- package/build/store/actions.js +13 -0
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +21 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +1 -2
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/app/index.js +0 -3
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +4 -12
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/editor/index.js +18 -27
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor/use-editor-title.js +13 -5
- package/build-module/components/editor/use-editor-title.js.map +1 -1
- package/build-module/components/editor/use-resolve-edited-entity.js +125 -0
- package/build-module/components/editor/use-resolve-edited-entity.js.map +1 -0
- package/build-module/components/editor-canvas-container/index.js +1 -1
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +8 -10
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +18 -5
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +11 -5
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/ui.js +1 -1
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles-sidebar/index.js +18 -2
- package/build-module/components/global-styles-sidebar/index.js.map +1 -1
- package/build-module/components/page-patterns/header.js +2 -2
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +4 -8
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/post-edit/index.js +9 -11
- package/build-module/components/post-edit/index.js.map +1 -1
- package/build-module/components/post-list/index.js +2 -2
- package/build-module/components/post-list/index.js.map +1 -1
- package/build-module/components/posts-app/index.js +3 -4
- package/build-module/components/posts-app/index.js.map +1 -1
- package/build-module/components/posts-app-routes/home.js +40 -0
- package/build-module/components/posts-app-routes/home.js.map +1 -0
- package/build-module/components/posts-app-routes/index.js +30 -0
- package/build-module/components/posts-app-routes/index.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-edit.js +36 -0
- package/build-module/components/posts-app-routes/posts-edit.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js +55 -0
- package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-list-view.js +40 -0
- package/build-module/components/posts-app-routes/posts-list-view.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-view-quick-edit.js +52 -0
- package/build-module/components/posts-app-routes/posts-view-quick-edit.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-view.js +33 -0
- package/build-module/components/posts-app-routes/posts-view.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js +20 -26
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +4 -18
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +3 -4
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build-module/components/site-editor-routes/index.js +1 -2
- package/build-module/components/site-editor-routes/index.js.map +1 -1
- package/build-module/components/style-book/examples.js +24 -2
- package/build-module/components/style-book/examples.js.map +1 -1
- package/build-module/index.js +1 -10
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +13 -0
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +21 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/posts-rtl.css +59 -18
- package/build-style/posts.css +59 -18
- package/build-style/style-rtl.css +74 -57
- package/build-style/style.css +74 -57
- package/package.json +38 -38
- package/src/components/add-new-template/utils.js +2 -2
- package/src/components/app/index.js +0 -3
- package/src/components/block-editor/use-site-editor-settings.js +7 -21
- package/src/components/editor/index.js +22 -33
- package/src/components/editor/use-editor-title.js +17 -4
- package/src/components/editor/use-resolve-edited-entity.js +132 -0
- package/src/components/editor-canvas-container/index.js +1 -1
- package/src/components/global-styles/block-preview-panel.js +10 -10
- package/src/components/global-styles/screen-block.js +26 -8
- package/src/components/global-styles/screen-style-variations.js +14 -5
- package/src/components/global-styles/ui.js +1 -1
- package/src/components/global-styles-sidebar/index.js +16 -2
- package/src/components/page-patterns/header.js +3 -2
- package/src/components/page-patterns/use-patterns.js +9 -7
- package/src/components/page-templates/style.scss +1 -0
- package/src/components/post-edit/index.js +10 -13
- package/src/components/post-list/index.js +1 -2
- package/src/components/posts-app/index.js +3 -4
- package/src/components/posts-app-routes/home.js +36 -0
- package/src/components/posts-app-routes/index.js +36 -0
- package/src/components/posts-app-routes/posts-edit.js +31 -0
- package/src/components/posts-app-routes/posts-list-view-quick-edit.js +52 -0
- package/src/components/posts-app-routes/posts-list-view.js +40 -0
- package/src/components/posts-app-routes/posts-view-quick-edit.js +49 -0
- package/src/components/posts-app-routes/posts-view.js +35 -0
- package/src/components/sidebar-navigation-screen/style.scss +7 -2
- package/src/components/sidebar-navigation-screen-details-footer/index.js +27 -38
- package/src/components/sidebar-navigation-screen-details-footer/style.scss +0 -4
- package/src/components/sidebar-navigation-screen-global-styles/index.js +8 -17
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +8 -0
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
- package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +4 -4
- package/src/components/site-editor-routes/README.md +2 -2
- package/src/components/site-editor-routes/index.js +0 -2
- package/src/components/site-hub/style.scss +1 -1
- package/src/components/style-book/examples.tsx +24 -2
- package/src/index.js +1 -13
- package/src/store/actions.js +15 -0
- package/src/store/selectors.js +24 -1
- package/src/style.scss +0 -2
- package/build/components/post-fields/index.js +0 -96
- package/build/components/post-fields/index.js.map +0 -1
- package/build/components/posts-app/router.js +0 -85
- package/build/components/posts-app/router.js.map +0 -1
- package/build/components/sidebar-navigation-screen-details-panel/index.js +0 -54
- package/build/components/sidebar-navigation-screen-details-panel/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -21
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +0 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -33
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +0 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -21
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +0 -1
- package/build/components/site-editor-routes/styles-edit.js +0 -33
- package/build/components/site-editor-routes/styles-edit.js.map +0 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -219
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +0 -1
- package/build-module/components/post-fields/index.js +0 -88
- package/build-module/components/post-fields/index.js.map +0 -1
- package/build-module/components/posts-app/router.js +0 -77
- package/build-module/components/posts-app/router.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/index.js +0 -29
- package/build-module/components/sidebar-navigation-screen-details-panel/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -14
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -25
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -14
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +0 -1
- package/build-module/components/site-editor-routes/styles-edit.js +0 -25
- package/build-module/components/site-editor-routes/styles-edit.js.map +0 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -212
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +0 -1
- package/src/components/post-fields/index.js +0 -107
- package/src/components/post-fields/style.scss +0 -3
- package/src/components/posts-app/router.js +0 -69
- package/src/components/sidebar-navigation-screen-details-panel/index.js +0 -40
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -14
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -31
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -14
- package/src/components/sidebar-navigation-screen-details-panel/style.scss +0 -26
- package/src/components/site-editor-routes/styles-edit.js +0 -26
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -257
- package/src/store/test/actions.js +0 -83
- package/src/store/test/reducer.js +0 -69
- package/src/store/test/selectors.js +0 -41
|
@@ -6,12 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = SidebarNavigationScreenDetailsFooter;
|
|
8
8
|
var _i18n = require("@wordpress/i18n");
|
|
9
|
-
var _date = require("@wordpress/date");
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
9
|
var _url = require("@wordpress/url");
|
|
12
10
|
var _components = require("@wordpress/components");
|
|
13
11
|
var _icons = require("@wordpress/icons");
|
|
14
|
-
var _sidebarNavigationScreenDetailsPanel = require("../sidebar-navigation-screen-details-panel");
|
|
15
12
|
var _sidebarNavigationItem = _interopRequireDefault(require("../sidebar-navigation-item"));
|
|
16
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
14
|
/**
|
|
@@ -24,9 +21,10 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
24
21
|
|
|
25
22
|
function SidebarNavigationScreenDetailsFooter({
|
|
26
23
|
record,
|
|
24
|
+
revisionsCount,
|
|
27
25
|
...otherProps
|
|
28
26
|
}) {
|
|
29
|
-
var _record$_links$predec
|
|
27
|
+
var _record$_links$predec;
|
|
30
28
|
/*
|
|
31
29
|
* There might be other items in the future,
|
|
32
30
|
* but for now it's just modified date.
|
|
@@ -35,8 +33,17 @@ function SidebarNavigationScreenDetailsFooter({
|
|
|
35
33
|
*/
|
|
36
34
|
const hrefProps = {};
|
|
37
35
|
const lastRevisionId = (_record$_links$predec = record?._links?.['predecessor-version']?.[0]?.id) !== null && _record$_links$predec !== void 0 ? _record$_links$predec : null;
|
|
38
|
-
|
|
39
|
-
//
|
|
36
|
+
|
|
37
|
+
// Use incoming prop first, then the record's version history, if available.
|
|
38
|
+
revisionsCount = revisionsCount || record?._links?.['version-history']?.[0]?.count || 0;
|
|
39
|
+
|
|
40
|
+
/*
|
|
41
|
+
* Enable the revisions link if there is a last revision and there is more than one revision.
|
|
42
|
+
* This link is used for theme assets, e.g., templates, which have no database record until they're edited.
|
|
43
|
+
* For these files there's only a "revision" after they're edited twice,
|
|
44
|
+
* which means the revision.php page won't display a proper diff.
|
|
45
|
+
* See: https://github.com/WordPress/gutenberg/issues/49164.
|
|
46
|
+
*/
|
|
40
47
|
if (lastRevisionId && revisionsCount > 1) {
|
|
41
48
|
hrefProps.href = (0, _url.addQueryArgs)('revision.php', {
|
|
42
49
|
revision: record?._links['predecessor-version'][0].id
|
|
@@ -44,27 +51,14 @@ function SidebarNavigationScreenDetailsFooter({
|
|
|
44
51
|
hrefProps.as = 'a';
|
|
45
52
|
}
|
|
46
53
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalItemGroup, {
|
|
54
|
+
size: "large",
|
|
47
55
|
className: "edit-site-sidebar-navigation-screen-details-footer",
|
|
48
56
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarNavigationItem.default, {
|
|
49
|
-
|
|
57
|
+
icon: _icons.backup,
|
|
50
58
|
...hrefProps,
|
|
51
59
|
...otherProps,
|
|
52
|
-
children:
|
|
53
|
-
|
|
54
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarNavigationScreenDetailsPanel.SidebarNavigationScreenDetailsPanelLabel, {
|
|
55
|
-
children: (0, _i18n.__)('Last modified')
|
|
56
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarNavigationScreenDetailsPanel.SidebarNavigationScreenDetailsPanelValue, {
|
|
57
|
-
children: (0, _element.createInterpolateElement)((0, _i18n.sprintf)(/* translators: %s: is the relative time when the post was last modified. */
|
|
58
|
-
(0, _i18n.__)('<time>%s</time>'), (0, _date.humanTimeDiff)(record.modified)), {
|
|
59
|
-
time: /*#__PURE__*/(0, _jsxRuntime.jsx)("time", {
|
|
60
|
-
dateTime: record.modified
|
|
61
|
-
})
|
|
62
|
-
})
|
|
63
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
|
|
64
|
-
className: "edit-site-sidebar-navigation-screen-details-footer__icon",
|
|
65
|
-
icon: _icons.backup
|
|
66
|
-
})]
|
|
67
|
-
})
|
|
60
|
+
children: (0, _i18n.sprintf)(/* translators: %d: Number of Styles revisions. */
|
|
61
|
+
(0, _i18n._n)('%d Revision', '%d Revisions', revisionsCount), revisionsCount)
|
|
68
62
|
})
|
|
69
63
|
});
|
|
70
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_url","_components","_icons","_sidebarNavigationItem","_interopRequireDefault","_jsxRuntime","SidebarNavigationScreenDetailsFooter","record","revisionsCount","otherProps","_record$_links$predec","hrefProps","lastRevisionId","_links","id","count","href","addQueryArgs","revision","as","jsx","__experimentalItemGroup","size","className","children","default","icon","backup","sprintf","_n"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-details-footer/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _n, sprintf } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { backup } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationItem from '../sidebar-navigation-item';\n\nexport default function SidebarNavigationScreenDetailsFooter( {\n\trecord,\n\trevisionsCount,\n\t...otherProps\n} ) {\n\t/*\n\t * There might be other items in the future,\n\t * but for now it's just modified date.\n\t * Later we might render a list of items and isolate\n\t * the following logic.\n\t */\n\tconst hrefProps = {};\n\tconst lastRevisionId =\n\t\trecord?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;\n\n\t// Use incoming prop first, then the record's version history, if available.\n\trevisionsCount =\n\t\trevisionsCount ||\n\t\trecord?._links?.[ 'version-history' ]?.[ 0 ]?.count ||\n\t\t0;\n\n\t/*\n\t * Enable the revisions link if there is a last revision and there is more than one revision.\n\t * This link is used for theme assets, e.g., templates, which have no database record until they're edited.\n\t * For these files there's only a \"revision\" after they're edited twice,\n\t * which means the revision.php page won't display a proper diff.\n\t * See: https://github.com/WordPress/gutenberg/issues/49164.\n\t */\n\tif ( lastRevisionId && revisionsCount > 1 ) {\n\t\threfProps.href = addQueryArgs( 'revision.php', {\n\t\t\trevision: record?._links[ 'predecessor-version' ][ 0 ].id,\n\t\t} );\n\t\threfProps.as = 'a';\n\t}\n\treturn (\n\t\t<ItemGroup\n\t\t\tsize=\"large\"\n\t\t\tclassName=\"edit-site-sidebar-navigation-screen-details-footer\"\n\t\t>\n\t\t\t<SidebarNavigationItem\n\t\t\t\ticon={ backup }\n\t\t\t\t{ ...hrefProps }\n\t\t\t\t{ ...otherProps }\n\t\t\t>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: %d: Number of Styles revisions. */\n\t\t\t\t\t_n( '%d Revision', '%d Revisions', revisionsCount ),\n\t\t\t\t\trevisionsCount\n\t\t\t\t) }\n\t\t\t</SidebarNavigationItem>\n\t\t</ItemGroup>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,sBAAA,GAAAC,sBAAA,CAAAL,OAAA;AAA+D,IAAAM,WAAA,GAAAN,OAAA;AAX/D;AACA;AACA;;AAMA;AACA;AACA;;AAGe,SAASO,oCAAoCA,CAAE;EAC7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revisions,
|
|
61
|
-
isLoading: isLoadingRevisions
|
|
61
|
+
isLoading: isLoadingRevisions,
|
|
62
|
+
revisionsCount
|
|
62
63
|
} = (0, _useGlobalStylesRevisions.default)();
|
|
63
64
|
const {
|
|
64
65
|
openGeneralSidebar
|
|
@@ -66,20 +67,6 @@ function SidebarNavigationScreenGlobalStyles() {
|
|
|
66
67
|
const {
|
|
67
68
|
setEditorCanvasContainerView
|
|
68
69
|
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
69
|
-
const {
|
|
70
|
-
revisionsCount
|
|
71
|
-
} = (0, _data.useSelect)(select => {
|
|
72
|
-
var _globalStyles$_links$;
|
|
73
|
-
const {
|
|
74
|
-
getEntityRecord,
|
|
75
|
-
__experimentalGetCurrentGlobalStylesId
|
|
76
|
-
} = select(_coreData.store);
|
|
77
|
-
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
|
|
78
|
-
const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined;
|
|
79
|
-
return {
|
|
80
|
-
revisionsCount: (_globalStyles$_links$ = globalStyles?._links?.['version-history']?.[0]?.count) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : 0
|
|
81
|
-
};
|
|
82
|
-
}, []);
|
|
83
70
|
const {
|
|
84
71
|
set: setPreference
|
|
85
72
|
} = (0, _data.useDispatch)(_preferences.store);
|
|
@@ -102,9 +89,7 @@ function SidebarNavigationScreenGlobalStyles() {
|
|
|
102
89
|
}, [openGlobalStyles, setEditorCanvasContainerView]);
|
|
103
90
|
|
|
104
91
|
// If there are no revisions, do not render a footer.
|
|
105
|
-
const
|
|
106
|
-
const modifiedDateTime = revisions?.[0]?.modified;
|
|
107
|
-
const shouldShowGlobalStylesFooter = hasRevisions && !isLoadingRevisions && modifiedDateTime;
|
|
92
|
+
const shouldShowGlobalStylesFooter = !!revisionsCount && !isLoadingRevisions;
|
|
108
93
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
109
94
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarNavigationScreen.default, {
|
|
110
95
|
title: (0, _i18n.__)('Design'),
|
|
@@ -115,6 +100,7 @@ function SidebarNavigationScreenGlobalStyles() {
|
|
|
115
100
|
}),
|
|
116
101
|
footer: shouldShowGlobalStylesFooter && /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarNavigationScreenDetailsFooter.default, {
|
|
117
102
|
record: revisions?.[0],
|
|
103
|
+
revisionsCount: revisionsCount,
|
|
118
104
|
onClick: openRevisions
|
|
119
105
|
})
|
|
120
106
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_data","_coreData","_element","_preferences","_router","_sidebarNavigationScreen","_interopRequireDefault","_lockUnlock","_store","_sidebarNavigationItem","_useGlobalStylesRevisions","_sidebarNavigationScreenDetailsFooter","_sidebarNavigationScreenMain","_jsxRuntime","useLocation","useHistory","unlock","routerPrivateApis","SidebarNavigationItemGlobalStyles","props","params","hasGlobalStyleVariations","useSelect","select","coreStore","__experimentalGetCurrentThemeGlobalStylesVariations","length","jsx","default","path","uid","startsWith","SidebarNavigationScreenGlobalStyles","history","revisions","isLoading","isLoadingRevisions","useGlobalStylesRevisions","openGeneralSidebar","useDispatch","editSiteStore","setEditorCanvasContainerView","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_data","_coreData","_element","_preferences","_router","_sidebarNavigationScreen","_interopRequireDefault","_lockUnlock","_store","_sidebarNavigationItem","_useGlobalStylesRevisions","_sidebarNavigationScreenDetailsFooter","_sidebarNavigationScreenMain","_jsxRuntime","useLocation","useHistory","unlock","routerPrivateApis","SidebarNavigationItemGlobalStyles","props","params","hasGlobalStyleVariations","useSelect","select","coreStore","__experimentalGetCurrentThemeGlobalStylesVariations","length","jsx","default","path","uid","startsWith","SidebarNavigationScreenGlobalStyles","history","revisions","isLoading","isLoadingRevisions","revisionsCount","useGlobalStylesRevisions","openGeneralSidebar","useDispatch","editSiteStore","setEditorCanvasContainerView","set","setPreference","preferencesStore","openGlobalStyles","useCallback","push","canvas","undefined","transition","Promise","all","openRevisions","shouldShowGlobalStylesFooter","Fragment","children","title","__","isRoot","description","content","MainSidebarNavigationContent","activeItem","footer","record","onClick"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useCallback } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\nimport { MainSidebarNavigationContent } from '../sidebar-navigation-screen-main';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { params } = useLocation();\n\tconst hasGlobalStyleVariations = useSelect(\n\t\t( select ) =>\n\t\t\t!! select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,\n\t\t[]\n\t);\n\tif ( hasGlobalStyleVariations ) {\n\t\treturn (\n\t\t\t<SidebarNavigationItem\n\t\t\t\t{ ...props }\n\t\t\t\tparams={ { path: '/wp_global_styles' } }\n\t\t\t\tuid=\"global-styles-navigation-item\"\n\t\t\t\taria-current={\n\t\t\t\t\tparams.path && params.path.startsWith( '/wp_global_styles' )\n\t\t\t\t}\n\t\t\t/>\n\t\t);\n\t}\n\treturn <SidebarNavigationItem { ...props } />;\n}\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst history = useHistory();\n\tconst { params } = useLocation();\n\tconst {\n\t\trevisions,\n\t\tisLoading: isLoadingRevisions,\n\t\trevisionsCount,\n\t} = useGlobalStylesRevisions();\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\thistory.push(\n\t\t\t{\n\t\t\t\t...params,\n\t\t\t\tcanvas: 'edit',\n\t\t\t},\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\ttransition: 'canvas-mode-edit-transition',\n\t\t\t}\n\t\t);\n\t\treturn Promise.all( [\n\t\t\tsetPreference( 'core', 'distractionFree', false ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ history, params, openGeneralSidebar, setPreference ] );\n\n\tconst openRevisions = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the global styles revisions once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. The global styles UI is responsible\n\t\t// for redirecting to the revisions screen once the editor canvas container\n\t\t// has been set to 'global-styles-revisions'.\n\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t}, [ openGlobalStyles, setEditorCanvasContainerView ] );\n\n\t// If there are no revisions, do not render a footer.\n\tconst shouldShowGlobalStylesFooter =\n\t\t!! revisionsCount && ! isLoadingRevisions;\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Design' ) }\n\t\t\t\tisRoot\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Customize the appearance of your website using the block editor.'\n\t\t\t\t) }\n\t\t\t\tcontent={\n\t\t\t\t\t<MainSidebarNavigationContent activeItem=\"styles-navigation-item\" />\n\t\t\t\t}\n\t\t\t\tfooter={\n\t\t\t\t\tshouldShowGlobalStylesF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AAC;EAE3D,MAAMU,aAAa,GAAG,IAAAP,oBAAW,EAAE,YAAY;IAC9C,MAAMD,gBAAgB,CAAC,CAAC;IACxB;IACA;IACA;IACA;IACAJ,4BAA4B,CAAE,yBAA0B,CAAC;EAC1D,CAAC,EAAE,CAAEI,gBAAgB,EAAEJ,4BAA4B,CAAG,CAAC;;EAEvD;EACA,MAAMa,4BAA4B,GACjC,CAAC,CAAElB,cAAc,IAAI,CAAED,kBAAkB;EAE1C,oBACC,IAAAvB,WAAA,CAAAc,GAAA,EAAAd,WAAA,CAAA2C,QAAA;IAAAC,QAAA,eACC,IAAA5C,WAAA,CAAAc,GAAA,EAACtB,wBAAA,CAAAuB,OAAuB;MACvB8B,KAAK,EAAG,IAAAC,QAAE,EAAE,QAAS,CAAG;MACxBC,MAAM;MACNC,WAAW,EAAG,IAAAF,QAAE,EACf,kEACD,CAAG;MACHG,OAAO,eACN,IAAAjD,WAAA,CAAAc,GAAA,EAACf,4BAAA,CAAAmD,4BAA4B;QAACC,UAAU,EAAC;MAAwB,CAAE,CACnE;MACDC,MAAM,EACLV,4BAA4B,iBAC3B,IAAA1C,WAAA,CAAAc,GAAA,EAAChB,qCAAA,CAAAiB,OAAoC;QACpCsC,MAAM,EAAGhC,SAAS,GAAI,CAAC,CAAI;QAC3BG,cAAc,EAAGA,cAAgB;QACjC8B,OAAO,EAAGb;MAAe,CACzB;IAEF,CACD;EAAC,CACD,CAAC;AAEL","ignoreList":[]}
|
|
@@ -74,7 +74,7 @@ function usePatternCategories() {
|
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
76
|
// If the pattern has no categories, add it to uncategorized.
|
|
77
|
-
if (!pattern.wp_pattern_category?.length || !pattern.wp_pattern_category
|
|
77
|
+
if (!pattern.wp_pattern_category?.length || !pattern.wp_pattern_category?.some(catId => userPatternCategories.find(cat => cat.id === catId))) {
|
|
78
78
|
categoryMap.uncategorized.count += 1;
|
|
79
79
|
}
|
|
80
80
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_i18n","_useDefaultPatternCategories","_interopRequireDefault","_useThemePatterns","_usePatterns","_constants","usePatternCategories","defaultCategories","useDefaultPatternCategories","push","name","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","label","__","themePatterns","useThemePatterns","patterns","userPatterns","categories","userPatternCategories","usePatterns","PATTERN_TYPES","user","patternCategories","useMemo","categoryMap","categoriesWithCounts","forEach","category","count","pattern","length","uncategorized","wp_pattern_category","catId","find","cat","id","some","sortedCategories","sort","a","b","localeCompare","unshift","PATTERN_USER_CATEGORY","PATTERN_DEFAULT_CATEGORY","description","hasPatterns"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useDefaultPatternCategories from './use-default-pattern-categories';\nimport useThemePatterns from './use-theme-patterns';\nimport usePatterns from '../page-patterns/use-patterns';\nimport {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_USER_CATEGORY,\n\tTEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n} from '../../utils/constants';\n\nexport default function usePatternCategories() {\n\tconst defaultCategories = useDefaultPatternCategories();\n\tdefaultCategories.push( {\n\t\tname: TEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n\t\tlabel: __( 'Uncategorized' ),\n\t} );\n\tconst themePatterns = useThemePatterns();\n\tconst { patterns: userPatterns, categories: userPatternCategories } =\n\t\tusePatterns( PATTERN_TYPES.user );\n\n\tconst patternCategories = useMemo( () => {\n\t\tconst categoryMap = {};\n\t\tconst categoriesWithCounts = [];\n\n\t\t// Create a map for easier counting of patterns in categories.\n\t\tdefaultCategories.forEach( ( category ) => {\n\t\t\tif ( ! categoryMap[ category.name ] ) {\n\t\t\t\tcategoryMap[ category.name ] = { ...category, count: 0 };\n\t\t\t}\n\t\t} );\n\t\tuserPatternCategories.forEach( ( category ) => {\n\t\t\tif ( ! categoryMap[ category.name ] ) {\n\t\t\t\tcategoryMap[ category.name ] = { ...category, count: 0 };\n\t\t\t}\n\t\t} );\n\n\t\t// Update the category counts to reflect theme registered patterns.\n\t\tthemePatterns.forEach( ( pattern ) => {\n\t\t\tpattern.categories?.forEach( ( category ) => {\n\t\t\t\tif ( categoryMap[ category ] ) {\n\t\t\t\t\tcategoryMap[ category ].count += 1;\n\t\t\t\t}\n\t\t\t} );\n\t\t\t// If the pattern has no categories, add it to uncategorized.\n\t\t\tif ( ! pattern.categories?.length ) {\n\t\t\t\tcategoryMap.uncategorized.count += 1;\n\t\t\t}\n\t\t} );\n\n\t\t// Update the category counts to reflect user registered patterns.\n\t\tuserPatterns.forEach( ( pattern ) => {\n\t\t\tpattern.wp_pattern_category?.forEach( ( catId ) => {\n\t\t\t\tconst category = userPatternCategories.find(\n\t\t\t\t\t( cat ) => cat.id === catId\n\t\t\t\t)?.name;\n\t\t\t\tif ( categoryMap[ category ] ) {\n\t\t\t\t\tcategoryMap[ category ].count += 1;\n\t\t\t\t}\n\t\t\t} );\n\t\t\t// If the pattern has no categories, add it to uncategorized.\n\t\t\tif (\n\t\t\t\t! pattern.wp_pattern_category?.length ||\n\t\t\t\t! pattern.wp_pattern_category
|
|
1
|
+
{"version":3,"names":["_element","require","_i18n","_useDefaultPatternCategories","_interopRequireDefault","_useThemePatterns","_usePatterns","_constants","usePatternCategories","defaultCategories","useDefaultPatternCategories","push","name","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","label","__","themePatterns","useThemePatterns","patterns","userPatterns","categories","userPatternCategories","usePatterns","PATTERN_TYPES","user","patternCategories","useMemo","categoryMap","categoriesWithCounts","forEach","category","count","pattern","length","uncategorized","wp_pattern_category","catId","find","cat","id","some","sortedCategories","sort","a","b","localeCompare","unshift","PATTERN_USER_CATEGORY","PATTERN_DEFAULT_CATEGORY","description","hasPatterns"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useDefaultPatternCategories from './use-default-pattern-categories';\nimport useThemePatterns from './use-theme-patterns';\nimport usePatterns from '../page-patterns/use-patterns';\nimport {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_USER_CATEGORY,\n\tTEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n} from '../../utils/constants';\n\nexport default function usePatternCategories() {\n\tconst defaultCategories = useDefaultPatternCategories();\n\tdefaultCategories.push( {\n\t\tname: TEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n\t\tlabel: __( 'Uncategorized' ),\n\t} );\n\tconst themePatterns = useThemePatterns();\n\tconst { patterns: userPatterns, categories: userPatternCategories } =\n\t\tusePatterns( PATTERN_TYPES.user );\n\n\tconst patternCategories = useMemo( () => {\n\t\tconst categoryMap = {};\n\t\tconst categoriesWithCounts = [];\n\n\t\t// Create a map for easier counting of patterns in categories.\n\t\tdefaultCategories.forEach( ( category ) => {\n\t\t\tif ( ! categoryMap[ category.name ] ) {\n\t\t\t\tcategoryMap[ category.name ] = { ...category, count: 0 };\n\t\t\t}\n\t\t} );\n\t\tuserPatternCategories.forEach( ( category ) => {\n\t\t\tif ( ! categoryMap[ category.name ] ) {\n\t\t\t\tcategoryMap[ category.name ] = { ...category, count: 0 };\n\t\t\t}\n\t\t} );\n\n\t\t// Update the category counts to reflect theme registered patterns.\n\t\tthemePatterns.forEach( ( pattern ) => {\n\t\t\tpattern.categories?.forEach( ( category ) => {\n\t\t\t\tif ( categoryMap[ category ] ) {\n\t\t\t\t\tcategoryMap[ category ].count += 1;\n\t\t\t\t}\n\t\t\t} );\n\t\t\t// If the pattern has no categories, add it to uncategorized.\n\t\t\tif ( ! pattern.categories?.length ) {\n\t\t\t\tcategoryMap.uncategorized.count += 1;\n\t\t\t}\n\t\t} );\n\n\t\t// Update the category counts to reflect user registered patterns.\n\t\tuserPatterns.forEach( ( pattern ) => {\n\t\t\tpattern.wp_pattern_category?.forEach( ( catId ) => {\n\t\t\t\tconst category = userPatternCategories.find(\n\t\t\t\t\t( cat ) => cat.id === catId\n\t\t\t\t)?.name;\n\t\t\t\tif ( categoryMap[ category ] ) {\n\t\t\t\t\tcategoryMap[ category ].count += 1;\n\t\t\t\t}\n\t\t\t} );\n\t\t\t// If the pattern has no categories, add it to uncategorized.\n\t\t\tif (\n\t\t\t\t! pattern.wp_pattern_category?.length ||\n\t\t\t\t! pattern.wp_pattern_category?.some( ( catId ) =>\n\t\t\t\t\tuserPatternCategories.find( ( cat ) => cat.id === catId )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tcategoryMap.uncategorized.count += 1;\n\t\t\t}\n\t\t} );\n\n\t\t// Filter categories so we only have those containing patterns.\n\t\t[ ...defaultCategories, ...userPatternCategories ].forEach(\n\t\t\t( category ) => {\n\t\t\t\tif (\n\t\t\t\t\tcategoryMap[ category.name ].count &&\n\t\t\t\t\t! categoriesWithCounts.find(\n\t\t\t\t\t\t( cat ) => cat.name === category.name\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tcategoriesWithCounts.push( categoryMap[ category.name ] );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\tconst sortedCategories = categoriesWithCounts.sort( ( a, b ) =>\n\t\t\ta.label.localeCompare( b.label )\n\t\t);\n\n\t\tsortedCategories.unshift( {\n\t\t\tname: PATTERN_USER_CATEGORY,\n\t\t\tlabel: __( 'My patterns' ),\n\t\t\tcount: userPatterns.length,\n\t\t} );\n\n\t\tsortedCategories.unshift( {\n\t\t\tname: PATTERN_DEFAULT_CATEGORY,\n\t\t\tlabel: __( 'All patterns' ),\n\t\t\tdescription: __( 'A list of all patterns from all sources.' ),\n\t\t\tcount: themePatterns.length + userPatterns.length,\n\t\t} );\n\n\t\treturn sortedCategories;\n\t}, [\n\t\tdefaultCategories,\n\t\tthemePatterns,\n\t\tuserPatternCategories,\n\t\tuserPatterns,\n\t] );\n\n\treturn { patternCategories, hasPatterns: !! patternCategories.length };\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,4BAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,YAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAZA;AACA;AACA;;AAIA;AACA;AACA;;AAWe,SAASO,oBAAoBA,CAAA,EAAG;EAC9C,MAAMC,iBAAiB,GAAG,IAAAC,oCAA2B,EAAC,CAAC;EACvDD,iBAAiB,CAACE,IAAI,CAAE;IACvBC,IAAI,EAAEC,8CAAmC;IACzCC,KAAK,EAAE,IAAAC,QAAE,EAAE,eAAgB;EAC5B,CAAE,CAAC;EACH,MAAMC,aAAa,GAAG,IAAAC,yBAAgB,EAAC,CAAC;EACxC,MAAM;IAAEC,QAAQ,EAAEC,YAAY;IAAEC,UAAU,EAAEC;EAAsB,CAAC,GAClE,IAAAC,oBAAW,EAAEC,wBAAa,CAACC,IAAK,CAAC;EAElC,MAAMC,iBAAiB,GAAG,IAAAC,gBAAO,EAAE,MAAM;IACxC,MAAMC,WAAW,GAAG,CAAC,CAAC;IACtB,MAAMC,oBAAoB,GAAG,EAAE;;IAE/B;IACAnB,iBAAiB,CAACoB,OAAO,CAAIC,QAAQ,IAAM;MAC1C,IAAK,CAAEH,WAAW,CAAEG,QAAQ,CAAClB,IAAI,CAAE,EAAG;QACrCe,WAAW,CAAEG,QAAQ,CAAClB,IAAI,CAAE,GAAG;UAAE,GAAGkB,QAAQ;UAAEC,KAAK,EAAE;QAAE,CAAC;MACzD;IACD,CAAE,CAAC;IACHV,qBAAqB,CAACQ,OAAO,CAAIC,QAAQ,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
|
exports.default = useTemplatePartAreas;
|
|
7
7
|
var _coreData = require("@wordpress/core-data");
|
|
8
8
|
var _data = require("@wordpress/data");
|
|
9
|
-
var _editor = require("@wordpress/editor");
|
|
10
9
|
var _constants = require("../../utils/constants");
|
|
11
10
|
/**
|
|
12
11
|
* WordPress dependencies
|
|
@@ -18,7 +17,7 @@ var _constants = require("../../utils/constants");
|
|
|
18
17
|
|
|
19
18
|
const useTemplatePartsGroupedByArea = items => {
|
|
20
19
|
const allItems = items || [];
|
|
21
|
-
const templatePartAreas = (0, _data.useSelect)(select => select(
|
|
20
|
+
const templatePartAreas = (0, _data.useSelect)(select => select(_coreData.store).getEntityRecord('root', '__unstableBase')?.default_template_part_areas || [], []);
|
|
22
21
|
|
|
23
22
|
// Create map of template areas ensuring that default areas are displayed before
|
|
24
23
|
// any custom registered template part areas.
|
|
@@ -34,7 +33,7 @@ const useTemplatePartsGroupedByArea = items => {
|
|
|
34
33
|
});
|
|
35
34
|
const groupedByArea = allItems.reduce((accumulator, item) => {
|
|
36
35
|
const key = accumulator[item.area] ? item.area : _constants.TEMPLATE_PART_AREA_DEFAULT_CATEGORY;
|
|
37
|
-
accumulator[key]
|
|
36
|
+
accumulator[key]?.templateParts?.push(item);
|
|
38
37
|
return accumulator;
|
|
39
38
|
}, knownAreas);
|
|
40
39
|
return groupedByArea;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_coreData","require","_data","
|
|
1
|
+
{"version":3,"names":["_coreData","require","_data","_constants","useTemplatePartsGroupedByArea","items","allItems","templatePartAreas","useSelect","select","coreStore","getEntityRecord","default_template_part_areas","knownAreas","header","footer","sidebar","uncategorized","forEach","templatePartArea","area","templateParts","groupedByArea","reduce","accumulator","item","key","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","push","useTemplatePartAreas","records","isResolving","isLoading","useEntityRecords","TEMPLATE_PART_POST_TYPE","per_page","hasTemplateParts","length"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../utils/constants';\n\nconst useTemplatePartsGroupedByArea = ( items ) => {\n\tconst allItems = items || [];\n\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t\t?.default_template_part_areas || [],\n\t\t[]\n\t);\n\n\t// Create map of template areas ensuring that default areas are displayed before\n\t// any custom registered template part areas.\n\tconst knownAreas = {\n\t\theader: {},\n\t\tfooter: {},\n\t\tsidebar: {},\n\t\tuncategorized: {},\n\t};\n\n\ttemplatePartAreas.forEach(\n\t\t( templatePartArea ) =>\n\t\t\t( knownAreas[ templatePartArea.area ] = {\n\t\t\t\t...templatePartArea,\n\t\t\t\ttemplateParts: [],\n\t\t\t} )\n\t);\n\n\tconst groupedByArea = allItems.reduce( ( accumulator, item ) => {\n\t\tconst key = accumulator[ item.area ]\n\t\t\t? item.area\n\t\t\t: TEMPLATE_PART_AREA_DEFAULT_CATEGORY;\n\t\taccumulator[ key ]?.templateParts?.push( item );\n\t\treturn accumulator;\n\t}, knownAreas );\n\n\treturn groupedByArea;\n};\n\nexport default function useTemplatePartAreas() {\n\tconst { records: templateParts, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\tTEMPLATE_PART_POST_TYPE,\n\t\t{ per_page: -1 }\n\t);\n\n\treturn {\n\t\thasTemplateParts: templateParts ? !! templateParts.length : false,\n\t\tisLoading,\n\t\ttemplatePartAreas: useTemplatePartsGroupedByArea( templateParts ),\n\t};\n}\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,UAA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CAAEA,aAAa,CAACgB,MAAM,GAAG,KAAK;IACjEL,SAAS;IACTzB,iBAAiB,EAAEH,6BAA6B,CAAEiB,aAAc;EACjE,CAAC;AACF","ignoreList":[]}
|
|
@@ -14,7 +14,6 @@ var _navigationView = require("./navigation-view");
|
|
|
14
14
|
var _navigationEdit = require("./navigation-edit");
|
|
15
15
|
var _navigationItemEdit = require("./navigation-item-edit");
|
|
16
16
|
var _navigationItemView = require("./navigation-item-view");
|
|
17
|
-
var _stylesEdit = require("./styles-edit");
|
|
18
17
|
var _stylesView = require("./styles-view");
|
|
19
18
|
var _patternsEdit = require("./patterns-edit");
|
|
20
19
|
var _patternsView = require("./patterns-view");
|
|
@@ -34,7 +33,7 @@ var _pagesViewQuickEdit = require("./pages-view-quick-edit");
|
|
|
34
33
|
* Internal dependencies
|
|
35
34
|
*/
|
|
36
35
|
|
|
37
|
-
const routes = [_pagesListViewQuickEdit.pagesListViewQuickEditRoute, _pagesListView.pagesListViewRoute, _pagesViewQuickEdit.pagesViewQuickEditRoute, _pagesView.pagesViewRoute, _pagesEdit.pagesEditRoute, _templatesEdit.templatesEditRoute, _templatesListView.templatesListViewRoute, _templatesView.templatesViewRoute, _patternsView.patternsViewRoute, _patternsEdit.patternsEditRoute, _stylesView.stylesViewRoute,
|
|
36
|
+
const routes = [_pagesListViewQuickEdit.pagesListViewQuickEditRoute, _pagesListView.pagesListViewRoute, _pagesViewQuickEdit.pagesViewQuickEditRoute, _pagesView.pagesViewRoute, _pagesEdit.pagesEditRoute, _templatesEdit.templatesEditRoute, _templatesListView.templatesListViewRoute, _templatesView.templatesViewRoute, _patternsView.patternsViewRoute, _patternsEdit.patternsEditRoute, _stylesView.stylesViewRoute, _navigationItemView.navigationItemViewRoute, _navigationItemEdit.navigationItemEditRoute, _navigationView.navigationViewRoute, _navigationEdit.navigationEditRoute, _homeView.homeViewRoute, _homeEdit.homeEditRoute];
|
|
38
37
|
function useRegisterSiteEditorRoutes() {
|
|
39
38
|
const registry = (0, _data.useRegistry)();
|
|
40
39
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_element","_lockUnlock","_store","_homeView","_homeEdit","_navigationView","_navigationEdit","_navigationItemEdit","_navigationItemView","
|
|
1
|
+
{"version":3,"names":["_data","require","_element","_lockUnlock","_store","_homeView","_homeEdit","_navigationView","_navigationEdit","_navigationItemEdit","_navigationItemView","_stylesView","_patternsEdit","_patternsView","_templatesEdit","_templatesListView","_templatesView","_pagesView","_pagesEdit","_pagesListView","_pagesListViewQuickEdit","_pagesViewQuickEdit","routes","pagesListViewQuickEditRoute","pagesListViewRoute","pagesViewQuickEditRoute","pagesViewRoute","pagesEditRoute","templatesEditRoute","templatesListViewRoute","templatesViewRoute","patternsViewRoute","patternsEditRoute","stylesViewRoute","navigationItemViewRoute","navigationItemEditRoute","navigationViewRoute","navigationEditRoute","homeViewRoute","homeEditRoute","useRegisterSiteEditorRoutes","registry","useRegistry","registerRoute","unlock","useDispatch","siteEditorStore","useEffect","batch","forEach"],"sources":["@wordpress/edit-site/src/components/site-editor-routes/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as siteEditorStore } from '../../store';\nimport { homeViewRoute } from './home-view';\nimport { homeEditRoute } from './home-edit';\nimport { navigationViewRoute } from './navigation-view';\nimport { navigationEditRoute } from './navigation-edit';\nimport { navigationItemEditRoute } from './navigation-item-edit';\nimport { navigationItemViewRoute } from './navigation-item-view';\nimport { stylesViewRoute } from './styles-view';\nimport { patternsEditRoute } from './patterns-edit';\nimport { patternsViewRoute } from './patterns-view';\nimport { templatesEditRoute } from './templates-edit';\nimport { templatesListViewRoute } from './templates-list-view';\nimport { templatesViewRoute } from './templates-view';\nimport { pagesViewRoute } from './pages-view';\nimport { pagesEditRoute } from './pages-edit';\nimport { pagesListViewRoute } from './pages-list-view';\nimport { pagesListViewQuickEditRoute } from './pages-list-view-quick-edit';\nimport { pagesViewQuickEditRoute } from './pages-view-quick-edit';\n\nconst routes = [\n\tpagesListViewQuickEditRoute,\n\tpagesListViewRoute,\n\tpagesViewQuickEditRoute,\n\tpagesViewRoute,\n\tpagesEditRoute,\n\ttemplatesEditRoute,\n\ttemplatesListViewRoute,\n\ttemplatesViewRoute,\n\tpatternsViewRoute,\n\tpatternsEditRoute,\n\tstylesViewRoute,\n\tnavigationItemViewRoute,\n\tnavigationItemEditRoute,\n\tnavigationViewRoute,\n\tnavigationEditRoute,\n\thomeViewRoute,\n\thomeEditRoute,\n];\n\nexport function useRegisterSiteEditorRoutes() {\n\tconst registry = useRegistry();\n\tconst { registerRoute } = unlock( useDispatch( siteEditorStore ) );\n\tuseEffect( () => {\n\t\tregistry.batch( () => {\n\t\t\troutes.forEach( registerRoute );\n\t\t} );\n\t}, [ registry, registerRoute ] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AACA,IAAAQ,mBAAA,GAAAR,OAAA;AACA,IAAAS,mBAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AACA,IAAAY,aAAA,GAAAZ,OAAA;AACA,IAAAa,cAAA,GAAAb,OAAA;AACA,IAAAc,kBAAA,GAAAd,OAAA;AACA,IAAAe,cAAA,GAAAf,OAAA;AACA,IAAAgB,UAAA,GAAAhB,OAAA;AACA,IAAAiB,UAAA,GAAAjB,OAAA;AACA,IAAAkB,cAAA,GAAAlB,OAAA;AACA,IAAAmB,uBAAA,GAAAnB,OAAA;AACA,IAAAoB,mBAAA,GAAApB,OAAA;AA3BA;AACA;AACA;;AAIA;AACA;AACA;;AAqBA,MAAMqB,MAAM,GAAG,CACdC,mDAA2B,EAC3BC,iCAAkB,EAClBC,2CAAuB,EACvBC,yBAAc,EACdC,yBAAc,EACdC,iCAAkB,EAClBC,yCAAsB,EACtBC,iCAAkB,EAClBC,+BAAiB,EACjBC,+BAAiB,EACjBC,2BAAe,EACfC,2CAAuB,EACvBC,2CAAuB,EACvBC,mCAAmB,EACnBC,mCAAmB,EACnBC,uBAAa,EACbC,uBAAa,CACb;AAEM,SAASC,2BAA2BA,CAAA,EAAG;EAC7C,MAAMC,QAAQ,GAAG,IAAAC,iBAAW,EAAC,CAAC;EAC9B,MAAM;IAAEC;EAAc,CAAC,GAAG,IAAAC,kBAAM,EAAE,IAAAC,iBAAW,EAAEC,YAAgB,CAAE,CAAC;EAClE,IAAAC,kBAAS,EAAE,MAAM;IAChBN,QAAQ,CAACO,KAAK,CAAE,MAAM;MACrB1B,MAAM,CAAC2B,OAAO,CAAEN,aAAc,CAAC;IAChC,CAAE,CAAC;EACJ,CAAC,EAAE,CAAEF,QAAQ,EAAEE,aAAa,CAAG,CAAC;AACjC","ignoreList":[]}
|
|
@@ -116,7 +116,18 @@ function getOverviewBlockExamples(colors) {
|
|
|
116
116
|
name: blockName,
|
|
117
117
|
title: blockType.title,
|
|
118
118
|
category: 'overview',
|
|
119
|
-
|
|
119
|
+
/*
|
|
120
|
+
* CSS generated from style attributes will take precedence over global styles CSS,
|
|
121
|
+
* so remove the style attribute from the example to ensure the example
|
|
122
|
+
* demonstrates changes to global styles.
|
|
123
|
+
*/
|
|
124
|
+
blocks: (0, _blocks.getBlockFromExample)(blockName, {
|
|
125
|
+
...blockType.example,
|
|
126
|
+
attributes: {
|
|
127
|
+
...blockType.example.attributes,
|
|
128
|
+
style: undefined
|
|
129
|
+
}
|
|
130
|
+
})
|
|
120
131
|
};
|
|
121
132
|
examples.push(blockExample);
|
|
122
133
|
}
|
|
@@ -142,7 +153,18 @@ function getExamples(colors) {
|
|
|
142
153
|
name: blockType.name,
|
|
143
154
|
title: blockType.title,
|
|
144
155
|
category: blockType.category,
|
|
145
|
-
|
|
156
|
+
/*
|
|
157
|
+
* CSS generated from style attributes will take precedence over global styles CSS,
|
|
158
|
+
* so remove the style attribute from the example to ensure the example
|
|
159
|
+
* demonstrates changes to global styles.
|
|
160
|
+
*/
|
|
161
|
+
blocks: (0, _blocks.getBlockFromExample)(blockType.name, {
|
|
162
|
+
...blockType.example,
|
|
163
|
+
attributes: {
|
|
164
|
+
...blockType.example.attributes,
|
|
165
|
+
style: undefined
|
|
166
|
+
}
|
|
167
|
+
})
|
|
146
168
|
}));
|
|
147
169
|
const isHeadingBlockRegistered = !!(0, _blocks.getBlockType)('core/heading');
|
|
148
170
|
if (!isHeadingBlockRegistered) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_blocks","_colorExamples","_interopRequireDefault","_duotoneExamples","_constants","_jsxRuntime","getColorExamples","colors","examples","STYLE_BOOK_COLOR_GROUPS","forEach","group","palette","type","find","origin","slug","example","name","title","category","content","jsx","default","duotones","push","getOverviewBlockExamples","themePalette","themeColorexample","__","headingBlock","createBlock","level","firstParagraphBlock","secondParagraphBlock","textExample","blocks","layout","columnCount","minimumColumnWidth","style","spacing","blockGap","otherBlockExamples","blockName","blockType","getBlockType","blockExample","getBlockFromExample","getExamples","nonHeadingBlockExamples","getBlockTypes","filter","supports","inserter","map","isHeadingBlockRegistered","headingsExample","sprintf","colorExamples","overviewBlockExamples"],"sources":["@wordpress/edit-site/src/components/style-book/examples.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tgetBlockType,\n\tgetBlockTypes,\n\tgetBlockFromExample,\n\tcreateBlock,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport type { BlockExample, ColorOrigin, MultiOriginPalettes } from './types';\nimport ColorExamples from './color-examples';\nimport DuotoneExamples from './duotone-examples';\nimport { STYLE_BOOK_COLOR_GROUPS } from './constants';\n\n/**\n * Returns examples color examples for each origin\n * e.g. Core (Default), Theme, and User.\n *\n * @param {MultiOriginPalettes} colors Global Styles color palettes per origin.\n * @return {BlockExample[]} An array of color block examples.\n */\nfunction getColorExamples( colors: MultiOriginPalettes ): BlockExample[] {\n\tif ( ! colors ) {\n\t\treturn [];\n\t}\n\n\tconst examples: BlockExample[] = [];\n\n\tSTYLE_BOOK_COLOR_GROUPS.forEach( ( group ) => {\n\t\tconst palette = colors[ group.type ].find(\n\t\t\t( origin: ColorOrigin ) => origin.slug === group.origin\n\t\t);\n\n\t\tif ( palette?.[ group.type ] ) {\n\t\t\tconst example: BlockExample = {\n\t\t\t\tname: group.slug,\n\t\t\t\ttitle: group.title,\n\t\t\t\tcategory: 'colors',\n\t\t\t};\n\t\t\tif ( group.type === 'duotones' ) {\n\t\t\t\texample.content = (\n\t\t\t\t\t<DuotoneExamples duotones={ palette[ group.type ] } />\n\t\t\t\t);\n\t\t\t\texamples.push( example );\n\t\t\t} else {\n\t\t\t\texample.content = (\n\t\t\t\t\t<ColorExamples\n\t\t\t\t\t\tcolors={ palette[ group.type ] }\n\t\t\t\t\t\ttype={ group.type }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t\texamples.push( example );\n\t\t\t}\n\t\t}\n\t} );\n\n\treturn examples;\n}\n\n/**\n * Returns examples for the overview page.\n *\n * @param {MultiOriginPalettes} colors Global Styles color palettes per origin.\n * @return {BlockExample[]} An array of block examples.\n */\nfunction getOverviewBlockExamples(\n\tcolors: MultiOriginPalettes\n): BlockExample[] {\n\tconst examples: BlockExample[] = [];\n\n\t// Get theme palette from colors.\n\tconst themePalette = colors.colors.find(\n\t\t( origin: ColorOrigin ) => origin.slug === 'theme'\n\t);\n\n\tif ( themePalette ) {\n\t\tconst themeColorexample: BlockExample = {\n\t\t\tname: 'theme-colors',\n\t\t\ttitle: __( 'Colors' ),\n\t\t\tcategory: 'overview',\n\t\t\tcontent: (\n\t\t\t\t<ColorExamples colors={ themePalette.colors } type={ colors } />\n\t\t\t),\n\t\t};\n\n\t\texamples.push( themeColorexample );\n\t}\n\n\tconst headingBlock = createBlock( 'core/heading', {\n\t\tcontent: __(\n\t\t\t`AaBbCcDdEeFfGgHhiiJjKkLIMmNnOoPpQakRrssTtUuVVWwXxxYyZzOl23356789X{(…)},2!*&:/A@HELFO™`\n\t\t),\n\t\tlevel: 1,\n\t} );\n\tconst firstParagraphBlock = createBlock( 'core/paragraph', {\n\t\tcontent: __(\n\t\t\t`A paragraph in a website refers to a distinct block of text that is used to present and organize information. It is a fundamental unit of content in web design and is typically composed of a group of related sentences or thoughts focused on a particular topic or idea. Paragraphs play a crucial role in improving the readability and user experience of a website. They break down the text into smaller, manageable chunks, allowing readers to scan the content more easily.`\n\t\t),\n\t} );\n\tconst secondParagraphBlock = createBlock( 'core/paragraph', {\n\t\tcontent: __(\n\t\t\t`Additionally, paragraphs help structure the flow of information and provide logical breaks between different concepts or pieces of information. In terms of formatting, paragraphs in websites are commonly denoted by a vertical gap or indentation between each block of text. This visual separation helps visually distinguish one paragraph from another, creating a clear and organized layout that guides the reader through the content smoothly.`\n\t\t),\n\t} );\n\n\tconst textExample = {\n\t\tname: 'typography',\n\t\ttitle: __( 'Typography' ),\n\t\tcategory: 'overview',\n\t\tblocks: [\n\t\t\theadingBlock,\n\t\t\tcreateBlock(\n\t\t\t\t'core/group',\n\t\t\t\t{\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\ttype: 'grid',\n\t\t\t\t\t\tcolumnCount: 2,\n\t\t\t\t\t\tminimumColumnWidth: '12rem',\n\t\t\t\t\t},\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\tspacing: {\n\t\t\t\t\t\t\tblockGap: '1.5rem',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t[ firstParagraphBlock, secondParagraphBlock ]\n\t\t\t),\n\t\t],\n\t};\n\texamples.push( textExample );\n\n\tconst otherBlockExamples = [\n\t\t'core/image',\n\t\t'core/separator',\n\t\t'core/buttons',\n\t\t'core/pullquote',\n\t\t'core/search',\n\t];\n\n\t// Get examples for other blocks and put them in order of above array.\n\totherBlockExamples.forEach( ( blockName ) => {\n\t\tconst blockType = getBlockType( blockName );\n\t\tif ( blockType && blockType.example ) {\n\t\t\tconst blockExample: BlockExample = {\n\t\t\t\tname: blockName,\n\t\t\t\ttitle: blockType.title,\n\t\t\t\tcategory: 'overview',\n\t\t\t\tblocks: getBlockFromExample( blockName, blockType.example ),\n\t\t\t};\n\t\t\texamples.push( blockExample );\n\t\t}\n\t} );\n\n\treturn examples;\n}\n\n/**\n * Returns a list of examples for registered block types.\n *\n * @param {MultiOriginPalettes} colors Global styles colors grouped by origin e.g. Core, Theme, and User.\n * @return {BlockExample[]} An array of block examples.\n */\nexport function getExamples( colors: MultiOriginPalettes ): BlockExample[] {\n\tconst nonHeadingBlockExamples = getBlockTypes()\n\t\t.filter( ( blockType ) => {\n\t\t\tconst { name, example, supports } = blockType;\n\t\t\treturn (\n\t\t\t\tname !== 'core/heading' &&\n\t\t\t\t!! example &&\n\t\t\t\tsupports?.inserter !== false\n\t\t\t);\n\t\t} )\n\t\t.map( ( blockType ) => ( {\n\t\t\tname: blockType.name,\n\t\t\ttitle: blockType.title,\n\t\t\tcategory: blockType.category,\n\t\t\tblocks: getBlockFromExample( blockType.name, blockType.example ),\n\t\t} ) );\n\tconst isHeadingBlockRegistered = !! getBlockType( 'core/heading' );\n\n\tif ( ! isHeadingBlockRegistered ) {\n\t\treturn nonHeadingBlockExamples;\n\t}\n\n\t// Use our own example for the Heading block so that we can show multiple\n\t// heading levels.\n\tconst headingsExample = {\n\t\tname: 'core/heading',\n\t\ttitle: __( 'Headings' ),\n\t\tcategory: 'text',\n\t\tblocks: [ 1, 2, 3, 4, 5, 6 ].map( ( level ) => {\n\t\t\treturn createBlock( 'core/heading', {\n\t\t\t\tcontent: sprintf(\n\t\t\t\t\t// translators: %d: heading level e.g: \"1\", \"2\", \"3\"\n\t\t\t\t\t__( 'Heading %d' ),\n\t\t\t\t\tlevel\n\t\t\t\t),\n\t\t\t\tlevel,\n\t\t\t} );\n\t\t} ),\n\t};\n\tconst colorExamples = getColorExamples( colors );\n\n\tconst overviewBlockExamples = getOverviewBlockExamples( colors );\n\n\treturn [\n\t\theadingsExample,\n\t\t...colorExamples,\n\t\t...nonHeadingBlockExamples,\n\t\t...overviewBlockExamples,\n\t];\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAWA,IAAAE,cAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAAsD,IAAAM,WAAA,GAAAN,OAAA;AAjBtD;AACA;AACA;;AASA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,SAASO,gBAAgBA,CAAEC,MAA2B,EAAmB;EACxE,IAAK,CAAEA,MAAM,EAAG;IACf,OAAO,EAAE;EACV;EAEA,MAAMC,QAAwB,GAAG,EAAE;EAEnCC,kCAAuB,CAACC,OAAO,CAAIC,KAAK,IAAM;IAC7C,MAAMC,OAAO,GAAGL,MAAM,CAAEI,KAAK,CAACE,IAAI,CAAE,CAACC,IAAI,CACtCC,MAAmB,IAAMA,MAAM,CAACC,IAAI,KAAKL,KAAK,CAACI,MAClD,CAAC;IAED,IAAKH,OAAO,GAAID,KAAK,CAACE,IAAI,CAAE,EAAG;MAC9B,MAAMI,OAAqB,GAAG;QAC7BC,IAAI,EAAEP,KAAK,CAACK,IAAI;QAChBG,KAAK,EAAER,KAAK,CAACQ,KAAK;QAClBC,QAAQ,EAAE;MACX,CAAC;MACD,IAAKT,KAAK,CAACE,IAAI,KAAK,UAAU,EAAG;QAChC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,IAAA7B,QAAE,EAAE,YAAa,CAAC,EAClBG,KACD,CAAC;QACDA;MACD,CAAE,CAAC;IACJ,CAAE;EACH,CAAC;EACD,MAAM2B,aAAa,GAAGrD,gBAAgB,CAAEC,MAAO,CAAC;EAEhD,MAAMqD,qBAAqB,GAAGlC,wBAAwB,CAAEnB,MAAO,CAAC;EAEhE,OAAO,CACNkD,eAAe,EACf,GAAGE,aAAa,EAChB,GAAGT,uBAAuB,EAC1B,GAAGU,qBAAqB,CACxB;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_blocks","_colorExamples","_interopRequireDefault","_duotoneExamples","_constants","_jsxRuntime","getColorExamples","colors","examples","STYLE_BOOK_COLOR_GROUPS","forEach","group","palette","type","find","origin","slug","example","name","title","category","content","jsx","default","duotones","push","getOverviewBlockExamples","themePalette","themeColorexample","__","headingBlock","createBlock","level","firstParagraphBlock","secondParagraphBlock","textExample","blocks","layout","columnCount","minimumColumnWidth","style","spacing","blockGap","otherBlockExamples","blockName","blockType","getBlockType","blockExample","getBlockFromExample","attributes","undefined","getExamples","nonHeadingBlockExamples","getBlockTypes","filter","supports","inserter","map","isHeadingBlockRegistered","headingsExample","sprintf","colorExamples","overviewBlockExamples"],"sources":["@wordpress/edit-site/src/components/style-book/examples.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tgetBlockType,\n\tgetBlockTypes,\n\tgetBlockFromExample,\n\tcreateBlock,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport type { BlockExample, ColorOrigin, MultiOriginPalettes } from './types';\nimport ColorExamples from './color-examples';\nimport DuotoneExamples from './duotone-examples';\nimport { STYLE_BOOK_COLOR_GROUPS } from './constants';\n\n/**\n * Returns examples color examples for each origin\n * e.g. Core (Default), Theme, and User.\n *\n * @param {MultiOriginPalettes} colors Global Styles color palettes per origin.\n * @return {BlockExample[]} An array of color block examples.\n */\nfunction getColorExamples( colors: MultiOriginPalettes ): BlockExample[] {\n\tif ( ! colors ) {\n\t\treturn [];\n\t}\n\n\tconst examples: BlockExample[] = [];\n\n\tSTYLE_BOOK_COLOR_GROUPS.forEach( ( group ) => {\n\t\tconst palette = colors[ group.type ].find(\n\t\t\t( origin: ColorOrigin ) => origin.slug === group.origin\n\t\t);\n\n\t\tif ( palette?.[ group.type ] ) {\n\t\t\tconst example: BlockExample = {\n\t\t\t\tname: group.slug,\n\t\t\t\ttitle: group.title,\n\t\t\t\tcategory: 'colors',\n\t\t\t};\n\t\t\tif ( group.type === 'duotones' ) {\n\t\t\t\texample.content = (\n\t\t\t\t\t<DuotoneExamples duotones={ palette[ group.type ] } />\n\t\t\t\t);\n\t\t\t\texamples.push( example );\n\t\t\t} else {\n\t\t\t\texample.content = (\n\t\t\t\t\t<ColorExamples\n\t\t\t\t\t\tcolors={ palette[ group.type ] }\n\t\t\t\t\t\ttype={ group.type }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t\texamples.push( example );\n\t\t\t}\n\t\t}\n\t} );\n\n\treturn examples;\n}\n\n/**\n * Returns examples for the overview page.\n *\n * @param {MultiOriginPalettes} colors Global Styles color palettes per origin.\n * @return {BlockExample[]} An array of block examples.\n */\nfunction getOverviewBlockExamples(\n\tcolors: MultiOriginPalettes\n): BlockExample[] {\n\tconst examples: BlockExample[] = [];\n\n\t// Get theme palette from colors.\n\tconst themePalette = colors.colors.find(\n\t\t( origin: ColorOrigin ) => origin.slug === 'theme'\n\t);\n\n\tif ( themePalette ) {\n\t\tconst themeColorexample: BlockExample = {\n\t\t\tname: 'theme-colors',\n\t\t\ttitle: __( 'Colors' ),\n\t\t\tcategory: 'overview',\n\t\t\tcontent: (\n\t\t\t\t<ColorExamples colors={ themePalette.colors } type={ colors } />\n\t\t\t),\n\t\t};\n\n\t\texamples.push( themeColorexample );\n\t}\n\n\tconst headingBlock = createBlock( 'core/heading', {\n\t\tcontent: __(\n\t\t\t`AaBbCcDdEeFfGgHhiiJjKkLIMmNnOoPpQakRrssTtUuVVWwXxxYyZzOl23356789X{(…)},2!*&:/A@HELFO™`\n\t\t),\n\t\tlevel: 1,\n\t} );\n\tconst firstParagraphBlock = createBlock( 'core/paragraph', {\n\t\tcontent: __(\n\t\t\t`A paragraph in a website refers to a distinct block of text that is used to present and organize information. It is a fundamental unit of content in web design and is typically composed of a group of related sentences or thoughts focused on a particular topic or idea. Paragraphs play a crucial role in improving the readability and user experience of a website. They break down the text into smaller, manageable chunks, allowing readers to scan the content more easily.`\n\t\t),\n\t} );\n\tconst secondParagraphBlock = createBlock( 'core/paragraph', {\n\t\tcontent: __(\n\t\t\t`Additionally, paragraphs help structure the flow of information and provide logical breaks between different concepts or pieces of information. In terms of formatting, paragraphs in websites are commonly denoted by a vertical gap or indentation between each block of text. This visual separation helps visually distinguish one paragraph from another, creating a clear and organized layout that guides the reader through the content smoothly.`\n\t\t),\n\t} );\n\n\tconst textExample = {\n\t\tname: 'typography',\n\t\ttitle: __( 'Typography' ),\n\t\tcategory: 'overview',\n\t\tblocks: [\n\t\t\theadingBlock,\n\t\t\tcreateBlock(\n\t\t\t\t'core/group',\n\t\t\t\t{\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\ttype: 'grid',\n\t\t\t\t\t\tcolumnCount: 2,\n\t\t\t\t\t\tminimumColumnWidth: '12rem',\n\t\t\t\t\t},\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\tspacing: {\n\t\t\t\t\t\t\tblockGap: '1.5rem',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t[ firstParagraphBlock, secondParagraphBlock ]\n\t\t\t),\n\t\t],\n\t};\n\texamples.push( textExample );\n\n\tconst otherBlockExamples = [\n\t\t'core/image',\n\t\t'core/separator',\n\t\t'core/buttons',\n\t\t'core/pullquote',\n\t\t'core/search',\n\t];\n\n\t// Get examples for other blocks and put them in order of above array.\n\totherBlockExamples.forEach( ( blockName ) => {\n\t\tconst blockType = getBlockType( blockName );\n\t\tif ( blockType && blockType.example ) {\n\t\t\tconst blockExample: BlockExample = {\n\t\t\t\tname: blockName,\n\t\t\t\ttitle: blockType.title,\n\t\t\t\tcategory: 'overview',\n\t\t\t\t/*\n\t\t\t\t * CSS generated from style attributes will take precedence over global styles CSS,\n\t\t\t\t * so remove the style attribute from the example to ensure the example\n\t\t\t\t * demonstrates changes to global styles.\n\t\t\t\t */\n\t\t\t\tblocks: getBlockFromExample( blockName, {\n\t\t\t\t\t...blockType.example,\n\t\t\t\t\tattributes: {\n\t\t\t\t\t\t...blockType.example.attributes,\n\t\t\t\t\t\tstyle: undefined,\n\t\t\t\t\t},\n\t\t\t\t} ),\n\t\t\t};\n\t\t\texamples.push( blockExample );\n\t\t}\n\t} );\n\n\treturn examples;\n}\n\n/**\n * Returns a list of examples for registered block types.\n *\n * @param {MultiOriginPalettes} colors Global styles colors grouped by origin e.g. Core, Theme, and User.\n * @return {BlockExample[]} An array of block examples.\n */\nexport function getExamples( colors: MultiOriginPalettes ): BlockExample[] {\n\tconst nonHeadingBlockExamples = getBlockTypes()\n\t\t.filter( ( blockType ) => {\n\t\t\tconst { name, example, supports } = blockType;\n\t\t\treturn (\n\t\t\t\tname !== 'core/heading' &&\n\t\t\t\t!! example &&\n\t\t\t\tsupports?.inserter !== false\n\t\t\t);\n\t\t} )\n\t\t.map( ( blockType ) => ( {\n\t\t\tname: blockType.name,\n\t\t\ttitle: blockType.title,\n\t\t\tcategory: blockType.category,\n\t\t\t/*\n\t\t\t * CSS generated from style attributes will take precedence over global styles CSS,\n\t\t\t * so remove the style attribute from the example to ensure the example\n\t\t\t * demonstrates changes to global styles.\n\t\t\t */\n\t\t\tblocks: getBlockFromExample( blockType.name, {\n\t\t\t\t...blockType.example,\n\t\t\t\tattributes: {\n\t\t\t\t\t...blockType.example.attributes,\n\t\t\t\t\tstyle: undefined,\n\t\t\t\t},\n\t\t\t} ),\n\t\t} ) );\n\tconst isHeadingBlockRegistered = !! getBlockType( 'core/heading' );\n\n\tif ( ! isHeadingBlockRegistered ) {\n\t\treturn nonHeadingBlockExamples;\n\t}\n\n\t// Use our own example for the Heading block so that we can show multiple\n\t// heading levels.\n\tconst headingsExample = {\n\t\tname: 'core/heading',\n\t\ttitle: __( 'Headings' ),\n\t\tcategory: 'text',\n\t\tblocks: [ 1, 2, 3, 4, 5, 6 ].map( ( level ) => {\n\t\t\treturn createBlock( 'core/heading', {\n\t\t\t\tcontent: sprintf(\n\t\t\t\t\t// translators: %d: heading level e.g: \"1\", \"2\", \"3\"\n\t\t\t\t\t__( 'Heading %d' ),\n\t\t\t\t\tlevel\n\t\t\t\t),\n\t\t\t\tlevel,\n\t\t\t} );\n\t\t} ),\n\t};\n\tconst colorExamples = getColorExamples( colors );\n\n\tconst overviewBlockExamples = getOverviewBlockExamples( colors );\n\n\treturn [\n\t\theadingsExample,\n\t\t...colorExamples,\n\t\t...nonHeadingBlockExamples,\n\t\t...overviewBlockExamples,\n\t];\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAWA,IAAAE,cAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAAsD,IAAAM,WAAA,GAAAN,OAAA;AAjBtD;AACA;AACA;;AASA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,SAASO,gBAAgBA,CAAEC,MAA2B,EAAmB;EACxE,IAAK,CAAEA,MAAM,EAAG;IACf,OAAO,EAAE;EACV;EAEA,MAAMC,QAAwB,GAAG,EAAE;EAEnCC,kCAAuB,CAACC,OAAO,CAAIC,KAAK,IAAM;IAC7C,MAAMC,OAAO,GAAGL,MAAM,CAAEI,KAAK,CAACE,IAAI,CAAE,CAACC,IAAI,CACtCC,MAAmB,IAAMA,MAAM,CAACC,IAAI,KAAKL,KAAK,CAACI,MAClD,CAAC;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ACD,CAAE;EACH,CAAC,CAAG,CAAC;EACN,MAAMQ,wBAAwB,GAAG,CAAC,CAAE,IAAAZ,oBAAY,EAAE,cAAe,CAAC;EAElE,IAAK,CAAEY,wBAAwB,EAAG;IACjC,OAAON,uBAAuB;EAC/B;;EAEA;EACA;EACA,MAAMO,eAAe,GAAG;IACvBzC,IAAI,EAAE,cAAc;IACpBC,KAAK,EAAE,IAAAU,QAAE,EAAE,UAAW,CAAC;IACvBT,QAAQ,EAAE,MAAM;IAChBgB,MAAM,EAAE,CAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAE,CAACqB,GAAG,CAAIzB,KAAK,IAAM;MAC9C,OAAO,IAAAD,mBAAW,EAAE,cAAc,EAAE;QACnCV,OAAO,EAAE,IAAAuC,aAAO;QACf;QACA,IAAA/B,QAAE,EAAE,YAAa,CAAC,EAClBG,KACD,CAAC;QACDA;MACD,CAAE,CAAC;IACJ,CAAE;EACH,CAAC;EACD,MAAM6B,aAAa,GAAGvD,gBAAgB,CAAEC,MAAO,CAAC;EAEhD,MAAMuD,qBAAqB,GAAGpC,wBAAwB,CAAEnB,MAAO,CAAC;EAEhE,OAAO,CACNoD,eAAe,EACf,GAAGE,aAAa,EAChB,GAAGT,uBAAuB,EAC1B,GAAGU,qBAAqB,CACxB;AACF","ignoreList":[]}
|
package/build/index.js
CHANGED
|
@@ -128,15 +128,6 @@ function initializeEditor(id, settings) {
|
|
|
128
128
|
}
|
|
129
129
|
(0, _data.dispatch)(_store.store).updateSettings(settings);
|
|
130
130
|
|
|
131
|
-
// Keep the defaultTemplateTypes in the core/editor settings too,
|
|
132
|
-
// so that they can be selected with core/editor selectors in any editor.
|
|
133
|
-
// This is needed because edit-site doesn't initialize with EditorProvider,
|
|
134
|
-
// which internally uses updateEditorSettings as well.
|
|
135
|
-
(0, _data.dispatch)(_editor.store).updateEditorSettings({
|
|
136
|
-
defaultTemplateTypes: settings.defaultTemplateTypes,
|
|
137
|
-
defaultTemplatePartAreas: settings.defaultTemplatePartAreas
|
|
138
|
-
});
|
|
139
|
-
|
|
140
131
|
// Prevent the default browser action for files dropped outside of dropzones.
|
|
141
132
|
window.addEventListener('dragover', e => e.preventDefault(), false);
|
|
142
133
|
window.addEventListener('drop', e => e.preventDefault(), false);
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_blockLibrary","_data","_deprecated","_interopRequireDefault","_element","_editor","_preferences","_widgets","_store","_lockUnlock","_app","_jsxRuntime","_pluginTemplateSettingPanel","_deprecated2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_posts","registerCoreBlockBindingsSources","unlock","editorPrivateApis","initializeEditor","id","settings","target","document","getElementById","root","createRoot","dispatch","blocksStore","reapplyBlockTypeFilters","coreBlocks","__experimentalGetCoreBlocks","filter","name","registerCoreBlocks","setFreeformFallbackBlockName","registerLegacyWidgetBlock","inserter","registerWidgetGroupBlock","globalThis","IS_GUTENBERG_PLUGIN","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","preferencesStore","setDefaults","welcomeGuide","welcomeGuideStyles","welcomeGuidePage","welcomeGuideTemplate","allowRightClickOverrides","distractionFree","editorMode","editorTool","fixedToolbar","focusMode","inactivePanels","keepCaretInsideBlock","openPanels","showBlockBreadcrumbs","showListViewByDefault","enableChoosePatternModal","window","__experimentalMediaProcessing","requireApproval","optimizeOnUpload","editSiteStore","updateSettings","
|
|
1
|
+
{"version":3,"names":["_blocks","require","_blockLibrary","_data","_deprecated","_interopRequireDefault","_element","_editor","_preferences","_widgets","_store","_lockUnlock","_app","_jsxRuntime","_pluginTemplateSettingPanel","_deprecated2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_posts","registerCoreBlockBindingsSources","unlock","editorPrivateApis","initializeEditor","id","settings","target","document","getElementById","root","createRoot","dispatch","blocksStore","reapplyBlockTypeFilters","coreBlocks","__experimentalGetCoreBlocks","filter","name","registerCoreBlocks","setFreeformFallbackBlockName","registerLegacyWidgetBlock","inserter","registerWidgetGroupBlock","globalThis","IS_GUTENBERG_PLUGIN","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","preferencesStore","setDefaults","welcomeGuide","welcomeGuideStyles","welcomeGuidePage","welcomeGuideTemplate","allowRightClickOverrides","distractionFree","editorMode","editorTool","fixedToolbar","focusMode","inactivePanels","keepCaretInsideBlock","openPanels","showBlockBreadcrumbs","showListViewByDefault","enableChoosePatternModal","window","__experimentalMediaProcessing","requireApproval","optimizeOnUpload","editSiteStore","updateSettings","addEventListener","e","preventDefault","render","jsx","StrictMode","children","default","reinitializeEditor","deprecated","since","version"],"sources":["@wordpress/edit-site/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot, StrictMode } from '@wordpress/element';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport { unlock } from './lock-unlock';\nimport App from './components/app';\n\nconst { registerCoreBlockBindingsSources } = unlock( editorPrivateApis );\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tregisterCoreBlockBindingsSources();\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\twelcomeGuidePage: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\tdistractionFree: false,\n\t\teditorMode: 'visual',\n\t\teditorTool: 'edit',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tinactivePanels: [],\n\t\tkeepCaretInsideBlock: false,\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowListViewByDefault: false,\n\t\tenableChoosePatternModal: true,\n\t} );\n\n\tif ( window.__experimentalMediaProcessing ) {\n\t\tdispatch( preferencesStore ).setDefaults( 'core/media', {\n\t\t\trequireApproval: true,\n\t\t\toptimizeOnUpload: true,\n\t\t} );\n\t}\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<App />\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editSite.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginTemplateSettingPanel } from './components/plugin-template-setting-panel';\nexport { store } from './store';\nexport * from './deprecated';\n\n// Temporary: While the posts dashboard is being iterated on\n// it's being built in the same package as the site editor.\nexport { initializePostsDashboard } from './posts';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAQAA,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AACA,IAAAW,IAAA,GAAAP,sBAAA,CAAAJ,OAAA;AAAmC,IAAAY,WAAA,GAAAZ,OAAA;AAkFnC,IAAAa,2BAAA,GAAAT,sBAAA,CAAAJ,OAAA;AAEA,IAAAc,YAAA,GAAAd,OAAA;AAAAe,MAAA,CAAAC,IAAA,CAAAF,YAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,YAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,YAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAIA,IAAAS,MAAA,GAAA3B,OAAA;AAjHA;AACA;AACA;;AAiBA;AACA;AACA;;AAMA,MAAM;E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EAAE,MAAM;IAClBC,YAAY,EAAE,KAAK;IACnBC,SAAS,EAAE,KAAK;IAChBC,cAAc,EAAE,EAAE;IAClBC,oBAAoB,EAAE,KAAK;IAC3BC,UAAU,EAAE,CAAE,aAAa,CAAE;IAC7BC,oBAAoB,EAAE,IAAI;IAC1BC,qBAAqB,EAAE,KAAK;IAC5BC,wBAAwB,EAAE;EAC3B,CAAE,CAAC;EAEH,IAAKC,MAAM,CAACC,6BAA6B,EAAG;IAC3C,IAAAnC,cAAQ,EAAEgB,kBAAiB,CAAC,CAACC,WAAW,CAAE,YAAY,EAAE;MACvDmB,eAAe,EAAE,IAAI;MACrBC,gBAAgB,EAAE;IACnB,CAAE,CAAC;EACJ;EAEA,IAAArC,cAAQ,EAAEsC,YAAc,CAAC,CAACC,cAAc,CAAE7C,QAAS,CAAC;;EAEpD;EACAwC,MAAM,CAACM,gBAAgB,CAAE,UAAU,EAAIC,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EACzER,MAAM,CAACM,gBAAgB,CAAE,MAAM,EAAIC,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EAErE5C,IAAI,CAAC6C,MAAM,cACV,IAAAtE,WAAA,CAAAuE,GAAA,EAAC9E,QAAA,CAAA+E,UAAU;IAAAC,QAAA,eACV,IAAAzE,WAAA,CAAAuE,GAAA,EAACxE,IAAA,CAAA2E,OAAG,IAAE;EAAC,CACI,CACb,CAAC;EAED,OAAOjD,IAAI;AACZ;AAEO,SAASkD,kBAAkBA,CAAA,EAAG;EACpC,IAAAC,mBAAU,EAAE,gCAAgC,EAAE;IAC7CC,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAMA;AACA","ignoreList":[]}
|
package/build/store/actions.js
CHANGED
|
@@ -144,12 +144,16 @@ const removeTemplate = template => ({
|
|
|
144
144
|
/**
|
|
145
145
|
* Action that sets a template part.
|
|
146
146
|
*
|
|
147
|
+
* @deprecated
|
|
147
148
|
* @param {string} templatePartId The template part ID.
|
|
148
149
|
*
|
|
149
150
|
* @return {Object} Action object.
|
|
150
151
|
*/
|
|
151
152
|
exports.removeTemplate = removeTemplate;
|
|
152
153
|
function setTemplatePart(templatePartId) {
|
|
154
|
+
(0, _deprecated.default)("dispatch( 'core/edit-site' ).setTemplatePart", {
|
|
155
|
+
since: '6.8'
|
|
156
|
+
});
|
|
153
157
|
return {
|
|
154
158
|
type: 'SET_EDITED_POST',
|
|
155
159
|
postType: _constants.TEMPLATE_PART_POST_TYPE,
|
|
@@ -160,11 +164,15 @@ function setTemplatePart(templatePartId) {
|
|
|
160
164
|
/**
|
|
161
165
|
* Action that sets a navigation menu.
|
|
162
166
|
*
|
|
167
|
+
* @deprecated
|
|
163
168
|
* @param {string} navigationMenuId The Navigation Menu Post ID.
|
|
164
169
|
*
|
|
165
170
|
* @return {Object} Action object.
|
|
166
171
|
*/
|
|
167
172
|
function setNavigationMenu(navigationMenuId) {
|
|
173
|
+
(0, _deprecated.default)("dispatch( 'core/edit-site' ).setNavigationMenu", {
|
|
174
|
+
since: '6.8'
|
|
175
|
+
});
|
|
168
176
|
return {
|
|
169
177
|
type: 'SET_EDITED_POST',
|
|
170
178
|
postType: _constants.NAVIGATION_POST_TYPE,
|
|
@@ -175,6 +183,7 @@ function setNavigationMenu(navigationMenuId) {
|
|
|
175
183
|
/**
|
|
176
184
|
* Action that sets an edited entity.
|
|
177
185
|
*
|
|
186
|
+
* @deprecated
|
|
178
187
|
* @param {string} postType The entity's post type.
|
|
179
188
|
* @param {string} postId The entity's ID.
|
|
180
189
|
* @param {Object} context The entity's context.
|
|
@@ -206,11 +215,15 @@ function setHomeTemplateId() {
|
|
|
206
215
|
/**
|
|
207
216
|
* Set's the current block editor context.
|
|
208
217
|
*
|
|
218
|
+
* @deprecated
|
|
209
219
|
* @param {Object} context The context object.
|
|
210
220
|
*
|
|
211
221
|
* @return {Object} Action object.
|
|
212
222
|
*/
|
|
213
223
|
function setEditedPostContext(context) {
|
|
224
|
+
(0, _deprecated.default)("dispatch( 'core/edit-site' ).setEditedPostContext", {
|
|
225
|
+
since: '6.8'
|
|
226
|
+
});
|
|
214
227
|
return {
|
|
215
228
|
type: 'SET_EDITED_POST_CONTEXT',
|
|
216
229
|
context
|