@wordpress/edit-site 6.12.0 → 6.12.1-next.082ed6819.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 (221) hide show
  1. package/build/components/add-new-template/utils.js +1 -2
  2. package/build/components/add-new-template/utils.js.map +1 -1
  3. package/build/components/app/index.js +0 -3
  4. package/build/components/app/index.js.map +1 -1
  5. package/build/components/block-editor/use-site-editor-settings.js +4 -12
  6. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  7. package/build/components/editor/index.js +18 -27
  8. package/build/components/editor/index.js.map +1 -1
  9. package/build/components/editor/use-editor-title.js +13 -5
  10. package/build/components/editor/use-editor-title.js.map +1 -1
  11. package/build/components/editor/use-resolve-edited-entity.js +133 -0
  12. package/build/components/editor/use-resolve-edited-entity.js.map +1 -0
  13. package/build/components/editor-canvas-container/index.js +1 -1
  14. package/build/components/editor-canvas-container/index.js.map +1 -1
  15. package/build/components/global-styles/block-preview-panel.js +8 -10
  16. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  17. package/build/components/global-styles/screen-block.js +18 -5
  18. package/build/components/global-styles/screen-block.js.map +1 -1
  19. package/build/components/global-styles/screen-style-variations.js +11 -5
  20. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  21. package/build/components/global-styles/ui.js.map +1 -1
  22. package/build/components/global-styles-sidebar/index.js +17 -1
  23. package/build/components/global-styles-sidebar/index.js.map +1 -1
  24. package/build/components/page-patterns/header.js +2 -2
  25. package/build/components/page-patterns/header.js.map +1 -1
  26. package/build/components/page-patterns/use-patterns.js +4 -8
  27. package/build/components/page-patterns/use-patterns.js.map +1 -1
  28. package/build/components/post-edit/index.js +10 -12
  29. package/build/components/post-edit/index.js.map +1 -1
  30. package/build/components/post-list/index.js +3 -3
  31. package/build/components/post-list/index.js.map +1 -1
  32. package/build/components/posts-app/index.js +3 -4
  33. package/build/components/posts-app/index.js.map +1 -1
  34. package/build/components/posts-app-routes/home.js +48 -0
  35. package/build/components/posts-app-routes/home.js.map +1 -0
  36. package/build/components/posts-app-routes/index.js +37 -0
  37. package/build/components/posts-app-routes/index.js.map +1 -0
  38. package/build/components/posts-app-routes/posts-edit.js +44 -0
  39. package/build/components/posts-app-routes/posts-edit.js.map +1 -0
  40. package/build/components/posts-app-routes/posts-list-view-quick-edit.js +63 -0
  41. package/build/components/posts-app-routes/posts-list-view-quick-edit.js.map +1 -0
  42. package/build/components/posts-app-routes/posts-list-view.js +48 -0
  43. package/build/components/posts-app-routes/posts-list-view.js.map +1 -0
  44. package/build/components/posts-app-routes/posts-view-quick-edit.js +60 -0
  45. package/build/components/posts-app-routes/posts-view-quick-edit.js.map +1 -0
  46. package/build/components/posts-app-routes/posts-view.js +41 -0
  47. package/build/components/posts-app-routes/posts-view.js.map +1 -0
  48. package/build/components/sidebar-navigation-screen-details-footer/index.js +17 -23
  49. package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  50. package/build/components/sidebar-navigation-screen-global-styles/index.js +4 -18
  51. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  52. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
  53. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  54. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +2 -3
  55. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
  56. package/build/components/site-editor-routes/index.js +1 -2
  57. package/build/components/site-editor-routes/index.js.map +1 -1
  58. package/build/components/style-book/examples.js +24 -2
  59. package/build/components/style-book/examples.js.map +1 -1
  60. package/build/index.js +0 -9
  61. package/build/index.js.map +1 -1
  62. package/build/store/actions.js +13 -0
  63. package/build/store/actions.js.map +1 -1
  64. package/build/store/selectors.js +21 -1
  65. package/build/store/selectors.js.map +1 -1
  66. package/build-module/components/add-new-template/utils.js +1 -2
  67. package/build-module/components/add-new-template/utils.js.map +1 -1
  68. package/build-module/components/app/index.js +0 -3
  69. package/build-module/components/app/index.js.map +1 -1
  70. package/build-module/components/block-editor/use-site-editor-settings.js +4 -12
  71. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  72. package/build-module/components/editor/index.js +18 -27
  73. package/build-module/components/editor/index.js.map +1 -1
  74. package/build-module/components/editor/use-editor-title.js +13 -5
  75. package/build-module/components/editor/use-editor-title.js.map +1 -1
  76. package/build-module/components/editor/use-resolve-edited-entity.js +125 -0
  77. package/build-module/components/editor/use-resolve-edited-entity.js.map +1 -0
  78. package/build-module/components/editor-canvas-container/index.js +1 -1
  79. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  80. package/build-module/components/global-styles/block-preview-panel.js +8 -10
  81. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  82. package/build-module/components/global-styles/screen-block.js +18 -5
  83. package/build-module/components/global-styles/screen-block.js.map +1 -1
  84. package/build-module/components/global-styles/screen-style-variations.js +11 -5
  85. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  86. package/build-module/components/global-styles/ui.js +1 -1
  87. package/build-module/components/global-styles/ui.js.map +1 -1
  88. package/build-module/components/global-styles-sidebar/index.js +18 -2
  89. package/build-module/components/global-styles-sidebar/index.js.map +1 -1
  90. package/build-module/components/page-patterns/header.js +2 -2
  91. package/build-module/components/page-patterns/header.js.map +1 -1
  92. package/build-module/components/page-patterns/use-patterns.js +4 -8
  93. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  94. package/build-module/components/post-edit/index.js +9 -11
  95. package/build-module/components/post-edit/index.js.map +1 -1
  96. package/build-module/components/post-list/index.js +2 -2
  97. package/build-module/components/post-list/index.js.map +1 -1
  98. package/build-module/components/posts-app/index.js +3 -4
  99. package/build-module/components/posts-app/index.js.map +1 -1
  100. package/build-module/components/posts-app-routes/home.js +40 -0
  101. package/build-module/components/posts-app-routes/home.js.map +1 -0
  102. package/build-module/components/posts-app-routes/index.js +30 -0
  103. package/build-module/components/posts-app-routes/index.js.map +1 -0
  104. package/build-module/components/posts-app-routes/posts-edit.js +36 -0
  105. package/build-module/components/posts-app-routes/posts-edit.js.map +1 -0
  106. package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js +55 -0
  107. package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js.map +1 -0
  108. package/build-module/components/posts-app-routes/posts-list-view.js +40 -0
  109. package/build-module/components/posts-app-routes/posts-list-view.js.map +1 -0
  110. package/build-module/components/posts-app-routes/posts-view-quick-edit.js +52 -0
  111. package/build-module/components/posts-app-routes/posts-view-quick-edit.js.map +1 -0
  112. package/build-module/components/posts-app-routes/posts-view.js +33 -0
  113. package/build-module/components/posts-app-routes/posts-view.js.map +1 -0
  114. package/build-module/components/sidebar-navigation-screen-details-footer/index.js +20 -26
  115. package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  116. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +4 -18
  117. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  118. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
  119. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  120. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +3 -4
  121. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
  122. package/build-module/components/site-editor-routes/index.js +1 -2
  123. package/build-module/components/site-editor-routes/index.js.map +1 -1
  124. package/build-module/components/style-book/examples.js +24 -2
  125. package/build-module/components/style-book/examples.js.map +1 -1
  126. package/build-module/index.js +1 -10
  127. package/build-module/index.js.map +1 -1
  128. package/build-module/store/actions.js +13 -0
  129. package/build-module/store/actions.js.map +1 -1
  130. package/build-module/store/selectors.js +21 -1
  131. package/build-module/store/selectors.js.map +1 -1
  132. package/build-style/posts-rtl.css +59 -18
  133. package/build-style/posts.css +59 -18
  134. package/build-style/style-rtl.css +74 -57
  135. package/build-style/style.css +74 -57
  136. package/package.json +38 -38
  137. package/src/components/add-new-template/utils.js +2 -2
  138. package/src/components/app/index.js +0 -3
  139. package/src/components/block-editor/use-site-editor-settings.js +7 -21
  140. package/src/components/editor/index.js +22 -33
  141. package/src/components/editor/use-editor-title.js +17 -4
  142. package/src/components/editor/use-resolve-edited-entity.js +132 -0
  143. package/src/components/editor-canvas-container/index.js +1 -1
  144. package/src/components/global-styles/block-preview-panel.js +10 -10
  145. package/src/components/global-styles/screen-block.js +26 -8
  146. package/src/components/global-styles/screen-style-variations.js +14 -5
  147. package/src/components/global-styles/ui.js +1 -1
  148. package/src/components/global-styles-sidebar/index.js +16 -2
  149. package/src/components/page-patterns/header.js +3 -2
  150. package/src/components/page-patterns/use-patterns.js +9 -7
  151. package/src/components/page-templates/style.scss +1 -0
  152. package/src/components/post-edit/index.js +10 -13
  153. package/src/components/post-list/index.js +1 -2
  154. package/src/components/posts-app/index.js +3 -4
  155. package/src/components/posts-app-routes/home.js +36 -0
  156. package/src/components/posts-app-routes/index.js +36 -0
  157. package/src/components/posts-app-routes/posts-edit.js +31 -0
  158. package/src/components/posts-app-routes/posts-list-view-quick-edit.js +52 -0
  159. package/src/components/posts-app-routes/posts-list-view.js +40 -0
  160. package/src/components/posts-app-routes/posts-view-quick-edit.js +49 -0
  161. package/src/components/posts-app-routes/posts-view.js +35 -0
  162. package/src/components/sidebar-navigation-screen/style.scss +7 -2
  163. package/src/components/sidebar-navigation-screen-details-footer/index.js +27 -38
  164. package/src/components/sidebar-navigation-screen-details-footer/style.scss +0 -4
  165. package/src/components/sidebar-navigation-screen-global-styles/index.js +8 -17
  166. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +8 -0
  167. package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
  168. package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +4 -4
  169. package/src/components/site-editor-routes/README.md +2 -2
  170. package/src/components/site-editor-routes/index.js +0 -2
  171. package/src/components/site-hub/style.scss +1 -1
  172. package/src/components/style-book/examples.tsx +24 -2
  173. package/src/index.js +1 -13
  174. package/src/store/actions.js +15 -0
  175. package/src/store/selectors.js +24 -1
  176. package/src/style.scss +0 -2
  177. package/build/components/post-fields/index.js +0 -96
  178. package/build/components/post-fields/index.js.map +0 -1
  179. package/build/components/posts-app/router.js +0 -85
  180. package/build/components/posts-app/router.js.map +0 -1
  181. package/build/components/sidebar-navigation-screen-details-panel/index.js +0 -54
  182. package/build/components/sidebar-navigation-screen-details-panel/index.js.map +0 -1
  183. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -21
  184. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +0 -1
  185. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -33
  186. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +0 -1
  187. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -21
  188. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +0 -1
  189. package/build/components/site-editor-routes/styles-edit.js +0 -33
  190. package/build/components/site-editor-routes/styles-edit.js.map +0 -1
  191. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -219
  192. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +0 -1
  193. package/build-module/components/post-fields/index.js +0 -88
  194. package/build-module/components/post-fields/index.js.map +0 -1
  195. package/build-module/components/posts-app/router.js +0 -77
  196. package/build-module/components/posts-app/router.js.map +0 -1
  197. package/build-module/components/sidebar-navigation-screen-details-panel/index.js +0 -29
  198. package/build-module/components/sidebar-navigation-screen-details-panel/index.js.map +0 -1
  199. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -14
  200. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +0 -1
  201. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -25
  202. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +0 -1
  203. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -14
  204. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +0 -1
  205. package/build-module/components/site-editor-routes/styles-edit.js +0 -25
  206. package/build-module/components/site-editor-routes/styles-edit.js.map +0 -1
  207. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -212
  208. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +0 -1
  209. package/src/components/post-fields/index.js +0 -107
  210. package/src/components/post-fields/style.scss +0 -3
  211. package/src/components/posts-app/router.js +0 -69
  212. package/src/components/sidebar-navigation-screen-details-panel/index.js +0 -40
  213. package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -14
  214. package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -31
  215. package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -14
  216. package/src/components/sidebar-navigation-screen-details-panel/style.scss +0 -26
  217. package/src/components/site-editor-routes/styles-edit.js +0 -26
  218. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -257
  219. package/src/store/test/actions.js +0 -83
  220. package/src/store/test/reducer.js +0 -69
  221. package/src/store/test/selectors.js +0 -41
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useMemo","privateApis","routerPrivateApis","usePrevious","store","editSiteStore","unlock","useNavigateToEntityRecord","FOCUSABLE_ENTITIES","useLocation","useHistory","useNavigateToPreviousEntityRecord","location","previousLocation","history","goBack","isFocusMode","params","focusMode","postId","includes","postType","didComeFromEditorCanvas","canvas","showBackButton","back","undefined","useSpecificEditorSettings","onNavigateToEntityRecord","settings","shouldUseTemplateAsDefaultRenderingMode","select","getEditedPostContext","getSettings","_context","defaultRenderingMode","onNavigateToPreviousEntityRecord","defaultEditorSettings","richEditingEnabled","supportsTemplateMode","isPreviewMode"],"sources":["@wordpress/edit-site/src/components/block-editor/use-site-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport useNavigateToEntityRecord from './use-navigate-to-entity-record';\nimport { FOCUSABLE_ENTITIES } from '../../utils/constants';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nfunction useNavigateToPreviousEntityRecord() {\n\tconst location = useLocation();\n\tconst previousLocation = usePrevious( location );\n\tconst history = useHistory();\n\tconst goBack = useMemo( () => {\n\t\tconst isFocusMode =\n\t\t\tlocation.params.focusMode ||\n\t\t\t( location.params.postId &&\n\t\t\t\tFOCUSABLE_ENTITIES.includes( location.params.postType ) );\n\t\tconst didComeFromEditorCanvas =\n\t\t\tpreviousLocation?.params.canvas === 'edit';\n\t\tconst showBackButton = isFocusMode && didComeFromEditorCanvas;\n\t\treturn showBackButton ? () => history.back() : undefined;\n\t\t// `previousLocation` changes when the component updates for any reason, not\n\t\t// just when location changes. Until this is fixed we can't add it to deps. See\n\t\t// https://github.com/WordPress/gutenberg/pull/58710#discussion_r1479219465.\n\t}, [ location, history ] );\n\treturn goBack;\n}\n\nexport function useSpecificEditorSettings() {\n\tconst { params } = useLocation();\n\tconst { canvas = 'view' } = params;\n\tconst onNavigateToEntityRecord = useNavigateToEntityRecord();\n\tconst { settings, shouldUseTemplateAsDefaultRenderingMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostContext, getSettings } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\tconst _context = getEditedPostContext();\n\t\t\treturn {\n\t\t\t\tsettings: getSettings(),\n\t\t\t\t// TODO: The `postType` check should be removed when the default rendering mode per post type is merged.\n\t\t\t\t// @see https://github.com/WordPress/gutenberg/pull/62304/\n\t\t\t\tshouldUseTemplateAsDefaultRenderingMode:\n\t\t\t\t\t_context?.postId && _context?.postType !== 'post',\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst defaultRenderingMode = shouldUseTemplateAsDefaultRenderingMode\n\t\t? 'template-locked'\n\t\t: 'post-only';\n\tconst onNavigateToPreviousEntityRecord =\n\t\tuseNavigateToPreviousEntityRecord();\n\tconst defaultEditorSettings = useMemo( () => {\n\t\treturn {\n\t\t\t...settings,\n\n\t\t\trichEditingEnabled: true,\n\t\t\tsupportsTemplateMode: true,\n\t\t\tfocusMode: canvas !== 'view',\n\t\t\tdefaultRenderingMode,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t\tisPreviewMode: canvas === 'view',\n\t\t};\n\t}, [\n\t\tsettings,\n\t\tcanvas,\n\t\tdefaultRenderingMode,\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord,\n\t] );\n\n\treturn defaultEditorSettings;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,WAAW,QAAQ,oBAAoB;;AAEhD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,aAAa,QAAQ,aAAa;AACpD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,SAASC,kBAAkB,QAAQ,uBAAuB;AAE1D,MAAM;EAAEC,WAAW;EAAEC;AAAW,CAAC,GAAGJ,MAAM,CAAEJ,iBAAkB,CAAC;AAE/D,SAASS,iCAAiCA,CAAA,EAAG;EAC5C,MAAMC,QAAQ,GAAGH,WAAW,CAAC,CAA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AC;EACD,MAAMc,oBAAoB,GAAGL,uCAAuC,GACjE,iBAAiB,GACjB,WAAW;EACd,MAAMM,gCAAgC,GACrCzB,iCAAiC,CAAC,CAAC;EACpC,MAAM0B,qBAAqB,GAAGrC,OAAO,CAAE,MAAM;IAC5C,OAAO;MACN,GAAG6B,QAAQ;MAEXS,kBAAkB,EAAE,IAAI;MACxBC,oBAAoB,EAAE,IAAI;MAC1BrB,SAAS,EAAEK,MAAM,KAAK,MAAM;MAC5BY,oBAAoB;MACpBP,wBAAwB;MACxBQ,gCAAgC;MAChCI,aAAa,EAAEjB,MAAM,KAAK;IAC3B,CAAC;EACF,CAAC,EAAE,CACFM,QAAQ,EACRN,MAAM,EACNY,oBAAoB,EACpBP,wBAAwB,EACxBQ,gCAAgC,CAC/B,CAAC;EAEH,OAAOC,qBAAqB;AAC7B","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","useMemo","privateApis","routerPrivateApis","usePrevious","store","editSiteStore","unlock","useNavigateToEntityRecord","FOCUSABLE_ENTITIES","useLocation","useHistory","useNavigateToPreviousEntityRecord","location","previousLocation","history","goBack","isFocusMode","params","focusMode","postId","includes","postType","didComeFromEditorCanvas","canvas","showBackButton","back","undefined","useSpecificEditorSettings","onNavigateToEntityRecord","settings","select","getSettings","onNavigateToPreviousEntityRecord","defaultEditorSettings","richEditingEnabled","supportsTemplateMode","isPreviewMode"],"sources":["@wordpress/edit-site/src/components/block-editor/use-site-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport useNavigateToEntityRecord from './use-navigate-to-entity-record';\nimport { FOCUSABLE_ENTITIES } from '../../utils/constants';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nfunction useNavigateToPreviousEntityRecord() {\n\tconst location = useLocation();\n\tconst previousLocation = usePrevious( location );\n\tconst history = useHistory();\n\tconst goBack = useMemo( () => {\n\t\tconst isFocusMode =\n\t\t\tlocation.params.focusMode ||\n\t\t\t( location.params.postId &&\n\t\t\t\tFOCUSABLE_ENTITIES.includes( location.params.postType ) );\n\t\tconst didComeFromEditorCanvas =\n\t\t\tpreviousLocation?.params.canvas === 'edit';\n\t\tconst showBackButton = isFocusMode && didComeFromEditorCanvas;\n\t\treturn showBackButton ? () => history.back() : undefined;\n\t\t// `previousLocation` changes when the component updates for any reason, not\n\t\t// just when location changes. Until this is fixed we can't add it to deps. See\n\t\t// https://github.com/WordPress/gutenberg/pull/58710#discussion_r1479219465.\n\t}, [ location, history ] );\n\treturn goBack;\n}\n\nexport function useSpecificEditorSettings() {\n\tconst { params } = useLocation();\n\tconst { canvas = 'view' } = params;\n\tconst onNavigateToEntityRecord = useNavigateToEntityRecord();\n\tconst { settings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( editSiteStore );\n\t\treturn {\n\t\t\tsettings: getSettings(),\n\t\t};\n\t}, [] );\n\n\tconst onNavigateToPreviousEntityRecord =\n\t\tuseNavigateToPreviousEntityRecord();\n\tconst defaultEditorSettings = useMemo( () => {\n\t\treturn {\n\t\t\t...settings,\n\n\t\t\trichEditingEnabled: true,\n\t\t\tsupportsTemplateMode: true,\n\t\t\tfocusMode: canvas !== 'view',\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t\tisPreviewMode: canvas === 'view',\n\t\t};\n\t}, [\n\t\tsettings,\n\t\tcanvas,\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord,\n\t] );\n\n\treturn defaultEditorSettings;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,WAAW,IAAIC,iBAAiB,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CAAC,GAAG9B,SAAS,CAAI+B,MAAM,IAAM;IAC7C,MAAM;MAAEC;IAAY,CAAC,GAAGD,MAAM,CAAEzB,aAAc,CAAC;IAC/C,OAAO;MACNwB,QAAQ,EAAEE,WAAW,CAAC;IACvB,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMC,gCAAgC,GACrCrB,iCAAiC,CAAC,CAAC;EACpC,MAAMsB,qBAAqB,GAAGjC,OAAO,CAAE,MAAM;IAC5C,OAAO;MACN,GAAG6B,QAAQ;MAEXK,kBAAkB,EAAE,IAAI;MACxBC,oBAAoB,EAAE,IAAI;MAC1BjB,SAAS,EAAEK,MAAM,KAAK,MAAM;MAC5BK,wBAAwB;MACxBI,gCAAgC;MAChCI,aAAa,EAAEb,MAAM,KAAK;IAC3B,CAAC;EACF,CAAC,EAAE,CACFM,QAAQ,EACRN,MAAM,EACNK,wBAAwB,EACxBI,gCAAgC,CAC/B,CAAC;EAEH,OAAOC,qBAAqB;AAC7B","ignoreList":[]}
@@ -43,6 +43,7 @@ import useEditorTitle from './use-editor-title';
43
43
  import { useIsSiteEditorLoading } from '../layout/hooks';
44
44
  import { useAdaptEditorToCanvas } from './use-adapt-editor-to-canvas';
45
45
  import { TEMPLATE_POST_TYPE } from '../../utils/constants';
46
+ import { useResolveEditedEntity, useSyncDeprecatedEntityIntoState } from './use-resolve-edited-entity';
46
47
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
47
48
  const {
48
49
  Editor,
@@ -89,12 +90,15 @@ export default function EditSiteEditor({
89
90
  } = params;
90
91
  const isLoading = useIsSiteEditorLoading();
91
92
  useAdaptEditorToCanvas(canvas);
93
+ const entity = useResolveEditedEntity();
94
+ // deprecated sync state with url
95
+ useSyncDeprecatedEntityIntoState(entity);
96
+ const {
97
+ postType,
98
+ postId,
99
+ context
100
+ } = entity;
92
101
  const {
93
- editedPostType,
94
- editedPostId,
95
- contextPostType,
96
- contextPostId,
97
- isEditingPage,
98
102
  supportsGlobalStyles,
99
103
  showIconLabels,
100
104
  editorCanvasView,
@@ -102,11 +106,7 @@ export default function EditSiteEditor({
102
106
  hasSiteIcon
103
107
  } = useSelect(select => {
104
108
  const {
105
- getEditorCanvasContainerView,
106
- getEditedPostContext,
107
- isPage,
108
- getEditedPostType,
109
- getEditedPostId
109
+ getEditorCanvasContainerView
110
110
  } = unlock(select(editSiteStore));
111
111
  const {
112
112
  get
@@ -115,17 +115,8 @@ export default function EditSiteEditor({
115
115
  getCurrentTheme,
116
116
  getEntityRecord
117
117
  } = select(coreDataStore);
118
- const _context = getEditedPostContext();
119
118
  const siteData = getEntityRecord('root', '__unstableBase', undefined);
120
-
121
- // The currently selected entity to display.
122
- // Typically template or template part in the site editor.
123
119
  return {
124
- editedPostType: getEditedPostType(),
125
- editedPostId: getEditedPostId(),
126
- contextPostType: _context?.postId ? _context.postType : undefined,
127
- contextPostId: _context?.postId ? _context.postId : undefined,
128
- isEditingPage: isPage(),
129
120
  supportsGlobalStyles: getCurrentTheme()?.is_block_theme,
130
121
  showIconLabels: get('core', 'showIconLabels'),
131
122
  editorCanvasView: getEditorCanvasContainerView(),
@@ -133,8 +124,8 @@ export default function EditSiteEditor({
133
124
  hasSiteIcon: !!siteData?.site_icon_url
134
125
  };
135
126
  }, []);
136
- const postWithTemplate = !!contextPostId;
137
- useEditorTitle(postWithTemplate ? contextPostType : editedPostType, postWithTemplate ? contextPostId : editedPostId);
127
+ const postWithTemplate = !!context?.postId;
128
+ useEditorTitle(postWithTemplate ? context.postType : postType, postWithTemplate ? context.postId : postId);
138
129
  const _isPreviewingTheme = isPreviewingTheme();
139
130
  const hasDefaultEditorCanvasView = !useHasEditorCanvasContainer();
140
131
  const iframeProps = useEditorIframeProps();
@@ -196,15 +187,15 @@ export default function EditSiteEditor({
196
187
  };
197
188
  return /*#__PURE__*/_jsxs(_Fragment, {
198
189
  children: [/*#__PURE__*/_jsx(GlobalStylesRenderer, {
199
- disableRootPadding: editedPostType !== TEMPLATE_POST_TYPE
190
+ disableRootPadding: postType !== TEMPLATE_POST_TYPE
200
191
  }), /*#__PURE__*/_jsx(EditorKeyboardShortcutsRegister, {}), isEditMode && /*#__PURE__*/_jsx(BlockKeyboardShortcuts, {}), !isReady ? /*#__PURE__*/_jsx(CanvasLoader, {
201
192
  id: loadingProgressId
202
193
  }) : null, isEditMode && /*#__PURE__*/_jsx(WelcomeGuide, {
203
- postType: postWithTemplate ? contextPostType : editedPostType
194
+ postType: postWithTemplate ? context.postType : postType
204
195
  }), isReady && /*#__PURE__*/_jsxs(Editor, {
205
- postType: postWithTemplate ? contextPostType : editedPostType,
206
- postId: postWithTemplate ? contextPostId : editedPostId,
207
- templateId: postWithTemplate ? editedPostId : undefined,
196
+ postType: postWithTemplate ? context.postType : postType,
197
+ postId: postWithTemplate ? context.postId : postId,
198
+ templateId: postWithTemplate ? postId : undefined,
208
199
  settings: settings,
209
200
  className: clsx('edit-site-editor__editor-interface', {
210
201
  'show-icon-labels': showIconLabels
@@ -218,7 +209,7 @@ export default function EditSiteEditor({
218
209
  title: title,
219
210
  iframeProps: iframeProps,
220
211
  onActionPerformed: onActionPerformed,
221
- extraSidebarPanels: !isEditingPage && /*#__PURE__*/_jsx(PluginTemplateSettingPanel.Slot, {}),
212
+ extraSidebarPanels: !postWithTemplate && /*#__PURE__*/_jsx(PluginTemplateSettingPanel.Slot, {}),
222
213
  children: [isEditMode && /*#__PURE__*/_jsx(BackButton, {
223
214
  children: ({
224
215
  length
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","useDispatch","useSelect","Button","__unstableMotion","motion","useInstanceId","useReducedMotion","EditorKeyboardShortcutsRegister","privateApis","editorPrivateApis","store","editorStore","__","sprintf","coreDataStore","blockLibraryPrivateApis","useCallback","useMemo","noticesStore","routerPrivateApis","preferencesStore","decodeEntities","Icon","arrowUpLeft","blockEditorStore","WelcomeGuide","editSiteStore","GlobalStylesRenderer","CanvasLoader","unlock","useSpecificEditorSettings","PluginTemplateSettingPanel","GlobalStylesSidebar","isPreviewingTheme","getEditorCanvasContainerTitle","useHasEditorCanvasContainer","SaveButton","SavePanel","SiteEditorMoreMenu","SiteIcon","useEditorIframeProps","useEditorTitle","useIsSiteEditorLoading","useAdaptEditorToCanvas","TEMPLATE_POST_TYPE","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","Editor","BackButton","useHistory","useLocation","BlockKeyboardShortcuts","toggleHomeIconVariants","edit","opacity","scale","hover","clipPath","siteIconVariants","tap","EditSiteEditor","isPostsList","disableMotion","params","canvas","isLoading","editedPostType","editedPostId","contextPostType","contextPostId","isEditingPage","supportsGlobalStyles","showIconLabels","editorCanvasView","currentPostIsTrashed","hasSiteIcon","select","getEditorCanvasContainerView","getEditedPostContext","isPage","getEditedPostType","getEditedPostId","get","getCurrentTheme","getEntityRecord","_context","siteData","undefined","postId","postType","is_block_theme","getCurrentPostAttribute","site_icon_url","postWithTemplate","_isPreviewingTheme","hasDefaultEditorCanvasView","iframeProps","isEditMode","loadingProgressId","settings","styles","css","resetZoomLevel","createSuccessNotice","history","onActionPerformed","actionId","items","push","type","newItem","_title","title","rendered","id","actions","label","onClick","isReady","transition","duration","children","disableRootPadding","templateId","className","customSaveButton","size","customSavePanel","forceDisableBlockTools","extraSidebarPanels","Slot","length","div","animate","initial","whileHover","whileTap","__next40pxDefaultSize","showTooltip","tooltipPosition","focusMode","page","variants","icon"],"sources":["@wordpress/edit-site/src/components/editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useInstanceId, useReducedMotion } from '@wordpress/compose';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { Icon, arrowUpLeft } from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport CanvasLoader from '../canvas-loader';\nimport { unlock } from '../../lock-unlock';\nimport { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';\nimport PluginTemplateSettingPanel from '../plugin-template-setting-panel';\nimport GlobalStylesSidebar from '../global-styles-sidebar';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\nimport {\n\tgetEditorCanvasContainerTitle,\n\tuseHasEditorCanvasContainer,\n} from '../editor-canvas-container';\nimport SaveButton from '../save-button';\nimport SavePanel from '../save-panel';\nimport SiteEditorMoreMenu from '../more-menu';\nimport SiteIcon from '../site-icon';\nimport useEditorIframeProps from '../block-editor/use-editor-iframe-props';\nimport useEditorTitle from './use-editor-title';\nimport { useIsSiteEditorLoading } from '../layout/hooks';\nimport { useAdaptEditorToCanvas } from './use-adapt-editor-to-canvas';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nconst { Editor, BackButton } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nconst toggleHomeIconVariants = {\n\tedit: {\n\t\topacity: 0,\n\t\tscale: 0.2,\n\t},\n\thover: {\n\t\topacity: 1,\n\t\tscale: 1,\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n};\n\nconst siteIconVariants = {\n\tedit: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n\thover: {\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n\ttap: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n};\n\nexport default function EditSiteEditor( { isPostsList = false } ) {\n\tconst disableMotion = useReducedMotion();\n\tconst { params } = useLocation();\n\tconst { canvas = 'view' } = params;\n\tconst isLoading = useIsSiteEditorLoading();\n\tuseAdaptEditorToCanvas( canvas );\n\tconst {\n\t\teditedPostType,\n\t\teditedPostId,\n\t\tcontextPostType,\n\t\tcontextPostId,\n\t\tisEditingPage,\n\t\tsupportsGlobalStyles,\n\t\tshowIconLabels,\n\t\teditorCanvasView,\n\t\tcurrentPostIsTrashed,\n\t\thasSiteIcon,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEditorCanvasContainerView,\n\t\t\tgetEditedPostContext,\n\t\t\tisPage,\n\t\t\tgetEditedPostType,\n\t\t\tgetEditedPostId,\n\t\t} = unlock( select( editSiteStore ) );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getCurrentTheme, getEntityRecord } = select( coreDataStore );\n\t\tconst _context = getEditedPostContext();\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase', undefined );\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\teditedPostType: getEditedPostType(),\n\t\t\teditedPostId: getEditedPostId(),\n\t\t\tcontextPostType: _context?.postId ? _context.postType : undefined,\n\t\t\tcontextPostId: _context?.postId ? _context.postId : undefined,\n\t\t\tisEditingPage: isPage(),\n\t\t\tsupportsGlobalStyles: getCurrentTheme()?.is_block_theme,\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\teditorCanvasView: getEditorCanvasContainerView(),\n\t\t\tcurrentPostIsTrashed:\n\t\t\t\tselect( editorStore ).getCurrentPostAttribute( 'status' ) ===\n\t\t\t\t'trash',\n\t\t\thasSiteIcon: !! siteData?.site_icon_url,\n\t\t};\n\t}, [] );\n\tconst postWithTemplate = !! contextPostId;\n\tuseEditorTitle(\n\t\tpostWithTemplate ? contextPostType : editedPostType,\n\t\tpostWithTemplate ? contextPostId : editedPostId\n\t);\n\tconst _isPreviewingTheme = isPreviewingTheme();\n\tconst hasDefaultEditorCanvasView = ! useHasEditorCanvasContainer();\n\tconst iframeProps = useEditorIframeProps();\n\tconst isEditMode = canvas === 'edit';\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst settings = useSpecificEditorSettings();\n\tconst styles = useMemo(\n\t\t() => [\n\t\t\t...settings.styles,\n\t\t\t{\n\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\tcss:\n\t\t\t\t\tcanvas === 'view'\n\t\t\t\t\t\t? `body{min-height: 100vh; ${\n\t\t\t\t\t\t\t\tcurrentPostIsTrashed ? '' : 'cursor: pointer;'\n\t\t\t\t\t\t }}`\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t],\n\t\t[ settings.styles, canvas, currentPostIsTrashed ]\n\t);\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst history = useHistory();\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\tcase 'delete-post':\n\t\t\t\t\t{\n\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\tpostType: items[ 0 ].type,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst _title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( _title )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\t\t\t\t\tpostId: newItem.id,\n\t\t\t\t\t\t\t\t\t\t\t\tpostType: newItem.type,\n\t\t\t\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t},\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}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[ history, createSuccessNotice ]\n\t);\n\n\t// Replace the title and icon displayed in the DocumentBar when there's an overlay visible.\n\tconst title = getEditorCanvasContainerTitle( editorCanvasView );\n\n\tconst isReady = ! isLoading;\n\tconst transition = {\n\t\tduration: disableMotion ? 0 : 0.2,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<GlobalStylesRenderer\n\t\t\t\tdisableRootPadding={ editedPostType !== TEMPLATE_POST_TYPE }\n\t\t\t/>\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t{ isEditMode && <BlockKeyboardShortcuts /> }\n\t\t\t{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }\n\t\t\t{ isEditMode && (\n\t\t\t\t<WelcomeGuide\n\t\t\t\t\tpostType={\n\t\t\t\t\t\tpostWithTemplate ? contextPostType : editedPostType\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<Editor\n\t\t\t\t\tpostType={\n\t\t\t\t\t\tpostWithTemplate ? contextPostType : editedPostType\n\t\t\t\t\t}\n\t\t\t\t\tpostId={ postWithTemplate ? contextPostId : editedPostId }\n\t\t\t\t\ttemplateId={ postWithTemplate ? editedPostId : undefined }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tclassName={ clsx( 'edit-site-editor__editor-interface', {\n\t\t\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t\t\t} ) }\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tcustomSaveButton={\n\t\t\t\t\t\t_isPreviewingTheme && <SaveButton size=\"compact\" />\n\t\t\t\t\t}\n\t\t\t\t\tcustomSavePanel={ _isPreviewingTheme && <SavePanel /> }\n\t\t\t\t\tforceDisableBlockTools={ ! hasDefaultEditorCanvasView }\n\t\t\t\t\ttitle={ title }\n\t\t\t\t\tiframeProps={ iframeProps }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\textraSidebarPanels={\n\t\t\t\t\t\t! isEditingPage && <PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t<BackButton>\n\t\t\t\t\t\t\t{ ( { length } ) =>\n\t\t\t\t\t\t\t\tlength <= 1 && (\n\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-editor__view-mode-toggle\"\n\t\t\t\t\t\t\t\t\t\ttransition={ transition }\n\t\t\t\t\t\t\t\t\t\tanimate=\"edit\"\n\t\t\t\t\t\t\t\t\t\tinitial=\"edit\"\n\t\t\t\t\t\t\t\t\t\twhileHover=\"hover\"\n\t\t\t\t\t\t\t\t\t\twhileTap=\"tap\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open Navigation' ) }\n\t\t\t\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\t\t\t\ttooltipPosition=\"middle right\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tresetZoomLevel();\n\n\t\t\t\t\t\t\t\t\t\t\t\t// TODO: this is a temporary solution to navigate to the posts list if we are\n\t\t\t\t\t\t\t\t\t\t\t\t// come here through `posts list` and are in focus mode editing a template, template part etc..\n\t\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\t\tisPostsList &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tparams?.focusMode\n\t\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\t\thistory.push(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpage: 'gutenberg-posts-dashboard',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpostType: 'post',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\thistory.push(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t...params,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcanvas: undefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\t\tvariants={ siteIconVariants }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-editor__view-mode-toggle-icon\" />\n\t\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t\t'edit-site-editor__back-icon',\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t'has-site-icon':\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thasSiteIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tvariants={ toggleHomeIconVariants }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ arrowUpLeft } />\n\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t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CAClB,CAAC;QAAA,CACF;MACZ,CAES,CACZ,eACDuB,IAAA,CAACR,kBAAkB,IAAE,CAAC,EACpBqC,oBAAoB,iBAAI7B,IAAA,CAACd,mBAAmB,IAAE,CAAC;IAAA,CAC1C,CACR;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useDispatch","useSelect","Button","__unstableMotion","motion","useInstanceId","useReducedMotion","EditorKeyboardShortcutsRegister","privateApis","editorPrivateApis","store","editorStore","__","sprintf","coreDataStore","blockLibraryPrivateApis","useCallback","useMemo","noticesStore","routerPrivateApis","preferencesStore","decodeEntities","Icon","arrowUpLeft","blockEditorStore","WelcomeGuide","editSiteStore","GlobalStylesRenderer","CanvasLoader","unlock","useSpecificEditorSettings","PluginTemplateSettingPanel","GlobalStylesSidebar","isPreviewingTheme","getEditorCanvasContainerTitle","useHasEditorCanvasContainer","SaveButton","SavePanel","SiteEditorMoreMenu","SiteIcon","useEditorIframeProps","useEditorTitle","useIsSiteEditorLoading","useAdaptEditorToCanvas","TEMPLATE_POST_TYPE","useResolveEditedEntity","useSyncDeprecatedEntityIntoState","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","Editor","BackButton","useHistory","useLocation","BlockKeyboardShortcuts","toggleHomeIconVariants","edit","opacity","scale","hover","clipPath","siteIconVariants","tap","EditSiteEditor","isPostsList","disableMotion","params","canvas","isLoading","entity","postType","postId","context","supportsGlobalStyles","showIconLabels","editorCanvasView","currentPostIsTrashed","hasSiteIcon","select","getEditorCanvasContainerView","get","getCurrentTheme","getEntityRecord","siteData","undefined","is_block_theme","getCurrentPostAttribute","site_icon_url","postWithTemplate","_isPreviewingTheme","hasDefaultEditorCanvasView","iframeProps","isEditMode","loadingProgressId","settings","styles","css","resetZoomLevel","createSuccessNotice","history","onActionPerformed","actionId","items","push","type","newItem","_title","title","rendered","id","actions","label","onClick","isReady","transition","duration","children","disableRootPadding","templateId","className","customSaveButton","size","customSavePanel","forceDisableBlockTools","extraSidebarPanels","Slot","length","div","animate","initial","whileHover","whileTap","__next40pxDefaultSize","showTooltip","tooltipPosition","focusMode","page","variants","icon"],"sources":["@wordpress/edit-site/src/components/editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useInstanceId, useReducedMotion } from '@wordpress/compose';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { Icon, arrowUpLeft } from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport CanvasLoader from '../canvas-loader';\nimport { unlock } from '../../lock-unlock';\nimport { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';\nimport PluginTemplateSettingPanel from '../plugin-template-setting-panel';\nimport GlobalStylesSidebar from '../global-styles-sidebar';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\nimport {\n\tgetEditorCanvasContainerTitle,\n\tuseHasEditorCanvasContainer,\n} from '../editor-canvas-container';\nimport SaveButton from '../save-button';\nimport SavePanel from '../save-panel';\nimport SiteEditorMoreMenu from '../more-menu';\nimport SiteIcon from '../site-icon';\nimport useEditorIframeProps from '../block-editor/use-editor-iframe-props';\nimport useEditorTitle from './use-editor-title';\nimport { useIsSiteEditorLoading } from '../layout/hooks';\nimport { useAdaptEditorToCanvas } from './use-adapt-editor-to-canvas';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport {\n\tuseResolveEditedEntity,\n\tuseSyncDeprecatedEntityIntoState,\n} from './use-resolve-edited-entity';\n\nconst { Editor, BackButton } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nconst toggleHomeIconVariants = {\n\tedit: {\n\t\topacity: 0,\n\t\tscale: 0.2,\n\t},\n\thover: {\n\t\topacity: 1,\n\t\tscale: 1,\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n};\n\nconst siteIconVariants = {\n\tedit: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n\thover: {\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n\ttap: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n};\n\nexport default function EditSiteEditor( { isPostsList = false } ) {\n\tconst disableMotion = useReducedMotion();\n\tconst { params } = useLocation();\n\tconst { canvas = 'view' } = params;\n\tconst isLoading = useIsSiteEditorLoading();\n\tuseAdaptEditorToCanvas( canvas );\n\tconst entity = useResolveEditedEntity();\n\t// deprecated sync state with url\n\tuseSyncDeprecatedEntityIntoState( entity );\n\tconst { postType, postId, context } = entity;\n\tconst {\n\t\tsupportsGlobalStyles,\n\t\tshowIconLabels,\n\t\teditorCanvasView,\n\t\tcurrentPostIsTrashed,\n\t\thasSiteIcon,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditorCanvasContainerView } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getCurrentTheme, getEntityRecord } = select( coreDataStore );\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase', undefined );\n\n\t\treturn {\n\t\t\tsupportsGlobalStyles: getCurrentTheme()?.is_block_theme,\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\teditorCanvasView: getEditorCanvasContainerView(),\n\t\t\tcurrentPostIsTrashed:\n\t\t\t\tselect( editorStore ).getCurrentPostAttribute( 'status' ) ===\n\t\t\t\t'trash',\n\t\t\thasSiteIcon: !! siteData?.site_icon_url,\n\t\t};\n\t}, [] );\n\tconst postWithTemplate = !! context?.postId;\n\tuseEditorTitle(\n\t\tpostWithTemplate ? context.postType : postType,\n\t\tpostWithTemplate ? context.postId : postId\n\t);\n\tconst _isPreviewingTheme = isPreviewingTheme();\n\tconst hasDefaultEditorCanvasView = ! useHasEditorCanvasContainer();\n\tconst iframeProps = useEditorIframeProps();\n\tconst isEditMode = canvas === 'edit';\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst settings = useSpecificEditorSettings();\n\tconst styles = useMemo(\n\t\t() => [\n\t\t\t...settings.styles,\n\t\t\t{\n\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\tcss:\n\t\t\t\t\tcanvas === 'view'\n\t\t\t\t\t\t? `body{min-height: 100vh; ${\n\t\t\t\t\t\t\t\tcurrentPostIsTrashed ? '' : 'cursor: pointer;'\n\t\t\t\t\t\t }}`\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t],\n\t\t[ settings.styles, canvas, currentPostIsTrashed ]\n\t);\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst history = useHistory();\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\tcase 'delete-post':\n\t\t\t\t\t{\n\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\tpostType: items[ 0 ].type,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst _title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( _title )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\t\t\t\t\tpostId: newItem.id,\n\t\t\t\t\t\t\t\t\t\t\t\tpostType: newItem.type,\n\t\t\t\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t},\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}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[ history, createSuccessNotice ]\n\t);\n\n\t// Replace the title and icon displayed in the DocumentBar when there's an overlay visible.\n\tconst title = getEditorCanvasContainerTitle( editorCanvasView );\n\n\tconst isReady = ! isLoading;\n\tconst transition = {\n\t\tduration: disableMotion ? 0 : 0.2,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<GlobalStylesRenderer\n\t\t\t\tdisableRootPadding={ postType !== TEMPLATE_POST_TYPE }\n\t\t\t/>\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t{ isEditMode && <BlockKeyboardShortcuts /> }\n\t\t\t{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }\n\t\t\t{ isEditMode && (\n\t\t\t\t<WelcomeGuide\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<Editor\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t\tpostId={ postWithTemplate ? context.postId : postId }\n\t\t\t\t\ttemplateId={ postWithTemplate ? postId : undefined }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tclassName={ clsx( 'edit-site-editor__editor-interface', {\n\t\t\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t\t\t} ) }\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tcustomSaveButton={\n\t\t\t\t\t\t_isPreviewingTheme && <SaveButton size=\"compact\" />\n\t\t\t\t\t}\n\t\t\t\t\tcustomSavePanel={ _isPreviewingTheme && <SavePanel /> }\n\t\t\t\t\tforceDisableBlockTools={ ! hasDefaultEditorCanvasView }\n\t\t\t\t\ttitle={ title }\n\t\t\t\t\tiframeProps={ iframeProps }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\textraSidebarPanels={\n\t\t\t\t\t\t! postWithTemplate && (\n\t\t\t\t\t\t\t<PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t<BackButton>\n\t\t\t\t\t\t\t{ ( { length } ) =>\n\t\t\t\t\t\t\t\tlength <= 1 && (\n\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-editor__view-mode-toggle\"\n\t\t\t\t\t\t\t\t\t\ttransition={ transition }\n\t\t\t\t\t\t\t\t\t\tanimate=\"edit\"\n\t\t\t\t\t\t\t\t\t\tinitial=\"edit\"\n\t\t\t\t\t\t\t\t\t\twhileHover=\"hover\"\n\t\t\t\t\t\t\t\t\t\twhileTap=\"tap\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open Navigation' ) }\n\t\t\t\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\t\t\t\ttooltipPosition=\"middle right\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tresetZoomLevel();\n\n\t\t\t\t\t\t\t\t\t\t\t\t// TODO: this is a temporary solution to navigate to the posts list if we are\n\t\t\t\t\t\t\t\t\t\t\t\t// come here through `posts list` and are in focus mode editing a template, template part etc..\n\t\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\t\tisPostsList &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tparams?.focusMode\n\t\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\t\thistory.push(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpage: 'gutenberg-posts-dashboard',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpostType: 'post',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\thistory.push(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t...params,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcanvas: undefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\t\tvariants={ siteIconVariants }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-editor__view-mode-toggle-icon\" />\n\t\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t\t'edit-site-editor__back-icon',\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t'has-site-icon':\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thasSiteIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tvariants={ toggleHomeIconVariants }\n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IAAI,EAAGtH;YAAa,CAAE;UAAC,CAClB,CAAC;QAAA,CACF;MACZ,CAES,CACZ,eACDyB,IAAA,CAACV,kBAAkB,IAAE,CAAC,EACpBsC,oBAAoB,iBAAI5B,IAAA,CAAChB,mBAAmB,IAAE,CAAC;IAAA,CAC1C,CACR;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
@@ -4,29 +4,37 @@
4
4
  import { _x, sprintf } from '@wordpress/i18n';
5
5
  import { useSelect } from '@wordpress/data';
6
6
  import { store as coreStore } from '@wordpress/core-data';
7
- import { store as editorStore } from '@wordpress/editor';
8
7
  import { decodeEntities } from '@wordpress/html-entities';
8
+ import { privateApis as editorPrivateApis } from '@wordpress/editor';
9
9
 
10
10
  /**
11
11
  * Internal dependencies
12
12
  */
13
13
  import useTitle from '../routes/use-title';
14
14
  import { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';
15
+ import { unlock } from '../../lock-unlock';
16
+ const {
17
+ getTemplateInfo
18
+ } = unlock(editorPrivateApis);
15
19
  function useEditorTitle(postType, postId) {
16
20
  const {
17
21
  title,
18
22
  isLoaded
19
23
  } = useSelect(select => {
24
+ var _select$getEntityReco;
20
25
  const {
21
26
  getEditedEntityRecord,
22
27
  hasFinishedResolution
23
28
  } = select(coreStore);
24
- const {
25
- __experimentalGetTemplateInfo: getTemplateInfo
26
- } = select(editorStore);
27
29
  const _record = getEditedEntityRecord('postType', postType, postId);
30
+ const {
31
+ default_template_types: templateTypes = []
32
+ } = (_select$getEntityReco = select(coreStore).getEntityRecord('root', '__unstableBase')) !== null && _select$getEntityReco !== void 0 ? _select$getEntityReco : {};
33
+ const templateInfo = getTemplateInfo({
34
+ template: _record,
35
+ templateTypes
36
+ });
28
37
  const _isLoaded = hasFinishedResolution('getEditedEntityRecord', ['postType', postType, postId]);
29
- const templateInfo = getTemplateInfo(_record);
30
38
  return {
31
39
  title: templateInfo.title,
32
40
  isLoaded: _isLoaded
@@ -1 +1 @@
1
- {"version":3,"names":["_x","sprintf","useSelect","store","coreStore","editorStore","decodeEntities","useTitle","POST_TYPE_LABELS","TEMPLATE_POST_TYPE","useEditorTitle","postType","postId","title","isLoaded","select","getEditedEntityRecord","hasFinishedResolution","__experimentalGetTemplateInfo","getTemplateInfo","_record","_isLoaded","templateInfo","editorTitle","_POST_TYPE_LABELS$pos"],"sources":["@wordpress/edit-site/src/components/editor/use-editor-title.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport useTitle from '../routes/use-title';\nimport { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nfunction useEditorTitle( postType, postId ) {\n\tconst { title, isLoaded } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { __experimentalGetTemplateInfo: getTemplateInfo } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\tconst _isLoaded = hasFinishedResolution( 'getEditedEntityRecord', [\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t] );\n\t\t\tconst templateInfo = getTemplateInfo( _record );\n\n\t\t\treturn {\n\t\t\t\ttitle: templateInfo.title,\n\t\t\t\tisLoaded: _isLoaded,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tlet editorTitle;\n\tif ( isLoaded ) {\n\t\teditorTitle = sprintf(\n\t\t\t// translators: A breadcrumb trail for the Admin document title. 1: title of template being edited, 2: type of template (Template or Template Part).\n\t\t\t_x( '%1$s ‹ %2$s', 'breadcrumb trail' ),\n\t\t\tdecodeEntities( title ),\n\t\t\tPOST_TYPE_LABELS[ postType ] ??\n\t\t\t\tPOST_TYPE_LABELS[ TEMPLATE_POST_TYPE ]\n\t\t);\n\t}\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URLQueryController> from double-announcing.\n\tuseTitle( isLoaded && editorTitle );\n}\n\nexport default useEditorTitle;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,WAAW,QAAQ,mBAAmB;AACxD,SAASC,cAAc,QAAQ,0BAA0B;;AAEzD;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,qBAAqB;AAC1C,SAASC,gBAAgB,EAAEC,kBAAkB,QAAQ,uBAAuB;AAE5E,SAASC,cAAcA,CAAEC,QAAQ,EAAEC,MAAM,EAAG;EAC3C,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAC,GAAGZ,SAAS,CAClCa,MAAM,IAAM;IACb,MAAM;MAAEC,qBAAqB;MAAEC;IAAsB,CAAC,GACrDF,MAAM,CAAEX,SAAU,CAAC;IACpB,MAAM;MAAEc,6BAA6B,EAAEC;IAAgB,CAAC,GACvDJ,MAAM,CAAEV,WAAY,CAAC;IACtB,MAAMe,OAAO,GAAGJ,qBAAqB,CACpC,UAAU,EACVL,QAAQ,EACRC,MACD,CAAC;IACD,MAAMS,SAAS,GAAGJ,qBAAqB,CAAE,uBAAuB,EAAE,CACjE,UAAU,EACVN,QAAQ,EACRC,MAAM,CACL,CAAC;IACH,MAAMU,YAAY,GAAGH,eAAe,CAAEC,OAAQ,CAAC;IAE/C,OAAO;MACNP,KAAK,EAAES,YAAY,CAACT,KAAK;MACzBC,QAAQ,EAAEO;IACX,CAAC;EACF,CAAC,EACD,CAAEV,QAAQ,EAAEC,MAAM,CACnB,CAAC;EAED,IAAIW,WAAW;EACf,IAAKT,QAAQ,EAAG;IAAA,IAAAU,qBAAA;IACfD,WAAW,GAAGtB,OAAO;IACpB;IACAD,EAAE,CAAE,aAAa,EAAE,kBAAmB,CAAC,EACvCM,cAAc,CAAEO,KAAM,CAAC,GAAAW,qBAAA,GACvBhB,gBAAgB,CAAEG,QAAQ,CAAE,cAAAa,qBAAA,cAAAA,qBAAA,GAC3BhB,gBAAgB,CAAEC,kBAAkB,CACtC,CAAC;EACF;;EAEA;EACA;EACAF,QAAQ,CAAEO,QAAQ,IAAIS,WAAY,CAAC;AACpC;AAEA,eAAeb,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["_x","sprintf","useSelect","store","coreStore","decodeEntities","privateApis","editorPrivateApis","useTitle","POST_TYPE_LABELS","TEMPLATE_POST_TYPE","unlock","getTemplateInfo","useEditorTitle","postType","postId","title","isLoaded","select","_select$getEntityReco","getEditedEntityRecord","hasFinishedResolution","_record","default_template_types","templateTypes","getEntityRecord","templateInfo","template","_isLoaded","editorTitle","_POST_TYPE_LABELS$pos"],"sources":["@wordpress/edit-site/src/components/editor/use-editor-title.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport useTitle from '../routes/use-title';\nimport { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\n\nconst { getTemplateInfo } = unlock( editorPrivateApis );\n\nfunction useEditorTitle( postType, postId ) {\n\tconst { title, isLoaded } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\n\t\t\tconst { default_template_types: templateTypes = [] } =\n\t\t\t\tselect( coreStore ).getEntityRecord(\n\t\t\t\t\t'root',\n\t\t\t\t\t'__unstableBase'\n\t\t\t\t) ?? {};\n\n\t\t\tconst templateInfo = getTemplateInfo( {\n\t\t\t\ttemplate: _record,\n\t\t\t\ttemplateTypes,\n\t\t\t} );\n\n\t\t\tconst _isLoaded = hasFinishedResolution( 'getEditedEntityRecord', [\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t] );\n\n\t\t\treturn {\n\t\t\t\ttitle: templateInfo.title,\n\t\t\t\tisLoaded: _isLoaded,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tlet editorTitle;\n\tif ( isLoaded ) {\n\t\teditorTitle = sprintf(\n\t\t\t// translators: A breadcrumb trail for the Admin document title. 1: title of template being edited, 2: type of template (Template or Template Part).\n\t\t\t_x( '%1$s ‹ %2$s', 'breadcrumb trail' ),\n\t\t\tdecodeEntities( title ),\n\t\t\tPOST_TYPE_LABELS[ postType ] ??\n\t\t\t\tPOST_TYPE_LABELS[ TEMPLATE_POST_TYPE ]\n\t\t);\n\t}\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URLQueryController> from double-announcing.\n\tuseTitle( isLoaded && editorTitle );\n}\n\nexport default useEditorTitle;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,qBAAqB;AAC1C,SAASC,gBAAgB,EAAEC,kBAAkB,QAAQ,uBAAuB;AAC5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,CAAC;EACF;;EAEA;EACA;EACAF,QAAQ,CAAES,QAAQ,IAAIY,WAAY,CAAC;AACpC;AAEA,eAAehB,cAAc","ignoreList":[]}
@@ -0,0 +1,125 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useEffect, useMemo } from '@wordpress/element';
5
+ import { useSelect, useDispatch } from '@wordpress/data';
6
+ import { store as coreDataStore } from '@wordpress/core-data';
7
+ import { privateApis as routerPrivateApis } from '@wordpress/router';
8
+
9
+ /**
10
+ * Internal dependencies
11
+ */
12
+ import { store as editSiteStore } from '../../store';
13
+ import { unlock } from '../../lock-unlock';
14
+ import { TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATTERN_TYPES } from '../../utils/constants';
15
+ const {
16
+ useLocation
17
+ } = unlock(routerPrivateApis);
18
+ const postTypesWithoutParentTemplate = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATTERN_TYPES.user];
19
+ const authorizedPostTypes = ['page', 'post'];
20
+ export function useResolveEditedEntity() {
21
+ const {
22
+ params = {}
23
+ } = useLocation();
24
+ const {
25
+ postId,
26
+ postType
27
+ } = params;
28
+ const homePage = useSelect(select => {
29
+ const {
30
+ getHomePage
31
+ } = unlock(select(coreDataStore));
32
+ return getHomePage();
33
+ }, []);
34
+
35
+ /**
36
+ * This is a hook that recreates the logic to resolve a template for a given WordPress postID postTypeId
37
+ * in order to match the frontend as closely as possible in the site editor.
38
+ *
39
+ * It is not possible to rely on the server logic because there maybe unsaved changes that impact the template resolution.
40
+ */
41
+ const resolvedTemplateId = useSelect(select => {
42
+ // If we're rendering a post type that doesn't have a template
43
+ // no need to resolve its template.
44
+ if (postTypesWithoutParentTemplate.includes(postType) && postId) {
45
+ return;
46
+ }
47
+
48
+ // Don't trigger resolution for multi-selected posts.
49
+ if (postId && postId.includes(',')) {
50
+ return;
51
+ }
52
+ const {
53
+ getTemplateId
54
+ } = unlock(select(coreDataStore));
55
+
56
+ // If we're rendering a specific page, we need to resolve its template.
57
+ // The site editor only supports pages for now, not other CPTs.
58
+ if (postType && postId && authorizedPostTypes.includes(postType)) {
59
+ return getTemplateId(postType, postId);
60
+ }
61
+
62
+ // If we're rendering the home page, and we have a static home page, resolve its template.
63
+ if (homePage?.postType === 'page') {
64
+ return getTemplateId('page', homePage?.postId);
65
+ }
66
+ if (homePage?.postType === 'wp_template') {
67
+ return homePage?.postId;
68
+ }
69
+ }, [homePage, postId, postType]);
70
+ const context = useMemo(() => {
71
+ if (postTypesWithoutParentTemplate.includes(postType) && postId) {
72
+ return {};
73
+ }
74
+ if (postType && postId && authorizedPostTypes.includes(postType)) {
75
+ return {
76
+ postType,
77
+ postId
78
+ };
79
+ }
80
+ // TODO: for post types lists we should probably not render the front page, but maybe a placeholder
81
+ // with a message like "Select a page" or something similar.
82
+ if (homePage?.postType === 'page') {
83
+ return {
84
+ postType: 'page',
85
+ postId: homePage?.postId
86
+ };
87
+ }
88
+ return {};
89
+ }, [homePage, postType, postId]);
90
+ if (postTypesWithoutParentTemplate.includes(postType) && postId) {
91
+ return {
92
+ isReady: true,
93
+ postType,
94
+ postId,
95
+ context
96
+ };
97
+ }
98
+ if (!!homePage) {
99
+ return {
100
+ isReady: resolvedTemplateId !== undefined,
101
+ postType: TEMPLATE_POST_TYPE,
102
+ postId: resolvedTemplateId,
103
+ context
104
+ };
105
+ }
106
+ return {
107
+ isReady: false
108
+ };
109
+ }
110
+ export function useSyncDeprecatedEntityIntoState({
111
+ postType,
112
+ postId,
113
+ context,
114
+ isReady
115
+ }) {
116
+ const {
117
+ setEditedEntity
118
+ } = useDispatch(editSiteStore);
119
+ useEffect(() => {
120
+ if (isReady) {
121
+ setEditedEntity(postType, postId, context);
122
+ }
123
+ }, [isReady, postType, postId, context, setEditedEntity]);
124
+ }
125
+ //# sourceMappingURL=use-resolve-edited-entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useMemo","useSelect","useDispatch","store","coreDataStore","privateApis","routerPrivateApis","editSiteStore","unlock","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","NAVIGATION_POST_TYPE","PATTERN_TYPES","useLocation","postTypesWithoutParentTemplate","user","authorizedPostTypes","useResolveEditedEntity","params","postId","postType","homePage","select","getHomePage","resolvedTemplateId","includes","getTemplateId","context","isReady","undefined","useSyncDeprecatedEntityIntoState","setEditedEntity"],"sources":["@wordpress/edit-site/src/components/editor/use-resolve-edited-entity.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES,\n} from '../../utils/constants';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst postTypesWithoutParentTemplate = [\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\nconst authorizedPostTypes = [ 'page', 'post' ];\n\nexport function useResolveEditedEntity() {\n\tconst { params = {} } = useLocation();\n\tconst { postId, postType } = params;\n\tconst homePage = useSelect( ( select ) => {\n\t\tconst { getHomePage } = unlock( select( coreDataStore ) );\n\t\treturn getHomePage();\n\t}, [] );\n\n\t/**\n\t * This is a hook that recreates the logic to resolve a template for a given WordPress postID postTypeId\n\t * in order to match the frontend as closely as possible in the site editor.\n\t *\n\t * It is not possible to rely on the server logic because there maybe unsaved changes that impact the template resolution.\n\t */\n\tconst resolvedTemplateId = useSelect(\n\t\t( select ) => {\n\t\t\t// If we're rendering a post type that doesn't have a template\n\t\t\t// no need to resolve its template.\n\t\t\tif (\n\t\t\t\tpostTypesWithoutParentTemplate.includes( postType ) &&\n\t\t\t\tpostId\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Don't trigger resolution for multi-selected posts.\n\t\t\tif ( postId && postId.includes( ',' ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { getTemplateId } = unlock( select( coreDataStore ) );\n\n\t\t\t// If we're rendering a specific page, we need to resolve its template.\n\t\t\t// The site editor only supports pages for now, not other CPTs.\n\t\t\tif (\n\t\t\t\tpostType &&\n\t\t\t\tpostId &&\n\t\t\t\tauthorizedPostTypes.includes( postType )\n\t\t\t) {\n\t\t\t\treturn getTemplateId( postType, postId );\n\t\t\t}\n\n\t\t\t// If we're rendering the home page, and we have a static home page, resolve its template.\n\t\t\tif ( homePage?.postType === 'page' ) {\n\t\t\t\treturn getTemplateId( 'page', homePage?.postId );\n\t\t\t}\n\n\t\t\tif ( homePage?.postType === 'wp_template' ) {\n\t\t\t\treturn homePage?.postId;\n\t\t\t}\n\t\t},\n\t\t[ homePage, postId, postType ]\n\t);\n\n\tconst context = useMemo( () => {\n\t\tif ( postTypesWithoutParentTemplate.includes( postType ) && postId ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tif ( postType && postId && authorizedPostTypes.includes( postType ) ) {\n\t\t\treturn { postType, postId };\n\t\t}\n\t\t// TODO: for post types lists we should probably not render the front page, but maybe a placeholder\n\t\t// with a message like \"Select a page\" or something similar.\n\t\tif ( homePage?.postType === 'page' ) {\n\t\t\treturn { postType: 'page', postId: homePage?.postId };\n\t\t}\n\n\t\treturn {};\n\t}, [ homePage, postType, postId ] );\n\n\tif ( postTypesWithoutParentTemplate.includes( postType ) && postId ) {\n\t\treturn { isReady: true, postType, postId, context };\n\t}\n\n\tif ( !! homePage ) {\n\t\treturn {\n\t\t\tisReady: resolvedTemplateId !== undefined,\n\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\tpostId: resolvedTemplateId,\n\t\t\tcontext,\n\t\t};\n\t}\n\n\treturn { isReady: false };\n}\n\nexport function useSyncDeprecatedEntityIntoState( {\n\tpostType,\n\tpostId,\n\tcontext,\n\tisReady,\n} ) {\n\tconst { setEditedEntity } = useDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\tif ( isReady ) {\n\t\t\tsetEditedEntity( postType, postId, context );\n\t\t}\n\t}, [ isReady, postType, postId, context, setEditedEntity ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,OAAO,QAAQ,oBAAoB;AACvD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,aAAa,QAAQ,sBAAsB;AAC7D,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASH,KAAK,IAAII,aAAa,QAAQ,aAAa;AACpD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SACCC,kBAAkB,EAClBC,uBAAuB,EACvBC,oBAAoB,EACpBC,aAAa,QACP,uBAAuB;AAE9B,MAAM;EAAEC;AAAY,CAAC,GAAGL,MAAM,CAAEF,iBAAkB,CAAC;AAEnD,MAAMQ,8BAA8B,GAAG,CACtCL,kBAAkB,EAClBC,uBAAuB,EACvBC,oBAAoB,EACpBC,aAAa,CAACG,IAAI,CAClB;AAED,MAAMC,mBAAmB,GAAG,CAAE,MAAM,EAAE,MAAM,CAAE;AAE9C,OAAO,SAASC,sBAAsBA,CAAA,EAAG;EACxC,MAAM;IAAEC,MAAM,GAAG,CAAC;EAAE,CAAC,GAAGL,WAAW,CAAC,CAAC;EACrC,MAAM;IAAEM,MAAM;IAAEC;EAAS,CAAC,GAAGF,MAAM;EACnC,MAAMG,QAAQ,GAAGpB,SAAS,CAAIqB,MAAM,IAAM;IACzC,MAAM;MAAEC;IAAY,CAAC,GAAGf,MAAM,CAAEc,MAAM,CAAElB,aAAc,CAAE,CAAC;IACzD,OAAOmB,WAA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,EAAEE,QAAQ,EAAEF;MAAO,CAAC;IACtD;IAEA,OAAO,CAAC,CAAC;EACV,CAAC,EAAE,CAAEE,QAAQ,EAAED,QAAQ,EAAED,MAAM,CAAG,CAAC;EAEnC,IAAKL,8BAA8B,CAACW,QAAQ,CAAEL,QAAS,CAAC,IAAID,MAAM,EAAG;IACpE,OAAO;MAAES,OAAO,EAAE,IAAI;MAAER,QAAQ;MAAED,MAAM;MAAEQ;IAAQ,CAAC;EACpD;EAEA,IAAK,CAAC,CAAEN,QAAQ,EAAG;IAClB,OAAO;MACNO,OAAO,EAAEJ,kBAAkB,KAAKK,SAAS;MACzCT,QAAQ,EAAEX,kBAAkB;MAC5BU,MAAM,EAAEK,kBAAkB;MAC1BG;IACD,CAAC;EACF;EAEA,OAAO;IAAEC,OAAO,EAAE;EAAM,CAAC;AAC1B;AAEA,OAAO,SAASE,gCAAgCA,CAAE;EACjDV,QAAQ;EACRD,MAAM;EACNQ,OAAO;EACPC;AACD,CAAC,EAAG;EACH,MAAM;IAAEG;EAAgB,CAAC,GAAG7B,WAAW,CAAEK,aAAc,CAAC;EAExDR,SAAS,CAAE,MAAM;IAChB,IAAK6B,OAAO,EAAG;MACdG,eAAe,CAAEX,QAAQ,EAAED,MAAM,EAAEQ,OAAQ,CAAC;IAC7C;EACD,CAAC,EAAE,CAAEC,OAAO,EAAER,QAAQ,EAAED,MAAM,EAAEQ,OAAO,EAAEI,eAAe,CAAG,CAAC;AAC7D","ignoreList":[]}
@@ -113,7 +113,7 @@ function EditorCanvasContainer({
113
113
  });
114
114
  }
115
115
  function useHasEditorCanvasContainer() {
116
- const fills = useSlotFills(EditorContentSlotFill.privateKey);
116
+ const fills = useSlotFills(EditorContentSlotFill.name);
117
117
  return !!fills?.length;
118
118
  }
119
119
  export default EditorCanvasContainer;
@@ -1 +1 @@
1
- {"version":3,"names":["Children","cloneElement","useState","Button","__experimentalUseSlotFills","useSlotFills","ESCAPE","__","useDispatch","useSelect","closeSmall","useFocusOnMount","useFocusReturn","store","preferencesStore","editorStore","privateApis","editorPrivateApis","unlock","editSiteStore","jsx","_jsx","jsxs","_jsxs","EditorContentSlotFill","ResizableEditor","getEditorCanvasContainerTitle","view","EditorCanvasContainer","children","closeButtonLabel","onClose","enableResizing","editorCanvasContainerView","showListViewByDefault","select","_editorCanvasContainerView","getEditorCanvasContainerView","_showListViewByDefault","get","isClosed","setIsClosed","setEditorCanvasContainerView","setIsListViewOpened","focusOnMountRef","sectionFocusReturnRef","onCloseContainer","undefined","closeOnEscape","event","keyCode","defaultPrevented","preventDefault","childrenWithProps","Array","isArray","map","child","index","ref","title","shouldShowCloseButton","Fill","className","onKeyDown","size","icon","label","onClick","useHasEditorCanvasContainer","fills","privateKey","length"],"sources":["@wordpress/edit-site/src/components/editor-canvas-container/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Children, cloneElement, useState } from '@wordpress/element';\nimport {\n\tButton,\n\t__experimentalUseSlotFills as useSlotFills,\n} from '@wordpress/components';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { closeSmall } from '@wordpress/icons';\nimport { useFocusOnMount, useFocusReturn } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\nconst { EditorContentSlotFill, ResizableEditor } = unlock( editorPrivateApis );\n\n/**\n * Returns a translated string for the title of the editor canvas container.\n *\n * @param {string} view Editor canvas container view.\n *\n * @return {Object} Translated string for the view title and associated icon, both defaulting to ''.\n */\nfunction getEditorCanvasContainerTitle( view ) {\n\tswitch ( view ) {\n\t\tcase 'style-book':\n\t\t\treturn __( 'Style Book' );\n\t\tcase 'global-styles-revisions':\n\t\tcase 'global-styles-revisions:style-book':\n\t\t\treturn __( 'Style Revisions' );\n\t\tdefault:\n\t\t\treturn '';\n\t}\n}\n\nfunction EditorCanvasContainer( {\n\tchildren,\n\tcloseButtonLabel,\n\tonClose,\n\tenableResizing = false,\n} ) {\n\tconst { editorCanvasContainerView, showListViewByDefault } = useSelect(\n\t\t( select ) => {\n\t\t\tconst _editorCanvasContainerView = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView();\n\n\t\t\tconst _showListViewByDefault = select( preferencesStore ).get(\n\t\t\t\t'core',\n\t\t\t\t'showListViewByDefault'\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\teditorCanvasContainerView: _editorCanvasContainerView,\n\t\t\t\tshowListViewByDefault: _showListViewByDefault,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst sectionFocusReturnRef = useFocusReturn();\n\n\tfunction onCloseContainer() {\n\t\tsetIsListViewOpened( showListViewByDefault );\n\t\tsetEditorCanvasContainerView( undefined );\n\t\tsetIsClosed( true );\n\t\tif ( typeof onClose === 'function' ) {\n\t\t\tonClose();\n\t\t}\n\t}\n\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tonCloseContainer();\n\t\t}\n\t}\n\n\tconst childrenWithProps = Array.isArray( children )\n\t\t? Children.map( children, ( child, index ) =>\n\t\t\t\tindex === 0\n\t\t\t\t\t? cloneElement( child, {\n\t\t\t\t\t\t\tref: sectionFocusReturnRef,\n\t\t\t\t\t } )\n\t\t\t\t\t: child\n\t\t )\n\t\t: cloneElement( children, {\n\t\t\t\tref: sectionFocusReturnRef,\n\t\t } );\n\n\tif ( isClosed ) {\n\t\treturn null;\n\t}\n\n\tconst title = getEditorCanvasContainerTitle( editorCanvasContainerView );\n\tconst shouldShowCloseButton = onClose || closeButtonLabel;\n\n\treturn (\n\t\t<EditorContentSlotFill.Fill>\n\t\t\t<div className=\"edit-site-editor-canvas-container\">\n\t\t\t\t<ResizableEditor enableResizing={ enableResizing }>\n\t\t\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t\t\t<section\n\t\t\t\t\t\tclassName=\"edit-site-editor-canvas-container__section\"\n\t\t\t\t\t\tref={ shouldShowCloseButton ? focusOnMountRef : null }\n\t\t\t\t\t\tonKeyDown={ closeOnEscape }\n\t\t\t\t\t\taria-label={ title }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ shouldShowCloseButton && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t\tclassName=\"edit-site-editor-canvas-container__close-button\"\n\t\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\t\tlabel={ closeButtonLabel || __( 'Close' ) }\n\t\t\t\t\t\t\t\tonClick={ onCloseContainer }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ childrenWithProps }\n\t\t\t\t\t</section>\n\t\t\t\t</ResizableEditor>\n\t\t\t</div>\n\t\t</EditorContentSlotFill.Fill>\n\t);\n}\n\nfunction useHasEditorCanvasContainer() {\n\tconst fills = useSlotFills( EditorContentSlotFill.privateKey );\n\treturn !! fills?.length;\n}\n\nexport default EditorCanvasContainer;\nexport { useHasEditorCanvasContainer, getEditorCanvasContainerTitle };\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,YAAY,EAAEC,QAAQ,QAAQ,oBAAoB;AACrE,SACCC,MAAM,EACNC,0BAA0B,IAAIC,YAAY,QACpC,uBAAuB;AAC9B,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,EAAE,QAAQ,iBAAi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xE,MAAM4B,qBAAqB,GAAG9B,OAAO,IAAID,gBAAgB;EAEzD,oBACCT,IAAA,CAACG,qBAAqB,CAACsC,IAAI;IAAAjC,QAAA,eAC1BR,IAAA;MAAK0C,SAAS,EAAC,mCAAmC;MAAAlC,QAAA,eACjDR,IAAA,CAACI,eAAe;QAACO,cAAc,EAAGA,cAAgB;QAAAH,QAAA,eAEjDN,KAAA;UACCwC,SAAS,EAAC,4CAA4C;UACtDJ,GAAG,EAAGE,qBAAqB,GAAGjB,eAAe,GAAG,IAAM;UACtDoB,SAAS,EAAGhB,aAAe;UAC3B,cAAaY,KAAO;UAAA/B,QAAA,GAElBgC,qBAAqB,iBACtBxC,IAAA,CAAClB,MAAM;YACN8D,IAAI,EAAC,SAAS;YACdF,SAAS,EAAC,iDAAiD;YAC3DG,IAAI,EAAGxD,UAAY;YACnByD,KAAK,EAAGrC,gBAAgB,IAAIvB,EAAE,CAAE,OAAQ,CAAG;YAC3C6D,OAAO,EAAGtB;UAAkB,CAC5B,CACD,EACCO,iBAAiB;QAAA,CACX;MAAC,CACM;IAAC,CACd;EAAC,CACqB,CAAC;AAE/B;AAEA,SAASgB,2BAA2BA,CAAA,EAAG;EACtC,MAAMC,KAAK,GAAGjE,YAAY,CAAEmB,qBAAqB,CAAC+C,UAAW,CAAC;EAC9D,OAAO,CAAC,CAAED,KAAK,EAAEE,MAAM;AACxB;AAEA,eAAe5C,qBAAqB;AACpC,SAASyC,2BAA2B,EAAE3C,6BAA6B","ignoreList":[]}
1
+ {"version":3,"names":["Children","cloneElement","useState","Button","__experimentalUseSlotFills","useSlotFills","ESCAPE","__","useDispatch","useSelect","closeSmall","useFocusOnMount","useFocusReturn","store","preferencesStore","editorStore","privateApis","editorPrivateApis","unlock","editSiteStore","jsx","_jsx","jsxs","_jsxs","EditorContentSlotFill","ResizableEditor","getEditorCanvasContainerTitle","view","EditorCanvasContainer","children","closeButtonLabel","onClose","enableResizing","editorCanvasContainerView","showListViewByDefault","select","_editorCanvasContainerView","getEditorCanvasContainerView","_showListViewByDefault","get","isClosed","setIsClosed","setEditorCanvasContainerView","setIsListViewOpened","focusOnMountRef","sectionFocusReturnRef","onCloseContainer","undefined","closeOnEscape","event","keyCode","defaultPrevented","preventDefault","childrenWithProps","Array","isArray","map","child","index","ref","title","shouldShowCloseButton","Fill","className","onKeyDown","size","icon","label","onClick","useHasEditorCanvasContainer","fills","name","length"],"sources":["@wordpress/edit-site/src/components/editor-canvas-container/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Children, cloneElement, useState } from '@wordpress/element';\nimport {\n\tButton,\n\t__experimentalUseSlotFills as useSlotFills,\n} from '@wordpress/components';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { closeSmall } from '@wordpress/icons';\nimport { useFocusOnMount, useFocusReturn } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\nconst { EditorContentSlotFill, ResizableEditor } = unlock( editorPrivateApis );\n\n/**\n * Returns a translated string for the title of the editor canvas container.\n *\n * @param {string} view Editor canvas container view.\n *\n * @return {Object} Translated string for the view title and associated icon, both defaulting to ''.\n */\nfunction getEditorCanvasContainerTitle( view ) {\n\tswitch ( view ) {\n\t\tcase 'style-book':\n\t\t\treturn __( 'Style Book' );\n\t\tcase 'global-styles-revisions':\n\t\tcase 'global-styles-revisions:style-book':\n\t\t\treturn __( 'Style Revisions' );\n\t\tdefault:\n\t\t\treturn '';\n\t}\n}\n\nfunction EditorCanvasContainer( {\n\tchildren,\n\tcloseButtonLabel,\n\tonClose,\n\tenableResizing = false,\n} ) {\n\tconst { editorCanvasContainerView, showListViewByDefault } = useSelect(\n\t\t( select ) => {\n\t\t\tconst _editorCanvasContainerView = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView();\n\n\t\t\tconst _showListViewByDefault = select( preferencesStore ).get(\n\t\t\t\t'core',\n\t\t\t\t'showListViewByDefault'\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\teditorCanvasContainerView: _editorCanvasContainerView,\n\t\t\t\tshowListViewByDefault: _showListViewByDefault,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst sectionFocusReturnRef = useFocusReturn();\n\n\tfunction onCloseContainer() {\n\t\tsetIsListViewOpened( showListViewByDefault );\n\t\tsetEditorCanvasContainerView( undefined );\n\t\tsetIsClosed( true );\n\t\tif ( typeof onClose === 'function' ) {\n\t\t\tonClose();\n\t\t}\n\t}\n\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tonCloseContainer();\n\t\t}\n\t}\n\n\tconst childrenWithProps = Array.isArray( children )\n\t\t? Children.map( children, ( child, index ) =>\n\t\t\t\tindex === 0\n\t\t\t\t\t? cloneElement( child, {\n\t\t\t\t\t\t\tref: sectionFocusReturnRef,\n\t\t\t\t\t } )\n\t\t\t\t\t: child\n\t\t )\n\t\t: cloneElement( children, {\n\t\t\t\tref: sectionFocusReturnRef,\n\t\t } );\n\n\tif ( isClosed ) {\n\t\treturn null;\n\t}\n\n\tconst title = getEditorCanvasContainerTitle( editorCanvasContainerView );\n\tconst shouldShowCloseButton = onClose || closeButtonLabel;\n\n\treturn (\n\t\t<EditorContentSlotFill.Fill>\n\t\t\t<div className=\"edit-site-editor-canvas-container\">\n\t\t\t\t<ResizableEditor enableResizing={ enableResizing }>\n\t\t\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t\t\t<section\n\t\t\t\t\t\tclassName=\"edit-site-editor-canvas-container__section\"\n\t\t\t\t\t\tref={ shouldShowCloseButton ? focusOnMountRef : null }\n\t\t\t\t\t\tonKeyDown={ closeOnEscape }\n\t\t\t\t\t\taria-label={ title }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ shouldShowCloseButton && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t\tclassName=\"edit-site-editor-canvas-container__close-button\"\n\t\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\t\tlabel={ closeButtonLabel || __( 'Close' ) }\n\t\t\t\t\t\t\t\tonClick={ onCloseContainer }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ childrenWithProps }\n\t\t\t\t\t</section>\n\t\t\t\t</ResizableEditor>\n\t\t\t</div>\n\t\t</EditorContentSlotFill.Fill>\n\t);\n}\n\nfunction useHasEditorCanvasContainer() {\n\tconst fills = useSlotFills( EditorContentSlotFill.name );\n\treturn !! fills?.length;\n}\n\nexport default EditorCanvasContainer;\nexport { useHasEditorCanvasContainer, getEditorCanvasContainerTitle };\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,YAAY,EAAEC,QAAQ,QAAQ,oBAAoB;AACrE,SACCC,MAAM,EACNC,0BAA0B,IAAIC,YAAY,QACpC,uBAAuB;AAC9B,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,eAAe,EAAEC,cAAc,QAAQ,oBAAoB;AACpE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;AAClE,SACCD,KAAK,IAAIE,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,EAAGA,cAAgB;QAAAH,QAAA,eAEjDN,KAAA;UACCwC,SAAS,EAAC,4CAA4C;UACtDJ,GAAG,EAAGE,qBAAqB,GAAGjB,eAAe,GAAG,IAAM;UACtDoB,SAAS,EAAGhB,aAAe;UAC3B,cAAaY,KAAO;UAAA/B,QAAA,GAElBgC,qBAAqB,iBACtBxC,IAAA,CAAClB,MAAM;YACN8D,IAAI,EAAC,SAAS;YACdF,SAAS,EAAC,iDAAiD;YAC3DG,IAAI,EAAGxD,UAAY;YACnByD,KAAK,EAAGrC,gBAAgB,IAAIvB,EAAE,CAAE,OAAQ,CAAG;YAC3C6D,OAAO,EAAGtB;UAAkB,CAC5B,CACD,EACCO,iBAAiB;QAAA,CACX;MAAC,CACM;IAAC,CACd;EAAC,CACqB,CAAC;AAE/B;AAEA,SAASgB,2BAA2BA,CAAA,EAAG;EACtC,MAAMC,KAAK,GAAGjE,YAAY,CAAEmB,qBAAqB,CAAC+C,IAAK,CAAC;EACxD,OAAO,CAAC,CAAED,KAAK,EAAEE,MAAM;AACxB;AAEA,eAAe5C,qBAAqB;AACpC,SAASyC,2BAA2B,EAAE3C,6BAA6B","ignoreList":[]}
@@ -21,16 +21,14 @@ const BlockPreviewPanel = ({
21
21
  if (!blockExample) {
22
22
  return null;
23
23
  }
24
- let example = blockExample;
25
- if (variation) {
26
- example = {
27
- ...example,
28
- attributes: {
29
- ...example.attributes,
30
- className: getVariationClassName(variation)
31
- }
32
- };
33
- }
24
+ const example = {
25
+ ...blockExample,
26
+ attributes: {
27
+ ...blockExample.attributes,
28
+ style: undefined,
29
+ className: variation ? getVariationClassName(variation) : blockExample.attributes?.className
30
+ }
31
+ };
34
32
  return getBlockFromExample(name, example);
35
33
  }, [name, blockExample, variation]);
36
34
  const viewportWidth = (_blockExample$viewpor = blockExample?.viewportWidth) !== null && _blockExample$viewpor !== void 0 ? _blockExample$viewpor : 500;
@@ -1 +1 @@
1
- {"version":3,"names":["BlockPreview","getBlockType","getBlockFromExample","__experimentalSpacer","Spacer","useMemo","getVariationClassName","jsx","_jsx","BlockPreviewPanel","name","variation","_blockExample$viewpor","blockExample","example","blocks","attributes","className","viewportWidth","previewHeight","sidebarWidth","scale","minHeight","marginX","marginBottom","children","style","maxHeight","boxSizing","additionalStyles","css","Math","round"],"sources":["@wordpress/edit-site/src/components/global-styles/block-preview-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockPreview } from '@wordpress/block-editor';\nimport { getBlockType, getBlockFromExample } from '@wordpress/blocks';\nimport { __experimentalSpacer as Spacer } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getVariationClassName } from './utils';\n\nconst BlockPreviewPanel = ( { name, variation = '' } ) => {\n\tconst blockExample = getBlockType( name )?.example;\n\tconst blocks = useMemo( () => {\n\t\tif ( ! blockExample ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tlet example = blockExample;\n\t\tif ( variation ) {\n\t\t\texample = {\n\t\t\t\t...example,\n\t\t\t\tattributes: {\n\t\t\t\t\t...example.attributes,\n\t\t\t\t\tclassName: getVariationClassName( variation ),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn getBlockFromExample( name, example );\n\t}, [ name, blockExample, variation ] );\n\n\tconst viewportWidth = blockExample?.viewportWidth ?? 500;\n\t// Same as height of InserterPreviewPanel.\n\tconst previewHeight = 144;\n\tconst sidebarWidth = 235;\n\tconst scale = sidebarWidth / viewportWidth;\n\tconst minHeight =\n\t\tscale !== 0 && scale < 1 && previewHeight\n\t\t\t? previewHeight / scale\n\t\t\t: previewHeight;\n\n\tif ( ! blockExample ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Spacer marginX={ 4 } marginBottom={ 4 }>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-global-styles__block-preview-panel\"\n\t\t\t\tstyle={ { maxHeight: previewHeight, boxSizing: 'initial' } }\n\t\t\t>\n\t\t\t\t<BlockPreview\n\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\tviewportWidth={ viewportWidth }\n\t\t\t\t\tminHeight={ previewHeight }\n\t\t\t\t\tadditionalStyles={\n\t\t\t\t\t\t//We want this CSS to be in sync with the one in InserterPreviewPanel.\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcss: `\n\t\t\t\t\t\t\t\tbody{\n\t\t\t\t\t\t\t\t\tpadding: 24px;\n\t\t\t\t\t\t\t\t\tmin-height:${ Math.round( minHeight ) }px;\n\t\t\t\t\t\t\t\t\tdisplay:flex;\n\t\t\t\t\t\t\t\t\talign-items:center;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t.is-root-container { width: 100%; }\n\t\t\t\t\t\t\t`,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t]\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</Spacer>\n\t);\n};\n\nexport default BlockPreviewPanel;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,yBAAyB;AACtD,SAASC,YAAY,EAAEC,mBAAmB,QAAQ,mBAAmB;AACrE,SAASC,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AACtE,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,SAASC,qBAAqB,QAAQ,SAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEhD,MAAMC,iBAAiB,GAAGA,CAAE;EAAEC,IAAI;EAAEC,SAAS,GAAG;AAAG,CAAC,KAAM;EAAA,IAAAC,qBAAA;EACzD,MAAMC,YAAY,GAAGZ,YAAY,CAAES,IAAK,CAAC,EAAEI,OAAO;EAClD,MAAMC,MAAM,GAAGV,OAAO,CAAE,MAAM;IAC7B,IAAK,CAAEQ,YAAY,EAAG;MACrB,OAAO,IAAI;IACZ;IAEA,IAAIC,OAAO,GAAGD,YAAY;IAC1B,IAAKF,SAAS,EAAG;MAChBG,OAAO,GAAG;QACT,G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Preview","getBlockType","getBlockFromExample","__experimentalSpacer","Spacer","useMemo","getVariationClassName","jsx","_jsx","BlockPreviewPanel","name","variation","_blockExample$viewpor","blockExample","example","blocks","attributes","style","undefined","className","viewportWidth","previewHeight","sidebarWidth","scale","minHeight","marginX","marginBottom","children","maxHeight","boxSizing","additionalStyles","css","Math","round"],"sources":["@wordpress/edit-site/src/components/global-styles/block-preview-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockPreview } from '@wordpress/block-editor';\nimport { getBlockType, getBlockFromExample } from '@wordpress/blocks';\nimport { __experimentalSpacer as Spacer } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getVariationClassName } from './utils';\n\nconst BlockPreviewPanel = ( { name, variation = '' } ) => {\n\tconst blockExample = getBlockType( name )?.example;\n\tconst blocks = useMemo( () => {\n\t\tif ( ! blockExample ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst example = {\n\t\t\t...blockExample,\n\t\t\tattributes: {\n\t\t\t\t...blockExample.attributes,\n\t\t\t\tstyle: undefined,\n\t\t\t\tclassName: variation\n\t\t\t\t\t? getVariationClassName( variation )\n\t\t\t\t\t: blockExample.attributes?.className,\n\t\t\t},\n\t\t};\n\n\t\treturn getBlockFromExample( name, example );\n\t}, [ name, blockExample, variation ] );\n\n\tconst viewportWidth = blockExample?.viewportWidth ?? 500;\n\t// Same as height of InserterPreviewPanel.\n\tconst previewHeight = 144;\n\tconst sidebarWidth = 235;\n\tconst scale = sidebarWidth / viewportWidth;\n\tconst minHeight =\n\t\tscale !== 0 && scale < 1 && previewHeight\n\t\t\t? previewHeight / scale\n\t\t\t: previewHeight;\n\n\tif ( ! blockExample ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Spacer marginX={ 4 } marginBottom={ 4 }>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-global-styles__block-preview-panel\"\n\t\t\t\tstyle={ { maxHeight: previewHeight, boxSizing: 'initial' } }\n\t\t\t>\n\t\t\t\t<BlockPreview\n\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\tviewportWidth={ viewportWidth }\n\t\t\t\t\tminHeight={ previewHeight }\n\t\t\t\t\tadditionalStyles={\n\t\t\t\t\t\t//We want this CSS to be in sync with the one in InserterPreviewPanel.\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcss: `\n\t\t\t\t\t\t\t\tbody{\n\t\t\t\t\t\t\t\t\tpadding: 24px;\n\t\t\t\t\t\t\t\t\tmin-height:${ Math.round( minHeight ) }px;\n\t\t\t\t\t\t\t\t\tdisplay:flex;\n\t\t\t\t\t\t\t\t\talign-items:center;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t.is-root-container { width: 100%; }\n\t\t\t\t\t\t\t`,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t]\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</Spacer>\n\t);\n};\n\nexport default BlockPreviewPanel;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,yBAAyB;AACtD,SAASC,YAAY,EAAEC,mBAAmB,QAAQ,mBAAmB;AACrE,SAASC,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AACtE,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,SAASC,qBAAqB,QAAQ,SAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEhD,MAAMC,iBAAiB,GAAGA,CAAE;EAAEC,IAAI;EAAEC,SAAS,GAAG;AAAG,CAAC,KAAM;EAAA,IAAAC,qBAAA;EACzD,MAAMC,YAAY,GAAGZ,YAAY,CAAES,IAAK,CAAC,EAAEI,OAAO;EAClD,MAAMC,MAAM,GAAGV,OAAO,CAAE,MAAM;IAC7B,IAAK,CAAEQ,YAAY,EAAG;MACrB,OAAO,IAAI;IACZ;IAEA,MAAMC,OAAO,GAAG;MACf,GAAG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CAAC;AAEX,CAAC;AAED,eAAef,iBAAiB","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * WordPress dependencies
3
4
  */
@@ -91,12 +92,13 @@ function ScreenBlock({
91
92
  });
92
93
  const [userSettings] = useGlobalSetting('', name, 'user');
93
94
  const [rawSettings, setSettings] = useGlobalSetting('', name);
94
- const settings = useSettingsForBlockElement(rawSettings, name);
95
+ const settingsForBlockElement = useSettingsForBlockElement(rawSettings, name);
95
96
  const blockType = getBlockType(name);
96
97
 
97
98
  // Only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied.
98
- if (settings?.spacing?.blockGap && blockType?.supports?.spacing?.blockGap && (blockType?.supports?.spacing?.__experimentalSkipSerialization === true || blockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(spacingType => spacingType === 'blockGap'))) {
99
- settings.spacing.blockGap = false;
99
+ let disableBlockGap = false;
100
+ if (settingsForBlockElement?.spacing?.blockGap && blockType?.supports?.spacing?.blockGap && (blockType?.supports?.spacing?.skipSerialization === true || blockType?.supports?.spacing?.skipSerialization?.some?.(spacingType => spacingType === 'blockGap'))) {
101
+ disableBlockGap = true;
100
102
  }
101
103
 
102
104
  // Only allow `aspectRatio` support if the block is not the grouping block.
@@ -105,9 +107,20 @@ function ScreenBlock({
105
107
  // for all three at once. Until there is the ability to set a different aspect
106
108
  // ratio for each variation, we disable the aspect ratio controls for the
107
109
  // grouping block in global styles.
108
- if (settings?.dimensions?.aspectRatio && name === 'core/group') {
109
- settings.dimensions.aspectRatio = false;
110
+ let disableAspectRatio = false;
111
+ if (settingsForBlockElement?.dimensions?.aspectRatio && name === 'core/group') {
112
+ disableAspectRatio = true;
110
113
  }
114
+ const settings = useMemo(() => {
115
+ const updatedSettings = structuredClone(settingsForBlockElement);
116
+ if (disableBlockGap) {
117
+ updatedSettings.spacing.blockGap = false;
118
+ }
119
+ if (disableAspectRatio) {
120
+ updatedSettings.dimensions.aspectRatio = false;
121
+ }
122
+ return updatedSettings;
123
+ }, [settingsForBlockElement, disableBlockGap, disableAspectRatio]);
111
124
  const blockVariations = useBlockVariations(name);
112
125
  const hasBackgroundPanel = useHasBackgroundPanel(settings);
113
126
  const hasTypographyPanel = useHasTypographyPanel(settings);