@wordpress/edit-site 5.3.0 → 5.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/add-new-template/new-template-part.js +5 -4
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +5 -4
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +13 -2
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +3 -3
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/editor/index.js +6 -18
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +10 -12
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +9 -2
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/screen-border.js +0 -6
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-effects.js +53 -0
- package/build/components/global-styles/screen-effects.js.map +1 -0
- package/build/components/global-styles/shadow-panel.js +1 -1
- package/build/components/global-styles/shadow-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +28 -2
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/layout/index.js +8 -4
- package/build/components/layout/index.js.map +1 -1
- package/build/components/navigation-inspector/index.js +8 -4
- package/build/components/navigation-inspector/index.js.map +1 -1
- package/build/components/navigation-inspector/navigation-menu.js +4 -2
- package/build/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build/components/save-panel/index.js +77 -0
- package/build/components/save-panel/index.js.map +1 -0
- package/build/components/sidebar/index.js +25 -2
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +18 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/site-hub/index.js +9 -8
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +6 -4
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build/store/actions.js +1 -27
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +8 -0
- package/build/store/index.js.map +1 -1
- package/build/store/private-actions.js +40 -0
- package/build/store/private-actions.js.map +1 -0
- package/build/store/private-selectors.js +18 -0
- package/build/store/private-selectors.js.map +1 -0
- package/build/store/selectors.js +0 -13
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +4 -4
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +4 -4
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +13 -3
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +3 -3
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/editor/index.js +7 -20
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +10 -11
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +9 -3
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +0 -5
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-effects.js +35 -0
- package/build-module/components/global-styles/screen-effects.js.map +1 -0
- package/build-module/components/global-styles/shadow-panel.js +1 -1
- package/build-module/components/global-styles/shadow-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +26 -2
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/layout/index.js +6 -4
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/navigation-inspector/index.js +8 -4
- package/build-module/components/navigation-inspector/index.js.map +1 -1
- package/build-module/components/navigation-inspector/navigation-menu.js +4 -2
- package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build-module/components/save-panel/index.js +63 -0
- package/build-module/components/save-panel/index.js.map +1 -0
- package/build-module/components/sidebar/index.js +22 -2
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +18 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +8 -8
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +5 -4
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build-module/store/actions.js +0 -23
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +5 -0
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-actions.js +29 -0
- package/build-module/store/private-actions.js.map +1 -0
- package/build-module/store/private-selectors.js +11 -0
- package/build-module/store/private-selectors.js.map +1 -0
- package/build-module/store/selectors.js +0 -11
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +83 -26
- package/build-style/style.css +83 -26
- package/package.json +31 -31
- package/src/components/add-new-template/new-template-part.js +3 -2
- package/src/components/add-new-template/new-template.js +5 -3
- package/src/components/block-editor/editor-canvas.js +12 -2
- package/src/components/block-editor/index.js +4 -3
- package/src/components/block-editor/style.scss +1 -0
- package/src/components/editor/index.js +7 -46
- package/src/components/editor/style.scss +2 -2
- package/src/components/global-styles/block-preview-panel.js +8 -12
- package/src/components/global-styles/context-menu.js +14 -2
- package/src/components/global-styles/screen-border.js +0 -5
- package/src/components/global-styles/screen-effects.js +28 -0
- package/src/components/global-styles/shadow-panel.js +1 -1
- package/src/components/global-styles/style.scss +0 -4
- package/src/components/global-styles/ui.js +28 -4
- package/src/components/layout/index.js +6 -2
- package/src/components/layout/style.scss +25 -3
- package/src/components/navigation-inspector/index.js +5 -2
- package/src/components/navigation-inspector/navigation-menu.js +2 -2
- package/src/components/save-panel/index.js +65 -0
- package/src/components/save-panel/style.scss +5 -0
- package/src/components/sidebar/index.js +26 -6
- package/src/components/sidebar/style.scss +15 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +21 -1
- package/src/components/site-hub/index.js +7 -9
- package/src/components/site-hub/style.scss +1 -0
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +4 -3
- package/src/store/actions.js +0 -24
- package/src/store/index.js +5 -0
- package/src/store/private-actions.js +29 -0
- package/src/store/private-selectors.js +10 -0
- package/src/store/selectors.js +0 -11
- package/src/style.scss +1 -0
|
@@ -29,7 +29,8 @@ const ALLOWED_BLOCKS = {
|
|
|
29
29
|
|
|
30
30
|
function NavigationMenu(_ref) {
|
|
31
31
|
let {
|
|
32
|
-
innerBlocks
|
|
32
|
+
innerBlocks,
|
|
33
|
+
onSelect
|
|
33
34
|
} = _ref;
|
|
34
35
|
const {
|
|
35
36
|
updateBlockListSettings
|
|
@@ -52,7 +53,8 @@ function NavigationMenu(_ref) {
|
|
|
52
53
|
});
|
|
53
54
|
}, [updateBlockListSettings, innerBlocks]);
|
|
54
55
|
return (0, _element.createElement)(OffCanvasEditor, {
|
|
55
|
-
blocks: innerBlocks
|
|
56
|
+
blocks: innerBlocks,
|
|
57
|
+
onSelect: onSelect
|
|
56
58
|
});
|
|
57
59
|
}
|
|
58
60
|
//# sourceMappingURL=navigation-menu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-inspector/navigation-menu.js"],"names":["ALLOWED_BLOCKS","NavigationMenu","innerBlocks","updateBlockListSettings","blockEditorStore","OffCanvasEditor","blockEditorExperiments","allowedBlocks","forEach","block","name","clientId"],"mappings":";;;;;;;AAOA;;AAJA;;AAKA;;AAKA;;AAbA;AACA;AACA;;AAQA;AACA;AACA;AAGA,MAAMA,cAAc,GAAG;AACtB,qBAAmB,CAClB,sBADkB,EAElB,aAFkB,EAGlB,mBAHkB,EAIlB,gBAJkB,EAKlB,aALkB,EAMlB,gBANkB,EAOlB,iBAPkB,EAQlB,gBARkB,EASlB,yBATkB,CADG;AAYtB,uBAAqB,CAAE,kBAAF,CAZC;AAatB,6BAA2B,CAC1B,sBAD0B,EAE1B,yBAF0B,CAbL;AAiBtB,0BAAwB,CACvB,sBADuB,EAEvB,yBAFuB;AAjBF,CAAvB;;AAuBe,SAASC,cAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-inspector/navigation-menu.js"],"names":["ALLOWED_BLOCKS","NavigationMenu","innerBlocks","onSelect","updateBlockListSettings","blockEditorStore","OffCanvasEditor","blockEditorExperiments","allowedBlocks","forEach","block","name","clientId"],"mappings":";;;;;;;AAOA;;AAJA;;AAKA;;AAKA;;AAbA;AACA;AACA;;AAQA;AACA;AACA;AAGA,MAAMA,cAAc,GAAG;AACtB,qBAAmB,CAClB,sBADkB,EAElB,aAFkB,EAGlB,mBAHkB,EAIlB,gBAJkB,EAKlB,aALkB,EAMlB,gBANkB,EAOlB,iBAPkB,EAQlB,gBARkB,EASlB,yBATkB,CADG;AAYtB,uBAAqB,CAAE,kBAAF,CAZC;AAatB,6BAA2B,CAC1B,sBAD0B,EAE1B,yBAF0B,CAbL;AAiBtB,0BAAwB,CACvB,sBADuB,EAEvB,yBAFuB;AAjBF,CAAvB;;AAuBe,SAASC,cAAT,OAAqD;AAAA,MAA5B;AAAEC,IAAAA,WAAF;AAAeC,IAAAA;AAAf,GAA4B;AACnE,QAAM;AAAEC,IAAAA;AAAF,MAA8B,uBAAaC,kBAAb,CAApC;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAAsB,yBAAQC,wBAAR,CAA5B,CAHmE,CAKnE;AACA;;AACA,0BAAW,MAAM;AAChBH,IAAAA,uBAAuB,CAAE,EAAF,EAAM;AAC5BI,MAAAA,aAAa,EAAER,cAAc,CAAE,iBAAF;AADD,KAAN,CAAvB;AAGAE,IAAAA,WAAW,CAACO,OAAZ,CAAuBC,KAAF,IAAa;AACjC,UAAKV,cAAc,CAAEU,KAAK,CAACC,IAAR,CAAnB,EAAoC;AACnCP,QAAAA,uBAAuB,CAAEM,KAAK,CAACE,QAAR,EAAkB;AACxCJ,UAAAA,aAAa,EAAER,cAAc,CAAEU,KAAK,CAACC,IAAR;AADW,SAAlB,CAAvB;AAGA;AACD,KAND;AAOA,GAXD,EAWG,CAAEP,uBAAF,EAA2BF,WAA3B,CAXH;AAaA,SAAO,4BAAC,eAAD;AAAiB,IAAA,MAAM,EAAGA,WAA1B;AAAwC,IAAA,QAAQ,EAAGC;AAAnD,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\texperiments as blockEditorExperiments,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../experiments';\n\nconst ALLOWED_BLOCKS = {\n\t'core/navigation': [\n\t\t'core/navigation-link',\n\t\t'core/search',\n\t\t'core/social-links',\n\t\t'core/page-list',\n\t\t'core/spacer',\n\t\t'core/home-link',\n\t\t'core/site-title',\n\t\t'core/site-logo',\n\t\t'core/navigation-submenu',\n\t],\n\t'core/social-links': [ 'core/social-link' ],\n\t'core/navigation-submenu': [\n\t\t'core/navigation-link',\n\t\t'core/navigation-submenu',\n\t],\n\t'core/navigation-link': [\n\t\t'core/navigation-link',\n\t\t'core/navigation-submenu',\n\t],\n};\n\nexport default function NavigationMenu( { innerBlocks, onSelect } ) {\n\tconst { updateBlockListSettings } = useDispatch( blockEditorStore );\n\n\tconst { OffCanvasEditor } = unlock( blockEditorExperiments );\n\n\t//TODO: Block settings are normally updated as a side effect of rendering InnerBlocks in BlockList\n\t//Think through a better way of doing this, possible with adding allowed blocks to block library metadata\n\tuseEffect( () => {\n\t\tupdateBlockListSettings( '', {\n\t\t\tallowedBlocks: ALLOWED_BLOCKS[ 'core/navigation' ],\n\t\t} );\n\t\tinnerBlocks.forEach( ( block ) => {\n\t\t\tif ( ALLOWED_BLOCKS[ block.name ] ) {\n\t\t\t\tupdateBlockListSettings( block.clientId, {\n\t\t\t\t\tallowedBlocks: ALLOWED_BLOCKS[ block.name ],\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}, [ updateBlockListSettings, innerBlocks ] );\n\n\treturn <OffCanvasEditor blocks={ innerBlocks } onSelect={ onSelect } />;\n}\n"]}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = SavePanel;
|
|
7
|
+
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
|
|
10
|
+
var _components = require("@wordpress/components");
|
|
11
|
+
|
|
12
|
+
var _editor = require("@wordpress/editor");
|
|
13
|
+
|
|
14
|
+
var _data = require("@wordpress/data");
|
|
15
|
+
|
|
16
|
+
var _i18n = require("@wordpress/i18n");
|
|
17
|
+
|
|
18
|
+
var _interface = require("@wordpress/interface");
|
|
19
|
+
|
|
20
|
+
var _store = require("../../store");
|
|
21
|
+
|
|
22
|
+
var _experiments = require("../../experiments");
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* WordPress dependencies
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Internal dependencies
|
|
30
|
+
*/
|
|
31
|
+
function SavePanel() {
|
|
32
|
+
const {
|
|
33
|
+
isSaveViewOpen,
|
|
34
|
+
canvasMode
|
|
35
|
+
} = (0, _data.useSelect)(select => {
|
|
36
|
+
const {
|
|
37
|
+
isSaveViewOpened,
|
|
38
|
+
getCanvasMode
|
|
39
|
+
} = (0, _experiments.unlock)(select(_store.store)); // The currently selected entity to display.
|
|
40
|
+
// Typically template or template part in the site editor.
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
isSaveViewOpen: isSaveViewOpened(),
|
|
44
|
+
canvasMode: getCanvasMode()
|
|
45
|
+
};
|
|
46
|
+
}, []);
|
|
47
|
+
const {
|
|
48
|
+
setIsSaveViewOpened
|
|
49
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
50
|
+
|
|
51
|
+
const onClose = () => setIsSaveViewOpened(false);
|
|
52
|
+
|
|
53
|
+
if (canvasMode === 'view') {
|
|
54
|
+
return isSaveViewOpen ? (0, _element.createElement)(_components.Modal, {
|
|
55
|
+
className: "edit-site-save-panel__modal",
|
|
56
|
+
onRequestClose: onClose,
|
|
57
|
+
__experimentalHideHeader: true
|
|
58
|
+
}, (0, _element.createElement)(_editor.EntitiesSavedStates, {
|
|
59
|
+
close: onClose
|
|
60
|
+
})) : null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return (0, _element.createElement)(_interface.NavigableRegion, {
|
|
64
|
+
className: "edit-site-layout__actions",
|
|
65
|
+
ariaLabel: (0, _i18n.__)('Save sidebar')
|
|
66
|
+
}, isSaveViewOpen ? (0, _element.createElement)(_editor.EntitiesSavedStates, {
|
|
67
|
+
close: onClose
|
|
68
|
+
}) : (0, _element.createElement)("div", {
|
|
69
|
+
className: "edit-site-editor__toggle-save-panel"
|
|
70
|
+
}, (0, _element.createElement)(_components.Button, {
|
|
71
|
+
variant: "secondary",
|
|
72
|
+
className: "edit-site-editor__toggle-save-panel-button",
|
|
73
|
+
onClick: () => setIsSaveViewOpened(true),
|
|
74
|
+
"aria-expanded": false
|
|
75
|
+
}, (0, _i18n.__)('Open save panel'))));
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/save-panel/index.js"],"names":["SavePanel","isSaveViewOpen","canvasMode","select","isSaveViewOpened","getCanvasMode","editSiteStore","setIsSaveViewOpened","onClose"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAbA;AACA;AACA;;AAOA;AACA;AACA;AAIe,SAASA,SAAT,GAAqB;AACnC,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MAAiC,qBAAaC,MAAF,IAAc;AAC/D,UAAM;AAAEC,MAAAA,gBAAF;AAAoBC,MAAAA;AAApB,QAAsC,yBAC3CF,MAAM,CAAEG,YAAF,CADqC,CAA5C,CAD+D,CAK/D;AACA;;AACA,WAAO;AACNL,MAAAA,cAAc,EAAEG,gBAAgB,EAD1B;AAENF,MAAAA,UAAU,EAAEG,aAAa;AAFnB,KAAP;AAIA,GAXsC,EAWpC,EAXoC,CAAvC;AAYA,QAAM;AAAEE,IAAAA;AAAF,MAA0B,uBAAaD,YAAb,CAAhC;;AACA,QAAME,OAAO,GAAG,MAAMD,mBAAmB,CAAE,KAAF,CAAzC;;AAEA,MAAKL,UAAU,KAAK,MAApB,EAA6B;AAC5B,WAAOD,cAAc,GACpB,4BAAC,iBAAD;AACC,MAAA,SAAS,EAAC,6BADX;AAEC,MAAA,cAAc,EAAGO,OAFlB;AAGC,MAAA,wBAAwB;AAHzB,OAKC,4BAAC,2BAAD;AAAqB,MAAA,KAAK,EAAGA;AAA7B,MALD,CADoB,GAQjB,IARJ;AASA;;AAED,SACC,4BAAC,0BAAD;AACC,IAAA,SAAS,EAAC,2BADX;AAEC,IAAA,SAAS,EAAG,cAAI,cAAJ;AAFb,KAIGP,cAAc,GACf,4BAAC,2BAAD;AAAqB,IAAA,KAAK,EAAGO;AAA7B,IADe,GAGf;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,WADT;AAEC,IAAA,SAAS,EAAC,4CAFX;AAGC,IAAA,OAAO,EAAG,MAAMD,mBAAmB,CAAE,IAAF,CAHpC;AAIC,qBAAgB;AAJjB,KAMG,cAAI,iBAAJ,CANH,CADD,CAPF,CADD;AAqBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, Modal } from '@wordpress/components';\nimport { EntitiesSavedStates } from '@wordpress/editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { NavigableRegion } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../experiments';\n\nexport default function SavePanel() {\n\tconst { isSaveViewOpen, canvasMode } = useSelect( ( select ) => {\n\t\tconst { isSaveViewOpened, getCanvasMode } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t};\n\t}, [] );\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\tconst onClose = () => setIsSaveViewOpened( false );\n\n\tif ( canvasMode === 'view' ) {\n\t\treturn isSaveViewOpen ? (\n\t\t\t<Modal\n\t\t\t\tclassName=\"edit-site-save-panel__modal\"\n\t\t\t\tonRequestClose={ onClose }\n\t\t\t\t__experimentalHideHeader\n\t\t\t>\n\t\t\t\t<EntitiesSavedStates close={ onClose } />\n\t\t\t</Modal>\n\t\t) : null;\n\t}\n\n\treturn (\n\t\t<NavigableRegion\n\t\t\tclassName=\"edit-site-layout__actions\"\n\t\t\tariaLabel={ __( 'Save sidebar' ) }\n\t\t>\n\t\t\t{ isSaveViewOpen ? (\n\t\t\t\t<EntitiesSavedStates close={ onClose } />\n\t\t\t) : (\n\t\t\t\t<div className=\"edit-site-editor__toggle-save-panel\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tclassName=\"edit-site-editor__toggle-save-panel-button\"\n\t\t\t\t\t\tonClick={ () => setIsSaveViewOpened( true ) }\n\t\t\t\t\t\taria-expanded={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Open save panel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</NavigableRegion>\n\t);\n}\n"]}
|
|
@@ -9,8 +9,12 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
+
var _data = require("@wordpress/data");
|
|
13
|
+
|
|
12
14
|
var _components = require("@wordpress/components");
|
|
13
15
|
|
|
16
|
+
var _coreData = require("@wordpress/core-data");
|
|
17
|
+
|
|
14
18
|
var _sidebarNavigationScreenMain = _interopRequireDefault(require("../sidebar-navigation-screen-main"));
|
|
15
19
|
|
|
16
20
|
var _sidebarNavigationScreenTemplates = _interopRequireDefault(require("../sidebar-navigation-screen-templates"));
|
|
@@ -19,6 +23,8 @@ var _useSyncSidebarPathWithUrl = _interopRequireDefault(require("../sync-state-w
|
|
|
19
23
|
|
|
20
24
|
var _sidebarNavigationScreenNavigationMenus = _interopRequireDefault(require("../sidebar-navigation-screen-navigation-menus"));
|
|
21
25
|
|
|
26
|
+
var _saveButton = _interopRequireDefault(require("../save-button"));
|
|
27
|
+
|
|
22
28
|
/**
|
|
23
29
|
* WordPress dependencies
|
|
24
30
|
*/
|
|
@@ -36,10 +42,27 @@ function SidebarScreens() {
|
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
function Sidebar() {
|
|
39
|
-
|
|
45
|
+
const {
|
|
46
|
+
isDirty
|
|
47
|
+
} = (0, _data.useSelect)(select => {
|
|
48
|
+
const {
|
|
49
|
+
__experimentalGetDirtyEntityRecords
|
|
50
|
+
} = select(_coreData.store);
|
|
51
|
+
|
|
52
|
+
const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); // The currently selected entity to display.
|
|
53
|
+
// Typically template or template part in the site editor.
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
isDirty: dirtyEntityRecords.length > 0
|
|
58
|
+
};
|
|
59
|
+
}, []);
|
|
60
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.__experimentalNavigatorProvider, {
|
|
40
61
|
className: "edit-site-sidebar__content",
|
|
41
62
|
initialPath: "/"
|
|
42
|
-
}, (0, _element.createElement)(SidebarScreens, null))
|
|
63
|
+
}, (0, _element.createElement)(SidebarScreens, null)), isDirty && (0, _element.createElement)("div", {
|
|
64
|
+
className: "edit-site-sidebar__footer"
|
|
65
|
+
}, (0, _element.createElement)(_saveButton.default, null)));
|
|
43
66
|
}
|
|
44
67
|
|
|
45
68
|
var _default = (0, _element.memo)(Sidebar);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["SidebarScreens","Sidebar"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["SidebarScreens","Sidebar","isDirty","select","__experimentalGetDirtyEntityRecords","coreStore","dirtyEntityRecords","length"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAfA;AACA;AACA;;AAMA;AACA;AACA;AAOA,SAASA,cAAT,GAA0B;AACzB;AAEA,SACC,qDACC,4BAAC,oCAAD,OADD,EAEC,4BAAC,+CAAD,OAFD,EAGC,4BAAC,yCAAD;AAAkC,IAAA,QAAQ,EAAC;AAA3C,IAHD,EAIC,4BAAC,yCAAD;AAAkC,IAAA,QAAQ,EAAC;AAA3C,IAJD,CADD;AAQA;;AAED,SAASC,OAAT,GAAmB;AAClB,QAAM;AAAEC,IAAAA;AAAF,MAAc,qBAAaC,MAAF,IAAc;AAC5C,UAAM;AAAEC,MAAAA;AAAF,QAA0CD,MAAM,CAAEE,eAAF,CAAtD;;AACA,UAAMC,kBAAkB,GAAGF,mCAAmC,EAA9D,CAF4C,CAG5C;AACA;;;AACA,WAAO;AACNF,MAAAA,OAAO,EAAEI,kBAAkB,CAACC,MAAnB,GAA4B;AAD/B,KAAP;AAGA,GARmB,EAQjB,EARiB,CAApB;AAUA,SACC,qDACC,4BAAC,2CAAD;AACC,IAAA,SAAS,EAAC,4BADX;AAEC,IAAA,WAAW,EAAC;AAFb,KAIC,4BAAC,cAAD,OAJD,CADD,EAOGL,OAAO,IACR;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,mBAAD,OADD,CARF,CADD;AAeA;;eAEc,mBAAMD,OAAN,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { memo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __experimentalNavigatorProvider as NavigatorProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';\nimport SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';\nimport useSyncSidebarPathWithURL from '../sync-state-with-url/use-sync-sidebar-path-with-url';\nimport SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';\nimport SaveButton from '../save-button';\n\nfunction SidebarScreens() {\n\tuseSyncSidebarPathWithURL();\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreenMain />\n\t\t\t<SidebarNavigationScreenNavigationMenus />\n\t\t\t<SidebarNavigationScreenTemplates postType=\"wp_template\" />\n\t\t\t<SidebarNavigationScreenTemplates postType=\"wp_template_part\" />\n\t\t</>\n\t);\n}\n\nfunction Sidebar() {\n\tconst { isDirty } = useSelect( ( select ) => {\n\t\tconst { __experimentalGetDirtyEntityRecords } = select( coreStore );\n\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tisDirty: dirtyEntityRecords.length > 0,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorProvider\n\t\t\t\tclassName=\"edit-site-sidebar__content\"\n\t\t\t\tinitialPath=\"/\"\n\t\t\t>\n\t\t\t\t<SidebarScreens />\n\t\t\t</NavigatorProvider>\n\t\t\t{ isDirty && (\n\t\t\t\t<div className=\"edit-site-sidebar__footer\">\n\t\t\t\t\t<SaveButton />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default memo( Sidebar );\n"]}
|
|
@@ -15,6 +15,8 @@ var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-naviga
|
|
|
15
15
|
|
|
16
16
|
var _navigationInspector = _interopRequireDefault(require("../navigation-inspector"));
|
|
17
17
|
|
|
18
|
+
var _routes = require("../routes");
|
|
19
|
+
|
|
18
20
|
/**
|
|
19
21
|
* WordPress dependencies
|
|
20
22
|
*/
|
|
@@ -23,13 +25,28 @@ var _navigationInspector = _interopRequireDefault(require("../navigation-inspect
|
|
|
23
25
|
* Internal dependencies
|
|
24
26
|
*/
|
|
25
27
|
function SidebarNavigationScreenNavigationMenus() {
|
|
28
|
+
const history = (0, _routes.useHistory)();
|
|
29
|
+
const onSelect = (0, _element.useCallback)(selectedBlock => {
|
|
30
|
+
const {
|
|
31
|
+
attributes
|
|
32
|
+
} = selectedBlock;
|
|
33
|
+
|
|
34
|
+
if (attributes.kind === 'post-type' && attributes.id && attributes.type && history) {
|
|
35
|
+
history.push({
|
|
36
|
+
postType: attributes.type,
|
|
37
|
+
postId: attributes.id
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}, [history]);
|
|
26
41
|
return (0, _element.createElement)(_sidebarNavigationScreen.default, {
|
|
27
42
|
path: "/navigation",
|
|
28
43
|
parentTitle: (0, _i18n.__)('Design'),
|
|
29
44
|
title: (0, _i18n.__)('Navigation'),
|
|
30
45
|
content: (0, _element.createElement)("div", {
|
|
31
46
|
className: "edit-site-sidebar-navigation-screen-navigation-menus"
|
|
32
|
-
}, (0, _element.createElement)(_navigationInspector.default,
|
|
47
|
+
}, (0, _element.createElement)(_navigationInspector.default, {
|
|
48
|
+
onSelect: onSelect
|
|
49
|
+
}))
|
|
33
50
|
});
|
|
34
51
|
}
|
|
35
52
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["SidebarNavigationScreenNavigationMenus"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["SidebarNavigationScreenNavigationMenus","history","onSelect","selectedBlock","attributes","kind","id","type","push","postType","postId"],"mappings":";;;;;;;;;AAIA;;AADA;;AAMA;;AACA;;AACA;;AAXA;AACA;AACA;;AAIA;AACA;AACA;AAKe,SAASA,sCAAT,GAAkD;AAChE,QAAMC,OAAO,GAAG,yBAAhB;AACA,QAAMC,QAAQ,GAAG,0BACdC,aAAF,IAAqB;AACpB,UAAM;AAAEC,MAAAA;AAAF,QAAiBD,aAAvB;;AACA,QACCC,UAAU,CAACC,IAAX,KAAoB,WAApB,IACAD,UAAU,CAACE,EADX,IAEAF,UAAU,CAACG,IAFX,IAGAN,OAJD,EAKE;AACDA,MAAAA,OAAO,CAACO,IAAR,CAAc;AACbC,QAAAA,QAAQ,EAAEL,UAAU,CAACG,IADR;AAEbG,QAAAA,MAAM,EAAEN,UAAU,CAACE;AAFN,OAAd;AAIA;AACD,GAde,EAehB,CAAEL,OAAF,CAfgB,CAAjB;AAiBA,SACC,4BAAC,gCAAD;AACC,IAAA,IAAI,EAAC,aADN;AAEC,IAAA,WAAW,EAAG,cAAI,QAAJ,CAFf;AAGC,IAAA,KAAK,EAAG,cAAI,YAAJ,CAHT;AAIC,IAAA,OAAO,EACN;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,4BAAC,4BAAD;AAAqB,MAAA,QAAQ,EAAGC;AAAhC,MADD;AALF,IADD;AAYA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport NavigationInspector from '../navigation-inspector';\nimport { useHistory } from '../routes';\n\nexport default function SidebarNavigationScreenNavigationMenus() {\n\tconst history = useHistory();\n\tconst onSelect = useCallback(\n\t\t( selectedBlock ) => {\n\t\t\tconst { attributes } = selectedBlock;\n\t\t\tif (\n\t\t\t\tattributes.kind === 'post-type' &&\n\t\t\t\tattributes.id &&\n\t\t\t\tattributes.type &&\n\t\t\t\thistory\n\t\t\t) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostType: attributes.type,\n\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath=\"/navigation\"\n\t\t\tparentTitle={ __( 'Design' ) }\n\t\t\ttitle={ __( 'Navigation' ) }\n\t\t\tcontent={\n\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus\">\n\t\t\t\t\t<NavigationInspector onSelect={ onSelect } />\n\t\t\t\t</div>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -35,6 +35,8 @@ var _siteIcon = _interopRequireDefault(require("../site-icon"));
|
|
|
35
35
|
|
|
36
36
|
var _useEditedEntityRecord = _interopRequireDefault(require("../use-edited-entity-record"));
|
|
37
37
|
|
|
38
|
+
var _experiments = require("../../experiments");
|
|
39
|
+
|
|
38
40
|
/**
|
|
39
41
|
* External dependencies
|
|
40
42
|
*/
|
|
@@ -65,12 +67,12 @@ const SiteHub = (0, _element.forwardRef)((_ref, ref) => {
|
|
|
65
67
|
} = (0, _data.useSelect)(select => {
|
|
66
68
|
select(_store.store).getEditedPostType();
|
|
67
69
|
const {
|
|
68
|
-
|
|
70
|
+
getCanvasMode,
|
|
69
71
|
getSettings,
|
|
70
72
|
getEditedPostType
|
|
71
|
-
} = select(_store.store);
|
|
73
|
+
} = (0, _experiments.unlock)(select(_store.store));
|
|
72
74
|
return {
|
|
73
|
-
canvasMode:
|
|
75
|
+
canvasMode: getCanvasMode(),
|
|
74
76
|
dashboardLink: getSettings().__experimentalDashboardLink,
|
|
75
77
|
entityConfig: select(_coreData.store).getEntityConfig('postType', getEditedPostType())
|
|
76
78
|
};
|
|
@@ -78,8 +80,8 @@ const SiteHub = (0, _element.forwardRef)((_ref, ref) => {
|
|
|
78
80
|
const disableMotion = (0, _compose.useReducedMotion)();
|
|
79
81
|
const isMobileViewport = (0, _compose.useViewportMatch)('medium', '<');
|
|
80
82
|
const {
|
|
81
|
-
|
|
82
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
83
|
+
setCanvasMode
|
|
84
|
+
} = (0, _experiments.unlock)((0, _data.useDispatch)(_store.store));
|
|
83
85
|
const {
|
|
84
86
|
clearSelectedBlock
|
|
85
87
|
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
@@ -94,8 +96,7 @@ const SiteHub = (0, _element.forwardRef)((_ref, ref) => {
|
|
|
94
96
|
onClick: () => {
|
|
95
97
|
clearSelectedBlock();
|
|
96
98
|
setIsMobileCanvasVisible(false);
|
|
97
|
-
|
|
98
|
-
__unstableSetCanvasMode('view');
|
|
99
|
+
setCanvasMode('view');
|
|
99
100
|
}
|
|
100
101
|
};
|
|
101
102
|
const {
|
|
@@ -136,7 +137,7 @@ const SiteHub = (0, _element.forwardRef)((_ref, ref) => {
|
|
|
136
137
|
}, entityConfig === null || entityConfig === void 0 ? void 0 : entityConfig.label))), showEditButton && (0, _element.createElement)(_components.Button, {
|
|
137
138
|
className: "edit-site-site-hub__edit-button",
|
|
138
139
|
onClick: () => {
|
|
139
|
-
|
|
140
|
+
setCanvasMode('edit');
|
|
140
141
|
},
|
|
141
142
|
variant: "primary"
|
|
142
143
|
}, (0, _i18n.__)('Edit')), isMobileViewport && !isMobileCanvasVisible && (0, _element.createElement)(_components.Button, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/site-hub/index.js"],"names":["HUB_ANIMATION_DURATION","SiteHub","ref","isMobileCanvasVisible","setIsMobileCanvasVisible","props","params","isListPage","isEditorPage","canvasMode","dashboardLink","entityConfig","select","editSiteStore","getEditedPostType","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/site-hub/index.js"],"names":["HUB_ANIMATION_DURATION","SiteHub","ref","isMobileCanvasVisible","setIsMobileCanvasVisible","props","params","isListPage","isEditorPage","canvasMode","dashboardLink","entityConfig","select","editSiteStore","getEditedPostType","getCanvasMode","getSettings","__experimentalDashboardLink","coreStore","getEntityConfig","disableMotion","isMobileViewport","setCanvasMode","clearSelectedBlock","blockEditorStore","showEditButton","isBackToDashboardButton","showLabels","siteIconButtonProps","href","label","onClick","getTitle","className","type","duration","ease"],"mappings":";;;;;;;;;AAmBA;;;;AAhBA;;AAKA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA7BA;AACA;AACA;;AAGA;AACA;AACA;;AAcA;AACA;AACA;AAQA,MAAMA,sBAAsB,GAAG,GAA/B;AAEA,MAAMC,OAAO,GAAG,yBACf,OAAiEC,GAAjE,KAA0E;AAAA,MAAxE;AAAEC,IAAAA,qBAAF;AAAyBC,IAAAA,wBAAzB;AAAmD,OAAGC;AAAtD,GAAwE;AACzE,QAAM;AAAEC,IAAAA;AAAF,MAAa,0BAAnB;AACA,QAAMC,UAAU,GAAG,4BAAeD,MAAf,CAAnB;AACA,QAAME,YAAY,GAAG,CAAED,UAAvB;AACA,QAAM;AAAEE,IAAAA,UAAF;AAAcC,IAAAA,aAAd;AAA6BC,IAAAA;AAA7B,MAA8C,qBACjDC,MAAF,IAAc;AACbA,IAAAA,MAAM,CAAEC,YAAF,CAAN,CAAwBC,iBAAxB;AACA,UAAM;AAAEC,MAAAA,aAAF;AAAiBC,MAAAA,WAAjB;AAA8BF,MAAAA;AAA9B,QACL,yBAAQF,MAAM,CAAEC,YAAF,CAAd,CADD;AAEA,WAAO;AACNJ,MAAAA,UAAU,EAAEM,aAAa,EADnB;AAENL,MAAAA,aAAa,EAAEM,WAAW,GAAGC,2BAFvB;AAGNN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A/DF,CADD;AAyEA,CA1Hc,CAAhB;eA6HeH,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\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useReducedMotion, useViewportMatch } 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 { useLocation } from '../routes';\nimport getIsListPage from '../../utils/get-is-list-page';\nimport SiteIcon from '../site-icon';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { unlock } from '../../experiments';\n\nconst HUB_ANIMATION_DURATION = 0.3;\n\nconst SiteHub = forwardRef(\n\t( { isMobileCanvasVisible, setIsMobileCanvasVisible, ...props }, ref ) => {\n\t\tconst { params } = useLocation();\n\t\tconst isListPage = getIsListPage( params );\n\t\tconst isEditorPage = ! isListPage;\n\t\tconst { canvasMode, dashboardLink, entityConfig } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tselect( editSiteStore ).getEditedPostType();\n\t\t\t\tconst { getCanvasMode, getSettings, getEditedPostType } =\n\t\t\t\t\tunlock( select( editSiteStore ) );\n\t\t\t\treturn {\n\t\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t\t\tdashboardLink: getSettings().__experimentalDashboardLink,\n\t\t\t\t\tentityConfig: select( coreStore ).getEntityConfig(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tgetEditedPostType()\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[]\n\t\t);\n\t\tconst disableMotion = useReducedMotion();\n\t\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\t\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\t\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\t\tconst showEditButton =\n\t\t\t( isEditorPage && canvasMode === 'view' && ! isMobileViewport ) ||\n\t\t\t( isMobileViewport &&\n\t\t\t\tcanvasMode === 'view' &&\n\t\t\t\tisMobileCanvasVisible );\n\t\tconst isBackToDashboardButton =\n\t\t\t( ! isMobileViewport && canvasMode === 'view' ) ||\n\t\t\t( isMobileViewport && ! isMobileCanvasVisible );\n\t\tconst showLabels = canvasMode !== 'edit';\n\t\tconst siteIconButtonProps = isBackToDashboardButton\n\t\t\t? {\n\t\t\t\t\thref: dashboardLink || 'index.php',\n\t\t\t\t\t'aria-label': __( 'Go back to the dashboard' ),\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tlabel: __( 'Open Navigation Sidebar' ),\n\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\tsetIsMobileCanvasVisible( false );\n\t\t\t\t\t\tsetCanvasMode( 'view' );\n\t\t\t\t\t},\n\t\t\t };\n\t\tconst { getTitle } = useEditedEntityRecord();\n\n\t\treturn (\n\t\t\t<motion.div\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...props }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'edit-site-site-hub',\n\t\t\t\t\tprops.className\n\t\t\t\t) }\n\t\t\t\tlayout\n\t\t\t\ttransition={ {\n\t\t\t\t\ttype: 'tween',\n\t\t\t\t\tduration: disableMotion ? 0 : HUB_ANIMATION_DURATION,\n\t\t\t\t\tease: 'easeOut',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"edit-site-site-hub__text-content\"\n\t\t\t\t\tspacing=\"0\"\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName=\"edit-site-site-hub__view-mode-toggle-container\"\n\t\t\t\t\t\tlayout\n\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\tduration: disableMotion\n\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t: HUB_ANIMATION_DURATION,\n\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t{ ...siteIconButtonProps }\n\t\t\t\t\t\t\tclassName=\"edit-site-layout__view-mode-toggle\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-layout__view-mode-toggle-icon\" />\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</motion.div>\n\n\t\t\t\t\t{ showLabels && (\n\t\t\t\t\t\t<VStack spacing={ 0 }>\n\t\t\t\t\t\t\t<div className=\"edit-site-site-hub__title\">\n\t\t\t\t\t\t\t\t{ getTitle() }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"edit-site-site-hub__post-type\">\n\t\t\t\t\t\t\t\t{ entityConfig?.label }\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</HStack>\n\n\t\t\t\t{ showEditButton && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-site-site-hub__edit-button\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\n\t\t\t\t{ isMobileViewport && ! isMobileCanvasVisible && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tonClick={ () => setIsMobileCanvasVisible( true ) }\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'View Editor' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t);\n\t}\n);\n\nexport default SiteHub;\n"]}
|
|
@@ -13,6 +13,8 @@ var _store = require("../../store");
|
|
|
13
13
|
|
|
14
14
|
var _routes = require("../routes");
|
|
15
15
|
|
|
16
|
+
var _experiments = require("../../experiments");
|
|
17
|
+
|
|
16
18
|
/**
|
|
17
19
|
* WordPress dependencies
|
|
18
20
|
*/
|
|
@@ -25,10 +27,10 @@ function useSyncCanvasModeWithURL() {
|
|
|
25
27
|
const {
|
|
26
28
|
params
|
|
27
29
|
} = (0, _routes.useLocation)();
|
|
28
|
-
const canvasMode = (0, _data.useSelect)(select => select(_store.store).
|
|
30
|
+
const canvasMode = (0, _data.useSelect)(select => (0, _experiments.unlock)(select(_store.store)).getCanvasMode(), []);
|
|
29
31
|
const {
|
|
30
|
-
|
|
31
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
32
|
+
setCanvasMode
|
|
33
|
+
} = (0, _experiments.unlock)((0, _data.useDispatch)(_store.store));
|
|
32
34
|
const currentCanvasMode = (0, _element.useRef)(canvasMode);
|
|
33
35
|
const {
|
|
34
36
|
canvas: canvasInUrl = 'view'
|
|
@@ -47,7 +49,7 @@ function useSyncCanvasModeWithURL() {
|
|
|
47
49
|
currentCanvasInUrl.current = canvasInUrl;
|
|
48
50
|
|
|
49
51
|
if (canvasInUrl !== currentCanvasMode.current) {
|
|
50
|
-
|
|
52
|
+
setCanvasMode(canvasInUrl);
|
|
51
53
|
}
|
|
52
54
|
}, [canvasInUrl]);
|
|
53
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js"],"names":["useSyncCanvasModeWithURL","history","params","canvasMode","select","editSiteStore","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js"],"names":["useSyncCanvasModeWithURL","history","params","canvasMode","select","editSiteStore","getCanvasMode","setCanvasMode","currentCanvasMode","canvas","canvasInUrl","currentCanvasInUrl","current","push"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAXA;AACA;AACA;;AAIA;AACA;AACA;AAKe,SAASA,wBAAT,GAAoC;AAClD,QAAMC,OAAO,GAAG,yBAAhB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAa,0BAAnB;AACA,QAAMC,UAAU,GAAG,qBAChBC,MAAF,IAAc,yBAAQA,MAAM,CAAEC,YAAF,CAAd,EAAkCC,aAAlC,EADI,EAElB,EAFkB,CAAnB;AAIA,QAAM;AAAEC,IAAAA;AAAF,MAAoB,yBAAQ,uBAAaF,YAAb,CAAR,CAA1B;AACA,QAAMG,iBAAiB,GAAG,qBAAQL,UAAR,CAA1B;AACA,QAAM;AAAEM,IAAAA,MAAM,EAAEC,WAAW,GAAG;AAAxB,MAAmCR,MAAzC;AACA,QAAMS,kBAAkB,GAAG,qBAAQD,WAAR,CAA3B;AACA,0BAAW,MAAM;AAChBF,IAAAA,iBAAiB,CAACI,OAAlB,GAA4BT,UAA5B;;AACA,QAAKK,iBAAiB,KAAKG,kBAA3B,EAAgD;AAC/CV,MAAAA,OAAO,CAACY,IAAR,CAAc,EACb,GAAGX,MADU;AAEbO,QAAAA,MAAM,EAAEN;AAFK,OAAd;AAIA;AACD,GARD,EAQG,CAAEA,UAAF,CARH;AAUA,0BAAW,MAAM;AAChBQ,IAAAA,kBAAkB,CAACC,OAAnB,GAA6BF,WAA7B;;AACA,QAAKA,WAAW,KAAKF,iBAAiB,CAACI,OAAvC,EAAiD;AAChDL,MAAAA,aAAa,CAAEG,WAAF,CAAb;AACA;AACD,GALD,EAKG,CAAEA,WAAF,CALH;AAMA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { useLocation, useHistory } from '../routes';\nimport { unlock } from '../../experiments';\n\nexport default function useSyncCanvasModeWithURL() {\n\tconst history = useHistory();\n\tconst { params } = useLocation();\n\tconst canvasMode = useSelect(\n\t\t( select ) => unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t[]\n\t);\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst currentCanvasMode = useRef( canvasMode );\n\tconst { canvas: canvasInUrl = 'view' } = params;\n\tconst currentCanvasInUrl = useRef( canvasInUrl );\n\tuseEffect( () => {\n\t\tcurrentCanvasMode.current = canvasMode;\n\t\tif ( currentCanvasMode !== currentCanvasInUrl ) {\n\t\t\thistory.push( {\n\t\t\t\t...params,\n\t\t\t\tcanvas: canvasMode,\n\t\t\t} );\n\t\t}\n\t}, [ canvasMode ] );\n\n\tuseEffect( () => {\n\t\tcurrentCanvasInUrl.current = canvasInUrl;\n\t\tif ( canvasInUrl !== currentCanvasMode.current ) {\n\t\t\tsetCanvasMode( canvasInUrl );\n\t\t}\n\t}, [ canvasInUrl ] );\n}\n"]}
|
package/build/store/actions.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.__experimentalSetPreviewDeviceType = __experimentalSetPreviewDeviceType;
|
|
9
|
-
exports.openGeneralSidebar = exports.closeGeneralSidebar = exports.addTemplate =
|
|
9
|
+
exports.openGeneralSidebar = exports.closeGeneralSidebar = exports.addTemplate = void 0;
|
|
10
10
|
exports.openNavigationPanelToMenu = openNavigationPanelToMenu;
|
|
11
11
|
exports.revertTemplate = exports.removeTemplate = void 0;
|
|
12
12
|
exports.setEditedPostContext = setEditedPostContext;
|
|
@@ -551,32 +551,6 @@ const switchEditorMode = mode => _ref10 => {
|
|
|
551
551
|
(0, _a11y.speak)((0, _i18n.__)('Mosaic view selected'), 'assertive');
|
|
552
552
|
}
|
|
553
553
|
};
|
|
554
|
-
/**
|
|
555
|
-
* Action that switches the canvas mode.
|
|
556
|
-
*
|
|
557
|
-
* @param {?string} mode Canvas mode.
|
|
558
|
-
*/
|
|
559
|
-
|
|
560
554
|
|
|
561
555
|
exports.switchEditorMode = switchEditorMode;
|
|
562
|
-
|
|
563
|
-
const __unstableSetCanvasMode = mode => _ref11 => {
|
|
564
|
-
let {
|
|
565
|
-
registry,
|
|
566
|
-
dispatch
|
|
567
|
-
} = _ref11;
|
|
568
|
-
|
|
569
|
-
registry.dispatch(_blockEditor.store).__unstableSetEditorMode('edit');
|
|
570
|
-
|
|
571
|
-
dispatch({
|
|
572
|
-
type: 'SET_CANVAS_MODE',
|
|
573
|
-
mode
|
|
574
|
-
}); // Check if the block list view should be open by default.
|
|
575
|
-
|
|
576
|
-
if (mode === 'edit' && registry.select(_preferences.store).get('core/edit-site', 'showListViewByDefault')) {
|
|
577
|
-
dispatch.setIsListViewOpened(true);
|
|
578
|
-
}
|
|
579
|
-
};
|
|
580
|
-
|
|
581
|
-
exports.__unstableSetCanvasMode = __unstableSetCanvasMode;
|
|
582
556
|
//# sourceMappingURL=actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/store/actions.js"],"names":["toggleFeature","featureName","registry","since","alternative","dispatch","preferencesStore","toggle","__experimentalSetPreviewDeviceType","deviceType","type","setTemplate","templateId","templateSlug","template","resolveSelect","coreStore","getEntityRecord","slug","error","postType","id","context","addTemplate","newTemplate","saveEntityRecord","content","editEntityRecord","blocks","undoIgnore","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","noticesStore","createSuccessNotice","title","rendered","errorMessage","message","code","createErrorNotice","setTemplatePart","templatePartId","setHomeTemplateId","version","setEditedPostContext","setPage","page","path","postId","entity","link","__experimentalGetTemplateForLink","setNavigationPanelActiveMenu","openNavigationPanelToMenu","setIsNavigationPanelOpened","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","isOpen","setIsSaveViewOpened","revertTemplate","allowUndo","templateEntityConfig","getEntityConfig","fileTemplatePath","baseURL","source","fileTemplate","serializeBlocks","blocksForSerialization","edited","getEditedEntityRecord","raw","undoRevert","actions","label","onClick","openGeneralSidebar","name","interfaceStore","enableComplementaryArea","editSiteStoreName","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","set","blockEditorStore","clearSelectedBlock","__unstableSetCanvasMode","__unstableSetEditorMode","get"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAnBA;AACA;AACA;;AAaA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAT,CAAwBC,WAAxB,EAAsC;AAC5C,SAAO,gBAA0B;AAAA,QAAf;AAAEC,MAAAA;AAAF,KAAe;AAChC,6BAAY,yDAAZ,EAAuE;AACtEC,MAAAA,KAAK,EAAE,KAD+D;AAEtEC,MAAAA,WAAW,EACV;AAHqE,KAAvE;AAMAF,IAAAA,QAAQ,CACNG,QADF,CACYC,kBADZ,EAEEC,MAFF,CAEU,gBAFV,EAE4BN,WAF5B;AAGA,GAVD;AAWA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASO,kCAAT,CAA6CC,UAA7C,EAA0D;AAChE,SAAO;AACNC,IAAAA,IAAI,EAAE,yBADA;AAEND,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAME,WAAW,GACvB,CAAEC,UAAF,EAAcC,YAAd,KACA,eAAoC;AAAA,MAA5B;AAAER,IAAAA,QAAF;AAAYH,IAAAA;AAAZ,GAA4B;;AACnC,MAAK,CAAEW,YAAP,EAAsB;AACrB,QAAI;AACH,YAAMC,QAAQ,GAAG,MAAMZ,QAAQ,CAC7Ba,aADqB,CACNC,eADM,EAErBC,eAFqB,CAEJ,UAFI,EAEQ,aAFR,EAEuBL,UAFvB,CAAvB;AAGAC,MAAAA,Y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import { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { addQueryArgs, getPathAndQueryString } from '@wordpress/url';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { speak } from '@wordpress/a11y';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\n\n/**\n * Dispatches an action that toggles a feature flag.\n *\n * @param {string} featureName Feature name.\n */\nexport function toggleFeature( featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( \"select( 'core/edit-site' ).toggleFeature( featureName )\", {\n\t\t\tsince: '6.0',\n\t\t\talternative:\n\t\t\t\t\"select( 'core/preferences').toggle( 'core/edit-site', featureName )\",\n\t\t} );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-site', featureName );\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Action that sets a template, optionally fetching it from REST API.\n *\n * @param {number} templateId The template ID.\n * @param {string} templateSlug The template slug.\n * @return {Object} Action object.\n */\nexport const setTemplate =\n\t( templateId, templateSlug ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! templateSlug ) {\n\t\t\ttry {\n\t\t\t\tconst template = await registry\n\t\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t\t.getEntityRecord( 'postType', 'wp_template', templateId );\n\t\t\t\ttemplateSlug = template?.slug;\n\t\t\t} catch ( error ) {}\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: templateId,\n\t\t\tcontext: { templateSlug },\n\t\t} );\n\t};\n\n/**\n * Action that adds a new template and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @return {Object} Action object used to set the current template.\n */\nexport const addTemplate =\n\t( template ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tconst newTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\n\t\tif ( template.content ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template',\n\t\t\t\t\tnewTemplate.id,\n\t\t\t\t\t{ blocks: parse( template.content ) },\n\t\t\t\t\t{ undoIgnore: true }\n\t\t\t\t);\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: newTemplate.id,\n\t\t\tcontext: { templateSlug: newTemplate.slug },\n\t\t} );\n\t};\n\n/**\n * Action that removes a template.\n *\n * @param {Object} template The template object.\n */\nexport const removeTemplate =\n\t( template ) =>\n\tasync ( { registry } ) => {\n\t\ttry {\n\t\t\tawait registry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.deleteEntityRecord( 'postType', template.type, template.id, {\n\t\t\t\t\tforce: true,\n\t\t\t\t} );\n\n\t\t\tconst lastError = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getLastEntityDeleteError(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\tif ( lastError ) {\n\t\t\t\tthrow lastError;\n\t\t\t}\n\n\t\t\tregistry.dispatch( noticesStore ).createSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\t\ttemplate.title.rendered\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar' }\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while deleting the template.' );\n\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n\n/**\n * Action that sets a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: 'wp_template_part',\n\t\tid: templatePartId,\n\t};\n}\n\n/**\n * @deprecated\n */\nexport function setHomeTemplateId() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Set's the current block editor context.\n *\n * @param {Object} context The context object.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport function setEditedPostContext( context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST_CONTEXT',\n\t\tcontext,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @param {Object} page The page object.\n * @param {string} page.type The page type.\n * @param {string} page.slug The page slug.\n * @param {string} page.path The page path.\n * @param {Object} page.context The page context.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport const setPage =\n\t( page ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! page.path && page.context?.postId ) {\n\t\t\tconst entity = await registry\n\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t.getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpage.context.postType || 'post',\n\t\t\t\t\tpage.context.postId\n\t\t\t\t);\n\t\t\t// If the entity is undefined for some reason, path will resolve to \"/\"\n\t\t\tpage.path = getPathAndQueryString( entity?.link );\n\t\t}\n\n\t\tconst template = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.__experimentalGetTemplateForLink( page.path );\n\n\t\tif ( ! template ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: template.id,\n\t\t\tcontext: {\n\t\t\t\t...page.context,\n\t\t\t\ttemplateSlug: template.slug,\n\t\t\t},\n\t\t} );\n\n\t\treturn template.id;\n\t};\n\n/**\n * Action that sets the active navigation panel menu.\n *\n * @deprecated\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @deprecated\n */\nexport function openNavigationPanelToMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).openNavigationPanelToMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @deprecated\n */\nexport function setIsNavigationPanelOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setIsNavigationPanelOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens or closes the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the list view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the list view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Sets whether the save view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the save view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsSaveViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_SAVE_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport const revertTemplate =\n\t( template, { allowUndo = true } = {} ) =>\n\tasync ( { registry } ) => {\n\t\tif ( ! isTemplateRevertable( template ) ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( __( 'This template is not revertable.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst templateEntityConfig = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEntityConfig( 'postType', template.type );\n\n\t\t\tif ( ! templateEntityConfig ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t\t`${ templateEntityConfig.baseURL }/${ template.id }`,\n\t\t\t\t{ context: 'edit', source: 'theme' }\n\t\t\t);\n\n\t\t\tconst fileTemplate = await apiFetch( { path: fileTemplatePath } );\n\t\t\tif ( ! fileTemplate ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst serializeBlocks = ( {\n\t\t\t\tblocks: blocksForSerialization = [],\n\t\t\t} ) => __unstableSerializeAndClean( blocksForSerialization );\n\n\t\t\tconst edited = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t\t// the revert in the header toolbar correctly.\n\t\t\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: serializeBlocks, // Required to make the `undo` behave correctly.\n\t\t\t\t\tblocks: edited.blocks, // Required to revert the blocks in the editor.\n\t\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tundoIgnore: true, // Required to merge this edit with the last undo level.\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord( 'postType', template.type, fileTemplate.id, {\n\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\tblocks,\n\t\t\t\t\tsource: 'theme',\n\t\t\t\t} );\n\n\t\t\tif ( allowUndo ) {\n\t\t\t\tconst undoRevert = () => {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\t\tedited.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t};\n\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\t\tonClick: undoRevert,\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} else {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ) );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'Template revert failed. Please reload.' );\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n/**\n * Action that opens an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( editSiteStoreName, name );\n\t};\n\n/**\n * Action that closes the sidebar.\n */\nexport const closeGeneralSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.disableComplementaryArea( editSiteStoreName );\n\t};\n\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( 'core/preferences' )\n\t\t\t.set( 'core/edit-site', 'editorMode', mode );\n\n\t\t// Unselect blocks when we switch to a non visual mode.\n\t\tif ( mode !== 'visual' ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\n\t\tif ( mode === 'visual' ) {\n\t\t\tspeak( __( 'Visual editor selected' ), 'assertive' );\n\t\t} else if ( mode === 'mosaic' ) {\n\t\t\tspeak( __( 'Mosaic view selected' ), 'assertive' );\n\t\t}\n\t};\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const __unstableSetCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch } ) => {\n\t\tregistry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );\n\t\tdispatch( {\n\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\tmode,\n\t\t} );\n\t\t// Check if the block list view should be open by default.\n\t\tif (\n\t\t\tmode === 'edit' &&\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'showListViewByDefault' )\n\t\t) {\n\t\t\tdispatch.setIsListViewOpened( true );\n\t\t}\n\t};\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/store/actions.js"],"names":["toggleFeature","featureName","registry","since","alternative","dispatch","preferencesStore","toggle","__experimentalSetPreviewDeviceType","deviceType","type","setTemplate","templateId","templateSlug","template","resolveSelect","coreStore","getEntityRecord","slug","error","postType","id","context","addTemplate","newTemplate","saveEntityRecord","content","editEntityRecord","blocks","undoIgnore","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","noticesStore","createSuccessNotice","title","rendered","errorMessage","message","code","createErrorNotice","setTemplatePart","templatePartId","setHomeTemplateId","version","setEditedPostContext","setPage","page","path","postId","entity","link","__experimentalGetTemplateForLink","setNavigationPanelActiveMenu","openNavigationPanelToMenu","setIsNavigationPanelOpened","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","isOpen","setIsSaveViewOpened","revertTemplate","allowUndo","templateEntityConfig","getEntityConfig","fileTemplatePath","baseURL","source","fileTemplate","serializeBlocks","blocksForSerialization","edited","getEditedEntityRecord","raw","undoRevert","actions","label","onClick","openGeneralSidebar","name","interfaceStore","enableComplementaryArea","editSiteStoreName","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","set","blockEditorStore","clearSelectedBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAnBA;AACA;AACA;;AAaA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAT,CAAwBC,WAAxB,EAAsC;AAC5C,SAAO,gBAA0B;AAAA,QAAf;AAAEC,MAAAA;AAAF,KAAe;AAChC,6BAAY,yDAAZ,EAAuE;AACtEC,MAAAA,KAAK,EAAE,KAD+D;AAEtEC,MAAAA,WAAW,EACV;AAHqE,KAAvE;AAMAF,IAAAA,QAAQ,CACNG,QADF,CACYC,kBADZ,EAEEC,MAFF,CAEU,gBAFV,EAE4BN,WAF5B;AAGA,GAVD;AAWA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASO,kCAAT,CAA6CC,UAA7C,EAA0D;AAChE,SAAO;AACNC,IAAAA,IAAI,EAAE,yBADA;AAEND,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAME,WAAW,G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M;AA8HP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMyE,kBAAkB,GAC5BC,IAAF,IACA,SAAoB;AAAA,MAAlB;AAAElF,IAAAA;AAAF,GAAkB;AACnBA,EAAAA,QAAQ,CACNG,QADF,CACYgF,gBADZ,EAEEC,uBAFF,CAE2BC,qBAF3B,EAE8CH,IAF9C;AAGA,CANK;AAQP;AACA;AACA;;;;;AACO,MAAMI,mBAAmB,GAC/B,MACA,SAAoB;AAAA,MAAlB;AAAEtF,IAAAA;AAAF,GAAkB;AACnBA,EAAAA,QAAQ,CACNG,QADF,CACYgF,gBADZ,EAEEI,wBAFF,CAE4BF,qBAF5B;AAGA,CANK;;;;AAQA,MAAMG,gBAAgB,GAC1BC,IAAF,IACA,UAAoB;AAAA,MAAlB;AAAEzF,IAAAA;AAAF,GAAkB;AACnBA,EAAAA,QAAQ,CACNG,QADF,CACY,kBADZ,EAEEuF,GAFF,CAEO,gBAFP,EAEyB,YAFzB,EAEuCD,IAFvC,EADmB,CAKnB;;AACA,MAAKA,IAAI,KAAK,QAAd,EAAyB;AACxBzF,IAAAA,QAAQ,CAACG,QAAT,CAAmBwF,kBAAnB,EAAsCC,kBAAtC;AACA;;AAED,MAAKH,IAAI,KAAK,QAAd,EAAyB;AACxB,qBAAO,cAAI,wBAAJ,CAAP,EAAuC,WAAvC;AACA,GAFD,MAEO,IAAKA,IAAI,KAAK,QAAd,EAAyB;AAC/B,qBAAO,cAAI,sBAAJ,CAAP,EAAqC,WAArC;AACA;AACD,CAjBK","sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { addQueryArgs, getPathAndQueryString } from '@wordpress/url';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { speak } from '@wordpress/a11y';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\n\n/**\n * Dispatches an action that toggles a feature flag.\n *\n * @param {string} featureName Feature name.\n */\nexport function toggleFeature( featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( \"select( 'core/edit-site' ).toggleFeature( featureName )\", {\n\t\t\tsince: '6.0',\n\t\t\talternative:\n\t\t\t\t\"select( 'core/preferences').toggle( 'core/edit-site', featureName )\",\n\t\t} );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-site', featureName );\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Action that sets a template, optionally fetching it from REST API.\n *\n * @param {number} templateId The template ID.\n * @param {string} templateSlug The template slug.\n * @return {Object} Action object.\n */\nexport const setTemplate =\n\t( templateId, templateSlug ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! templateSlug ) {\n\t\t\ttry {\n\t\t\t\tconst template = await registry\n\t\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t\t.getEntityRecord( 'postType', 'wp_template', templateId );\n\t\t\t\ttemplateSlug = template?.slug;\n\t\t\t} catch ( error ) {}\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: templateId,\n\t\t\tcontext: { templateSlug },\n\t\t} );\n\t};\n\n/**\n * Action that adds a new template and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @return {Object} Action object used to set the current template.\n */\nexport const addTemplate =\n\t( template ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tconst newTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\n\t\tif ( template.content ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template',\n\t\t\t\t\tnewTemplate.id,\n\t\t\t\t\t{ blocks: parse( template.content ) },\n\t\t\t\t\t{ undoIgnore: true }\n\t\t\t\t);\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: newTemplate.id,\n\t\t\tcontext: { templateSlug: newTemplate.slug },\n\t\t} );\n\t};\n\n/**\n * Action that removes a template.\n *\n * @param {Object} template The template object.\n */\nexport const removeTemplate =\n\t( template ) =>\n\tasync ( { registry } ) => {\n\t\ttry {\n\t\t\tawait registry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.deleteEntityRecord( 'postType', template.type, template.id, {\n\t\t\t\t\tforce: true,\n\t\t\t\t} );\n\n\t\t\tconst lastError = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getLastEntityDeleteError(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\tif ( lastError ) {\n\t\t\t\tthrow lastError;\n\t\t\t}\n\n\t\t\tregistry.dispatch( noticesStore ).createSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\t\ttemplate.title.rendered\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar' }\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while deleting the template.' );\n\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n\n/**\n * Action that sets a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: 'wp_template_part',\n\t\tid: templatePartId,\n\t};\n}\n\n/**\n * @deprecated\n */\nexport function setHomeTemplateId() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Set's the current block editor context.\n *\n * @param {Object} context The context object.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport function setEditedPostContext( context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST_CONTEXT',\n\t\tcontext,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @param {Object} page The page object.\n * @param {string} page.type The page type.\n * @param {string} page.slug The page slug.\n * @param {string} page.path The page path.\n * @param {Object} page.context The page context.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport const setPage =\n\t( page ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! page.path && page.context?.postId ) {\n\t\t\tconst entity = await registry\n\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t.getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpage.context.postType || 'post',\n\t\t\t\t\tpage.context.postId\n\t\t\t\t);\n\t\t\t// If the entity is undefined for some reason, path will resolve to \"/\"\n\t\t\tpage.path = getPathAndQueryString( entity?.link );\n\t\t}\n\n\t\tconst template = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.__experimentalGetTemplateForLink( page.path );\n\n\t\tif ( ! template ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: template.id,\n\t\t\tcontext: {\n\t\t\t\t...page.context,\n\t\t\t\ttemplateSlug: template.slug,\n\t\t\t},\n\t\t} );\n\n\t\treturn template.id;\n\t};\n\n/**\n * Action that sets the active navigation panel menu.\n *\n * @deprecated\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @deprecated\n */\nexport function openNavigationPanelToMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).openNavigationPanelToMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @deprecated\n */\nexport function setIsNavigationPanelOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setIsNavigationPanelOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens or closes the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the list view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the list view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Sets whether the save view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the save view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsSaveViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_SAVE_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport const revertTemplate =\n\t( template, { allowUndo = true } = {} ) =>\n\tasync ( { registry } ) => {\n\t\tif ( ! isTemplateRevertable( template ) ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( __( 'This template is not revertable.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst templateEntityConfig = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEntityConfig( 'postType', template.type );\n\n\t\t\tif ( ! templateEntityConfig ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t\t`${ templateEntityConfig.baseURL }/${ template.id }`,\n\t\t\t\t{ context: 'edit', source: 'theme' }\n\t\t\t);\n\n\t\t\tconst fileTemplate = await apiFetch( { path: fileTemplatePath } );\n\t\t\tif ( ! fileTemplate ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst serializeBlocks = ( {\n\t\t\t\tblocks: blocksForSerialization = [],\n\t\t\t} ) => __unstableSerializeAndClean( blocksForSerialization );\n\n\t\t\tconst edited = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t\t// the revert in the header toolbar correctly.\n\t\t\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: serializeBlocks, // Required to make the `undo` behave correctly.\n\t\t\t\t\tblocks: edited.blocks, // Required to revert the blocks in the editor.\n\t\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tundoIgnore: true, // Required to merge this edit with the last undo level.\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord( 'postType', template.type, fileTemplate.id, {\n\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\tblocks,\n\t\t\t\t\tsource: 'theme',\n\t\t\t\t} );\n\n\t\t\tif ( allowUndo ) {\n\t\t\t\tconst undoRevert = () => {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\t\tedited.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t};\n\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\t\tonClick: undoRevert,\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} else {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ) );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'Template revert failed. Please reload.' );\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n/**\n * Action that opens an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( editSiteStoreName, name );\n\t};\n\n/**\n * Action that closes the sidebar.\n */\nexport const closeGeneralSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.disableComplementaryArea( editSiteStoreName );\n\t};\n\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( 'core/preferences' )\n\t\t\t.set( 'core/edit-site', 'editorMode', mode );\n\n\t\t// Unselect blocks when we switch to a non visual mode.\n\t\tif ( mode !== 'visual' ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\n\t\tif ( mode === 'visual' ) {\n\t\t\tspeak( __( 'Visual editor selected' ), 'assertive' );\n\t\t} else if ( mode === 'mosaic' ) {\n\t\t\tspeak( __( 'Mosaic view selected' ), 'assertive' );\n\t\t}\n\t};\n"]}
|
package/build/store/index.js
CHANGED
|
@@ -13,10 +13,16 @@ var _reducer = _interopRequireDefault(require("./reducer"));
|
|
|
13
13
|
|
|
14
14
|
var actions = _interopRequireWildcard(require("./actions"));
|
|
15
15
|
|
|
16
|
+
var privateActions = _interopRequireWildcard(require("./private-actions"));
|
|
17
|
+
|
|
16
18
|
var selectors = _interopRequireWildcard(require("./selectors"));
|
|
17
19
|
|
|
20
|
+
var privateSelectors = _interopRequireWildcard(require("./private-selectors"));
|
|
21
|
+
|
|
18
22
|
var _constants = require("./constants");
|
|
19
23
|
|
|
24
|
+
var _experiments = require("../experiments");
|
|
25
|
+
|
|
20
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
27
|
|
|
22
28
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -37,4 +43,6 @@ exports.storeConfig = storeConfig;
|
|
|
37
43
|
const store = (0, _data.createReduxStore)(_constants.STORE_NAME, storeConfig);
|
|
38
44
|
exports.store = store;
|
|
39
45
|
(0, _data.register)(store);
|
|
46
|
+
(0, _experiments.unlock)(store).registerPrivateSelectors(privateSelectors);
|
|
47
|
+
(0, _experiments.unlock)(store).registerPrivateActions(privateActions);
|
|
40
48
|
//# sourceMappingURL=index.js.map
|
package/build/store/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/store/index.js"],"names":["storeConfig","reducer","actions","selectors","store","STORE_NAME"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;;;;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/store/index.js"],"names":["storeConfig","reducer","actions","selectors","store","STORE_NAME","registerPrivateSelectors","privateSelectors","registerPrivateActions","privateActions"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAdA;AACA;AACA;;AAGA;AACA;AACA;AASO,MAAMA,WAAW,GAAG;AAC1BC,EAAAA,OAAO,EAAPA,gBAD0B;AAE1BC,EAAAA,OAF0B;AAG1BC,EAAAA;AAH0B,CAApB;;AAMA,MAAMC,KAAK,GAAG,4BAAkBC,qBAAlB,EAA8BL,WAA9B,CAAd;;AACP,oBAAUI,KAAV;AACA,yBAAQA,KAAR,EAAgBE,wBAAhB,CAA0CC,gBAA1C;AACA,yBAAQH,KAAR,EAAgBI,sBAAhB,CAAwCC,cAAxC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as privateActions from './private-actions';\nimport * as selectors from './selectors';\nimport * as privateSelectors from './private-selectors';\nimport { STORE_NAME } from './constants';\nimport { unlock } from '../experiments';\n\nexport const storeConfig = {\n\treducer,\n\tactions,\n\tselectors,\n};\n\nexport const store = createReduxStore( STORE_NAME, storeConfig );\nregister( store );\nunlock( store ).registerPrivateSelectors( privateSelectors );\nunlock( store ).registerPrivateActions( privateActions );\n"]}
|