@wordpress/edit-post 6.1.0 → 6.3.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 (68) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/header/plugin-more-menu-item/index.js +5 -0
  3. package/build/components/header/plugin-more-menu-item/index.js.map +1 -1
  4. package/build/components/header/template-title/delete-template.js +3 -1
  5. package/build/components/header/template-title/delete-template.js.map +1 -1
  6. package/build/components/sidebar/post-link/index.js +1 -1
  7. package/build/components/sidebar/post-link/index.js.map +1 -1
  8. package/build/components/visual-editor/index.js +3 -3
  9. package/build/components/visual-editor/index.js.map +1 -1
  10. package/build/editor.js +4 -6
  11. package/build/editor.js.map +1 -1
  12. package/build/index.js +5 -0
  13. package/build/index.js.map +1 -1
  14. package/build/index.native.js +15 -0
  15. package/build/index.native.js.map +1 -1
  16. package/build/store/actions.js +99 -74
  17. package/build/store/actions.js.map +1 -1
  18. package/build/store/index.js +7 -10
  19. package/build/store/index.js.map +1 -1
  20. package/build/store/reducer.js +0 -118
  21. package/build/store/reducer.js.map +1 -1
  22. package/build/store/selectors.js +95 -34
  23. package/build/store/selectors.js.map +1 -1
  24. package/build-module/components/header/plugin-more-menu-item/index.js +4 -0
  25. package/build-module/components/header/plugin-more-menu-item/index.js.map +1 -1
  26. package/build-module/components/header/template-title/delete-template.js +3 -1
  27. package/build-module/components/header/template-title/delete-template.js.map +1 -1
  28. package/build-module/components/sidebar/post-link/index.js +1 -1
  29. package/build-module/components/sidebar/post-link/index.js.map +1 -1
  30. package/build-module/components/visual-editor/index.js +3 -3
  31. package/build-module/components/visual-editor/index.js.map +1 -1
  32. package/build-module/editor.js +3 -6
  33. package/build-module/editor.js.map +1 -1
  34. package/build-module/index.js +5 -0
  35. package/build-module/index.js.map +1 -1
  36. package/build-module/index.native.js +13 -0
  37. package/build-module/index.native.js.map +1 -1
  38. package/build-module/store/actions.js +92 -68
  39. package/build-module/store/actions.js.map +1 -1
  40. package/build-module/store/index.js +7 -10
  41. package/build-module/store/index.js.map +1 -1
  42. package/build-module/store/reducer.js +1 -115
  43. package/build-module/store/reducer.js.map +1 -1
  44. package/build-module/store/selectors.js +89 -28
  45. package/build-module/store/selectors.js.map +1 -1
  46. package/build-style/style-rtl.css +1 -4
  47. package/build-style/style.css +1 -4
  48. package/package.json +27 -26
  49. package/src/components/header/plugin-more-menu-item/index.js +2 -0
  50. package/src/components/header/template-title/delete-template.js +3 -1
  51. package/src/components/sidebar/post-link/index.js +1 -1
  52. package/src/components/visual-editor/index.js +5 -3
  53. package/src/editor.js +3 -8
  54. package/src/index.js +5 -0
  55. package/src/index.native.js +14 -0
  56. package/src/store/actions.js +87 -42
  57. package/src/store/index.js +7 -11
  58. package/src/store/reducer.js +1 -106
  59. package/src/store/selectors.js +124 -50
  60. package/src/store/test/actions.js +89 -46
  61. package/src/store/test/reducer.js +0 -135
  62. package/src/store/test/selectors.js +0 -174
  63. package/src/style.scss +0 -4
  64. package/build/store/defaults.js +0 -19
  65. package/build/store/defaults.js.map +0 -1
  66. package/build-module/store/defaults.js +0 -12
  67. package/build-module/store/defaults.js.map +0 -1
  68. package/src/store/defaults.js +0 -11
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.__experimentalSetPreviewDeviceType = __experimentalSetPreviewDeviceType;
9
- exports.__experimentalUpdateLocalAutosaveInterval = __experimentalUpdateLocalAutosaveInterval;
10
9
  exports.closeGeneralSidebar = exports.__unstableSwitchToTemplateMode = exports.__unstableCreateTemplate = void 0;
11
10
  exports.closeModal = closeModal;
12
11
  exports.closePublishSidebar = closePublishSidebar;
@@ -21,12 +20,9 @@ exports.setAvailableMetaBoxesPerLocation = exports.requestMetaBoxUpdates = void
21
20
  exports.setIsEditingTemplate = setIsEditingTemplate;
22
21
  exports.setIsInserterOpened = setIsInserterOpened;
23
22
  exports.setIsListViewOpened = setIsListViewOpened;
24
- exports.switchEditorMode = exports.showBlockTypes = void 0;
25
- exports.toggleEditorPanelEnabled = toggleEditorPanelEnabled;
26
- exports.toggleEditorPanelOpened = toggleEditorPanelOpened;
27
- exports.togglePinnedPluginItem = exports.toggleFeature = void 0;
23
+ exports.togglePinnedPluginItem = exports.toggleFeature = exports.toggleEditorPanelOpened = exports.toggleEditorPanelEnabled = exports.switchEditorMode = exports.showBlockTypes = void 0;
28
24
  exports.togglePublishSidebar = togglePublishSidebar;
29
- exports.updatePreferredStyleVariations = updatePreferredStyleVariations;
25
+ exports.updatePreferredStyleVariations = void 0;
30
26
 
31
27
  var _lodash = require("lodash");
32
28
 
@@ -164,27 +160,55 @@ function togglePublishSidebar() {
164
160
  */
165
161
 
166
162
 
167
- function toggleEditorPanelEnabled(panelName) {
168
- return {
169
- type: 'TOGGLE_PANEL_ENABLED',
170
- panelName
171
- };
172
- }
163
+ const toggleEditorPanelEnabled = panelName => _ref3 => {
164
+ var _registry$select$get;
165
+
166
+ let {
167
+ registry
168
+ } = _ref3;
169
+ const inactivePanels = (_registry$select$get = registry.select(_preferences.store).get('core/edit-post', 'inactivePanels')) !== null && _registry$select$get !== void 0 ? _registry$select$get : [];
170
+ const isPanelInactive = !!(inactivePanels !== null && inactivePanels !== void 0 && inactivePanels.includes(panelName)); // If the panel is inactive, remove it to enable it, else add it to
171
+ // make it inactive.
172
+
173
+ let updatedInactivePanels;
174
+
175
+ if (isPanelInactive) {
176
+ updatedInactivePanels = inactivePanels.filter(invactivePanelName => invactivePanelName !== panelName);
177
+ } else {
178
+ updatedInactivePanels = [...inactivePanels, panelName];
179
+ }
180
+
181
+ registry.dispatch(_preferences.store).set('core/edit-post', 'inactivePanels', updatedInactivePanels);
182
+ };
173
183
  /**
174
- * Returns an action object used to open or close a panel in the editor.
184
+ * Opens a closed panel and closes an open panel.
175
185
  *
176
186
  * @param {string} panelName A string that identifies the panel to open or close.
177
- *
178
- * @return {Object} Action object.
179
187
  */
180
188
 
181
189
 
182
- function toggleEditorPanelOpened(panelName) {
183
- return {
184
- type: 'TOGGLE_PANEL_OPENED',
185
- panelName
186
- };
187
- }
190
+ exports.toggleEditorPanelEnabled = toggleEditorPanelEnabled;
191
+
192
+ const toggleEditorPanelOpened = panelName => _ref4 => {
193
+ var _registry$select$get2;
194
+
195
+ let {
196
+ registry
197
+ } = _ref4;
198
+ const openPanels = (_registry$select$get2 = registry.select(_preferences.store).get('core/edit-post', 'openPanels')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : [];
199
+ const isPanelOpen = !!(openPanels !== null && openPanels !== void 0 && openPanels.includes(panelName)); // If the panel is open, remove it to close it, else add it to
200
+ // make it open.
201
+
202
+ let updatedOpenPanels;
203
+
204
+ if (isPanelOpen) {
205
+ updatedOpenPanels = openPanels.filter(openPanelName => openPanelName !== panelName);
206
+ } else {
207
+ updatedOpenPanels = [...openPanels, panelName];
208
+ }
209
+
210
+ registry.dispatch(_preferences.store).set('core/edit-post', 'openPanels', updatedOpenPanels);
211
+ };
188
212
  /**
189
213
  * Returns an action object used to remove a panel from the editor.
190
214
  *
@@ -194,6 +218,8 @@ function toggleEditorPanelOpened(panelName) {
194
218
  */
195
219
 
196
220
 
221
+ exports.toggleEditorPanelOpened = toggleEditorPanelOpened;
222
+
197
223
  function removeEditorPanel(panelName) {
198
224
  return {
199
225
  type: 'REMOVE_PANEL',
@@ -207,10 +233,10 @@ function removeEditorPanel(panelName) {
207
233
  */
208
234
 
209
235
 
210
- const toggleFeature = feature => _ref3 => {
236
+ const toggleFeature = feature => _ref5 => {
211
237
  let {
212
238
  registry
213
- } = _ref3;
239
+ } = _ref5;
214
240
  return registry.dispatch(_preferences.store).toggle('core/edit-post', feature);
215
241
  };
216
242
  /**
@@ -222,15 +248,11 @@ const toggleFeature = feature => _ref3 => {
222
248
 
223
249
  exports.toggleFeature = toggleFeature;
224
250
 
225
- const switchEditorMode = mode => _ref4 => {
251
+ const switchEditorMode = mode => _ref6 => {
226
252
  let {
227
- dispatch,
228
253
  registry
229
- } = _ref4;
230
- dispatch({
231
- type: 'SWITCH_MODE',
232
- mode
233
- }); // Unselect blocks when we switch to the code editor.
254
+ } = _ref6;
255
+ registry.dispatch(_preferences.store).set('core/edit-post', 'editorMode', mode); // Unselect blocks when we switch to the code editor.
234
256
 
235
257
  if (mode !== 'visual') {
236
258
  registry.dispatch(_blockEditor.store).clearSelectedBlock();
@@ -248,10 +270,10 @@ const switchEditorMode = mode => _ref4 => {
248
270
 
249
271
  exports.switchEditorMode = switchEditorMode;
250
272
 
251
- const togglePinnedPluginItem = pluginName => _ref5 => {
273
+ const togglePinnedPluginItem = pluginName => _ref7 => {
252
274
  let {
253
275
  registry
254
- } = _ref5;
276
+ } = _ref7;
255
277
  const isPinned = registry.select(_interface.store).isItemPinned('core/edit-post', pluginName);
256
278
  registry.dispatch(_interface.store)[isPinned ? 'unpinItem' : 'pinItem']('core/edit-post', pluginName);
257
279
  };
@@ -260,35 +282,36 @@ const togglePinnedPluginItem = pluginName => _ref5 => {
260
282
  *
261
283
  * @param {string} blockName Name of the block.
262
284
  * @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the "auto apply" setting of the block is removed.
263
- *
264
- * @return {Object} Action object.
265
285
  */
266
286
 
267
287
 
268
288
  exports.togglePinnedPluginItem = togglePinnedPluginItem;
269
289
 
270
- function updatePreferredStyleVariations(blockName, blockStyle) {
271
- return {
272
- type: 'UPDATE_PREFERRED_STYLE_VARIATIONS',
273
- blockName,
274
- blockStyle
275
- };
276
- }
277
- /**
278
- * Returns an action object used in signalling that the editor should attempt
279
- * to locally autosave the current post every `interval` seconds.
280
- *
281
- * @param {number} interval The new interval, in seconds.
282
- * @return {Object} Action object.
283
- */
290
+ const updatePreferredStyleVariations = (blockName, blockStyle) => _ref8 => {
291
+ var _registry$select$get3;
284
292
 
293
+ let {
294
+ registry
295
+ } = _ref8;
285
296
 
286
- function __experimentalUpdateLocalAutosaveInterval(interval) {
287
- return {
288
- type: 'UPDATE_LOCAL_AUTOSAVE_INTERVAL',
289
- interval
290
- };
291
- }
297
+ if (!blockName) {
298
+ return;
299
+ }
300
+
301
+ const existingVariations = (_registry$select$get3 = registry.select(_preferences.store).get('core/edit-post', 'preferredStyleVariations')) !== null && _registry$select$get3 !== void 0 ? _registry$select$get3 : {}; // When the blockStyle is omitted, remove the block's preferred variation.
302
+
303
+ if (!blockStyle) {
304
+ const updatedVariations = { ...existingVariations
305
+ };
306
+ delete updatedVariations[blockName];
307
+ registry.dispatch(_preferences.store).set('core/edit-post', 'preferredStyleVariations', updatedVariations);
308
+ } else {
309
+ // Else add the variation.
310
+ registry.dispatch(_preferences.store).set('core/edit-post', 'preferredStyleVariations', { ...existingVariations,
311
+ [blockName]: blockStyle
312
+ });
313
+ }
314
+ };
292
315
  /**
293
316
  * Update the provided block types to be visible.
294
317
  *
@@ -296,13 +319,15 @@ function __experimentalUpdateLocalAutosaveInterval(interval) {
296
319
  */
297
320
 
298
321
 
299
- const showBlockTypes = blockNames => _ref6 => {
300
- var _registry$select$get;
322
+ exports.updatePreferredStyleVariations = updatePreferredStyleVariations;
323
+
324
+ const showBlockTypes = blockNames => _ref9 => {
325
+ var _registry$select$get4;
301
326
 
302
327
  let {
303
328
  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 : [];
329
+ } = _ref9;
330
+ const existingBlockNames = (_registry$select$get4 = registry.select(_preferences.store).get('core/edit-post', 'hiddenBlockTypes')) !== null && _registry$select$get4 !== void 0 ? _registry$select$get4 : [];
306
331
  const newBlockNames = (0, _lodash.without)(existingBlockNames, ...(0, _lodash.castArray)(blockNames));
307
332
  registry.dispatch(_preferences.store).set('core/edit-post', 'hiddenBlockTypes', newBlockNames);
308
333
  };
@@ -315,13 +340,13 @@ const showBlockTypes = blockNames => _ref6 => {
315
340
 
316
341
  exports.showBlockTypes = showBlockTypes;
317
342
 
318
- const hideBlockTypes = blockNames => _ref7 => {
319
- var _registry$select$get2;
343
+ const hideBlockTypes = blockNames => _ref10 => {
344
+ var _registry$select$get5;
320
345
 
321
346
  let {
322
347
  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 : [];
348
+ } = _ref10;
349
+ const existingBlockNames = (_registry$select$get5 = registry.select(_preferences.store).get('core/edit-post', 'hiddenBlockTypes')) !== null && _registry$select$get5 !== void 0 ? _registry$select$get5 : [];
325
350
  const mergedBlockNames = new Set([...existingBlockNames, ...(0, _lodash.castArray)(blockNames)]);
326
351
  registry.dispatch(_preferences.store).set('core/edit-post', 'hiddenBlockTypes', [...mergedBlockNames]);
327
352
  };
@@ -335,10 +360,10 @@ const hideBlockTypes = blockNames => _ref7 => {
335
360
 
336
361
  exports.hideBlockTypes = hideBlockTypes;
337
362
 
338
- const setAvailableMetaBoxesPerLocation = metaBoxesPerLocation => _ref8 => {
363
+ const setAvailableMetaBoxesPerLocation = metaBoxesPerLocation => _ref11 => {
339
364
  let {
340
365
  dispatch
341
- } = _ref8;
366
+ } = _ref11;
342
367
  return dispatch({
343
368
  type: 'SET_META_BOXES_PER_LOCATIONS',
344
369
  metaBoxesPerLocation
@@ -351,12 +376,12 @@ const setAvailableMetaBoxesPerLocation = metaBoxesPerLocation => _ref8 => {
351
376
 
352
377
  exports.setAvailableMetaBoxesPerLocation = setAvailableMetaBoxesPerLocation;
353
378
 
354
- const requestMetaBoxUpdates = () => async _ref9 => {
379
+ const requestMetaBoxUpdates = () => async _ref12 => {
355
380
  let {
356
381
  registry,
357
382
  select,
358
383
  dispatch
359
- } = _ref9;
384
+ } = _ref12;
360
385
  dispatch({
361
386
  type: 'REQUEST_META_BOX_UPDATES'
362
387
  }); // Saves the wp_editor fields.
@@ -381,8 +406,8 @@ const requestMetaBoxUpdates = () => async _ref9 => {
381
406
 
382
407
  return memo;
383
408
  }, new window.FormData());
384
- additionalData.forEach(_ref10 => {
385
- let [key, value] = _ref10;
409
+ additionalData.forEach(_ref13 => {
410
+ let [key, value] = _ref13;
386
411
  return formData.append(key, value);
387
412
  });
388
413
 
@@ -497,12 +522,12 @@ function setIsEditingTemplate(value) {
497
522
 
498
523
  const __unstableSwitchToTemplateMode = function () {
499
524
  let newTemplate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
500
- return _ref11 => {
525
+ return _ref14 => {
501
526
  let {
502
527
  registry,
503
528
  select,
504
529
  dispatch
505
- } = _ref11;
530
+ } = _ref14;
506
531
  dispatch(setIsEditingTemplate(true));
507
532
  const isWelcomeGuideActive = select.isFeatureActive('welcomeGuideTemplate');
508
533
 
@@ -523,10 +548,10 @@ const __unstableSwitchToTemplateMode = function () {
523
548
 
524
549
  exports.__unstableSwitchToTemplateMode = __unstableSwitchToTemplateMode;
525
550
 
526
- const __unstableCreateTemplate = template => async _ref12 => {
551
+ const __unstableCreateTemplate = template => async _ref15 => {
527
552
  let {
528
553
  registry
529
- } = _ref12;
554
+ } = _ref15;
530
555
  const savedTemplate = await registry.dispatch(_coreData.store).saveEntityRecord('postType', 'wp_template', template);
531
556
  const post = registry.select(_editor.store).getCurrentPost();
532
557
  registry.dispatch(_coreData.store).editEntityRecord('postType', post.type, post.id, {
@@ -540,12 +565,12 @@ let metaBoxesInitialized = false;
540
565
  * Initializes WordPress `postboxes` script and the logic for saving meta boxes.
541
566
  */
542
567
 
543
- const initializeMetaBoxes = () => _ref13 => {
568
+ const initializeMetaBoxes = () => _ref16 => {
544
569
  let {
545
570
  registry,
546
571
  select,
547
572
  dispatch
548
- } = _ref13;
573
+ } = _ref16;
549
574
 
550
575
  const isEditorReady = registry.select(_editor.store).__unstableIsEditorReady();
551
576
 
@@ -1 +1 @@
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,IAAF,IAAY;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA,SAC7CA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B,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"]}
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","inactivePanels","select","preferencesStore","get","isPanelInactive","includes","updatedInactivePanels","filter","invactivePanelName","set","toggleEditorPanelOpened","openPanels","isPanelOpen","updatedOpenPanels","openPanelName","removeEditorPanel","toggleFeature","feature","toggle","switchEditorMode","mode","blockEditorStore","clearSelectedBlock","message","togglePinnedPluginItem","pluginName","isPinned","isItemPinned","updatePreferredStyleVariations","blockName","blockStyle","existingVariations","updatedVariations","showBlockTypes","blockNames","existingBlockNames","newBlockNames","hideBlockTypes","mergedBlockNames","Set","setAvailableMetaBoxesPerLocation","metaBoxesPerLocation","requestMetaBoxUpdates","window","tinyMCE","triggerSave","post","editorStore","getCurrentPost","additionalData","comment_status","ping_status","sticky","author","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,IAAF,IAAY;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA,SAC7CA,QAAQ,CACNC,QADF,CACYC,gBADZ,EAEEC,uBAFF,CAE2BC,QAAcL,IAFzC,EAE+CA,IAF/C,CAD6C;AAAA,CAAvC;AAKP;AACA;AACA;;;;;AACO,MAAMM,mBAAmB,GAAG,MAAM;AAAA,MAAE;AAAEL,IAAAA;AAAF,GAAF;AAAA,SACxCA,QAAQ,CACNC,QADF,CACYC,gBADZ,EAEEI,wBAFF,CAE4BF,QAAcL,IAF1C,CADwC;AAAA,CAAlC;AAKP;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,SAASQ,SAAT,CAAoBR,IAApB,EAA2B;AACjC,SAAO;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,IAAvB;AAEA,MAAIS,aAAa,GAAG1H,QAAQ,CAACgB,MAAT,CAAiB8C,aAAjB,EAA+B6D,YAA/B,EAApB;AACA,MAAIC,iBAAiB,GAAG5H,QAAQ,CAACgB,MAAT,CAAiB8C,aAAjB,EAA+B+D,gBAA/B,EAAxB;AACA,QAAMC,YAAY,GAAG9G,MAAM,CAAC8G,YAAP,EAArB,CArB8E,CAuB9E;;AACA9H,EAAAA,QAAQ,CAAC+H,SAAT,CAAoB,YAAY;AAC/B,UAAMJ,YAAY,GAAG3H,QAAQ,CAACgB,MAAT,CAAiB8C,aAAjB,EAA+B6D,YAA/B,EAArB;AACA,UAAME,gBAAgB,GAAG7H,QAAQ,CAC/BgB,MADuB,CACf8C,aADe,EAEvB+D,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,YAAM/H,QAAQ,CAACwD,qBAAT,EAAN;AACA;AACD,GAzBD;AA2BAxD,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 const toggleEditorPanelEnabled = ( panelName ) => ( { registry } ) => {\n\tconst inactivePanels =\n\t\tregistry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-post', 'inactivePanels' ) ?? [];\n\n\tconst isPanelInactive = !! inactivePanels?.includes( panelName );\n\n\t// If the panel is inactive, remove it to enable it, else add it to\n\t// make it inactive.\n\tlet updatedInactivePanels;\n\tif ( isPanelInactive ) {\n\t\tupdatedInactivePanels = inactivePanels.filter(\n\t\t\t( invactivePanelName ) => invactivePanelName !== panelName\n\t\t);\n\t} else {\n\t\tupdatedInactivePanels = [ ...inactivePanels, panelName ];\n\t}\n\n\tregistry\n\t\t.dispatch( preferencesStore )\n\t\t.set( 'core/edit-post', 'inactivePanels', updatedInactivePanels );\n};\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 = ( panelName ) => ( { registry } ) => {\n\tconst openPanels =\n\t\tregistry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-post', 'openPanels' ) ?? [];\n\n\tconst isPanelOpen = !! openPanels?.includes( panelName );\n\n\t// If the panel is open, remove it to close it, else add it to\n\t// make it open.\n\tlet updatedOpenPanels;\n\tif ( isPanelOpen ) {\n\t\tupdatedOpenPanels = openPanels.filter(\n\t\t\t( openPanelName ) => openPanelName !== panelName\n\t\t);\n\t} else {\n\t\tupdatedOpenPanels = [ ...openPanels, panelName ];\n\t}\n\n\tregistry\n\t\t.dispatch( preferencesStore )\n\t\t.set( 'core/edit-post', 'openPanels', updatedOpenPanels );\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 ) => ( { registry } ) => {\n\tregistry\n\t\t.dispatch( preferencesStore )\n\t\t.set( 'core/edit-post', 'editorMode', mode );\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 */\nexport const updatePreferredStyleVariations = ( blockName, blockStyle ) => ( {\n\tregistry,\n} ) => {\n\tif ( ! blockName ) {\n\t\treturn;\n\t}\n\n\tconst existingVariations =\n\t\tregistry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-post', 'preferredStyleVariations' ) ?? {};\n\n\t// When the blockStyle is omitted, remove the block's preferred variation.\n\tif ( ! blockStyle ) {\n\t\tconst updatedVariations = {\n\t\t\t...existingVariations,\n\t\t};\n\n\t\tdelete updatedVariations[ blockName ];\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set(\n\t\t\t\t'core/edit-post',\n\t\t\t\t'preferredStyleVariations',\n\t\t\t\tupdatedVariations\n\t\t\t);\n\t} else {\n\t\t// Else add the variation.\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core/edit-post', 'preferredStyleVariations', {\n\t\t\t\t...existingVariations,\n\t\t\t\t[ blockName ]: blockStyle,\n\t\t\t} );\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"]}
@@ -28,12 +28,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
28
28
  /**
29
29
  * Internal dependencies
30
30
  */
31
- const storeConfig = {
32
- reducer: _reducer.default,
33
- actions,
34
- selectors,
35
- persist: ['preferences']
36
- };
31
+
37
32
  /**
38
33
  * Store definition for the edit post namespace.
39
34
  *
@@ -41,9 +36,11 @@ const storeConfig = {
41
36
  *
42
37
  * @type {Object}
43
38
  */
44
-
45
- const store = (0, _data.createReduxStore)(_constants.STORE_NAME, storeConfig); // Ideally we use register instead of register store.
46
-
39
+ const store = (0, _data.createReduxStore)(_constants.STORE_NAME, {
40
+ reducer: _reducer.default,
41
+ actions,
42
+ selectors
43
+ });
47
44
  exports.store = store;
48
- (0, _data.registerStore)(_constants.STORE_NAME, storeConfig);
45
+ (0, _data.register)(store);
49
46
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/store/index.js"],"names":["store","STORE_NAME","reducer","actions","selectors"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;;;;;AAXA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,KAAK,GAAG,4BAAkBC,qBAAlB,EAA8B;AAClDC,EAAAA,OAAO,EAAPA,gBADkD;AAElDC,EAAAA,OAFkD;AAGlDC,EAAAA;AAHkD,CAA9B,CAAd;;AAMP,oBAAUJ,KAAV","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\nimport { STORE_NAME } from './constants';\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, {\n\treducer,\n\tactions,\n\tselectors,\n} );\n\nregister( store );\n"]}
@@ -10,7 +10,6 @@ exports.deviceType = deviceType;
10
10
  exports.isSavingMetaBoxes = isSavingMetaBoxes;
11
11
  exports.listViewPanel = listViewPanel;
12
12
  exports.metaBoxLocations = metaBoxLocations;
13
- exports.preferences = void 0;
14
13
  exports.publishSidebarActive = publishSidebarActive;
15
14
  exports.removedPanels = removedPanels;
16
15
 
@@ -18,8 +17,6 @@ var _lodash = require("lodash");
18
17
 
19
18
  var _data = require("@wordpress/data");
20
19
 
21
- var _defaults = require("./defaults");
22
-
23
20
  /**
24
21
  * External dependencies
25
22
  */
@@ -28,117 +25,6 @@ var _defaults = require("./defaults");
28
25
  * WordPress dependencies
29
26
  */
30
27
 
31
- /**
32
- * Internal dependencies
33
- */
34
-
35
- /**
36
- * Higher-order reducer creator which provides the given initial state for the
37
- * original reducer.
38
- *
39
- * @param {*} initialState Initial state to provide to reducer.
40
- *
41
- * @return {Function} Higher-order reducer.
42
- */
43
- const createWithInitialState = initialState => reducer => {
44
- return function () {
45
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
46
- let action = arguments.length > 1 ? arguments[1] : undefined;
47
- return reducer(state, action);
48
- };
49
- };
50
- /**
51
- * Reducer returning the user preferences.
52
- *
53
- * @param {Object} state Current state.
54
- * @param {string} state.mode Current editor mode, either
55
- * "visual" or "text".
56
- * @param {boolean} state.isGeneralSidebarDismissed Whether general sidebar is
57
- * dismissed. False by default
58
- * or when closing general
59
- * sidebar, true when opening
60
- * sidebar.
61
- * @param {boolean} state.isSidebarOpened Whether the sidebar is
62
- * opened or closed.
63
- * @param {Object} state.panels The state of the different
64
- * sidebar panels.
65
- * @param {Object} action Dispatched action.
66
- *
67
- * @return {Object} Updated state.
68
- */
69
-
70
-
71
- const preferences = (0, _lodash.flow)([_data.combineReducers, createWithInitialState(_defaults.PREFERENCES_DEFAULTS)])({
72
- panels(state, action) {
73
- switch (action.type) {
74
- case 'TOGGLE_PANEL_ENABLED':
75
- {
76
- const {
77
- panelName
78
- } = action;
79
- return { ...state,
80
- [panelName]: { ...state[panelName],
81
- enabled: !(0, _lodash.get)(state, [panelName, 'enabled'], true)
82
- }
83
- };
84
- }
85
-
86
- case 'TOGGLE_PANEL_OPENED':
87
- {
88
- const {
89
- panelName
90
- } = action;
91
- const isOpen = state[panelName] === true || (0, _lodash.get)(state, [panelName, 'opened'], false);
92
- return { ...state,
93
- [panelName]: { ...state[panelName],
94
- opened: !isOpen
95
- }
96
- };
97
- }
98
- }
99
-
100
- return state;
101
- },
102
-
103
- editorMode(state, action) {
104
- if (action.type === 'SWITCH_MODE') {
105
- return action.mode;
106
- }
107
-
108
- return state;
109
- },
110
-
111
- preferredStyleVariations(state, action) {
112
- switch (action.type) {
113
- case 'UPDATE_PREFERRED_STYLE_VARIATIONS':
114
- {
115
- if (!action.blockName) {
116
- return state;
117
- }
118
-
119
- if (!action.blockStyle) {
120
- return (0, _lodash.omit)(state, [action.blockName]);
121
- }
122
-
123
- return { ...state,
124
- [action.blockName]: action.blockStyle
125
- };
126
- }
127
- }
128
-
129
- return state;
130
- },
131
-
132
- localAutosaveInterval(state, action) {
133
- switch (action.type) {
134
- case 'UPDATE_LOCAL_AUTOSAVE_INTERVAL':
135
- return action.interval;
136
- }
137
-
138
- return state;
139
- }
140
-
141
- });
142
28
  /**
143
29
  * Reducer storing the list of all programmatically removed panels.
144
30
  *
@@ -147,9 +33,6 @@ const preferences = (0, _lodash.flow)([_data.combineReducers, createWithInitialS
147
33
  *
148
34
  * @return {Array} Updated state.
149
35
  */
150
-
151
- exports.preferences = preferences;
152
-
153
36
  function removedPanels() {
154
37
  let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
155
38
  let action = arguments.length > 1 ? arguments[1] : undefined;
@@ -376,7 +259,6 @@ const metaBoxes = (0, _data.combineReducers)({
376
259
  var _default = (0, _data.combineReducers)({
377
260
  activeModal,
378
261
  metaBoxes,
379
- preferences,
380
262
  publishSidebarActive,
381
263
  removedPanels,
382
264
  deviceType,