@wordpress/editor 14.10.0 → 14.11.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 (292) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +2 -2
  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 +120 -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 +272 -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 +6 -6
  20. package/build/components/commands/index.js.map +1 -1
  21. package/build/components/document-bar/index.js +8 -7
  22. package/build/components/document-bar/index.js.map +1 -1
  23. package/build/components/document-tools/index.js +1 -5
  24. package/build/components/document-tools/index.js.map +1 -1
  25. package/build/components/editor-interface/index.js +3 -2
  26. package/build/components/editor-interface/index.js.map +1 -1
  27. package/build/components/entities-saved-states/index.js +1 -1
  28. package/build/components/entities-saved-states/index.js.map +1 -1
  29. package/build/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
  30. package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  31. package/build/components/global-styles-provider/index.js +13 -3
  32. package/build/components/global-styles-provider/index.js.map +1 -1
  33. package/build/components/header/index.js +5 -2
  34. package/build/components/header/index.js.map +1 -1
  35. package/build/components/inserter-sidebar/index.js +2 -2
  36. package/build/components/inserter-sidebar/index.js.map +1 -1
  37. package/build/components/page-attributes/parent.js +5 -5
  38. package/build/components/page-attributes/parent.js.map +1 -1
  39. package/build/components/plugin-more-menu-item/index.js +13 -11
  40. package/build/components/plugin-more-menu-item/index.js.map +1 -1
  41. package/build/components/plugin-preview-menu-item/index.js +15 -13
  42. package/build/components/plugin-preview-menu-item/index.js.map +1 -1
  43. package/build/components/plugin-sidebar/index.js +0 -15
  44. package/build/components/plugin-sidebar/index.js.map +1 -1
  45. package/build/components/post-actions/index.js +5 -5
  46. package/build/components/post-actions/index.js.map +1 -1
  47. package/build/components/post-author/panel.js +4 -4
  48. package/build/components/post-author/panel.js.map +1 -1
  49. package/build/components/post-card-panel/index.js +7 -36
  50. package/build/components/post-card-panel/index.js.map +1 -1
  51. package/build/components/post-content-information/index.js +1 -2
  52. package/build/components/post-content-information/index.js.map +1 -1
  53. package/build/components/post-featured-image/index.js +26 -7
  54. package/build/components/post-featured-image/index.js.map +1 -1
  55. package/build/components/post-last-revision/index.js +1 -1
  56. package/build/components/post-last-revision/index.js.map +1 -1
  57. package/build/components/post-schedule/label.js +1 -1
  58. package/build/components/post-schedule/label.js.map +1 -1
  59. package/build/components/post-taxonomies/flat-term-selector.js +9 -1
  60. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  61. package/build/components/post-taxonomies/hierarchical-term-selector.js +2 -2
  62. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  63. package/build/components/post-url/index.js +1 -1
  64. package/build/components/post-url/index.js.map +1 -1
  65. package/build/components/post-url/panel.js +3 -3
  66. package/build/components/post-url/panel.js.map +1 -1
  67. package/build/components/preview-dropdown/index.js +0 -4
  68. package/build/components/preview-dropdown/index.js.map +1 -1
  69. package/build/components/provider/index.js +10 -12
  70. package/build/components/provider/index.js.map +1 -1
  71. package/build/components/provider/use-block-editor-settings.js +1 -1
  72. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  73. package/build/components/sidebar/header.js +2 -1
  74. package/build/components/sidebar/header.js.map +1 -1
  75. package/build/components/sidebar/index.js +3 -3
  76. package/build/components/sidebar/index.js.map +1 -1
  77. package/build/components/time-to-read/index.js +2 -2
  78. package/build/components/time-to-read/index.js.map +1 -1
  79. package/build/components/visual-editor/index.js +25 -27
  80. package/build/components/visual-editor/index.js.map +1 -1
  81. package/build/components/visual-editor/use-zoom-out-mode-exit.js +52 -0
  82. package/build/components/visual-editor/use-zoom-out-mode-exit.js.map +1 -0
  83. package/build/components/zoom-out-toggle/index.js +37 -5
  84. package/build/components/zoom-out-toggle/index.js.map +1 -1
  85. package/build/dataviews/actions/duplicate-template-part.js +2 -2
  86. package/build/dataviews/actions/duplicate-template-part.js.map +1 -1
  87. package/build/store/actions.js +4 -3
  88. package/build/store/actions.js.map +1 -1
  89. package/build/store/private-actions.js +2 -2
  90. package/build/store/private-actions.js.map +1 -1
  91. package/build/store/selectors.js +3 -2
  92. package/build/store/selectors.js.map +1 -1
  93. package/build/utils/pageTypeBadge.js +51 -0
  94. package/build/utils/pageTypeBadge.js.map +1 -0
  95. package/build/utils/terms.js +2 -2
  96. package/build/utils/terms.js.map +1 -1
  97. package/build-module/bindings/post-meta.js +2 -1
  98. package/build-module/bindings/post-meta.js.map +1 -1
  99. package/build-module/components/collab-sidebar/add-comment.js +114 -0
  100. package/build-module/components/collab-sidebar/add-comment.js.map +1 -0
  101. package/build-module/components/collab-sidebar/comment-button-toolbar.js +30 -0
  102. package/build-module/components/collab-sidebar/comment-button-toolbar.js.map +1 -0
  103. package/build-module/components/collab-sidebar/comment-button.js +30 -0
  104. package/build-module/components/collab-sidebar/comment-button.js.map +1 -0
  105. package/build-module/components/collab-sidebar/comments.js +314 -0
  106. package/build-module/components/collab-sidebar/comments.js.map +1 -0
  107. package/build-module/components/collab-sidebar/constants.js +2 -0
  108. package/build-module/components/collab-sidebar/constants.js.map +1 -0
  109. package/build-module/components/collab-sidebar/index.js +264 -0
  110. package/build-module/components/collab-sidebar/index.js.map +1 -0
  111. package/build-module/components/collab-sidebar/utils.js +10 -0
  112. package/build-module/components/collab-sidebar/utils.js.map +1 -0
  113. package/build-module/components/commands/index.js +6 -6
  114. package/build-module/components/commands/index.js.map +1 -1
  115. package/build-module/components/document-bar/index.js +9 -8
  116. package/build-module/components/document-bar/index.js.map +1 -1
  117. package/build-module/components/document-tools/index.js +2 -6
  118. package/build-module/components/document-tools/index.js.map +1 -1
  119. package/build-module/components/editor-interface/index.js +3 -2
  120. package/build-module/components/editor-interface/index.js.map +1 -1
  121. package/build-module/components/entities-saved-states/index.js +1 -1
  122. package/build-module/components/entities-saved-states/index.js.map +1 -1
  123. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
  124. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  125. package/build-module/components/global-styles-provider/index.js +13 -3
  126. package/build-module/components/global-styles-provider/index.js.map +1 -1
  127. package/build-module/components/header/index.js +5 -2
  128. package/build-module/components/header/index.js.map +1 -1
  129. package/build-module/components/inserter-sidebar/index.js +2 -2
  130. package/build-module/components/inserter-sidebar/index.js.map +1 -1
  131. package/build-module/components/page-attributes/parent.js +5 -5
  132. package/build-module/components/page-attributes/parent.js.map +1 -1
  133. package/build-module/components/plugin-more-menu-item/index.js +12 -10
  134. package/build-module/components/plugin-more-menu-item/index.js.map +1 -1
  135. package/build-module/components/plugin-preview-menu-item/index.js +14 -12
  136. package/build-module/components/plugin-preview-menu-item/index.js.map +1 -1
  137. package/build-module/components/plugin-sidebar/index.js +0 -15
  138. package/build-module/components/plugin-sidebar/index.js.map +1 -1
  139. package/build-module/components/post-actions/index.js +5 -5
  140. package/build-module/components/post-actions/index.js.map +1 -1
  141. package/build-module/components/post-author/panel.js +4 -4
  142. package/build-module/components/post-author/panel.js.map +1 -1
  143. package/build-module/components/post-card-panel/index.js +8 -36
  144. package/build-module/components/post-card-panel/index.js.map +1 -1
  145. package/build-module/components/post-content-information/index.js +1 -2
  146. package/build-module/components/post-content-information/index.js.map +1 -1
  147. package/build-module/components/post-featured-image/index.js +26 -7
  148. package/build-module/components/post-featured-image/index.js.map +1 -1
  149. package/build-module/components/post-last-revision/index.js +1 -1
  150. package/build-module/components/post-last-revision/index.js.map +1 -1
  151. package/build-module/components/post-schedule/label.js +1 -1
  152. package/build-module/components/post-schedule/label.js.map +1 -1
  153. package/build-module/components/post-taxonomies/flat-term-selector.js +12 -4
  154. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  155. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +2 -2
  156. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  157. package/build-module/components/post-url/index.js +1 -1
  158. package/build-module/components/post-url/index.js.map +1 -1
  159. package/build-module/components/post-url/panel.js +3 -3
  160. package/build-module/components/post-url/panel.js.map +1 -1
  161. package/build-module/components/preview-dropdown/index.js +0 -4
  162. package/build-module/components/preview-dropdown/index.js.map +1 -1
  163. package/build-module/components/provider/index.js +10 -12
  164. package/build-module/components/provider/index.js.map +1 -1
  165. package/build-module/components/provider/use-block-editor-settings.js +1 -1
  166. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  167. package/build-module/components/sidebar/header.js +2 -1
  168. package/build-module/components/sidebar/header.js.map +1 -1
  169. package/build-module/components/sidebar/index.js +4 -4
  170. package/build-module/components/sidebar/index.js.map +1 -1
  171. package/build-module/components/time-to-read/index.js +2 -2
  172. package/build-module/components/time-to-read/index.js.map +1 -1
  173. package/build-module/components/visual-editor/index.js +26 -28
  174. package/build-module/components/visual-editor/index.js.map +1 -1
  175. package/build-module/components/visual-editor/use-zoom-out-mode-exit.js +46 -0
  176. package/build-module/components/visual-editor/use-zoom-out-mode-exit.js.map +1 -0
  177. package/build-module/components/zoom-out-toggle/index.js +37 -5
  178. package/build-module/components/zoom-out-toggle/index.js.map +1 -1
  179. package/build-module/dataviews/actions/duplicate-template-part.js +3 -3
  180. package/build-module/dataviews/actions/duplicate-template-part.js.map +1 -1
  181. package/build-module/store/actions.js +4 -3
  182. package/build-module/store/actions.js.map +1 -1
  183. package/build-module/store/private-actions.js +3 -3
  184. package/build-module/store/private-actions.js.map +1 -1
  185. package/build-module/store/selectors.js +3 -2
  186. package/build-module/store/selectors.js.map +1 -1
  187. package/build-module/utils/pageTypeBadge.js +45 -0
  188. package/build-module/utils/pageTypeBadge.js.map +1 -0
  189. package/build-module/utils/terms.js +2 -2
  190. package/build-module/utils/terms.js.map +1 -1
  191. package/build-style/style-rtl.css +96 -54
  192. package/build-style/style.css +96 -54
  193. package/build-types/bindings/post-meta.d.ts.map +1 -1
  194. package/build-types/components/collab-sidebar/add-comment.d.ts +15 -0
  195. package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -0
  196. package/build-types/components/collab-sidebar/comment-button-toolbar.d.ts +5 -0
  197. package/build-types/components/collab-sidebar/comment-button-toolbar.d.ts.map +1 -0
  198. package/build-types/components/collab-sidebar/comment-button.d.ts +5 -0
  199. package/build-types/components/collab-sidebar/comment-button.d.ts.map +1 -0
  200. package/build-types/components/collab-sidebar/comments.d.ts +19 -0
  201. package/build-types/components/collab-sidebar/comments.d.ts.map +1 -0
  202. package/build-types/components/collab-sidebar/constants.d.ts +2 -0
  203. package/build-types/components/collab-sidebar/constants.d.ts.map +1 -0
  204. package/build-types/components/collab-sidebar/index.d.ts +5 -0
  205. package/build-types/components/collab-sidebar/index.d.ts.map +1 -0
  206. package/build-types/components/collab-sidebar/utils.d.ts +8 -0
  207. package/build-types/components/collab-sidebar/utils.d.ts.map +1 -0
  208. package/build-types/components/commands/index.d.ts.map +1 -1
  209. package/build-types/components/document-bar/index.d.ts.map +1 -1
  210. package/build-types/components/document-tools/index.d.ts.map +1 -1
  211. package/build-types/components/editor-interface/index.d.ts.map +1 -1
  212. package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
  213. package/build-types/components/header/index.d.ts.map +1 -1
  214. package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
  215. package/build-types/components/page-attributes/parent.d.ts.map +1 -1
  216. package/build-types/components/plugin-more-menu-item/index.d.ts +62 -2
  217. package/build-types/components/plugin-more-menu-item/index.d.ts.map +1 -1
  218. package/build-types/components/plugin-preview-menu-item/index.d.ts +41 -2
  219. package/build-types/components/plugin-preview-menu-item/index.d.ts.map +1 -1
  220. package/build-types/components/plugin-sidebar/index.d.ts.map +1 -1
  221. package/build-types/components/post-author/panel.d.ts.map +1 -1
  222. package/build-types/components/post-card-panel/index.d.ts.map +1 -1
  223. package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
  224. package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
  225. package/build-types/components/provider/index.d.ts.map +1 -1
  226. package/build-types/components/sidebar/index.d.ts.map +1 -1
  227. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  228. package/build-types/components/visual-editor/use-zoom-out-mode-exit.d.ts +5 -0
  229. package/build-types/components/visual-editor/use-zoom-out-mode-exit.d.ts.map +1 -0
  230. package/build-types/components/zoom-out-toggle/index.d.ts +3 -1
  231. package/build-types/components/zoom-out-toggle/index.d.ts.map +1 -1
  232. package/build-types/store/actions.d.ts.map +1 -1
  233. package/build-types/store/selectors.d.ts.map +1 -1
  234. package/build-types/utils/pageTypeBadge.d.ts +5 -0
  235. package/build-types/utils/pageTypeBadge.d.ts.map +1 -0
  236. package/build-types/utils/terms.d.ts.map +1 -1
  237. package/package.json +38 -37
  238. package/src/bindings/post-meta.js +1 -0
  239. package/src/components/collab-sidebar/add-comment.js +124 -0
  240. package/src/components/collab-sidebar/comment-button-toolbar.js +29 -0
  241. package/src/components/collab-sidebar/comment-button.js +31 -0
  242. package/src/components/collab-sidebar/comments.js +404 -0
  243. package/src/components/collab-sidebar/constants.js +1 -0
  244. package/src/components/collab-sidebar/index.js +307 -0
  245. package/src/components/collab-sidebar/style.scss +111 -0
  246. package/src/components/collab-sidebar/utils.js +9 -0
  247. package/src/components/commands/index.js +9 -7
  248. package/src/components/document-bar/index.js +15 -7
  249. package/src/components/document-bar/style.scss +0 -4
  250. package/src/components/document-tools/index.js +1 -7
  251. package/src/components/editor-interface/index.js +4 -3
  252. package/src/components/entities-saved-states/index.js +2 -2
  253. package/src/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
  254. package/src/components/global-styles-provider/index.js +20 -6
  255. package/src/components/header/index.js +3 -1
  256. package/src/components/inserter-sidebar/index.js +3 -6
  257. package/src/components/page-attributes/parent.js +6 -4
  258. package/src/components/plugin-more-menu-item/index.js +12 -11
  259. package/src/components/plugin-preview-menu-item/index.js +14 -13
  260. package/src/components/plugin-sidebar/index.js +0 -13
  261. package/src/components/post-actions/index.js +8 -11
  262. package/src/components/post-author/panel.js +4 -2
  263. package/src/components/post-card-panel/index.js +9 -43
  264. package/src/components/post-card-panel/style.scss +1 -9
  265. package/src/components/post-content-information/index.js +1 -1
  266. package/src/components/post-featured-image/index.js +31 -16
  267. package/src/components/post-featured-image/style.scss +5 -2
  268. package/src/components/post-last-revision/index.js +1 -1
  269. package/src/components/post-schedule/label.js +1 -1
  270. package/src/components/post-sticky/test/index.js +6 -6
  271. package/src/components/post-taxonomies/flat-term-selector.js +15 -4
  272. package/src/components/post-taxonomies/hierarchical-term-selector.js +2 -2
  273. package/src/components/post-url/index.js +1 -1
  274. package/src/components/post-url/panel.js +4 -2
  275. package/src/components/preview-dropdown/index.js +0 -2
  276. package/src/components/provider/index.js +31 -24
  277. package/src/components/provider/use-block-editor-settings.js +1 -1
  278. package/src/components/sidebar/header.js +3 -2
  279. package/src/components/sidebar/index.js +5 -3
  280. package/src/components/time-to-read/index.js +3 -3
  281. package/src/components/visual-editor/index.js +32 -41
  282. package/src/components/visual-editor/use-zoom-out-mode-exit.js +49 -0
  283. package/src/components/zoom-out-toggle/index.js +39 -5
  284. package/src/dataviews/actions/duplicate-template-part.tsx +3 -3
  285. package/src/store/actions.js +5 -3
  286. package/src/store/private-actions.js +3 -3
  287. package/src/store/selectors.js +3 -2
  288. package/src/style.scss +1 -0
  289. package/src/utils/pageTypeBadge.js +41 -0
  290. package/src/utils/terms.js +4 -2
  291. package/src/utils/test/terms.js +3 -3
  292. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,264 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+ import { useSelect, useDispatch, resolveSelect } from '@wordpress/data';
6
+ import { useState, useEffect, useMemo } from '@wordpress/element';
7
+ import { comment as commentIcon } from '@wordpress/icons';
8
+ import { addFilter } from '@wordpress/hooks';
9
+ import { store as noticesStore } from '@wordpress/notices';
10
+ import { store as coreStore } from '@wordpress/core-data';
11
+ import { store as blockEditorStore } from '@wordpress/block-editor';
12
+ import { store as interfaceStore } from '@wordpress/interface';
13
+
14
+ /**
15
+ * Internal dependencies
16
+ */
17
+ import PluginSidebar from '../plugin-sidebar';
18
+ import { collabSidebarName } from './constants';
19
+ import { Comments } from './comments';
20
+ import { AddComment } from './add-comment';
21
+ import { store as editorStore } from '../../store';
22
+ import AddCommentButton from './comment-button';
23
+ import AddCommentToolbarButton from './comment-button-toolbar';
24
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
25
+ const threadsEmptyArray = [];
26
+ const isBlockCommentExperimentEnabled = window?.__experimentalEnableBlockComment;
27
+ const modifyBlockCommentAttributes = settings => {
28
+ if (!settings.attributes.blockCommentId) {
29
+ settings.attributes = {
30
+ ...settings.attributes,
31
+ blockCommentId: {
32
+ type: 'number'
33
+ }
34
+ };
35
+ }
36
+ return settings;
37
+ };
38
+
39
+ // Apply the filter to all core blocks
40
+ addFilter('blocks.registerBlockType', 'block-comment/modify-core-block-attributes', modifyBlockCommentAttributes);
41
+
42
+ /**
43
+ * Renders the Collab sidebar.
44
+ */
45
+ export default function CollabSidebar() {
46
+ const {
47
+ createNotice
48
+ } = useDispatch(noticesStore);
49
+ const {
50
+ saveEntityRecord,
51
+ deleteEntityRecord
52
+ } = useDispatch(coreStore);
53
+ const {
54
+ getEntityRecord
55
+ } = resolveSelect(coreStore);
56
+ const {
57
+ enableComplementaryArea
58
+ } = useDispatch(interfaceStore);
59
+ const [blockCommentID, setBlockCommentID] = useState(null);
60
+ const [showCommentBoard, setShowCommentBoard] = useState(false);
61
+ const {
62
+ postId
63
+ } = useSelect(select => {
64
+ return {
65
+ postId: select(editorStore).getCurrentPostId()
66
+ };
67
+ }, []);
68
+ const postStatus = useSelect(select => {
69
+ const post = select(editorStore).getCurrentPost();
70
+ return {
71
+ postStatus: post?.status
72
+ };
73
+ }, []);
74
+ const threads = useSelect(select => {
75
+ if (!postId) {
76
+ return threadsEmptyArray;
77
+ }
78
+ const {
79
+ getEntityRecords
80
+ } = select(coreStore);
81
+ const data = getEntityRecords('root', 'comment', {
82
+ post: postId,
83
+ type: 'block_comment',
84
+ status: 'any',
85
+ per_page: 100
86
+ });
87
+ return data || threadsEmptyArray;
88
+ }, [postId]);
89
+ const clientId = useSelect(select => {
90
+ const {
91
+ getSelectedBlockClientId
92
+ } = select(blockEditorStore);
93
+ return getSelectedBlockClientId();
94
+ }, []);
95
+ const blockDetails = useSelect(select => {
96
+ return clientId ? select(blockEditorStore).getBlock(clientId) : null;
97
+ }, [clientId]);
98
+
99
+ // Get the dispatch functions to save the comment and update the block attributes.
100
+ const {
101
+ updateBlockAttributes
102
+ } = useDispatch(blockEditorStore);
103
+
104
+ // Process comments to build the tree structure
105
+ const resultComments = useMemo(() => {
106
+ // Create a compare to store the references to all objects by id
107
+ const compare = {};
108
+ const result = [];
109
+ const filteredComments = threads.filter(comment => comment.status !== 'trash');
110
+
111
+ // Initialize each object with an empty `reply` array
112
+ filteredComments.forEach(item => {
113
+ compare[item.id] = {
114
+ ...item,
115
+ reply: []
116
+ };
117
+ });
118
+
119
+ // Iterate over the data to build the tree structure
120
+ filteredComments.forEach(item => {
121
+ if (item.parent === 0) {
122
+ // If parent is 0, it's a root item, push it to the result array
123
+ result.push(compare[item.id]);
124
+ } else if (compare[item.parent]) {
125
+ // Otherwise, find its parent and push it to the parent's `reply` array
126
+ compare[item.parent].reply.push(compare[item.id]);
127
+ }
128
+ });
129
+ return result;
130
+ }, [threads]);
131
+ const openCollabBoard = () => {
132
+ setShowCommentBoard(true);
133
+ enableComplementaryArea('core', 'edit-post/collab-sidebar');
134
+ };
135
+
136
+ // Function to save the comment.
137
+ const addNewComment = async (comment, parentCommentId) => {
138
+ const args = {
139
+ post: postId,
140
+ content: comment,
141
+ comment_type: 'block_comment',
142
+ comment_approved: 0
143
+ };
144
+
145
+ // Create a new object, conditionally including the parent property
146
+ const updatedArgs = {
147
+ ...args,
148
+ ...(parentCommentId ? {
149
+ parent: parentCommentId
150
+ } : {})
151
+ };
152
+ const savedRecord = await saveEntityRecord('root', 'comment', updatedArgs);
153
+ if (savedRecord) {
154
+ // If it's a main comment, update the block attributes with the comment id.
155
+ if (!parentCommentId) {
156
+ updateBlockAttributes(clientId, {
157
+ blockCommentId: savedRecord?.id
158
+ });
159
+ }
160
+ createNotice('snackbar', parentCommentId ?
161
+ // translators: Reply added successfully
162
+ __('Reply added successfully.') :
163
+ // translators: Comment added successfully
164
+ __('Comment added successfully.'), {
165
+ type: 'snackbar',
166
+ isDismissible: true
167
+ });
168
+ } else {
169
+ onError();
170
+ }
171
+ };
172
+ const onCommentResolve = async commentId => {
173
+ const savedRecord = await saveEntityRecord('root', 'comment', {
174
+ id: commentId,
175
+ status: 'approved'
176
+ });
177
+ if (savedRecord) {
178
+ // translators: Comment resolved successfully
179
+ createNotice('snackbar', __('Comment marked as resolved.'), {
180
+ type: 'snackbar',
181
+ isDismissible: true
182
+ });
183
+ } else {
184
+ onError();
185
+ }
186
+ };
187
+ const onEditComment = async (commentId, comment) => {
188
+ const savedRecord = await saveEntityRecord('root', 'comment', {
189
+ id: commentId,
190
+ content: comment
191
+ });
192
+ if (savedRecord) {
193
+ createNotice('snackbar',
194
+ // translators: Comment edited successfully
195
+ __('Comment edited successfully.'), {
196
+ type: 'snackbar',
197
+ isDismissible: true
198
+ });
199
+ } else {
200
+ onError();
201
+ }
202
+ };
203
+ const onError = () => {
204
+ createNotice('error',
205
+ // translators: Error message when comment submission fails
206
+ __('Something went wrong. Please try publishing the post, or you may have already submitted your comment earlier.'), {
207
+ isDismissible: true
208
+ });
209
+ };
210
+ const onCommentDelete = async commentId => {
211
+ const childComment = await getEntityRecord('root', 'comment', commentId);
212
+ await deleteEntityRecord('root', 'comment', commentId);
213
+ if (childComment && !childComment.parent) {
214
+ updateBlockAttributes(clientId, {
215
+ blockCommentId: undefined
216
+ });
217
+ }
218
+ createNotice('snackbar',
219
+ // translators: Comment deleted successfully
220
+ __('Comment deleted successfully.'), {
221
+ type: 'snackbar',
222
+ isDismissible: true
223
+ });
224
+ };
225
+ useEffect(() => {
226
+ if (blockDetails) {
227
+ setBlockCommentID(blockDetails?.attributes.blockCommentId);
228
+ }
229
+ }, [postId, clientId]);
230
+
231
+ // Check if the experimental flag is enabled.
232
+ if (!isBlockCommentExperimentEnabled || postStatus.postStatus === 'publish') {
233
+ return null; // or maybe return some message indicating no threads are available.
234
+ }
235
+ return /*#__PURE__*/_jsxs(_Fragment, {
236
+ children: [!blockCommentID && /*#__PURE__*/_jsx(AddCommentButton, {
237
+ onClick: openCollabBoard
238
+ }), blockCommentID > 0 && /*#__PURE__*/_jsx(AddCommentToolbarButton, {
239
+ onClick: openCollabBoard
240
+ }), /*#__PURE__*/_jsx(PluginSidebar, {
241
+ identifier: collabSidebarName
242
+ // translators: Comments sidebar title
243
+ ,
244
+ title: __('Comments'),
245
+ icon: commentIcon,
246
+ children: /*#__PURE__*/_jsxs("div", {
247
+ className: "editor-collab-sidebar-panel",
248
+ children: [/*#__PURE__*/_jsx(AddComment, {
249
+ threads: resultComments,
250
+ onSubmit: addNewComment,
251
+ showCommentBoard: showCommentBoard,
252
+ setShowCommentBoard: setShowCommentBoard
253
+ }), /*#__PURE__*/_jsx(Comments, {
254
+ threads: resultComments,
255
+ onEditComment: onEditComment,
256
+ onAddReply: addNewComment,
257
+ onCommentDelete: onCommentDelete,
258
+ onCommentResolve: onCommentResolve
259
+ })]
260
+ })
261
+ })]
262
+ });
263
+ }
264
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__","useSelect","useDispatch","resolveSelect","useState","useEffect","useMemo","comment","commentIcon","addFilter","store","noticesStore","coreStore","blockEditorStore","interfaceStore","PluginSidebar","collabSidebarName","Comments","AddComment","editorStore","AddCommentButton","AddCommentToolbarButton","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","threadsEmptyArray","isBlockCommentExperimentEnabled","window","__experimentalEnableBlockComment","modifyBlockCommentAttributes","settings","attributes","blockCommentId","type","CollabSidebar","createNotice","saveEntityRecord","deleteEntityRecord","getEntityRecord","enableComplementaryArea","blockCommentID","setBlockCommentID","showCommentBoard","setShowCommentBoard","postId","select","getCurrentPostId","postStatus","post","getCurrentPost","status","threads","getEntityRecords","data","per_page","clientId","getSelectedBlockClientId","blockDetails","getBlock","updateBlockAttributes","resultComments","compare","result","filteredComments","filter","forEach","item","id","reply","parent","push","openCollabBoard","addNewComment","parentCommentId","args","content","comment_type","comment_approved","updatedArgs","savedRecord","isDismissible","onError","onCommentResolve","commentId","onEditComment","onCommentDelete","childComment","undefined","children","onClick","identifier","title","icon","className","onSubmit","onAddReply"],"sources":["@wordpress/editor/src/components/collab-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch, resolveSelect } from '@wordpress/data';\nimport { useState, useEffect, useMemo } from '@wordpress/element';\nimport { comment as commentIcon } from '@wordpress/icons';\nimport { addFilter } from '@wordpress/hooks';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport PluginSidebar from '../plugin-sidebar';\nimport { collabSidebarName } from './constants';\nimport { Comments } from './comments';\nimport { AddComment } from './add-comment';\nimport { store as editorStore } from '../../store';\nimport AddCommentButton from './comment-button';\nimport AddCommentToolbarButton from './comment-button-toolbar';\n\nconst threadsEmptyArray = [];\n\nconst isBlockCommentExperimentEnabled =\n\twindow?.__experimentalEnableBlockComment;\nconst modifyBlockCommentAttributes = ( settings ) => {\n\tif ( ! settings.attributes.blockCommentId ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tblockCommentId: {\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n};\n\n// Apply the filter to all core blocks\naddFilter(\n\t'blocks.registerBlockType',\n\t'block-comment/modify-core-block-attributes',\n\tmodifyBlockCommentAttributes\n);\n\n/**\n * Renders the Collab sidebar.\n */\nexport default function CollabSidebar() {\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord, deleteEntityRecord } = useDispatch( coreStore );\n\tconst { getEntityRecord } = resolveSelect( coreStore );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst [ blockCommentID, setBlockCommentID ] = useState( null );\n\tconst [ showCommentBoard, setShowCommentBoard ] = useState( false );\n\tconst { postId } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostId: select( editorStore ).getCurrentPostId(),\n\t\t};\n\t}, [] );\n\n\tconst postStatus = useSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\treturn { postStatus: post?.status };\n\t}, [] );\n\n\tconst threads = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! postId ) {\n\t\t\t\treturn threadsEmptyArray;\n\t\t\t}\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\tconst data = getEntityRecords( 'root', 'comment', {\n\t\t\t\tpost: postId,\n\t\t\t\ttype: 'block_comment',\n\t\t\t\tstatus: 'any',\n\t\t\t\tper_page: 100,\n\t\t\t} );\n\t\t\treturn data || threadsEmptyArray;\n\t\t},\n\t\t[ postId ]\n\t);\n\n\tconst clientId = useSelect( ( select ) => {\n\t\tconst { getSelectedBlockClientId } = select( blockEditorStore );\n\t\treturn getSelectedBlockClientId();\n\t}, [] );\n\n\tconst blockDetails = useSelect(\n\t\t( select ) => {\n\t\t\treturn clientId\n\t\t\t\t? select( blockEditorStore ).getBlock( clientId )\n\t\t\t\t: null;\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Get the dispatch functions to save the comment and update the block attributes.\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\t// Process comments to build the tree structure\n\tconst resultComments = useMemo( () => {\n\t\t// Create a compare to store the references to all objects by id\n\t\tconst compare = {};\n\t\tconst result = [];\n\n\t\tconst filteredComments = threads.filter(\n\t\t\t( comment ) => comment.status !== 'trash'\n\t\t);\n\n\t\t// Initialize each object with an empty `reply` array\n\t\tfilteredComments.forEach( ( item ) => {\n\t\t\tcompare[ item.id ] = { ...item, reply: [] };\n\t\t} );\n\n\t\t// Iterate over the data to build the tree structure\n\t\tfilteredComments.forEach( ( item ) => {\n\t\t\tif ( item.parent === 0 ) {\n\t\t\t\t// If parent is 0, it's a root item, push it to the result array\n\t\t\t\tresult.push( compare[ item.id ] );\n\t\t\t} else if ( compare[ item.parent ] ) {\n\t\t\t\t// Otherwise, find its parent and push it to the parent's `reply` array\n\t\t\t\tcompare[ item.parent ].reply.push( compare[ item.id ] );\n\t\t\t}\n\t\t} );\n\n\t\treturn result;\n\t}, [ threads ] );\n\n\tconst openCollabBoard = () => {\n\t\tsetShowCommentBoard( true );\n\t\tenableComplementaryArea( 'core', 'edit-post/collab-sidebar' );\n\t};\n\n\t// Function to save the comment.\n\tconst addNewComment = async ( comment, parentCommentId ) => {\n\t\tconst args = {\n\t\t\tpost: postId,\n\t\t\tcontent: comment,\n\t\t\tcomment_type: 'block_comment',\n\t\t\tcomment_approved: 0,\n\t\t};\n\n\t\t// Create a new object, conditionally including the parent property\n\t\tconst updatedArgs = {\n\t\t\t...args,\n\t\t\t...( parentCommentId ? { parent: parentCommentId } : {} ),\n\t\t};\n\n\t\tconst savedRecord = await saveEntityRecord(\n\t\t\t'root',\n\t\t\t'comment',\n\t\t\tupdatedArgs\n\t\t);\n\n\t\tif ( savedRecord ) {\n\t\t\t// If it's a main comment, update the block attributes with the comment id.\n\t\t\tif ( ! parentCommentId ) {\n\t\t\t\tupdateBlockAttributes( clientId, {\n\t\t\t\t\tblockCommentId: savedRecord?.id,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tcreateNotice(\n\t\t\t\t'snackbar',\n\t\t\t\tparentCommentId\n\t\t\t\t\t? // translators: Reply added successfully\n\t\t\t\t\t __( 'Reply added successfully.' )\n\t\t\t\t\t: // translators: Comment added successfully\n\t\t\t\t\t __( 'Comment added successfully.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tisDismissible: true,\n\t\t\t\t}\n\t\t\t);\n\t\t} else {\n\t\t\tonError();\n\t\t}\n\t};\n\n\tconst onCommentResolve = async ( commentId ) => {\n\t\tconst savedRecord = await saveEntityRecord( 'root', 'comment', {\n\t\t\tid: commentId,\n\t\t\tstatus: 'approved',\n\t\t} );\n\n\t\tif ( savedRecord ) {\n\t\t\t// translators: Comment resolved successfully\n\t\t\tcreateNotice( 'snackbar', __( 'Comment marked as resolved.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tisDismissible: true,\n\t\t\t} );\n\t\t} else {\n\t\t\tonError();\n\t\t}\n\t};\n\n\tconst onEditComment = async ( commentId, comment ) => {\n\t\tconst savedRecord = await saveEntityRecord( 'root', 'comment', {\n\t\t\tid: commentId,\n\t\t\tcontent: comment,\n\t\t} );\n\n\t\tif ( savedRecord ) {\n\t\t\tcreateNotice(\n\t\t\t\t'snackbar',\n\t\t\t\t// translators: Comment edited successfully\n\t\t\t\t__( 'Comment edited successfully.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tisDismissible: true,\n\t\t\t\t}\n\t\t\t);\n\t\t} else {\n\t\t\tonError();\n\t\t}\n\t};\n\n\tconst onError = () => {\n\t\tcreateNotice(\n\t\t\t'error',\n\t\t\t// translators: Error message when comment submission fails\n\t\t\t__(\n\t\t\t\t'Something went wrong. Please try publishing the post, or you may have already submitted your comment earlier.'\n\t\t\t),\n\t\t\t{\n\t\t\t\tisDismissible: true,\n\t\t\t}\n\t\t);\n\t};\n\n\tconst onCommentDelete = async ( commentId ) => {\n\t\tconst childComment = await getEntityRecord(\n\t\t\t'root',\n\t\t\t'comment',\n\t\t\tcommentId\n\t\t);\n\t\tawait deleteEntityRecord( 'root', 'comment', commentId );\n\n\t\tif ( childComment && ! childComment.parent ) {\n\t\t\tupdateBlockAttributes( clientId, {\n\t\t\t\tblockCommentId: undefined,\n\t\t\t} );\n\t\t}\n\n\t\tcreateNotice(\n\t\t\t'snackbar',\n\t\t\t// translators: Comment deleted successfully\n\t\t\t__( 'Comment deleted successfully.' ),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tisDismissible: true,\n\t\t\t}\n\t\t);\n\t};\n\n\tuseEffect( () => {\n\t\tif ( blockDetails ) {\n\t\t\tsetBlockCommentID( blockDetails?.attributes.blockCommentId );\n\t\t}\n\t}, [ postId, clientId ] );\n\n\t// Check if the experimental flag is enabled.\n\tif (\n\t\t! isBlockCommentExperimentEnabled ||\n\t\tpostStatus.postStatus === 'publish'\n\t) {\n\t\treturn null; // or maybe return some message indicating no threads are available.\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ ! blockCommentID && (\n\t\t\t\t<AddCommentButton onClick={ openCollabBoard } />\n\t\t\t) }\n\n\t\t\t{ blockCommentID > 0 && (\n\t\t\t\t<AddCommentToolbarButton onClick={ openCollabBoard } />\n\t\t\t) }\n\t\t\t<PluginSidebar\n\t\t\t\tidentifier={ collabSidebarName }\n\t\t\t\t// translators: Comments sidebar title\n\t\t\t\ttitle={ __( 'Comments' ) }\n\t\t\t\ticon={ commentIcon }\n\t\t\t>\n\t\t\t\t<div className=\"editor-collab-sidebar-panel\">\n\t\t\t\t\t<AddComment\n\t\t\t\t\t\tthreads={ resultComments }\n\t\t\t\t\t\tonSubmit={ addNewComment }\n\t\t\t\t\t\tshowCommentBoard={ showCommentBoard }\n\t\t\t\t\t\tsetShowCommentBoard={ setShowCommentBoard }\n\t\t\t\t\t/>\n\t\t\t\t\t<Comments\n\t\t\t\t\t\tthreads={ resultComments }\n\t\t\t\t\t\tonEditComment={ onEditComment }\n\t\t\t\t\t\tonAddReply={ addNewComment }\n\t\t\t\t\t\tonCommentDelete={ onCommentDelete }\n\t\t\t\t\t\tonCommentResolve={ onCommentResolve }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</PluginSidebar>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAAEC,WAAW,EAAEC,aAAa,QAAQ,iBAAiB;AACvE,SAASC,QAAQ,EAAEC,SAAS,EAAEC,OAAO,QAAQ,oBAAoB;AACjE,SAASC,OAAO,IAAIC,WAAW,QAAQ,kBAAkB;AACzD,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,KAAK,IAAIC,YAAY,QAAQ,oBAAoB;AAC1D,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;AACzD,SAASF,KAAK,IAAIG,gBAAgB,QAAQ,yBAAyB;AACnE,SAASH,KAAK,IAAII,cAAc,QAAQ,sBAAsB;;AAE9D;AACA;AACA;AACA,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,QAAQ,QAAQ,YAAY;AACrC,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASR,KAAK,IAAIS,WAAW,QAAQ,aAAa;AAClD,OAAOC,gBAAgB,MAAM,kBAAkB;AAC/C,OAAOC,uBAAuB,MAAM,0BAA0B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAA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EAAG9F,EAAE,CAAE,UAAW,CAAG;MAC1B+F,IAAI,EAAGvF,WAAa;MAAAmF,QAAA,eAEpBlE,KAAA;QAAKuE,SAAS,EAAC,6BAA6B;QAAAL,QAAA,gBAC3CpE,IAAA,CAACL,UAAU;UACVoC,OAAO,EAAGS,cAAgB;UAC1BkC,QAAQ,EAAGtB,aAAe;UAC1B9B,gBAAgB,EAAGA,gBAAkB;UACrCC,mBAAmB,EAAGA;QAAqB,CAC3C,CAAC,eACFvB,IAAA,CAACN,QAAQ;UACRqC,OAAO,EAAGS,cAAgB;UAC1BwB,aAAa,EAAGA,aAAe;UAC/BW,UAAU,EAAGvB,aAAe;UAC5Ba,eAAe,EAAGA,eAAiB;UACnCH,gBAAgB,EAAGA;QAAkB,CACrC,CAAC;MAAA,CACE;IAAC,CACQ,CAAC;EAAA,CACf,CAAC;AAEL","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Sanitizes a comment string by removing non-printable ASCII characters.
3
+ *
4
+ * @param {string} str - The comment string to sanitize.
5
+ * @return {string} - The sanitized comment string.
6
+ */
7
+ export function sanitizeCommentString(str) {
8
+ return str.trim();
9
+ }
10
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["sanitizeCommentString","str","trim"],"sources":["@wordpress/editor/src/components/collab-sidebar/utils.js"],"sourcesContent":["/**\n * Sanitizes a comment string by removing non-printable ASCII characters.\n *\n * @param {string} str - The comment string to sanitize.\n * @return {string} - The sanitized comment string.\n */\nexport function sanitizeCommentString( str ) {\n\treturn str.trim();\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,qBAAqBA,CAAEC,GAAG,EAAG;EAC5C,OAAOA,GAAG,CAACC,IAAI,CAAC,CAAC;AAClB","ignoreList":[]}
@@ -54,7 +54,7 @@ function useEditorCommandLoader() {
54
54
  isDistractionFree: get('core', 'distractionFree'),
55
55
  isFocusMode: get('core', 'focusMode'),
56
56
  isTopToolbar: get('core', 'fixedToolbar'),
57
- isPreviewMode: getSettings().__unstableIsPreviewMode,
57
+ isPreviewMode: getSettings().isPreviewMode,
58
58
  isViewable: (_getPostType$viewable = getPostType(getCurrentPostType())?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false,
59
59
  isCodeEditingEnabled: getEditorSettings().codeEditingEnabled,
60
60
  isRichEditingEnabled: getEditorSettings().richEditingEnabled,
@@ -105,7 +105,7 @@ function useEditorCommandLoader() {
105
105
  });
106
106
  commands.push({
107
107
  name: 'core/toggle-distraction-free',
108
- label: isDistractionFree ? __('Exit Distraction Free') : __('Enter Distraction Free'),
108
+ label: isDistractionFree ? __('Exit Distraction free') : __('Enter Distraction free'),
109
109
  callback: ({
110
110
  close
111
111
  }) => {
@@ -125,7 +125,7 @@ function useEditorCommandLoader() {
125
125
  });
126
126
  commands.push({
127
127
  name: 'core/toggle-spotlight-mode',
128
- label: __('Toggle spotlight'),
128
+ label: isFocusMode ? __('Exit Spotlight mode') : __('Enter Spotlight mode'),
129
129
  callback: ({
130
130
  close
131
131
  }) => {
@@ -160,7 +160,7 @@ function useEditorCommandLoader() {
160
160
  });
161
161
  commands.push({
162
162
  name: 'core/toggle-top-toolbar',
163
- label: __('Toggle top toolbar'),
163
+ label: __('Top toolbar'),
164
164
  callback: ({
165
165
  close
166
166
  }) => {
@@ -210,7 +210,7 @@ function useEditorCommandLoader() {
210
210
  });
211
211
  commands.push({
212
212
  name: 'core/open-settings-sidebar',
213
- label: __('Toggle settings sidebar'),
213
+ label: __('Show or hide the Settings panel.'),
214
214
  icon: isRTL() ? drawerLeft : drawerRight,
215
215
  callback: ({
216
216
  close
@@ -226,7 +226,7 @@ function useEditorCommandLoader() {
226
226
  });
227
227
  commands.push({
228
228
  name: 'core/open-block-inspector',
229
- label: __('Toggle block inspector'),
229
+ label: __('Show or hide the Block settings panel'),
230
230
  icon: blockDefault,
231
231
  callback: ({
232
232
  close
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","__","isRTL","blockDefault","code","drawerLeft","drawerRight","edit","formatListBullets","listView","external","keyboard","symbol","useCommandLoader","store","preferencesStore","noticesStore","blockEditorStore","coreStore","interfaceStore","editorStore","PATTERN_POST_TYPE","modalName","patternRenameModalName","patternDuplicateModalName","useEditorCommandLoader","editorMode","isListViewOpen","showBlockBreadcrumbs","isDistractionFree","isTopToolbar","isFocusMode","isPreviewMode","isViewable","isCodeEditingEnabled","isRichEditingEnabled","isPublishSidebarEnabled","select","_get","_getPostType$viewable","get","isListViewOpened","getCurrentPostType","getEditorSettings","getSettings","getPostType","__unstableIsPreviewMode","viewable","codeEditingEnabled","richEditingEnabled","getActiveComplementaryArea","toggle","createInfoNotice","__unstableSaveForPreview","setIsListViewOpened","switchEditorMode","toggleDistractionFree","openModal","enableComplementaryArea","disableComplementaryArea","getCurrentPostId","allowSwitchEditorMode","commands","isLoading","push","name","label","icon","callback","close","id","type","actions","onClick","activeSidebar","postId","link","window","open","useEditedEntityContextualCommands","postType","useCommands","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":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SACCC,YAAY,EACZC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,IAAI,EACJC,iBAAiB,EACjBC,QAAQ,EACRC,QAAQ,EACRC,QAAQ,EACRC,MAAM,QACA,kBAAkB;AACzB,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;AAClE,SAASD,KAAK,IAAIE,YAAY,QAAQ,oBAAoB;AAC1D,SAASF,KAAK,IAAIG,gBAAgB,QAAQ,yBAAyB;AACnE,SAASH,KAAK,IAAII,SAAS,QAAQ,sBAAsB;AACzD,SAASJ,KAAK,IAAIK,cAAc,QAAQ,sBAAsB;;AAE9D;AACA;AACA;AACA,SAASL,KAAK,IAAIM,WAAW,QAAQ,aAAa;AAClD,SAASC,iBAAiB,QAAQ,uBAAuB;AACzD,SAASC,SAAS,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC7E,SAASD,SAAS,IAAIE,yBAAyB,QAAQ,4BAA4B;AAEnF,SAASC,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,GAAGrC,SAAS,CAAIsC,MAA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;IACpD,OAAO;MACN4D,QAAQ,EAAEtC,kBAAkB,CAAC;IAC9B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAM;IAAEe;EAAU,CAAC,GAAGzD,WAAW,CAAEmB,cAAe,CAAC;EACnD,MAAM2C,QAAQ,GAAG,EAAE;EAEnB,IAAKkB,QAAQ,KAAK3D,iBAAiB,EAAG;IACrCyC,QAAQ,CAACE,IAAI,CAAE;MACdC,IAAI,EAAE,qBAAqB;MAC3BC,KAAK,EAAEjE,EAAE,CAAE,gBAAiB,CAAC;MAC7BkE,IAAI,EAAE5D,IAAI;MACV6D,QAAQ,EAAEA,CAAE;QAAEC;MAAM,CAAC,KAAM;QAC1BZ,SAAS,CAAElC,sBAAuB,CAAC;QACnC8C,KAAK,CAAC,CAAC;MACR;IACD,CAAE,CAAC;IACHP,QAAQ,CAACE,IAAI,CAAE;MACdC,IAAI,EAAE,wBAAwB;MAC9BC,KAAK,EAAEjE,EAAE,CAAE,mBAAoB,CAAC;MAChCkE,IAAI,EAAEvD,MAAM;MACZwD,QAAQ,EAAEA,CAAE;QAAEC;MAAM,CAAC,KAAM;QAC1BZ,SAAS,CAAEjC,yBAA0B,CAAC;QACtC6C,KAAK,CAAC,CAAC;MACR;IACD,CAAE,CAAC;EACJ;EAEA,OAAO;IAAEN,SAAS,EAAE,KAAK;IAAED;EAAS,CAAC;AACtC;AAEA,eAAe,SAASmB,WAAWA,CAAA,EAAG;EACrCpE,gBAAgB,CAAE;IACjBoD,IAAI,EAAE,qBAAqB;IAC3BiB,IAAI,EAAEzD;EACP,CAAE,CAAC;EAEHZ,gBAAgB,CAAE;IACjBoD,IAAI,EAAE,iCAAiC;IACvCiB,IAAI,EAAEH,iCAAiC;IACvCI,OAAO,EAAE;EACV,CAAE,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","useDispatch","__","isRTL","blockDefault","code","drawerLeft","drawerRight","edit","formatListBullets","listView","external","keyboard","symbol","useCommandLoader","store","preferencesStore","noticesStore","blockEditorStore","coreStore","interfaceStore","editorStore","PATTERN_POST_TYPE","modalName","patternRenameModalName","patternDuplicateModalName","useEditorCommandLoader","editorMode","isListViewOpen","showBlockBreadcrumbs","isDistractionFree","isTopToolbar","isFocusMode","isPreviewMode","isViewable","isCodeEditingEnabled","isRichEditingEnabled","isPublishSidebarEnabled","select","_get","_getPostType$viewable","get","isListViewOpened","getCurrentPostType","getEditorSettings","getSettings","getPostType","viewable","codeEditingEnabled","richEditingEnabled","getActiveComplementaryArea","toggle","createInfoNotice","__unstableSaveForPreview","setIsListViewOpened","switchEditorMode","toggleDistractionFree","openModal","enableComplementaryArea","disableComplementaryArea","getCurrentPostId","allowSwitchEditorMode","commands","isLoading","push","name","label","icon","callback","close","id","type","actions","onClick","activeSidebar","postId","link","window","open","useEditedEntityContextualCommands","postType","useCommands","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().isPreviewMode,\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: isFocusMode\n\t\t\t? __( 'Exit Spotlight mode' )\n\t\t\t: __( 'Enter Spotlight mode' ),\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: __( '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: __( 'Show or hide the Settings panel.' ),\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: __( 'Show or hide the Block settings panel' ),\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":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SACCC,YAAY,EACZC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,IAAI,EACJC,iBAAiB,EACjBC,QAAQ,EACRC,QAAQ,EACRC,QAAQ,EACRC,MAAM,QACA,kBAAkB;AACzB,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;AAClE,SAASD,KAAK,IAAIE,YAAY,QAAQ,oBAAoB;AAC1D,SAASF,KAAK,IAAIG,gBAAgB,QAAQ,yBAAyB;AACnE,SAASH,KAAK,IAAII,SAAS,QAAQ,sBAAsB;AACzD,SAASJ,KAAK,IAAIK,cAAc,QAAQ,sBAAsB;;AAE9D;AACA;AACA;AACA,SAASL,KAAK,IAAIM,WAAW,QAAQ,aAAa;AAClD,SAASC,iBAAiB,QAAQ,uBAAuB;AACzD,SAASC,SAAS,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC7E,SAASD,SAAS,IAAIE,yBAAyB,QAAQ,4BAA4B;AAEnF,SAASC,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,GAAGrC,SAAS,CAAIsC,MAAM,IAAM;IAAA,IAAAC,IAAA,EAAAC,qBAAA;IAC5B,MAAM;MAAEC;IAA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D,QAAQ,EAAErC,kBAAkB,CAAC;IAC9B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAM;IAAEc;EAAU,CAAC,GAAGxD,WAAW,CAAEmB,cAAe,CAAC;EACnD,MAAM0C,QAAQ,GAAG,EAAE;EAEnB,IAAKkB,QAAQ,KAAK1D,iBAAiB,EAAG;IACrCwC,QAAQ,CAACE,IAAI,CAAE;MACdC,IAAI,EAAE,qBAAqB;MAC3BC,KAAK,EAAEhE,EAAE,CAAE,gBAAiB,CAAC;MAC7BiE,IAAI,EAAE3D,IAAI;MACV4D,QAAQ,EAAEA,CAAE;QAAEC;MAAM,CAAC,KAAM;QAC1BZ,SAAS,CAAEjC,sBAAuB,CAAC;QACnC6C,KAAK,CAAC,CAAC;MACR;IACD,CAAE,CAAC;IACHP,QAAQ,CAACE,IAAI,CAAE;MACdC,IAAI,EAAE,wBAAwB;MAC9BC,KAAK,EAAEhE,EAAE,CAAE,mBAAoB,CAAC;MAChCiE,IAAI,EAAEtD,MAAM;MACZuD,QAAQ,EAAEA,CAAE;QAAEC;MAAM,CAAC,KAAM;QAC1BZ,SAAS,CAAEhC,yBAA0B,CAAC;QACtC4C,KAAK,CAAC,CAAC;MACR;IACD,CAAE,CAAC;EACJ;EAEA,OAAO;IAAEN,SAAS,EAAE,KAAK;IAAED;EAAS,CAAC;AACtC;AAEA,eAAe,SAASmB,WAAWA,CAAA,EAAG;EACrCnE,gBAAgB,CAAE;IACjBmD,IAAI,EAAE,qBAAqB;IAC3BiB,IAAI,EAAExD;EACP,CAAE,CAAC;EAEHZ,gBAAgB,CAAE;IACjBmD,IAAI,EAAE,iCAAiC;IACvCiB,IAAI,EAAEH,iCAAiC;IACvCI,OAAO,EAAE;EACV,CAAE,CAAC;AACJ","ignoreList":[]}
@@ -21,8 +21,9 @@ import { decodeEntities } from '@wordpress/html-entities';
21
21
  /**
22
22
  * Internal dependencies
23
23
  */
24
- import { TEMPLATE_POST_TYPES, GLOBAL_POST_TYPES } from '../../store/constants';
24
+ import { TEMPLATE_POST_TYPES } from '../../store/constants';
25
25
  import { store as editorStore } from '../../store';
26
+ import usePageTypeBadge from '../../utils/pageTypeBadge';
26
27
 
27
28
  /** @typedef {import("@wordpress/components").IconType} IconType */
28
29
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -51,7 +52,6 @@ export default function DocumentBar(props) {
51
52
  postTypeLabel,
52
53
  documentTitle,
53
54
  isNotFound,
54
- isUnsyncedPattern,
55
55
  templateTitle,
56
56
  onNavigateToPreviousEntityRecord
57
57
  } = useSelect(select => {
@@ -76,7 +76,6 @@ export default function DocumentBar(props) {
76
76
  postTypeLabel: _postTypeLabel,
77
77
  documentTitle: _document.title,
78
78
  isNotFound: !_document && !isResolvingSelector('getEditedEntityRecord', 'postType', _postType, _postId),
79
- isUnsyncedPattern: _document?.wp_pattern_sync_status === 'unsynced',
80
79
  templateTitle: _templateInfo.title,
81
80
  onNavigateToPreviousEntityRecord: getEditorSettings().onNavigateToPreviousEntityRecord
82
81
  };
@@ -86,19 +85,18 @@ export default function DocumentBar(props) {
86
85
  } = useDispatch(commandsStore);
87
86
  const isReducedMotion = useReducedMotion();
88
87
  const isTemplate = TEMPLATE_POST_TYPES.includes(postType);
89
- const isGlobalEntity = GLOBAL_POST_TYPES.includes(postType);
90
88
  const hasBackButton = !!onNavigateToPreviousEntityRecord;
91
89
  const entityTitle = isTemplate ? templateTitle : documentTitle;
92
90
  const title = props.title || entityTitle;
93
91
  const icon = props.icon;
92
+ const pageTypeBadge = usePageTypeBadge();
94
93
  const mountedRef = useRef(false);
95
94
  useEffect(() => {
96
95
  mountedRef.current = true;
97
96
  }, []);
98
97
  return /*#__PURE__*/_jsxs("div", {
99
98
  className: clsx('editor-document-bar', {
100
- 'has-back-button': hasBackButton,
101
- 'is-global': isGlobalEntity && !isUnsyncedPattern
99
+ 'has-back-button': hasBackButton
102
100
  }),
103
101
  children: [/*#__PURE__*/_jsx(AnimatePresence, {
104
102
  children: hasBackButton && /*#__PURE__*/_jsx(MotionButton, {
@@ -158,9 +156,12 @@ export default function DocumentBar(props) {
158
156
  children: [/*#__PURE__*/_jsx("span", {
159
157
  className: "editor-document-bar__post-title",
160
158
  children: title ? decodeEntities(title) : __('No title')
161
- }), postTypeLabel && !props.title && /*#__PURE__*/_jsx("span", {
159
+ }), pageTypeBadge && /*#__PURE__*/_jsx("span", {
162
160
  className: "editor-document-bar__post-type-label",
163
- children: ' + decodeEntities(postTypeLabel)
161
+ children: ${pageTypeBadge}`
162
+ }), postTypeLabel && !props.title && !pageTypeBadge && /*#__PURE__*/_jsx("span", {
163
+ className: "editor-document-bar__post-type-label",
164
+ children: `· ${decodeEntities(postTypeLabel)}`
164
165
  })]
165
166
  })]
166
167
  }, hasBackButton), /*#__PURE__*/_jsx("span", {
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","__","isRTL","useSelect","useDispatch","Button","__experimentalText","Text","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","BlockIcon","chevronLeftSmall","chevronRightSmall","displayShortcut","store","coreStore","commandsStore","useRef","useEffect","useReducedMotion","decodeEntities","TEMPLATE_POST_TYPES","GLOBAL_POST_TYPES","editorStore","jsx","_jsx","jsxs","_jsxs","MotionButton","DocumentBar","props","postType","postTypeLabel","documentTitle","isNotFound","isUnsyncedPattern","templateTitle","onNavigateToPreviousEntityRecord","select","getCurrentPostType","getCurrentPostId","getEditorSettings","__experimentalGetTemplateInfo","getTemplateInfo","getEditedEntityRecord","getPostType","isResolving","isResolvingSelector","_postType","_postId","_document","_templateInfo","_postTypeLabel","labels","singular_name","title","wp_pattern_sync_status","open","openCommandCenter","isReducedMotion","isTemplate","includes","isGlobalEntity","hasBackButton","entityTitle","icon","mountedRef","current","className","children","onClick","event","stopPropagation","size","initial","opacity","transform","animate","exit","transition","duration","undefined","div","as","primary"],"sources":["@wordpress/editor/src/components/document-bar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { chevronLeftSmall, chevronRightSmall } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as commandsStore } from '@wordpress/commands';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPES, GLOBAL_POST_TYPES } from '../../store/constants';\nimport { store as editorStore } from '../../store';\n\n/** @typedef {import(\"@wordpress/components\").IconType} IconType */\n\nconst MotionButton = motion( Button );\n\n/**\n * This component renders a navigation bar at the top of the editor. It displays the title of the current document,\n * a back button (if applicable), and a command center button. It also handles different states of the document,\n * such as \"not found\" or \"unsynced\".\n *\n * @example\n * ```jsx\n * <DocumentBar />\n * ```\n * @param {Object} props The component props.\n * @param {string} props.title A title for the document, defaulting to the document or\n * template title currently being edited.\n * @param {IconType} props.icon An icon for the document, no default.\n * (A default icon indicating the document post type is no longer used.)\n *\n * @return {JSX.Element} The rendered DocumentBar component.\n */\nexport default function DocumentBar( props ) {\n\tconst {\n\t\tpostType,\n\t\tpostTypeLabel,\n\t\tdocumentTitle,\n\t\tisNotFound,\n\t\tisUnsyncedPattern,\n\t\ttemplateTitle,\n\t\tonNavigateToPreviousEntityRecord,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t\tgetEditorSettings,\n\t\t\t__experimentalGetTemplateInfo: getTemplateInfo,\n\t\t} = select( editorStore );\n\t\tconst {\n\t\t\tgetEditedEntityRecord,\n\t\t\tgetPostType,\n\t\t\tisResolving: isResolvingSelector,\n\t\t} = select( coreStore );\n\t\tconst _postType = getCurrentPostType();\n\t\tconst _postId = getCurrentPostId();\n\t\tconst _document = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t_postType,\n\t\t\t_postId\n\t\t);\n\t\tconst _templateInfo = getTemplateInfo( _document );\n\t\tconst _postTypeLabel = getPostType( _postType )?.labels?.singular_name;\n\n\t\treturn {\n\t\t\tpostType: _postType,\n\t\t\tpostTypeLabel: _postTypeLabel,\n\t\t\tdocumentTitle: _document.title,\n\t\t\tisNotFound:\n\t\t\t\t! _document &&\n\t\t\t\t! isResolvingSelector(\n\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\t'postType',\n\t\t\t\t\t_postType,\n\t\t\t\t\t_postId\n\t\t\t\t),\n\t\t\tisUnsyncedPattern: _document?.wp_pattern_sync_status === 'unsynced',\n\t\t\ttemplateTitle: _templateInfo.title,\n\t\t\tonNavigateToPreviousEntityRecord:\n\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t};\n\t}, [] );\n\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\tconst isReducedMotion = useReducedMotion();\n\n\tconst isTemplate = TEMPLATE_POST_TYPES.includes( postType );\n\tconst isGlobalEntity = GLOBAL_POST_TYPES.includes( postType );\n\tconst hasBackButton = !! onNavigateToPreviousEntityRecord;\n\tconst entityTitle = isTemplate ? templateTitle : documentTitle;\n\tconst title = props.title || entityTitle;\n\tconst icon = props.icon;\n\n\tconst mountedRef = useRef( false );\n\tuseEffect( () => {\n\t\tmountedRef.current = true;\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'editor-document-bar', {\n\t\t\t\t'has-back-button': hasBackButton,\n\t\t\t\t'is-global': isGlobalEntity && ! isUnsyncedPattern,\n\t\t\t} ) }\n\t\t>\n\t\t\t<AnimatePresence>\n\t\t\t\t{ hasBackButton && (\n\t\t\t\t\t<MotionButton\n\t\t\t\t\t\tclassName=\"editor-document-bar__back\"\n\t\t\t\t\t\ticon={ isRTL() ? chevronRightSmall : chevronLeftSmall }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\tonNavigateToPreviousEntityRecord();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmountedRef.current\n\t\t\t\t\t\t\t\t? { opacity: 0, transform: 'translateX(15%)' }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ { opacity: 1, transform: 'translateX(0%)' } }\n\t\t\t\t\t\texit={ { opacity: 0, transform: 'translateX(15%)' } }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</MotionButton>\n\t\t\t\t) }\n\t\t\t</AnimatePresence>\n\t\t\t{ isNotFound ? (\n\t\t\t\t<Text>{ __( 'Document not found' ) }</Text>\n\t\t\t) : (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"editor-document-bar__command\"\n\t\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName=\"editor-document-bar__title\"\n\t\t\t\t\t\t// Force entry animation when the back button is added or removed.\n\t\t\t\t\t\tkey={ hasBackButton }\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmountedRef.current\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\t\t\ttransform: hasBackButton\n\t\t\t\t\t\t\t\t\t\t\t? 'translateX(15%)'\n\t\t\t\t\t\t\t\t\t\t\t: 'translateX(-15%)',\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\ttransform: 'translateX(0%)',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ icon && <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\t<Text size=\"body\" as=\"h1\">\n\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-title\">\n\t\t\t\t\t\t\t\t{ title\n\t\t\t\t\t\t\t\t\t? decodeEntities( title )\n\t\t\t\t\t\t\t\t\t: __( 'No title' ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t{ postTypeLabel && ! props.title && (\n\t\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-type-label\">\n\t\t\t\t\t\t\t\t\t{ '· ' + decodeEntities( postTypeLabel ) }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</motion.div>\n\t\t\t\t\t<span className=\"editor-document-bar__shortcut\">\n\t\t\t\t\t\t{ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t</span>\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,MAAM,EACNC,kBAAkB,IAAIC,IAAI,EAC1BC,gBAAgB,IAAIC,MAAM,EAC1BC,yBAAyB,IAAIC,eAAe,QACtC,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,yB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CAAC;UACVC,SAAS,EAAEb,aAAa,GACrB,iBAAiB,GACjB;QACH,CAAC,GACD,KAAK,CAAC;QACT;QACDc,OAAO,EAAG;UACTF,OAAO,EAAE,CAAC;UACVC,SAAS,EAAE;QACZ,CAAG;QACHG,UAAU,EACTpB,eAAe,GAAG;UAAEqB,QAAQ,EAAE;QAAE,CAAC,GAAGC,SACpC;QAAAZ,QAAA,GAECJ,IAAI,iBAAIxC,IAAA,CAACf,SAAS;UAACuD,IAAI,EAAGA;QAAM,CAAE,CAAC,eACrCtC,KAAA,CAACtB,IAAI;UAACoE,IAAI,EAAC,MAAM;UAACU,EAAE,EAAC,IAAI;UAAAd,QAAA,gBACxB5C,IAAA;YAAM2C,SAAS,EAAC,iCAAiC;YAAAC,QAAA,EAC9Cd,KAAK,GACJnC,cAAc,CAAEmC,KAAM,CAAC,GACvBxD,EAAE,CAAE,UAAW;UAAC,CACd,CAAC,EACLiC,aAAa,IAAI,CAAEF,KAAK,CAACyB,KAAK,iBAC/B9B,IAAA;YAAM2C,SAAS,EAAC,sCAAsC;YAAAC,QAAA,EACnD,IAAI,GAAGjD,cAAc,CAAEY,aAAc;UAAC,CACnC,CACN;QAAA,CACI,CAAC;MAAA,GA/BD+B,aAgCK,CAAC,eACbtC,IAAA;QAAM2C,SAAS,EAAC,+BAA+B;QAAAC,QAAA,EAC5CxD,eAAe,CAACuE,OAAO,CAAE,GAAI;MAAC,CAC3B,CAAC;IAAA,CACA,CACR;EAAA,CACG,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["clsx","__","isRTL","useSelect","useDispatch","Button","__experimentalText","Text","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","BlockIcon","chevronLeftSmall","chevronRightSmall","displayShortcut","store","coreStore","commandsStore","useRef","useEffect","useReducedMotion","decodeEntities","TEMPLATE_POST_TYPES","editorStore","usePageTypeBadge","jsx","_jsx","jsxs","_jsxs","MotionButton","DocumentBar","props","postType","postTypeLabel","documentTitle","isNotFound","templateTitle","onNavigateToPreviousEntityRecord","select","getCurrentPostType","getCurrentPostId","getEditorSettings","__experimentalGetTemplateInfo","getTemplateInfo","getEditedEntityRecord","getPostType","isResolving","isResolvingSelector","_postType","_postId","_document","_templateInfo","_postTypeLabel","labels","singular_name","title","open","openCommandCenter","isReducedMotion","isTemplate","includes","hasBackButton","entityTitle","icon","pageTypeBadge","mountedRef","current","className","children","onClick","event","stopPropagation","size","initial","opacity","transform","animate","exit","transition","duration","undefined","div","as","primary"],"sources":["@wordpress/editor/src/components/document-bar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { chevronLeftSmall, chevronRightSmall } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as commandsStore } from '@wordpress/commands';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPES } from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport usePageTypeBadge from '../../utils/pageTypeBadge';\n\n/** @typedef {import(\"@wordpress/components\").IconType} IconType */\n\nconst MotionButton = motion( Button );\n\n/**\n * This component renders a navigation bar at the top of the editor. It displays the title of the current document,\n * a back button (if applicable), and a command center button. It also handles different states of the document,\n * such as \"not found\" or \"unsynced\".\n *\n * @example\n * ```jsx\n * <DocumentBar />\n * ```\n * @param {Object} props The component props.\n * @param {string} props.title A title for the document, defaulting to the document or\n * template title currently being edited.\n * @param {IconType} props.icon An icon for the document, no default.\n * (A default icon indicating the document post type is no longer used.)\n *\n * @return {JSX.Element} The rendered DocumentBar component.\n */\nexport default function DocumentBar( props ) {\n\tconst {\n\t\tpostType,\n\t\tpostTypeLabel,\n\t\tdocumentTitle,\n\t\tisNotFound,\n\t\ttemplateTitle,\n\t\tonNavigateToPreviousEntityRecord,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t\tgetEditorSettings,\n\t\t\t__experimentalGetTemplateInfo: getTemplateInfo,\n\t\t} = select( editorStore );\n\t\tconst {\n\t\t\tgetEditedEntityRecord,\n\t\t\tgetPostType,\n\t\t\tisResolving: isResolvingSelector,\n\t\t} = select( coreStore );\n\t\tconst _postType = getCurrentPostType();\n\t\tconst _postId = getCurrentPostId();\n\t\tconst _document = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t_postType,\n\t\t\t_postId\n\t\t);\n\t\tconst _templateInfo = getTemplateInfo( _document );\n\t\tconst _postTypeLabel = getPostType( _postType )?.labels?.singular_name;\n\n\t\treturn {\n\t\t\tpostType: _postType,\n\t\t\tpostTypeLabel: _postTypeLabel,\n\t\t\tdocumentTitle: _document.title,\n\t\t\tisNotFound:\n\t\t\t\t! _document &&\n\t\t\t\t! isResolvingSelector(\n\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\t'postType',\n\t\t\t\t\t_postType,\n\t\t\t\t\t_postId\n\t\t\t\t),\n\t\t\ttemplateTitle: _templateInfo.title,\n\t\t\tonNavigateToPreviousEntityRecord:\n\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t};\n\t}, [] );\n\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\tconst isReducedMotion = useReducedMotion();\n\n\tconst isTemplate = TEMPLATE_POST_TYPES.includes( postType );\n\tconst hasBackButton = !! onNavigateToPreviousEntityRecord;\n\tconst entityTitle = isTemplate ? templateTitle : documentTitle;\n\tconst title = props.title || entityTitle;\n\tconst icon = props.icon;\n\n\tconst pageTypeBadge = usePageTypeBadge();\n\n\tconst mountedRef = useRef( false );\n\tuseEffect( () => {\n\t\tmountedRef.current = true;\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'editor-document-bar', {\n\t\t\t\t'has-back-button': hasBackButton,\n\t\t\t} ) }\n\t\t>\n\t\t\t<AnimatePresence>\n\t\t\t\t{ hasBackButton && (\n\t\t\t\t\t<MotionButton\n\t\t\t\t\t\tclassName=\"editor-document-bar__back\"\n\t\t\t\t\t\ticon={ isRTL() ? chevronRightSmall : chevronLeftSmall }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\tonNavigateToPreviousEntityRecord();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmountedRef.current\n\t\t\t\t\t\t\t\t? { opacity: 0, transform: 'translateX(15%)' }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ { opacity: 1, transform: 'translateX(0%)' } }\n\t\t\t\t\t\texit={ { opacity: 0, transform: 'translateX(15%)' } }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</MotionButton>\n\t\t\t\t) }\n\t\t\t</AnimatePresence>\n\t\t\t{ isNotFound ? (\n\t\t\t\t<Text>{ __( 'Document not found' ) }</Text>\n\t\t\t) : (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"editor-document-bar__command\"\n\t\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName=\"editor-document-bar__title\"\n\t\t\t\t\t\t// Force entry animation when the back button is added or removed.\n\t\t\t\t\t\tkey={ hasBackButton }\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmountedRef.current\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\t\t\ttransform: hasBackButton\n\t\t\t\t\t\t\t\t\t\t\t? 'translateX(15%)'\n\t\t\t\t\t\t\t\t\t\t\t: 'translateX(-15%)',\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\ttransform: 'translateX(0%)',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ icon && <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\t<Text size=\"body\" as=\"h1\">\n\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-title\">\n\t\t\t\t\t\t\t\t{ title\n\t\t\t\t\t\t\t\t\t? decodeEntities( title )\n\t\t\t\t\t\t\t\t\t: __( 'No title' ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t{ pageTypeBadge && (\n\t\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-type-label\">\n\t\t\t\t\t\t\t\t\t{ `· ${ pageTypeBadge }` }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ postTypeLabel &&\n\t\t\t\t\t\t\t\t! props.title &&\n\t\t\t\t\t\t\t\t! pageTypeBadge && (\n\t\t\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-type-label\">\n\t\t\t\t\t\t\t\t\t\t{ `· ${ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\tpostTypeLabel\n\t\t\t\t\t\t\t\t\t\t) }` }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</motion.div>\n\t\t\t\t\t<span className=\"editor-document-bar__shortcut\">\n\t\t\t\t\t\t{ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t</span>\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,MAAM,EACNC,kBAAkB,IAAIC,IAAI,EAC1BC,gBAAgB,IAAIC,MAAM,EAC1BC,yBAAyB,IAAIC,eAAe,QACtC,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,yBAAyB;AACnD,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,kBAAkB;AACtE,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,aAAa,QAAQ,qBAAqB;AAC5D,SAASC,MAAM,EAAEC,SAAS,QAAQ,oBAAoB;AACtD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,cAAc,QAAQ,0BAA0B;;AAEzD;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASP,KAAK,IAAIQ,WAAW,QAAQ,aAAa;AAClD,OAAOC,gBAAgB,MAAM,2BAA2B;;AAExD;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEA,MAAMC,YAAY,GAAGrB,MAAM,CAAEJ,MAAO,CAAC;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,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AAAC,QAAA,EACnD,KAAM/C,cAAc,CACrBY,aACD,CAAC;UAAG,CACC,CACN;QAAA,CACG,CAAC;MAAA,GAxCD4B,aAyCK,CAAC,eACbnC,IAAA;QAAMyC,SAAS,EAAC,+BAA+B;QAAAC,QAAA,EAC5CtD,eAAe,CAACqE,OAAO,CAAE,GAAI;MAAC,CAC3B,CAAC;IAAA,CACA,CACR;EAAA,CACG,CAAC;AAER","ignoreList":[]}
@@ -9,7 +9,7 @@ import clsx from 'clsx';
9
9
  import { useViewportMatch } from '@wordpress/compose';
10
10
  import { useSelect, useDispatch } from '@wordpress/data';
11
11
  import { __, _x } from '@wordpress/i18n';
12
- import { NavigableToolbar, ToolSelector, store as blockEditorStore } from '@wordpress/block-editor';
12
+ import { NavigableToolbar, ToolSelector } from '@wordpress/block-editor';
13
13
  import { Button, ToolbarItem } from '@wordpress/components';
14
14
  import { listView, plus } from '@wordpress/icons';
15
15
  import { useCallback } from '@wordpress/element';
@@ -53,9 +53,6 @@ function DocumentTools({
53
53
  const {
54
54
  getShortcutRepresentation
55
55
  } = select(keyboardShortcutsStore);
56
- const {
57
- __unstableGetEditorMode
58
- } = select(blockEditorStore);
59
56
  return {
60
57
  isInserterOpened: select(editorStore).isInserterOpened(),
61
58
  isListViewOpen: isListViewOpened(),
@@ -64,8 +61,7 @@ function DocumentTools({
64
61
  listViewToggleRef: getListViewToggleRef(),
65
62
  showIconLabels: get('core', 'showIconLabels'),
66
63
  isDistractionFree: get('core', 'distractionFree'),
67
- isVisualMode: getEditorMode() === 'visual',
68
- isZoomedOutView: __unstableGetEditorMode() === 'zoom-out'
64
+ isVisualMode: getEditorMode() === 'visual'
69
65
  };
70
66
  }, []);
71
67
  const preventDefault = event => {