@wordpress/edit-post 6.0.0 → 6.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/build/components/header/fullscreen-mode-close/index.js +11 -4
  2. package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
  3. package/build/components/header/index.js +3 -1
  4. package/build/components/header/index.js.map +1 -1
  5. package/build/components/header/template-title/delete-template.js +29 -20
  6. package/build/components/header/template-title/delete-template.js.map +1 -1
  7. package/build/components/preferences-modal/index.js +4 -41
  8. package/build/components/preferences-modal/index.js.map +1 -1
  9. package/build/components/secondary-sidebar/list-view-sidebar.js +0 -11
  10. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  11. package/build/store/actions.js +135 -87
  12. package/build/store/actions.js.map +1 -1
  13. package/build/store/index.js +0 -3
  14. package/build/store/index.js.map +1 -1
  15. package/build-module/components/header/fullscreen-mode-close/index.js +8 -4
  16. package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
  17. package/build-module/components/header/index.js +3 -1
  18. package/build-module/components/header/index.js.map +1 -1
  19. package/build-module/components/header/template-title/delete-template.js +32 -22
  20. package/build-module/components/header/template-title/delete-template.js.map +1 -1
  21. package/build-module/components/preferences-modal/index.js +5 -42
  22. package/build-module/components/preferences-modal/index.js.map +1 -1
  23. package/build-module/components/secondary-sidebar/list-view-sidebar.js +1 -12
  24. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  25. package/build-module/store/actions.js +107 -75
  26. package/build-module/store/actions.js.map +1 -1
  27. package/build-module/store/index.js +0 -2
  28. package/build-module/store/index.js.map +1 -1
  29. package/build-style/style-rtl.css +14 -9
  30. package/build-style/style.css +14 -9
  31. package/package.json +17 -17
  32. package/src/components/header/fullscreen-mode-close/index.js +9 -4
  33. package/src/components/header/fullscreen-mode-close/style.scss +5 -1
  34. package/src/components/header/index.js +1 -1
  35. package/src/components/header/template-title/delete-template.js +57 -46
  36. package/src/components/preferences-modal/index.js +5 -33
  37. package/src/components/preferences-modal/test/__snapshots__/index.js.snap +9 -9
  38. package/src/components/secondary-sidebar/list-view-sidebar.js +1 -11
  39. package/src/store/actions.js +85 -121
  40. package/src/store/index.js +0 -2
  41. package/src/store/test/actions.js +107 -97
@@ -1,34 +1,32 @@
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
13
  exports.hideBlockTypes = hideBlockTypes;
14
- exports.initializeMetaBoxes = initializeMetaBoxes;
14
+ exports.initializeMetaBoxes = void 0;
15
15
  exports.metaBoxUpdatesFailure = metaBoxUpdatesFailure;
16
16
  exports.metaBoxUpdatesSuccess = metaBoxUpdatesSuccess;
17
- exports.openGeneralSidebar = openGeneralSidebar;
17
+ exports.openGeneralSidebar = void 0;
18
18
  exports.openModal = openModal;
19
19
  exports.openPublishSidebar = openPublishSidebar;
20
20
  exports.removeEditorPanel = removeEditorPanel;
21
- exports.requestMetaBoxUpdates = requestMetaBoxUpdates;
22
- exports.setAvailableMetaBoxesPerLocation = setAvailableMetaBoxesPerLocation;
21
+ exports.setAvailableMetaBoxesPerLocation = exports.requestMetaBoxUpdates = void 0;
23
22
  exports.setIsEditingTemplate = setIsEditingTemplate;
24
23
  exports.setIsInserterOpened = setIsInserterOpened;
25
24
  exports.setIsListViewOpened = setIsListViewOpened;
26
25
  exports.showBlockTypes = showBlockTypes;
27
- exports.switchEditorMode = switchEditorMode;
26
+ exports.switchEditorMode = void 0;
28
27
  exports.toggleEditorPanelEnabled = toggleEditorPanelEnabled;
29
28
  exports.toggleEditorPanelOpened = toggleEditorPanelOpened;
30
- exports.toggleFeature = toggleFeature;
31
- exports.togglePinnedPluginItem = togglePinnedPluginItem;
29
+ exports.togglePinnedPluginItem = exports.toggleFeature = void 0;
32
30
  exports.togglePublishSidebar = togglePublishSidebar;
33
31
  exports.updatePreferredStyleVariations = updatePreferredStyleVariations;
34
32
 
@@ -36,14 +34,12 @@ var _lodash = require("lodash");
36
34
 
37
35
  var _i18n = require("@wordpress/i18n");
38
36
 
39
- var _dataControls = require("@wordpress/data-controls");
40
-
41
- var _interface = require("@wordpress/interface");
42
-
43
- var _data = require("@wordpress/data");
37
+ var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
44
38
 
45
39
  var _a11y = require("@wordpress/a11y");
46
40
 
41
+ var _interface = require("@wordpress/interface");
42
+
47
43
  var _notices = require("@wordpress/notices");
48
44
 
49
45
  var _coreData = require("@wordpress/core-data");
@@ -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,32 @@ 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(_interface.store).toggleFeature('core/edit-post', feature);
215
+ };
216
+
217
+ exports.toggleFeature = toggleFeature;
211
218
 
212
- function* switchEditorMode(mode) {
213
- yield {
219
+ const switchEditorMode = mode => _ref4 => {
220
+ let {
221
+ dispatch,
222
+ registry
223
+ } = _ref4;
224
+ dispatch({
214
225
  type: 'SWITCH_MODE',
215
226
  mode
216
- }; // Unselect blocks when we switch to the code editor.
227
+ }); // Unselect blocks when we switch to the code editor.
217
228
 
218
229
  if (mode !== 'visual') {
219
- yield _data.controls.dispatch(_blockEditor.store, 'clearSelectedBlock');
230
+ registry.dispatch(_blockEditor.store).clearSelectedBlock();
220
231
  }
221
232
 
222
233
  const message = mode === 'visual' ? (0, _i18n.__)('Visual editor selected') : (0, _i18n.__)('Code editor selected');
223
234
  (0, _a11y.speak)(message, 'assertive');
224
- }
235
+ };
225
236
  /**
226
237
  * Triggers an action object used to toggle a plugin name flag.
227
238
  *
@@ -229,10 +240,15 @@ function* switchEditorMode(mode) {
229
240
  */
230
241
 
231
242
 
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
- }
243
+ exports.switchEditorMode = switchEditorMode;
244
+
245
+ const togglePinnedPluginItem = pluginName => _ref5 => {
246
+ let {
247
+ registry
248
+ } = _ref5;
249
+ const isPinned = registry.select(_interface.store).isItemPinned('core/edit-post', pluginName);
250
+ registry.dispatch(_interface.store)[isPinned ? 'unpinItem' : 'pinItem']('core/edit-post', pluginName);
251
+ };
236
252
  /**
237
253
  * Returns an action object used in signalling that block types by the given
238
254
  * name(s) should be hidden.
@@ -243,6 +259,8 @@ function* togglePinnedPluginItem(pluginName) {
243
259
  */
244
260
 
245
261
 
262
+ exports.togglePinnedPluginItem = togglePinnedPluginItem;
263
+
246
264
  function hideBlockTypes(blockNames) {
247
265
  return {
248
266
  type: 'HIDE_BLOCK_TYPES',
@@ -302,28 +320,34 @@ function showBlockTypes(blockNames) {
302
320
  * what Meta boxes are available in which location.
303
321
  *
304
322
  * @param {Object} metaBoxesPerLocation Meta boxes per location.
305
- *
306
- * @yield {Object} Action object.
307
323
  */
308
324
 
309
325
 
310
- function* setAvailableMetaBoxesPerLocation(metaBoxesPerLocation) {
311
- yield {
326
+ const setAvailableMetaBoxesPerLocation = metaBoxesPerLocation => _ref6 => {
327
+ let {
328
+ dispatch
329
+ } = _ref6;
330
+ return dispatch({
312
331
  type: 'SET_META_BOXES_PER_LOCATIONS',
313
332
  metaBoxesPerLocation
314
- };
315
- }
333
+ });
334
+ };
316
335
  /**
317
- * Returns an action object used to request meta box update.
318
- *
319
- * @yield {Object} Action object.
336
+ * Update a metabox.
320
337
  */
321
338
 
322
339
 
323
- function* requestMetaBoxUpdates() {
324
- yield {
340
+ exports.setAvailableMetaBoxesPerLocation = setAvailableMetaBoxesPerLocation;
341
+
342
+ const requestMetaBoxUpdates = () => async _ref7 => {
343
+ let {
344
+ registry,
345
+ select,
346
+ dispatch
347
+ } = _ref7;
348
+ dispatch({
325
349
  type: 'REQUEST_META_BOX_UPDATES'
326
- }; // Saves the wp_editor fields
350
+ }); // Saves the wp_editor fields
327
351
 
328
352
  if (window.tinyMCE) {
329
353
  window.tinyMCE.triggerSave();
@@ -331,11 +355,11 @@ function* requestMetaBoxUpdates() {
331
355
  // If we do not provide this data, the post will be overridden with the default values.
332
356
 
333
357
 
334
- const post = yield _data.controls.select(_editor.store, 'getCurrentPost');
358
+ const post = registry.select(_editor.store).getCurrentPost();
335
359
  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
360
 
337
361
  const baseFormData = new window.FormData(document.querySelector('.metabox-base-form'));
338
- const activeMetaBoxLocations = yield _data.controls.select(_.store, 'getActiveMetaBoxLocations');
362
+ const activeMetaBoxLocations = select.getActiveMetaBoxLocations();
339
363
  const formDataToMerge = [baseFormData, ...activeMetaBoxLocations.map(location => new window.FormData((0, _metaBoxes.getMetaBoxContainer)(location)))]; // Merge all form data objects into a single one.
340
364
 
341
365
  const formData = (0, _lodash.reduce)(formDataToMerge, (memo, currentFormData) => {
@@ -345,24 +369,24 @@ function* requestMetaBoxUpdates() {
345
369
 
346
370
  return memo;
347
371
  }, new window.FormData());
348
- additionalData.forEach(_ref => {
349
- let [key, value] = _ref;
372
+ additionalData.forEach(_ref8 => {
373
+ let [key, value] = _ref8;
350
374
  return formData.append(key, value);
351
375
  });
352
376
 
353
377
  try {
354
378
  // Save the metaboxes
355
- yield (0, _dataControls.apiFetch)({
379
+ await (0, _apiFetch.default)({
356
380
  url: window._wpMetaBoxUrl,
357
381
  method: 'POST',
358
382
  body: formData,
359
383
  parse: false
360
384
  });
361
- yield _data.controls.dispatch(_.store, 'metaBoxUpdatesSuccess');
385
+ dispatch.metaBoxUpdatesSuccess();
362
386
  } catch {
363
- yield _data.controls.dispatch(_.store, 'metaBoxUpdatesFailure');
387
+ dispatch.metaBoxUpdatesFailure();
364
388
  }
365
- }
389
+ };
366
390
  /**
367
391
  * Returns an action object used to signal a successful meta box update.
368
392
  *
@@ -370,6 +394,8 @@ function* requestMetaBoxUpdates() {
370
394
  */
371
395
 
372
396
 
397
+ exports.requestMetaBoxUpdates = requestMetaBoxUpdates;
398
+
373
399
  function metaBoxUpdatesSuccess() {
374
400
  return {
375
401
  type: 'META_BOX_UPDATES_SUCCESS'
@@ -457,18 +483,25 @@ function setIsEditingTemplate(value) {
457
483
  */
458
484
 
459
485
 
460
- function* __unstableSwitchToTemplateMode() {
486
+ const __unstableSwitchToTemplateMode = function () {
461
487
  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
- }
488
+ return _ref9 => {
489
+ let {
490
+ registry,
491
+ select,
492
+ dispatch
493
+ } = _ref9;
494
+ dispatch(setIsEditingTemplate(true));
495
+ const isWelcomeGuideActive = select.isFeatureActive('welcomeGuideTemplate');
496
+
497
+ if (!isWelcomeGuideActive) {
498
+ 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.');
499
+ registry.dispatch(_notices.store).createSuccessNotice(message, {
500
+ type: 'snackbar'
501
+ });
502
+ }
503
+ };
504
+ };
472
505
  /**
473
506
  * Create a block based template.
474
507
  *
@@ -476,44 +509,57 @@ function* __unstableSwitchToTemplateMode() {
476
509
  */
477
510
 
478
511
 
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, {
512
+ exports.__unstableSwitchToTemplateMode = __unstableSwitchToTemplateMode;
513
+
514
+ const __unstableCreateTemplate = template => async _ref10 => {
515
+ let {
516
+ registry
517
+ } = _ref10;
518
+ const savedTemplate = await registry.dispatch(_coreData.store).saveEntityRecord('postType', 'wp_template', template);
519
+ const post = registry.select(_editor.store).getCurrentPost();
520
+ registry.dispatch(_coreData.store).editEntityRecord('postType', post.type, post.id, {
483
521
  template: savedTemplate.slug
484
522
  });
485
- }
523
+ };
486
524
 
525
+ exports.__unstableCreateTemplate = __unstableCreateTemplate;
487
526
  let metaBoxesInitialized = false;
488
527
  /**
489
528
  * Initializes WordPress `postboxes` script and the logic for saving meta boxes.
490
529
  */
491
530
 
492
- function* initializeMetaBoxes() {
493
- const isEditorReady = yield _data.controls.select(_editor.store, '__unstableIsEditorReady');
531
+ const initializeMetaBoxes = () => _ref11 => {
532
+ let {
533
+ registry,
534
+ select,
535
+ dispatch
536
+ } = _ref11;
537
+
538
+ const isEditorReady = registry.select(_editor.store).__unstableIsEditorReady();
494
539
 
495
540
  if (!isEditorReady) {
496
541
  return;
497
- }
542
+ } // Only initialize once.
498
543
 
499
- const postType = yield _data.controls.select(_editor.store, 'getCurrentPostType'); // Only initialize once.
500
544
 
501
545
  if (metaBoxesInitialized) {
502
546
  return;
503
547
  }
504
548
 
549
+ const postType = registry.select(_editor.store).getCurrentPostType();
550
+
505
551
  if (window.postboxes.page !== postType) {
506
552
  window.postboxes.add_postbox_toggles(postType);
507
553
  }
508
554
 
509
555
  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.
556
+ let wasSavingPost = registry.select(_editor.store).isSavingPost();
557
+ let wasAutosavingPost = registry.select(_editor.store).isAutosavingPost();
558
+ const hasMetaBoxes = select.hasMetaBoxes(); // Save metaboxes when performing a full save on the post.
513
559
 
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.
560
+ registry.subscribe(async () => {
561
+ const isSavingPost = registry.select(_editor.store).isSavingPost();
562
+ const isAutosavingPost = registry.select(_editor.store).isAutosavingPost(); // Save metaboxes on save completion, except for autosaves that are not a post preview.
517
563
  //
518
564
  // Meta boxes are initialized once at page load. It is not necessary to
519
565
  // account for updates on each state change.
@@ -526,11 +572,13 @@ function* initializeMetaBoxes() {
526
572
  wasAutosavingPost = isAutosavingPost;
527
573
 
528
574
  if (shouldTriggerMetaboxesSave) {
529
- (0, _data.dispatch)(_.store).requestMetaBoxUpdates();
575
+ await dispatch.requestMetaBoxUpdates();
530
576
  }
531
577
  });
532
- return {
578
+ dispatch({
533
579
  type: 'META_BOXES_INITIALIZED'
534
- };
535
- }
580
+ });
581
+ };
582
+
583
+ exports.initializeMetaBoxes = initializeMetaBoxes;
536
584
  //# 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,GAAP;AAIA;AAED;AACA;AACA;AAC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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","switchEditorMode","mode","blockEditorStore","clearSelectedBlock","message","togglePinnedPluginItem","pluginName","isPinned","select","isItemPinned","hideBlockTypes","blockNames","updatePreferredStyleVariations","blockName","blockStyle","__experimentalUpdateLocalAutosaveInterval","interval","showBlockTypes","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;;AAKA;;AACA;;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,MAAMA,kBAAkB,GAAKC,IAAF,IAAY;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA,SAC7CA,QAAQ,CACNC,QADF,CACY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,IAAAA,aAAa,GAAGC,YAAhB;AACAC,IAAAA,iBAAiB,GAAGC,gBAApB;;AAEA,QAAKG,0BAAL,EAAkC;AACjC,YAAM9G,QAAQ,CAACsC,qBAAT,EAAN;AACA;AACD,GAzBD;AA2BAtC,EAAAA,QAAQ,CAAE;AACTO,IAAAA,IAAI,EAAE;AADG,GAAF,CAAR;AAGA,CAtDM","sourcesContent":["/**\n * External dependencies\n */\nimport { castArray, reduce } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport apiFetch from '@wordpress/api-fetch';\nimport { speak } from '@wordpress/a11y';\nimport { store as interfaceStore } from '@wordpress/interface';\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\n\t\t.dispatch( interfaceStore )\n\t\t.toggleFeature( 'core/edit-post', feature );\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 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 */\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"]}
@@ -4,6 +4,7 @@ import { createElement } from "@wordpress/element";
4
4
  * External dependencies
5
5
  */
6
6
  import { get } from 'lodash';
7
+ import classnames from 'classnames';
7
8
  /**
8
9
  * WordPress dependencies
9
10
  */
@@ -65,11 +66,10 @@ function FullscreenModeClose(_ref) {
65
66
  });
66
67
  const effect = {
67
68
  expand: {
68
- scale: 1.7,
69
- borderRadius: 0,
69
+ scale: 1.25,
70
70
  transition: {
71
71
  type: 'tween',
72
- duration: '0.2'
72
+ duration: '0.3'
73
73
  }
74
74
  }
75
75
  };
@@ -95,10 +95,14 @@ function FullscreenModeClose(_ref) {
95
95
  });
96
96
  }
97
97
 
98
+ const classes = classnames({
99
+ 'edit-post-fullscreen-mode-close': true,
100
+ 'has-icon': siteIconUrl
101
+ });
98
102
  return createElement(motion.div, {
99
103
  whileHover: "expand"
100
104
  }, createElement(Button, {
101
- className: "edit-post-fullscreen-mode-close has-icon",
105
+ className: classes,
102
106
  href: href !== null && href !== void 0 ? href : addQueryArgs('edit.php', {
103
107
  post_type: postType.slug
104
108
  }),
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/header/fullscreen-mode-close/index.js"],"names":["get","useSelect","Button","Icon","__unstableMotion","motion","__","addQueryArgs","wordpress","store","editorStore","coreStore","useReducedMotion","editPostStore","FullscreenModeClose","showTooltip","icon","href","isActive","isRequestingSiteIcon","postType","siteIconUrl","select","getCurrentPostType","isFeatureActive","getEntityRecord","getPostType","isResolving","siteData","undefined","site_icon_url","disableMotion","buttonIcon","effect","expand","scale","borderRadius","transition","type","duration","post_type","slug"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,MADD,EAECC,IAFD,EAGCC,gBAAgB,IAAIC,MAHrB,QAIO,uBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA;AACA;AACA;;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,gBAAvC;;AAEA,SAASC,mBAAT,OAA4D;AAAA,MAA9B;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,IAAf;AAAqBC,IAAAA;AAArB,GAA8B;AAC3D,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,oBAAZ;AAAkCC,IAAAA,QAAlC;AAA4CC,IAAAA;AAA5C,MAA4DpB,SAAS,CACxEqB,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAyBD,MAAM,CAAEZ,WAAF,CAArC;AACA,UAAM;AAAEc,MAAAA;AAAF,QAAsBF,MAAM,CAAET,aAAF,CAAlC;AACA,UAAM;AAAEY,MAAAA,eAAF;AAAmBC,MAAAA,WAAnB;AAA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A,UAAU,GAAG,IAAb;AACA,GAtD0D,CAwD3D;;;AACA,MAAKhB,IAAL,EAAY;AACXgB,IAAAA,UAAU,GAAG,cAAC,IAAD;AAAM,MAAA,IAAI,EAAC,MAAX;AAAkB,MAAA,IAAI,EAAGhB;AAAzB,MAAb;AACA;;AAED,SACC,cAAC,MAAD,CAAQ,GAAR;AAAY,IAAA,UAAU,EAAC;AAAvB,KACC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,IAAI,EACHC,IADG,aACHA,IADG,cACHA,IADG,GAEHV,YAAY,CAAE,UAAF,EAAc;AACzBiC,MAAAA,SAAS,EAAEpB,QAAQ,CAACqB;AADK,KAAd,CAJd;AAQC,IAAA,KAAK,EAAGzC,GAAG,CACVoB,QADU,EAEV,CAAE,QAAF,EAAY,YAAZ,CAFU,EAGVd,EAAE,CAAE,MAAF,CAHQ,CARZ;AAaC,IAAA,WAAW,EAAGS;AAbf,KAeGiB,UAfH,CADD,CADD;AAqBA;;AAED,eAAelB,mBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tIcon,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\nimport { wordpress } from '@wordpress/icons';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useReducedMotion } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nfunction FullscreenModeClose( { showTooltip, icon, href } ) {\n\tconst { isActive, isRequestingSiteIcon, postType, siteIconUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPostType } = select( editorStore );\n\t\t\tconst { isFeatureActive } = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, isResolving } = select(\n\t\t\t\tcoreStore\n\t\t\t);\n\t\t\tconst siteData =\n\t\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\t\treturn {\n\t\t\t\tisActive: isFeatureActive( 'fullscreenMode' ),\n\t\t\t\tisRequestingSiteIcon: isResolving( 'getEntityRecord', [\n\t\t\t\t\t'root',\n\t\t\t\t\t'__unstableBase',\n\t\t\t\t\tundefined,\n\t\t\t\t] ),\n\t\t\t\tpostType: getPostType( getCurrentPostType() ),\n\t\t\t\tsiteIconUrl: siteData.site_icon_url,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst disableMotion = useReducedMotion();\n\n\tif ( ! isActive || ! postType ) {\n\t\treturn null;\n\t}\n\n\tlet buttonIcon = <Icon size=\"36px\" icon={ wordpress } />;\n\n\tconst effect = {\n\t\texpand: {\n\t\t\tscale: 1.7,\n\t\t\tborderRadius: 0,\n\t\t\ttransition: { type: 'tween', duration: '0.2' },\n\t\t},\n\t};\n\n\tif ( siteIconUrl ) {\n\t\tbuttonIcon = (\n\t\t\t<motion.img\n\t\t\t\tvariants={ ! disableMotion && effect }\n\t\t\t\talt={ __( 'Site Icon' ) }\n\t\t\t\tclassName=\"edit-post-fullscreen-mode-close_site-icon\"\n\t\t\t\tsrc={ siteIconUrl }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isRequestingSiteIcon ) {\n\t\tbuttonIcon = null;\n\t}\n\n\t// Override default icon if custom icon is provided via props.\n\tif ( icon ) {\n\t\tbuttonIcon = <Icon size=\"36px\" icon={ icon } />;\n\t}\n\n\treturn (\n\t\t<motion.div whileHover=\"expand\">\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-post-fullscreen-mode-close has-icon\"\n\t\t\t\thref={\n\t\t\t\t\thref ??\n\t\t\t\t\taddQueryArgs( 'edit.php', {\n\t\t\t\t\t\tpost_type: postType.slug,\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t\tlabel={ get(\n\t\t\t\t\tpostType,\n\t\t\t\t\t[ 'labels', 'view_items' ],\n\t\t\t\t\t__( 'Back' )\n\t\t\t\t) }\n\t\t\t\tshowTooltip={ showTooltip }\n\t\t\t>\n\t\t\t\t{ buttonIcon }\n\t\t\t</Button>\n\t\t</motion.div>\n\t);\n}\n\nexport default FullscreenModeClose;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/components/header/fullscreen-mode-close/index.js"],"names":["get","classnames","useSelect","Button","Icon","__unstableMotion","motion","__","addQueryArgs","wordpress","store","editorStore","coreStore","useReducedMotion","editPostStore","FullscreenModeClose","showTooltip","icon","href","isActive","isRequestingSiteIcon","postType","siteIconUrl","select","getCurrentPostType","isFeatureActive","getEntityRecord","getPostType","isResolving","siteData","undefined","site_icon_url","disableMotion","buttonIcon","effect","expand","scale","transition","type","duration","classes","post_type","slug"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,MADD,EAECC,IAFD,EAGCC,gBAAgB,IAAIC,MAHrB,QAIO,uBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA;AACA;AACA;;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,gBAAvC;;AAEA,SAASC,mBAAT,OAA4D;AAAA,MAA9B;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,IAAf;AAAqBC,IAAAA;AAArB,GAA8B;AAC3D,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,oBAAZ;AAAkCC,IAAAA,QAAlC;AAA4CC,IAAAA;AAA5C,MAA4DpB,SAAS,CACxEqB,MAAF,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C,MAAA,GAAG,EAAG3B,EAAE,CAAE,WAAF,CAFT;AAGC,MAAA,SAAS,EAAC,2CAHX;AAIC,MAAA,GAAG,EAAGe;AAJP,MADD;AAQA;;AAED,MAAKF,oBAAL,EAA4B;AAC3Ba,IAAAA,UAAU,GAAG,IAAb;AACA,GArD0D,CAuD3D;;;AACA,MAAKhB,IAAL,EAAY;AACXgB,IAAAA,UAAU,GAAG,cAAC,IAAD;AAAM,MAAA,IAAI,EAAC,MAAX;AAAkB,MAAA,IAAI,EAAGhB;AAAzB,MAAb;AACA;;AAED,QAAMuB,OAAO,GAAGvC,UAAU,CAAE;AAC3B,uCAAmC,IADR;AAE3B,gBAAYqB;AAFe,GAAF,CAA1B;AAKA,SACC,cAAC,MAAD,CAAQ,GAAR;AAAY,IAAA,UAAU,EAAC;AAAvB,KACC,cAAC,MAAD;AACC,IAAA,SAAS,EAAGkB,OADb;AAEC,IAAA,IAAI,EACHtB,IADG,aACHA,IADG,cACHA,IADG,GAEHV,YAAY,CAAE,UAAF,EAAc;AACzBiC,MAAAA,SAAS,EAAEpB,QAAQ,CAACqB;AADK,KAAd,CAJd;AAQC,IAAA,KAAK,EAAG1C,GAAG,CACVqB,QADU,EAEV,CAAE,QAAF,EAAY,YAAZ,CAFU,EAGVd,EAAE,CAAE,MAAF,CAHQ,CARZ;AAaC,IAAA,WAAW,EAAGS;AAbf,KAeGiB,UAfH,CADD,CADD;AAqBA;;AAED,eAAelB,mBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tIcon,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\nimport { wordpress } from '@wordpress/icons';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useReducedMotion } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nfunction FullscreenModeClose( { showTooltip, icon, href } ) {\n\tconst { isActive, isRequestingSiteIcon, postType, siteIconUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPostType } = select( editorStore );\n\t\t\tconst { isFeatureActive } = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, isResolving } = select(\n\t\t\t\tcoreStore\n\t\t\t);\n\t\t\tconst siteData =\n\t\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\t\treturn {\n\t\t\t\tisActive: isFeatureActive( 'fullscreenMode' ),\n\t\t\t\tisRequestingSiteIcon: isResolving( 'getEntityRecord', [\n\t\t\t\t\t'root',\n\t\t\t\t\t'__unstableBase',\n\t\t\t\t\tundefined,\n\t\t\t\t] ),\n\t\t\t\tpostType: getPostType( getCurrentPostType() ),\n\t\t\t\tsiteIconUrl: siteData.site_icon_url,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst disableMotion = useReducedMotion();\n\n\tif ( ! isActive || ! postType ) {\n\t\treturn null;\n\t}\n\n\tlet buttonIcon = <Icon size=\"36px\" icon={ wordpress } />;\n\n\tconst effect = {\n\t\texpand: {\n\t\t\tscale: 1.25,\n\t\t\ttransition: { type: 'tween', duration: '0.3' },\n\t\t},\n\t};\n\n\tif ( siteIconUrl ) {\n\t\tbuttonIcon = (\n\t\t\t<motion.img\n\t\t\t\tvariants={ ! disableMotion && effect }\n\t\t\t\talt={ __( 'Site Icon' ) }\n\t\t\t\tclassName=\"edit-post-fullscreen-mode-close_site-icon\"\n\t\t\t\tsrc={ siteIconUrl }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isRequestingSiteIcon ) {\n\t\tbuttonIcon = null;\n\t}\n\n\t// Override default icon if custom icon is provided via props.\n\tif ( icon ) {\n\t\tbuttonIcon = <Icon size=\"36px\" icon={ icon } />;\n\t}\n\n\tconst classes = classnames( {\n\t\t'edit-post-fullscreen-mode-close': true,\n\t\t'has-icon': siteIconUrl,\n\t} );\n\n\treturn (\n\t\t<motion.div whileHover=\"expand\">\n\t\t\t<Button\n\t\t\t\tclassName={ classes }\n\t\t\t\thref={\n\t\t\t\t\thref ??\n\t\t\t\t\taddQueryArgs( 'edit.php', {\n\t\t\t\t\t\tpost_type: postType.slug,\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t\tlabel={ get(\n\t\t\t\t\tpostType,\n\t\t\t\t\t[ 'labels', 'view_items' ],\n\t\t\t\t\t__( 'Back' )\n\t\t\t\t) }\n\t\t\t\tshowTooltip={ showTooltip }\n\t\t\t>\n\t\t\t\t{ buttonIcon }\n\t\t\t</Button>\n\t\t</motion.div>\n\t);\n}\n\nexport default FullscreenModeClose;\n"]}
@@ -48,7 +48,9 @@ function Header(_ref) {
48
48
  });
49
49
  return createElement("div", {
50
50
  className: classes
51
- }, createElement(MainDashboardButton.Slot, null, createElement(FullscreenModeClose, null)), createElement("div", {
51
+ }, createElement(MainDashboardButton.Slot, null, createElement(FullscreenModeClose, {
52
+ showTooltip: true
53
+ })), createElement("div", {
52
54
  className: "edit-post-header__toolbar"
53
55
  }, createElement(HeaderToolbar, null), createElement(TemplateTitle, null)), createElement("div", {
54
56
  className: "edit-post-header__settings"