@wordpress/edit-site 5.11.0 → 5.12.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 (587) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-page/index.js +105 -0
  3. package/build/components/add-new-page/index.js.map +1 -0
  4. package/build/components/add-new-template/add-custom-generic-template-modal-content.js +4 -5
  5. package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  6. package/build/components/add-new-template/add-custom-template-modal-content.js +19 -22
  7. package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
  8. package/build/components/add-new-template/index.js +4 -5
  9. package/build/components/add-new-template/index.js.map +1 -1
  10. package/build/components/add-new-template/new-template-part.js +9 -12
  11. package/build/components/add-new-template/new-template-part.js.map +1 -1
  12. package/build/components/add-new-template/new-template.js +19 -26
  13. package/build/components/add-new-template/new-template.js.map +1 -1
  14. package/build/components/add-new-template/utils.js +71 -120
  15. package/build/components/add-new-template/utils.js.map +1 -1
  16. package/build/components/block-editor/back-button.js +1 -3
  17. package/build/components/block-editor/back-button.js.map +1 -1
  18. package/build/components/block-editor/block-inspector-button.js +3 -4
  19. package/build/components/block-editor/block-inspector-button.js.map +1 -1
  20. package/build/components/block-editor/editor-canvas.js +6 -7
  21. package/build/components/block-editor/editor-canvas.js.map +1 -1
  22. package/build/components/block-editor/index.js +13 -10
  23. package/build/components/block-editor/index.js.map +1 -1
  24. package/build/components/block-editor/inserter-media-categories.js +25 -42
  25. package/build/components/block-editor/inserter-media-categories.js.map +1 -1
  26. package/build/components/block-editor/resizable-editor.js +6 -7
  27. package/build/components/block-editor/resizable-editor.js.map +1 -1
  28. package/build/components/block-editor/resize-handle.js +5 -7
  29. package/build/components/block-editor/resize-handle.js.map +1 -1
  30. package/build/components/code-editor/code-editor-text-area.js +5 -6
  31. package/build/components/code-editor/code-editor-text-area.js.map +1 -1
  32. package/build/components/create-template-part-modal/index.js +25 -29
  33. package/build/components/create-template-part-modal/index.js.map +1 -1
  34. package/build/components/editor/index.js +26 -17
  35. package/build/components/editor/index.js.map +1 -1
  36. package/build/components/editor-canvas-container/index.js +7 -8
  37. package/build/components/editor-canvas-container/index.js.map +1 -1
  38. package/build/components/error-boundary/warning.js +8 -10
  39. package/build/components/error-boundary/warning.js.map +1 -1
  40. package/build/components/global-styles/block-preview-panel.js +7 -10
  41. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  42. package/build/components/global-styles/color-indicator-wrapper.js +4 -5
  43. package/build/components/global-styles/color-indicator-wrapper.js.map +1 -1
  44. package/build/components/global-styles/color-palette-panel.js +3 -4
  45. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  46. package/build/components/global-styles/dimensions-panel.js +1 -3
  47. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  48. package/build/components/global-styles/global-styles-provider.js +8 -10
  49. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  50. package/build/components/global-styles/gradients-palette-panel.js +3 -4
  51. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  52. package/build/components/global-styles/header.js +4 -5
  53. package/build/components/global-styles/header.js.map +1 -1
  54. package/build/components/global-styles/icon-with-current-color.js +4 -5
  55. package/build/components/global-styles/icon-with-current-color.js.map +1 -1
  56. package/build/components/global-styles/navigation-button.js +5 -6
  57. package/build/components/global-styles/navigation-button.js.map +1 -1
  58. package/build/components/global-styles/palette.js +10 -14
  59. package/build/components/global-styles/palette.js.map +1 -1
  60. package/build/components/global-styles/preview.js +41 -51
  61. package/build/components/global-styles/preview.js.map +1 -1
  62. package/build/components/global-styles/screen-block-list.js +4 -7
  63. package/build/components/global-styles/screen-block-list.js.map +1 -1
  64. package/build/components/global-styles/screen-block.js +9 -10
  65. package/build/components/global-styles/screen-block.js.map +1 -1
  66. package/build/components/global-styles/screen-color-palette.js +3 -4
  67. package/build/components/global-styles/screen-color-palette.js.map +1 -1
  68. package/build/components/global-styles/screen-revisions/index.js +8 -8
  69. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  70. package/build/components/global-styles/screen-revisions/revisions-buttons.js +14 -19
  71. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  72. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +5 -11
  73. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  74. package/build/components/global-styles/screen-root.js +3 -3
  75. package/build/components/global-styles/screen-root.js.map +1 -1
  76. package/build/components/global-styles/screen-typography-element.js +3 -4
  77. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  78. package/build/components/global-styles/screen-typography.js +5 -6
  79. package/build/components/global-styles/screen-typography.js.map +1 -1
  80. package/build/components/global-styles/style-variations-container.js +5 -6
  81. package/build/components/global-styles/style-variations-container.js.map +1 -1
  82. package/build/components/global-styles/subtitle.js +4 -5
  83. package/build/components/global-styles/subtitle.js.map +1 -1
  84. package/build/components/global-styles/typography-panel.js +4 -5
  85. package/build/components/global-styles/typography-panel.js.map +1 -1
  86. package/build/components/global-styles/typography-preview.js +5 -6
  87. package/build/components/global-styles/typography-preview.js.map +1 -1
  88. package/build/components/global-styles/ui.js +40 -21
  89. package/build/components/global-styles/ui.js.map +1 -1
  90. package/build/components/global-styles/variations-panel.js +5 -6
  91. package/build/components/global-styles/variations-panel.js.map +1 -1
  92. package/build/components/header-edit-mode/document-actions/index.js +102 -23
  93. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  94. package/build/components/header-edit-mode/index.js +2 -6
  95. package/build/components/header-edit-mode/index.js.map +1 -1
  96. package/build/components/header-edit-mode/more-menu/index.js +49 -53
  97. package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
  98. package/build/components/header-edit-mode/tools-more-menu-group/index.js +5 -14
  99. package/build/components/header-edit-mode/tools-more-menu-group/index.js.map +1 -1
  100. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
  101. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  102. package/build/components/keyboard-shortcut-help-modal/index.js +41 -51
  103. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  104. package/build/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
  105. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  106. package/build/components/layout/index.js +4 -12
  107. package/build/components/layout/index.js.map +1 -1
  108. package/build/components/list/added-by.js +13 -23
  109. package/build/components/list/added-by.js.map +1 -1
  110. package/build/components/list/header.js +4 -7
  111. package/build/components/list/header.js.map +1 -1
  112. package/build/components/list/index.js +2 -4
  113. package/build/components/list/index.js.map +1 -1
  114. package/build/components/list/table.js +35 -40
  115. package/build/components/list/table.js.map +1 -1
  116. package/build/components/page-actions/delete-page-menu-item.js +70 -0
  117. package/build/components/page-actions/delete-page-menu-item.js.map +1 -0
  118. package/build/components/page-actions/index.js +43 -0
  119. package/build/components/page-actions/index.js.map +1 -0
  120. package/build/components/page-content-lock/constants.js +9 -0
  121. package/build/components/page-content-lock/constants.js.map +1 -0
  122. package/build/components/page-content-lock/index.js +29 -0
  123. package/build/components/page-content-lock/index.js.map +1 -0
  124. package/build/components/page-content-lock/use-disable-non-content-blocks.js +49 -0
  125. package/build/components/page-content-lock/use-disable-non-content-blocks.js.map +1 -0
  126. package/build/components/page-content-lock/use-page-content-lock-notifications.js +112 -0
  127. package/build/components/page-content-lock/use-page-content-lock-notifications.js.map +1 -0
  128. package/build/components/preferences-modal/index.js +4 -5
  129. package/build/components/preferences-modal/index.js.map +1 -1
  130. package/build/components/resizable-frame/index.js +20 -12
  131. package/build/components/resizable-frame/index.js.map +1 -1
  132. package/build/components/revisions/index.js +11 -14
  133. package/build/components/revisions/index.js.map +1 -1
  134. package/build/components/routes/link.js +8 -12
  135. package/build/components/routes/link.js.map +1 -1
  136. package/build/components/routes/use-title.js +1 -5
  137. package/build/components/routes/use-title.js.map +1 -1
  138. package/build/components/save-button/index.js +13 -7
  139. package/build/components/save-button/index.js.map +1 -1
  140. package/build/components/save-hub/index.js +97 -5
  141. package/build/components/save-hub/index.js.map +1 -1
  142. package/build/components/save-panel/index.js +63 -17
  143. package/build/components/save-panel/index.js.map +1 -1
  144. package/build/components/secondary-sidebar/list-view-sidebar.js +8 -3
  145. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  146. package/build/components/sidebar/index.js +7 -5
  147. package/build/components/sidebar/index.js.map +1 -1
  148. package/build/components/sidebar-edit-mode/default-sidebar.js +11 -12
  149. package/build/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
  150. package/build/components/sidebar-edit-mode/index.js +13 -10
  151. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  152. package/build/components/sidebar-edit-mode/page-panels/content-blocks-list.js +79 -0
  153. package/build/components/sidebar-edit-mode/page-panels/content-blocks-list.js.map +1 -0
  154. package/build/components/sidebar-edit-mode/page-panels/index.js +86 -0
  155. package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -0
  156. package/build/components/sidebar-edit-mode/plugin-sidebar/index.js +4 -5
  157. package/build/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
  158. package/build/components/sidebar-edit-mode/settings-header/index.js +39 -21
  159. package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
  160. package/build/components/sidebar-edit-mode/sidebar-card/index.js +46 -0
  161. package/build/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -0
  162. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +3 -4
  163. package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -1
  164. package/build/components/sidebar-edit-mode/{template-card → template-panel}/index.js +22 -18
  165. package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -0
  166. package/build/components/sidebar-edit-mode/{template-revisions/index.js → template-panel/last-revision.js} +7 -8
  167. package/{build-module/components/sidebar-edit-mode/template-revisions/index.js.map → build/components/sidebar-edit-mode/template-panel/last-revision.js.map} +1 -1
  168. package/build/components/sidebar-edit-mode/{template-card → template-panel}/template-actions.js +12 -16
  169. package/build/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -0
  170. package/build/components/sidebar-edit-mode/{template-card → template-panel}/template-areas.js +15 -19
  171. package/build/components/sidebar-edit-mode/template-panel/template-areas.js.map +1 -0
  172. package/build/components/sidebar-navigation-item/index.js +7 -8
  173. package/build/components/sidebar-navigation-item/index.js.map +1 -1
  174. package/build/components/sidebar-navigation-screen/index.js +21 -14
  175. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  176. package/build/components/sidebar-navigation-screen-global-styles/index.js +103 -13
  177. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  178. package/build/components/sidebar-navigation-screen-navigation-item/index.js +3 -5
  179. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  180. package/build/components/sidebar-navigation-screen-navigation-menu/index.js +7 -10
  181. package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  182. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +17 -23
  183. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  184. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +20 -23
  185. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  186. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +4 -5
  187. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  188. package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +8 -9
  189. package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -1
  190. package/build/components/sidebar-navigation-screen-page/index.js +81 -10
  191. package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
  192. package/build/components/sidebar-navigation-screen-page/page-details.js +148 -0
  193. package/build/components/sidebar-navigation-screen-page/page-details.js.map +1 -0
  194. package/build/components/sidebar-navigation-screen-page/status-label.js +110 -0
  195. package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -0
  196. package/build/components/sidebar-navigation-screen-pages/index.js +128 -17
  197. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  198. package/build/components/sidebar-navigation-screen-template/index.js +22 -16
  199. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  200. package/build/components/sidebar-navigation-screen-template-part/index.js +105 -0
  201. package/build/components/sidebar-navigation-screen-template-part/index.js.map +1 -0
  202. package/build/components/sidebar-navigation-screen-templates/index.js +13 -18
  203. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  204. package/build/components/sidebar-navigation-subtitle/index.js +3 -4
  205. package/build/components/sidebar-navigation-subtitle/index.js.map +1 -1
  206. package/build/components/site-hub/index.js +20 -13
  207. package/build/components/site-hub/index.js.map +1 -1
  208. package/build/components/site-icon/index.js +4 -5
  209. package/build/components/site-icon/index.js.map +1 -1
  210. package/build/components/start-template-options/index.js +15 -21
  211. package/build/components/start-template-options/index.js.map +1 -1
  212. package/build/components/style-book/index.js +35 -39
  213. package/build/components/style-book/index.js.map +1 -1
  214. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +2 -2
  215. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  216. package/build/components/sync-state-with-url/use-sync-path-with-url.js +9 -10
  217. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  218. package/build/components/{list/actions → template-actions}/index.js +34 -31
  219. package/build/components/template-actions/index.js.map +1 -0
  220. package/build/components/{list/actions → template-actions}/rename-menu-item.js +4 -5
  221. package/build/components/template-actions/rename-menu-item.js.map +1 -0
  222. package/build/components/template-part-converter/convert-to-regular.js +4 -5
  223. package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
  224. package/build/components/template-part-converter/convert-to-template-part.js +8 -10
  225. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  226. package/build/components/template-part-converter/index.js +12 -18
  227. package/build/components/template-part-converter/index.js.map +1 -1
  228. package/build/components/welcome-guide/image.js +4 -5
  229. package/build/components/welcome-guide/image.js.map +1 -1
  230. package/build/hooks/commands/use-edit-mode-commands.js +6 -8
  231. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  232. package/build/hooks/push-changes-to-global-styles/index.js +11 -8
  233. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  234. package/build/hooks/template-part-edit.js +5 -6
  235. package/build/hooks/template-part-edit.js.map +1 -1
  236. package/build/index.js +3 -6
  237. package/build/index.js.map +1 -1
  238. package/build/store/actions.js +129 -125
  239. package/build/store/actions.js.map +1 -1
  240. package/build/store/private-actions.js +7 -10
  241. package/build/store/private-actions.js.map +1 -1
  242. package/build/store/reducer.js +32 -33
  243. package/build/store/reducer.js.map +1 -1
  244. package/build/store/selectors.js +35 -11
  245. package/build/store/selectors.js.map +1 -1
  246. package/build/store/utils.js +1 -3
  247. package/build/store/utils.js.map +1 -1
  248. package/build/utils/get-is-list-page.js +3 -4
  249. package/build/utils/get-is-list-page.js.map +1 -1
  250. package/build/utils/is-previewing-theme.js +1 -3
  251. package/build/utils/is-previewing-theme.js.map +1 -1
  252. package/build/utils/is-template-revertable.js +1 -1
  253. package/build/utils/is-template-revertable.js.map +1 -1
  254. package/build-module/components/add-new-page/index.js +93 -0
  255. package/build-module/components/add-new-page/index.js.map +1 -0
  256. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +4 -5
  257. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  258. package/build-module/components/add-new-template/add-custom-template-modal-content.js +19 -22
  259. package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
  260. package/build-module/components/add-new-template/index.js +4 -5
  261. package/build-module/components/add-new-template/index.js.map +1 -1
  262. package/build-module/components/add-new-template/new-template-part.js +9 -12
  263. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  264. package/build-module/components/add-new-template/new-template.js +18 -26
  265. package/build-module/components/add-new-template/new-template.js.map +1 -1
  266. package/build-module/components/add-new-template/utils.js +71 -120
  267. package/build-module/components/add-new-template/utils.js.map +1 -1
  268. package/build-module/components/block-editor/back-button.js +1 -3
  269. package/build-module/components/block-editor/back-button.js.map +1 -1
  270. package/build-module/components/block-editor/block-inspector-button.js +3 -4
  271. package/build-module/components/block-editor/block-inspector-button.js.map +1 -1
  272. package/build-module/components/block-editor/editor-canvas.js +6 -7
  273. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  274. package/build-module/components/block-editor/index.js +12 -10
  275. package/build-module/components/block-editor/index.js.map +1 -1
  276. package/build-module/components/block-editor/inserter-media-categories.js +25 -42
  277. package/build-module/components/block-editor/inserter-media-categories.js.map +1 -1
  278. package/build-module/components/block-editor/resizable-editor.js +6 -7
  279. package/build-module/components/block-editor/resizable-editor.js.map +1 -1
  280. package/build-module/components/block-editor/resize-handle.js +5 -7
  281. package/build-module/components/block-editor/resize-handle.js.map +1 -1
  282. package/build-module/components/code-editor/code-editor-text-area.js +5 -6
  283. package/build-module/components/code-editor/code-editor-text-area.js.map +1 -1
  284. package/build-module/components/create-template-part-modal/index.js +25 -29
  285. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  286. package/build-module/components/editor/index.js +26 -17
  287. package/build-module/components/editor/index.js.map +1 -1
  288. package/build-module/components/editor-canvas-container/index.js +7 -8
  289. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  290. package/build-module/components/error-boundary/warning.js +8 -10
  291. package/build-module/components/error-boundary/warning.js.map +1 -1
  292. package/build-module/components/global-styles/block-preview-panel.js +7 -10
  293. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  294. package/build-module/components/global-styles/color-indicator-wrapper.js +4 -5
  295. package/build-module/components/global-styles/color-indicator-wrapper.js.map +1 -1
  296. package/build-module/components/global-styles/color-palette-panel.js +3 -4
  297. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  298. package/build-module/components/global-styles/dimensions-panel.js +1 -3
  299. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  300. package/build-module/components/global-styles/global-styles-provider.js +8 -10
  301. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  302. package/build-module/components/global-styles/gradients-palette-panel.js +3 -4
  303. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  304. package/build-module/components/global-styles/header.js +4 -5
  305. package/build-module/components/global-styles/header.js.map +1 -1
  306. package/build-module/components/global-styles/icon-with-current-color.js +4 -5
  307. package/build-module/components/global-styles/icon-with-current-color.js.map +1 -1
  308. package/build-module/components/global-styles/navigation-button.js +5 -6
  309. package/build-module/components/global-styles/navigation-button.js.map +1 -1
  310. package/build-module/components/global-styles/palette.js +10 -14
  311. package/build-module/components/global-styles/palette.js.map +1 -1
  312. package/build-module/components/global-styles/preview.js +41 -51
  313. package/build-module/components/global-styles/preview.js.map +1 -1
  314. package/build-module/components/global-styles/screen-block-list.js +4 -7
  315. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  316. package/build-module/components/global-styles/screen-block.js +9 -10
  317. package/build-module/components/global-styles/screen-block.js.map +1 -1
  318. package/build-module/components/global-styles/screen-color-palette.js +3 -4
  319. package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
  320. package/build-module/components/global-styles/screen-revisions/index.js +8 -8
  321. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  322. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +14 -19
  323. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  324. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +5 -10
  325. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  326. package/build-module/components/global-styles/screen-root.js +3 -3
  327. package/build-module/components/global-styles/screen-root.js.map +1 -1
  328. package/build-module/components/global-styles/screen-typography-element.js +3 -4
  329. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  330. package/build-module/components/global-styles/screen-typography.js +5 -6
  331. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  332. package/build-module/components/global-styles/style-variations-container.js +5 -6
  333. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  334. package/build-module/components/global-styles/subtitle.js +4 -5
  335. package/build-module/components/global-styles/subtitle.js.map +1 -1
  336. package/build-module/components/global-styles/typography-panel.js +4 -5
  337. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  338. package/build-module/components/global-styles/typography-preview.js +5 -6
  339. package/build-module/components/global-styles/typography-preview.js.map +1 -1
  340. package/build-module/components/global-styles/ui.js +40 -21
  341. package/build-module/components/global-styles/ui.js.map +1 -1
  342. package/build-module/components/global-styles/variations-panel.js +5 -6
  343. package/build-module/components/global-styles/variations-panel.js.map +1 -1
  344. package/build-module/components/header-edit-mode/document-actions/index.js +102 -24
  345. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  346. package/build-module/components/header-edit-mode/index.js +2 -6
  347. package/build-module/components/header-edit-mode/index.js.map +1 -1
  348. package/build-module/components/header-edit-mode/more-menu/index.js +49 -53
  349. package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
  350. package/build-module/components/header-edit-mode/tools-more-menu-group/index.js +5 -13
  351. package/build-module/components/header-edit-mode/tools-more-menu-group/index.js.map +1 -1
  352. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
  353. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  354. package/build-module/components/keyboard-shortcut-help-modal/index.js +39 -49
  355. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  356. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
  357. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  358. package/build-module/components/layout/index.js +4 -12
  359. package/build-module/components/layout/index.js.map +1 -1
  360. package/build-module/components/list/added-by.js +13 -23
  361. package/build-module/components/list/added-by.js.map +1 -1
  362. package/build-module/components/list/header.js +4 -7
  363. package/build-module/components/list/header.js.map +1 -1
  364. package/build-module/components/list/index.js +2 -4
  365. package/build-module/components/list/index.js.map +1 -1
  366. package/build-module/components/list/table.js +34 -39
  367. package/build-module/components/list/table.js.map +1 -1
  368. package/build-module/components/page-actions/delete-page-menu-item.js +58 -0
  369. package/build-module/components/page-actions/delete-page-menu-item.js.map +1 -0
  370. package/build-module/components/page-actions/index.js +30 -0
  371. package/build-module/components/page-actions/index.js.map +1 -0
  372. package/build-module/components/page-content-lock/constants.js +2 -0
  373. package/build-module/components/page-content-lock/constants.js.map +1 -0
  374. package/build-module/components/page-content-lock/index.js +14 -0
  375. package/build-module/components/page-content-lock/index.js.map +1 -0
  376. package/build-module/components/page-content-lock/use-disable-non-content-blocks.js +36 -0
  377. package/build-module/components/page-content-lock/use-disable-non-content-blocks.js.map +1 -0
  378. package/build-module/components/page-content-lock/use-page-content-lock-notifications.js +98 -0
  379. package/build-module/components/page-content-lock/use-page-content-lock-notifications.js.map +1 -0
  380. package/build-module/components/preferences-modal/index.js +4 -5
  381. package/build-module/components/preferences-modal/index.js.map +1 -1
  382. package/build-module/components/resizable-frame/index.js +20 -12
  383. package/build-module/components/resizable-frame/index.js.map +1 -1
  384. package/build-module/components/revisions/index.js +11 -13
  385. package/build-module/components/revisions/index.js.map +1 -1
  386. package/build-module/components/routes/link.js +8 -12
  387. package/build-module/components/routes/link.js.map +1 -1
  388. package/build-module/components/routes/use-title.js +1 -5
  389. package/build-module/components/routes/use-title.js.map +1 -1
  390. package/build-module/components/save-button/index.js +13 -7
  391. package/build-module/components/save-button/index.js.map +1 -1
  392. package/build-module/components/save-hub/index.js +95 -8
  393. package/build-module/components/save-hub/index.js.map +1 -1
  394. package/build-module/components/save-panel/index.js +62 -19
  395. package/build-module/components/save-panel/index.js.map +1 -1
  396. package/build-module/components/secondary-sidebar/list-view-sidebar.js +9 -3
  397. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  398. package/build-module/components/sidebar/index.js +6 -5
  399. package/build-module/components/sidebar/index.js.map +1 -1
  400. package/build-module/components/sidebar-edit-mode/default-sidebar.js +11 -12
  401. package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
  402. package/build-module/components/sidebar-edit-mode/index.js +14 -11
  403. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  404. package/build-module/components/sidebar-edit-mode/page-panels/content-blocks-list.js +67 -0
  405. package/build-module/components/sidebar-edit-mode/page-panels/content-blocks-list.js.map +1 -0
  406. package/build-module/components/sidebar-edit-mode/page-panels/index.js +67 -0
  407. package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -0
  408. package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js +4 -5
  409. package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
  410. package/build-module/components/sidebar-edit-mode/settings-header/index.js +36 -22
  411. package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
  412. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js +35 -0
  413. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -0
  414. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +3 -4
  415. package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -1
  416. package/build-module/components/sidebar-edit-mode/{template-card → template-panel}/index.js +20 -19
  417. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -0
  418. package/build-module/components/sidebar-edit-mode/{template-revisions/index.js → template-panel/last-revision.js} +7 -8
  419. package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js.map +1 -0
  420. package/build-module/components/sidebar-edit-mode/{template-card → template-panel}/template-actions.js +12 -16
  421. package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -0
  422. package/build-module/components/sidebar-edit-mode/{template-card → template-panel}/template-areas.js +15 -19
  423. package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js.map +1 -0
  424. package/build-module/components/sidebar-navigation-item/index.js +7 -8
  425. package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
  426. package/build-module/components/sidebar-navigation-screen/index.js +22 -15
  427. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  428. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +104 -14
  429. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  430. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +3 -5
  431. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  432. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +7 -10
  433. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  434. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +17 -23
  435. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  436. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +20 -23
  437. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  438. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +4 -5
  439. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  440. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +8 -9
  441. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -1
  442. package/build-module/components/sidebar-navigation-screen-page/index.js +79 -14
  443. package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
  444. package/build-module/components/sidebar-navigation-screen-page/page-details.js +131 -0
  445. package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +1 -0
  446. package/build-module/components/sidebar-navigation-screen-page/status-label.js +97 -0
  447. package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -0
  448. package/build-module/components/sidebar-navigation-screen-pages/index.js +125 -19
  449. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  450. package/build-module/components/sidebar-navigation-screen-template/index.js +22 -17
  451. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  452. package/build-module/components/sidebar-navigation-screen-template-part/index.js +86 -0
  453. package/build-module/components/sidebar-navigation-screen-template-part/index.js.map +1 -0
  454. package/build-module/components/sidebar-navigation-screen-templates/index.js +13 -18
  455. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  456. package/build-module/components/sidebar-navigation-subtitle/index.js +3 -4
  457. package/build-module/components/sidebar-navigation-subtitle/index.js.map +1 -1
  458. package/build-module/components/site-hub/index.js +21 -14
  459. package/build-module/components/site-hub/index.js.map +1 -1
  460. package/build-module/components/site-icon/index.js +4 -5
  461. package/build-module/components/site-icon/index.js.map +1 -1
  462. package/build-module/components/start-template-options/index.js +15 -21
  463. package/build-module/components/start-template-options/index.js.map +1 -1
  464. package/build-module/components/style-book/index.js +35 -39
  465. package/build-module/components/style-book/index.js.map +1 -1
  466. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +2 -2
  467. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  468. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +9 -10
  469. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  470. package/build-module/components/{list/actions → template-actions}/index.js +34 -31
  471. package/build-module/components/template-actions/index.js.map +1 -0
  472. package/build-module/components/{list/actions → template-actions}/rename-menu-item.js +4 -5
  473. package/build-module/components/template-actions/rename-menu-item.js.map +1 -0
  474. package/build-module/components/template-part-converter/convert-to-regular.js +4 -5
  475. package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
  476. package/build-module/components/template-part-converter/convert-to-template-part.js +8 -10
  477. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  478. package/build-module/components/template-part-converter/index.js +12 -18
  479. package/build-module/components/template-part-converter/index.js.map +1 -1
  480. package/build-module/components/welcome-guide/image.js +4 -5
  481. package/build-module/components/welcome-guide/image.js.map +1 -1
  482. package/build-module/hooks/commands/use-edit-mode-commands.js +6 -8
  483. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  484. package/build-module/hooks/push-changes-to-global-styles/index.js +11 -8
  485. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  486. package/build-module/hooks/template-part-edit.js +5 -6
  487. package/build-module/hooks/template-part-edit.js.map +1 -1
  488. package/build-module/index.js +3 -6
  489. package/build-module/index.js.map +1 -1
  490. package/build-module/store/actions.js +125 -126
  491. package/build-module/store/actions.js.map +1 -1
  492. package/build-module/store/private-actions.js +7 -10
  493. package/build-module/store/private-actions.js.map +1 -1
  494. package/build-module/store/reducer.js +30 -33
  495. package/build-module/store/reducer.js.map +1 -1
  496. package/build-module/store/selectors.js +31 -11
  497. package/build-module/store/selectors.js.map +1 -1
  498. package/build-module/store/utils.js +1 -3
  499. package/build-module/store/utils.js.map +1 -1
  500. package/build-module/utils/get-is-list-page.js +3 -4
  501. package/build-module/utils/get-is-list-page.js.map +1 -1
  502. package/build-module/utils/is-previewing-theme.js +1 -3
  503. package/build-module/utils/is-previewing-theme.js.map +1 -1
  504. package/build-module/utils/is-template-revertable.js +1 -1
  505. package/build-module/utils/is-template-revertable.js.map +1 -1
  506. package/build-style/style-rtl.css +281 -59
  507. package/build-style/style.css +281 -59
  508. package/package.json +39 -36
  509. package/src/components/add-new-page/index.js +105 -0
  510. package/src/components/add-new-template/new-template.js +2 -1
  511. package/src/components/block-editor/index.js +25 -14
  512. package/src/components/editor/index.js +14 -8
  513. package/src/components/editor/style.scss +6 -11
  514. package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +7 -5
  515. package/src/components/global-styles/ui.js +28 -0
  516. package/src/components/header-edit-mode/document-actions/index.js +126 -32
  517. package/src/components/header-edit-mode/document-actions/style.scss +64 -9
  518. package/src/components/header-edit-mode/tools-more-menu-group/index.js +1 -6
  519. package/src/components/layout/index.js +3 -9
  520. package/src/components/list/table.js +6 -2
  521. package/src/components/page-actions/delete-page-menu-item.js +71 -0
  522. package/src/components/page-actions/index.js +36 -0
  523. package/src/components/page-content-lock/constants.js +5 -0
  524. package/src/components/page-content-lock/index.js +14 -0
  525. package/src/components/page-content-lock/use-disable-non-content-blocks.js +44 -0
  526. package/src/components/page-content-lock/use-page-content-lock-notifications.js +128 -0
  527. package/src/components/resizable-frame/index.js +15 -5
  528. package/src/components/resizable-frame/style.scss +20 -18
  529. package/src/components/revisions/index.js +6 -7
  530. package/src/components/save-button/index.js +6 -0
  531. package/src/components/save-hub/index.js +143 -38
  532. package/src/components/save-hub/style.scss +6 -0
  533. package/src/components/save-panel/index.js +62 -15
  534. package/src/components/secondary-sidebar/list-view-sidebar.js +8 -1
  535. package/src/components/sidebar/index.js +6 -4
  536. package/src/components/sidebar/style.scss +3 -4
  537. package/src/components/sidebar-edit-mode/index.js +16 -14
  538. package/src/components/sidebar-edit-mode/page-panels/content-blocks-list.js +77 -0
  539. package/src/components/sidebar-edit-mode/page-panels/index.js +89 -0
  540. package/src/components/sidebar-edit-mode/page-panels/style.scss +10 -0
  541. package/src/components/sidebar-edit-mode/settings-header/index.js +51 -28
  542. package/src/components/sidebar-edit-mode/sidebar-card/index.js +34 -0
  543. package/src/components/sidebar-edit-mode/sidebar-card/style.scss +34 -0
  544. package/src/components/sidebar-edit-mode/{template-card → template-panel}/index.js +22 -19
  545. package/src/components/sidebar-edit-mode/{template-card → template-panel}/style.scss +2 -32
  546. package/src/components/sidebar-navigation-screen/index.js +74 -50
  547. package/src/components/sidebar-navigation-screen/style.scss +45 -4
  548. package/src/components/sidebar-navigation-screen-global-styles/index.js +118 -12
  549. package/src/components/sidebar-navigation-screen-global-styles/style.scss +15 -0
  550. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +1 -1
  551. package/src/components/sidebar-navigation-screen-page/index.js +137 -24
  552. package/src/components/sidebar-navigation-screen-page/page-details.js +163 -0
  553. package/src/components/sidebar-navigation-screen-page/status-label.js +101 -0
  554. package/src/components/sidebar-navigation-screen-page/style.scss +80 -0
  555. package/src/components/sidebar-navigation-screen-pages/index.js +180 -44
  556. package/src/components/sidebar-navigation-screen-template/index.js +25 -22
  557. package/src/components/sidebar-navigation-screen-template-part/index.js +103 -0
  558. package/src/components/sidebar-navigation-screen-templates/index.js +1 -1
  559. package/src/components/sidebar-navigation-subtitle/style.scss +2 -2
  560. package/src/components/site-hub/index.js +21 -6
  561. package/src/components/site-hub/style.scss +26 -0
  562. package/src/components/{list/actions → template-actions}/index.js +19 -6
  563. package/src/hooks/push-changes-to-global-styles/index.js +13 -7
  564. package/src/store/actions.js +20 -1
  565. package/src/store/reducer.js +20 -0
  566. package/src/store/selectors.js +24 -0
  567. package/src/store/test/actions.js +31 -0
  568. package/src/store/test/reducer.js +44 -0
  569. package/src/store/test/selectors.js +57 -0
  570. package/src/style.scss +5 -2
  571. package/src/utils/is-previewing-theme.js +1 -4
  572. package/build/components/list/actions/index.js.map +0 -1
  573. package/build/components/list/actions/rename-menu-item.js.map +0 -1
  574. package/build/components/sidebar-edit-mode/template-card/index.js.map +0 -1
  575. package/build/components/sidebar-edit-mode/template-card/template-actions.js.map +0 -1
  576. package/build/components/sidebar-edit-mode/template-card/template-areas.js.map +0 -1
  577. package/build/components/sidebar-edit-mode/template-revisions/index.js.map +0 -1
  578. package/build-module/components/list/actions/index.js.map +0 -1
  579. package/build-module/components/list/actions/rename-menu-item.js.map +0 -1
  580. package/build-module/components/sidebar-edit-mode/template-card/index.js.map +0 -1
  581. package/build-module/components/sidebar-edit-mode/template-card/template-actions.js.map +0 -1
  582. package/build-module/components/sidebar-edit-mode/template-card/template-areas.js.map +0 -1
  583. package/src/components/sidebar-navigation-screen-pages/style.scss +0 -4
  584. /package/src/components/sidebar-edit-mode/{template-revisions/index.js → template-panel/last-revision.js} +0 -0
  585. /package/src/components/sidebar-edit-mode/{template-card → template-panel}/template-actions.js +0 -0
  586. /package/src/components/sidebar-edit-mode/{template-card → template-panel}/template-areas.js +0 -0
  587. /package/src/components/{list/actions → template-actions}/rename-menu-item.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/hooks/template-part-edit.js"],"names":["useLocation","routerPrivateApis","EditTemplatePartMenuItem","attributes","theme","slug","params","templatePart","select","coreStore","getEntityRecord","linkProps","postId","id","postType","type","canvas","fromTemplateId","event","onClick","withEditBlockControls","BlockEdit","props","name","isDisplayed"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAUA;AACA;AACA;AAIA,MAAM;AAAEA,EAAAA;AAAF,IAAkB,yBAAQC,mBAAR,CAAxB;;AAEA,SAASC,wBAAT,OAAoD;AAAA,MAAjB;AAAEC,IAAAA;AAAF,GAAiB;AACnD,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAkBF,UAAxB;AACA,QAAM;AAAEG,IAAAA;AAAF,MAAaN,WAAW,EAA9B;AACA,QAAMO,YAAY,GAAG,qBAClBC,MAAF,IAAc;AACb,WAAOA,MAAM,CAAEC,eAAF,CAAN,CAAoBC,eAApB,CACN,UADM,EAEN,kBAFM,EAGN;AACC,OAAGN,KAAO,KAAKC,IAAM,EAJhB,CAAP;AAMA,GARmB,EASpB,CAAED,KAAF,EAASC,IAAT,CAToB,CAArB;AAYA,QAAMM,SAAS,GAAG,mBACjB;AACCC,IAAAA,MAAM,EAAEL,YAAF,aAAEA,YAAF,uBAAEA,YAAY,CAAEM,EADvB;AAECC,IAAAA,QAAQ,EAAEP,YAAF,aAAEA,YAAF,uBAAEA,YAAY,CAAEQ,IAFzB;AAGCC,IAAAA,MAAM,EAAE;AAHT,GADiB,EAMjB;AACCC,IAAAA,cAAc,EAAEX,MAAM,CAACM;AADxB,GANiB,CAAlB;;AAWA,MAAK,CAAEL,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,0BAAD;AAAe,IAAA,KAAK,EAAC;AAArB,KACC,4BAAC,yBAAD,6BACMI,SADN;AAEC,IAAA,OAAO,EAAKO,KAAF,IAAa;AACtBP,MAAAA,SAAS,CAACQ,OAAV,CAAmBD,KAAnB;AACA;AAJF,MAMG,cAAI,MAAJ,CANH,CADD,CADD;AAYA;;AAEM,MAAME,qBAAqB,GAAG,yCAClCC,SAAF,IAAmBC,KAAF,IAAa;AAC7B,QAAM;AAAEnB,IAAAA,UAAF;AAAcoB,IAAAA;AAAd,MAAuBD,KAA7B;AACA,QAAME,WAAW,GAAGD,IAAI,KAAK,oBAAT,IAAiCpB,UAAU,CAACE,IAAhE;AAEA,SACC,qDACC,4BAAC,SAAD,EAAgBiB,KAAhB,CADD,EAEGE,WAAW,IACZ,4BAAC,wBAAD;AAA0B,IAAA,UAAU,EAAGrB;AAAvC,IAHF,CADD;AAQA,CAbmC,EAcpC,uBAdoC,CAA9B;;AAiBP,sBACC,kBADD,EAEC,0CAFD,EAGCiB,qBAHD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { BlockControls } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ToolbarButton } from '@wordpress/components';\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { useLink } from '../components/routes/link';\nimport { unlock } from '../private-apis';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction EditTemplatePartMenuItem( { attributes } ) {\n\tconst { theme, slug } = attributes;\n\tconst { params } = useLocation();\n\tconst templatePart = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\t// Ideally this should be an official public API.\n\t\t\t\t`${ theme }//${ slug }`\n\t\t\t);\n\t\t},\n\t\t[ theme, slug ]\n\t);\n\n\tconst linkProps = useLink(\n\t\t{\n\t\t\tpostId: templatePart?.id,\n\t\t\tpostType: templatePart?.type,\n\t\t\tcanvas: 'edit',\n\t\t},\n\t\t{\n\t\t\tfromTemplateId: params.postId,\n\t\t}\n\t);\n\n\tif ( ! templatePart ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockControls group=\"other\">\n\t\t\t<ToolbarButton\n\t\t\t\t{ ...linkProps }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\tlinkProps.onClick( event );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Edit' ) }\n\t\t\t</ToolbarButton>\n\t\t</BlockControls>\n\t);\n}\n\nexport const withEditBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { attributes, name } = props;\n\t\tconst isDisplayed = name === 'core/template-part' && attributes.slug;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ isDisplayed && (\n\t\t\t\t\t<EditTemplatePartMenuItem attributes={ attributes } />\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withEditBlockControls'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/template-part-edit-button',\n\twithEditBlockControls\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/hooks/template-part-edit.js"],"names":["useLocation","routerPrivateApis","EditTemplatePartMenuItem","attributes","theme","slug","params","templatePart","select","coreStore","getEntityRecord","linkProps","postId","id","postType","type","canvas","fromTemplateId","event","onClick","withEditBlockControls","BlockEdit","props","name","isDisplayed"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAUA;AACA;AACA;AAIA,MAAM;AAAEA,EAAAA;AAAF,IAAkB,yBAAQC,mBAAR,CAAxB;;AAEA,SAASC,wBAAT,CAAmC;AAAEC,EAAAA;AAAF,CAAnC,EAAoD;AACnD,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAkBF,UAAxB;AACA,QAAM;AAAEG,IAAAA;AAAF,MAAaN,WAAW,EAA9B;AACA,QAAMO,YAAY,GAAG,qBAClBC,MAAF,IAAc;AACb,WAAOA,MAAM,CAAEC,eAAF,CAAN,CAAoBC,eAApB,CACN,UADM,EAEN,kBAFM,EAGN;AACC,OAAGN,KAAO,KAAKC,IAAM,EAJhB,CAAP;AAMA,GARmB,EASpB,CAAED,KAAF,EAASC,IAAT,CAToB,CAArB;AAYA,QAAMM,SAAS,GAAG,mBACjB;AACCC,IAAAA,MAAM,EAAEL,YAAY,EAAEM,EADvB;AAECC,IAAAA,QAAQ,EAAEP,YAAY,EAAEQ,IAFzB;AAGCC,IAAAA,MAAM,EAAE;AAHT,GADiB,EAMjB;AACCC,IAAAA,cAAc,EAAEX,MAAM,CAACM;AADxB,GANiB,CAAlB;;AAWA,MAAK,CAAEL,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,0BAAD;AAAe,IAAA,KAAK,EAAC;AAArB,KACC,4BAAC,yBAAD,6BACMI,SADN;AAEC,IAAA,OAAO,EAAKO,KAAF,IAAa;AACtBP,MAAAA,SAAS,CAACQ,OAAV,CAAmBD,KAAnB;AACA;AAJF,MAMG,cAAI,MAAJ,CANH,CADD,CADD;AAYA;;AAEM,MAAME,qBAAqB,GAAG,yCAClCC,SAAF,IAAmBC,KAAF,IAAa;AAC7B,QAAM;AAAEnB,IAAAA,UAAF;AAAcoB,IAAAA;AAAd,MAAuBD,KAA7B;AACA,QAAME,WAAW,GAAGD,IAAI,KAAK,oBAAT,IAAiCpB,UAAU,CAACE,IAAhE;AAEA,SACC,qDACC,4BAAC,SAAD,EAAgBiB,KAAhB,CADD,EAEGE,WAAW,IACZ,4BAAC,wBAAD;AAA0B,IAAA,UAAU,EAAGrB;AAAvC,IAHF,CADD;AAQA,CAbmC,EAcpC,uBAdoC,CAA9B;;AAiBP,sBACC,kBADD,EAEC,0CAFD,EAGCiB,qBAHD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { BlockControls } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ToolbarButton } from '@wordpress/components';\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { useLink } from '../components/routes/link';\nimport { unlock } from '../private-apis';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction EditTemplatePartMenuItem( { attributes } ) {\n\tconst { theme, slug } = attributes;\n\tconst { params } = useLocation();\n\tconst templatePart = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\t// Ideally this should be an official public API.\n\t\t\t\t`${ theme }//${ slug }`\n\t\t\t);\n\t\t},\n\t\t[ theme, slug ]\n\t);\n\n\tconst linkProps = useLink(\n\t\t{\n\t\t\tpostId: templatePart?.id,\n\t\t\tpostType: templatePart?.type,\n\t\t\tcanvas: 'edit',\n\t\t},\n\t\t{\n\t\t\tfromTemplateId: params.postId,\n\t\t}\n\t);\n\n\tif ( ! templatePart ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockControls group=\"other\">\n\t\t\t<ToolbarButton\n\t\t\t\t{ ...linkProps }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\tlinkProps.onClick( event );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Edit' ) }\n\t\t\t</ToolbarButton>\n\t\t</BlockControls>\n\t);\n}\n\nexport const withEditBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { attributes, name } = props;\n\t\tconst isDisplayed = name === 'core/template-part' && attributes.slug;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ isDisplayed && (\n\t\t\t\t\t<EditTemplatePartMenuItem attributes={ attributes } />\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withEditBlockControls'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/template-part-edit-button',\n\twithEditBlockControls\n);\n"]}
package/build/index.js CHANGED
@@ -90,12 +90,9 @@ function initializeEditor(id, settings) {
90
90
 
91
91
  (0, _data.dispatch)(_blocks.store).__experimentalReapplyBlockTypeFilters();
92
92
 
93
- const coreBlocks = (0, _blockLibrary.__experimentalGetCoreBlocks)().filter(_ref => {
94
- let {
95
- name
96
- } = _ref;
97
- return name !== 'core/freeform';
98
- });
93
+ const coreBlocks = (0, _blockLibrary.__experimentalGetCoreBlocks)().filter(({
94
+ name
95
+ }) => name !== 'core/freeform');
99
96
  (0, _blockLibrary.registerCoreBlocks)(coreBlocks);
100
97
  (0, _data.dispatch)(_blocks.store).setFreeformFallbackBlockName('core/html');
101
98
  (0, _widgets.registerLegacyWidgetBlock)({
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["initializeEditor","id","settings","target","document","getElementById","root","__experimentalFetchLinkSuggestions","search","searchOptions","__experimentalFetchRichUrlData","fetchUrlData","blocksStore","__experimentalReapplyBlockTypeFilters","coreBlocks","filter","name","setFreeformFallbackBlockName","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","preferencesStore","setDefaults","editorMode","fixedToolbar","focusMode","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","showListViewByDefault","showBlockBreadcrumbs","interfaceStore","setDefaultComplementaryArea","editSiteStore","updateSettings","editorStore","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","render","reinitializeEditor","since","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA;;AARA;;AACA;;AAKA;;AACA;;AAEA;;AAIA;;AACA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AA2EA;;AACA;;AACA;;AACA;;AA3GA;AACA;AACA;;AAsBA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAT,CAA2BC,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EAEC,oBAFD;AAKA,sBAAUC,YAAV,EAA0BC,cAA1B,CAA0ClC,QAA1C,EAxCgD,CA0ChD;AACA;AACA;AACA;;AACA,sBAAUmC,aAAV,EAAwBC,oBAAxB,CAA8C;AAC7CC,IAAAA,oBAAoB,EAAErC,QAAQ,CAACqC,oBADc;AAE7CC,IAAAA,wBAAwB,EAAEtC,QAAQ,CAACsC;AAFU,GAA9C,EA9CgD,CAmDhD;;AACAC,EAAAA,MAAM,CAACC,gBAAP,CAAyB,UAAzB,EAAuCC,CAAF,IAASA,CAAC,CAACC,cAAF,EAA9C,EAAkE,KAAlE;AACAH,EAAAA,MAAM,CAACC,gBAAP,CAAyB,MAAzB,EAAmCC,CAAF,IAASA,CAAC,CAACC,cAAF,EAA1C,EAA8D,KAA9D;AAEAtC,EAAAA,IAAI,CAACuC,MAAL,CAAa,4BAAC,YAAD,OAAb;AAEA,SAAOvC,IAAP;AACA;;AAEM,SAASwC,kBAAT,GAA8B;AACpC,2BAAY,gCAAZ,EAA8C;AAC7CC,IAAAA,KAAK,EAAE,KADsC;AAE7CC,IAAAA,OAAO,EAAE;AAFoC,GAA9C;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport App from './components/app';\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tkeepCaretInsideBlock: false,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\tshowListViewByDefault: false,\n\t\tshowBlockBreadcrumbs: true,\n\t} );\n\n\tdispatch( interfaceStore ).setDefaultComplementaryArea(\n\t\t'core/edit-site',\n\t\t'edit-site/template'\n\t);\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t// so that they can be selected with core/editor selectors in any editor.\n\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t// which internally uses updateEditorSettings as well.\n\tdispatch( editorStore ).updateEditorSettings( {\n\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t} );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render( <App /> );\n\n\treturn root;\n}\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editSite.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginSidebar } from './components/sidebar-edit-mode/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header-edit-mode/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header-edit-mode/plugin-more-menu-item';\nexport { default as PluginTemplateSettingPanel } from './components/plugin-template-setting-panel';\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["initializeEditor","id","settings","target","document","getElementById","root","__experimentalFetchLinkSuggestions","search","searchOptions","__experimentalFetchRichUrlData","fetchUrlData","blocksStore","__experimentalReapplyBlockTypeFilters","coreBlocks","filter","name","setFreeformFallbackBlockName","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","preferencesStore","setDefaults","editorMode","fixedToolbar","focusMode","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","showListViewByDefault","showBlockBreadcrumbs","interfaceStore","setDefaultComplementaryArea","editSiteStore","updateSettings","editorStore","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","render","reinitializeEditor","since","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA;;AARA;;AACA;;AAKA;;AACA;;AAEA;;AAIA;;AACA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AA2EA;;AACA;;AACA;;AACA;;AA3GA;AACA;AACA;;AAsBA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAT,CA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BAAUC,YAAV,EAA0BC,cAA1B,CAA0ClC,QAA1C,EAxCgD,CA0ChD;AACA;AACA;AACA;;AACA,sBAAUmC,aAAV,EAAwBC,oBAAxB,CAA8C;AAC7CC,IAAAA,oBAAoB,EAAErC,QAAQ,CAACqC,oBADc;AAE7CC,IAAAA,wBAAwB,EAAEtC,QAAQ,CAACsC;AAFU,GAA9C,EA9CgD,CAmDhD;;AACAC,EAAAA,MAAM,CAACC,gBAAP,CAAyB,UAAzB,EAAuCC,CAAF,IAASA,CAAC,CAACC,cAAF,EAA9C,EAAkE,KAAlE;AACAH,EAAAA,MAAM,CAACC,gBAAP,CAAyB,MAAzB,EAAmCC,CAAF,IAASA,CAAC,CAACC,cAAF,EAA1C,EAA8D,KAA9D;AAEAtC,EAAAA,IAAI,CAACuC,MAAL,CAAa,4BAAC,YAAD,OAAb;AAEA,SAAOvC,IAAP;AACA;;AAEM,SAASwC,kBAAT,GAA8B;AACpC,2BAAY,gCAAZ,EAA8C;AAC7CC,IAAAA,KAAK,EAAE,KADsC;AAE7CC,IAAAA,OAAO,EAAE;AAFoC,GAA9C;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport App from './components/app';\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tkeepCaretInsideBlock: false,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\tshowListViewByDefault: false,\n\t\tshowBlockBreadcrumbs: true,\n\t} );\n\n\tdispatch( interfaceStore ).setDefaultComplementaryArea(\n\t\t'core/edit-site',\n\t\t'edit-site/template'\n\t);\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t// so that they can be selected with core/editor selectors in any editor.\n\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t// which internally uses updateEditorSettings as well.\n\tdispatch( editorStore ).updateEditorSettings( {\n\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t} );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render( <App /> );\n\n\treturn root;\n}\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editSite.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginSidebar } from './components/sidebar-edit-mode/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header-edit-mode/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header-edit-mode/plugin-more-menu-item';\nexport { default as PluginTemplateSettingPanel } from './components/plugin-template-setting-panel';\n"]}
@@ -10,6 +10,7 @@ exports.openGeneralSidebar = exports.closeGeneralSidebar = exports.addTemplate =
10
10
  exports.openNavigationPanelToMenu = openNavigationPanelToMenu;
11
11
  exports.revertTemplate = exports.removeTemplate = void 0;
12
12
  exports.setEditedPostContext = setEditedPostContext;
13
+ exports.setHasPageContentLock = void 0;
13
14
  exports.setHomeTemplateId = setHomeTemplateId;
14
15
  exports.setIsInserterOpened = setIsInserterOpened;
15
16
  exports.setIsListViewOpened = setIsListViewOpened;
@@ -44,6 +45,8 @@ var _a11y = require("@wordpress/a11y");
44
45
 
45
46
  var _preferences = require("@wordpress/preferences");
46
47
 
48
+ var _htmlEntities = require("@wordpress/html-entities");
49
+
47
50
  var _constants = require("./constants");
48
51
 
49
52
  var _isTemplateRevertable = _interopRequireDefault(require("../utils/is-template-revertable"));
@@ -62,10 +65,9 @@ var _isTemplateRevertable = _interopRequireDefault(require("../utils/is-template
62
65
  * @param {string} featureName Feature name.
63
66
  */
64
67
  function toggleFeature(featureName) {
65
- return function (_ref) {
66
- let {
67
- registry
68
- } = _ref;
68
+ return function ({
69
+ registry
70
+ }) {
69
71
  (0, _deprecated.default)("select( 'core/edit-site' ).toggleFeature( featureName )", {
70
72
  since: '6.0',
71
73
  alternative: "select( 'core/preferences').toggle( 'core/edit-site', featureName )"
@@ -97,16 +99,14 @@ function __experimentalSetPreviewDeviceType(deviceType) {
97
99
  */
98
100
 
99
101
 
100
- const setTemplate = (templateId, templateSlug) => async _ref2 => {
101
- let {
102
- dispatch,
103
- registry
104
- } = _ref2;
105
-
102
+ const setTemplate = (templateId, templateSlug) => async ({
103
+ dispatch,
104
+ registry
105
+ }) => {
106
106
  if (!templateSlug) {
107
107
  try {
108
108
  const template = await registry.resolveSelect(_coreData.store).getEntityRecord('postType', 'wp_template', templateId);
109
- templateSlug = template === null || template === void 0 ? void 0 : template.slug;
109
+ templateSlug = template?.slug;
110
110
  } catch (error) {}
111
111
  }
112
112
 
@@ -130,11 +130,10 @@ const setTemplate = (templateId, templateSlug) => async _ref2 => {
130
130
 
131
131
  exports.setTemplate = setTemplate;
132
132
 
133
- const addTemplate = template => async _ref3 => {
134
- let {
135
- dispatch,
136
- registry
137
- } = _ref3;
133
+ const addTemplate = template => async ({
134
+ dispatch,
135
+ registry
136
+ }) => {
138
137
  const newTemplate = await registry.dispatch(_coreData.store).saveEntityRecord('postType', 'wp_template', template);
139
138
 
140
139
  if (template.content) {
@@ -163,11 +162,9 @@ const addTemplate = template => async _ref3 => {
163
162
 
164
163
  exports.addTemplate = addTemplate;
165
164
 
166
- const removeTemplate = template => async _ref4 => {
167
- let {
168
- registry
169
- } = _ref4;
170
-
165
+ const removeTemplate = template => async ({
166
+ registry
167
+ }) => {
171
168
  try {
172
169
  await registry.dispatch(_coreData.store).deleteEntityRecord('postType', template.type, template.id, {
173
170
  force: true
@@ -180,7 +177,7 @@ const removeTemplate = template => async _ref4 => {
180
177
 
181
178
  registry.dispatch(_notices.store).createSuccessNotice((0, _i18n.sprintf)(
182
179
  /* translators: The template/part's name. */
183
- (0, _i18n.__)('"%s" deleted.'), template.title.rendered), {
180
+ (0, _i18n.__)('"%s" deleted.'), (0, _htmlEntities.decodeEntities)(template.title.rendered)), {
184
181
  type: 'snackbar',
185
182
  id: 'site-editor-template-deleted-success'
186
183
  });
@@ -252,18 +249,14 @@ function setEditedPostContext(context) {
252
249
  */
253
250
 
254
251
 
255
- const setPage = page => async _ref5 => {
256
- var _page$context;
257
-
258
- let {
259
- dispatch,
260
- registry
261
- } = _ref5;
262
-
263
- if (!page.path && (_page$context = page.context) !== null && _page$context !== void 0 && _page$context.postId) {
252
+ const setPage = page => async ({
253
+ dispatch,
254
+ registry
255
+ }) => {
256
+ if (!page.path && page.context?.postId) {
264
257
  const entity = await registry.resolveSelect(_coreData.store).getEntityRecord('postType', page.context.postType || 'post', page.context.postId); // If the entity is undefined for some reason, path will resolve to "/"
265
258
 
266
- page.path = (0, _url.getPathAndQueryString)(entity === null || entity === void 0 ? void 0 : entity.link);
259
+ page.path = (0, _url.getPathAndQueryString)(entity?.link);
267
260
  }
268
261
 
269
262
  const template = await registry.resolveSelect(_coreData.store).__experimentalGetTemplateForLink(page.path);
@@ -407,104 +400,95 @@ function setIsSaveViewOpened(isOpen) {
407
400
  */
408
401
 
409
402
 
410
- const revertTemplate = function (template) {
411
- let {
412
- allowUndo = true
413
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
414
- return async _ref6 => {
415
- let {
416
- registry
417
- } = _ref6;
418
- const noticeId = 'edit-site-template-reverted';
419
- registry.dispatch(_notices.store).removeNotice(noticeId);
403
+ const revertTemplate = (template, {
404
+ allowUndo = true
405
+ } = {}) => async ({
406
+ registry
407
+ }) => {
408
+ const noticeId = 'edit-site-template-reverted';
409
+ registry.dispatch(_notices.store).removeNotice(noticeId);
410
+
411
+ if (!(0, _isTemplateRevertable.default)(template)) {
412
+ registry.dispatch(_notices.store).createErrorNotice((0, _i18n.__)('This template is not revertable.'), {
413
+ type: 'snackbar'
414
+ });
415
+ return;
416
+ }
420
417
 
421
- if (!(0, _isTemplateRevertable.default)(template)) {
422
- registry.dispatch(_notices.store).createErrorNotice((0, _i18n.__)('This template is not revertable.'), {
418
+ try {
419
+ const templateEntityConfig = registry.select(_coreData.store).getEntityConfig('postType', template.type);
420
+
421
+ if (!templateEntityConfig) {
422
+ registry.dispatch(_notices.store).createErrorNotice((0, _i18n.__)('The editor has encountered an unexpected error. Please reload.'), {
423
423
  type: 'snackbar'
424
424
  });
425
425
  return;
426
426
  }
427
427
 
428
- try {
429
- var _fileTemplate$content;
430
-
431
- const templateEntityConfig = registry.select(_coreData.store).getEntityConfig('postType', template.type);
432
-
433
- if (!templateEntityConfig) {
434
- registry.dispatch(_notices.store).createErrorNotice((0, _i18n.__)('The editor has encountered an unexpected error. Please reload.'), {
435
- type: 'snackbar'
436
- });
437
- return;
438
- }
428
+ const fileTemplatePath = (0, _url.addQueryArgs)(`${templateEntityConfig.baseURL}/${template.id}`, {
429
+ context: 'edit',
430
+ source: 'theme'
431
+ });
432
+ const fileTemplate = await (0, _apiFetch.default)({
433
+ path: fileTemplatePath
434
+ });
439
435
 
440
- const fileTemplatePath = (0, _url.addQueryArgs)(`${templateEntityConfig.baseURL}/${template.id}`, {
441
- context: 'edit',
442
- source: 'theme'
443
- });
444
- const fileTemplate = await (0, _apiFetch.default)({
445
- path: fileTemplatePath
436
+ if (!fileTemplate) {
437
+ registry.dispatch(_notices.store).createErrorNotice((0, _i18n.__)('The editor has encountered an unexpected error. Please reload.'), {
438
+ type: 'snackbar'
446
439
  });
440
+ return;
441
+ }
447
442
 
448
- if (!fileTemplate) {
449
- registry.dispatch(_notices.store).createErrorNotice((0, _i18n.__)('The editor has encountered an unexpected error. Please reload.'), {
450
- type: 'snackbar'
451
- });
452
- return;
453
- }
454
-
455
- const serializeBlocks = _ref7 => {
456
- let {
457
- blocks: blocksForSerialization = []
458
- } = _ref7;
459
- return (0, _blocks.__unstableSerializeAndClean)(blocksForSerialization);
460
- };
443
+ const serializeBlocks = ({
444
+ blocks: blocksForSerialization = []
445
+ }) => (0, _blocks.__unstableSerializeAndClean)(blocksForSerialization);
461
446
 
462
- const edited = registry.select(_coreData.store).getEditedEntityRecord('postType', template.type, template.id); // We are fixing up the undo level here to make sure we can undo
463
- // the revert in the header toolbar correctly.
447
+ const edited = registry.select(_coreData.store).getEditedEntityRecord('postType', template.type, template.id); // We are fixing up the undo level here to make sure we can undo
448
+ // the revert in the header toolbar correctly.
464
449
 
465
- registry.dispatch(_coreData.store).editEntityRecord('postType', template.type, template.id, {
466
- content: serializeBlocks,
467
- // Required to make the `undo` behave correctly.
468
- blocks: edited.blocks,
469
- // Required to revert the blocks in the editor.
470
- source: 'custom' // required to avoid turning the editor into a dirty state
450
+ registry.dispatch(_coreData.store).editEntityRecord('postType', template.type, template.id, {
451
+ content: serializeBlocks,
452
+ // Required to make the `undo` behave correctly.
453
+ blocks: edited.blocks,
454
+ // Required to revert the blocks in the editor.
455
+ source: 'custom' // required to avoid turning the editor into a dirty state
471
456
 
472
- }, {
473
- undoIgnore: true // Required to merge this edit with the last undo level.
457
+ }, {
458
+ undoIgnore: true // Required to merge this edit with the last undo level.
474
459
 
475
- });
476
- const blocks = (0, _blocks.parse)(fileTemplate === null || fileTemplate === void 0 ? void 0 : (_fileTemplate$content = fileTemplate.content) === null || _fileTemplate$content === void 0 ? void 0 : _fileTemplate$content.raw);
477
- registry.dispatch(_coreData.store).editEntityRecord('postType', template.type, fileTemplate.id, {
478
- content: serializeBlocks,
479
- blocks,
480
- source: 'theme'
481
- });
460
+ });
461
+ const blocks = (0, _blocks.parse)(fileTemplate?.content?.raw);
462
+ registry.dispatch(_coreData.store).editEntityRecord('postType', template.type, fileTemplate.id, {
463
+ content: serializeBlocks,
464
+ blocks,
465
+ source: 'theme'
466
+ });
482
467
 
483
- if (allowUndo) {
484
- const undoRevert = () => {
485
- registry.dispatch(_coreData.store).editEntityRecord('postType', template.type, edited.id, {
486
- content: serializeBlocks,
487
- blocks: edited.blocks,
488
- source: 'custom'
489
- });
490
- };
491
-
492
- registry.dispatch(_notices.store).createSuccessNotice((0, _i18n.__)('Template reverted.'), {
493
- type: 'snackbar',
494
- id: noticeId,
495
- actions: [{
496
- label: (0, _i18n.__)('Undo'),
497
- onClick: undoRevert
498
- }]
468
+ if (allowUndo) {
469
+ const undoRevert = () => {
470
+ registry.dispatch(_coreData.store).editEntityRecord('postType', template.type, edited.id, {
471
+ content: serializeBlocks,
472
+ blocks: edited.blocks,
473
+ source: 'custom'
499
474
  });
500
- }
501
- } catch (error) {
502
- const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0, _i18n.__)('Template revert failed. Please reload.');
503
- registry.dispatch(_notices.store).createErrorNotice(errorMessage, {
504
- type: 'snackbar'
475
+ };
476
+
477
+ registry.dispatch(_notices.store).createSuccessNotice((0, _i18n.__)('Template reverted.'), {
478
+ type: 'snackbar',
479
+ id: noticeId,
480
+ actions: [{
481
+ label: (0, _i18n.__)('Undo'),
482
+ onClick: undoRevert
483
+ }]
505
484
  });
506
485
  }
507
- };
486
+ } catch (error) {
487
+ const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0, _i18n.__)('Template revert failed. Please reload.');
488
+ registry.dispatch(_notices.store).createErrorNotice(errorMessage, {
489
+ type: 'snackbar'
490
+ });
491
+ }
508
492
  };
509
493
  /**
510
494
  * Action that opens an editor sidebar.
@@ -515,10 +499,9 @@ const revertTemplate = function (template) {
515
499
 
516
500
  exports.revertTemplate = revertTemplate;
517
501
 
518
- const openGeneralSidebar = name => _ref8 => {
519
- let {
520
- registry
521
- } = _ref8;
502
+ const openGeneralSidebar = name => ({
503
+ registry
504
+ }) => {
522
505
  registry.dispatch(_interface.store).enableComplementaryArea(_constants.STORE_NAME, name);
523
506
  };
524
507
  /**
@@ -528,19 +511,17 @@ const openGeneralSidebar = name => _ref8 => {
528
511
 
529
512
  exports.openGeneralSidebar = openGeneralSidebar;
530
513
 
531
- const closeGeneralSidebar = () => _ref9 => {
532
- let {
533
- registry
534
- } = _ref9;
514
+ const closeGeneralSidebar = () => ({
515
+ registry
516
+ }) => {
535
517
  registry.dispatch(_interface.store).disableComplementaryArea(_constants.STORE_NAME);
536
518
  };
537
519
 
538
520
  exports.closeGeneralSidebar = closeGeneralSidebar;
539
521
 
540
- const switchEditorMode = mode => _ref10 => {
541
- let {
542
- registry
543
- } = _ref10;
522
+ const switchEditorMode = mode => ({
523
+ registry
524
+ }) => {
544
525
  registry.dispatch('core/preferences').set('core/edit-site', 'editorMode', mode); // Unselect blocks when we switch to a non visual mode.
545
526
 
546
527
  if (mode !== 'visual') {
@@ -553,6 +534,29 @@ const switchEditorMode = mode => _ref10 => {
553
534
  (0, _a11y.speak)((0, _i18n.__)('Code editor selected'), 'assertive');
554
535
  }
555
536
  };
537
+ /**
538
+ * Sets whether or not the editor is locked so that only page content can be
539
+ * edited.
540
+ *
541
+ * @param {boolean} hasPageContentLock True to enable lock, false to disable.
542
+ */
543
+
556
544
 
557
545
  exports.switchEditorMode = switchEditorMode;
546
+
547
+ const setHasPageContentLock = hasPageContentLock => ({
548
+ dispatch,
549
+ registry
550
+ }) => {
551
+ if (hasPageContentLock) {
552
+ registry.dispatch(_blockEditor.store).clearSelectedBlock();
553
+ }
554
+
555
+ dispatch({
556
+ type: 'SET_HAS_PAGE_CONTENT_LOCK',
557
+ hasPageContentLock
558
+ });
559
+ };
560
+
561
+ exports.setHasPageContentLock = setHasPageContentLock;
558
562
  //# sourceMappingURL=actions.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/actions.js"],"names":["toggleFeature","featureName","registry","since","alternative","dispatch","preferencesStore","toggle","__experimentalSetPreviewDeviceType","deviceType","type","setTemplate","templateId","templateSlug","template","resolveSelect","coreStore","getEntityRecord","slug","error","postType","id","context","addTemplate","newTemplate","saveEntityRecord","content","editEntityRecord","blocks","undoIgnore","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","noticesStore","createSuccessNotice","title","rendered","errorMessage","message","code","createErrorNotice","setTemplatePart","templatePartId","setHomeTemplateId","version","setEditedPostContext","setPage","page","path","postId","entity","link","__experimentalGetTemplateForLink","setNavigationPanelActiveMenu","openNavigationPanelToMenu","setIsNavigationPanelOpened","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","isOpen","setIsSaveViewOpened","revertTemplate","allowUndo","noticeId","removeNotice","templateEntityConfig","getEntityConfig","fileTemplatePath","baseURL","source","fileTemplate","serializeBlocks","blocksForSerialization","edited","getEditedEntityRecord","raw","undoRevert","actions","label","onClick","openGeneralSidebar","name","interfaceStore","enableComplementaryArea","editSiteStoreName","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","set","blockEditorStore","clearSelectedBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAnBA;AACA;AACA;;AAaA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAT,CAAwBC,WAAxB,EAAsC;AAC5C,SAAO,gBAA0B;AAAA,QAAf;AAAEC,MAAAA;AAAF,KAAe;AAChC,6BAAY,yDAAZ,EAAuE;AACtEC,MAAAA,KAAK,EAAE,KAD+D;AAEtEC,MAAAA,WAAW,EACV;AAHqE,KAAvE;AAMAF,IAAAA,QAAQ,CACNG,QADF,CACYC,kBADZ,EAEEC,MAFF,CAEU,gBAFV,EAE4BN,WAF5B;AAGA,GAVD;AAWA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASO,kCAAT,CAA6CC,UAA7C,EAA0D;AAChE,SAAO;AACNC,IAAAA,IAAI,EAAE,yBADA;AAEND,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAME,WAAW,GACvB,CAAEC,UAAF,EAAcC,YAAd,KACA,eAAoC;AAAA,MAA5B;AAAER,IAAAA,QAAF;AAAYH,IAAAA;AAAZ,GAA4B;;AACnC,MAAK,CAAEW,YAAP,EAAsB;AACrB,QAAI;AACH,YAAMC,QAAQ,GAAG,MAAMZ,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AAA;AAAF,GAAkB;AACnBA,EAAAA,QAAQ,CACNG,QADF,CACYkF,gBADZ,EAEEC,uBAFF,CAE2BC,qBAF3B,EAE8CH,IAF9C;AAGA,CANK;AAQP;AACA;AACA;;;;;AACO,MAAMI,mBAAmB,GAC/B,MACA,SAAoB;AAAA,MAAlB;AAAExF,IAAAA;AAAF,GAAkB;AACnBA,EAAAA,QAAQ,CACNG,QADF,CACYkF,gBADZ,EAEEI,wBAFF,CAE4BF,qBAF5B;AAGA,CANK;;;;AAQA,MAAMG,gBAAgB,GAC1BC,IAAF,IACA,UAAoB;AAAA,MAAlB;AAAE3F,IAAAA;AAAF,GAAkB;AACnBA,EAAAA,QAAQ,CACNG,QADF,CACY,kBADZ,EAEEyF,GAFF,CAEO,gBAFP,EAEyB,YAFzB,EAEuCD,IAFvC,EADmB,CAKnB;;AACA,MAAKA,IAAI,KAAK,QAAd,EAAyB;AACxB3F,IAAAA,QAAQ,CAACG,QAAT,CAAmB0F,kBAAnB,EAAsCC,kBAAtC;AACA;;AAED,MAAKH,IAAI,KAAK,QAAd,EAAyB;AACxB,qBAAO,cAAI,wBAAJ,CAAP,EAAuC,WAAvC;AACA,GAFD,MAEO,IAAKA,IAAI,KAAK,MAAd,EAAuB;AAC7B,qBAAO,cAAI,sBAAJ,CAAP,EAAqC,WAArC;AACA;AACD,CAjBK","sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { addQueryArgs, getPathAndQueryString } from '@wordpress/url';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { speak } from '@wordpress/a11y';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\n\n/**\n * Dispatches an action that toggles a feature flag.\n *\n * @param {string} featureName Feature name.\n */\nexport function toggleFeature( featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( \"select( 'core/edit-site' ).toggleFeature( featureName )\", {\n\t\t\tsince: '6.0',\n\t\t\talternative:\n\t\t\t\t\"select( 'core/preferences').toggle( 'core/edit-site', featureName )\",\n\t\t} );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-site', featureName );\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Action that sets a template, optionally fetching it from REST API.\n *\n * @param {number} templateId The template ID.\n * @param {string} templateSlug The template slug.\n * @return {Object} Action object.\n */\nexport const setTemplate =\n\t( templateId, templateSlug ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! templateSlug ) {\n\t\t\ttry {\n\t\t\t\tconst template = await registry\n\t\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t\t.getEntityRecord( 'postType', 'wp_template', templateId );\n\t\t\t\ttemplateSlug = template?.slug;\n\t\t\t} catch ( error ) {}\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: templateId,\n\t\t\tcontext: { templateSlug },\n\t\t} );\n\t};\n\n/**\n * Action that adds a new template and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @return {Object} Action object used to set the current template.\n */\nexport const addTemplate =\n\t( template ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tconst newTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\n\t\tif ( template.content ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template',\n\t\t\t\t\tnewTemplate.id,\n\t\t\t\t\t{ blocks: parse( template.content ) },\n\t\t\t\t\t{ undoIgnore: true }\n\t\t\t\t);\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: newTemplate.id,\n\t\t\tcontext: { templateSlug: newTemplate.slug },\n\t\t} );\n\t};\n\n/**\n * Action that removes a template.\n *\n * @param {Object} template The template object.\n */\nexport const removeTemplate =\n\t( template ) =>\n\tasync ( { registry } ) => {\n\t\ttry {\n\t\t\tawait registry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.deleteEntityRecord( 'postType', template.type, template.id, {\n\t\t\t\t\tforce: true,\n\t\t\t\t} );\n\n\t\t\tconst lastError = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getLastEntityDeleteError(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\tif ( lastError ) {\n\t\t\t\tthrow lastError;\n\t\t\t}\n\n\t\t\tregistry.dispatch( noticesStore ).createSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\t\ttemplate.title.rendered\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', id: 'site-editor-template-deleted-success' }\n\t\t\t);\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: __( 'An error occurred while deleting the template.' );\n\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n\n/**\n * Action that sets a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: 'wp_template_part',\n\t\tid: templatePartId,\n\t};\n}\n\n/**\n * @deprecated\n */\nexport function setHomeTemplateId() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Set's the current block editor context.\n *\n * @param {Object} context The context object.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport function setEditedPostContext( context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST_CONTEXT',\n\t\tcontext,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @param {Object} page The page object.\n * @param {string} page.type The page type.\n * @param {string} page.slug The page slug.\n * @param {string} page.path The page path.\n * @param {Object} page.context The page context.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport const setPage =\n\t( page ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! page.path && page.context?.postId ) {\n\t\t\tconst entity = await registry\n\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t.getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpage.context.postType || 'post',\n\t\t\t\t\tpage.context.postId\n\t\t\t\t);\n\t\t\t// If the entity is undefined for some reason, path will resolve to \"/\"\n\t\t\tpage.path = getPathAndQueryString( entity?.link );\n\t\t}\n\n\t\tconst template = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.__experimentalGetTemplateForLink( page.path );\n\n\t\tif ( ! template ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: template.id,\n\t\t\tcontext: {\n\t\t\t\t...page.context,\n\t\t\t\ttemplateSlug: template.slug,\n\t\t\t},\n\t\t} );\n\n\t\treturn template.id;\n\t};\n\n/**\n * Action that sets the active navigation panel menu.\n *\n * @deprecated\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @deprecated\n */\nexport function openNavigationPanelToMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).openNavigationPanelToMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @deprecated\n */\nexport function setIsNavigationPanelOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setIsNavigationPanelOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens or closes the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the list view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the list view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Sets whether the save view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the save view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsSaveViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_SAVE_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport const revertTemplate =\n\t( template, { allowUndo = true } = {} ) =>\n\tasync ( { registry } ) => {\n\t\tconst noticeId = 'edit-site-template-reverted';\n\t\tregistry.dispatch( noticesStore ).removeNotice( noticeId );\n\t\tif ( ! isTemplateRevertable( template ) ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( __( 'This template is not revertable.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst templateEntityConfig = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEntityConfig( 'postType', template.type );\n\n\t\t\tif ( ! templateEntityConfig ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t\t`${ templateEntityConfig.baseURL }/${ template.id }`,\n\t\t\t\t{ context: 'edit', source: 'theme' }\n\t\t\t);\n\n\t\t\tconst fileTemplate = await apiFetch( { path: fileTemplatePath } );\n\t\t\tif ( ! fileTemplate ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst serializeBlocks = ( {\n\t\t\t\tblocks: blocksForSerialization = [],\n\t\t\t} ) => __unstableSerializeAndClean( blocksForSerialization );\n\n\t\t\tconst edited = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t\t// the revert in the header toolbar correctly.\n\t\t\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: serializeBlocks, // Required to make the `undo` behave correctly.\n\t\t\t\t\tblocks: edited.blocks, // Required to revert the blocks in the editor.\n\t\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tundoIgnore: true, // Required to merge this edit with the last undo level.\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord( 'postType', template.type, fileTemplate.id, {\n\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\tblocks,\n\t\t\t\t\tsource: 'theme',\n\t\t\t\t} );\n\n\t\t\tif ( allowUndo ) {\n\t\t\t\tconst undoRevert = () => {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\t\tedited.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t};\n\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: noticeId,\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\t\tonClick: undoRevert,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t} );\n\t\t\t}\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: __( 'Template revert failed. Please reload.' );\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n/**\n * Action that opens an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( editSiteStoreName, name );\n\t};\n\n/**\n * Action that closes the sidebar.\n */\nexport const closeGeneralSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.disableComplementaryArea( editSiteStoreName );\n\t};\n\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( 'core/preferences' )\n\t\t\t.set( 'core/edit-site', 'editorMode', mode );\n\n\t\t// Unselect blocks when we switch to a non visual mode.\n\t\tif ( mode !== 'visual' ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\n\t\tif ( mode === 'visual' ) {\n\t\t\tspeak( __( 'Visual editor selected' ), 'assertive' );\n\t\t} else if ( mode === 'text' ) {\n\t\t\tspeak( __( 'Code editor selected' ), 'assertive' );\n\t\t}\n\t};\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/actions.js"],"names":["toggleFeature","featureName","registry","since","alternative","dispatch","preferencesStore","toggle","__experimentalSetPreviewDeviceType","deviceType","type","setTemplate","templateId","templateSlug","template","resolveSelect","coreStore","getEntityRecord","slug","error","postType","id","context","addTemplate","newTemplate","saveEntityRecord","content","editEntityRecord","blocks","undoIgnore","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","noticesStore","createSuccessNotice","title","rendered","errorMessage","message","code","createErrorNotice","setTemplatePart","templatePartId","setHomeTemplateId","version","setEditedPostContext","setPage","page","path","postId","entity","link","__experimentalGetTemplateForLink","setNavigationPanelActiveMenu","openNavigationPanelToMenu","setIsNavigationPanelOpened","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","isOpen","setIsSaveViewOpened","revertTemplate","allowUndo","noticeId","removeNotice","templateEntityConfig","getEntityConfig","fileTemplatePath","baseURL","source","fileTemplate","serializeBlocks","blocksForSerialization","edited","getEditedEntityRecord","raw","undoRevert","actions","label","onClick","openGeneralSidebar","name","interfaceStore","enableComplementaryArea","editSiteStoreName","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","set","blockEditorStore","clearSelectedBlock","setHasPageContentLock","hasPageContentLock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AApBA;AACA;AACA;;AAcA;AACA;AACA;;AAIA;AACA;AACA;AAC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Ad,EAAuB;AAC7B,qBAAO,cAAI,sBAAJ,CAAP,EAAqC,WAArC;AACA;AACD,CAjBK;AAmBP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMI,qBAAqB,GAC/BC,kBAAF,IACA,CAAE;AAAE7F,EAAAA,QAAF;AAAYH,EAAAA;AAAZ,CAAF,KAA8B;AAC7B,MAAKgG,kBAAL,EAA0B;AACzBhG,IAAAA,QAAQ,CAACG,QAAT,CAAmB0F,kBAAnB,EAAsCC,kBAAtC;AACA;;AACD3F,EAAAA,QAAQ,CAAE;AACTK,IAAAA,IAAI,EAAE,2BADG;AAETwF,IAAAA;AAFS,GAAF,CAAR;AAIA,CAVK","sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { addQueryArgs, getPathAndQueryString } from '@wordpress/url';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { speak } from '@wordpress/a11y';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\n\n/**\n * Dispatches an action that toggles a feature flag.\n *\n * @param {string} featureName Feature name.\n */\nexport function toggleFeature( featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( \"select( 'core/edit-site' ).toggleFeature( featureName )\", {\n\t\t\tsince: '6.0',\n\t\t\talternative:\n\t\t\t\t\"select( 'core/preferences').toggle( 'core/edit-site', featureName )\",\n\t\t} );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-site', featureName );\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Action that sets a template, optionally fetching it from REST API.\n *\n * @param {number} templateId The template ID.\n * @param {string} templateSlug The template slug.\n * @return {Object} Action object.\n */\nexport const setTemplate =\n\t( templateId, templateSlug ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! templateSlug ) {\n\t\t\ttry {\n\t\t\t\tconst template = await registry\n\t\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t\t.getEntityRecord( 'postType', 'wp_template', templateId );\n\t\t\t\ttemplateSlug = template?.slug;\n\t\t\t} catch ( error ) {}\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: templateId,\n\t\t\tcontext: { templateSlug },\n\t\t} );\n\t};\n\n/**\n * Action that adds a new template and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @return {Object} Action object used to set the current template.\n */\nexport const addTemplate =\n\t( template ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tconst newTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\n\t\tif ( template.content ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template',\n\t\t\t\t\tnewTemplate.id,\n\t\t\t\t\t{ blocks: parse( template.content ) },\n\t\t\t\t\t{ undoIgnore: true }\n\t\t\t\t);\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: newTemplate.id,\n\t\t\tcontext: { templateSlug: newTemplate.slug },\n\t\t} );\n\t};\n\n/**\n * Action that removes a template.\n *\n * @param {Object} template The template object.\n */\nexport const removeTemplate =\n\t( template ) =>\n\tasync ( { registry } ) => {\n\t\ttry {\n\t\t\tawait registry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.deleteEntityRecord( 'postType', template.type, template.id, {\n\t\t\t\t\tforce: true,\n\t\t\t\t} );\n\n\t\t\tconst lastError = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getLastEntityDeleteError(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\tif ( lastError ) {\n\t\t\t\tthrow lastError;\n\t\t\t}\n\n\t\t\tregistry.dispatch( noticesStore ).createSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\t\tdecodeEntities( template.title.rendered )\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', id: 'site-editor-template-deleted-success' }\n\t\t\t);\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: __( 'An error occurred while deleting the template.' );\n\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n\n/**\n * Action that sets a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: 'wp_template_part',\n\t\tid: templatePartId,\n\t};\n}\n\n/**\n * @deprecated\n */\nexport function setHomeTemplateId() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Set's the current block editor context.\n *\n * @param {Object} context The context object.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport function setEditedPostContext( context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST_CONTEXT',\n\t\tcontext,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @param {Object} page The page object.\n * @param {string} page.type The page type.\n * @param {string} page.slug The page slug.\n * @param {string} page.path The page path.\n * @param {Object} page.context The page context.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport const setPage =\n\t( page ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! page.path && page.context?.postId ) {\n\t\t\tconst entity = await registry\n\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t.getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpage.context.postType || 'post',\n\t\t\t\t\tpage.context.postId\n\t\t\t\t);\n\t\t\t// If the entity is undefined for some reason, path will resolve to \"/\"\n\t\t\tpage.path = getPathAndQueryString( entity?.link );\n\t\t}\n\n\t\tconst template = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.__experimentalGetTemplateForLink( page.path );\n\n\t\tif ( ! template ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: template.id,\n\t\t\tcontext: {\n\t\t\t\t...page.context,\n\t\t\t\ttemplateSlug: template.slug,\n\t\t\t},\n\t\t} );\n\n\t\treturn template.id;\n\t};\n\n/**\n * Action that sets the active navigation panel menu.\n *\n * @deprecated\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @deprecated\n */\nexport function openNavigationPanelToMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).openNavigationPanelToMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @deprecated\n */\nexport function setIsNavigationPanelOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setIsNavigationPanelOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens or closes the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the list view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the list view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Sets whether the save view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the save view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsSaveViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_SAVE_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport const revertTemplate =\n\t( template, { allowUndo = true } = {} ) =>\n\tasync ( { registry } ) => {\n\t\tconst noticeId = 'edit-site-template-reverted';\n\t\tregistry.dispatch( noticesStore ).removeNotice( noticeId );\n\t\tif ( ! isTemplateRevertable( template ) ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( __( 'This template is not revertable.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst templateEntityConfig = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEntityConfig( 'postType', template.type );\n\n\t\t\tif ( ! templateEntityConfig ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t\t`${ templateEntityConfig.baseURL }/${ template.id }`,\n\t\t\t\t{ context: 'edit', source: 'theme' }\n\t\t\t);\n\n\t\t\tconst fileTemplate = await apiFetch( { path: fileTemplatePath } );\n\t\t\tif ( ! fileTemplate ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst serializeBlocks = ( {\n\t\t\t\tblocks: blocksForSerialization = [],\n\t\t\t} ) => __unstableSerializeAndClean( blocksForSerialization );\n\n\t\t\tconst edited = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t\t// the revert in the header toolbar correctly.\n\t\t\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: serializeBlocks, // Required to make the `undo` behave correctly.\n\t\t\t\t\tblocks: edited.blocks, // Required to revert the blocks in the editor.\n\t\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tundoIgnore: true, // Required to merge this edit with the last undo level.\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord( 'postType', template.type, fileTemplate.id, {\n\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\tblocks,\n\t\t\t\t\tsource: 'theme',\n\t\t\t\t} );\n\n\t\t\tif ( allowUndo ) {\n\t\t\t\tconst undoRevert = () => {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\t\tedited.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t};\n\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: noticeId,\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\t\tonClick: undoRevert,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t} );\n\t\t\t}\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: __( 'Template revert failed. Please reload.' );\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n/**\n * Action that opens an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( editSiteStoreName, name );\n\t};\n\n/**\n * Action that closes the sidebar.\n */\nexport const closeGeneralSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.disableComplementaryArea( editSiteStoreName );\n\t};\n\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( 'core/preferences' )\n\t\t\t.set( 'core/edit-site', 'editorMode', mode );\n\n\t\t// Unselect blocks when we switch to a non visual mode.\n\t\tif ( mode !== 'visual' ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\n\t\tif ( mode === 'visual' ) {\n\t\t\tspeak( __( 'Visual editor selected' ), 'assertive' );\n\t\t} else if ( mode === 'text' ) {\n\t\t\tspeak( __( 'Code editor selected' ), 'assertive' );\n\t\t}\n\t};\n\n/**\n * Sets whether or not the editor is locked so that only page content can be\n * edited.\n *\n * @param {boolean} hasPageContentLock True to enable lock, false to disable.\n */\nexport const setHasPageContentLock =\n\t( hasPageContentLock ) =>\n\t( { dispatch, registry } ) => {\n\t\tif ( hasPageContentLock ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'SET_HAS_PAGE_CONTENT_LOCK',\n\t\t\thasPageContentLock,\n\t\t} );\n\t};\n"]}
@@ -18,12 +18,10 @@ var _preferences = require("@wordpress/preferences");
18
18
  *
19
19
  * @param {?string} mode Canvas mode.
20
20
  */
21
- const setCanvasMode = mode => _ref => {
22
- let {
23
- registry,
24
- dispatch
25
- } = _ref;
26
-
21
+ const setCanvasMode = mode => ({
22
+ registry,
23
+ dispatch
24
+ }) => {
27
25
  registry.dispatch(_blockEditor.store).__unstableSetEditorMode('edit');
28
26
 
29
27
  dispatch({
@@ -44,10 +42,9 @@ const setCanvasMode = mode => _ref => {
44
42
 
45
43
  exports.setCanvasMode = setCanvasMode;
46
44
 
47
- const setEditorCanvasContainerView = view => _ref2 => {
48
- let {
49
- dispatch
50
- } = _ref2;
45
+ const setEditorCanvasContainerView = view => ({
46
+ dispatch
47
+ }) => {
51
48
  dispatch({
52
49
  type: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',
53
50
  view
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/private-actions.js"],"names":["setCanvasMode","mode","registry","dispatch","blockEditorStore","__unstableSetEditorMode","type","select","preferencesStore","get","setIsListViewOpened","setEditorCanvasContainerView","view"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,MAAMA,aAAa,GACvBC,IAAF,IACA,QAA8B;AAAA,MAA5B;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAA4B;;AAC7BD,EAAAA,QAAQ,CAACC,QAAT,CAAmBC,kBAAnB,EAAsCC,uBAAtC,CAA+D,MAA/D;;AACAF,EAAAA,QAAQ,CAAE;AACTG,IAAAA,IAAI,EAAE,iBADG;AAETL,IAAAA;AAFS,GAAF,CAAR,CAF6B,CAM7B;;AACA,MACCA,IAAI,KAAK,MAAT,IACAC,QAAQ,CACNK,MADF,CACUC,kBADV,EAEEC,GAFF,CAEO,gBAFP,EAEyB,uBAFzB,CAFD,EAKE;AACDN,IAAAA,QAAQ,CAACO,mBAAT,CAA8B,IAA9B;AACA;AACD,CAjBK;AAmBP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMC,4BAA4B,GACtCC,IAAF,IACA,SAAoB;AAAA,MAAlB;AAAET,IAAAA;AAAF,GAAkB;AACnBA,EAAAA,QAAQ,CAAE;AACTG,IAAAA,IAAI,EAAE,kCADG;AAETM,IAAAA;AAFS,GAAF,CAAR;AAIA,CAPK","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch } ) => {\n\t\tregistry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );\n\t\tdispatch( {\n\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\tmode,\n\t\t} );\n\t\t// Check if the block list view should be open by default.\n\t\tif (\n\t\t\tmode === 'edit' &&\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'showListViewByDefault' )\n\t\t) {\n\t\t\tdispatch.setIsListViewOpened( true );\n\t\t}\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',\n\t\t\tview,\n\t\t} );\n\t};\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/private-actions.js"],"names":["setCanvasMode","mode","registry","dispatch","blockEditorStore","__unstableSetEditorMode","type","select","preferencesStore","get","setIsListViewOpened","setEditorCanvasContainerView","view"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,MAAMA,aAAa,GACvBC,IAAF,IACA,CAAE;AAAEC,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,CAAF,KAA8B;AAC7BD,EAAAA,QAAQ,CAACC,QAAT,CAAmBC,kBAAnB,EAAsCC,uBAAtC,CAA+D,MAA/D;;AACAF,EAAAA,QAAQ,CAAE;AACTG,IAAAA,IAAI,EAAE,iBADG;AAETL,IAAAA;AAFS,GAAF,CAAR,CAF6B,CAM7B;;AACA,MACCA,IAAI,KAAK,MAAT,IACAC,QAAQ,CACNK,MADF,CACUC,kBADV,EAEEC,GAFF,CAEO,gBAFP,EAEyB,uBAFzB,CAFD,EAKE;AACDN,IAAAA,QAAQ,CAACO,mBAAT,CAA8B,IAA9B;AACA;AACD,CAjBK;AAmBP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMC,4BAA4B,GACtCC,IAAF,IACA,CAAE;AAAET,EAAAA;AAAF,CAAF,KAAoB;AACnBA,EAAAA,QAAQ,CAAE;AACTG,IAAAA,IAAI,EAAE,kCADG;AAETM,IAAAA;AAFS,GAAF,CAAR;AAIA,CAPK","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch } ) => {\n\t\tregistry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );\n\t\tdispatch( {\n\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\tmode,\n\t\t} );\n\t\t// Check if the block list view should be open by default.\n\t\tif (\n\t\t\tmode === 'edit' &&\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'showListViewByDefault' )\n\t\t) {\n\t\t\tdispatch.setIsListViewOpened( true );\n\t\t}\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',\n\t\t\tview,\n\t\t} );\n\t};\n"]}