@wordpress/edit-site 4.17.0 → 4.19.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.
Files changed (141) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-template/add-custom-template-modal.js +3 -1
  3. package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
  4. package/build/components/app/index.js +8 -3
  5. package/build/components/app/index.js.map +1 -1
  6. package/build/components/block-editor/resizable-editor.js +9 -47
  7. package/build/components/block-editor/resizable-editor.js.map +1 -1
  8. package/build/components/editor/index.js +9 -13
  9. package/build/components/editor/index.js.map +1 -1
  10. package/build/components/global-styles/border-panel.js +2 -1
  11. package/build/components/global-styles/border-panel.js.map +1 -1
  12. package/build/components/global-styles/dimensions-panel.js +46 -2
  13. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  14. package/build/components/global-styles/global-styles-provider.js +6 -5
  15. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  16. package/build/components/global-styles/hooks.js +32 -0
  17. package/build/components/global-styles/hooks.js.map +1 -1
  18. package/build/components/global-styles/palette.js +8 -1
  19. package/build/components/global-styles/palette.js.map +1 -1
  20. package/build/components/global-styles/typography-panel.js +53 -16
  21. package/build/components/global-styles/typography-panel.js.map +1 -1
  22. package/build/components/global-styles/use-global-styles-output.js +43 -8
  23. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  24. package/build/components/header-edit-mode/document-actions/index.js +3 -1
  25. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  26. package/build/components/header-edit-mode/index.js +15 -13
  27. package/build/components/header-edit-mode/index.js.map +1 -1
  28. package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -7
  29. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  30. package/build/components/keyboard-shortcuts/index.js +8 -5
  31. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  32. package/build/components/list/table.js +1 -1
  33. package/build/components/list/table.js.map +1 -1
  34. package/build/components/list/use-register-shortcuts.js +3 -0
  35. package/build/components/list/use-register-shortcuts.js.map +1 -1
  36. package/build/components/navigation-sidebar/navigation-panel/index.js +9 -8
  37. package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
  38. package/build/components/save-button/index.js +36 -14
  39. package/build/components/save-button/index.js.map +1 -1
  40. package/build/components/sidebar-edit-mode/template-card/index.js +4 -2
  41. package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  42. package/build/components/template-details/index.js +4 -2
  43. package/build/components/template-details/index.js.map +1 -1
  44. package/build/index.js +5 -10
  45. package/build/index.js.map +1 -1
  46. package/build/store/actions.js +15 -0
  47. package/build/store/actions.js.map +1 -1
  48. package/build/store/reducer.js +28 -1
  49. package/build/store/reducer.js.map +1 -1
  50. package/build/store/selectors.js +13 -0
  51. package/build/store/selectors.js.map +1 -1
  52. package/build-module/components/add-new-template/add-custom-template-modal.js +2 -1
  53. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  54. package/build-module/components/app/index.js +8 -3
  55. package/build-module/components/app/index.js.map +1 -1
  56. package/build-module/components/block-editor/resizable-editor.js +11 -49
  57. package/build-module/components/block-editor/resizable-editor.js.map +1 -1
  58. package/build-module/components/editor/index.js +10 -14
  59. package/build-module/components/editor/index.js.map +1 -1
  60. package/build-module/components/global-styles/border-panel.js +2 -1
  61. package/build-module/components/global-styles/border-panel.js.map +1 -1
  62. package/build-module/components/global-styles/dimensions-panel.js +46 -2
  63. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  64. package/build-module/components/global-styles/global-styles-provider.js +7 -6
  65. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  66. package/build-module/components/global-styles/hooks.js +27 -1
  67. package/build-module/components/global-styles/hooks.js.map +1 -1
  68. package/build-module/components/global-styles/palette.js +9 -3
  69. package/build-module/components/global-styles/palette.js.map +1 -1
  70. package/build-module/components/global-styles/typography-panel.js +54 -16
  71. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  72. package/build-module/components/global-styles/use-global-styles-output.js +44 -9
  73. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  74. package/build-module/components/header-edit-mode/document-actions/index.js +2 -1
  75. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  76. package/build-module/components/header-edit-mode/index.js +14 -13
  77. package/build-module/components/header-edit-mode/index.js.map +1 -1
  78. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +1 -6
  79. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  80. package/build-module/components/keyboard-shortcuts/index.js +8 -5
  81. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  82. package/build-module/components/list/table.js +1 -1
  83. package/build-module/components/list/table.js.map +1 -1
  84. package/build-module/components/list/use-register-shortcuts.js +3 -0
  85. package/build-module/components/list/use-register-shortcuts.js.map +1 -1
  86. package/build-module/components/navigation-sidebar/navigation-panel/index.js +9 -7
  87. package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
  88. package/build-module/components/save-button/index.js +39 -16
  89. package/build-module/components/save-button/index.js.map +1 -1
  90. package/build-module/components/sidebar-edit-mode/template-card/index.js +3 -2
  91. package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  92. package/build-module/components/template-details/index.js +3 -2
  93. package/build-module/components/template-details/index.js.map +1 -1
  94. package/build-module/index.js +5 -3
  95. package/build-module/index.js.map +1 -1
  96. package/build-module/store/actions.js +13 -0
  97. package/build-module/store/actions.js.map +1 -1
  98. package/build-module/store/reducer.js +26 -1
  99. package/build-module/store/reducer.js.map +1 -1
  100. package/build-module/store/selectors.js +11 -0
  101. package/build-module/store/selectors.js.map +1 -1
  102. package/build-style/style-rtl.css +17 -15
  103. package/build-style/style.css +17 -15
  104. package/package.json +30 -29
  105. package/src/components/add-new-template/add-custom-template-modal.js +5 -1
  106. package/src/components/app/index.js +11 -2
  107. package/src/components/block-editor/resizable-editor.js +10 -55
  108. package/src/components/block-editor/style.scss +1 -0
  109. package/src/components/editor/index.js +16 -25
  110. package/src/components/editor/style.scss +1 -7
  111. package/src/components/global-styles/border-panel.js +1 -0
  112. package/src/components/global-styles/dimensions-panel.js +59 -1
  113. package/src/components/global-styles/global-styles-provider.js +5 -6
  114. package/src/components/global-styles/hooks.js +36 -0
  115. package/src/components/global-styles/palette.js +15 -1
  116. package/src/components/global-styles/style.scss +1 -0
  117. package/src/components/global-styles/test/typography-utils.js +82 -98
  118. package/src/components/global-styles/test/use-global-styles-output.js +6 -6
  119. package/src/components/global-styles/typography-panel.js +58 -15
  120. package/src/components/global-styles/use-global-styles-output.js +47 -10
  121. package/src/components/header-edit-mode/document-actions/index.js +2 -1
  122. package/src/components/header-edit-mode/index.js +10 -13
  123. package/src/components/keyboard-shortcut-help-modal/shortcut.js +15 -18
  124. package/src/components/keyboard-shortcuts/index.js +7 -2
  125. package/src/components/list/table.js +1 -1
  126. package/src/components/list/use-register-shortcuts.js +4 -0
  127. package/src/components/navigation-sidebar/navigation-panel/index.js +30 -24
  128. package/src/components/navigation-sidebar/navigation-panel/style.scss +0 -7
  129. package/src/components/navigation-sidebar/navigation-toggle/test/index.js +24 -30
  130. package/src/components/save-button/index.js +31 -15
  131. package/src/components/sidebar-edit-mode/template-card/index.js +3 -2
  132. package/src/components/template-details/index.js +3 -2
  133. package/src/index.js +10 -3
  134. package/src/store/actions.js +13 -0
  135. package/src/store/reducer.js +19 -0
  136. package/src/store/selectors.js +11 -0
  137. package/build/components/main-dashboard-button/index.js +0 -41
  138. package/build/components/main-dashboard-button/index.js.map +0 -1
  139. package/build-module/components/main-dashboard-button/index.js +0 -32
  140. package/build-module/components/main-dashboard-button/index.js.map +0 -1
  141. package/src/components/main-dashboard-button/index.js +0 -28
@@ -7,8 +7,6 @@ exports.default = SaveButton;
7
7
 
8
8
  var _element = require("@wordpress/element");
9
9
 
10
- var _lodash = require("lodash");
11
-
12
10
  var _data = require("@wordpress/data");
13
11
 
14
12
  var _components = require("@wordpress/components");
@@ -17,21 +15,22 @@ var _i18n = require("@wordpress/i18n");
17
15
 
18
16
  var _coreData = require("@wordpress/core-data");
19
17
 
18
+ var _keycodes = require("@wordpress/keycodes");
19
+
20
+ var _store = require("../../store");
21
+
20
22
  /**
21
- * External dependencies
23
+ * WordPress dependencies
22
24
  */
23
25
 
24
26
  /**
25
- * WordPress dependencies
27
+ * Internal dependencies
26
28
  */
27
- function SaveButton(_ref) {
28
- let {
29
- openEntitiesSavedStates,
30
- isEntitiesSavedStatesOpen
31
- } = _ref;
29
+ function SaveButton() {
32
30
  const {
33
31
  isDirty,
34
- isSaving
32
+ isSaving,
33
+ isSaveViewOpen
35
34
  } = (0, _data.useSelect)(select => {
36
35
  const {
37
36
  __experimentalGetDirtyEntityRecords,
@@ -40,19 +39,42 @@ function SaveButton(_ref) {
40
39
 
41
40
  const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
42
41
 
42
+ const {
43
+ isSaveViewOpened
44
+ } = select(_store.store);
43
45
  return {
44
46
  isDirty: dirtyEntityRecords.length > 0,
45
- isSaving: (0, _lodash.some)(dirtyEntityRecords, record => isSavingEntityRecord(record.kind, record.name, record.key))
47
+ isSaving: dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)),
48
+ isSaveViewOpen: isSaveViewOpened()
46
49
  };
47
50
  }, []);
51
+ const {
52
+ setIsSaveViewOpened
53
+ } = (0, _data.useDispatch)(_store.store);
48
54
  const disabled = !isDirty || isSaving;
55
+ const label = (0, _i18n.__)('Save');
49
56
  return (0, _element.createElement)(_components.Button, {
50
57
  variant: "primary",
51
58
  className: "edit-site-save-button__button",
52
59
  "aria-disabled": disabled,
53
- "aria-expanded": isEntitiesSavedStatesOpen,
60
+ "aria-expanded": isSaveViewOpen,
54
61
  isBusy: isSaving,
55
- onClick: disabled ? undefined : openEntitiesSavedStates
56
- }, (0, _i18n.__)('Save'));
62
+ onClick: disabled ? undefined : () => setIsSaveViewOpened(true),
63
+ label: label
64
+ /*
65
+ * We want the tooltip to show the keyboard shortcut only when the
66
+ * button does something, i.e. when it's not disabled.
67
+ */
68
+ ,
69
+ shortcut: disabled ? undefined : _keycodes.displayShortcut.primary('s')
70
+ /*
71
+ * Displaying the keyboard shortcut conditionally makes the tooltip
72
+ * itself show conditionally. This would trigger a full-rerendering
73
+ * of the button that we want to avoid. By setting `showTooltip`,
74
+ & the tooltip is always rendered even when there's no keyboard shortcut.
75
+ */
76
+ ,
77
+ showTooltip: true
78
+ }, label);
57
79
  }
58
80
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/save-button/index.js"],"names":["SaveButton","openEntitiesSavedStates","isEntitiesSavedStatesOpen","isDirty","isSaving","select","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","coreStore","dirtyEntityRecords","length","record","kind","name","key","disabled","undefined"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;AAMe,SAASA,UAAT,OAGX;AAAA,MAHgC;AACnCC,IAAAA,uBADmC;AAEnCC,IAAAA;AAFmC,GAGhC;AACH,QAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,MAAwB,qBAAaC,MAAF,IAAc;AACtD,UAAM;AAAEC,MAAAA,mCAAF;AAAuCC,MAAAA;AAAvC,QACLF,MAAM,CAAEG,eAAF,CADP;;AAEA,UAAMC,kBAAkB,GAAGH,mCAAmC,EAA9D;;AACA,WAAO;AACNH,MAAAA,OAAO,EAAEM,kBAAkB,CAACC,MAAnB,GAA4B,CAD/B;AAENN,MAAAA,QAAQ,EAAE,kBAAMK,kBAAN,EAA4BE,MAAF,IACnCJ,oBAAoB,CAAEI,MAAM,CAACC,IAAT,EAAeD,MAAM,CAACE,IAAtB,EAA4BF,MAAM,CAACG,GAAnC,CADX;AAFJ,KAAP;AAMA,GAV6B,EAU3B,EAV2B,CAA9B;AAYA,QAAMC,QAAQ,GAAG,CAAEZ,OAAF,IAAaC,QAA9B;AAEA,SACC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,SAAS,EAAC,+BAFX;AAGC,qBAAgBW,QAHjB;AAIC,qBAAgBb,yBAJjB;AAKC,IAAA,MAAM,EAAGE,QALV;AAMC,IAAA,OAAO,EAAGW,QAAQ,GAAGC,SAAH,GAAef;AANlC,KAQG,cAAI,MAAJ,CARH,CADD;AAYA","sourcesContent":["/**\n * External dependencies\n */\nimport { some } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\nexport default function SaveButton( {\n\topenEntitiesSavedStates,\n\tisEntitiesSavedStatesOpen,\n} ) {\n\tconst { isDirty, isSaving } = useSelect( ( select ) => {\n\t\tconst { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } =\n\t\t\tselect( coreStore );\n\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\treturn {\n\t\t\tisDirty: dirtyEntityRecords.length > 0,\n\t\t\tisSaving: some( dirtyEntityRecords, ( record ) =>\n\t\t\t\tisSavingEntityRecord( record.kind, record.name, record.key )\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst disabled = ! isDirty || isSaving;\n\n\treturn (\n\t\t<Button\n\t\t\tvariant=\"primary\"\n\t\t\tclassName=\"edit-site-save-button__button\"\n\t\t\taria-disabled={ disabled }\n\t\t\taria-expanded={ isEntitiesSavedStatesOpen }\n\t\t\tisBusy={ isSaving }\n\t\t\tonClick={ disabled ? undefined : openEntitiesSavedStates }\n\t\t>\n\t\t\t{ __( 'Save' ) }\n\t\t</Button>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/save-button/index.js"],"names":["SaveButton","isDirty","isSaving","isSaveViewOpen","select","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","coreStore","dirtyEntityRecords","isSaveViewOpened","editSiteStore","length","some","record","kind","name","key","setIsSaveViewOpened","disabled","label","undefined","displayShortcut","primary"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;AAGe,SAASA,UAAT,GAAsB;AACpC,QAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,QAAX;AAAqBC,IAAAA;AAArB,MAAwC,qBAAaC,MAAF,IAAc;AACtE,UAAM;AAAEC,MAAAA,mCAAF;AAAuCC,MAAAA;AAAvC,QACLF,MAAM,CAAEG,eAAF,CADP;;AAEA,UAAMC,kBAAkB,GAAGH,mCAAmC,EAA9D;;AACA,UAAM;AAAEI,MAAAA;AAAF,QAAuBL,MAAM,CAAEM,YAAF,CAAnC;AACA,WAAO;AACNT,MAAAA,OAAO,EAAEO,kBAAkB,CAACG,MAAnB,GAA4B,CAD/B;AAENT,MAAAA,QAAQ,EAAEM,kBAAkB,CAACI,IAAnB,CAA2BC,MAAF,IAClCP,oBAAoB,CAAEO,MAAM,CAACC,IAAT,EAAeD,MAAM,CAACE,IAAtB,EAA4BF,MAAM,CAACG,GAAnC,CADX,CAFJ;AAKNb,MAAAA,cAAc,EAAEM,gBAAgB;AAL1B,KAAP;AAOA,GAZ6C,EAY3C,EAZ2C,CAA9C;AAaA,QAAM;AAAEQ,IAAAA;AAAF,MAA0B,uBAAaP,YAAb,CAAhC;AAEA,QAAMQ,QAAQ,GAAG,CAAEjB,OAAF,IAAaC,QAA9B;AAEA,QAAMiB,KAAK,GAAG,cAAI,MAAJ,CAAd;AAEA,SACC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,SAAS,EAAC,+BAFX;AAGC,qBAAgBD,QAHjB;AAIC,qBAAgBf,cAJjB;AAKC,IAAA,MAAM,EAAGD,QALV;AAMC,IAAA,OAAO,EAAGgB,QAAQ,GAAGE,SAAH,GAAe,MAAMH,mBAAmB,CAAE,IAAF,CAN3D;AAOC,IAAA,KAAK,EAAGE;AACR;AACH;AACA;AACA;AAXE;AAYC,IAAA,QAAQ,EAAGD,QAAQ,GAAGE,SAAH,GAAeC,0BAAgBC,OAAhB,CAAyB,GAAzB;AAClC;AACH;AACA;AACA;AACA;AACA;AAlBE;AAmBC,IAAA,WAAW;AAnBZ,KAqBGH,KArBH,CADD;AAyBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function SaveButton() {\n\tconst { isDirty, isSaving, isSaveViewOpen } = useSelect( ( select ) => {\n\t\tconst { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } =\n\t\t\tselect( coreStore );\n\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\tconst { isSaveViewOpened } = select( editSiteStore );\n\t\treturn {\n\t\t\tisDirty: dirtyEntityRecords.length > 0,\n\t\t\tisSaving: dirtyEntityRecords.some( ( record ) =>\n\t\t\t\tisSavingEntityRecord( record.kind, record.name, record.key )\n\t\t\t),\n\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t};\n\t}, [] );\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\n\tconst disabled = ! isDirty || isSaving;\n\n\tconst label = __( 'Save' );\n\n\treturn (\n\t\t<Button\n\t\t\tvariant=\"primary\"\n\t\t\tclassName=\"edit-site-save-button__button\"\n\t\t\taria-disabled={ disabled }\n\t\t\taria-expanded={ isSaveViewOpen }\n\t\t\tisBusy={ isSaving }\n\t\t\tonClick={ disabled ? undefined : () => setIsSaveViewOpened( true ) }\n\t\t\tlabel={ label }\n\t\t\t/*\n\t\t\t * We want the tooltip to show the keyboard shortcut only when the\n\t\t\t * button does something, i.e. when it's not disabled.\n\t\t\t */\n\t\t\tshortcut={ disabled ? undefined : displayShortcut.primary( 's' ) }\n\t\t\t/*\n\t\t\t * Displaying the keyboard shortcut conditionally makes the tooltip\n\t\t\t * itself show conditionally. This would trigger a full-rerendering\n\t\t\t * of the button that we want to avoid. By setting `showTooltip`,\n\t\t\t & the tooltip is always rendered even when there's no keyboard shortcut.\n\t\t\t */\n\t\t\tshowTooltip\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n"]}
@@ -17,6 +17,8 @@ var _editor = require("@wordpress/editor");
17
17
 
18
18
  var _coreData = require("@wordpress/core-data");
19
19
 
20
+ var _htmlEntities = require("@wordpress/html-entities");
21
+
20
22
  var _store = require("../../../store");
21
23
 
22
24
  var _templateActions = _interopRequireDefault(require("./template-actions"));
@@ -74,10 +76,10 @@ function TemplateCard() {
74
76
  className: "edit-site-template-card__header"
75
77
  }, (0, _element.createElement)("h2", {
76
78
  className: "edit-site-template-card__title"
77
- }, title), (0, _element.createElement)(_templateActions.default, {
79
+ }, (0, _htmlEntities.decodeEntities)(title)), (0, _element.createElement)(_templateActions.default, {
78
80
  template: template
79
81
  })), (0, _element.createElement)("div", {
80
82
  className: "edit-site-template-card__description"
81
- }, description), (0, _element.createElement)(_templateAreas.default, null)));
83
+ }, (0, _htmlEntities.decodeEntities)(description)), (0, _element.createElement)(_templateAreas.default, null)));
82
84
  }
83
85
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/template-card/index.js"],"names":["TemplateCard","info","title","description","icon","template","select","getEditedPostType","getEditedPostId","editSiteStore","getEditedEntityRecord","coreStore","__experimentalGetTemplateInfo","getTemplateInfo","editorStore","postType","postId","record"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAbA;AACA;AACA;;AAMA;AACA;AACA;AAKe,SAASA,YAAT,GAAwB;AACtC,QAAM;AACLC,IAAAA,IAAI,EAAE;AA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elect } from '@wordpress/data';\nimport { Icon } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport TemplateActions from './template-actions';\nimport TemplateAreas from './template-areas';\n\nexport default function TemplateCard() {\n\tconst {\n\t\tinfo: { title, description, icon },\n\t\ttemplate,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId } = select( editSiteStore );\n\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\tconst { __experimentalGetTemplateInfo: getTemplateInfo } =\n\t\t\tselect( editorStore );\n\n\t\tconst postType = getEditedPostType();\n\t\tconst postId = getEditedPostId();\n\t\tconst record = getEditedEntityRecord( 'postType', postType, postId );\n\n\t\tconst info = record ? getTemplateInfo( record ) : {};\n\n\t\treturn { info, template: record };\n\t}, [] );\n\n\tif ( ! title && ! description ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"edit-site-template-card\">\n\t\t\t<Icon className=\"edit-site-template-card__icon\" icon={ icon } />\n\t\t\t<div className=\"edit-site-template-card__content\">\n\t\t\t\t<div className=\"edit-site-template-card__header\">\n\t\t\t\t\t<h2 className=\"edit-site-template-card__title\">\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</h2>\n\t\t\t\t\t<TemplateActions template={ template } />\n\t\t\t\t</div>\n\t\t\t\t<div className=\"edit-site-template-card__description\">\n\t\t\t\t\t{ description }\n\t\t\t\t</div>\n\t\t\t\t<TemplateAreas />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/template-card/index.js"],"names":["TemplateCard","info","title","description","icon","template","select","getEditedPostType","getEditedPostId","editSiteStore","getEditedEntityRecord","coreStore","__experimentalGetTemplateInfo","getTemplateInfo","editorStore","postType","postId","record"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;A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D,EAOC;AAAK,IAAA,SAAS,EAAC;AAAf,KACG,kCAAgBF,WAAhB,CADH,CAPD,EAUC,4BAAC,sBAAD,OAVD,CAFD,CADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { Icon } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport TemplateActions from './template-actions';\nimport TemplateAreas from './template-areas';\n\nexport default function TemplateCard() {\n\tconst {\n\t\tinfo: { title, description, icon },\n\t\ttemplate,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId } = select( editSiteStore );\n\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\tconst { __experimentalGetTemplateInfo: getTemplateInfo } =\n\t\t\tselect( editorStore );\n\n\t\tconst postType = getEditedPostType();\n\t\tconst postId = getEditedPostId();\n\t\tconst record = getEditedEntityRecord( 'postType', postType, postId );\n\n\t\tconst info = record ? getTemplateInfo( record ) : {};\n\n\t\treturn { info, template: record };\n\t}, [] );\n\n\tif ( ! title && ! description ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"edit-site-template-card\">\n\t\t\t<Icon className=\"edit-site-template-card__icon\" icon={ icon } />\n\t\t\t<div className=\"edit-site-template-card__content\">\n\t\t\t\t<div className=\"edit-site-template-card__header\">\n\t\t\t\t\t<h2 className=\"edit-site-template-card__title\">\n\t\t\t\t\t\t{ decodeEntities( title ) }\n\t\t\t\t\t</h2>\n\t\t\t\t\t<TemplateActions template={ template } />\n\t\t\t\t</div>\n\t\t\t\t<div className=\"edit-site-template-card__description\">\n\t\t\t\t\t{ decodeEntities( description ) }\n\t\t\t\t</div>\n\t\t\t\t<TemplateAreas />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
@@ -19,6 +19,8 @@ var _data = require("@wordpress/data");
19
19
 
20
20
  var _editor = require("@wordpress/editor");
21
21
 
22
+ var _htmlEntities = require("@wordpress/html-entities");
23
+
22
24
  var _isTemplateRevertable = _interopRequireDefault(require("../../utils/is-template-revertable"));
23
25
 
24
26
  var _store = require("../../store");
@@ -81,11 +83,11 @@ function TemplateDetails(_ref) {
81
83
  weight: 600,
82
84
  className: "edit-site-template-details__title",
83
85
  as: "p"
84
- }, title), description && (0, _element.createElement)(_components.__experimentalText, {
86
+ }, (0, _htmlEntities.decodeEntities)(title)), description && (0, _element.createElement)(_components.__experimentalText, {
85
87
  size: "body",
86
88
  className: "edit-site-template-details__description",
87
89
  as: "p"
88
- }, description)), isTemplatePart && (0, _element.createElement)("div", {
90
+ }, (0, _htmlEntities.decodeEntities)(description))), isTemplatePart && (0, _element.createElement)("div", {
89
91
  className: "edit-site-template-details__group"
90
92
  }, (0, _element.createElement)(_templatePartAreaSelector.default, {
91
93
  id: template.id
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["TemplateDetails","template","onClose","title","description","select","editorStore","__experimentalGetTemplateInfo","revertTemplate","editSiteStore","browseAllLinkProps","postType","type","postId","undefined","isTemplatePart","canEditTitle","has_theme_file","is_custom","revert","id"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAOA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAYA;AACA;AACA;AAQe,SAASA,eAAT,OAAkD;AAAA,MAAxB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAwB;AAChE,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAyB,qBAC5BC,MAAF,IACCA,MAAM,CAAEC,aAAF,CAAN,CAAsBC,6BAAtB,CAAqDN,QAArD,CAF6B,EAG9B,EAH8B,CAA/B;AAKA,QAAM;AAAEO,IAAAA;AAAF,MAAqB,uBAAaC,YAAb,CAA3B;AAEA,QAAM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AC,qBAAD;AAAW,IAAA,SAAS,EAAC;AAArB,KACC,4BAAC,oBAAD;AACC,IAAA,SAAS,EAAC,2CADX;AAEC,IAAA,IAAI,EAAG,cACN,4CADM,CAFR;AAKC,IAAA,OAAO,EAAGkB;AALX,KAOG,cAAI,sBAAJ,CAPH,CADD,CAnCF,EAgDC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC;AADX,KAEMT,kBAFN,GAIG,CAAAT,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAEW,IAAV,MAAmB,aAAnB,GACC,cAAI,sBAAJ,CADD,GAEC,cAAI,2BAAJ,CANJ,CAhDD,CADD;AA2DA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalVStack as VStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { store as editSiteStore } from '../../store';\nimport TemplateAreas from './template-areas';\nimport EditTemplateTitle from './edit-template-title';\nimport { useLink } from '../routes/link';\nimport TemplatePartAreaSelector from './template-part-area-selector';\n\nexport default function TemplateDetails( { template, onClose } ) {\n\tconst { title, description } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetTemplateInfo( template ),\n\t\t[]\n\t);\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\n\tconst browseAllLinkProps = useLink( {\n\t\t// TODO: We should update this to filter by template part's areas as well.\n\t\tpostType: template.type,\n\t\tpostId: undefined,\n\t} );\n\n\tconst isTemplatePart = template.type === 'wp_template_part';\n\n\t// Only user-created and non-default templates can change the name.\n\t// But any user-created template part can be renamed.\n\tconst canEditTitle = isTemplatePart\n\t\t? ! template.has_theme_file\n\t\t: template.is_custom && ! template.has_theme_file;\n\n\tif ( ! template ) {\n\t\treturn null;\n\t}\n\n\tconst revert = () => {\n\t\trevertTemplate( template );\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<div className=\"edit-site-template-details\">\n\t\t\t<VStack className=\"edit-site-template-details__group\" spacing={ 3 }>\n\t\t\t\t{ canEditTitle ? (\n\t\t\t\t\t<EditTemplateTitle template={ template } />\n\t\t\t\t) : (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize={ 16 }\n\t\t\t\t\t\tweight={ 600 }\n\t\t\t\t\t\tclassName=\"edit-site-template-details__title\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\n\t\t\t\t{ description && (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize=\"body\"\n\t\t\t\t\t\tclassName=\"edit-site-template-details__description\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</VStack>\n\n\t\t\t{ isTemplatePart && (\n\t\t\t\t<div className=\"edit-site-template-details__group\">\n\t\t\t\t\t<TemplatePartAreaSelector id={ template.id } />\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t<TemplateAreas closeTemplateDetailsDropdown={ onClose } />\n\n\t\t\t{ isTemplateRevertable( template ) && (\n\t\t\t\t<MenuGroup className=\"edit-site-template-details__group edit-site-template-details__revert\">\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tclassName=\"edit-site-template-details__revert-button\"\n\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t'Use the template as supplied by the theme.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ revert }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-template-details__show-all-button\"\n\t\t\t\t{ ...browseAllLinkProps }\n\t\t\t>\n\t\t\t\t{ template?.type === 'wp_template'\n\t\t\t\t\t? __( 'Browse all templates' )\n\t\t\t\t\t: __( 'Browse all template parts' ) }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["TemplateDetails","template","onClose","title","description","select","editorStore","__experimentalGetTemplateInfo","revertTemplate","editSiteStore","browseAllLinkProps","postType","type","postId","undefined","isTemplatePart","canEditTitle","has_theme_file","is_custom","revert","id"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAOA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvBA;AACA;AACA;;AAaA;AACA;AACA;AAQe,SAASA,eAAT,OAAkD;AAAA,MAAxB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAwB;AAChE,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAyB,qBAC5BC,MAAF,IACCA,MAAM,CAAEC,aAAF,CAAN,CAAsBC,6BAAtB,CAAqDN,QAArD,CAF6B,EAG9B,EAH8B,CAA/B;AAKA,QAAM;AAAEO,IAAAA;AAAF,MAAqB,uBAAaC,YAAb,CAA3B;AAEA,QAAMC,kBAAkB,GAAG,mBAAS;AACnC;AACAC,IAAAA,QAAQ,EAAEV,QAAQ,CAACW,IAFgB;AAGnCC,IAAAA,MAAM,EAAEC;AAH2B,GAAT,CAA3B;AAMA,QAAMC,cAAc,GAAGd,QAAQ,CAACW,IAAT,KAAkB,kBAAzC,CAdgE,CAgBhE;AACA;;AACA,QAAMI,YAAY,GAAGD,cAAc,GAChC,CAAEd,QAAQ,CAACgB,cADqB,GAEhChB,QAAQ,CAACiB,SAAT,IAAsB,CAAEjB,QAAQ,CAACgB,cAFpC;;AAIA,MAAK,CAAEhB,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;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,CADD,GAEC,cAAI,2BAAJ,CANJ,CAhDD,CADD;AA2DA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalVStack as VStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { store as editSiteStore } from '../../store';\nimport TemplateAreas from './template-areas';\nimport EditTemplateTitle from './edit-template-title';\nimport { useLink } from '../routes/link';\nimport TemplatePartAreaSelector from './template-part-area-selector';\n\nexport default function TemplateDetails( { template, onClose } ) {\n\tconst { title, description } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetTemplateInfo( template ),\n\t\t[]\n\t);\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\n\tconst browseAllLinkProps = useLink( {\n\t\t// TODO: We should update this to filter by template part's areas as well.\n\t\tpostType: template.type,\n\t\tpostId: undefined,\n\t} );\n\n\tconst isTemplatePart = template.type === 'wp_template_part';\n\n\t// Only user-created and non-default templates can change the name.\n\t// But any user-created template part can be renamed.\n\tconst canEditTitle = isTemplatePart\n\t\t? ! template.has_theme_file\n\t\t: template.is_custom && ! template.has_theme_file;\n\n\tif ( ! template ) {\n\t\treturn null;\n\t}\n\n\tconst revert = () => {\n\t\trevertTemplate( template );\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<div className=\"edit-site-template-details\">\n\t\t\t<VStack className=\"edit-site-template-details__group\" spacing={ 3 }>\n\t\t\t\t{ canEditTitle ? (\n\t\t\t\t\t<EditTemplateTitle template={ template } />\n\t\t\t\t) : (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize={ 16 }\n\t\t\t\t\t\tweight={ 600 }\n\t\t\t\t\t\tclassName=\"edit-site-template-details__title\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ decodeEntities( title ) }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\n\t\t\t\t{ description && (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize=\"body\"\n\t\t\t\t\t\tclassName=\"edit-site-template-details__description\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ decodeEntities( description ) }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</VStack>\n\n\t\t\t{ isTemplatePart && (\n\t\t\t\t<div className=\"edit-site-template-details__group\">\n\t\t\t\t\t<TemplatePartAreaSelector id={ template.id } />\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t<TemplateAreas closeTemplateDetailsDropdown={ onClose } />\n\n\t\t\t{ isTemplateRevertable( template ) && (\n\t\t\t\t<MenuGroup className=\"edit-site-template-details__group edit-site-template-details__revert\">\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tclassName=\"edit-site-template-details__revert-button\"\n\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t'Use the template as supplied by the theme.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ revert }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-template-details__show-all-button\"\n\t\t\t\t{ ...browseAllLinkProps }\n\t\t\t>\n\t\t\t\t{ template?.type === 'wp_template'\n\t\t\t\t\t? __( 'Browse all templates' )\n\t\t\t\t\t: __( 'Browse all template parts' ) }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"]}
package/build/index.js CHANGED
@@ -23,12 +23,6 @@ Object.defineProperty(exports, "PluginSidebarMoreMenuItem", {
23
23
  return _pluginSidebarMoreMenuItem.default;
24
24
  }
25
25
  });
26
- Object.defineProperty(exports, "__experimentalMainDashboardButton", {
27
- enumerable: true,
28
- get: function () {
29
- return _mainDashboardButton.default;
30
- }
31
- });
32
26
  Object.defineProperty(exports, "__experimentalNavigationToggle", {
33
27
  enumerable: true,
34
28
  get: function () {
@@ -72,8 +66,6 @@ var _getIsListPage = _interopRequireDefault(require("./utils/get-is-list-page"))
72
66
 
73
67
  var _warning = _interopRequireDefault(require("./components/error-boundary/warning"));
74
68
 
75
- var _mainDashboardButton = _interopRequireDefault(require("./components/main-dashboard-button"));
76
-
77
69
  var _navigationToggle = _interopRequireDefault(require("./components/navigation-sidebar/navigation-toggle"));
78
70
 
79
71
  var _pluginSidebar = _interopRequireDefault(require("./components/sidebar-edit-mode/plugin-sidebar"));
@@ -101,9 +93,11 @@ var _pluginMoreMenuItem = _interopRequireDefault(require("./components/header-ed
101
93
  function reinitializeEditor(target, settings) {
102
94
  // Display warning if editor wasn't able to resolve homepage template.
103
95
  if (!settings.__unstableHomeTemplate) {
96
+ var _settings$__experimen;
97
+
104
98
  (0, _element.render)((0, _element.createElement)(_warning.default, {
105
99
  message: (0, _i18n.__)('The editor is unable to find a block template for the homepage.'),
106
- dashboardLink: "index.php"
100
+ dashboardLink: (_settings$__experimen = settings.__experimentalDashboardLink) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : 'index.php'
107
101
  }), target);
108
102
  return;
109
103
  }
@@ -167,7 +161,8 @@ function reinitializeEditor(target, settings) {
167
161
  window.addEventListener('dragover', e => e.preventDefault(), false);
168
162
  window.addEventListener('drop', e => e.preventDefault(), false);
169
163
  (0, _element.render)((0, _element.createElement)(_app.default, {
170
- reboot: reboot
164
+ reboot: reboot,
165
+ homeTemplate: settings.__unstableHomeTemplate
171
166
  }), target);
172
167
  }
173
168
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["reinitializeEditor","target","settings","__unstableHomeTemplate","canInsert","blockType","name","reboot","bind","preferencesStore","setDefaults","editorMode","fixedToolbar","focusMode","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","showListViewByDefault","get","editSiteStore","setIsListViewOpened","interfaceStore","setDefaultComplementaryArea","updateSettings","editorStore","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","isLandingOnListPage","window","location","href","setIsNavigationPanelOpened","viewportStore","isViewportMatch","addEventListener","e","preventDefault","initializeEditor","id","__experimentalFetchLinkSuggestions","search","searchOptions","__experimentalFetchRichUrlData","fetchUrlData","document","getElementById","blocksStore","__experimentalReapplyBlockTypeFilters","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA;;AANA;;AACA;;AAIA;;AAEA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAoIA;;AACA;;AACA;;AACA;;AACA;;AArKA;AACA;AACA;;AAoBA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kBAAT,CAA6BC,MAA7B,EAAqCC,QAArC,EAAgD;AACtD;AACA,MAAK,CAAEA,QAAQ,CAACC,sBAAhB,EAAyC;AACxC,yBACC,4BAAC,gBAAD;AACC,MAAA,OAAO,EAAG,cACT,iEADS,CADX;AAIC,MAAA,aAAa,EAAC;AAJf,MADD,EAOCF,MAPD;AASA;AACA;AAED;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACC,wBACC,0CADD,EAEC,gCAFD,EAGC,CAAEG,SAAF,EAAaC,SAAb,KAA4B;AAC3B,QAAKA,SAAS,CAACC,IAAV,KAAmB,eAAxB,EAA0C;AACzC,aAAO,KAAP;AACA;;AACD,WAAOF,SAAP;AACA,GARF,EAxBsD,CAmCtD;;AACA,uCAAwBH,MAAxB;AACA,QAAMM,MAAM,GAAGP,kBAAkB,CAACQ,IAAnB,CAAyB,IAAzB,EAA+BP,MAA/B,EAAuCC,QAAvC,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C,cAAF,EAA1C,EAA8D,KAA9D;AAEA,uBAAQ,4BAAC,YAAD;AAAa,IAAA,MAAM,EAAG9B;AAAtB,IAAR,EAA2CN,MAA3C;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASqC,gBAAT,CAA2BC,EAA3B,EAA+BrC,QAA/B,EAA0C;AAChDA,EAAAA,QAAQ,CAACsC,kCAAT,GAA8C,CAAEC,MAAF,EAAUC,aAAV,KAC7C,kDAAsBD,MAAtB,EAA8BC,aAA9B,EAA6CxC,QAA7C,CADD;;AAEAA,EAAAA,QAAQ,CAACyC,8BAAT,GAA0CC,oCAA1C;AAEA,QAAM3C,MAAM,GAAG4C,QAAQ,CAACC,cAAT,CAAyBP,EAAzB,CAAf;;AAEA,sBAAUQ,aAAV,EAAwBC,qCAAxB;;AACA;;AACA,MAAKC,OAAO,CAACC,GAAR,CAAYC,mBAAjB,EAAuC;AACtC,oEAA8C;AAC7CC,MAAAA,eAAe,EAAE;AAD4B,KAA9C;AAGA;;AAEDpD,EAAAA,kBAAkB,CAAEC,MAAF,EAAUC,QAAV,CAAlB;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch, select } from '@wordpress/data';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { __ } from '@wordpress/i18n';\nimport { store as viewportStore } from '@wordpress/viewport';\nimport { getQueryArgs } from '@wordpress/url';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport EditSiteApp from './components/app';\nimport getIsListPage from './utils/get-is-list-page';\nimport ErrorBoundaryWarning from './components/error-boundary/warning';\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n */\nexport function reinitializeEditor( target, settings ) {\n\t// Display warning if editor wasn't able to resolve homepage template.\n\tif ( ! settings.__unstableHomeTemplate ) {\n\t\trender(\n\t\t\t<ErrorBoundaryWarning\n\t\t\t\tmessage={ __(\n\t\t\t\t\t'The editor is unable to find a block template for the homepage.'\n\t\t\t\t) }\n\t\t\t\tdashboardLink=\"index.php\"\n\t\t\t/>,\n\t\t\ttarget\n\t\t);\n\t\treturn;\n\t}\n\n\t/*\n\t * Prevent adding the Clasic block in the site editor.\n\t * Only add the filter when the site editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t *\n\t * This usage here is inspired by previous usage of the filter in the post editor:\n\t * https://github.com/WordPress/gutenberg/pull/37157\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removeClassicBlockFromInserter',\n\t\t( canInsert, blockType ) => {\n\t\t\tif ( blockType.name === 'core/freeform' ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t// This will be a no-op if the target doesn't have any React nodes.\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\t{\n\t\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\t\teditorMode: 'visual',\n\t\t\tfixedToolbar: false,\n\t\t\tfocusMode: false,\n\t\t\tkeepCaretInsideBlock: false,\n\t\t\twelcomeGuide: true,\n\t\t\twelcomeGuideStyles: true,\n\t\t\tshowListViewByDefault: false,\n\t\t} );\n\n\t\t// Check if the block list view should be open by default.\n\t\tif (\n\t\t\tselect( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showListViewByDefault'\n\t\t\t)\n\t\t) {\n\t\t\tdispatch( editSiteStore ).setIsListViewOpened( true );\n\t\t}\n\n\t\tdispatch( interfaceStore ).setDefaultComplementaryArea(\n\t\t\t'core/edit-site',\n\t\t\t'edit-site/template'\n\t\t);\n\n\t\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t\t// so that they can be selected with core/editor selectors in any editor.\n\t\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t\t// which internally uses updateEditorSettings as well.\n\t\tdispatch( editorStore ).updateEditorSettings( {\n\t\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t\t} );\n\n\t\tconst isLandingOnListPage = getIsListPage(\n\t\t\tgetQueryArgs( window.location.href )\n\t\t);\n\n\t\tif ( isLandingOnListPage ) {\n\t\t\t// Default the navigation panel to be opened when we're in a bigger\n\t\t\t// screen and land in the list screen.\n\t\t\tdispatch( editSiteStore ).setIsNavigationPanelOpened(\n\t\t\t\tselect( viewportStore ).isViewportMatch( 'medium' )\n\t\t\t);\n\t\t}\n\t}\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\trender( <EditSiteApp reboot={ reboot } />, target );\n}\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\n\tconst target = document.getElementById( id );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks();\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\treinitializeEditor( target, settings );\n}\n\nexport { default as __experimentalMainDashboardButton } from './components/main-dashboard-button';\nexport { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle';\nexport { default as PluginSidebar } from './components/sidebar-edit-mode/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header-edit-mode/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header-edit-mode/plugin-more-menu-item';\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["reinitializeEditor","target","settings","__unstableHomeTemplate","__experimentalDashboardLink","canInsert","blockType","name","reboot","bind","preferencesStore","setDefaults","editorMode","fixedToolbar","focusMode","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","showListViewByDefault","get","editSiteStore","setIsListViewOpened","interfaceStore","setDefaultComplementaryArea","updateSettings","editorStore","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","isLandingOnListPage","window","location","href","setIsNavigationPanelOpened","viewportStore","isViewportMatch","addEventListener","e","preventDefault","initializeEditor","id","__experimentalFetchLinkSuggestions","search","searchOptions","__experimentalFetchRichUrlData","fetchUrlData","document","getElementById","blocksStore","__experimentalReapplyBlockTypeFilters","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA;;AANA;;AACA;;AAIA;;AAEA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AA4IA;;AACA;;AACA;;AACA;;AA5KA;AACA;AACA;;AAoBA;AACA;AACA;;AAOA;AACA;AACA;AAC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,mBAAjB,EAAuC;AACtC,oEAA8C;AAC7CC,MAAAA,eAAe,EAAE;AAD4B,KAA9C;AAGA;;AAEDrD,EAAAA,kBAAkB,CAAEC,MAAF,EAAUC,QAAV,CAAlB;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch, select } from '@wordpress/data';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { __ } from '@wordpress/i18n';\nimport { store as viewportStore } from '@wordpress/viewport';\nimport { getQueryArgs } from '@wordpress/url';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport EditSiteApp from './components/app';\nimport getIsListPage from './utils/get-is-list-page';\nimport ErrorBoundaryWarning from './components/error-boundary/warning';\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n */\nexport function reinitializeEditor( target, settings ) {\n\t// Display warning if editor wasn't able to resolve homepage template.\n\tif ( ! settings.__unstableHomeTemplate ) {\n\t\trender(\n\t\t\t<ErrorBoundaryWarning\n\t\t\t\tmessage={ __(\n\t\t\t\t\t'The editor is unable to find a block template for the homepage.'\n\t\t\t\t) }\n\t\t\t\tdashboardLink={\n\t\t\t\t\tsettings.__experimentalDashboardLink ?? 'index.php'\n\t\t\t\t}\n\t\t\t/>,\n\t\t\ttarget\n\t\t);\n\t\treturn;\n\t}\n\n\t/*\n\t * Prevent adding the Clasic block in the site editor.\n\t * Only add the filter when the site editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t *\n\t * This usage here is inspired by previous usage of the filter in the post editor:\n\t * https://github.com/WordPress/gutenberg/pull/37157\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removeClassicBlockFromInserter',\n\t\t( canInsert, blockType ) => {\n\t\t\tif ( blockType.name === 'core/freeform' ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t// This will be a no-op if the target doesn't have any React nodes.\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\t{\n\t\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\t\teditorMode: 'visual',\n\t\t\tfixedToolbar: false,\n\t\t\tfocusMode: false,\n\t\t\tkeepCaretInsideBlock: false,\n\t\t\twelcomeGuide: true,\n\t\t\twelcomeGuideStyles: true,\n\t\t\tshowListViewByDefault: false,\n\t\t} );\n\n\t\t// Check if the block list view should be open by default.\n\t\tif (\n\t\t\tselect( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showListViewByDefault'\n\t\t\t)\n\t\t) {\n\t\t\tdispatch( editSiteStore ).setIsListViewOpened( true );\n\t\t}\n\n\t\tdispatch( interfaceStore ).setDefaultComplementaryArea(\n\t\t\t'core/edit-site',\n\t\t\t'edit-site/template'\n\t\t);\n\n\t\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t\t// so that they can be selected with core/editor selectors in any editor.\n\t\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t\t// which internally uses updateEditorSettings as well.\n\t\tdispatch( editorStore ).updateEditorSettings( {\n\t\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t\t} );\n\n\t\tconst isLandingOnListPage = getIsListPage(\n\t\t\tgetQueryArgs( window.location.href )\n\t\t);\n\n\t\tif ( isLandingOnListPage ) {\n\t\t\t// Default the navigation panel to be opened when we're in a bigger\n\t\t\t// screen and land in the list screen.\n\t\t\tdispatch( editSiteStore ).setIsNavigationPanelOpened(\n\t\t\t\tselect( viewportStore ).isViewportMatch( 'medium' )\n\t\t\t);\n\t\t}\n\t}\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\trender(\n\t\t<EditSiteApp\n\t\t\treboot={ reboot }\n\t\t\thomeTemplate={ settings.__unstableHomeTemplate }\n\t\t/>,\n\t\ttarget\n\t);\n}\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\n\tconst target = document.getElementById( id );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks();\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\treinitializeEditor( target, settings );\n}\n\nexport { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle';\nexport { default as PluginSidebar } from './components/sidebar-edit-mode/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header-edit-mode/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header-edit-mode/plugin-more-menu-item';\n"]}
@@ -13,6 +13,7 @@ exports.setHomeTemplateId = setHomeTemplateId;
13
13
  exports.setIsInserterOpened = setIsInserterOpened;
14
14
  exports.setIsListViewOpened = setIsListViewOpened;
15
15
  exports.setIsNavigationPanelOpened = setIsNavigationPanelOpened;
16
+ exports.setIsSaveViewOpened = setIsSaveViewOpened;
16
17
  exports.setNavigationPanelActiveMenu = setNavigationPanelActiveMenu;
17
18
  exports.setTemplate = exports.setPage = void 0;
18
19
  exports.setTemplatePart = setTemplatePart;
@@ -357,6 +358,20 @@ function setIsListViewOpened(isOpen) {
357
358
  isOpen
358
359
  };
359
360
  }
361
+ /**
362
+ * Sets whether the save view panel should be open.
363
+ *
364
+ * @param {boolean} isOpen If true, opens the save view. If false, closes it.
365
+ * It does not toggle the state, but sets it directly.
366
+ */
367
+
368
+
369
+ function setIsSaveViewOpened(isOpen) {
370
+ return {
371
+ type: 'SET_IS_SAVE_VIEW_OPENED',
372
+ isOpen
373
+ };
374
+ }
360
375
  /**
361
376
  * Reverts a template to its original theme-provided file.
362
377
  *
@@ -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","page","context","addTemplate","newTemplate","saveEntityRecord","content","editEntityRecord","id","blocks","undoIgnore","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","noticesStore","createSuccessNotice","title","rendered","error","errorMessage","message","code","createErrorNotice","setTemplatePart","templatePartId","setHomeTemplateId","homeTemplateId","setPage","path","postId","entity","postType","link","__experimentalGetTemplateForLink","setNavigationPanelActiveMenu","menu","openNavigationPanelToMenu","setIsNavigationPanelOpened","isOpen","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","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,GACvB,CAAEC,UAAF,EAAcC,YAAd,KACA,eAAoC;AAAA,MAA5B;AAAER,IAAAA,QAAF;AAAYH,IAAAA;AAAZ,GAA4B;;AACnC,MAAK,CAAEW,YAAP,EAAsB;AACrB,UAAMC,QAAQ,GAAG,MAAMZ,QAAQ,CAC7Ba,aADqB,CACNC,eADM,EAErBC,eAFqB,CAEJ,UAFI,EAEQ,aAFR,EAEuBL,UAFvB,CAAvB;AAGAC,IAAAA,YAAY,GAAGC,QAAH,aAAGA,QAAH,uBAAGA,QAAQ,CAAEI,IAAzB;AACA;;AAEDb,EAAAA,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KAAe,eAAhC,GACGH,KAAK,CAACE,OADT,GAEG,cAAI,wCAAJ,CAHJ;AAIAvC,MAAAA,QAAQ,CACNG,QADF,CACY8B,cADZ,EAEEQ,iBAFF,CAEqBH,YAFrB,EAEmC;AAAE9B,QAAAA,IAAI,EAAE;AAAR,OAFnC;AAGA;AACD,GA5HD;AAAA,CADM;AA8HP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMwE,kBAAkB,GAC5BC,IAAF,IACA,SAAoB;AAAA,MAAlB;AAAEjF,IAAAA;AAAF,GAAkB;AACnBA,EAAAA,QAAQ,CACNG,QADF,CACY+E,gBADZ,EAEEC,uBAFF,CAE2BC,qBAF3B,EAE8CH,IAF9C;AAGA,CANK;AAQP;AACA;AACA;;;;;AACO,MAAMI,mBAAmB,GAC/B,MACA,SAAoB;AAAA,MAAlB;AAAErF,IAAAA;AAAF,GAAkB;AACnBA,EAAAA,QAAQ,CACNG,QADF,CACY+E,gBADZ,EAEEI,wBAFF,CAE4BF,qBAF5B;AAGA,CANK;;;;AAQA,MAAMG,gBAAgB,GAC1BC,IAAF,IACA,UAAoB;AAAA,MAAlB;AAAExF,IAAAA;AAAF,GAAkB;AACnBA,EAAAA,QAAQ,CACNG,QADF,CACY,kBADZ,EAEEsF,GAFF,CAEO,gBAFP,EAEyB,YAFzB,EAEuCD,IAFvC,EADmB,CAKnB;;AACA,MAAKA,IAAI,KAAK,QAAd,EAAyB;AACxBxF,IAAAA,QAAQ,CAACG,QAAT,CAAmBuF,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\tconst template = await registry\n\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t.getEntityRecord( 'postType', 'wp_template', templateId );\n\t\t\ttemplateSlug = template?.slug;\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_TEMPLATE',\n\t\t\ttemplateId,\n\t\t\tpage: { context: { 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_TEMPLATE',\n\t\t\ttemplateId: newTemplate.id,\n\t\t\tpage: { context: { 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_TEMPLATE_PART',\n\t\ttemplatePartId,\n\t};\n}\n\n/**\n * Action that sets the home template ID to the template ID of the page resolved\n * from a given path.\n *\n * @param {number} homeTemplateId The template ID for the homepage.\n */\nexport function setHomeTemplateId( homeTemplateId ) {\n\treturn {\n\t\ttype: 'SET_HOME_TEMPLATE',\n\t\thomeTemplateId,\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_PAGE',\n\t\t\tpage: template.slug\n\t\t\t\t? {\n\t\t\t\t\t\t...page,\n\t\t\t\t\t\tcontext: {\n\t\t\t\t\t\t\t...page.context,\n\t\t\t\t\t\t\ttemplateSlug: template.slug,\n\t\t\t\t\t\t},\n\t\t\t\t }\n\t\t\t\t: page,\n\t\t\ttemplateId: template.id,\n\t\t} );\n\n\t\treturn template.id;\n\t};\n\n/**\n * Action that sets the active navigation panel menu.\n *\n * @param {string} menu Menu prop of active menu.\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu( menu ) {\n\treturn {\n\t\ttype: 'SET_NAVIGATION_PANEL_ACTIVE_MENU',\n\t\tmenu,\n\t};\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @param {string} menu Identifies the menu to open.\n */\nexport function openNavigationPanelToMenu( menu ) {\n\treturn {\n\t\ttype: 'OPEN_NAVIGATION_PANEL_TO_MENU',\n\t\tmenu,\n\t};\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @param {boolean} isOpen If true, opens the nav panel. If false, closes it. It\n * does not toggle the state, but sets it directly.\n */\nexport function setIsNavigationPanelOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_NAVIGATION_PANEL_OPENED',\n\t\tisOpen,\n\t};\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 * 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"]}
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","page","context","addTemplate","newTemplate","saveEntityRecord","content","editEntityRecord","id","blocks","undoIgnore","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","noticesStore","createSuccessNotice","title","rendered","error","errorMessage","message","code","createErrorNotice","setTemplatePart","templatePartId","setHomeTemplateId","homeTemplateId","setPage","path","postId","entity","postType","link","__experimentalGetTemplateForLink","setNavigationPanelActiveMenu","menu","openNavigationPanelToMenu","setIsNavigationPanelOpened","isOpen","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","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,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AAAA;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\tconst template = await registry\n\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t.getEntityRecord( 'postType', 'wp_template', templateId );\n\t\t\ttemplateSlug = template?.slug;\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_TEMPLATE',\n\t\t\ttemplateId,\n\t\t\tpage: { context: { 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_TEMPLATE',\n\t\t\ttemplateId: newTemplate.id,\n\t\t\tpage: { context: { 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_TEMPLATE_PART',\n\t\ttemplatePartId,\n\t};\n}\n\n/**\n * Action that sets the home template ID to the template ID of the page resolved\n * from a given path.\n *\n * @param {number} homeTemplateId The template ID for the homepage.\n */\nexport function setHomeTemplateId( homeTemplateId ) {\n\treturn {\n\t\ttype: 'SET_HOME_TEMPLATE',\n\t\thomeTemplateId,\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_PAGE',\n\t\t\tpage: template.slug\n\t\t\t\t? {\n\t\t\t\t\t\t...page,\n\t\t\t\t\t\tcontext: {\n\t\t\t\t\t\t\t...page.context,\n\t\t\t\t\t\t\ttemplateSlug: template.slug,\n\t\t\t\t\t\t},\n\t\t\t\t }\n\t\t\t\t: page,\n\t\t\ttemplateId: template.id,\n\t\t} );\n\n\t\treturn template.id;\n\t};\n\n/**\n * Action that sets the active navigation panel menu.\n *\n * @param {string} menu Menu prop of active menu.\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu( menu ) {\n\treturn {\n\t\ttype: 'SET_NAVIGATION_PANEL_ACTIVE_MENU',\n\t\tmenu,\n\t};\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @param {string} menu Identifies the menu to open.\n */\nexport function openNavigationPanelToMenu( menu ) {\n\treturn {\n\t\ttype: 'OPEN_NAVIGATION_PANEL_TO_MENU',\n\t\tmenu,\n\t};\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @param {boolean} isOpen If true, opens the nav panel. If false, closes it. It\n * does not toggle the state, but sets it directly.\n */\nexport function setIsNavigationPanelOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_NAVIGATION_PANEL_OPENED',\n\t\tisOpen,\n\t};\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"]}
@@ -10,6 +10,7 @@ exports.editedPost = editedPost;
10
10
  exports.homeTemplateId = homeTemplateId;
11
11
  exports.listViewPanel = listViewPanel;
12
12
  exports.navigationPanel = navigationPanel;
13
+ exports.saveViewPanel = saveViewPanel;
13
14
  exports.settings = settings;
14
15
 
15
16
  var _data = require("@wordpress/data");
@@ -232,6 +233,31 @@ function listViewPanel() {
232
233
 
233
234
  return state;
234
235
  }
236
+ /**
237
+ * Reducer to set the save view panel open or closed.
238
+ *
239
+ * @param {Object} state Current state.
240
+ * @param {Object} action Dispatched action.
241
+ */
242
+
243
+
244
+ function saveViewPanel() {
245
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
246
+ let action = arguments.length > 1 ? arguments[1] : undefined;
247
+
248
+ switch (action.type) {
249
+ case 'OPEN_NAVIGATION_PANEL_TO_MENU':
250
+ return false;
251
+
252
+ case 'SET_IS_NAVIGATION_PANEL_OPENED':
253
+ return action.isOpen ? false : state;
254
+
255
+ case 'SET_IS_SAVE_VIEW_OPENED':
256
+ return action.isOpen;
257
+ }
258
+
259
+ return state;
260
+ }
235
261
 
236
262
  var _default = (0, _data.combineReducers)({
237
263
  deviceType,
@@ -240,7 +266,8 @@ var _default = (0, _data.combineReducers)({
240
266
  homeTemplateId,
241
267
  navigationPanel,
242
268
  blockInserterPanel,
243
- listViewPanel
269
+ listViewPanel,
270
+ saveViewPanel
244
271
  });
245
272
 
246
273
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/reducer.js"],"names":["deviceType","state","action","type","settings","editedPost","id","templateId","page","templatePartId","homeTemplateId","navigationPanel","menu","MENU_ROOT","isOpen","value","blockInserterPanel","listViewPanel"],"mappings":";;;;;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;A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AAhB,KAAgB;AAAA,MAATC,MAAS;;AAC3D,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,+BAAL;AACC,aAAO,KAAP;;AACD,SAAK,gCAAL;AACA,SAAK,yBAAL;AACC,aAAOD,MAAM,CAACY,MAAP,GAAgB,KAAhB,GAAwBb,KAA/B;;AACD,SAAK,wBAAL;AACC,aAAOC,MAAM,CAACa,KAAd;AAPF;;AASA,SAAOd,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASgB,aAAT,GAAgD;AAAA,MAAxBhB,KAAwB,uEAAhB,KAAgB;AAAA,MAATC,MAAS;;AACtD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,+BAAL;AACC,aAAO,KAAP;;AACD,SAAK,gCAAL;AACC,aAAOD,MAAM,CAACY,MAAP,GAAgB,KAAhB,GAAwBb,KAA/B;;AACD,SAAK,wBAAL;AACC,aAAOC,MAAM,CAACa,KAAP,GAAe,KAAf,GAAuBd,KAA9B;;AACD,SAAK,yBAAL;AACC,aAAOC,MAAM,CAACY,MAAd;AARF;;AAUA,SAAOb,KAAP;AACA;;eAEc,2BAAiB;AAC/BD,EAAAA,UAD+B;AAE/BI,EAAAA,QAF+B;AAG/BC,EAAAA,UAH+B;AAI/BK,EAAAA,cAJ+B;AAK/BC,EAAAA,eAL+B;AAM/BK,EAAAA,kBAN+B;AAO/BC,EAAAA;AAP+B,CAAjB,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { MENU_ROOT } from '../components/navigation-sidebar/navigation-panel/constants';\n\n/**\n * Reducer returning the editing canvas device type.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deviceType( state = 'Desktop', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_PREVIEW_DEVICE_TYPE':\n\t\t\treturn action.deviceType;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the settings.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function settings( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_SETTINGS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.settings,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the currently edited Post Type,\n * Post Id and the context provided to fill the content of the block editor.\n *\n * @param {Object} state Current edited post.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function editedPost( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_TEMPLATE':\n\t\tcase 'SET_PAGE':\n\t\t\treturn {\n\t\t\t\ttype: 'wp_template',\n\t\t\t\tid: action.templateId,\n\t\t\t\tpage: action.page,\n\t\t\t};\n\t\tcase 'SET_TEMPLATE_PART':\n\t\t\treturn {\n\t\t\t\ttype: 'wp_template_part',\n\t\t\t\tid: action.templatePartId,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for information about the site's homepage.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function homeTemplateId( state, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_HOME_TEMPLATE':\n\t\t\treturn action.homeTemplateId;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for information about the navigation panel, such as its active menu\n * and whether it should be opened or closed.\n *\n * Note: this reducer interacts with the inserter and list view panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function navigationPanel(\n\tstate = { menu: MENU_ROOT, isOpen: false },\n\taction\n) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_NAVIGATION_PANEL_ACTIVE_MENU':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: action.menu,\n\t\t\t};\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisOpen: true,\n\t\t\t\tmenu: action.menu,\n\t\t\t};\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: ! action.isOpen ? MENU_ROOT : state.menu, // Set menu to root when closing panel.\n\t\t\t\tisOpen: action.isOpen,\n\t\t\t};\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: state.isOpen && action.isOpen ? MENU_ROOT : state.menu, // Set menu to root when closing panel.\n\t\t\t\tisOpen: action.isOpen ? false : state.isOpen,\n\t\t\t};\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: state.isOpen && action.value ? MENU_ROOT : state.menu, // Set menu to root when closing panel.\n\t\t\t\tisOpen: action.value ? false : state.isOpen,\n\t\t\t};\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the navigation and list view panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {boolean|Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn false;\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the navigation and inserter panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn false;\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tdeviceType,\n\tsettings,\n\teditedPost,\n\thomeTemplateId,\n\tnavigationPanel,\n\tblockInserterPanel,\n\tlistViewPanel,\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/reducer.js"],"names":["deviceType","state","action","type","settings","editedPost","id","templateId","page","templatePartId","homeTemplateId","navigationPanel","menu","MENU_ROOT","isOpen","value","blockInserterPanel","listViewPanel","saveViewPanel"],"mappings":";;;;;;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,UAAT,GAAiD;AAAA,MAA5BC,KAA4B,uEAApB,SAAoB;AAAA,MAATC,MAAS;;AACvD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,yBAAL;AACC,aAAOD,MAAM,CAACF,UAAd;AAFF;;AAKA,SAAOC,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASG,QAAT,GAAwC;AAAA,MAArBH,KAAqB,uEAAb,EAAa;AAAA,MAATC,MAAS;;AAC9C,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,iBAAL;AACC,aAAO,EACN,GAAGF,KADG;AAEN,WAAGC,MAAM,CAACE;AAFJ,OAAP;AAFF;;AAQA,SAAOH,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,UAAT,GAA0C;AAAA,MAArBJ,KAAqB,uEAAb,EAAa;AAAA,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AACC,aAAOC,MAAM,CAACa,KAAP,GAAe,KAAf,GAAuBd,KAA9B;;AACD,SAAK,yBAAL;AACC,aAAOC,MAAM,CAACY,MAAd;AARF;;AAUA,SAAOb,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASiB,aAAT,GAAgD;AAAA,MAAxBjB,KAAwB,uEAAhB,KAAgB;AAAA,MAATC,MAAS;;AACtD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,+BAAL;AACC,aAAO,KAAP;;AACD,SAAK,gCAAL;AACC,aAAOD,MAAM,CAACY,MAAP,GAAgB,KAAhB,GAAwBb,KAA/B;;AACD,SAAK,yBAAL;AACC,aAAOC,MAAM,CAACY,MAAd;AANF;;AAQA,SAAOb,KAAP;AACA;;eAEc,2BAAiB;AAC/BD,EAAAA,UAD+B;AAE/BI,EAAAA,QAF+B;AAG/BC,EAAAA,UAH+B;AAI/BK,EAAAA,cAJ+B;AAK/BC,EAAAA,eAL+B;AAM/BK,EAAAA,kBAN+B;AAO/BC,EAAAA,aAP+B;AAQ/BC,EAAAA;AAR+B,CAAjB,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { MENU_ROOT } from '../components/navigation-sidebar/navigation-panel/constants';\n\n/**\n * Reducer returning the editing canvas device type.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deviceType( state = 'Desktop', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_PREVIEW_DEVICE_TYPE':\n\t\t\treturn action.deviceType;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the settings.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function settings( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_SETTINGS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.settings,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the currently edited Post Type,\n * Post Id and the context provided to fill the content of the block editor.\n *\n * @param {Object} state Current edited post.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function editedPost( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_TEMPLATE':\n\t\tcase 'SET_PAGE':\n\t\t\treturn {\n\t\t\t\ttype: 'wp_template',\n\t\t\t\tid: action.templateId,\n\t\t\t\tpage: action.page,\n\t\t\t};\n\t\tcase 'SET_TEMPLATE_PART':\n\t\t\treturn {\n\t\t\t\ttype: 'wp_template_part',\n\t\t\t\tid: action.templatePartId,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for information about the site's homepage.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function homeTemplateId( state, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_HOME_TEMPLATE':\n\t\t\treturn action.homeTemplateId;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for information about the navigation panel, such as its active menu\n * and whether it should be opened or closed.\n *\n * Note: this reducer interacts with the inserter and list view panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function navigationPanel(\n\tstate = { menu: MENU_ROOT, isOpen: false },\n\taction\n) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_NAVIGATION_PANEL_ACTIVE_MENU':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: action.menu,\n\t\t\t};\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisOpen: true,\n\t\t\t\tmenu: action.menu,\n\t\t\t};\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: ! action.isOpen ? MENU_ROOT : state.menu, // Set menu to root when closing panel.\n\t\t\t\tisOpen: action.isOpen,\n\t\t\t};\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: state.isOpen && action.isOpen ? MENU_ROOT : state.menu, // Set menu to root when closing panel.\n\t\t\t\tisOpen: action.isOpen ? false : state.isOpen,\n\t\t\t};\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenu: state.isOpen && action.value ? MENU_ROOT : state.menu, // Set menu to root when closing panel.\n\t\t\t\tisOpen: action.value ? false : state.isOpen,\n\t\t\t};\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the navigation and list view panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {boolean|Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn false;\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the navigation and inserter panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn false;\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the save view panel open or closed.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function saveViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_NAVIGATION_PANEL_TO_MENU':\n\t\t\treturn false;\n\t\tcase 'SET_IS_NAVIGATION_PANEL_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_SAVE_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tdeviceType,\n\tsettings,\n\teditedPost,\n\thomeTemplateId,\n\tnavigationPanel,\n\tblockInserterPanel,\n\tlistViewPanel,\n\tsaveViewPanel,\n} );\n"]}
@@ -19,6 +19,7 @@ exports.isFeatureActive = isFeatureActive;
19
19
  exports.isInserterOpened = isInserterOpened;
20
20
  exports.isListViewOpened = isListViewOpened;
21
21
  exports.isNavigationOpened = isNavigationOpened;
22
+ exports.isSaveViewOpened = isSaveViewOpened;
22
23
 
23
24
  var _lodash = require("lodash");
24
25
 
@@ -327,6 +328,18 @@ function __experimentalGetInsertionPoint(state) {
327
328
  function isListViewOpened(state) {
328
329
  return state.listViewPanel;
329
330
  }
331
+ /**
332
+ * Returns the current opened/closed state of the save panel.
333
+ *
334
+ * @param {Object} state Global application state.
335
+ *
336
+ * @return {boolean} True if the save panel should be open; false if closed.
337
+ */
338
+
339
+
340
+ function isSaveViewOpened(state) {
341
+ return state.saveViewPanel;
342
+ }
330
343
  /**
331
344
  * Returns the template parts and their blocks for the current edited template.
332
345
  *