@wordpress/edit-site 5.25.0 → 5.26.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 (433) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/build/components/block-editor/back-button.js +3 -2
  4. package/build/components/block-editor/back-button.js.map +1 -1
  5. package/build/components/block-editor/resizable-editor.js +2 -2
  6. package/build/components/block-editor/resizable-editor.js.map +1 -1
  7. package/build/components/block-editor/use-post-link-props.js +27 -0
  8. package/build/components/block-editor/use-post-link-props.js.map +1 -0
  9. package/build/components/block-editor/use-site-editor-settings.js +7 -24
  10. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  11. package/build/components/create-template-part-modal/index.js +15 -7
  12. package/build/components/create-template-part-modal/index.js.map +1 -1
  13. package/build/components/editor/index.js +15 -16
  14. package/build/components/editor/index.js.map +1 -1
  15. package/build/components/editor-canvas-container/index.js +9 -7
  16. package/build/components/editor-canvas-container/index.js.map +1 -1
  17. package/build/components/global-styles/font-library-modal/collection-font-variant.js +5 -2
  18. package/build/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
  19. package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js +3 -3
  20. package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +1 -1
  21. package/build/components/global-styles/font-library-modal/context.js +5 -5
  22. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  23. package/build/components/global-styles/font-library-modal/font-collection.js +8 -4
  24. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  25. package/build/components/global-styles/font-library-modal/index.js +38 -21
  26. package/build/components/global-styles/font-library-modal/index.js.map +1 -1
  27. package/build/components/global-styles/font-library-modal/installed-fonts.js +2 -2
  28. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  29. package/build/components/global-styles/font-library-modal/library-font-variant.js +5 -2
  30. package/build/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
  31. package/build/components/global-styles/font-library-modal/local-fonts.js +26 -10
  32. package/build/components/global-styles/font-library-modal/local-fonts.js.map +1 -1
  33. package/build/components/global-styles/font-library-modal/resolvers.js +6 -6
  34. package/build/components/global-styles/font-library-modal/resolvers.js.map +1 -1
  35. package/build/components/global-styles/font-library-modal/{tab-layout.js → tab-panel-layout.js} +4 -4
  36. package/build/components/global-styles/font-library-modal/tab-panel-layout.js.map +1 -0
  37. package/build/components/global-styles/font-library-modal/utils/index.js +35 -38
  38. package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  39. package/build/components/global-styles/preview.js +43 -1
  40. package/build/components/global-styles/preview.js.map +1 -1
  41. package/build/components/global-styles/screen-color-palette.js +16 -12
  42. package/build/components/global-styles/screen-color-palette.js.map +1 -1
  43. package/build/components/global-styles/screen-revisions/index.js +52 -52
  44. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  45. package/build/components/global-styles/screen-revisions/revisions-buttons.js +26 -35
  46. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  47. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +40 -22
  48. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  49. package/build/components/global-styles/ui.js +13 -62
  50. package/build/components/global-styles/ui.js.map +1 -1
  51. package/build/components/header-edit-mode/document-tools/index.js +8 -106
  52. package/build/components/header-edit-mode/document-tools/index.js.map +1 -1
  53. package/build/components/header-edit-mode/index.js +7 -11
  54. package/build/components/header-edit-mode/index.js.map +1 -1
  55. package/build/components/header-edit-mode/mode-switcher/index.js +0 -2
  56. package/build/components/header-edit-mode/mode-switcher/index.js.map +1 -1
  57. package/build/components/header-edit-mode/more-menu/index.js +10 -7
  58. package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
  59. package/build/components/keyboard-shortcuts/edit-mode.js +0 -23
  60. package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
  61. package/build/components/keyboard-shortcuts/register.js +0 -36
  62. package/build/components/keyboard-shortcuts/register.js.map +1 -1
  63. package/build/components/layout/index.js +6 -13
  64. package/build/components/layout/index.js.map +1 -1
  65. package/build/components/page-main/index.js +4 -4
  66. package/build/components/page-main/index.js.map +1 -1
  67. package/build/components/page-pages/index.js +84 -37
  68. package/build/components/page-pages/index.js.map +1 -1
  69. package/build/components/page-patterns/dataviews-pattern-actions.js +305 -0
  70. package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -0
  71. package/build/components/page-patterns/dataviews-patterns.js +307 -0
  72. package/build/components/page-patterns/dataviews-patterns.js.map +1 -0
  73. package/build/components/page-patterns/duplicate-menu-item.js +1 -1
  74. package/build/components/page-patterns/duplicate-menu-item.js.map +1 -1
  75. package/build/components/page-patterns/grid-item.js +4 -3
  76. package/build/components/page-patterns/grid-item.js.map +1 -1
  77. package/build/components/page-patterns/patterns-list.js +2 -1
  78. package/build/components/page-patterns/patterns-list.js.map +1 -1
  79. package/build/components/page-patterns/use-patterns.js +23 -13
  80. package/build/components/page-patterns/use-patterns.js.map +1 -1
  81. package/build/components/page-templates/index.js +312 -36
  82. package/build/components/page-templates/index.js.map +1 -1
  83. package/build/components/{page-patterns/pagination.js → pagination/index.js} +25 -12
  84. package/build/components/pagination/index.js.map +1 -0
  85. package/build/components/{page-pages/side-editor.js → post-preview/index.js} +8 -4
  86. package/build/components/post-preview/index.js.map +1 -0
  87. package/build/components/preferences-modal/enable-feature.js +3 -2
  88. package/build/components/preferences-modal/enable-feature.js.map +1 -1
  89. package/build/components/preferences-modal/enable-panel-option.js +33 -0
  90. package/build/components/preferences-modal/enable-panel-option.js.map +1 -0
  91. package/build/components/preferences-modal/index.js +57 -9
  92. package/build/components/preferences-modal/index.js.map +1 -1
  93. package/build/components/revisions/index.js +3 -7
  94. package/build/components/revisions/index.js.map +1 -1
  95. package/build/components/routes/link.js +6 -2
  96. package/build/components/routes/link.js.map +1 -1
  97. package/build/components/save-button/index.js +6 -3
  98. package/build/components/save-button/index.js.map +1 -1
  99. package/build/components/sidebar/index.js +3 -11
  100. package/build/components/sidebar/index.js.map +1 -1
  101. package/build/components/sidebar-dataviews/add-new-view.js +2 -2
  102. package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
  103. package/build/components/sidebar-dataviews/default-views.js +18 -5
  104. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  105. package/build/components/sidebar-dataviews/index.js +3 -3
  106. package/build/components/sidebar-dataviews/index.js.map +1 -1
  107. package/build/components/sidebar-edit-mode/default-sidebar.js +1 -5
  108. package/build/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
  109. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +62 -10
  110. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  111. package/build/components/sidebar-edit-mode/page-panels/index.js +1 -1
  112. package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  113. package/build/components/sidebar-edit-mode/plugin-sidebar/index.js +0 -4
  114. package/build/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
  115. package/build/components/sidebar-edit-mode/template-panel/index.js +4 -13
  116. package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  117. package/build/components/sidebar-navigation-screen-details-footer/index.js +1 -1
  118. package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  119. package/build/components/sidebar-navigation-screen-global-styles/index.js +5 -2
  120. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  121. package/build/components/sidebar-navigation-screen-page/index.js +4 -1
  122. package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
  123. package/build/components/sidebar-navigation-screen-pages-dataviews/index.js +69 -0
  124. package/build/components/sidebar-navigation-screen-pages-dataviews/index.js.map +1 -0
  125. package/build/components/style-book/index.js +38 -8
  126. package/build/components/style-book/index.js.map +1 -1
  127. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
  128. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  129. package/build/hooks/commands/use-edit-mode-commands.js +11 -6
  130. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  131. package/build/index.js +12 -7
  132. package/build/index.js.map +1 -1
  133. package/build/store/actions.js +39 -44
  134. package/build/store/actions.js.map +1 -1
  135. package/build/store/private-actions.js +6 -2
  136. package/build/store/private-actions.js.map +1 -1
  137. package/build/store/reducer.js +0 -46
  138. package/build/store/reducer.js.map +1 -1
  139. package/build/store/selectors.js +32 -41
  140. package/build/store/selectors.js.map +1 -1
  141. package/build/utils/get-is-list-page.js +1 -1
  142. package/build/utils/get-is-list-page.js.map +1 -1
  143. package/build-module/components/block-editor/back-button.js +4 -3
  144. package/build-module/components/block-editor/back-button.js.map +1 -1
  145. package/build-module/components/block-editor/resizable-editor.js +2 -2
  146. package/build-module/components/block-editor/resizable-editor.js.map +1 -1
  147. package/build-module/components/block-editor/use-post-link-props.js +20 -0
  148. package/build-module/components/block-editor/use-post-link-props.js.map +1 -0
  149. package/build-module/components/block-editor/use-site-editor-settings.js +8 -25
  150. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  151. package/build-module/components/create-template-part-modal/index.js +14 -7
  152. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  153. package/build-module/components/editor/index.js +16 -17
  154. package/build-module/components/editor/index.js.map +1 -1
  155. package/build-module/components/editor-canvas-container/index.js +9 -7
  156. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  157. package/build-module/components/global-styles/font-library-modal/collection-font-variant.js +5 -2
  158. package/build-module/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
  159. package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js +3 -3
  160. package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +1 -1
  161. package/build-module/components/global-styles/font-library-modal/context.js +7 -7
  162. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  163. package/build-module/components/global-styles/font-library-modal/font-collection.js +8 -4
  164. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  165. package/build-module/components/global-styles/font-library-modal/index.js +39 -22
  166. package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
  167. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +2 -2
  168. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  169. package/build-module/components/global-styles/font-library-modal/library-font-variant.js +5 -2
  170. package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
  171. package/build-module/components/global-styles/font-library-modal/local-fonts.js +27 -11
  172. package/build-module/components/global-styles/font-library-modal/local-fonts.js.map +1 -1
  173. package/build-module/components/global-styles/font-library-modal/resolvers.js +5 -5
  174. package/build-module/components/global-styles/font-library-modal/resolvers.js.map +1 -1
  175. package/build-module/components/global-styles/font-library-modal/{tab-layout.js → tab-panel-layout.js} +4 -4
  176. package/build-module/components/global-styles/font-library-modal/tab-panel-layout.js.map +1 -0
  177. package/build-module/components/global-styles/font-library-modal/utils/index.js +34 -36
  178. package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  179. package/build-module/components/global-styles/preview.js +45 -3
  180. package/build-module/components/global-styles/preview.js.map +1 -1
  181. package/build-module/components/global-styles/screen-color-palette.js +17 -13
  182. package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
  183. package/build-module/components/global-styles/screen-revisions/index.js +53 -53
  184. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  185. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +27 -36
  186. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  187. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +40 -22
  188. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  189. package/build-module/components/global-styles/ui.js +15 -64
  190. package/build-module/components/global-styles/ui.js.map +1 -1
  191. package/build-module/components/header-edit-mode/document-tools/index.js +13 -110
  192. package/build-module/components/header-edit-mode/document-tools/index.js.map +1 -1
  193. package/build-module/components/header-edit-mode/index.js +7 -11
  194. package/build-module/components/header-edit-mode/index.js.map +1 -1
  195. package/build-module/components/header-edit-mode/mode-switcher/index.js +0 -2
  196. package/build-module/components/header-edit-mode/mode-switcher/index.js.map +1 -1
  197. package/build-module/components/header-edit-mode/more-menu/index.js +10 -7
  198. package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
  199. package/build-module/components/keyboard-shortcuts/edit-mode.js +0 -23
  200. package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
  201. package/build-module/components/keyboard-shortcuts/register.js +0 -36
  202. package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
  203. package/build-module/components/layout/index.js +6 -13
  204. package/build-module/components/layout/index.js.map +1 -1
  205. package/build-module/components/page-main/index.js +4 -4
  206. package/build-module/components/page-main/index.js.map +1 -1
  207. package/build-module/components/page-pages/index.js +83 -36
  208. package/build-module/components/page-pages/index.js.map +1 -1
  209. package/build-module/components/page-patterns/dataviews-pattern-actions.js +292 -0
  210. package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -0
  211. package/build-module/components/page-patterns/dataviews-patterns.js +299 -0
  212. package/build-module/components/page-patterns/dataviews-patterns.js.map +1 -0
  213. package/build-module/components/page-patterns/duplicate-menu-item.js +1 -1
  214. package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -1
  215. package/build-module/components/page-patterns/grid-item.js +4 -3
  216. package/build-module/components/page-patterns/grid-item.js.map +1 -1
  217. package/build-module/components/page-patterns/patterns-list.js +2 -1
  218. package/build-module/components/page-patterns/patterns-list.js.map +1 -1
  219. package/build-module/components/page-patterns/use-patterns.js +23 -13
  220. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  221. package/build-module/components/page-templates/index.js +314 -38
  222. package/build-module/components/page-templates/index.js.map +1 -1
  223. package/build-module/components/{page-patterns/pagination.js → pagination/index.js} +24 -12
  224. package/build-module/components/pagination/index.js.map +1 -0
  225. package/build-module/components/{page-pages/side-editor.js → post-preview/index.js} +7 -3
  226. package/build-module/components/post-preview/index.js.map +1 -0
  227. package/build-module/components/preferences-modal/enable-feature.js +3 -2
  228. package/build-module/components/preferences-modal/enable-feature.js.map +1 -1
  229. package/build-module/components/preferences-modal/enable-panel-option.js +26 -0
  230. package/build-module/components/preferences-modal/enable-panel-option.js.map +1 -0
  231. package/build-module/components/preferences-modal/index.js +57 -9
  232. package/build-module/components/preferences-modal/index.js.map +1 -1
  233. package/build-module/components/revisions/index.js +4 -8
  234. package/build-module/components/revisions/index.js.map +1 -1
  235. package/build-module/components/routes/link.js +5 -2
  236. package/build-module/components/routes/link.js.map +1 -1
  237. package/build-module/components/save-button/index.js +6 -3
  238. package/build-module/components/save-button/index.js.map +1 -1
  239. package/build-module/components/sidebar/index.js +3 -11
  240. package/build-module/components/sidebar/index.js.map +1 -1
  241. package/build-module/components/sidebar-dataviews/add-new-view.js +1 -1
  242. package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
  243. package/build-module/components/sidebar-dataviews/default-views.js +17 -5
  244. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  245. package/build-module/components/sidebar-dataviews/index.js +2 -2
  246. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  247. package/build-module/components/sidebar-edit-mode/default-sidebar.js +1 -5
  248. package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
  249. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +64 -12
  250. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  251. package/build-module/components/sidebar-edit-mode/page-panels/index.js +2 -2
  252. package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  253. package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js +0 -4
  254. package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
  255. package/build-module/components/sidebar-edit-mode/template-panel/index.js +6 -15
  256. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  257. package/build-module/components/sidebar-navigation-screen-details-footer/index.js +1 -1
  258. package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  259. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +5 -2
  260. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  261. package/build-module/components/sidebar-navigation-screen-page/index.js +4 -1
  262. package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
  263. package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js +61 -0
  264. package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js.map +1 -0
  265. package/build-module/components/style-book/index.js +40 -10
  266. package/build-module/components/style-book/index.js.map +1 -1
  267. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
  268. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  269. package/build-module/hooks/commands/use-edit-mode-commands.js +11 -6
  270. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  271. package/build-module/index.js +12 -7
  272. package/build-module/index.js.map +1 -1
  273. package/build-module/store/actions.js +36 -41
  274. package/build-module/store/actions.js.map +1 -1
  275. package/build-module/store/private-actions.js +6 -2
  276. package/build-module/store/private-actions.js.map +1 -1
  277. package/build-module/store/reducer.js +0 -44
  278. package/build-module/store/reducer.js.map +1 -1
  279. package/build-module/store/selectors.js +30 -38
  280. package/build-module/store/selectors.js.map +1 -1
  281. package/build-module/utils/get-is-list-page.js +1 -1
  282. package/build-module/utils/get-is-list-page.js.map +1 -1
  283. package/build-style/style-rtl.css +357 -268
  284. package/build-style/style.css +357 -268
  285. package/package.json +42 -42
  286. package/src/components/add-new-template/style.scss +2 -1
  287. package/src/components/block-editor/back-button.js +4 -2
  288. package/src/components/block-editor/resizable-editor.js +1 -1
  289. package/src/components/block-editor/style.scss +1 -2
  290. package/src/components/block-editor/use-post-link-props.js +20 -0
  291. package/src/components/block-editor/use-site-editor-settings.js +10 -41
  292. package/src/components/code-editor/style.scss +0 -4
  293. package/src/components/create-template-part-modal/index.js +83 -82
  294. package/src/components/editor/index.js +24 -31
  295. package/src/components/editor-canvas-container/index.js +8 -6
  296. package/src/components/global-styles/font-library-modal/collection-font-variant.js +7 -2
  297. package/src/components/global-styles/font-library-modal/confirm-delete-dialog.js +3 -3
  298. package/src/components/global-styles/font-library-modal/context.js +7 -7
  299. package/src/components/global-styles/font-library-modal/font-collection.js +10 -5
  300. package/src/components/global-styles/font-library-modal/index.js +44 -24
  301. package/src/components/global-styles/font-library-modal/installed-fonts.js +3 -3
  302. package/src/components/global-styles/font-library-modal/library-font-variant.js +7 -2
  303. package/src/components/global-styles/font-library-modal/local-fonts.js +53 -26
  304. package/src/components/global-styles/font-library-modal/resolvers.js +5 -5
  305. package/src/components/global-styles/font-library-modal/style.scss +5 -2
  306. package/src/components/global-styles/font-library-modal/{tab-layout.js → tab-panel-layout.js} +9 -3
  307. package/src/components/global-styles/font-library-modal/utils/index.js +21 -23
  308. package/src/components/global-styles/font-library-modal/utils/test/makeFormDataFromFontFamily.spec.js +58 -0
  309. package/src/components/global-styles/preview.js +55 -3
  310. package/src/components/global-styles/screen-color-palette.js +16 -26
  311. package/src/components/global-styles/screen-revisions/index.js +91 -92
  312. package/src/components/global-styles/screen-revisions/revisions-buttons.js +37 -38
  313. package/src/components/global-styles/screen-revisions/style.scss +77 -20
  314. package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +67 -0
  315. package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +73 -46
  316. package/src/components/global-styles/ui.js +13 -74
  317. package/src/components/header-edit-mode/document-tools/index.js +33 -165
  318. package/src/components/header-edit-mode/index.js +6 -17
  319. package/src/components/header-edit-mode/mode-switcher/index.js +0 -4
  320. package/src/components/header-edit-mode/more-menu/index.js +9 -7
  321. package/src/components/header-edit-mode/style.scss +0 -47
  322. package/src/components/keyboard-shortcuts/edit-mode.js +1 -26
  323. package/src/components/keyboard-shortcuts/register.js +0 -43
  324. package/src/components/layout/index.js +8 -27
  325. package/src/components/layout/style.scss +10 -3
  326. package/src/components/list/style.scss +0 -5
  327. package/src/components/page/style.scss +1 -1
  328. package/src/components/page-main/index.js +8 -8
  329. package/src/components/page-pages/index.js +112 -41
  330. package/src/components/page-pages/style.scss +3 -2
  331. package/src/components/page-patterns/dataviews-pattern-actions.js +329 -0
  332. package/src/components/page-patterns/dataviews-patterns.js +380 -0
  333. package/src/components/page-patterns/duplicate-menu-item.js +1 -1
  334. package/src/components/page-patterns/grid-item.js +3 -2
  335. package/src/components/page-patterns/patterns-list.js +2 -1
  336. package/src/components/page-patterns/style.scss +89 -26
  337. package/src/components/page-patterns/use-patterns.js +24 -15
  338. package/src/components/page-templates/index.js +399 -64
  339. package/src/components/{page-patterns/pagination.js → pagination/index.js} +21 -10
  340. package/src/components/pagination/style.scss +5 -0
  341. package/src/components/post-preview/index.js +16 -0
  342. package/src/components/preferences-modal/enable-feature.js +9 -5
  343. package/src/components/preferences-modal/enable-panel-option.js +23 -0
  344. package/src/components/preferences-modal/index.js +107 -22
  345. package/src/components/revisions/index.js +8 -15
  346. package/src/components/routes/link.js +11 -3
  347. package/src/components/save-button/index.js +16 -3
  348. package/src/components/sidebar/index.js +6 -13
  349. package/src/components/sidebar-dataviews/add-new-view.js +1 -1
  350. package/src/components/sidebar-dataviews/default-views.js +23 -6
  351. package/src/components/sidebar-dataviews/index.js +2 -2
  352. package/src/components/sidebar-edit-mode/default-sidebar.js +0 -12
  353. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +85 -14
  354. package/src/components/sidebar-edit-mode/page-panels/index.js +15 -1
  355. package/src/components/sidebar-edit-mode/plugin-sidebar/index.js +0 -12
  356. package/src/components/sidebar-edit-mode/style.scss +0 -10
  357. package/src/components/sidebar-edit-mode/template-panel/index.js +44 -40
  358. package/src/components/sidebar-edit-mode/template-panel/style.scss +0 -4
  359. package/src/components/sidebar-navigation-screen-details-footer/index.js +1 -1
  360. package/src/components/sidebar-navigation-screen-global-styles/index.js +3 -2
  361. package/src/components/sidebar-navigation-screen-page/index.js +2 -1
  362. package/src/components/sidebar-navigation-screen-pages-dataviews/index.js +77 -0
  363. package/src/components/site-hub/style.scss +5 -2
  364. package/src/components/style-book/index.js +65 -21
  365. package/src/components/style-book/style.scss +3 -3
  366. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +4 -1
  367. package/src/hooks/commands/use-edit-mode-commands.js +8 -12
  368. package/src/index.js +11 -5
  369. package/src/store/actions.js +35 -45
  370. package/src/store/private-actions.js +7 -3
  371. package/src/store/reducer.js +0 -44
  372. package/src/store/selectors.js +32 -38
  373. package/src/store/test/actions.js +11 -39
  374. package/src/store/test/reducer.js +1 -82
  375. package/src/store/test/selectors.js +0 -24
  376. package/src/style.scss +1 -1
  377. package/src/utils/get-is-list-page.js +2 -3
  378. package/build/components/global-styles/font-library-modal/tab-layout.js.map +0 -1
  379. package/build/components/global-styles/screen-revisions/get-revision-changes.js +0 -146
  380. package/build/components/global-styles/screen-revisions/get-revision-changes.js.map +0 -1
  381. package/build/components/header-edit-mode/undo-redo/redo.js +0 -41
  382. package/build/components/header-edit-mode/undo-redo/redo.js.map +0 -1
  383. package/build/components/header-edit-mode/undo-redo/undo.js +0 -40
  384. package/build/components/header-edit-mode/undo-redo/undo.js.map +0 -1
  385. package/build/components/page-pages/side-editor.js.map +0 -1
  386. package/build/components/page-patterns/pagination.js.map +0 -1
  387. package/build/components/page-templates/dataviews-templates.js +0 -317
  388. package/build/components/page-templates/dataviews-templates.js.map +0 -1
  389. package/build/components/secondary-sidebar/inserter-sidebar.js +0 -60
  390. package/build/components/secondary-sidebar/inserter-sidebar.js.map +0 -1
  391. package/build/components/secondary-sidebar/list-view-sidebar.js +0 -109
  392. package/build/components/secondary-sidebar/list-view-sidebar.js.map +0 -1
  393. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +0 -35
  394. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +0 -1
  395. package/build/components/sidebar-edit-mode/template-panel/last-revision.js +0 -73
  396. package/build/components/sidebar-edit-mode/template-panel/last-revision.js.map +0 -1
  397. package/build/components/sidebar-edit-mode/template-panel/pattern-categories.js +0 -219
  398. package/build/components/sidebar-edit-mode/template-panel/pattern-categories.js.map +0 -1
  399. package/build-module/components/global-styles/font-library-modal/tab-layout.js.map +0 -1
  400. package/build-module/components/global-styles/screen-revisions/get-revision-changes.js +0 -139
  401. package/build-module/components/global-styles/screen-revisions/get-revision-changes.js.map +0 -1
  402. package/build-module/components/header-edit-mode/undo-redo/redo.js +0 -33
  403. package/build-module/components/header-edit-mode/undo-redo/redo.js.map +0 -1
  404. package/build-module/components/header-edit-mode/undo-redo/undo.js +0 -32
  405. package/build-module/components/header-edit-mode/undo-redo/undo.js.map +0 -1
  406. package/build-module/components/page-pages/side-editor.js.map +0 -1
  407. package/build-module/components/page-patterns/pagination.js.map +0 -1
  408. package/build-module/components/page-templates/dataviews-templates.js +0 -309
  409. package/build-module/components/page-templates/dataviews-templates.js.map +0 -1
  410. package/build-module/components/secondary-sidebar/inserter-sidebar.js +0 -53
  411. package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +0 -1
  412. package/build-module/components/secondary-sidebar/list-view-sidebar.js +0 -102
  413. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +0 -1
  414. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +0 -27
  415. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +0 -1
  416. package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js +0 -65
  417. package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js.map +0 -1
  418. package/build-module/components/sidebar-edit-mode/template-panel/pattern-categories.js +0 -209
  419. package/build-module/components/sidebar-edit-mode/template-panel/pattern-categories.js.map +0 -1
  420. package/src/components/global-styles/font-library-modal/utils/test/makeFormDataFromFontFamilies.spec.js +0 -62
  421. package/src/components/global-styles/font-library-modal/utils/test/wpKebabCase.spec.js +0 -28
  422. package/src/components/global-styles/screen-revisions/get-revision-changes.js +0 -171
  423. package/src/components/global-styles/screen-revisions/test/get-revision-changes.js +0 -191
  424. package/src/components/header-edit-mode/undo-redo/redo.js +0 -38
  425. package/src/components/header-edit-mode/undo-redo/undo.js +0 -34
  426. package/src/components/page-pages/side-editor.js +0 -14
  427. package/src/components/page-templates/dataviews-templates.js +0 -360
  428. package/src/components/secondary-sidebar/inserter-sidebar.js +0 -66
  429. package/src/components/secondary-sidebar/list-view-sidebar.js +0 -123
  430. package/src/components/secondary-sidebar/style.scss +0 -65
  431. package/src/components/sidebar-edit-mode/sidebar-fixed-bottom.js +0 -26
  432. package/src/components/sidebar-edit-mode/template-panel/last-revision.js +0 -82
  433. package/src/components/sidebar-edit-mode/template-panel/pattern-categories.js +0 -279
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","settings","state","action","type","editedPost","postType","id","context","blockInserterPanel","isOpen","value","listViewPanel","saveViewPanel","canvasMode","mode","editorCanvasContainerView","undefined","view","_default","combineReducers","exports","default"],"sources":["@wordpress/edit-site/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer returning the settings.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function settings( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_SETTINGS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.settings,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the currently edited Post Type,\n * Post Id and the context provided to fill the content of the block editor.\n *\n * @param {Object} state Current edited post.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function editedPost( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_EDITED_POST':\n\t\t\treturn {\n\t\t\t\tpostType: action.postType,\n\t\t\t\tid: action.id,\n\t\t\t\tcontext: action.context,\n\t\t\t};\n\t\tcase 'SET_EDITED_POST_CONTEXT':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tcontext: action.context,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the navigation and list view panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {boolean|Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t\tcase 'SET_CANVAS_MODE':\n\t\t\treturn false;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the navigation and inserter panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t\tcase 'SET_CANVAS_MODE':\n\t\t\treturn false;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the save view panel open or closed.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function saveViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_SAVE_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t\tcase 'SET_CANVAS_MODE':\n\t\t\treturn false;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer used to track the site editor canvas mode (edit or view).\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nfunction canvasMode( state = 'init', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_CANVAS_MODE':\n\t\t\treturn action.mode;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer used to track the site editor canvas container view.\n * Default is `undefined`, denoting the default, visual block editor.\n * This could be, for example, `'style-book'` (the style book).\n *\n * @param {string|undefined} state Current state.\n * @param {Object} action Dispatched action.\n */\nfunction editorCanvasContainerView( state = undefined, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_EDITOR_CANVAS_CONTAINER_VIEW':\n\t\t\treturn action.view;\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tsettings,\n\teditedPost,\n\tblockInserterPanel,\n\tlistViewPanel,\n\tsaveViewPanel,\n\tcanvasMode,\n\teditorCanvasContainerView,\n} );\n"],"mappings":";;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,QAAQA,CAAEC,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAC9C,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,iBAAiB;MACrB,OAAO;QACN,GAAGF,KAAK;QACR,GAAGC,MAAM,CAACF;MACX,CAAC;EACH;EAEA,OAAOC,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,UAAUA,CAAEH,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAChD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,iBAAiB;MACrB,OAAO;QACNE,QAAQ,EAAEH,MAAM,CAACG,QAAQ;QACzBC,EAAE,EAAEJ,MAAM,CAACI,EAAE;QACbC,OAAO,EAAEL,MAAM,CAACK;MACjB,CAAC;IACF,KAAK,yBAAyB;MAC7B,OAAO;QACN,GAAGN,KAAK;QACRM,OAAO,EAAEL,MAAM,CAACK;MACjB,CAAC;EACH;EAEA,OAAON,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,kBAAkBA,CAAEP,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;EAC3D,QAASA,MAAM,CAACC,IAAI;IACnB,K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C,qBAAe,EAAE;EAC/BnB,QAAQ;EACRI,UAAU;EACVI,kBAAkB;EAClBG,aAAa;EACbC,aAAa;EACbC,UAAU;EACVE;AACD,CAAE,CAAC;AAAAK,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
1
+ {"version":3,"names":["_data","require","settings","state","action","type","editedPost","postType","id","context","saveViewPanel","isOpen","canvasMode","mode","editorCanvasContainerView","undefined","view","_default","combineReducers","exports","default"],"sources":["@wordpress/edit-site/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer returning the settings.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function settings( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_SETTINGS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.settings,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the currently edited Post Type,\n * Post Id and the context provided to fill the content of the block editor.\n *\n * @param {Object} state Current edited post.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function editedPost( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_EDITED_POST':\n\t\t\treturn {\n\t\t\t\tpostType: action.postType,\n\t\t\t\tid: action.id,\n\t\t\t\tcontext: action.context,\n\t\t\t};\n\t\tcase 'SET_EDITED_POST_CONTEXT':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tcontext: action.context,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer to set the save view panel open or closed.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function saveViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_SAVE_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t\tcase 'SET_CANVAS_MODE':\n\t\t\treturn false;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer used to track the site editor canvas mode (edit or view).\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nfunction canvasMode( state = 'init', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_CANVAS_MODE':\n\t\t\treturn action.mode;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer used to track the site editor canvas container view.\n * Default is `undefined`, denoting the default, visual block editor.\n * This could be, for example, `'style-book'` (the style book).\n *\n * @param {string|undefined} state Current state.\n * @param {Object} action Dispatched action.\n */\nfunction editorCanvasContainerView( state = undefined, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_EDITOR_CANVAS_CONTAINER_VIEW':\n\t\t\treturn action.view;\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tsettings,\n\teditedPost,\n\tsaveViewPanel,\n\tcanvasMode,\n\teditorCanvasContainerView,\n} );\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,QAAQA,CAAEC,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAC9C,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,iBAAiB;MACrB,OAAO;QACN,GAAGF,KAAK;QACR,GAAGC,MAAM,CAACF;MACX,CAAC;EACH;EAEA,OAAOC,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,UAAUA,CAAEH,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAChD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,iBAAiB;MACrB,OAAO;QACNE,QAAQ,EAAEH,MAAM,CAACG,QAAQ;QACzBC,EAAE,EAAEJ,MAAM,CAACI,EAAE;QACbC,OAAO,EAAEL,MAAM,CAACK;MACjB,CAAC;IACF,KAAK,yBAAyB;MAC7B,OAAO;QACN,GAAGN,KAAK;QACRM,OAAO,EAAEL,MAAM,CAACK;MACjB,CAAC;EACH;EAEA,OAAON,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,aAAaA,CAAEP,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;EACtD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,yBAAyB;MAC7B,OAAOD,MAAM,CAACO,MAAM;IACrB,KAAK,iBAAiB;MACrB,OAAO,KAAK;EACd;EACA,OAAOR,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASS,UAAUA,CAAET,KAAK,GAAG,MAAM,EAAEC,MAAM,EAAG;EAC7C,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,iBAAiB;MACrB,OAAOD,MAAM,CAACS,IAAI;EACpB;EAEA,OAAOV,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASW,yBAAyBA,CAAEX,KAAK,GAAGY,SAAS,EAAEX,MAAM,EAAG;EAC/D,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,kCAAkC;MACtC,OAAOD,MAAM,CAACY,IAAI;EACpB;EAEA,OAAOb,KAAK;AACb;AAAC,IAAAc,QAAA,GAEc,IAAAC,qBAAe,EAAE;EAC/BhB,QAAQ;EACRI,UAAU;EACVI,aAAa;EACbE,UAAU;EACVE;AACD,CAAE,CAAC;AAAAK,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
@@ -17,9 +17,7 @@ exports.getPage = getPage;
17
17
  exports.getReusableBlocks = void 0;
18
18
  exports.getSettings = getSettings;
19
19
  exports.hasPageContentFocus = hasPageContentFocus;
20
- exports.isFeatureActive = void 0;
21
- exports.isInserterOpened = isInserterOpened;
22
- exports.isListViewOpened = isListViewOpened;
20
+ exports.isListViewOpened = exports.isInserterOpened = exports.isFeatureActive = void 0;
23
21
  exports.isNavigationOpened = isNavigationOpened;
24
22
  exports.isPage = isPage;
25
23
  exports.isSaveViewOpened = isSaveViewOpened;
@@ -32,6 +30,7 @@ var _blockEditor = require("@wordpress/block-editor");
32
30
  var _editor = require("@wordpress/editor");
33
31
  var _utils = require("./utils");
34
32
  var _constants = require("../utils/constants");
33
+ var _lockUnlock = require("../lock-unlock");
35
34
  /**
36
35
  * WordPress dependencies
37
36
  */
@@ -183,64 +182,55 @@ function getPage(state) {
183
182
  }
184
183
 
185
184
  /**
186
- * Returns the current opened/closed state of the inserter panel.
185
+ * Returns true if the inserter is opened.
186
+ *
187
+ * @deprecated
187
188
  *
188
189
  * @param {Object} state Global application state.
189
190
  *
190
- * @return {boolean} True if the inserter panel should be open; false if closed.
191
+ * @return {boolean} Whether the inserter is opened.
191
192
  */
192
- function isInserterOpened(state) {
193
- return !!state.blockInserterPanel;
194
- }
193
+ const isInserterOpened = (0, _data.createRegistrySelector)(select => () => {
194
+ (0, _deprecated.default)(`select( 'core/edit-site' ).isInserterOpened`, {
195
+ since: '6.5',
196
+ alternative: `select( 'core/editor' ).isInserterOpened`
197
+ });
198
+ return select(_editor.store).isInserterOpened();
199
+ });
195
200
 
196
201
  /**
197
202
  * Get the insertion point for the inserter.
198
203
  *
204
+ * @deprecated
205
+ *
199
206
  * @param {Object} state Global application state.
200
207
  *
201
208
  * @return {Object} The root client ID, index to insert at and starting filter value.
202
209
  */
203
- const __experimentalGetInsertionPoint = (0, _data.createRegistrySelector)(select => state => {
204
- if (typeof state.blockInserterPanel === 'object') {
205
- const {
206
- rootClientId,
207
- insertionIndex,
208
- filterValue
209
- } = state.blockInserterPanel;
210
- return {
211
- rootClientId,
212
- insertionIndex,
213
- filterValue
214
- };
215
- }
216
- if (isPage(state) && select(_editor.store).getRenderingMode() !== 'template-only') {
217
- const [postContentClientId] = select(_blockEditor.store).__experimentalGetGlobalBlocksByName('core/post-content');
218
- if (postContentClientId) {
219
- return {
220
- rootClientId: postContentClientId,
221
- insertionIndex: undefined,
222
- filterValue: undefined
223
- };
224
- }
225
- }
226
- return {
227
- rootClientId: undefined,
228
- insertionIndex: undefined,
229
- filterValue: undefined
230
- };
210
+ exports.isInserterOpened = isInserterOpened;
211
+ const __experimentalGetInsertionPoint = (0, _data.createRegistrySelector)(select => () => {
212
+ (0, _deprecated.default)(`select( 'core/edit-site' ).__experimentalGetInsertionPoint`, {
213
+ since: '6.5',
214
+ version: '6.7'
215
+ });
216
+ return (0, _lockUnlock.unlock)(select(_editor.store)).getInsertionPoint();
231
217
  });
232
218
 
233
219
  /**
234
- * Returns the current opened/closed state of the list view panel.
220
+ * Returns true if the list view is opened.
235
221
  *
236
222
  * @param {Object} state Global application state.
237
223
  *
238
- * @return {boolean} True if the list view panel should be open; false if closed.
224
+ * @return {boolean} Whether the list view is opened.
239
225
  */
240
226
  exports.__experimentalGetInsertionPoint = __experimentalGetInsertionPoint;
241
- function isListViewOpened(state) {
242
- return state.listViewPanel;
243
- }
227
+ const isListViewOpened = (0, _data.createRegistrySelector)(select => () => {
228
+ (0, _deprecated.default)(`select( 'core/edit-site' ).isListViewOpened`, {
229
+ since: '6.5',
230
+ alternative: `select( 'core/editor' ).isListViewOpened`
231
+ });
232
+ return select(_editor.store).isListViewOpened();
233
+ });
244
234
 
245
235
  /**
246
236
  * Returns the current opened/closed state of the save panel.
@@ -249,6 +239,7 @@ function isListViewOpened(state) {
249
239
  *
250
240
  * @return {boolean} True if the save panel should be open; false if closed.
251
241
  */
242
+ exports.isListViewOpened = isListViewOpened;
252
243
  function isSaveViewOpened(state) {
253
244
  return state.saveViewPanel;
254
245
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_coreData","require","_data","_deprecated","_interopRequireDefault","_element","_preferences","_blockEditor","_editor","_utils","_constants","isFeatureActive","createRegistrySelector","select","_","featureName","deprecated","since","alternative","preferencesStore","get","exports","__experimentalGetPreviewDeviceType","version","editorStore","getDeviceType","getCanUserCreateMedia","coreDataStore","canUser","getReusableBlocks","isWeb","Platform","OS","getEntityRecords","per_page","getSettings","state","settings","getHomeTemplateId","getEditedPostType","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isPage","getRenderingMode","postContentClientId","blockEditorStore","__experimentalGetGlobalBlocksByName","undefined","isListViewOpened","listViewPanel","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","templateParts","TEMPLATE_PART_POST_TYPE","clientIds","blocks","getBlocksByClientId","getFilteredTemplatePartBlocks","getEditorMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened","postId","hasPageContentFocus"],"sources":["@wordpress/edit-site/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { getFilteredTemplatePartBlocks } from './utils';\nimport { TEMPLATE_PART_POST_TYPE } from '../utils/constants';\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @deprecated\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( _, featureName ) => {\n\t\tdeprecated( `select( 'core/edit-site' ).isFeatureActive`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `select( 'core/preferences' ).get`,\n\t\t} );\n\n\t\treturn !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\tfeatureName\n\t\t);\n\t}\n);\n\n/**\n * Returns the current editing canvas device type.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport const __experimentalGetPreviewDeviceType = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\talternative: `select( 'core/editor' ).getDeviceType`,\n\t\t\t}\n\t\t);\n\t\treturn select( editorStore ).getDeviceType();\n\t}\n);\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tdeprecated(\n\t\t\"select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )\",\n\t\t{\n\t\t\tsince: '6.5',\n\t\t\tversion: '6.8',\n\t\t}\n\t);\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the site editor settings.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Settings.\n */\nexport function getSettings( state ) {\n\t// It is important that we don't inject anything into these settings locally.\n\t// The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings.\n\t// If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected.\n\treturn state.settings;\n}\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns the current opened/closed state of the inserter panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the inserter panel should be open; false if closed.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport const __experimentalGetInsertionPoint = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tif ( typeof state.blockInserterPanel === 'object' ) {\n\t\t\tconst { rootClientId, insertionIndex, filterValue } =\n\t\t\t\tstate.blockInserterPanel;\n\t\t\treturn { rootClientId, insertionIndex, filterValue };\n\t\t}\n\n\t\tif (\n\t\t\tisPage( state ) &&\n\t\t\tselect( editorStore ).getRenderingMode() !== 'template-only'\n\t\t) {\n\t\t\tconst [ postContentClientId ] =\n\t\t\t\tselect( blockEditorStore ).__experimentalGetGlobalBlocksByName(\n\t\t\t\t\t'core/post-content'\n\t\t\t\t);\n\t\t\tif ( postContentClientId ) {\n\t\t\t\treturn {\n\t\t\t\t\trootClientId: postContentClientId,\n\t\t\t\t\tinsertionIndex: undefined,\n\t\t\t\t\tfilterValue: undefined,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\trootClientId: undefined,\n\t\t\tinsertionIndex: undefined,\n\t\t\tfilterValue: undefined,\n\t\t};\n\t}\n);\n\n/**\n * Returns the current opened/closed state of the list view panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the list view panel should be open; false if closed.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t{ per_page: -1 }\n\t\t);\n\n\t\tconst clientIds =\n\t\t\tselect( blockEditorStore ).__experimentalGetGlobalBlocksByName(\n\t\t\t\t'core/template-part'\n\t\t\t);\n\t\tconst blocks =\n\t\t\tselect( blockEditorStore ).getBlocksByClientId( clientIds );\n\n\t\treturn getFilteredTemplatePartBlocks( blocks, templateParts );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector( ( select ) => () => {\n\treturn select( preferencesStore ).get( 'core/edit-site', 'editorMode' );\n} );\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Whether or not the editor has a page loaded into it.\n *\n * @see setPage\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not the editor has a page loaded into it.\n */\nexport function isPage( state ) {\n\treturn !! state.editedPost.context?.postId;\n}\n\n/**\n * Whether or not the editor allows only page content to be edited.\n *\n * @deprecated\n *\n * @return {boolean} Whether or not focus is on editing page content.\n */\nexport function hasPageContentFocus() {\n\tdeprecated( `select( 'core/edit-site' ).hasPageContentFocus`, {\n\t\tsince: '6.5',\n\t} );\n\n\treturn false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AAfA;AACA;AACA;;AASA;AACA;AACA;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMU,eAAe,GAAG,IAAAC,4BAAsB,EAClDC,MAAM,IAAM,CAAEC,CAAC,EAAEC,WAAW,KAAM;EACnC,IAAAC,mBAAU,EAAG,4CAA2C,EAAE;IACzDC,KAAK,EAAE,KAAK;IACZC,WAAW,EAAG;EACf,CAAE,CAAC;EAEH,OAAO,CAAC,CAAEL,MAAM,CAAEM,kBAAiB,CAAC,CAACC,GAAG,CACvC,gBAAgB,EAChBL,WACD,CAAC;AACF,CACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARAM,OAAA,CAAAV,eAAA,GAAAA,eAAA;AASO,MAA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AiB,CAAC,CAACC,GAAG,CAAE,gBAAgB,EAAE,YAAa,CAAC;AACxE,CAAE,CAAC;;AAEH;AACA;AACA;AAFAC,OAAA,CAAAiD,aAAA,GAAAA,aAAA;AAGO,SAASC,wCAAwCA,CAAA,EAAG;EAC1D,IAAAvD,mBAAU,EACT,uEAAuE,EACvE;IACCC,KAAK,EAAE,KAAK;IACZM,OAAO,EAAE;EACV,CACD,CAAC;AACF;;AAEA;AACA;AACA;AACO,SAASiD,4BAA4BA,CAAA,EAAG;EAC9C,IAAAxD,mBAAU,EAAE,2DAA2D,EAAE;IACxEC,KAAK,EAAE,KAAK;IACZM,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACO,SAASkD,kBAAkBA,CAAA,EAAG;EACpC,IAAAzD,mBAAU,EAAE,iDAAiD,EAAE;IAC9DC,KAAK,EAAE,KAAK;IACZM,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS8B,MAAMA,CAAEjB,KAAK,EAAG;EAC/B,OAAO,CAAC,CAAEA,KAAK,CAACI,UAAU,CAACK,OAAO,EAAE6B,MAAM;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAAA,EAAG;EACrC,IAAA3D,mBAAU,EAAG,gDAA+C,EAAE;IAC7DC,KAAK,EAAE;EACR,CAAE,CAAC;EAEH,OAAO,KAAK;AACb"}
1
+ {"version":3,"names":["_coreData","require","_data","_deprecated","_interopRequireDefault","_element","_preferences","_blockEditor","_editor","_utils","_constants","_lockUnlock","isFeatureActive","createRegistrySelector","select","_","featureName","deprecated","since","alternative","preferencesStore","get","exports","__experimentalGetPreviewDeviceType","version","editorStore","getDeviceType","getCanUserCreateMedia","coreDataStore","canUser","getReusableBlocks","isWeb","Platform","OS","getEntityRecords","per_page","getSettings","state","settings","getHomeTemplateId","getEditedPostType","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","__experimentalGetInsertionPoint","unlock","getInsertionPoint","isListViewOpened","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","templateParts","TEMPLATE_PART_POST_TYPE","clientIds","blockEditorStore","__experimentalGetGlobalBlocksByName","blocks","getBlocksByClientId","getFilteredTemplatePartBlocks","getEditorMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened","isPage","postId","hasPageContentFocus"],"sources":["@wordpress/edit-site/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { getFilteredTemplatePartBlocks } from './utils';\nimport { TEMPLATE_PART_POST_TYPE } from '../utils/constants';\nimport { unlock } from '../lock-unlock';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @deprecated\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( _, featureName ) => {\n\t\tdeprecated( `select( 'core/edit-site' ).isFeatureActive`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `select( 'core/preferences' ).get`,\n\t\t} );\n\n\t\treturn !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\tfeatureName\n\t\t);\n\t}\n);\n\n/**\n * Returns the current editing canvas device type.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport const __experimentalGetPreviewDeviceType = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\talternative: `select( 'core/editor' ).getDeviceType`,\n\t\t\t}\n\t\t);\n\t\treturn select( editorStore ).getDeviceType();\n\t}\n);\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tdeprecated(\n\t\t\"select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )\",\n\t\t{\n\t\t\tsince: '6.5',\n\t\t\tversion: '6.8',\n\t\t}\n\t);\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the site editor settings.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Settings.\n */\nexport function getSettings( state ) {\n\t// It is important that we don't inject anything into these settings locally.\n\t// The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings.\n\t// If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected.\n\treturn state.settings;\n}\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport const isInserterOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isInserterOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isInserterOpened`,\n\t} );\n\treturn select( editorStore ).isInserterOpened();\n} );\n\n/**\n * Get the insertion point for the inserter.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport const __experimentalGetInsertionPoint = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetInsertionPoint`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t}\n\t\t);\n\t\treturn unlock( select( editorStore ) ).getInsertionPoint();\n\t}\n);\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport const isListViewOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isListViewOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isListViewOpened`,\n\t} );\n\treturn select( editorStore ).isListViewOpened();\n} );\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t{ per_page: -1 }\n\t\t);\n\n\t\tconst clientIds =\n\t\t\tselect( blockEditorStore ).__experimentalGetGlobalBlocksByName(\n\t\t\t\t'core/template-part'\n\t\t\t);\n\t\tconst blocks =\n\t\t\tselect( blockEditorStore ).getBlocksByClientId( clientIds );\n\n\t\treturn getFilteredTemplatePartBlocks( blocks, templateParts );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector( ( select ) => () => {\n\treturn select( preferencesStore ).get( 'core/edit-site', 'editorMode' );\n} );\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Whether or not the editor has a page loaded into it.\n *\n * @see setPage\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not the editor has a page loaded into it.\n */\nexport function isPage( state ) {\n\treturn !! state.editedPost.context?.postId;\n}\n\n/**\n * Whether or not the editor allows only page content to be edited.\n *\n * @deprecated\n *\n * @return {boolean} Whether or not focus is on editing page content.\n */\nexport function hasPageContentFocus() {\n\tdeprecated( `select( 'core/edit-site' ).hasPageContentFocus`, {\n\t\tsince: '6.5',\n\t} );\n\n\treturn false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AAhBA;AACA;AACA;;AASA;AACA;AACA;;AAKA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMW,eAAe,GAAG,IAAAC,4BAAsB,EAClDC,MAAM,IAAM,CAAEC,CAAC,EAAEC,WAAW,KAAM;EACnC,IAAAC,mBAAU,EAAG,4CAA2C,EAAE;IACzDC,KAAK,EAAE,KAAK;IACZC,WAAW,EAAG;EACf,CAAE,CAAC;EAEH,OAAO,CAAC,CAAEL,MAAM,CAAEM,kBAAiB,CAAC,CAACC,GAAG,CACvC,gBAAgB,EAChBL,WACD,CAAC;AACF,CACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARAM,OAAA,CAAAV,eAAA,GAAAA,eAAA;AASO,MAAMW,kCAAkC,GAAG,IAAAV,4BAAsB,EACrEC,MAAM,IAAM,MAAM;EACnB,IAAAG,mBAAU,EACR,+DAA8D,EAC/D;IACCC,KAAK,EAAE,KAAK;IACZM,OAAO,EAAE,KA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hD,mBAAU,EACT,uEAAuE,EACvE;IACCC,KAAK,EAAE,KAAK;IACZM,OAAO,EAAE;EACV,CACD,CAAC;AACF;;AAEA;AACA;AACA;AACO,SAAS0C,4BAA4BA,CAAA,EAAG;EAC9C,IAAAjD,mBAAU,EAAE,2DAA2D,EAAE;IACxEC,KAAK,EAAE,KAAK;IACZM,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACO,SAAS2C,kBAAkBA,CAAA,EAAG;EACpC,IAAAlD,mBAAU,EAAE,iDAAiD,EAAE;IAC9DC,KAAK,EAAE,KAAK;IACZM,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS4C,MAAMA,CAAE/B,KAAK,EAAG;EAC/B,OAAO,CAAC,CAAEA,KAAK,CAACI,UAAU,CAACK,OAAO,EAAEuB,MAAM;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAAA,EAAG;EACrC,IAAArD,mBAAU,EAAG,gDAA+C,EAAE;IAC7DC,KAAK,EAAE;EACR,CAAE,CAAC;EAEH,OAAO,KAAK;AACb"}
@@ -20,7 +20,7 @@ function getIsListPage({
20
20
  categoryType,
21
21
  categoryId
22
22
  }, isMobileViewport) {
23
- return ['/wp_template/all', '/wp_template_part/all', '/pages'].includes(path) || path === '/patterns' && (
23
+ return ['/wp_template/all', '/wp_template_part/all'].includes(path) || path === '/page' && window?.__experimentalAdminViews || path === '/patterns' && (
24
24
  // Don't treat "/patterns" without categoryType and categoryId as a
25
25
  // list page in mobile because the sidebar covers the whole page.
26
26
  !isMobileViewport || !!categoryType && !!categoryId);
@@ -1 +1 @@
1
- {"version":3,"names":["getIsListPage","path","categoryType","categoryId","isMobileViewport","includes"],"sources":["@wordpress/edit-site/src/utils/get-is-list-page.js"],"sourcesContent":["/**\n * Returns if the params match the list page route.\n *\n * @param {Object} params The url params.\n * @param {string} params.path The current path.\n * @param {string} [params.categoryType] The current category type.\n * @param {string} [params.categoryId] The current category id.\n * @param {boolean} isMobileViewport Is mobile viewport.\n *\n * @return {boolean} Is list page or not.\n */\nexport default function getIsListPage(\n\t{ path, categoryType, categoryId },\n\tisMobileViewport\n) {\n\treturn (\n\t\t[ '/wp_template/all', '/wp_template_part/all', '/pages' ].includes(\n\t\t\tpath\n\t\t) ||\n\t\t( path === '/patterns' &&\n\t\t\t// Don't treat \"/patterns\" without categoryType and categoryId as a\n\t\t\t// list page in mobile because the sidebar covers the whole page.\n\t\t\t( ! isMobileViewport || ( !! categoryType && !! categoryId ) ) )\n\t);\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,aAAaA,CACpC;EAAEC,IAAI;EAAEC,YAAY;EAAEC;AAAW,CAAC,EAClCC,gBAAgB,EACf;EACD,OACC,CAAE,kBAAkB,EAAE,uBAAuB,EAAE,QAAQ,CAAE,CAACC,QAAQ,CACjEJ,IACD,CAAC,IACCA,IAAI,KAAK,WAAW;EACrB;EACA;EACE,CAAEG,gBAAgB,IAAM,CAAC,CAAEF,YAAY,IAAI,CAAC,CAAEC,UAAY,CAAI;AAEnE"}
1
+ {"version":3,"names":["getIsListPage","path","categoryType","categoryId","isMobileViewport","includes","window","__experimentalAdminViews"],"sources":["@wordpress/edit-site/src/utils/get-is-list-page.js"],"sourcesContent":["/**\n * Returns if the params match the list page route.\n *\n * @param {Object} params The url params.\n * @param {string} params.path The current path.\n * @param {string} [params.categoryType] The current category type.\n * @param {string} [params.categoryId] The current category id.\n * @param {boolean} isMobileViewport Is mobile viewport.\n *\n * @return {boolean} Is list page or not.\n */\nexport default function getIsListPage(\n\t{ path, categoryType, categoryId },\n\tisMobileViewport\n) {\n\treturn (\n\t\t[ '/wp_template/all', '/wp_template_part/all' ].includes( path ) ||\n\t\t( path === '/page' && window?.__experimentalAdminViews ) ||\n\t\t( path === '/patterns' &&\n\t\t\t// Don't treat \"/patterns\" without categoryType and categoryId as a\n\t\t\t// list page in mobile because the sidebar covers the whole page.\n\t\t\t( ! isMobileViewport || ( !! categoryType && !! categoryId ) ) )\n\t);\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,aAAaA,CACpC;EAAEC,IAAI;EAAEC,YAAY;EAAEC;AAAW,CAAC,EAClCC,gBAAgB,EACf;EACD,OACC,CAAE,kBAAkB,EAAE,uBAAuB,CAAE,CAACC,QAAQ,CAAEJ,IAAK,CAAC,IAC9DA,IAAI,KAAK,OAAO,IAAIK,MAAM,EAAEC,wBAA0B,IACtDN,IAAI,KAAK,WAAW;EACrB;EACA;EACE,CAAEG,gBAAgB,IAAM,CAAC,CAAEF,YAAY,IAAI,CAAC,CAAEC,UAAY,CAAI;AAEnE"}
@@ -10,7 +10,7 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
10
10
  /**
11
11
  * Internal dependencies
12
12
  */
13
- import { TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE } from '../../utils/constants';
13
+ import { TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATTERN_TYPES } from '../../utils/constants';
14
14
  import { unlock } from '../../lock-unlock';
15
15
  const {
16
16
  useLocation,
@@ -21,9 +21,10 @@ function BackButton() {
21
21
  const history = useHistory();
22
22
  const isTemplatePart = location.params.postType === TEMPLATE_PART_POST_TYPE;
23
23
  const isNavigationMenu = location.params.postType === NAVIGATION_POST_TYPE;
24
+ const isPattern = location.params.postType === PATTERN_TYPES.user;
24
25
  const previousTemplateId = location.state?.fromTemplateId;
25
- const isFocusMode = isTemplatePart || isNavigationMenu;
26
- if (!isFocusMode || !previousTemplateId) {
26
+ const isFocusMode = isTemplatePart || isNavigationMenu || isPattern;
27
+ if (!isFocusMode || !previousTemplateId && !isPattern) {
27
28
  return null;
28
29
  }
29
30
  return createElement(Button, {
@@ -1 +1 @@
1
- {"version":3,"names":["Button","arrowLeft","__","privateApis","routerPrivateApis","TEMPLATE_PART_POST_TYPE","NAVIGATION_POST_TYPE","unlock","useLocation","useHistory","BackButton","location","history","isTemplatePart","params","postType","isNavigationMenu","previousTemplateId","state","fromTemplateId","isFocusMode","createElement","className","icon","onClick","back"],"sources":["@wordpress/edit-site/src/components/block-editor/back-button.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { arrowLeft } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nfunction BackButton() {\n\tconst location = useLocation();\n\tconst history = useHistory();\n\tconst isTemplatePart = location.params.postType === TEMPLATE_PART_POST_TYPE;\n\tconst isNavigationMenu = location.params.postType === NAVIGATION_POST_TYPE;\n\tconst previousTemplateId = location.state?.fromTemplateId;\n\n\tconst isFocusMode = isTemplatePart || isNavigationMenu;\n\n\tif ( ! isFocusMode || ! previousTemplateId ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"edit-site-visual-editor__back-button\"\n\t\t\ticon={ arrowLeft }\n\t\t\tonClick={ () => {\n\t\t\t\thistory.back();\n\t\t\t} }\n\t\t>\n\t\t\t{ __( 'Back' ) }\n\t\t</Button>\n\t);\n}\n\nexport default BackButton;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SACCC,uBAAuB,EACvBC,oBAAoB,QACd,uBAAuB;AAC9B,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC,WAAW;EAAEC;AAAW,CAAC,GAAGF,MAAM,CAAEH,iBAAkB,CAAC;AAE/D,SAASM,UAAUA,CAAA,EAAG;EACrB,MAAMC,QAAQ,GAAGH,WAAW,CAAC,CAAC;EAC9B,MAAMI,OAAO,GAAGH,UAAU,CAAC,CAAC;EAC5B,MAAMI,cAAc,GAAGF,QAAQ,CAACG,MAAM,CAACC,QAAQ,KAAKV,uBAAuB;EAC3E,MAAMW,gBAAgB,GAAGL,QAAQ,CAACG,MAAM,CAACC,QAAQ,KAAKT,oBAAoB;EAC1E,MAAMW,kBAAkB,GAAGN,QAAQ,CAACO,KAAK,EAAEC,cAAc;EAEzD,MAAMC,WAAW,GAAGP,cAAc,IAAIG,gBAAgB;EAEtD,IAAK,CAAEI,WAAW,IAAI,CAAEH,kBAAkB,EAAG;IAC5C,OAAO,IAAI;EACZ;EAEA,OACCI,aAAA,CAACrB,MAAM;IACNsB,SAAS,EAAC,sCAAsC;IAChDC,IAAI,EAAGtB,SAAW;IAClBuB,OAAO,EAAGA,CAAA,KAAM;MACfZ,OAAO,CAACa,IAAI,CAAC,CAAC;IACf;EAAG,GAEDvB,EAAE,CAAE,MAAO,CACN,CAAC;AAEX;AAEA,eAAeQ,UAAU"}
1
+ {"version":3,"names":["Button","arrowLeft","__","privateApis","routerPrivateApis","TEMPLATE_PART_POST_TYPE","NAVIGATION_POST_TYPE","PATTERN_TYPES","unlock","useLocation","useHistory","BackButton","location","history","isTemplatePart","params","postType","isNavigationMenu","isPattern","user","previousTemplateId","state","fromTemplateId","isFocusMode","createElement","className","icon","onClick","back"],"sources":["@wordpress/edit-site/src/components/block-editor/back-button.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { arrowLeft } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES,\n} from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nfunction BackButton() {\n\tconst location = useLocation();\n\tconst history = useHistory();\n\tconst isTemplatePart = location.params.postType === TEMPLATE_PART_POST_TYPE;\n\tconst isNavigationMenu = location.params.postType === NAVIGATION_POST_TYPE;\n\tconst isPattern = location.params.postType === PATTERN_TYPES.user;\n\tconst previousTemplateId = location.state?.fromTemplateId;\n\n\tconst isFocusMode = isTemplatePart || isNavigationMenu || isPattern;\n\n\tif ( ! isFocusMode || ( ! previousTemplateId && ! isPattern ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"edit-site-visual-editor__back-button\"\n\t\t\ticon={ arrowLeft }\n\t\t\tonClick={ () => {\n\t\t\t\thistory.back();\n\t\t\t} }\n\t\t>\n\t\t\t{ __( 'Back' ) }\n\t\t</Button>\n\t);\n}\n\nexport default BackButton;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SACCC,uBAAuB,EACvBC,oBAAoB,EACpBC,aAAa,QACP,uBAAuB;AAC9B,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC,WAAW;EAAEC;AAAW,CAAC,GAAGF,MAAM,CAAEJ,iBAAkB,CAAC;AAE/D,SAASO,UAAUA,CAAA,EAAG;EACrB,MAAMC,QAAQ,GAAGH,WAAW,CAAC,CAAC;EAC9B,MAAMI,OAAO,GAAGH,UAAU,CAAC,CAAC;EAC5B,MAAMI,cAAc,GAAGF,QAAQ,CAACG,MAAM,CAACC,QAAQ,KAAKX,uBAAuB;EAC3E,MAAMY,gBAAgB,GAAGL,QAAQ,CAACG,MAAM,CAACC,QAAQ,KAAKV,oBAAoB;EAC1E,MAAMY,SAAS,GAAGN,QAAQ,CAACG,MAAM,CAACC,QAAQ,KAAKT,aAAa,CAACY,IAAI;EACjE,MAAMC,kBAAkB,GAAGR,QAAQ,CAACS,KAAK,EAAEC,cAAc;EAEzD,MAAMC,WAAW,GAAGT,cAAc,IAAIG,gBAAgB,IAAIC,SAAS;EAEnE,IAAK,CAAEK,WAAW,IAAM,CAAEH,kBAAkB,IAAI,CAAEF,SAAW,EAAG;IAC/D,OAAO,IAAI;EACZ;EAEA,OACCM,aAAA,CAACxB,MAAM;IACNyB,SAAS,EAAC,sCAAsC;IAChDC,IAAI,EAAGzB,SAAW;IAClB0B,OAAO,EAAGA,CAAA,KAAM;MACfd,OAAO,CAACe,IAAI,CAAC,CAAC;IACf;EAAG,GAED1B,EAAE,CAAE,MAAO,CACN,CAAC;AAEX;AAEA,eAAeS,UAAU"}
@@ -49,8 +49,8 @@ function ResizableEditor({
49
49
  maxWidth: "100%",
50
50
  maxHeight: "100%",
51
51
  enable: {
52
- right: enableResizing,
53
- left: enableResizing
52
+ left: enableResizing,
53
+ right: enableResizing
54
54
  },
55
55
  showHandle: enableResizing
56
56
  // The editor is centered horizontally, resizing it only
@@ -1 +1 @@
1
- {"version":3,"names":["useState","useRef","useCallback","ResizableBox","ResizeHandle","HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","width","height","top","right","bottom","left","ResizableEditor","enableResizing","children","setWidth","resizableRef","resizeWidthBy","deltaPixels","current","offsetWidth","createElement","ref","api","resizable","size","onResizeStop","event","direction","element","style","minWidth","maxWidth","maxHeight","enable","showHandle","resizeRatio","handleComponent","handleClasses","handleStyles"],"sources":["@wordpress/edit-site/src/components/block-editor/resizable-editor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useRef, useCallback } from '@wordpress/element';\nimport { ResizableBox } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ResizeHandle from './resize-handle';\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\nfunction ResizableEditor( { enableResizing, height, children } ) {\n\tconst [ width, setWidth ] = useState( '100%' );\n\tconst resizableRef = useRef();\n\tconst resizeWidthBy = useCallback( ( deltaPixels ) => {\n\t\tif ( resizableRef.current ) {\n\t\t\tsetWidth( resizableRef.current.offsetWidth + deltaPixels );\n\t\t}\n\t}, [] );\n\treturn (\n\t\t<ResizableBox\n\t\t\tref={ ( api ) => {\n\t\t\t\tresizableRef.current = api?.resizable;\n\t\t\t} }\n\t\t\tsize={ {\n\t\t\t\twidth: enableResizing ? width : '100%',\n\t\t\t\theight: enableResizing && height ? height : '100%',\n\t\t\t} }\n\t\t\tonResizeStop={ ( event, direction, element ) => {\n\t\t\t\tsetWidth( element.style.width );\n\t\t\t} }\n\t\t\tminWidth={ 300 }\n\t\t\tmaxWidth=\"100%\"\n\t\t\tmaxHeight=\"100%\"\n\t\t\tenable={ {\n\t\t\t\tright: enableResizing,\n\t\t\t\tleft: enableResizing,\n\t\t\t} }\n\t\t\tshowHandle={ enableResizing }\n\t\t\t// The editor is centered horizontally, resizing it only\n\t\t\t// moves half the distance. Hence double the ratio to correctly\n\t\t\t// align the cursor to the resizer handle.\n\t\t\tresizeRatio={ 2 }\n\t\t\thandleComponent={ {\n\t\t\t\tleft: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"left\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t\tright: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"right\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t} }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t>\n\t\t\t{ children }\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableEditor;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,WAAW,QAAQ,oBAAoB;AAClE,SAASC,YAAY,QAAQ,uBAAuB;;AAEpD;AACA;AACA;AACA,OAAOC,YAAY,MAAM,iBAAiB;;AAE1C;AACA,MAAMC,sBAAsB,GAAG;EAC9BC,QAAQ,EAAEC,SAAS;EACnBC,UAAU,EAAED,SAAS;EACrBE,MAAM,EAAEF,SAAS;EACjBG,KAAK,EAAEH,SAAS;EAChBI,MAAM,EAAEJ,SAAS;EACjBK,GAAG,EAAEL,SAAS;EACdM,KAAK,EAAEN,SAAS;EAChBO,MAAM,EAAEP,SAAS;EACjBQ,IAAI,EAAER;AACP,CAAC;AAED,SAASS,eAAeA,CAAE;EAAEC,cAAc;EAAEN,MAAM;EAAEO;AAAS,CAAC,EAAG;EAChE,MAAM,CAAER,KAAK,EAAES,QAAQ,CAAE,GAAGnB,QAAQ,CAAE,MAAO,CAAC;EAC9C,MAAMoB,YAAY,GAAGnB,MAAM,CAAC,CAAC;EAC7B,MAAMoB,aAAa,GAAGnB,WAAW,CAAIoB,WAAW,IAAM;IACrD,IAAKF,YAAY,CAACG,OAAO,EAAG;MAC3BJ,QAAQ,CAAEC,YAAY,CAACG,OAAO,CAACC,WAAW,GAAGF,WAAY,CAAC;IAC3D;EACD,CAAC,EAAE,EAAG,CAAC;EACP,OACCG,aAAA,CAACtB,YAAY;IACZuB,GAAG,EAAKC,GAAG,IAAM;MAChBP,YAAY,CAACG,OAAO,GAAGI,GAAG,EAAEC,SAAS;IACtC,CAAG;IACHC,IAAI,EAAG;MACNnB,KAAK,EAAEO,cAAc,GAAGP,KAAK,GAAG,MAAM;MACtCC,MAAM,EAAEM,cAAc,IAAIN,MAAM,GAAGA,MAAM,GAAG;IAC7C,CAAG;IACHmB,YAAY,EAAGA,CAAEC,KAAK,EAAEC,SAAS,EAAEC,OAAO,KAAM;MAC/Cd,QAAQ,CAAEc,OAAO,CAACC,KAAK,CAACxB,KAAM,CAAC;IAChC,CAAG;IACHyB,QAAQ,EAAG,GAAK;IAChBC,QAAQ,EAAC,MAAM;IACfC,SAAS,EAAC,MAAM;IAChBC,MAAM,EAAG;MACRzB,KAAK,EAAEI,cAAc;MACrBF,IAAI,EAAEE;IACP,CAAG;IACHsB,UAAU,EAAGtB;IACb;IACA;IACA;IAAA;IACAuB,WAAW,EAAG,CAAG;IACjBC,eAAe,EAAG;MACjB1B,IAAI,EACHU,aAAA,CAACrB,YAAY;QACZ4B,SAAS,EAAC,MAAM;QAChBX,aAAa,EAAGA;MAAe,CAC/B,CACD;MACDR,KAAK,EACJY,aAAA,CAACrB,YAAY;QACZ4B,SAAS,EAAC,OAAO;QACjBX,aAAa,EAAGA;MAAe,CAC/B;IAEH,CAAG;IACHqB,aAAa,EAAGnC,SAAW;IAC3BoC,YAAY,EAAG;MACd5B,IAAI,EAAEV,sBAAsB;MAC5BQ,KAAK,EAAER;IACR;EAAG,GAEDa,QACW,CAAC;AAEjB;AAEA,eAAeF,eAAe"}
1
+ {"version":3,"names":["useState","useRef","useCallback","ResizableBox","ResizeHandle","HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","width","height","top","right","bottom","left","ResizableEditor","enableResizing","children","setWidth","resizableRef","resizeWidthBy","deltaPixels","current","offsetWidth","createElement","ref","api","resizable","size","onResizeStop","event","direction","element","style","minWidth","maxWidth","maxHeight","enable","showHandle","resizeRatio","handleComponent","handleClasses","handleStyles"],"sources":["@wordpress/edit-site/src/components/block-editor/resizable-editor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useRef, useCallback } from '@wordpress/element';\nimport { ResizableBox } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ResizeHandle from './resize-handle';\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\nfunction ResizableEditor( { enableResizing, height, children } ) {\n\tconst [ width, setWidth ] = useState( '100%' );\n\tconst resizableRef = useRef();\n\tconst resizeWidthBy = useCallback( ( deltaPixels ) => {\n\t\tif ( resizableRef.current ) {\n\t\t\tsetWidth( resizableRef.current.offsetWidth + deltaPixels );\n\t\t}\n\t}, [] );\n\treturn (\n\t\t<ResizableBox\n\t\t\tref={ ( api ) => {\n\t\t\t\tresizableRef.current = api?.resizable;\n\t\t\t} }\n\t\t\tsize={ {\n\t\t\t\twidth: enableResizing ? width : '100%',\n\t\t\t\theight: enableResizing && height ? height : '100%',\n\t\t\t} }\n\t\t\tonResizeStop={ ( event, direction, element ) => {\n\t\t\t\tsetWidth( element.style.width );\n\t\t\t} }\n\t\t\tminWidth={ 300 }\n\t\t\tmaxWidth=\"100%\"\n\t\t\tmaxHeight=\"100%\"\n\t\t\tenable={ {\n\t\t\t\tleft: enableResizing,\n\t\t\t\tright: enableResizing,\n\t\t\t} }\n\t\t\tshowHandle={ enableResizing }\n\t\t\t// The editor is centered horizontally, resizing it only\n\t\t\t// moves half the distance. Hence double the ratio to correctly\n\t\t\t// align the cursor to the resizer handle.\n\t\t\tresizeRatio={ 2 }\n\t\t\thandleComponent={ {\n\t\t\t\tleft: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"left\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t\tright: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"right\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t} }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t>\n\t\t\t{ children }\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableEditor;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,WAAW,QAAQ,oBAAoB;AAClE,SAASC,YAAY,QAAQ,uBAAuB;;AAEpD;AACA;AACA;AACA,OAAOC,YAAY,MAAM,iBAAiB;;AAE1C;AACA,MAAMC,sBAAsB,GAAG;EAC9BC,QAAQ,EAAEC,SAAS;EACnBC,UAAU,EAAED,SAAS;EACrBE,MAAM,EAAEF,SAAS;EACjBG,KAAK,EAAEH,SAAS;EAChBI,MAAM,EAAEJ,SAAS;EACjBK,GAAG,EAAEL,SAAS;EACdM,KAAK,EAAEN,SAAS;EAChBO,MAAM,EAAEP,SAAS;EACjBQ,IAAI,EAAER;AACP,CAAC;AAED,SAASS,eAAeA,CAAE;EAAEC,cAAc;EAAEN,MAAM;EAAEO;AAAS,CAAC,EAAG;EAChE,MAAM,CAAER,KAAK,EAAES,QAAQ,CAAE,GAAGnB,QAAQ,CAAE,MAAO,CAAC;EAC9C,MAAMoB,YAAY,GAAGnB,MAAM,CAAC,CAAC;EAC7B,MAAMoB,aAAa,GAAGnB,WAAW,CAAIoB,WAAW,IAAM;IACrD,IAAKF,YAAY,CAACG,OAAO,EAAG;MAC3BJ,QAAQ,CAAEC,YAAY,CAACG,OAAO,CAACC,WAAW,GAAGF,WAAY,CAAC;IAC3D;EACD,CAAC,EAAE,EAAG,CAAC;EACP,OACCG,aAAA,CAACtB,YAAY;IACZuB,GAAG,EAAKC,GAAG,IAAM;MAChBP,YAAY,CAACG,OAAO,GAAGI,GAAG,EAAEC,SAAS;IACtC,CAAG;IACHC,IAAI,EAAG;MACNnB,KAAK,EAAEO,cAAc,GAAGP,KAAK,GAAG,MAAM;MACtCC,MAAM,EAAEM,cAAc,IAAIN,MAAM,GAAGA,MAAM,GAAG;IAC7C,CAAG;IACHmB,YAAY,EAAGA,CAAEC,KAAK,EAAEC,SAAS,EAAEC,OAAO,KAAM;MAC/Cd,QAAQ,CAAEc,OAAO,CAACC,KAAK,CAACxB,KAAM,CAAC;IAChC,CAAG;IACHyB,QAAQ,EAAG,GAAK;IAChBC,QAAQ,EAAC,MAAM;IACfC,SAAS,EAAC,MAAM;IAChBC,MAAM,EAAG;MACRvB,IAAI,EAAEE,cAAc;MACpBJ,KAAK,EAAEI;IACR,CAAG;IACHsB,UAAU,EAAGtB;IACb;IACA;IACA;IAAA;IACAuB,WAAW,EAAG,CAAG;IACjBC,eAAe,EAAG;MACjB1B,IAAI,EACHU,aAAA,CAACrB,YAAY;QACZ4B,SAAS,EAAC,MAAM;QAChBX,aAAa,EAAGA;MAAe,CAC/B,CACD;MACDR,KAAK,EACJY,aAAA,CAACrB,YAAY;QACZ4B,SAAS,EAAC,OAAO;QACjBX,aAAa,EAAGA;MAAe,CAC/B;IAEH,CAAG;IACHqB,aAAa,EAAGnC,SAAW;IAC3BoC,YAAY,EAAG;MACd5B,IAAI,EAAEV,sBAAsB;MAC5BQ,KAAK,EAAER;IACR;EAAG,GAEDa,QACW,CAAC;AAEjB;AAEA,eAAeF,eAAe"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { privateApis as routerPrivateApis } from '@wordpress/router';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import { unlock } from '../../lock-unlock';
10
+ import { getPostLinkProps } from '../routes/link';
11
+ const {
12
+ useHistory
13
+ } = unlock(routerPrivateApis);
14
+ export function usePostLinkProps() {
15
+ const history = useHistory();
16
+ return (params, state) => {
17
+ return getPostLinkProps(history, params, state);
18
+ };
19
+ }
20
+ //# sourceMappingURL=use-post-link-props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["privateApis","routerPrivateApis","unlock","getPostLinkProps","useHistory","usePostLinkProps","history","params","state"],"sources":["@wordpress/edit-site/src/components/block-editor/use-post-link-props.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { getPostLinkProps } from '../routes/link';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nexport function usePostLinkProps() {\n\tconst history = useHistory();\n\n\treturn ( params, state ) => {\n\t\treturn getPostLinkProps( history, params, state );\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,gBAAgB,QAAQ,gBAAgB;AAEjD,MAAM;EAAEC;AAAW,CAAC,GAAGF,MAAM,CAAED,iBAAkB,CAAC;AAElD,OAAO,SAASI,gBAAgBA,CAAA,EAAG;EAClC,MAAMC,OAAO,GAAGF,UAAU,CAAC,CAAC;EAE5B,OAAO,CAAEG,MAAM,EAAEC,KAAK,KAAM;IAC3B,OAAOL,gBAAgB,CAAEG,OAAO,EAAEC,MAAM,EAAEC,KAAM,CAAC;EAClD,CAAC;AACF"}
@@ -1,18 +1,17 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { useViewportMatch } from '@wordpress/compose';
5
- import { useDispatch, useSelect } from '@wordpress/data';
4
+ import { useSelect } from '@wordpress/data';
6
5
  import { useMemo } from '@wordpress/element';
7
6
  import { store as coreStore } from '@wordpress/core-data';
8
7
  import { privateApis as editorPrivateApis } from '@wordpress/editor';
9
- import { store as preferencesStore } from '@wordpress/preferences';
10
8
 
11
9
  /**
12
10
  * Internal dependencies
13
11
  */
14
12
  import { store as editSiteStore } from '../../store';
15
13
  import { unlock } from '../../lock-unlock';
14
+ import { usePostLinkProps } from './use-post-link-props';
16
15
  const {
17
16
  useBlockEditorSettings
18
17
  } = unlock(editorPrivateApis);
@@ -83,16 +82,9 @@ function useArchiveLabel(templateSlug) {
83
82
  }, [authorSlug, isAuthor, taxonomy, term]);
84
83
  }
85
84
  export function useSpecificEditorSettings() {
86
- const {
87
- setIsInserterOpened
88
- } = useDispatch(editSiteStore);
89
- const isLargeViewport = useViewportMatch('medium');
85
+ const getPostLinkProps = usePostLinkProps();
90
86
  const {
91
87
  templateSlug,
92
- focusMode,
93
- isDistractionFree,
94
- hasFixedToolbar,
95
- keepCaretInsideBlock,
96
88
  canvasMode,
97
89
  settings,
98
90
  postWithTemplate
@@ -104,9 +96,6 @@ export function useSpecificEditorSettings() {
104
96
  getCanvasMode,
105
97
  getSettings
106
98
  } = unlock(select(editSiteStore));
107
- const {
108
- get: getPreference
109
- } = select(preferencesStore);
110
99
  const {
111
100
  getEditedEntityRecord
112
101
  } = select(coreStore);
@@ -116,32 +105,26 @@ export function useSpecificEditorSettings() {
116
105
  const _context = getEditedPostContext();
117
106
  return {
118
107
  templateSlug: _record.slug,
119
- focusMode: !!getPreference('core/edit-site', 'focusMode'),
120
- isDistractionFree: !!getPreference('core/edit-site', 'distractionFree'),
121
- hasFixedToolbar: !!getPreference('core/edit-site', 'fixedToolbar') || !isLargeViewport,
122
- keepCaretInsideBlock: !!getPreference('core/edit-site', 'keepCaretInsideBlock'),
123
108
  canvasMode: getCanvasMode(),
124
109
  settings: getSettings(),
125
110
  postWithTemplate: _context?.postId
126
111
  };
127
- }, [isLargeViewport]);
112
+ }, []);
128
113
  const archiveLabels = useArchiveLabel(templateSlug);
129
114
  const defaultRenderingMode = postWithTemplate ? 'template-locked' : 'all';
130
115
  const defaultEditorSettings = useMemo(() => {
131
116
  return {
132
117
  ...settings,
118
+ richEditingEnabled: true,
133
119
  supportsTemplateMode: true,
134
- __experimentalSetIsInserterOpened: setIsInserterOpened,
135
- focusMode: canvasMode === 'view' && focusMode ? false : focusMode,
136
- isDistractionFree,
137
- hasFixedToolbar,
138
- keepCaretInsideBlock,
120
+ focusMode: canvasMode !== 'view',
139
121
  defaultRenderingMode,
122
+ getPostLinkProps,
140
123
  // I wonder if they should be set in the post editor too
141
124
  __experimentalArchiveTitleTypeLabel: archiveLabels.archiveTypeLabel,
142
125
  __experimentalArchiveTitleNameLabel: archiveLabels.archiveNameLabel
143
126
  };
144
- }, [settings, setIsInserterOpened, focusMode, isDistractionFree, hasFixedToolbar, keepCaretInsideBlock, canvasMode, archiveLabels.archiveTypeLabel, archiveLabels.archiveNameLabel, defaultRenderingMode]);
127
+ }, [settings, canvasMode, defaultRenderingMode, getPostLinkProps, archiveLabels.archiveTypeLabel, archiveLabels.archiveNameLabel]);
145
128
  return defaultEditorSettings;
146
129
  }
147
130
  export default function useSiteEditorSettings() {
@@ -1 +1 @@
1
- {"version":3,"names":["useViewportMatch","useDispatch","useSelect","useMemo","store","coreStore","privateApis","editorPrivateApis","preferencesStore","editSiteStore","unlock","useBlockEditorSettings","useArchiveLabel","templateSlug","taxonomyMatches","match","taxonomy","term","isAuthor","authorSlug","authorMatches","select","getEntityRecords","getTaxonomy","getAuthors","archiveTypeLabel","archiveNameLabel","labels","singular_name","records","slug","per_page","name","authorRecords","useSpecificEditorSettings","setIsInserterOpened","isLargeViewport","focusMode","isDistractionFree","hasFixedToolbar","keepCaretInsideBlock","canvasMode","settings","postWithTemplate","getEditedPostType","getEditedPostId","getEditedPostContext","getCanvasMode","getSettings","get","getPreference","getEditedEntityRecord","usedPostType","usedPostId","_record","_context","postId","archiveLabels","defaultRenderingMode","defaultEditorSettings","supportsTemplateMode","__experimentalSetIsInserterOpened","__experimentalArchiveTitleTypeLabel","__experimentalArchiveTitleNameLabel","useSiteEditorSettings","postType"],"sources":["@wordpress/edit-site/src/components/block-editor/use-site-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { useBlockEditorSettings } = unlock( editorPrivateApis );\n\nfunction useArchiveLabel( templateSlug ) {\n\tconst taxonomyMatches = templateSlug?.match(\n\t\t/^(category|tag|taxonomy-([^-]+))$|^(((category|tag)|taxonomy-([^-]+))-(.+))$/\n\t);\n\tlet taxonomy;\n\tlet term;\n\tlet isAuthor = false;\n\tlet authorSlug;\n\tif ( taxonomyMatches ) {\n\t\t// If is for a all taxonomies of a type\n\t\tif ( taxonomyMatches[ 1 ] ) {\n\t\t\ttaxonomy = taxonomyMatches[ 2 ]\n\t\t\t\t? taxonomyMatches[ 2 ]\n\t\t\t\t: taxonomyMatches[ 1 ];\n\t\t}\n\t\t// If is for a all taxonomies of a type\n\t\telse if ( taxonomyMatches[ 3 ] ) {\n\t\t\ttaxonomy = taxonomyMatches[ 6 ]\n\t\t\t\t? taxonomyMatches[ 6 ]\n\t\t\t\t: taxonomyMatches[ 4 ];\n\t\t\tterm = taxonomyMatches[ 7 ];\n\t\t}\n\t\ttaxonomy = taxonomy === 'tag' ? 'post_tag' : taxonomy;\n\n\t\t//getTaxonomy( 'category' );\n\t\t//wp.data.select('core').getEntityRecords( 'taxonomy', 'category', {slug: 'newcat'} );\n\t} else {\n\t\tconst authorMatches = templateSlug?.match( /^(author)$|^author-(.+)$/ );\n\t\tif ( authorMatches ) {\n\t\t\tisAuthor = true;\n\t\t\tif ( authorMatches[ 2 ] ) {\n\t\t\t\tauthorSlug = authorMatches[ 2 ];\n\t\t\t}\n\t\t}\n\t}\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getTaxonomy, getAuthors } =\n\t\t\t\tselect( coreStore );\n\t\t\tlet archiveTypeLabel;\n\t\t\tlet archiveNameLabel;\n\t\t\tif ( taxonomy ) {\n\t\t\t\tarchiveTypeLabel =\n\t\t\t\t\tgetTaxonomy( taxonomy )?.labels?.singular_name;\n\t\t\t}\n\t\t\tif ( term ) {\n\t\t\t\tconst records = getEntityRecords( 'taxonomy', taxonomy, {\n\t\t\t\t\tslug: term,\n\t\t\t\t\tper_page: 1,\n\t\t\t\t} );\n\t\t\t\tif ( records && records[ 0 ] ) {\n\t\t\t\t\tarchiveNameLabel = records[ 0 ].name;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( isAuthor ) {\n\t\t\t\tarchiveTypeLabel = 'Author';\n\t\t\t\tif ( authorSlug ) {\n\t\t\t\t\tconst authorRecords = getAuthors( { slug: authorSlug } );\n\t\t\t\t\tif ( authorRecords && authorRecords[ 0 ] ) {\n\t\t\t\t\t\tarchiveNameLabel = authorRecords[ 0 ].name;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tarchiveTypeLabel,\n\t\t\t\tarchiveNameLabel,\n\t\t\t};\n\t\t},\n\t\t[ authorSlug, isAuthor, taxonomy, term ]\n\t);\n}\n\nexport function useSpecificEditorSettings() {\n\tconst { setIsInserterOpened } = useDispatch( editSiteStore );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\ttemplateSlug,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thasFixedToolbar,\n\t\tkeepCaretInsideBlock,\n\t\tcanvasMode,\n\t\tsettings,\n\t\tpostWithTemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostType,\n\t\t\t\tgetEditedPostId,\n\t\t\t\tgetEditedPostContext,\n\t\t\t\tgetCanvasMode,\n\t\t\t\tgetSettings,\n\t\t\t} = unlock( select( editSiteStore ) );\n\t\t\tconst { get: getPreference } = select( preferencesStore );\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst usedPostType = getEditedPostType();\n\t\t\tconst usedPostId = getEditedPostId();\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tusedPostType,\n\t\t\t\tusedPostId\n\t\t\t);\n\t\t\tconst _context = getEditedPostContext();\n\t\t\treturn {\n\t\t\t\ttemplateSlug: _record.slug,\n\t\t\t\tfocusMode: !! getPreference( 'core/edit-site', 'focusMode' ),\n\t\t\t\tisDistractionFree: !! getPreference(\n\t\t\t\t\t'core/edit-site',\n\t\t\t\t\t'distractionFree'\n\t\t\t\t),\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\t!! getPreference( 'core/edit-site', 'fixedToolbar' ) ||\n\t\t\t\t\t! isLargeViewport,\n\t\t\t\tkeepCaretInsideBlock: !! getPreference(\n\t\t\t\t\t'core/edit-site',\n\t\t\t\t\t'keepCaretInsideBlock'\n\t\t\t\t),\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t\tsettings: getSettings(),\n\t\t\t\tpostWithTemplate: _context?.postId,\n\t\t\t};\n\t\t},\n\t\t[ isLargeViewport ]\n\t);\n\tconst archiveLabels = useArchiveLabel( templateSlug );\n\tconst defaultRenderingMode = postWithTemplate ? 'template-locked' : 'all';\n\tconst defaultEditorSettings = useMemo( () => {\n\t\treturn {\n\t\t\t...settings,\n\n\t\t\tsupportsTemplateMode: true,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tfocusMode: canvasMode === 'view' && focusMode ? false : focusMode,\n\t\t\tisDistractionFree,\n\t\t\thasFixedToolbar,\n\t\t\tkeepCaretInsideBlock,\n\t\t\tdefaultRenderingMode,\n\n\t\t\t// I wonder if they should be set in the post editor too\n\t\t\t__experimentalArchiveTitleTypeLabel: archiveLabels.archiveTypeLabel,\n\t\t\t__experimentalArchiveTitleNameLabel: archiveLabels.archiveNameLabel,\n\t\t};\n\t}, [\n\t\tsettings,\n\t\tsetIsInserterOpened,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thasFixedToolbar,\n\t\tkeepCaretInsideBlock,\n\t\tcanvasMode,\n\t\tarchiveLabels.archiveTypeLabel,\n\t\tarchiveLabels.archiveNameLabel,\n\t\tdefaultRenderingMode,\n\t] );\n\n\treturn defaultEditorSettings;\n}\n\nexport default function useSiteEditorSettings() {\n\tconst defaultEditorSettings = useSpecificEditorSettings();\n\tconst { postType, postId } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst usedPostType = getEditedPostType();\n\t\tconst usedPostId = getEditedPostId();\n\t\treturn {\n\t\t\tpostType: usedPostType,\n\t\t\tpostId: usedPostId,\n\t\t};\n\t}, [] );\n\treturn useBlockEditorSettings( defaultEditorSettings, postType, postId );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASH,KAAK,IAAII,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,SAASJ,KAAK,IAAIK,aAAa,QAAQ,aAAa;AACpD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAuB,CAAC,GAAGD,MAAM,CAAEH,iBAAkB,CAAC;AAE9D,SAASK,eAAeA,CAAEC,YAAY,EAAG;EACxC,MAAMC,eAAe,GAAGD,YAAY,EAAEE,KAAK,CAC1C,8EACD,CAAC;EACD,IAAIC,QAAQ;EACZ,IAAIC,IAAI;EACR,IAAIC,QAAQ,GAAG,KAAK;EACpB,IAAIC,UAAU;EACd,IAAKL,eAAe,EAAG;IACtB;IACA,IAAK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C9BgC,oBAAoB,CACnB,CAAC;EAEH,OAAOC,qBAAqB;AAC7B;AAEA,eAAe,SAASK,qBAAqBA,CAAA,EAAG;EAC/C,MAAML,qBAAqB,GAAGzB,yBAAyB,CAAC,CAAC;EACzD,MAAM;IAAE+B,QAAQ;IAAET;EAAO,CAAC,GAAGtD,SAAS,CAAImB,MAAM,IAAM;IACrD,MAAM;MAAEuB,iBAAiB;MAAEC;IAAgB,CAAC,GAAGnC,MAAM,CACpDW,MAAM,CAAEZ,aAAc,CACvB,CAAC;IACD,MAAM2C,YAAY,GAAGR,iBAAiB,CAAC,CAAC;IACxC,MAAMS,UAAU,GAAGR,eAAe,CAAC,CAAC;IACpC,OAAO;MACNoB,QAAQ,EAAEb,YAAY;MACtBI,MAAM,EAAEH;IACT,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,OAAO1C,sBAAsB,CAAEgD,qBAAqB,EAAEM,QAAQ,EAAET,MAAO,CAAC;AACzE"}
1
+ {"version":3,"names":["useSelect","useMemo","store","coreStore","privateApis","editorPrivateApis","editSiteStore","unlock","usePostLinkProps","useBlockEditorSettings","useArchiveLabel","templateSlug","taxonomyMatches","match","taxonomy","term","isAuthor","authorSlug","authorMatches","select","getEntityRecords","getTaxonomy","getAuthors","archiveTypeLabel","archiveNameLabel","labels","singular_name","records","slug","per_page","name","authorRecords","useSpecificEditorSettings","getPostLinkProps","canvasMode","settings","postWithTemplate","getEditedPostType","getEditedPostId","getEditedPostContext","getCanvasMode","getSettings","getEditedEntityRecord","usedPostType","usedPostId","_record","_context","postId","archiveLabels","defaultRenderingMode","defaultEditorSettings","richEditingEnabled","supportsTemplateMode","focusMode","__experimentalArchiveTitleTypeLabel","__experimentalArchiveTitleNameLabel","useSiteEditorSettings","postType"],"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 { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { usePostLinkProps } from './use-post-link-props';\n\nconst { useBlockEditorSettings } = unlock( editorPrivateApis );\n\nfunction useArchiveLabel( templateSlug ) {\n\tconst taxonomyMatches = templateSlug?.match(\n\t\t/^(category|tag|taxonomy-([^-]+))$|^(((category|tag)|taxonomy-([^-]+))-(.+))$/\n\t);\n\tlet taxonomy;\n\tlet term;\n\tlet isAuthor = false;\n\tlet authorSlug;\n\tif ( taxonomyMatches ) {\n\t\t// If is for a all taxonomies of a type\n\t\tif ( taxonomyMatches[ 1 ] ) {\n\t\t\ttaxonomy = taxonomyMatches[ 2 ]\n\t\t\t\t? taxonomyMatches[ 2 ]\n\t\t\t\t: taxonomyMatches[ 1 ];\n\t\t}\n\t\t// If is for a all taxonomies of a type\n\t\telse if ( taxonomyMatches[ 3 ] ) {\n\t\t\ttaxonomy = taxonomyMatches[ 6 ]\n\t\t\t\t? taxonomyMatches[ 6 ]\n\t\t\t\t: taxonomyMatches[ 4 ];\n\t\t\tterm = taxonomyMatches[ 7 ];\n\t\t}\n\t\ttaxonomy = taxonomy === 'tag' ? 'post_tag' : taxonomy;\n\n\t\t//getTaxonomy( 'category' );\n\t\t//wp.data.select('core').getEntityRecords( 'taxonomy', 'category', {slug: 'newcat'} );\n\t} else {\n\t\tconst authorMatches = templateSlug?.match( /^(author)$|^author-(.+)$/ );\n\t\tif ( authorMatches ) {\n\t\t\tisAuthor = true;\n\t\t\tif ( authorMatches[ 2 ] ) {\n\t\t\t\tauthorSlug = authorMatches[ 2 ];\n\t\t\t}\n\t\t}\n\t}\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getTaxonomy, getAuthors } =\n\t\t\t\tselect( coreStore );\n\t\t\tlet archiveTypeLabel;\n\t\t\tlet archiveNameLabel;\n\t\t\tif ( taxonomy ) {\n\t\t\t\tarchiveTypeLabel =\n\t\t\t\t\tgetTaxonomy( taxonomy )?.labels?.singular_name;\n\t\t\t}\n\t\t\tif ( term ) {\n\t\t\t\tconst records = getEntityRecords( 'taxonomy', taxonomy, {\n\t\t\t\t\tslug: term,\n\t\t\t\t\tper_page: 1,\n\t\t\t\t} );\n\t\t\t\tif ( records && records[ 0 ] ) {\n\t\t\t\t\tarchiveNameLabel = records[ 0 ].name;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( isAuthor ) {\n\t\t\t\tarchiveTypeLabel = 'Author';\n\t\t\t\tif ( authorSlug ) {\n\t\t\t\t\tconst authorRecords = getAuthors( { slug: authorSlug } );\n\t\t\t\t\tif ( authorRecords && authorRecords[ 0 ] ) {\n\t\t\t\t\t\tarchiveNameLabel = authorRecords[ 0 ].name;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tarchiveTypeLabel,\n\t\t\t\tarchiveNameLabel,\n\t\t\t};\n\t\t},\n\t\t[ authorSlug, isAuthor, taxonomy, term ]\n\t);\n}\n\nexport function useSpecificEditorSettings() {\n\tconst getPostLinkProps = usePostLinkProps();\n\tconst { templateSlug, canvasMode, settings, postWithTemplate } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostType,\n\t\t\t\tgetEditedPostId,\n\t\t\t\tgetEditedPostContext,\n\t\t\t\tgetCanvasMode,\n\t\t\t\tgetSettings,\n\t\t\t} = unlock( select( editSiteStore ) );\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst usedPostType = getEditedPostType();\n\t\t\tconst usedPostId = getEditedPostId();\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tusedPostType,\n\t\t\t\tusedPostId\n\t\t\t);\n\t\t\tconst _context = getEditedPostContext();\n\t\t\treturn {\n\t\t\t\ttemplateSlug: _record.slug,\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t\tsettings: getSettings(),\n\t\t\t\tpostWithTemplate: _context?.postId,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst archiveLabels = useArchiveLabel( templateSlug );\n\tconst defaultRenderingMode = postWithTemplate ? 'template-locked' : 'all';\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: canvasMode !== 'view',\n\t\t\tdefaultRenderingMode,\n\t\t\tgetPostLinkProps,\n\t\t\t// I wonder if they should be set in the post editor too\n\t\t\t__experimentalArchiveTitleTypeLabel: archiveLabels.archiveTypeLabel,\n\t\t\t__experimentalArchiveTitleNameLabel: archiveLabels.archiveNameLabel,\n\t\t};\n\t}, [\n\t\tsettings,\n\t\tcanvasMode,\n\t\tdefaultRenderingMode,\n\t\tgetPostLinkProps,\n\t\tarchiveLabels.archiveTypeLabel,\n\t\tarchiveLabels.archiveNameLabel,\n\t] );\n\n\treturn defaultEditorSettings;\n}\n\nexport default function useSiteEditorSettings() {\n\tconst defaultEditorSettings = useSpecificEditorSettings();\n\tconst { postType, postId } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst usedPostType = getEditedPostType();\n\t\tconst usedPostId = getEditedPostId();\n\t\treturn {\n\t\t\tpostType: usedPostType,\n\t\t\tpostId: usedPostId,\n\t\t};\n\t}, [] );\n\treturn useBlockEditorSettings( defaultEditorSettings, postType, postId );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASH,KAAK,IAAII,aAAa,QAAQ,aAAa;AAC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AAM,CACpDY,MAAM,CAAEb,aAAc,CACvB,CAAC;IACD,MAAMqC,YAAY,GAAGN,iBAAiB,CAAC,CAAC;IACxC,MAAMO,UAAU,GAAGN,eAAe,CAAC,CAAC;IACpC,OAAO;MACNmB,QAAQ,EAAEd,YAAY;MACtBI,MAAM,EAAEH;IACT,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,OAAOnC,sBAAsB,CAAEyC,qBAAqB,EAAEO,QAAQ,EAAEV,MAAO,CAAC;AACzE"}
@@ -19,11 +19,22 @@ import { serialize } from '@wordpress/blocks';
19
19
  import { TEMPLATE_PART_POST_TYPE, TEMPLATE_PART_AREA_DEFAULT_CATEGORY } from '../../utils/constants';
20
20
  import { useExistingTemplateParts, getUniqueTemplatePartTitle, getCleanTemplatePartSlug } from '../../utils/template-part-create';
21
21
  export default function CreateTemplatePartModal({
22
+ modalTitle = __('Create template part'),
23
+ ...restProps
24
+ }) {
25
+ return createElement(Modal, {
26
+ title: modalTitle,
27
+ onRequestClose: restProps.closeModal,
28
+ overlayClassName: "edit-site-create-template-part-modal"
29
+ }, createElement(CreateTemplatePartModalContents, {
30
+ ...restProps
31
+ }));
32
+ }
33
+ export function CreateTemplatePartModalContents({
22
34
  defaultArea = TEMPLATE_PART_AREA_DEFAULT_CATEGORY,
23
35
  blocks = [],
24
36
  confirmLabel = __('Create'),
25
37
  closeModal,
26
- modalTitle = __('Create template part'),
27
38
  onCreate,
28
39
  onError,
29
40
  defaultTitle = ''
@@ -69,11 +80,7 @@ export default function CreateTemplatePartModal({
69
80
  setIsSubmitting(false);
70
81
  }
71
82
  }
72
- return createElement(Modal, {
73
- title: modalTitle,
74
- onRequestClose: closeModal,
75
- overlayClassName: "edit-site-create-template-part-modal"
76
- }, createElement("form", {
83
+ return createElement("form", {
77
84
  onSubmit: async event => {
78
85
  event.preventDefault();
79
86
  await createTemplatePart();
@@ -128,6 +135,6 @@ export default function CreateTemplatePartModal({
128
135
  type: "submit",
129
136
  "aria-disabled": !title || isSubmitting,
130
137
  isBusy: isSubmitting
131
- }, confirmLabel)))));
138
+ }, confirmLabel))));
132
139
  }
133
140
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","Icon","BaseControl","TextControl","Flex","FlexItem","FlexBlock","Button","Modal","__experimentalRadioGroup","RadioGroup","__experimentalRadio","Radio","__experimentalHStack","HStack","__experimentalVStack","VStack","__","useState","useInstanceId","store","editorStore","noticesStore","coreStore","check","serialize","TEMPLATE_PART_POST_TYPE","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","useExistingTemplateParts","getUniqueTemplatePartTitle","getCleanTemplatePartSlug","CreateTemplatePartModal","defaultArea","blocks","confirmLabel","closeModal","modalTitle","onCreate","onError","defaultTitle","createErrorNotice","saveEntityRecord","existingTemplateParts","title","setTitle","area","setArea","isSubmitting","setIsSubmitting","instanceId","templatePartAreas","select","__experimentalGetDefaultTemplatePartAreas","createTemplatePart","uniqueTitle","cleanSlug","templatePart","slug","content","throwOnError","error","errorMessage","message","code","type","createElement","onRequestClose","overlayClassName","onSubmit","event","preventDefault","spacing","__nextHasNoMarginBottom","label","value","onChange","required","id","className","checked","map","icon","description","key","align","justify","variant","onClick","isBusy"],"sources":["@wordpress/edit-site/src/components/create-template-part-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tIcon,\n\tBaseControl,\n\tTextControl,\n\tFlex,\n\tFlexItem,\n\tFlexBlock,\n\tButton,\n\tModal,\n\t__experimentalRadioGroup as RadioGroup,\n\t__experimentalRadio as Radio,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { check } from '@wordpress/icons';\nimport { serialize } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n} from '../../utils/constants';\nimport {\n\tuseExistingTemplateParts,\n\tgetUniqueTemplatePartTitle,\n\tgetCleanTemplatePartSlug,\n} from '../../utils/template-part-create';\n\nexport default function CreateTemplatePartModal( {\n\tdefaultArea = TEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n\tblocks = [],\n\tconfirmLabel = __( 'Create' ),\n\tcloseModal,\n\tmodalTitle = __( 'Create template part' ),\n\tonCreate,\n\tonError,\n\tdefaultTitle = '',\n} ) {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst existingTemplateParts = useExistingTemplateParts();\n\n\tconst [ title, setTitle ] = useState( defaultTitle );\n\tconst [ area, setArea ] = useState( defaultArea );\n\tconst [ isSubmitting, setIsSubmitting ] = useState( false );\n\tconst instanceId = useInstanceId( CreateTemplatePartModal );\n\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\n\tasync function createTemplatePart() {\n\t\tif ( ! title || isSubmitting ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tsetIsSubmitting( true );\n\t\t\tconst uniqueTitle = getUniqueTemplatePartTitle(\n\t\t\t\ttitle,\n\t\t\t\texistingTemplateParts\n\t\t\t);\n\t\t\tconst cleanSlug = getCleanTemplatePartSlug( uniqueTitle );\n\n\t\t\tconst templatePart = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t{\n\t\t\t\t\tslug: cleanSlug,\n\t\t\t\t\ttitle: uniqueTitle,\n\t\t\t\t\tcontent: serialize( blocks ),\n\t\t\t\t\tarea,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\t\t\tawait onCreate( templatePart );\n\n\t\t\t// TODO: Add a success notice?\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'An error occurred while creating the template part.'\n\t\t\t\t\t );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\n\t\t\tonError?.();\n\t\t} finally {\n\t\t\tsetIsSubmitting( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ modalTitle }\n\t\t\tonRequestClose={ closeModal }\n\t\t\toverlayClassName=\"edit-site-create-template-part-modal\"\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ async ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tawait createTemplatePart();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"4\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<BaseControl\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tid={ `edit-site-create-template-part-modal__area-selection-${ instanceId }` }\n\t\t\t\t\t\tclassName=\"edit-site-create-template-part-modal__area-base-control\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<RadioGroup\n\t\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\t\tclassName=\"edit-site-create-template-part-modal__area-radio-group\"\n\t\t\t\t\t\t\tid={ `edit-site-create-template-part-modal__area-selection-${ instanceId }` }\n\t\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t\t\tchecked={ area }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ templatePartAreas.map(\n\t\t\t\t\t\t\t\t( {\n\t\t\t\t\t\t\t\t\ticon,\n\t\t\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t\t\tarea: value,\n\t\t\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\t\t} ) => (\n\t\t\t\t\t\t\t\t\t<Radio\n\t\t\t\t\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-create-template-part-modal__area-radio\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Flex align=\"start\" justify=\"start\">\n\t\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t<FlexBlock className=\"edit-site-create-template-part-modal__option-label\">\n\t\t\t\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t\t\t\t\t<div>{ description }</div>\n\t\t\t\t\t\t\t\t\t\t\t</FlexBlock>\n\n\t\t\t\t\t\t\t\t\t\t\t<FlexItem className=\"edit-site-create-template-part-modal__checkbox\">\n\t\t\t\t\t\t\t\t\t\t\t\t{ area === value && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ check } />\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</FlexItem>\n\t\t\t\t\t\t\t\t\t\t</Flex>\n\t\t\t\t\t\t\t\t\t</Radio>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</RadioGroup>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\taria-disabled={ ! title || isSubmitting }\n\t\t\t\t\t\t\tisBusy={ isSubmitting }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ confirmLabel }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,IAAI,EACJC,WAAW,EACXC,WAAW,EACXC,IAAI,EACJC,QAAQ,EACRC,SAAS,EACTC,MAAM,EACNC,KAAK,EACLC,wBAAwB,IAAIC,UAAU,EACtCC,mBAAmB,IAAIC,KAAK,EAC5BC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASD,KAAK,IAAIE,YAAY,QAAQ,oBAAoB;AAC1D,SAASF,KAAK,IAAIG,SAAS,QAAQ,sBAAsB;AACzD,SAASC,KAAK,QAAQ,kBAAkB;AACxC,SAASC,SAAS,QAAQ,mBAAmB;;AAE7C;AACA;AACA;AACA,SACCC,uBAAuB,EACvBC,mCAAmC,QAC7B,uBAAuB;AAC9B,SACCC,wBAAwB,EACxBC,0BAA0B,EAC1BC,wBAAwB,QAClB,kCAAkC;AAEzC,eAAe,SAASC,uBAAuBA,CAAE;EAChDC,WAAW,GAAGL,mC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AAG;IAC7E0B,QAAQ,EAAG7B,OAAS;IACpBiC,OAAO,EAAGlC;EAAM,GAEdK,iBAAiB,CAAC8B,GAAG,CACtB,CAAE;IACDC,IAAI;IACJR,KAAK;IACL5B,IAAI,EAAE6B,KAAK;IACXQ;EACD,CAAC,KACAjB,aAAA,CAACrD,KAAK;IACLuE,GAAG,EAAGV,KAAO;IACbC,KAAK,EAAGA,KAAO;IACfI,SAAS,EAAC;EAAkD,GAE5Db,aAAA,CAAC7D,IAAI;IAACgF,KAAK,EAAC,OAAO;IAACC,OAAO,EAAC;EAAO,GAClCpB,aAAA,CAAC5D,QAAQ,QACR4D,aAAA,CAAChE,IAAI;IAACgF,IAAI,EAAGA;EAAM,CAAE,CACZ,CAAC,EACXhB,aAAA,CAAC3D,SAAS;IAACwE,SAAS,EAAC;EAAoD,GACtEL,KAAK,EACPR,aAAA,cAAOiB,WAAkB,CACf,CAAC,EAEZjB,aAAA,CAAC5D,QAAQ;IAACyE,SAAS,EAAC;EAAgD,GACjEjC,IAAI,KAAK6B,KAAK,IACfT,aAAA,CAAChE,IAAI;IAACgF,IAAI,EAAGzD;EAAO,CAAE,CAEd,CACL,CACA,CAET,CACW,CACA,CAAC,EACdyC,aAAA,CAACnD,MAAM;IAACuE,OAAO,EAAC;EAAO,GACtBpB,aAAA,CAAC1D,MAAM;IACN+E,OAAO,EAAC,UAAU;IAClBC,OAAO,EAAGA,CAAA,KAAM;MACfpD,UAAU,CAAC,CAAC;IACb;EAAG,GAEDlB,EAAE,CAAE,QAAS,CACR,CAAC,EACTgD,aAAA,CAAC1D,MAAM;IACN+E,OAAO,EAAC,SAAS;IACjBtB,IAAI,EAAC,QAAQ;IACb,iBAAgB,CAAErB,KAAK,IAAII,YAAc;IACzCyC,MAAM,EAAGzC;EAAc,GAErBb,YACK,CACD,CACD,CACH,CACA,CAAC;AAEV"}
1
+ {"version":3,"names":["useSelect","useDispatch","Icon","BaseControl","TextControl","Flex","FlexItem","FlexBlock","Button","Modal","__experimentalRadioGroup","RadioGroup","__experimentalRadio","Radio","__experimentalHStack","HStack","__experimentalVStack","VStack","__","useState","useInstanceId","store","editorStore","noticesStore","coreStore","check","serialize","TEMPLATE_PART_POST_TYPE","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","useExistingTemplateParts","getUniqueTemplatePartTitle","getCleanTemplatePartSlug","CreateTemplatePartModal","modalTitle","restProps","createElement","title","onRequestClose","closeModal","overlayClassName","CreateTemplatePartModalContents","defaultArea","blocks","confirmLabel","onCreate","onError","defaultTitle","createErrorNotice","saveEntityRecord","existingTemplateParts","setTitle","area","setArea","isSubmitting","setIsSubmitting","instanceId","templatePartAreas","select","__experimentalGetDefaultTemplatePartAreas","createTemplatePart","uniqueTitle","cleanSlug","templatePart","slug","content","throwOnError","error","errorMessage","message","code","type","onSubmit","event","preventDefault","spacing","__nextHasNoMarginBottom","label","value","onChange","required","id","className","checked","map","icon","description","key","align","justify","variant","onClick","isBusy"],"sources":["@wordpress/edit-site/src/components/create-template-part-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tIcon,\n\tBaseControl,\n\tTextControl,\n\tFlex,\n\tFlexItem,\n\tFlexBlock,\n\tButton,\n\tModal,\n\t__experimentalRadioGroup as RadioGroup,\n\t__experimentalRadio as Radio,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { check } from '@wordpress/icons';\nimport { serialize } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n} from '../../utils/constants';\nimport {\n\tuseExistingTemplateParts,\n\tgetUniqueTemplatePartTitle,\n\tgetCleanTemplatePartSlug,\n} from '../../utils/template-part-create';\n\nexport default function CreateTemplatePartModal( {\n\tmodalTitle = __( 'Create template part' ),\n\t...restProps\n} ) {\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ modalTitle }\n\t\t\tonRequestClose={ restProps.closeModal }\n\t\t\toverlayClassName=\"edit-site-create-template-part-modal\"\n\t\t>\n\t\t\t<CreateTemplatePartModalContents { ...restProps } />\n\t\t</Modal>\n\t);\n}\n\nexport function CreateTemplatePartModalContents( {\n\tdefaultArea = TEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n\tblocks = [],\n\tconfirmLabel = __( 'Create' ),\n\tcloseModal,\n\tonCreate,\n\tonError,\n\tdefaultTitle = '',\n} ) {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst existingTemplateParts = useExistingTemplateParts();\n\n\tconst [ title, setTitle ] = useState( defaultTitle );\n\tconst [ area, setArea ] = useState( defaultArea );\n\tconst [ isSubmitting, setIsSubmitting ] = useState( false );\n\tconst instanceId = useInstanceId( CreateTemplatePartModal );\n\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\tasync function createTemplatePart() {\n\t\tif ( ! title || isSubmitting ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tsetIsSubmitting( true );\n\t\t\tconst uniqueTitle = getUniqueTemplatePartTitle(\n\t\t\t\ttitle,\n\t\t\t\texistingTemplateParts\n\t\t\t);\n\t\t\tconst cleanSlug = getCleanTemplatePartSlug( uniqueTitle );\n\n\t\t\tconst templatePart = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t{\n\t\t\t\t\tslug: cleanSlug,\n\t\t\t\t\ttitle: uniqueTitle,\n\t\t\t\t\tcontent: serialize( blocks ),\n\t\t\t\t\tarea,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\t\t\tawait onCreate( templatePart );\n\n\t\t\t// TODO: Add a success notice?\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'An error occurred while creating the template part.'\n\t\t\t\t\t );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\n\t\t\tonError?.();\n\t\t} finally {\n\t\t\tsetIsSubmitting( false );\n\t\t}\n\t}\n\treturn (\n\t\t<form\n\t\t\tonSubmit={ async ( event ) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tawait createTemplatePart();\n\t\t\t} }\n\t\t>\n\t\t\t<VStack spacing=\"4\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\trequired\n\t\t\t\t/>\n\t\t\t\t<BaseControl\n\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\tid={ `edit-site-create-template-part-modal__area-selection-${ instanceId }` }\n\t\t\t\t\tclassName=\"edit-site-create-template-part-modal__area-base-control\"\n\t\t\t\t>\n\t\t\t\t\t<RadioGroup\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tclassName=\"edit-site-create-template-part-modal__area-radio-group\"\n\t\t\t\t\t\tid={ `edit-site-create-template-part-modal__area-selection-${ instanceId }` }\n\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t\tchecked={ area }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ templatePartAreas.map(\n\t\t\t\t\t\t\t( { icon, label, area: value, description } ) => (\n\t\t\t\t\t\t\t\t<Radio\n\t\t\t\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-create-template-part-modal__area-radio\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<Flex align=\"start\" justify=\"start\">\n\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t<FlexBlock className=\"edit-site-create-template-part-modal__option-label\">\n\t\t\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t\t\t\t<div>{ description }</div>\n\t\t\t\t\t\t\t\t\t\t</FlexBlock>\n\n\t\t\t\t\t\t\t\t\t\t<FlexItem className=\"edit-site-create-template-part-modal__checkbox\">\n\t\t\t\t\t\t\t\t\t\t\t{ area === value && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ check } />\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t</Flex>\n\t\t\t\t\t\t\t\t</Radio>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) }\n\t\t\t\t\t</RadioGroup>\n\t\t\t\t</BaseControl>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\taria-disabled={ ! title || isSubmitting }\n\t\t\t\t\t\tisBusy={ isSubmitting }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ confirmLabel }\n\t\t\t\t\t</Button>\n\t\t\t\t</HSt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