@wordpress/edit-site 5.5.0 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/components/add-new-template/new-template-part.js +3 -11
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +23 -17
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/add-new-template/utils.js +1 -1
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/app/index.js +4 -2
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +7 -9
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/editor/index.js +2 -4
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +20 -159
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +4 -6
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/hooks.js +0 -72
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/preview.js +3 -4
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +5 -7
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-border.js +13 -5
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +22 -211
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-root.js +2 -1
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +2 -1
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +4 -0
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +5 -0
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/ui.js +5 -35
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles-renderer/index.js +1 -2
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/layout/index.js +7 -0
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/added-by.js +128 -136
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/list/index.js +2 -1
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +6 -5
- package/build/components/list/table.js.map +1 -1
- package/build/components/routes/link.js +4 -1
- package/build/components/routes/link.js.map +1 -1
- package/build/components/save-button/index.js +2 -5
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +82 -0
- package/build/components/save-hub/index.js.map +1 -0
- package/build/components/secondary-sidebar/list-view-sidebar.js +6 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +2 -4
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +5 -2
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +13 -13
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +9 -14
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +87 -10
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +19 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +77 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
- package/build/components/sidebar-navigation-screen-template/index.js +59 -10
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +5 -2
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-hub/index.js +3 -1
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/start-template-options/index.js +44 -9
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/style-book/index.js +133 -19
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +9 -7
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-details/index.js +0 -3
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-part-converter/convert-to-regular.js +8 -12
- package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +2 -2
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/components/template-part-converter/index.js +19 -14
- package/build/components/template-part-converter/index.js.map +1 -1
- package/build/components/use-edited-entity-record/index.js +6 -6
- package/build/components/use-edited-entity-record/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/index.js +3 -0
- package/build/index.js.map +1 -1
- package/build/utils/history.js +8 -2
- package/build/utils/history.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +3 -9
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +25 -18
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +1 -1
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/app/index.js +3 -2
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +8 -10
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/editor/index.js +2 -3
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +21 -157
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +4 -4
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +0 -66
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/preview.js +3 -4
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +5 -5
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +11 -2
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +23 -208
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +2 -1
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +2 -1
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +4 -0
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +5 -0
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/ui.js +5 -30
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles-renderer/index.js +1 -2
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/layout/index.js +7 -0
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/added-by.js +126 -137
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/list/index.js +2 -1
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +6 -5
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/routes/link.js +5 -2
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/save-button/index.js +2 -5
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +68 -0
- package/build-module/components/save-hub/index.js.map +1 -0
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +6 -2
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +2 -4
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +5 -2
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +13 -13
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +13 -18
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +81 -10
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +11 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +66 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-template/index.js +60 -13
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -2
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +3 -1
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +45 -10
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/style-book/index.js +133 -21
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +9 -7
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-details/index.js +0 -3
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-regular.js +9 -13
- package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +3 -3
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/components/template-part-converter/index.js +20 -15
- package/build-module/components/template-part-converter/index.js.map +1 -1
- package/build-module/components/use-edited-entity-record/index.js +6 -6
- package/build-module/components/use-edited-entity-record/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/index.js +4 -1
- package/build-module/index.js.map +1 -1
- package/build-module/utils/history.js +9 -3
- package/build-module/utils/history.js.map +1 -1
- package/build-style/style-rtl.css +172 -128
- package/build-style/style.css +172 -128
- package/package.json +31 -31
- package/src/components/add-new-template/new-template-part.js +1 -6
- package/src/components/add-new-template/new-template.js +60 -38
- package/src/components/add-new-template/style.scss +12 -1
- package/src/components/add-new-template/utils.js +1 -1
- package/src/components/app/index.js +9 -6
- package/src/components/block-editor/editor-canvas.js +13 -22
- package/src/components/editor/index.js +61 -65
- package/src/components/global-styles/border-panel.js +24 -199
- package/src/components/global-styles/context-menu.js +4 -4
- package/src/components/global-styles/hooks.js +0 -101
- package/src/components/global-styles/preview.js +1 -1
- package/src/components/global-styles/screen-block-list.js +4 -4
- package/src/components/global-styles/screen-border.js +9 -2
- package/src/components/global-styles/screen-colors.js +25 -229
- package/src/components/global-styles/screen-root.js +1 -1
- package/src/components/global-styles/screen-style-variations.js +5 -1
- package/src/components/global-styles/screen-typography-element.js +4 -0
- package/src/components/global-styles/screen-typography.js +6 -0
- package/src/components/global-styles/stories/index.js +425 -0
- package/src/components/global-styles/style.scss +14 -18
- package/src/components/global-styles/ui.js +6 -31
- package/src/components/global-styles-renderer/index.js +1 -2
- package/src/components/layout/index.js +15 -0
- package/src/components/layout/style.scss +1 -3
- package/src/components/list/added-by.js +144 -140
- package/src/components/list/index.js +3 -1
- package/src/components/list/table.js +7 -4
- package/src/components/routes/link.js +9 -2
- package/src/components/save-button/index.js +2 -2
- package/src/components/save-hub/index.js +78 -0
- package/src/components/save-hub/style.scss +15 -0
- package/src/components/secondary-sidebar/list-view-sidebar.js +4 -3
- package/src/components/sidebar/index.js +2 -3
- package/src/components/sidebar/style.scss +4 -3
- package/src/components/sidebar-button/style.scss +2 -1
- package/src/components/sidebar-navigation-item/style.scss +1 -23
- package/src/components/sidebar-navigation-screen/index.js +6 -0
- package/src/components/sidebar-navigation-screen/style.scss +15 -0
- package/src/components/sidebar-navigation-screen-main/index.js +21 -8
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +30 -21
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +92 -9
- package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +9 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +78 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +108 -1
- package/src/components/sidebar-navigation-screen-template/index.js +82 -11
- package/src/components/sidebar-navigation-screen-template/style.scss +25 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +7 -0
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +12 -1
- package/src/components/site-hub/index.js +5 -1
- package/src/components/site-hub/style.scss +5 -1
- package/src/components/start-template-options/index.js +40 -8
- package/src/components/style-book/index.js +203 -54
- package/src/components/style-book/style.scss +2 -46
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +38 -8
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +12 -7
- package/src/components/template-details/index.js +0 -3
- package/src/components/template-part-converter/convert-to-regular.js +10 -17
- package/src/components/template-part-converter/convert-to-template-part.js +9 -16
- package/src/components/template-part-converter/index.js +28 -12
- package/src/components/use-edited-entity-record/index.js +26 -18
- package/src/hooks/push-changes-to-global-styles/index.js +1 -0
- package/src/index.js +5 -1
- package/src/store/test/actions.js +0 -2
- package/src/style.scss +2 -1
- package/src/utils/history.js +13 -9
- package/build/components/global-styles/color-utils.js +0 -17
- package/build/components/global-styles/color-utils.js.map +0 -1
- package/build/components/global-styles/screen-background-color.js +0 -114
- package/build/components/global-styles/screen-background-color.js.map +0 -1
- package/build/components/global-styles/screen-button-color.js +0 -88
- package/build/components/global-styles/screen-button-color.js.map +0 -1
- package/build/components/global-styles/screen-heading-color.js +0 -165
- package/build/components/global-styles/screen-heading-color.js.map +0 -1
- package/build/components/global-styles/screen-link-color.js +0 -105
- package/build/components/global-styles/screen-link-color.js.map +0 -1
- package/build/components/global-styles/screen-text-color.js +0 -71
- package/build/components/global-styles/screen-text-color.js.map +0 -1
- package/build/components/navigation-inspector/index.js +0 -161
- package/build/components/navigation-inspector/index.js.map +0 -1
- package/build/components/navigation-inspector/navigation-menu.js +0 -79
- package/build/components/navigation-inspector/navigation-menu.js.map +0 -1
- package/build-module/components/global-styles/color-utils.js +0 -9
- package/build-module/components/global-styles/color-utils.js.map +0 -1
- package/build-module/components/global-styles/screen-background-color.js +0 -97
- package/build-module/components/global-styles/screen-background-color.js.map +0 -1
- package/build-module/components/global-styles/screen-button-color.js +0 -73
- package/build-module/components/global-styles/screen-button-color.js.map +0 -1
- package/build-module/components/global-styles/screen-heading-color.js +0 -149
- package/build-module/components/global-styles/screen-heading-color.js.map +0 -1
- package/build-module/components/global-styles/screen-link-color.js +0 -89
- package/build-module/components/global-styles/screen-link-color.js.map +0 -1
- package/build-module/components/global-styles/screen-text-color.js +0 -56
- package/build-module/components/global-styles/screen-text-color.js.map +0 -1
- package/build-module/components/navigation-inspector/index.js +0 -146
- package/build-module/components/navigation-inspector/index.js.map +0 -1
- package/build-module/components/navigation-inspector/navigation-menu.js +0 -69
- package/build-module/components/navigation-inspector/navigation-menu.js.map +0 -1
- package/src/components/global-styles/color-utils.js +0 -14
- package/src/components/global-styles/screen-background-color.js +0 -132
- package/src/components/global-styles/screen-button-color.js +0 -104
- package/src/components/global-styles/screen-heading-color.js +0 -206
- package/src/components/global-styles/screen-link-color.js +0 -124
- package/src/components/global-styles/screen-text-color.js +0 -62
- package/src/components/navigation-inspector/index.js +0 -191
- package/src/components/navigation-inspector/navigation-menu.js +0 -84
- package/src/components/navigation-inspector/style.scss +0 -46
|
@@ -15,6 +15,10 @@ var _data = require("@wordpress/data");
|
|
|
15
15
|
|
|
16
16
|
var _icons = require("@wordpress/icons");
|
|
17
17
|
|
|
18
|
+
var _components = require("@wordpress/components");
|
|
19
|
+
|
|
20
|
+
var _coreData = require("@wordpress/core-data");
|
|
21
|
+
|
|
18
22
|
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
19
23
|
|
|
20
24
|
var _useEditedEntityRecord = _interopRequireDefault(require("../use-edited-entity-record"));
|
|
@@ -25,6 +29,8 @@ var _store = require("../../store");
|
|
|
25
29
|
|
|
26
30
|
var _sidebarButton = _interopRequireDefault(require("../sidebar-button"));
|
|
27
31
|
|
|
32
|
+
var _addedBy = require("../list/added-by");
|
|
33
|
+
|
|
28
34
|
/**
|
|
29
35
|
* WordPress dependencies
|
|
30
36
|
*/
|
|
@@ -32,29 +38,72 @@ var _sidebarButton = _interopRequireDefault(require("../sidebar-button"));
|
|
|
32
38
|
/**
|
|
33
39
|
* Internal dependencies
|
|
34
40
|
*/
|
|
35
|
-
function
|
|
36
|
-
const {
|
|
37
|
-
setCanvasMode
|
|
38
|
-
} = (0, _privateApis.unlock)((0, _data.useDispatch)(_store.store));
|
|
41
|
+
function useTemplateTitleAndDescription(postType, postId) {
|
|
39
42
|
const {
|
|
40
43
|
getDescription,
|
|
41
44
|
getTitle,
|
|
42
45
|
record
|
|
43
|
-
} = (0, _useEditedEntityRecord.default)();
|
|
44
|
-
|
|
46
|
+
} = (0, _useEditedEntityRecord.default)(postType, postId);
|
|
47
|
+
const currentTheme = (0, _data.useSelect)(select => select(_coreData.store).getCurrentTheme(), []);
|
|
48
|
+
const addedBy = (0, _addedBy.useAddedBy)(postType, postId);
|
|
49
|
+
const isAddedByActiveTheme = addedBy.type === 'theme' && record.theme === (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.stylesheet);
|
|
50
|
+
const title = getTitle();
|
|
51
|
+
let descriptionText = getDescription();
|
|
45
52
|
|
|
46
|
-
if (!
|
|
47
|
-
|
|
53
|
+
if (!descriptionText && addedBy.text) {
|
|
54
|
+
if (record.type === 'wp_template' && record.is_custom) {
|
|
55
|
+
descriptionText = (0, _i18n.__)('This is a custom template that can be applied manually to any Post or Page.');
|
|
56
|
+
} else if (record.type === 'wp_template_part') {
|
|
57
|
+
descriptionText = (0, _i18n.sprintf)( // translators: %s: template part title e.g: "Header".
|
|
58
|
+
(0, _i18n.__)('This is your %s template part.'), getTitle());
|
|
59
|
+
}
|
|
48
60
|
}
|
|
49
61
|
|
|
62
|
+
const description = (0, _element.createElement)(_element.Fragment, null, descriptionText, addedBy.text && !isAddedByActiveTheme && (0, _element.createElement)("span", {
|
|
63
|
+
className: "edit-site-sidebar-navigation-screen-template__added-by-description"
|
|
64
|
+
}, (0, _element.createElement)("span", {
|
|
65
|
+
className: "edit-site-sidebar-navigation-screen-template__added-by-description-author"
|
|
66
|
+
}, (0, _element.createElement)("span", {
|
|
67
|
+
className: "edit-site-sidebar-navigation-screen-template__added-by-description-author-icon"
|
|
68
|
+
}, addedBy.imageUrl ? (0, _element.createElement)("img", {
|
|
69
|
+
src: addedBy.imageUrl,
|
|
70
|
+
alt: "",
|
|
71
|
+
width: "24",
|
|
72
|
+
height: "24"
|
|
73
|
+
}) : (0, _element.createElement)(_components.Icon, {
|
|
74
|
+
icon: addedBy.icon
|
|
75
|
+
})), addedBy.text), addedBy.isCustomized && (0, _element.createElement)("span", {
|
|
76
|
+
className: "edit-site-sidebar-navigation-screen-template__added-by-description-customized"
|
|
77
|
+
}, postType === 'wp_template' ? (0, _i18n._x)('(Customized)', 'template') : (0, _i18n._x)('(Customized)', 'template part'))));
|
|
78
|
+
return {
|
|
79
|
+
title,
|
|
80
|
+
description
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function SidebarNavigationScreenTemplate() {
|
|
85
|
+
const {
|
|
86
|
+
params
|
|
87
|
+
} = (0, _components.__experimentalUseNavigator)();
|
|
88
|
+
const {
|
|
89
|
+
postType,
|
|
90
|
+
postId
|
|
91
|
+
} = params;
|
|
92
|
+
const {
|
|
93
|
+
setCanvasMode
|
|
94
|
+
} = (0, _privateApis.unlock)((0, _data.useDispatch)(_store.store));
|
|
95
|
+
const {
|
|
96
|
+
title,
|
|
97
|
+
description
|
|
98
|
+
} = useTemplateTitleAndDescription(postType, postId);
|
|
50
99
|
return (0, _element.createElement)(_sidebarNavigationScreen.default, {
|
|
51
|
-
title:
|
|
100
|
+
title: title,
|
|
52
101
|
actions: (0, _element.createElement)(_sidebarButton.default, {
|
|
53
102
|
onClick: () => setCanvasMode('edit'),
|
|
54
103
|
label: (0, _i18n.__)('Edit'),
|
|
55
104
|
icon: _icons.pencil
|
|
56
105
|
}),
|
|
57
|
-
|
|
106
|
+
description: description
|
|
58
107
|
});
|
|
59
108
|
}
|
|
60
109
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"names":["useTemplateTitleAndDescription","postType","postId","getDescription","getTitle","record","currentTheme","select","coreStore","getCurrentTheme","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","descriptionText","text","is_custom","description","imageUrl","icon","isCustomized","SidebarNavigationScreenTemplate","params","setCanvasMode","editSiteStore","pencil"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AApBA;AACA;A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,QADf;AAEC,IAAA,GAAG,EAAC,EAFL;AAGC,IAAA,KAAK,EAAC,IAHP;AAIC,IAAA,MAAM,EAAC;AAJR,IADC,GAQD,4BAAC,gBAAD;AAAM,IAAA,IAAI,EAAGV,OAAO,CAACW;AAArB,IATF,CADD,EAaGX,OAAO,CAACO,IAbX,CADD,EAiBGP,OAAO,CAACY,YAAR,IACD;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGrB,QAAQ,KAAK,aAAb,GACC,cAAI,cAAJ,EAAoB,UAApB,CADD,GAEC,cAAI,cAAJ,EAAoB,eAApB,CAHJ,CAlBF,CAJF,CADD;AAkCA,SAAO;AAAEc,IAAAA,KAAF;AAASI,IAAAA;AAAT,GAAP;AACA;;AAEc,SAASI,+BAAT,GAA2C;AACzD,QAAM;AAAEC,IAAAA;AAAF,MAAa,6CAAnB;AACA,QAAM;AAAEvB,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAuBsB,MAA7B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAoB,yBAAQ,uBAAaC,YAAb,CAAR,CAA1B;AACA,QAAM;AAAEX,IAAAA,KAAF;AAASI,IAAAA;AAAT,MAAyBnB,8BAA8B,CAC5DC,QAD4D,EAE5DC,MAF4D,CAA7D;AAKA,SACC,4BAAC,gCAAD;AACC,IAAA,KAAK,EAAGa,KADT;AAEC,IAAA,OAAO,EACN,4BAAC,sBAAD;AACC,MAAA,OAAO,EAAG,MAAMU,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAG,cAAI,MAAJ,CAFT;AAGC,MAAA,IAAI,EAAGE;AAHR,MAHF;AASC,IAAA,WAAW,EAAGR;AATf,IADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf, _x } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { pencil } from '@wordpress/icons';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\tIcon,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport { useAddedBy } from '../list/added-by';\n\nfunction useTemplateTitleAndDescription( postType, postId ) {\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst currentTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme(),\n\t\t[]\n\t);\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet descriptionText = getDescription();\n\n\tif ( ! descriptionText && addedBy.text ) {\n\t\tif ( record.type === 'wp_template' && record.is_custom ) {\n\t\t\tdescriptionText = __(\n\t\t\t\t'This is a custom template that can be applied manually to any Post or Page.'\n\t\t\t);\n\t\t} else if ( record.type === 'wp_template_part' ) {\n\t\t\tdescriptionText = sprintf(\n\t\t\t\t// translators: %s: template part title e.g: \"Header\".\n\t\t\t\t__( 'This is your %s template part.' ),\n\t\t\t\tgetTitle()\n\t\t\t);\n\t\t}\n\t}\n\n\tconst description = (\n\t\t<>\n\t\t\t{ descriptionText }\n\n\t\t\t{ addedBy.text && ! isAddedByActiveTheme && (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description\">\n\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-author\">\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-author-icon\">\n\t\t\t\t\t\t\t{ addedBy.imageUrl ? (\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\tsrc={ addedBy.imageUrl }\n\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\twidth=\"24\"\n\t\t\t\t\t\t\t\t\theight=\"24\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Icon icon={ addedBy.icon } />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ addedBy.text }\n\t\t\t\t\t</span>\n\n\t\t\t\t\t{ addedBy.isCustomized && (\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-customized\">\n\t\t\t\t\t\t\t{ postType === 'wp_template'\n\t\t\t\t\t\t\t\t? _x( '(Customized)', 'template' )\n\t\t\t\t\t\t\t\t: _x( '(Customized)', 'template part' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</>\n\t);\n\n\treturn { title, description };\n}\n\nexport default function SidebarNavigationScreenTemplate() {\n\tconst { params } = useNavigator();\n\tconst { postType, postId } = params;\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { title, description } = useTemplateTitleAndDescription(\n\t\tpostType,\n\t\tpostId\n\t);\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ title }\n\t\t\tactions={\n\t\t\t\t<SidebarButton\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\ticon={ pencil }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tdescription={ description }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -48,7 +48,8 @@ const config = {
|
|
|
48
48
|
title: (0, _i18n.__)('Templates'),
|
|
49
49
|
loading: (0, _i18n.__)('Loading templates'),
|
|
50
50
|
notFound: (0, _i18n.__)('No templates found'),
|
|
51
|
-
manage: (0, _i18n.__)('Manage all templates')
|
|
51
|
+
manage: (0, _i18n.__)('Manage all templates'),
|
|
52
|
+
description: (0, _i18n.__)('Express the layout of your site with templates.')
|
|
52
53
|
}
|
|
53
54
|
},
|
|
54
55
|
wp_template_part: {
|
|
@@ -56,7 +57,8 @@ const config = {
|
|
|
56
57
|
title: (0, _i18n.__)('Template parts'),
|
|
57
58
|
loading: (0, _i18n.__)('Loading template parts'),
|
|
58
59
|
notFound: (0, _i18n.__)('No template parts found'),
|
|
59
|
-
manage: (0, _i18n.__)('Manage all template parts')
|
|
60
|
+
manage: (0, _i18n.__)('Manage all template parts'),
|
|
61
|
+
description: (0, _i18n.__)('Template Parts are small pieces of a layout that can be reused across multiple templates and always appear the same way. Common template parts include the site header, footer, or sidebar.')
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
64
|
};
|
|
@@ -100,6 +102,7 @@ function SidebarNavigationScreenTemplates() {
|
|
|
100
102
|
return (0, _element.createElement)(_sidebarNavigationScreen.default, {
|
|
101
103
|
isRoot: isTemplatePartsMode,
|
|
102
104
|
title: config[postType].labels.title,
|
|
105
|
+
description: config[postType].labels.description,
|
|
103
106
|
actions: canCreate && (0, _element.createElement)(_addNewTemplate.default, {
|
|
104
107
|
templateType: postType,
|
|
105
108
|
toggleProps: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"names":["config","wp_template","labels","title","loading","notFound","manage","wp_template_part","TemplateItem","postType","postId","props","linkInfo","SidebarNavigationScreenTemplates","params","isMobileViewport","isTemplatePartsMode","select","settings","editSiteStore","getSettings","supportsTemplatePartsMode","records","templates","isResolving","isLoading","per_page","sortedTemplates","sort","a","b","slug","localeCompare","browseAllLink","path","canCreate","as","SidebarButton","length","map","template","id","rendered"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAYA;AACA;AACA;AAQA,MAAMA,MAAM,GAAG;AACdC,EAAAA,WAAW,EAAE;AACZC,IAAAA,MAAM,EAAE;AACPC,MAAAA,KAAK,EAAE,cAAI,WAAJ,CADA;AAEPC,MAAAA,OAAO,EAAE,cAAI,mBAAJ,CAFF;AAGPC,MAAAA,QAAQ,EAAE,cAAI,oBAAJ,CAHH;AAIPC,MAAAA,MAAM,EAAE,cAAI,sBAAJ;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"names":["config","wp_template","labels","title","loading","notFound","manage","description","wp_template_part","TemplateItem","postType","postId","props","linkInfo","SidebarNavigationScreenTemplates","params","isMobileViewport","isTemplatePartsMode","select","settings","editSiteStore","getSettings","supportsTemplatePartsMode","records","templates","isResolving","isLoading","per_page","sortedTemplates","sort","a","b","slug","localeCompare","browseAllLink","path","canCreate","as","SidebarButton","length","map","template","id","rendered"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAYA;AACA;AACA;AAQA,MAAMA,MAAM,GAAG;AACdC,EAAAA,WAAW,EAAE;AACZC,IAAAA,MAAM,EAAE;AACPC,MAAAA,KAAK,EAAE,cAAI,WAAJ,CADA;AAEPC,MAAAA,OAAO,EAAE,cAAI,mBAAJ,CAFF;AAGPC,MAAAA,QAAQ,EAAE,cAAI,oBAAJ,CAHH;AAIPC,MAAAA,MAAM,EAAE,cAAI,sBAAJ,CAJD;AAKPC,MAAAA,WAAW,EAAE,cACZ,iDADY;AALN;AADI,GADC;AAYdC,EAAAA,gBAAgB,EAAE;AACjBN,IAAAA,MAAM,EAAE;AACPC,MAAAA,KAAK,EAAE,cAAI,gBAAJ,CADA;AAEPC,MAAAA,OAAO,EAAE,cAAI,wBAAJ,CAFF;AAGPC,MAAAA,QAAQ,EAAE,cAAI,yBAAJ,CAHH;AAIPC,MAAAA,MAAM,EAAE,cAAI,2BAAJ,CAJD;AAKPC,MAAAA,WAAW,EAAE,cACZ,6LADY;AALN;AADS;AAZJ,CAAf;;AAyBA,MAAME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imentalUseNavigator as useNavigator,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport AddNewTemplate from '../add-new-template';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\n\nconst config = {\n\twp_template: {\n\t\tlabels: {\n\t\t\ttitle: __( 'Templates' ),\n\t\t\tloading: __( 'Loading templates' ),\n\t\t\tnotFound: __( 'No templates found' ),\n\t\t\tmanage: __( 'Manage all templates' ),\n\t\t\tdescription: __(\n\t\t\t\t'Express the layout of your site with templates.'\n\t\t\t),\n\t\t},\n\t},\n\twp_template_part: {\n\t\tlabels: {\n\t\t\ttitle: __( 'Template parts' ),\n\t\t\tloading: __( 'Loading template parts' ),\n\t\t\tnotFound: __( 'No template parts found' ),\n\t\t\tmanage: __( 'Manage all template parts' ),\n\t\t\tdescription: __(\n\t\t\t\t'Template Parts are small pieces of a layout that can be reused across multiple templates and always appear the same way. Common template parts include the site header, footer, or sidebar.'\n\t\t\t),\n\t\t},\n\t},\n};\n\nconst TemplateItem = ( { postType, postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostType,\n\t\tpostId,\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenTemplates() {\n\tconst {\n\t\tparams: { postType },\n\t} = useNavigator();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isTemplatePartsMode = useSelect( ( select ) => {\n\t\tconst settings = select( editSiteStore ).getSettings();\n\n\t\treturn !! settings.supportsTemplatePartsMode;\n\t}, [] );\n\n\tconst { records: templates, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\tpostType,\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\tconst sortedTemplates = templates ? [ ...templates ] : [];\n\tsortedTemplates.sort( ( a, b ) => a.slug.localeCompare( b.slug ) );\n\n\tconst browseAllLink = useLink( {\n\t\tpath: '/' + postType + '/all',\n\t} );\n\n\tconst canCreate = ! isMobileViewport && ! isTemplatePartsMode;\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot={ isTemplatePartsMode }\n\t\t\ttitle={ config[ postType ].labels.title }\n\t\t\tdescription={ config[ postType ].labels.description }\n\t\t\tactions={\n\t\t\t\tcanCreate && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ postType }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tas: SidebarButton,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && config[ postType ].labels.loading }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t{ ! templates?.length && (\n\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t{ config[ postType ].labels.notFound }\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ sortedTemplates.map( ( template ) => (\n\t\t\t\t\t\t\t\t<TemplateItem\n\t\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\t\tpostId={ template.id }\n\t\t\t\t\t\t\t\t\tkey={ template.id }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\ttemplate.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\ttemplate.slug\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</TemplateItem>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-templates__see-all\"\n\t\t\t\t\t\t\t\t\t{ ...browseAllLink }\n\t\t\t\t\t\t\t\t\tchildren={\n\t\t\t\t\t\t\t\t\t\tconfig[ postType ].labels.manage\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</ItemGroup>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -24,10 +24,12 @@ var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-naviga
|
|
|
24
24
|
*/
|
|
25
25
|
const config = {
|
|
26
26
|
wp_template: {
|
|
27
|
-
title: (0, _i18n.__)('All templates')
|
|
27
|
+
title: (0, _i18n.__)('All templates'),
|
|
28
|
+
description: (0, _i18n.__)('Create new templates, or reset any customizations made to the templates supplied by your theme.')
|
|
28
29
|
},
|
|
29
30
|
wp_template_part: {
|
|
30
|
-
title: (0, _i18n.__)('All template parts')
|
|
31
|
+
title: (0, _i18n.__)('All template parts'),
|
|
32
|
+
description: (0, _i18n.__)('Create new template parts, or reset any customizations made to the template parts supplied by your theme.')
|
|
31
33
|
}
|
|
32
34
|
};
|
|
33
35
|
|
|
@@ -38,7 +40,8 @@ function SidebarNavigationScreenTemplatesBrowse() {
|
|
|
38
40
|
}
|
|
39
41
|
} = (0, _components.__experimentalUseNavigator)();
|
|
40
42
|
return (0, _element.createElement)(_sidebarNavigationScreen.default, {
|
|
41
|
-
title: config[postType].title
|
|
43
|
+
title: config[postType].title,
|
|
44
|
+
description: config[postType].description
|
|
42
45
|
});
|
|
43
46
|
}
|
|
44
47
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/index.js"],"names":["config","wp_template","title","wp_template_part","SidebarNavigationScreenTemplatesBrowse","params","postType"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGA,MAAMA,MAAM,GAAG;AACdC,EAAAA,WAAW,EAAE;AACZC,IAAAA,KAAK,EAAE,cAAI,eAAJ;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/index.js"],"names":["config","wp_template","title","description","wp_template_part","SidebarNavigationScreenTemplatesBrowse","params","postType"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGA,MAAMA,MAAM,GAAG;AACdC,EAAAA,WAAW,EAAE;AACZC,IAAAA,KAAK,EAAE,cAAI,eAAJ,CADK;AAEZC,IAAAA,WAAW,EAAE,cACZ,iGADY;AAFD,GADC;AAOdC,EAAAA,gBAAgB,EAAE;AACjBF,IAAAA,KAAK,EAAE,cAAI,oBAAJ,CADU;AAEjBC,IAAAA,WAAW,EAAE,cACZ,2GADY;AAFI;AAPJ,CAAf;;AAee,SAASE,sCAAT,GAAkD;AAChE,QAAM;AACLC,IAAAA,MAAM,EAAE;AAAEC,MAAAA;AAAF;AADH,MAEF,6CAFJ;AAGA,SACC,4BAAC,gCAAD;AACC,IAAA,KAAK,EAAGP,MAAM,CAAEO,QAAF,CAAN,CAAmBL,KAD5B;AAEC,IAAA,WAAW,EAAGF,MAAM,CAAEO,QAAF,CAAN,CAAmBJ;AAFlC,IADD;AAMA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\n\nconst config = {\n\twp_template: {\n\t\ttitle: __( 'All templates' ),\n\t\tdescription: __(\n\t\t\t'Create new templates, or reset any customizations made to the templates supplied by your theme.'\n\t\t),\n\t},\n\twp_template_part: {\n\t\ttitle: __( 'All template parts' ),\n\t\tdescription: __(\n\t\t\t'Create new template parts, or reset any customizations made to the template parts supplied by your theme.'\n\t\t),\n\t},\n};\n\nexport default function SidebarNavigationScreenTemplatesBrowse() {\n\tconst {\n\t\tparams: { postType },\n\t} = useNavigator();\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ config[ postType ].title }\n\t\t\tdescription={ config[ postType ].description }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -108,7 +108,9 @@ const SiteHub = (0, _element.forwardRef)((props, ref) => {
|
|
|
108
108
|
className: "edit-site-layout__view-mode-toggle"
|
|
109
109
|
}), (0, _element.createElement)(_siteIcon.default, {
|
|
110
110
|
className: "edit-site-layout__view-mode-toggle-icon"
|
|
111
|
-
}))), showLabels && (0, _element.createElement)("div",
|
|
111
|
+
}))), showLabels && (0, _element.createElement)("div", {
|
|
112
|
+
className: "edit-site-site-hub__site-title"
|
|
113
|
+
}, siteTitle)));
|
|
112
114
|
});
|
|
113
115
|
var _default = SiteHub;
|
|
114
116
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/site-hub/index.js"],"names":["HUB_ANIMATION_DURATION","SiteHub","props","ref","canvasMode","dashboardLink","select","editSiteStore","getEditedPostType","getCanvasMode","getSettings","__experimentalDashboardLink","disableMotion","setCanvasMode","clearSelectedBlock","blockEditorStore","isBackToDashboardButton","showLabels","siteIconButtonProps","href","label","onClick","siteTitle","coreStore","getEntityRecord","title","className","type","duration","ease"],"mappings":";;;;;;;;;AAkBA;;;;AAfA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;AAKA,MAAMA,sBAAsB,GAAG,GAA/B;AAEA,MAAMC,OAAO,GAAG,yBAAY,CAAEC,KAA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AAS,EAAG,yBAAY,oBAAZ,EAAkCA,KAAK,CAACwB,SAAxC,CAHb;AAIC,IAAA,MAAM,MAJP;AAKC,IAAA,UAAU,EAAG;AACZC,MAAAA,IAAI,EAAE,OADM;AAEZC,MAAAA,QAAQ,EAAEhB,aAAa,GAAG,CAAH,GAAOZ,sBAFlB;AAGZ6B,MAAAA,IAAI,EAAE;AAHM;AALd,MAWC,4BAAC,gCAAD;AACC,IAAA,OAAO,EAAC,YADT;AAEC,IAAA,SAAS,EAAC,kCAFX;AAGC,IAAA,OAAO,EAAC;AAHT,KAKC,4BAAC,4BAAD,CAAQ,GAAR;AACC,IAAA,SAAS,EAAC,gDADX;AAEC,IAAA,MAAM,MAFP;AAGC,IAAA,UAAU,EAAG;AACZF,MAAAA,IAAI,EAAE,OADM;AAEZC,MAAAA,QAAQ,EAAEhB,aAAa,GAAG,CAAH,GAAOZ,sBAFlB;AAGZ6B,MAAAA,IAAI,EAAE;AAHM;AAHd,KASC,4BAAC,kBAAD,6BACMX,mBADN;AAEC,IAAA,SAAS,EAAC;AAFX,MAIC,4BAAC,iBAAD;AAAU,IAAA,SAAS,EAAC;AAApB,IAJD,CATD,CALD,EAsBGD,UAAU,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/site-hub/index.js"],"names":["HUB_ANIMATION_DURATION","SiteHub","props","ref","canvasMode","dashboardLink","select","editSiteStore","getEditedPostType","getCanvasMode","getSettings","__experimentalDashboardLink","disableMotion","setCanvasMode","clearSelectedBlock","blockEditorStore","isBackToDashboardButton","showLabels","siteIconButtonProps","href","label","onClick","siteTitle","coreStore","getEntityRecord","title","className","type","duration","ease"],"mappings":";;;;;;;;;AAkBA;;;;AAfA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;AAKA,MAAMA,sBAAsB,GAAG,GAA/B;AAEA,MAAMC,OAAO,GAAG,yBAAY,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GC,IAAA,SAAS,EAAG,yBAAY,oBAAZ,EAAkCA,KAAK,CAACwB,SAAxC,CAHb;AAIC,IAAA,MAAM,MAJP;AAKC,IAAA,UAAU,EAAG;AACZC,MAAAA,IAAI,EAAE,OADM;AAEZC,MAAAA,QAAQ,EAAEhB,aAAa,GAAG,CAAH,GAAOZ,sBAFlB;AAGZ6B,MAAAA,IAAI,EAAE;AAHM;AALd,MAWC,4BAAC,gCAAD;AACC,IAAA,OAAO,EAAC,YADT;AAEC,IAAA,SAAS,EAAC,kCAFX;AAGC,IAAA,OAAO,EAAC;AAHT,KAKC,4BAAC,4BAAD,CAAQ,GAAR;AACC,IAAA,SAAS,EAAC,gDADX;AAEC,IAAA,MAAM,MAFP;AAGC,IAAA,UAAU,EAAG;AACZF,MAAAA,IAAI,EAAE,OADM;AAEZC,MAAAA,QAAQ,EAAEhB,aAAa,GAAG,CAAH,GAAOZ,sBAFlB;AAGZ6B,MAAAA,IAAI,EAAE;AAHM;AAHd,KASC,4BAAC,kBAAD,6BACMX,mBADN;AAEC,IAAA,SAAS,EAAC;AAFX,MAIC,4BAAC,iBAAD;AAAU,IAAA,SAAS,EAAC;AAApB,IAJD,CATD,CALD,EAsBGD,UAAU,IACX;AAAK,IAAA,SAAS,EAAC;AAAf,KACGK,SADH,CAvBF,CAXD,CADD;AA0CA,CA5Ee,CAAhB;eA8EerB,O","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__unstableMotion as motion,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport SiteIcon from '../site-icon';\nimport { unlock } from '../../private-apis';\n\nconst HUB_ANIMATION_DURATION = 0.3;\n\nconst SiteHub = forwardRef( ( props, ref ) => {\n\tconst { canvasMode, dashboardLink } = useSelect( ( select ) => {\n\t\tselect( editSiteStore ).getEditedPostType();\n\t\tconst { getCanvasMode, getSettings } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\treturn {\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tdashboardLink: getSettings().__experimentalDashboardLink,\n\t\t};\n\t}, [] );\n\tconst disableMotion = useReducedMotion();\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst isBackToDashboardButton = canvasMode === 'view';\n\tconst showLabels = canvasMode !== 'edit';\n\tconst siteIconButtonProps = isBackToDashboardButton\n\t\t? {\n\t\t\t\thref: dashboardLink || 'index.php',\n\t\t\t\t'aria-label': __( 'Go back to the dashboard' ),\n\t\t }\n\t\t: {\n\t\t\t\tlabel: __( 'Open Navigation Sidebar' ),\n\t\t\t\tonClick: () => {\n\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\tsetCanvasMode( 'view' );\n\t\t\t\t},\n\t\t };\n\tconst siteTitle = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'root', 'site' )?.title,\n\t\t[]\n\t);\n\n\treturn (\n\t\t<motion.div\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tclassName={ classnames( 'edit-site-site-hub', props.className ) }\n\t\t\tlayout\n\t\t\ttransition={ {\n\t\t\t\ttype: 'tween',\n\t\t\t\tduration: disableMotion ? 0 : HUB_ANIMATION_DURATION,\n\t\t\t\tease: 'easeOut',\n\t\t\t} }\n\t\t>\n\t\t\t<HStack\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tclassName=\"edit-site-site-hub__text-content\"\n\t\t\t\tspacing=\"0\"\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"edit-site-site-hub__view-mode-toggle-container\"\n\t\t\t\t\tlayout\n\t\t\t\t\ttransition={ {\n\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\tduration: disableMotion ? 0 : HUB_ANIMATION_DURATION,\n\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t{ ...siteIconButtonProps }\n\t\t\t\t\t\tclassName=\"edit-site-layout__view-mode-toggle\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<SiteIcon className=\"edit-site-layout__view-mode-toggle-icon\" />\n\t\t\t\t\t</Button>\n\t\t\t\t</motion.div>\n\n\t\t\t\t{ showLabels && (\n\t\t\t\t\t<div className=\"edit-site-site-hub__site-title\">\n\t\t\t\t\t\t{ siteTitle }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t</motion.div>\n\t);\n} );\n\nexport default SiteHub;\n"]}
|
|
@@ -60,6 +60,49 @@ function useFallbackTemplateContent(slug) {
|
|
|
60
60
|
|
|
61
61
|
const START_BLANK_TITLE = (0, _i18n.__)('Start blank');
|
|
62
62
|
|
|
63
|
+
function useStartPatterns(fallbackContent) {
|
|
64
|
+
const {
|
|
65
|
+
slug,
|
|
66
|
+
patterns
|
|
67
|
+
} = (0, _data.useSelect)(select => {
|
|
68
|
+
const {
|
|
69
|
+
getEditedPostType,
|
|
70
|
+
getEditedPostId
|
|
71
|
+
} = select(_store.store);
|
|
72
|
+
const {
|
|
73
|
+
getEntityRecord
|
|
74
|
+
} = select(_coreData.store);
|
|
75
|
+
const postId = getEditedPostId();
|
|
76
|
+
const postType = getEditedPostType();
|
|
77
|
+
const record = getEntityRecord('postType', postType, postId);
|
|
78
|
+
const {
|
|
79
|
+
getSettings
|
|
80
|
+
} = select(_blockEditor.store);
|
|
81
|
+
return {
|
|
82
|
+
slug: record.slug,
|
|
83
|
+
patterns: getSettings().__experimentalBlockPatterns
|
|
84
|
+
};
|
|
85
|
+
}, []);
|
|
86
|
+
return (0, _element.useMemo)(() => {
|
|
87
|
+
// filter patterns that are supposed to be used in the current template being edited.
|
|
88
|
+
return [{
|
|
89
|
+
name: 'fallback',
|
|
90
|
+
blocks: (0, _blocks.parse)(fallbackContent),
|
|
91
|
+
title: (0, _i18n.__)('Fallback content')
|
|
92
|
+
}, ...patterns.filter(pattern => {
|
|
93
|
+
return Array.isArray(pattern.templateTypes) && pattern.templateTypes.some(templateType => slug.startsWith(templateType));
|
|
94
|
+
}).map(pattern => {
|
|
95
|
+
return { ...pattern,
|
|
96
|
+
blocks: (0, _blocks.parse)(pattern.content)
|
|
97
|
+
};
|
|
98
|
+
}), {
|
|
99
|
+
name: 'start-blank',
|
|
100
|
+
blocks: (0, _blocks.parse)('<!-- wp:paragraph --><p></p><!-- /wp:paragraph -->'),
|
|
101
|
+
title: START_BLANK_TITLE
|
|
102
|
+
}];
|
|
103
|
+
}, [fallbackContent, slug, patterns]);
|
|
104
|
+
}
|
|
105
|
+
|
|
63
106
|
function PatternSelection(_ref2) {
|
|
64
107
|
let {
|
|
65
108
|
fallbackContent,
|
|
@@ -67,15 +110,7 @@ function PatternSelection(_ref2) {
|
|
|
67
110
|
postType
|
|
68
111
|
} = _ref2;
|
|
69
112
|
const [,, onChange] = (0, _coreData.useEntityBlockEditor)('postType', postType);
|
|
70
|
-
const blockPatterns = (
|
|
71
|
-
name: 'fallback',
|
|
72
|
-
blocks: (0, _blocks.parse)(fallbackContent),
|
|
73
|
-
title: (0, _i18n.__)('Fallback content')
|
|
74
|
-
}, {
|
|
75
|
-
name: 'start-blank',
|
|
76
|
-
blocks: (0, _blocks.parse)('<!-- wp:paragraph --><p></p><!-- /wp:paragraph -->'),
|
|
77
|
-
title: START_BLANK_TITLE
|
|
78
|
-
}], [fallbackContent]);
|
|
113
|
+
const blockPatterns = useStartPatterns(fallbackContent);
|
|
79
114
|
const shownBlockPatterns = (0, _compose.useAsyncList)(blockPatterns);
|
|
80
115
|
return (0, _element.createElement)("div", {
|
|
81
116
|
className: "edit-site-start-template-options__pattern-container",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/start-template-options/index.js"],"names":["useFallbackTemplateContent","slug","isCustom","templateContent","setTemplateContent","path","is_custom","ignore_empty","then","content","raw","START_BLANK_TITLE","PatternSelection","fallbackContent","onChoosePattern","postType","onChange","blockPatterns","name","blocks","title","shownBlockPatterns","pattern","selection","undefined","StartModal","onClose","START_TEMPLATE_MODAL_STATES","INITIAL","CLOSED","StartTemplateOptions","modalState","setModalState","shouldOpenModel","select","getEditedPostType","getEditedPostId","editSiteStore","_postType","postId","__experimentalGetDirtyEntityRecords","getEditedEntityRecord","coreStore","templateRecord","hasDirtyEntityRecords","length","preferencesStore","get"],"mappings":";;;;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAUA;AACA;AACA;AAMA,SAASA,0BAAT,CAAqCC,IAArC,EAA8D;AAAA,MAAnBC,QAAmB,uEAAR,KAAQ;AAC7D,QAAM,CAAEC,eAAF,EAAmBC,kBAAnB,IAA0C,uBAAU,EAAV,CAAhD;AAEA,0BAAW,MAAM;AAChB,2BAAU;AACTC,MAAAA,IAAI,EAAE,uBAAc,yBAAd,EAAyC;AAC9CJ,QAAAA,IAD8C;AAE9CK,QAAAA,SAAS,EAAEJ,QAFmC;AAG9CK,QAAAA,YAAY,EAAE;AAHgC,OAAzC;AADG,KAAV,EAMIC,IANJ,CAMU;AAAA,UAAE;AAAEC,QAAAA;AAAF,OAAF;AAAA,aAAmBL,kBAAkB,CAAEK,OAAO,CAACC,GAAV,CAArC;AAAA,KANV;AAOA,GARD,EAQG,CAAET,IAAF,CARH;AASA,SAAOE,eAAP;AACA;;AAED,MAAMQ,iBAAiB,GAAG,cAAI,aAAJ,CAA1B;;AAEA,SAASC,gBAAT,QAA4E;AAAA,MAAjD;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e,EACd,CAAEW,qBAAF,IACA,OAAOD,cAAc,CAAClC,OADtB,IAEA,kBAAkB6B,SAFlB,IAGA,CAAEJ,MAAM,CAAEY,kBAAF,CAAN,CAA2BC,GAA3B,CACD,gBADC,EAED,cAFC,CALG;AASN9C,MAAAA,IAAI,EAAE0C,cAAc,CAAC1C,IATf;AAUNC,MAAAA,QAAQ,EAAEyC,cAAc,CAACrC,SAVnB;AAWNS,MAAAA,QAAQ,EAAEuB;AAXJ,KAAP;AAaA,GAhCoD,EAiCrD,EAjCqD,CAAtD;;AAoCA,MACGP,UAAU,KAAKJ,2BAA2B,CAACC,OAA3C,IACD,CAAEK,eADH,IAEAF,UAAU,KAAKJ,2BAA2B,CAACE,MAH5C,EAIE;AACD,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,UAAD;AACC,IAAA,IAAI,EAAG5B,IADR;AAEC,IAAA,QAAQ,EAAGC,QAFZ;AAGC,IAAA,QAAQ,EAAGa,QAHZ;AAIC,IAAA,OAAO,EAAG,MACTiB,aAAa,CAAEL,2BAA2B,CAACE,MAA9B;AALf,IADD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useEffect, useMemo } from '@wordpress/element';\nimport { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useAsyncList } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { parse } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { store as coreStore, useEntityBlockEditor } from '@wordpress/core-data';\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\n\nfunction useFallbackTemplateContent( slug, isCustom = false ) {\n\tconst [ templateContent, setTemplateContent ] = useState( '' );\n\n\tuseEffect( () => {\n\t\tapiFetch( {\n\t\t\tpath: addQueryArgs( '/wp/v2/templates/lookup', {\n\t\t\t\tslug,\n\t\t\t\tis_custom: isCustom,\n\t\t\t\tignore_empty: true,\n\t\t\t} ),\n\t\t} ).then( ( { content } ) => setTemplateContent( content.raw ) );\n\t}, [ slug ] );\n\treturn templateContent;\n}\n\nconst START_BLANK_TITLE = __( 'Start blank' );\n\nfunction PatternSelection( { fallbackContent, onChoosePattern, postType } ) {\n\tconst [ , , onChange ] = useEntityBlockEditor( 'postType', postType );\n\tconst blockPatterns = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\tname: 'fallback',\n\t\t\t\tblocks: parse( fallbackContent ),\n\t\t\t\ttitle: __( 'Fallback content' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'start-blank',\n\t\t\t\tblocks: parse(\n\t\t\t\t\t'<!-- wp:paragraph --><p></p><!-- /wp:paragraph -->'\n\t\t\t\t),\n\t\t\t\ttitle: START_BLANK_TITLE,\n\t\t\t},\n\t\t],\n\t\t[ fallbackContent ]\n\t);\n\tconst shownBlockPatterns = useAsyncList( blockPatterns );\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"edit-site-start-template-options__pattern-container\"\n\t\t\tstyle={ {\n\t\t\t\t'--wp-edit-site-start-template-options-start-blank': `\"${ START_BLANK_TITLE }\"`,\n\t\t\t} }\n\t\t>\n\t\t\t<BlockPatternsList\n\t\t\t\tblockPatterns={ blockPatterns }\n\t\t\t\tshownPatterns={ shownBlockPatterns }\n\t\t\t\tonClickPattern={ ( pattern, blocks ) => {\n\t\t\t\t\tonChange( 'start-blank' === pattern.name ? [] : blocks, {\n\t\t\t\t\t\tselection: undefined,\n\t\t\t\t\t} );\n\t\t\t\t\tonChoosePattern();\n\t\t\t\t} }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction StartModal( { slug, isCustom, onClose, postType } ) {\n\tconst fallbackContent = useFallbackTemplateContent( slug, isCustom );\n\tif ( ! fallbackContent ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"edit-site-start-template-options__modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tcloseLabel={ __( 'Cancel' ) }\n\t\t\tfocusOnMount=\"firstElement\"\n\t\t\tonRequestClose={ onClose }\n\t\t>\n\t\t\t<div className=\"edit-site-start-template-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tfallbackContent={ fallbackContent }\n\t\t\t\t\tslug={ slug }\n\t\t\t\t\tisCustom={ isCustom }\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tonChoosePattern={ () => {\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</Modal>\n\t);\n}\n\nconst START_TEMPLATE_MODAL_STATES = {\n\tINITIAL: 'INITIAL',\n\tCLOSED: 'CLOSED',\n};\n\nexport default function StartTemplateOptions() {\n\tconst [ modalState, setModalState ] = useState(\n\t\tSTART_TEMPLATE_MODAL_STATES.INITIAL\n\t);\n\tconst { shouldOpenModel, slug, isCustom, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostType, getEditedPostId } =\n\t\t\t\tselect( editSiteStore );\n\t\t\tconst _postType = getEditedPostType();\n\t\t\tconst postId = getEditedPostId();\n\t\t\tconst {\n\t\t\t\t__experimentalGetDirtyEntityRecords,\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t} = select( coreStore );\n\t\t\tconst templateRecord = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\tpostId\n\t\t\t);\n\n\t\t\tconst hasDirtyEntityRecords =\n\t\t\t\t__experimentalGetDirtyEntityRecords().length > 0;\n\n\t\t\treturn {\n\t\t\t\tshouldOpenModel:\n\t\t\t\t\t! hasDirtyEntityRecords &&\n\t\t\t\t\t'' === templateRecord.content &&\n\t\t\t\t\t'wp_template' === _postType &&\n\t\t\t\t\t! select( preferencesStore ).get(\n\t\t\t\t\t\t'core/edit-site',\n\t\t\t\t\t\t'welcomeGuide'\n\t\t\t\t\t),\n\t\t\t\tslug: templateRecord.slug,\n\t\t\t\tisCustom: templateRecord.is_custom,\n\t\t\t\tpostType: _postType,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tif (\n\t\t( modalState === START_TEMPLATE_MODAL_STATES.INITIAL &&\n\t\t\t! shouldOpenModel ) ||\n\t\tmodalState === START_TEMPLATE_MODAL_STATES.CLOSED\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StartModal\n\t\t\tslug={ slug }\n\t\t\tisCustom={ isCustom }\n\t\t\tpostType={ postType }\n\t\t\tonClose={ () =>\n\t\t\t\tsetModalState( START_TEMPLATE_MODAL_STATES.CLOSED )\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/start-template-options/index.js"],"names":["useFallbackTemplateContent","slug","isCustom","templateContent","setTemplateContent","path","is_custom","ignore_empty","then","content","raw","START_BLANK_TITLE","useStartPatterns","fallbackContent","patterns","select","getEditedPostType","getEditedPostId","editSiteStore","getEntityRecord","coreStore","postId","postType","record","getSettings","blockEditorStore","__experimentalBlockPatterns","name","blocks","title","filter","pattern","Array","isArray","templateTypes","some","templateType","startsWith","map","PatternSelection","onChoosePattern","onChange","blockPatterns","shownBlockPatterns","selection","undefined","StartModal","onClose","START_TEMPLATE_MODAL_STATES","INITIAL","CLOSED","StartTemplateOptions","modalState","setModalState","shouldOpenModel","_postType","__experimentalGetDirtyEntityRecords","getEditedEntityRecord","templateRecord","hasDirtyEntityRecords","length","preferencesStore","get"],"mappings":";;;;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AAIA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AAaA;AACA;AACA;AAMA,SAASA,0BAAT,CAAqCC,IAArC,EAA8D;AAAA,MAAnBC,QAAmB,uEAAR,KAAQ;AAC7D,QAAM,CAAEC,eAAF,EAAmBC,kBAAn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,UAAM;AAAEC,MAAAA,iBAAF;AAAqBC,MAAAA;AAArB,QACLF,MAAM,CAAEG,YAAF,CADP;;AAEA,UAAMqC,SAAS,GAAGvC,iBAAiB,EAAnC;;AACA,UAAMK,MAAM,GAAGJ,eAAe,EAA9B;AACA,UAAM;AACLuC,MAAAA,mCADK;AAELC,MAAAA;AAFK,QAGF1C,MAAM,CAAEK,eAAF,CAHV;AAIA,UAAMsC,cAAc,GAAGD,qBAAqB,CAC3C,UAD2C,EAE3CF,SAF2C,EAG3ClC,MAH2C,CAA5C;AAMA,UAAMsC,qBAAqB,GAC1BH,mCAAmC,GAAGI,MAAtC,GAA+C,CADhD;AAGA,WAAO;AACNN,MAAAA,eAAe,EACd,CAAEK,qBAAF,IACA,OAAOD,cAAc,CAACjD,OADtB,IAEA,kBAAkB8C,SAFlB,IAGA,CAAExC,MAAM,CAAE8C,kBAAF,CAAN,CAA2BC,GAA3B,CACD,gBADC,EAED,cAFC,CALG;AASN7D,MAAAA,IAAI,EAAEyD,cAAc,CAACzD,IATf;AAUNC,MAAAA,QAAQ,EAAEwD,cAAc,CAACpD,SAVnB;AAWNgB,MAAAA,QAAQ,EAAEiC;AAXJ,KAAP;AAaA,GAhCoD,EAiCrD,EAjCqD,CAAtD;;AAoCA,MACGH,UAAU,KAAKJ,2BAA2B,CAACC,OAA3C,IACD,CAAEK,eADH,IAEAF,UAAU,KAAKJ,2BAA2B,CAACE,MAH5C,EAIE;AACD,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,UAAD;AACC,IAAA,IAAI,EAAGjD,IADR;AAEC,IAAA,QAAQ,EAAGC,QAFZ;AAGC,IAAA,QAAQ,EAAGoB,QAHZ;AAIC,IAAA,OAAO,EAAG,MACT+B,aAAa,CAAEL,2BAA2B,CAACE,MAA9B;AALf,IADD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useEffect, useMemo } from '@wordpress/element';\nimport {\n\t__experimentalBlockPatternsList as BlockPatternsList,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useAsyncList } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { parse } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { store as coreStore, useEntityBlockEditor } from '@wordpress/core-data';\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\n\nfunction useFallbackTemplateContent( slug, isCustom = false ) {\n\tconst [ templateContent, setTemplateContent ] = useState( '' );\n\n\tuseEffect( () => {\n\t\tapiFetch( {\n\t\t\tpath: addQueryArgs( '/wp/v2/templates/lookup', {\n\t\t\t\tslug,\n\t\t\t\tis_custom: isCustom,\n\t\t\t\tignore_empty: true,\n\t\t\t} ),\n\t\t} ).then( ( { content } ) => setTemplateContent( content.raw ) );\n\t}, [ slug ] );\n\treturn templateContent;\n}\n\nconst START_BLANK_TITLE = __( 'Start blank' );\n\nfunction useStartPatterns( fallbackContent ) {\n\tconst { slug, patterns } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId } = select( editSiteStore );\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst postId = getEditedPostId();\n\t\tconst postType = getEditedPostType();\n\t\tconst record = getEntityRecord( 'postType', postType, postId );\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\tslug: record.slug,\n\t\t\tpatterns: getSettings().__experimentalBlockPatterns,\n\t\t};\n\t}, [] );\n\n\treturn useMemo( () => {\n\t\t// filter patterns that are supposed to be used in the current template being edited.\n\t\treturn [\n\t\t\t{\n\t\t\t\tname: 'fallback',\n\t\t\t\tblocks: parse( fallbackContent ),\n\t\t\t\ttitle: __( 'Fallback content' ),\n\t\t\t},\n\t\t\t...patterns\n\t\t\t\t.filter( ( pattern ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\tArray.isArray( pattern.templateTypes ) &&\n\t\t\t\t\t\tpattern.templateTypes.some( ( templateType ) =>\n\t\t\t\t\t\t\tslug.startsWith( templateType )\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t} )\n\t\t\t\t.map( ( pattern ) => {\n\t\t\t\t\treturn { ...pattern, blocks: parse( pattern.content ) };\n\t\t\t\t} ),\n\t\t\t{\n\t\t\t\tname: 'start-blank',\n\t\t\t\tblocks: parse(\n\t\t\t\t\t'<!-- wp:paragraph --><p></p><!-- /wp:paragraph -->'\n\t\t\t\t),\n\t\t\t\ttitle: START_BLANK_TITLE,\n\t\t\t},\n\t\t];\n\t}, [ fallbackContent, slug, patterns ] );\n}\n\nfunction PatternSelection( { fallbackContent, onChoosePattern, postType } ) {\n\tconst [ , , onChange ] = useEntityBlockEditor( 'postType', postType );\n\tconst blockPatterns = useStartPatterns( fallbackContent );\n\tconst shownBlockPatterns = useAsyncList( blockPatterns );\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"edit-site-start-template-options__pattern-container\"\n\t\t\tstyle={ {\n\t\t\t\t'--wp-edit-site-start-template-options-start-blank': `\"${ START_BLANK_TITLE }\"`,\n\t\t\t} }\n\t\t>\n\t\t\t<BlockPatternsList\n\t\t\t\tblockPatterns={ blockPatterns }\n\t\t\t\tshownPatterns={ shownBlockPatterns }\n\t\t\t\tonClickPattern={ ( pattern, blocks ) => {\n\t\t\t\t\tonChange( 'start-blank' === pattern.name ? [] : blocks, {\n\t\t\t\t\t\tselection: undefined,\n\t\t\t\t\t} );\n\t\t\t\t\tonChoosePattern();\n\t\t\t\t} }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction StartModal( { slug, isCustom, onClose, postType } ) {\n\tconst fallbackContent = useFallbackTemplateContent( slug, isCustom );\n\tif ( ! fallbackContent ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"edit-site-start-template-options__modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tcloseLabel={ __( 'Cancel' ) }\n\t\t\tfocusOnMount=\"firstElement\"\n\t\t\tonRequestClose={ onClose }\n\t\t>\n\t\t\t<div className=\"edit-site-start-template-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tfallbackContent={ fallbackContent }\n\t\t\t\t\tslug={ slug }\n\t\t\t\t\tisCustom={ isCustom }\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tonChoosePattern={ () => {\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</Modal>\n\t);\n}\n\nconst START_TEMPLATE_MODAL_STATES = {\n\tINITIAL: 'INITIAL',\n\tCLOSED: 'CLOSED',\n};\n\nexport default function StartTemplateOptions() {\n\tconst [ modalState, setModalState ] = useState(\n\t\tSTART_TEMPLATE_MODAL_STATES.INITIAL\n\t);\n\tconst { shouldOpenModel, slug, isCustom, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostType, getEditedPostId } =\n\t\t\t\tselect( editSiteStore );\n\t\t\tconst _postType = getEditedPostType();\n\t\t\tconst postId = getEditedPostId();\n\t\t\tconst {\n\t\t\t\t__experimentalGetDirtyEntityRecords,\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t} = select( coreStore );\n\t\t\tconst templateRecord = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\tpostId\n\t\t\t);\n\n\t\t\tconst hasDirtyEntityRecords =\n\t\t\t\t__experimentalGetDirtyEntityRecords().length > 0;\n\n\t\t\treturn {\n\t\t\t\tshouldOpenModel:\n\t\t\t\t\t! hasDirtyEntityRecords &&\n\t\t\t\t\t'' === templateRecord.content &&\n\t\t\t\t\t'wp_template' === _postType &&\n\t\t\t\t\t! select( preferencesStore ).get(\n\t\t\t\t\t\t'core/edit-site',\n\t\t\t\t\t\t'welcomeGuide'\n\t\t\t\t\t),\n\t\t\t\tslug: templateRecord.slug,\n\t\t\t\tisCustom: templateRecord.is_custom,\n\t\t\t\tpostType: _postType,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tif (\n\t\t( modalState === START_TEMPLATE_MODAL_STATES.INITIAL &&\n\t\t\t! shouldOpenModel ) ||\n\t\tmodalState === START_TEMPLATE_MODAL_STATES.CLOSED\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StartModal\n\t\t\tslug={ slug }\n\t\t\tisCustom={ isCustom }\n\t\t\tpostType={ postType }\n\t\t\tonClose={ () =>\n\t\t\t\tsetModalState( START_TEMPLATE_MODAL_STATES.CLOSED )\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -10,6 +10,8 @@ exports.useHasStyleBook = useHasStyleBook;
|
|
|
10
10
|
|
|
11
11
|
var _element = require("@wordpress/element");
|
|
12
12
|
|
|
13
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
14
|
+
|
|
13
15
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
16
|
|
|
15
17
|
var _components = require("@wordpress/components");
|
|
@@ -20,6 +22,8 @@ var _blocks = require("@wordpress/blocks");
|
|
|
20
22
|
|
|
21
23
|
var _blockEditor = require("@wordpress/block-editor");
|
|
22
24
|
|
|
25
|
+
var _data = require("@wordpress/data");
|
|
26
|
+
|
|
23
27
|
var _icons = require("@wordpress/icons");
|
|
24
28
|
|
|
25
29
|
var _compose = require("@wordpress/compose");
|
|
@@ -40,13 +44,83 @@ var _privateApis = require("../../private-apis");
|
|
|
40
44
|
* Internal dependencies
|
|
41
45
|
*/
|
|
42
46
|
const {
|
|
47
|
+
ExperimentalBlockEditorProvider,
|
|
43
48
|
useGlobalStyle
|
|
44
49
|
} = (0, _privateApis.unlock)(_blockEditor.privateApis);
|
|
45
50
|
const SLOT_FILL_NAME = 'EditSiteStyleBook';
|
|
46
51
|
const {
|
|
47
52
|
Slot: StyleBookSlot,
|
|
48
53
|
Fill: StyleBookFill
|
|
49
|
-
} = (0, _components.createSlotFill)(SLOT_FILL_NAME);
|
|
54
|
+
} = (0, _components.createSlotFill)(SLOT_FILL_NAME); // The content area of the Style Book is rendered within an iframe so that global styles
|
|
55
|
+
// are applied to elements within the entire content area. To support elements that are
|
|
56
|
+
// not part of the block previews, such as headings and layout for the block previews,
|
|
57
|
+
// additional CSS rules need to be passed into the iframe. These are hard-coded below.
|
|
58
|
+
// Note that button styles are unset, and then focus rules from the `Button` component are
|
|
59
|
+
// applied to the `button` element, targeted via `.edit-site-style-book__example`.
|
|
60
|
+
// This is to ensure that browser default styles for buttons are not applied to the previews.
|
|
61
|
+
|
|
62
|
+
const STYLE_BOOK_IFRAME_STYLES = `
|
|
63
|
+
.edit-site-style-book__examples {
|
|
64
|
+
max-width: 900px;
|
|
65
|
+
margin: 0 auto;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.edit-site-style-book__example {
|
|
69
|
+
border-radius: 2px;
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
gap: 40px;
|
|
74
|
+
margin-bottom: 40px;
|
|
75
|
+
padding: 16px;
|
|
76
|
+
width: 100%;
|
|
77
|
+
box-sizing: border-box;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.edit-site-style-book__example.is-selected {
|
|
81
|
+
box-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.edit-site-style-book__example:focus:not(:disabled) {
|
|
85
|
+
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
|
|
86
|
+
outline: 3px solid transparent;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.edit-site-style-book__examples.is-wide .edit-site-style-book__example {
|
|
90
|
+
flex-direction: row;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.edit-site-style-book__example-title {
|
|
94
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
95
|
+
font-size: 11px;
|
|
96
|
+
font-weight: 500;
|
|
97
|
+
line-height: normal;
|
|
98
|
+
margin: 0;
|
|
99
|
+
text-align: left;
|
|
100
|
+
text-transform: uppercase;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.edit-site-style-book__examples.is-wide .edit-site-style-book__example-title {
|
|
104
|
+
text-align: right;
|
|
105
|
+
width: 120px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.edit-site-style-book__example-preview {
|
|
109
|
+
width: 100%;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.edit-site-style-book__example-preview .block-editor-block-list__insertion-point,
|
|
113
|
+
.edit-site-style-book__example-preview .block-list-appender {
|
|
114
|
+
display: none;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.edit-site-style-book__example-preview .is-root-container > .wp-block:first-child {
|
|
118
|
+
margin-top: 0;
|
|
119
|
+
}
|
|
120
|
+
.edit-site-style-book__example-preview .is-root-container > .wp-block:last-child {
|
|
121
|
+
margin-bottom: 0;
|
|
122
|
+
}
|
|
123
|
+
`;
|
|
50
124
|
|
|
51
125
|
function getExamples() {
|
|
52
126
|
// Use our own example for the Heading block so that we can show multiple
|
|
@@ -105,6 +179,10 @@ function StyleBook(_ref) {
|
|
|
105
179
|
title: category.title,
|
|
106
180
|
icon: category.icon
|
|
107
181
|
})), [examples]);
|
|
182
|
+
const originalSettings = (0, _data.useSelect)(select => select(_blockEditor.store).getSettings(), []);
|
|
183
|
+
const settings = (0, _element.useMemo)(() => ({ ...originalSettings,
|
|
184
|
+
__unstableIsPreviewMode: true
|
|
185
|
+
}), [originalSettings]);
|
|
108
186
|
|
|
109
187
|
function closeOnEscape(event) {
|
|
110
188
|
if (event.keyCode === _keycodes.ESCAPE && !event.defaultPrevented) {
|
|
@@ -133,25 +211,47 @@ function StyleBook(_ref) {
|
|
|
133
211
|
}), (0, _element.createElement)(_components.TabPanel, {
|
|
134
212
|
className: "edit-site-style-book__tab-panel",
|
|
135
213
|
tabs: tabs
|
|
136
|
-
}, tab => (0, _element.createElement)(
|
|
214
|
+
}, tab => (0, _element.createElement)(_blockEditor.__unstableIframe, {
|
|
215
|
+
className: "edit-site-style-book__iframe",
|
|
216
|
+
name: "style-book-canvas",
|
|
217
|
+
tabIndex: 0
|
|
218
|
+
}, (0, _element.createElement)(_blockEditor.__unstableEditorStyles, {
|
|
219
|
+
styles: settings.styles
|
|
220
|
+
}), (0, _element.createElement)("style", null, // Forming a "block formatting context" to prevent margin collapsing.
|
|
221
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
|
|
222
|
+
`.is-root-container { display: flow-root; }
|
|
223
|
+
body { position: relative; padding: 32px !important; }` + STYLE_BOOK_IFRAME_STYLES), (0, _element.createElement)(Examples, {
|
|
224
|
+
className: (0, _classnames.default)('edit-site-style-book__examples', {
|
|
225
|
+
'is-wide': sizes.width > 600
|
|
226
|
+
}),
|
|
137
227
|
examples: examples,
|
|
138
228
|
category: tab.name,
|
|
229
|
+
label: (0, _i18n.sprintf)( // translators: %s: Category of blocks, e.g. Text.
|
|
230
|
+
(0, _i18n.__)('Examples of blocks in the %s category'), tab.title),
|
|
139
231
|
isSelected: isSelected,
|
|
140
232
|
onSelect: onSelect
|
|
141
|
-
}))));
|
|
233
|
+
})))));
|
|
142
234
|
}
|
|
143
235
|
|
|
144
236
|
const Examples = (0, _element.memo)(_ref2 => {
|
|
145
237
|
let {
|
|
238
|
+
className,
|
|
146
239
|
examples,
|
|
147
240
|
category,
|
|
241
|
+
label,
|
|
148
242
|
isSelected,
|
|
149
243
|
onSelect
|
|
150
244
|
} = _ref2;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
245
|
+
const composite = (0, _components.__unstableUseCompositeState)({
|
|
246
|
+
orientation: 'vertical'
|
|
247
|
+
});
|
|
248
|
+
return (0, _element.createElement)(_components.__unstableComposite, (0, _extends2.default)({}, composite, {
|
|
249
|
+
className: className,
|
|
250
|
+
"aria-label": label
|
|
251
|
+
}), examples.filter(example => example.category === category).map(example => (0, _element.createElement)(Example, {
|
|
154
252
|
key: example.name,
|
|
253
|
+
id: `example-${example.name}`,
|
|
254
|
+
composite: composite,
|
|
155
255
|
title: example.title,
|
|
156
256
|
blocks: example.blocks,
|
|
157
257
|
isSelected: isSelected(example.name),
|
|
@@ -160,32 +260,46 @@ const Examples = (0, _element.memo)(_ref2 => {
|
|
|
160
260
|
}
|
|
161
261
|
})));
|
|
162
262
|
});
|
|
163
|
-
|
|
263
|
+
|
|
264
|
+
const Example = _ref3 => {
|
|
164
265
|
let {
|
|
266
|
+
composite,
|
|
267
|
+
id,
|
|
165
268
|
title,
|
|
166
269
|
blocks,
|
|
167
270
|
isSelected,
|
|
168
271
|
onClick
|
|
169
272
|
} = _ref3;
|
|
170
|
-
|
|
273
|
+
const originalSettings = (0, _data.useSelect)(select => select(_blockEditor.store).getSettings(), []);
|
|
274
|
+
const settings = (0, _element.useMemo)(() => ({ ...originalSettings,
|
|
275
|
+
__unstableIsPreviewMode: true
|
|
276
|
+
}), [originalSettings]); // Cache the list of blocks to avoid additional processing when the component is re-rendered.
|
|
277
|
+
|
|
278
|
+
const renderedBlocks = (0, _element.useMemo)(() => Array.isArray(blocks) ? blocks : [blocks], [blocks]);
|
|
279
|
+
return (0, _element.createElement)(_components.__unstableCompositeItem, (0, _extends2.default)({}, composite, {
|
|
171
280
|
className: (0, _classnames.default)('edit-site-style-book__example', {
|
|
172
281
|
'is-selected': isSelected
|
|
173
282
|
}),
|
|
283
|
+
id: id,
|
|
174
284
|
"aria-label": (0, _i18n.sprintf)( // translators: %s: Title of a block, e.g. Heading.
|
|
175
285
|
(0, _i18n.__)('Open %s styles in Styles panel'), title),
|
|
176
|
-
onClick: onClick
|
|
177
|
-
|
|
286
|
+
onClick: onClick,
|
|
287
|
+
role: "button",
|
|
288
|
+
as: "div"
|
|
289
|
+
}), (0, _element.createElement)("span", {
|
|
178
290
|
className: "edit-site-style-book__example-title"
|
|
179
291
|
}, title), (0, _element.createElement)("div", {
|
|
180
|
-
className: "edit-site-style-book__example-preview"
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
})
|
|
188
|
-
|
|
292
|
+
className: "edit-site-style-book__example-preview",
|
|
293
|
+
"aria-hidden": true
|
|
294
|
+
}, (0, _element.createElement)(_components.Disabled, {
|
|
295
|
+
className: "edit-site-style-book__example-preview__content"
|
|
296
|
+
}, (0, _element.createElement)(ExperimentalBlockEditorProvider, {
|
|
297
|
+
value: renderedBlocks,
|
|
298
|
+
settings: settings
|
|
299
|
+
}, (0, _element.createElement)(_blockEditor.BlockList, {
|
|
300
|
+
renderAppender: false
|
|
301
|
+
})))));
|
|
302
|
+
};
|
|
189
303
|
|
|
190
304
|
function useHasStyleBook() {
|
|
191
305
|
const fills = (0, _components.__experimentalUseSlotFills)(SLOT_FILL_NAME);
|