@wordpress/edit-post 7.31.0 → 7.32.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 (104) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +5 -127
  3. package/build/components/header/index.js +1 -1
  4. package/build/components/header/index.js.map +1 -1
  5. package/build/components/header/post-publish-button-or-toggle.js +2 -7
  6. package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
  7. package/build/components/keyboard-shortcut-help-modal/index.js +3 -0
  8. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  9. package/build/components/layout/actions-panel.js +4 -7
  10. package/build/components/layout/actions-panel.js.map +1 -1
  11. package/build/components/layout/index.js +5 -2
  12. package/build/components/layout/index.js.map +1 -1
  13. package/build/components/sidebar/plugin-post-publish-panel/index.js +16 -64
  14. package/build/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
  15. package/build/components/sidebar/plugin-pre-publish-panel/index.js +16 -63
  16. package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
  17. package/build/components/sidebar/settings-sidebar/index.js +8 -3
  18. package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
  19. package/build/editor.js +7 -2
  20. package/build/editor.js.map +1 -1
  21. package/build/hooks/commands/use-common-commands.js +2 -2
  22. package/build/hooks/commands/use-common-commands.js.map +1 -1
  23. package/build/hooks/use-navigate-to-entity-record.js +36 -19
  24. package/build/hooks/use-navigate-to-entity-record.js.map +1 -1
  25. package/build/index.js +3 -4
  26. package/build/index.js.map +1 -1
  27. package/build/index.native.js +2 -4
  28. package/build/index.native.js.map +1 -1
  29. package/build/store/actions.js +36 -23
  30. package/build/store/actions.js.map +1 -1
  31. package/build/store/reducer.js +1 -15
  32. package/build/store/reducer.js.map +1 -1
  33. package/build/store/selectors.js +10 -5
  34. package/build/store/selectors.js.map +1 -1
  35. package/build-module/components/header/index.js +1 -1
  36. package/build-module/components/header/index.js.map +1 -1
  37. package/build-module/components/header/post-publish-button-or-toggle.js +2 -7
  38. package/build-module/components/header/post-publish-button-or-toggle.js.map +1 -1
  39. package/build-module/components/keyboard-shortcut-help-modal/index.js +3 -0
  40. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  41. package/build-module/components/layout/actions-panel.js +4 -5
  42. package/build-module/components/layout/actions-panel.js.map +1 -1
  43. package/build-module/components/layout/index.js +5 -2
  44. package/build-module/components/layout/index.js.map +1 -1
  45. package/build-module/components/sidebar/plugin-post-publish-panel/index.js +14 -62
  46. package/build-module/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
  47. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js +14 -61
  48. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
  49. package/build-module/components/sidebar/settings-sidebar/index.js +9 -4
  50. package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
  51. package/build-module/editor.js +7 -2
  52. package/build-module/editor.js.map +1 -1
  53. package/build-module/hooks/commands/use-common-commands.js +2 -2
  54. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  55. package/build-module/hooks/use-navigate-to-entity-record.js +37 -20
  56. package/build-module/hooks/use-navigate-to-entity-record.js.map +1 -1
  57. package/build-module/index.js +4 -4
  58. package/build-module/index.js.map +1 -1
  59. package/build-module/index.native.js +2 -4
  60. package/build-module/index.native.js.map +1 -1
  61. package/build-module/store/actions.js +30 -15
  62. package/build-module/store/actions.js.map +1 -1
  63. package/build-module/store/reducer.js +1 -13
  64. package/build-module/store/reducer.js.map +1 -1
  65. package/build-module/store/selectors.js +9 -3
  66. package/build-module/store/selectors.js.map +1 -1
  67. package/build-style/classic-rtl.css +1 -1
  68. package/build-style/classic.css +1 -1
  69. package/build-style/style-rtl.css +1 -7
  70. package/build-style/style.css +1 -7
  71. package/package.json +32 -32
  72. package/src/classic.scss +2 -1
  73. package/src/components/header/index.js +1 -1
  74. package/src/components/header/post-publish-button-or-toggle.js +2 -8
  75. package/src/components/keyboard-shortcut-help-modal/index.js +4 -0
  76. package/src/components/layout/actions-panel.js +5 -4
  77. package/src/components/layout/index.js +7 -2
  78. package/src/components/meta-boxes/meta-boxes-area/style.scss +1 -1
  79. package/src/components/sidebar/plugin-post-publish-panel/index.js +12 -67
  80. package/src/components/sidebar/plugin-pre-publish-panel/index.js +12 -66
  81. package/src/components/sidebar/settings-sidebar/index.js +6 -2
  82. package/src/editor.js +12 -2
  83. package/src/hooks/commands/use-common-commands.js +2 -2
  84. package/src/hooks/use-navigate-to-entity-record.js +37 -24
  85. package/src/index.js +3 -2
  86. package/src/index.native.js +1 -4
  87. package/src/store/actions.js +27 -12
  88. package/src/store/reducer.js +0 -13
  89. package/src/store/selectors.js +11 -3
  90. package/src/style.scss +0 -1
  91. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +0 -107
  92. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +0 -1
  93. package/build/components/sidebar/template-summary/index.js +0 -36
  94. package/build/components/sidebar/template-summary/index.js.map +0 -1
  95. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +0 -100
  96. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +0 -1
  97. package/build-module/components/sidebar/template-summary/index.js +0 -29
  98. package/build-module/components/sidebar/template-summary/index.js.map +0 -1
  99. package/src/components/block-settings-menu/plugin-block-settings-menu-item.js +0 -108
  100. package/src/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.snap +0 -39
  101. package/src/components/sidebar/plugin-post-publish-panel/test/index.js +0 -33
  102. package/src/components/sidebar/plugin-pre-publish-panel/test/index.js +0 -33
  103. package/src/components/sidebar/template-summary/index.js +0 -37
  104. package/src/components/sidebar/template-summary/style.scss +0 -5
@@ -1,87 +1,39 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.default = void 0;
7
+ exports.default = EditPostPluginPostPublishPanel;
7
8
  var _react = require("react");
8
- var _plugins = require("@wordpress/plugins");
9
- var _components = require("@wordpress/components");
9
+ var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
10
+ var _editor = require("@wordpress/editor");
10
11
  /**
11
12
  * WordPress dependencies
12
13
  */
13
14
 
14
- const {
15
- Fill,
16
- Slot
17
- } = (0, _components.createSlotFill)('PluginPostPublishPanel');
18
-
19
15
  /**
20
16
  * Renders provided content to the post-publish panel in the publish flow
21
17
  * (side panel that opens after a user publishes the post).
22
18
  *
19
+ * @deprecated since 6.6, use `wp.editor.PluginPostPublishPanel` instead.
20
+ *
23
21
  * @param {Object} props Component properties.
24
22
  * @param {string} [props.className] An optional class name added to the panel.
25
23
  * @param {string} [props.title] Title displayed at the top of the panel.
26
24
  * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. When no title is provided it is always opened.
27
25
  * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
28
26
  * @param {Element} props.children Children to be rendered
29
- *
30
- * @example
31
- * ```js
32
- * // Using ES5 syntax
33
- * var __ = wp.i18n.__;
34
- * var PluginPostPublishPanel = wp.editPost.PluginPostPublishPanel;
35
- *
36
- * function MyPluginPostPublishPanel() {
37
- * return React.createElement(
38
- * PluginPostPublishPanel,
39
- * {
40
- * className: 'my-plugin-post-publish-panel',
41
- * title: __( 'My panel title' ),
42
- * initialOpen: true,
43
- * },
44
- * __( 'My panel content' )
45
- * );
46
- * }
47
- * ```
48
- *
49
- * @example
50
- * ```jsx
51
- * // Using ESNext syntax
52
- * import { __ } from '@wordpress/i18n';
53
- * import { PluginPostPublishPanel } from '@wordpress/edit-post';
54
- *
55
- * const MyPluginPostPublishPanel = () => (
56
- * <PluginPostPublishPanel
57
- * className="my-plugin-post-publish-panel"
58
- * title={ __( 'My panel title' ) }
59
- * initialOpen={ true }
60
- * >
61
- * { __( 'My panel content' ) }
62
- * </PluginPostPublishPanel>
63
- * );
64
- * ```
65
- *
66
27
  * @return {Component} The component to be rendered.
67
28
  */
68
- const PluginPostPublishPanel = ({
69
- children,
70
- className,
71
- title,
72
- initialOpen = false,
73
- icon
74
- }) => {
75
- const {
76
- icon: pluginIcon
77
- } = (0, _plugins.usePluginContext)();
78
- return (0, _react.createElement)(Fill, null, (0, _react.createElement)(_components.PanelBody, {
79
- className: className,
80
- initialOpen: initialOpen || !title,
81
- title: title,
82
- icon: icon !== null && icon !== void 0 ? icon : pluginIcon
83
- }, children));
84
- };
85
- PluginPostPublishPanel.Slot = Slot;
86
- var _default = exports.default = PluginPostPublishPanel;
29
+ function EditPostPluginPostPublishPanel(props) {
30
+ (0, _deprecated.default)('wp.editPost.PluginPostPublishPanel', {
31
+ since: '6.6',
32
+ version: '6.8',
33
+ alternative: 'wp.editor.PluginPostPublishPanel'
34
+ });
35
+ return (0, _react.createElement)(_editor.PluginPostPublishPanel, {
36
+ ...props
37
+ });
38
+ }
87
39
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_plugins","require","_components","Fill","Slot","createSlotFill","PluginPostPublishPanel","children","className","title","initialOpen","icon","pluginIcon","usePluginContext","_react","createElement","PanelBody","_default","exports","default"],"sources":["@wordpress/edit-post/src/components/sidebar/plugin-post-publish-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { usePluginContext } from '@wordpress/plugins';\nimport { createSlotFill, PanelBody } from '@wordpress/components';\n\nconst { Fill, Slot } = createSlotFill( 'PluginPostPublishPanel' );\n\n/**\n * Renders provided content to the post-publish panel in the publish flow\n * (side panel that opens after a user publishes the post).\n *\n * @param {Object} props Component properties.\n * @param {string} [props.className] An optional class name added to the panel.\n * @param {string} [props.title] Title displayed at the top of the panel.\n * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. When no title is provided it is always opened.\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.\n * @param {Element} props.children Children to be rendered\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var PluginPostPublishPanel = wp.editPost.PluginPostPublishPanel;\n *\n * function MyPluginPostPublishPanel() {\n * \treturn React.createElement(\n * \t\tPluginPostPublishPanel,\n * \t\t{\n * \t\t\tclassName: 'my-plugin-post-publish-panel',\n * \t\t\ttitle: __( 'My panel title' ),\n * \t\t\tinitialOpen: true,\n * \t\t},\n * \t\t__( 'My panel content' )\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PluginPostPublishPanel } from '@wordpress/edit-post';\n *\n * const MyPluginPostPublishPanel = () => (\n * \t<PluginPostPublishPanel\n * \t\tclassName=\"my-plugin-post-publish-panel\"\n * \t\ttitle={ __( 'My panel title' ) }\n * \t\tinitialOpen={ true }\n * \t>\n * { __( 'My panel content' ) }\n * \t</PluginPostPublishPanel>\n * );\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nconst PluginPostPublishPanel = ( {\n\tchildren,\n\tclassName,\n\ttitle,\n\tinitialOpen = false,\n\ticon,\n} ) => {\n\tconst { icon: pluginIcon } = usePluginContext();\n\n\treturn (\n\t\t<Fill>\n\t\t\t<PanelBody\n\t\t\t\tclassName={ className }\n\t\t\t\tinitialOpen={ initialOpen || ! title }\n\t\t\t\ttitle={ title }\n\t\t\t\ticon={ icon ?? pluginIcon }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</PanelBody>\n\t\t</Fill>\n\t);\n};\n\nPluginPostPublishPanel.Slot = Slot;\n\nexport default PluginPostPublishPanel;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA,MAAM;EAAEE,IAAI;EAAEC;AAAK,CAAC,GAAG,IAAAC,0BAAc,EAAE,wBAAyB,CAAC;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,sBAAsB,GAAGA,CAAE;EAChCC,QAAQ;EACRC,SAAS;EACTC,KAAK;EACLC,WAAW,GAAG,KAAK;EACnBC;AACD,CAAC,KAAM;EACN,MAAM;IAAEA,IAAI,EAAEC;EAAW,CAAC,GAAG,IAAAC,yBAAgB,EAAC,CAAC;EAE/C,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACZ,IAAI,QACJ,IAAAW,MAAA,CAAAC,aAAA,EAACb,WAAA,CAAAc,SAAS;IACTR,SAAS,EAAGA,SAAW;IACvBE,WAAW,EAAGA,WAAW,IAAI,CAAED,KAAO;IACtCA,KAAK,EAAGA,KAAO;IACfE,IAAI,EAAGA,IAAI,aAAJA,IAAI,cAAJA,IAAI,GAAIC;EAAY,GAEzBL,QACQ,CACN,CAAC;AAET,CAAC;AAEDD,sBAAsB,CAACF,IAAI,GAAGA,IAAI;AAAC,IAAAa,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEpBb,sBAAsB"}
1
+ {"version":3,"names":["_deprecated","_interopRequireDefault","require","_editor","EditPostPluginPostPublishPanel","props","deprecated","since","version","alternative","_react","createElement","PluginPostPublishPanel"],"sources":["@wordpress/edit-post/src/components/sidebar/plugin-post-publish-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { PluginPostPublishPanel } from '@wordpress/editor';\n\n/**\n * Renders provided content to the post-publish panel in the publish flow\n * (side panel that opens after a user publishes the post).\n *\n * @deprecated since 6.6, use `wp.editor.PluginPostPublishPanel` instead.\n *\n * @param {Object} props Component properties.\n * @param {string} [props.className] An optional class name added to the panel.\n * @param {string} [props.title] Title displayed at the top of the panel.\n * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. When no title is provided it is always opened.\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.\n * @param {Element} props.children Children to be rendered\n * @return {Component} The component to be rendered.\n */\nexport default function EditPostPluginPostPublishPanel( props ) {\n\tdeprecated( 'wp.editPost.PluginPostPublishPanel', {\n\t\tsince: '6.6',\n\t\tversion: '6.8',\n\t\talternative: 'wp.editor.PluginPostPublishPanel',\n\t} );\n\treturn <PluginPostPublishPanel { ...props } />;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,8BAA8BA,CAAEC,KAAK,EAAG;EAC/D,IAAAC,mBAAU,EAAE,oCAAoC,EAAE;IACjDC,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE,KAAK;IACdC,WAAW,EAAE;EACd,CAAE,CAAC;EACH,OAAO,IAAAC,MAAA,CAAAC,aAAA,EAACR,OAAA,CAAAS,sBAAsB;IAAA,GAAMP;EAAK,CAAI,CAAC;AAC/C"}
@@ -1,25 +1,23 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.default = void 0;
7
+ exports.default = EditPostPluginPrePublishPanel;
7
8
  var _react = require("react");
8
- var _components = require("@wordpress/components");
9
- var _plugins = require("@wordpress/plugins");
9
+ var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
10
+ var _editor = require("@wordpress/editor");
10
11
  /**
11
12
  * WordPress dependencies
12
13
  */
13
14
 
14
- const {
15
- Fill,
16
- Slot
17
- } = (0, _components.createSlotFill)('PluginPrePublishPanel');
18
-
19
15
  /**
20
16
  * Renders provided content to the pre-publish side panel in the publish flow
21
17
  * (side panel that opens when a user first pushes "Publish" from the main editor).
22
18
  *
19
+ * @deprecated since 6.6, use `wp.editor.PluginPrePublishPanel` instead.
20
+ *
23
21
  * @param {Object} props Component props.
24
22
  * @param {string} [props.className] An optional class name added to the panel.
25
23
  * @param {string} [props.title] Title displayed at the top of the panel.
@@ -30,61 +28,16 @@ const {
30
28
  * the sidebar is pinned to toolbar.
31
29
  * @param {Element} props.children Children to be rendered
32
30
  *
33
- * @example
34
- * ```js
35
- * // Using ES5 syntax
36
- * var __ = wp.i18n.__;
37
- * var PluginPrePublishPanel = wp.editPost.PluginPrePublishPanel;
38
- *
39
- * function MyPluginPrePublishPanel() {
40
- * return React.createElement(
41
- * PluginPrePublishPanel,
42
- * {
43
- * className: 'my-plugin-pre-publish-panel',
44
- * title: __( 'My panel title' ),
45
- * initialOpen: true,
46
- * },
47
- * __( 'My panel content' )
48
- * );
49
- * }
50
- * ```
51
- *
52
- * @example
53
- * ```jsx
54
- * // Using ESNext syntax
55
- * import { __ } from '@wordpress/i18n';
56
- * import { PluginPrePublishPanel } from '@wordpress/edit-post';
57
- *
58
- * const MyPluginPrePublishPanel = () => (
59
- * <PluginPrePublishPanel
60
- * className="my-plugin-pre-publish-panel"
61
- * title={ __( 'My panel title' ) }
62
- * initialOpen={ true }
63
- * >
64
- * { __( 'My panel content' ) }
65
- * </PluginPrePublishPanel>
66
- * );
67
- * ```
68
- *
69
31
  * @return {Component} The component to be rendered.
70
32
  */
71
- const PluginPrePublishPanel = ({
72
- children,
73
- className,
74
- title,
75
- initialOpen = false,
76
- icon
77
- }) => {
78
- const {
79
- icon: pluginIcon
80
- } = (0, _plugins.usePluginContext)();
81
- return (0, _react.createElement)(Fill, null, (0, _react.createElement)(_components.PanelBody, {
82
- className: className,
83
- initialOpen: initialOpen || !title,
84
- title: title,
85
- icon: icon !== null && icon !== void 0 ? icon : pluginIcon
86
- }, children));
87
- };
88
- PluginPrePublishPanel.Slot = Slot;
89
- var _default = exports.default = PluginPrePublishPanel;
33
+ function EditPostPluginPrePublishPanel(props) {
34
+ (0, _deprecated.default)('wp.editPost.PluginPrePublishPanel', {
35
+ since: '6.6',
36
+ version: '6.8',
37
+ alternative: 'wp.editor.PluginPrePublishPanel'
38
+ });
39
+ return (0, _react.createElement)(_editor.PluginPrePublishPanel, {
40
+ ...props
41
+ });
42
+ }
90
43
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_plugins","Fill","Slot","createSlotFill","PluginPrePublishPanel","children","className","title","initialOpen","icon","pluginIcon","usePluginContext","_react","createElement","PanelBody","_default","exports","default"],"sources":["@wordpress/edit-post/src/components/sidebar/plugin-pre-publish-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelBody } from '@wordpress/components';\nimport { usePluginContext } from '@wordpress/plugins';\n\nconst { Fill, Slot } = createSlotFill( 'PluginPrePublishPanel' );\n\n/**\n * Renders provided content to the pre-publish side panel in the publish flow\n * (side panel that opens when a user first pushes \"Publish\" from the main editor).\n *\n * @param {Object} props Component props.\n * @param {string} [props.className] An optional class name added to the panel.\n * @param {string} [props.title] Title displayed at the top of the panel.\n * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened.\n * When no title is provided it is always opened.\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/)\n * icon slug string, or an SVG WP element, to be rendered when\n * the sidebar is pinned to toolbar.\n * @param {Element} props.children Children to be rendered\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var PluginPrePublishPanel = wp.editPost.PluginPrePublishPanel;\n *\n * function MyPluginPrePublishPanel() {\n * \treturn React.createElement(\n * \t\tPluginPrePublishPanel,\n * \t\t{\n * \t\t\tclassName: 'my-plugin-pre-publish-panel',\n * \t\t\ttitle: __( 'My panel title' ),\n * \t\t\tinitialOpen: true,\n * \t\t},\n * \t\t__( 'My panel content' )\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PluginPrePublishPanel } from '@wordpress/edit-post';\n *\n * const MyPluginPrePublishPanel = () => (\n * \t<PluginPrePublishPanel\n * \t\tclassName=\"my-plugin-pre-publish-panel\"\n * \t\ttitle={ __( 'My panel title' ) }\n * \t\tinitialOpen={ true }\n * \t>\n * \t { __( 'My panel content' ) }\n * \t</PluginPrePublishPanel>\n * );\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nconst PluginPrePublishPanel = ( {\n\tchildren,\n\tclassName,\n\ttitle,\n\tinitialOpen = false,\n\ticon,\n} ) => {\n\tconst { icon: pluginIcon } = usePluginContext();\n\n\treturn (\n\t\t<Fill>\n\t\t\t<PanelBody\n\t\t\t\tclassName={ className }\n\t\t\t\tinitialOpen={ initialOpen || ! title }\n\t\t\t\ttitle={ title }\n\t\t\t\ticon={ icon ?? pluginIcon }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</PanelBody>\n\t\t</Fill>\n\t);\n};\n\nPluginPrePublishPanel.Slot = Slot;\n\nexport default PluginPrePublishPanel;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA,MAAM;EAAEE,IAAI;EAAEC;AAAK,CAAC,GAAG,IAAAC,0BAAc,EAAE,uBAAwB,CAAC;;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,qBAAqB,GAAGA,CAAE;EAC/BC,QAAQ;EACRC,SAAS;EACTC,KAAK;EACLC,WAAW,GAAG,KAAK;EACnBC;AACD,CAAC,KAAM;EACN,MAAM;IAAEA,IAAI,EAAEC;EAAW,CAAC,GAAG,IAAAC,yBAAgB,EAAC,CAAC;EAE/C,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACZ,IAAI,QACJ,IAAAW,MAAA,CAAAC,aAAA,EAACf,WAAA,CAAAgB,SAAS;IACTR,SAAS,EAAGA,SAAW;IACvBE,WAAW,EAAGA,WAAW,IAAI,CAAED,KAAO;IACtCA,KAAK,EAAGA,KAAO;IACfE,IAAI,EAAGA,IAAI,aAAJA,IAAI,cAAJA,IAAI,GAAIC;EAAY,GAEzBL,QACQ,CACN,CAAC;AAET,CAAC;AAEDD,qBAAqB,CAACF,IAAI,GAAGA,IAAI;AAAC,IAAAa,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEnBb,qBAAqB"}
1
+ {"version":3,"names":["_deprecated","_interopRequireDefault","require","_editor","EditPostPluginPrePublishPanel","props","deprecated","since","version","alternative","_react","createElement","PluginPrePublishPanel"],"sources":["@wordpress/edit-post/src/components/sidebar/plugin-pre-publish-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { PluginPrePublishPanel } from '@wordpress/editor';\n\n/**\n * Renders provided content to the pre-publish side panel in the publish flow\n * (side panel that opens when a user first pushes \"Publish\" from the main editor).\n *\n * @deprecated since 6.6, use `wp.editor.PluginPrePublishPanel` instead.\n *\n * @param {Object} props Component props.\n * @param {string} [props.className] An optional class name added to the panel.\n * @param {string} [props.title] Title displayed at the top of the panel.\n * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened.\n * When no title is provided it is always opened.\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/)\n * icon slug string, or an SVG WP element, to be rendered when\n * the sidebar is pinned to toolbar.\n * @param {Element} props.children Children to be rendered\n *\n * @return {Component} The component to be rendered.\n */\nexport default function EditPostPluginPrePublishPanel( props ) {\n\tdeprecated( 'wp.editPost.PluginPrePublishPanel', {\n\t\tsince: '6.6',\n\t\tversion: '6.8',\n\t\talternative: 'wp.editor.PluginPrePublishPanel',\n\t} );\n\treturn <PluginPrePublishPanel { ...props } />;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,6BAA6BA,CAAEC,KAAK,EAAG;EAC9D,IAAAC,mBAAU,EAAE,mCAAmC,EAAE;IAChDC,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE,KAAK;IACdC,WAAW,EAAE;EACd,CAAE,CAAC;EACH,OAAO,IAAAC,MAAA,CAAAC,aAAA,EAACR,OAAA,CAAAS,qBAAqB;IAAA,GAAMP;EAAK,CAAI,CAAC;AAC9C"}
@@ -18,7 +18,6 @@ var _settingsHeader = _interopRequireDefault(require("../settings-header"));
18
18
  var _postStatus = _interopRequireDefault(require("../post-status"));
19
19
  var _metaBoxes = _interopRequireDefault(require("../../meta-boxes"));
20
20
  var _pluginSidebar = _interopRequireDefault(require("../plugin-sidebar"));
21
- var _templateSummary = _interopRequireDefault(require("../template-summary"));
22
21
  var _store = require("../../../store");
23
22
  var _components = require("@wordpress/components");
24
23
  var _lockUnlock = require("../../../lock-unlock");
@@ -30,9 +29,15 @@ var _lockUnlock = require("../../../lock-unlock");
30
29
  * Internal dependencies
31
30
  */
32
31
 
32
+ const {
33
+ PostCardPanel
34
+ } = (0, _lockUnlock.unlock)(_editor.privateApis);
33
35
  const {
34
36
  Tabs
35
37
  } = (0, _lockUnlock.unlock)(_components.privateApis);
38
+ const {
39
+ PatternOverridesPanel
40
+ } = (0, _lockUnlock.unlock)(_editor.privateApis);
36
41
  const SIDEBAR_ACTIVE_BY_DEFAULT = _element.Platform.select({
37
42
  web: true,
38
43
  native: false
@@ -95,9 +100,9 @@ const SidebarContent = ({
95
100
  }, (0, _react.createElement)(Tabs.TabPanel, {
96
101
  tabId: sidebars.document,
97
102
  focusable: false
98
- }, !isEditingTemplate && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_postStatus.default, null), (0, _react.createElement)(_editor.PluginDocumentSettingPanel.Slot, null), (0, _react.createElement)(_editor.PostLastRevisionPanel, null), (0, _react.createElement)(_editor.PostTaxonomiesPanel, null), (0, _react.createElement)(_editor.PostExcerptPanel, null), (0, _react.createElement)(_editor.PostDiscussionPanel, null), (0, _react.createElement)(_editor.PageAttributesPanel, null), (0, _react.createElement)(_metaBoxes.default, {
103
+ }, (0, _react.createElement)(PostCardPanel, null), !isEditingTemplate && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_postStatus.default, null), (0, _react.createElement)(_editor.PluginDocumentSettingPanel.Slot, null), (0, _react.createElement)(_editor.PostLastRevisionPanel, null), (0, _react.createElement)(_editor.PostTaxonomiesPanel, null), (0, _react.createElement)(_editor.PostExcerptPanel, null), (0, _react.createElement)(_editor.PostDiscussionPanel, null), (0, _react.createElement)(_editor.PageAttributesPanel, null), (0, _react.createElement)(PatternOverridesPanel, null), (0, _react.createElement)(_metaBoxes.default, {
99
104
  location: "side"
100
- })), isEditingTemplate && (0, _react.createElement)(_templateSummary.default, null)), (0, _react.createElement)(Tabs.TabPanel, {
105
+ }))), (0, _react.createElement)(Tabs.TabPanel, {
101
106
  tabId: sidebars.block,
102
107
  focusable: false
103
108
  }, (0, _react.createElement)(_blockEditor.BlockInspector, null))));
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","_data","_element","_i18n","_icons","_interface","_keyboardShortcuts","_editor","_settingsHeader","_interopRequireDefault","_postStatus","_metaBoxes","_pluginSidebar","_templateSummary","_store","_components","_lockUnlock","Tabs","unlock","componentsPrivateApis","SIDEBAR_ACTIVE_BY_DEFAULT","Platform","select","web","native","sidebars","exports","document","block","SidebarContent","sidebarName","keyboardShortcut","isEditingTemplate","tabListRef","useRef","tabsContextValue","useContext","Context","useEffect","tabsElements","Array","from","current","querySelectorAll","selectedTabElement","find","element","getAttribute","activeElement","ownerDocument","tabsHasFocus","some","id","focus","_react","createElement","default","identifier","header","Provider","value","ref","closeLabel","__","className","headerClassName","title","toggleShortcut","icon","isRTL","drawerLeft","drawerRight","isActiveByDefault","TabPanel","tabId","focusable","Fragment","PluginDocumentSettingPanel","Slot","PostLastRevisionPanel","PostTaxonomiesPanel","PostExcerptPanel","PostDiscussionPanel","PageAttributesPanel","location","BlockInspector","SettingsSidebar","isSettingsSidebarActive","useSelect","sidebar","interfaceStore","getActiveComplementaryArea","editPostStore","name","isSettingsSidebar","includes","blockEditorStore","getBlockSelectionStart","shortcut","keyboardShortcutsStore","getShortcutRepresentation","editorStore","getCurrentPostType","openGeneralSidebar","useDispatch","onTabSelect","useCallback","newSelectedTabId","selectedTabId","onSelect","selectOnMove","_default"],"sources":["@wordpress/edit-post/src/components/sidebar/settings-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPlatform,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseRef,\n} from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport {\n\tstore as editorStore,\n\tPageAttributesPanel,\n\tPluginDocumentSettingPanel,\n\tPostDiscussionPanel,\n\tPostExcerptPanel,\n\tPostLastRevisionPanel,\n\tPostTaxonomiesPanel,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport SettingsHeader from '../settings-header';\nimport PostStatus from '../post-status';\nimport MetaBoxes from '../../meta-boxes';\nimport PluginSidebarEditPost from '../plugin-sidebar';\nimport TemplateSummary from '../template-summary';\nimport { store as editPostStore } from '../../../store';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { unlock } from '../../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\nexport const sidebars = {\n\tdocument: 'edit-post/document',\n\tblock: 'edit-post/block',\n};\n\nconst SidebarContent = ( {\n\tsidebarName,\n\tkeyboardShortcut,\n\tisEditingTemplate,\n} ) => {\n\tconst tabListRef = useRef( null );\n\t// Because `PluginSidebarEditPost` renders a `ComplementaryArea`, we\n\t// need to forward the `Tabs` context so it can be passed through the\n\t// underlying slot/fill.\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\t// This effect addresses a race condition caused by tabbing from the last\n\t// block in the editor into the settings sidebar. Without this effect, the\n\t// selected tab and browser focus can become separated in an unexpected way\n\t// (e.g the \"block\" tab is focused, but the \"post\" tab is selected).\n\tuseEffect( () => {\n\t\tconst tabsElements = Array.from(\n\t\t\ttabListRef.current?.querySelectorAll( '[role=\"tab\"]' ) || []\n\t\t);\n\t\tconst selectedTabElement = tabsElements.find(\n\t\t\t// We are purposefully using a custom `data-tab-id` attribute here\n\t\t\t// because we don't want rely on any assumptions about `Tabs`\n\t\t\t// component internals.\n\t\t\t( element ) => element.getAttribute( 'data-tab-id' ) === sidebarName\n\t\t);\n\t\tconst activeElement = selectedTabElement?.ownerDocument.activeElement;\n\t\tconst tabsHasFocus = tabsElements.some( ( element ) => {\n\t\t\treturn activeElement && activeElement.id === element.id;\n\t\t} );\n\t\tif (\n\t\t\ttabsHasFocus &&\n\t\t\tselectedTabElement &&\n\t\t\tselectedTabElement.id !== activeElement?.id\n\t\t) {\n\t\t\tselectedTabElement?.focus();\n\t\t}\n\t}, [ sidebarName ] );\n\n\treturn (\n\t\t<PluginSidebarEditPost\n\t\t\tidentifier={ sidebarName }\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<SettingsHeader ref={ tabListRef } />\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t}\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\t// This classname is added so we can apply a corrective negative\n\t\t\t// margin to the panel.\n\t\t\t// see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049\n\t\t\tclassName=\"edit-post-sidebar__panel\"\n\t\t\theaderClassName=\"edit-post-sidebar__panel-tabs\"\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\ttitle={ __( 'Settings' ) }\n\t\t\ttoggleShortcut={ keyboardShortcut }\n\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<Tabs.TabPanel tabId={ sidebars.document } focusable={ false }>\n\t\t\t\t\t{ ! isEditingTemplate && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<PostStatus />\n\t\t\t\t\t\t\t<PluginDocumentSettingPanel.Slot />\n\t\t\t\t\t\t\t<PostLastRevisionPanel />\n\t\t\t\t\t\t\t<PostTaxonomiesPanel />\n\t\t\t\t\t\t\t<PostExcerptPanel />\n\t\t\t\t\t\t\t<PostDiscussionPanel />\n\t\t\t\t\t\t\t<PageAttributesPanel />\n\t\t\t\t\t\t\t<MetaBoxes location=\"side\" />\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isEditingTemplate && <TemplateSummary /> }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel tabId={ sidebars.block } focusable={ false }>\n\t\t\t\t\t<BlockInspector />\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs.Context.Provider>\n\t\t</PluginSidebarEditPost>\n\t);\n};\n\nconst SettingsSidebar = () => {\n\tconst {\n\t\tsidebarName,\n\t\tisSettingsSidebarActive,\n\t\tkeyboardShortcut,\n\t\tisEditingTemplate,\n\t} = useSelect( ( select ) => {\n\t\t// The settings sidebar is used by the edit-post/document and edit-post/block sidebars.\n\t\t// sidebarName represents the sidebar that is active or that should be active when the SettingsSidebar toggle button is pressed.\n\t\t// If one of the two sidebars is active the component will contain the content of that sidebar.\n\t\t// When neither of the two sidebars is active we can not simply return null, because the PluginSidebarEditPost\n\t\t// component, besides being used to render the sidebar, also renders the toggle button. In that case sidebarName\n\t\t// should contain the sidebar that will be active when the toggle button is pressed. If a block\n\t\t// is selected, that should be edit-post/block otherwise it's edit-post/document.\n\t\tlet sidebar = select( interfaceStore ).getActiveComplementaryArea(\n\t\t\teditPostStore.name\n\t\t);\n\t\tlet isSettingsSidebar = true;\n\t\tif ( ! [ sidebars.document, sidebars.block ].includes( sidebar ) ) {\n\t\t\tisSettingsSidebar = false;\n\t\t\tif ( select( blockEditorStore ).getBlockSelectionStart() ) {\n\t\t\t\tsidebar = sidebars.block;\n\t\t\t}\n\t\t\tsidebar = sidebars.document;\n\t\t}\n\t\tconst shortcut = select(\n\t\t\tkeyboardShortcutsStore\n\t\t).getShortcutRepresentation( 'core/edit-post/toggle-sidebar' );\n\t\treturn {\n\t\t\tsidebarName: sidebar,\n\t\t\tisSettingsSidebarActive: isSettingsSidebar,\n\t\t\tkeyboardShortcut: shortcut,\n\t\t\tisEditingTemplate:\n\t\t\t\tselect( editorStore ).getCurrentPostType() === 'wp_template',\n\t\t};\n\t}, [] );\n\n\tconst { openGeneralSidebar } = useDispatch( editPostStore );\n\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\topenGeneralSidebar( newSelectedTabId );\n\t\t\t}\n\t\t},\n\t\t[ openGeneralSidebar ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\t// Due to how this component is controlled (via a value from the\n\t\t\t// `interfaceStore`), when the sidebar closes the currently selected\n\t\t\t// tab can't be found. This causes the component to continuously reset\n\t\t\t// the selection to `null` in an infinite loop.Proactively setting\n\t\t\t// the selected tab to `null` avoids that.\n\t\t\tselectedTabId={ isSettingsSidebarActive ? sidebarName : null }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<SidebarContent\n\t\t\t\tsidebarName={ sidebarName }\n\t\t\t\tkeyboardShortcut={ keyboardShortcut }\n\t\t\t\tisEditingTemplate={ isEditingTemplate }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n};\n\nexport default SettingsSidebar;\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAOA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAaA,IAAAQ,eAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,WAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,UAAA,GAAAF,sBAAA,CAAAT,OAAA;AACA,IAAAY,cAAA,GAAAH,sBAAA,CAAAT,OAAA;AACA,IAAAa,gBAAA,GAAAJ,sBAAA,CAAAT,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AACA,IAAAe,WAAA,GAAAf,OAAA;AACA,IAAAgB,WAAA,GAAAhB,OAAA;AAvCA;AACA;AACA;;AA2BA;AAC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B,CAAC,CAAC,EAAG;QAC1DR,OAAO,GAAGhE,QAAQ,CAACG,KAAK;MACzB;MACA6D,OAAO,GAAGhE,QAAQ,CAACE,QAAQ;IAC5B;IACA,MAAMuE,QAAQ,GAAG5E,MAAM,CACtB6E,wBACD,CAAC,CAACC,yBAAyB,CAAE,+BAAgC,CAAC;IAC9D,OAAO;MACNtE,WAAW,EAAE2D,OAAO;MACpBF,uBAAuB,EAAEO,iBAAiB;MAC1C/D,gBAAgB,EAAEmE,QAAQ;MAC1BlE,iBAAiB,EAChBV,MAAM,CAAE+E,aAAY,CAAC,CAACC,kBAAkB,CAAC,CAAC,KAAK;IACjD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAM;IAAEC;EAAmB,CAAC,GAAG,IAAAC,iBAAW,EAAEZ,YAAc,CAAC;EAE3D,MAAMa,WAAW,GAAG,IAAAC,oBAAW,EAC5BC,gBAAgB,IAAM;IACvB,IAAK,CAAC,CAAEA,gBAAgB,EAAG;MAC1BJ,kBAAkB,CAAEI,gBAAiB,CAAC;IACvC;EACD,CAAC,EACD,CAAEJ,kBAAkB,CACrB,CAAC;EAED,OACC,IAAAjD,MAAA,CAAAC,aAAA,EAACtC;EACA;EACA;EACA;EACA;EACA;EAAA;IACA2F,aAAa,EAAGrB,uBAAuB,GAAGzD,WAAW,GAAG,IAAM;IAC9D+E,QAAQ,EAAGJ,WAAa;IACxBK,YAAY,EAAG;EAAO,GAEtB,IAAAxD,MAAA,CAAAC,aAAA,EAAC1B,cAAc;IACdC,WAAW,EAAGA,WAAa;IAC3BC,gBAAgB,EAAGA,gBAAkB;IACrCC,iBAAiB,EAAGA;EAAmB,CACvC,CACI,CAAC;AAET,CAAC;AAAC,IAAA+E,QAAA,GAAArF,OAAA,CAAA8B,OAAA,GAEa8B,eAAe"}
1
+ {"version":3,"names":["_blockEditor","require","_data","_element","_i18n","_icons","_interface","_keyboardShortcuts","_editor","_settingsHeader","_interopRequireDefault","_postStatus","_metaBoxes","_pluginSidebar","_store","_components","_lockUnlock","PostCardPanel","unlock","editorPrivateApis","Tabs","componentsPrivateApis","PatternOverridesPanel","SIDEBAR_ACTIVE_BY_DEFAULT","Platform","select","web","native","sidebars","exports","document","block","SidebarContent","sidebarName","keyboardShortcut","isEditingTemplate","tabListRef","useRef","tabsContextValue","useContext","Context","useEffect","tabsElements","Array","from","current","querySelectorAll","selectedTabElement","find","element","getAttribute","activeElement","ownerDocument","tabsHasFocus","some","id","focus","_react","createElement","default","identifier","header","Provider","value","ref","closeLabel","__","className","headerClassName","title","toggleShortcut","icon","isRTL","drawerLeft","drawerRight","isActiveByDefault","TabPanel","tabId","focusable","Fragment","PluginDocumentSettingPanel","Slot","PostLastRevisionPanel","PostTaxonomiesPanel","PostExcerptPanel","PostDiscussionPanel","PageAttributesPanel","location","BlockInspector","SettingsSidebar","isSettingsSidebarActive","useSelect","sidebar","interfaceStore","getActiveComplementaryArea","editPostStore","name","isSettingsSidebar","includes","blockEditorStore","getBlockSelectionStart","shortcut","keyboardShortcutsStore","getShortcutRepresentation","editorStore","getCurrentPostType","openGeneralSidebar","useDispatch","onTabSelect","useCallback","newSelectedTabId","selectedTabId","onSelect","selectOnMove","_default"],"sources":["@wordpress/edit-post/src/components/sidebar/settings-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPlatform,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseRef,\n} from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport {\n\tstore as editorStore,\n\tPageAttributesPanel,\n\tPluginDocumentSettingPanel,\n\tPostDiscussionPanel,\n\tPostExcerptPanel,\n\tPostLastRevisionPanel,\n\tPostTaxonomiesPanel,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport SettingsHeader from '../settings-header';\nimport PostStatus from '../post-status';\nimport MetaBoxes from '../../meta-boxes';\nimport PluginSidebarEditPost from '../plugin-sidebar';\nimport { store as editPostStore } from '../../../store';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { unlock } from '../../../lock-unlock';\n\nconst { PostCardPanel } = unlock( editorPrivateApis );\n\nconst { Tabs } = unlock( componentsPrivateApis );\nconst { PatternOverridesPanel } = unlock( editorPrivateApis );\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\nexport const sidebars = {\n\tdocument: 'edit-post/document',\n\tblock: 'edit-post/block',\n};\n\nconst SidebarContent = ( {\n\tsidebarName,\n\tkeyboardShortcut,\n\tisEditingTemplate,\n} ) => {\n\tconst tabListRef = useRef( null );\n\t// Because `PluginSidebarEditPost` renders a `ComplementaryArea`, we\n\t// need to forward the `Tabs` context so it can be passed through the\n\t// underlying slot/fill.\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\t// This effect addresses a race condition caused by tabbing from the last\n\t// block in the editor into the settings sidebar. Without this effect, the\n\t// selected tab and browser focus can become separated in an unexpected way\n\t// (e.g the \"block\" tab is focused, but the \"post\" tab is selected).\n\tuseEffect( () => {\n\t\tconst tabsElements = Array.from(\n\t\t\ttabListRef.current?.querySelectorAll( '[role=\"tab\"]' ) || []\n\t\t);\n\t\tconst selectedTabElement = tabsElements.find(\n\t\t\t// We are purposefully using a custom `data-tab-id` attribute here\n\t\t\t// because we don't want rely on any assumptions about `Tabs`\n\t\t\t// component internals.\n\t\t\t( element ) => element.getAttribute( 'data-tab-id' ) === sidebarName\n\t\t);\n\t\tconst activeElement = selectedTabElement?.ownerDocument.activeElement;\n\t\tconst tabsHasFocus = tabsElements.some( ( element ) => {\n\t\t\treturn activeElement && activeElement.id === element.id;\n\t\t} );\n\t\tif (\n\t\t\ttabsHasFocus &&\n\t\t\tselectedTabElement &&\n\t\t\tselectedTabElement.id !== activeElement?.id\n\t\t) {\n\t\t\tselectedTabElement?.focus();\n\t\t}\n\t}, [ sidebarName ] );\n\n\treturn (\n\t\t<PluginSidebarEditPost\n\t\t\tidentifier={ sidebarName }\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<SettingsHeader ref={ tabListRef } />\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t}\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\t// This classname is added so we can apply a corrective negative\n\t\t\t// margin to the panel.\n\t\t\t// see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049\n\t\t\tclassName=\"edit-post-sidebar__panel\"\n\t\t\theaderClassName=\"edit-post-sidebar__panel-tabs\"\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\ttitle={ __( 'Settings' ) }\n\t\t\ttoggleShortcut={ keyboardShortcut }\n\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<Tabs.TabPanel tabId={ sidebars.document } focusable={ false }>\n\t\t\t\t\t<PostCardPanel />\n\t\t\t\t\t{ ! isEditingTemplate && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<PostStatus />\n\t\t\t\t\t\t\t<PluginDocumentSettingPanel.Slot />\n\t\t\t\t\t\t\t<PostLastRevisionPanel />\n\t\t\t\t\t\t\t<PostTaxonomiesPanel />\n\t\t\t\t\t\t\t<PostExcerptPanel />\n\t\t\t\t\t\t\t<PostDiscussionPanel />\n\t\t\t\t\t\t\t<PageAttributesPanel />\n\t\t\t\t\t\t\t<PatternOverridesPanel />\n\t\t\t\t\t\t\t<MetaBoxes location=\"side\" />\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel tabId={ sidebars.block } focusable={ false }>\n\t\t\t\t\t<BlockInspector />\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs.Context.Provider>\n\t\t</PluginSidebarEditPost>\n\t);\n};\n\nconst SettingsSidebar = () => {\n\tconst {\n\t\tsidebarName,\n\t\tisSettingsSidebarActive,\n\t\tkeyboardShortcut,\n\t\tisEditingTemplate,\n\t} = useSelect( ( select ) => {\n\t\t// The settings sidebar is used by the edit-post/document and edit-post/block sidebars.\n\t\t// sidebarName represents the sidebar that is active or that should be active when the SettingsSidebar toggle button is pressed.\n\t\t// If one of the two sidebars is active the component will contain the content of that sidebar.\n\t\t// When neither of the two sidebars is active we can not simply return null, because the PluginSidebarEditPost\n\t\t// component, besides being used to render the sidebar, also renders the toggle button. In that case sidebarName\n\t\t// should contain the sidebar that will be active when the toggle button is pressed. If a block\n\t\t// is selected, that should be edit-post/block otherwise it's edit-post/document.\n\t\tlet sidebar = select( interfaceStore ).getActiveComplementaryArea(\n\t\t\teditPostStore.name\n\t\t);\n\t\tlet isSettingsSidebar = true;\n\t\tif ( ! [ sidebars.document, sidebars.block ].includes( sidebar ) ) {\n\t\t\tisSettingsSidebar = false;\n\t\t\tif ( select( blockEditorStore ).getBlockSelectionStart() ) {\n\t\t\t\tsidebar = sidebars.block;\n\t\t\t}\n\t\t\tsidebar = sidebars.document;\n\t\t}\n\t\tconst shortcut = select(\n\t\t\tkeyboardShortcutsStore\n\t\t).getShortcutRepresentation( 'core/edit-post/toggle-sidebar' );\n\t\treturn {\n\t\t\tsidebarName: sidebar,\n\t\t\tisSettingsSidebarActive: isSettingsSidebar,\n\t\t\tkeyboardShortcut: shortcut,\n\t\t\tisEditingTemplate:\n\t\t\t\tselect( editorStore ).getCurrentPostType() === 'wp_template',\n\t\t};\n\t}, [] );\n\n\tconst { openGeneralSidebar } = useDispatch( editPostStore );\n\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\topenGeneralSidebar( newSelectedTabId );\n\t\t\t}\n\t\t},\n\t\t[ openGeneralSidebar ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\t// Due to how this component is controlled (via a value from the\n\t\t\t// `interfaceStore`), when the sidebar closes the currently selected\n\t\t\t// tab can't be found. This causes the component to continuously reset\n\t\t\t// the selection to `null` in an infinite loop.Proactively setting\n\t\t\t// the selected tab to `null` avoids that.\n\t\t\tselectedTabId={ isSettingsSidebarActive ? sidebarName : null }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<SidebarContent\n\t\t\t\tsidebarName={ sidebarName }\n\t\t\t\tkeyboardShortcut={ keyboardShortcut }\n\t\t\t\tisEditingTemplate={ isEditingTemplate }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n};\n\nexport default SettingsSidebar;\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAOA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAcA,IAAAQ,eAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,WAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,UAAA,GAAAF,sBAAA,CAAAT,OAAA;AACA,IAAAY,cAAA,GAAAH,sBAAA,CAAAT,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,WAAA,GAAAd,OAAA;AACA,IAAAe,WAAA,GAAAf,OAAA;AAvCA;AACA;AACA;;AA4BA;AACA;AACA;;AASA,MAAM;EAAEgB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ArF,OAAA,CAAA8B,OAAA,GAEa8B,eAAe"}
package/build/editor.js CHANGED
@@ -36,11 +36,10 @@ function Editor({
36
36
  ...props
37
37
  }) {
38
38
  const {
39
- initialPost,
40
39
  currentPost,
41
40
  onNavigateToEntityRecord,
42
41
  onNavigateToPreviousEntityRecord
43
- } = (0, _useNavigateToEntityRecord.default)(initialPostId, initialPostType);
42
+ } = (0, _useNavigateToEntityRecord.default)(initialPostId, initialPostType, 'post-only');
44
43
  const {
45
44
  post,
46
45
  template
@@ -72,6 +71,12 @@ function Editor({
72
71
  onNavigateToPreviousEntityRecord,
73
72
  defaultRenderingMode: 'post-only'
74
73
  }), [settings, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord]);
74
+ const initialPost = (0, _element.useMemo)(() => {
75
+ return {
76
+ type: initialPostType,
77
+ id: initialPostId
78
+ };
79
+ }, [initialPostType, initialPostId]);
75
80
  if (!post) {
76
81
  return null;
77
82
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_editor","_element","_components","_coreData","_commands","_layout","_interopRequireDefault","_editorInitialization","_store","_lockUnlock","_useNavigateToEntityRecord","ExperimentalEditorProvider","unlock","editorPrivateApis","Editor","postId","initialPostId","postType","initialPostType","settings","initialEdits","props","initialPost","currentPost","onNavigateToEntityRecord","onNavigateToPreviousEntityRecord","useNavigateToEntityRecord","post","template","useSelect","select","_getPostType$viewable","getEditedPostTemplate","editPostStore","getEntityRecord","getPostType","canUser","coreStore","getEditorSettings","editorStore","postObject","supportsTemplateMode","isViewable","viewable","canEditTemplate","editorSettings","useMemo","defaultRenderingMode","_react","createElement","SlotFillProvider","useSubRegistry","__unstableTemplate","ErrorBoundary","CommandMenu","default","PostLockedModal","_default","exports"],"sources":["@wordpress/edit-post/src/editor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { CommandMenu } from '@wordpress/commands';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './lock-unlock';\nimport useNavigateToEntityRecord from './hooks/use-navigate-to-entity-record';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\n\nfunction Editor( {\n\tpostId: initialPostId,\n\tpostType: initialPostType,\n\tsettings,\n\tinitialEdits,\n\t...props\n} ) {\n\tconst {\n\t\tinitialPost,\n\t\tcurrentPost,\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord,\n\t} = useNavigateToEntityRecord( initialPostId, initialPostType );\n\n\tconst { post, template } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostTemplate } = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\n\t\t\tconst postObject = getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tcurrentPost.postType,\n\t\t\t\tcurrentPost.postId\n\t\t\t);\n\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable =\n\t\t\t\tgetPostType( currentPost.postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\t\t\treturn {\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode &&\n\t\t\t\t\tisViewable &&\n\t\t\t\t\tcanEditTemplate &&\n\t\t\t\t\tcurrentPost.postType !== 'wp_template'\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ currentPost.postType, currentPost.postId ]\n\t);\n\n\tconst editorSettings = useMemo(\n\t\t() => ( {\n\t\t\t...settings,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t\tdefaultRenderingMode: 'post-only',\n\t\t} ),\n\t\t[ settings, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord ]\n\t);\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<ExperimentalEditorProvider\n\t\t\t\tsettings={ editorSettings }\n\t\t\t\tpost={ post }\n\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t__unstableTemplate={ template }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t<EditorInitialization />\n\t\t\t\t\t<Layout initialPost={ initialPost } />\n\t\t\t\t</ErrorBoundary>\n\t\t\t\t<PostLockedModal />\n\t\t\t</ExperimentalEditorProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n\nexport default Editor;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAMA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAKA,IAAAM,OAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,qBAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AACA,IAAAW,0BAAA,GAAAJ,sBAAA,CAAAP,OAAA;AAtBA;AACA;AACA;;AAaA;AACA;AACA;;AAOA,MAAM;EAAEY;AAA2B,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAElE,SAASC,MAAMA,CAAE;EAChBC,MAAM,EAAEC,aA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XK,wBAAwB;IACxBC,gCAAgC;IAChCsB,oBAAoB,EAAE;EACvB,CAAC,CAAE,EACH,CAAE5B,QAAQ,EAAEK,wBAAwB,EAAEC,gCAAgC,CACvE,CAAC;EAED,IAAK,CAAEE,IAAI,EAAG;IACb,OAAO,IAAI;EACZ;EAEA,OACC,IAAAqB,MAAA,CAAAC,aAAA,EAAC/C,WAAA,CAAAgD,gBAAgB,QAChB,IAAAF,MAAA,CAAAC,aAAA,EAACtC,0BAA0B;IAC1BQ,QAAQ,EAAG0B,cAAgB;IAC3BlB,IAAI,EAAGA,IAAM;IACbP,YAAY,EAAGA,YAAc;IAC7B+B,cAAc,EAAG,KAAO;IACxBC,kBAAkB,EAAGxB,QAAU;IAAA,GAC1BP;EAAK,GAEV,IAAA2B,MAAA,CAAAC,aAAA,EAACjD,OAAA,CAAAqD,aAAa,QACb,IAAAL,MAAA,CAAAC,aAAA,EAAC7C,SAAA,CAAAkD,WAAW,MAAE,CAAC,EACf,IAAAN,MAAA,CAAAC,aAAA,EAAC1C,qBAAA,CAAAgD,OAAoB,MAAE,CAAC,EACxB,IAAAP,MAAA,CAAAC,aAAA,EAAC5C,OAAA,CAAAkD,OAAM;IAACjC,WAAW,EAAGA;EAAa,CAAE,CACvB,CAAC,EAChB,IAAA0B,MAAA,CAAAC,aAAA,EAACjD,OAAA,CAAAwD,eAAe,MAAE,CACS,CACX,CAAC;AAErB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAEczC,MAAM"}
1
+ {"version":3,"names":["_data","require","_editor","_element","_components","_coreData","_commands","_layout","_interopRequireDefault","_editorInitialization","_store","_lockUnlock","_useNavigateToEntityRecord","ExperimentalEditorProvider","unlock","editorPrivateApis","Editor","postId","initialPostId","postType","initialPostType","settings","initialEdits","props","currentPost","onNavigateToEntityRecord","onNavigateToPreviousEntityRecord","useNavigateToEntityRecord","post","template","useSelect","select","_getPostType$viewable","getEditedPostTemplate","editPostStore","getEntityRecord","getPostType","canUser","coreStore","getEditorSettings","editorStore","postObject","supportsTemplateMode","isViewable","viewable","canEditTemplate","editorSettings","useMemo","defaultRenderingMode","initialPost","type","id","_react","createElement","SlotFillProvider","useSubRegistry","__unstableTemplate","ErrorBoundary","CommandMenu","default","PostLockedModal","_default","exports"],"sources":["@wordpress/edit-post/src/editor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { CommandMenu } from '@wordpress/commands';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './lock-unlock';\nimport useNavigateToEntityRecord from './hooks/use-navigate-to-entity-record';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\n\nfunction Editor( {\n\tpostId: initialPostId,\n\tpostType: initialPostType,\n\tsettings,\n\tinitialEdits,\n\t...props\n} ) {\n\tconst {\n\t\tcurrentPost,\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord,\n\t} = useNavigateToEntityRecord(\n\t\tinitialPostId,\n\t\tinitialPostType,\n\t\t'post-only'\n\t);\n\n\tconst { post, template } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostTemplate } = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\n\t\t\tconst postObject = getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tcurrentPost.postType,\n\t\t\t\tcurrentPost.postId\n\t\t\t);\n\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable =\n\t\t\t\tgetPostType( currentPost.postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\t\t\treturn {\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode &&\n\t\t\t\t\tisViewable &&\n\t\t\t\t\tcanEditTemplate &&\n\t\t\t\t\tcurrentPost.postType !== 'wp_template'\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ currentPost.postType, currentPost.postId ]\n\t);\n\n\tconst editorSettings = useMemo(\n\t\t() => ( {\n\t\t\t...settings,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t\tdefaultRenderingMode: 'post-only',\n\t\t} ),\n\t\t[ settings, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord ]\n\t);\n\n\tconst initialPost = useMemo( () => {\n\t\treturn {\n\t\t\ttype: initialPostType,\n\t\t\tid: initialPostId,\n\t\t};\n\t}, [ initialPostType, initialPostId ] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<ExperimentalEditorProvider\n\t\t\t\tsettings={ editorSettings }\n\t\t\t\tpost={ post }\n\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t__unstableTemplate={ template }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t<EditorInitialization />\n\t\t\t\t\t<Layout initialPost={ initialPost } />\n\t\t\t\t</ErrorBoundary>\n\t\t\t\t<PostLockedModal />\n\t\t\t</ExperimentalEditorProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n\nexport default Editor;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAMA,IAAAE,QAAA,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WAAW,MAAE,CAAC,EACf,IAAAN,MAAA,CAAAC,aAAA,EAAC5C,qBAAA,CAAAkD,OAAoB,MAAE,CAAC,EACxB,IAAAP,MAAA,CAAAC,aAAA,EAAC9C,OAAA,CAAAoD,OAAM;IAACV,WAAW,EAAGA;EAAa,CAAE,CACvB,CAAC,EAChB,IAAAG,MAAA,CAAAC,aAAA,EAACnD,OAAA,CAAA0D,eAAe,MAAE,CACS,CACX,CAAC;AAErB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAEc3C,MAAM"}
@@ -125,9 +125,9 @@ function useCommonCommands() {
125
125
  close
126
126
  }) => {
127
127
  close();
128
- toggle('core/edit-post', 'isPublishSidebarEnabled');
128
+ toggle('core', 'isPublishSidebarEnabled');
129
129
  createInfoNotice(isPublishSidebarEnabled ? (0, _i18n.__)('Pre-publish checks disabled.') : (0, _i18n.__)('Pre-publish checks enabled.'), {
130
- id: 'core/edit-post/publish-sidebar/notice',
130
+ id: 'core/editor/publish-sidebar/notice',
131
131
  type: 'snackbar'
132
132
  });
133
133
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_i18n","_icons","_commands","_preferences","_interface","_editor","_notices","_keyboardShortcutHelpModal","_preferencesModal","_store","useCommonCommands","openGeneralSidebar","closeGeneralSidebar","useDispatch","editPostStore","openModal","interfaceStore","activeSidebar","isFullscreen","isPublishSidebarEnabled","useSelect","select","get","preferencesStore","getActiveComplementaryArea","name","editorStore","toggle","createInfoNotice","noticesStore","useCommand","label","__","icon","isRTL","drawerLeft","drawerRight","callback","close","blockDefault","fullscreen","id","type","actions","onClick","PREFERENCES_MODAL_NAME","keyboard","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","formatListBullets"],"sources":["@wordpress/edit-post/src/hooks/commands/use-common-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tkeyboard,\n\tfullscreen,\n\tformatListBullets,\n} from '@wordpress/icons';\nimport { useCommand } from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { store as editPostStore } from '../../store';\n\nexport default function useCommonCommands() {\n\tconst { openGeneralSidebar, closeGeneralSidebar } =\n\t\tuseDispatch( editPostStore );\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { activeSidebar, isFullscreen, isPublishSidebarEnabled } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { get } = select( preferencesStore );\n\n\t\t\treturn {\n\t\t\t\tactiveSidebar: select(\n\t\t\t\t\tinterfaceStore\n\t\t\t\t).getActiveComplementaryArea( editPostStore.name ),\n\t\t\t\tisPublishSidebarEnabled:\n\t\t\t\t\tselect( editorStore ).isPublishSidebarEnabled(),\n\t\t\t\tisFullscreen: get( 'core/edit-post', 'fullscreenMode' ),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\n\tuseCommand( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/document' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/document' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/block' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/block' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-fullscreen-mode',\n\t\tlabel: isFullscreen\n\t\t\t? __( 'Exit fullscreen' )\n\t\t\t: __( 'Enter fullscreen' ),\n\t\ticon: fullscreen,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'fullscreenMode' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisFullscreen ? __( 'Fullscreen off.' ) : __( 'Fullscreen on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/toggle-fullscreen-mode/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core/edit-post', 'fullscreenMode' );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Editor preferences' ),\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Keyboard shortcuts' ),\n\t\ticon: keyboard,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-publish-sidebar',\n\t\tlabel: isPublishSidebarEnabled\n\t\t\t? __( 'Disable pre-publish checks' )\n\t\t\t: __( 'Enable pre-publish checks' ),\n\t\ticon: formatListBullets,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\ttoggle( 'core/edit-post', 'isPublishSidebarEnabled' );\n\t\t\tcreateInfoNotice(\n\t\t\t\tisPublishSidebarEnabled\n\t\t\t\t\t? __( 'Pre-publish checks disabled.' )\n\t\t\t\t\t: __( 'Pre-publish checks enabled.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/publish-sidebar/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAQA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,0BAAA,GAAAR,OAAA;AACA,IAAAS,iBAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAxBA;AACA;AACA;;AAiBA;AACA;AACA;;AAKe,SAASW,iBAAiBA,CAAA,EAAG;EAC3C,MAAM;IAAEC,kBAAkB;IAAEC;EAAoB,CAAC,GAChD,IAAAC,iBAAW,EAAEC,YAAc,CAAC;EAC7B,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAF,iBAAW,EAAEG,gBAAe,CAAC;EACnD,MAAM;IAAEC,aAAa;IAAEC,YAAY;IAAEC;EAAwB,CAAC,GAAG,IAAAC,eAAS,EACvEC,MAAM,IAAM;IACb,MAAM;MAAEC;IAAI,CAAC,GAAGD,MAAM,CAAEE,kBAAiB,CAAC;IAE1C,OAAO;MACNN,aAAa,EAAEI,MAAM,CACpBL,gBACD,CAAC,CAACQ,0BAA0B,CAAEV,YAAa,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AM;MAC1BA,KAAK,CAAC,CAAC;MACPX,MAAM,CAAE,gBAAgB,EAAE,yBAA0B,CAAC;MACrDC,gBAAgB,CACfT,uBAAuB,GACpB,IAAAa,QAAE,EAAE,8BAA+B,CAAC,GACpC,IAAAA,QAAE,EAAE,6BAA8B,CAAC,EACtC;QACCS,EAAE,EAAE,uCAAuC;QAC3CC,IAAI,EAAE;MACP,CACD,CAAC;IACF;EACD,CAAE,CAAC;AACJ"}
1
+ {"version":3,"names":["_data","require","_i18n","_icons","_commands","_preferences","_interface","_editor","_notices","_keyboardShortcutHelpModal","_preferencesModal","_store","useCommonCommands","openGeneralSidebar","closeGeneralSidebar","useDispatch","editPostStore","openModal","interfaceStore","activeSidebar","isFullscreen","isPublishSidebarEnabled","useSelect","select","get","preferencesStore","getActiveComplementaryArea","name","editorStore","toggle","createInfoNotice","noticesStore","useCommand","label","__","icon","isRTL","drawerLeft","drawerRight","callback","close","blockDefault","fullscreen","id","type","actions","onClick","PREFERENCES_MODAL_NAME","keyboard","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","formatListBullets"],"sources":["@wordpress/edit-post/src/hooks/commands/use-common-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tkeyboard,\n\tfullscreen,\n\tformatListBullets,\n} from '@wordpress/icons';\nimport { useCommand } from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { store as editPostStore } from '../../store';\n\nexport default function useCommonCommands() {\n\tconst { openGeneralSidebar, closeGeneralSidebar } =\n\t\tuseDispatch( editPostStore );\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { activeSidebar, isFullscreen, isPublishSidebarEnabled } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { get } = select( preferencesStore );\n\n\t\t\treturn {\n\t\t\t\tactiveSidebar: select(\n\t\t\t\t\tinterfaceStore\n\t\t\t\t).getActiveComplementaryArea( editPostStore.name ),\n\t\t\t\tisPublishSidebarEnabled:\n\t\t\t\t\tselect( editorStore ).isPublishSidebarEnabled(),\n\t\t\t\tisFullscreen: get( 'core/edit-post', 'fullscreenMode' ),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\n\tuseCommand( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/document' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/document' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/block' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/block' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-fullscreen-mode',\n\t\tlabel: isFullscreen\n\t\t\t? __( 'Exit fullscreen' )\n\t\t\t: __( 'Enter fullscreen' ),\n\t\ticon: fullscreen,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'fullscreenMode' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisFullscreen ? __( 'Fullscreen off.' ) : __( 'Fullscreen on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/toggle-fullscreen-mode/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core/edit-post', 'fullscreenMode' );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Editor preferences' ),\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Keyboard shortcuts' ),\n\t\ticon: keyboard,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-publish-sidebar',\n\t\tlabel: isPublishSidebarEnabled\n\t\t\t? __( 'Disable pre-publish checks' )\n\t\t\t: __( 'Enable pre-publish checks' ),\n\t\ticon: formatListBullets,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\ttoggle( 'core', 'isPublishSidebarEnabled' );\n\t\t\tcreateInfoNotice(\n\t\t\t\tisPublishSidebarEnabled\n\t\t\t\t\t? __( 'Pre-publish checks disabled.' )\n\t\t\t\t\t: __( 'Pre-publish checks enabled.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/editor/publish-sidebar/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n}\n"],"mappings":";;;;;;AAGA,I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AE,EAAE,MAAO,CAAC;UACnBY,OAAO,EAAEA,CAAA,KAAM;YACdjB,MAAM,CAAE,gBAAgB,EAAE,gBAAiB,CAAC;UAC7C;QACD,CAAC;MAEH,CACD,CAAC;IACF;EACD,CAAE,CAAC;EAEH,IAAAG,oBAAU,EAAE;IACXL,IAAI,EAAE,uBAAuB;IAC7BM,KAAK,EAAE,IAAAC,QAAE,EAAE,oBAAqB,CAAC;IACjCK,QAAQ,EAAEA,CAAA,KAAM;MACftB,SAAS,CAAE8B,wCAAuB,CAAC;IACpC;EACD,CAAE,CAAC;EAEH,IAAAf,oBAAU,EAAE;IACXL,IAAI,EAAE,yBAAyB;IAC/BM,KAAK,EAAE,IAAAC,QAAE,EAAE,oBAAqB,CAAC;IACjCC,IAAI,EAAEa,eAAQ;IACdT,QAAQ,EAAEA,CAAA,KAAM;MACftB,SAAS,CAAEgC,4DAAkC,CAAC;IAC/C;EACD,CAAE,CAAC;EAEH,IAAAjB,oBAAU,EAAE;IACXL,IAAI,EAAE,6BAA6B;IACnCM,KAAK,EAAEZ,uBAAuB,GAC3B,IAAAa,QAAE,EAAE,4BAA6B,CAAC,GAClC,IAAAA,QAAE,EAAE,2BAA4B,CAAC;IACpCC,IAAI,EAAEe,wBAAiB;IACvBX,QAAQ,EAAEA,CAAE;MAAEC;IAAM,CAAC,KAAM;MAC1BA,KAAK,CAAC,CAAC;MACPX,MAAM,CAAE,MAAM,EAAE,yBAA0B,CAAC;MAC3CC,gBAAgB,CACfT,uBAAuB,GACpB,IAAAa,QAAE,EAAE,8BAA+B,CAAC,GACpC,IAAAA,QAAE,EAAE,6BAA8B,CAAC,EACtC;QACCS,EAAE,EAAE,oCAAoC;QACxCC,IAAI,EAAE;MACP,CACD,CAAC;IACF;EACD,CAAE,CAAC;AACJ"}
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = useNavigateToEntityRecord;
7
7
  var _element = require("@wordpress/element");
8
+ var _data = require("@wordpress/data");
9
+ var _editor = require("@wordpress/editor");
8
10
  /**
9
11
  * WordPress dependencies
10
12
  */
@@ -17,19 +19,24 @@ var _element = require("@wordpress/element");
17
19
  *
18
20
  * Used to control displaying UI elements like the back button.
19
21
  *
20
- * @param {number} initialPostId The post id of the post when the editor loaded.
21
- * @param {string} initialPostType The post type of the post when the editor loaded.
22
+ * @param {number} initialPostId The post id of the post when the editor loaded.
23
+ * @param {string} initialPostType The post type of the post when the editor loaded.
24
+ * @param {string} defaultRenderingMode The rendering mode to switch to when navigating.
22
25
  *
23
26
  * @return {Object} An object containing the `currentPost` variable and
24
27
  * `onNavigateToEntityRecord` and `onNavigateToPreviousEntityRecord` functions.
25
28
  */
26
- function useNavigateToEntityRecord(initialPostId, initialPostType) {
29
+ function useNavigateToEntityRecord(initialPostId, initialPostType, defaultRenderingMode) {
27
30
  const [postHistory, dispatch] = (0, _element.useReducer)((historyState, {
28
31
  type,
29
- post
32
+ post,
33
+ previousRenderingMode
30
34
  }) => {
31
35
  if (type === 'push') {
32
- return [...historyState, post];
36
+ return [...historyState, {
37
+ post,
38
+ previousRenderingMode
39
+ }];
33
40
  }
34
41
  if (type === 'pop') {
35
42
  // Try to leave one item in the history.
@@ -39,33 +46,43 @@ function useNavigateToEntityRecord(initialPostId, initialPostType) {
39
46
  }
40
47
  return historyState;
41
48
  }, [{
42
- postId: initialPostId,
43
- postType: initialPostType
49
+ post: {
50
+ postId: initialPostId,
51
+ postType: initialPostType
52
+ }
44
53
  }]);
45
- const initialPost = (0, _element.useMemo)(() => {
46
- return {
47
- type: initialPostType,
48
- id: initialPostId
49
- };
50
- }, [initialPostType, initialPostId]);
54
+ const {
55
+ post,
56
+ previousRenderingMode
57
+ } = postHistory[postHistory.length - 1];
58
+ const {
59
+ getRenderingMode
60
+ } = (0, _data.useSelect)(_editor.store);
61
+ const {
62
+ setRenderingMode
63
+ } = (0, _data.useDispatch)(_editor.store);
51
64
  const onNavigateToEntityRecord = (0, _element.useCallback)(params => {
52
65
  dispatch({
53
66
  type: 'push',
54
67
  post: {
55
68
  postId: params.postId,
56
69
  postType: params.postType
57
- }
70
+ },
71
+ // Save the current rendering mode so we can restore it when navigating back.
72
+ previousRenderingMode: getRenderingMode()
58
73
  });
59
- }, []);
74
+ setRenderingMode(defaultRenderingMode);
75
+ }, [getRenderingMode, setRenderingMode, defaultRenderingMode]);
60
76
  const onNavigateToPreviousEntityRecord = (0, _element.useCallback)(() => {
61
77
  dispatch({
62
78
  type: 'pop'
63
79
  });
64
- }, []);
65
- const currentPost = postHistory[postHistory.length - 1];
80
+ if (previousRenderingMode) {
81
+ setRenderingMode(previousRenderingMode);
82
+ }
83
+ }, [setRenderingMode, previousRenderingMode]);
66
84
  return {
67
- currentPost,
68
- initialPost,
85
+ currentPost: post,
69
86
  onNavigateToEntityRecord,
70
87
  onNavigateToPreviousEntityRecord: postHistory.length > 1 ? onNavigateToPreviousEntityRecord : undefined
71
88
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","useNavigateToEntityRecord","initialPostId","initialPostType","postHistory","dispatch","useReducer","historyState","type","post","length","slice","postId","postType","initialPost","useMemo","id","onNavigateToEntityRecord","useCallback","params","onNavigateToPreviousEntityRecord","currentPost","undefined"],"sources":["@wordpress/edit-post/src/hooks/use-navigate-to-entity-record.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback, useReducer, useMemo } from '@wordpress/element';\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 *\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) {\n\tconst [ postHistory, dispatch ] = useReducer(\n\t\t( historyState, { type, post } ) => {\n\t\t\tif ( type === 'push' ) {\n\t\t\t\treturn [ ...historyState, post ];\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[ { postId: initialPostId, postType: initialPostType } ]\n\t);\n\n\tconst initialPost = useMemo( () => {\n\t\treturn {\n\t\t\ttype: initialPostType,\n\t\t\tid: initialPostId,\n\t\t};\n\t}, [ initialPostType, initialPostId ] );\n\n\tconst onNavigateToEntityRecord = useCallback( ( params ) => {\n\t\tdispatch( {\n\t\t\ttype: 'push',\n\t\t\tpost: { postId: params.postId, postType: params.postType },\n\t\t} );\n\t}, [] );\n\n\tconst onNavigateToPreviousEntityRecord = useCallback( () => {\n\t\tdispatch( { type: 'pop' } );\n\t}, [] );\n\n\tconst currentPost = postHistory[ postHistory.length - 1 ];\n\n\treturn {\n\t\tcurrentPost,\n\t\tinitialPost,\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"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,yBAAyBA,CAChDC,aAAa,EACbC,eAAe,EACd;EACD,MAAM,CAAEC,WAAW,EAAEC,QAAQ,CAAE,GAAG,IAAAC,mBAAU,EAC3C,CAAEC,YAAY,EAAE;IAAEC,IAAI;IAAEC;EAAK,CAAC,KAAM;IACnC,IAAKD,IAAI,KAAK,MAAM,EAAG;MACtB,OAAO,CAAE,GAAGD,YAAY,EAAEE,IAAI,CAAE;IACjC;IACA,IAAKD,IAAI,KAAK,KAAK,EAAG;MACrB;MACA,IAAKD,YAAY,CAACG,MAAM,GAAG,CAAC,EAAG;QAC9B,OAAOH,YAAY,CAACI,KAAK,CAAE,CAAC,EAAE,CAAC,CAAE,CAAC;MACnC;IACD;IACA,OAAOJ,YAAY;EACpB,CAAC,EACD,CAAE;IAAEK,MAAM,EAAEV,aAAa;IAAEW,QAAQ,EAAEV;EAAgB,CAAC,CACvD,CAAC;EAED,MAAMW,WAAW,GAAG,IAAAC,gBAAO,EAAE,MAAM;IAClC,OAAO;MACNP,IAAI,EAAEL,eAAe;MACrBa,EAAE,EAAEd;IACL,CAAC;EACF,CAAC,EAAE,CAAEC,eAAe,EAAED,aAAa,CAAG,CAAC;EAEvC,MAAMe,wBAAwB,GAAG,IAAAC,oBAAW,EAAIC,MAAM,IAAM;IAC3Dd,QAAQ,CAAE;MACTG,IAAI,EAAE,MAAM;MACZC,IAAI,EAAE;QAAEG,MAAM,EAAEO,MAAM,CAACP,MAAM;QAAEC,QAAQ,EAAEM,MAAM,CAACN;MAAS;IAC1D,CAAE,CAAC;EACJ,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMO,gCAAgC,GAAG,IAAAF,oBAAW,EAAE,MAAM;IAC3Db,QAAQ,CAAE;MAAEG,IAAI,EAAE;IAAM,CAAE,CAAC;EAC5B,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMa,WAAW,GAAGjB,WAAW,CAAEA,WAAW,CAACM,MAAM,GAAG,CAAC,CAAE;EAEzD,OAAO;IACNW,WAAW;IACXP,WAAW;IACXG,wBAAwB;IACxBG,gCAAgC,EAC/BhB,WAAW,CAACM,MAAM,GAAG,CAAC,GACnBU,gCAAgC,GAChCE;EACL,CAAC;AACF"}
1
+ {"version":3,"names":["_element","require","_data","_editor","useNavigateToEntityRecord","initialPostId","initialPostType","defaultRenderingMode","postHistory","dispatch","useReducer","historyState","type","post","previousRenderingMode","length","slice","postId","postType","getRenderingMode","useSelect","editorStore","setRenderingMode","useDispatch","onNavigateToEntityRecord","useCallback","params","onNavigateToPreviousEntityRecord","currentPost","undefined"],"sources":["@wordpress/edit-post/src/hooks/use-navigate-to-entity-record.js"],"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"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASG,yBAAyBA,CAChDC,aAAa,EACbC,eAAe,EACfC,oBAAoB,EACnB;EACD,MAAM,CAAEC,WAAW,EAAEC,QAAQ,CAAE,GAAG,IAAAC,mBAAU,EAC3C,CAAEC,YAAY,EAAE;IAAEC,IAAI;IAAEC,IAAI;IAAEC;EAAsB,CAAC,KAAM;IAC1D,IAAKF,IAAI,KAAK,MAAM,EAAG;MACtB,OAAO,CAAE,GAAGD,YAAY,EAAE;QAAEE,IAAI;QAAEC;MAAsB,CAAC,CAAE;IAC5D;IACA,IAAKF,IAAI,KAAK,KAAK,EAAG;MACrB;MACA,IAAKD,YAAY,CAACI,MAAM,GAAG,CAAC,EAAG;QAC9B,OAAOJ,YAAY,CAACK,KAAK,CAAE,CAAC,EAAE,CAAC,CAAE,CAAC;MACnC;IACD;IACA,OAAOL,YAAY;EACpB,CAAC,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