@wordpress/edit-post 6.0.1 → 6.1.0-next.e230fbab09.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 (171) hide show
  1. package/build/components/block-manager/category.js +2 -2
  2. package/build/components/block-manager/category.js.map +1 -1
  3. package/build/components/block-manager/index.js +2 -2
  4. package/build/components/block-manager/index.js.map +1 -1
  5. package/build/components/header/fullscreen-mode-close/index.js +11 -4
  6. package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
  7. package/build/components/header/header-toolbar/index.js +1 -1
  8. package/build/components/header/header-toolbar/index.js.map +1 -1
  9. package/build/components/header/header-toolbar/index.native.js +1 -1
  10. package/build/components/header/header-toolbar/index.native.js.map +1 -1
  11. package/build/components/header/index.js +3 -1
  12. package/build/components/header/index.js.map +1 -1
  13. package/build/components/header/more-menu/index.js +0 -6
  14. package/build/components/header/more-menu/index.js.map +1 -1
  15. package/build/components/header/template-title/delete-template.js +29 -20
  16. package/build/components/header/template-title/delete-template.js.map +1 -1
  17. package/build/components/header/writing-menu/index.js +7 -7
  18. package/build/components/header/writing-menu/index.js.map +1 -1
  19. package/build/components/keyboard-shortcut-help-modal/config.js +5 -0
  20. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  21. package/build/components/layout/index.js.map +1 -1
  22. package/build/components/layout/index.native.js +1 -1
  23. package/build/components/layout/index.native.js.map +1 -1
  24. package/build/components/preferences-modal/index.js +14 -136
  25. package/build/components/preferences-modal/index.js.map +1 -1
  26. package/build/components/preferences-modal/meta-boxes-section.js +2 -4
  27. package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
  28. package/build/components/preferences-modal/options/enable-custom-fields.js +2 -8
  29. package/build/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
  30. package/build/components/preferences-modal/options/enable-feature.js +2 -4
  31. package/build/components/preferences-modal/options/enable-feature.js.map +1 -1
  32. package/build/components/preferences-modal/options/enable-panel.js +2 -4
  33. package/build/components/preferences-modal/options/enable-panel.js.map +1 -1
  34. package/build/components/preferences-modal/options/enable-publish-sidebar.js +2 -8
  35. package/build/components/preferences-modal/options/enable-publish-sidebar.js.map +1 -1
  36. package/build/components/secondary-sidebar/list-view-sidebar.js +0 -11
  37. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  38. package/build/components/sidebar/post-link/index.js +1 -1
  39. package/build/components/sidebar/post-link/index.js.map +1 -1
  40. package/build/editor.js +4 -3
  41. package/build/editor.js.map +1 -1
  42. package/build/editor.native.js +8 -8
  43. package/build/editor.native.js.map +1 -1
  44. package/build/hooks/validate-multiple-use/index.js +1 -1
  45. package/build/hooks/validate-multiple-use/index.js.map +1 -1
  46. package/build/index.js +5 -4
  47. package/build/index.js.map +1 -1
  48. package/build/plugins/welcome-guide-menu-item/index.js +3 -3
  49. package/build/plugins/welcome-guide-menu-item/index.js.map +1 -1
  50. package/build/store/actions.js +173 -113
  51. package/build/store/actions.js.map +1 -1
  52. package/build/store/index.js +0 -3
  53. package/build/store/index.js.map +1 -1
  54. package/build/store/reducer.js +0 -12
  55. package/build/store/reducer.js.map +1 -1
  56. package/build/store/selectors.js +44 -10
  57. package/build/store/selectors.js.map +1 -1
  58. package/build-module/components/block-manager/category.js +2 -2
  59. package/build-module/components/block-manager/category.js.map +1 -1
  60. package/build-module/components/block-manager/index.js +2 -2
  61. package/build-module/components/block-manager/index.js.map +1 -1
  62. package/build-module/components/header/fullscreen-mode-close/index.js +8 -4
  63. package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
  64. package/build-module/components/header/header-toolbar/index.js +1 -1
  65. package/build-module/components/header/header-toolbar/index.js.map +1 -1
  66. package/build-module/components/header/header-toolbar/index.native.js +1 -1
  67. package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
  68. package/build-module/components/header/index.js +3 -1
  69. package/build-module/components/header/index.js.map +1 -1
  70. package/build-module/components/header/more-menu/index.js +0 -5
  71. package/build-module/components/header/more-menu/index.js.map +1 -1
  72. package/build-module/components/header/template-title/delete-template.js +32 -22
  73. package/build-module/components/header/template-title/delete-template.js.map +1 -1
  74. package/build-module/components/header/writing-menu/index.js +7 -7
  75. package/build-module/components/header/writing-menu/index.js.map +1 -1
  76. package/build-module/components/keyboard-shortcut-help-modal/config.js +5 -0
  77. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  78. package/build-module/components/layout/index.js +2 -2
  79. package/build-module/components/layout/index.js.map +1 -1
  80. package/build-module/components/layout/index.native.js +1 -1
  81. package/build-module/components/layout/index.native.js.map +1 -1
  82. package/build-module/components/preferences-modal/index.js +15 -135
  83. package/build-module/components/preferences-modal/index.js.map +1 -1
  84. package/build-module/components/preferences-modal/meta-boxes-section.js +2 -2
  85. package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
  86. package/build-module/components/preferences-modal/options/enable-custom-fields.js +1 -5
  87. package/build-module/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
  88. package/build-module/components/preferences-modal/options/enable-feature.js +1 -1
  89. package/build-module/components/preferences-modal/options/enable-feature.js.map +1 -1
  90. package/build-module/components/preferences-modal/options/enable-panel.js +1 -1
  91. package/build-module/components/preferences-modal/options/enable-panel.js.map +1 -1
  92. package/build-module/components/preferences-modal/options/enable-publish-sidebar.js +1 -5
  93. package/build-module/components/preferences-modal/options/enable-publish-sidebar.js.map +1 -1
  94. package/build-module/components/secondary-sidebar/list-view-sidebar.js +1 -12
  95. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  96. package/build-module/components/sidebar/post-link/index.js +2 -2
  97. package/build-module/components/sidebar/post-link/index.js.map +1 -1
  98. package/build-module/editor.js +5 -4
  99. package/build-module/editor.js.map +1 -1
  100. package/build-module/editor.native.js +8 -8
  101. package/build-module/editor.native.js.map +1 -1
  102. package/build-module/hooks/validate-multiple-use/index.js +1 -1
  103. package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
  104. package/build-module/index.js +5 -4
  105. package/build-module/index.js.map +1 -1
  106. package/build-module/plugins/welcome-guide-menu-item/index.js +3 -3
  107. package/build-module/plugins/welcome-guide-menu-item/index.js.map +1 -1
  108. package/build-module/store/actions.js +143 -102
  109. package/build-module/store/actions.js.map +1 -1
  110. package/build-module/store/index.js +0 -2
  111. package/build-module/store/index.js.map +1 -1
  112. package/build-module/store/reducer.js +1 -13
  113. package/build-module/store/reducer.js.map +1 -1
  114. package/build-module/store/selectors.js +36 -6
  115. package/build-module/store/selectors.js.map +1 -1
  116. package/build-style/style-rtl.css +105 -139
  117. package/build-style/style.css +105 -139
  118. package/package.json +30 -25
  119. package/src/components/block-manager/category.js +2 -2
  120. package/src/components/block-manager/index.js +2 -2
  121. package/src/components/header/fullscreen-mode-close/index.js +9 -4
  122. package/src/components/header/fullscreen-mode-close/style.scss +5 -1
  123. package/src/components/header/fullscreen-mode-close/test/index.js +1 -1
  124. package/src/components/header/header-toolbar/index.js +1 -1
  125. package/src/components/header/header-toolbar/index.native.js +1 -1
  126. package/src/components/header/index.js +1 -1
  127. package/src/components/header/more-menu/index.js +0 -6
  128. package/src/components/header/style.scss +1 -1
  129. package/src/components/header/template-title/delete-template.js +57 -46
  130. package/src/components/header/writing-menu/index.js +7 -7
  131. package/src/components/keyboard-shortcut-help-modal/config.js +4 -0
  132. package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +6 -0
  133. package/src/components/layout/index.js +2 -2
  134. package/src/components/layout/index.native.js +1 -1
  135. package/src/components/preferences-modal/index.js +24 -178
  136. package/src/components/preferences-modal/meta-boxes-section.js +3 -3
  137. package/src/components/preferences-modal/options/enable-custom-fields.js +1 -5
  138. package/src/components/preferences-modal/options/enable-feature.js +1 -1
  139. package/src/components/preferences-modal/options/enable-panel.js +1 -1
  140. package/src/components/preferences-modal/options/enable-publish-sidebar.js +1 -5
  141. package/src/components/preferences-modal/options/test/__snapshots__/enable-custom-fields.js.snap +4 -4
  142. package/src/components/preferences-modal/options/test/enable-custom-fields.js +1 -1
  143. package/src/components/preferences-modal/test/__snapshots__/index.js.snap +235 -357
  144. package/src/components/preferences-modal/test/index.js +6 -6
  145. package/src/components/secondary-sidebar/list-view-sidebar.js +1 -11
  146. package/src/components/sidebar/post-link/index.js +2 -2
  147. package/src/editor.js +4 -3
  148. package/src/editor.native.js +7 -7
  149. package/src/hooks/validate-multiple-use/index.js +1 -1
  150. package/src/index.js +5 -4
  151. package/src/plugins/welcome-guide-menu-item/index.js +3 -3
  152. package/src/store/actions.js +129 -149
  153. package/src/store/index.js +0 -2
  154. package/src/store/reducer.js +1 -12
  155. package/src/store/selectors.js +56 -8
  156. package/src/store/test/actions.js +252 -79
  157. package/src/store/test/reducer.js +0 -28
  158. package/src/style.scss +0 -2
  159. package/src/test/editor.native.js +2 -2
  160. package/build/components/preferences-modal/options/base.js +0 -35
  161. package/build/components/preferences-modal/options/base.js.map +0 -1
  162. package/build/components/preferences-modal/section.js +0 -27
  163. package/build/components/preferences-modal/section.js.map +0 -1
  164. package/build-module/components/preferences-modal/options/base.js +0 -27
  165. package/build-module/components/preferences-modal/options/base.js.map +0 -1
  166. package/build-module/components/preferences-modal/section.js +0 -19
  167. package/build-module/components/preferences-modal/section.js.map +0 -1
  168. package/src/components/header/more-menu/style.scss +0 -35
  169. package/src/components/preferences-modal/options/base.js +0 -20
  170. package/src/components/preferences-modal/section.js +0 -15
  171. package/src/components/preferences-modal/style.scss +0 -112
@@ -1,34 +1,30 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.__experimentalSetPreviewDeviceType = __experimentalSetPreviewDeviceType;
7
9
  exports.__experimentalUpdateLocalAutosaveInterval = __experimentalUpdateLocalAutosaveInterval;
8
- exports.__unstableCreateTemplate = __unstableCreateTemplate;
9
- exports.__unstableSwitchToTemplateMode = __unstableSwitchToTemplateMode;
10
- exports.closeGeneralSidebar = closeGeneralSidebar;
10
+ exports.closeGeneralSidebar = exports.__unstableSwitchToTemplateMode = exports.__unstableCreateTemplate = void 0;
11
11
  exports.closeModal = closeModal;
12
12
  exports.closePublishSidebar = closePublishSidebar;
13
- exports.hideBlockTypes = hideBlockTypes;
14
- exports.initializeMetaBoxes = initializeMetaBoxes;
13
+ exports.initializeMetaBoxes = exports.hideBlockTypes = void 0;
15
14
  exports.metaBoxUpdatesFailure = metaBoxUpdatesFailure;
16
15
  exports.metaBoxUpdatesSuccess = metaBoxUpdatesSuccess;
17
- exports.openGeneralSidebar = openGeneralSidebar;
16
+ exports.openGeneralSidebar = void 0;
18
17
  exports.openModal = openModal;
19
18
  exports.openPublishSidebar = openPublishSidebar;
20
19
  exports.removeEditorPanel = removeEditorPanel;
21
- exports.requestMetaBoxUpdates = requestMetaBoxUpdates;
22
- exports.setAvailableMetaBoxesPerLocation = setAvailableMetaBoxesPerLocation;
20
+ exports.setAvailableMetaBoxesPerLocation = exports.requestMetaBoxUpdates = void 0;
23
21
  exports.setIsEditingTemplate = setIsEditingTemplate;
24
22
  exports.setIsInserterOpened = setIsInserterOpened;
25
23
  exports.setIsListViewOpened = setIsListViewOpened;
26
- exports.showBlockTypes = showBlockTypes;
27
- exports.switchEditorMode = switchEditorMode;
24
+ exports.switchEditorMode = exports.showBlockTypes = void 0;
28
25
  exports.toggleEditorPanelEnabled = toggleEditorPanelEnabled;
29
26
  exports.toggleEditorPanelOpened = toggleEditorPanelOpened;
30
- exports.toggleFeature = toggleFeature;
31
- exports.togglePinnedPluginItem = togglePinnedPluginItem;
27
+ exports.togglePinnedPluginItem = exports.toggleFeature = void 0;
32
28
  exports.togglePublishSidebar = togglePublishSidebar;
33
29
  exports.updatePreferredStyleVariations = updatePreferredStyleVariations;
34
30
 
@@ -36,11 +32,11 @@ var _lodash = require("lodash");
36
32
 
37
33
  var _i18n = require("@wordpress/i18n");
38
34
 
39
- var _dataControls = require("@wordpress/data-controls");
35
+ var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
40
36
 
41
37
  var _interface = require("@wordpress/interface");
42
38
 
43
- var _data = require("@wordpress/data");
39
+ var _preferences = require("@wordpress/preferences");
44
40
 
45
41
  var _a11y = require("@wordpress/a11y");
46
42
 
@@ -72,22 +68,26 @@ var _ = require(".");
72
68
  * Returns an action object used in signalling that the user opened an editor sidebar.
73
69
  *
74
70
  * @param {?string} name Sidebar name to be opened.
75
- *
76
- * @yield {Object} Action object.
77
71
  */
78
- function* openGeneralSidebar(name) {
79
- yield _data.controls.dispatch(_interface.store, 'enableComplementaryArea', _.store.name, name);
80
- }
72
+ const openGeneralSidebar = name => _ref => {
73
+ let {
74
+ registry
75
+ } = _ref;
76
+ return registry.dispatch(_interface.store).enableComplementaryArea(_.store.name, name);
77
+ };
81
78
  /**
82
79
  * Returns an action object signalling that the user closed the sidebar.
83
- *
84
- * @yield {Object} Action object.
85
80
  */
86
81
 
87
82
 
88
- function* closeGeneralSidebar() {
89
- yield _data.controls.dispatch(_interface.store, 'disableComplementaryArea', _.store.name);
90
- }
83
+ exports.openGeneralSidebar = openGeneralSidebar;
84
+
85
+ const closeGeneralSidebar = () => _ref2 => {
86
+ let {
87
+ registry
88
+ } = _ref2;
89
+ return registry.dispatch(_interface.store).disableComplementaryArea(_.store.name);
90
+ };
91
91
  /**
92
92
  * Returns an action object used in signalling that the user opened a modal.
93
93
  *
@@ -97,6 +97,8 @@ function* closeGeneralSidebar() {
97
97
  */
98
98
 
99
99
 
100
+ exports.closeGeneralSidebar = closeGeneralSidebar;
101
+
100
102
  function openModal(name) {
101
103
  return {
102
104
  type: 'OPEN_MODAL',
@@ -205,23 +207,38 @@ function removeEditorPanel(panelName) {
205
207
  */
206
208
 
207
209
 
208
- function* toggleFeature(feature) {
209
- yield _data.controls.dispatch(_interface.store.name, 'toggleFeature', 'core/edit-post', feature);
210
- }
210
+ const toggleFeature = feature => _ref3 => {
211
+ let {
212
+ registry
213
+ } = _ref3;
214
+ return registry.dispatch(_preferences.store).toggle('core/edit-post', feature);
215
+ };
216
+ /**
217
+ * Triggers an action used to switch editor mode.
218
+ *
219
+ * @param {string} mode The editor mode.
220
+ */
221
+
222
+
223
+ exports.toggleFeature = toggleFeature;
211
224
 
212
- function* switchEditorMode(mode) {
213
- yield {
225
+ const switchEditorMode = mode => _ref4 => {
226
+ let {
227
+ dispatch,
228
+ registry
229
+ } = _ref4;
230
+ dispatch({
214
231
  type: 'SWITCH_MODE',
215
232
  mode
216
- }; // Unselect blocks when we switch to the code editor.
233
+ }); // Unselect blocks when we switch to the code editor.
217
234
 
218
235
  if (mode !== 'visual') {
219
- yield _data.controls.dispatch(_blockEditor.store, 'clearSelectedBlock');
236
+ registry.dispatch(_blockEditor.store).clearSelectedBlock();
220
237
  }
221
238
 
222
239
  const message = mode === 'visual' ? (0, _i18n.__)('Visual editor selected') : (0, _i18n.__)('Code editor selected');
223
240
  (0, _a11y.speak)(message, 'assertive');
224
- }
241
+ };
225
242
  /**
226
243
  * Triggers an action object used to toggle a plugin name flag.
227
244
  *
@@ -229,26 +246,15 @@ function* switchEditorMode(mode) {
229
246
  */
230
247
 
231
248
 
232
- function* togglePinnedPluginItem(pluginName) {
233
- const isPinned = yield _data.controls.select(_interface.store, 'isItemPinned', 'core/edit-post', pluginName);
234
- yield _data.controls.dispatch(_interface.store, isPinned ? 'unpinItem' : 'pinItem', 'core/edit-post', pluginName);
235
- }
236
- /**
237
- * Returns an action object used in signalling that block types by the given
238
- * name(s) should be hidden.
239
- *
240
- * @param {string[]} blockNames Names of block types to hide.
241
- *
242
- * @return {Object} Action object.
243
- */
244
-
249
+ exports.switchEditorMode = switchEditorMode;
245
250
 
246
- function hideBlockTypes(blockNames) {
247
- return {
248
- type: 'HIDE_BLOCK_TYPES',
249
- blockNames: (0, _lodash.castArray)(blockNames)
250
- };
251
- }
251
+ const togglePinnedPluginItem = pluginName => _ref5 => {
252
+ let {
253
+ registry
254
+ } = _ref5;
255
+ const isPinned = registry.select(_interface.store).isItemPinned('core/edit-post', pluginName);
256
+ registry.dispatch(_interface.store)[isPinned ? 'unpinItem' : 'pinItem']('core/edit-post', pluginName);
257
+ };
252
258
  /**
253
259
  * Returns an action object used in signaling that a style should be auto-applied when a block is created.
254
260
  *
@@ -259,6 +265,8 @@ function hideBlockTypes(blockNames) {
259
265
  */
260
266
 
261
267
 
268
+ exports.togglePinnedPluginItem = togglePinnedPluginItem;
269
+
262
270
  function updatePreferredStyleVariations(blockName, blockStyle) {
263
271
  return {
264
272
  type: 'UPDATE_PREFERRED_STYLE_VARIATIONS',
@@ -282,48 +290,76 @@ function __experimentalUpdateLocalAutosaveInterval(interval) {
282
290
  };
283
291
  }
284
292
  /**
285
- * Returns an action object used in signalling that block types by the given
286
- * name(s) should be shown.
293
+ * Update the provided block types to be visible.
287
294
  *
288
295
  * @param {string[]} blockNames Names of block types to show.
296
+ */
297
+
298
+
299
+ const showBlockTypes = blockNames => _ref6 => {
300
+ var _registry$select$get;
301
+
302
+ let {
303
+ registry
304
+ } = _ref6;
305
+ const existingBlockNames = (_registry$select$get = registry.select(_preferences.store).get('core/edit-post', 'hiddenBlockTypes')) !== null && _registry$select$get !== void 0 ? _registry$select$get : [];
306
+ const newBlockNames = (0, _lodash.without)(existingBlockNames, ...(0, _lodash.castArray)(blockNames));
307
+ registry.dispatch(_preferences.store).set('core/edit-post', 'hiddenBlockTypes', newBlockNames);
308
+ };
309
+ /**
310
+ * Update the provided block types to be hidden.
289
311
  *
290
- * @return {Object} Action object.
312
+ * @param {string[]} blockNames Names of block types to hide.
291
313
  */
292
314
 
293
315
 
294
- function showBlockTypes(blockNames) {
295
- return {
296
- type: 'SHOW_BLOCK_TYPES',
297
- blockNames: (0, _lodash.castArray)(blockNames)
298
- };
299
- }
316
+ exports.showBlockTypes = showBlockTypes;
317
+
318
+ const hideBlockTypes = blockNames => _ref7 => {
319
+ var _registry$select$get2;
320
+
321
+ let {
322
+ registry
323
+ } = _ref7;
324
+ const existingBlockNames = (_registry$select$get2 = registry.select(_preferences.store).get('core/edit-post', 'hiddenBlockTypes')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : [];
325
+ const mergedBlockNames = new Set([...existingBlockNames, ...(0, _lodash.castArray)(blockNames)]);
326
+ registry.dispatch(_preferences.store).set('core/edit-post', 'hiddenBlockTypes', [...mergedBlockNames]);
327
+ };
300
328
  /**
301
329
  * Returns an action object used in signaling
302
330
  * what Meta boxes are available in which location.
303
331
  *
304
332
  * @param {Object} metaBoxesPerLocation Meta boxes per location.
305
- *
306
- * @yield {Object} Action object.
307
333
  */
308
334
 
309
335
 
310
- function* setAvailableMetaBoxesPerLocation(metaBoxesPerLocation) {
311
- yield {
336
+ exports.hideBlockTypes = hideBlockTypes;
337
+
338
+ const setAvailableMetaBoxesPerLocation = metaBoxesPerLocation => _ref8 => {
339
+ let {
340
+ dispatch
341
+ } = _ref8;
342
+ return dispatch({
312
343
  type: 'SET_META_BOXES_PER_LOCATIONS',
313
344
  metaBoxesPerLocation
314
- };
315
- }
345
+ });
346
+ };
316
347
  /**
317
- * Returns an action object used to request meta box update.
318
- *
319
- * @yield {Object} Action object.
348
+ * Update a metabox.
320
349
  */
321
350
 
322
351
 
323
- function* requestMetaBoxUpdates() {
324
- yield {
352
+ exports.setAvailableMetaBoxesPerLocation = setAvailableMetaBoxesPerLocation;
353
+
354
+ const requestMetaBoxUpdates = () => async _ref9 => {
355
+ let {
356
+ registry,
357
+ select,
358
+ dispatch
359
+ } = _ref9;
360
+ dispatch({
325
361
  type: 'REQUEST_META_BOX_UPDATES'
326
- }; // Saves the wp_editor fields
362
+ }); // Saves the wp_editor fields.
327
363
 
328
364
  if (window.tinyMCE) {
329
365
  window.tinyMCE.triggerSave();
@@ -331,11 +367,11 @@ function* requestMetaBoxUpdates() {
331
367
  // If we do not provide this data, the post will be overridden with the default values.
332
368
 
333
369
 
334
- const post = yield _data.controls.select(_editor.store, 'getCurrentPost');
335
- const additionalData = [post.comment_status ? ['comment_status', post.comment_status] : false, post.ping_status ? ['ping_status', post.ping_status] : false, post.sticky ? ['sticky', post.sticky] : false, post.author ? ['post_author', post.author] : false].filter(Boolean); // We gather all the metaboxes locations data and the base form data
370
+ const post = registry.select(_editor.store).getCurrentPost();
371
+ const additionalData = [post.comment_status ? ['comment_status', post.comment_status] : false, post.ping_status ? ['ping_status', post.ping_status] : false, post.sticky ? ['sticky', post.sticky] : false, post.author ? ['post_author', post.author] : false].filter(Boolean); // We gather all the metaboxes locations data and the base form data.
336
372
 
337
373
  const baseFormData = new window.FormData(document.querySelector('.metabox-base-form'));
338
- const activeMetaBoxLocations = yield _data.controls.select(_.store, 'getActiveMetaBoxLocations');
374
+ const activeMetaBoxLocations = select.getActiveMetaBoxLocations();
339
375
  const formDataToMerge = [baseFormData, ...activeMetaBoxLocations.map(location => new window.FormData((0, _metaBoxes.getMetaBoxContainer)(location)))]; // Merge all form data objects into a single one.
340
376
 
341
377
  const formData = (0, _lodash.reduce)(formDataToMerge, (memo, currentFormData) => {
@@ -345,24 +381,24 @@ function* requestMetaBoxUpdates() {
345
381
 
346
382
  return memo;
347
383
  }, new window.FormData());
348
- additionalData.forEach(_ref => {
349
- let [key, value] = _ref;
384
+ additionalData.forEach(_ref10 => {
385
+ let [key, value] = _ref10;
350
386
  return formData.append(key, value);
351
387
  });
352
388
 
353
389
  try {
354
- // Save the metaboxes
355
- yield (0, _dataControls.apiFetch)({
390
+ // Save the metaboxes.
391
+ await (0, _apiFetch.default)({
356
392
  url: window._wpMetaBoxUrl,
357
393
  method: 'POST',
358
394
  body: formData,
359
395
  parse: false
360
396
  });
361
- yield _data.controls.dispatch(_.store, 'metaBoxUpdatesSuccess');
397
+ dispatch.metaBoxUpdatesSuccess();
362
398
  } catch {
363
- yield _data.controls.dispatch(_.store, 'metaBoxUpdatesFailure');
399
+ dispatch.metaBoxUpdatesFailure();
364
400
  }
365
- }
401
+ };
366
402
  /**
367
403
  * Returns an action object used to signal a successful meta box update.
368
404
  *
@@ -370,6 +406,8 @@ function* requestMetaBoxUpdates() {
370
406
  */
371
407
 
372
408
 
409
+ exports.requestMetaBoxUpdates = requestMetaBoxUpdates;
410
+
373
411
  function metaBoxUpdatesSuccess() {
374
412
  return {
375
413
  type: 'META_BOX_UPDATES_SUCCESS'
@@ -457,18 +495,25 @@ function setIsEditingTemplate(value) {
457
495
  */
458
496
 
459
497
 
460
- function* __unstableSwitchToTemplateMode() {
498
+ const __unstableSwitchToTemplateMode = function () {
461
499
  let newTemplate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
462
- yield setIsEditingTemplate(true);
463
- const isWelcomeGuideActive = yield _data.controls.select(_.store, 'isFeatureActive', 'welcomeGuideTemplate');
464
-
465
- if (!isWelcomeGuideActive) {
466
- const message = newTemplate ? (0, _i18n.__)("Custom template created. You're in template mode now.") : (0, _i18n.__)('Editing template. Changes made here affect all posts and pages that use the template.');
467
- yield _data.controls.dispatch(_notices.store, 'createSuccessNotice', message, {
468
- type: 'snackbar'
469
- });
470
- }
471
- }
500
+ return _ref11 => {
501
+ let {
502
+ registry,
503
+ select,
504
+ dispatch
505
+ } = _ref11;
506
+ dispatch(setIsEditingTemplate(true));
507
+ const isWelcomeGuideActive = select.isFeatureActive('welcomeGuideTemplate');
508
+
509
+ if (!isWelcomeGuideActive) {
510
+ const message = newTemplate ? (0, _i18n.__)("Custom template created. You're in template mode now.") : (0, _i18n.__)('Editing template. Changes made here affect all posts and pages that use the template.');
511
+ registry.dispatch(_notices.store).createSuccessNotice(message, {
512
+ type: 'snackbar'
513
+ });
514
+ }
515
+ };
516
+ };
472
517
  /**
473
518
  * Create a block based template.
474
519
  *
@@ -476,49 +521,62 @@ function* __unstableSwitchToTemplateMode() {
476
521
  */
477
522
 
478
523
 
479
- function* __unstableCreateTemplate(template) {
480
- const savedTemplate = yield _data.controls.dispatch(_coreData.store, 'saveEntityRecord', 'postType', 'wp_template', template);
481
- const post = yield _data.controls.select(_editor.store, 'getCurrentPost');
482
- yield _data.controls.dispatch(_coreData.store, 'editEntityRecord', 'postType', post.type, post.id, {
524
+ exports.__unstableSwitchToTemplateMode = __unstableSwitchToTemplateMode;
525
+
526
+ const __unstableCreateTemplate = template => async _ref12 => {
527
+ let {
528
+ registry
529
+ } = _ref12;
530
+ const savedTemplate = await registry.dispatch(_coreData.store).saveEntityRecord('postType', 'wp_template', template);
531
+ const post = registry.select(_editor.store).getCurrentPost();
532
+ registry.dispatch(_coreData.store).editEntityRecord('postType', post.type, post.id, {
483
533
  template: savedTemplate.slug
484
534
  });
485
- }
535
+ };
486
536
 
537
+ exports.__unstableCreateTemplate = __unstableCreateTemplate;
487
538
  let metaBoxesInitialized = false;
488
539
  /**
489
540
  * Initializes WordPress `postboxes` script and the logic for saving meta boxes.
490
541
  */
491
542
 
492
- function* initializeMetaBoxes() {
493
- const isEditorReady = yield _data.controls.select(_editor.store, '__unstableIsEditorReady');
543
+ const initializeMetaBoxes = () => _ref13 => {
544
+ let {
545
+ registry,
546
+ select,
547
+ dispatch
548
+ } = _ref13;
549
+
550
+ const isEditorReady = registry.select(_editor.store).__unstableIsEditorReady();
494
551
 
495
552
  if (!isEditorReady) {
496
553
  return;
497
- }
554
+ } // Only initialize once.
498
555
 
499
- const postType = yield _data.controls.select(_editor.store, 'getCurrentPostType'); // Only initialize once.
500
556
 
501
557
  if (metaBoxesInitialized) {
502
558
  return;
503
559
  }
504
560
 
561
+ const postType = registry.select(_editor.store).getCurrentPostType();
562
+
505
563
  if (window.postboxes.page !== postType) {
506
564
  window.postboxes.add_postbox_toggles(postType);
507
565
  }
508
566
 
509
567
  metaBoxesInitialized = true;
510
- let wasSavingPost = yield _data.controls.select(_editor.store, 'isSavingPost');
511
- let wasAutosavingPost = yield _data.controls.select(_editor.store, 'isAutosavingPost');
512
- const hasMetaBoxes = yield _data.controls.select(_.store, 'hasMetaBoxes'); // Save metaboxes when performing a full save on the post.
568
+ let wasSavingPost = registry.select(_editor.store).isSavingPost();
569
+ let wasAutosavingPost = registry.select(_editor.store).isAutosavingPost();
570
+ const hasMetaBoxes = select.hasMetaBoxes(); // Save metaboxes when performing a full save on the post.
513
571
 
514
- (0, _data.subscribe)(() => {
515
- const isSavingPost = (0, _data.select)(_editor.store).isSavingPost();
516
- const isAutosavingPost = (0, _data.select)(_editor.store).isAutosavingPost(); // Save metaboxes on save completion, except for autosaves that are not a post preview.
572
+ registry.subscribe(async () => {
573
+ const isSavingPost = registry.select(_editor.store).isSavingPost();
574
+ const isAutosavingPost = registry.select(_editor.store).isAutosavingPost(); // Save metaboxes on save completion, except for autosaves that are not a post preview.
517
575
  //
518
576
  // Meta boxes are initialized once at page load. It is not necessary to
519
577
  // account for updates on each state change.
520
578
  //
521
- // See: https://github.com/WordPress/WordPress/blob/5.1.1/wp-admin/includes/post.php#L2307-L2309
579
+ // See: https://github.com/WordPress/WordPress/blob/5.1.1/wp-admin/includes/post.php#L2307-L2309.
522
580
 
523
581
  const shouldTriggerMetaboxesSave = hasMetaBoxes && wasSavingPost && !isSavingPost && !wasAutosavingPost; // Save current state for next inspection.
524
582
 
@@ -526,11 +584,13 @@ function* initializeMetaBoxes() {
526
584
  wasAutosavingPost = isAutosavingPost;
527
585
 
528
586
  if (shouldTriggerMetaboxesSave) {
529
- (0, _data.dispatch)(_.store).requestMetaBoxUpdates();
587
+ await dispatch.requestMetaBoxUpdates();
530
588
  }
531
589
  });
532
- return {
590
+ dispatch({
533
591
  type: 'META_BOXES_INITIALIZED'
534
- };
535
- }
592
+ });
593
+ };
594
+
595
+ exports.initializeMetaBoxes = initializeMetaBoxes;
536
596
  //# sourceMappingURL=actions.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/store/actions.js"],"names":["openGeneralSidebar","name","controls","dispatch","interfaceStore","editPostStore","closeGeneralSidebar","openModal","type","closeModal","openPublishSidebar","closePublishSidebar","togglePublishSidebar","toggleEditorPanelEnabled","panelName","toggleEditorPanelOpened","removeEditorPanel","toggleFeature","feature","switchEditorMode","mode","blockEditorStore","message","togglePinnedPluginItem","pluginName","isPinned","select","hideBlockTypes","blockNames","updatePreferredStyleVariations","blockName","blockStyle","__experimentalUpdateLocalAutosaveInterval","interval","showBlockTypes","setAvailableMetaBoxesPerLocation","metaBoxesPerLocation","requestMetaBoxUpdates","window","tinyMCE","triggerSave","post","editorStore","additionalData","comment_status","ping_status","sticky","author","filter","Boolean","baseFormData","FormData","document","querySelector","activeMetaBoxLocations","formDataToMerge","map","location","formData","memo","currentFormData","key","value","append","forEach","url","_wpMetaBoxUrl","method","body","parse","metaBoxUpdatesSuccess","metaBoxUpdatesFailure","__experimentalSetPreviewDeviceType","deviceType","setIsInserterOpened","setIsListViewOpened","isOpen","setIsEditingTemplate","__unstableSwitchToTemplateMode","newTemplate","isWelcomeGuideActive","noticesStore","__unstableCreateTemplate","template","savedTemplate","coreStore","id","slug","metaBoxesInitialized","initializeMetaBoxes","isEditorReady","postType","postboxes","page","add_postbox_toggles","wasSavingPost","wasAutosavingPost","hasMetaBoxes","isSavingPost","isAutosavingPost","shouldTriggerMetaboxesSave"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,UAAUA,kBAAV,CAA8BC,IAA9B,EAAqC;AAC3C,QAAMC,eAASC,QAAT,CACLC,gBADK,EAEL,yBAFK,EAGLC,QAAcJ,IAHT,EAILA,IAJK,CAAN;AAMA;AAED;AACA;AACA;AACA;AACA;;;AACO,UAAUK,mBAAV,GAAgC;AACtC,QAAMJ,eAASC,QAAT,CACLC,gBADK,EAEL,0BAFK,EAGLC,QAAcJ,IAHT,CAAN;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASM,SAAT,CAAoBN,IAApB,EAA2B;AACjC,SAAO;AACNO,IAAAA,IAAI,EAAE,YADA;AAENP,IAAAA;AAFM,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A;AACA;;AACA,UAAMC,0BAA0B,GAC/BH,YAAY,IACZF,aADA,IAEA,CAAEG,YAFF,IAGA,CAAEF,iBAJH,CAVgB,CAgBhB;;AACAD,IAAAA,aAAa,GAAGG,YAAhB;AACAF,IAAAA,iBAAiB,GAAGG,gBAApB;;AAEA,QAAKC,0BAAL,EAAkC;AACjC,0BAAU/F,OAAV,EAA0BgC,qBAA1B;AACA;AACD,GAvBD;AAyBA,SAAO;AACN7B,IAAAA,IAAI,EAAE;AADA,GAAP;AAGA","sourcesContent":["/**\n * External dependencies\n */\nimport { castArray, reduce } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { apiFetch } from '@wordpress/data-controls';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { controls, select, subscribe, dispatch } from '@wordpress/data';\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';\n\n/**\n * Internal dependencies\n */\nimport { getMetaBoxContainer } from '../utils/meta-boxes';\nimport { store as editPostStore } from '.';\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 *\n * @yield {Object} Action object.\n */\nexport function* openGeneralSidebar( name ) {\n\tyield controls.dispatch(\n\t\tinterfaceStore,\n\t\t'enableComplementaryArea',\n\t\teditPostStore.name,\n\t\tname\n\t);\n}\n\n/**\n * Returns an action object signalling that the user closed the sidebar.\n *\n * @yield {Object} Action object.\n */\nexport function* closeGeneralSidebar() {\n\tyield controls.dispatch(\n\t\tinterfaceStore,\n\t\t'disableComplementaryArea',\n\t\teditPostStore.name\n\t);\n}\n\n/**\n * Returns an action object used in signalling that the user opened a modal.\n *\n * @param {string} name A string that uniquely identifies the modal.\n *\n * @return {Object} Action object.\n */\nexport function openModal( name ) {\n\treturn {\n\t\ttype: 'OPEN_MODAL',\n\t\tname,\n\t};\n}\n\n/**\n * Returns an action object signalling that the user closed a modal.\n *\n * @return {Object} Action object.\n */\nexport function closeModal() {\n\treturn {\n\t\ttype: 'CLOSE_MODAL',\n\t};\n}\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 function toggleEditorPanelEnabled( panelName ) {\n\treturn {\n\t\ttype: 'TOGGLE_PANEL_ENABLED',\n\t\tpanelName,\n\t};\n}\n\n/**\n * Returns an action object used to open or close a panel in the editor.\n *\n * @param {string} panelName A string that identifies the panel to open or close.\n *\n * @return {Object} Action object.\n */\nexport function toggleEditorPanelOpened( panelName ) {\n\treturn {\n\t\ttype: 'TOGGLE_PANEL_OPENED',\n\t\tpanelName,\n\t};\n}\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 function* toggleFeature( feature ) {\n\tyield controls.dispatch(\n\t\tinterfaceStore.name,\n\t\t'toggleFeature',\n\t\t'core/edit-post',\n\t\tfeature\n\t);\n}\n\nexport function* switchEditorMode( mode ) {\n\tyield {\n\t\ttype: 'SWITCH_MODE',\n\t\tmode,\n\t};\n\n\t// Unselect blocks when we switch to the code editor.\n\tif ( mode !== 'visual' ) {\n\t\tyield controls.dispatch( blockEditorStore, 'clearSelectedBlock' );\n\t}\n\n\tconst message =\n\t\tmode === 'visual'\n\t\t\t? __( 'Visual editor selected' )\n\t\t\t: __( 'Code editor selected' );\n\tspeak( message, 'assertive' );\n}\n\n/**\n * Triggers an action object used to toggle a plugin name flag.\n *\n * @param {string} pluginName Plugin name.\n */\nexport function* togglePinnedPluginItem( pluginName ) {\n\tconst isPinned = yield controls.select(\n\t\tinterfaceStore,\n\t\t'isItemPinned',\n\t\t'core/edit-post',\n\t\tpluginName\n\t);\n\n\tyield controls.dispatch(\n\t\tinterfaceStore,\n\t\tisPinned ? 'unpinItem' : 'pinItem',\n\t\t'core/edit-post',\n\t\tpluginName\n\t);\n}\n\n/**\n * Returns an action object used in signalling that block types by the given\n * name(s) should be hidden.\n *\n * @param {string[]} blockNames Names of block types to hide.\n *\n * @return {Object} Action object.\n */\nexport function hideBlockTypes( blockNames ) {\n\treturn {\n\t\ttype: 'HIDE_BLOCK_TYPES',\n\t\tblockNames: castArray( blockNames ),\n\t};\n}\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 *\n * @return {Object} Action object.\n */\nexport function updatePreferredStyleVariations( blockName, blockStyle ) {\n\treturn {\n\t\ttype: 'UPDATE_PREFERRED_STYLE_VARIATIONS',\n\t\tblockName,\n\t\tblockStyle,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the editor should attempt\n * to locally autosave the current post every `interval` seconds.\n *\n * @param {number} interval The new interval, in seconds.\n * @return {Object} Action object.\n */\nexport function __experimentalUpdateLocalAutosaveInterval( interval ) {\n\treturn {\n\t\ttype: 'UPDATE_LOCAL_AUTOSAVE_INTERVAL',\n\t\tinterval,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that block types by the given\n * name(s) should be shown.\n *\n * @param {string[]} blockNames Names of block types to show.\n *\n * @return {Object} Action object.\n */\nexport function showBlockTypes( blockNames ) {\n\treturn {\n\t\ttype: 'SHOW_BLOCK_TYPES',\n\t\tblockNames: castArray( blockNames ),\n\t};\n}\n\n/**\n * Returns an action object used in signaling\n * what Meta boxes are available in which location.\n *\n * @param {Object} metaBoxesPerLocation Meta boxes per location.\n *\n * @yield {Object} Action object.\n */\nexport function* setAvailableMetaBoxesPerLocation( metaBoxesPerLocation ) {\n\tyield {\n\t\ttype: 'SET_META_BOXES_PER_LOCATIONS',\n\t\tmetaBoxesPerLocation,\n\t};\n}\n\n/**\n * Returns an action object used to request meta box update.\n *\n * @yield {Object} Action object.\n */\nexport function* requestMetaBoxUpdates() {\n\tyield {\n\t\ttype: 'REQUEST_META_BOX_UPDATES',\n\t};\n\n\t// Saves the wp_editor fields\n\tif ( window.tinyMCE ) {\n\t\twindow.tinyMCE.triggerSave();\n\t}\n\n\t// Additional data needed for backward compatibility.\n\t// If we do not provide this data, the post will be overridden with the default values.\n\tconst post = yield controls.select( editorStore, 'getCurrentPost' );\n\tconst additionalData = [\n\t\tpost.comment_status ? [ 'comment_status', post.comment_status ] : false,\n\t\tpost.ping_status ? [ 'ping_status', post.ping_status ] : false,\n\t\tpost.sticky ? [ 'sticky', post.sticky ] : false,\n\t\tpost.author ? [ 'post_author', post.author ] : false,\n\t].filter( Boolean );\n\n\t// We gather all the metaboxes locations data and the base form data\n\tconst baseFormData = new window.FormData(\n\t\tdocument.querySelector( '.metabox-base-form' )\n\t);\n\tconst activeMetaBoxLocations = yield controls.select(\n\t\teditPostStore,\n\t\t'getActiveMetaBoxLocations'\n\t);\n\tconst formDataToMerge = [\n\t\tbaseFormData,\n\t\t...activeMetaBoxLocations.map(\n\t\t\t( location ) =>\n\t\t\t\tnew window.FormData( getMetaBoxContainer( location ) )\n\t\t),\n\t];\n\n\t// Merge all form data objects into a single one.\n\tconst formData = reduce(\n\t\tformDataToMerge,\n\t\t( 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},\n\t\tnew window.FormData()\n\t);\n\tadditionalData.forEach( ( [ key, value ] ) =>\n\t\tformData.append( key, value )\n\t);\n\n\ttry {\n\t\t// Save the metaboxes\n\t\tyield apiFetch( {\n\t\t\turl: window._wpMetaBoxUrl,\n\t\t\tmethod: 'POST',\n\t\t\tbody: formData,\n\t\t\tparse: false,\n\t\t} );\n\t\tyield controls.dispatch( editPostStore, 'metaBoxUpdatesSuccess' );\n\t} catch {\n\t\tyield controls.dispatch( editPostStore, 'metaBoxUpdatesFailure' );\n\t}\n}\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 function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\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 function* __unstableSwitchToTemplateMode( newTemplate = false ) {\n\tyield setIsEditingTemplate( true );\n\n\tconst isWelcomeGuideActive = yield controls.select(\n\t\teditPostStore,\n\t\t'isFeatureActive',\n\t\t'welcomeGuideTemplate'\n\t);\n\n\tif ( ! isWelcomeGuideActive ) {\n\t\tconst message = newTemplate\n\t\t\t? __( \"Custom template created. You're in template mode now.\" )\n\t\t\t: __(\n\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t );\n\t\tyield controls.dispatch( noticesStore, 'createSuccessNotice', message, {\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t}\n}\n\n/**\n * Create a block based template.\n *\n * @param {Object?} template Template to create and assign.\n */\nexport function* __unstableCreateTemplate( template ) {\n\tconst savedTemplate = yield controls.dispatch(\n\t\tcoreStore,\n\t\t'saveEntityRecord',\n\t\t'postType',\n\t\t'wp_template',\n\t\ttemplate\n\t);\n\tconst post = yield controls.select( editorStore, 'getCurrentPost' );\n\n\tyield controls.dispatch(\n\t\tcoreStore,\n\t\t'editEntityRecord',\n\t\t'postType',\n\t\tpost.type,\n\t\tpost.id,\n\t\t{\n\t\t\ttemplate: savedTemplate.slug,\n\t\t}\n\t);\n}\n\nlet metaBoxesInitialized = false;\n\n/**\n * Initializes WordPress `postboxes` script and the logic for saving meta boxes.\n */\nexport function* initializeMetaBoxes() {\n\tconst isEditorReady = yield controls.select(\n\t\teditorStore,\n\t\t'__unstableIsEditorReady'\n\t);\n\n\tif ( ! isEditorReady ) {\n\t\treturn;\n\t}\n\n\tconst postType = yield controls.select( editorStore, 'getCurrentPostType' );\n\n\t// Only initialize once.\n\tif ( metaBoxesInitialized ) {\n\t\treturn;\n\t}\n\n\tif ( window.postboxes.page !== postType ) {\n\t\twindow.postboxes.add_postbox_toggles( postType );\n\t}\n\n\tmetaBoxesInitialized = true;\n\n\tlet wasSavingPost = yield controls.select( editorStore, 'isSavingPost' );\n\tlet wasAutosavingPost = yield controls.select(\n\t\teditorStore,\n\t\t'isAutosavingPost'\n\t);\n\tconst hasMetaBoxes = yield controls.select( editPostStore, 'hasMetaBoxes' );\n\n\t// Save metaboxes when performing a full save on the post.\n\tsubscribe( () => {\n\t\tconst isSavingPost = select( editorStore ).isSavingPost();\n\t\tconst isAutosavingPost = select( editorStore ).isAutosavingPost();\n\n\t\t// Save metaboxes on save completion, except for autosaves that are not a post preview.\n\t\t//\n\t\t// Meta boxes are initialized once at page load. It is not necessary to\n\t\t// account for updates on each state change.\n\t\t//\n\t\t// See: https://github.com/WordPress/WordPress/blob/5.1.1/wp-admin/includes/post.php#L2307-L2309\n\t\tconst shouldTriggerMetaboxesSave =\n\t\t\thasMetaBoxes &&\n\t\t\twasSavingPost &&\n\t\t\t! isSavingPost &&\n\t\t\t! wasAutosavingPost;\n\n\t\t// Save current state for next inspection.\n\t\twasSavingPost = isSavingPost;\n\t\twasAutosavingPost = isAutosavingPost;\n\n\t\tif ( shouldTriggerMetaboxesSave ) {\n\t\t\tdispatch( editPostStore ).requestMetaBoxUpdates();\n\t\t}\n\t} );\n\n\treturn {\n\t\ttype: 'META_BOXES_INITIALIZED',\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/store/actions.js"],"names":["openGeneralSidebar","name","registry","dispatch","interfaceStore","enableComplementaryArea","editPostStore","closeGeneralSidebar","disableComplementaryArea","openModal","type","closeModal","openPublishSidebar","closePublishSidebar","togglePublishSidebar","toggleEditorPanelEnabled","panelName","toggleEditorPanelOpened","removeEditorPanel","toggleFeature","feature","preferencesStore","toggle","switchEditorMode","mode","blockEditorStore","clearSelectedBlock","message","togglePinnedPluginItem","pluginName","isPinned","select","isItemPinned","updatePreferredStyleVariations","blockName","blockStyle","__experimentalUpdateLocalAutosaveInterval","interval","showBlockTypes","blockNames","existingBlockNames","get","newBlockNames","set","hideBlockTypes","mergedBlockNames","Set","setAvailableMetaBoxesPerLocation","metaBoxesPerLocation","requestMetaBoxUpdates","window","tinyMCE","triggerSave","post","editorStore","getCurrentPost","additionalData","comment_status","ping_status","sticky","author","filter","Boolean","baseFormData","FormData","document","querySelector","activeMetaBoxLocations","getActiveMetaBoxLocations","formDataToMerge","map","location","formData","memo","currentFormData","key","value","append","forEach","url","_wpMetaBoxUrl","method","body","parse","metaBoxUpdatesSuccess","metaBoxUpdatesFailure","__experimentalSetPreviewDeviceType","deviceType","setIsInserterOpened","setIsListViewOpened","isOpen","setIsEditingTemplate","__unstableSwitchToTemplateMode","newTemplate","isWelcomeGuideActive","isFeatureActive","noticesStore","createSuccessNotice","__unstableCreateTemplate","template","savedTemplate","coreStore","saveEntityRecord","editEntityRecord","id","slug","metaBoxesInitialized","initializeMetaBoxes","isEditorReady","__unstableIsEditorReady","postType","getCurrentPostType","postboxes","page","add_postbox_toggles","wasSavingPost","isSavingPost","wasAutosavingPost","isAutosavingPost","hasMetaBoxes","subscribe","shouldTriggerMetaboxesSave"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,MAAMA,kBAAkB,GAAKC,IA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CAAiBE,mBAAjB,CAAsCJ,QAAtC;AACA;;AAEDJ,EAAAA,oBAAoB,GAAG,IAAvB;AAEA,MAAIS,aAAa,GAAGjH,QAAQ,CAAC6B,MAAT,CAAiBuB,aAAjB,EAA+B8D,YAA/B,EAApB;AACA,MAAIC,iBAAiB,GAAGnH,QAAQ,CAAC6B,MAAT,CAAiBuB,aAAjB,EAA+BgE,gBAA/B,EAAxB;AACA,QAAMC,YAAY,GAAGxF,MAAM,CAACwF,YAAP,EAArB,CArB8E,CAuB9E;;AACArH,EAAAA,QAAQ,CAACsH,SAAT,CAAoB,YAAY;AAC/B,UAAMJ,YAAY,GAAGlH,QAAQ,CAAC6B,MAAT,CAAiBuB,aAAjB,EAA+B8D,YAA/B,EAArB;AACA,UAAME,gBAAgB,GAAGpH,QAAQ,CAC/B6B,MADuB,CACfuB,aADe,EAEvBgE,gBAFuB,EAAzB,CAF+B,CAM/B;AACA;AACA;AACA;AACA;AACA;;AACA,UAAMG,0BAA0B,GAC/BF,YAAY,IACZJ,aADA,IAEA,CAAEC,YAFF,IAGA,CAAEC,iBAJH,CAZ+B,CAkB/B;;AACAF,IAAAA,aAAa,GAAGC,YAAhB;AACAC,IAAAA,iBAAiB,GAAGC,gBAApB;;AAEA,QAAKG,0BAAL,EAAkC;AACjC,YAAMtH,QAAQ,CAAC8C,qBAAT,EAAN;AACA;AACD,GAzBD;AA2BA9C,EAAAA,QAAQ,CAAE;AACTO,IAAAA,IAAI,EAAE;AADG,GAAF,CAAR;AAGA,CAtDM","sourcesContent":["/**\n * External dependencies\n */\nimport { castArray, reduce, without } from 'lodash';\n\n/**\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';\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 = ( name ) => ( { registry } ) =>\n\tregistry\n\t\t.dispatch( interfaceStore )\n\t\t.enableComplementaryArea( editPostStore.name, name );\n\n/**\n * Returns an action object signalling that the user closed the sidebar.\n */\nexport const closeGeneralSidebar = () => ( { registry } ) =>\n\tregistry\n\t\t.dispatch( interfaceStore )\n\t\t.disableComplementaryArea( editPostStore.name );\n\n/**\n * Returns an action object used in signalling that the user opened a modal.\n *\n * @param {string} name A string that uniquely identifies the modal.\n *\n * @return {Object} Action object.\n */\nexport function openModal( name ) {\n\treturn {\n\t\ttype: 'OPEN_MODAL',\n\t\tname,\n\t};\n}\n\n/**\n * Returns an action object signalling that the user closed a modal.\n *\n * @return {Object} Action object.\n */\nexport function closeModal() {\n\treturn {\n\t\ttype: 'CLOSE_MODAL',\n\t};\n}\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 function toggleEditorPanelEnabled( panelName ) {\n\treturn {\n\t\ttype: 'TOGGLE_PANEL_ENABLED',\n\t\tpanelName,\n\t};\n}\n\n/**\n * Returns an action object used to open or close a panel in the editor.\n *\n * @param {string} panelName A string that identifies the panel to open or close.\n *\n * @return {Object} Action object.\n */\nexport function toggleEditorPanelOpened( panelName ) {\n\treturn {\n\t\ttype: 'TOGGLE_PANEL_OPENED',\n\t\tpanelName,\n\t};\n}\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 = ( feature ) => ( { registry } ) =>\n\tregistry.dispatch( preferencesStore ).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 = ( mode ) => ( { dispatch, registry } ) => {\n\tdispatch( {\n\t\ttype: 'SWITCH_MODE',\n\t\tmode,\n\t} );\n\n\t// Unselect blocks when we switch to the code editor.\n\tif ( mode !== 'visual' ) {\n\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t}\n\n\tconst message =\n\t\tmode === 'visual'\n\t\t\t? __( 'Visual editor selected' )\n\t\t\t: __( 'Code editor selected' );\n\tspeak( message, 'assertive' );\n};\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 = ( pluginName ) => ( { registry } ) => {\n\tconst isPinned = registry\n\t\t.select( interfaceStore )\n\t\t.isItemPinned( 'core/edit-post', pluginName );\n\n\tregistry\n\t\t.dispatch( interfaceStore )\n\t\t[ isPinned ? 'unpinItem' : 'pinItem' ]( 'core/edit-post', pluginName );\n};\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 *\n * @return {Object} Action object.\n */\nexport function updatePreferredStyleVariations( blockName, blockStyle ) {\n\treturn {\n\t\ttype: 'UPDATE_PREFERRED_STYLE_VARIATIONS',\n\t\tblockName,\n\t\tblockStyle,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the editor should attempt\n * to locally autosave the current post every `interval` seconds.\n *\n * @param {number} interval The new interval, in seconds.\n * @return {Object} Action object.\n */\nexport function __experimentalUpdateLocalAutosaveInterval( interval ) {\n\treturn {\n\t\ttype: 'UPDATE_LOCAL_AUTOSAVE_INTERVAL',\n\t\tinterval,\n\t};\n}\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 = ( blockNames ) => ( { registry } ) => {\n\tconst existingBlockNames =\n\t\tregistry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-post', 'hiddenBlockTypes' ) ?? [];\n\n\tconst newBlockNames = without(\n\t\texistingBlockNames,\n\t\t...castArray( blockNames )\n\t);\n\n\tregistry\n\t\t.dispatch( preferencesStore )\n\t\t.set( 'core/edit-post', 'hiddenBlockTypes', newBlockNames );\n};\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 = ( blockNames ) => ( { registry } ) => {\n\tconst existingBlockNames =\n\t\tregistry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-post', 'hiddenBlockTypes' ) ?? [];\n\n\tconst mergedBlockNames = new Set( [\n\t\t...existingBlockNames,\n\t\t...castArray( blockNames ),\n\t] );\n\n\tregistry\n\t\t.dispatch( preferencesStore )\n\t\t.set( 'core/edit-post', 'hiddenBlockTypes', [ ...mergedBlockNames ] );\n};\n\n/**\n * Returns an action object used in signaling\n * what Meta boxes are available in which location.\n *\n * @param {Object} metaBoxesPerLocation Meta boxes per location.\n */\nexport const setAvailableMetaBoxesPerLocation = ( metaBoxesPerLocation ) => ( {\n\tdispatch,\n} ) =>\n\tdispatch( {\n\t\ttype: 'SET_META_BOXES_PER_LOCATIONS',\n\t\tmetaBoxesPerLocation,\n\t} );\n\n/**\n * Update a metabox.\n */\nexport const requestMetaBoxUpdates = () => async ( {\n\tregistry,\n\tselect,\n\tdispatch,\n} ) => {\n\tdispatch( {\n\t\ttype: 'REQUEST_META_BOX_UPDATES',\n\t} );\n\n\t// Saves the wp_editor fields.\n\tif ( window.tinyMCE ) {\n\t\twindow.tinyMCE.triggerSave();\n\t}\n\n\t// Additional data needed for backward compatibility.\n\t// If we do not provide this data, the post will be overridden with the default values.\n\tconst post = registry.select( editorStore ).getCurrentPost();\n\tconst additionalData = [\n\t\tpost.comment_status ? [ 'comment_status', post.comment_status ] : false,\n\t\tpost.ping_status ? [ 'ping_status', post.ping_status ] : false,\n\t\tpost.sticky ? [ 'sticky', post.sticky ] : false,\n\t\tpost.author ? [ 'post_author', post.author ] : false,\n\t].filter( Boolean );\n\n\t// We gather all the metaboxes locations data and the base form data.\n\tconst baseFormData = new window.FormData(\n\t\tdocument.querySelector( '.metabox-base-form' )\n\t);\n\tconst activeMetaBoxLocations = select.getActiveMetaBoxLocations();\n\tconst formDataToMerge = [\n\t\tbaseFormData,\n\t\t...activeMetaBoxLocations.map(\n\t\t\t( location ) =>\n\t\t\t\tnew window.FormData( getMetaBoxContainer( location ) )\n\t\t),\n\t];\n\n\t// Merge all form data objects into a single one.\n\tconst formData = reduce(\n\t\tformDataToMerge,\n\t\t( 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},\n\t\tnew window.FormData()\n\t);\n\tadditionalData.forEach( ( [ key, value ] ) =>\n\t\tformData.append( key, value )\n\t);\n\n\ttry {\n\t\t// Save the metaboxes.\n\t\tawait apiFetch( {\n\t\t\turl: window._wpMetaBoxUrl,\n\t\t\tmethod: 'POST',\n\t\t\tbody: formData,\n\t\t\tparse: false,\n\t\t} );\n\t\tdispatch.metaBoxUpdatesSuccess();\n\t} catch {\n\t\tdispatch.metaBoxUpdatesFailure();\n\t}\n};\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 function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\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 = ( newTemplate = false ) => ( {\n\tregistry,\n\tselect,\n\tdispatch,\n} ) => {\n\tdispatch( setIsEditingTemplate( true ) );\n\tconst isWelcomeGuideActive = select.isFeatureActive(\n\t\t'welcomeGuideTemplate'\n\t);\n\tif ( ! isWelcomeGuideActive ) {\n\t\tconst message = newTemplate\n\t\t\t? __( \"Custom template created. You're in template mode now.\" )\n\t\t\t: __(\n\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t );\n\t\tregistry.dispatch( noticesStore ).createSuccessNotice( message, {\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t}\n};\n\n/**\n * Create a block based template.\n *\n * @param {Object?} template Template to create and assign.\n */\nexport const __unstableCreateTemplate = ( template ) => async ( {\n\tregistry,\n} ) => {\n\tconst savedTemplate = await registry\n\t\t.dispatch( coreStore )\n\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\tconst post = registry.select( editorStore ).getCurrentPost();\n\tregistry\n\t\t.dispatch( coreStore )\n\t\t.editEntityRecord( 'postType', post.type, post.id, {\n\t\t\ttemplate: savedTemplate.slug,\n\t\t} );\n};\n\nlet metaBoxesInitialized = false;\n\n/**\n * Initializes WordPress `postboxes` script and the logic for saving meta boxes.\n */\nexport const initializeMetaBoxes = () => ( { registry, select, dispatch } ) => {\n\tconst isEditorReady = registry\n\t\t.select( editorStore )\n\t\t.__unstableIsEditorReady();\n\n\tif ( ! isEditorReady ) {\n\t\treturn;\n\t}\n\t// Only initialize once.\n\tif ( metaBoxesInitialized ) {\n\t\treturn;\n\t}\n\tconst postType = registry.select( editorStore ).getCurrentPostType();\n\tif ( window.postboxes.page !== postType ) {\n\t\twindow.postboxes.add_postbox_toggles( postType );\n\t}\n\n\tmetaBoxesInitialized = true;\n\n\tlet wasSavingPost = registry.select( editorStore ).isSavingPost();\n\tlet wasAutosavingPost = registry.select( editorStore ).isAutosavingPost();\n\tconst hasMetaBoxes = select.hasMetaBoxes();\n\n\t// Save metaboxes when performing a full save on the post.\n\tregistry.subscribe( async () => {\n\t\tconst isSavingPost = registry.select( editorStore ).isSavingPost();\n\t\tconst isAutosavingPost = registry\n\t\t\t.select( editorStore )\n\t\t\t.isAutosavingPost();\n\n\t\t// Save metaboxes on save completion, except for autosaves that are not a post preview.\n\t\t//\n\t\t// Meta boxes are initialized once at page load. It is not necessary to\n\t\t// account for updates on each state change.\n\t\t//\n\t\t// See: https://github.com/WordPress/WordPress/blob/5.1.1/wp-admin/includes/post.php#L2307-L2309.\n\t\tconst shouldTriggerMetaboxesSave =\n\t\t\thasMetaBoxes &&\n\t\t\twasSavingPost &&\n\t\t\t! isSavingPost &&\n\t\t\t! wasAutosavingPost;\n\n\t\t// Save current state for next inspection.\n\t\twasSavingPost = isSavingPost;\n\t\twasAutosavingPost = isAutosavingPost;\n\n\t\tif ( shouldTriggerMetaboxesSave ) {\n\t\t\tawait dispatch.requestMetaBoxUpdates();\n\t\t}\n\t} );\n\n\tdispatch( {\n\t\ttype: 'META_BOXES_INITIALIZED',\n\t} );\n};\n"]}
@@ -9,8 +9,6 @@ exports.store = void 0;
9
9
 
10
10
  var _data = require("@wordpress/data");
11
11
 
12
- var _dataControls = require("@wordpress/data-controls");
13
-
14
12
  var _reducer = _interopRequireDefault(require("./reducer"));
15
13
 
16
14
  var actions = _interopRequireWildcard(require("./actions"));
@@ -34,7 +32,6 @@ const storeConfig = {
34
32
  reducer: _reducer.default,
35
33
  actions,
36
34
  selectors,
37
- controls: _dataControls.controls,
38
35
  persist: ['preferences']
39
36
  };
40
37
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/store/index.js"],"names":["storeConfig","reducer","actions","selectors","controls","persist","store","STORE_NAME"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;;;;;AAZA;AACA;AACA;;AAIA;AACA;AACA;AAMA,MAAMA,WAAW,GAAG;AACnBC,EAAAA,OAAO,EAAPA,gBADmB;AAEnBC,EAAAA,OAFmB;AAGnBC,EAAAA,SAHmB;AAInBC,EAAAA,QAAQ,EAARA,sBAJmB;AAKnBC,EAAAA,OAAO,EAAE,CAAE,aAAF;AALU,CAApB;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,MAAMC,KAAK,GAAG,4BAAkBC,qBAAlB,EAA8BP,WAA9B,CAAd,C,CAEP;;;AACA,yBAAeO,qBAAf,EAA2BP,WAA3B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, registerStore } from '@wordpress/data';\nimport { controls } from '@wordpress/data-controls';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\nimport { STORE_NAME } from './constants';\n\nconst storeConfig = {\n\treducer,\n\tactions,\n\tselectors,\n\tcontrols,\n\tpersist: [ 'preferences' ],\n};\n\n/**\n * Store definition for the edit post namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, storeConfig );\n\n// Ideally we use register instead of register store.\nregisterStore( STORE_NAME, storeConfig );\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/store/index.js"],"names":["storeConfig","reducer","actions","selectors","persist","store","STORE_NAME"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;;;;;AAXA;AACA;AACA;;AAGA;AACA;AACA;AAMA,MAAMA,WAAW,GAAG;AACnBC,EAAAA,OAAO,EAAPA,gBADmB;AAEnBC,EAAAA,OAFmB;AAGnBC,EAAAA,SAHmB;AAInBC,EAAAA,OAAO,EAAE,CAAE,aAAF;AAJU,CAApB;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,MAAMC,KAAK,GAAG,4BAAkBC,qBAAlB,EAA8BN,WAA9B,CAAd,C,CAEP;;;AACA,yBAAeM,qBAAf,EAA2BN,WAA3B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, registerStore } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\nimport { STORE_NAME } from './constants';\n\nconst storeConfig = {\n\treducer,\n\tactions,\n\tselectors,\n\tpersist: [ 'preferences' ],\n};\n\n/**\n * Store definition for the edit post namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, storeConfig );\n\n// Ideally we use register instead of register store.\nregisterStore( STORE_NAME, storeConfig );\n"]}
@@ -108,18 +108,6 @@ const preferences = (0, _lodash.flow)([_data.combineReducers, createWithInitialS
108
108
  return state;
109
109
  },
110
110
 
111
- hiddenBlockTypes(state, action) {
112
- switch (action.type) {
113
- case 'SHOW_BLOCK_TYPES':
114
- return (0, _lodash.without)(state, ...action.blockNames);
115
-
116
- case 'HIDE_BLOCK_TYPES':
117
- return (0, _lodash.union)(state, action.blockNames);
118
- }
119
-
120
- return state;
121
- },
122
-
123
111
  preferredStyleVariations(state, action) {
124
112
  switch (action.type) {
125
113
  case 'UPDATE_PREFERRED_STYLE_VARIATIONS':