@wordpress/editor 14.19.0 → 14.20.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 (121) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/commands/index.js +1 -1
  3. package/build/components/commands/index.js.map +1 -1
  4. package/build/components/document-bar/index.js +3 -2
  5. package/build/components/document-bar/index.js.map +1 -1
  6. package/build/components/document-outline/index.js +21 -1
  7. package/build/components/document-outline/index.js.map +1 -1
  8. package/build/components/document-outline/item.js +32 -20
  9. package/build/components/document-outline/item.js.map +1 -1
  10. package/build/components/entities-saved-states/entity-record-item.js +2 -2
  11. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  12. package/build/components/post-actions/actions.js +10 -8
  13. package/build/components/post-actions/actions.js.map +1 -1
  14. package/build/components/post-card-panel/index.js +3 -3
  15. package/build/components/post-card-panel/index.js.map +1 -1
  16. package/build/components/post-publish-panel/maybe-category-panel.js +19 -3
  17. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  18. package/build/components/post-publish-panel/maybe-tags-panel.js +16 -6
  19. package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  20. package/build/components/post-status/index.js +1 -1
  21. package/build/components/post-status/index.js.map +1 -1
  22. package/build/components/post-sticky/index.js +1 -1
  23. package/build/components/post-sticky/index.js.map +1 -1
  24. package/build/components/post-template/hooks.js +6 -5
  25. package/build/components/post-template/hooks.js.map +1 -1
  26. package/build/components/post-template/swap-template-button.js +2 -3
  27. package/build/components/post-template/swap-template-button.js.map +1 -1
  28. package/build/components/post-visibility/index.js +39 -109
  29. package/build/components/post-visibility/index.js.map +1 -1
  30. package/build/components/post-visibility/label.js +2 -2
  31. package/build/components/post-visibility/label.js.map +1 -1
  32. package/build/components/post-visibility/utils.js +14 -15
  33. package/build/components/post-visibility/utils.js.map +1 -1
  34. package/build/components/provider/index.js +7 -4
  35. package/build/components/provider/index.js.map +1 -1
  36. package/build/store/private-selectors.js +1 -1
  37. package/build/store/private-selectors.js.map +1 -1
  38. package/build/store/selectors.js +8 -7
  39. package/build/store/selectors.js.map +1 -1
  40. package/build-module/components/commands/index.js +1 -1
  41. package/build-module/components/commands/index.js.map +1 -1
  42. package/build-module/components/document-bar/index.js +3 -2
  43. package/build-module/components/document-bar/index.js.map +1 -1
  44. package/build-module/components/document-outline/index.js +21 -1
  45. package/build-module/components/document-outline/index.js.map +1 -1
  46. package/build-module/components/document-outline/item.js +32 -20
  47. package/build-module/components/document-outline/item.js.map +1 -1
  48. package/build-module/components/entities-saved-states/entity-record-item.js +2 -2
  49. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  50. package/build-module/components/post-actions/actions.js +10 -8
  51. package/build-module/components/post-actions/actions.js.map +1 -1
  52. package/build-module/components/post-card-panel/index.js +3 -3
  53. package/build-module/components/post-card-panel/index.js.map +1 -1
  54. package/build-module/components/post-publish-panel/maybe-category-panel.js +19 -3
  55. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  56. package/build-module/components/post-publish-panel/maybe-tags-panel.js +16 -6
  57. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  58. package/build-module/components/post-status/index.js +1 -1
  59. package/build-module/components/post-status/index.js.map +1 -1
  60. package/build-module/components/post-sticky/index.js +1 -1
  61. package/build-module/components/post-sticky/index.js.map +1 -1
  62. package/build-module/components/post-template/hooks.js +6 -5
  63. package/build-module/components/post-template/hooks.js.map +1 -1
  64. package/build-module/components/post-template/swap-template-button.js +2 -3
  65. package/build-module/components/post-template/swap-template-button.js.map +1 -1
  66. package/build-module/components/post-visibility/index.js +41 -111
  67. package/build-module/components/post-visibility/index.js.map +1 -1
  68. package/build-module/components/post-visibility/label.js +3 -3
  69. package/build-module/components/post-visibility/label.js.map +1 -1
  70. package/build-module/components/post-visibility/utils.js +13 -14
  71. package/build-module/components/post-visibility/utils.js.map +1 -1
  72. package/build-module/components/provider/index.js +7 -4
  73. package/build-module/components/provider/index.js.map +1 -1
  74. package/build-module/store/private-selectors.js +1 -1
  75. package/build-module/store/private-selectors.js.map +1 -1
  76. package/build-module/store/selectors.js +8 -7
  77. package/build-module/store/selectors.js.map +1 -1
  78. package/build-style/style-rtl.css +4 -138
  79. package/build-style/style.css +4 -138
  80. package/build-types/components/document-outline/index.d.ts.map +1 -1
  81. package/build-types/components/document-outline/item.d.ts +2 -1
  82. package/build-types/components/document-outline/item.d.ts.map +1 -1
  83. package/build-types/components/entities-saved-states/entity-record-item.d.ts.map +1 -1
  84. package/build-types/components/post-actions/actions.d.ts.map +1 -1
  85. package/build-types/components/post-publish-panel/maybe-category-panel.d.ts.map +1 -1
  86. package/build-types/components/post-publish-panel/maybe-tags-panel.d.ts.map +1 -1
  87. package/build-types/components/post-template/hooks.d.ts.map +1 -1
  88. package/build-types/components/post-template/swap-template-button.d.ts +1 -1
  89. package/build-types/components/post-template/swap-template-button.d.ts.map +1 -1
  90. package/build-types/components/post-visibility/index.d.ts.map +1 -1
  91. package/build-types/components/post-visibility/label.d.ts.map +1 -1
  92. package/build-types/components/post-visibility/utils.d.ts +5 -20
  93. package/build-types/components/post-visibility/utils.d.ts.map +1 -1
  94. package/build-types/components/provider/index.d.ts.map +1 -1
  95. package/build-types/store/private-selectors.d.ts.map +1 -1
  96. package/build-types/store/selectors.d.ts.map +1 -1
  97. package/package.json +37 -37
  98. package/src/components/autocompleters/style.scss +2 -3
  99. package/src/components/commands/index.js +1 -1
  100. package/src/components/document-bar/index.js +2 -2
  101. package/src/components/document-outline/index.js +27 -1
  102. package/src/components/document-outline/item.js +38 -23
  103. package/src/components/document-outline/style.scss +2 -0
  104. package/src/components/entities-saved-states/entity-record-item.js +1 -4
  105. package/src/components/post-actions/actions.js +13 -8
  106. package/src/components/post-card-panel/index.js +2 -2
  107. package/src/components/post-publish-panel/maybe-category-panel.js +20 -5
  108. package/src/components/post-publish-panel/maybe-tags-panel.js +39 -22
  109. package/src/components/post-status/index.js +1 -1
  110. package/src/components/post-sticky/index.js +1 -1
  111. package/src/components/post-template/hooks.js +12 -8
  112. package/src/components/post-template/swap-template-button.js +6 -4
  113. package/src/components/post-visibility/index.js +41 -118
  114. package/src/components/post-visibility/label.js +7 -4
  115. package/src/components/post-visibility/utils.js +11 -8
  116. package/src/components/provider/index.js +9 -4
  117. package/src/store/private-selectors.js +2 -4
  118. package/src/store/selectors.js +9 -14
  119. package/src/style.scss +0 -1
  120. package/tsconfig.tsbuildinfo +1 -1
  121. package/src/components/post-visibility/style.scss +0 -27
@@ -41,43 +41,30 @@ var _jsxRuntime = require("react/jsx-runtime");
41
41
  password: select(_store.store).getEditedPostAttribute('password')
42
42
  }));
43
43
  const {
44
- editPost,
45
- savePost
44
+ editPost
46
45
  } = (0, _data.useDispatch)(_store.store);
47
46
  const [hasPassword, setHasPassword] = (0, _element.useState)(!!password);
48
- const [showPrivateConfirmDialog, setShowPrivateConfirmDialog] = (0, _element.useState)(false);
49
- const setPublic = () => {
47
+ function updateVisibility(value) {
48
+ const nextValues = {
49
+ public: {
50
+ status: visibility === 'private' ? 'draft' : status,
51
+ password: ''
52
+ },
53
+ private: {
54
+ status: 'private',
55
+ password: ''
56
+ },
57
+ password: {
58
+ status: visibility === 'private' ? 'draft' : status,
59
+ password: password || ''
60
+ }
61
+ };
62
+ editPost(nextValues[value]);
63
+ setHasPassword(value === 'password');
64
+ }
65
+ const updatePassword = value => {
50
66
  editPost({
51
- status: visibility === 'private' ? 'draft' : status,
52
- password: ''
53
- });
54
- setHasPassword(false);
55
- };
56
- const setPrivate = () => {
57
- setShowPrivateConfirmDialog(true);
58
- };
59
- const confirmPrivate = () => {
60
- editPost({
61
- status: 'private',
62
- password: ''
63
- });
64
- setHasPassword(false);
65
- setShowPrivateConfirmDialog(false);
66
- savePost();
67
- };
68
- const handleDialogCancel = () => {
69
- setShowPrivateConfirmDialog(false);
70
- };
71
- const setPasswordProtected = () => {
72
- editPost({
73
- status: visibility === 'private' ? 'draft' : status,
74
- password: password || ''
75
- });
76
- setHasPassword(true);
77
- };
78
- const updatePassword = event => {
79
- editPost({
80
- password: event.target.value
67
+ password: value
81
68
  });
82
69
  };
83
70
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
@@ -86,82 +73,25 @@ var _jsxRuntime = require("react/jsx-runtime");
86
73
  title: (0, _i18n.__)('Visibility'),
87
74
  help: (0, _i18n.__)('Control how this post is viewed.'),
88
75
  onClose: onClose
89
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("fieldset", {
90
- className: "editor-post-visibility__fieldset",
91
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.VisuallyHidden, {
92
- as: "legend",
93
- children: (0, _i18n.__)('Visibility')
94
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(PostVisibilityChoice, {
95
- instanceId: instanceId,
96
- value: "public",
97
- label: _utils.visibilityOptions.public.label,
98
- info: _utils.visibilityOptions.public.info,
99
- checked: visibility === 'public' && !hasPassword,
100
- onChange: setPublic
101
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(PostVisibilityChoice, {
102
- instanceId: instanceId,
103
- value: "private",
104
- label: _utils.visibilityOptions.private.label,
105
- info: _utils.visibilityOptions.private.info,
106
- checked: visibility === 'private',
107
- onChange: setPrivate
108
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(PostVisibilityChoice, {
109
- instanceId: instanceId,
110
- value: "password",
111
- label: _utils.visibilityOptions.password.label,
112
- info: _utils.visibilityOptions.password.info,
113
- checked: hasPassword,
114
- onChange: setPasswordProtected
115
- }), hasPassword && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
116
- className: "editor-post-visibility__password",
117
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.VisuallyHidden, {
118
- as: "label",
119
- htmlFor: `editor-post-visibility__password-input-${instanceId}`,
120
- children: (0, _i18n.__)('Create password')
121
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
122
- className: "editor-post-visibility__password-input",
123
- id: `editor-post-visibility__password-input-${instanceId}`,
124
- type: "text",
125
- onChange: updatePassword,
126
- value: password,
127
- placeholder: (0, _i18n.__)('Use a secure password')
128
- })]
76
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
77
+ spacing: 4,
78
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RadioControl, {
79
+ label: (0, _i18n.__)('Visibility'),
80
+ hideLabelFromVision: true,
81
+ options: _utils.VISIBILITY_OPTIONS,
82
+ selected: hasPassword ? 'password' : visibility,
83
+ onChange: updateVisibility
84
+ }), hasPassword && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextControl, {
85
+ label: (0, _i18n.__)('Password'),
86
+ onChange: updatePassword,
87
+ value: password,
88
+ placeholder: (0, _i18n.__)('Use a secure password'),
89
+ type: "text",
90
+ id: `editor-post-visibility__password-input-${instanceId}`,
91
+ __next40pxDefaultSize: true,
92
+ __nextHasNoMarginBottom: true,
93
+ maxLength: 255
129
94
  })]
130
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalConfirmDialog, {
131
- isOpen: showPrivateConfirmDialog,
132
- onConfirm: confirmPrivate,
133
- onCancel: handleDialogCancel,
134
- confirmButtonText: (0, _i18n.__)('Publish'),
135
- size: "medium",
136
- children: (0, _i18n.__)('Would you like to privately publish this post now?')
137
- })]
138
- });
139
- }
140
- function PostVisibilityChoice({
141
- instanceId,
142
- value,
143
- label,
144
- info,
145
- ...props
146
- }) {
147
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
148
- className: "editor-post-visibility__choice",
149
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
150
- type: "radio",
151
- name: `editor-post-visibility__setting-${instanceId}`,
152
- value: value,
153
- id: `editor-post-${value}-${instanceId}`,
154
- "aria-describedby": `editor-post-${value}-${instanceId}-description`,
155
- className: "editor-post-visibility__radio",
156
- ...props
157
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
158
- htmlFor: `editor-post-${value}-${instanceId}`,
159
- className: "editor-post-visibility__label",
160
- children: label
161
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
162
- id: `editor-post-${value}-${instanceId}-description`,
163
- className: "editor-post-visibility__info",
164
- children: info
165
95
  })]
166
96
  });
167
97
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_element","_components","_compose","_data","_blockEditor","_utils","_store","_jsxRuntime","PostVisibility","onClose","instanceId","useInstanceId","status","visibility","password","useSelect","select","editorStore","getEditedPostAttribute","getEditedPostVisibility","editPost","savePost","useDispatch","hasPassword","setHasPassword","useState","showPrivateConfirmDialog","setShowPrivateConfirmDialog","setPublic","setPrivate","confirmPrivate","handleDialogCancel","setPasswordProtected","updatePassword","event","target","value","jsxs","className","children","jsx","__experimentalInspectorPopoverHeader","title","__","help","VisuallyHidden","as","PostVisibilityChoice","label","visibilityOptions","public","info","checked","onChange","private","htmlFor","id","type","placeholder","__experimentalConfirmDialog","isOpen","onConfirm","onCancel","confirmButtonText","size","props","name"],"sources":["@wordpress/editor/src/components/post-visibility/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport {\n\tVisuallyHidden,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { visibilityOptions } from './utils';\nimport { store as editorStore } from '../../store';\n\n/**\n * Allows users to set the visibility of a post.\n *\n * @param {Object} props The component props.\n * @param {Function} props.onClose Function to call when the popover is closed.\n * @return {React.ReactNode} The rendered component.\n */\nexport default function PostVisibility( { onClose } ) {\n\tconst instanceId = useInstanceId( PostVisibility );\n\n\tconst { status, visibility, password } = useSelect( ( select ) => ( {\n\t\tstatus: select( editorStore ).getEditedPostAttribute( 'status' ),\n\t\tvisibility: select( editorStore ).getEditedPostVisibility(),\n\t\tpassword: select( editorStore ).getEditedPostAttribute( 'password' ),\n\t} ) );\n\n\tconst { editPost, savePost } = useDispatch( editorStore );\n\n\tconst [ hasPassword, setHasPassword ] = useState( !! password );\n\tconst [ showPrivateConfirmDialog, setShowPrivateConfirmDialog ] =\n\t\tuseState( false );\n\n\tconst setPublic = () => {\n\t\teditPost( {\n\t\t\tstatus: visibility === 'private' ? 'draft' : status,\n\t\t\tpassword: '',\n\t\t} );\n\t\tsetHasPassword( false );\n\t};\n\n\tconst setPrivate = () => {\n\t\tsetShowPrivateConfirmDialog( true );\n\t};\n\n\tconst confirmPrivate = () => {\n\t\teditPost( { status: 'private', password: '' } );\n\t\tsetHasPassword( false );\n\t\tsetShowPrivateConfirmDialog( false );\n\t\tsavePost();\n\t};\n\n\tconst handleDialogCancel = () => {\n\t\tsetShowPrivateConfirmDialog( false );\n\t};\n\n\tconst setPasswordProtected = () => {\n\t\teditPost( {\n\t\t\tstatus: visibility === 'private' ? 'draft' : status,\n\t\t\tpassword: password || '',\n\t\t} );\n\t\tsetHasPassword( true );\n\t};\n\n\tconst updatePassword = ( event ) => {\n\t\teditPost( { password: event.target.value } );\n\t};\n\n\treturn (\n\t\t<div className=\"editor-post-visibility\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Visibility' ) }\n\t\t\t\thelp={ __( 'Control how this post is viewed.' ) }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t<fieldset className=\"editor-post-visibility__fieldset\">\n\t\t\t\t<VisuallyHidden as=\"legend\">\n\t\t\t\t\t{ __( 'Visibility' ) }\n\t\t\t\t</VisuallyHidden>\n\t\t\t\t<PostVisibilityChoice\n\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\tvalue=\"public\"\n\t\t\t\t\tlabel={ visibilityOptions.public.label }\n\t\t\t\t\tinfo={ visibilityOptions.public.info }\n\t\t\t\t\tchecked={ visibility === 'public' && ! hasPassword }\n\t\t\t\t\tonChange={ setPublic }\n\t\t\t\t/>\n\t\t\t\t<PostVisibilityChoice\n\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\tvalue=\"private\"\n\t\t\t\t\tlabel={ visibilityOptions.private.label }\n\t\t\t\t\tinfo={ visibilityOptions.private.info }\n\t\t\t\t\tchecked={ visibility === 'private' }\n\t\t\t\t\tonChange={ setPrivate }\n\t\t\t\t/>\n\t\t\t\t<PostVisibilityChoice\n\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\tvalue=\"password\"\n\t\t\t\t\tlabel={ visibilityOptions.password.label }\n\t\t\t\t\tinfo={ visibilityOptions.password.info }\n\t\t\t\t\tchecked={ hasPassword }\n\t\t\t\t\tonChange={ setPasswordProtected }\n\t\t\t\t/>\n\t\t\t\t{ hasPassword && (\n\t\t\t\t\t<div className=\"editor-post-visibility__password\">\n\t\t\t\t\t\t<VisuallyHidden\n\t\t\t\t\t\t\tas=\"label\"\n\t\t\t\t\t\t\thtmlFor={ `editor-post-visibility__password-input-${ instanceId }` }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create password' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\tclassName=\"editor-post-visibility__password-input\"\n\t\t\t\t\t\t\tid={ `editor-post-visibility__password-input-${ instanceId }` }\n\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\tonChange={ updatePassword }\n\t\t\t\t\t\t\tvalue={ password }\n\t\t\t\t\t\t\tplaceholder={ __( 'Use a secure password' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</fieldset>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ showPrivateConfirmDialog }\n\t\t\t\tonConfirm={ confirmPrivate }\n\t\t\t\tonCancel={ handleDialogCancel }\n\t\t\t\tconfirmButtonText={ __( 'Publish' ) }\n\t\t\t\tsize=\"medium\"\n\t\t\t>\n\t\t\t\t{ __( 'Would you like to privately publish this post now?' ) }\n\t\t\t</ConfirmDialog>\n\t\t</div>\n\t);\n}\n\nfunction PostVisibilityChoice( { instanceId, value, label, info, ...props } ) {\n\treturn (\n\t\t<div className=\"editor-post-visibility__choice\">\n\t\t\t<input\n\t\t\t\ttype=\"radio\"\n\t\t\t\tname={ `editor-post-visibility__setting-${ instanceId }` }\n\t\t\t\tvalue={ value }\n\t\t\t\tid={ `editor-post-${ value }-${ instanceId }` }\n\t\t\t\taria-describedby={ `editor-post-${ value }-${ instanceId }-description` }\n\t\t\t\tclassName=\"editor-post-visibility__radio\"\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t\t<label\n\t\t\t\thtmlFor={ `editor-post-${ value }-${ instanceId }` }\n\t\t\t\tclassName=\"editor-post-visibility__label\"\n\t\t\t>\n\t\t\t\t{ label }\n\t\t\t</label>\n\t\t\t<p\n\t\t\t\tid={ `editor-post-${ value }-${ instanceId }-description` }\n\t\t\t\tclassName=\"editor-post-visibility__info\"\n\t\t\t>\n\t\t\t\t{ info }\n\t\t\t</p>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAIA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAAmD,IAAAQ,WAAA,GAAAR,OAAA;AAjBnD;AACA;AACA;;AAWA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASS,cAAcA,CAAE;EAAEC;AAAQ,CAAC,EAAG;EACrD,MAAMC,UAAU,GAAG,IAAAC,sBAAa,EAAEH,cAAe,CAAC;EAElD,MAAM;IA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,iBAAiB,EAAG,IAAApB,QAAE,EAAE,SAAU,CAAG;MACrCqB,IAAI,EAAC,QAAQ;MAAAzB,QAAA,EAEX,IAAAI,QAAE,EAAE,oDAAqD;IAAC,CAC9C,CAAC;EAAA,CACZ,CAAC;AAER;AAEA,SAASI,oBAAoBA,CAAE;EAAErC,UAAU;EAAE0B,KAAK;EAAEY,KAAK;EAAEG,IAAI;EAAE,GAAGc;AAAM,CAAC,EAAG;EAC7E,oBACC,IAAA1D,WAAA,CAAA8B,IAAA;IAAKC,SAAS,EAAC,gCAAgC;IAAAC,QAAA,gBAC9C,IAAAhC,WAAA,CAAAiC,GAAA;MACCiB,IAAI,EAAC,OAAO;MACZS,IAAI,EAAG,mCAAoCxD,UAAU,EAAK;MAC1D0B,KAAK,EAAGA,KAAO;MACfoB,EAAE,EAAG,eAAgBpB,KAAK,IAAM1B,UAAU,EAAK;MAC/C,oBAAmB,eAAgB0B,KAAK,IAAM1B,UAAU,cAAiB;MACzE4B,SAAS,EAAC,+BAA+B;MAAA,GACpC2B;IAAK,CACV,CAAC,eACF,IAAA1D,WAAA,CAAAiC,GAAA;MACCe,OAAO,EAAG,eAAgBnB,KAAK,IAAM1B,UAAU,EAAK;MACpD4B,SAAS,EAAC,+BAA+B;MAAAC,QAAA,EAEvCS;IAAK,CACD,CAAC,eACR,IAAAzC,WAAA,CAAAiC,GAAA;MACCgB,EAAE,EAAG,eAAgBpB,KAAK,IAAM1B,UAAU,cAAiB;MAC3D4B,SAAS,EAAC,8BAA8B;MAAAC,QAAA,EAEtCY;IAAI,CACJ,CAAC;EAAA,CACA,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_element","_components","_compose","_data","_blockEditor","_utils","_store","_jsxRuntime","PostVisibility","onClose","instanceId","useInstanceId","status","visibility","password","useSelect","select","editorStore","getEditedPostAttribute","getEditedPostVisibility","editPost","useDispatch","hasPassword","setHasPassword","useState","updateVisibility","value","nextValues","public","private","updatePassword","jsxs","className","children","jsx","__experimentalInspectorPopoverHeader","title","__","help","__experimentalVStack","spacing","RadioControl","label","hideLabelFromVision","options","VISIBILITY_OPTIONS","selected","onChange","TextControl","placeholder","type","id","__next40pxDefaultSize","__nextHasNoMarginBottom","maxLength"],"sources":["@wordpress/editor/src/components/post-visibility/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport {\n\tTextControl,\n\tRadioControl,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { VISIBILITY_OPTIONS } from './utils';\nimport { store as editorStore } from '../../store';\n\n/**\n * Allows users to set the visibility of a post.\n *\n * @param {Object} props The component props.\n * @param {Function} props.onClose Function to call when the popover is closed.\n * @return {React.ReactNode} The rendered component.\n */\nexport default function PostVisibility( { onClose } ) {\n\tconst instanceId = useInstanceId( PostVisibility );\n\n\tconst { status, visibility, password } = useSelect( ( select ) => ( {\n\t\tstatus: select( editorStore ).getEditedPostAttribute( 'status' ),\n\t\tvisibility: select( editorStore ).getEditedPostVisibility(),\n\t\tpassword: select( editorStore ).getEditedPostAttribute( 'password' ),\n\t} ) );\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst [ hasPassword, setHasPassword ] = useState( !! password );\n\n\tfunction updateVisibility( value ) {\n\t\tconst nextValues = {\n\t\t\tpublic: {\n\t\t\t\tstatus: visibility === 'private' ? 'draft' : status,\n\t\t\t\tpassword: '',\n\t\t\t},\n\t\t\tprivate: { status: 'private', password: '' },\n\t\t\tpassword: {\n\t\t\t\tstatus: visibility === 'private' ? 'draft' : status,\n\t\t\t\tpassword: password || '',\n\t\t\t},\n\t\t};\n\n\t\teditPost( nextValues[ value ] );\n\t\tsetHasPassword( value === 'password' );\n\t}\n\n\tconst updatePassword = ( value ) => {\n\t\teditPost( { password: value } );\n\t};\n\n\treturn (\n\t\t<div className=\"editor-post-visibility\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Visibility' ) }\n\t\t\t\thelp={ __( 'Control how this post is viewed.' ) }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t<RadioControl\n\t\t\t\t\tlabel={ __( 'Visibility' ) }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\toptions={ VISIBILITY_OPTIONS }\n\t\t\t\t\tselected={ hasPassword ? 'password' : visibility }\n\t\t\t\t\tonChange={ updateVisibility }\n\t\t\t\t/>\n\t\t\t\t{ hasPassword && (\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Password' ) }\n\t\t\t\t\t\tonChange={ updatePassword }\n\t\t\t\t\t\tvalue={ password }\n\t\t\t\t\t\tplaceholder={ __( 'Use a secure password' ) }\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\tid={ `editor-post-visibility__password-input-${ instanceId }` }\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tmaxLength={ 255 }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAAmD,IAAAQ,WAAA,GAAAR,OAAA;AAlBnD;AACA;AACA;;AAYA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASS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,oBACC,IAAAnB,WAAA,CAAAwB,IAAA;IAAKC,SAAS,EAAC,wBAAwB;IAAAC,QAAA,gBACtC,IAAA1B,WAAA,CAAA2B,GAAA,EAAC9B,YAAA,CAAA+B,oCAAsB;MACtBC,KAAK,EAAG,IAAAC,QAAE,EAAE,YAAa,CAAG;MAC5BC,IAAI,EAAG,IAAAD,QAAE,EAAE,kCAAmC,CAAG;MACjD5B,OAAO,EAAGA;IAAS,CACnB,CAAC,eACF,IAAAF,WAAA,CAAAwB,IAAA,EAAC9B,WAAA,CAAAsC,oBAAM;MAACC,OAAO,EAAG,CAAG;MAAAP,QAAA,gBACpB,IAAA1B,WAAA,CAAA2B,GAAA,EAACjC,WAAA,CAAAwC,YAAY;QACZC,KAAK,EAAG,IAAAL,QAAE,EAAE,YAAa,CAAG;QAC5BM,mBAAmB;QACnBC,OAAO,EAAGC,yBAAoB;QAC9BC,QAAQ,EAAGxB,WAAW,GAAG,UAAU,GAAGT,UAAY;QAClDkC,QAAQ,EAAGtB;MAAkB,CAC7B,CAAC,EACAH,WAAW,iBACZ,IAAAf,WAAA,CAAA2B,GAAA,EAACjC,WAAA,CAAA+C,WAAW;QACXN,KAAK,EAAG,IAAAL,QAAE,EAAE,UAAW,CAAG;QAC1BU,QAAQ,EAAGjB,cAAgB;QAC3BJ,KAAK,EAAGZ,QAAU;QAClBmC,WAAW,EAAG,IAAAZ,QAAE,EAAE,uBAAwB,CAAG;QAC7Ca,IAAI,EAAC,MAAM;QACXC,EAAE,EAAG,0CAA2CzC,UAAU,EAAK;QAC/D0C,qBAAqB;QACrBC,uBAAuB;QACvBC,SAAS,EAAG;MAAK,CACjB,CACD;IAAA,CACM,CAAC;EAAA,CACL,CAAC;AAER","ignoreList":[]}
@@ -31,7 +31,7 @@ function PostVisibilityLabel() {
31
31
  * @return {string} Post visibility label.
32
32
  */
33
33
  function usePostVisibilityLabel() {
34
- const visibility = (0, _data.useSelect)(select => select(_store.store).getEditedPostVisibility());
35
- return _utils.visibilityOptions[visibility]?.label;
34
+ const visibility = (0, _data.useSelect)(select => select(_store.store).getEditedPostVisibility(), []);
35
+ return _utils.VISIBILITY_OPTIONS.find(option => option.value === visibility)?.label;
36
36
  }
37
37
  //# sourceMappingURL=label.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_utils","_store","PostVisibilityLabel","usePostVisibilityLabel","visibility","useSelect","select","editorStore","getEditedPostVisibility","visibilityOptions","label"],"sources":["@wordpress/editor/src/components/post-visibility/label.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { visibilityOptions } from './utils';\nimport { store as editorStore } from '../../store';\n\n/**\n * Returns the label for the current post visibility setting.\n *\n * @return {string} Post visibility label.\n */\nexport default function PostVisibilityLabel() {\n\treturn usePostVisibilityLabel();\n}\n\n/**\n * Get the label for the current post visibility setting.\n *\n * @return {string} Post visibility label.\n */\nexport function usePostVisibilityLabel() {\n\tconst visibility = useSelect( ( select ) =>\n\t\tselect( editorStore ).getEditedPostVisibility()\n\t);\n\treturn visibilityOptions[ visibility ]?.label;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACe,SAASG,mBAAmBA,CAAA,EAAG;EAC7C,OAAOC,sBAAsB,CAAC,CAAC;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASA,sBAAsBA,CAAA,EAAG;EACxC,MAAMC,UAAU,GAAG,IAAAC,eAAS,EAAIC,MAAM,IACrCA,MAAM,CAAEC,YAAY,CAAC,CAACC,uBAAuB,CAAC,CAC/C,CAAC;EACD,OAAOC,wBAAiB,CAAEL,UAAU,CAAE,EAAEM,KAAK;AAC9C","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_utils","_store","PostVisibilityLabel","usePostVisibilityLabel","visibility","useSelect","select","editorStore","getEditedPostVisibility","VISIBILITY_OPTIONS","find","option","value","label"],"sources":["@wordpress/editor/src/components/post-visibility/label.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { VISIBILITY_OPTIONS } from './utils';\nimport { store as editorStore } from '../../store';\n\n/**\n * Returns the label for the current post visibility setting.\n *\n * @return {string} Post visibility label.\n */\nexport default function PostVisibilityLabel() {\n\treturn usePostVisibilityLabel();\n}\n\n/**\n * Get the label for the current post visibility setting.\n *\n * @return {string} Post visibility label.\n */\nexport function usePostVisibilityLabel() {\n\tconst visibility = useSelect(\n\t\t( select ) => select( editorStore ).getEditedPostVisibility(),\n\t\t[]\n\t);\n\n\treturn VISIBILITY_OPTIONS.find( ( option ) => option.value === visibility )\n\t\t?.label;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACe,SAASG,mBAAmBA,CAAA,EAAG;EAC7C,OAAOC,sBAAsB,CAAC,CAAC;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASA,sBAAsBA,CAAA,EAAG;EACxC,MAAMC,UAAU,GAAG,IAAAC,eAAS,EACzBC,MAAM,IAAMA,MAAM,CAAEC,YAAY,CAAC,CAACC,uBAAuB,CAAC,CAAC,EAC7D,EACD,CAAC;EAED,OAAOC,yBAAkB,CAACC,IAAI,CAAIC,MAAM,IAAMA,MAAM,CAACC,KAAK,KAAKR,UAAW,CAAC,EACxES,KAAK;AACT","ignoreList":[]}
@@ -3,24 +3,23 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.visibilityOptions = void 0;
6
+ exports.VISIBILITY_OPTIONS = void 0;
7
7
  var _i18n = require("@wordpress/i18n");
8
8
  /**
9
9
  * WordPress dependencies
10
10
  */
11
11
 
12
- const visibilityOptions = exports.visibilityOptions = {
13
- public: {
14
- label: (0, _i18n.__)('Public'),
15
- info: (0, _i18n.__)('Visible to everyone.')
16
- },
17
- private: {
18
- label: (0, _i18n.__)('Private'),
19
- info: (0, _i18n.__)('Only visible to site admins and editors.')
20
- },
21
- password: {
22
- label: (0, _i18n.__)('Password protected'),
23
- info: (0, _i18n.__)('Only those with the password can view this post.')
24
- }
25
- };
12
+ const VISIBILITY_OPTIONS = exports.VISIBILITY_OPTIONS = [{
13
+ label: (0, _i18n.__)('Public'),
14
+ value: 'public',
15
+ description: (0, _i18n.__)('Visible to everyone.')
16
+ }, {
17
+ label: (0, _i18n.__)('Private'),
18
+ value: 'private',
19
+ description: (0, _i18n.__)('Only visible to site admins and editors.')
20
+ }, {
21
+ label: (0, _i18n.__)('Password protected'),
22
+ value: 'password',
23
+ description: (0, _i18n.__)('Only visible to those who know the password.')
24
+ }];
26
25
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","visibilityOptions","exports","public","label","__","info","private","password"],"sources":["@wordpress/editor/src/components/post-visibility/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const visibilityOptions = {\n\tpublic: {\n\t\tlabel: __( 'Public' ),\n\t\tinfo: __( 'Visible to everyone.' ),\n\t},\n\tprivate: {\n\t\tlabel: __( 'Private' ),\n\t\tinfo: __( 'Only visible to site admins and editors.' ),\n\t},\n\tpassword: {\n\t\tlabel: __( 'Password protected' ),\n\t\tinfo: __( 'Only those with the password can view this post.' ),\n\t},\n};\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAMC,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG;EAChCE,MAAM,EAAE;IACPC,KAAK,EAAE,IAAAC,QAAE,EAAE,QAAS,CAAC;IACrBC,IAAI,EAAE,IAAAD,QAAE,EAAE,sBAAuB;EAClC,CAAC;EACDE,OAAO,EAAE;IACRH,KAAK,EAAE,IAAAC,QAAE,EAAE,SAAU,CAAC;IACtBC,IAAI,EAAE,IAAAD,QAAE,EAAE,0CAA2C;EACtD,CAAC;EACDG,QAAQ,EAAE;IACTJ,KAAK,EAAE,IAAAC,QAAE,EAAE,oBAAqB,CAAC;IACjCC,IAAI,EAAE,IAAAD,QAAE,EAAE,kDAAmD;EAC9D;AACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","VISIBILITY_OPTIONS","exports","label","__","value","description"],"sources":["@wordpress/editor/src/components/post-visibility/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const VISIBILITY_OPTIONS = [\n\t{\n\t\tlabel: __( 'Public' ),\n\t\tvalue: 'public',\n\t\tdescription: __( 'Visible to everyone.' ),\n\t},\n\t{\n\t\tlabel: __( 'Private' ),\n\t\tvalue: 'private',\n\t\tdescription: __( 'Only visible to site admins and editors.' ),\n\t},\n\t{\n\t\tlabel: __( 'Password protected' ),\n\t\tvalue: 'password',\n\t\tdescription: __( 'Only visible to those who know the password.' ),\n\t},\n];\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAMC,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,CACjC;EACCE,KAAK,EAAE,IAAAC,QAAE,EAAE,QAAS,CAAC;EACrBC,KAAK,EAAE,QAAQ;EACfC,WAAW,EAAE,IAAAF,QAAE,EAAE,sBAAuB;AACzC,CAAC,EACD;EACCD,KAAK,EAAE,IAAAC,QAAE,EAAE,SAAU,CAAC;EACtBC,KAAK,EAAE,SAAS;EAChBC,WAAW,EAAE,IAAAF,QAAE,EAAE,0CAA2C;AAC7D,CAAC,EACD;EACCD,KAAK,EAAE,IAAAC,QAAE,EAAE,oBAAqB,CAAC;EACjCC,KAAK,EAAE,UAAU;EACjBC,WAAW,EAAE,IAAAF,QAAE,EAAE,8CAA+C;AACjE,CAAC,CACD","ignoreList":[]}
@@ -167,6 +167,7 @@ const ExperimentalEditorProvider = exports.ExperimentalEditorProvider = (0, _wit
167
167
  const {
168
168
  getEntitiesConfig
169
169
  } = select(_coreData.store);
170
+ const _mode = getRenderingMode();
170
171
  const _defaultMode = getDefaultRenderingMode(post.type);
171
172
  /**
172
173
  * To avoid content "flash", wait until rendering mode has been resolved.
@@ -175,12 +176,14 @@ const ExperimentalEditorProvider = exports.ExperimentalEditorProvider = (0, _wit
175
176
  * - Wait for template to be resolved if the default mode is 'template-locked'.
176
177
  * - Wait for default mode to be resolved otherwise.
177
178
  */
178
- const hasResolvedMode = _defaultMode === 'template-locked' ? hasTemplate : _defaultMode !== undefined;
179
+ const hasResolvedDefaultMode = _defaultMode === 'template-locked' ? hasTemplate : _defaultMode !== undefined;
180
+ // Wait until the default mode is retrieved and start rendering canvas.
181
+ const isRenderingModeReady = _defaultMode !== undefined;
179
182
  return {
180
183
  editorSettings: getEditorSettings(),
181
- isReady: __unstableIsEditorReady() && hasResolvedMode,
182
- mode: getRenderingMode(),
183
- defaultMode: _defaultMode,
184
+ isReady: __unstableIsEditorReady(),
185
+ mode: isRenderingModeReady ? _mode : undefined,
186
+ defaultMode: hasResolvedDefaultMode ? _defaultMode : undefined,
184
187
  selection: getEditorSelection(),
185
188
  postTypeEntities: post.type === 'wp_template' ? getEntitiesConfig('postType') : null
186
189
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_data","_i18n","_coreData","_blockEditor","_notices","_patterns","_blocks","_withRegistryProvider","_interopRequireDefault","_store","_useBlockEditorSettings","_lockUnlock","_disableNonPageContentBlocks","_navigationBlockEditingMode","_useHideBlocksFromInserter","_commands","_blockRemovalWarnings","_startPageOptions","_keyboardShortcutHelpModal","_contentOnlySettingsMenu","_startTemplateOptions","_globalKeyboardShortcuts","_patternRenameModal","_patternDuplicateModal","_templatePartMenuItems","_jsxRuntime","ExperimentalBlockEditorProvider","unlock","blockEditorPrivateApis","PatternsMenuItems","editPatternsPrivateApis","noop","NON_CONTEXTUAL_POST_TYPES","useBlockEditorProps","post","template","mode","rootLevelPost","postBlocks","onInput","onChange","useEntityBlockEditor","type","id","templateBlocks","onInputTemplate","onChangeTemplate","maybeNavigationBlocks","useMemo","createBlock","ref","templateLock","blocks","disableRootLevelChanges","ExperimentalEditorProvider","exports","withRegistryProvider","settings","recovery","initialEdits","children","BlockEditorProviderComponent","__unstableTemplate","hasTemplate","editorSettings","selection","isReady","defaultMode","postTypeEntities","useSelect","select","getEditorSettings","getEditorSelection","getRenderingMode","__unstableIsEditorReady","getDefaultRenderingMode","editorStore","getEntitiesConfig","coreStore","_defaultMode","hasResolvedMode","undefined","shouldRenderTemplate","defaultBlockContext","postContext","slug","postType","split","postTypeNames","map","entity","name","match","join","includes","postId","templateSlug","blockEditorSettings","useBlockEditorSettings","updatePostLock","setupEditor","updateEditorSettings","setCurrentTemplateId","setEditedPost","setRenderingMode","useDispatch","createWarningNotice","noticesStore","useLayoutEffect","postLock","autosave","__","actions","label","url","editLink","useEffect","useHideBlocksFromInserter","useCommands","jsx","EntityProvider","kind","BlockContextProvider","value","jsxs","useSubRegistry","isPreviewMode","Fragment","default","EditorProvider","props","BlockEditorProvider","_default"],"sources":["@wordpress/editor/src/components/provider/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useLayoutEffect, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tEntityProvider,\n\tuseEntityBlockEditor,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport {\n\tBlockEditorProvider,\n\tBlockContextProvider,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as editPatternsPrivateApis } from '@wordpress/patterns';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport withRegistryProvider from './with-registry-provider';\nimport { store as editorStore } from '../../store';\nimport useBlockEditorSettings from './use-block-editor-settings';\nimport { unlock } from '../../lock-unlock';\nimport DisableNonPageContentBlocks from './disable-non-page-content-blocks';\nimport NavigationBlockEditingMode from './navigation-block-editing-mode';\nimport { useHideBlocksFromInserter } from './use-hide-blocks-from-inserter';\nimport useCommands from '../commands';\nimport BlockRemovalWarnings from '../block-removal-warnings';\nimport StartPageOptions from '../start-page-options';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\nimport ContentOnlySettingsMenu from '../block-settings-menu/content-only-settings-menu';\nimport StartTemplateOptions from '../start-template-options';\nimport EditorKeyboardShortcuts from '../global-keyboard-shortcuts';\nimport PatternRenameModal from '../pattern-rename-modal';\nimport PatternDuplicateModal from '../pattern-duplicate-modal';\nimport TemplatePartMenuItems from '../template-part-menu-items';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\nconst { PatternsMenuItems } = unlock( editPatternsPrivateApis );\n\nconst noop = () => {};\n\n/**\n * These are global entities that are only there to split blocks into logical units\n * They don't provide a \"context\" for the current post/page being rendered.\n * So we should not use their ids as post context. This is important to allow post blocks\n * (post content, post title) to be used within them without issues.\n */\nconst NON_CONTEXTUAL_POST_TYPES = [\n\t'wp_block',\n\t'wp_navigation',\n\t'wp_template_part',\n];\n\n/**\n * Depending on the post, template and template mode,\n * returns the appropriate blocks and change handlers for the block editor provider.\n *\n * @param {Array} post Block list.\n * @param {boolean} template Whether the page content has focus (and the surrounding template is inert). If `true` return page content blocks. Default `false`.\n * @param {string} mode Rendering mode.\n *\n * @example\n * ```jsx\n * const [ blocks, onInput, onChange ] = useBlockEditorProps( post, template, mode );\n * ```\n *\n * @return {Array} Block editor props.\n */\nfunction useBlockEditorProps( post, template, mode ) {\n\tconst rootLevelPost = mode === 'template-locked' ? 'template' : 'post';\n\tconst [ postBlocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\tpost.type,\n\t\t{ id: post.id }\n\t);\n\tconst [ templateBlocks, onInputTemplate, onChangeTemplate ] =\n\t\tuseEntityBlockEditor( 'postType', template?.type, {\n\t\t\tid: template?.id,\n\t\t} );\n\tconst maybeNavigationBlocks = useMemo( () => {\n\t\tif ( post.type === 'wp_navigation' ) {\n\t\t\treturn [\n\t\t\t\tcreateBlock( 'core/navigation', {\n\t\t\t\t\tref: post.id,\n\t\t\t\t\t// As the parent editor is locked with `templateLock`, the template locking\n\t\t\t\t\t// must be explicitly \"unset\" on the block itself to allow the user to modify\n\t\t\t\t\t// the block's content.\n\t\t\t\t\ttemplateLock: false,\n\t\t\t\t} ),\n\t\t\t];\n\t\t}\n\t}, [ post.type, post.id ] );\n\n\t// It is important that we don't create a new instance of blocks on every change\n\t// We should only create a new instance if the blocks them selves change, not a dependency of them.\n\tconst blocks = useMemo( () => {\n\t\tif ( maybeNavigationBlocks ) {\n\t\t\treturn maybeNavigationBlocks;\n\t\t}\n\n\t\tif ( rootLevelPost === 'template' ) {\n\t\t\treturn templateBlocks;\n\t\t}\n\n\t\treturn postBlocks;\n\t}, [ maybeNavigationBlocks, rootLevelPost, templateBlocks, postBlocks ] );\n\n\t// Handle fallback to postBlocks outside of the above useMemo, to ensure\n\t// that constructed block templates that call `createBlock` are not generated\n\t// too frequently. This ensures that clientIds are stable.\n\tconst disableRootLevelChanges =\n\t\t( !! template && mode === 'template-locked' ) ||\n\t\tpost.type === 'wp_navigation';\n\tif ( disableRootLevelChanges ) {\n\t\treturn [ blocks, noop, noop ];\n\t}\n\n\treturn [\n\t\tblocks,\n\t\trootLevelPost === 'post' ? onInput : onInputTemplate,\n\t\trootLevelPost === 'post' ? onChange : onChangeTemplate,\n\t];\n}\n\n/**\n * This component provides the editor context and manages the state of the block editor.\n *\n * @param {Object} props The component props.\n * @param {Object} props.post The post object.\n * @param {Object} props.settings The editor settings.\n * @param {boolean} props.recovery Indicates if the editor is in recovery mode.\n * @param {Array} props.initialEdits The initial edits for the editor.\n * @param {Object} props.children The child components.\n * @param {Object} [props.BlockEditorProviderComponent] The block editor provider component to use. Defaults to ExperimentalBlockEditorProvider.\n * @param {Object} [props.__unstableTemplate] The template object.\n *\n * @example\n * ```jsx\n * <ExperimentalEditorProvider\n * post={ post }\n * settings={ settings }\n * recovery={ recovery }\n * initialEdits={ initialEdits }\n * __unstableTemplate={ template }\n * >\n * { children }\n * </ExperimentalEditorProvider>\n *\n * @return {Object} The rendered ExperimentalEditorProvider component.\n */\nexport const ExperimentalEditorProvider = withRegistryProvider(\n\t( {\n\t\tpost,\n\t\tsettings,\n\t\trecovery,\n\t\tinitialEdits,\n\t\tchildren,\n\t\tBlockEditorProviderComponent = ExperimentalBlockEditorProvider,\n\t\t__unstableTemplate: template,\n\t} ) => {\n\t\tconst hasTemplate = !! template;\n\t\tconst {\n\t\t\teditorSettings,\n\t\t\tselection,\n\t\t\tisReady,\n\t\t\tmode,\n\t\t\tdefaultMode,\n\t\t\tpostTypeEntities,\n\t\t} = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetEditorSettings,\n\t\t\t\t\tgetEditorSelection,\n\t\t\t\t\tgetRenderingMode,\n\t\t\t\t\t__unstableIsEditorReady,\n\t\t\t\t\tgetDefaultRenderingMode,\n\t\t\t\t} = unlock( select( editorStore ) );\n\t\t\t\tconst { getEntitiesConfig } = select( coreStore );\n\n\t\t\t\tconst _defaultMode = getDefaultRenderingMode( post.type );\n\t\t\t\t/**\n\t\t\t\t * To avoid content \"flash\", wait until rendering mode has been resolved.\n\t\t\t\t * This is important for the initial render of the editor.\n\t\t\t\t *\n\t\t\t\t * - Wait for template to be resolved if the default mode is 'template-locked'.\n\t\t\t\t * - Wait for default mode to be resolved otherwise.\n\t\t\t\t */\n\t\t\t\tconst hasResolvedMode =\n\t\t\t\t\t_defaultMode === 'template-locked'\n\t\t\t\t\t\t? hasTemplate\n\t\t\t\t\t\t: _defaultMode !== undefined;\n\n\t\t\t\treturn {\n\t\t\t\t\teditorSettings: getEditorSettings(),\n\t\t\t\t\tisReady: __unstableIsEditorReady() && hasResolvedMode,\n\t\t\t\t\tmode: getRenderingMode(),\n\t\t\t\t\tdefaultMode: _defaultMode,\n\t\t\t\t\tselection: getEditorSelection(),\n\t\t\t\t\tpostTypeEntities:\n\t\t\t\t\t\tpost.type === 'wp_template'\n\t\t\t\t\t\t\t? getEntitiesConfig( 'postType' )\n\t\t\t\t\t\t\t: null,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ post.type, hasTemplate ]\n\t\t);\n\n\t\tconst shouldRenderTemplate = hasTemplate && mode !== 'post-only';\n\t\tconst rootLevelPost = shouldRenderTemplate ? template : post;\n\t\tconst defaultBlockContext = useMemo( () => {\n\t\t\tconst postContext = {};\n\t\t\t// If it is a template, try to inherit the post type from the name.\n\t\t\tif ( post.type === 'wp_template' ) {\n\t\t\t\tif ( post.slug === 'page' ) {\n\t\t\t\t\tpostContext.postType = 'page';\n\t\t\t\t} else if ( post.slug === 'single' ) {\n\t\t\t\t\tpostContext.postType = 'post';\n\t\t\t\t} else if ( post.slug.split( '-' )[ 0 ] === 'single' ) {\n\t\t\t\t\t// If the slug is single-{postType}, infer the post type from the name.\n\t\t\t\t\tconst postTypeNames =\n\t\t\t\t\t\tpostTypeEntities?.map( ( entity ) => entity.name ) ||\n\t\t\t\t\t\t[];\n\t\t\t\t\tconst match = post.slug.match(\n\t\t\t\t\t\t`^single-(${ postTypeNames.join( '|' ) })(?:-.+)?$`\n\t\t\t\t\t);\n\t\t\t\t\tif ( match ) {\n\t\t\t\t\t\tpostContext.postType = match[ 1 ];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\t! NON_CONTEXTUAL_POST_TYPES.includes( rootLevelPost.type ) ||\n\t\t\t\tshouldRenderTemplate\n\t\t\t) {\n\t\t\t\tpostContext.postId = post.id;\n\t\t\t\tpostContext.postType = post.type;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...postContext,\n\t\t\t\ttemplateSlug:\n\t\t\t\t\trootLevelPost.type === 'wp_template'\n\t\t\t\t\t\t? rootLevelPost.slug\n\t\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t}, [\n\t\t\tshouldRenderTemplate,\n\t\t\tpost.id,\n\t\t\tpost.type,\n\t\t\tpost.slug,\n\t\t\trootLevelPost.type,\n\t\t\trootLevelPost.slug,\n\t\t\tpostTypeEntities,\n\t\t] );\n\t\tconst { id, type } = rootLevelPost;\n\t\tconst blockEditorSettings = useBlockEditorSettings(\n\t\t\teditorSettings,\n\t\t\ttype,\n\t\t\tid,\n\t\t\tmode\n\t\t);\n\t\tconst [ blocks, onInput, onChange ] = useBlockEditorProps(\n\t\t\tpost,\n\t\t\ttemplate,\n\t\t\tmode\n\t\t);\n\n\t\tconst {\n\t\t\tupdatePostLock,\n\t\t\tsetupEditor,\n\t\t\tupdateEditorSettings,\n\t\t\tsetCurrentTemplateId,\n\t\t\tsetEditedPost,\n\t\t\tsetRenderingMode,\n\t\t} = unlock( useDispatch( editorStore ) );\n\t\tconst { createWarningNotice } = useDispatch( noticesStore );\n\n\t\t// Ideally this should be synced on each change and not just something you do once.\n\t\tuseLayoutEffect( () => {\n\t\t\t// Assume that we don't need to initialize in the case of an error recovery.\n\t\t\tif ( recovery ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tupdatePostLock( settings.postLock );\n\t\t\tsetupEditor( post, initialEdits, settings.template );\n\t\t\tif ( settings.autosave ) {\n\t\t\t\tcreateWarningNotice(\n\t\t\t\t\t__(\n\t\t\t\t\t\t'There is an autosave of this post that is more recent than the version below.'\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'autosave-exists',\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'View the autosave' ),\n\t\t\t\t\t\t\t\turl: settings.autosave.editLink,\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\n\t\t\t// The dependencies of the hook are omitted deliberately\n\t\t\t// We only want to run setupEditor (with initialEdits) only once per post.\n\t\t\t// A better solution in the future would be to split this effect into multiple ones.\n\t\t}, [] );\n\n\t\t// Synchronizes the active post with the state\n\t\tuseEffect( () => {\n\t\t\tsetEditedPost( post.type, post.id );\n\t\t}, [ post.type, post.id, setEditedPost ] );\n\n\t\t// Synchronize the editor settings as they change.\n\t\tuseEffect( () => {\n\t\t\tupdateEditorSettings( settings );\n\t\t}, [ settings, updateEditorSettings ] );\n\n\t\t// Synchronizes the active template with the state.\n\t\tuseEffect( () => {\n\t\t\tsetCurrentTemplateId( template?.id );\n\t\t}, [ template?.id, setCurrentTemplateId ] );\n\n\t\t// Sets the right rendering mode when loading the editor.\n\t\tuseEffect( () => {\n\t\t\tif ( defaultMode ) {\n\t\t\t\tsetRenderingMode( defaultMode );\n\t\t\t}\n\t\t}, [ defaultMode, setRenderingMode ] );\n\n\t\tuseHideBlocksFromInserter( post.type, mode );\n\n\t\t// Register the editor commands.\n\t\tuseCommands();\n\n\t\tif ( ! isReady || ! mode ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<EntityProvider kind=\"root\" type=\"site\">\n\t\t\t\t<EntityProvider\n\t\t\t\t\tkind=\"postType\"\n\t\t\t\t\ttype={ post.type }\n\t\t\t\t\tid={ post.id }\n\t\t\t\t>\n\t\t\t\t\t<BlockContextProvider value={ defaultBlockContext }>\n\t\t\t\t\t\t<BlockEditorProviderComponent\n\t\t\t\t\t\t\tvalue={ blocks }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tonInput={ onInput }\n\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\tsettings={ blockEditorSettings }\n\t\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t{ ! settings.isPreviewMode && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<PatternsMenuItems />\n\t\t\t\t\t\t\t\t\t<TemplatePartMenuItems />\n\t\t\t\t\t\t\t\t\t<ContentOnlySettingsMenu />\n\t\t\t\t\t\t\t\t\t{ mode === 'template-locked' && (\n\t\t\t\t\t\t\t\t\t\t<DisableNonPageContentBlocks />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ type === 'wp_navigation' && (\n\t\t\t\t\t\t\t\t\t\t<NavigationBlockEditingMode />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<EditorKeyboardShortcuts />\n\t\t\t\t\t\t\t\t\t<KeyboardShortcutHelpModal />\n\t\t\t\t\t\t\t\t\t<BlockRemovalWarnings />\n\t\t\t\t\t\t\t\t\t<StartPageOptions />\n\t\t\t\t\t\t\t\t\t<StartTemplateOptions />\n\t\t\t\t\t\t\t\t\t<PatternRenameModal />\n\t\t\t\t\t\t\t\t\t<PatternDuplicateModal />\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</BlockEditorProviderComponent>\n\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t</EntityProvider>\n\t\t\t</EntityProvider>\n\t\t);\n\t}\n);\n\n/**\n * This component establishes a new post editing context, and serves as the entry point for a new post editor (or post with template editor).\n *\n * It supports a large number of post types, including post, page, templates,\n * custom post types, patterns, template parts.\n *\n * All modification and changes are performed to the `@wordpress/core-data` store.\n *\n * @param {Object} props The component props.\n * @param {Object} [props.post] The post object to edit. This is required.\n * @param {Object} [props.__unstableTemplate] The template object wrapper the edited post.\n * This is optional and can only be used when the post type supports templates (like posts and pages).\n * @param {Object} [props.settings] The settings object to use for the editor.\n * This is optional and can be used to override the default settings.\n * @param {React.ReactNode} [props.children] Children elements for which the BlockEditorProvider context should apply.\n * This is optional.\n *\n * @example\n * ```jsx\n * <EditorProvider\n * post={ post }\n * settings={ settings }\n * __unstableTemplate={ template }\n * >\n * { children }\n * </EditorProvider>\n * ```\n *\n * @return {React.ReactNode} The rendered EditorProvider component.\n */\nexport function EditorProvider( props ) {\n\treturn (\n\t\t<ExperimentalEditorProvider\n\t\t\t{ ...props }\n\t\t\tBlockEditorProviderComponent={ BlockEditorProvider }\n\t\t>\n\t\t\t{ props.children }\n\t\t</ExperimentalEditorProvider>\n\t);\n}\n\nexport default EditorProvider;\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAKA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAKA,IAAAQ,qBAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,uBAAA,GAAAF,sBAAA,CAAAT,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AACA,IAAAa,4BAAA,GAAAJ,sBAAA,CAAAT,OAAA;AACA,IAAAc,2BAAA,GAAAL,sBAAA,CAAAT,OAAA;AACA,IAAAe,0BAAA,GAAAf,OAAA;AACA,IAAAgB,SAAA,GAAAP,sBAAA,CAAAT,OAAA;AACA,IAAAiB,qBAAA,GAAAR,sBAAA,CAAAT,OAAA;AACA,IAAAkB,iBAAA,GAAAT,sBAAA,CAAAT,OAAA;AACA,IAAAmB,0BAAA,GAAAV,sBAAA,CAAAT,OAAA;AACA,IAAAoB,wBAAA,GAAAX,sBAAA,CAAAT,OAAA;AACA,IAAAqB,qBAAA,GAAAZ,sBAAA,CAAAT,OAAA;AACA,IAAAsB,wBAAA,GAAAb,sBAAA,CAAAT,OAAA;AACA,IAAAuB,mBAAA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AAED;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;AACO,SAASC,cAAcA,CAAEC,KAAK,EAAG;EACvC,oBACC,IAAAzG,WAAA,CAAA8F,GAAA,EAACjE,0BAA0B;IAAA,GACrB4E,KAAK;IACVrE,4BAA4B,EAAGsE,gCAAqB;IAAAvE,QAAA,EAElDsE,KAAK,CAACtE;EAAQ,CACW,CAAC;AAE/B;AAAC,IAAAwE,QAAA,GAAA7E,OAAA,CAAAyE,OAAA,GAEcC,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_data","_i18n","_coreData","_blockEditor","_notices","_patterns","_blocks","_withRegistryProvider","_interopRequireDefault","_store","_useBlockEditorSettings","_lockUnlock","_disableNonPageContentBlocks","_navigationBlockEditingMode","_useHideBlocksFromInserter","_commands","_blockRemovalWarnings","_startPageOptions","_keyboardShortcutHelpModal","_contentOnlySettingsMenu","_startTemplateOptions","_globalKeyboardShortcuts","_patternRenameModal","_patternDuplicateModal","_templatePartMenuItems","_jsxRuntime","ExperimentalBlockEditorProvider","unlock","blockEditorPrivateApis","PatternsMenuItems","editPatternsPrivateApis","noop","NON_CONTEXTUAL_POST_TYPES","useBlockEditorProps","post","template","mode","rootLevelPost","postBlocks","onInput","onChange","useEntityBlockEditor","type","id","templateBlocks","onInputTemplate","onChangeTemplate","maybeNavigationBlocks","useMemo","createBlock","ref","templateLock","blocks","disableRootLevelChanges","ExperimentalEditorProvider","exports","withRegistryProvider","settings","recovery","initialEdits","children","BlockEditorProviderComponent","__unstableTemplate","hasTemplate","editorSettings","selection","isReady","defaultMode","postTypeEntities","useSelect","select","getEditorSettings","getEditorSelection","getRenderingMode","__unstableIsEditorReady","getDefaultRenderingMode","editorStore","getEntitiesConfig","coreStore","_mode","_defaultMode","hasResolvedDefaultMode","undefined","isRenderingModeReady","shouldRenderTemplate","defaultBlockContext","postContext","slug","postType","split","postTypeNames","map","entity","name","match","join","includes","postId","templateSlug","blockEditorSettings","useBlockEditorSettings","updatePostLock","setupEditor","updateEditorSettings","setCurrentTemplateId","setEditedPost","setRenderingMode","useDispatch","createWarningNotice","noticesStore","useLayoutEffect","postLock","autosave","__","actions","label","url","editLink","useEffect","useHideBlocksFromInserter","useCommands","jsx","EntityProvider","kind","BlockContextProvider","value","jsxs","useSubRegistry","isPreviewMode","Fragment","default","EditorProvider","props","BlockEditorProvider","_default"],"sources":["@wordpress/editor/src/components/provider/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useLayoutEffect, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tEntityProvider,\n\tuseEntityBlockEditor,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport {\n\tBlockEditorProvider,\n\tBlockContextProvider,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as editPatternsPrivateApis } from '@wordpress/patterns';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport withRegistryProvider from './with-registry-provider';\nimport { store as editorStore } from '../../store';\nimport useBlockEditorSettings from './use-block-editor-settings';\nimport { unlock } from '../../lock-unlock';\nimport DisableNonPageContentBlocks from './disable-non-page-content-blocks';\nimport NavigationBlockEditingMode from './navigation-block-editing-mode';\nimport { useHideBlocksFromInserter } from './use-hide-blocks-from-inserter';\nimport useCommands from '../commands';\nimport BlockRemovalWarnings from '../block-removal-warnings';\nimport StartPageOptions from '../start-page-options';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\nimport ContentOnlySettingsMenu from '../block-settings-menu/content-only-settings-menu';\nimport StartTemplateOptions from '../start-template-options';\nimport EditorKeyboardShortcuts from '../global-keyboard-shortcuts';\nimport PatternRenameModal from '../pattern-rename-modal';\nimport PatternDuplicateModal from '../pattern-duplicate-modal';\nimport TemplatePartMenuItems from '../template-part-menu-items';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\nconst { PatternsMenuItems } = unlock( editPatternsPrivateApis );\n\nconst noop = () => {};\n\n/**\n * These are global entities that are only there to split blocks into logical units\n * They don't provide a \"context\" for the current post/page being rendered.\n * So we should not use their ids as post context. This is important to allow post blocks\n * (post content, post title) to be used within them without issues.\n */\nconst NON_CONTEXTUAL_POST_TYPES = [\n\t'wp_block',\n\t'wp_navigation',\n\t'wp_template_part',\n];\n\n/**\n * Depending on the post, template and template mode,\n * returns the appropriate blocks and change handlers for the block editor provider.\n *\n * @param {Array} post Block list.\n * @param {boolean} template Whether the page content has focus (and the surrounding template is inert). If `true` return page content blocks. Default `false`.\n * @param {string} mode Rendering mode.\n *\n * @example\n * ```jsx\n * const [ blocks, onInput, onChange ] = useBlockEditorProps( post, template, mode );\n * ```\n *\n * @return {Array} Block editor props.\n */\nfunction useBlockEditorProps( post, template, mode ) {\n\tconst rootLevelPost = mode === 'template-locked' ? 'template' : 'post';\n\tconst [ postBlocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\tpost.type,\n\t\t{ id: post.id }\n\t);\n\tconst [ templateBlocks, onInputTemplate, onChangeTemplate ] =\n\t\tuseEntityBlockEditor( 'postType', template?.type, {\n\t\t\tid: template?.id,\n\t\t} );\n\tconst maybeNavigationBlocks = useMemo( () => {\n\t\tif ( post.type === 'wp_navigation' ) {\n\t\t\treturn [\n\t\t\t\tcreateBlock( 'core/navigation', {\n\t\t\t\t\tref: post.id,\n\t\t\t\t\t// As the parent editor is locked with `templateLock`, the template locking\n\t\t\t\t\t// must be explicitly \"unset\" on the block itself to allow the user to modify\n\t\t\t\t\t// the block's content.\n\t\t\t\t\ttemplateLock: false,\n\t\t\t\t} ),\n\t\t\t];\n\t\t}\n\t}, [ post.type, post.id ] );\n\n\t// It is important that we don't create a new instance of blocks on every change\n\t// We should only create a new instance if the blocks them selves change, not a dependency of them.\n\tconst blocks = useMemo( () => {\n\t\tif ( maybeNavigationBlocks ) {\n\t\t\treturn maybeNavigationBlocks;\n\t\t}\n\n\t\tif ( rootLevelPost === 'template' ) {\n\t\t\treturn templateBlocks;\n\t\t}\n\n\t\treturn postBlocks;\n\t}, [ maybeNavigationBlocks, rootLevelPost, templateBlocks, postBlocks ] );\n\n\t// Handle fallback to postBlocks outside of the above useMemo, to ensure\n\t// that constructed block templates that call `createBlock` are not generated\n\t// too frequently. This ensures that clientIds are stable.\n\tconst disableRootLevelChanges =\n\t\t( !! template && mode === 'template-locked' ) ||\n\t\tpost.type === 'wp_navigation';\n\tif ( disableRootLevelChanges ) {\n\t\treturn [ blocks, noop, noop ];\n\t}\n\n\treturn [\n\t\tblocks,\n\t\trootLevelPost === 'post' ? onInput : onInputTemplate,\n\t\trootLevelPost === 'post' ? onChange : onChangeTemplate,\n\t];\n}\n\n/**\n * This component provides the editor context and manages the state of the block editor.\n *\n * @param {Object} props The component props.\n * @param {Object} props.post The post object.\n * @param {Object} props.settings The editor settings.\n * @param {boolean} props.recovery Indicates if the editor is in recovery mode.\n * @param {Array} props.initialEdits The initial edits for the editor.\n * @param {Object} props.children The child components.\n * @param {Object} [props.BlockEditorProviderComponent] The block editor provider component to use. Defaults to ExperimentalBlockEditorProvider.\n * @param {Object} [props.__unstableTemplate] The template object.\n *\n * @example\n * ```jsx\n * <ExperimentalEditorProvider\n * post={ post }\n * settings={ settings }\n * recovery={ recovery }\n * initialEdits={ initialEdits }\n * __unstableTemplate={ template }\n * >\n * { children }\n * </ExperimentalEditorProvider>\n *\n * @return {Object} The rendered ExperimentalEditorProvider component.\n */\nexport const ExperimentalEditorProvider = withRegistryProvider(\n\t( {\n\t\tpost,\n\t\tsettings,\n\t\trecovery,\n\t\tinitialEdits,\n\t\tchildren,\n\t\tBlockEditorProviderComponent = ExperimentalBlockEditorProvider,\n\t\t__unstableTemplate: template,\n\t} ) => {\n\t\tconst hasTemplate = !! template;\n\t\tconst {\n\t\t\teditorSettings,\n\t\t\tselection,\n\t\t\tisReady,\n\t\t\tmode,\n\t\t\tdefaultMode,\n\t\t\tpostTypeEntities,\n\t\t} = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetEditorSettings,\n\t\t\t\t\tgetEditorSelection,\n\t\t\t\t\tgetRenderingMode,\n\t\t\t\t\t__unstableIsEditorReady,\n\t\t\t\t\tgetDefaultRenderingMode,\n\t\t\t\t} = unlock( select( editorStore ) );\n\t\t\t\tconst { getEntitiesConfig } = select( coreStore );\n\n\t\t\t\tconst _mode = getRenderingMode();\n\t\t\t\tconst _defaultMode = getDefaultRenderingMode( post.type );\n\t\t\t\t/**\n\t\t\t\t * To avoid content \"flash\", wait until rendering mode has been resolved.\n\t\t\t\t * This is important for the initial render of the editor.\n\t\t\t\t *\n\t\t\t\t * - Wait for template to be resolved if the default mode is 'template-locked'.\n\t\t\t\t * - Wait for default mode to be resolved otherwise.\n\t\t\t\t */\n\t\t\t\tconst hasResolvedDefaultMode =\n\t\t\t\t\t_defaultMode === 'template-locked'\n\t\t\t\t\t\t? hasTemplate\n\t\t\t\t\t\t: _defaultMode !== undefined;\n\t\t\t\t// Wait until the default mode is retrieved and start rendering canvas.\n\t\t\t\tconst isRenderingModeReady = _defaultMode !== undefined;\n\n\t\t\t\treturn {\n\t\t\t\t\teditorSettings: getEditorSettings(),\n\t\t\t\t\tisReady: __unstableIsEditorReady(),\n\t\t\t\t\tmode: isRenderingModeReady ? _mode : undefined,\n\t\t\t\t\tdefaultMode: hasResolvedDefaultMode\n\t\t\t\t\t\t? _defaultMode\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\tselection: getEditorSelection(),\n\t\t\t\t\tpostTypeEntities:\n\t\t\t\t\t\tpost.type === 'wp_template'\n\t\t\t\t\t\t\t? getEntitiesConfig( 'postType' )\n\t\t\t\t\t\t\t: null,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ post.type, hasTemplate ]\n\t\t);\n\n\t\tconst shouldRenderTemplate = hasTemplate && mode !== 'post-only';\n\t\tconst rootLevelPost = shouldRenderTemplate ? template : post;\n\t\tconst defaultBlockContext = useMemo( () => {\n\t\t\tconst postContext = {};\n\t\t\t// If it is a template, try to inherit the post type from the name.\n\t\t\tif ( post.type === 'wp_template' ) {\n\t\t\t\tif ( post.slug === 'page' ) {\n\t\t\t\t\tpostContext.postType = 'page';\n\t\t\t\t} else if ( post.slug === 'single' ) {\n\t\t\t\t\tpostContext.postType = 'post';\n\t\t\t\t} else if ( post.slug.split( '-' )[ 0 ] === 'single' ) {\n\t\t\t\t\t// If the slug is single-{postType}, infer the post type from the name.\n\t\t\t\t\tconst postTypeNames =\n\t\t\t\t\t\tpostTypeEntities?.map( ( entity ) => entity.name ) ||\n\t\t\t\t\t\t[];\n\t\t\t\t\tconst match = post.slug.match(\n\t\t\t\t\t\t`^single-(${ postTypeNames.join( '|' ) })(?:-.+)?$`\n\t\t\t\t\t);\n\t\t\t\t\tif ( match ) {\n\t\t\t\t\t\tpostContext.postType = match[ 1 ];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\t! NON_CONTEXTUAL_POST_TYPES.includes( rootLevelPost.type ) ||\n\t\t\t\tshouldRenderTemplate\n\t\t\t) {\n\t\t\t\tpostContext.postId = post.id;\n\t\t\t\tpostContext.postType = post.type;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...postContext,\n\t\t\t\ttemplateSlug:\n\t\t\t\t\trootLevelPost.type === 'wp_template'\n\t\t\t\t\t\t? rootLevelPost.slug\n\t\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t}, [\n\t\t\tshouldRenderTemplate,\n\t\t\tpost.id,\n\t\t\tpost.type,\n\t\t\tpost.slug,\n\t\t\trootLevelPost.type,\n\t\t\trootLevelPost.slug,\n\t\t\tpostTypeEntities,\n\t\t] );\n\t\tconst { id, type } = rootLevelPost;\n\t\tconst blockEditorSettings = useBlockEditorSettings(\n\t\t\teditorSettings,\n\t\t\ttype,\n\t\t\tid,\n\t\t\tmode\n\t\t);\n\t\tconst [ blocks, onInput, onChange ] = useBlockEditorProps(\n\t\t\tpost,\n\t\t\ttemplate,\n\t\t\tmode\n\t\t);\n\n\t\tconst {\n\t\t\tupdatePostLock,\n\t\t\tsetupEditor,\n\t\t\tupdateEditorSettings,\n\t\t\tsetCurrentTemplateId,\n\t\t\tsetEditedPost,\n\t\t\tsetRenderingMode,\n\t\t} = unlock( useDispatch( editorStore ) );\n\t\tconst { createWarningNotice } = useDispatch( noticesStore );\n\n\t\t// Ideally this should be synced on each change and not just something you do once.\n\t\tuseLayoutEffect( () => {\n\t\t\t// Assume that we don't need to initialize in the case of an error recovery.\n\t\t\tif ( recovery ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tupdatePostLock( settings.postLock );\n\t\t\tsetupEditor( post, initialEdits, settings.template );\n\t\t\tif ( settings.autosave ) {\n\t\t\t\tcreateWarningNotice(\n\t\t\t\t\t__(\n\t\t\t\t\t\t'There is an autosave of this post that is more recent than the version below.'\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'autosave-exists',\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'View the autosave' ),\n\t\t\t\t\t\t\t\turl: settings.autosave.editLink,\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\n\t\t\t// The dependencies of the hook are omitted deliberately\n\t\t\t// We only want to run setupEditor (with initialEdits) only once per post.\n\t\t\t// A better solution in the future would be to split this effect into multiple ones.\n\t\t}, [] );\n\n\t\t// Synchronizes the active post with the state\n\t\tuseEffect( () => {\n\t\t\tsetEditedPost( post.type, post.id );\n\t\t}, [ post.type, post.id, setEditedPost ] );\n\n\t\t// Synchronize the editor settings as they change.\n\t\tuseEffect( () => {\n\t\t\tupdateEditorSettings( settings );\n\t\t}, [ settings, updateEditorSettings ] );\n\n\t\t// Synchronizes the active template with the state.\n\t\tuseEffect( () => {\n\t\t\tsetCurrentTemplateId( template?.id );\n\t\t}, [ template?.id, setCurrentTemplateId ] );\n\n\t\t// Sets the right rendering mode when loading the editor.\n\t\tuseEffect( () => {\n\t\t\tif ( defaultMode ) {\n\t\t\t\tsetRenderingMode( defaultMode );\n\t\t\t}\n\t\t}, [ defaultMode, setRenderingMode ] );\n\n\t\tuseHideBlocksFromInserter( post.type, mode );\n\n\t\t// Register the editor commands.\n\t\tuseCommands();\n\n\t\tif ( ! isReady || ! mode ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<EntityProvider kind=\"root\" type=\"site\">\n\t\t\t\t<EntityProvider\n\t\t\t\t\tkind=\"postType\"\n\t\t\t\t\ttype={ post.type }\n\t\t\t\t\tid={ post.id }\n\t\t\t\t>\n\t\t\t\t\t<BlockContextProvider value={ defaultBlockContext }>\n\t\t\t\t\t\t<BlockEditorProviderComponent\n\t\t\t\t\t\t\tvalue={ blocks }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tonInput={ onInput }\n\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\tsettings={ blockEditorSettings }\n\t\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t{ ! settings.isPreviewMode && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<PatternsMenuItems />\n\t\t\t\t\t\t\t\t\t<TemplatePartMenuItems />\n\t\t\t\t\t\t\t\t\t<ContentOnlySettingsMenu />\n\t\t\t\t\t\t\t\t\t{ mode === 'template-locked' && (\n\t\t\t\t\t\t\t\t\t\t<DisableNonPageContentBlocks />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ type === 'wp_navigation' && (\n\t\t\t\t\t\t\t\t\t\t<NavigationBlockEditingMode />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<EditorKeyboardShortcuts />\n\t\t\t\t\t\t\t\t\t<KeyboardShortcutHelpModal />\n\t\t\t\t\t\t\t\t\t<BlockRemovalWarnings />\n\t\t\t\t\t\t\t\t\t<StartPageOptions />\n\t\t\t\t\t\t\t\t\t<StartTemplateOptions />\n\t\t\t\t\t\t\t\t\t<PatternRenameModal />\n\t\t\t\t\t\t\t\t\t<PatternDuplicateModal />\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</BlockEditorProviderComponent>\n\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t</EntityProvider>\n\t\t\t</EntityProvider>\n\t\t);\n\t}\n);\n\n/**\n * This component establishes a new post editing context, and serves as the entry point for a new post editor (or post with template editor).\n *\n * It supports a large number of post types, including post, page, templates,\n * custom post types, patterns, template parts.\n *\n * All modification and changes are performed to the `@wordpress/core-data` store.\n *\n * @param {Object} props The component props.\n * @param {Object} [props.post] The post object to edit. This is required.\n * @param {Object} [props.__unstableTemplate] The template object wrapper the edited post.\n * This is optional and can only be used when the post type supports templates (like posts and pages).\n * @param {Object} [props.settings] The settings object to use for the editor.\n * This is optional and can be used to override the default settings.\n * @param {React.ReactNode} [props.children] Children elements for which the BlockEditorProvider context should apply.\n * This is optional.\n *\n * @example\n * ```jsx\n * <EditorProvider\n * post={ post }\n * settings={ settings }\n * __unstableTemplate={ template }\n * >\n * { children }\n * </EditorProvider>\n * ```\n *\n * @return {React.ReactNode} The rendered EditorProvider component.\n */\nexport function EditorProvider( props ) {\n\treturn (\n\t\t<ExperimentalEditorProvider\n\t\t\t{ ...props }\n\t\t\tBlockEditorProviderComponent={ BlockEditorProvider }\n\t\t>\n\t\t\t{ props.children }\n\t\t</ExperimentalEditorProvider>\n\t);\n}\n\nexport default EditorProvider;\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC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,0BAA0B;IAAA,GACrB8E,KAAK;IACVvE,4BAA4B,EAAGwE,gCAAqB;IAAAzE,QAAA,EAElDwE,KAAK,CAACxE;EAAQ,CACW,CAAC;AAE/B;AAAC,IAAA0E,QAAA,GAAA/E,OAAA,CAAA2E,OAAA,GAEcC,cAAc","ignoreList":[]}
@@ -85,7 +85,7 @@ const CARD_ICONS = {
85
85
  const getPostIcon = exports.getPostIcon = (0, _data.createRegistrySelector)(select => (state, postType, options) => {
86
86
  {
87
87
  if (postType === 'wp_template_part' || postType === 'wp_template') {
88
- const templateAreas = select(_coreData.store).getEntityRecord('root', '__unstableBase')?.default_template_part_areas || [];
88
+ const templateAreas = select(_coreData.store).getCurrentTheme()?.default_template_part_areas || [];
89
89
  const areaData = templateAreas.find(item => options.area === item.area);
90
90
  if (areaData?.icon) {
91
91
  return (0, _utils.getTemplatePartIcon)(areaData.icon);
@@ -1 +1 @@
1
- {"version":3,"names":["_fastDeepEqual","_interopRequireDefault","require","_blockEditor","_data","_icons","_coreData","_preferences","_selectors","_privateSelectors","_utils","EMPTY_INSERTION_POINT","rootClientId","undefined","insertionIndex","filterValue","RENDERING_MODES","getInserter","exports","createRegistrySelector","select","createSelector","state","blockInserterPanel","getRenderingMode","postContentClientId","blockEditorStore","getBlocksByName","getListViewToggleRef","listViewToggleRef","getInserterSidebarToggleRef","inserterSidebarToggleRef","CARD_ICONS","wp_block","symbol","wp_navigation","navigation","page","pageIcon","post","verse","getPostIcon","postType","options","templateAreas","coreStore","getEntityRecord","default_template_part_areas","areaData","find","item","area","icon","getTemplatePartIcon","layout","postTypeEntity","getPostType","startsWith","slice","hasPostMetaChanges","postId","type","currentPostType","id","currentPostId","getCurrentPost","edits","getEntityRecordNonTransientEdits","meta","originalPostMeta","fastDeepEqual","footnotes","getEntityActions","args","_getEntityActions","dataviews","isEntityReady","_isEntityReady","getEntityFields","_getEntityFields","getPostBlocksByName","blockNames","Array","isArray","getBlockParents","getBlockName","filter","clientId","every","parentClientId","parentBlockName","includes","getBlocks","getDefaultRenderingMode","getCurrentTheme","hasFinishedResolution","currentTheme","theme","stylesheet","defaultModePreference","preferencesStore","get","postTypeDefaultMode","supports","editor","features","defaultMode"],"sources":["@wordpress/editor/src/store/private-selectors.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal';\n\n/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\nimport {\n\tlayout,\n\tsymbol,\n\tnavigation,\n\tpage as pageIcon,\n\tverse,\n} from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { getRenderingMode, getCurrentPost } from './selectors';\nimport {\n\tgetEntityActions as _getEntityActions,\n\tgetEntityFields as _getEntityFields,\n\tisEntityReady as _isEntityReady,\n} from '../dataviews/store/private-selectors';\nimport { getTemplatePartIcon } from '../utils';\n\nconst EMPTY_INSERTION_POINT = {\n\trootClientId: undefined,\n\tinsertionIndex: undefined,\n\tfilterValue: undefined,\n};\n\n/**\n * These are rendering modes that the editor supports.\n */\nconst RENDERING_MODES = [ 'post-only', 'template-locked' ];\n\n/**\n * Get the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport const getInserter = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state ) => {\n\t\t\tif ( typeof state.blockInserterPanel === 'object' ) {\n\t\t\t\treturn state.blockInserterPanel;\n\t\t\t}\n\n\t\t\tif ( getRenderingMode( state ) === 'template-locked' ) {\n\t\t\t\tconst [ postContentClientId ] =\n\t\t\t\t\tselect( blockEditorStore ).getBlocksByName(\n\t\t\t\t\t\t'core/post-content'\n\t\t\t\t\t);\n\t\t\t\tif ( postContentClientId ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\trootClientId: postContentClientId,\n\t\t\t\t\t\tinsertionIndex: undefined,\n\t\t\t\t\t\tfilterValue: undefined,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn EMPTY_INSERTION_POINT;\n\t\t},\n\t\t( state ) => {\n\t\t\tconst [ postContentClientId ] =\n\t\t\t\tselect( blockEditorStore ).getBlocksByName(\n\t\t\t\t\t'core/post-content'\n\t\t\t\t);\n\t\t\treturn [\n\t\t\t\tstate.blockInserterPanel,\n\t\t\t\tgetRenderingMode( state ),\n\t\t\t\tpostContentClientId,\n\t\t\t];\n\t\t}\n\t)\n);\n\nexport function getListViewToggleRef( state ) {\n\treturn state.listViewToggleRef;\n}\nexport function getInserterSidebarToggleRef( state ) {\n\treturn state.inserterSidebarToggleRef;\n}\nconst CARD_ICONS = {\n\twp_block: symbol,\n\twp_navigation: navigation,\n\tpage: pageIcon,\n\tpost: verse,\n};\n\nexport const getPostIcon = createRegistrySelector(\n\t( select ) => ( state, postType, options ) => {\n\t\t{\n\t\t\tif (\n\t\t\t\tpostType === 'wp_template_part' ||\n\t\t\t\tpostType === 'wp_template'\n\t\t\t) {\n\t\t\t\tconst templateAreas =\n\t\t\t\t\tselect( coreStore ).getEntityRecord(\n\t\t\t\t\t\t'root',\n\t\t\t\t\t\t'__unstableBase'\n\t\t\t\t\t)?.default_template_part_areas || [];\n\n\t\t\t\tconst areaData = templateAreas.find(\n\t\t\t\t\t( item ) => options.area === item.area\n\t\t\t\t);\n\n\t\t\t\tif ( areaData?.icon ) {\n\t\t\t\t\treturn getTemplatePartIcon( areaData.icon );\n\t\t\t\t}\n\n\t\t\t\treturn layout;\n\t\t\t}\n\t\t\tif ( CARD_ICONS[ postType ] ) {\n\t\t\t\treturn CARD_ICONS[ postType ];\n\t\t\t}\n\t\t\tconst postTypeEntity = select( coreStore ).getPostType( postType );\n\t\t\t// `icon` is the `menu_icon` property of a post type. We\n\t\t\t// only handle `dashicons` for now, even if the `menu_icon`\n\t\t\t// also supports urls and svg as values.\n\t\t\tif (\n\t\t\t\ttypeof postTypeEntity?.icon === 'string' &&\n\t\t\t\tpostTypeEntity.icon.startsWith( 'dashicons-' )\n\t\t\t) {\n\t\t\t\treturn postTypeEntity.icon.slice( 10 );\n\t\t\t}\n\t\t\treturn pageIcon;\n\t\t}\n\t}\n);\n\n/**\n * Returns true if there are unsaved changes to the\n * post's meta fields, and false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} postType The post type of the post.\n * @param {number} postId The ID of the post.\n *\n * @return {boolean} Whether there are edits or not in the meta fields of the relevant post.\n */\nexport const hasPostMetaChanges = createRegistrySelector(\n\t( select ) => ( state, postType, postId ) => {\n\t\tconst { type: currentPostType, id: currentPostId } =\n\t\t\tgetCurrentPost( state );\n\t\t// If no postType or postId is passed, use the current post.\n\t\tconst edits = select( coreStore ).getEntityRecordNonTransientEdits(\n\t\t\t'postType',\n\t\t\tpostType || currentPostType,\n\t\t\tpostId || currentPostId\n\t\t);\n\n\t\tif ( ! edits?.meta ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Compare if anything apart from `footnotes` has changed.\n\t\tconst originalPostMeta = select( coreStore ).getEntityRecord(\n\t\t\t'postType',\n\t\t\tpostType || currentPostType,\n\t\t\tpostId || currentPostId\n\t\t)?.meta;\n\n\t\treturn ! fastDeepEqual(\n\t\t\t{ ...originalPostMeta, footnotes: undefined },\n\t\t\t{ ...edits.meta, footnotes: undefined }\n\t\t);\n\t}\n);\n\nexport function getEntityActions( state, ...args ) {\n\treturn _getEntityActions( state.dataviews, ...args );\n}\n\nexport function isEntityReady( state, ...args ) {\n\treturn _isEntityReady( state.dataviews, ...args );\n}\n\nexport function getEntityFields( state, ...args ) {\n\treturn _getEntityFields( state.dataviews, ...args );\n}\n\n/**\n * Similar to getBlocksByName in @wordpress/block-editor, but only returns the top-most\n * blocks that aren't descendants of the query block.\n *\n * @param {Object} state Global application state.\n * @param {Array|string} blockNames Block names of the blocks to retrieve.\n *\n * @return {Array} Block client IDs.\n */\nexport const getPostBlocksByName = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state, blockNames ) => {\n\t\t\tblockNames = Array.isArray( blockNames )\n\t\t\t\t? blockNames\n\t\t\t\t: [ blockNames ];\n\t\t\tconst { getBlocksByName, getBlockParents, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn getBlocksByName( blockNames ).filter( ( clientId ) =>\n\t\t\t\tgetBlockParents( clientId ).every( ( parentClientId ) => {\n\t\t\t\t\tconst parentBlockName = getBlockName( parentClientId );\n\t\t\t\t\treturn (\n\t\t\t\t\t\t// Ignore descendents of the query block.\n\t\t\t\t\t\tparentBlockName !== 'core/query' &&\n\t\t\t\t\t\t// Enable only the top-most block.\n\t\t\t\t\t\t! blockNames.includes( parentBlockName )\n\t\t\t\t\t);\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\t\t() => [ select( blockEditorStore ).getBlocks() ]\n\t)\n);\n\n/**\n * Returns the default rendering mode for a post type by user preference or post type configuration.\n *\n * @param {Object} state Global application state.\n * @param {string} postType The post type.\n *\n * @return {string} The default rendering mode. Returns `undefined` while resolving value.\n */\nexport const getDefaultRenderingMode = createRegistrySelector(\n\t( select ) => ( state, postType ) => {\n\t\tconst { getPostType, getCurrentTheme, hasFinishedResolution } =\n\t\t\tselect( coreStore );\n\n\t\t// This needs to be called before `hasFinishedResolution`.\n\t\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\t\tconst currentTheme = getCurrentTheme();\n\t\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\t\tconst postTypeEntity = getPostType( postType );\n\n\t\t// Wait for the post type and theme resolution.\n\t\tif (\n\t\t\t! hasFinishedResolution( 'getPostType', [ postType ] ) ||\n\t\t\t! hasFinishedResolution( 'getCurrentTheme' )\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst theme = currentTheme?.stylesheet;\n\t\tconst defaultModePreference = select( preferencesStore ).get(\n\t\t\t'core',\n\t\t\t'renderingModes'\n\t\t)?.[ theme ]?.[ postType ];\n\t\tconst postTypeDefaultMode = Array.isArray(\n\t\t\tpostTypeEntity?.supports?.editor\n\t\t)\n\t\t\t? postTypeEntity.supports.editor.find(\n\t\t\t\t\t( features ) => 'default-mode' in features\n\t\t\t )?.[ 'default-mode' ]\n\t\t\t: undefined;\n\n\t\tconst defaultMode = defaultModePreference || postTypeDefaultMode;\n\n\t\t// Fallback gracefully to 'post-only' when rendering mode is not supported.\n\t\tif ( ! RENDERING_MODES.includes( defaultMode ) ) {\n\t\t\treturn 'post-only';\n\t\t}\n\n\t\treturn defaultMode;\n\t}\n);\n"],"mappings":";;;;;;;;;;;;;;AAGA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAOA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAKA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,iBAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AA7BA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;;AASA,MAAMS,qBAAqB,GAAG;EAC7BC,YAAY,EAAEC,SAAS;EACvBC,cAAc,EAAED,SAAS;EACzBE,WAAW,EAAEF;AACd,CAAC;;AAED;AACA;AACA;AACA,MAAMG,eAAe,GAAG,CAAE,WAAW,EAAE,iBAAiB,CAAE;;AAE1D;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,IAAAE,4BAAsB,EAAIC,MAAM,IAC1D,IAAAC,oBAAc,EACXC,KAAK,IAAM;EACZ,IAAK,OAAOA,KAAK,CAACC,kBAAkB,KAAK,QAAQ,EAAG;IACnD,OAAOD,KAAK,CAACC,kBAAkB;EAChC;EAEA,IAAK,IAAAC,2BAAgB,EAAEF,KAAM,CA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;;EAEhE;EACA,IAAK,CAAEtF,eAAe,CAAC2E,QAAQ,CAAEe,WAAY,CAAC,EAAG;IAChD,OAAO,WAAW;EACnB;EAEA,OAAOA,WAAW;AACnB,CACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_fastDeepEqual","_interopRequireDefault","require","_blockEditor","_data","_icons","_coreData","_preferences","_selectors","_privateSelectors","_utils","EMPTY_INSERTION_POINT","rootClientId","undefined","insertionIndex","filterValue","RENDERING_MODES","getInserter","exports","createRegistrySelector","select","createSelector","state","blockInserterPanel","getRenderingMode","postContentClientId","blockEditorStore","getBlocksByName","getListViewToggleRef","listViewToggleRef","getInserterSidebarToggleRef","inserterSidebarToggleRef","CARD_ICONS","wp_block","symbol","wp_navigation","navigation","page","pageIcon","post","verse","getPostIcon","postType","options","templateAreas","coreStore","getCurrentTheme","default_template_part_areas","areaData","find","item","area","icon","getTemplatePartIcon","layout","postTypeEntity","getPostType","startsWith","slice","hasPostMetaChanges","postId","type","currentPostType","id","currentPostId","getCurrentPost","edits","getEntityRecordNonTransientEdits","meta","originalPostMeta","getEntityRecord","fastDeepEqual","footnotes","getEntityActions","args","_getEntityActions","dataviews","isEntityReady","_isEntityReady","getEntityFields","_getEntityFields","getPostBlocksByName","blockNames","Array","isArray","getBlockParents","getBlockName","filter","clientId","every","parentClientId","parentBlockName","includes","getBlocks","getDefaultRenderingMode","hasFinishedResolution","currentTheme","theme","stylesheet","defaultModePreference","preferencesStore","get","postTypeDefaultMode","supports","editor","features","defaultMode"],"sources":["@wordpress/editor/src/store/private-selectors.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal';\n\n/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\nimport {\n\tlayout,\n\tsymbol,\n\tnavigation,\n\tpage as pageIcon,\n\tverse,\n} from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { getRenderingMode, getCurrentPost } from './selectors';\nimport {\n\tgetEntityActions as _getEntityActions,\n\tgetEntityFields as _getEntityFields,\n\tisEntityReady as _isEntityReady,\n} from '../dataviews/store/private-selectors';\nimport { getTemplatePartIcon } from '../utils';\n\nconst EMPTY_INSERTION_POINT = {\n\trootClientId: undefined,\n\tinsertionIndex: undefined,\n\tfilterValue: undefined,\n};\n\n/**\n * These are rendering modes that the editor supports.\n */\nconst RENDERING_MODES = [ 'post-only', 'template-locked' ];\n\n/**\n * Get the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport const getInserter = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state ) => {\n\t\t\tif ( typeof state.blockInserterPanel === 'object' ) {\n\t\t\t\treturn state.blockInserterPanel;\n\t\t\t}\n\n\t\t\tif ( getRenderingMode( state ) === 'template-locked' ) {\n\t\t\t\tconst [ postContentClientId ] =\n\t\t\t\t\tselect( blockEditorStore ).getBlocksByName(\n\t\t\t\t\t\t'core/post-content'\n\t\t\t\t\t);\n\t\t\t\tif ( postContentClientId ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\trootClientId: postContentClientId,\n\t\t\t\t\t\tinsertionIndex: undefined,\n\t\t\t\t\t\tfilterValue: undefined,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn EMPTY_INSERTION_POINT;\n\t\t},\n\t\t( state ) => {\n\t\t\tconst [ postContentClientId ] =\n\t\t\t\tselect( blockEditorStore ).getBlocksByName(\n\t\t\t\t\t'core/post-content'\n\t\t\t\t);\n\t\t\treturn [\n\t\t\t\tstate.blockInserterPanel,\n\t\t\t\tgetRenderingMode( state ),\n\t\t\t\tpostContentClientId,\n\t\t\t];\n\t\t}\n\t)\n);\n\nexport function getListViewToggleRef( state ) {\n\treturn state.listViewToggleRef;\n}\nexport function getInserterSidebarToggleRef( state ) {\n\treturn state.inserterSidebarToggleRef;\n}\nconst CARD_ICONS = {\n\twp_block: symbol,\n\twp_navigation: navigation,\n\tpage: pageIcon,\n\tpost: verse,\n};\n\nexport const getPostIcon = createRegistrySelector(\n\t( select ) => ( state, postType, options ) => {\n\t\t{\n\t\t\tif (\n\t\t\t\tpostType === 'wp_template_part' ||\n\t\t\t\tpostType === 'wp_template'\n\t\t\t) {\n\t\t\t\tconst templateAreas =\n\t\t\t\t\tselect( coreStore ).getCurrentTheme()\n\t\t\t\t\t\t?.default_template_part_areas || [];\n\n\t\t\t\tconst areaData = templateAreas.find(\n\t\t\t\t\t( item ) => options.area === item.area\n\t\t\t\t);\n\n\t\t\t\tif ( areaData?.icon ) {\n\t\t\t\t\treturn getTemplatePartIcon( areaData.icon );\n\t\t\t\t}\n\n\t\t\t\treturn layout;\n\t\t\t}\n\t\t\tif ( CARD_ICONS[ postType ] ) {\n\t\t\t\treturn CARD_ICONS[ postType ];\n\t\t\t}\n\t\t\tconst postTypeEntity = select( coreStore ).getPostType( postType );\n\t\t\t// `icon` is the `menu_icon` property of a post type. We\n\t\t\t// only handle `dashicons` for now, even if the `menu_icon`\n\t\t\t// also supports urls and svg as values.\n\t\t\tif (\n\t\t\t\ttypeof postTypeEntity?.icon === 'string' &&\n\t\t\t\tpostTypeEntity.icon.startsWith( 'dashicons-' )\n\t\t\t) {\n\t\t\t\treturn postTypeEntity.icon.slice( 10 );\n\t\t\t}\n\t\t\treturn pageIcon;\n\t\t}\n\t}\n);\n\n/**\n * Returns true if there are unsaved changes to the\n * post's meta fields, and false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} postType The post type of the post.\n * @param {number} postId The ID of the post.\n *\n * @return {boolean} Whether there are edits or not in the meta fields of the relevant post.\n */\nexport const hasPostMetaChanges = createRegistrySelector(\n\t( select ) => ( state, postType, postId ) => {\n\t\tconst { type: currentPostType, id: currentPostId } =\n\t\t\tgetCurrentPost( state );\n\t\t// If no postType or postId is passed, use the current post.\n\t\tconst edits = select( coreStore ).getEntityRecordNonTransientEdits(\n\t\t\t'postType',\n\t\t\tpostType || currentPostType,\n\t\t\tpostId || currentPostId\n\t\t);\n\n\t\tif ( ! edits?.meta ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Compare if anything apart from `footnotes` has changed.\n\t\tconst originalPostMeta = select( coreStore ).getEntityRecord(\n\t\t\t'postType',\n\t\t\tpostType || currentPostType,\n\t\t\tpostId || currentPostId\n\t\t)?.meta;\n\n\t\treturn ! fastDeepEqual(\n\t\t\t{ ...originalPostMeta, footnotes: undefined },\n\t\t\t{ ...edits.meta, footnotes: undefined }\n\t\t);\n\t}\n);\n\nexport function getEntityActions( state, ...args ) {\n\treturn _getEntityActions( state.dataviews, ...args );\n}\n\nexport function isEntityReady( state, ...args ) {\n\treturn _isEntityReady( state.dataviews, ...args );\n}\n\nexport function getEntityFields( state, ...args ) {\n\treturn _getEntityFields( state.dataviews, ...args );\n}\n\n/**\n * Similar to getBlocksByName in @wordpress/block-editor, but only returns the top-most\n * blocks that aren't descendants of the query block.\n *\n * @param {Object} state Global application state.\n * @param {Array|string} blockNames Block names of the blocks to retrieve.\n *\n * @return {Array} Block client IDs.\n */\nexport const getPostBlocksByName = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state, blockNames ) => {\n\t\t\tblockNames = Array.isArray( blockNames )\n\t\t\t\t? blockNames\n\t\t\t\t: [ blockNames ];\n\t\t\tconst { getBlocksByName, getBlockParents, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn getBlocksByName( blockNames ).filter( ( clientId ) =>\n\t\t\t\tgetBlockParents( clientId ).every( ( parentClientId ) => {\n\t\t\t\t\tconst parentBlockName = getBlockName( parentClientId );\n\t\t\t\t\treturn (\n\t\t\t\t\t\t// Ignore descendents of the query block.\n\t\t\t\t\t\tparentBlockName !== 'core/query' &&\n\t\t\t\t\t\t// Enable only the top-most block.\n\t\t\t\t\t\t! blockNames.includes( parentBlockName )\n\t\t\t\t\t);\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\t\t() => [ select( blockEditorStore ).getBlocks() ]\n\t)\n);\n\n/**\n * Returns the default rendering mode for a post type by user preference or post type configuration.\n *\n * @param {Object} state Global application state.\n * @param {string} postType The post type.\n *\n * @return {string} The default rendering mode. Returns `undefined` while resolving value.\n */\nexport const getDefaultRenderingMode = createRegistrySelector(\n\t( select ) => ( state, postType ) => {\n\t\tconst { getPostType, getCurrentTheme, hasFinishedResolution } =\n\t\t\tselect( coreStore );\n\n\t\t// This needs to be called before `hasFinishedResolution`.\n\t\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\t\tconst currentTheme = getCurrentTheme();\n\t\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\t\tconst postTypeEntity = getPostType( postType );\n\n\t\t// Wait for the post type and theme resolution.\n\t\tif (\n\t\t\t! hasFinishedResolution( 'getPostType', [ postType ] ) ||\n\t\t\t! hasFinishedResolution( 'getCurrentTheme' )\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst theme = currentTheme?.stylesheet;\n\t\tconst defaultModePreference = select( preferencesStore ).get(\n\t\t\t'core',\n\t\t\t'renderingModes'\n\t\t)?.[ theme ]?.[ postType ];\n\t\tconst postTypeDefaultMode = Array.isArray(\n\t\t\tpostTypeEntity?.supports?.editor\n\t\t)\n\t\t\t? postTypeEntity.supports.editor.find(\n\t\t\t\t\t( features ) => 'default-mode' in features\n\t\t\t )?.[ 'default-mode' ]\n\t\t\t: undefined;\n\n\t\tconst defaultMode = defaultModePreference || postTypeDefaultMode;\n\n\t\t// Fallback gracefully to 'post-only' when rendering mode is not supported.\n\t\tif ( ! RENDERING_MODES.includes( defaultMode ) ) {\n\t\t\treturn 'post-only';\n\t\t}\n\n\t\treturn defaultMode;\n\t}\n);\n"],"mappings":";;;;;;;;;;;;;;AAGA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,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AAU,CAAC;;EAEpB;EACA;EACA,MAAMmD,YAAY,GAAGlD,eAAe,CAAC,CAAC;EACtC;EACA,MAAMS,cAAc,GAAGC,WAAW,CAAEd,QAAS,CAAC;;EAE9C;EACA,IACC,CAAEqD,qBAAqB,CAAE,aAAa,EAAE,CAAErD,QAAQ,CAAG,CAAC,IACtD,CAAEqD,qBAAqB,CAAE,iBAAkB,CAAC,EAC3C;IACD,OAAOlF,SAAS;EACjB;EAEA,MAAMoF,KAAK,GAAGD,YAAY,EAAEE,UAAU;EACtC,MAAMC,qBAAqB,GAAG/E,MAAM,CAAEgF,kBAAiB,CAAC,CAACC,GAAG,CAC3D,MAAM,EACN,gBACD,CAAC,GAAIJ,KAAK,CAAE,GAAIvD,QAAQ,CAAE;EAC1B,MAAM4D,mBAAmB,GAAGnB,KAAK,CAACC,OAAO,CACxC7B,cAAc,EAAEgD,QAAQ,EAAEC,MAC3B,CAAC,GACEjD,cAAc,CAACgD,QAAQ,CAACC,MAAM,CAACvD,IAAI,CACjCwD,QAAQ,IAAM,cAAc,IAAIA,QAClC,CAAC,GAAI,cAAc,CAAE,GACrB5F,SAAS;EAEZ,MAAM6F,WAAW,GAAGP,qBAAqB,IAAIG,mBAAmB;;EAEhE;EACA,IAAK,CAAEtF,eAAe,CAAC4E,QAAQ,CAAEc,WAAY,CAAC,EAAG;IAChD,OAAO,WAAW;EACnB;EAEA,OAAOA,WAAW;AACnB,CACD,CAAC","ignoreList":[]}
@@ -1524,9 +1524,9 @@ const getBlockListSettings = exports.getBlockListSettings = getBlockEditorSelect
1524
1524
  const __experimentalGetDefaultTemplateTypes = exports.__experimentalGetDefaultTemplateTypes = (0, _data.createRegistrySelector)(select => () => {
1525
1525
  (0, _deprecated.default)("select('core/editor').__experimentalGetDefaultTemplateTypes", {
1526
1526
  since: '6.8',
1527
- alternative: "select('core/core-data').getEntityRecord( 'root', '__unstableBase' )?.default_template_types"
1527
+ alternative: "select('core/core-data').getCurrentTheme()?.default_template_types"
1528
1528
  });
1529
- return select(_coreData.store).getEntityRecord('root', '__unstableBase')?.default_template_types;
1529
+ return select(_coreData.store).getCurrentTheme()?.default_template_types;
1530
1530
  });
1531
1531
 
1532
1532
  /**
@@ -1539,9 +1539,9 @@ const __experimentalGetDefaultTemplateTypes = exports.__experimentalGetDefaultTe
1539
1539
  const __experimentalGetDefaultTemplatePartAreas = exports.__experimentalGetDefaultTemplatePartAreas = (0, _data.createRegistrySelector)(select => (0, _data.createSelector)(() => {
1540
1540
  (0, _deprecated.default)("select('core/editor').__experimentalGetDefaultTemplatePartAreas", {
1541
1541
  since: '6.8',
1542
- alternative: "select('core/core-data').getEntityRecord( 'root', '__unstableBase' )?.default_template_part_areas"
1542
+ alternative: "select('core/core-data').getCurrentTheme()?.default_template_part_areas"
1543
1543
  });
1544
- const areas = select(_coreData.store).getEntityRecord('root', '__unstableBase')?.default_template_part_areas || [];
1544
+ const areas = select(_coreData.store).getCurrentTheme()?.default_template_part_areas || [];
1545
1545
  return areas.map(item => {
1546
1546
  return {
1547
1547
  ...item,
@@ -1563,7 +1563,7 @@ const __experimentalGetDefaultTemplateType = exports.__experimentalGetDefaultTem
1563
1563
  (0, _deprecated.default)("select('core/editor').__experimentalGetDefaultTemplateType", {
1564
1564
  since: '6.8'
1565
1565
  });
1566
- const templateTypes = select(_coreData.store).getEntityRecord('root', '__unstableBase')?.default_template_types;
1566
+ const templateTypes = select(_coreData.store).getCurrentTheme()?.default_template_types;
1567
1567
  if (!templateTypes) {
1568
1568
  return EMPTY_OBJECT;
1569
1569
  }
@@ -1585,8 +1585,9 @@ const __experimentalGetTemplateInfo = exports.__experimentalGetTemplateInfo = (0
1585
1585
  if (!template) {
1586
1586
  return EMPTY_OBJECT;
1587
1587
  }
1588
- const templateTypes = select(_coreData.store).getEntityRecord('root', '__unstableBase')?.default_template_types || [];
1589
- const templateAreas = select(_coreData.store).getEntityRecord('root', '__unstableBase')?.default_template_part_areas || [];
1588
+ const currentTheme = select(_coreData.store).getCurrentTheme();
1589
+ const templateTypes = currentTheme?.default_template_types || [];
1590
+ const templateAreas = currentTheme?.default_template_part_areas || [];
1590
1591
  return (0, _getTemplateInfo.getTemplateInfo)({
1591
1592
  template,
1592
1593
  templateAreas,