@wordpress/edit-post 7.24.1 → 7.26.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 (267) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE.md +1 -1
  3. package/build/components/browser-url/index.js +3 -2
  4. package/build/components/browser-url/index.js.map +1 -1
  5. package/build/components/header/index.js +35 -33
  6. package/build/components/header/index.js.map +1 -1
  7. package/build/components/header/mode-switcher/index.js +1 -1
  8. package/build/components/header/mode-switcher/index.js.map +1 -1
  9. package/build/components/header/more-menu/index.js +2 -1
  10. package/build/components/header/more-menu/index.js.map +1 -1
  11. package/build/components/header/writing-menu/index.js +22 -18
  12. package/build/components/header/writing-menu/index.js.map +1 -1
  13. package/build/components/keyboard-shortcuts/index.js +1 -20
  14. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  15. package/build/components/layout/index.js +45 -38
  16. package/build/components/layout/index.js.map +1 -1
  17. package/build/components/layout/index.native.js +3 -1
  18. package/build/components/layout/index.native.js.map +1 -1
  19. package/build/components/meta-boxes/meta-box-visibility.js +2 -6
  20. package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
  21. package/build/components/preferences-modal/index.js +87 -54
  22. package/build/components/preferences-modal/index.js.map +1 -1
  23. package/build/components/preferences-modal/options/enable-feature.js +23 -23
  24. package/build/components/preferences-modal/options/enable-feature.js.map +1 -1
  25. package/build/components/preferences-modal/options/enable-panel.js +3 -6
  26. package/build/components/preferences-modal/options/enable-panel.js.map +1 -1
  27. package/build/components/sidebar/plugin-document-setting-panel/index.js +3 -3
  28. package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  29. package/build/components/sidebar/plugin-sidebar/index.js +2 -10
  30. package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
  31. package/build/components/sidebar/post-status/index.js +3 -5
  32. package/build/components/sidebar/post-status/index.js.map +1 -1
  33. package/build/components/sidebar/settings-header/index.js +17 -43
  34. package/build/components/sidebar/settings-header/index.js.map +1 -1
  35. package/build/components/sidebar/settings-sidebar/index.js +80 -26
  36. package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
  37. package/build/components/start-page-options/index.js +3 -3
  38. package/build/components/start-page-options/index.js.map +1 -1
  39. package/build/components/visual-editor/index.js +20 -257
  40. package/build/components/visual-editor/index.js.map +1 -1
  41. package/build/components/welcome-guide/index.js +6 -3
  42. package/build/components/welcome-guide/index.js.map +1 -1
  43. package/build/editor.js +20 -30
  44. package/build/editor.js.map +1 -1
  45. package/build/editor.native.js +3 -11
  46. package/build/editor.native.js.map +1 -1
  47. package/build/hooks/commands/use-common-commands.js +16 -12
  48. package/build/hooks/commands/use-common-commands.js.map +1 -1
  49. package/build/hooks/use-post-history.js +79 -0
  50. package/build/hooks/use-post-history.js.map +1 -0
  51. package/build/index.js +24 -20
  52. package/build/index.js.map +1 -1
  53. package/build/index.native.js +7 -1
  54. package/build/index.native.js.map +1 -1
  55. package/build/plugins/welcome-guide-menu-item/index.js +2 -6
  56. package/build/plugins/welcome-guide-menu-item/index.js.map +1 -1
  57. package/build/store/actions.js +94 -112
  58. package/build/store/actions.js.map +1 -1
  59. package/build/store/reducer.js +1 -95
  60. package/build/store/reducer.js.map +1 -1
  61. package/build/store/selectors.js +86 -48
  62. package/build/store/selectors.js.map +1 -1
  63. package/build-module/components/browser-url/index.js +3 -2
  64. package/build-module/components/browser-url/index.js.map +1 -1
  65. package/build-module/components/header/index.js +37 -35
  66. package/build-module/components/header/index.js.map +1 -1
  67. package/build-module/components/header/mode-switcher/index.js +1 -1
  68. package/build-module/components/header/mode-switcher/index.js.map +1 -1
  69. package/build-module/components/header/more-menu/index.js +2 -1
  70. package/build-module/components/header/more-menu/index.js.map +1 -1
  71. package/build-module/components/header/writing-menu/index.js +23 -19
  72. package/build-module/components/header/writing-menu/index.js.map +1 -1
  73. package/build-module/components/keyboard-shortcuts/index.js +1 -20
  74. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  75. package/build-module/components/layout/index.js +46 -38
  76. package/build-module/components/layout/index.js.map +1 -1
  77. package/build-module/components/layout/index.native.js +4 -2
  78. package/build-module/components/layout/index.native.js.map +1 -1
  79. package/build-module/components/meta-boxes/meta-box-visibility.js +2 -6
  80. package/build-module/components/meta-boxes/meta-box-visibility.js.map +1 -1
  81. package/build-module/components/preferences-modal/index.js +87 -54
  82. package/build-module/components/preferences-modal/index.js.map +1 -1
  83. package/build-module/components/preferences-modal/options/enable-feature.js +22 -23
  84. package/build-module/components/preferences-modal/options/enable-feature.js.map +1 -1
  85. package/build-module/components/preferences-modal/options/enable-panel.js +3 -7
  86. package/build-module/components/preferences-modal/options/enable-panel.js.map +1 -1
  87. package/build-module/components/sidebar/plugin-document-setting-panel/index.js +3 -3
  88. package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  89. package/build-module/components/sidebar/plugin-sidebar/index.js +2 -10
  90. package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
  91. package/build-module/components/sidebar/post-status/index.js +4 -6
  92. package/build-module/components/sidebar/post-status/index.js.map +1 -1
  93. package/build-module/components/sidebar/settings-header/index.js +20 -46
  94. package/build-module/components/sidebar/settings-header/index.js.map +1 -1
  95. package/build-module/components/sidebar/settings-sidebar/index.js +80 -27
  96. package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
  97. package/build-module/components/start-page-options/index.js +3 -3
  98. package/build-module/components/start-page-options/index.js.map +1 -1
  99. package/build-module/components/visual-editor/index.js +24 -261
  100. package/build-module/components/visual-editor/index.js.map +1 -1
  101. package/build-module/components/welcome-guide/index.js +6 -3
  102. package/build-module/components/welcome-guide/index.js.map +1 -1
  103. package/build-module/editor.js +20 -30
  104. package/build-module/editor.js.map +1 -1
  105. package/build-module/editor.native.js +3 -11
  106. package/build-module/editor.native.js.map +1 -1
  107. package/build-module/hooks/commands/use-common-commands.js +16 -12
  108. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  109. package/build-module/hooks/use-post-history.js +73 -0
  110. package/build-module/hooks/use-post-history.js.map +1 -0
  111. package/build-module/index.js +19 -12
  112. package/build-module/index.js.map +1 -1
  113. package/build-module/index.native.js +7 -1
  114. package/build-module/index.native.js.map +1 -1
  115. package/build-module/plugins/welcome-guide-menu-item/index.js +2 -6
  116. package/build-module/plugins/welcome-guide-menu-item/index.js.map +1 -1
  117. package/build-module/store/actions.js +86 -105
  118. package/build-module/store/actions.js.map +1 -1
  119. package/build-module/store/reducer.js +1 -92
  120. package/build-module/store/reducer.js.map +1 -1
  121. package/build-module/store/selectors.js +76 -38
  122. package/build-module/store/selectors.js.map +1 -1
  123. package/build-style/style-rtl.css +65 -473
  124. package/build-style/style.css +65 -473
  125. package/package.json +32 -32
  126. package/src/components/browser-url/index.js +4 -2
  127. package/src/components/header/index.js +45 -46
  128. package/src/components/header/mode-switcher/index.js +2 -1
  129. package/src/components/header/more-menu/index.js +1 -0
  130. package/src/components/header/style.scss +63 -37
  131. package/src/components/header/writing-menu/index.js +24 -24
  132. package/src/components/keyboard-shortcut-help-modal/test/index.js +0 -15
  133. package/src/components/keyboard-shortcuts/index.js +1 -23
  134. package/src/components/layout/index.js +31 -39
  135. package/src/components/layout/index.native.js +9 -1
  136. package/src/components/meta-boxes/meta-box-visibility.js +2 -8
  137. package/src/components/preferences-modal/index.js +128 -97
  138. package/src/components/preferences-modal/options/enable-feature.js +26 -21
  139. package/src/components/preferences-modal/options/enable-panel.js +3 -7
  140. package/src/components/preferences-modal/test/__snapshots__/meta-boxes-section.js.snap +187 -175
  141. package/src/components/preferences-modal/test/index.js +1 -52
  142. package/src/components/sidebar/plugin-document-setting-panel/index.js +3 -3
  143. package/src/components/sidebar/plugin-sidebar/index.js +1 -9
  144. package/src/components/sidebar/post-status/index.js +5 -5
  145. package/src/components/sidebar/settings-header/index.js +19 -71
  146. package/src/components/sidebar/settings-sidebar/index.js +125 -60
  147. package/src/components/sidebar/style.scss +4 -12
  148. package/src/components/start-page-options/index.js +3 -3
  149. package/src/components/text-editor/style.scss +0 -6
  150. package/src/components/visual-editor/index.js +26 -359
  151. package/src/components/visual-editor/style.scss +0 -15
  152. package/src/components/welcome-guide/index.js +4 -2
  153. package/src/editor.js +36 -35
  154. package/src/editor.native.js +2 -23
  155. package/src/hooks/commands/use-common-commands.js +14 -16
  156. package/src/hooks/use-post-history.js +73 -0
  157. package/src/index.js +24 -13
  158. package/src/index.native.js +8 -1
  159. package/src/plugins/welcome-guide-menu-item/index.js +3 -6
  160. package/src/store/actions.js +80 -131
  161. package/src/store/reducer.js +0 -93
  162. package/src/store/selectors.js +97 -55
  163. package/src/store/test/actions.js +10 -131
  164. package/src/store/test/reducer.js +1 -108
  165. package/src/store/test/selectors.js +0 -50
  166. package/src/style.scss +1 -8
  167. package/src/test/__snapshots__/editor.native.js.snap +21 -0
  168. package/src/test/editor.native.js +107 -56
  169. package/build/components/device-preview/index.js +0 -72
  170. package/build/components/device-preview/index.js.map +0 -1
  171. package/build/components/header/document-actions/index.js +0 -82
  172. package/build/components/header/document-actions/index.js.map +0 -1
  173. package/build/components/header/header-toolbar/index.js +0 -156
  174. package/build/components/header/header-toolbar/index.js.map +0 -1
  175. package/build/components/secondary-sidebar/inserter-sidebar.js +0 -73
  176. package/build/components/secondary-sidebar/inserter-sidebar.js.map +0 -1
  177. package/build/components/secondary-sidebar/list-view-outline.js +0 -112
  178. package/build/components/secondary-sidebar/list-view-outline.js.map +0 -1
  179. package/build/components/secondary-sidebar/list-view-sidebar.js +0 -148
  180. package/build/components/secondary-sidebar/list-view-sidebar.js.map +0 -1
  181. package/build/components/sidebar/discussion-panel/index.js +0 -59
  182. package/build/components/sidebar/discussion-panel/index.js.map +0 -1
  183. package/build/components/sidebar/featured-image/index.js +0 -70
  184. package/build/components/sidebar/featured-image/index.js.map +0 -1
  185. package/build/components/sidebar/last-revision/index.js +0 -21
  186. package/build/components/sidebar/last-revision/index.js.map +0 -1
  187. package/build/components/sidebar/page-attributes/index.js +0 -65
  188. package/build/components/sidebar/page-attributes/index.js.map +0 -1
  189. package/build/components/sidebar/plugin-post-excerpt/index.js +0 -72
  190. package/build/components/sidebar/plugin-post-excerpt/index.js.map +0 -1
  191. package/build/components/sidebar/post-excerpt/index.js +0 -54
  192. package/build/components/sidebar/post-excerpt/index.js.map +0 -1
  193. package/build/components/sidebar/post-taxonomies/index.js +0 -30
  194. package/build/components/sidebar/post-taxonomies/index.js.map +0 -1
  195. package/build/components/sidebar/post-taxonomies/taxonomy-panel.js +0 -56
  196. package/build/components/sidebar/post-taxonomies/taxonomy-panel.js.map +0 -1
  197. package/build/components/sidebar/post-template/create-modal.js +0 -99
  198. package/build/components/sidebar/post-template/create-modal.js.map +0 -1
  199. package/build/components/sidebar/post-template/form.js +0 -110
  200. package/build/components/sidebar/post-template/form.js.map +0 -1
  201. package/build/components/sidebar/post-template/index.js +0 -106
  202. package/build/components/sidebar/post-template/index.js.map +0 -1
  203. package/build/components/view-link/index.js +0 -53
  204. package/build/components/view-link/index.js.map +0 -1
  205. package/build-module/components/device-preview/index.js +0 -65
  206. package/build-module/components/device-preview/index.js.map +0 -1
  207. package/build-module/components/header/document-actions/index.js +0 -74
  208. package/build-module/components/header/document-actions/index.js.map +0 -1
  209. package/build-module/components/header/header-toolbar/index.js +0 -148
  210. package/build-module/components/header/header-toolbar/index.js.map +0 -1
  211. package/build-module/components/secondary-sidebar/inserter-sidebar.js +0 -66
  212. package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +0 -1
  213. package/build-module/components/secondary-sidebar/list-view-outline.js +0 -105
  214. package/build-module/components/secondary-sidebar/list-view-outline.js.map +0 -1
  215. package/build-module/components/secondary-sidebar/list-view-sidebar.js +0 -140
  216. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +0 -1
  217. package/build-module/components/sidebar/discussion-panel/index.js +0 -52
  218. package/build-module/components/sidebar/discussion-panel/index.js.map +0 -1
  219. package/build-module/components/sidebar/featured-image/index.js +0 -63
  220. package/build-module/components/sidebar/featured-image/index.js.map +0 -1
  221. package/build-module/components/sidebar/last-revision/index.js +0 -13
  222. package/build-module/components/sidebar/last-revision/index.js.map +0 -1
  223. package/build-module/components/sidebar/page-attributes/index.js +0 -57
  224. package/build-module/components/sidebar/page-attributes/index.js.map +0 -1
  225. package/build-module/components/sidebar/plugin-post-excerpt/index.js +0 -64
  226. package/build-module/components/sidebar/plugin-post-excerpt/index.js.map +0 -1
  227. package/build-module/components/sidebar/post-excerpt/index.js +0 -47
  228. package/build-module/components/sidebar/post-excerpt/index.js.map +0 -1
  229. package/build-module/components/sidebar/post-taxonomies/index.js +0 -21
  230. package/build-module/components/sidebar/post-taxonomies/index.js.map +0 -1
  231. package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js +0 -48
  232. package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js.map +0 -1
  233. package/build-module/components/sidebar/post-template/create-modal.js +0 -92
  234. package/build-module/components/sidebar/post-template/create-modal.js.map +0 -1
  235. package/build-module/components/sidebar/post-template/form.js +0 -102
  236. package/build-module/components/sidebar/post-template/form.js.map +0 -1
  237. package/build-module/components/sidebar/post-template/index.js +0 -98
  238. package/build-module/components/sidebar/post-template/index.js.map +0 -1
  239. package/build-module/components/view-link/index.js +0 -46
  240. package/build-module/components/view-link/index.js.map +0 -1
  241. package/src/components/device-preview/index.js +0 -73
  242. package/src/components/header/document-actions/index.js +0 -82
  243. package/src/components/header/document-actions/style.scss +0 -64
  244. package/src/components/header/header-toolbar/index.js +0 -182
  245. package/src/components/header/header-toolbar/style.scss +0 -114
  246. package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +0 -929
  247. package/src/components/secondary-sidebar/inserter-sidebar.js +0 -71
  248. package/src/components/secondary-sidebar/list-view-outline.js +0 -98
  249. package/src/components/secondary-sidebar/list-view-sidebar.js +0 -170
  250. package/src/components/secondary-sidebar/style.scss +0 -120
  251. package/src/components/sidebar/discussion-panel/index.js +0 -62
  252. package/src/components/sidebar/featured-image/index.js +0 -67
  253. package/src/components/sidebar/last-revision/index.js +0 -17
  254. package/src/components/sidebar/last-revision/style.scss +0 -10
  255. package/src/components/sidebar/page-attributes/index.js +0 -65
  256. package/src/components/sidebar/plugin-post-excerpt/index.js +0 -61
  257. package/src/components/sidebar/plugin-post-excerpt/test/index.js +0 -36
  258. package/src/components/sidebar/post-excerpt/index.js +0 -59
  259. package/src/components/sidebar/post-taxonomies/index.js +0 -30
  260. package/src/components/sidebar/post-taxonomies/taxonomy-panel.js +0 -48
  261. package/src/components/sidebar/post-template/create-modal.js +0 -140
  262. package/src/components/sidebar/post-template/form.js +0 -141
  263. package/src/components/sidebar/post-template/index.js +0 -120
  264. package/src/components/sidebar/post-template/style.scss +0 -22
  265. package/src/components/sidebar/settings-header/style.scss +0 -74
  266. package/src/components/sidebar/template/style.scss +0 -35
  267. package/src/components/view-link/index.js +0 -48
@@ -7,7 +7,6 @@ import { store as interfaceStore } from '@wordpress/interface';
7
7
  import { store as preferencesStore } from '@wordpress/preferences';
8
8
  import { speak } from '@wordpress/a11y';
9
9
  import { store as noticesStore } from '@wordpress/notices';
10
- import { store as coreStore } from '@wordpress/core-data';
11
10
  import { store as blockEditorStore } from '@wordpress/block-editor';
12
11
  import { store as editorStore } from '@wordpress/editor';
13
12
  import deprecated from '@wordpress/deprecated';
@@ -28,7 +27,7 @@ export const openGeneralSidebar = name => ({
28
27
  dispatch,
29
28
  registry
30
29
  }) => {
31
- const isDistractionFree = registry.select(preferencesStore).get('core/edit-post', 'distractionFree');
30
+ const isDistractionFree = registry.select(preferencesStore).get('core', 'distractionFree');
32
31
  if (isDistractionFree) {
33
32
  dispatch.toggleDistractionFree();
34
33
  }
@@ -117,6 +116,8 @@ export function togglePublishSidebar() {
117
116
  /**
118
117
  * Returns an action object used to enable or disable a panel in the editor.
119
118
  *
119
+ * @deprecated
120
+ *
120
121
  * @param {string} panelName A string that identifies the panel to enable or disable.
121
122
  *
122
123
  * @return {Object} Action object.
@@ -124,57 +125,48 @@ export function togglePublishSidebar() {
124
125
  export const toggleEditorPanelEnabled = panelName => ({
125
126
  registry
126
127
  }) => {
127
- var _registry$select$get;
128
- const inactivePanels = (_registry$select$get = registry.select(preferencesStore).get('core/edit-post', 'inactivePanels')) !== null && _registry$select$get !== void 0 ? _registry$select$get : [];
129
- const isPanelInactive = !!inactivePanels?.includes(panelName);
130
-
131
- // If the panel is inactive, remove it to enable it, else add it to
132
- // make it inactive.
133
- let updatedInactivePanels;
134
- if (isPanelInactive) {
135
- updatedInactivePanels = inactivePanels.filter(invactivePanelName => invactivePanelName !== panelName);
136
- } else {
137
- updatedInactivePanels = [...inactivePanels, panelName];
138
- }
139
- registry.dispatch(preferencesStore).set('core/edit-post', 'inactivePanels', updatedInactivePanels);
128
+ deprecated("dispatch( 'core/edit-post' ).toggleEditorPanelEnabled", {
129
+ since: '6.5',
130
+ alternative: "dispatch( 'core/editor').toggleEditorPanelEnabled"
131
+ });
132
+ registry.dispatch(editorStore).toggleEditorPanelEnabled(panelName);
140
133
  };
141
134
 
142
135
  /**
143
136
  * Opens a closed panel and closes an open panel.
144
137
  *
138
+ * @deprecated
139
+ *
145
140
  * @param {string} panelName A string that identifies the panel to open or close.
146
141
  */
147
142
  export const toggleEditorPanelOpened = panelName => ({
148
143
  registry
149
144
  }) => {
150
- var _registry$select$get2;
151
- const openPanels = (_registry$select$get2 = registry.select(preferencesStore).get('core/edit-post', 'openPanels')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : [];
152
- const isPanelOpen = !!openPanels?.includes(panelName);
153
-
154
- // If the panel is open, remove it to close it, else add it to
155
- // make it open.
156
- let updatedOpenPanels;
157
- if (isPanelOpen) {
158
- updatedOpenPanels = openPanels.filter(openPanelName => openPanelName !== panelName);
159
- } else {
160
- updatedOpenPanels = [...openPanels, panelName];
161
- }
162
- registry.dispatch(preferencesStore).set('core/edit-post', 'openPanels', updatedOpenPanels);
145
+ deprecated("dispatch( 'core/edit-post' ).toggleEditorPanelOpened", {
146
+ since: '6.5',
147
+ alternative: "dispatch( 'core/editor').toggleEditorPanelOpened"
148
+ });
149
+ registry.dispatch(editorStore).toggleEditorPanelOpened(panelName);
163
150
  };
164
151
 
165
152
  /**
166
153
  * Returns an action object used to remove a panel from the editor.
167
154
  *
155
+ * @deprecated
156
+ *
168
157
  * @param {string} panelName A string that identifies the panel to remove.
169
158
  *
170
159
  * @return {Object} Action object.
171
160
  */
172
- export function removeEditorPanel(panelName) {
173
- return {
174
- type: 'REMOVE_PANEL',
175
- panelName
176
- };
177
- }
161
+ export const removeEditorPanel = panelName => ({
162
+ registry
163
+ }) => {
164
+ deprecated("dispatch( 'core/edit-post' ).removeEditorPanel", {
165
+ since: '6.5',
166
+ alternative: "dispatch( 'core/editor').removeEditorPanel"
167
+ });
168
+ registry.dispatch(editorStore).removeEditorPanel(panelName);
169
+ };
178
170
 
179
171
  /**
180
172
  * Triggers an action used to toggle a feature flag.
@@ -200,7 +192,7 @@ export const switchEditorMode = mode => ({
200
192
  if (mode !== 'visual') {
201
193
  registry.dispatch(blockEditorStore).clearSelectedBlock();
202
194
  }
203
- if (mode === 'text' && registry.select(preferencesStore).get('core/edit-post', 'distractionFree')) {
195
+ if (mode === 'text' && registry.select(preferencesStore).get('core', 'distractionFree')) {
204
196
  dispatch.toggleDistractionFree();
205
197
  }
206
198
  const message = mode === 'visual' ? __('Visual editor selected') : __('Code editor selected');
@@ -228,11 +220,11 @@ export const togglePinnedPluginItem = pluginName => ({
228
220
  export const updatePreferredStyleVariations = (blockName, blockStyle) => ({
229
221
  registry
230
222
  }) => {
231
- var _registry$select$get3;
223
+ var _registry$select$get;
232
224
  if (!blockName) {
233
225
  return;
234
226
  }
235
- const existingVariations = (_registry$select$get3 = registry.select(preferencesStore).get('core/edit-post', 'preferredStyleVariations')) !== null && _registry$select$get3 !== void 0 ? _registry$select$get3 : {};
227
+ const existingVariations = (_registry$select$get = registry.select(preferencesStore).get('core/edit-post', 'preferredStyleVariations')) !== null && _registry$select$get !== void 0 ? _registry$select$get : {};
236
228
 
237
229
  // When the blockStyle is omitted, remove the block's preferred variation.
238
230
  if (!blockStyle) {
@@ -258,8 +250,8 @@ export const updatePreferredStyleVariations = (blockName, blockStyle) => ({
258
250
  export const showBlockTypes = blockNames => ({
259
251
  registry
260
252
  }) => {
261
- var _registry$select$get4;
262
- const existingBlockNames = (_registry$select$get4 = registry.select(preferencesStore).get('core/edit-post', 'hiddenBlockTypes')) !== null && _registry$select$get4 !== void 0 ? _registry$select$get4 : [];
253
+ var _registry$select$get2;
254
+ const existingBlockNames = (_registry$select$get2 = registry.select(preferencesStore).get('core/edit-post', 'hiddenBlockTypes')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : [];
263
255
  const newBlockNames = existingBlockNames.filter(type => !(Array.isArray(blockNames) ? blockNames : [blockNames]).includes(type));
264
256
  registry.dispatch(preferencesStore).set('core/edit-post', 'hiddenBlockTypes', newBlockNames);
265
257
  };
@@ -272,8 +264,8 @@ export const showBlockTypes = blockNames => ({
272
264
  export const hideBlockTypes = blockNames => ({
273
265
  registry
274
266
  }) => {
275
- var _registry$select$get5;
276
- const existingBlockNames = (_registry$select$get5 = registry.select(preferencesStore).get('core/edit-post', 'hiddenBlockTypes')) !== null && _registry$select$get5 !== void 0 ? _registry$select$get5 : [];
267
+ var _registry$select$get3;
268
+ const existingBlockNames = (_registry$select$get3 = registry.select(preferencesStore).get('core/edit-post', 'hiddenBlockTypes')) !== null && _registry$select$get3 !== void 0 ? _registry$select$get3 : [];
277
269
  const mergedBlockNames = new Set([...existingBlockNames, ...(Array.isArray(blockNames) ? blockNames : [blockNames])]);
278
270
  registry.dispatch(preferencesStore).set('core/edit-post', 'hiddenBlockTypes', [...mergedBlockNames]);
279
271
  };
@@ -362,105 +354,94 @@ export function metaBoxUpdatesFailure() {
362
354
  }
363
355
 
364
356
  /**
365
- * Returns an action object used to toggle the width of the editing canvas.
357
+ * Action that changes the width of the editing canvas.
366
358
  *
367
- * @param {string} deviceType
359
+ * @deprecated
368
360
  *
369
- * @return {Object} Action object.
361
+ * @param {string} deviceType
370
362
  */
371
- export function __experimentalSetPreviewDeviceType(deviceType) {
372
- return {
373
- type: 'SET_PREVIEW_DEVICE_TYPE',
374
- deviceType
375
- };
376
- }
363
+ export const __experimentalSetPreviewDeviceType = deviceType => ({
364
+ registry
365
+ }) => {
366
+ deprecated("dispatch( 'core/edit-post' ).__experimentalSetPreviewDeviceType", {
367
+ since: '6.5',
368
+ version: '6.7',
369
+ hint: 'registry.dispatch( editorStore ).setDeviceType'
370
+ });
371
+ registry.dispatch(editorStore).setDeviceType(deviceType);
372
+ };
377
373
 
378
374
  /**
379
375
  * Returns an action object used to open/close the inserter.
380
376
  *
381
- * @param {boolean|Object} value Whether the inserter should be
382
- * opened (true) or closed (false).
383
- * To specify an insertion point,
384
- * use an object.
385
- * @param {string} value.rootClientId The root client ID to insert at.
386
- * @param {number} value.insertionIndex The index to insert at.
377
+ * @deprecated
387
378
  *
388
- * @return {Object} Action object.
379
+ * @param {boolean|Object} value Whether the inserter should be opened (true) or closed (false).
389
380
  */
390
- export function setIsInserterOpened(value) {
391
- return {
392
- type: 'SET_IS_INSERTER_OPENED',
393
- value
394
- };
395
- }
381
+ export const setIsInserterOpened = value => ({
382
+ registry
383
+ }) => {
384
+ deprecated("dispatch( 'core/edit-post' ).setIsInserterOpened", {
385
+ since: '6.5',
386
+ alternative: "dispatch( 'core/editor').setIsInserterOpened"
387
+ });
388
+ registry.dispatch(editorStore).setIsInserterOpened(value);
389
+ };
396
390
 
397
391
  /**
398
392
  * Returns an action object used to open/close the list view.
399
393
  *
394
+ * @deprecated
395
+ *
400
396
  * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.
401
- * @return {Object} Action object.
402
397
  */
403
398
  export const setIsListViewOpened = isOpen => ({
404
- dispatch,
405
399
  registry
406
400
  }) => {
407
- const isDistractionFree = registry.select(preferencesStore).get('core/edit-post', 'distractionFree');
408
- if (isDistractionFree && isOpen) {
409
- dispatch.toggleDistractionFree();
410
- }
411
- dispatch({
412
- type: 'SET_IS_LIST_VIEW_OPENED',
413
- isOpen
401
+ deprecated("dispatch( 'core/edit-post' ).setIsListViewOpened", {
402
+ since: '6.5',
403
+ alternative: "dispatch( 'core/editor').setIsListViewOpened"
414
404
  });
405
+ registry.dispatch(editorStore).setIsListViewOpened(isOpen);
415
406
  };
416
407
 
417
408
  /**
418
409
  * Returns an action object used to switch to template editing.
419
410
  *
420
- * @param {boolean} value Is editing template.
421
- * @return {Object} Action object.
411
+ * @deprecated
422
412
  */
423
- export function setIsEditingTemplate(value) {
413
+ export function setIsEditingTemplate() {
414
+ deprecated("dispatch( 'core/edit-post' ).setIsEditingTemplate", {
415
+ since: '6.5',
416
+ alternative: "dispatch( 'core/editor').setRenderingMode"
417
+ });
424
418
  return {
425
- type: 'SET_IS_EDITING_TEMPLATE',
426
- value
419
+ type: 'NOTHING'
427
420
  };
428
421
  }
429
422
 
430
423
  /**
431
424
  * Switches to the template mode.
432
- *
433
- * @param {boolean} newTemplate Is new template.
434
425
  */
435
- export const __unstableSwitchToTemplateMode = (newTemplate = false) => ({
436
- registry,
437
- select,
438
- dispatch
426
+ export const __unstableSwitchToTemplateMode = () => ({
427
+ registry
439
428
  }) => {
440
- dispatch(setIsEditingTemplate(true));
441
- const isWelcomeGuideActive = select.isFeatureActive('welcomeGuideTemplate');
442
- if (!isWelcomeGuideActive) {
443
- const message = newTemplate ? __("Custom template created. You're in template mode now.") : __('Editing template. Changes made here affect all posts and pages that use the template.');
444
- registry.dispatch(noticesStore).createSuccessNotice(message, {
445
- type: 'snackbar'
446
- });
447
- }
429
+ registry.dispatch(editorStore).setRenderingMode('template-only');
448
430
  };
449
431
 
450
432
  /**
451
433
  * Create a block based template.
452
434
  *
453
- * @param {Object?} template Template to create and assign.
435
+ * @deprecated
454
436
  */
455
- export const __unstableCreateTemplate = template => async ({
456
- registry
457
- }) => {
458
- const savedTemplate = await registry.dispatch(coreStore).saveEntityRecord('postType', 'wp_template', template);
459
- const post = registry.select(editorStore).getCurrentPost();
460
- registry.dispatch(coreStore).editEntityRecord('postType', post.type, post.id, {
461
- template: savedTemplate.slug
437
+ export function __unstableCreateTemplate() {
438
+ deprecated("dispatch( 'core/edit-post' ).__unstableCreateTemplate", {
439
+ since: '6.5'
462
440
  });
463
- };
441
+ return {
442
+ type: 'NOTHING'
443
+ };
444
+ }
464
445
  let metaBoxesInitialized = false;
465
446
 
466
447
  /**
@@ -509,17 +490,17 @@ export const toggleDistractionFree = () => ({
509
490
  dispatch,
510
491
  registry
511
492
  }) => {
512
- const isDistractionFree = registry.select(preferencesStore).get('core/edit-post', 'distractionFree');
493
+ const isDistractionFree = registry.select(preferencesStore).get('core', 'distractionFree');
513
494
  if (!isDistractionFree) {
514
495
  registry.batch(() => {
515
- registry.dispatch(preferencesStore).set('core/edit-post', 'fixedToolbar', true);
516
- dispatch.setIsInserterOpened(false);
517
- dispatch.setIsListViewOpened(false);
496
+ registry.dispatch(preferencesStore).set('core', 'fixedToolbar', true);
497
+ registry.dispatch(editorStore).setIsInserterOpened(false);
498
+ registry.dispatch(editorStore).setIsListViewOpened(false);
518
499
  dispatch.closeGeneralSidebar();
519
500
  });
520
501
  }
521
502
  registry.batch(() => {
522
- registry.dispatch(preferencesStore).set('core/edit-post', 'distractionFree', !isDistractionFree);
503
+ registry.dispatch(preferencesStore).set('core', 'distractionFree', !isDistractionFree);
523
504
  registry.dispatch(noticesStore).createInfoNotice(isDistractionFree ? __('Distraction free off.') : __('Distraction free on.'), {
524
505
  id: 'core/edit-post/distraction-free-mode/notice',
525
506
  type: 'snackbar'
@@ -1 +1 @@
1
- {"version":3,"names":["__","apiFetch","store","interfaceStore","preferencesStore","speak","noticesStore","coreStore","blockEditorStore","editorStore","deprecated","addFilter","getMetaBoxContainer","editPostStore","openGeneralSidebar","name","dispatch","registry","isDistractionFree","select","get","toggleDistractionFree","enableComplementaryArea","closeGeneralSidebar","disableComplementaryArea","openModal","since","alternative","closeModal","openPublishSidebar","type","closePublishSidebar","togglePublishSidebar","toggleEditorPanelEnabled","panelName","_registry$select$get","inactivePanels","isPanelInactive","includes","updatedInactivePanels","filter","invactivePanelName","set","toggleEditorPanelOpened","_registry$select$get2","openPanels","isPanelOpen","updatedOpenPanels","openPanelName","removeEditorPanel","toggleFeature","feature","toggle","switchEditorMode","mode","clearSelectedBlock","message","togglePinnedPluginItem","pluginName","isPinned","isItemPinned","updatePreferredStyleVariations","blockName","blockStyle","_registry$select$get3","existingVariations","updatedVariations","showBlockTypes","blockNames","_registry$select$get4","existingBlockNames","newBlockNames","Array","isArray","hideBlockTypes","_registry$select$get5","mergedBlockNames","Set","setAvailableMetaBoxesPerLocation","metaBoxesPerLocation","requestMetaBoxUpdates","window","tinyMCE","triggerSave","post","getCurrentPost","additionalData","comment_status","ping_status","sticky","author","Boolean","baseFormData","FormData","document","querySelector","activeMetaBoxLocations","getActiveMetaBoxLocations","formDataToMerge","map","location","formData","reduce","memo","currentFormData","key","value","append","forEach","url","_wpMetaBoxUrl","method","body","parse","metaBoxUpdatesSuccess","metaBoxUpdatesFailure","__experimentalSetPreviewDeviceType","deviceType","setIsInserterOpened","setIsListViewOpened","isOpen","setIsEditingTemplate","__unstableSwitchToTemplateMode","newTemplate","isWelcomeGuideActive","isFeatureActive","createSuccessNotice","__unstableCreateTemplate","template","savedTemplate","saveEntityRecord","editEntityRecord","id","slug","metaBoxesInitialized","initializeMetaBoxes","isEditorReady","__unstableIsEditorReady","postType","getCurrentPostType","postboxes","page","add_postbox_toggles","previous","options","then","isAutosave","hasMetaBoxes","batch","createInfoNotice"],"sources":["@wordpress/edit-post/src/store/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport apiFetch from '@wordpress/api-fetch';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { speak } from '@wordpress/a11y';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport deprecated from '@wordpress/deprecated';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { getMetaBoxContainer } from '../utils/meta-boxes';\nimport { store as editPostStore } from '.';\n\n/**\n * Returns an action object used in signalling that the user opened an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-post', 'distractionFree' );\n\t\tif ( isDistractionFree ) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( editPostStore.name, name );\n\t};\n\n/**\n * Returns an action object signalling that the user closed 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( editPostStore.name );\n\n/**\n * Returns an action object used in signalling that the user opened a modal.\n *\n * @deprecated since WP 6.3 use `core/interface` store's action with the same name instead.\n *\n *\n * @param {string} name A string that uniquely identifies the modal.\n *\n * @return {Object} Action object.\n */\nexport const openModal =\n\t( name ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"select( 'core/edit-post' ).openModal( name )\", {\n\t\t\tsince: '6.3',\n\t\t\talternative: \"select( 'core/interface').openModal( name )\",\n\t\t} );\n\t\treturn registry.dispatch( interfaceStore ).openModal( name );\n\t};\n\n/**\n * Returns an action object signalling that the user closed a modal.\n *\n * @deprecated since WP 6.3 use `core/interface` store's action with the same name instead.\n *\n * @return {Object} Action object.\n */\nexport const closeModal =\n\t() =>\n\t( { registry } ) => {\n\t\tdeprecated( \"select( 'core/edit-post' ).closeModal()\", {\n\t\t\tsince: '6.3',\n\t\t\talternative: \"select( 'core/interface').closeModal()\",\n\t\t} );\n\t\treturn registry.dispatch( interfaceStore ).closeModal();\n\t};\n\n/**\n * Returns an action object used in signalling that the user opened the publish\n * sidebar.\n *\n * @return {Object} Action object\n */\nexport function openPublishSidebar() {\n\treturn {\n\t\ttype: 'OPEN_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user closed the\n * publish sidebar.\n *\n * @return {Object} Action object.\n */\nexport function closePublishSidebar() {\n\treturn {\n\t\ttype: 'CLOSE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user toggles the publish sidebar.\n *\n * @return {Object} Action object\n */\nexport function togglePublishSidebar() {\n\treturn {\n\t\ttype: 'TOGGLE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used to enable or disable a panel in the editor.\n *\n * @param {string} panelName A string that identifies the panel to enable or disable.\n *\n * @return {Object} Action object.\n */\nexport const toggleEditorPanelEnabled =\n\t( panelName ) =>\n\t( { registry } ) => {\n\t\tconst inactivePanels =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-post', 'inactivePanels' ) ?? [];\n\n\t\tconst isPanelInactive = !! inactivePanels?.includes( panelName );\n\n\t\t// If the panel is inactive, remove it to enable it, else add it to\n\t\t// make it inactive.\n\t\tlet updatedInactivePanels;\n\t\tif ( isPanelInactive ) {\n\t\t\tupdatedInactivePanels = inactivePanels.filter(\n\t\t\t\t( invactivePanelName ) => invactivePanelName !== panelName\n\t\t\t);\n\t\t} else {\n\t\t\tupdatedInactivePanels = [ ...inactivePanels, panelName ];\n\t\t}\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core/edit-post', 'inactivePanels', updatedInactivePanels );\n\t};\n\n/**\n * Opens a closed panel and closes an open panel.\n *\n * @param {string} panelName A string that identifies the panel to open or close.\n */\nexport const toggleEditorPanelOpened =\n\t( panelName ) =>\n\t( { registry } ) => {\n\t\tconst openPanels =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-post', 'openPanels' ) ?? [];\n\n\t\tconst isPanelOpen = !! openPanels?.includes( panelName );\n\n\t\t// If the panel is open, remove it to close it, else add it to\n\t\t// make it open.\n\t\tlet updatedOpenPanels;\n\t\tif ( isPanelOpen ) {\n\t\t\tupdatedOpenPanels = openPanels.filter(\n\t\t\t\t( openPanelName ) => openPanelName !== panelName\n\t\t\t);\n\t\t} else {\n\t\t\tupdatedOpenPanels = [ ...openPanels, panelName ];\n\t\t}\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core/edit-post', 'openPanels', updatedOpenPanels );\n\t};\n\n/**\n * Returns an action object used to remove a panel from the editor.\n *\n * @param {string} panelName A string that identifies the panel to remove.\n *\n * @return {Object} Action object.\n */\nexport function removeEditorPanel( panelName ) {\n\treturn {\n\t\ttype: 'REMOVE_PANEL',\n\t\tpanelName,\n\t};\n}\n\n/**\n * Triggers an action used to toggle a feature flag.\n *\n * @param {string} feature Feature name.\n */\nexport const toggleFeature =\n\t( feature ) =>\n\t( { registry } ) =>\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-post', feature );\n\n/**\n * Triggers an action used to switch editor mode.\n *\n * @param {string} mode The editor mode.\n */\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { dispatch, registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core/edit-post', 'editorMode', mode );\n\n\t\t// Unselect blocks when we switch to the code editor.\n\t\tif ( mode !== 'visual' ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\n\t\tif (\n\t\t\tmode === 'text' &&\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-post', 'distractionFree' )\n\t\t) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\n\n\t\tconst message =\n\t\t\tmode === 'visual'\n\t\t\t\t? __( 'Visual editor selected' )\n\t\t\t\t: __( 'Code editor selected' );\n\t\tspeak( message, 'assertive' );\n\t};\n\n/**\n * Triggers an action object used to toggle a plugin name flag.\n *\n * @param {string} pluginName Plugin name.\n */\nexport const togglePinnedPluginItem =\n\t( pluginName ) =>\n\t( { registry } ) => {\n\t\tconst isPinned = registry\n\t\t\t.select( interfaceStore )\n\t\t\t.isItemPinned( 'core/edit-post', pluginName );\n\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t[ isPinned ? 'unpinItem' : 'pinItem' ](\n\t\t\t\t'core/edit-post',\n\t\t\t\tpluginName\n\t\t\t);\n\t};\n\n/**\n * Returns an action object used in signaling that a style should be auto-applied when a block is created.\n *\n * @param {string} blockName Name of the block.\n * @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the \"auto apply\" setting of the block is removed.\n */\nexport const updatePreferredStyleVariations =\n\t( blockName, blockStyle ) =>\n\t( { registry } ) => {\n\t\tif ( ! blockName ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst existingVariations =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-post', 'preferredStyleVariations' ) ?? {};\n\n\t\t// When the blockStyle is omitted, remove the block's preferred variation.\n\t\tif ( ! blockStyle ) {\n\t\t\tconst updatedVariations = {\n\t\t\t\t...existingVariations,\n\t\t\t};\n\n\t\t\tdelete updatedVariations[ blockName ];\n\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations',\n\t\t\t\t\tupdatedVariations\n\t\t\t\t);\n\t\t} else {\n\t\t\t// Else add the variation.\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set( 'core/edit-post', 'preferredStyleVariations', {\n\t\t\t\t\t...existingVariations,\n\t\t\t\t\t[ blockName ]: blockStyle,\n\t\t\t\t} );\n\t\t}\n\t};\n\n/**\n * Update the provided block types to be visible.\n *\n * @param {string[]} blockNames Names of block types to show.\n */\nexport const showBlockTypes =\n\t( blockNames ) =>\n\t( { registry } ) => {\n\t\tconst existingBlockNames =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-post', 'hiddenBlockTypes' ) ?? [];\n\n\t\tconst newBlockNames = existingBlockNames.filter(\n\t\t\t( type ) =>\n\t\t\t\t! (\n\t\t\t\t\tArray.isArray( blockNames ) ? blockNames : [ blockNames ]\n\t\t\t\t).includes( type )\n\t\t);\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core/edit-post', 'hiddenBlockTypes', newBlockNames );\n\t};\n\n/**\n * Update the provided block types to be hidden.\n *\n * @param {string[]} blockNames Names of block types to hide.\n */\nexport const hideBlockTypes =\n\t( blockNames ) =>\n\t( { registry } ) => {\n\t\tconst existingBlockNames =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-post', 'hiddenBlockTypes' ) ?? [];\n\n\t\tconst mergedBlockNames = new Set( [\n\t\t\t...existingBlockNames,\n\t\t\t...( Array.isArray( blockNames ) ? blockNames : [ blockNames ] ),\n\t\t] );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core/edit-post', 'hiddenBlockTypes', [\n\t\t\t\t...mergedBlockNames,\n\t\t\t] );\n\t};\n\n/**\n * Stores info about which Meta boxes are available in which location.\n *\n * @param {Object} metaBoxesPerLocation Meta boxes per location.\n */\nexport function setAvailableMetaBoxesPerLocation( metaBoxesPerLocation ) {\n\treturn {\n\t\ttype: 'SET_META_BOXES_PER_LOCATIONS',\n\t\tmetaBoxesPerLocation,\n\t};\n}\n\n/**\n * Update a metabox.\n */\nexport const requestMetaBoxUpdates =\n\t() =>\n\tasync ( { registry, select, dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'REQUEST_META_BOX_UPDATES',\n\t\t} );\n\n\t\t// Saves the wp_editor fields.\n\t\tif ( window.tinyMCE ) {\n\t\t\twindow.tinyMCE.triggerSave();\n\t\t}\n\n\t\t// Additional data needed for backward compatibility.\n\t\t// If we do not provide this data, the post will be overridden with the default values.\n\t\tconst post = registry.select( editorStore ).getCurrentPost();\n\t\tconst additionalData = [\n\t\t\tpost.comment_status\n\t\t\t\t? [ 'comment_status', post.comment_status ]\n\t\t\t\t: false,\n\t\t\tpost.ping_status ? [ 'ping_status', post.ping_status ] : false,\n\t\t\tpost.sticky ? [ 'sticky', post.sticky ] : false,\n\t\t\tpost.author ? [ 'post_author', post.author ] : false,\n\t\t].filter( Boolean );\n\n\t\t// We gather all the metaboxes locations data and the base form data.\n\t\tconst baseFormData = new window.FormData(\n\t\t\tdocument.querySelector( '.metabox-base-form' )\n\t\t);\n\t\tconst activeMetaBoxLocations = select.getActiveMetaBoxLocations();\n\t\tconst formDataToMerge = [\n\t\t\tbaseFormData,\n\t\t\t...activeMetaBoxLocations.map(\n\t\t\t\t( location ) =>\n\t\t\t\t\tnew window.FormData( getMetaBoxContainer( location ) )\n\t\t\t),\n\t\t];\n\n\t\t// Merge all form data objects into a single one.\n\t\tconst formData = formDataToMerge.reduce( ( memo, currentFormData ) => {\n\t\t\tfor ( const [ key, value ] of currentFormData ) {\n\t\t\t\tmemo.append( key, value );\n\t\t\t}\n\t\t\treturn memo;\n\t\t}, new window.FormData() );\n\t\tadditionalData.forEach( ( [ key, value ] ) =>\n\t\t\tformData.append( key, value )\n\t\t);\n\n\t\ttry {\n\t\t\t// Save the metaboxes.\n\t\t\tawait apiFetch( {\n\t\t\t\turl: window._wpMetaBoxUrl,\n\t\t\t\tmethod: 'POST',\n\t\t\t\tbody: formData,\n\t\t\t\tparse: false,\n\t\t\t} );\n\t\t\tdispatch.metaBoxUpdatesSuccess();\n\t\t} catch {\n\t\t\tdispatch.metaBoxUpdatesFailure();\n\t\t}\n\t};\n\n/**\n * Returns an action object used to signal a successful meta box update.\n *\n * @return {Object} Action object.\n */\nexport function metaBoxUpdatesSuccess() {\n\treturn {\n\t\ttype: 'META_BOX_UPDATES_SUCCESS',\n\t};\n}\n\n/**\n * Returns an action object used to signal a failed meta box update.\n *\n * @return {Object} Action object.\n */\nexport function metaBoxUpdatesFailure() {\n\treturn {\n\t\ttype: 'META_BOX_UPDATES_FAILURE',\n\t};\n}\n\n/**\n * Returns an action object used to toggle 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 * Returns an action object used to open/close 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 open/close the list view.\n *\n * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.\n * @return {Object} Action object.\n */\nexport const setIsListViewOpened =\n\t( isOpen ) =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-post', 'distractionFree' );\n\t\tif ( isDistractionFree && isOpen ) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\t\tisOpen,\n\t\t} );\n\t};\n\n/**\n * Returns an action object used to switch to template editing.\n *\n * @param {boolean} value Is editing template.\n * @return {Object} Action object.\n */\nexport function setIsEditingTemplate( value ) {\n\treturn {\n\t\ttype: 'SET_IS_EDITING_TEMPLATE',\n\t\tvalue,\n\t};\n}\n\n/**\n * Switches to the template mode.\n *\n * @param {boolean} newTemplate Is new template.\n */\nexport const __unstableSwitchToTemplateMode =\n\t( newTemplate = false ) =>\n\t( { registry, select, dispatch } ) => {\n\t\tdispatch( setIsEditingTemplate( true ) );\n\t\tconst isWelcomeGuideActive = select.isFeatureActive(\n\t\t\t'welcomeGuideTemplate'\n\t\t);\n\t\tif ( ! isWelcomeGuideActive ) {\n\t\t\tconst message = newTemplate\n\t\t\t\t? __( \"Custom template created. You're in template mode now.\" )\n\t\t\t\t: __(\n\t\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t\t );\n\t\t\tregistry.dispatch( noticesStore ).createSuccessNotice( message, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t};\n\n/**\n * Create a block based template.\n *\n * @param {Object?} template Template to create and assign.\n */\nexport const __unstableCreateTemplate =\n\t( template ) =>\n\tasync ( { registry } ) => {\n\t\tconst savedTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\t\tconst post = registry.select( editorStore ).getCurrentPost();\n\t\tregistry\n\t\t\t.dispatch( coreStore )\n\t\t\t.editEntityRecord( 'postType', post.type, post.id, {\n\t\t\t\ttemplate: savedTemplate.slug,\n\t\t\t} );\n\t};\n\nlet metaBoxesInitialized = false;\n\n/**\n * Initializes WordPress `postboxes` script and the logic for saving meta boxes.\n */\nexport const initializeMetaBoxes =\n\t() =>\n\t( { registry, select, dispatch } ) => {\n\t\tconst isEditorReady = registry\n\t\t\t.select( editorStore )\n\t\t\t.__unstableIsEditorReady();\n\n\t\tif ( ! isEditorReady ) {\n\t\t\treturn;\n\t\t}\n\t\t// Only initialize once.\n\t\tif ( metaBoxesInitialized ) {\n\t\t\treturn;\n\t\t}\n\t\tconst postType = registry.select( editorStore ).getCurrentPostType();\n\t\tif ( window.postboxes.page !== postType ) {\n\t\t\twindow.postboxes.add_postbox_toggles( postType );\n\t\t}\n\n\t\tmetaBoxesInitialized = true;\n\n\t\t// Save metaboxes on save completion, except for autosaves.\n\t\taddFilter(\n\t\t\t'editor.__unstableSavePost',\n\t\t\t'core/edit-post/save-metaboxes',\n\t\t\t( previous, options ) =>\n\t\t\t\tprevious.then( () => {\n\t\t\t\t\tif ( options.isAutosave ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! select.hasMetaBoxes() ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn dispatch.requestMetaBoxUpdates();\n\t\t\t\t} )\n\t\t);\n\n\t\tdispatch( {\n\t\t\ttype: 'META_BOXES_INITIALIZED',\n\t\t} );\n\t};\n\n/**\n * Action that toggles Distraction free mode.\n * Distraction free mode expects there are no sidebars, as due to the\n * z-index values set, you can't close sidebars.\n */\nexport const toggleDistractionFree =\n\t() =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-post', 'distractionFree' );\n\t\tif ( ! isDistractionFree ) {\n\t\t\tregistry.batch( () => {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t\t.set( 'core/edit-post', 'fixedToolbar', true );\n\t\t\t\tdispatch.setIsInserterOpened( false );\n\t\t\t\tdispatch.setIsListViewOpened( false );\n\t\t\t\tdispatch.closeGeneralSidebar();\n\t\t\t} );\n\t\t}\n\t\tregistry.batch( () => {\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'distractionFree',\n\t\t\t\t\t! isDistractionFree\n\t\t\t\t);\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createInfoNotice(\n\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t? __( 'Distraction free off.' )\n\t\t\t\t\t\t: __( 'Distraction free on.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'core/edit-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AACgE,qBAAqB,CAAC,CAAC;EACxC,CAAE,CACJ,CAAC;EAEDhE,QAAQ,CAAE;IACTc,IAAI,EAAE;EACP,CAAE,CAAC;AACJ,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMT,qBAAqB,GACjCA,CAAA,KACA,CAAE;EAAEL,QAAQ;EAAEC;AAAS,CAAC,KAAM;EAC7B,MAAMC,iBAAiB,GAAGD,QAAQ,CAChCE,MAAM,CAAEf,gBAAiB,CAAC,CAC1BgB,GAAG,CAAE,gBAAgB,EAAE,iBAAkB,CAAC;EAC5C,IAAK,CAAEF,iBAAiB,EAAG;IAC1BD,QAAQ,CAACmI,KAAK,CAAE,MAAM;MACrBnI,QAAQ,CACND,QAAQ,CAAEZ,gBAAiB,CAAC,CAC5BsC,GAAG,CAAE,gBAAgB,EAAE,cAAc,EAAE,IAAK,CAAC;MAC/C1B,QAAQ,CAACsG,mBAAmB,CAAE,KAAM,CAAC;MACrCtG,QAAQ,CAACuG,mBAAmB,CAAE,KAAM,CAAC;MACrCvG,QAAQ,CAACO,mBAAmB,CAAC,CAAC;IAC/B,CAAE,CAAC;EACJ;EACAN,QAAQ,CAACmI,KAAK,CAAE,MAAM;IACrBnI,QAAQ,CACND,QAAQ,CAAEZ,gBAAiB,CAAC,CAC5BsC,GAAG,CACH,gBAAgB,EAChB,iBAAiB,EACjB,CAAExB,iBACH,CAAC;IACFD,QAAQ,CACND,QAAQ,CAAEV,YAAa,CAAC,CACxB+I,gBAAgB,CAChBnI,iBAAiB,GACdlB,EAAE,CAAE,uBAAwB,CAAC,GAC7BA,EAAE,CAAE,sBAAuB,CAAC,EAC/B;MACCoI,EAAE,EAAE,6CAA6C;MACjDtG,IAAI,EAAE;IACP,CACD,CAAC;EACH,CAAE,CAAC;AACJ,CAAC"}
1
+ {"version":3,"names":["__","apiFetch","store","interfaceStore","preferencesStore","speak","noticesStore","blockEditorStore","editorStore","deprecated","addFilter","getMetaBoxContainer","editPostStore","openGeneralSidebar","name","dispatch","registry","isDistractionFree","select","get","toggleDistractionFree","enableComplementaryArea","closeGeneralSidebar","disableComplementaryArea","openModal","since","alternative","closeModal","openPublishSidebar","type","closePublishSidebar","togglePublishSidebar","toggleEditorPanelEnabled","panelName","toggleEditorPanelOpened","removeEditorPanel","toggleFeature","feature","toggle","switchEditorMode","mode","set","clearSelectedBlock","message","togglePinnedPluginItem","pluginName","isPinned","isItemPinned","updatePreferredStyleVariations","blockName","blockStyle","_registry$select$get","existingVariations","updatedVariations","showBlockTypes","blockNames","_registry$select$get2","existingBlockNames","newBlockNames","filter","Array","isArray","includes","hideBlockTypes","_registry$select$get3","mergedBlockNames","Set","setAvailableMetaBoxesPerLocation","metaBoxesPerLocation","requestMetaBoxUpdates","window","tinyMCE","triggerSave","post","getCurrentPost","additionalData","comment_status","ping_status","sticky","author","Boolean","baseFormData","FormData","document","querySelector","activeMetaBoxLocations","getActiveMetaBoxLocations","formDataToMerge","map","location","formData","reduce","memo","currentFormData","key","value","append","forEach","url","_wpMetaBoxUrl","method","body","parse","metaBoxUpdatesSuccess","metaBoxUpdatesFailure","__experimentalSetPreviewDeviceType","deviceType","version","hint","setDeviceType","setIsInserterOpened","setIsListViewOpened","isOpen","setIsEditingTemplate","__unstableSwitchToTemplateMode","setRenderingMode","__unstableCreateTemplate","metaBoxesInitialized","initializeMetaBoxes","isEditorReady","__unstableIsEditorReady","postType","getCurrentPostType","postboxes","page","add_postbox_toggles","previous","options","then","isAutosave","hasMetaBoxes","batch","createInfoNotice","id"],"sources":["@wordpress/edit-post/src/store/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport apiFetch from '@wordpress/api-fetch';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { speak } from '@wordpress/a11y';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport deprecated from '@wordpress/deprecated';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { getMetaBoxContainer } from '../utils/meta-boxes';\nimport { store as editPostStore } from '.';\n\n/**\n * Returns an action object used in signalling that the user opened an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core', 'distractionFree' );\n\t\tif ( isDistractionFree ) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( editPostStore.name, name );\n\t};\n\n/**\n * Returns an action object signalling that the user closed 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( editPostStore.name );\n\n/**\n * Returns an action object used in signalling that the user opened a modal.\n *\n * @deprecated since WP 6.3 use `core/interface` store's action with the same name instead.\n *\n *\n * @param {string} name A string that uniquely identifies the modal.\n *\n * @return {Object} Action object.\n */\nexport const openModal =\n\t( name ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"select( 'core/edit-post' ).openModal( name )\", {\n\t\t\tsince: '6.3',\n\t\t\talternative: \"select( 'core/interface').openModal( name )\",\n\t\t} );\n\t\treturn registry.dispatch( interfaceStore ).openModal( name );\n\t};\n\n/**\n * Returns an action object signalling that the user closed a modal.\n *\n * @deprecated since WP 6.3 use `core/interface` store's action with the same name instead.\n *\n * @return {Object} Action object.\n */\nexport const closeModal =\n\t() =>\n\t( { registry } ) => {\n\t\tdeprecated( \"select( 'core/edit-post' ).closeModal()\", {\n\t\t\tsince: '6.3',\n\t\t\talternative: \"select( 'core/interface').closeModal()\",\n\t\t} );\n\t\treturn registry.dispatch( interfaceStore ).closeModal();\n\t};\n\n/**\n * Returns an action object used in signalling that the user opened the publish\n * sidebar.\n *\n * @return {Object} Action object\n */\nexport function openPublishSidebar() {\n\treturn {\n\t\ttype: 'OPEN_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user closed the\n * publish sidebar.\n *\n * @return {Object} Action object.\n */\nexport function closePublishSidebar() {\n\treturn {\n\t\ttype: 'CLOSE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user toggles the publish sidebar.\n *\n * @return {Object} Action object\n */\nexport function togglePublishSidebar() {\n\treturn {\n\t\ttype: 'TOGGLE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used to enable or disable a panel in the editor.\n *\n * @deprecated\n *\n * @param {string} panelName A string that identifies the panel to enable or disable.\n *\n * @return {Object} Action object.\n */\nexport const toggleEditorPanelEnabled =\n\t( panelName ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).toggleEditorPanelEnabled\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').toggleEditorPanelEnabled\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).toggleEditorPanelEnabled( panelName );\n\t};\n\n/**\n * Opens a closed panel and closes an open panel.\n *\n * @deprecated\n *\n * @param {string} panelName A string that identifies the panel to open or close.\n */\nexport const toggleEditorPanelOpened =\n\t( panelName ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).toggleEditorPanelOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').toggleEditorPanelOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).toggleEditorPanelOpened( panelName );\n\t};\n\n/**\n * Returns an action object used to remove a panel from the editor.\n *\n * @deprecated\n *\n * @param {string} panelName A string that identifies the panel to remove.\n *\n * @return {Object} Action object.\n */\nexport const removeEditorPanel =\n\t( panelName ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).removeEditorPanel\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').removeEditorPanel\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).removeEditorPanel( panelName );\n\t};\n\n/**\n * Triggers an action used to toggle a feature flag.\n *\n * @param {string} feature Feature name.\n */\nexport const toggleFeature =\n\t( feature ) =>\n\t( { registry } ) =>\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-post', feature );\n\n/**\n * Triggers an action used to switch editor mode.\n *\n * @param {string} mode The editor mode.\n */\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { dispatch, registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core/edit-post', 'editorMode', mode );\n\n\t\t// Unselect blocks when we switch to the code editor.\n\t\tif ( mode !== 'visual' ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\n\t\tif (\n\t\t\tmode === 'text' &&\n\t\t\tregistry.select( preferencesStore ).get( 'core', 'distractionFree' )\n\t\t) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\n\n\t\tconst message =\n\t\t\tmode === 'visual'\n\t\t\t\t? __( 'Visual editor selected' )\n\t\t\t\t: __( 'Code editor selected' );\n\t\tspeak( message, 'assertive' );\n\t};\n\n/**\n * Triggers an action object used to toggle a plugin name flag.\n *\n * @param {string} pluginName Plugin name.\n */\nexport const togglePinnedPluginItem =\n\t( pluginName ) =>\n\t( { registry } ) => {\n\t\tconst isPinned = registry\n\t\t\t.select( interfaceStore )\n\t\t\t.isItemPinned( 'core/edit-post', pluginName );\n\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t[ isPinned ? 'unpinItem' : 'pinItem' ](\n\t\t\t\t'core/edit-post',\n\t\t\t\tpluginName\n\t\t\t);\n\t};\n\n/**\n * Returns an action object used in signaling that a style should be auto-applied when a block is created.\n *\n * @param {string} blockName Name of the block.\n * @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the \"auto apply\" setting of the block is removed.\n */\nexport const updatePreferredStyleVariations =\n\t( blockName, blockStyle ) =>\n\t( { registry } ) => {\n\t\tif ( ! blockName ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst existingVariations =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-post', 'preferredStyleVariations' ) ?? {};\n\n\t\t// When the blockStyle is omitted, remove the block's preferred variation.\n\t\tif ( ! blockStyle ) {\n\t\t\tconst updatedVariations = {\n\t\t\t\t...existingVariations,\n\t\t\t};\n\n\t\t\tdelete updatedVariations[ blockName ];\n\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations',\n\t\t\t\t\tupdatedVariations\n\t\t\t\t);\n\t\t} else {\n\t\t\t// Else add the variation.\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set( 'core/edit-post', 'preferredStyleVariations', {\n\t\t\t\t\t...existingVariations,\n\t\t\t\t\t[ blockName ]: blockStyle,\n\t\t\t\t} );\n\t\t}\n\t};\n\n/**\n * Update the provided block types to be visible.\n *\n * @param {string[]} blockNames Names of block types to show.\n */\nexport const showBlockTypes =\n\t( blockNames ) =>\n\t( { registry } ) => {\n\t\tconst existingBlockNames =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-post', 'hiddenBlockTypes' ) ?? [];\n\n\t\tconst newBlockNames = existingBlockNames.filter(\n\t\t\t( type ) =>\n\t\t\t\t! (\n\t\t\t\t\tArray.isArray( blockNames ) ? blockNames : [ blockNames ]\n\t\t\t\t).includes( type )\n\t\t);\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core/edit-post', 'hiddenBlockTypes', newBlockNames );\n\t};\n\n/**\n * Update the provided block types to be hidden.\n *\n * @param {string[]} blockNames Names of block types to hide.\n */\nexport const hideBlockTypes =\n\t( blockNames ) =>\n\t( { registry } ) => {\n\t\tconst existingBlockNames =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-post', 'hiddenBlockTypes' ) ?? [];\n\n\t\tconst mergedBlockNames = new Set( [\n\t\t\t...existingBlockNames,\n\t\t\t...( Array.isArray( blockNames ) ? blockNames : [ blockNames ] ),\n\t\t] );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core/edit-post', 'hiddenBlockTypes', [\n\t\t\t\t...mergedBlockNames,\n\t\t\t] );\n\t};\n\n/**\n * Stores info about which Meta boxes are available in which location.\n *\n * @param {Object} metaBoxesPerLocation Meta boxes per location.\n */\nexport function setAvailableMetaBoxesPerLocation( metaBoxesPerLocation ) {\n\treturn {\n\t\ttype: 'SET_META_BOXES_PER_LOCATIONS',\n\t\tmetaBoxesPerLocation,\n\t};\n}\n\n/**\n * Update a metabox.\n */\nexport const requestMetaBoxUpdates =\n\t() =>\n\tasync ( { registry, select, dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'REQUEST_META_BOX_UPDATES',\n\t\t} );\n\n\t\t// Saves the wp_editor fields.\n\t\tif ( window.tinyMCE ) {\n\t\t\twindow.tinyMCE.triggerSave();\n\t\t}\n\n\t\t// Additional data needed for backward compatibility.\n\t\t// If we do not provide this data, the post will be overridden with the default values.\n\t\tconst post = registry.select( editorStore ).getCurrentPost();\n\t\tconst additionalData = [\n\t\t\tpost.comment_status\n\t\t\t\t? [ 'comment_status', post.comment_status ]\n\t\t\t\t: false,\n\t\t\tpost.ping_status ? [ 'ping_status', post.ping_status ] : false,\n\t\t\tpost.sticky ? [ 'sticky', post.sticky ] : false,\n\t\t\tpost.author ? [ 'post_author', post.author ] : false,\n\t\t].filter( Boolean );\n\n\t\t// We gather all the metaboxes locations data and the base form data.\n\t\tconst baseFormData = new window.FormData(\n\t\t\tdocument.querySelector( '.metabox-base-form' )\n\t\t);\n\t\tconst activeMetaBoxLocations = select.getActiveMetaBoxLocations();\n\t\tconst formDataToMerge = [\n\t\t\tbaseFormData,\n\t\t\t...activeMetaBoxLocations.map(\n\t\t\t\t( location ) =>\n\t\t\t\t\tnew window.FormData( getMetaBoxContainer( location ) )\n\t\t\t),\n\t\t];\n\n\t\t// Merge all form data objects into a single one.\n\t\tconst formData = formDataToMerge.reduce( ( memo, currentFormData ) => {\n\t\t\tfor ( const [ key, value ] of currentFormData ) {\n\t\t\t\tmemo.append( key, value );\n\t\t\t}\n\t\t\treturn memo;\n\t\t}, new window.FormData() );\n\t\tadditionalData.forEach( ( [ key, value ] ) =>\n\t\t\tformData.append( key, value )\n\t\t);\n\n\t\ttry {\n\t\t\t// Save the metaboxes.\n\t\t\tawait apiFetch( {\n\t\t\t\turl: window._wpMetaBoxUrl,\n\t\t\t\tmethod: 'POST',\n\t\t\t\tbody: formData,\n\t\t\t\tparse: false,\n\t\t\t} );\n\t\t\tdispatch.metaBoxUpdatesSuccess();\n\t\t} catch {\n\t\t\tdispatch.metaBoxUpdatesFailure();\n\t\t}\n\t};\n\n/**\n * Returns an action object used to signal a successful meta box update.\n *\n * @return {Object} Action object.\n */\nexport function metaBoxUpdatesSuccess() {\n\treturn {\n\t\ttype: 'META_BOX_UPDATES_SUCCESS',\n\t};\n}\n\n/**\n * Returns an action object used to signal a failed meta box update.\n *\n * @return {Object} Action object.\n */\nexport function metaBoxUpdatesFailure() {\n\treturn {\n\t\ttype: 'META_BOX_UPDATES_FAILURE',\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @deprecated\n *\n * @param {string} deviceType\n */\nexport const __experimentalSetPreviewDeviceType =\n\t( deviceType ) =>\n\t( { registry } ) => {\n\t\tdeprecated(\n\t\t\t\"dispatch( 'core/edit-post' ).__experimentalSetPreviewDeviceType\",\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\thint: 'registry.dispatch( editorStore ).setDeviceType',\n\t\t\t}\n\t\t);\n\t\tregistry.dispatch( editorStore ).setDeviceType( deviceType );\n\t};\n\n/**\n * Returns an action object used to open/close the inserter.\n *\n * @deprecated\n *\n * @param {boolean|Object} value Whether the inserter should be opened (true) or closed (false).\n */\nexport const setIsInserterOpened =\n\t( value ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).setIsInserterOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').setIsInserterOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).setIsInserterOpened( value );\n\t};\n\n/**\n * Returns an action object used to open/close the list view.\n *\n * @deprecated\n *\n * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.\n */\nexport const setIsListViewOpened =\n\t( isOpen ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).setIsListViewOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').setIsListViewOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).setIsListViewOpened( isOpen );\n\t};\n\n/**\n * Returns an action object used to switch to template editing.\n *\n * @deprecated\n */\nexport function setIsEditingTemplate() {\n\tdeprecated( \"dispatch( 'core/edit-post' ).setIsEditingTemplate\", {\n\t\tsince: '6.5',\n\t\talternative: \"dispatch( 'core/editor').setRenderingMode\",\n\t} );\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Switches to the template mode.\n */\nexport const __unstableSwitchToTemplateMode =\n\t() =>\n\t( { registry } ) => {\n\t\tregistry.dispatch( editorStore ).setRenderingMode( 'template-only' );\n\t};\n\n/**\n * Create a block based template.\n *\n * @deprecated\n */\nexport function __unstableCreateTemplate() {\n\tdeprecated( \"dispatch( 'core/edit-post' ).__unstableCreateTemplate\", {\n\t\tsince: '6.5',\n\t} );\n\treturn { type: 'NOTHING' };\n}\n\nlet metaBoxesInitialized = false;\n\n/**\n * Initializes WordPress `postboxes` script and the logic for saving meta boxes.\n */\nexport const initializeMetaBoxes =\n\t() =>\n\t( { registry, select, dispatch } ) => {\n\t\tconst isEditorReady = registry\n\t\t\t.select( editorStore )\n\t\t\t.__unstableIsEditorReady();\n\n\t\tif ( ! isEditorReady ) {\n\t\t\treturn;\n\t\t}\n\t\t// Only initialize once.\n\t\tif ( metaBoxesInitialized ) {\n\t\t\treturn;\n\t\t}\n\t\tconst postType = registry.select( editorStore ).getCurrentPostType();\n\t\tif ( window.postboxes.page !== postType ) {\n\t\t\twindow.postboxes.add_postbox_toggles( postType );\n\t\t}\n\n\t\tmetaBoxesInitialized = true;\n\n\t\t// Save metaboxes on save completion, except for autosaves.\n\t\taddFilter(\n\t\t\t'editor.__unstableSavePost',\n\t\t\t'core/edit-post/save-metaboxes',\n\t\t\t( previous, options ) =>\n\t\t\t\tprevious.then( () => {\n\t\t\t\t\tif ( options.isAutosave ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! select.hasMetaBoxes() ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn dispatch.requestMetaBoxUpdates();\n\t\t\t\t} )\n\t\t);\n\n\t\tdispatch( {\n\t\t\ttype: 'META_BOXES_INITIALIZED',\n\t\t} );\n\t};\n\n/**\n * Action that toggles Distraction free mode.\n * Distraction free mode expects there are no sidebars, as due to the\n * z-index values set, you can't close sidebars.\n */\nexport const toggleDistractionFree =\n\t() =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core', 'distractionFree' );\n\t\tif ( ! isDistractionFree ) {\n\t\t\tregistry.batch( () => {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t\t.set( 'core', 'fixedToolbar', true );\n\t\t\t\tregistry.dispatch( editorStore ).setIsInserterOpened( false );\n\t\t\t\tregistry.dispatch( editorStore ).setIsListViewOpened( false );\n\t\t\t\tdispatch.closeGeneralSidebar();\n\t\t\t} );\n\t\t}\n\t\tregistry.batch( () => {\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set( 'core', 'distractionFree', ! isDistractionFree );\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createInfoNotice(\n\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t? __( 'Distraction free off.' )\n\t\t\t\t\t\t: __( 'Distraction free on.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'core/edit-post/distraction-free-mode/notice',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t} );\n\t};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,OAAOC,QAAQ,MAAM,sBAAsB;AAC3C,SAASC,KAAK,IAAIC,cAAc,QAAQ,sBAAsB;AAC9D,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,wBAAwB;AAClE,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SAASH,KAAK,IAAII,YAAY,QAAQ,oBAAoB;AAC1D,SAASJ,KAAK,IAAIK,gBAAgB,QAAQ,yBAAyB;AACnE,SAASL,KAAK,IAAIM,WAAW,QAAQ,mBAAmB;AACxD,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,SAAS,QAAQ,kBAAkB;;AAE5C;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,qBAAqB;AACzD,SAAST,KAAK,IAAIU,aAAa,QAAQ,GAAG;;AAE1C;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,GAC5BC,IAAI,IACN,CAAE;EAAEC,QAAQ;EAAEC;AAAS,CAAC,KAAM;EAC7B,MAAMC,iBAAiB,GAAGD,QAAQ,CAChCE,MAAM,CAAEd,gBAAiB,CAAC,CAC1Be,GAAG,CAAE,MAAM,EAAE,iBAAkB,CAAC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CAAC,CAC5BqC,GAAG,CAAE,MAAM,EAAE,iBAAiB,EAAE,CAAExB,iBAAkB,CAAC;IACvDD,QAAQ,CACND,QAAQ,CAAET,YAAa,CAAC,CACxB8H,gBAAgB,CAChBnH,iBAAiB,GACdjB,EAAE,CAAE,uBAAwB,CAAC,GAC7BA,EAAE,CAAE,sBAAuB,CAAC,EAC/B;MACCqI,EAAE,EAAE,6CAA6C;MACjDxG,IAAI,EAAE;IACP,CACD,CAAC;EACH,CAAE,CAAC;AACJ,CAAC"}
@@ -2,24 +2,6 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { combineReducers } from '@wordpress/data';
5
-
6
- /**
7
- * Reducer storing the list of all programmatically removed panels.
8
- *
9
- * @param {Array} state Current state.
10
- * @param {Object} action Action object.
11
- *
12
- * @return {Array} Updated state.
13
- */
14
- export function removedPanels(state = [], action) {
15
- switch (action.type) {
16
- case 'REMOVE_PANEL':
17
- if (!state.includes(action.panelName)) {
18
- return [...state, action.panelName];
19
- }
20
- }
21
- return state;
22
- }
23
5
  export function publishSidebarActive(state = false, action) {
24
6
  switch (action.type) {
25
7
  case 'OPEN_PUBLISH_SIDEBAR':
@@ -90,74 +72,6 @@ export function metaBoxLocations(state = {}, action) {
90
72
  return state;
91
73
  }
92
74
 
93
- /**
94
- * Reducer returning the editing canvas device type.
95
- *
96
- * @param {Object} state Current state.
97
- * @param {Object} action Dispatched action.
98
- *
99
- * @return {Object} Updated state.
100
- */
101
- export function deviceType(state = 'Desktop', action) {
102
- switch (action.type) {
103
- case 'SET_PREVIEW_DEVICE_TYPE':
104
- return action.deviceType;
105
- }
106
- return state;
107
- }
108
-
109
- /**
110
- * Reducer to set the block inserter panel open or closed.
111
- *
112
- * Note: this reducer interacts with the list view panel reducer
113
- * to make sure that only one of the two panels is open at the same time.
114
- *
115
- * @param {Object} state Current state.
116
- * @param {Object} action Dispatched action.
117
- */
118
- export function blockInserterPanel(state = false, action) {
119
- switch (action.type) {
120
- case 'SET_IS_LIST_VIEW_OPENED':
121
- return action.isOpen ? false : state;
122
- case 'SET_IS_INSERTER_OPENED':
123
- return action.value;
124
- }
125
- return state;
126
- }
127
-
128
- /**
129
- * Reducer to set the list view panel open or closed.
130
- *
131
- * Note: this reducer interacts with the inserter panel reducer
132
- * to make sure that only one of the two panels is open at the same time.
133
- *
134
- * @param {Object} state Current state.
135
- * @param {Object} action Dispatched action.
136
- */
137
- export function listViewPanel(state = false, action) {
138
- switch (action.type) {
139
- case 'SET_IS_INSERTER_OPENED':
140
- return action.value ? false : state;
141
- case 'SET_IS_LIST_VIEW_OPENED':
142
- return action.isOpen;
143
- }
144
- return state;
145
- }
146
-
147
- /**
148
- * Reducer tracking whether template editing is on or off.
149
- *
150
- * @param {boolean} state
151
- * @param {Object} action
152
- */
153
- function isEditingTemplate(state = false, action) {
154
- switch (action.type) {
155
- case 'SET_IS_EDITING_TEMPLATE':
156
- return action.value;
157
- }
158
- return state;
159
- }
160
-
161
75
  /**
162
76
  * Reducer tracking whether meta boxes are initialized.
163
77
  *
@@ -180,11 +94,6 @@ const metaBoxes = combineReducers({
180
94
  });
181
95
  export default combineReducers({
182
96
  metaBoxes,
183
- publishSidebarActive,
184
- removedPanels,
185
- deviceType,
186
- blockInserterPanel,
187
- listViewPanel,
188
- isEditingTemplate
97
+ publishSidebarActive
189
98
  });
190
99
  //# sourceMappingURL=reducer.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["combineReducers","removedPanels","state","action","type","includes","panelName","publishSidebarActive","isSavingMetaBoxes","mergeMetaboxes","metaboxes","newMetaboxes","mergedMetaboxes","metabox","existing","findIndex","box","id","push","metaBoxLocations","newState","location","Object","entries","metaBoxesPerLocation","deviceType","blockInserterPanel","isOpen","value","listViewPanel","isEditingTemplate","metaBoxesInitialized","metaBoxes","isSaving","locations","initialized"],"sources":["@wordpress/edit-post/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer storing the list of all programmatically removed panels.\n *\n * @param {Array} state Current state.\n * @param {Object} action Action object.\n *\n * @return {Array} Updated state.\n */\nexport function removedPanels( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REMOVE_PANEL':\n\t\t\tif ( ! state.includes( action.panelName ) ) {\n\t\t\t\treturn [ ...state, action.panelName ];\n\t\t\t}\n\t}\n\n\treturn state;\n}\n\nexport function publishSidebarActive( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_PUBLISH_SIDEBAR':\n\t\t\treturn true;\n\t\tcase 'CLOSE_PUBLISH_SIDEBAR':\n\t\t\treturn false;\n\t\tcase 'TOGGLE_PUBLISH_SIDEBAR':\n\t\t\treturn ! state;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the meta boxes isSaving state.\n * A \"true\" value means the meta boxes saving request is in-flight.\n *\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action Object.\n *\n * @return {Object} Updated state.\n */\nexport function isSavingMetaBoxes( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REQUEST_META_BOX_UPDATES':\n\t\t\treturn true;\n\t\tcase 'META_BOX_UPDATES_SUCCESS':\n\t\tcase 'META_BOX_UPDATES_FAILURE':\n\t\t\treturn false;\n\t\tdefault:\n\t\t\treturn state;\n\t}\n}\n\nfunction mergeMetaboxes( metaboxes = [], newMetaboxes ) {\n\tconst mergedMetaboxes = [ ...metaboxes ];\n\tfor ( const metabox of newMetaboxes ) {\n\t\tconst existing = mergedMetaboxes.findIndex(\n\t\t\t( box ) => box.id === metabox.id\n\t\t);\n\t\tif ( existing !== -1 ) {\n\t\t\tmergedMetaboxes[ existing ] = metabox;\n\t\t} else {\n\t\t\tmergedMetaboxes.push( metabox );\n\t\t}\n\t}\n\treturn mergedMetaboxes;\n}\n\n/**\n * Reducer keeping track of the meta boxes per location.\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action Object.\n *\n * @return {Object} Updated state.\n */\nexport function metaBoxLocations( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_META_BOXES_PER_LOCATIONS': {\n\t\t\tconst newState = { ...state };\n\t\t\tfor ( const [ location, metaboxes ] of Object.entries(\n\t\t\t\taction.metaBoxesPerLocation\n\t\t\t) ) {\n\t\t\t\tnewState[ location ] = mergeMetaboxes(\n\t\t\t\t\tnewState[ location ],\n\t\t\t\t\tmetaboxes\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn newState;\n\t\t}\n\t}\n\n\treturn state;\n}\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 to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the list view panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\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 inserter panel reducer\n * to make sure that only one of the two 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 '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 tracking whether template editing is on or off.\n *\n * @param {boolean} state\n * @param {Object} action\n */\nfunction isEditingTemplate( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_EDITING_TEMPLATE':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer tracking whether meta boxes are initialized.\n *\n * @param {boolean} state\n * @param {Object} action\n *\n * @return {boolean} Updated state.\n */\nfunction metaBoxesInitialized( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'META_BOXES_INITIALIZED':\n\t\t\treturn true;\n\t}\n\treturn state;\n}\n\nconst metaBoxes = combineReducers( {\n\tisSaving: isSavingMetaBoxes,\n\tlocations: metaBoxLocations,\n\tinitialized: metaBoxesInitialized,\n} );\n\nexport default combineReducers( {\n\tmetaBoxes,\n\tpublishSidebarActive,\n\tremovedPanels,\n\tdeviceType,\n\tblockInserterPanel,\n\tlistViewPanel,\n\tisEditingTemplate,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,iBAAiB;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAAEC,KAAK,GAAG,EAAE,EAAEC,MAAM,EAAG;EACnD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,cAAc;MAClB,IAAK,CAAEF,KAAK,CAACG,QAAQ,CAAEF,MAAM,CAACG,SAAU,CAAC,EAAG;QAC3C,OAAO,CAAE,GAAGJ,KAAK,EAAEC,MAAM,CAACG,SAAS,CAAE;MACtC;EACF;EAEA,OAAOJ,KAAK;AACb;AAEA,OAAO,SAASK,oBAAoBA,CAAEL,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;EAC7D,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,sBAAsB;MAC1B,OAAO,IAAI;IACZ,KAAK,uBAAuB;MAC3B,OAAO,KAAK;IACb,KAAK,wBAAwB;MAC5B,OAAO,CAAEF,KAAK;EAChB;EACA,OAAOA,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SA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AAK;AACb;AAEA,MAAM8B,SAAS,GAAGhC,eAAe,CAAE;EAClCiC,QAAQ,EAAEzB,iBAAiB;EAC3B0B,SAAS,EAAEf,gBAAgB;EAC3BgB,WAAW,EAAEJ;AACd,CAAE,CAAC;AAEH,eAAe/B,eAAe,CAAE;EAC/BgC,SAAS;EACTzB,oBAAoB;EACpBN,aAAa;EACbwB,UAAU;EACVC,kBAAkB;EAClBG,aAAa;EACbC;AACD,CAAE,CAAC"}
1
+ {"version":3,"names":["combineReducers","publishSidebarActive","state","action","type","isSavingMetaBoxes","mergeMetaboxes","metaboxes","newMetaboxes","mergedMetaboxes","metabox","existing","findIndex","box","id","push","metaBoxLocations","newState","location","Object","entries","metaBoxesPerLocation","metaBoxesInitialized","metaBoxes","isSaving","locations","initialized"],"sources":["@wordpress/edit-post/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\nexport function publishSidebarActive( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_PUBLISH_SIDEBAR':\n\t\t\treturn true;\n\t\tcase 'CLOSE_PUBLISH_SIDEBAR':\n\t\t\treturn false;\n\t\tcase 'TOGGLE_PUBLISH_SIDEBAR':\n\t\t\treturn ! state;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the meta boxes isSaving state.\n * A \"true\" value means the meta boxes saving request is in-flight.\n *\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action Object.\n *\n * @return {Object} Updated state.\n */\nexport function isSavingMetaBoxes( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REQUEST_META_BOX_UPDATES':\n\t\t\treturn true;\n\t\tcase 'META_BOX_UPDATES_SUCCESS':\n\t\tcase 'META_BOX_UPDATES_FAILURE':\n\t\t\treturn false;\n\t\tdefault:\n\t\t\treturn state;\n\t}\n}\n\nfunction mergeMetaboxes( metaboxes = [], newMetaboxes ) {\n\tconst mergedMetaboxes = [ ...metaboxes ];\n\tfor ( const metabox of newMetaboxes ) {\n\t\tconst existing = mergedMetaboxes.findIndex(\n\t\t\t( box ) => box.id === metabox.id\n\t\t);\n\t\tif ( existing !== -1 ) {\n\t\t\tmergedMetaboxes[ existing ] = metabox;\n\t\t} else {\n\t\t\tmergedMetaboxes.push( metabox );\n\t\t}\n\t}\n\treturn mergedMetaboxes;\n}\n\n/**\n * Reducer keeping track of the meta boxes per location.\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action Object.\n *\n * @return {Object} Updated state.\n */\nexport function metaBoxLocations( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_META_BOXES_PER_LOCATIONS': {\n\t\t\tconst newState = { ...state };\n\t\t\tfor ( const [ location, metaboxes ] of Object.entries(\n\t\t\t\taction.metaBoxesPerLocation\n\t\t\t) ) {\n\t\t\t\tnewState[ location ] = mergeMetaboxes(\n\t\t\t\t\tnewState[ location ],\n\t\t\t\t\tmetaboxes\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn newState;\n\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer tracking whether meta boxes are initialized.\n *\n * @param {boolean} state\n * @param {Object} action\n *\n * @return {boolean} Updated state.\n */\nfunction metaBoxesInitialized( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'META_BOXES_INITIALIZED':\n\t\t\treturn true;\n\t}\n\treturn state;\n}\n\nconst metaBoxes = combineReducers( {\n\tisSaving: isSavingMetaBoxes,\n\tlocations: metaBoxLocations,\n\tinitialized: metaBoxesInitialized,\n} );\n\nexport default combineReducers( {\n\tmetaBoxes,\n\tpublishSidebarActive,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,iBAAiB;AAEjD,OAAO,SAASC,oBAAoBA,CAAEC,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;EAC7D,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,sBAAsB;MAC1B,OAAO,IAAI;IACZ,KAAK,uBAAuB;MAC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