@wordpress/editor 14.49.1 → 14.51.1-next.v.202607070741.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 (262) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/components/collab-sidebar/format.cjs +83 -0
  3. package/build/components/collab-sidebar/format.cjs.map +7 -0
  4. package/build/components/collab-sidebar/hooks.cjs +117 -16
  5. package/build/components/collab-sidebar/hooks.cjs.map +2 -2
  6. package/build/components/collab-sidebar/index.cjs +18 -2
  7. package/build/components/collab-sidebar/index.cjs.map +2 -2
  8. package/build/components/collab-sidebar/note-highlight-styles.cjs +67 -0
  9. package/build/components/collab-sidebar/note-highlight-styles.cjs.map +7 -0
  10. package/build/components/collab-sidebar/utils.cjs +139 -0
  11. package/build/components/collab-sidebar/utils.cjs.map +2 -2
  12. package/build/components/collaborators-presence/use-collaborator-notifications.cjs +55 -30
  13. package/build/components/collaborators-presence/use-collaborator-notifications.cjs.map +2 -2
  14. package/build/components/commands/index.cjs +99 -3
  15. package/build/components/commands/index.cjs.map +2 -2
  16. package/build/components/document-bar/index.cjs +28 -34
  17. package/build/components/document-bar/index.cjs.map +2 -2
  18. package/build/components/entities-saved-states/index.cjs +1 -4
  19. package/build/components/entities-saved-states/index.cjs.map +2 -2
  20. package/build/components/header/index.cjs +1 -8
  21. package/build/components/header/index.cjs.map +2 -2
  22. package/build/components/media-categories/index.cjs +92 -6
  23. package/build/components/media-categories/index.cjs.map +2 -2
  24. package/build/components/page-attributes/parent.cjs +0 -1
  25. package/build/components/page-attributes/parent.cjs.map +2 -2
  26. package/build/components/post-author/combobox.cjs +0 -1
  27. package/build/components/post-author/combobox.cjs.map +2 -2
  28. package/build/components/post-author/select.cjs +0 -1
  29. package/build/components/post-author/select.cjs.map +2 -2
  30. package/build/components/post-preview-button/index.cjs +29 -2
  31. package/build/components/post-preview-button/index.cjs.map +2 -2
  32. package/build/components/post-publish-panel/maybe-upload-media.cjs +15 -26
  33. package/build/components/post-publish-panel/maybe-upload-media.cjs.map +3 -3
  34. package/build/components/post-revisions-preview/revisions-slider.cjs +3 -1
  35. package/build/components/post-revisions-preview/revisions-slider.cjs.map +2 -2
  36. package/build/components/post-taxonomies/flat-term-selector.cjs +0 -1
  37. package/build/components/post-taxonomies/flat-term-selector.cjs.map +2 -2
  38. package/build/components/post-taxonomies/hierarchical-term-selector.cjs +0 -2
  39. package/build/components/post-taxonomies/hierarchical-term-selector.cjs.map +2 -2
  40. package/build/components/post-template/classic-theme.cjs +0 -1
  41. package/build/components/post-template/classic-theme.cjs.map +2 -2
  42. package/build/components/preferences-modal/index.cjs +54 -28
  43. package/build/components/preferences-modal/index.cjs.map +2 -2
  44. package/build/components/preview-dropdown/index.cjs +38 -9
  45. package/build/components/preview-dropdown/index.cjs.map +3 -3
  46. package/build/components/provider/use-block-editor-settings.cjs +23 -9
  47. package/build/components/provider/use-block-editor-settings.cjs.map +3 -3
  48. package/build/components/resizable-editor/index.cjs +54 -9
  49. package/build/components/resizable-editor/index.cjs.map +3 -3
  50. package/build/components/sidebar/dataform-post-summary.cjs +5 -1
  51. package/build/components/sidebar/dataform-post-summary.cjs.map +3 -3
  52. package/build/components/sidebar/index.cjs +29 -38
  53. package/build/components/sidebar/index.cjs.map +3 -3
  54. package/build/components/sidebar/post-summary.cjs +0 -13
  55. package/build/components/sidebar/post-summary.cjs.map +3 -3
  56. package/build/components/visual-editor/index.cjs +15 -11
  57. package/build/components/visual-editor/index.cjs.map +3 -3
  58. package/build/dataviews/store/private-actions.cjs +24 -19
  59. package/build/dataviews/store/private-actions.cjs.map +2 -2
  60. package/build/store/actions.cjs +5 -3
  61. package/build/store/actions.cjs.map +2 -2
  62. package/build/store/constants.cjs +26 -0
  63. package/build/store/constants.cjs.map +2 -2
  64. package/build/store/private-actions.cjs +25 -18
  65. package/build/store/private-actions.cjs.map +3 -3
  66. package/build/store/private-selectors.cjs +5 -0
  67. package/build/store/private-selectors.cjs.map +2 -2
  68. package/build/store/reducer.cjs +6 -6
  69. package/build/store/reducer.cjs.map +2 -2
  70. package/build/store/selectors.cjs +3 -1
  71. package/build/store/selectors.cjs.map +2 -2
  72. package/build/utils/device-type.cjs +52 -0
  73. package/build/utils/device-type.cjs.map +7 -0
  74. package/build/utils/media-sideload-from-url/index.cjs +63 -0
  75. package/build/utils/media-sideload-from-url/index.cjs.map +7 -0
  76. package/build-module/components/collab-sidebar/format.mjs +57 -0
  77. package/build-module/components/collab-sidebar/format.mjs.map +7 -0
  78. package/build-module/components/collab-sidebar/hooks.mjs +121 -16
  79. package/build-module/components/collab-sidebar/hooks.mjs.map +2 -2
  80. package/build-module/components/collab-sidebar/index.mjs +21 -5
  81. package/build-module/components/collab-sidebar/index.mjs.map +2 -2
  82. package/build-module/components/collab-sidebar/note-highlight-styles.mjs +41 -0
  83. package/build-module/components/collab-sidebar/note-highlight-styles.mjs.map +7 -0
  84. package/build-module/components/collab-sidebar/utils.mjs +133 -0
  85. package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
  86. package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs +55 -30
  87. package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs.map +2 -2
  88. package/build-module/components/commands/index.mjs +99 -3
  89. package/build-module/components/commands/index.mjs.map +2 -2
  90. package/build-module/components/document-bar/index.mjs +28 -34
  91. package/build-module/components/document-bar/index.mjs.map +2 -2
  92. package/build-module/components/entities-saved-states/index.mjs +1 -4
  93. package/build-module/components/entities-saved-states/index.mjs.map +2 -2
  94. package/build-module/components/header/index.mjs +1 -13
  95. package/build-module/components/header/index.mjs.map +2 -2
  96. package/build-module/components/media-categories/index.mjs +93 -7
  97. package/build-module/components/media-categories/index.mjs.map +2 -2
  98. package/build-module/components/page-attributes/parent.mjs +0 -1
  99. package/build-module/components/page-attributes/parent.mjs.map +2 -2
  100. package/build-module/components/post-author/combobox.mjs +0 -1
  101. package/build-module/components/post-author/combobox.mjs.map +2 -2
  102. package/build-module/components/post-author/select.mjs +0 -1
  103. package/build-module/components/post-author/select.mjs.map +2 -2
  104. package/build-module/components/post-preview-button/index.mjs +29 -2
  105. package/build-module/components/post-preview-button/index.mjs.map +2 -2
  106. package/build-module/components/post-publish-panel/maybe-upload-media.mjs +19 -27
  107. package/build-module/components/post-publish-panel/maybe-upload-media.mjs.map +2 -2
  108. package/build-module/components/post-revisions-preview/revisions-slider.mjs +3 -1
  109. package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
  110. package/build-module/components/post-taxonomies/flat-term-selector.mjs +0 -1
  111. package/build-module/components/post-taxonomies/flat-term-selector.mjs.map +2 -2
  112. package/build-module/components/post-taxonomies/hierarchical-term-selector.mjs +0 -2
  113. package/build-module/components/post-taxonomies/hierarchical-term-selector.mjs.map +2 -2
  114. package/build-module/components/post-template/classic-theme.mjs +0 -1
  115. package/build-module/components/post-template/classic-theme.mjs.map +2 -2
  116. package/build-module/components/preferences-modal/index.mjs +54 -28
  117. package/build-module/components/preferences-modal/index.mjs.map +2 -2
  118. package/build-module/components/preview-dropdown/index.mjs +38 -9
  119. package/build-module/components/preview-dropdown/index.mjs.map +2 -2
  120. package/build-module/components/provider/use-block-editor-settings.mjs +23 -9
  121. package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
  122. package/build-module/components/resizable-editor/index.mjs +55 -10
  123. package/build-module/components/resizable-editor/index.mjs.map +2 -2
  124. package/build-module/components/sidebar/dataform-post-summary.mjs +6 -2
  125. package/build-module/components/sidebar/dataform-post-summary.mjs.map +2 -2
  126. package/build-module/components/sidebar/index.mjs +29 -42
  127. package/build-module/components/sidebar/index.mjs.map +2 -2
  128. package/build-module/components/sidebar/post-summary.mjs +0 -13
  129. package/build-module/components/sidebar/post-summary.mjs.map +2 -2
  130. package/build-module/components/visual-editor/index.mjs +16 -13
  131. package/build-module/components/visual-editor/index.mjs.map +2 -2
  132. package/build-module/dataviews/store/private-actions.mjs +26 -19
  133. package/build-module/dataviews/store/private-actions.mjs.map +2 -2
  134. package/build-module/store/actions.mjs +5 -3
  135. package/build-module/store/actions.mjs.map +2 -2
  136. package/build-module/store/constants.mjs +25 -0
  137. package/build-module/store/constants.mjs.map +2 -2
  138. package/build-module/store/private-actions.mjs +27 -17
  139. package/build-module/store/private-actions.mjs.map +2 -2
  140. package/build-module/store/private-selectors.mjs +4 -0
  141. package/build-module/store/private-selectors.mjs.map +2 -2
  142. package/build-module/store/reducer.mjs +5 -5
  143. package/build-module/store/reducer.mjs.map +2 -2
  144. package/build-module/store/selectors.mjs +3 -1
  145. package/build-module/store/selectors.mjs.map +2 -2
  146. package/build-module/utils/device-type.mjs +25 -0
  147. package/build-module/utils/device-type.mjs.map +7 -0
  148. package/build-module/utils/media-sideload-from-url/index.mjs +32 -0
  149. package/build-module/utils/media-sideload-from-url/index.mjs.map +7 -0
  150. package/build-style/style-rtl.css +84 -39
  151. package/build-style/style.css +84 -39
  152. package/build-types/components/collab-sidebar/format.d.ts +17 -0
  153. package/build-types/components/collab-sidebar/format.d.ts.map +1 -0
  154. package/build-types/components/collab-sidebar/hooks.d.ts.map +1 -1
  155. package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
  156. package/build-types/components/collab-sidebar/note-highlight-styles.d.ts +31 -0
  157. package/build-types/components/collab-sidebar/note-highlight-styles.d.ts.map +1 -0
  158. package/build-types/components/collab-sidebar/utils.d.ts +82 -2
  159. package/build-types/components/collab-sidebar/utils.d.ts.map +1 -1
  160. package/build-types/components/collaborators-presence/use-collaborator-notifications.d.ts.map +1 -1
  161. package/build-types/components/commands/index.d.ts.map +1 -1
  162. package/build-types/components/document-bar/index.d.ts.map +1 -1
  163. package/build-types/components/entities-saved-states/index.d.ts.map +1 -1
  164. package/build-types/components/header/index.d.ts.map +1 -1
  165. package/build-types/components/media-categories/index.d.ts +12 -3
  166. package/build-types/components/media-categories/index.d.ts.map +1 -1
  167. package/build-types/components/page-attributes/parent.d.ts.map +1 -1
  168. package/build-types/components/post-author/combobox.d.ts.map +1 -1
  169. package/build-types/components/post-author/select.d.ts.map +1 -1
  170. package/build-types/components/post-preview-button/index.d.ts.map +1 -1
  171. package/build-types/components/post-publish-panel/maybe-upload-media.d.ts.map +1 -1
  172. package/build-types/components/post-revisions-preview/revisions-slider.d.ts.map +1 -1
  173. package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
  174. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
  175. package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
  176. package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
  177. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  178. package/build-types/components/resizable-editor/index.d.ts.map +1 -1
  179. package/build-types/components/sidebar/dataform-post-summary.d.ts.map +1 -1
  180. package/build-types/components/sidebar/index.d.ts.map +1 -1
  181. package/build-types/components/sidebar/post-summary.d.ts.map +1 -1
  182. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  183. package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
  184. package/build-types/store/actions.d.ts.map +1 -1
  185. package/build-types/store/constants.d.ts +6 -0
  186. package/build-types/store/constants.d.ts.map +1 -1
  187. package/build-types/store/index.d.ts +2 -2
  188. package/build-types/store/private-actions.d.ts +9 -15
  189. package/build-types/store/private-actions.d.ts.map +1 -1
  190. package/build-types/store/private-selectors.d.ts +7 -0
  191. package/build-types/store/private-selectors.d.ts.map +1 -1
  192. package/build-types/store/reducer.d.ts +6 -7
  193. package/build-types/store/reducer.d.ts.map +1 -1
  194. package/build-types/store/selectors.d.ts +1 -1
  195. package/build-types/store/selectors.d.ts.map +1 -1
  196. package/build-types/utils/device-type.d.ts +23 -0
  197. package/build-types/utils/device-type.d.ts.map +1 -0
  198. package/build-types/utils/get-template-part-icon.d.ts.map +1 -1
  199. package/build-types/utils/media-sideload-from-url/index.d.ts +18 -0
  200. package/build-types/utils/media-sideload-from-url/index.d.ts.map +1 -0
  201. package/package.json +48 -46
  202. package/src/components/collab-sidebar/format.js +72 -0
  203. package/src/components/collab-sidebar/hooks.js +203 -22
  204. package/src/components/collab-sidebar/index.js +19 -5
  205. package/src/components/collab-sidebar/note-highlight-styles.js +83 -0
  206. package/src/components/collab-sidebar/style.scss +9 -0
  207. package/src/components/collab-sidebar/test/note-highlight-styles.js +106 -0
  208. package/src/components/collab-sidebar/test/utils.js +471 -0
  209. package/src/components/collab-sidebar/utils.js +225 -2
  210. package/src/components/collaborators-presence/test/use-collaborator-notifications.ts +265 -262
  211. package/src/components/collaborators-presence/use-collaborator-notifications.ts +70 -34
  212. package/src/components/commands/index.js +142 -0
  213. package/src/components/document-bar/index.js +0 -9
  214. package/src/components/document-bar/style.scss +0 -17
  215. package/src/components/entities-saved-states/index.js +1 -5
  216. package/src/components/header/index.js +1 -15
  217. package/src/components/header/style.scss +7 -3
  218. package/src/components/media-categories/index.js +160 -6
  219. package/src/components/media-categories/test/index.js +202 -0
  220. package/src/components/page-attributes/parent.js +0 -1
  221. package/src/components/post-author/combobox.js +0 -1
  222. package/src/components/post-author/select.js +0 -1
  223. package/src/components/post-preview-button/index.js +68 -2
  224. package/src/components/post-publish-panel/maybe-upload-media.js +25 -30
  225. package/src/components/post-publish-panel/style.scss +1 -1
  226. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +11 -127
  227. package/src/components/post-revisions-preview/revisions-slider.js +4 -1
  228. package/src/components/post-revisions-preview/test/block-diff.js +2 -2
  229. package/src/components/post-taxonomies/flat-term-selector.js +0 -1
  230. package/src/components/post-taxonomies/hierarchical-term-selector.js +0 -2
  231. package/src/components/post-template/classic-theme.js +0 -1
  232. package/src/components/preferences-modal/index.js +40 -22
  233. package/src/components/preferences-modal/test/index.js +83 -0
  234. package/src/components/preview-dropdown/index.js +42 -3
  235. package/src/components/provider/use-block-editor-settings.js +42 -7
  236. package/src/components/resizable-editor/index.js +71 -9
  237. package/src/components/resizable-editor/style.scss +7 -0
  238. package/src/components/sidebar/dataform-post-summary.js +13 -1
  239. package/src/components/sidebar/index.js +32 -47
  240. package/src/components/sidebar/post-summary.js +0 -17
  241. package/src/components/styles-canvas/style.scss +1 -2
  242. package/src/components/visual-editor/index.js +19 -15
  243. package/src/components/visual-editor/style.scss +11 -4
  244. package/src/dataviews/store/private-actions.ts +30 -26
  245. package/src/store/actions.js +6 -3
  246. package/src/store/constants.ts +45 -0
  247. package/src/store/private-actions.js +38 -28
  248. package/src/store/private-selectors.js +10 -0
  249. package/src/store/reducer.js +7 -9
  250. package/src/store/selectors.js +3 -1
  251. package/src/store/test/actions.js +31 -22
  252. package/src/utils/device-type.js +46 -0
  253. package/src/utils/media-sideload-from-url/index.js +54 -0
  254. package/src/utils/media-sideload-from-url/test/index.js +162 -0
  255. package/build/components/post-publish-panel/media-util.cjs +0 -72
  256. package/build/components/post-publish-panel/media-util.cjs.map +0 -7
  257. package/build-module/components/post-publish-panel/media-util.mjs +0 -46
  258. package/build-module/components/post-publish-panel/media-util.mjs.map +0 -7
  259. package/build-types/components/post-publish-panel/media-util.d.ts +0 -20
  260. package/build-types/components/post-publish-panel/media-util.d.ts.map +0 -1
  261. package/src/components/post-publish-panel/media-util.js +0 -87
  262. package/src/components/post-publish-panel/test/media-util.js +0 -118
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/preview-dropdown/index.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tMenuItemsChoice,\n\tIcon as WCIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { desktop, mobile, tablet, external, check } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { ActionItem } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { VisuallyHidden } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PostPreviewButton from '../post-preview-button';\nimport { unlock } from '../../lock-unlock';\n\nexport default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {\n\tconst {\n\t\tdeviceType,\n\t\thomeUrl,\n\t\tisTemplate,\n\t\tisViewable,\n\t\tshowIconLabels,\n\t\tisTemplateHidden,\n\t\ttemplateId,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetDeviceType,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentTemplateId,\n\t\t\tgetRenderingMode,\n\t\t} = select( editorStore );\n\t\tconst { getEntityRecord, getPostType } = select( coreStore );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst _currentPostType = getCurrentPostType();\n\t\treturn {\n\t\t\tdeviceType: getDeviceType(),\n\t\t\thomeUrl: getEntityRecord( 'root', '__unstableBase' )?.home,\n\t\t\tisTemplate: _currentPostType === 'wp_template',\n\t\t\tisViewable: getPostType( _currentPostType )?.viewable ?? false,\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\tisTemplateHidden: getRenderingMode() === 'post-only',\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t};\n\t}, [] );\n\tconst { setDeviceType, setRenderingMode, setDefaultRenderingMode } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\n\n\tconst handleDevicePreviewChange = ( newDeviceType ) => {\n\t\tsetDeviceType( newDeviceType );\n\t\tresetZoomLevel();\n\t};\n\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\tif ( isMobile ) {\n\t\treturn null;\n\t}\n\n\tconst popoverProps = {\n\t\tplacement: 'bottom-end',\n\t};\n\tconst toggleProps = {\n\t\tclassName: 'editor-preview-dropdown__toggle',\n\t\ticonPosition: 'right',\n\t\tsize: 'compact',\n\t\tshowTooltip: ! showIconLabels,\n\t\tdisabled,\n\t\taccessibleWhenDisabled: disabled,\n\t};\n\tconst menuProps = {\n\t\t'aria-label': __( 'View options' ),\n\t};\n\n\tconst deviceIcons = {\n\t\tdesktop,\n\t\tmobile,\n\t\ttablet,\n\t};\n\n\t/**\n\t * The choices for the device type.\n\t * Duplicated in block-editor block-visibility constants and edit-site\n\t * use-viewport-sync. Update all three when adding new viewport types.\n\t *\n\t * @type {Array}\n\t */\n\tconst choices = [\n\t\t{\n\t\t\tvalue: 'Desktop',\n\t\t\tlabel: __( 'Desktop' ),\n\t\t\ticon: desktop,\n\t\t},\n\t\t{\n\t\t\tvalue: 'Tablet',\n\t\t\tlabel: __( 'Tablet' ),\n\t\t\ticon: tablet,\n\t\t},\n\t\t{\n\t\t\tvalue: 'Mobile',\n\t\t\tlabel: __( 'Mobile' ),\n\t\t\ticon: mobile,\n\t\t},\n\t];\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-preview-dropdown',\n\t\t\t\t`editor-preview-dropdown--${ deviceType.toLowerCase() }`\n\t\t\t) }\n\t\t\tpopoverProps={ popoverProps }\n\t\t\ttoggleProps={ toggleProps }\n\t\t\tmenuProps={ menuProps }\n\t\t\ticon={ deviceIcons[ deviceType.toLowerCase() ] }\n\t\t\tlabel={ __( 'View' ) }\n\t\t\tdisableOpenOnArrowDown={ disabled }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\tchoices={ choices }\n\t\t\t\t\t\t\tvalue={ deviceType }\n\t\t\t\t\t\t\tonSelect={ handleDevicePreviewChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t{ isTemplate && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'View site' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden render={ <span /> }>\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isTemplate && !! templateId && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\ticon={ ! isTemplateHidden ? check : undefined }\n\t\t\t\t\t\t\t\tisSelected={ ! isTemplateHidden }\n\t\t\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tconst newRenderingMode = isTemplateHidden\n\t\t\t\t\t\t\t\t\t\t? 'template-locked'\n\t\t\t\t\t\t\t\t\t\t: 'post-only';\n\t\t\t\t\t\t\t\t\tsetRenderingMode( newRenderingMode );\n\t\t\t\t\t\t\t\t\tsetDefaultRenderingMode( newRenderingMode );\n\t\t\t\t\t\t\t\t\tresetZoomLevel();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Show template' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isViewable && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<PostPreviewButton\n\t\t\t\t\t\t\t\tclassName=\"editor-preview-dropdown__button-external\"\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\tforceIsAutosaveable={ forceIsAutosaveable }\n\t\t\t\t\t\t\t\taria-label={ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\ttextContent={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\t\t\t<WCIcon icon={ external } />\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonPreview={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t<ActionItem.Slot\n\t\t\t\t\t\tname=\"core/plugin-preview-menu\"\n\t\t\t\t\t\tfillProps={ { onClick: onClose } }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],
5
- "mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,wBAAwB;AACjC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,OACF;AACP,SAAS,UAAU;AACnB,SAAS,SAAS,QAAQ,QAAQ,UAAU,aAAa;AACzD,SAAS,WAAW,mBAAmB;AACvC,SAAS,SAAS,iBAAiB;AACnC,SAAS,SAAS,wBAAwB;AAC1C,SAAS,kBAAkB;AAC3B,SAAS,SAAS,wBAAwB;AAC1C,SAAS,sBAAsB;AAK/B,SAAS,SAAS,mBAAmB;AACrC,OAAO,uBAAuB;AAC9B,SAAS,cAAc;AA4GjB,SAmDG,UAnDH,KAQC,YARD;AA1GS,SAAR,gBAAkC,EAAE,qBAAqB,SAAS,GAAI;AAC5E,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI,UAAW,CAAE,WAAY;AAC5B,UAAM;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD,IAAI,OAAQ,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qB;AAAA,cAC3B,oBAAC,UAAO,MAAO,UAAW;AAAA,eAC3B;AAAA,YAED,WAAY;AAAA;AAAA,QACb,GACD;AAAA,QAED;AAAA,UAAC,WAAW;AAAA,UAAX;AAAA,YACA,MAAK;AAAA,YACL,WAAY,EAAE,SAAS,QAAQ;AAAA;AAAA,QAChC;AAAA,SACD;AAAA;AAAA,EAEF;AAEF;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tMenuItemsChoice,\n\tIcon as WCIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { desktop, mobile, tablet, external, check } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { ActionItem } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { VisuallyHidden } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PostPreviewButton from '../post-preview-button';\nimport { VIEWPORT_STATE_BY_DEVICE_TYPE } from '../../utils/device-type';\nimport { unlock } from '../../lock-unlock';\n\nexport default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {\n\tconst {\n\t\tdeviceType,\n\t\thomeUrl,\n\t\tisTemplate,\n\t\tisViewable,\n\t\tshowIconLabels,\n\t\tisTemplateHidden,\n\t\ttemplateId,\n\t\tisResponsiveEditing,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentTemplateId,\n\t\t\tgetRenderingMode,\n\t\t\tgetDeviceType,\n\t\t} = unlock( select( editorStore ) );\n\t\tconst { isResponsiveEditing: _isResponsiveEditing } = unlock(\n\t\t\tselect( blockEditorStore )\n\t\t);\n\t\tconst { getEntityRecord, getPostType } = select( coreStore );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst _currentPostType = getCurrentPostType();\n\t\treturn {\n\t\t\tdeviceType: getDeviceType(),\n\t\t\thomeUrl: getEntityRecord( 'root', '__unstableBase' )?.home,\n\t\t\tisTemplate: _currentPostType === 'wp_template',\n\t\t\tisViewable: getPostType( _currentPostType )?.viewable ?? false,\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\tisTemplateHidden: getRenderingMode() === 'post-only',\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t\tisResponsiveEditing: _isResponsiveEditing(),\n\t\t};\n\t}, [] );\n\tconst { setDeviceType, setRenderingMode, setDefaultRenderingMode } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\tconst { resetZoomLevel, setStyleStateViewport, setResponsiveEditing } =\n\t\tunlock( useDispatch( blockEditorStore ) );\n\n\tconst handleDevicePreviewChange = ( newDeviceType ) => {\n\t\tsetDeviceType( newDeviceType );\n\t\tresetZoomLevel();\n\t};\n\n\tconst handleResponsiveEditingChange = () => {\n\t\tconst newIsResponsiveEditing = ! isResponsiveEditing;\n\t\tsetResponsiveEditing( newIsResponsiveEditing );\n\t\tsetStyleStateViewport(\n\t\t\tnewIsResponsiveEditing\n\t\t\t\t? VIEWPORT_STATE_BY_DEVICE_TYPE[ deviceType ] ?? 'default'\n\t\t\t\t: 'default'\n\t\t);\n\t};\n\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\tif ( isMobile ) {\n\t\treturn null;\n\t}\n\n\tconst popoverProps = {\n\t\tplacement: 'bottom-end',\n\t};\n\tconst toggleProps = {\n\t\tclassName: 'editor-preview-dropdown__toggle',\n\t\ticonPosition: 'right',\n\t\tsize: 'compact',\n\t\tshowTooltip: ! showIconLabels,\n\t\tdisabled,\n\t\taccessibleWhenDisabled: disabled,\n\t};\n\tconst menuProps = {\n\t\t'aria-label': __( 'View options' ),\n\t};\n\n\tconst deviceIcons = {\n\t\tdesktop,\n\t\tmobile,\n\t\ttablet,\n\t};\n\n\t/**\n\t * The choices for the device type.\n\t * Duplicated in block-editor block-visibility constants and edit-site\n\t * use-viewport-sync. Update all three when adding new viewport types.\n\t *\n\t * @type {Array}\n\t */\n\tconst choices = [\n\t\t{\n\t\t\tvalue: 'Desktop',\n\t\t\tlabel: __( 'Desktop' ),\n\t\t\ticon: desktop,\n\t\t\tinfo: isResponsiveEditing\n\t\t\t\t? __( 'Edit across all breakpoints.' )\n\t\t\t\t: __( 'Preview desktop viewport.' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'Tablet',\n\t\t\tlabel: __( 'Tablet' ),\n\t\t\ticon: tablet,\n\t\t\tinfo: isResponsiveEditing\n\t\t\t\t? __( 'Make tablet exclusive style changes.' )\n\t\t\t\t: __( 'Preview tablet viewport.' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'Mobile',\n\t\t\tlabel: __( 'Mobile' ),\n\t\t\ticon: mobile,\n\t\t\tinfo: isResponsiveEditing\n\t\t\t\t? __( 'Make mobile exclusive style changes.' )\n\t\t\t\t: __( 'Preview mobile viewport.' ),\n\t\t},\n\t];\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-preview-dropdown',\n\t\t\t\t`editor-preview-dropdown--${ deviceType.toLowerCase() }`\n\t\t\t) }\n\t\t\tpopoverProps={ popoverProps }\n\t\t\ttoggleProps={ toggleProps }\n\t\t\tmenuProps={ menuProps }\n\t\t\ticon={ deviceIcons[ deviceType.toLowerCase() ] }\n\t\t\tlabel={ __( 'View' ) }\n\t\t\tdisableOpenOnArrowDown={ disabled }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\tchoices={ choices }\n\t\t\t\t\t\t\tvalue={ deviceType }\n\t\t\t\t\t\t\tonSelect={ handleDevicePreviewChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\ticon={ isResponsiveEditing ? check : undefined }\n\t\t\t\t\t\t\tisSelected={ isResponsiveEditing }\n\t\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\t\tonClick={ handleResponsiveEditingChange }\n\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t'Style changes apply only to the current viewport.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Responsive editing' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t{ isTemplate && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'View site' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden render={ <span /> }>\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isTemplate && !! templateId && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\ticon={ ! isTemplateHidden ? check : undefined }\n\t\t\t\t\t\t\t\tisSelected={ ! isTemplateHidden }\n\t\t\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tconst newRenderingMode = isTemplateHidden\n\t\t\t\t\t\t\t\t\t\t? 'template-locked'\n\t\t\t\t\t\t\t\t\t\t: 'post-only';\n\t\t\t\t\t\t\t\t\tsetRenderingMode( newRenderingMode );\n\t\t\t\t\t\t\t\t\tsetDefaultRenderingMode( newRenderingMode );\n\t\t\t\t\t\t\t\t\tresetZoomLevel();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Show template' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isViewable && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<PostPreviewButton\n\t\t\t\t\t\t\t\tclassName=\"editor-preview-dropdown__button-external\"\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\tforceIsAutosaveable={ forceIsAutosaveable }\n\t\t\t\t\t\t\t\taria-label={ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\ttextContent={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\t\t\t<WCIcon icon={ external } />\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonPreview={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t<ActionItem.Slot\n\t\t\t\t\t\tname=\"core/plugin-preview-menu\"\n\t\t\t\t\t\tfillProps={ { onClick: onClose } }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],
5
+ "mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,wBAAwB;AACjC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,E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,YACL;AAAA,YACA,cAAa,GAAI,oBAAqB;AAAA,YACtC,aACC,iCACG;AAAA,iBAAI,oBAAqB;AAAA,cAC3B,oBAAC,UAAO,MAAO,UAAW;AAAA,eAC3B;AAAA,YAED,WAAY;AAAA;AAAA,QACb,GACD;AAAA,QAED;AAAA,UAAC,WAAW;AAAA,UAAX;AAAA,YACA,MAAK;AAAA,YACL,WAAY,EAAE,SAAS,QAAQ;AAAA;AAAA,QAChC;AAAA,SACD;AAAA;AAAA,EAEF;AAEF;",
6
6
  "names": []
7
7
  }
@@ -16,10 +16,11 @@ import {
16
16
  store as blockEditorStore
17
17
  } from "@wordpress/block-editor";
18
18
  import { privateApis as mediaEditorPrivateApis } from "@wordpress/media-editor";
19
- import inserterMediaCategories from "../media-categories/index.mjs";
19
+ import getInserterMediaCategories from "../media-categories/index.mjs";
20
20
  import { mediaUpload } from "../../utils/index.mjs";
21
21
  import mediaUploadOnSuccess from "../../utils/media-upload/on-success.mjs";
22
22
  import { default as mediaSideload } from "../../utils/media-sideload/index.mjs";
23
+ import { default as mediaSideloadFromUrl } from "../../utils/media-sideload-from-url/index.mjs";
23
24
  import { default as mediaFinalize } from "../../utils/media-finalize/index.mjs";
24
25
  import { default as mediaDelete } from "../../utils/media-delete/index.mjs";
25
26
  import { store as editorStore } from "../../store/index.mjs";
@@ -102,10 +103,10 @@ var {
102
103
  getMediaSelectKey,
103
104
  isIsolatedEditorKey,
104
105
  deviceTypeKey,
105
- onViewportStateChangeKey,
106
106
  isNavigationOverlayContextKey,
107
107
  isNavigationPostEditorKey,
108
108
  mediaUploadOnSuccessKey,
109
+ mediaSideloadFromUrlKey,
109
110
  openMediaEditorModalKey
110
111
  } = unlock(privateApis);
111
112
  function useBlockEditorSettings(settings, postType, postId, renderingMode) {
@@ -129,17 +130,21 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
129
130
  sectionRootClientId,
130
131
  deviceType,
131
132
  isNavigationOverlayContext,
132
- isRevisionsMode
133
+ isRevisionsMode,
134
+ viewablePostTypeLabel,
135
+ currentPostId
133
136
  } = useSelect(
134
137
  (select) => {
135
138
  const {
136
139
  canUser,
137
140
  getRawEntityRecord,
138
141
  getEntityRecord,
139
- getBlockPatternCategories
142
+ getBlockPatternCategories,
143
+ getPostType
140
144
  } = select(coreStore);
141
145
  const { get } = select(preferencesStore);
142
146
  const { getBlockTypes } = select(blocksStore);
147
+ const { getCurrentPostId, getCurrentPostType } = select(editorStore);
143
148
  const { getDeviceType, isRevisionsMode: _isRevisionsMode } = unlock(
144
149
  select(editorStore)
145
150
  );
@@ -149,6 +154,8 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
149
154
  name: "site"
150
155
  }) ? getEntityRecord("root", "site") : void 0;
151
156
  const baseData = getEntityRecord("root", "__unstableBase");
157
+ const currentPostType = getCurrentPostType();
158
+ const postTypeObject = currentPostType ? getPostType(currentPostType) : void 0;
152
159
  function getSectionRootBlock() {
153
160
  if (renderingMode === "template-locked") {
154
161
  return getBlocksByName("core/post-content")?.[0] ?? "";
@@ -185,6 +192,12 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
185
192
  }),
186
193
  pageOnFront: siteSettings?.page_on_front,
187
194
  pageForPosts: siteSettings?.page_for_posts,
195
+ // The post type's singular name, but only for real, front-end
196
+ // rendered content (`viewable`). Empty for synced patterns,
197
+ // navigation and templates, which gates the attached-images
198
+ // category off for them and words its copy for everything else.
199
+ viewablePostTypeLabel: postTypeObject?.viewable ? postTypeObject?.labels?.singular_name : void 0,
200
+ currentPostId: getCurrentPostId(),
188
201
  restBlockPatternCategories: getBlockPatternCategories(),
189
202
  sectionRootClientId: getSectionRootBlock(),
190
203
  deviceType: getDeviceType(),
@@ -223,9 +236,6 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
223
236
  [settingsBlockPatternCategories, restBlockPatternCategories]
224
237
  );
225
238
  const { undo, setIsInserterOpened } = useDispatch(editorStore);
226
- const { updateDeviceTypeForViewportState } = unlock(
227
- useDispatch(editorStore)
228
- );
229
239
  const { editMediaEntity } = unlock(useDispatch(coreStore));
230
240
  const { saveEntityRecord } = useDispatch(coreStore);
231
241
  const { openMediaEditorModal } = useDispatch(mediaEditorStore);
@@ -252,6 +262,10 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
252
262
  return settings.allowedBlockTypes;
253
263
  }, [settings.allowedBlockTypes, hiddenBlockTypes, blockTypes]);
254
264
  const forceDisableFocusMode = settings.focusMode === false;
265
+ const inserterMediaCategories = useMemo(
266
+ () => getInserterMediaCategories(currentPostId, viewablePostTypeLabel),
267
+ [currentPostId, viewablePostTypeLabel]
268
+ );
255
269
  return useMemo(() => {
256
270
  const blockEditorSettings = {
257
271
  ...Object.fromEntries(
@@ -281,6 +295,7 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
281
295
  mediaUpload: hasUploadPermissions ? mediaUpload : void 0,
282
296
  [mediaUploadOnSuccessKey]: hasUploadPermissions ? mediaUploadOnSuccess : void 0,
283
297
  mediaSideload: hasUploadPermissions ? mediaSideload : void 0,
298
+ [mediaSideloadFromUrlKey]: hasUploadPermissions ? mediaSideloadFromUrl : void 0,
284
299
  mediaFinalize: hasUploadPermissions ? mediaFinalize : void 0,
285
300
  mediaDelete: hasUploadPermissions ? mediaDelete : void 0,
286
301
  __experimentalBlockPatterns: blockPatterns,
@@ -326,7 +341,6 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
326
341
  // don't treat template parts as contentOnly sections.
327
342
  disableContentOnlyForTemplateParts: renderingMode === "template-locked" || settings.disableContentOnlyForTemplateParts,
328
343
  ...deviceType ? { [deviceTypeKey]: deviceType } : {},
329
- [onViewportStateChangeKey]: updateDeviceTypeForViewportState,
330
344
  [isNavigationOverlayContextKey]: isNavigationOverlayContext
331
345
  };
332
346
  if (isRevisionsMode) {
@@ -346,6 +360,7 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
346
360
  hasUploadPermissions,
347
361
  blockPatterns,
348
362
  blockPatternCategories,
363
+ inserterMediaCategories,
349
364
  canUseUnfilteredHTML,
350
365
  undo,
351
366
  createPageEntity,
@@ -360,7 +375,6 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
360
375
  renderingMode,
361
376
  editMediaEntity,
362
377
  openMediaEditorModal,
363
- updateDeviceTypeForViewportState,
364
378
  deviceType,
365
379
  allImageSizes,
366
380
  bigImageSizeThreshold,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/provider/use-block-editor-settings.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n\tprivateApis as coreDataPrivateApis,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tprivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { privateApis as mediaEditorPrivateApis } from '@wordpress/media-editor';\n\n/**\n * Internal dependencies\n */\nimport inserterMediaCategories from '../media-categories';\nimport { mediaUpload } from '../../utils';\nimport mediaUploadOnSuccess from '../../utils/media-upload/on-success';\nimport { default as mediaSideload } from '../../utils/media-sideload';\nimport { default as mediaFinalize } from '../../utils/media-finalize';\nimport { default as mediaDelete } from '../../utils/media-delete';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useGlobalStyles } from '../global-styles';\n\nconst { store: mediaEditorStore } = unlock( mediaEditorPrivateApis );\n\nconst EMPTY_OBJECT = {};\n\nfunction __experimentalReusableBlocksSelect( select ) {\n\tconst { RECEIVE_INTERMEDIATE_RESULTS } = unlock( coreDataPrivateApis );\n\tconst { getEntityRecords } = select( coreStore );\n\treturn getEntityRecords( 'postType', 'wp_block', {\n\t\tper_page: -1,\n\t\t[ RECEIVE_INTERMEDIATE_RESULTS ]: true,\n\t} );\n}\n\nfunction __experimentalUserPatternCategoriesSelect( select ) {\n\treturn select( coreStore ).getUserPatternCategories();\n}\n\nconst BLOCK_EDITOR_SETTINGS = [\n\t'__experimentalBlockBindingsSupportedAttributes',\n\t'__experimentalBlockDirectory',\n\t'__experimentalDiscussionSettings',\n\t'__experimentalFeatures',\n\t'__experimentalGlobalStylesBaseStyles',\n\t'allImageSizes',\n\t'alignWide',\n\t'blockInspectorTabs',\n\t'maxUploadFileSize',\n\t'allowedMimeTypes',\n\t'bodyPlaceholder',\n\t'canEditCSS',\n\t'canLockBlocks',\n\t'canUpdateBlockBindings',\n\t'capabilities',\n\t'clearBlockSelection',\n\t'codeEditingEnabled',\n\t'colors',\n\t'disableContentOnlyForTemplateParts',\n\t'disableContentOnlyForUnsyncedPatterns',\n\t'disableCustomColors',\n\t'disableCustomFontSizes',\n\t'disableCustomSpacingSizes',\n\t'disableCustomGradients',\n\t'disableLayoutStyles',\n\t'enableCustomLineHeight',\n\t'enableCustomSpacing',\n\t'enableCustomUnits',\n\t'enableOpenverseMediaCategory',\n\t'fontSizes',\n\t'gradients',\n\t'generateAnchors',\n\t'onNavigateToEntityRecord',\n\t'imageDefaultSize',\n\t'imageDimensions',\n\t'imageEditing',\n\t'imageSizes',\n\t'isPreviewMode',\n\t'isRTL',\n\t'locale',\n\t'maxWidth',\n\t'postContentAttributes',\n\t'postsPerPage',\n\t'readOnly',\n\t'styles',\n\t'titlePlaceholder',\n\t'supportsLayout',\n\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t'__unstableHasCustomAppender',\n\t'__unstableResolvedAssets',\n\t'__unstableIsBlockBasedTheme',\n];\n\nconst {\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tselectBlockPatternsKey,\n\treusableBlocksSelectKey,\n\tuserPatternCategoriesSelectKey,\n\tsectionRootClientIdKey,\n\tmediaEditKey,\n\tgetMediaSelectKey,\n\tisIsolatedEditorKey,\n\tdeviceTypeKey,\n\tonViewportStateChangeKey,\n\tisNavigationOverlayContextKey,\n\tisNavigationPostEditorKey,\n\tmediaUploadOnSuccessKey,\n\topenMediaEditorModalKey,\n} = unlock( privateApis );\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {string} postType Editor root level post type.\n * @param {string} postId Editor root level post ID.\n * @param {string} renderingMode Editor rendering mode.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, postType, postId, renderingMode ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\tallImageSizes,\n\t\tbigImageSizeThreshold,\n\t\tallowRightClickOverrides,\n\t\tblockTypes,\n\t\tfocusMode,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tkeepCaretInsideBlock,\n\t\thasUploadPermissions,\n\t\thiddenBlockTypes,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\trestBlockPatternCategories,\n\t\tsectionRootClientId,\n\t\tdeviceType,\n\t\tisNavigationOverlayContext,\n\t\tisRevisionsMode,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tcanUser,\n\t\t\t\tgetRawEntityRecord,\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetBlockPatternCategories,\n\t\t\t} = select( coreStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst { getDeviceType, isRevisionsMode: _isRevisionsMode } = unlock(\n\t\t\t\tselect( editorStore )\n\t\t\t);\n\t\t\tconst { getBlocksByName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\n\t\t\t// Fetch image sizes from REST API index for client-side media processing.\n\t\t\tconst baseData = getEntityRecord( 'root', '__unstableBase' );\n\n\t\t\tfunction getSectionRootBlock() {\n\t\t\t\tif ( renderingMode === 'template-locked' ) {\n\t\t\t\t\treturn getBlocksByName( 'core/post-content' )?.[ 0 ] ?? '';\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\tgetBlocksByName( 'core/group' ).find(\n\t\t\t\t\t\t( clientId ) =>\n\t\t\t\t\t\t\tgetBlockAttributes( clientId )?.tagName === 'main'\n\t\t\t\t\t) ?? ''\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tallImageSizes: baseData?.image_sizes,\n\t\t\t\tbigImageSizeThreshold: baseData?.image_size_threshold,\n\t\t\t\tallowRightClickOverrides: get(\n\t\t\t\t\t'core',\n\t\t\t\t\t'allowRightClickOverrides'\n\t\t\t\t),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tcanUseUnfilteredHTML: getRawEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t)?._links?.hasOwnProperty( 'wp:action-unfiltered-html' ),\n\t\t\t\tfocusMode: get( 'core', 'focusMode' ),\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tget( 'core', 'fixedToolbar' ) || ! isLargeViewport,\n\t\t\t\thiddenBlockTypes: get( 'core', 'hiddenBlockTypes' ),\n\t\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\t\tkeepCaretInsideBlock: get( 'core', 'keepCaretInsideBlock' ),\n\t\t\t\thasUploadPermissions:\n\t\t\t\t\tcanUser( 'create', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'attachment',\n\t\t\t\t\t} ) ?? true,\n\t\t\t\tuserCanCreatePages: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'page',\n\t\t\t\t} ),\n\t\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\t\tpageForPosts: siteSettings?.page_for_posts,\n\t\t\t\trestBlockPatternCategories: getBlockPatternCategories(),\n\t\t\t\tsectionRootClientId: getSectionRootBlock(),\n\t\t\t\tdeviceType: getDeviceType(),\n\t\t\t\tisNavigationOverlayContext:\n\t\t\t\t\tpostType === 'wp_template_part' && postId\n\t\t\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t'wp_template_part',\n\t\t\t\t\t\t\t\tpostId\n\t\t\t\t\t\t )?.area === 'navigation-overlay'\n\t\t\t\t\t\t: false,\n\t\t\t\tisRevisionsMode: _isRevisionsMode(),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, isLargeViewport, renderingMode ]\n\t);\n\n\tconst { merged: mergedGlobalStyles } = useGlobalStyles();\n\tconst globalStylesData = mergedGlobalStyles.styles ?? EMPTY_OBJECT;\n\tconst globalStylesLinksData = mergedGlobalStyles._links ?? EMPTY_OBJECT;\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[ ...( settingsBlockPatterns || [] ) ].filter(\n\t\t\t\t( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t),\n\t\t[ settingsBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst { undo, setIsInserterOpened } = useDispatch( editorStore );\n\tconst { updateDeviceTypeForViewportState } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\tconst { editMediaEntity } = unlock( useDispatch( coreStore ) );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { openMediaEditorModal } = useDispatch( mediaEditorStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = useCallback(\n\t\t( options ) => {\n\t\t\tif ( ! userCanCreatePages ) {\n\t\t\t\treturn Promise.reject( {\n\t\t\t\t\tmessage: __(\n\t\t\t\t\t\t'You do not have permission to create Pages.'\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t\t},\n\t\t[ saveEntityRecord, userCanCreatePages ]\n\t);\n\n\tconst allowedBlockTypes = useMemo( () => {\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes && hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\treturn defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn settings.allowedBlockTypes;\n\t}, [ settings.allowedBlockTypes, hiddenBlockTypes, blockTypes ] );\n\n\tconst forceDisableFocusMode = settings.focusMode === false;\n\n\treturn useMemo( () => {\n\t\tconst blockEditorSettings = {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( settings ).filter( ( [ key ] ) =>\n\t\t\t\t\tBLOCK_EDITOR_SETTINGS.includes( key )\n\t\t\t\t)\n\t\t\t),\n\t\t\t[ globalStylesDataKey ]: globalStylesData,\n\t\t\t[ globalStylesLinksDataKey ]: globalStylesLinksData,\n\t\t\tallImageSizes,\n\t\t\tbigImageSizeThreshold,\n\t\t\tallowedBlockTypes,\n\t\t\tallowRightClickOverrides,\n\t\t\tfocusMode: focusMode && ! forceDisableFocusMode,\n\t\t\thasFixedToolbar,\n\t\t\tisDistractionFree,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t[ getMediaSelectKey ]: ( select, attachmentId ) => {\n\t\t\t\treturn select( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'attachment',\n\t\t\t\t\tattachmentId\n\t\t\t\t);\n\t\t\t},\n\t\t\t[ mediaEditKey ]: hasUploadPermissions\n\t\t\t\t? editMediaEntity\n\t\t\t\t: undefined,\n\t\t\t[ openMediaEditorModalKey ]: ( { id, onUpdate, onClose } ) =>\n\t\t\t\topenMediaEditorModal( { id, onUpdate, onClose } ),\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t[ mediaUploadOnSuccessKey ]: hasUploadPermissions\n\t\t\t\t? mediaUploadOnSuccess\n\t\t\t\t: undefined,\n\t\t\tmediaSideload: hasUploadPermissions ? mediaSideload : undefined,\n\t\t\tmediaFinalize: hasUploadPermissions ? mediaFinalize : undefined,\n\t\t\tmediaDelete: hasUploadPermissions ? mediaDelete : undefined,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t[ selectBlockPatternsKey ]: ( select ) => {\n\t\t\t\tconst { hasFinishedResolution, getBlockPatternsForPostType } =\n\t\t\t\t\tunlock( select( coreStore ) );\n\t\t\t\tconst patterns = getBlockPatternsForPostType( postType );\n\t\t\t\treturn hasFinishedResolution( 'getBlockPatterns' )\n\t\t\t\t\t? patterns\n\t\t\t\t\t: undefined;\n\t\t\t},\n\t\t\t[ reusableBlocksSelectKey ]: __experimentalReusableBlocksSelect,\n\t\t\t[ userPatternCategoriesSelectKey ]:\n\t\t\t\t__experimentalUserPatternCategoriesSelect,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t// Todo: This only checks the top level post, not the post within a template or any other entity that can be edited.\n\t\t\t// This might be better as a generic \"canUser\" selector.\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t//Todo: this is only needed for native and should probably be removed.\n\t\t\t__experimentalUndo: undo,\n\t\t\t// Check whether we want all site editor frames to have outlines\n\t\t\t// including the navigation / pattern / parts editors.\n\t\t\toutlineMode: ! isDistractionFree && postType === 'wp_template',\n\t\t\t// Check these two properties: they were not present in the site editor.\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\tpageForPosts,\n\t\t\t__experimentalPreferPatternsOnRoot: postType === 'wp_template',\n\t\t\ttemplateLock:\n\t\t\t\tpostType === 'wp_navigation' ? 'insert' : settings.templateLock,\n\t\t\ttemplate:\n\t\t\t\tpostType === 'wp_navigation'\n\t\t\t\t\t? [ [ 'core/navigation', {}, [] ] ]\n\t\t\t\t\t: settings.template,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\t[ sectionRootClientIdKey ]: sectionRootClientId,\n\t\t\teditorTool:\n\t\t\t\trenderingMode === 'post-only' && postType !== 'wp_template'\n\t\t\t\t\t? 'edit'\n\t\t\t\t\t: undefined,\n\t\t\t// When editing template parts, patterns, or navigation directly,\n\t\t\t// we're in an isolated editing context (focused on that entity alone).\n\t\t\t[ isIsolatedEditorKey ]: [\n\t\t\t\t'wp_template_part',\n\t\t\t\t'wp_block',\n\t\t\t\t'wp_navigation',\n\t\t\t].includes( postType ),\n\t\t\t[ isNavigationPostEditorKey ]: postType === 'wp_navigation',\n\t\t\t// When in template-locked mode (e.g., \"Show Template\" in the post editor),\n\t\t\t// don't treat template parts as contentOnly sections.\n\t\t\tdisableContentOnlyForTemplateParts:\n\t\t\t\trenderingMode === 'template-locked' ||\n\t\t\t\tsettings.disableContentOnlyForTemplateParts,\n\t\t\t...( deviceType ? { [ deviceTypeKey ]: deviceType } : {} ),\n\t\t\t[ onViewportStateChangeKey ]: updateDeviceTypeForViewportState,\n\t\t\t[ isNavigationOverlayContextKey ]: isNavigationOverlayContext,\n\t\t};\n\n\t\tif ( isRevisionsMode ) {\n\t\t\tblockEditorSettings.isPreviewMode = true;\n\t\t}\n\n\t\treturn blockEditorSettings;\n\t}, [\n\t\tisRevisionsMode,\n\t\tallowedBlockTypes,\n\t\tallowRightClickOverrides,\n\t\tfocusMode,\n\t\tforceDisableFocusMode,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tkeepCaretInsideBlock,\n\t\tsettings,\n\t\thasUploadPermissions,\n\t\tblockPatterns,\n\t\tblockPatternCategories,\n\t\tcanUseUnfilteredHTML,\n\t\tundo,\n\t\tcreatePageEntity,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\tpostType,\n\t\tsetIsInserterOpened,\n\t\tsectionRootClientId,\n\t\tglobalStylesData,\n\t\tglobalStylesLinksData,\n\t\trenderingMode,\n\t\teditMediaEntity,\n\t\topenMediaEditorModal,\n\t\tupdateDeviceTypeForViewportState,\n\t\tdeviceType,\n\t\tallImageSizes,\n\t\tbigImageSizeThreshold,\n\t\tisNavigationOverlayContext,\n\t] );\n}\n\nexport default useBlockEditorSettings;\n"],
5
- "mappings": ";AAGA,SAAS,SAAS,mBAAmB;AACrC,SAAS,aAAa,iBAAiB;AACvC;AAAA,EACC,SAAS;AAAA,EACT,sCAAsC;AAAA,EACtC,8BAA8B;AAAA,EAC9B,eAAe;AAAA,OACT;AACP,SAAS,UAAU;AACnB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,wBAAwB;AACjC,SAAS,SAAS,mBAAmB;AACrC;AAAA,EACC;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,eAAe,8BAA8B;AAKtD,OAAO,6BAA6B;AACpC,SAAS,mBAAmB;AAC5B,OAAO,0BAA0B;AACjC,SAAS,WAAW,qBAAqB;AACzC,SAAS,WAAW,qBAAqB;AACzC,SAAS,WAAW,mBAAmB;AACvC,SAAS,SAAS,mBAAmB;AACrC,SAAS,cAAc;AACvB,SAAS,uBAAuB;AAEhC,IAAM,EAAE,OAAO,iBAAiB,IAAI,OAAQ,sBAAuB;AAEnE,IAAM,eAAe,CAAC;AAEtB,SAAS,mCAAoC,QAAS;AACrD,QAAM,EAAE,6BAA6B,IAAI,OAAQ,mBAAoB;AACrE,QAAM,EAAE,iBAAiB,IAAI,OAAQ,SAAU;AAC/C,SAAO,iBAAkB,YAAY,YAAY;AAAA,IAChD,UAAU;AAAA,IACV,CAAE,4BAA6B,GAAG;AAAA,EACnC,CAAE;AACH;AAEA,SAAS,0CAA2C,QAAS;AAC5D,SAAO,OAAQ,SAAU,EAAE,yBAAyB;AACrD;AAEA,IAAM,wBAAwB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,E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AI,CAAC;AAAA,MACvD,CAAE,wBAAyB,GAAG;AAAA,MAC9B,CAAE,6BAA8B,GAAG;AAAA,IACpC;AAEA,QAAK,iBAAkB;AACtB,0BAAoB,gBAAgB;AAAA,IACrC;AAEA,WAAO;AAAA,EACR,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AACH;AAEA,IAAO,oCAAQ;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n\tprivateApis as coreDataPrivateApis,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tprivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { privateApis as mediaEditorPrivateApis } from '@wordpress/media-editor';\n\n/**\n * Internal dependencies\n */\nimport getInserterMediaCategories from '../media-categories';\nimport { mediaUpload } from '../../utils';\nimport mediaUploadOnSuccess from '../../utils/media-upload/on-success';\nimport { default as mediaSideload } from '../../utils/media-sideload';\nimport { default as mediaSideloadFromUrl } from '../../utils/media-sideload-from-url';\nimport { default as mediaFinalize } from '../../utils/media-finalize';\nimport { default as mediaDelete } from '../../utils/media-delete';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useGlobalStyles } from '../global-styles';\n\nconst { store: mediaEditorStore } = unlock( mediaEditorPrivateApis );\n\nconst EMPTY_OBJECT = {};\n\nfunction __experimentalReusableBlocksSelect( select ) {\n\tconst { RECEIVE_INTERMEDIATE_RESULTS } = unlock( coreDataPrivateApis );\n\tconst { getEntityRecords } = select( coreStore );\n\treturn getEntityRecords( 'postType', 'wp_block', {\n\t\tper_page: -1,\n\t\t[ RECEIVE_INTERMEDIATE_RESULTS ]: true,\n\t} );\n}\n\nfunction __experimentalUserPatternCategoriesSelect( select ) {\n\treturn select( coreStore ).getUserPatternCategories();\n}\n\nconst BLOCK_EDITOR_SETTINGS = [\n\t'__experimentalBlockBindingsSupportedAttributes',\n\t'__experimentalBlockDirectory',\n\t'__experimentalDiscussionSettings',\n\t'__experimentalFeatures',\n\t'__experimentalGlobalStylesBaseStyles',\n\t'allImageSizes',\n\t'alignWide',\n\t'blockInspectorTabs',\n\t'maxUploadFileSize',\n\t'allowedMimeTypes',\n\t'bodyPlaceholder',\n\t'canEditCSS',\n\t'canLockBlocks',\n\t'canUpdateBlockBindings',\n\t'capabilities',\n\t'clearBlockSelection',\n\t'codeEditingEnabled',\n\t'colors',\n\t'disableContentOnlyForTemplateParts',\n\t'disableContentOnlyForUnsyncedPatterns',\n\t'disableCustomColors',\n\t'disableCustomFontSizes',\n\t'disableCustomSpacingSizes',\n\t'disableCustomGradients',\n\t'disableLayoutStyles',\n\t'enableCustomLineHeight',\n\t'enableCustomSpacing',\n\t'enableCustomUnits',\n\t'enableOpenverseMediaCategory',\n\t'fontSizes',\n\t'gradients',\n\t'generateAnchors',\n\t'onNavigateToEntityRecord',\n\t'imageDefaultSize',\n\t'imageDimensions',\n\t'imageEditing',\n\t'imageSizes',\n\t'isPreviewMode',\n\t'isRTL',\n\t'locale',\n\t'maxWidth',\n\t'postContentAttributes',\n\t'postsPerPage',\n\t'readOnly',\n\t'styles',\n\t'titlePlaceholder',\n\t'supportsLayout',\n\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t'__unstableHasCustomAppender',\n\t'__unstableResolvedAssets',\n\t'__unstableIsBlockBasedTheme',\n];\n\nconst {\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tselectBlockPatternsKey,\n\treusableBlocksSelectKey,\n\tuserPatternCategoriesSelectKey,\n\tsectionRootClientIdKey,\n\tmediaEditKey,\n\tgetMediaSelectKey,\n\tisIsolatedEditorKey,\n\tdeviceTypeKey,\n\tisNavigationOverlayContextKey,\n\tisNavigationPostEditorKey,\n\tmediaUploadOnSuccessKey,\n\tmediaSideloadFromUrlKey,\n\topenMediaEditorModalKey,\n} = unlock( privateApis );\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {string} postType Editor root level post type.\n * @param {string} postId Editor root level post ID.\n * @param {string} renderingMode Editor rendering mode.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, postType, postId, renderingMode ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\tallImageSizes,\n\t\tbigImageSizeThreshold,\n\t\tallowRightClickOverrides,\n\t\tblockTypes,\n\t\tfocusMode,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tkeepCaretInsideBlock,\n\t\thasUploadPermissions,\n\t\thiddenBlockTypes,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\trestBlockPatternCategories,\n\t\tsectionRootClientId,\n\t\tdeviceType,\n\t\tisNavigationOverlayContext,\n\t\tisRevisionsMode,\n\t\tviewablePostTypeLabel,\n\t\tcurrentPostId,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tcanUser,\n\t\t\t\tgetRawEntityRecord,\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetBlockPatternCategories,\n\t\t\t\tgetPostType,\n\t\t\t} = select( coreStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst { getCurrentPostId, getCurrentPostType } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst { getDeviceType, isRevisionsMode: _isRevisionsMode } = unlock(\n\t\t\t\tselect( editorStore )\n\t\t\t);\n\t\t\tconst { getBlocksByName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\n\t\t\t// Fetch image sizes from REST API index for client-side media processing.\n\t\t\tconst baseData = getEntityRecord( 'root', '__unstableBase' );\n\n\t\t\t// The attached-images category follows the post being edited, not the\n\t\t\t// root-level entity in `postType`/`postId`. With \"Show template\" on,\n\t\t\t// the root becomes the template (wp_template), but media still attaches\n\t\t\t// to the page being edited.\n\t\t\t//\n\t\t\t// Guard on a truthy slug: `getPostType()` with no slug resolves the\n\t\t\t// whole `/wp/v2/types` collection rather than the single, already\n\t\t\t// fetched record for the current type.\n\t\t\tconst currentPostType = getCurrentPostType();\n\t\t\tconst postTypeObject = currentPostType\n\t\t\t\t? getPostType( currentPostType )\n\t\t\t\t: undefined;\n\n\t\t\tfunction getSectionRootBlock() {\n\t\t\t\tif ( renderingMode === 'template-locked' ) {\n\t\t\t\t\treturn getBlocksByName( 'core/post-content' )?.[ 0 ] ?? '';\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\tgetBlocksByName( 'core/group' ).find(\n\t\t\t\t\t\t( clientId ) =>\n\t\t\t\t\t\t\tgetBlockAttributes( clientId )?.tagName === 'main'\n\t\t\t\t\t) ?? ''\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tallImageSizes: baseData?.image_sizes,\n\t\t\t\tbigImageSizeThreshold: baseData?.image_size_threshold,\n\t\t\t\tallowRightClickOverrides: get(\n\t\t\t\t\t'core',\n\t\t\t\t\t'allowRightClickOverrides'\n\t\t\t\t),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tcanUseUnfilteredHTML: getRawEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t)?._links?.hasOwnProperty( 'wp:action-unfiltered-html' ),\n\t\t\t\tfocusMode: get( 'core', 'focusMode' ),\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tget( 'core', 'fixedToolbar' ) || ! isLargeViewport,\n\t\t\t\thiddenBlockTypes: get( 'core', 'hiddenBlockTypes' ),\n\t\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\t\tkeepCaretInsideBlock: get( 'core', 'keepCaretInsideBlock' ),\n\t\t\t\thasUploadPermissions:\n\t\t\t\t\tcanUser( 'create', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'attachment',\n\t\t\t\t\t} ) ?? true,\n\t\t\t\tuserCanCreatePages: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'page',\n\t\t\t\t} ),\n\t\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\t\tpageForPosts: siteSettings?.page_for_posts,\n\t\t\t\t// The post type's singular name, but only for real, front-end\n\t\t\t\t// rendered content (`viewable`). Empty for synced patterns,\n\t\t\t\t// navigation and templates, which gates the attached-images\n\t\t\t\t// category off for them and words its copy for everything else.\n\t\t\t\tviewablePostTypeLabel: postTypeObject?.viewable\n\t\t\t\t\t? postTypeObject?.labels?.singular_name\n\t\t\t\t\t: undefined,\n\t\t\t\tcurrentPostId: getCurrentPostId(),\n\t\t\t\trestBlockPatternCategories: getBlockPatternCategories(),\n\t\t\t\tsectionRootClientId: getSectionRootBlock(),\n\t\t\t\tdeviceType: getDeviceType(),\n\t\t\t\tisNavigationOverlayContext:\n\t\t\t\t\tpostType === 'wp_template_part' && postId\n\t\t\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t'wp_template_part',\n\t\t\t\t\t\t\t\tpostId\n\t\t\t\t\t\t )?.area === 'navigation-overlay'\n\t\t\t\t\t\t: false,\n\t\t\t\tisRevisionsMode: _isRevisionsMode(),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, isLargeViewport, renderingMode ]\n\t);\n\n\tconst { merged: mergedGlobalStyles } = useGlobalStyles();\n\tconst globalStylesData = mergedGlobalStyles.styles ?? EMPTY_OBJECT;\n\tconst globalStylesLinksData = mergedGlobalStyles._links ?? EMPTY_OBJECT;\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[ ...( settingsBlockPatterns || [] ) ].filter(\n\t\t\t\t( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t),\n\t\t[ settingsBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst { undo, setIsInserterOpened } = useDispatch( editorStore );\n\tconst { editMediaEntity } = unlock( useDispatch( coreStore ) );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { openMediaEditorModal } = useDispatch( mediaEditorStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = useCallback(\n\t\t( options ) => {\n\t\t\tif ( ! userCanCreatePages ) {\n\t\t\t\treturn Promise.reject( {\n\t\t\t\t\tmessage: __(\n\t\t\t\t\t\t'You do not have permission to create Pages.'\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t\t},\n\t\t[ saveEntityRecord, userCanCreatePages ]\n\t);\n\n\tconst allowedBlockTypes = useMemo( () => {\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes && hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\treturn defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn settings.allowedBlockTypes;\n\t}, [ settings.allowedBlockTypes, hiddenBlockTypes, blockTypes ] );\n\n\tconst forceDisableFocusMode = settings.focusMode === false;\n\n\t// The \"Attachments\" media category depends on the edited post and its post\n\t// type label (which gates whether it's offered and words its copy), so the\n\t// categories are derived rather than being a static list.\n\tconst inserterMediaCategories = useMemo(\n\t\t() =>\n\t\t\tgetInserterMediaCategories( currentPostId, viewablePostTypeLabel ),\n\t\t[ currentPostId, viewablePostTypeLabel ]\n\t);\n\n\treturn useMemo( () => {\n\t\tconst blockEditorSettings = {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( settings ).filter( ( [ key ] ) =>\n\t\t\t\t\tBLOCK_EDITOR_SETTINGS.includes( key )\n\t\t\t\t)\n\t\t\t),\n\t\t\t[ globalStylesDataKey ]: globalStylesData,\n\t\t\t[ globalStylesLinksDataKey ]: globalStylesLinksData,\n\t\t\tallImageSizes,\n\t\t\tbigImageSizeThreshold,\n\t\t\tallowedBlockTypes,\n\t\t\tallowRightClickOverrides,\n\t\t\tfocusMode: focusMode && ! forceDisableFocusMode,\n\t\t\thasFixedToolbar,\n\t\t\tisDistractionFree,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t[ getMediaSelectKey ]: ( select, attachmentId ) => {\n\t\t\t\treturn select( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'attachment',\n\t\t\t\t\tattachmentId\n\t\t\t\t);\n\t\t\t},\n\t\t\t[ mediaEditKey ]: hasUploadPermissions\n\t\t\t\t? editMediaEntity\n\t\t\t\t: undefined,\n\t\t\t[ openMediaEditorModalKey ]: ( { id, onUpdate, onClose } ) =>\n\t\t\t\topenMediaEditorModal( { id, onUpdate, onClose } ),\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t[ mediaUploadOnSuccessKey ]: hasUploadPermissions\n\t\t\t\t? mediaUploadOnSuccess\n\t\t\t\t: undefined,\n\t\t\tmediaSideload: hasUploadPermissions ? mediaSideload : undefined,\n\t\t\t[ mediaSideloadFromUrlKey ]: hasUploadPermissions\n\t\t\t\t? mediaSideloadFromUrl\n\t\t\t\t: undefined,\n\t\t\tmediaFinalize: hasUploadPermissions ? mediaFinalize : undefined,\n\t\t\tmediaDelete: hasUploadPermissions ? mediaDelete : undefined,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t[ selectBlockPatternsKey ]: ( select ) => {\n\t\t\t\tconst { hasFinishedResolution, getBlockPatternsForPostType } =\n\t\t\t\t\tunlock( select( coreStore ) );\n\t\t\t\tconst patterns = getBlockPatternsForPostType( postType );\n\t\t\t\treturn hasFinishedResolution( 'getBlockPatterns' )\n\t\t\t\t\t? patterns\n\t\t\t\t\t: undefined;\n\t\t\t},\n\t\t\t[ reusableBlocksSelectKey ]: __experimentalReusableBlocksSelect,\n\t\t\t[ userPatternCategoriesSelectKey ]:\n\t\t\t\t__experimentalUserPatternCategoriesSelect,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t// Todo: This only checks the top level post, not the post within a template or any other entity that can be edited.\n\t\t\t// This might be better as a generic \"canUser\" selector.\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t//Todo: this is only needed for native and should probably be removed.\n\t\t\t__experimentalUndo: undo,\n\t\t\t// Check whether we want all site editor frames to have outlines\n\t\t\t// including the navigation / pattern / parts editors.\n\t\t\toutlineMode: ! isDistractionFree && postType === 'wp_template',\n\t\t\t// Check these two properties: they were not present in the site editor.\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\tpageForPosts,\n\t\t\t__experimentalPreferPatternsOnRoot: postType === 'wp_template',\n\t\t\ttemplateLock:\n\t\t\t\tpostType === 'wp_navigation' ? 'insert' : settings.templateLock,\n\t\t\ttemplate:\n\t\t\t\tpostType === 'wp_navigation'\n\t\t\t\t\t? [ [ 'core/navigation', {}, [] ] ]\n\t\t\t\t\t: settings.template,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\t[ sectionRootClientIdKey ]: sectionRootClientId,\n\t\t\teditorTool:\n\t\t\t\trenderingMode === 'post-only' && postType !== 'wp_template'\n\t\t\t\t\t? 'edit'\n\t\t\t\t\t: undefined,\n\t\t\t// When editing template parts, patterns, or navigation directly,\n\t\t\t// we're in an isolated editing context (focused on that entity alone).\n\t\t\t[ isIsolatedEditorKey ]: [\n\t\t\t\t'wp_template_part',\n\t\t\t\t'wp_block',\n\t\t\t\t'wp_navigation',\n\t\t\t].includes( postType ),\n\t\t\t[ isNavigationPostEditorKey ]: postType === 'wp_navigation',\n\t\t\t// When in template-locked mode (e.g., \"Show Template\" in the post editor),\n\t\t\t// don't treat template parts as contentOnly sections.\n\t\t\tdisableContentOnlyForTemplateParts:\n\t\t\t\trenderingMode === 'template-locked' ||\n\t\t\t\tsettings.disableContentOnlyForTemplateParts,\n\t\t\t...( deviceType ? { [ deviceTypeKey ]: deviceType } : {} ),\n\t\t\t[ isNavigationOverlayContextKey ]: isNavigationOverlayContext,\n\t\t};\n\n\t\tif ( isRevisionsMode ) {\n\t\t\tblockEditorSettings.isPreviewMode = true;\n\t\t}\n\n\t\treturn blockEditorSettings;\n\t}, [\n\t\tisRevisionsMode,\n\t\tallowedBlockTypes,\n\t\tallowRightClickOverrides,\n\t\tfocusMode,\n\t\tforceDisableFocusMode,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tkeepCaretInsideBlock,\n\t\tsettings,\n\t\thasUploadPermissions,\n\t\tblockPatterns,\n\t\tblockPatternCategories,\n\t\tinserterMediaCategories,\n\t\tcanUseUnfilteredHTML,\n\t\tundo,\n\t\tcreatePageEntity,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\tpostType,\n\t\tsetIsInserterOpened,\n\t\tsectionRootClientId,\n\t\tglobalStylesData,\n\t\tglobalStylesLinksData,\n\t\trenderingMode,\n\t\teditMediaEntity,\n\t\topenMediaEditorModal,\n\t\tdeviceType,\n\t\tallImageSizes,\n\t\tbigImageSizeThre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uB,GAAG;AAAA,MAC5B,YACC,kBAAkB,eAAe,aAAa,gBAC3C,SACA;AAAA;AAAA;AAAA,MAGJ,CAAE,mBAAoB,GAAG;AAAA,QACxB;AAAA,QACA;AAAA,QACA;AAAA,MACD,EAAE,SAAU,QAAS;AAAA,MACrB,CAAE,yBAA0B,GAAG,aAAa;AAAA;AAAA;AAAA,MAG5C,oCACC,kBAAkB,qBAClB,SAAS;AAAA,MACV,GAAK,aAAa,EAAE,CAAE,aAAc,GAAG,WAAW,IAAI,CAAC;AAAA,MACvD,CAAE,6BAA8B,GAAG;AAAA,IACpC;AAEA,QAAK,iBAAkB;AACtB,0BAAoB,gBAAgB;AAAA,IACrC;AAEA,WAAO;AAAA,EACR,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AACH;AAEA,IAAO,oCAAQ;",
6
6
  "names": []
7
7
  }
@@ -1,8 +1,11 @@
1
1
  // packages/editor/src/components/resizable-editor/index.js
2
2
  import clsx from "clsx";
3
- import { useState, useRef, useCallback } from "@wordpress/element";
3
+ import { useDispatch, useSelect } from "@wordpress/data";
4
+ import { useRef, useCallback, useState } from "@wordpress/element";
4
5
  import { ResizableBox } from "@wordpress/components";
5
6
  import ResizeHandle from "./resize-handle.mjs";
7
+ import { store as editorStore } from "../../store/index.mjs";
8
+ import { unlock } from "../../lock-unlock.mjs";
6
9
  import { jsx } from "react/jsx-runtime";
7
10
  var HANDLE_STYLES_OVERRIDE = {
8
11
  position: void 0,
@@ -15,29 +18,71 @@ var HANDLE_STYLES_OVERRIDE = {
15
18
  bottom: void 0,
16
19
  left: void 0
17
20
  };
21
+ function isAtMaxWidth(currentWidth, containerWidth, tolerance = 0) {
22
+ return containerWidth > 0 && currentWidth >= containerWidth - tolerance;
23
+ }
18
24
  function ResizableEditor({ className, enableResizing, height, children }) {
19
- const [width, setWidth] = useState("100%");
25
+ const [isResizing, setIsResizing] = useState(false);
26
+ const { setCanvasWidth } = unlock(useDispatch(editorStore));
27
+ const canvasWidth = useSelect(
28
+ (select) => {
29
+ if (!enableResizing) {
30
+ return void 0;
31
+ }
32
+ const { getCanvasWidth } = unlock(select(editorStore));
33
+ return getCanvasWidth();
34
+ },
35
+ [enableResizing]
36
+ );
20
37
  const resizableRef = useRef();
21
- const resizeWidthBy = useCallback((deltaPixels) => {
22
- if (resizableRef.current) {
23
- setWidth(resizableRef.current.offsetWidth + deltaPixels);
24
- }
25
- }, []);
38
+ const resizeWidthBy = useCallback(
39
+ (deltaPixels) => {
40
+ if (resizableRef.current) {
41
+ const _isAtMaxWidth = isAtMaxWidth(
42
+ resizableRef.current.offsetWidth + deltaPixels,
43
+ resizableRef.current.parentElement?.offsetWidth ?? 0,
44
+ 80
45
+ );
46
+ setCanvasWidth(
47
+ _isAtMaxWidth ? void 0 : resizableRef.current.offsetWidth + deltaPixels
48
+ );
49
+ }
50
+ },
51
+ [setCanvasWidth]
52
+ );
53
+ const updateCanvasWidth = useCallback(
54
+ (element) => {
55
+ const currentWidth = element.offsetWidth;
56
+ const containerWidth = element.parentElement?.offsetWidth ?? 0;
57
+ setCanvasWidth(
58
+ isAtMaxWidth(currentWidth, containerWidth, 80) ? void 0 : currentWidth
59
+ );
60
+ },
61
+ [setCanvasWidth]
62
+ );
26
63
  return /* @__PURE__ */ jsx(
27
64
  ResizableBox,
28
65
  {
29
66
  className: clsx("editor-resizable-editor", className, {
30
- "is-resizable": enableResizing
67
+ "is-resizable": enableResizing,
68
+ "is-resizing": isResizing
31
69
  }),
32
70
  ref: (api) => {
33
71
  resizableRef.current = api?.resizable;
34
72
  },
35
73
  size: {
36
- width: enableResizing ? width : "100%",
74
+ width: enableResizing && canvasWidth ? canvasWidth + "px" : "100%",
37
75
  height: enableResizing && height ? height : "100%"
38
76
  },
77
+ onResizeStart: () => {
78
+ setIsResizing(true);
79
+ },
80
+ onResize: (event, direction, element) => {
81
+ updateCanvasWidth(element);
82
+ },
39
83
  onResizeStop: (event, direction, element) => {
40
- setWidth(element.style.width);
84
+ setIsResizing(false);
85
+ updateCanvasWidth(element);
41
86
  },
42
87
  minWidth: 300,
43
88
  maxWidth: "100%",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/resizable-editor/index.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef, useCallback } from '@wordpress/element';\nimport { ResizableBox } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ResizeHandle from './resize-handle';\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\nfunction ResizableEditor( { className, enableResizing, height, children } ) {\n\tconst [ width, setWidth ] = useState( '100%' );\n\tconst resizableRef = useRef();\n\tconst resizeWidthBy = useCallback( ( deltaPixels ) => {\n\t\tif ( resizableRef.current ) {\n\t\t\tsetWidth( resizableRef.current.offsetWidth + deltaPixels );\n\t\t}\n\t}, [] );\n\treturn (\n\t\t<ResizableBox\n\t\t\tclassName={ clsx( 'editor-resizable-editor', className, {\n\t\t\t\t'is-resizable': enableResizing,\n\t\t\t} ) }\n\t\t\tref={ ( api ) => {\n\t\t\t\tresizableRef.current = api?.resizable;\n\t\t\t} }\n\t\t\tsize={ {\n\t\t\t\twidth: enableResizing ? width : '100%',\n\t\t\t\theight: enableResizing && height ? height : '100%',\n\t\t\t} }\n\t\t\tonResizeStop={ ( event, direction, element ) => {\n\t\t\t\tsetWidth( element.style.width );\n\t\t\t} }\n\t\t\tminWidth={ 300 }\n\t\t\tmaxWidth=\"100%\"\n\t\t\tmaxHeight=\"100%\"\n\t\t\tenable={ {\n\t\t\t\tleft: enableResizing,\n\t\t\t\tright: enableResizing,\n\t\t\t} }\n\t\t\tshowHandle={ enableResizing }\n\t\t\t// The editor is centered horizontally, resizing it only\n\t\t\t// moves half the distance. Hence double the ratio to correctly\n\t\t\t// align the cursor to the resizer handle.\n\t\t\tresizeRatio={ 2 }\n\t\t\thandleComponent={ {\n\t\t\t\tleft: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"left\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t\tright: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"right\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t} }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t>\n\t\t\t{ children }\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableEditor;\n"],
5
- "mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,UAAU,QAAQ,mBAAmB;AAC9C,SAAS,oBAAoB;AAK7B,OAAO,kBAAkB;AAoDpB;AAjDL,IAAM,yBAAyB;AAAA,EAC9B,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AACP;AAEA,SAAS,gBAAiB,EAAE,WAAW,gBAAgB,QAAQ,SAAS,GAAI;AAC3E,QAAM,CAAE,OAAO,QAAS,IAAI,SAAU,MAAO;AAC7C,QAAM,eAAe,OAAO;AAC5B,QAAM,gBAAgB,YAAa,CAAE,gBAAiB;AACrD,QAAK,aAAa,SAAU;AAC3B,eAAU,aAAa,QAAQ,cAAc,WAAY;AAAA,IAC1D;AAAA,EACD,GAAG,CAAC,CAAE;AACN,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAY,KAAM,2BAA2B,WAAW;AAAA,QACvD,gBAAgB;AAAA,MACjB,CAAE;AAAA,MACF,KAAM,CAAE,QAAS;AAChB,qBAAa,UAAU,KAAK;AAAA,MAC7B;AAAA,MACA,MAAO;AAAA,QACN,OAAO,iBAAiB,QAAQ;AAAA,QAChC,QAAQ,kBAAkB,SAAS,SAAS;AAAA,MAC7C;AAAA,MACA,cAAe,CAAE,OAAO,WAAW,YAAa;AAC/C,iBAAU,QAAQ,MAAM,KAAM;AAAA,MAC/B;AAAA,MACA,UAAW;AAAA,MACX,UAAS;AAAA,MACT,WAAU;AAAA,MACV,QAAS;AAAA,QACR,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,MACA,YAAa;AAAA,MAIb,aAAc;AAAA,MACd,iBAAkB;AAAA,QACjB,MACC;AAAA,UAAC;AAAA;AAAA,YACA,WAAU;AAAA,YACV;AAAA;AAAA,QACD;AAAA,QAED,OACC;AAAA,UAAC;AAAA;AAAA,YACA,WAAU;AAAA,YACV;AAAA;AAAA,QACD;AAAA,MAEF;AAAA,MACA,eAAgB;AAAA,MAChB,cAAe;AAAA,QACd,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,MAEE;AAAA;AAAA,EACH;AAEF;AAEA,IAAO,2BAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useRef, useCallback, useState } from '@wordpress/element';\nimport { ResizableBox } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ResizeHandle from './resize-handle';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\n/**\n * Checks if the current width is at the max width.\n *\n * @param {number} currentWidth - The current width of the editor.\n * @param {number} containerWidth - The width of the container.\n * @param {number} tolerance - The tolerance for the max width in pixels.\n * @return {boolean} - True if the current width is at the max width, false otherwise.\n */\nfunction isAtMaxWidth( currentWidth, containerWidth, tolerance = 0 ) {\n\treturn containerWidth > 0 && currentWidth >= containerWidth - tolerance;\n}\n\nfunction ResizableEditor( { className, enableResizing, height, children } ) {\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\tconst { setCanvasWidth } = unlock( useDispatch( editorStore ) );\n\tconst canvasWidth = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! enableResizing ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst { getCanvasWidth } = unlock( select( editorStore ) );\n\t\t\treturn getCanvasWidth();\n\t\t},\n\t\t[ enableResizing ]\n\t);\n\n\tconst resizableRef = useRef();\n\tconst resizeWidthBy = useCallback(\n\t\t( deltaPixels ) => {\n\t\t\tif ( resizableRef.current ) {\n\t\t\t\tconst _isAtMaxWidth = isAtMaxWidth(\n\t\t\t\t\tresizableRef.current.offsetWidth + deltaPixels,\n\t\t\t\t\tresizableRef.current.parentElement?.offsetWidth ?? 0,\n\t\t\t\t\t80\n\t\t\t\t);\n\t\t\t\tsetCanvasWidth(\n\t\t\t\t\t_isAtMaxWidth\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: resizableRef.current.offsetWidth + deltaPixels\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ setCanvasWidth ]\n\t);\n\n\tconst updateCanvasWidth = useCallback(\n\t\t( element ) => {\n\t\t\tconst currentWidth = element.offsetWidth;\n\t\t\tconst containerWidth = element.parentElement?.offsetWidth ?? 0;\n\t\t\tsetCanvasWidth(\n\t\t\t\tisAtMaxWidth( currentWidth, containerWidth, 80 )\n\t\t\t\t\t? undefined\n\t\t\t\t\t: currentWidth\n\t\t\t);\n\t\t},\n\t\t[ setCanvasWidth ]\n\t);\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tclassName={ clsx( 'editor-resizable-editor', className, {\n\t\t\t\t'is-resizable': enableResizing,\n\t\t\t\t'is-resizing': isResizing,\n\t\t\t} ) }\n\t\t\tref={ ( api ) => {\n\t\t\t\tresizableRef.current = api?.resizable;\n\t\t\t} }\n\t\t\tsize={ {\n\t\t\t\twidth:\n\t\t\t\t\tenableResizing && canvasWidth ? canvasWidth + 'px' : '100%',\n\t\t\t\theight: enableResizing && height ? height : '100%',\n\t\t\t} }\n\t\t\tonResizeStart={ () => {\n\t\t\t\tsetIsResizing( true );\n\t\t\t} }\n\t\t\tonResize={ ( event, direction, element ) => {\n\t\t\t\tupdateCanvasWidth( element );\n\t\t\t} }\n\t\t\tonResizeStop={ ( event, direction, element ) => {\n\t\t\t\tsetIsResizing( false );\n\t\t\t\tupdateCanvasWidth( element );\n\t\t\t} }\n\t\t\tminWidth={ 300 }\n\t\t\tmaxWidth=\"100%\"\n\t\t\tmaxHeight=\"100%\"\n\t\t\tenable={ {\n\t\t\t\tleft: enableResizing,\n\t\t\t\tright: enableResizing,\n\t\t\t} }\n\t\t\tshowHandle={ enableResizing }\n\t\t\t// The editor is centered horizontally, resizing it only\n\t\t\t// moves half the distance. Hence double the ratio to correctly\n\t\t\t// align the cursor to the resizer handle.\n\t\t\tresizeRatio={ 2 }\n\t\t\thandleComponent={ {\n\t\t\t\tleft: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"left\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t\tright: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"right\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t} }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t>\n\t\t\t{ children }\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableEditor;\n"],
5
+ "mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,aAAa,iBAAiB;AACvC,SAAS,QAAQ,aAAa,gBAAgB;AAC9C,SAAS,oBAAoB;AAK7B,OAAO,kBAAkB;AACzB,SAAS,SAAS,mBAAmB;AACrC,SAAS,cAAc;AA+GlB;AA5GL,IAAM,yBAAyB;AAAA,EAC9B,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AACP;AAUA,SAAS,aAAc,cAAc,gBAAgB,YAAY,GAAI;AACpE,SAAO,iBAAiB,KAAK,gBAAgB,iBAAiB;AAC/D;AAEA,SAAS,gBAAiB,EAAE,WAAW,gBAAgB,QAAQ,SAAS,GAAI;AAC3E,QAAM,CAAE,YAAY,aAAc,IAAI,SAAU,KAAM;AACtD,QAAM,EAAE,eAAe,IAAI,OAAQ,YAAa,WAAY,CAAE;AAC9D,QAAM,cAAc;AAAA,IACnB,CAAE,WAAY;AACb,UAAK,CAAE,gBAAiB;AACvB,eAAO;AAAA,MACR;AACA,YAAM,EAAE,eAAe,IAAI,OAAQ,OAAQ,WAAY,CAAE;AACzD,aAAO,eAAe;AAAA,IACv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,MACA,YAAa;AAAA,MAIb,aAAc;AAAA,MACd,iBAAkB;AAAA,QACjB,MACC;AAAA,UAAC;AAAA;AAAA,YACA,WAAU;AAAA,YACV;AAAA;AAAA,QACD;AAAA,QAED,OACC;AAAA,UAAC;AAAA;AAAA,YACA,WAAU;AAAA,YACV;AAAA;AAAA,QACD;AAAA,MAEF;AAAA,MACA,eAAgB;AAAA,MAChB,cAAe;AAAA,QACd,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,MAEE;AAAA;AAAA,EACH;AAEF;AAEA,IAAO,2BAAQ;",
6
6
  "names": []
7
7
  }
@@ -7,13 +7,14 @@ import { Stack } from "@wordpress/ui";
7
7
  import { useMemo } from "@wordpress/element";
8
8
  import { useViewConfig } from "@wordpress/views";
9
9
  import PostCardPanel from "../post-card-panel/index.mjs";
10
+ import PluginPostStatusInfo from "../plugin-post-status-info/index.mjs";
10
11
  import PostPanelSection from "../post-panel-section/index.mjs";
11
12
  import { store as editorStore } from "../../store/index.mjs";
12
13
  import PostTrash from "../post-trash/index.mjs";
13
14
  import usePostFields from "../post-fields/index.mjs";
14
15
  import { usePostTemplatePanelMode } from "../post-template/hooks.mjs";
15
16
  import revisionsField from "../../dataviews/fields/revisions/index.mjs";
16
- import { jsx, jsxs } from "react/jsx-runtime";
17
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
17
18
  var EMPTY_FORM = { layout: { type: "panel" }, fields: [] };
18
19
  var VIEW_CONFIG_FIELDS = ["form"];
19
20
  function useInspectorPanelVisibility(form) {
@@ -272,7 +273,10 @@ function DataFormPostSummary({ onActionPerformed }) {
272
273
  onChange
273
274
  }
274
275
  ),
275
- !isPostStatusRemoved && /* @__PURE__ */ jsx(PostTrash, { onActionPerformed })
276
+ !isPostStatusRemoved && /* @__PURE__ */ jsxs(Fragment, { children: [
277
+ /* @__PURE__ */ jsx(PluginPostStatusInfo.Slot, { children: (fills) => fills.length > 0 && /* @__PURE__ */ jsx(Stack, { direction: "column", gap: "xs", children: fills }) }),
278
+ /* @__PURE__ */ jsx(PostTrash, { onActionPerformed })
279
+ ] })
276
280
  ] }) });
277
281
  }
278
282
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/sidebar/dataform-post-summary.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { DataForm } from '@wordpress/dataviews';\nimport { Stack } from '@wordpress/ui';\nimport { useMemo } from '@wordpress/element';\nimport { useViewConfig } from '@wordpress/views';\n\n/**\n * Internal dependencies\n */\nimport PostCardPanel from '../post-card-panel';\nimport PostPanelSection from '../post-panel-section';\nimport { store as editorStore } from '../../store';\nimport PostTrash from '../post-trash';\nimport usePostFields from '../post-fields';\nimport { usePostTemplatePanelMode } from '../post-template/hooks';\nimport revisionsField from '../../dataviews/fields/revisions';\n\nconst EMPTY_FORM = { layout: { type: 'panel' }, fields: [] };\nconst VIEW_CONFIG_FIELDS = [ 'form' ];\n\n/**\n * Bridges the legacy editor-panel visibility controls onto the DataForm summary,\n * returning the form with the hidden fields removed. The new inspector has no\n * concept of the Preferences → Panels switches or of `removeEditorPanel`, so we\n * reproduce their effect on the form.\n *\n * @param {Object} form The DataForm summary form configuration.\n * @return {Object} The form with the hidden fields removed.\n */\nfunction useInspectorPanelVisibility( form ) {\n\tconst {\n\t\tisPostStatusRemoved,\n\t\tfeaturedImageEnabled,\n\t\texcerptEnabled,\n\t\tdiscussionEnabled,\n\t\tpageAttributesEnabled,\n\t} = useSelect( ( select ) => {\n\t\tconst { isEditorPanelRemoved, isEditorPanelEnabled } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tisPostStatusRemoved: isEditorPanelRemoved( 'post-status' ),\n\t\t\tfeaturedImageEnabled: isEditorPanelEnabled( 'featured-image' ),\n\t\t\texcerptEnabled: isEditorPanelEnabled( 'post-excerpt' ),\n\t\t\tdiscussionEnabled: isEditorPanelEnabled( 'discussion-panel' ),\n\t\t\tpageAttributesEnabled: isEditorPanelEnabled( 'page-attributes' ),\n\t\t};\n\t}, [] );\n\n\tconst visibleForm = useMemo( () => {\n\t\tif ( ! form.fields?.length ) {\n\t\t\treturn form;\n\t\t}\n\t\t// `featured_media`/`excerpt` are their own top-level panels and\n\t\t// `post-content-info` is always shown, so they survive. Everything else\n\t\t// belongs to the `post-status` summary panel: `discussion`/`parent` honor\n\t\t// their own switch, but every one of them is hidden while the `post-status`\n\t\t// panel is removed.\n\t\tconst visibilityById = {\n\t\t\tfeatured_media: featuredImageEnabled,\n\t\t\texcerpt: excerptEnabled,\n\t\t\t'post-content-info': true,\n\t\t\tdiscussion: discussionEnabled && ! isPostStatusRemoved,\n\t\t\tparent: pageAttributesEnabled && ! isPostStatusRemoved,\n\t\t};\n\t\tconst isFieldVisible = ( id ) =>\n\t\t\tid in visibilityById ? visibilityById[ id ] : ! isPostStatusRemoved;\n\t\t// Recurse into `children` so a panel-tied field is dropped wherever it\n\t\t// sits in the form: the PHP view-config filter can nest such a field\n\t\t// inside another field's group.\n\t\tconst filterFields = ( fields ) =>\n\t\t\tfields.reduce( ( acc, field ) => {\n\t\t\t\tconst id = typeof field === 'string' ? field : field.id;\n\t\t\t\tif ( ! isFieldVisible( id ) ) {\n\t\t\t\t\treturn acc;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\ttypeof field !== 'string' &&\n\t\t\t\t\tArray.isArray( field.children )\n\t\t\t\t) {\n\t\t\t\t\tconst children = filterFields( field.children );\n\t\t\t\t\t// A group whose children were all removed would render as\n\t\t\t\t\t// an empty panel, so drop it too.\n\t\t\t\t\tif ( ! children.length ) {\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t}\n\t\t\t\t\tacc.push( { ...field, children } );\n\t\t\t\t\treturn acc;\n\t\t\t\t}\n\t\t\t\tacc.push( field );\n\t\t\t\treturn acc;\n\t\t\t}, [] );\n\t\treturn { ...form, fields: filterFields( form.fields ) };\n\t}, [\n\t\tform,\n\t\tisPostStatusRemoved,\n\t\tfeaturedImageEnabled,\n\t\texcerptEnabled,\n\t\tdiscussionEnabled,\n\t\tpageAttributesEnabled,\n\t] );\n\n\treturn visibleForm;\n}\n\n// Some post types expose summary fields that edit entities other than the one\n// being edited. Keyed by the post type that needs them, the related records are\n// merged into the form data under a `${ kind }_${ name }` namespace key so that\n// a single DataForm can read and write all of them, and edits to those keys are\n// routed back to their entity.\n//\n// The fields themselves are namespace-agnostic: they read and write a plain\n// record. The `fields` list ties each one to the entity it edits, and this\n// component overrides their `getValue`/`setValue`/`render` to operate on the\n// namespaced record, plus their `isVisible` to only show where that record is\n// present (e.g. the `home`/`index` template summary).\n//\n// Currently only `wp_template` uses this: `posts_per_page` and\n// `default_comment_status` target `root/site`, and `posts_page_title` targets\n// the posts page (the `page` assigned as `page_for_posts`).\nconst ENTITIES = {\n\twp_template: {\n\t\troot_site: {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t\tfields: [ 'posts_per_page', 'default_comment_status' ],\n\t\t\tisVisible: ( item ) =>\n\t\t\t\t[ 'home', 'index' ].includes( item.slug ?? '' ),\n\t\t},\n\t\tposttype_page: {\n\t\t\tkind: 'postType',\n\t\t\tname: 'page',\n\t\t\tgetId: ( select ) =>\n\t\t\t\tselect( coreDataStore ).getEditedEntityRecord( 'root', 'site' )\n\t\t\t\t\t?.page_for_posts,\n\t\t\tfields: [ 'posts_page_title' ],\n\t\t\tisVisible: ( item ) =>\n\t\t\t\t[ 'home', 'index' ].includes( item.slug ?? '' ),\n\t\t},\n\t},\n};\n\n// Rebinds a namespace-agnostic field to the namespaced record it edits. Every\n// field callback that receives the form `item` is redirected to the\n// `item[ namespace ]` sub-record so the field operates on its own entity:\n// `getValue`/`setValue`/`render` here, and the rest indirectly because they all\n// funnel through the (remapped) `getValue` (default `render`, `getValueFormatted`\n// and `isValid` range/`custom` validation). Edits are wrapped back under the\n// namespace key. The caller-supplied `isVisible` encodes entity-specific\n// conditions (e.g. only for `home`/`index` templates); the generic guard\n// `!! item[ namespace ]` ensures the field is hidden when the sub-record\n// hasn't been fetched.\nfunction bindFieldToNamespace( field, namespace, isVisible = () => true ) {\n\tconst subItem = ( item ) => item?.[ namespace ] ?? {};\n\treturn {\n\t\t...field,\n\t\tgetValue: ( { item } ) =>\n\t\t\tfield.getValue\n\t\t\t\t? field.getValue( { item: subItem( item ) } )\n\t\t\t\t: subItem( item )[ field.id ],\n\t\tsetValue: ( { item, value } ) => ( {\n\t\t\t[ namespace ]: field.setValue( { item: subItem( item ), value } ),\n\t\t} ),\n\t\trender: field.render\n\t\t\t? ( props ) =>\n\t\t\t\t\tfield.render( { ...props, item: subItem( props.item ) } )\n\t\t\t: undefined,\n\t\tisVisible: ( item ) => isVisible( item ) && !! item[ namespace ],\n\t};\n}\n\nexport default function DataFormPostSummary( { onActionPerformed } ) {\n\tconst { postType, postId, isPostStatusRemoved, availableTemplates } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\tisEditorPanelRemoved,\n\t\t\t\tgetEditorSettings,\n\t\t\t} = select( editorStore );\n\t\t\tconst _availableTemplates = select(\n\t\t\t\tcoreDataStore\n\t\t\t).getCurrentTheme()?.is_block_theme\n\t\t\t\t? null\n\t\t\t\t: getEditorSettings().availableTemplates ?? null;\n\t\t\treturn {\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t\tpostId: getCurrentPostId(),\n\t\t\t\tisPostStatusRemoved: isEditorPanelRemoved( 'post-status' ),\n\t\t\t\tavailableTemplates: _availableTemplates,\n\t\t\t};\n\t\t}, [] );\n\tconst { form: formConfig } = useViewConfig( {\n\t\tkind: 'postType',\n\t\tname: postType,\n\t\tfields: VIEW_CONFIG_FIELDS,\n\t} );\n\t// Bridge the legacy editor-panel visibility (Preferences → Panels and\n\t// programmatic panel removal) onto the form by dropping hidden fields.\n\tconst form = useInspectorPanelVisibility( formConfig ?? EMPTY_FORM );\n\tconst record = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! postType || ! postId ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn select( coreDataStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst templatePanelMode = usePostTemplatePanelMode();\n\n\tconst entityRecords = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, canUser } = select( coreDataStore );\n\n\t\t\tconst records = {};\n\n\t\t\t// Other entities the current post type needs merged into its form.\n\t\t\tfor ( const [ namespace, entity ] of Object.entries(\n\t\t\t\tENTITIES[ postType ] ?? {}\n\t\t\t) ) {\n\t\t\t\tif (\n\t\t\t\t\t! canUser( 'read', {\n\t\t\t\t\t\tkind: entity.kind,\n\t\t\t\t\t\tname: entity.name,\n\t\t\t\t\t} )\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst id = entity.getId ? entity.getId( select ) : undefined;\n\t\t\t\t// Entities resolved through another record need a valid id.\n\t\t\t\tif ( entity.getId && ! id ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\trecords[ namespace ] = getEditedEntityRecord(\n\t\t\t\t\tentity.kind,\n\t\t\t\t\tentity.name,\n\t\t\t\t\tid\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn records;\n\t\t},\n\t\t[ postType ]\n\t);\n\n\t// Merge the supplementary data onto the record.\n\tconst data = useMemo( () => {\n\t\tif ( ! record ) {\n\t\t\treturn record;\n\t\t}\n\t\tconst extra = { ...entityRecords };\n\t\tif ( availableTemplates && Object.keys( availableTemplates ).length ) {\n\t\t\textra.available_templates = availableTemplates;\n\t\t}\n\t\treturn { ...record, ...extra };\n\t}, [ record, entityRecords, availableTemplates ] );\n\n\tconst { editEntityRecord } = useDispatch( coreDataStore );\n\tconst registry = useRegistry();\n\n\t// Map of namespaced field id to the namespace key its entity is merged under.\n\tconst fieldNamespaces = useMemo( () => {\n\t\tconst map = {};\n\t\tfor ( const [ namespace, entity ] of Object.entries(\n\t\t\tENTITIES[ postType ] ?? {}\n\t\t) ) {\n\t\t\tfor ( const id of entity.fields ?? [] ) {\n\t\t\t\tmap[ id ] = namespace;\n\t\t\t}\n\t\t}\n\t\treturn map;\n\t}, [ postType ] );\n\n\tconst _fields = usePostFields( { postType } );\n\tconst fields = useMemo(\n\t\t() =>\n\t\t\t_fields\n\t\t\t\t?.map( ( field ) => {\n\t\t\t\t\tconst namespace = fieldNamespaces[ field.id ];\n\t\t\t\t\tif ( namespace ) {\n\t\t\t\t\t\treturn bindFieldToNamespace(\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tnamespace,\n\t\t\t\t\t\t\tENTITIES[ postType ]?.[ namespace ]?.isVisible\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif ( field.id === 'status' ) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...field,\n\t\t\t\t\t\t\telements: field.elements.filter(\n\t\t\t\t\t\t\t\t( element ) => element.value !== 'trash'\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\tif ( field.id === 'template' ) {\n\t\t\t\t\t\t// `usePostTemplatePanelMode` is reused in the Post Template panel to match\n\t\t\t\t\t\t// the existing behavior. If the panel rendered nothing we should exclude the\n\t\t\t\t\t\t// template field from the form.\n\t\t\t\t\t\tif ( ! templatePanelMode ) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// In classic themes without available templates we need to make the field read-only.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttemplatePanelMode === 'classic' &&\n\t\t\t\t\t\t\tObject.keys( availableTemplates ?? {} ).length === 0\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...field,\n\t\t\t\t\t\t\t\treadOnly: true,\n\t\t\t\t\t\t\t\trender: () => __( 'Default template' ),\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn field;\n\t\t\t\t\t}\n\t\t\t\t\treturn field;\n\t\t\t\t} )\n\t\t\t\t.filter( Boolean )\n\t\t\t\t// Editor-only field, injected here rather than registered\n\t\t\t\t// so it never leaks into the site editor list / quick-edit fields.\n\t\t\t\t.concat( revisionsField ),\n\t\t[\n\t\t\t_fields,\n\t\t\ttemplatePanelMode,\n\t\t\tavailableTemplates,\n\t\t\tfieldNamespaces,\n\t\t\tpostType,\n\t\t]\n\t);\n\n\tconst onChange = ( edits ) => {\n\t\t// Route edits that target another entity (merged in under a namespace)\n\t\t// back to that entity; collect the rest for the post being edited.\n\t\tconst entities = ENTITIES[ postType ] ?? {};\n\t\tconst baseEdits = {};\n\t\tfor ( const [ key, value ] of Object.entries( edits ) ) {\n\t\t\tconst entity = entities[ key ];\n\t\t\tif ( entity ) {\n\t\t\t\t// Resolve the id the same way it was resolved to read the\n\t\t\t\t// record, so the save targets the right entity regardless of\n\t\t\t\t// its key field (`undefined` for the `root/site` singleton).\n\t\t\t\tconst id = entity.getId\n\t\t\t\t\t? entity.getId( registry.select )\n\t\t\t\t\t: undefined;\n\t\t\t\teditEntityRecord( entity.kind, entity.name, id, value );\n\t\t\t} else {\n\t\t\t\tbaseEdits[ key ] = value;\n\t\t\t}\n\t\t}\n\n\t\tif ( ! Object.keys( baseEdits ).length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tbaseEdits.status &&\n\t\t\tbaseEdits.status !== 'future' &&\n\t\t\trecord?.status === 'future' &&\n\t\t\tnew Date( record.date ) > new Date()\n\t\t) {\n\t\t\tbaseEdits.date = null;\n\t\t}\n\t\tif (\n\t\t\tbaseEdits.status &&\n\t\t\tbaseEdits.status === 'private' &&\n\t\t\trecord?.password\n\t\t) {\n\t\t\tbaseEdits.password = '';\n\t\t}\n\n\t\teditEntityRecord( 'postType', postType, postId, baseEdits );\n\t};\n\treturn (\n\t\t<PostPanelSection className=\"editor-post-summary\">\n\t\t\t<Stack direction=\"column\" gap=\"lg\">\n\t\t\t\t<PostCardPanel\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tpostId={ postId }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t/>\n\t\t\t\t<DataForm\n\t\t\t\t\tdata={ data }\n\t\t\t\t\tfields={ fields }\n\t\t\t\t\tform={ form }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t\t{ ! isPostStatusRemoved && (\n\t\t\t\t\t<PostTrash onActionPerformed={ onActionPerformed } />\n\t\t\t\t) }\n\t\t\t</Stack>\n\t\t</PostPanelSection>\n\t);\n}\n"],
5
- "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,aAAa,WAAW,mBAAmB;AACpD,SAAS,SAAS,qBAAqB;AACvC,SAAS,gBAAgB;AACzB,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAK9B,OAAO,mBAAmB;AAC1B,OAAO,sBAAsB;AAC7B,SAAS,SAAS,mBAAmB;AACrC,OAAO,eAAe;AACtB,OAAO,mBAAmB;AAC1B,SAAS,gCAAgC;AACzC,OAAO,oBAAoB;AA2WxB,SACC,KADD;AAzWH,IAAM,aAAa,EAAE,QAAQ,EAAE,MAAM,QAAQ,GAAG,QAAQ,CAAC,EAAE;AAC3D,IAAM,qBAAqB,CAAE,MAAO;AAWpC,SAAS,4BAA6B,MAAO;AAC5C,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI,UAAW,CAAE,WAAY;AAC5B,UAAM,EAAE,sBAAsB,qBAAqB,IAClD,OAAQ,WAAY;AACrB,WAAO;AAAA,MACN,qBAAqB,qBAAsB,aAAc;AAAA,M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,QACA;AAAA;AAAA,IACD;AAAA,IACE,CAAE,uBACH,oBAAC,aAAU,mBAAwC;AAAA,KAErD,GACD;AAEF;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { DataForm } from '@wordpress/dataviews';\nimport { Stack } from '@wordpress/ui';\nimport { useMemo } from '@wordpress/element';\nimport { useViewConfig } from '@wordpress/views';\n\n/**\n * Internal dependencies\n */\nimport PostCardPanel from '../post-card-panel';\nimport PluginPostStatusInfo from '../plugin-post-status-info';\nimport PostPanelSection from '../post-panel-section';\nimport { store as editorStore } from '../../store';\nimport PostTrash from '../post-trash';\nimport usePostFields from '../post-fields';\nimport { usePostTemplatePanelMode } from '../post-template/hooks';\nimport revisionsField from '../../dataviews/fields/revisions';\n\nconst EMPTY_FORM = { layout: { type: 'panel' }, fields: [] };\nconst VIEW_CONFIG_FIELDS = [ 'form' ];\n\n/**\n * Bridges the legacy editor-panel visibility controls onto the DataForm summary,\n * returning the form with the hidden fields removed. The new inspector has no\n * concept of the Preferences → Panels switches or of `removeEditorPanel`, so we\n * reproduce their effect on the form.\n *\n * @param {Object} form The DataForm summary form configuration.\n * @return {Object} The form with the hidden fields removed.\n */\nfunction useInspectorPanelVisibility( form ) {\n\tconst {\n\t\tisPostStatusRemoved,\n\t\tfeaturedImageEnabled,\n\t\texcerptEnabled,\n\t\tdiscussionEnabled,\n\t\tpageAttributesEnabled,\n\t} = useSelect( ( select ) => {\n\t\tconst { isEditorPanelRemoved, isEditorPanelEnabled } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tisPostStatusRemoved: isEditorPanelRemoved( 'post-status' ),\n\t\t\tfeaturedImageEnabled: isEditorPanelEnabled( 'featured-image' ),\n\t\t\texcerptEnabled: isEditorPanelEnabled( 'post-excerpt' ),\n\t\t\tdiscussionEnabled: isEditorPanelEnabled( 'discussion-panel' ),\n\t\t\tpageAttributesEnabled: isEditorPanelEnabled( 'page-attributes' ),\n\t\t};\n\t}, [] );\n\n\tconst visibleForm = useMemo( () => {\n\t\tif ( ! form.fields?.length ) {\n\t\t\treturn form;\n\t\t}\n\t\t// `featured_media`/`excerpt` are their own top-level panels and\n\t\t// `post-content-info` is always shown, so they survive. Everything else\n\t\t// belongs to the `post-status` summary panel: `discussion`/`parent` honor\n\t\t// their own switch, but every one of them is hidden while the `post-status`\n\t\t// panel is removed.\n\t\tconst visibilityById = {\n\t\t\tfeatured_media: featuredImageEnabled,\n\t\t\texcerpt: excerptEnabled,\n\t\t\t'post-content-info': true,\n\t\t\tdiscussion: discussionEnabled && ! isPostStatusRemoved,\n\t\t\tparent: pageAttributesEnabled && ! isPostStatusRemoved,\n\t\t};\n\t\tconst isFieldVisible = ( id ) =>\n\t\t\tid in visibilityById ? visibilityById[ id ] : ! isPostStatusRemoved;\n\t\t// Recurse into `children` so a panel-tied field is dropped wherever it\n\t\t// sits in the form: the PHP view-config filter can nest such a field\n\t\t// inside another field's group.\n\t\tconst filterFields = ( fields ) =>\n\t\t\tfields.reduce( ( acc, field ) => {\n\t\t\t\tconst id = typeof field === 'string' ? field : field.id;\n\t\t\t\tif ( ! isFieldVisible( id ) ) {\n\t\t\t\t\treturn acc;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\ttypeof field !== 'string' &&\n\t\t\t\t\tArray.isArray( field.children )\n\t\t\t\t) {\n\t\t\t\t\tconst children = filterFields( field.children );\n\t\t\t\t\t// A group whose children were all removed would render as\n\t\t\t\t\t// an empty panel, so drop it too.\n\t\t\t\t\tif ( ! children.length ) {\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t}\n\t\t\t\t\tacc.push( { ...field, children } );\n\t\t\t\t\treturn acc;\n\t\t\t\t}\n\t\t\t\tacc.push( field );\n\t\t\t\treturn acc;\n\t\t\t}, [] );\n\t\treturn { ...form, fields: filterFields( form.fields ) };\n\t}, [\n\t\tform,\n\t\tisPostStatusRemoved,\n\t\tfeaturedImageEnabled,\n\t\texcerptEnabled,\n\t\tdiscussionEnabled,\n\t\tpageAttributesEnabled,\n\t] );\n\n\treturn visibleForm;\n}\n\n// Some post types expose summary fields that edit entities other than the one\n// being edited. Keyed by the post type that needs them, the related records are\n// merged into the form data under a `${ kind }_${ name }` namespace key so that\n// a single DataForm can read and write all of them, and edits to those keys are\n// routed back to their entity.\n//\n// The fields themselves are namespace-agnostic: they read and write a plain\n// record. The `fields` list ties each one to the entity it edits, and this\n// component overrides their `getValue`/`setValue`/`render` to operate on the\n// namespaced record, plus their `isVisible` to only show where that record is\n// present (e.g. the `home`/`index` template summary).\n//\n// Currently only `wp_template` uses this: `posts_per_page` and\n// `default_comment_status` target `root/site`, and `posts_page_title` targets\n// the posts page (the `page` assigned as `page_for_posts`).\nconst ENTITIES = {\n\twp_template: {\n\t\troot_site: {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t\tfields: [ 'posts_per_page', 'default_comment_status' ],\n\t\t\tisVisible: ( item ) =>\n\t\t\t\t[ 'home', 'index' ].includes( item.slug ?? '' ),\n\t\t},\n\t\tposttype_page: {\n\t\t\tkind: 'postType',\n\t\t\tname: 'page',\n\t\t\tgetId: ( select ) =>\n\t\t\t\tselect( coreDataStore ).getEditedEntityRecord( 'root', 'site' )\n\t\t\t\t\t?.page_for_posts,\n\t\t\tfields: [ 'posts_page_title' ],\n\t\t\tisVisible: ( item ) =>\n\t\t\t\t[ 'home', 'index' ].includes( item.slug ?? '' ),\n\t\t},\n\t},\n};\n\n// Rebinds a namespace-agnostic field to the namespaced record it edits. Every\n// field callback that receives the form `item` is redirected to the\n// `item[ namespace ]` sub-record so the field operates on its own entity:\n// `getValue`/`setValue`/`render` here, and the rest indirectly because they all\n// funnel through the (remapped) `getValue` (default `render`, `getValueFormatted`\n// and `isValid` range/`custom` validation). Edits are wrapped back under the\n// namespace key. The caller-supplied `isVisible` encodes entity-specific\n// conditions (e.g. only for `home`/`index` templates); the generic guard\n// `!! item[ namespace ]` ensures the field is hidden when the sub-record\n// hasn't been fetched.\nfunction bindFieldToNamespace( field, namespace, isVisible = () => true ) {\n\tconst subItem = ( item ) => item?.[ namespace ] ?? {};\n\treturn {\n\t\t...field,\n\t\tgetValue: ( { item } ) =>\n\t\t\tfield.getValue\n\t\t\t\t? field.getValue( { item: subItem( item ) } )\n\t\t\t\t: subItem( item )[ field.id ],\n\t\tsetValue: ( { item, value } ) => ( {\n\t\t\t[ namespace ]: field.setValue( { item: subItem( item ), value } ),\n\t\t} ),\n\t\trender: field.render\n\t\t\t? ( props ) =>\n\t\t\t\t\tfield.render( { ...props, item: subItem( props.item ) } )\n\t\t\t: undefined,\n\t\tisVisible: ( item ) => isVisible( item ) && !! item[ namespace ],\n\t};\n}\n\nexport default function DataFormPostSummary( { onActionPerformed } ) {\n\tconst { postType, postId, isPostStatusRemoved, availableTemplates } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\tisEditorPanelRemoved,\n\t\t\t\tgetEditorSettings,\n\t\t\t} = select( editorStore );\n\t\t\tconst _availableTemplates = select(\n\t\t\t\tcoreDataStore\n\t\t\t).getCurrentTheme()?.is_block_theme\n\t\t\t\t? null\n\t\t\t\t: getEditorSettings().availableTemplates ?? null;\n\t\t\treturn {\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t\tpostId: getCurrentPostId(),\n\t\t\t\tisPostStatusRemoved: isEditorPanelRemoved( 'post-status' ),\n\t\t\t\tavailableTemplates: _availableTemplates,\n\t\t\t};\n\t\t}, [] );\n\tconst { form: formConfig } = useViewConfig( {\n\t\tkind: 'postType',\n\t\tname: postType,\n\t\tfields: VIEW_CONFIG_FIELDS,\n\t} );\n\t// Bridge the legacy editor-panel visibility (Preferences → Panels and\n\t// programmatic panel removal) onto the form by dropping hidden fields.\n\tconst form = useInspectorPanelVisibility( formConfig ?? EMPTY_FORM );\n\tconst record = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! postType || ! postId ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn select( coreDataStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst templatePanelMode = usePostTemplatePanelMode();\n\n\tconst entityRecords = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, canUser } = select( coreDataStore );\n\n\t\t\tconst records = {};\n\n\t\t\t// Other entities the current post type needs merged into its form.\n\t\t\tfor ( const [ namespace, entity ] of Object.entries(\n\t\t\t\tENTITIES[ postType ] ?? {}\n\t\t\t) ) {\n\t\t\t\tif (\n\t\t\t\t\t! canUser( 'read', {\n\t\t\t\t\t\tkind: entity.kind,\n\t\t\t\t\t\tname: entity.name,\n\t\t\t\t\t} )\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst id = entity.getId ? entity.getId( select ) : undefined;\n\t\t\t\t// Entities resolved through another record need a valid id.\n\t\t\t\tif ( entity.getId && ! id ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\trecords[ namespace ] = getEditedEntityRecord(\n\t\t\t\t\tentity.kind,\n\t\t\t\t\tentity.name,\n\t\t\t\t\tid\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn records;\n\t\t},\n\t\t[ postType ]\n\t);\n\n\t// Merge the supplementary data onto the record.\n\tconst data = useMemo( () => {\n\t\tif ( ! record ) {\n\t\t\treturn record;\n\t\t}\n\t\tconst extra = { ...entityRecords };\n\t\tif ( availableTemplates && Object.keys( availableTemplates ).length ) {\n\t\t\textra.available_templates = availableTemplates;\n\t\t}\n\t\treturn { ...record, ...extra };\n\t}, [ record, entityRecords, availableTemplates ] );\n\n\tconst { editEntityRecord } = useDispatch( coreDataStore );\n\tconst registry = useRegistry();\n\n\t// Map of namespaced field id to the namespace key its entity is merged under.\n\tconst fieldNamespaces = useMemo( () => {\n\t\tconst map = {};\n\t\tfor ( const [ namespace, entity ] of Object.entries(\n\t\t\tENTITIES[ postType ] ?? {}\n\t\t) ) {\n\t\t\tfor ( const id of entity.fields ?? [] ) {\n\t\t\t\tmap[ id ] = namespace;\n\t\t\t}\n\t\t}\n\t\treturn map;\n\t}, [ postType ] );\n\n\tconst _fields = usePostFields( { postType } );\n\tconst fields = useMemo(\n\t\t() =>\n\t\t\t_fields\n\t\t\t\t?.map( ( field ) => {\n\t\t\t\t\tconst namespace = fieldNamespaces[ field.id ];\n\t\t\t\t\tif ( namespace ) {\n\t\t\t\t\t\treturn bindFieldToNamespace(\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tnamespace,\n\t\t\t\t\t\t\tENTITIES[ postType ]?.[ namespace ]?.isVisible\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif ( field.id === 'status' ) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...field,\n\t\t\t\t\t\t\telements: field.elements.filter(\n\t\t\t\t\t\t\t\t( element ) => element.value !== 'trash'\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\tif ( field.id === 'template' ) {\n\t\t\t\t\t\t// `usePostTemplatePanelMode` is reused in the Post Template panel to match\n\t\t\t\t\t\t// the existing behavior. If the panel rendered nothing we should exclude the\n\t\t\t\t\t\t// template field from the form.\n\t\t\t\t\t\tif ( ! templatePanelMode ) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// In classic themes without available templates we need to make the field read-only.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttemplatePanelMode === 'classic' &&\n\t\t\t\t\t\t\tObject.keys( availableTemplates ?? {} ).length === 0\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...field,\n\t\t\t\t\t\t\t\treadOnly: true,\n\t\t\t\t\t\t\t\trender: () => __( 'Default template' ),\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn field;\n\t\t\t\t\t}\n\t\t\t\t\treturn field;\n\t\t\t\t} )\n\t\t\t\t.filter( Boolean )\n\t\t\t\t// Editor-only field, injected here rather than registered\n\t\t\t\t// so it never leaks into the site editor list / quick-edit fields.\n\t\t\t\t.concat( revisionsField ),\n\t\t[\n\t\t\t_fields,\n\t\t\ttemplatePanelMode,\n\t\t\tavailableTemplates,\n\t\t\tfieldNamespaces,\n\t\t\tpostType,\n\t\t]\n\t);\n\n\tconst onChange = ( edits ) => {\n\t\t// Route edits that target another entity (merged in under a namespace)\n\t\t// back to that entity; collect the rest for the post being edited.\n\t\tconst entities = ENTITIES[ postType ] ?? {};\n\t\tconst baseEdits = {};\n\t\tfor ( const [ key, value ] of Object.entries( edits ) ) {\n\t\t\tconst entity = entities[ key ];\n\t\t\tif ( entity ) {\n\t\t\t\t// Resolve the id the same way it was resolved to read the\n\t\t\t\t// record, so the save targets the right entity regardless of\n\t\t\t\t// its key field (`undefined` for the `root/site` singleton).\n\t\t\t\tconst id = entity.getId\n\t\t\t\t\t? entity.getId( registry.select )\n\t\t\t\t\t: undefined;\n\t\t\t\teditEntityRecord( entity.kind, entity.name, id, value );\n\t\t\t} else {\n\t\t\t\tbaseEdits[ key ] = value;\n\t\t\t}\n\t\t}\n\n\t\tif ( ! Object.keys( baseEdits ).length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tbaseEdits.status &&\n\t\t\tbaseEdits.status !== 'future' &&\n\t\t\trecord?.status === 'future' &&\n\t\t\tnew Date( record.date ) > new Date()\n\t\t) {\n\t\t\tbaseEdits.date = null;\n\t\t}\n\t\tif (\n\t\t\tbaseEdits.status &&\n\t\t\tbaseEdits.status === 'private' &&\n\t\t\trecord?.password\n\t\t) {\n\t\t\tbaseEdits.password = '';\n\t\t}\n\n\t\teditEntityRecord( 'postType', postType, postId, baseEdits );\n\t};\n\treturn (\n\t\t<PostPanelSection className=\"editor-post-summary\">\n\t\t\t<Stack direction=\"column\" gap=\"lg\">\n\t\t\t\t<PostCardPanel\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tpostId={ postId }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t/>\n\t\t\t\t<DataForm\n\t\t\t\t\tdata={ data }\n\t\t\t\t\tfields={ fields }\n\t\t\t\t\tform={ form }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t\t{ ! isPostStatusRemoved && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PluginPostStatusInfo.Slot>\n\t\t\t\t\t\t\t{ ( fills ) =>\n\t\t\t\t\t\t\t\tfills.length > 0 && (\n\t\t\t\t\t\t\t\t\t<Stack direction=\"column\" gap=\"xs\">\n\t\t\t\t\t\t\t\t\t\t{ fills }\n\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</PluginPostStatusInfo.Slot>\n\t\t\t\t\t\t<PostTrash onActionPerformed={ onActionPerformed } />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</Stack>\n\t\t</PostPanelSection>\n\t);\n}\n"],
5
+ "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,aAAa,WAAW,mBAAmB;AACpD,SAAS,SAAS,qBAAqB;AACvC,SAAS,gBAAgB;AACzB,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAK9B,OAAO,mBAAmB;AAC1B,OAAO,0BAA0B;AACjC,OAAO,sBAAsB;AAC7B,SAAS,SAAS,mBAAmB;AACrC,OAAO,eAAe;AACtB,OAAO,mBAAmB;AAC1B,SAAS,gCAAgC;AACzC,OAAO,oBAAoB;AA4WvB,SAYC,UAZD,KAYC,YAZD;AA1WJ,IAAM,aAAa,EAAE,QAAQ,E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