@wordpress/edit-site 5.33.0 → 5.34.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 +2 -0
- package/build/components/add-new-page/index.js +3 -0
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/add-new-pattern/index.js +8 -7
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js +3 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build/components/block-editor/resize-handle.js +20 -5
- package/build/components/block-editor/resize-handle.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +3 -0
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +28 -5
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +9 -3
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +7 -2
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +22 -20
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
- package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +8 -2
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/header-edit-mode/index.js +33 -49
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +3 -97
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +0 -49
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/index.js +7 -4
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +9 -38
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page-pages/index.js +4 -3
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/dataviews-pattern-actions.js +11 -7
- package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build/components/page-patterns/header.js +3 -1
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/index.js +20 -49
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +1 -0
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/hooks.js.map +1 -0
- package/build/components/{page-templates-template-parts → page-templates}/index.js +67 -80
- package/build/components/page-templates/index.js.map +1 -0
- package/build/components/pattern-modal/duplicate.js +7 -5
- package/build/components/pattern-modal/duplicate.js.map +1 -1
- package/build/components/plugin-template-setting-panel/index.js +9 -0
- package/build/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +9 -6
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +3 -2
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/index.js +40 -9
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +24 -17
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +2 -5
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +39 -8
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +6 -13
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js +3 -2
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +34 -28
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +5 -35
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -8
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/template-actions/index.js +1 -1
- package/build/components/template-actions/index.js.map +1 -1
- package/build/deprecated.js +55 -0
- package/build/deprecated.js.map +1 -0
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +35 -4
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/index.js +18 -18
- package/build/index.js.map +1 -1
- package/build/utils/constants.js +1 -2
- package/build/utils/constants.js.map +1 -1
- package/build-module/components/add-new-page/index.js +3 -0
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +8 -7
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js +3 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build-module/components/block-editor/resize-handle.js +21 -6
- package/build-module/components/block-editor/resize-handle.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +3 -0
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +28 -5
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +9 -3
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +7 -2
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +22 -20
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
- package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +8 -2
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +39 -55
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +5 -99
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +0 -49
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/index.js +7 -4
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +9 -38
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page-pages/index.js +5 -4
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/dataviews-pattern-actions.js +11 -7
- package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build-module/components/page-patterns/header.js +3 -1
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/index.js +22 -51
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +1 -0
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/hooks.js.map +1 -0
- package/build-module/components/{page-templates-template-parts → page-templates}/index.js +67 -80
- package/build-module/components/page-templates/index.js.map +1 -0
- package/build-module/components/pattern-modal/duplicate.js +7 -5
- package/build-module/components/pattern-modal/duplicate.js.map +1 -1
- package/build-module/components/plugin-template-setting-panel/index.js +8 -0
- package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +9 -6
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +4 -3
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +43 -12
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +25 -17
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +3 -6
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +40 -9
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +6 -13
- package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +3 -2
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +35 -29
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +5 -35
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -8
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/template-actions/index.js +1 -1
- package/build-module/components/template-actions/index.js.map +1 -1
- package/build-module/deprecated.js +45 -0
- package/build-module/deprecated.js.map +1 -0
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +34 -4
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/index.js +2 -4
- package/build-module/index.js.map +1 -1
- package/build-module/utils/constants.js +0 -1
- package/build-module/utils/constants.js.map +1 -1
- package/build-style/style-rtl.css +79 -125
- package/build-style/style.css +79 -125
- package/package.json +42 -42
- package/src/components/add-new-page/index.js +7 -1
- package/src/components/add-new-pattern/index.js +15 -12
- package/src/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
- package/src/components/add-new-template/add-custom-template-modal-content.js +3 -1
- package/src/components/block-editor/resize-handle.js +30 -11
- package/src/components/block-editor/style.scss +10 -15
- package/src/components/create-template-part-modal/index.js +3 -0
- package/src/components/editor/index.js +42 -3
- package/src/components/editor/style.scss +6 -1
- package/src/components/global-styles/font-library-modal/context.js +9 -3
- package/src/components/global-styles/font-library-modal/font-collection.js +31 -12
- package/src/components/global-styles/font-library-modal/installed-fonts.js +82 -54
- package/src/components/global-styles/font-library-modal/style.scss +17 -0
- package/src/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
- package/src/components/global-styles/style-variations-container.js +11 -2
- package/src/components/header-edit-mode/index.js +56 -76
- package/src/components/header-edit-mode/more-menu/index.js +8 -145
- package/src/components/header-edit-mode/style.scss +13 -85
- package/src/components/keyboard-shortcuts/register.js +0 -58
- package/src/components/layout/index.js +11 -2
- package/src/components/layout/router.js +9 -49
- package/src/components/page-pages/index.js +14 -4
- package/src/components/page-pages/style.scss +11 -0
- package/src/components/page-patterns/dataviews-pattern-actions.js +8 -9
- package/src/components/page-patterns/header.js +3 -1
- package/src/components/page-patterns/index.js +17 -76
- package/src/components/page-patterns/style.scss +14 -1
- package/src/components/page-patterns/use-patterns.js +1 -0
- package/src/components/{page-templates-template-parts → page-templates}/index.js +23 -46
- package/src/components/{page-templates-template-parts → page-templates}/style.scss +2 -2
- package/src/components/pattern-modal/duplicate.js +4 -3
- package/src/components/plugin-template-setting-panel/index.js +8 -0
- package/src/components/resizable-frame/index.js +4 -3
- package/src/components/sidebar-edit-mode/index.js +13 -2
- package/src/components/sidebar-edit-mode/page-panels/index.js +49 -21
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +31 -19
- package/src/components/sidebar-edit-mode/template-panel/index.js +2 -12
- package/src/components/sidebar-navigation-screen-page/index.js +48 -9
- package/src/components/sidebar-navigation-screen-pattern/index.js +6 -11
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
- package/src/components/sidebar-navigation-screen-patterns/category-item.js +2 -1
- package/src/components/sidebar-navigation-screen-patterns/index.js +30 -38
- package/src/components/sidebar-navigation-screen-template/index.js +1 -1
- package/src/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +7 -39
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -4
- package/src/components/template-actions/index.js +1 -1
- package/src/deprecated.js +42 -0
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +69 -16
- package/src/index.js +2 -9
- package/src/style.scss +1 -5
- package/src/utils/constants.js +1 -1
- package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -59
- package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +0 -1
- package/build/components/header-edit-mode/tools-more-menu-group/index.js +0 -23
- package/build/components/header-edit-mode/tools-more-menu-group/index.js.map +0 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +0 -56
- package/build/components/keyboard-shortcuts/edit-mode.js.map +0 -1
- package/build/components/page-templates-template-parts/add-new-template-part.js +0 -65
- package/build/components/page-templates-template-parts/add-new-template-part.js.map +0 -1
- package/build/components/page-templates-template-parts/hooks.js.map +0 -1
- package/build/components/page-templates-template-parts/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/page-status.js +0 -188
- package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +0 -1
- package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -52
- package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +0 -1
- package/build-module/components/header-edit-mode/tools-more-menu-group/index.js +0 -16
- package/build-module/components/header-edit-mode/tools-more-menu-group/index.js.map +0 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +0 -49
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +0 -1
- package/build-module/components/page-templates-template-parts/add-new-template-part.js +0 -57
- package/build-module/components/page-templates-template-parts/add-new-template-part.js.map +0 -1
- package/build-module/components/page-templates-template-parts/hooks.js.map +0 -1
- package/build-module/components/page-templates-template-parts/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +0 -180
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +0 -1
- package/src/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -51
- package/src/components/header-edit-mode/tools-more-menu-group/index.js +0 -16
- package/src/components/keyboard-shortcuts/edit-mode.js +0 -59
- package/src/components/page-templates-template-parts/add-new-template-part.js +0 -62
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +0 -249
- package/src/components/sidebar-edit-mode/page-panels/style.scss +0 -34
- /package/build/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
- /package/build-module/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
- /package/src/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
|
@@ -35,7 +35,8 @@ const {
|
|
|
35
35
|
} = (0, _lockUnlock.unlock)(_components.privateApis);
|
|
36
36
|
const {
|
|
37
37
|
interfaceStore,
|
|
38
|
-
useAutoSwitchEditorSidebars
|
|
38
|
+
useAutoSwitchEditorSidebars,
|
|
39
|
+
PatternOverridesPanel
|
|
39
40
|
} = (0, _lockUnlock.unlock)(_editor.privateApis);
|
|
40
41
|
const {
|
|
41
42
|
Slot: InspectorSlot,
|
|
@@ -94,7 +95,7 @@ const FillContents = ({
|
|
|
94
95
|
}, (0, _react.createElement)(Tabs.TabPanel, {
|
|
95
96
|
tabId: "edit-post/document",
|
|
96
97
|
focusable: false
|
|
97
|
-
}, isEditingPage ? (0, _react.createElement)(_pagePanels.default, null) : (0, _react.createElement)(_templatePanel.default, null)), (0, _react.createElement)(Tabs.TabPanel, {
|
|
98
|
+
}, isEditingPage ? (0, _react.createElement)(_pagePanels.default, null) : (0, _react.createElement)(_templatePanel.default, null), (0, _react.createElement)(_editor.PostLastRevisionPanel, null), (0, _react.createElement)(_editor.PostTaxonomiesPanel, null), (0, _react.createElement)(_editor.PostDiscussionPanel, null), (0, _react.createElement)(_editor.PageAttributesPanel, null), (0, _react.createElement)(PatternOverridesPanel, null)), (0, _react.createElement)(Tabs.TabPanel, {
|
|
98
99
|
tabId: "edit-post/block",
|
|
99
100
|
focusable: false
|
|
100
101
|
}, (0, _react.createElement)(InspectorSlot, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_icons","_element","_data","_blockEditor","_coreData","_editor","_defaultSidebar","_interopRequireDefault","_globalStylesSidebar","_settingsHeader","_pagePanels","_templatePanel","_store","_lockUnlock","Tabs","unlock","componentsPrivateApis","interfaceStore","useAutoSwitchEditorSidebars","editorPrivateApis","Slot","InspectorSlot","Fill","InspectorFill","createSlotFill","SidebarInspectorFill","exports","FillContents","tabName","isEditingPage","supportsGlobalStyles","tabListRef","useRef","tabsContextValue","useContext","Context","useEffect","tabsElements","Array","from","current","querySelectorAll","selectedTabElement","find","element","getAttribute","activeElement","ownerDocument","tabsHasFocus","some","id","focus","_react","createElement","Fragment","default","identifier","title","__","icon","isRTL","drawerLeft","drawerRight","closeLabel","header","Provider","value","ref","headerClassName","className","isActiveByDefault","TabPanel","tabId","focusable","bubblesVirtually","SidebarComplementaryAreaFills","useSelect","select","sidebar","getActiveComplementaryArea","_isEditorSidebarOpened","includes","_tabName","blockEditorStore","getBlockSelectionStart","coreStore","getCurrentTheme","is_block_theme","editSiteStore","isPage","enableComplementaryArea","useDispatch","onTabSelect","useCallback","newSelectedTabId","selectedTabId","onSelect","selectOnMove"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateSlotFill,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { useCallback, useContext, useEffect, useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport GlobalStylesSidebar from './global-styles-sidebar';\nimport SettingsHeader from './settings-header';\nimport PagePanels from './page-panels';\nimport TemplatePanel from './template-panel';\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\nconst { interfaceStore, useAutoSwitchEditorSidebars } =\n\tunlock( editorPrivateApis );\nconst { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(\n\t'EditSiteSidebarInspector'\n);\nexport const SidebarInspectorFill = InspectorFill;\n\nconst FillContents = ( { tabName, isEditingPage, supportsGlobalStyles } ) => {\n\tconst tabListRef = useRef( null );\n\t// Because `DefaultSidebar` renders a `ComplementaryArea`, we\n\t// need to forward the `Tabs` context so it can be passed through the\n\t// underlying slot/fill.\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\t// This effect addresses a race condition caused by tabbing from the last\n\t// block in the editor into the settings sidebar. Without this effect, the\n\t// selected tab and browser focus can become separated in an unexpected way.\n\t// (e.g the \"block\" tab is focused, but the \"post\" tab is selected).\n\tuseEffect( () => {\n\t\tconst tabsElements = Array.from(\n\t\t\ttabListRef.current?.querySelectorAll( '[role=\"tab\"]' ) || []\n\t\t);\n\t\tconst selectedTabElement = tabsElements.find(\n\t\t\t// We are purposefully using a custom `data-tab-id` attribute here\n\t\t\t// because we don't want rely on any assumptions about `Tabs`\n\t\t\t// component internals.\n\t\t\t( element ) => element.getAttribute( 'data-tab-id' ) === tabName\n\t\t);\n\t\tconst activeElement = selectedTabElement?.ownerDocument.activeElement;\n\t\tconst tabsHasFocus = tabsElements.some( ( element ) => {\n\t\t\treturn activeElement && activeElement.id === element.id;\n\t\t} );\n\t\tif (\n\t\t\ttabsHasFocus &&\n\t\t\tselectedTabElement &&\n\t\t\tselectedTabElement.id !== activeElement?.id\n\t\t) {\n\t\t\tselectedTabElement?.focus();\n\t\t}\n\t}, [ tabName ] );\n\n\treturn (\n\t\t<>\n\t\t\t<DefaultSidebar\n\t\t\t\tidentifier={ tabName }\n\t\t\t\ttitle={ __( 'Settings' ) }\n\t\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\t\theader={\n\t\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t\t<SettingsHeader ref={ tabListRef } />\n\t\t\t\t\t</Tabs.Context.Provider>\n\t\t\t\t}\n\t\t\t\theaderClassName=\"edit-site-sidebar-edit-mode__panel-tabs\"\n\t\t\t\t// This classname is added so we can apply a corrective negative\n\t\t\t\t// margin to the panel.\n\t\t\t\t// see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049\n\t\t\t\tclassName=\"edit-site-sidebar__panel\"\n\t\t\t\tisActiveByDefault\n\t\t\t>\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\ttabId=\"edit-post/document\"\n\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isEditingPage ? <PagePanels /> : <TemplatePanel /> }\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t<Tabs.TabPanel tabId=\"edit-post/block\" focusable={ false }>\n\t\t\t\t\t\t<InspectorSlot bubblesVirtually />\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t</DefaultSidebar>\n\t\t\t{ supportsGlobalStyles && <GlobalStylesSidebar /> }\n\t\t</>\n\t);\n};\n\nexport function SidebarComplementaryAreaFills() {\n\tuseAutoSwitchEditorSidebars();\n\tconst { tabName, supportsGlobalStyles, isEditingPage } = useSelect(\n\t\t( select ) => {\n\t\t\tconst sidebar =\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea( 'core' );\n\n\t\t\tconst _isEditorSidebarOpened = [\n\t\t\t\t'edit-post/block',\n\t\t\t\t'edit-post/document',\n\t\t\t].includes( sidebar );\n\t\t\tlet _tabName = sidebar;\n\t\t\tif ( ! _isEditorSidebarOpened ) {\n\t\t\t\t_tabName = !! select(\n\t\t\t\t\tblockEditorStore\n\t\t\t\t).getBlockSelectionStart()\n\t\t\t\t\t? 'edit-post/block'\n\t\t\t\t\t: 'edit-post/document';\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttabName: _tabName,\n\t\t\t\tsupportsGlobalStyles:\n\t\t\t\t\tselect( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t\t\tisEditingPage: select( editSiteStore ).isPage(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\t// `newSelectedTabId` could technically be falsey if no tab is selected (i.e.\n\t// the initial render) or when we don't want a tab displayed (i.e. the\n\t// sidebar is closed). These cases should both be covered by the `!!` check\n\t// below, so we shouldn't need any additional falsey handling.\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea( 'core', newSelectedTabId );\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\tselectedTabId={ tabName }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<FillContents\n\t\t\t\ttabName={ tabName }\n\t\t\t\tisEditingPage={ isEditingPage }\n\t\t\t\tsupportsGlobalStyles={ supportsGlobalStyles }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAKA,IAAAQ,eAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,oBAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,eAAA,GAAAF,sBAAA,CAAAT,OAAA;AACA,IAAAY,WAAA,GAAAH,sBAAA,CAAAT,OAAA;AACA,IAAAa,cAAA,GAAAJ,sBAAA,CAAAT,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AACA,IAAAe,WAAA,GAAAf,OAAA;AAxBA;AACA;AACA;;AAaA;AACA;AACA;;AASA,MAAM;EAAEgB;AAAK,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAA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ACJiF,aAAa,EAAGnE,OAAS;IACzBoE,QAAQ,EAAGJ,WAAa;IACxBK,YAAY,EAAG;EAAO,GAEtB,IAAA7C,MAAA,CAAAC,aAAA,EAAC1B,YAAY;IACZC,OAAO,EAAGA,OAAS;IACnBC,aAAa,EAAGA,aAAe;IAC/BC,oBAAoB,EAAGA;EAAsB,CAC7C,CACI,CAAC;AAET","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_icons","_element","_data","_blockEditor","_coreData","_editor","_defaultSidebar","_interopRequireDefault","_globalStylesSidebar","_settingsHeader","_pagePanels","_templatePanel","_store","_lockUnlock","Tabs","unlock","componentsPrivateApis","interfaceStore","useAutoSwitchEditorSidebars","PatternOverridesPanel","editorPrivateApis","Slot","InspectorSlot","Fill","InspectorFill","createSlotFill","SidebarInspectorFill","exports","FillContents","tabName","isEditingPage","supportsGlobalStyles","tabListRef","useRef","tabsContextValue","useContext","Context","useEffect","tabsElements","Array","from","current","querySelectorAll","selectedTabElement","find","element","getAttribute","activeElement","ownerDocument","tabsHasFocus","some","id","focus","_react","createElement","Fragment","default","identifier","title","__","icon","isRTL","drawerLeft","drawerRight","closeLabel","header","Provider","value","ref","headerClassName","className","isActiveByDefault","TabPanel","tabId","focusable","PostLastRevisionPanel","PostTaxonomiesPanel","PostDiscussionPanel","PageAttributesPanel","bubblesVirtually","SidebarComplementaryAreaFills","useSelect","select","sidebar","getActiveComplementaryArea","_isEditorSidebarOpened","includes","_tabName","blockEditorStore","getBlockSelectionStart","coreStore","getCurrentTheme","is_block_theme","editSiteStore","isPage","enableComplementaryArea","useDispatch","onTabSelect","useCallback","newSelectedTabId","selectedTabId","onSelect","selectOnMove"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateSlotFill,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { useCallback, useContext, useEffect, useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tPageAttributesPanel,\n\tPostDiscussionPanel,\n\tPostLastRevisionPanel,\n\tPostTaxonomiesPanel,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport GlobalStylesSidebar from './global-styles-sidebar';\nimport SettingsHeader from './settings-header';\nimport PagePanels from './page-panels';\nimport TemplatePanel from './template-panel';\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\nconst { interfaceStore, useAutoSwitchEditorSidebars, PatternOverridesPanel } =\n\tunlock( editorPrivateApis );\nconst { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(\n\t'EditSiteSidebarInspector'\n);\nexport const SidebarInspectorFill = InspectorFill;\n\nconst FillContents = ( { tabName, isEditingPage, supportsGlobalStyles } ) => {\n\tconst tabListRef = useRef( null );\n\t// Because `DefaultSidebar` renders a `ComplementaryArea`, we\n\t// need to forward the `Tabs` context so it can be passed through the\n\t// underlying slot/fill.\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\t// This effect addresses a race condition caused by tabbing from the last\n\t// block in the editor into the settings sidebar. Without this effect, the\n\t// selected tab and browser focus can become separated in an unexpected way.\n\t// (e.g the \"block\" tab is focused, but the \"post\" tab is selected).\n\tuseEffect( () => {\n\t\tconst tabsElements = Array.from(\n\t\t\ttabListRef.current?.querySelectorAll( '[role=\"tab\"]' ) || []\n\t\t);\n\t\tconst selectedTabElement = tabsElements.find(\n\t\t\t// We are purposefully using a custom `data-tab-id` attribute here\n\t\t\t// because we don't want rely on any assumptions about `Tabs`\n\t\t\t// component internals.\n\t\t\t( element ) => element.getAttribute( 'data-tab-id' ) === tabName\n\t\t);\n\t\tconst activeElement = selectedTabElement?.ownerDocument.activeElement;\n\t\tconst tabsHasFocus = tabsElements.some( ( element ) => {\n\t\t\treturn activeElement && activeElement.id === element.id;\n\t\t} );\n\t\tif (\n\t\t\ttabsHasFocus &&\n\t\t\tselectedTabElement &&\n\t\t\tselectedTabElement.id !== activeElement?.id\n\t\t) {\n\t\t\tselectedTabElement?.focus();\n\t\t}\n\t}, [ tabName ] );\n\n\treturn (\n\t\t<>\n\t\t\t<DefaultSidebar\n\t\t\t\tidentifier={ tabName }\n\t\t\t\ttitle={ __( 'Settings' ) }\n\t\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\t\theader={\n\t\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t\t<SettingsHeader ref={ tabListRef } />\n\t\t\t\t\t</Tabs.Context.Provider>\n\t\t\t\t}\n\t\t\t\theaderClassName=\"edit-site-sidebar-edit-mode__panel-tabs\"\n\t\t\t\t// This classname is added so we can apply a corrective negative\n\t\t\t\t// margin to the panel.\n\t\t\t\t// see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049\n\t\t\t\tclassName=\"edit-site-sidebar__panel\"\n\t\t\t\tisActiveByDefault\n\t\t\t>\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\ttabId=\"edit-post/document\"\n\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isEditingPage ? <PagePanels /> : <TemplatePanel /> }\n\t\t\t\t\t\t<PostLastRevisionPanel />\n\t\t\t\t\t\t<PostTaxonomiesPanel />\n\t\t\t\t\t\t<PostDiscussionPanel />\n\t\t\t\t\t\t<PageAttributesPanel />\n\t\t\t\t\t\t<PatternOverridesPanel />\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t<Tabs.TabPanel tabId=\"edit-post/block\" focusable={ false }>\n\t\t\t\t\t\t<InspectorSlot bubblesVirtually />\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t</DefaultSidebar>\n\t\t\t{ supportsGlobalStyles && <GlobalStylesSidebar /> }\n\t\t</>\n\t);\n};\n\nexport function SidebarComplementaryAreaFills() {\n\tuseAutoSwitchEditorSidebars();\n\tconst { tabName, supportsGlobalStyles, isEditingPage } = useSelect(\n\t\t( select ) => {\n\t\t\tconst sidebar =\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea( 'core' );\n\n\t\t\tconst _isEditorSidebarOpened = [\n\t\t\t\t'edit-post/block',\n\t\t\t\t'edit-post/document',\n\t\t\t].includes( sidebar );\n\t\t\tlet _tabName = sidebar;\n\t\t\tif ( ! _isEditorSidebarOpened ) {\n\t\t\t\t_tabName = !! select(\n\t\t\t\t\tblockEditorStore\n\t\t\t\t).getBlockSelectionStart()\n\t\t\t\t\t? 'edit-post/block'\n\t\t\t\t\t: 'edit-post/document';\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttabName: _tabName,\n\t\t\t\tsupportsGlobalStyles:\n\t\t\t\t\tselect( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t\t\tisEditingPage: select( editSiteStore ).isPage(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\t// `newSelectedTabId` could technically be falsey if no tab is selected (i.e.\n\t// the initial render) or when we don't want a tab displayed (i.e. the\n\t// sidebar is closed). These cases should both be covered by the `!!` check\n\t// below, so we shouldn't need any additional falsey handling.\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea( 'core', newSelectedTabId );\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\tselectedTabId={ tabName }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<FillContents\n\t\t\t\ttabName={ tabName }\n\t\t\t\tisEditingPage={ isEditingPage }\n\t\t\t\tsupportsGlobalStyles={ supportsGlobalStyles }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAWA,IAAAQ,eAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,oBAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,eAAA,GAAAF,sBAAA,CAAAT,OAAA;AACA,IAAAY,WAAA,GAAAH,sBAAA,CAAAT,OAAA;AACA,IAAAa,cAAA,GAAAJ,sBAAA,CAAAT,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AACA,IAAAe,WAAA,GAAAf,OAAA;AA9BA;AACA;AACA;;AAmBA;AACA;AACA;;AASA,MAAM;EAAEgB;AAAK,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;AAChD,MAAM;EAAEC,cAAc;EAAEC,2BAA2B;EAAEC;AAAsB,CAAC,GAC3E,IAAAJ,kBAAM,EAAEK,mBAAkB,CAAC;AAC5B,MAAM;EAAEC,IAAI,EAAEC,aAAa;EAAEC,IAAI,EAAEC;AAAc,CAAC,GAAG,IAAAC,0BAAc,EAClE,0BACD,CAAC;AACM,MAAMC,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAGF,aAAa;AAEjD,MAAMI,YAAY,GAAGA,CAAE;EAAEC,OAAO;EAAEC,aAAa;EAAEC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AAAC,aAAA,EAACxC,IAAI;IACJsF,aAAa,EAAGvE,OAAS;IACzBwE,QAAQ,EAAGJ,WAAa;IACxBK,YAAY,EAAG;EAAO,GAEtB,IAAAjD,MAAA,CAAAC,aAAA,EAAC1B,YAAY;IACZC,OAAO,EAAGA,OAAS;IACnBC,aAAa,EAAGA,aAAe;IAC/BC,oBAAoB,EAAGA;EAAsB,CAC7C,CACI,CAAC;AAET","ignoreList":[]}
|
|
@@ -13,6 +13,7 @@ var _coreData = require("@wordpress/core-data");
|
|
|
13
13
|
var _editor = require("@wordpress/editor");
|
|
14
14
|
var _router = require("@wordpress/router");
|
|
15
15
|
var _element = require("@wordpress/element");
|
|
16
|
+
var _notices = require("@wordpress/notices");
|
|
16
17
|
var _store = require("../../../store");
|
|
17
18
|
var _pageContent = _interopRequireDefault(require("./page-content"));
|
|
18
19
|
var _pageSummary = _interopRequireDefault(require("./page-summary"));
|
|
@@ -65,17 +66,47 @@ function PagePanels() {
|
|
|
65
66
|
renderingMode: getRenderingMode()
|
|
66
67
|
};
|
|
67
68
|
}, []);
|
|
69
|
+
const {
|
|
70
|
+
createSuccessNotice
|
|
71
|
+
} = (0, _data.useDispatch)(_notices.store);
|
|
68
72
|
const history = useHistory();
|
|
69
73
|
const onActionPerformed = (0, _element.useCallback)((actionId, items) => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
switch (actionId) {
|
|
75
|
+
case 'move-to-trash':
|
|
76
|
+
{
|
|
77
|
+
history.push({
|
|
78
|
+
path: '/' + items[0].type,
|
|
79
|
+
postId: undefined,
|
|
80
|
+
postType: undefined,
|
|
81
|
+
canvas: 'view'
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
break;
|
|
85
|
+
case 'duplicate-post':
|
|
86
|
+
{
|
|
87
|
+
const newItem = items[0];
|
|
88
|
+
const title = typeof newItem.title === 'string' ? newItem.title : newItem.title?.rendered;
|
|
89
|
+
createSuccessNotice((0, _i18n.sprintf)(
|
|
90
|
+
// translators: %s: Title of the created post e.g: "Post 1".
|
|
91
|
+
(0, _i18n.__)('"%s" successfully created.'), title), {
|
|
92
|
+
type: 'snackbar',
|
|
93
|
+
id: 'duplicate-post-action',
|
|
94
|
+
actions: [{
|
|
95
|
+
label: (0, _i18n.__)('Edit'),
|
|
96
|
+
onClick: () => {
|
|
97
|
+
history.push({
|
|
98
|
+
path: undefined,
|
|
99
|
+
postId: newItem.id,
|
|
100
|
+
postType: newItem.type,
|
|
101
|
+
canvas: 'edit'
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}]
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
break;
|
|
77
108
|
}
|
|
78
|
-
}, [history]);
|
|
109
|
+
}, [history, createSuccessNotice]);
|
|
79
110
|
if (!hasResolved) {
|
|
80
111
|
return null;
|
|
81
112
|
}
|
|
@@ -93,6 +124,6 @@ function PagePanels() {
|
|
|
93
124
|
postType: type
|
|
94
125
|
})), (0, _react.createElement)(_editor.PluginDocumentSettingPanel.Slot, null), renderingMode !== 'post-only' && (0, _react.createElement)(_components.PanelBody, {
|
|
95
126
|
title: (0, _i18n.__)('Content')
|
|
96
|
-
}, (0, _react.createElement)(_pageContent.default, null))
|
|
127
|
+
}, (0, _react.createElement)(_pageContent.default, null)));
|
|
97
128
|
}
|
|
98
129
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_data","_coreData","_editor","_router","_element","_store","_pageContent","_interopRequireDefault","_pageSummary","_lockUnlock","PostCardPanel","PostActions","unlock","editorPrivateApis","useHistory","routerPrivateApis","PagePanels","id","type","hasResolved","status","date","password","renderingMode","useSelect","select","getEditedPostContext","editSiteStore","getEditedEntityRecord","hasFinishedResolution","coreStore","getRenderingMode","editorStore","context","queryArgs","postType","postId","page","history","onActionPerformed","useCallback","actionId","items","push","path","undefined","canvas","
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_data","_coreData","_editor","_router","_element","_notices","_store","_pageContent","_interopRequireDefault","_pageSummary","_lockUnlock","PostCardPanel","PostActions","unlock","editorPrivateApis","useHistory","routerPrivateApis","PagePanels","id","type","hasResolved","status","date","password","renderingMode","useSelect","select","getEditedPostContext","editSiteStore","getEditedEntityRecord","hasFinishedResolution","coreStore","getRenderingMode","editorStore","context","queryArgs","postType","postId","page","createSuccessNotice","useDispatch","noticesStore","history","onActionPerformed","useCallback","actionId","items","push","path","undefined","canvas","newItem","title","rendered","sprintf","__","actions","label","onClick","_react","createElement","Fragment","PanelBody","default","PluginDocumentSettingPanel","Slot"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/page-panels/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { PanelBody } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tPluginDocumentSettingPanel,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useCallback } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport PageContent from './page-content';\nimport PageSummary from './page-summary';\n\nimport { unlock } from '../../../lock-unlock';\n\nconst { PostCardPanel, PostActions } = unlock( editorPrivateApis );\nconst { useHistory } = unlock( routerPrivateApis );\n\nexport default function PagePanels() {\n\tconst { id, type, hasResolved, status, date, password, renderingMode } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getEditedPostContext } = select( editSiteStore );\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getRenderingMode } = select( editorStore );\n\t\t\tconst context = getEditedPostContext();\n\t\t\tconst queryArgs = [ 'postType', context.postType, context.postId ];\n\t\t\tconst page = getEditedEntityRecord( ...queryArgs );\n\t\t\treturn {\n\t\t\t\thasResolved: hasFinishedResolution(\n\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\tqueryArgs\n\t\t\t\t),\n\t\t\t\tid: page?.id,\n\t\t\t\ttype: page?.type,\n\t\t\t\tstatus: page?.status,\n\t\t\t\tdate: page?.date,\n\t\t\t\tpassword: page?.password,\n\t\t\t\trenderingMode: getRenderingMode(),\n\t\t\t};\n\t\t}, [] );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst history = useHistory();\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\t\t{\n\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\tpath: '/' + items[ 0 ].type,\n\t\t\t\t\t\t\tpostId: undefined,\n\t\t\t\t\t\t\tpostType: undefined,\n\t\t\t\t\t\t\tcanvas: 'view',\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post e.g: \"Post 1\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\ttitle\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\t\t\t\t\tpath: undefined,\n\t\t\t\t\t\t\t\t\t\t\t\tpostId: newItem.id,\n\t\t\t\t\t\t\t\t\t\t\t\tpostType: newItem.type,\n\t\t\t\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[ history, createSuccessNotice ]\n\t);\n\n\tif ( ! hasResolved ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<PostCardPanel\n\t\t\t\tactions={\n\t\t\t\t\t<PostActions onActionPerformed={ onActionPerformed } />\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<PanelBody title={ __( 'Summary' ) }>\n\t\t\t\t<PageSummary\n\t\t\t\t\tstatus={ status }\n\t\t\t\t\tdate={ date }\n\t\t\t\t\tpassword={ password }\n\t\t\t\t\tpostId={ id }\n\t\t\t\t\tpostType={ type }\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t\t<PluginDocumentSettingPanel.Slot />\n\t\t\t{ renderingMode !== 'post-only' && (\n\t\t\t\t<PanelBody title={ __( 'Content' ) }>\n\t\t\t\t\t<PageContent />\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,OAAA,G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;gBACT,CAAE,CAAC;cACJ;YACD,CAAC;UAEH,CACD,CAAC;QACF;QACA;IACF;EACD,CAAC,EACD,CAAER,OAAO,EAAEH,mBAAmB,CAC/B,CAAC;EAED,IAAK,CAAEnB,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAuC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,EAACjD,aAAa;IACb6C,OAAO,EACN,IAAAG,MAAA,CAAAC,aAAA,EAAChD,WAAW;MAAC+B,iBAAiB,EAAGA;IAAmB,CAAE;EACtD,CACD,CAAC,EACF,IAAAgB,MAAA,CAAAC,aAAA,EAAC/D,WAAA,CAAAiE,SAAS;IAACV,KAAK,EAAG,IAAAG,QAAE,EAAE,SAAU;EAAG,GACnC,IAAAI,MAAA,CAAAC,aAAA,EAACnD,YAAA,CAAAsD,OAAW;IACX1C,MAAM,EAAGA,MAAQ;IACjBC,IAAI,EAAGA,IAAM;IACbC,QAAQ,EAAGA,QAAU;IACrBc,MAAM,EAAGnB,EAAI;IACbkB,QAAQ,EAAGjB;EAAM,CACjB,CACS,CAAC,EACZ,IAAAwC,MAAA,CAAAC,aAAA,EAAC1D,OAAA,CAAA8D,0BAA0B,CAACC,IAAI,MAAE,CAAC,EACjCzC,aAAa,KAAK,WAAW,IAC9B,IAAAmC,MAAA,CAAAC,aAAA,EAAC/D,WAAA,CAAAiE,SAAS;IAACV,KAAK,EAAG,IAAAG,QAAE,EAAE,SAAU;EAAG,GACnC,IAAAI,MAAA,CAAAC,aAAA,EAACrD,YAAA,CAAAwD,OAAW,MAAE,CACJ,CAEX,CAAC;AAEL","ignoreList":[]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -8,7 +7,7 @@ exports.default = PageSummary;
|
|
|
8
7
|
var _react = require("react");
|
|
9
8
|
var _components = require("@wordpress/components");
|
|
10
9
|
var _editor = require("@wordpress/editor");
|
|
11
|
-
var
|
|
10
|
+
var _lockUnlock = require("../../../lock-unlock");
|
|
12
11
|
/**
|
|
13
12
|
* WordPress dependencies
|
|
14
13
|
*/
|
|
@@ -17,23 +16,31 @@ var _pageStatus = _interopRequireDefault(require("./page-status"));
|
|
|
17
16
|
* Internal dependencies
|
|
18
17
|
*/
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
const {
|
|
20
|
+
PrivatePostExcerptPanel,
|
|
21
|
+
PostStatus,
|
|
22
|
+
PostContentInformation,
|
|
23
|
+
PostLastEditedPanel
|
|
24
|
+
} = (0, _lockUnlock.unlock)(_editor.privateApis);
|
|
25
|
+
function PageSummary() {
|
|
27
26
|
return (0, _react.createElement)(_components.__experimentalVStack, {
|
|
28
27
|
spacing: 0
|
|
29
|
-
}, (0, _react.createElement)(_editor.PluginPostStatusInfo.Slot, null, fills => (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(
|
|
28
|
+
}, (0, _react.createElement)(_editor.PluginPostStatusInfo.Slot, null, fills => (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.__experimentalVStack, {
|
|
29
|
+
spacing: 3
|
|
30
|
+
// TODO: this needs to be consolidated with the panel in post editor, when we unify them.
|
|
31
|
+
,
|
|
32
|
+
style: {
|
|
33
|
+
marginBlockEnd: '24px'
|
|
34
|
+
}
|
|
35
|
+
}, (0, _react.createElement)(_editor.PostFeaturedImagePanel, {
|
|
30
36
|
withPanelBody: false
|
|
31
|
-
}), (0, _react.createElement)(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
}), (0, _react.createElement)(PrivatePostExcerptPanel, null), (0, _react.createElement)(_components.__experimentalVStack, {
|
|
38
|
+
spacing: 1
|
|
39
|
+
}, (0, _react.createElement)(PostContentInformation, null), (0, _react.createElement)(PostLastEditedPanel, null))), (0, _react.createElement)(_components.__experimentalVStack, {
|
|
40
|
+
spacing: 1,
|
|
41
|
+
style: {
|
|
42
|
+
marginBlockEnd: '12px'
|
|
43
|
+
}
|
|
44
|
+
}, (0, _react.createElement)(PostStatus, null), (0, _react.createElement)(_editor.PostSchedulePanel, null), (0, _react.createElement)(_editor.PostTemplatePanel, null), (0, _react.createElement)(_editor.PostURLPanel, null)), (0, _react.createElement)(_editor.PostAuthorPanel, null), fills)));
|
|
38
45
|
}
|
|
39
46
|
//# sourceMappingURL=page-summary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_editor","
|
|
1
|
+
{"version":3,"names":["_components","require","_editor","_lockUnlock","PrivatePostExcerptPanel","PostStatus","PostContentInformation","PostLastEditedPanel","unlock","editorPrivateApis","PageSummary","_react","createElement","__experimentalVStack","spacing","PluginPostStatusInfo","Slot","fills","Fragment","style","marginBlockEnd","PostFeaturedImagePanel","withPanelBody","PostSchedulePanel","PostTemplatePanel","PostURLPanel","PostAuthorPanel"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/page-panels/page-summary.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport {\n\tPluginPostStatusInfo,\n\tPostAuthorPanel,\n\tPostURLPanel,\n\tPostSchedulePanel,\n\tPostTemplatePanel,\n\tPostFeaturedImagePanel,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst {\n\tPrivatePostExcerptPanel,\n\tPostStatus,\n\tPostContentInformation,\n\tPostLastEditedPanel,\n} = unlock( editorPrivateApis );\n\nexport default function PageSummary() {\n\treturn (\n\t\t<VStack spacing={ 0 }>\n\t\t\t<PluginPostStatusInfo.Slot>\n\t\t\t\t{ ( fills ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\t\t\t// TODO: this needs to be consolidated with the panel in post editor, when we unify them.\n\t\t\t\t\t\t\tstyle={ { marginBlockEnd: '24px' } }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PostFeaturedImagePanel withPanelBody={ false } />\n\t\t\t\t\t\t\t<PrivatePostExcerptPanel />\n\t\t\t\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t\t\t\t<PostContentInformation />\n\t\t\t\t\t\t\t\t<PostLastEditedPanel />\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\t\tstyle={ { marginBlockEnd: '12px' } }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PostStatus />\n\t\t\t\t\t\t\t<PostSchedulePanel />\n\t\t\t\t\t\t\t<PostTemplatePanel />\n\t\t\t\t\t\t\t<PostURLPanel />\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t<PostAuthorPanel />\n\t\t\t\t\t\t{ fills }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</PluginPostStatusInfo.Slot>\n\t\t</VStack>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAaA,IAAAE,WAAA,GAAAF,OAAA;AAjBA;AACA;AACA;;AAYA;AACA;AACA;;AAGA,MAAM;EACLG,uBAAuB;EACvBC,UAAU;EACVC,sBAAsB;EACtBC;AACD,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAEhB,SAASC,WAAWA,CAAA,EAAG;EACrC,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACZ,W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@@ -32,9 +32,6 @@ var _lockUnlock = require("../../../lock-unlock");
|
|
|
32
32
|
const {
|
|
33
33
|
PostCardPanel
|
|
34
34
|
} = (0, _lockUnlock.unlock)(_editor.privateApis);
|
|
35
|
-
const {
|
|
36
|
-
PatternOverridesPanel
|
|
37
|
-
} = (0, _lockUnlock.unlock)(_editor.privateApis);
|
|
38
35
|
const {
|
|
39
36
|
useHistory
|
|
40
37
|
} = (0, _lockUnlock.unlock)(_router.privateApis);
|
|
@@ -118,13 +115,13 @@ function TemplatePanel() {
|
|
|
118
115
|
});
|
|
119
116
|
}
|
|
120
117
|
})
|
|
121
|
-
}), (0, _react.createElement)(_pluginTemplateSettingPanel.default.Slot, null), availablePatterns?.length > 0 && (0, _react.createElement)(_components.PanelBody, {
|
|
118
|
+
}), (0, _react.createElement)(_pluginTemplateSettingPanel.default.Slot, null), (0, _react.createElement)(_editor.PluginDocumentSettingPanel.Slot, null), availablePatterns?.length > 0 && (0, _react.createElement)(_components.PanelBody, {
|
|
122
119
|
title: (0, _i18n.__)('Transform into:'),
|
|
123
120
|
initialOpen: postType === _constants.TEMPLATE_PART_POST_TYPE
|
|
124
121
|
}, (0, _react.createElement)(_components.PanelRow, null, (0, _react.createElement)("p", null, (0, _i18n.__)('Choose a predefined pattern to switch up the look of your template.' // TODO - make this dynamic?
|
|
125
122
|
))), (0, _react.createElement)(TemplatesList, {
|
|
126
123
|
availableTemplates: availablePatterns,
|
|
127
124
|
onSelect: onTemplateSelect
|
|
128
|
-
}))
|
|
125
|
+
})));
|
|
129
126
|
}
|
|
130
127
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_components","_editor","_coreData","_i18n","_compose","_blocks","_blockEditor","_router","_store","_templateActions","_interopRequireDefault","_pluginTemplateSettingPanel","_hooks","_constants","_lockUnlock","PostCardPanel","unlock","editorPrivateApis","
|
|
1
|
+
{"version":3,"names":["_data","require","_components","_editor","_coreData","_i18n","_compose","_blocks","_blockEditor","_router","_store","_templateActions","_interopRequireDefault","_pluginTemplateSettingPanel","_hooks","_constants","_lockUnlock","PostCardPanel","unlock","editorPrivateApis","useHistory","routerPrivateApis","TemplatesList","availableTemplates","onSelect","shownTemplates","useAsyncList","length","_react","createElement","__experimentalBlockPatternsList","label","__","blockPatterns","shownPatterns","onClickPattern","showTitlesAsTooltip","POST_TYPE_PATH","wp_template","wp_template_part","TemplatePanel","title","description","record","postType","postId","useSelect","select","getEditedPostType","getEditedPostId","editSiteStore","getEditedEntityRecord","coreStore","__experimentalGetTemplateInfo","getTemplateInfo","editorStore","type","_postId","_record","info","icon","history","availablePatterns","useAvailablePatterns","editEntityRecord","useDispatch","onTemplateSelect","selectedTemplate","blocks","content","serialize","Fragment","className","actions","default","toggleProps","size","onRemove","push","path","Slot","PluginDocumentSettingPanel","PanelBody","initialOpen","TEMPLATE_PART_POST_TYPE","PanelRow"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/template-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport {\n\tPluginDocumentSettingPanel,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { useAsyncList } from '@wordpress/compose';\nimport { serialize } from '@wordpress/blocks';\nimport { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport TemplateActions from '../../template-actions';\nimport PluginTemplateSettingPanel from '../../plugin-template-setting-panel';\nimport { useAvailablePatterns } from './hooks';\nimport { TEMPLATE_PART_POST_TYPE } from '../../../utils/constants';\nimport { unlock } from '../../../lock-unlock';\n\nconst { PostCardPanel } = unlock( editorPrivateApis );\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction TemplatesList( { availableTemplates, onSelect } ) {\n\tconst shownTemplates = useAsyncList( availableTemplates );\n\tif ( ! availableTemplates || availableTemplates?.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tlabel={ __( 'Templates' ) }\n\t\t\tblockPatterns={ availableTemplates }\n\t\t\tshownPatterns={ shownTemplates }\n\t\t\tonClickPattern={ onSelect }\n\t\t\tshowTitlesAsTooltip\n\t\t/>\n\t);\n}\n\nconst POST_TYPE_PATH = {\n\twp_template: '/wp_template',\n\twp_template_part: '/patterns',\n};\n\nexport default function TemplatePanel() {\n\tconst { title, description, record, postType, postId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostType, getEditedPostId } =\n\t\t\t\tselect( editSiteStore );\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst { __experimentalGetTemplateInfo: getTemplateInfo } =\n\t\t\t\tselect( editorStore );\n\n\t\t\tconst type = getEditedPostType();\n\t\t\tconst _postId = getEditedPostId();\n\t\t\tconst _record = getEditedEntityRecord( 'postType', type, _postId );\n\t\t\tconst info = getTemplateInfo( _record );\n\n\t\t\treturn {\n\t\t\t\ttitle: info.title,\n\t\t\t\tdescription: info.description,\n\t\t\t\ticon: info.icon,\n\t\t\t\trecord: _record,\n\t\t\t\tpostType: type,\n\t\t\t\tpostId: _postId,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst history = useHistory();\n\tconst availablePatterns = useAvailablePatterns( record );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tif ( ! title && ! description ) {\n\t\treturn null;\n\t}\n\n\tconst onTemplateSelect = async ( selectedTemplate ) => {\n\t\tawait editEntityRecord( 'postType', postType, postId, {\n\t\t\tblocks: selectedTemplate.blocks,\n\t\t\tcontent: serialize( selectedTemplate.blocks ),\n\t\t} );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<PostCardPanel\n\t\t\t\tclassName=\"edit-site-template-card\"\n\t\t\t\tactions={\n\t\t\t\t\t<TemplateActions\n\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\tclassName=\"edit-site-template-card__actions\"\n\t\t\t\t\t\ttoggleProps={ { size: 'small' } }\n\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\tpath: POST_TYPE_PATH[ postType ],\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<PluginTemplateSettingPanel.Slot />\n\t\t\t<PluginDocumentSettingPanel.Slot />\n\t\t\t{ availablePatterns?.length > 0 && (\n\t\t\t\t<PanelBody\n\t\t\t\t\ttitle={ __( 'Transform into:' ) }\n\t\t\t\t\tinitialOpen={ postType === TEMPLATE_PART_POST_TYPE }\n\t\t\t\t>\n\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Choose a predefined pattern to switch up the look of your template.' // TODO - make this dynamic?\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</PanelRow>\n\n\t\t\t\t\t<TemplatesList\n\t\t\t\t\t\tavailableTemplates={ availablePatterns }\n\t\t\t\t\t\tonSelect={ onTemplateSelect }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAKA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ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buD,SAAS,EAAC,yBAAyB;IACnCC,OAAO,EACN,IAAA7C,MAAA,CAAAC,aAAA,EAAClB,gBAAA,CAAA+D,OAAe;MACf9B,QAAQ,EAAGA,QAAU;MACrBC,MAAM,EAAGA,MAAQ;MACjB2B,SAAS,EAAC,kCAAkC;MAC5CG,WAAW,EAAG;QAAEC,IAAI,EAAE;MAAQ,CAAG;MACjCC,QAAQ,EAAGA,CAAA,KAAM;QAChBhB,OAAO,CAACiB,IAAI,CAAE;UACbC,IAAI,EAAE1C,cAAc,CAAEO,QAAQ;QAC/B,CAAE,CAAC;MACJ;IAAG,CACH;EACD,CACD,CAAC,EACF,IAAAhB,MAAA,CAAAC,aAAA,EAAChB,2BAAA,CAAA6D,OAA0B,CAACM,IAAI,MAAE,CAAC,EACnC,IAAApD,MAAA,CAAAC,aAAA,EAAC1B,OAAA,CAAA8E,0BAA0B,CAACD,IAAI,MAAE,CAAC,EACjClB,iBAAiB,EAAEnC,MAAM,GAAG,CAAC,IAC9B,IAAAC,MAAA,CAAAC,aAAA,EAAC3B,WAAA,CAAAgF,SAAS;IACTzC,KAAK,EAAG,IAAAT,QAAE,EAAE,iBAAkB,CAAG;IACjCmD,WAAW,EAAGvC,QAAQ,KAAKwC;EAAyB,GAEpD,IAAAxD,MAAA,CAAAC,aAAA,EAAC3B,WAAA,CAAAmF,QAAQ,QACR,IAAAzD,MAAA,CAAAC,aAAA,aACG,IAAAG,QAAE,EACH,qEAAqE,CAAC;EACvE,CACE,CACM,CAAC,EAEX,IAAAJ,MAAA,CAAAC,aAAA,EAACP,aAAa;IACbC,kBAAkB,EAAGuC,iBAAmB;IACxCtC,QAAQ,EAAG0C;EAAkB,CAC7B,CACS,CAEX,CAAC;AAEL","ignoreList":[]}
|
|
@@ -18,6 +18,7 @@ var _url = require("@wordpress/url");
|
|
|
18
18
|
var _element = require("@wordpress/element");
|
|
19
19
|
var _router = require("@wordpress/router");
|
|
20
20
|
var _editor = require("@wordpress/editor");
|
|
21
|
+
var _notices = require("@wordpress/notices");
|
|
21
22
|
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
22
23
|
var _lockUnlock = require("../../lock-unlock");
|
|
23
24
|
var _store = require("../../store");
|
|
@@ -46,6 +47,9 @@ function SidebarNavigationScreenPage({
|
|
|
46
47
|
setCanvasMode
|
|
47
48
|
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
48
49
|
const history = useHistory();
|
|
50
|
+
const {
|
|
51
|
+
createSuccessNotice
|
|
52
|
+
} = (0, _data.useDispatch)(_notices.store);
|
|
49
53
|
const {
|
|
50
54
|
params: {
|
|
51
55
|
postId
|
|
@@ -82,15 +86,42 @@ function SidebarNavigationScreenPage({
|
|
|
82
86
|
}
|
|
83
87
|
}, [hasResolved, record, history]);
|
|
84
88
|
const onActionPerformed = (0, _element.useCallback)((actionId, items) => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
switch (actionId) {
|
|
90
|
+
case 'move-to-trash':
|
|
91
|
+
{
|
|
92
|
+
history.push({
|
|
93
|
+
path: '/' + items[0].type,
|
|
94
|
+
postId: undefined,
|
|
95
|
+
postType: undefined,
|
|
96
|
+
canvas: 'view'
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
case 'duplicate-post':
|
|
101
|
+
{
|
|
102
|
+
const newItem = items[0];
|
|
103
|
+
const title = typeof newItem.title === 'string' ? newItem.title : newItem.title?.rendered;
|
|
104
|
+
createSuccessNotice((0, _i18n.sprintf)(
|
|
105
|
+
// translators: %s: Title of the created post e.g: "Post 1".
|
|
106
|
+
(0, _i18n.__)('"%s" successfully created.'), title), {
|
|
107
|
+
type: 'snackbar',
|
|
108
|
+
id: 'duplicate-post-action',
|
|
109
|
+
actions: [{
|
|
110
|
+
label: (0, _i18n.__)('Edit'),
|
|
111
|
+
onClick: () => {
|
|
112
|
+
history.push({
|
|
113
|
+
path: undefined,
|
|
114
|
+
postId: newItem.id,
|
|
115
|
+
postType: newItem.type,
|
|
116
|
+
canvas: 'edit'
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}]
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
break;
|
|
92
123
|
}
|
|
93
|
-
}, [history]);
|
|
124
|
+
}, [history, createSuccessNotice]);
|
|
94
125
|
const featureImageAltText = featuredMediaAltText ? (0, _htmlEntities.decodeEntities)(featuredMediaAltText) : (0, _htmlEntities.decodeEntities)(record?.title?.rendered || (0, _i18n.__)('Featured image'));
|
|
95
126
|
return record ? (0, _react.createElement)(_sidebarNavigationScreen.default, {
|
|
96
127
|
backPath: backPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_data","_components","_coreData","_htmlEntities","_icons","_dom","_escapeHtml","_url","_element","_router","_editor","_sidebarNavigationScreen","_interopRequireDefault","_lockUnlock","_store","_sidebarButton","_pageDetails","_sidebarNavigationScreenDetailsFooter","useLocation","useHistory","unlock","routerPrivateApis","PostActions","editorPrivateApis","SidebarNavigationScreenPage","backPath","setCanvasMode","useDispatch","editSiteStore","history","params","postId","record","hasResolved","useEntityRecord","featuredMediaAltText","featuredMediaSourceUrl","useSelect","select","getEntityRecord","coreStore","attachedMedia","featured_media","media_details","sizes","medium","source_url","escapeAttribute","alt_text","description","raw","useEffect","push","path","undefined","postType","canvas","onActionPerformed","useCallback","actionId","items","type","featureImageAltText","decodeEntities","title","rendered","__","_react","createElement","default","actions","Fragment","buttonProps","size","onClick","label","icon","pencil","meta","ExternalLink","className","href","link","filterURLForDisplay","safeDecodeURIComponent","content","__experimentalVStack","alignment","spacing","alt","src","excerpt","__experimentalTruncate","numberOfLines","stripHTML","id","footer","modified"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\t__experimentalVStack as VStack,\n\tExternalLink,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { store as coreStore, useEntityRecord } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { pencil } from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { escapeAttribute } from '@wordpress/escape-html';\nimport { safeDecodeURIComponent, filterURLForDisplay } from '@wordpress/url';\nimport { useEffect, useCallback } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport PageDetails from './page-details';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\nconst { PostActions } = unlock( editorPrivateApis );\n\nexport default function SidebarNavigationScreenPage( { backPath } ) {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst history = useHistory();\n\tconst {\n\t\tparams: { postId },\n\t} = useLocation();\n\tconst { record, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'page',\n\t\tpostId\n\t);\n\n\tconst { featuredMediaAltText, featuredMediaSourceUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\t// Featured image.\n\t\t\tconst attachedMedia = record?.featured_media\n\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\trecord?.featured_media\n\t\t\t\t )\n\t\t\t\t: null;\n\n\t\t\treturn {\n\t\t\t\tfeaturedMediaSourceUrl:\n\t\t\t\t\tattachedMedia?.media_details.sizes?.medium?.source_url ||\n\t\t\t\t\tattachedMedia?.source_url,\n\t\t\t\tfeaturedMediaAltText: escapeAttribute(\n\t\t\t\t\tattachedMedia?.alt_text ||\n\t\t\t\t\t\tattachedMedia?.description?.raw ||\n\t\t\t\t\t\t''\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ record ]\n\t);\n\n\t// Redirect to the main pages navigation screen if the page is not found or has been deleted.\n\tuseEffect( () => {\n\t\tif ( hasResolved && ! record ) {\n\t\t\thistory.push( {\n\t\t\t\tpath: '/page',\n\t\t\t\tpostId: undefined,\n\t\t\t\tpostType: undefined,\n\t\t\t\tcanvas: 'view',\n\t\t\t} );\n\t\t}\n\t}, [ hasResolved, record, history ] );\n\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tif ( actionId === 'move-to-trash' ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpath: '/' + items[ 0 ].type,\n\t\t\t\t\tpostId: undefined,\n\t\t\t\t\tpostType: undefined,\n\t\t\t\t\tcanvas: 'view',\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\n\tconst featureImageAltText = featuredMediaAltText\n\t\t? decodeEntities( featuredMediaAltText )\n\t\t: decodeEntities( record?.title?.rendered || __( 'Featured image' ) );\n\n\treturn record ? (\n\t\t<SidebarNavigationScreen\n\t\t\tbackPath={ backPath }\n\t\t\ttitle={ decodeEntities(\n\t\t\t\trecord?.title?.rendered || __( '(no title)' )\n\t\t\t) }\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<PostActions\n\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\tbuttonProps={ { size: 'default' } }\n\t\t\t\t\t/>\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\t\ticon={ pencil }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tmeta={\n\t\t\t\t<ExternalLink\n\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__page-link\"\n\t\t\t\t\thref={ record.link }\n\t\t\t\t>\n\t\t\t\t\t{ filterURLForDisplay(\n\t\t\t\t\t\tsafeDecodeURIComponent( record.link )\n\t\t\t\t\t) }\n\t\t\t\t</ExternalLink>\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ !! featuredMediaSourceUrl && (\n\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-page__featured-image-wrapper\"\n\t\t\t\t\t\t\talignment=\"left\"\n\t\t\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen-page__featured-image has-image\">\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\talt={ featureImageAltText }\n\t\t\t\t\t\t\t\t\tsrc={ featuredMediaSourceUrl }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t) }\n\t\t\t\t\t{ !! record?.excerpt?.rendered && (\n\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-page__excerpt\"\n\t\t\t\t\t\t\tnumberOfLines={ 3 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ stripHTML( record.excerpt.rendered ) }\n\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t) }\n\t\t\t\t\t<PageDetails id={ postId } />\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\trecord?.modified ? (\n\t\t\t\t\t<SidebarNavigationScreenDetailsFooter record={ record } />\n\t\t\t\t) : null\n\t\t\t}\n\t\t/>\n\t) : null;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OA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EAAG;IAAG,GAEb,IAAArB,MAAA,CAAAC,aAAA;MAAKY,SAAS,EAAC;IAAoE,GAClF,IAAAb,MAAA,CAAAC,aAAA;MACCqB,GAAG,EAAG3B,mBAAqB;MAC3B4B,GAAG,EAAGtD;IAAwB,CAC9B,CACG,CACE,CACR,EACC,CAAC,CAAEJ,MAAM,EAAE2D,OAAO,EAAE1B,QAAQ,IAC7B,IAAAE,MAAA,CAAAC,aAAA,EAACnE,WAAA,CAAA2F,sBAAQ;MACRZ,SAAS,EAAC,mDAAmD;MAC7Da,aAAa,EAAG;IAAG,GAEjB,IAAAC,wBAAS,EAAE9D,MAAM,CAAC2D,OAAO,CAAC1B,QAAS,CAC5B,CACV,EACD,IAAAE,MAAA,CAAAC,aAAA,EAACpD,YAAA,CAAAqD,OAAW;MAAC0B,EAAE,EAAGhE;IAAQ,CAAE,CAC3B,CACF;IACDiE,MAAM,EACLhE,MAAM,EAAEiE,QAAQ,GACf,IAAA9B,MAAA,CAAAC,aAAA,EAACnD,qCAAA,CAAAoD,OAAoC;MAACrC,MAAM,EAAGA;IAAQ,CAAE,CAAC,GACvD;EACJ,CACD,CAAC,GACC,IAAI;AACT","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_data","_components","_coreData","_htmlEntities","_icons","_dom","_escapeHtml","_url","_element","_router","_editor","_notices","_sidebarNavigationScreen","_interopRequireDefault","_lockUnlock","_store","_sidebarButton","_pageDetails","_sidebarNavigationScreenDetailsFooter","useLocation","useHistory","unlock","routerPrivateApis","PostActions","editorPrivateApis","SidebarNavigationScreenPage","backPath","setCanvasMode","useDispatch","editSiteStore","history","createSuccessNotice","noticesStore","params","postId","record","hasResolved","useEntityRecord","featuredMediaAltText","featuredMediaSourceUrl","useSelect","select","getEntityRecord","coreStore","attachedMedia","featured_media","media_details","sizes","medium","source_url","escapeAttribute","alt_text","description","raw","useEffect","push","path","undefined","postType","canvas","onActionPerformed","useCallback","actionId","items","type","newItem","title","rendered","sprintf","__","id","actions","label","onClick","featureImageAltText","decodeEntities","_react","createElement","default","Fragment","buttonProps","size","icon","pencil","meta","ExternalLink","className","href","link","filterURLForDisplay","safeDecodeURIComponent","content","__experimentalVStack","alignment","spacing","alt","src","excerpt","__experimentalTruncate","numberOfLines","stripHTML","footer","modified"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\t__experimentalVStack as VStack,\n\tExternalLink,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { store as coreStore, useEntityRecord } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { pencil } from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { escapeAttribute } from '@wordpress/escape-html';\nimport { safeDecodeURIComponent, filterURLForDisplay } from '@wordpress/url';\nimport { useEffect, useCallback } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport PageDetails from './page-details';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\nconst { PostActions } = unlock( editorPrivateApis );\n\nexport default function SidebarNavigationScreenPage( { backPath } ) {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst history = useHistory();\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst {\n\t\tparams: { postId },\n\t} = useLocation();\n\tconst { record, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'page',\n\t\tpostId\n\t);\n\n\tconst { featuredMediaAltText, featuredMediaSourceUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\t// Featured image.\n\t\t\tconst attachedMedia = record?.featured_media\n\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\trecord?.featured_media\n\t\t\t\t )\n\t\t\t\t: null;\n\n\t\t\treturn {\n\t\t\t\tfeaturedMediaSourceUrl:\n\t\t\t\t\tattachedMedia?.media_details.sizes?.medium?.source_url ||\n\t\t\t\t\tattachedMedia?.source_url,\n\t\t\t\tfeaturedMediaAltText: escapeAttribute(\n\t\t\t\t\tattachedMedia?.alt_text ||\n\t\t\t\t\t\tattachedMedia?.description?.raw ||\n\t\t\t\t\t\t''\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ record ]\n\t);\n\n\t// Redirect to the main pages navigation screen if the page is not found or has been deleted.\n\tuseEffect( () => {\n\t\tif ( hasResolved && ! record ) {\n\t\t\thistory.push( {\n\t\t\t\tpath: '/page',\n\t\t\t\tpostId: undefined,\n\t\t\t\tpostType: undefined,\n\t\t\t\tcanvas: 'view',\n\t\t\t} );\n\t\t}\n\t}, [ hasResolved, record, history ] );\n\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\t\t{\n\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\tpath: '/' + items[ 0 ].type,\n\t\t\t\t\t\t\tpostId: undefined,\n\t\t\t\t\t\t\tpostType: undefined,\n\t\t\t\t\t\t\tcanvas: 'view',\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post e.g: \"Post 1\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\ttitle\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\t\t\t\t\tpath: undefined,\n\t\t\t\t\t\t\t\t\t\t\t\tpostId: newItem.id,\n\t\t\t\t\t\t\t\t\t\t\t\tpostType: newItem.type,\n\t\t\t\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[ history, createSuccessNotice ]\n\t);\n\n\tconst featureImageAltText = featuredMediaAltText\n\t\t? decodeEntities( featuredMediaAltText )\n\t\t: decodeEntities( record?.title?.rendered || __( 'Featured image' ) );\n\n\treturn record ? (\n\t\t<SidebarNavigationScreen\n\t\t\tbackPath={ backPath }\n\t\t\ttitle={ decodeEntities(\n\t\t\t\trecord?.title?.rendered || __( '(no title)' )\n\t\t\t) }\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<PostActions\n\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\tbuttonProps={ { size: 'default' } }\n\t\t\t\t\t/>\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\t\ticon={ pencil }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tmeta={\n\t\t\t\t<ExternalLink\n\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__page-link\"\n\t\t\t\t\thref={ record.link }\n\t\t\t\t>\n\t\t\t\t\t{ filterURLForDisplay(\n\t\t\t\t\t\tsafeDecodeURIComponent( record.link )\n\t\t\t\t\t) }\n\t\t\t\t</ExternalLink>\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ !! featuredMediaSourceUrl && (\n\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-page__featured-image-wrapper\"\n\t\t\t\t\t\t\talignment=\"left\"\n\t\t\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen-page__featured-image has-image\">\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\talt={ featureImageAltText }\n\t\t\t\t\t\t\t\t\tsrc={ featuredMediaSourceUrl }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t) }\n\t\t\t\t\t{ !! record?.excerpt?.rendered && (\n\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-page__excerpt\"\n\t\t\t\t\t\t\tnumberOfLines={ 3 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ stripHTML( record.excerpt.rendered ) }\n\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t) }\n\t\t\t\t\t<PageDetails id={ postId } />\n\t\t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CACG,CACE,CACR,EACC,CAAC,CAAEJ,MAAM,EAAE8D,OAAO,EAAE9B,QAAQ,IAC7B,IAAAS,MAAA,CAAAC,aAAA,EAAC5E,WAAA,CAAAiG,sBAAQ;MACRZ,SAAS,EAAC,mDAAmD;MAC7Da,aAAa,EAAG;IAAG,GAEjB,IAAAC,wBAAS,EAAEjE,MAAM,CAAC8D,OAAO,CAAC9B,QAAS,CAC5B,CACV,EACD,IAAAS,MAAA,CAAAC,aAAA,EAAC5D,YAAA,CAAA6D,OAAW;MAACR,EAAE,EAAGpC;IAAQ,CAAE,CAC3B,CACF;IACDmE,MAAM,EACLlE,MAAM,EAAEmE,QAAQ,GACf,IAAA1B,MAAA,CAAAC,aAAA,EAAC3D,qCAAA,CAAA4D,OAAoC;MAAC3C,MAAM,EAAGA;IAAQ,CAAE,CAAC,GACvD;EACJ,CACD,CAAC,GACC,IAAI;AACT","ignoreList":[]}
|
|
@@ -9,7 +9,6 @@ var _react = require("react");
|
|
|
9
9
|
var _data = require("@wordpress/data");
|
|
10
10
|
var _i18n = require("@wordpress/i18n");
|
|
11
11
|
var _icons = require("@wordpress/icons");
|
|
12
|
-
var _url = require("@wordpress/url");
|
|
13
12
|
var _router = require("@wordpress/router");
|
|
14
13
|
var _sidebarButton = _interopRequireDefault(require("../sidebar-button"));
|
|
15
14
|
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
@@ -18,7 +17,6 @@ var _usePatternDetails = _interopRequireDefault(require("./use-pattern-details")
|
|
|
18
17
|
var _store = require("../../store");
|
|
19
18
|
var _lockUnlock = require("../../lock-unlock");
|
|
20
19
|
var _templateActions = _interopRequireDefault(require("../template-actions"));
|
|
21
|
-
var _constants = require("../../utils/constants");
|
|
22
20
|
/**
|
|
23
21
|
* WordPress dependencies
|
|
24
22
|
*/
|
|
@@ -37,24 +35,19 @@ function SidebarNavigationScreenPattern() {
|
|
|
37
35
|
const {
|
|
38
36
|
params: {
|
|
39
37
|
postType,
|
|
40
|
-
postId
|
|
38
|
+
postId,
|
|
39
|
+
categoryId,
|
|
40
|
+
categoryType
|
|
41
41
|
}
|
|
42
42
|
} = location;
|
|
43
|
-
const {
|
|
44
|
-
categoryType
|
|
45
|
-
} = (0, _url.getQueryArgs)(window.location.href);
|
|
46
43
|
const {
|
|
47
44
|
setCanvasMode
|
|
48
45
|
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
49
46
|
(0, _useInitEditedEntityFromUrl.default)();
|
|
50
47
|
const patternDetails = (0, _usePatternDetails.default)(postType, postId);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
// page and the back button should return them to that list page.
|
|
55
|
-
const backPath = !categoryType && postType === _constants.TEMPLATE_PART_POST_TYPE ? {
|
|
56
|
-
path: '/wp_template_part/all'
|
|
57
|
-
} : {
|
|
48
|
+
const backPath = {
|
|
49
|
+
categoryId,
|
|
50
|
+
categoryType,
|
|
58
51
|
path: '/patterns'
|
|
59
52
|
};
|
|
60
53
|
return (0, _react.createElement)(_sidebarNavigationScreen.default, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_i18n","_icons","
|
|
1
|
+
{"version":3,"names":["_data","require","_i18n","_icons","_router","_sidebarButton","_interopRequireDefault","_sidebarNavigationScreen","_useInitEditedEntityFromUrl","_usePatternDetails","_store","_lockUnlock","_templateActions","useLocation","useHistory","unlock","routerPrivateApis","SidebarNavigationScreenPattern","history","location","params","postType","postId","categoryId","categoryType","setCanvasMode","useDispatch","editSiteStore","useInitEditedEntityFromURL","patternDetails","usePatternDetails","backPath","path","_react","createElement","default","actions","Fragment","toggleProps","as","SidebarButton","onRemove","push","onClick","label","__","icon","pencil"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { pencil } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';\nimport usePatternDetails from './use-pattern-details';\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport TemplateActions from '../template-actions';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nexport default function SidebarNavigationScreenPattern() {\n\tconst history = useHistory();\n\tconst location = useLocation();\n\tconst {\n\t\tparams: { postType, postId, categoryId, categoryType },\n\t} = location;\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tuseInitEditedEntityFromURL();\n\n\tconst patternDetails = usePatternDetails( postType, postId );\n\n\tconst backPath = {\n\t\tcategoryId,\n\t\tcategoryType,\n\t\tpath: '/patterns',\n\t};\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<TemplateActions\n\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\ttoggleProps={ { as: SidebarButton } }\n\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\thistory.push( backPath );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\t\ticon={ pencil }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tbackPath={ backPath }\n\t\t\t{ ...patternDetails }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAKA,IA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C;MAAc,CAAG;MACrCC,QAAQ,EAAGA,CAAA,KAAM;QAChBvB,OAAO,CAACwB,IAAI,CAAEX,QAAS,CAAC;MACzB;IAAG,CACH,CAAC,EACF,IAAAE,MAAA,CAAAC,aAAA,EAAC7B,cAAA,CAAA8B,OAAa;MACbQ,OAAO,EAAGA,CAAA,KAAMlB,aAAa,CAAE,MAAO,CAAG;MACzCmB,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO,CAAG;MACtBC,IAAI,EAAGC;IAAQ,CACf,CACA,CACF;IACDhB,QAAQ,EAAGA,QAAU;IAAA,GAChBF;EAAc,CACnB,CAAC;AAEJ","ignoreList":[]}
|
package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js
CHANGED
|
@@ -21,7 +21,9 @@ var _templatePartNavigationMenuList = _interopRequireDefault(require("./template
|
|
|
21
21
|
function TemplatePartNavigationMenus({
|
|
22
22
|
menus
|
|
23
23
|
}) {
|
|
24
|
-
if (!menus.length)
|
|
24
|
+
if (!menus.length) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
25
27
|
|
|
26
28
|
// if there is a single menu then render TemplatePartNavigationMenu
|
|
27
29
|
if (menus.length === 1) {
|
package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_templatePartNavigationMenu","_interopRequireDefault","_templatePartNavigationMenuList","TemplatePartNavigationMenus","menus","length","_react","createElement","default","id","Fragment","__experimentalHeading","className","size","upperCase","weight","__"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\n/**\n * Internal dependencies\n */\nimport TemplatePartNavigationMenu from './template-part-navigation-menu';\nimport TemplatePartNavigationMenuList from './template-part-navigation-menu-list';\n\nexport default function TemplatePartNavigationMenus( { menus } ) {\n\tif ( ! menus.length )
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_templatePartNavigationMenu","_interopRequireDefault","_templatePartNavigationMenuList","TemplatePartNavigationMenus","menus","length","_react","createElement","default","id","Fragment","__experimentalHeading","className","size","upperCase","weight","__"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\n/**\n * Internal dependencies\n */\nimport TemplatePartNavigationMenu from './template-part-navigation-menu';\nimport TemplatePartNavigationMenuList from './template-part-navigation-menu-list';\n\nexport default function TemplatePartNavigationMenus( { menus } ) {\n\tif ( ! menus.length ) {\n\t\treturn null;\n\t}\n\n\t// if there is a single menu then render TemplatePartNavigationMenu\n\tif ( menus.length === 1 ) {\n\t\treturn <TemplatePartNavigationMenu id={ menus[ 0 ] } />;\n\t}\n\n\t// if there are multiple menus then render TemplatePartNavigationMenuList\n\treturn (\n\t\t<>\n\t\t\t<Heading\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-template-part-navigation-menu__title\"\n\t\t\t\tsize=\"11\"\n\t\t\t\tupperCase\n\t\t\t\tweight={ 500 }\n\t\t\t>\n\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t</Heading>\n\t\t\t<TemplatePartNavigationMenuList menus={ menus } />\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAIA,IAAAE,2BAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,+BAAA,GAAAD,sBAAA,CAAAH,OAAA;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIe,SAASK,2BAA2BA,CAAE;EAAEC;AAAM,CAAC,EAAG;EAChE,IAAK,CAAEA,KAAK,CAACC,MAAM,EAAG;IACrB,OAAO,IAAI;EACZ;;EAEA;EACA,IAAKD,KAAK,CAACC,MAAM,KAAK,CAAC,EAAG;IACzB,OAAO,IAAAC,MAAA,CAAAC,aAAA,EAACP,2BAAA,CAAAQ,OAA0B;MAACC,EAAE,EAAGL,KAAK,CAAE,CAAC;IAAI,CAAE,CAAC;EACxD;;EAEA;EACA,OACC,IAAAE,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAI,QAAA,QACC,IAAAJ,MAAA,CAAAC,aAAA,EAACR,WAAA,CAAAY,qBAAO;IACPC,SAAS,EAAC,0EAA0E;IACpFC,IAAI,EAAC,IAAI;IACTC,SAAS;IACTC,MAAM,EAAG;EAAK,GAEZ,IAAAC,QAAE,EAAE,YAAa,CACX,CAAC,EACV,IAAAV,MAAA,CAAAC,aAAA,EAACL,+BAAA,CAAAM,OAA8B;IAACJ,KAAK,EAAGA;EAAO,CAAE,CAChD,CAAC;AAEL","ignoreList":[]}
|