@wordpress/editor 14.10.0 → 14.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 (366) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +2 -10
  3. package/build/bindings/post-meta.js +2 -1
  4. package/build/bindings/post-meta.js.map +1 -1
  5. package/build/components/collab-sidebar/add-comment.js +119 -0
  6. package/build/components/collab-sidebar/add-comment.js.map +1 -0
  7. package/build/components/collab-sidebar/comment-button-toolbar.js +37 -0
  8. package/build/components/collab-sidebar/comment-button-toolbar.js.map +1 -0
  9. package/build/components/collab-sidebar/comment-button.js +37 -0
  10. package/build/components/collab-sidebar/comment-button.js.map +1 -0
  11. package/build/components/collab-sidebar/comments.js +321 -0
  12. package/build/components/collab-sidebar/comments.js.map +1 -0
  13. package/build/components/collab-sidebar/constants.js +8 -0
  14. package/build/components/collab-sidebar/constants.js.map +1 -0
  15. package/build/components/collab-sidebar/index.js +274 -0
  16. package/build/components/collab-sidebar/index.js.map +1 -0
  17. package/build/components/collab-sidebar/utils.js +16 -0
  18. package/build/components/collab-sidebar/utils.js.map +1 -0
  19. package/build/components/commands/index.js +148 -40
  20. package/build/components/commands/index.js.map +1 -1
  21. package/build/components/create-template-part-modal/index.js +1 -0
  22. package/build/components/create-template-part-modal/index.js.map +1 -1
  23. package/build/components/document-bar/index.js +17 -10
  24. package/build/components/document-bar/index.js.map +1 -1
  25. package/build/components/document-tools/index.js +7 -7
  26. package/build/components/document-tools/index.js.map +1 -1
  27. package/build/components/editor-interface/index.js +4 -4
  28. package/build/components/editor-interface/index.js.map +1 -1
  29. package/build/components/entities-saved-states/index.js +1 -1
  30. package/build/components/entities-saved-states/index.js.map +1 -1
  31. package/build/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
  32. package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  33. package/build/components/global-styles-provider/index.js +25 -3
  34. package/build/components/global-styles-provider/index.js.map +1 -1
  35. package/build/components/header/index.js +12 -11
  36. package/build/components/header/index.js.map +1 -1
  37. package/build/components/inserter-sidebar/index.js +2 -2
  38. package/build/components/inserter-sidebar/index.js.map +1 -1
  39. package/build/components/more-menu/index.js +9 -7
  40. package/build/components/more-menu/index.js.map +1 -1
  41. package/build/components/page-attributes/parent.js +5 -5
  42. package/build/components/page-attributes/parent.js.map +1 -1
  43. package/build/components/plugin-more-menu-item/index.js +13 -11
  44. package/build/components/plugin-more-menu-item/index.js.map +1 -1
  45. package/build/components/plugin-preview-menu-item/index.js +15 -13
  46. package/build/components/plugin-preview-menu-item/index.js.map +1 -1
  47. package/build/components/plugin-sidebar/index.js +0 -15
  48. package/build/components/plugin-sidebar/index.js.map +1 -1
  49. package/build/components/post-actions/index.js +5 -5
  50. package/build/components/post-actions/index.js.map +1 -1
  51. package/build/components/post-author/panel.js +4 -4
  52. package/build/components/post-author/panel.js.map +1 -1
  53. package/build/components/post-card-panel/index.js +7 -36
  54. package/build/components/post-card-panel/index.js.map +1 -1
  55. package/build/components/post-content-information/index.js +1 -2
  56. package/build/components/post-content-information/index.js.map +1 -1
  57. package/build/components/post-featured-image/index.js +26 -7
  58. package/build/components/post-featured-image/index.js.map +1 -1
  59. package/build/components/post-last-revision/index.js +1 -1
  60. package/build/components/post-last-revision/index.js.map +1 -1
  61. package/build/components/post-schedule/label.js +1 -1
  62. package/build/components/post-schedule/label.js.map +1 -1
  63. package/build/components/post-taxonomies/flat-term-selector.js +11 -1
  64. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  65. package/build/components/post-taxonomies/hierarchical-term-selector.js +2 -2
  66. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  67. package/build/components/post-template/swap-template-button.js +0 -3
  68. package/build/components/post-template/swap-template-button.js.map +1 -1
  69. package/build/components/post-transform-panel/index.js +0 -3
  70. package/build/components/post-transform-panel/index.js.map +1 -1
  71. package/build/components/post-url/index.js +1 -1
  72. package/build/components/post-url/index.js.map +1 -1
  73. package/build/components/post-url/panel.js +3 -3
  74. package/build/components/post-url/panel.js.map +1 -1
  75. package/build/components/preferences-modal/index.js +26 -22
  76. package/build/components/preferences-modal/index.js.map +1 -1
  77. package/build/components/preview-dropdown/index.js +23 -8
  78. package/build/components/preview-dropdown/index.js.map +1 -1
  79. package/build/components/provider/index.js +10 -12
  80. package/build/components/provider/index.js.map +1 -1
  81. package/build/components/provider/use-block-editor-settings.js +11 -10
  82. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  83. package/build/components/sidebar/header.js +2 -1
  84. package/build/components/sidebar/header.js.map +1 -1
  85. package/build/components/sidebar/index.js +3 -3
  86. package/build/components/sidebar/index.js.map +1 -1
  87. package/build/components/sidebar/post-summary.js +2 -2
  88. package/build/components/sidebar/post-summary.js.map +1 -1
  89. package/build/components/start-page-options/index.js +0 -3
  90. package/build/components/start-page-options/index.js.map +1 -1
  91. package/build/components/start-template-options/index.js +0 -3
  92. package/build/components/start-template-options/index.js.map +1 -1
  93. package/build/components/time-to-read/index.js +2 -2
  94. package/build/components/time-to-read/index.js.map +1 -1
  95. package/build/components/visual-editor/index.js +30 -29
  96. package/build/components/visual-editor/index.js.map +1 -1
  97. package/build/components/visual-editor/use-zoom-out-mode-exit.js +52 -0
  98. package/build/components/visual-editor/use-zoom-out-mode-exit.js.map +1 -0
  99. package/build/components/zoom-out-toggle/index.js +37 -5
  100. package/build/components/zoom-out-toggle/index.js.map +1 -1
  101. package/build/dataviews/actions/duplicate-template-part.js +2 -2
  102. package/build/dataviews/actions/duplicate-template-part.js.map +1 -1
  103. package/build/store/actions.js +68 -18
  104. package/build/store/actions.js.map +1 -1
  105. package/build/store/constants.js +0 -2
  106. package/build/store/constants.js.map +1 -1
  107. package/build/store/index.js +0 -4
  108. package/build/store/index.js.map +1 -1
  109. package/build/store/private-actions.js +2 -2
  110. package/build/store/private-actions.js.map +1 -1
  111. package/build/store/selectors.js +5 -4
  112. package/build/store/selectors.js.map +1 -1
  113. package/build/utils/pageTypeBadge.js +51 -0
  114. package/build/utils/pageTypeBadge.js.map +1 -0
  115. package/build/utils/terms.js +2 -2
  116. package/build/utils/terms.js.map +1 -1
  117. package/build-module/bindings/post-meta.js +2 -1
  118. package/build-module/bindings/post-meta.js.map +1 -1
  119. package/build-module/components/collab-sidebar/add-comment.js +113 -0
  120. package/build-module/components/collab-sidebar/add-comment.js.map +1 -0
  121. package/build-module/components/collab-sidebar/comment-button-toolbar.js +30 -0
  122. package/build-module/components/collab-sidebar/comment-button-toolbar.js.map +1 -0
  123. package/build-module/components/collab-sidebar/comment-button.js +30 -0
  124. package/build-module/components/collab-sidebar/comment-button.js.map +1 -0
  125. package/build-module/components/collab-sidebar/comments.js +314 -0
  126. package/build-module/components/collab-sidebar/comments.js.map +1 -0
  127. package/build-module/components/collab-sidebar/constants.js +2 -0
  128. package/build-module/components/collab-sidebar/constants.js.map +1 -0
  129. package/build-module/components/collab-sidebar/index.js +266 -0
  130. package/build-module/components/collab-sidebar/index.js.map +1 -0
  131. package/build-module/components/collab-sidebar/utils.js +10 -0
  132. package/build-module/components/collab-sidebar/utils.js.map +1 -0
  133. package/build-module/components/commands/index.js +151 -44
  134. package/build-module/components/commands/index.js.map +1 -1
  135. package/build-module/components/create-template-part-modal/index.js +1 -0
  136. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  137. package/build-module/components/document-bar/index.js +19 -12
  138. package/build-module/components/document-bar/index.js.map +1 -1
  139. package/build-module/components/document-tools/index.js +8 -8
  140. package/build-module/components/document-tools/index.js.map +1 -1
  141. package/build-module/components/editor-interface/index.js +4 -4
  142. package/build-module/components/editor-interface/index.js.map +1 -1
  143. package/build-module/components/entities-saved-states/index.js +1 -1
  144. package/build-module/components/entities-saved-states/index.js.map +1 -1
  145. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
  146. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  147. package/build-module/components/global-styles-provider/index.js +25 -3
  148. package/build-module/components/global-styles-provider/index.js.map +1 -1
  149. package/build-module/components/header/index.js +12 -11
  150. package/build-module/components/header/index.js.map +1 -1
  151. package/build-module/components/inserter-sidebar/index.js +2 -2
  152. package/build-module/components/inserter-sidebar/index.js.map +1 -1
  153. package/build-module/components/more-menu/index.js +9 -7
  154. package/build-module/components/more-menu/index.js.map +1 -1
  155. package/build-module/components/page-attributes/parent.js +5 -5
  156. package/build-module/components/page-attributes/parent.js.map +1 -1
  157. package/build-module/components/plugin-more-menu-item/index.js +12 -10
  158. package/build-module/components/plugin-more-menu-item/index.js.map +1 -1
  159. package/build-module/components/plugin-preview-menu-item/index.js +14 -12
  160. package/build-module/components/plugin-preview-menu-item/index.js.map +1 -1
  161. package/build-module/components/plugin-sidebar/index.js +0 -15
  162. package/build-module/components/plugin-sidebar/index.js.map +1 -1
  163. package/build-module/components/post-actions/index.js +5 -5
  164. package/build-module/components/post-actions/index.js.map +1 -1
  165. package/build-module/components/post-author/panel.js +4 -4
  166. package/build-module/components/post-author/panel.js.map +1 -1
  167. package/build-module/components/post-card-panel/index.js +8 -36
  168. package/build-module/components/post-card-panel/index.js.map +1 -1
  169. package/build-module/components/post-content-information/index.js +1 -2
  170. package/build-module/components/post-content-information/index.js.map +1 -1
  171. package/build-module/components/post-featured-image/index.js +26 -7
  172. package/build-module/components/post-featured-image/index.js.map +1 -1
  173. package/build-module/components/post-last-revision/index.js +1 -1
  174. package/build-module/components/post-last-revision/index.js.map +1 -1
  175. package/build-module/components/post-schedule/label.js +1 -1
  176. package/build-module/components/post-schedule/label.js.map +1 -1
  177. package/build-module/components/post-taxonomies/flat-term-selector.js +14 -4
  178. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  179. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +2 -2
  180. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  181. package/build-module/components/post-template/swap-template-button.js +0 -3
  182. package/build-module/components/post-template/swap-template-button.js.map +1 -1
  183. package/build-module/components/post-transform-panel/index.js +0 -3
  184. package/build-module/components/post-transform-panel/index.js.map +1 -1
  185. package/build-module/components/post-url/index.js +1 -1
  186. package/build-module/components/post-url/index.js.map +1 -1
  187. package/build-module/components/post-url/panel.js +3 -3
  188. package/build-module/components/post-url/panel.js.map +1 -1
  189. package/build-module/components/preferences-modal/index.js +26 -22
  190. package/build-module/components/preferences-modal/index.js.map +1 -1
  191. package/build-module/components/preview-dropdown/index.js +24 -9
  192. package/build-module/components/preview-dropdown/index.js.map +1 -1
  193. package/build-module/components/provider/index.js +10 -12
  194. package/build-module/components/provider/index.js.map +1 -1
  195. package/build-module/components/provider/use-block-editor-settings.js +12 -11
  196. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  197. package/build-module/components/sidebar/header.js +2 -1
  198. package/build-module/components/sidebar/header.js.map +1 -1
  199. package/build-module/components/sidebar/index.js +4 -4
  200. package/build-module/components/sidebar/index.js.map +1 -1
  201. package/build-module/components/sidebar/post-summary.js +2 -2
  202. package/build-module/components/sidebar/post-summary.js.map +1 -1
  203. package/build-module/components/start-page-options/index.js +0 -3
  204. package/build-module/components/start-page-options/index.js.map +1 -1
  205. package/build-module/components/start-template-options/index.js +0 -3
  206. package/build-module/components/start-template-options/index.js.map +1 -1
  207. package/build-module/components/time-to-read/index.js +2 -2
  208. package/build-module/components/time-to-read/index.js.map +1 -1
  209. package/build-module/components/visual-editor/index.js +31 -30
  210. package/build-module/components/visual-editor/index.js.map +1 -1
  211. package/build-module/components/visual-editor/use-zoom-out-mode-exit.js +46 -0
  212. package/build-module/components/visual-editor/use-zoom-out-mode-exit.js.map +1 -0
  213. package/build-module/components/zoom-out-toggle/index.js +37 -5
  214. package/build-module/components/zoom-out-toggle/index.js.map +1 -1
  215. package/build-module/dataviews/actions/duplicate-template-part.js +3 -3
  216. package/build-module/dataviews/actions/duplicate-template-part.js.map +1 -1
  217. package/build-module/store/actions.js +64 -16
  218. package/build-module/store/actions.js.map +1 -1
  219. package/build-module/store/constants.js +0 -2
  220. package/build-module/store/constants.js.map +1 -1
  221. package/build-module/store/index.js +0 -4
  222. package/build-module/store/index.js.map +1 -1
  223. package/build-module/store/private-actions.js +3 -3
  224. package/build-module/store/private-actions.js.map +1 -1
  225. package/build-module/store/selectors.js +5 -4
  226. package/build-module/store/selectors.js.map +1 -1
  227. package/build-module/utils/pageTypeBadge.js +45 -0
  228. package/build-module/utils/pageTypeBadge.js.map +1 -0
  229. package/build-module/utils/terms.js +2 -2
  230. package/build-module/utils/terms.js.map +1 -1
  231. package/build-style/style-rtl.css +118 -60
  232. package/build-style/style.css +118 -60
  233. package/build-types/bindings/post-meta.d.ts.map +1 -1
  234. package/build-types/components/collab-sidebar/add-comment.d.ts +15 -0
  235. package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -0
  236. package/build-types/components/collab-sidebar/comment-button-toolbar.d.ts +5 -0
  237. package/build-types/components/collab-sidebar/comment-button-toolbar.d.ts.map +1 -0
  238. package/build-types/components/collab-sidebar/comment-button.d.ts +5 -0
  239. package/build-types/components/collab-sidebar/comment-button.d.ts.map +1 -0
  240. package/build-types/components/collab-sidebar/comments.d.ts +19 -0
  241. package/build-types/components/collab-sidebar/comments.d.ts.map +1 -0
  242. package/build-types/components/collab-sidebar/constants.d.ts +2 -0
  243. package/build-types/components/collab-sidebar/constants.d.ts.map +1 -0
  244. package/build-types/components/collab-sidebar/index.d.ts +5 -0
  245. package/build-types/components/collab-sidebar/index.d.ts.map +1 -0
  246. package/build-types/components/collab-sidebar/utils.d.ts +8 -0
  247. package/build-types/components/collab-sidebar/utils.d.ts.map +1 -0
  248. package/build-types/components/commands/index.d.ts.map +1 -1
  249. package/build-types/components/create-template-part-modal/index.d.ts.map +1 -1
  250. package/build-types/components/document-bar/index.d.ts.map +1 -1
  251. package/build-types/components/document-tools/index.d.ts.map +1 -1
  252. package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
  253. package/build-types/components/header/index.d.ts +1 -2
  254. package/build-types/components/header/index.d.ts.map +1 -1
  255. package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
  256. package/build-types/components/more-menu/index.d.ts.map +1 -1
  257. package/build-types/components/page-attributes/parent.d.ts.map +1 -1
  258. package/build-types/components/plugin-more-menu-item/index.d.ts +62 -2
  259. package/build-types/components/plugin-more-menu-item/index.d.ts.map +1 -1
  260. package/build-types/components/plugin-preview-menu-item/index.d.ts +41 -2
  261. package/build-types/components/plugin-preview-menu-item/index.d.ts.map +1 -1
  262. package/build-types/components/plugin-sidebar/index.d.ts.map +1 -1
  263. package/build-types/components/post-author/panel.d.ts.map +1 -1
  264. package/build-types/components/post-card-panel/index.d.ts.map +1 -1
  265. package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
  266. package/build-types/components/post-template/hooks.d.ts +2 -2
  267. package/build-types/components/post-template/swap-template-button.d.ts.map +1 -1
  268. package/build-types/components/post-transform-panel/index.d.ts.map +1 -1
  269. package/build-types/components/preferences-modal/index.d.ts.map +1 -1
  270. package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
  271. package/build-types/components/provider/index.d.ts.map +1 -1
  272. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  273. package/build-types/components/sidebar/index.d.ts.map +1 -1
  274. package/build-types/components/start-page-options/index.d.ts.map +1 -1
  275. package/build-types/components/start-template-options/index.d.ts.map +1 -1
  276. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  277. package/build-types/components/visual-editor/use-zoom-out-mode-exit.d.ts +5 -0
  278. package/build-types/components/visual-editor/use-zoom-out-mode-exit.d.ts.map +1 -0
  279. package/build-types/components/zoom-out-toggle/index.d.ts +3 -1
  280. package/build-types/components/zoom-out-toggle/index.d.ts.map +1 -1
  281. package/build-types/dataviews/store/reducer.d.ts +5 -2
  282. package/build-types/dataviews/store/reducer.d.ts.map +1 -1
  283. package/build-types/lock-unlock.d.ts +2 -2
  284. package/build-types/store/actions.d.ts +9 -1
  285. package/build-types/store/actions.d.ts.map +1 -1
  286. package/build-types/store/constants.d.ts +0 -2
  287. package/build-types/store/constants.d.ts.map +1 -1
  288. package/build-types/store/index.d.ts +9 -11
  289. package/build-types/store/index.d.ts.map +1 -1
  290. package/build-types/store/reducer.d.ts +24 -4
  291. package/build-types/store/reducer.d.ts.map +1 -1
  292. package/build-types/store/selectors.d.ts +3 -3
  293. package/build-types/store/selectors.d.ts.map +1 -1
  294. package/build-types/utils/pageTypeBadge.d.ts +5 -0
  295. package/build-types/utils/pageTypeBadge.d.ts.map +1 -0
  296. package/build-types/utils/terms.d.ts.map +1 -1
  297. package/package.json +39 -37
  298. package/src/bindings/post-meta.js +1 -0
  299. package/src/components/collab-sidebar/add-comment.js +121 -0
  300. package/src/components/collab-sidebar/comment-button-toolbar.js +29 -0
  301. package/src/components/collab-sidebar/comment-button.js +31 -0
  302. package/src/components/collab-sidebar/comments.js +404 -0
  303. package/src/components/collab-sidebar/constants.js +1 -0
  304. package/src/components/collab-sidebar/index.js +298 -0
  305. package/src/components/collab-sidebar/style.scss +111 -0
  306. package/src/components/collab-sidebar/utils.js +9 -0
  307. package/src/components/commands/index.js +390 -268
  308. package/src/components/create-template-part-modal/index.js +1 -0
  309. package/src/components/document-bar/index.js +25 -8
  310. package/src/components/document-bar/style.scss +13 -4
  311. package/src/components/document-tools/index.js +8 -8
  312. package/src/components/editor-interface/index.js +4 -4
  313. package/src/components/entities-saved-states/index.js +2 -2
  314. package/src/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
  315. package/src/components/global-styles-provider/index.js +32 -6
  316. package/src/components/header/index.js +20 -10
  317. package/src/components/inserter-sidebar/index.js +3 -6
  318. package/src/components/more-menu/index.js +12 -7
  319. package/src/components/page-attributes/parent.js +6 -4
  320. package/src/components/plugin-more-menu-item/index.js +12 -11
  321. package/src/components/plugin-post-publish-panel/test/__snapshots__/index.js.snap +1 -1
  322. package/src/components/plugin-preview-menu-item/index.js +14 -13
  323. package/src/components/plugin-sidebar/index.js +0 -13
  324. package/src/components/post-actions/index.js +8 -11
  325. package/src/components/post-author/panel.js +4 -2
  326. package/src/components/post-card-panel/index.js +9 -43
  327. package/src/components/post-card-panel/style.scss +1 -9
  328. package/src/components/post-content-information/index.js +1 -1
  329. package/src/components/post-featured-image/index.js +31 -16
  330. package/src/components/post-featured-image/style.scss +5 -2
  331. package/src/components/post-last-revision/index.js +1 -1
  332. package/src/components/post-schedule/label.js +1 -1
  333. package/src/components/post-sticky/test/index.js +6 -6
  334. package/src/components/post-taxonomies/flat-term-selector.js +15 -4
  335. package/src/components/post-taxonomies/hierarchical-term-selector.js +2 -2
  336. package/src/components/post-template/swap-template-button.js +0 -3
  337. package/src/components/post-transform-panel/index.js +0 -3
  338. package/src/components/post-url/index.js +1 -1
  339. package/src/components/post-url/panel.js +4 -2
  340. package/src/components/preferences-modal/index.js +26 -19
  341. package/src/components/preferences-modal/test/index.js +1 -1
  342. package/src/components/preview-dropdown/index.js +45 -18
  343. package/src/components/provider/index.js +31 -24
  344. package/src/components/provider/use-block-editor-settings.js +11 -10
  345. package/src/components/sidebar/header.js +3 -2
  346. package/src/components/sidebar/index.js +5 -3
  347. package/src/components/sidebar/post-summary.js +1 -1
  348. package/src/components/sidebar/style.scss +1 -3
  349. package/src/components/start-page-options/index.js +0 -3
  350. package/src/components/start-template-options/index.js +0 -3
  351. package/src/components/time-to-read/index.js +3 -3
  352. package/src/components/visual-editor/index.js +39 -42
  353. package/src/components/visual-editor/style.scss +11 -0
  354. package/src/components/visual-editor/use-zoom-out-mode-exit.js +49 -0
  355. package/src/components/zoom-out-toggle/index.js +39 -5
  356. package/src/dataviews/actions/duplicate-template-part.tsx +3 -3
  357. package/src/store/actions.js +113 -34
  358. package/src/store/constants.ts +0 -2
  359. package/src/store/index.js +0 -4
  360. package/src/store/private-actions.js +3 -3
  361. package/src/store/selectors.js +5 -4
  362. package/src/style.scss +1 -0
  363. package/src/utils/pageTypeBadge.js +41 -0
  364. package/src/utils/terms.js +4 -2
  365. package/src/utils/test/terms.js +3 -3
  366. package/tsconfig.tsbuildinfo +1 -1
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
@@ -13,10 +14,13 @@ var _notices = require("@wordpress/notices");
13
14
  var _blockEditor = require("@wordpress/block-editor");
14
15
  var _coreData = require("@wordpress/core-data");
15
16
  var _interface = require("@wordpress/interface");
17
+ var _htmlEntities = require("@wordpress/html-entities");
18
+ var _lockUnlock = require("../../lock-unlock");
16
19
  var _store = require("../../store");
17
20
  var _constants = require("../../store/constants");
18
21
  var _patternRenameModal = require("../pattern-rename-modal");
19
22
  var _patternDuplicateModal = require("../pattern-duplicate-modal");
23
+ var _isTemplateRevertable = _interopRequireDefault(require("../../store/utils/is-template-revertable"));
20
24
  /**
21
25
  * WordPress dependencies
22
26
  */
@@ -25,13 +29,12 @@ var _patternDuplicateModal = require("../pattern-duplicate-modal");
25
29
  * Internal dependencies
26
30
  */
27
31
 
28
- function useEditorCommandLoader() {
32
+ const getEditorCommandLoader = () => function useEditorCommandLoader() {
29
33
  const {
30
34
  editorMode,
31
35
  isListViewOpen,
32
36
  showBlockBreadcrumbs,
33
37
  isDistractionFree,
34
- isTopToolbar,
35
38
  isFocusMode,
36
39
  isPreviewMode,
37
40
  isViewable,
@@ -60,8 +63,7 @@ function useEditorCommandLoader() {
60
63
  showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'),
61
64
  isDistractionFree: get('core', 'distractionFree'),
62
65
  isFocusMode: get('core', 'focusMode'),
63
- isTopToolbar: get('core', 'fixedToolbar'),
64
- isPreviewMode: getSettings().__unstableIsPreviewMode,
66
+ isPreviewMode: getSettings().isPreviewMode,
65
67
  isViewable: (_getPostType$viewable = getPostType(getCurrentPostType())?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false,
66
68
  isCodeEditingEnabled: getEditorSettings().codeEditingEnabled,
67
69
  isRichEditingEnabled: getEditorSettings().richEditingEnabled,
@@ -81,7 +83,9 @@ function useEditorCommandLoader() {
81
83
  __unstableSaveForPreview,
82
84
  setIsListViewOpened,
83
85
  switchEditorMode,
84
- toggleDistractionFree
86
+ toggleDistractionFree,
87
+ toggleSpotlightMode,
88
+ toggleTopToolbar
85
89
  } = (0, _data.useDispatch)(_store.store);
86
90
  const {
87
91
  openModal,
@@ -112,7 +116,7 @@ function useEditorCommandLoader() {
112
116
  });
113
117
  commands.push({
114
118
  name: 'core/toggle-distraction-free',
115
- label: isDistractionFree ? (0, _i18n.__)('Exit Distraction Free') : (0, _i18n.__)('Enter Distraction Free'),
119
+ label: isDistractionFree ? (0, _i18n.__)('Exit Distraction free') : (0, _i18n.__)('Enter Distraction free'),
116
120
  callback: ({
117
121
  close
118
122
  }) => {
@@ -132,22 +136,12 @@ function useEditorCommandLoader() {
132
136
  });
133
137
  commands.push({
134
138
  name: 'core/toggle-spotlight-mode',
135
- label: (0, _i18n.__)('Toggle spotlight'),
139
+ label: isFocusMode ? (0, _i18n.__)('Exit Spotlight mode') : (0, _i18n.__)('Enter Spotlight mode'),
136
140
  callback: ({
137
141
  close
138
142
  }) => {
139
- toggle('core', 'focusMode');
143
+ toggleSpotlightMode();
140
144
  close();
141
- createInfoNotice(isFocusMode ? (0, _i18n.__)('Spotlight off.') : (0, _i18n.__)('Spotlight on.'), {
142
- id: 'core/editor/toggle-spotlight-mode/notice',
143
- type: 'snackbar',
144
- actions: [{
145
- label: (0, _i18n.__)('Undo'),
146
- onClick: () => {
147
- toggle('core', 'focusMode');
148
- }
149
- }]
150
- });
151
145
  }
152
146
  });
153
147
  commands.push({
@@ -167,25 +161,12 @@ function useEditorCommandLoader() {
167
161
  });
168
162
  commands.push({
169
163
  name: 'core/toggle-top-toolbar',
170
- label: (0, _i18n.__)('Toggle top toolbar'),
164
+ label: (0, _i18n.__)('Top toolbar'),
171
165
  callback: ({
172
166
  close
173
167
  }) => {
174
- toggle('core', 'fixedToolbar');
175
- if (isDistractionFree) {
176
- toggleDistractionFree();
177
- }
168
+ toggleTopToolbar();
178
169
  close();
179
- createInfoNotice(isTopToolbar ? (0, _i18n.__)('Top toolbar off.') : (0, _i18n.__)('Top toolbar on.'), {
180
- id: 'core/editor/toggle-top-toolbar/notice',
181
- type: 'snackbar',
182
- actions: [{
183
- label: (0, _i18n.__)('Undo'),
184
- onClick: () => {
185
- toggle('core', 'fixedToolbar');
186
- }
187
- }]
188
- });
189
170
  }
190
171
  });
191
172
  if (allowSwitchEditorMode) {
@@ -217,7 +198,7 @@ function useEditorCommandLoader() {
217
198
  });
218
199
  commands.push({
219
200
  name: 'core/open-settings-sidebar',
220
- label: (0, _i18n.__)('Toggle settings sidebar'),
201
+ label: (0, _i18n.__)('Show or hide the Settings panel.'),
221
202
  icon: (0, _i18n.isRTL)() ? _icons.drawerLeft : _icons.drawerRight,
222
203
  callback: ({
223
204
  close
@@ -233,7 +214,7 @@ function useEditorCommandLoader() {
233
214
  });
234
215
  commands.push({
235
216
  name: 'core/open-block-inspector',
236
- label: (0, _i18n.__)('Toggle block inspector'),
217
+ label: (0, _i18n.__)('Show or hide the Block settings panel'),
237
218
  icon: _icons.blockDefault,
238
219
  callback: ({
239
220
  close
@@ -281,8 +262,8 @@ function useEditorCommandLoader() {
281
262
  commands,
282
263
  isLoading: false
283
264
  };
284
- }
285
- function useEditedEntityContextualCommands() {
265
+ };
266
+ const getEditedEntityContextualCommands = () => function useEditedEntityContextualCommands() {
286
267
  const {
287
268
  postType
288
269
  } = (0, _data.useSelect)(select => {
@@ -325,16 +306,143 @@ function useEditedEntityContextualCommands() {
325
306
  isLoading: false,
326
307
  commands
327
308
  };
328
- }
309
+ };
310
+ const getPageContentFocusCommands = () => function usePageContentFocusCommands() {
311
+ const {
312
+ onNavigateToEntityRecord,
313
+ goBack,
314
+ templateId,
315
+ isPreviewMode
316
+ } = (0, _data.useSelect)(select => {
317
+ const {
318
+ getRenderingMode,
319
+ getEditorSettings: _getEditorSettings,
320
+ getCurrentTemplateId
321
+ } = (0, _lockUnlock.unlock)(select(_store.store));
322
+ const editorSettings = _getEditorSettings();
323
+ return {
324
+ isTemplateHidden: getRenderingMode() === 'post-only',
325
+ onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord,
326
+ getEditorSettings: _getEditorSettings,
327
+ goBack: editorSettings.onNavigateToPreviousEntityRecord,
328
+ templateId: getCurrentTemplateId(),
329
+ isPreviewMode: editorSettings.isPreviewMode
330
+ };
331
+ }, []);
332
+ const {
333
+ editedRecord: template,
334
+ hasResolved
335
+ } = (0, _coreData.useEntityRecord)('postType', 'wp_template', templateId);
336
+ if (isPreviewMode) {
337
+ return {
338
+ isLoading: false,
339
+ commands: []
340
+ };
341
+ }
342
+ const commands = [];
343
+ if (templateId && hasResolved) {
344
+ commands.push({
345
+ name: 'core/switch-to-template-focus',
346
+ label: (0, _i18n.sprintf)(/* translators: %s: template title */
347
+ (0, _i18n.__)('Edit template: %s'), (0, _htmlEntities.decodeEntities)(template.title)),
348
+ icon: _icons.layout,
349
+ callback: ({
350
+ close
351
+ }) => {
352
+ onNavigateToEntityRecord({
353
+ postId: templateId,
354
+ postType: 'wp_template'
355
+ });
356
+ close();
357
+ }
358
+ });
359
+ }
360
+ if (!!goBack) {
361
+ commands.push({
362
+ name: 'core/switch-to-previous-entity',
363
+ label: (0, _i18n.__)('Go back'),
364
+ icon: _icons.page,
365
+ callback: ({
366
+ close
367
+ }) => {
368
+ goBack();
369
+ close();
370
+ }
371
+ });
372
+ }
373
+ return {
374
+ isLoading: false,
375
+ commands
376
+ };
377
+ };
378
+ const getManipulateDocumentCommands = () => function useManipulateDocumentCommands() {
379
+ const {
380
+ postType,
381
+ postId
382
+ } = (0, _data.useSelect)(select => {
383
+ const {
384
+ getCurrentPostId,
385
+ getCurrentPostType
386
+ } = select(_store.store);
387
+ return {
388
+ postType: getCurrentPostType(),
389
+ postId: getCurrentPostId()
390
+ };
391
+ }, []);
392
+ const {
393
+ editedRecord: template,
394
+ hasResolved
395
+ } = (0, _coreData.useEntityRecord)('postType', postType, postId);
396
+ // eslint-disable-next-line @wordpress/no-unused-vars-before-return
397
+ const {
398
+ revertTemplate
399
+ } = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
400
+ if (!hasResolved || ![_constants.TEMPLATE_PART_POST_TYPE, _constants.TEMPLATE_POST_TYPE].includes(postType)) {
401
+ return {
402
+ isLoading: true,
403
+ commands: []
404
+ };
405
+ }
406
+ const commands = [];
407
+ if ((0, _isTemplateRevertable.default)(template)) {
408
+ const label = template.type === _constants.TEMPLATE_POST_TYPE ? (0, _i18n.sprintf)(/* translators: %s: template title */
409
+ (0, _i18n.__)('Reset template: %s'), (0, _htmlEntities.decodeEntities)(template.title)) : (0, _i18n.sprintf)(/* translators: %s: template part title */
410
+ (0, _i18n.__)('Reset template part: %s'), (0, _htmlEntities.decodeEntities)(template.title));
411
+ commands.push({
412
+ name: 'core/reset-template',
413
+ label,
414
+ icon: (0, _i18n.isRTL)() ? _icons.rotateRight : _icons.rotateLeft,
415
+ callback: ({
416
+ close
417
+ }) => {
418
+ revertTemplate(template);
419
+ close();
420
+ }
421
+ });
422
+ }
423
+ return {
424
+ isLoading: !hasResolved,
425
+ commands
426
+ };
427
+ };
329
428
  function useCommands() {
330
429
  (0, _commands.useCommandLoader)({
331
430
  name: 'core/editor/edit-ui',
332
- hook: useEditorCommandLoader
431
+ hook: getEditorCommandLoader()
333
432
  });
334
433
  (0, _commands.useCommandLoader)({
335
434
  name: 'core/editor/contextual-commands',
336
- hook: useEditedEntityContextualCommands,
435
+ hook: getEditedEntityContextualCommands(),
436
+ context: 'entity-edit'
437
+ });
438
+ (0, _commands.useCommandLoader)({
439
+ name: 'core/editor/page-content-focus',
440
+ hook: getPageContentFocusCommands(),
337
441
  context: 'entity-edit'
338
442
  });
443
+ (0, _commands.useCommandLoader)({
444
+ name: 'core/edit-site/manipulate-document',
445
+ hook: getManipulateDocumentCommands()
446
+ });
339
447
  }
340
448
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_i18n","_icons","_commands","_preferences","_notices","_blockEditor","_coreData","_interface","_store","_constants","_patternRenameModal","_patternDuplicateModal","useEditorCommandLoader","editorMode","isListViewOpen","showBlockBreadcrumbs","isDistractionFree","isTopToolbar","isFocusMode","isPreviewMode","isViewable","isCodeEditingEnabled","isRichEditingEnabled","isPublishSidebarEnabled","useSelect","select","_get","_getPostType$viewable","get","preferencesStore","isListViewOpened","getCurrentPostType","getEditorSettings","editorStore","getSettings","blockEditorStore","getPostType","coreStore","__unstableIsPreviewMode","viewable","codeEditingEnabled","richEditingEnabled","getActiveComplementaryArea","interfaceStore","toggle","useDispatch","createInfoNotice","noticesStore","__unstableSaveForPreview","setIsListViewOpened","switchEditorMode","toggleDistractionFree","openModal","enableComplementaryArea","disableComplementaryArea","getCurrentPostId","allowSwitchEditorMode","commands","isLoading","push","name","label","__","icon","keyboard","callback","close","id","type","actions","onClick","listView","code","isRTL","drawerLeft","drawerRight","activeSidebar","blockDefault","formatListBullets","external","postId","link","window","open","useEditedEntityContextualCommands","postType","PATTERN_POST_TYPE","edit","patternRenameModalName","symbol","patternDuplicateModalName","useCommands","useCommandLoader","hook","context"],"sources":["@wordpress/editor/src/components/commands/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tblockDefault,\n\tcode,\n\tdrawerLeft,\n\tdrawerRight,\n\tedit,\n\tformatListBullets,\n\tlistView,\n\texternal,\n\tkeyboard,\n\tsymbol,\n} from '@wordpress/icons';\nimport { useCommandLoader } from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { PATTERN_POST_TYPE } from '../../store/constants';\nimport { modalName as patternRenameModalName } from '../pattern-rename-modal';\nimport { modalName as patternDuplicateModalName } from '../pattern-duplicate-modal';\n\nfunction useEditorCommandLoader() {\n\tconst {\n\t\teditorMode,\n\t\tisListViewOpen,\n\t\tshowBlockBreadcrumbs,\n\t\tisDistractionFree,\n\t\tisTopToolbar,\n\t\tisFocusMode,\n\t\tisPreviewMode,\n\t\tisViewable,\n\t\tisCodeEditingEnabled,\n\t\tisRichEditingEnabled,\n\t\tisPublishSidebarEnabled,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { isListViewOpened, getCurrentPostType, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { getPostType } = select( coreStore );\n\n\t\treturn {\n\t\t\teditorMode: get( 'core', 'editorMode' ) ?? 'visual',\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tisFocusMode: get( 'core', 'focusMode' ),\n\t\t\tisTopToolbar: get( 'core', 'fixedToolbar' ),\n\t\t\tisPreviewMode: getSettings().__unstableIsPreviewMode,\n\t\t\tisViewable: getPostType( getCurrentPostType() )?.viewable ?? false,\n\t\t\tisCodeEditingEnabled: getEditorSettings().codeEditingEnabled,\n\t\t\tisRichEditingEnabled: getEditorSettings().richEditingEnabled,\n\t\t\tisPublishSidebarEnabled:\n\t\t\t\tselect( editorStore ).isPublishSidebarEnabled(),\n\t\t};\n\t}, [] );\n\tconst { getActiveComplementaryArea } = useSelect( interfaceStore );\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\tconst {\n\t\t__unstableSaveForPreview,\n\t\tsetIsListViewOpened,\n\t\tswitchEditorMode,\n\t\ttoggleDistractionFree,\n\t} = useDispatch( editorStore );\n\tconst { openModal, enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\tconst { getCurrentPostId } = useSelect( editorStore );\n\tconst allowSwitchEditorMode = isCodeEditingEnabled && isRichEditingEnabled;\n\n\tif ( isPreviewMode ) {\n\t\treturn { commands: [], isLoading: false };\n\t}\n\n\tconst commands = [];\n\n\tcommands.push( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Keyboard shortcuts' ),\n\t\ticon: keyboard,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\topenModal( 'editor/keyboard-shortcut-help' );\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-distraction-free',\n\t\tlabel: isDistractionFree\n\t\t\t? __( 'Exit Distraction Free' )\n\t\t\t: __( 'Enter Distraction Free' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggleDistractionFree();\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Editor preferences' ),\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\topenModal( 'editor/preferences' );\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-spotlight-mode',\n\t\tlabel: __( 'Toggle spotlight' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'focusMode' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisFocusMode ? __( 'Spotlight off.' ) : __( 'Spotlight on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/editor/toggle-spotlight-mode/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core', 'focusMode' );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-list-view',\n\t\tlabel: isListViewOpen\n\t\t\t? __( 'Close List View' )\n\t\t\t: __( 'Open List View' ),\n\t\ticon: listView,\n\t\tcallback: ( { close } ) => {\n\t\t\tsetIsListViewOpened( ! isListViewOpen );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisListViewOpen ? __( 'List View off.' ) : __( 'List View on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/editor/toggle-list-view/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-top-toolbar',\n\t\tlabel: __( 'Toggle top toolbar' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'fixedToolbar' );\n\t\t\tif ( isDistractionFree ) {\n\t\t\t\ttoggleDistractionFree();\n\t\t\t}\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisTopToolbar\n\t\t\t\t\t? __( 'Top toolbar off.' )\n\t\t\t\t\t: __( 'Top toolbar on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/editor/toggle-top-toolbar/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core', 'fixedToolbar' );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tif ( allowSwitchEditorMode ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-code-editor',\n\t\t\tlabel:\n\t\t\t\teditorMode === 'visual'\n\t\t\t\t\t? __( 'Open code editor' )\n\t\t\t\t\t: __( 'Exit code editor' ),\n\t\t\ticon: code,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tswitchEditorMode( editorMode === 'visual' ? 'text' : 'visual' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\tcommands.push( {\n\t\tname: 'core/toggle-breadcrumbs',\n\t\tlabel: showBlockBreadcrumbs\n\t\t\t? __( 'Hide block breadcrumbs' )\n\t\t\t: __( 'Show block breadcrumbs' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'showBlockBreadcrumbs' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tshowBlockBreadcrumbs\n\t\t\t\t\t? __( 'Breadcrumbs hidden.' )\n\t\t\t\t\t: __( 'Breadcrumbs visible.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/editor/toggle-breadcrumbs/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tconst activeSidebar = getActiveComplementaryArea( 'core' );\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/document' ) {\n\t\t\t\tdisableComplementaryArea( 'core' );\n\t\t\t} else {\n\t\t\t\tenableComplementaryArea( 'core', 'edit-post/document' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tconst activeSidebar = getActiveComplementaryArea( 'core' );\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/block' ) {\n\t\t\t\tdisableComplementaryArea( 'core' );\n\t\t\t} else {\n\t\t\t\tenableComplementaryArea( 'core', 'edit-post/block' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-publish-sidebar',\n\t\tlabel: isPublishSidebarEnabled\n\t\t\t? __( 'Disable pre-publish checks' )\n\t\t\t: __( 'Enable pre-publish checks' ),\n\t\ticon: formatListBullets,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\ttoggle( 'core', 'isPublishSidebarEnabled' );\n\t\t\tcreateInfoNotice(\n\t\t\t\tisPublishSidebarEnabled\n\t\t\t\t\t? __( 'Pre-publish checks disabled.' )\n\t\t\t\t\t: __( 'Pre-publish checks enabled.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/editor/publish-sidebar/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tif ( isViewable ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/preview-link',\n\t\t\tlabel: __( 'Preview in a new tab' ),\n\t\t\ticon: external,\n\t\t\tcallback: async ( { close } ) => {\n\t\t\t\tclose();\n\t\t\t\tconst postId = getCurrentPostId();\n\t\t\t\tconst link = await __unstableSaveForPreview();\n\t\t\t\twindow.open( link, `wp-preview-${ postId }` );\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn {\n\t\tcommands,\n\t\tisLoading: false,\n\t};\n}\n\nfunction useEditedEntityContextualCommands() {\n\tconst { postType } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType } = select( editorStore );\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst commands = [];\n\n\tif ( postType === PATTERN_POST_TYPE ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/rename-pattern',\n\t\t\tlabel: __( 'Rename pattern' ),\n\t\t\ticon: edit,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\topenModal( patternRenameModalName );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t\tcommands.push( {\n\t\t\tname: 'core/duplicate-pattern',\n\t\t\tlabel: __( 'Duplicate pattern' ),\n\t\t\ticon: symbol,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\topenModal( patternDuplicateModalName );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nexport default function useCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/editor/edit-ui',\n\t\thook: useEditorCommandLoader,\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/editor/contextual-commands',\n\t\thook: useEditedEntityContextualCommands,\n\t\tcontext: 'entity-edit',\n\t} );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAYA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,UAAA,GAAAV,OAAA;AACA,IAAAW,mBAAA,GAAAX,OAAA;AACA,IAAAY,sBAAA,GAAAZ,OAAA;AA9BA;AACA;AACA;;AAsBA;AACA;AACA;;AAMA,SAASa,sBAAsBA,CAAA,EAAG;EACjC,MAAM;IACLC,UAAU;IACVC,cAAc;IACdC,oBAAoB;IACpBC,iBAAiB;IACjBC,YAAY;IACZC,WAAW;IACXC,aAAa;IACbC,UAAU;IACVC,oBAAoB;IACpBC,oBAAoB;IACpBC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAAA,IAAAC,IAAA,EAAAC,qBAAA;IAC5B,MAAM;MAAEC;IAAI,CAAC,GAAGH,MAAM,CAAEI,kBAAiB,CAAC;IAC1C,MAAM;MAAEC,gBAAgB;MAAEC,kBAAkB;MAAEC;IAAkB,CAAC,G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,CAAC;IACpD,OAAO;MACNoD,QAAQ,EAAEtD,kBAAkB,CAAC;IAC9B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAM;IAAEqB;EAAU,CAAC,GAAG,IAAAP,iBAAW,EAAEF,gBAAe,CAAC;EACnD,MAAMc,QAAQ,GAAG,EAAE;EAEnB,IAAK4B,QAAQ,KAAKC,4BAAiB,EAAG;IACrC7B,QAAQ,CAACE,IAAI,CAAE;MACdC,IAAI,EAAE,qBAAqB;MAC3BC,KAAK,EAAE,IAAAC,QAAE,EAAE,gBAAiB,CAAC;MAC7BC,IAAI,EAAEwB,WAAI;MACVtB,QAAQ,EAAEA,CAAE;QAAEC;MAAM,CAAC,KAAM;QAC1Bd,SAAS,CAAEoC,6BAAuB,CAAC;QACnCtB,KAAK,CAAC,CAAC;MACR;IACD,CAAE,CAAC;IACHT,QAAQ,CAACE,IAAI,CAAE;MACdC,IAAI,EAAE,wBAAwB;MAC9BC,KAAK,EAAE,IAAAC,QAAE,EAAE,mBAAoB,CAAC;MAChCC,IAAI,EAAE0B,aAAM;MACZxB,QAAQ,EAAEA,CAAE;QAAEC;MAAM,CAAC,KAAM;QAC1Bd,SAAS,CAAEsC,gCAA0B,CAAC;QACtCxB,KAAK,CAAC,CAAC;MACR;IACD,CAAE,CAAC;EACJ;EAEA,OAAO;IAAER,SAAS,EAAE,KAAK;IAAED;EAAS,CAAC;AACtC;AAEe,SAASkC,WAAWA,CAAA,EAAG;EACrC,IAAAC,0BAAgB,EAAE;IACjBhC,IAAI,EAAE,qBAAqB;IAC3BiC,IAAI,EAAEjF;EACP,CAAE,CAAC;EAEH,IAAAgF,0BAAgB,EAAE;IACjBhC,IAAI,EAAE,iCAAiC;IACvCiC,IAAI,EAAET,iCAAiC;IACvCU,OAAO,EAAE;EACV,CAAE,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_i18n","_icons","_commands","_preferences","_notices","_blockEditor","_coreData","_interface","_htmlEntities","_lockUnlock","_store","_constants","_patternRenameModal","_patternDuplicateModal","_isTemplateRevertable","_interopRequireDefault","getEditorCommandLoader","useEditorCommandLoader","editorMode","isListViewOpen","showBlockBreadcrumbs","isDistractionFree","isFocusMode","isPreviewMode","isViewable","isCodeEditingEnabled","isRichEditingEnabled","isPublishSidebarEnabled","useSelect","select","_get","_getPostType$viewable","get","preferencesStore","isListViewOpened","getCurrentPostType","getEditorSettings","editorStore","getSettings","blockEditorStore","getPostType","coreStore","viewable","codeEditingEnabled","richEditingEnabled","getActiveComplementaryArea","interfaceStore","toggle","useDispatch","createInfoNotice","noticesStore","__unstableSaveForPreview","setIsListViewOpened","switchEditorMode","toggleDistractionFree","toggleSpotlightMode","toggleTopToolbar","openModal","enableComplementaryArea","disableComplementaryArea","getCurrentPostId","allowSwitchEditorMode","commands","isLoading","push","name","label","__","icon","keyboard","callback","close","listView","id","type","code","isRTL","drawerLeft","drawerRight","activeSidebar","blockDefault","formatListBullets","external","postId","link","window","open","getEditedEntityContextualCommands","useEditedEntityContextualCommands","postType","PATTERN_POST_TYPE","edit","patternRenameModalName","symbol","patternDuplicateModalName","getPageContentFocusCommands","usePageContentFocusCommands","onNavigateToEntityRecord","goBack","templateId","getRenderingMode","_getEditorSettings","getCurrentTemplateId","unlock","editorSettings","isTemplateHidden","onNavigateToPreviousEntityRecord","editedRecord","template","hasResolved","useEntityRecord","sprintf","decodeEntities","title","layout","page","getManipulateDocumentCommands","useManipulateDocumentCommands","revertTemplate","TEMPLATE_PART_POST_TYPE","TEMPLATE_POST_TYPE","includes","isTemplateRevertable","rotateRight","rotateLeft","useCommands","useCommandLoader","hook","context"],"sources":["@wordpress/editor/src/components/commands/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL, sprintf } from '@wordpress/i18n';\nimport {\n\tblockDefault,\n\tcode,\n\tdrawerLeft,\n\tdrawerRight,\n\tedit,\n\tformatListBullets,\n\tlistView,\n\texternal,\n\tkeyboard,\n\tsymbol,\n\tpage,\n\tlayout,\n\trotateRight,\n\trotateLeft,\n} from '@wordpress/icons';\nimport { useCommandLoader } from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore, useEntityRecord } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport {\n\tPATTERN_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n} from '../../store/constants';\nimport { modalName as patternRenameModalName } from '../pattern-rename-modal';\nimport { modalName as patternDuplicateModalName } from '../pattern-duplicate-modal';\nimport isTemplateRevertable from '../../store/utils/is-template-revertable';\n\nconst getEditorCommandLoader = () =>\n\tfunction useEditorCommandLoader() {\n\t\tconst {\n\t\t\teditorMode,\n\t\t\tisListViewOpen,\n\t\t\tshowBlockBreadcrumbs,\n\t\t\tisDistractionFree,\n\t\t\tisFocusMode,\n\t\t\tisPreviewMode,\n\t\t\tisViewable,\n\t\t\tisCodeEditingEnabled,\n\t\t\tisRichEditingEnabled,\n\t\t\tisPublishSidebarEnabled,\n\t\t} = useSelect( ( select ) => {\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst { isListViewOpened, getCurrentPostType, getEditorSettings } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\tconst { getPostType } = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\teditorMode: get( 'core', 'editorMode' ) ?? 'visual',\n\t\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\t\tisFocusMode: get( 'core', 'focusMode' ),\n\t\t\t\tisPreviewMode: getSettings().isPreviewMode,\n\t\t\t\tisViewable:\n\t\t\t\t\tgetPostType( getCurrentPostType() )?.viewable ?? false,\n\t\t\t\tisCodeEditingEnabled: getEditorSettings().codeEditingEnabled,\n\t\t\t\tisRichEditingEnabled: getEditorSettings().richEditingEnabled,\n\t\t\t\tisPublishSidebarEnabled:\n\t\t\t\t\tselect( editorStore ).isPublishSidebarEnabled(),\n\t\t\t};\n\t\t}, [] );\n\t\tconst { getActiveComplementaryArea } = useSelect( interfaceStore );\n\t\tconst { toggle } = useDispatch( preferencesStore );\n\t\tconst { createInfoNotice } = useDispatch( noticesStore );\n\t\tconst {\n\t\t\t__unstableSaveForPreview,\n\t\t\tsetIsListViewOpened,\n\t\t\tswitchEditorMode,\n\t\t\ttoggleDistractionFree,\n\t\t\ttoggleSpotlightMode,\n\t\t\ttoggleTopToolbar,\n\t\t} = useDispatch( editorStore );\n\t\tconst { openModal, enableComplementaryArea, disableComplementaryArea } =\n\t\t\tuseDispatch( interfaceStore );\n\t\tconst { getCurrentPostId } = useSelect( editorStore );\n\t\tconst allowSwitchEditorMode =\n\t\t\tisCodeEditingEnabled && isRichEditingEnabled;\n\n\t\tif ( isPreviewMode ) {\n\t\t\treturn { commands: [], isLoading: false };\n\t\t}\n\n\t\tconst commands = [];\n\n\t\tcommands.push( {\n\t\t\tname: 'core/open-shortcut-help',\n\t\t\tlabel: __( 'Keyboard shortcuts' ),\n\t\t\ticon: keyboard,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tclose();\n\t\t\t\topenModal( 'editor/keyboard-shortcut-help' );\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-distraction-free',\n\t\t\tlabel: isDistractionFree\n\t\t\t\t? __( 'Exit Distraction free' )\n\t\t\t\t: __( 'Enter Distraction free' ),\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\ttoggleDistractionFree();\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/open-preferences',\n\t\t\tlabel: __( 'Editor preferences' ),\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tclose();\n\t\t\t\topenModal( 'editor/preferences' );\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-spotlight-mode',\n\t\t\tlabel: isFocusMode\n\t\t\t\t? __( 'Exit Spotlight mode' )\n\t\t\t\t: __( 'Enter Spotlight mode' ),\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\ttoggleSpotlightMode();\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-list-view',\n\t\t\tlabel: isListViewOpen\n\t\t\t\t? __( 'Close List View' )\n\t\t\t\t: __( 'Open List View' ),\n\t\t\ticon: listView,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetIsListViewOpened( ! isListViewOpen );\n\t\t\t\tclose();\n\t\t\t\tcreateInfoNotice(\n\t\t\t\t\tisListViewOpen\n\t\t\t\t\t\t? __( 'List View off.' )\n\t\t\t\t\t\t: __( 'List View on.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'core/editor/toggle-list-view/notice',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-top-toolbar',\n\t\t\tlabel: __( 'Top toolbar' ),\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\ttoggleTopToolbar();\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\n\t\tif ( allowSwitchEditorMode ) {\n\t\t\tcommands.push( {\n\t\t\t\tname: 'core/toggle-code-editor',\n\t\t\t\tlabel:\n\t\t\t\t\teditorMode === 'visual'\n\t\t\t\t\t\t? __( 'Open code editor' )\n\t\t\t\t\t\t: __( 'Exit code editor' ),\n\t\t\t\ticon: code,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\tswitchEditorMode(\n\t\t\t\t\t\teditorMode === 'visual' ? 'text' : 'visual'\n\t\t\t\t\t);\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-breadcrumbs',\n\t\t\tlabel: showBlockBreadcrumbs\n\t\t\t\t? __( 'Hide block breadcrumbs' )\n\t\t\t\t: __( 'Show block breadcrumbs' ),\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\ttoggle( 'core', 'showBlockBreadcrumbs' );\n\t\t\t\tclose();\n\t\t\t\tcreateInfoNotice(\n\t\t\t\t\tshowBlockBreadcrumbs\n\t\t\t\t\t\t? __( 'Breadcrumbs hidden.' )\n\t\t\t\t\t\t: __( 'Breadcrumbs visible.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'core/editor/toggle-breadcrumbs/notice',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/open-settings-sidebar',\n\t\t\tlabel: __( 'Show or hide the Settings panel.' ),\n\t\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tconst activeSidebar = getActiveComplementaryArea( 'core' );\n\t\t\t\tclose();\n\t\t\t\tif ( activeSidebar === 'edit-post/document' ) {\n\t\t\t\t\tdisableComplementaryArea( 'core' );\n\t\t\t\t} else {\n\t\t\t\t\tenableComplementaryArea( 'core', 'edit-post/document' );\n\t\t\t\t}\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/open-block-inspector',\n\t\t\tlabel: __( 'Show or hide the Block settings panel' ),\n\t\t\ticon: blockDefault,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tconst activeSidebar = getActiveComplementaryArea( 'core' );\n\t\t\t\tclose();\n\t\t\t\tif ( activeSidebar === 'edit-post/block' ) {\n\t\t\t\t\tdisableComplementaryArea( 'core' );\n\t\t\t\t} else {\n\t\t\t\t\tenableComplementaryArea( 'core', 'edit-post/block' );\n\t\t\t\t}\n\t\t\t},\n\t\t} );\n\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-publish-sidebar',\n\t\t\tlabel: isPublishSidebarEnabled\n\t\t\t\t? __( 'Disable pre-publish checks' )\n\t\t\t\t: __( 'Enable pre-publish checks' ),\n\t\t\ticon: formatListBullets,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tclose();\n\t\t\t\ttoggle( 'core', 'isPublishSidebarEnabled' );\n\t\t\t\tcreateInfoNotice(\n\t\t\t\t\tisPublishSidebarEnabled\n\t\t\t\t\t\t? __( 'Pre-publish checks disabled.' )\n\t\t\t\t\t\t: __( 'Pre-publish checks enabled.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'core/editor/publish-sidebar/notice',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t},\n\t\t} );\n\n\t\tif ( isViewable ) {\n\t\t\tcommands.push( {\n\t\t\t\tname: 'core/preview-link',\n\t\t\t\tlabel: __( 'Preview in a new tab' ),\n\t\t\t\ticon: external,\n\t\t\t\tcallback: async ( { close } ) => {\n\t\t\t\t\tclose();\n\t\t\t\t\tconst postId = getCurrentPostId();\n\t\t\t\t\tconst link = await __unstableSaveForPreview();\n\t\t\t\t\twindow.open( link, `wp-preview-${ postId }` );\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\treturn {\n\t\t\tcommands,\n\t\t\tisLoading: false,\n\t\t};\n\t};\n\nconst getEditedEntityContextualCommands = () =>\n\tfunction useEditedEntityContextualCommands() {\n\t\tconst { postType } = useSelect( ( select ) => {\n\t\t\tconst { getCurrentPostType } = select( editorStore );\n\t\t\treturn {\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t};\n\t\t}, [] );\n\t\tconst { openModal } = useDispatch( interfaceStore );\n\t\tconst commands = [];\n\n\t\tif ( postType === PATTERN_POST_TYPE ) {\n\t\t\tcommands.push( {\n\t\t\t\tname: 'core/rename-pattern',\n\t\t\t\tlabel: __( 'Rename pattern' ),\n\t\t\t\ticon: edit,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\topenModal( patternRenameModalName );\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t} );\n\t\t\tcommands.push( {\n\t\t\t\tname: 'core/duplicate-pattern',\n\t\t\t\tlabel: __( 'Duplicate pattern' ),\n\t\t\t\ticon: symbol,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\topenModal( patternDuplicateModalName );\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\treturn { isLoading: false, commands };\n\t};\n\nconst getPageContentFocusCommands = () =>\n\tfunction usePageContentFocusCommands() {\n\t\tconst { onNavigateToEntityRecord, goBack, templateId, isPreviewMode } =\n\t\t\tuseSelect( ( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetRenderingMode,\n\t\t\t\t\tgetEditorSettings: _getEditorSettings,\n\t\t\t\t\tgetCurrentTemplateId,\n\t\t\t\t} = unlock( select( editorStore ) );\n\t\t\t\tconst editorSettings = _getEditorSettings();\n\t\t\t\treturn {\n\t\t\t\t\tisTemplateHidden: getRenderingMode() === 'post-only',\n\t\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\t\teditorSettings.onNavigateToEntityRecord,\n\t\t\t\t\tgetEditorSettings: _getEditorSettings,\n\t\t\t\t\tgoBack: editorSettings.onNavigateToPreviousEntityRecord,\n\t\t\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t\t\t\tisPreviewMode: editorSettings.isPreviewMode,\n\t\t\t\t};\n\t\t\t}, [] );\n\t\tconst { editedRecord: template, hasResolved } = useEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\ttemplateId\n\t\t);\n\n\t\tif ( isPreviewMode ) {\n\t\t\treturn { isLoading: false, commands: [] };\n\t\t}\n\n\t\tconst commands = [];\n\n\t\tif ( templateId && hasResolved ) {\n\t\t\tcommands.push( {\n\t\t\t\tname: 'core/switch-to-template-focus',\n\t\t\t\tlabel: sprintf(\n\t\t\t\t\t/* translators: %s: template title */\n\t\t\t\t\t__( 'Edit template: %s' ),\n\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t),\n\t\t\t\ticon: layout,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\tpostId: templateId,\n\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t} );\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tif ( !! goBack ) {\n\t\t\tcommands.push( {\n\t\t\t\tname: 'core/switch-to-previous-entity',\n\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\ticon: page,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\tgoBack();\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\treturn { isLoading: false, commands };\n\t};\n\nconst getManipulateDocumentCommands = () =>\n\tfunction useManipulateDocumentCommands() {\n\t\tconst { postType, postId } = useSelect( ( select ) => {\n\t\t\tconst { getCurrentPostId, getCurrentPostType } =\n\t\t\t\tselect( editorStore );\n\t\t\treturn {\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t\tpostId: getCurrentPostId(),\n\t\t\t};\n\t\t}, [] );\n\t\tconst { editedRecord: template, hasResolved } = useEntityRecord(\n\t\t\t'postType',\n\t\t\tpostType,\n\t\t\tpostId\n\t\t);\n\t\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\t\tconst { revertTemplate } = unlock( useDispatch( editorStore ) );\n\n\t\tif (\n\t\t\t! hasResolved ||\n\t\t\t! [ TEMPLATE_PART_POST_TYPE, TEMPLATE_POST_TYPE ].includes(\n\t\t\t\tpostType\n\t\t\t)\n\t\t) {\n\t\t\treturn { isLoading: true, commands: [] };\n\t\t}\n\n\t\tconst commands = [];\n\n\t\tif ( isTemplateRevertable( template ) ) {\n\t\t\tconst label =\n\t\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t/* translators: %s: template title */\n\t\t\t\t\t\t\t__( 'Reset template: %s' ),\n\t\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: template part title */\n\t\t\t\t\t\t\t__( 'Reset template part: %s' ),\n\t\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t\t );\n\t\t\tcommands.push( {\n\t\t\t\tname: 'core/reset-template',\n\t\t\t\tlabel,\n\t\t\t\ticon: isRTL() ? rotateRight : rotateLeft,\n\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\trevertTemplate( template );\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\treturn {\n\t\t\tisLoading: ! hasResolved,\n\t\t\tcommands,\n\t\t};\n\t};\n\nexport default function useCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/editor/edit-ui',\n\t\thook: getEditorCommandLoader(),\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/editor/contextual-commands',\n\t\thook: getEditedEntityContextualCommands(),\n\t\tcontext: 'entity-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/editor/page-content-focus',\n\t\thook: getPageContentFocusCommands(),\n\t\tcontext: 'entity-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/manipulate-document',\n\t\thook: getManipulateDocumentCommands(),\n\t} );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAgBA,IAAAG,SAA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 @@ function CreateTemplatePartModalContents({
123
123
  area: value,
124
124
  description
125
125
  }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalRadio, {
126
+ __next40pxDefaultSize: true,
126
127
  value: value,
127
128
  className: "editor-create-template-part-modal__area-radio",
128
129
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Flex, {
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_components","_i18n","_element","_compose","_notices","_coreData","_icons","_blocks","_store","_constants","_utils","_jsxRuntime","CreateTemplatePartModal","modalTitle","restProps","defaultModalTitle","useSelect","select","coreStore","getPostType","TEMPLATE_PART_POST_TYPE","labels","add_new_item","jsx","Modal","title","onRequestClose","closeModal","overlayClassName","focusOnMount","size","children","CreateTemplatePartModalContents","defaultArea","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","blocks","confirmLabel","__","onCreate","onError","defaultTitle","createErrorNotice","useDispatch","noticesStore","saveEntityRecord","existingTemplateParts","useExistingTemplateParts","setTitle","useState","area","setArea","isSubmitting","setIsSubmitting","instanceId","useInstanceId","templatePartAreas","editorStore","__experimentalGetDefaultTemplatePartAreas","createTemplatePart","uniqueTitle","getUniqueTemplatePartTitle","cleanSlug","getCleanTemplatePartSlug","templatePart","slug","content","serialize","throwOnError","error","errorMessage","message","code","type","onSubmit","event","preventDefault","jsxs","__experimentalVStack","spacing","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","label","value","onChange","required","BaseControl","id","className","__experimentalRadioGroup","checked","map","icon","description","__experimentalRadio","Flex","align","justify","FlexItem","Icon","FlexBlock","check","__experimentalHStack","Button","variant","onClick","isBusy"],"sources":["@wordpress/editor/src/components/create-template-part-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tIcon,\n\tBaseControl,\n\tTextControl,\n\tFlex,\n\tFlexItem,\n\tFlexBlock,\n\tButton,\n\tModal,\n\t__experimentalRadioGroup as RadioGroup,\n\t__experimentalRadio as Radio,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { check } from '@wordpress/icons';\nimport { serialize } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n} from '../../store/constants';\nimport {\n\tuseExistingTemplateParts,\n\tgetUniqueTemplatePartTitle,\n\tgetCleanTemplatePartSlug,\n} from './utils';\n\nexport default function CreateTemplatePartModal( {\n\tmodalTitle,\n\t...restProps\n} ) {\n\tconst defaultModalTitle = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getPostType( TEMPLATE_PART_POST_TYPE )?.labels\n\t\t\t\t?.add_new_item,\n\t\t[]\n\t);\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ modalTitle || defaultModalTitle }\n\t\t\tonRequestClose={ restProps.closeModal }\n\t\t\toverlayClassName=\"editor-create-template-part-modal\"\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"medium\"\n\t\t>\n\t\t\t<CreateTemplatePartModalContents { ...restProps } />\n\t\t</Modal>\n\t);\n}\n\nexport function CreateTemplatePartModalContents( {\n\tdefaultArea = TEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n\tblocks = [],\n\tconfirmLabel = __( 'Add' ),\n\tcloseModal,\n\tonCreate,\n\tonError,\n\tdefaultTitle = '',\n} ) {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst existingTemplateParts = useExistingTemplateParts();\n\n\tconst [ title, setTitle ] = useState( defaultTitle );\n\tconst [ area, setArea ] = useState( defaultArea );\n\tconst [ isSubmitting, setIsSubmitting ] = useState( false );\n\tconst instanceId = useInstanceId( CreateTemplatePartModal );\n\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\tasync function createTemplatePart() {\n\t\tif ( ! title || isSubmitting ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tsetIsSubmitting( true );\n\t\t\tconst uniqueTitle = getUniqueTemplatePartTitle(\n\t\t\t\ttitle,\n\t\t\t\texistingTemplateParts\n\t\t\t);\n\t\t\tconst cleanSlug = getCleanTemplatePartSlug( uniqueTitle );\n\n\t\t\tconst templatePart = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t{\n\t\t\t\t\tslug: cleanSlug,\n\t\t\t\t\ttitle: uniqueTitle,\n\t\t\t\t\tcontent: serialize( blocks ),\n\t\t\t\t\tarea,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\t\t\tawait onCreate( templatePart );\n\n\t\t\t// TODO: Add a success notice?\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'An error occurred while creating the template part.'\n\t\t\t\t\t );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\n\t\t\tonError?.();\n\t\t} finally {\n\t\t\tsetIsSubmitting( false );\n\t\t}\n\t}\n\treturn (\n\t\t<form\n\t\t\tonSubmit={ async ( event ) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tawait createTemplatePart();\n\t\t\t} }\n\t\t>\n\t\t\t<VStack spacing=\"4\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\trequired\n\t\t\t\t/>\n\t\t\t\t<BaseControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\tid={ `editor-create-template-part-modal__area-selection-${ instanceId }` }\n\t\t\t\t\tclassName=\"editor-create-template-part-modal__area-base-control\"\n\t\t\t\t>\n\t\t\t\t\t<RadioGroup\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tclassName=\"editor-create-template-part-modal__area-radio-group\"\n\t\t\t\t\t\tid={ `editor-create-template-part-modal__area-selection-${ instanceId }` }\n\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t\tchecked={ area }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ templatePartAreas.map(\n\t\t\t\t\t\t\t( { icon, label, area: value, description } ) => (\n\t\t\t\t\t\t\t\t<Radio\n\t\t\t\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\tclassName=\"editor-create-template-part-modal__area-radio\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<Flex align=\"start\" justify=\"start\">\n\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t<FlexBlock className=\"editor-create-template-part-modal__option-label\">\n\t\t\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t\t\t\t<div>{ description }</div>\n\t\t\t\t\t\t\t\t\t\t</FlexBlock>\n\n\t\t\t\t\t\t\t\t\t\t<FlexItem className=\"editor-create-template-part-modal__checkbox\">\n\t\t\t\t\t\t\t\t\t\t\t{ area === value && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ check } />\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t</Flex>\n\t\t\t\t\t\t\t\t</Radio>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) }\n\t\t\t\t\t</RadioGroup>\n\t\t\t\t</BaseControl>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\taria-disabled={ ! title || isSubmitting }\n\t\t\t\t\t\tisBusy={ isSubmitting }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ confirmLabel }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAcA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,UAAA,GAAAV,OAAA;AAIA,IAAAW,MAAA,GAAAX,OAAA;AAIiB,IAAAY,WAAA,GAAAZ,OAAA;AAtCjB;AACA;AACA;;AAwBA;AACA;AACA;;AAYe,SAASa,uBAAuBA,CAAE;EAChDC,UAAU;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AApB,QAAA,EAErBK;QAAY,CACP,CAAC;MAAA,CACF,CAAC;IAAA,CACF;EAAC,CACJ,CAAC;AAET","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_components","_i18n","_element","_compose","_notices","_coreData","_icons","_blocks","_store","_constants","_utils","_jsxRuntime","CreateTemplatePartModal","modalTitle","restProps","defaultModalTitle","useSelect","select","coreStore","getPostType","TEMPLATE_PART_POST_TYPE","labels","add_new_item","jsx","Modal","title","onRequestClose","closeModal","overlayClassName","focusOnMount","size","children","CreateTemplatePartModalContents","defaultArea","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","blocks","confirmLabel","__","onCreate","onError","defaultTitle","createErrorNotice","useDispatch","noticesStore","saveEntityRecord","existingTemplateParts","useExistingTemplateParts","setTitle","useState","area","setArea","isSubmitting","setIsSubmitting","instanceId","useInstanceId","templatePartAreas","editorStore","__experimentalGetDefaultTemplatePartAreas","createTemplatePart","uniqueTitle","getUniqueTemplatePartTitle","cleanSlug","getCleanTemplatePartSlug","templatePart","slug","content","serialize","throwOnError","error","errorMessage","message","code","type","onSubmit","event","preventDefault","jsxs","__experimentalVStack","spacing","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","label","value","onChange","required","BaseControl","id","className","__experimentalRadioGroup","checked","map","icon","description","__experimentalRadio","Flex","align","justify","FlexItem","Icon","FlexBlock","check","__experimentalHStack","Button","variant","onClick","isBusy"],"sources":["@wordpress/editor/src/components/create-template-part-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tIcon,\n\tBaseControl,\n\tTextControl,\n\tFlex,\n\tFlexItem,\n\tFlexBlock,\n\tButton,\n\tModal,\n\t__experimentalRadioGroup as RadioGroup,\n\t__experimentalRadio as Radio,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { check } from '@wordpress/icons';\nimport { serialize } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n} from '../../store/constants';\nimport {\n\tuseExistingTemplateParts,\n\tgetUniqueTemplatePartTitle,\n\tgetCleanTemplatePartSlug,\n} from './utils';\n\nexport default function CreateTemplatePartModal( {\n\tmodalTitle,\n\t...restProps\n} ) {\n\tconst defaultModalTitle = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getPostType( TEMPLATE_PART_POST_TYPE )?.labels\n\t\t\t\t?.add_new_item,\n\t\t[]\n\t);\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ modalTitle || defaultModalTitle }\n\t\t\tonRequestClose={ restProps.closeModal }\n\t\t\toverlayClassName=\"editor-create-template-part-modal\"\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"medium\"\n\t\t>\n\t\t\t<CreateTemplatePartModalContents { ...restProps } />\n\t\t</Modal>\n\t);\n}\n\nexport function CreateTemplatePartModalContents( {\n\tdefaultArea = TEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n\tblocks = [],\n\tconfirmLabel = __( 'Add' ),\n\tcloseModal,\n\tonCreate,\n\tonError,\n\tdefaultTitle = '',\n} ) {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst existingTemplateParts = useExistingTemplateParts();\n\n\tconst [ title, setTitle ] = useState( defaultTitle );\n\tconst [ area, setArea ] = useState( defaultArea );\n\tconst [ isSubmitting, setIsSubmitting ] = useState( false );\n\tconst instanceId = useInstanceId( CreateTemplatePartModal );\n\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\tasync function createTemplatePart() {\n\t\tif ( ! title || isSubmitting ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tsetIsSubmitting( true );\n\t\t\tconst uniqueTitle = getUniqueTemplatePartTitle(\n\t\t\t\ttitle,\n\t\t\t\texistingTemplateParts\n\t\t\t);\n\t\t\tconst cleanSlug = getCleanTemplatePartSlug( uniqueTitle );\n\n\t\t\tconst templatePart = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t{\n\t\t\t\t\tslug: cleanSlug,\n\t\t\t\t\ttitle: uniqueTitle,\n\t\t\t\t\tcontent: serialize( blocks ),\n\t\t\t\t\tarea,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\t\t\tawait onCreate( templatePart );\n\n\t\t\t// TODO: Add a success notice?\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'An error occurred while creating the template part.'\n\t\t\t\t\t );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\n\t\t\tonError?.();\n\t\t} finally {\n\t\t\tsetIsSubmitting( false );\n\t\t}\n\t}\n\treturn (\n\t\t<form\n\t\t\tonSubmit={ async ( event ) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tawait createTemplatePart();\n\t\t\t} }\n\t\t>\n\t\t\t<VStack spacing=\"4\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\trequired\n\t\t\t\t/>\n\t\t\t\t<BaseControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\tid={ `editor-create-template-part-modal__area-selection-${ instanceId }` }\n\t\t\t\t\tclassName=\"editor-create-template-part-modal__area-base-control\"\n\t\t\t\t>\n\t\t\t\t\t<RadioGroup\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tclassName=\"editor-create-template-part-modal__area-radio-group\"\n\t\t\t\t\t\tid={ `editor-create-template-part-modal__area-selection-${ instanceId }` }\n\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t\tchecked={ area }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ templatePartAreas.map(\n\t\t\t\t\t\t\t( { icon, label, area: value, description } ) => (\n\t\t\t\t\t\t\t\t<Radio\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\tclassName=\"editor-create-template-part-modal__area-radio\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<Flex align=\"start\" justify=\"start\">\n\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t<FlexBlock className=\"editor-create-template-part-modal__option-label\">\n\t\t\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t\t\t\t<div>{ description }</div>\n\t\t\t\t\t\t\t\t\t\t</FlexBlock>\n\n\t\t\t\t\t\t\t\t\t\t<FlexItem className=\"editor-create-template-part-modal__checkbox\">\n\t\t\t\t\t\t\t\t\t\t\t{ area === value && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ check } />\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t</Flex>\n\t\t\t\t\t\t\t\t</Radio>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) }\n\t\t\t\t\t</RadioGroup>\n\t\t\t\t</BaseControl>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\taria-disabled={ ! title || isSubmitting }\n\t\t\t\t\t\tisBusy={ isSubmitting }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ confirmLabel }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAcA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,UAAA,GAAAV,OAAA;AAIA,IAAAW,MAAA,GAAAX,OAAA;AAIiB,IAAAY,WAAA,GAAAZ,OAAA;AAtCjB;AACA;AACA;;AAwBA;AACA;AACA;;AAYe,SAASa,uBAAuBA,CAAE;EAChDC,UAAU;EACV,GAAGC;AACJ,CAAC,EAAG;EACH,MAAMC,iBAAiB,GAAG,IAAAC,eAAS,EAChCC,MAAM,IACPA,MAAM,CAAEC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ignoreList":[]}
@@ -19,6 +19,7 @@ var _compose = require("@wordpress/compose");
19
19
  var _htmlEntities = require("@wordpress/html-entities");
20
20
  var _constants = require("../../store/constants");
21
21
  var _store = require("../../store");
22
+ var _pageTypeBadge = _interopRequireDefault(require("../../utils/pageTypeBadge"));
22
23
  var _jsxRuntime = require("react/jsx-runtime");
23
24
  /**
24
25
  * External dependencies
@@ -57,15 +58,16 @@ function DocumentBar(props) {
57
58
  postTypeLabel,
58
59
  documentTitle,
59
60
  isNotFound,
60
- isUnsyncedPattern,
61
61
  templateTitle,
62
- onNavigateToPreviousEntityRecord
62
+ onNavigateToPreviousEntityRecord,
63
+ isTemplatePreview
63
64
  } = (0, _data.useSelect)(select => {
64
65
  const {
65
66
  getCurrentPostType,
66
67
  getCurrentPostId,
67
68
  getEditorSettings,
68
- __experimentalGetTemplateInfo: getTemplateInfo
69
+ __experimentalGetTemplateInfo: getTemplateInfo,
70
+ getRenderingMode
69
71
  } = select(_store.store);
70
72
  const {
71
73
  getEditedEntityRecord,
@@ -82,9 +84,9 @@ function DocumentBar(props) {
82
84
  postTypeLabel: _postTypeLabel,
83
85
  documentTitle: _document.title,
84
86
  isNotFound: !_document && !isResolvingSelector('getEditedEntityRecord', 'postType', _postType, _postId),
85
- isUnsyncedPattern: _document?.wp_pattern_sync_status === 'unsynced',
86
87
  templateTitle: _templateInfo.title,
87
- onNavigateToPreviousEntityRecord: getEditorSettings().onNavigateToPreviousEntityRecord
88
+ onNavigateToPreviousEntityRecord: getEditorSettings().onNavigateToPreviousEntityRecord,
89
+ isTemplatePreview: getRenderingMode() === 'template-locked'
88
90
  };
89
91
  }, []);
90
92
  const {
@@ -92,19 +94,18 @@ function DocumentBar(props) {
92
94
  } = (0, _data.useDispatch)(_commands.store);
93
95
  const isReducedMotion = (0, _compose.useReducedMotion)();
94
96
  const isTemplate = _constants.TEMPLATE_POST_TYPES.includes(postType);
95
- const isGlobalEntity = _constants.GLOBAL_POST_TYPES.includes(postType);
96
97
  const hasBackButton = !!onNavigateToPreviousEntityRecord;
97
98
  const entityTitle = isTemplate ? templateTitle : documentTitle;
98
99
  const title = props.title || entityTitle;
99
100
  const icon = props.icon;
101
+ const pageTypeBadge = (0, _pageTypeBadge.default)();
100
102
  const mountedRef = (0, _element.useRef)(false);
101
103
  (0, _element.useEffect)(() => {
102
104
  mountedRef.current = true;
103
105
  }, []);
104
106
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
105
107
  className: (0, _clsx.default)('editor-document-bar', {
106
- 'has-back-button': hasBackButton,
107
- 'is-global': isGlobalEntity && !isUnsyncedPattern
108
+ 'has-back-button': hasBackButton
108
109
  }),
109
110
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__unstableAnimatePresence, {
110
111
  children: hasBackButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(MotionButton, {
@@ -133,6 +134,9 @@ function DocumentBar(props) {
133
134
  } : undefined,
134
135
  children: (0, _i18n.__)('Back')
135
136
  })
137
+ }), !isTemplate && isTemplatePreview && /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockIcon, {
138
+ icon: _icons.layout,
139
+ className: "editor-document-bar__icon-layout"
136
140
  }), isNotFound ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
137
141
  children: (0, _i18n.__)('Document not found')
138
142
  }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Button, {
@@ -164,9 +168,12 @@ function DocumentBar(props) {
164
168
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
165
169
  className: "editor-document-bar__post-title",
166
170
  children: title ? (0, _htmlEntities.decodeEntities)(title) : (0, _i18n.__)('No title')
167
- }), postTypeLabel && !props.title && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
171
+ }), pageTypeBadge && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
168
172
  className: "editor-document-bar__post-type-label",
169
- children: ' + (0, _htmlEntities.decodeEntities)(postTypeLabel)
173
+ children: ${pageTypeBadge}`
174
+ }), postTypeLabel && !props.title && !pageTypeBadge && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
175
+ className: "editor-document-bar__post-type-label",
176
+ children: `· ${(0, _htmlEntities.decodeEntities)(postTypeLabel)}`
170
177
  })]
171
178
  })]
172
179
  }, hasBackButton), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {