@wordpress/edit-post 8.36.1-next.6deb34194.0 → 8.36.1-next.76cff8c98.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 (152) hide show
  1. package/LICENSE.md +1 -1
  2. package/build/commands/{use-commands.js → use-commands.cjs} +1 -1
  3. package/build/components/back-button/{fullscreen-mode-close.js → fullscreen-mode-close.cjs} +1 -1
  4. package/build/components/back-button/{index.js → index.cjs} +3 -3
  5. package/build/components/browser-url/{index.js → index.cjs} +1 -1
  6. package/build/components/editor-initialization/{index.js → index.cjs} +2 -2
  7. package/build/components/editor-initialization/{listener-hooks.js → listener-hooks.cjs} +2 -2
  8. package/build/components/init-pattern-modal/{index.js → index.cjs} +1 -3
  9. package/build/components/init-pattern-modal/{index.js.map → index.cjs.map} +2 -2
  10. package/build/components/keyboard-shortcuts/{index.js → index.cjs} +2 -2
  11. package/build/components/layout/{index.js → index.cjs} +18 -16
  12. package/build/components/layout/{index.js.map → index.cjs.map} +2 -2
  13. package/build/components/layout/{use-should-iframe.js → use-should-iframe.cjs} +2 -2
  14. package/build/components/meta-boxes/{index.js → index.cjs} +4 -4
  15. package/build/components/meta-boxes/{meta-box-visibility.js → meta-box-visibility.cjs} +1 -1
  16. package/build/components/meta-boxes/meta-boxes-area/{index.js → index.cjs} +2 -2
  17. package/build/components/meta-boxes/{use-meta-box-initialization.js → use-meta-box-initialization.cjs} +2 -2
  18. package/build/components/more-menu/{index.js → index.cjs} +5 -5
  19. package/build/components/more-menu/{manage-patterns-menu-item.js → manage-patterns-menu-item.cjs} +1 -1
  20. package/build/components/more-menu/{welcome-guide-menu-item.js → welcome-guide-menu-item.cjs} +1 -1
  21. package/build/components/preferences-modal/{enable-custom-fields.js → enable-custom-fields.cjs} +2 -2
  22. package/build/components/preferences-modal/{enable-panel.js → enable-panel.cjs} +2 -2
  23. package/build/components/preferences-modal/{index.js → index.cjs} +3 -3
  24. package/build/components/preferences-modal/{meta-boxes-section.js → meta-boxes-section.cjs} +5 -5
  25. package/build/components/welcome-guide/{default.js → default.cjs} +3 -3
  26. package/build/components/welcome-guide/{image.js → image.cjs} +1 -1
  27. package/build/components/welcome-guide/{index.js → index.cjs} +4 -4
  28. package/build/components/welcome-guide/{template.js → template.cjs} +3 -3
  29. package/build/{deprecated.js → deprecated.cjs} +2 -2
  30. package/build/hooks/{use-navigate-to-entity-record.js → use-navigate-to-entity-record.cjs} +28 -8
  31. package/build/hooks/use-navigate-to-entity-record.cjs.map +7 -0
  32. package/build/{index.js → index.cjs} +7 -7
  33. package/build/{index.js.map → index.cjs.map} +1 -1
  34. package/build/{lock-unlock.js → lock-unlock.cjs} +1 -1
  35. package/build/store/{actions.js → actions.cjs} +3 -3
  36. package/build/store/{constants.js → constants.cjs} +1 -1
  37. package/build/store/{index.js → index.cjs} +5 -5
  38. package/build/store/{reducer.js → reducer.cjs} +1 -1
  39. package/build/store/{selectors.js → selectors.cjs} +2 -2
  40. package/build/utils/{meta-boxes.js → meta-boxes.cjs} +1 -1
  41. package/build-module/commands/{use-commands.js → use-commands.mjs} +1 -1
  42. package/build-module/components/back-button/{fullscreen-mode-close.js → fullscreen-mode-close.mjs} +1 -1
  43. package/build-module/components/back-button/{index.js → index.mjs} +3 -3
  44. package/build-module/components/browser-url/{index.js → index.mjs} +1 -1
  45. package/build-module/components/editor-initialization/{index.js → index.mjs} +2 -2
  46. package/build-module/components/editor-initialization/{listener-hooks.js → listener-hooks.mjs} +2 -2
  47. package/build-module/components/init-pattern-modal/{index.js → index.mjs} +1 -3
  48. package/build-module/components/init-pattern-modal/{index.js.map → index.mjs.map} +2 -2
  49. package/build-module/components/keyboard-shortcuts/{index.js → index.mjs} +2 -2
  50. package/build-module/components/layout/{index.js → index.mjs} +18 -16
  51. package/build-module/components/layout/{index.js.map → index.mjs.map} +2 -2
  52. package/build-module/components/layout/{use-should-iframe.js → use-should-iframe.mjs} +2 -2
  53. package/build-module/components/meta-boxes/{index.js → index.mjs} +4 -4
  54. package/build-module/components/meta-boxes/{meta-box-visibility.js → meta-box-visibility.mjs} +1 -1
  55. package/build-module/components/meta-boxes/meta-boxes-area/{index.js → index.mjs} +2 -2
  56. package/build-module/components/meta-boxes/{use-meta-box-initialization.js → use-meta-box-initialization.mjs} +2 -2
  57. package/build-module/components/more-menu/{index.js → index.mjs} +5 -5
  58. package/build-module/components/more-menu/{manage-patterns-menu-item.js → manage-patterns-menu-item.mjs} +1 -1
  59. package/build-module/components/more-menu/{welcome-guide-menu-item.js → welcome-guide-menu-item.mjs} +1 -1
  60. package/build-module/components/preferences-modal/{enable-custom-fields.js → enable-custom-fields.mjs} +2 -2
  61. package/build-module/components/preferences-modal/{enable-panel.js → enable-panel.mjs} +2 -2
  62. package/build-module/components/preferences-modal/{index.js → index.mjs} +3 -3
  63. package/build-module/components/preferences-modal/{meta-boxes-section.js → meta-boxes-section.mjs} +5 -5
  64. package/build-module/components/welcome-guide/{default.js → default.mjs} +3 -3
  65. package/build-module/components/welcome-guide/{image.js → image.mjs} +1 -1
  66. package/build-module/components/welcome-guide/{index.js → index.mjs} +4 -4
  67. package/build-module/components/welcome-guide/{template.js → template.mjs} +3 -3
  68. package/build-module/{deprecated.js → deprecated.mjs} +2 -2
  69. package/build-module/hooks/{use-navigate-to-entity-record.js → use-navigate-to-entity-record.mjs} +29 -9
  70. package/build-module/hooks/use-navigate-to-entity-record.mjs.map +7 -0
  71. package/build-module/{index.js → index.mjs} +6 -6
  72. package/build-module/{lock-unlock.js → lock-unlock.mjs} +1 -1
  73. package/build-module/store/{actions.js → actions.mjs} +3 -3
  74. package/build-module/store/{constants.js → constants.mjs} +1 -1
  75. package/build-module/store/{index.js → index.mjs} +5 -5
  76. package/build-module/store/{reducer.js → reducer.mjs} +1 -1
  77. package/build-module/store/{selectors.js → selectors.mjs} +2 -2
  78. package/build-module/utils/{meta-boxes.js → meta-boxes.mjs} +1 -1
  79. package/build-style/classic-rtl.css +4 -0
  80. package/build-style/classic.css +4 -0
  81. package/build-style/style-rtl.css +9 -120
  82. package/build-style/style.css +9 -120
  83. package/package.json +45 -37
  84. package/src/components/init-pattern-modal/index.js +0 -2
  85. package/src/components/layout/index.js +2 -0
  86. package/src/hooks/use-navigate-to-entity-record.js +40 -8
  87. package/src/style.scss +0 -2
  88. package/build/hooks/use-navigate-to-entity-record.js.map +0 -7
  89. package/build-module/hooks/use-navigate-to-entity-record.js.map +0 -7
  90. /package/build/commands/{use-commands.js.map → use-commands.cjs.map} +0 -0
  91. /package/build/components/back-button/{fullscreen-mode-close.js.map → fullscreen-mode-close.cjs.map} +0 -0
  92. /package/build/components/back-button/{index.js.map → index.cjs.map} +0 -0
  93. /package/build/components/browser-url/{index.js.map → index.cjs.map} +0 -0
  94. /package/build/components/editor-initialization/{index.js.map → index.cjs.map} +0 -0
  95. /package/build/components/editor-initialization/{listener-hooks.js.map → listener-hooks.cjs.map} +0 -0
  96. /package/build/components/keyboard-shortcuts/{index.js.map → index.cjs.map} +0 -0
  97. /package/build/components/layout/{use-should-iframe.js.map → use-should-iframe.cjs.map} +0 -0
  98. /package/build/components/meta-boxes/{index.js.map → index.cjs.map} +0 -0
  99. /package/build/components/meta-boxes/{meta-box-visibility.js.map → meta-box-visibility.cjs.map} +0 -0
  100. /package/build/components/meta-boxes/meta-boxes-area/{index.js.map → index.cjs.map} +0 -0
  101. /package/build/components/meta-boxes/{use-meta-box-initialization.js.map → use-meta-box-initialization.cjs.map} +0 -0
  102. /package/build/components/more-menu/{index.js.map → index.cjs.map} +0 -0
  103. /package/build/components/more-menu/{manage-patterns-menu-item.js.map → manage-patterns-menu-item.cjs.map} +0 -0
  104. /package/build/components/more-menu/{welcome-guide-menu-item.js.map → welcome-guide-menu-item.cjs.map} +0 -0
  105. /package/build/components/preferences-modal/{enable-custom-fields.js.map → enable-custom-fields.cjs.map} +0 -0
  106. /package/build/components/preferences-modal/{enable-panel.js.map → enable-panel.cjs.map} +0 -0
  107. /package/build/components/preferences-modal/{index.js.map → index.cjs.map} +0 -0
  108. /package/build/components/preferences-modal/{meta-boxes-section.js.map → meta-boxes-section.cjs.map} +0 -0
  109. /package/build/components/welcome-guide/{default.js.map → default.cjs.map} +0 -0
  110. /package/build/components/welcome-guide/{image.js.map → image.cjs.map} +0 -0
  111. /package/build/components/welcome-guide/{index.js.map → index.cjs.map} +0 -0
  112. /package/build/components/welcome-guide/{template.js.map → template.cjs.map} +0 -0
  113. /package/build/{deprecated.js.map → deprecated.cjs.map} +0 -0
  114. /package/build/{lock-unlock.js.map → lock-unlock.cjs.map} +0 -0
  115. /package/build/store/{actions.js.map → actions.cjs.map} +0 -0
  116. /package/build/store/{constants.js.map → constants.cjs.map} +0 -0
  117. /package/build/store/{index.js.map → index.cjs.map} +0 -0
  118. /package/build/store/{reducer.js.map → reducer.cjs.map} +0 -0
  119. /package/build/store/{selectors.js.map → selectors.cjs.map} +0 -0
  120. /package/build/utils/{meta-boxes.js.map → meta-boxes.cjs.map} +0 -0
  121. /package/build-module/commands/{use-commands.js.map → use-commands.mjs.map} +0 -0
  122. /package/build-module/components/back-button/{fullscreen-mode-close.js.map → fullscreen-mode-close.mjs.map} +0 -0
  123. /package/build-module/components/back-button/{index.js.map → index.mjs.map} +0 -0
  124. /package/build-module/components/browser-url/{index.js.map → index.mjs.map} +0 -0
  125. /package/build-module/components/editor-initialization/{index.js.map → index.mjs.map} +0 -0
  126. /package/build-module/components/editor-initialization/{listener-hooks.js.map → listener-hooks.mjs.map} +0 -0
  127. /package/build-module/components/keyboard-shortcuts/{index.js.map → index.mjs.map} +0 -0
  128. /package/build-module/components/layout/{use-should-iframe.js.map → use-should-iframe.mjs.map} +0 -0
  129. /package/build-module/components/meta-boxes/{index.js.map → index.mjs.map} +0 -0
  130. /package/build-module/components/meta-boxes/{meta-box-visibility.js.map → meta-box-visibility.mjs.map} +0 -0
  131. /package/build-module/components/meta-boxes/meta-boxes-area/{index.js.map → index.mjs.map} +0 -0
  132. /package/build-module/components/meta-boxes/{use-meta-box-initialization.js.map → use-meta-box-initialization.mjs.map} +0 -0
  133. /package/build-module/components/more-menu/{index.js.map → index.mjs.map} +0 -0
  134. /package/build-module/components/more-menu/{manage-patterns-menu-item.js.map → manage-patterns-menu-item.mjs.map} +0 -0
  135. /package/build-module/components/more-menu/{welcome-guide-menu-item.js.map → welcome-guide-menu-item.mjs.map} +0 -0
  136. /package/build-module/components/preferences-modal/{enable-custom-fields.js.map → enable-custom-fields.mjs.map} +0 -0
  137. /package/build-module/components/preferences-modal/{enable-panel.js.map → enable-panel.mjs.map} +0 -0
  138. /package/build-module/components/preferences-modal/{index.js.map → index.mjs.map} +0 -0
  139. /package/build-module/components/preferences-modal/{meta-boxes-section.js.map → meta-boxes-section.mjs.map} +0 -0
  140. /package/build-module/components/welcome-guide/{default.js.map → default.mjs.map} +0 -0
  141. /package/build-module/components/welcome-guide/{image.js.map → image.mjs.map} +0 -0
  142. /package/build-module/components/welcome-guide/{index.js.map → index.mjs.map} +0 -0
  143. /package/build-module/components/welcome-guide/{template.js.map → template.mjs.map} +0 -0
  144. /package/build-module/{deprecated.js.map → deprecated.mjs.map} +0 -0
  145. /package/build-module/{index.js.map → index.mjs.map} +0 -0
  146. /package/build-module/{lock-unlock.js.map → lock-unlock.mjs.map} +0 -0
  147. /package/build-module/store/{actions.js.map → actions.mjs.map} +0 -0
  148. /package/build-module/store/{constants.js.map → constants.mjs.map} +0 -0
  149. /package/build-module/store/{index.js.map → index.mjs.map} +0 -0
  150. /package/build-module/store/{reducer.js.map → reducer.mjs.map} +0 -0
  151. /package/build-module/store/{selectors.js.map → selectors.mjs.map} +0 -0
  152. /package/build-module/utils/{meta-boxes.js.map → meta-boxes.mjs.map} +0 -0
@@ -7,7 +7,7 @@ import {
7
7
  privateApis as editorPrivateApis
8
8
  } from "@wordpress/editor";
9
9
  import deprecated from "@wordpress/deprecated";
10
- import { unlock } from "../lock-unlock";
10
+ import { unlock } from "../lock-unlock.mjs";
11
11
  var { interfaceStore } = unlock(editorPrivateApis);
12
12
  var EMPTY_ARRAY = [];
13
13
  var EMPTY_OBJECT = {};
@@ -285,4 +285,4 @@ export {
285
285
  isPublishSidebarOpened,
286
286
  isSavingMetaBoxes
287
287
  };
288
- //# sourceMappingURL=selectors.js.map
288
+ //# sourceMappingURL=selectors.mjs.map
@@ -11,4 +11,4 @@ var getMetaBoxContainer = (location) => {
11
11
  export {
12
12
  getMetaBoxContainer
13
13
  };
14
- //# sourceMappingURL=meta-boxes.js.map
14
+ //# sourceMappingURL=meta-boxes.mjs.map
@@ -83,6 +83,10 @@
83
83
  /**
84
84
  * Reset the WP Admin page styles for Gutenberg-like pages.
85
85
  */
86
+ /**
87
+ * Creates a checkerboard pattern background to indicate transparency.
88
+ * @param {String} $size - The size of the squares in the checkerboard pattern. Default is 12px.
89
+ */
86
90
  .editor-styles-wrapper :where(:not(.is-layout-flex, .is-layout-grid)) > .wp-block {
87
91
  margin-right: auto;
88
92
  margin-left: auto;
@@ -83,6 +83,10 @@
83
83
  /**
84
84
  * Reset the WP Admin page styles for Gutenberg-like pages.
85
85
  */
86
+ /**
87
+ * Creates a checkerboard pattern background to indicate transparency.
88
+ * @param {String} $size - The size of the squares in the checkerboard pattern. Default is 12px.
89
+ */
86
90
  .editor-styles-wrapper :where(:not(.is-layout-flex, .is-layout-grid)) > .wp-block {
87
91
  margin-left: auto;
88
92
  margin-right: auto;
@@ -83,6 +83,10 @@
83
83
  /**
84
84
  * Reset the WP Admin page styles for Gutenberg-like pages.
85
85
  */
86
+ /**
87
+ * Creates a checkerboard pattern background to indicate transparency.
88
+ * @param {String} $size - The size of the squares in the checkerboard pattern. Default is 12px.
89
+ */
86
90
  :root {
87
91
  --wp-block-synced-color: #7a00df;
88
92
  --wp-block-synced-color--rgb: 122, 0, 223;
@@ -187,6 +191,10 @@
187
191
  /**
188
192
  * Reset the WP Admin page styles for Gutenberg-like pages.
189
193
  */
194
+ /**
195
+ * Creates a checkerboard pattern background to indicate transparency.
196
+ * @param {String} $size - The size of the squares in the checkerboard pattern. Default is 12px.
197
+ */
190
198
  .admin-ui-page {
191
199
  display: flex;
192
200
  height: 100%;
@@ -203,6 +211,7 @@
203
211
  background: #fff;
204
212
  position: sticky;
205
213
  top: 0;
214
+ z-index: 1;
206
215
  }
207
216
 
208
217
  .admin-ui-page__sidebar-toggle-slot:empty {
@@ -714,124 +723,4 @@ body.js.block-editor-page .media-frame select.attachment-filters:last-of-type {
714
723
  .block-editor__container img {
715
724
  max-width: 100%;
716
725
  height: auto;
717
- }
718
-
719
- body.admin-color-light {
720
- --wp-admin-theme-color: #0085ba;
721
- --wp-admin-theme-color--rgb: 0, 133, 186;
722
- --wp-admin-theme-color-darker-10: rgb(0, 114.7661290323, 160.5);
723
- --wp-admin-theme-color-darker-10--rgb: 0, 114.7661290323, 160.5;
724
- --wp-admin-theme-color-darker-20: rgb(0, 96.5322580645, 135);
725
- --wp-admin-theme-color-darker-20--rgb: 0, 96.5322580645, 135;
726
- --wp-admin-border-width-focus: 2px;
727
- }
728
- @media (min-resolution: 192dpi) {
729
- body.admin-color-light {
730
- --wp-admin-border-width-focus: 1.5px;
731
- }
732
- }
733
-
734
- body.admin-color-modern {
735
- --wp-admin-theme-color: #3858e9;
736
- --wp-admin-theme-color--rgb: 56, 88, 233;
737
- --wp-admin-theme-color-darker-10: rgb(33.0384615385, 68.7307692308, 230.4615384615);
738
- --wp-admin-theme-color-darker-10--rgb: 33.0384615385, 68.7307692308, 230.4615384615;
739
- --wp-admin-theme-color-darker-20: rgb(23.6923076923, 58.1538461538, 214.3076923077);
740
- --wp-admin-theme-color-darker-20--rgb: 23.6923076923, 58.1538461538, 214.3076923077;
741
- --wp-admin-border-width-focus: 2px;
742
- }
743
- @media (min-resolution: 192dpi) {
744
- body.admin-color-modern {
745
- --wp-admin-border-width-focus: 1.5px;
746
- }
747
- }
748
-
749
- body.admin-color-blue {
750
- --wp-admin-theme-color: #096484;
751
- --wp-admin-theme-color--rgb: 9, 100, 132;
752
- --wp-admin-theme-color-darker-10: rgb(7.3723404255, 81.914893617, 108.1276595745);
753
- --wp-admin-theme-color-darker-10--rgb: 7.3723404255, 81.914893617, 108.1276595745;
754
- --wp-admin-theme-color-darker-20: rgb(5.7446808511, 63.829787234, 84.2553191489);
755
- --wp-admin-theme-color-darker-20--rgb: 5.7446808511, 63.829787234, 84.2553191489;
756
- --wp-admin-border-width-focus: 2px;
757
- }
758
- @media (min-resolution: 192dpi) {
759
- body.admin-color-blue {
760
- --wp-admin-border-width-focus: 1.5px;
761
- }
762
- }
763
-
764
- body.admin-color-coffee {
765
- --wp-admin-theme-color: #46403c;
766
- --wp-admin-theme-color--rgb: 70, 64, 60;
767
- --wp-admin-theme-color-darker-10: rgb(56.2692307692, 51.4461538462, 48.2307692308);
768
- --wp-admin-theme-color-darker-10--rgb: 56.2692307692, 51.4461538462, 48.2307692308;
769
- --wp-admin-theme-color-darker-20: rgb(42.5384615385, 38.8923076923, 36.4615384615);
770
- --wp-admin-theme-color-darker-20--rgb: 42.5384615385, 38.8923076923, 36.4615384615;
771
- --wp-admin-border-width-focus: 2px;
772
- }
773
- @media (min-resolution: 192dpi) {
774
- body.admin-color-coffee {
775
- --wp-admin-border-width-focus: 1.5px;
776
- }
777
- }
778
-
779
- body.admin-color-ectoplasm {
780
- --wp-admin-theme-color: #523f6d;
781
- --wp-admin-theme-color--rgb: 82, 63, 109;
782
- --wp-admin-theme-color-darker-10: rgb(69.8430232558, 53.6598837209, 92.8401162791);
783
- --wp-admin-theme-color-darker-10--rgb: 69.8430232558, 53.6598837209, 92.8401162791;
784
- --wp-admin-theme-color-darker-20: rgb(57.6860465116, 44.3197674419, 76.6802325581);
785
- --wp-admin-theme-color-darker-20--rgb: 57.6860465116, 44.3197674419, 76.6802325581;
786
- --wp-admin-border-width-focus: 2px;
787
- }
788
- @media (min-resolution: 192dpi) {
789
- body.admin-color-ectoplasm {
790
- --wp-admin-border-width-focus: 1.5px;
791
- }
792
- }
793
-
794
- body.admin-color-midnight {
795
- --wp-admin-theme-color: #e14d43;
796
- --wp-admin-theme-color--rgb: 225, 77, 67;
797
- --wp-admin-theme-color-darker-10: rgb(221.4908256881, 56.1788990826, 45.0091743119);
798
- --wp-admin-theme-color-darker-10--rgb: 221.4908256881, 56.1788990826, 45.0091743119;
799
- --wp-admin-theme-color-darker-20: rgb(207.8348623853, 44.2201834862, 33.1651376147);
800
- --wp-admin-theme-color-darker-20--rgb: 207.8348623853, 44.2201834862, 33.1651376147;
801
- --wp-admin-border-width-focus: 2px;
802
- }
803
- @media (min-resolution: 192dpi) {
804
- body.admin-color-midnight {
805
- --wp-admin-border-width-focus: 1.5px;
806
- }
807
- }
808
-
809
- body.admin-color-ocean {
810
- --wp-admin-theme-color: #627c83;
811
- --wp-admin-theme-color--rgb: 98, 124, 131;
812
- --wp-admin-theme-color-darker-10: rgb(87.0873362445, 110.192139738, 116.4126637555);
813
- --wp-admin-theme-color-darker-10--rgb: 87.0873362445, 110.192139738, 116.4126637555;
814
- --wp-admin-theme-color-darker-20: rgb(76.1746724891, 96.384279476, 101.8253275109);
815
- --wp-admin-theme-color-darker-20--rgb: 76.1746724891, 96.384279476, 101.8253275109;
816
- --wp-admin-border-width-focus: 2px;
817
- }
818
- @media (min-resolution: 192dpi) {
819
- body.admin-color-ocean {
820
- --wp-admin-border-width-focus: 1.5px;
821
- }
822
- }
823
-
824
- body.admin-color-sunrise {
825
- --wp-admin-theme-color: #dd823b;
826
- --wp-admin-theme-color--rgb: 221, 130, 59;
827
- --wp-admin-theme-color-darker-10: rgb(216.8782608696, 116.1847826087, 37.6217391304);
828
- --wp-admin-theme-color-darker-10--rgb: 216.8782608696, 116.1847826087, 37.6217391304;
829
- --wp-admin-theme-color-darker-20: rgb(195.147826087, 104.5434782609, 33.852173913);
830
- --wp-admin-theme-color-darker-20--rgb: 195.147826087, 104.5434782609, 33.852173913;
831
- --wp-admin-border-width-focus: 2px;
832
- }
833
- @media (min-resolution: 192dpi) {
834
- body.admin-color-sunrise {
835
- --wp-admin-border-width-focus: 1.5px;
836
- }
837
726
  }
@@ -83,6 +83,10 @@
83
83
  /**
84
84
  * Reset the WP Admin page styles for Gutenberg-like pages.
85
85
  */
86
+ /**
87
+ * Creates a checkerboard pattern background to indicate transparency.
88
+ * @param {String} $size - The size of the squares in the checkerboard pattern. Default is 12px.
89
+ */
86
90
  :root {
87
91
  --wp-block-synced-color: #7a00df;
88
92
  --wp-block-synced-color--rgb: 122, 0, 223;
@@ -187,6 +191,10 @@
187
191
  /**
188
192
  * Reset the WP Admin page styles for Gutenberg-like pages.
189
193
  */
194
+ /**
195
+ * Creates a checkerboard pattern background to indicate transparency.
196
+ * @param {String} $size - The size of the squares in the checkerboard pattern. Default is 12px.
197
+ */
190
198
  .admin-ui-page {
191
199
  display: flex;
192
200
  height: 100%;
@@ -203,6 +211,7 @@
203
211
  background: #fff;
204
212
  position: sticky;
205
213
  top: 0;
214
+ z-index: 1;
206
215
  }
207
216
 
208
217
  .admin-ui-page__sidebar-toggle-slot:empty {
@@ -714,124 +723,4 @@ body.js.block-editor-page .media-frame select.attachment-filters:last-of-type {
714
723
  .block-editor__container img {
715
724
  max-width: 100%;
716
725
  height: auto;
717
- }
718
-
719
- body.admin-color-light {
720
- --wp-admin-theme-color: #0085ba;
721
- --wp-admin-theme-color--rgb: 0, 133, 186;
722
- --wp-admin-theme-color-darker-10: rgb(0, 114.7661290323, 160.5);
723
- --wp-admin-theme-color-darker-10--rgb: 0, 114.7661290323, 160.5;
724
- --wp-admin-theme-color-darker-20: rgb(0, 96.5322580645, 135);
725
- --wp-admin-theme-color-darker-20--rgb: 0, 96.5322580645, 135;
726
- --wp-admin-border-width-focus: 2px;
727
- }
728
- @media (min-resolution: 192dpi) {
729
- body.admin-color-light {
730
- --wp-admin-border-width-focus: 1.5px;
731
- }
732
- }
733
-
734
- body.admin-color-modern {
735
- --wp-admin-theme-color: #3858e9;
736
- --wp-admin-theme-color--rgb: 56, 88, 233;
737
- --wp-admin-theme-color-darker-10: rgb(33.0384615385, 68.7307692308, 230.4615384615);
738
- --wp-admin-theme-color-darker-10--rgb: 33.0384615385, 68.7307692308, 230.4615384615;
739
- --wp-admin-theme-color-darker-20: rgb(23.6923076923, 58.1538461538, 214.3076923077);
740
- --wp-admin-theme-color-darker-20--rgb: 23.6923076923, 58.1538461538, 214.3076923077;
741
- --wp-admin-border-width-focus: 2px;
742
- }
743
- @media (min-resolution: 192dpi) {
744
- body.admin-color-modern {
745
- --wp-admin-border-width-focus: 1.5px;
746
- }
747
- }
748
-
749
- body.admin-color-blue {
750
- --wp-admin-theme-color: #096484;
751
- --wp-admin-theme-color--rgb: 9, 100, 132;
752
- --wp-admin-theme-color-darker-10: rgb(7.3723404255, 81.914893617, 108.1276595745);
753
- --wp-admin-theme-color-darker-10--rgb: 7.3723404255, 81.914893617, 108.1276595745;
754
- --wp-admin-theme-color-darker-20: rgb(5.7446808511, 63.829787234, 84.2553191489);
755
- --wp-admin-theme-color-darker-20--rgb: 5.7446808511, 63.829787234, 84.2553191489;
756
- --wp-admin-border-width-focus: 2px;
757
- }
758
- @media (min-resolution: 192dpi) {
759
- body.admin-color-blue {
760
- --wp-admin-border-width-focus: 1.5px;
761
- }
762
- }
763
-
764
- body.admin-color-coffee {
765
- --wp-admin-theme-color: #46403c;
766
- --wp-admin-theme-color--rgb: 70, 64, 60;
767
- --wp-admin-theme-color-darker-10: rgb(56.2692307692, 51.4461538462, 48.2307692308);
768
- --wp-admin-theme-color-darker-10--rgb: 56.2692307692, 51.4461538462, 48.2307692308;
769
- --wp-admin-theme-color-darker-20: rgb(42.5384615385, 38.8923076923, 36.4615384615);
770
- --wp-admin-theme-color-darker-20--rgb: 42.5384615385, 38.8923076923, 36.4615384615;
771
- --wp-admin-border-width-focus: 2px;
772
- }
773
- @media (min-resolution: 192dpi) {
774
- body.admin-color-coffee {
775
- --wp-admin-border-width-focus: 1.5px;
776
- }
777
- }
778
-
779
- body.admin-color-ectoplasm {
780
- --wp-admin-theme-color: #523f6d;
781
- --wp-admin-theme-color--rgb: 82, 63, 109;
782
- --wp-admin-theme-color-darker-10: rgb(69.8430232558, 53.6598837209, 92.8401162791);
783
- --wp-admin-theme-color-darker-10--rgb: 69.8430232558, 53.6598837209, 92.8401162791;
784
- --wp-admin-theme-color-darker-20: rgb(57.6860465116, 44.3197674419, 76.6802325581);
785
- --wp-admin-theme-color-darker-20--rgb: 57.6860465116, 44.3197674419, 76.6802325581;
786
- --wp-admin-border-width-focus: 2px;
787
- }
788
- @media (min-resolution: 192dpi) {
789
- body.admin-color-ectoplasm {
790
- --wp-admin-border-width-focus: 1.5px;
791
- }
792
- }
793
-
794
- body.admin-color-midnight {
795
- --wp-admin-theme-color: #e14d43;
796
- --wp-admin-theme-color--rgb: 225, 77, 67;
797
- --wp-admin-theme-color-darker-10: rgb(221.4908256881, 56.1788990826, 45.0091743119);
798
- --wp-admin-theme-color-darker-10--rgb: 221.4908256881, 56.1788990826, 45.0091743119;
799
- --wp-admin-theme-color-darker-20: rgb(207.8348623853, 44.2201834862, 33.1651376147);
800
- --wp-admin-theme-color-darker-20--rgb: 207.8348623853, 44.2201834862, 33.1651376147;
801
- --wp-admin-border-width-focus: 2px;
802
- }
803
- @media (min-resolution: 192dpi) {
804
- body.admin-color-midnight {
805
- --wp-admin-border-width-focus: 1.5px;
806
- }
807
- }
808
-
809
- body.admin-color-ocean {
810
- --wp-admin-theme-color: #627c83;
811
- --wp-admin-theme-color--rgb: 98, 124, 131;
812
- --wp-admin-theme-color-darker-10: rgb(87.0873362445, 110.192139738, 116.4126637555);
813
- --wp-admin-theme-color-darker-10--rgb: 87.0873362445, 110.192139738, 116.4126637555;
814
- --wp-admin-theme-color-darker-20: rgb(76.1746724891, 96.384279476, 101.8253275109);
815
- --wp-admin-theme-color-darker-20--rgb: 76.1746724891, 96.384279476, 101.8253275109;
816
- --wp-admin-border-width-focus: 2px;
817
- }
818
- @media (min-resolution: 192dpi) {
819
- body.admin-color-ocean {
820
- --wp-admin-border-width-focus: 1.5px;
821
- }
822
- }
823
-
824
- body.admin-color-sunrise {
825
- --wp-admin-theme-color: #dd823b;
826
- --wp-admin-theme-color--rgb: 221, 130, 59;
827
- --wp-admin-theme-color-darker-10: rgb(216.8782608696, 116.1847826087, 37.6217391304);
828
- --wp-admin-theme-color-darker-10--rgb: 216.8782608696, 116.1847826087, 37.6217391304;
829
- --wp-admin-theme-color-darker-20: rgb(195.147826087, 104.5434782609, 33.852173913);
830
- --wp-admin-theme-color-darker-20--rgb: 195.147826087, 104.5434782609, 33.852173913;
831
- --wp-admin-border-width-focus: 2px;
832
- }
833
- @media (min-resolution: 192dpi) {
834
- body.admin-color-sunrise {
835
- --wp-admin-border-width-focus: 1.5px;
836
- }
837
726
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-post",
3
- "version": "8.36.1-next.6deb34194.0",
3
+ "version": "8.36.1-next.76cff8c98.0",
4
4
  "description": "Edit Post module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -23,12 +23,20 @@
23
23
  "node": ">=18.12.0",
24
24
  "npm": ">=8.19.2"
25
25
  },
26
- "main": "build/index.js",
27
- "module": "build-module/index.js",
26
+ "files": [
27
+ "src",
28
+ "build",
29
+ "build-module",
30
+ "build-style",
31
+ "build-types",
32
+ "*.md"
33
+ ],
34
+ "main": "build/index.cjs",
35
+ "module": "build-module/index.mjs",
28
36
  "exports": {
29
37
  ".": {
30
- "import": "./build-module/index.js",
31
- "default": "./build/index.js"
38
+ "import": "./build-module/index.mjs",
39
+ "default": "./build/index.cjs"
32
40
  },
33
41
  "./package.json": "./package.json"
34
42
  },
@@ -40,37 +48,37 @@
40
48
  "postbox"
41
49
  ],
42
50
  "dependencies": {
43
- "@wordpress/a11y": "^4.36.1-next.6deb34194.0",
44
- "@wordpress/admin-ui": "^1.4.1-next.6deb34194.0",
45
- "@wordpress/api-fetch": "^7.36.1-next.6deb34194.0",
46
- "@wordpress/base-styles": "^6.12.1-next.6deb34194.0",
47
- "@wordpress/block-editor": "^15.9.1-next.6deb34194.0",
48
- "@wordpress/block-library": "^9.36.1-next.6deb34194.0",
49
- "@wordpress/blocks": "^15.9.1-next.6deb34194.0",
50
- "@wordpress/commands": "^1.36.1-next.6deb34194.0",
51
- "@wordpress/components": "^31.0.1-next.6deb34194.0",
52
- "@wordpress/compose": "^7.36.1-next.6deb34194.0",
53
- "@wordpress/core-data": "^7.36.1-next.6deb34194.0",
54
- "@wordpress/data": "^10.36.1-next.6deb34194.0",
55
- "@wordpress/deprecated": "^4.36.1-next.6deb34194.0",
56
- "@wordpress/dom": "^4.36.1-next.6deb34194.0",
57
- "@wordpress/editor": "^14.36.1-next.6deb34194.0",
58
- "@wordpress/element": "^6.36.1-next.6deb34194.0",
59
- "@wordpress/global-styles-engine": "^1.3.1-next.6deb34194.0",
60
- "@wordpress/hooks": "^4.36.1-next.6deb34194.0",
61
- "@wordpress/html-entities": "^4.36.1-next.6deb34194.0",
62
- "@wordpress/i18n": "^6.9.1-next.6deb34194.0",
63
- "@wordpress/icons": "^11.3.1-next.6deb34194.0",
64
- "@wordpress/keyboard-shortcuts": "^5.36.1-next.6deb34194.0",
65
- "@wordpress/keycodes": "^4.36.1-next.6deb34194.0",
66
- "@wordpress/notices": "^5.36.1-next.6deb34194.0",
67
- "@wordpress/plugins": "^7.36.1-next.6deb34194.0",
68
- "@wordpress/preferences": "^4.36.1-next.6deb34194.0",
69
- "@wordpress/private-apis": "^1.36.1-next.6deb34194.0",
70
- "@wordpress/url": "^4.36.1-next.6deb34194.0",
71
- "@wordpress/viewport": "^6.36.1-next.6deb34194.0",
72
- "@wordpress/warning": "^3.36.1-next.6deb34194.0",
73
- "@wordpress/widgets": "^4.36.1-next.6deb34194.0",
51
+ "@wordpress/a11y": "^4.36.1-next.76cff8c98.0",
52
+ "@wordpress/admin-ui": "^1.4.1-next.76cff8c98.0",
53
+ "@wordpress/api-fetch": "^7.36.1-next.76cff8c98.0",
54
+ "@wordpress/base-styles": "^6.12.2-next.76cff8c98.0",
55
+ "@wordpress/block-editor": "^15.9.1-next.76cff8c98.0",
56
+ "@wordpress/block-library": "^9.36.2-next.76cff8c98.0",
57
+ "@wordpress/blocks": "^15.9.1-next.76cff8c98.0",
58
+ "@wordpress/commands": "^1.36.1-next.76cff8c98.0",
59
+ "@wordpress/components": "^31.0.1-next.76cff8c98.0",
60
+ "@wordpress/compose": "^7.36.1-next.76cff8c98.0",
61
+ "@wordpress/core-data": "^7.36.1-next.76cff8c98.0",
62
+ "@wordpress/data": "^10.36.1-next.76cff8c98.0",
63
+ "@wordpress/deprecated": "^4.36.1-next.76cff8c98.0",
64
+ "@wordpress/dom": "^4.36.1-next.76cff8c98.0",
65
+ "@wordpress/editor": "^14.36.1-next.76cff8c98.0",
66
+ "@wordpress/element": "^6.36.1-next.76cff8c98.0",
67
+ "@wordpress/global-styles-engine": "^1.3.1-next.76cff8c98.0",
68
+ "@wordpress/hooks": "^4.36.1-next.76cff8c98.0",
69
+ "@wordpress/html-entities": "^4.36.1-next.76cff8c98.0",
70
+ "@wordpress/i18n": "^6.9.1-next.76cff8c98.0",
71
+ "@wordpress/icons": "^11.3.1-next.76cff8c98.0",
72
+ "@wordpress/keyboard-shortcuts": "^5.36.1-next.76cff8c98.0",
73
+ "@wordpress/keycodes": "^4.36.1-next.76cff8c98.0",
74
+ "@wordpress/notices": "^5.36.1-next.76cff8c98.0",
75
+ "@wordpress/plugins": "^7.36.1-next.76cff8c98.0",
76
+ "@wordpress/preferences": "^4.36.1-next.76cff8c98.0",
77
+ "@wordpress/private-apis": "^1.36.1-next.76cff8c98.0",
78
+ "@wordpress/url": "^4.36.1-next.76cff8c98.0",
79
+ "@wordpress/viewport": "^6.36.1-next.76cff8c98.0",
80
+ "@wordpress/warning": "^3.36.1-next.76cff8c98.0",
81
+ "@wordpress/widgets": "^4.36.1-next.76cff8c98.0",
74
82
  "clsx": "^2.1.1",
75
83
  "memize": "^2.1.0"
76
84
  },
@@ -81,5 +89,5 @@
81
89
  "publishConfig": {
82
90
  "access": "public"
83
91
  },
84
- "gitHead": "457096e9e9b3896d2d4fe54fc19d7fb571ee9a44"
92
+ "gitHead": "368727f14b858e75179e140967c2d9ec965c8790"
85
93
  }
@@ -59,11 +59,9 @@ export default function InitPatternModal() {
59
59
  onChange={ setTitle }
60
60
  placeholder={ __( 'My pattern' ) }
61
61
  className="patterns-create-modal__name-input"
62
- __nextHasNoMarginBottom
63
62
  __next40pxDefaultSize
64
63
  />
65
64
  <ToggleControl
66
- __nextHasNoMarginBottom
67
65
  label={ _x( 'Synced', 'pattern (singular)' ) }
68
66
  help={ __(
69
67
  'Sync this pattern across multiple locations.'
@@ -412,6 +412,7 @@ function Layout( {
412
412
  currentPost: { postId: currentPostId, postType: currentPostType },
413
413
  onNavigateToEntityRecord,
414
414
  onNavigateToPreviousEntityRecord,
415
+ previousSelectedBlockPath,
415
416
  } = useNavigateToEntityRecord(
416
417
  initialPostId,
417
418
  initialPostType,
@@ -627,6 +628,7 @@ function Layout( {
627
628
  // eslint-disable-next-line jsx-a11y/no-autofocus
628
629
  autoFocus={ ! isWelcomeGuideVisible }
629
630
  onActionPerformed={ onActionPerformed }
631
+ initialSelection={ previousSelectedBlockPath }
630
632
  extraSidebarPanels={
631
633
  showMetaBoxes && <MetaBoxes location="side" />
632
634
  }
@@ -3,7 +3,14 @@
3
3
  */
4
4
  import { useCallback, useReducer } from '@wordpress/element';
5
5
  import { useSelect, useDispatch } from '@wordpress/data';
6
- import { store as editorStore } from '@wordpress/editor';
6
+ import { store as editorStore, privateApis } from '@wordpress/editor';
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import { unlock } from '../lock-unlock';
12
+
13
+ const { useGenerateBlockPath } = unlock( privateApis );
7
14
 
8
15
  /**
9
16
  * A hook that records the 'entity' history in the post editor as a user
@@ -25,13 +32,24 @@ export default function useNavigateToEntityRecord(
25
32
  initialPostType,
26
33
  defaultRenderingMode
27
34
  ) {
35
+ const generateBlockPath = useGenerateBlockPath();
28
36
  const [ postHistory, dispatch ] = useReducer(
29
- ( historyState, { type, post, previousRenderingMode } ) => {
37
+ (
38
+ historyState,
39
+ { type, post, previousRenderingMode, selectedBlockPath }
40
+ ) => {
30
41
  if ( type === 'push' ) {
31
- return [ ...historyState, { post, previousRenderingMode } ];
42
+ // Update the current item with the selected block path before pushing new item
43
+ const updatedHistory = [ ...historyState ];
44
+ const currentIndex = updatedHistory.length - 1;
45
+ updatedHistory[ currentIndex ] = {
46
+ ...updatedHistory[ currentIndex ],
47
+ selectedBlockPath,
48
+ };
49
+ return [ ...updatedHistory, { post, previousRenderingMode } ];
32
50
  }
33
51
  if ( type === 'pop' ) {
34
- // Try to leave one item in the history.
52
+ // Remove the current item from history
35
53
  if ( historyState.length > 1 ) {
36
54
  return historyState.slice( 0, -1 );
37
55
  }
@@ -44,8 +62,7 @@ export default function useNavigateToEntityRecord(
44
62
  },
45
63
  ]
46
64
  );
47
-
48
- const { post, previousRenderingMode } =
65
+ const { post, previousRenderingMode, selectedBlockPath } =
49
66
  postHistory[ postHistory.length - 1 ];
50
67
 
51
68
  const { getRenderingMode } = useSelect( editorStore );
@@ -53,19 +70,32 @@ export default function useNavigateToEntityRecord(
53
70
 
54
71
  const onNavigateToEntityRecord = useCallback(
55
72
  ( params ) => {
73
+ // Generate block path from clientId if provided
74
+ const blockPath = params.selectedBlockClientId
75
+ ? generateBlockPath( params.selectedBlockClientId )
76
+ : null;
77
+
56
78
  dispatch( {
57
79
  type: 'push',
58
80
  post: { postId: params.postId, postType: params.postType },
59
81
  // Save the current rendering mode so we can restore it when navigating back.
60
82
  previousRenderingMode: getRenderingMode(),
83
+ selectedBlockPath: blockPath,
61
84
  } );
62
85
  setRenderingMode( defaultRenderingMode );
63
86
  },
64
- [ getRenderingMode, setRenderingMode, defaultRenderingMode ]
87
+ [
88
+ getRenderingMode,
89
+ setRenderingMode,
90
+ defaultRenderingMode,
91
+ generateBlockPath,
92
+ ]
65
93
  );
66
94
 
67
95
  const onNavigateToPreviousEntityRecord = useCallback( () => {
68
- dispatch( { type: 'pop' } );
96
+ dispatch( {
97
+ type: 'pop',
98
+ } );
69
99
  if ( previousRenderingMode ) {
70
100
  setRenderingMode( previousRenderingMode );
71
101
  }
@@ -78,5 +108,7 @@ export default function useNavigateToEntityRecord(
78
108
  postHistory.length > 1
79
109
  ? onNavigateToPreviousEntityRecord
80
110
  : undefined,
111
+ // Return the selected block path from the current history item
112
+ previousSelectedBlockPath: selectedBlockPath,
81
113
  };
82
114
  }
package/src/style.scss CHANGED
@@ -49,5 +49,3 @@ body.js.block-editor-page {
49
49
  height: auto;
50
50
  }
51
51
  }
52
-
53
- @include wordpress-admin-schemes();
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/hooks/use-navigate-to-entity-record.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useCallback, useReducer } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * A hook that records the 'entity' history in the post editor as a user\n * navigates between editing a post and editing the post template or patterns.\n *\n * Implemented as a stack, so a little similar to the browser history API.\n *\n * Used to control displaying UI elements like the back button.\n *\n * @param {number} initialPostId The post id of the post when the editor loaded.\n * @param {string} initialPostType The post type of the post when the editor loaded.\n * @param {string} defaultRenderingMode The rendering mode to switch to when navigating.\n *\n * @return {Object} An object containing the `currentPost` variable and\n * `onNavigateToEntityRecord` and `onNavigateToPreviousEntityRecord` functions.\n */\nexport default function useNavigateToEntityRecord(\n\tinitialPostId,\n\tinitialPostType,\n\tdefaultRenderingMode\n) {\n\tconst [ postHistory, dispatch ] = useReducer(\n\t\t( historyState, { type, post, previousRenderingMode } ) => {\n\t\t\tif ( type === 'push' ) {\n\t\t\t\treturn [ ...historyState, { post, previousRenderingMode } ];\n\t\t\t}\n\t\t\tif ( type === 'pop' ) {\n\t\t\t\t// Try to leave one item in the history.\n\t\t\t\tif ( historyState.length > 1 ) {\n\t\t\t\t\treturn historyState.slice( 0, -1 );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn historyState;\n\t\t},\n\t\t[\n\t\t\t{\n\t\t\t\tpost: { postId: initialPostId, postType: initialPostType },\n\t\t\t},\n\t\t]\n\t);\n\n\tconst { post, previousRenderingMode } =\n\t\tpostHistory[ postHistory.length - 1 ];\n\n\tconst { getRenderingMode } = useSelect( editorStore );\n\tconst { setRenderingMode } = useDispatch( editorStore );\n\n\tconst onNavigateToEntityRecord = useCallback(\n\t\t( params ) => {\n\t\t\tdispatch( {\n\t\t\t\ttype: 'push',\n\t\t\t\tpost: { postId: params.postId, postType: params.postType },\n\t\t\t\t// Save the current rendering mode so we can restore it when navigating back.\n\t\t\t\tpreviousRenderingMode: getRenderingMode(),\n\t\t\t} );\n\t\t\tsetRenderingMode( defaultRenderingMode );\n\t\t},\n\t\t[ getRenderingMode, setRenderingMode, defaultRenderingMode ]\n\t);\n\n\tconst onNavigateToPreviousEntityRecord = useCallback( () => {\n\t\tdispatch( { type: 'pop' } );\n\t\tif ( previousRenderingMode ) {\n\t\t\tsetRenderingMode( previousRenderingMode );\n\t\t}\n\t}, [ setRenderingMode, previousRenderingMode ] );\n\n\treturn {\n\t\tcurrentPost: post,\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord:\n\t\t\tpostHistory.length > 1\n\t\t\t\t? onNavigateToPreviousEntityRecord\n\t\t\t\t: undefined,\n\t};\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAwC;AACxC,kBAAuC;AACvC,oBAAqC;AAiBtB,SAAR,0BACN,eACA,iBACA,sBACC;AACD,QAAM,CAAE,aAAa,QAAS,QAAI;AAAA,IACjC,CAAE,cAAc,EAAE,MAAM,MAAAA,OAAM,uBAAAC,uBAAsB,MAAO;AAC1D,UAAK,SAAS,QAAS;AACtB,eAAO,CAAE,GAAG,cAAc,EAAE,MAAAD,OAAM,uBAAAC,uBAAsB,CAAE;AAAA,MAC3D;AACA,UAAK,SAAS,OAAQ;AAErB,YAAK,aAAa,SAAS,GAAI;AAC9B,iBAAO,aAAa,MAAO,GAAG,EAAG;AAAA,QAClC;AAAA,MACD;AACA,aAAO;AAAA,IACR;AAAA,IACA;AAAA,MACC;AAAA,QACC,MAAM,EAAE,QAAQ,eAAe,UAAU,gBAAgB;AAAA,MAC1D;AAAA,IACD;AAAA,EACD;AAEA,QAAM,EAAE,MAAM,sBAAsB,IACnC,YAAa,YAAY,SAAS,CAAE;AAErC,QAAM,EAAE,iBAAiB,QAAI,uBAAW,cAAAC,KAAY;AACpD,QAAM,EAAE,iBAAiB,QAAI,yBAAa,cAAAA,KAAY;AAEtD,QAAM,+BAA2B;AAAA,IAChC,CAAE,WAAY;AACb,eAAU;AAAA,QACT,MAAM;AAAA,QACN,MAAM,EAAE,QAAQ,OAAO,QAAQ,UAAU,OAAO,SAAS;AAAA;AAAA,QAEzD,uBAAuB,iBAAiB;AAAA,MACzC,CAAE;AACF,uBAAkB,oBAAqB;AAAA,IACxC;AAAA,IACA,CAAE,kBAAkB,kBAAkB,oBAAqB;AAAA,EAC5D;AAEA,QAAM,uCAAmC,4BAAa,MAAM;AAC3D,aAAU,EAAE,MAAM,MAAM,CAAE;AAC1B,QAAK,uBAAwB;AAC5B,uBAAkB,qBAAsB;AAAA,IACzC;AAAA,EACD,GAAG,CAAE,kBAAkB,qBAAsB,CAAE;AAE/C,SAAO;AAAA,IACN,aAAa;AAAA,IACb;AAAA,IACA,kCACC,YAAY,SAAS,IAClB,mCACA;AAAA,EACL;AACD;",
6
- "names": ["post", "previousRenderingMode", "editorStore"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/hooks/use-navigate-to-entity-record.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useCallback, useReducer } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * A hook that records the 'entity' history in the post editor as a user\n * navigates between editing a post and editing the post template or patterns.\n *\n * Implemented as a stack, so a little similar to the browser history API.\n *\n * Used to control displaying UI elements like the back button.\n *\n * @param {number} initialPostId The post id of the post when the editor loaded.\n * @param {string} initialPostType The post type of the post when the editor loaded.\n * @param {string} defaultRenderingMode The rendering mode to switch to when navigating.\n *\n * @return {Object} An object containing the `currentPost` variable and\n * `onNavigateToEntityRecord` and `onNavigateToPreviousEntityRecord` functions.\n */\nexport default function useNavigateToEntityRecord(\n\tinitialPostId,\n\tinitialPostType,\n\tdefaultRenderingMode\n) {\n\tconst [ postHistory, dispatch ] = useReducer(\n\t\t( historyState, { type, post, previousRenderingMode } ) => {\n\t\t\tif ( type === 'push' ) {\n\t\t\t\treturn [ ...historyState, { post, previousRenderingMode } ];\n\t\t\t}\n\t\t\tif ( type === 'pop' ) {\n\t\t\t\t// Try to leave one item in the history.\n\t\t\t\tif ( historyState.length > 1 ) {\n\t\t\t\t\treturn historyState.slice( 0, -1 );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn historyState;\n\t\t},\n\t\t[\n\t\t\t{\n\t\t\t\tpost: { postId: initialPostId, postType: initialPostType },\n\t\t\t},\n\t\t]\n\t);\n\n\tconst { post, previousRenderingMode } =\n\t\tpostHistory[ postHistory.length - 1 ];\n\n\tconst { getRenderingMode } = useSelect( editorStore );\n\tconst { setRenderingMode } = useDispatch( editorStore );\n\n\tconst onNavigateToEntityRecord = useCallback(\n\t\t( params ) => {\n\t\t\tdispatch( {\n\t\t\t\ttype: 'push',\n\t\t\t\tpost: { postId: params.postId, postType: params.postType },\n\t\t\t\t// Save the current rendering mode so we can restore it when navigating back.\n\t\t\t\tpreviousRenderingMode: getRenderingMode(),\n\t\t\t} );\n\t\t\tsetRenderingMode( defaultRenderingMode );\n\t\t},\n\t\t[ getRenderingMode, setRenderingMode, defaultRenderingMode ]\n\t);\n\n\tconst onNavigateToPreviousEntityRecord = useCallback( () => {\n\t\tdispatch( { type: 'pop' } );\n\t\tif ( previousRenderingMode ) {\n\t\t\tsetRenderingMode( previousRenderingMode );\n\t\t}\n\t}, [ setRenderingMode, previousRenderingMode ] );\n\n\treturn {\n\t\tcurrentPost: post,\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord:\n\t\t\tpostHistory.length > 1\n\t\t\t\t? onNavigateToPreviousEntityRecord\n\t\t\t\t: undefined,\n\t};\n}\n"],
5
- "mappings": ";AAGA,SAAS,aAAa,kBAAkB;AACxC,SAAS,WAAW,mBAAmB;AACvC,SAAS,SAAS,mBAAmB;AAiBtB,SAAR,0BACN,eACA,iBACA,sBACC;AACD,QAAM,CAAE,aAAa,QAAS,IAAI;AAAA,IACjC,CAAE,cAAc,EAAE,MAAM,MAAAA,OAAM,uBAAAC,uBAAsB,MAAO;AAC1D,UAAK,SAAS,QAAS;AACtB,eAAO,CAAE,GAAG,cAAc,EAAE,MAAAD,OAAM,uBAAAC,uBAAsB,CAAE;AAAA,MAC3D;AACA,UAAK,SAAS,OAAQ;AAErB,YAAK,aAAa,SAAS,GAAI;AAC9B,iBAAO,aAAa,MAAO,GAAG,EAAG;AAAA,QAClC;AAAA,MACD;AACA,aAAO;AAAA,IACR;AAAA,IACA;AAAA,MACC;AAAA,QACC,MAAM,EAAE,QAAQ,eAAe,UAAU,gBAAgB;AAAA,MAC1D;AAAA,IACD;AAAA,EACD;AAEA,QAAM,EAAE,MAAM,sBAAsB,IACnC,YAAa,YAAY,SAAS,CAAE;AAErC,QAAM,EAAE,iBAAiB,IAAI,UAAW,WAAY;AACpD,QAAM,EAAE,iBAAiB,IAAI,YAAa,WAAY;AAEtD,QAAM,2BAA2B;AAAA,IAChC,CAAE,WAAY;AACb,eAAU;AAAA,QACT,MAAM;AAAA,QACN,MAAM,EAAE,QAAQ,OAAO,QAAQ,UAAU,OAAO,SAAS;AAAA;AAAA,QAEzD,uBAAuB,iBAAiB;AAAA,MACzC,CAAE;AACF,uBAAkB,oBAAqB;AAAA,IACxC;AAAA,IACA,CAAE,kBAAkB,kBAAkB,oBAAqB;AAAA,EAC5D;AAEA,QAAM,mCAAmC,YAAa,MAAM;AAC3D,aAAU,EAAE,MAAM,MAAM,CAAE;AAC1B,QAAK,uBAAwB;AAC5B,uBAAkB,qBAAsB;AAAA,IACzC;AAAA,EACD,GAAG,CAAE,kBAAkB,qBAAsB,CAAE;AAE/C,SAAO;AAAA,IACN,aAAa;AAAA,IACb;AAAA,IACA,kCACC,YAAY,SAAS,IAClB,mCACA;AAAA,EACL;AACD;",
6
- "names": ["post", "previousRenderingMode"]
7
- }