@wordpress/editor 14.33.2 → 14.33.3

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 (89) hide show
  1. package/build/bindings/post-data.js +10 -17
  2. package/build/bindings/post-data.js.map +2 -2
  3. package/build/bindings/post-meta.js +7 -14
  4. package/build/bindings/post-meta.js.map +2 -2
  5. package/build/bindings/term-data.js +6 -16
  6. package/build/bindings/term-data.js.map +2 -2
  7. package/build/components/collab-sidebar/add-comment.js +26 -3
  8. package/build/components/collab-sidebar/add-comment.js.map +3 -3
  9. package/build/components/collab-sidebar/comment-indicator-toolbar.js +6 -22
  10. package/build/components/collab-sidebar/comment-indicator-toolbar.js.map +3 -3
  11. package/build/components/collab-sidebar/comments.js +112 -33
  12. package/build/components/collab-sidebar/comments.js.map +3 -3
  13. package/build/components/collab-sidebar/hooks.js +14 -8
  14. package/build/components/collab-sidebar/hooks.js.map +2 -2
  15. package/build/components/collab-sidebar/index.js +51 -59
  16. package/build/components/collab-sidebar/index.js.map +3 -3
  17. package/build/components/editor/index.js +2 -0
  18. package/build/components/editor/index.js.map +3 -3
  19. package/build/components/header/index.js +0 -3
  20. package/build/components/header/index.js.map +3 -3
  21. package/build/components/post-template/hooks.js +7 -38
  22. package/build/components/post-template/hooks.js.map +2 -2
  23. package/build/components/provider/index.js +1 -1
  24. package/build/components/provider/index.js.map +2 -2
  25. package/build/store/actions.js +1 -1
  26. package/build/store/actions.js.map +2 -2
  27. package/build-module/bindings/post-data.js +10 -17
  28. package/build-module/bindings/post-data.js.map +2 -2
  29. package/build-module/bindings/post-meta.js +7 -14
  30. package/build-module/bindings/post-meta.js.map +2 -2
  31. package/build-module/bindings/term-data.js +6 -16
  32. package/build-module/bindings/term-data.js.map +2 -2
  33. package/build-module/components/collab-sidebar/add-comment.js +27 -4
  34. package/build-module/components/collab-sidebar/add-comment.js.map +2 -2
  35. package/build-module/components/collab-sidebar/comment-indicator-toolbar.js +6 -12
  36. package/build-module/components/collab-sidebar/comment-indicator-toolbar.js.map +2 -2
  37. package/build-module/components/collab-sidebar/comments.js +121 -36
  38. package/build-module/components/collab-sidebar/comments.js.map +2 -2
  39. package/build-module/components/collab-sidebar/hooks.js +14 -8
  40. package/build-module/components/collab-sidebar/hooks.js.map +2 -2
  41. package/build-module/components/collab-sidebar/index.js +51 -59
  42. package/build-module/components/collab-sidebar/index.js.map +2 -2
  43. package/build-module/components/editor/index.js +2 -0
  44. package/build-module/components/editor/index.js.map +2 -2
  45. package/build-module/components/header/index.js +0 -3
  46. package/build-module/components/header/index.js.map +2 -2
  47. package/build-module/components/post-template/hooks.js +7 -38
  48. package/build-module/components/post-template/hooks.js.map +2 -2
  49. package/build-module/components/provider/index.js +1 -1
  50. package/build-module/components/provider/index.js.map +2 -2
  51. package/build-module/store/actions.js +1 -1
  52. package/build-module/store/actions.js.map +2 -2
  53. package/build-style/style-rtl.css +1 -16
  54. package/build-style/style.css +1 -16
  55. package/build-types/bindings/post-data.d.ts +6 -16
  56. package/build-types/bindings/post-meta.d.ts +6 -13
  57. package/build-types/bindings/term-data.d.ts +6 -16
  58. package/build-types/components/collab-sidebar/add-comment.d.ts +6 -1
  59. package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -1
  60. package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts +1 -2
  61. package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts.map +1 -1
  62. package/build-types/components/collab-sidebar/comments.d.ts +12 -26
  63. package/build-types/components/collab-sidebar/comments.d.ts.map +1 -1
  64. package/build-types/components/collab-sidebar/hooks.d.ts +0 -1
  65. package/build-types/components/collab-sidebar/hooks.d.ts.map +1 -1
  66. package/build-types/components/collab-sidebar/index.d.ts +1 -4
  67. package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
  68. package/build-types/components/editor/index.d.ts.map +1 -1
  69. package/build-types/components/header/index.d.ts.map +1 -1
  70. package/build-types/components/post-template/hooks.d.ts +1 -1
  71. package/build-types/components/post-template/hooks.d.ts.map +1 -1
  72. package/build-types/components/provider/index.d.ts.map +1 -1
  73. package/build-types/store/actions.d.ts.map +1 -1
  74. package/package.json +38 -38
  75. package/src/bindings/post-data.js +9 -20
  76. package/src/bindings/post-meta.js +6 -17
  77. package/src/bindings/term-data.js +6 -21
  78. package/src/components/collab-sidebar/add-comment.js +31 -3
  79. package/src/components/collab-sidebar/comment-indicator-toolbar.js +6 -22
  80. package/src/components/collab-sidebar/comments.js +128 -51
  81. package/src/components/collab-sidebar/hooks.js +18 -12
  82. package/src/components/collab-sidebar/index.js +67 -67
  83. package/src/components/collab-sidebar/style.scss +1 -22
  84. package/src/components/editor/index.js +2 -0
  85. package/src/components/header/index.js +0 -7
  86. package/src/components/post-template/hooks.js +10 -51
  87. package/src/components/provider/index.js +1 -4
  88. package/src/store/actions.js +4 -1
  89. package/tsconfig.tsbuildinfo +1 -1
@@ -28,7 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var collab_sidebar_exports = {};
30
30
  __export(collab_sidebar_exports, {
31
- default: () => CollabSidebar
31
+ default: () => NotesSidebarContainer
32
32
  });
33
33
  module.exports = __toCommonJS(collab_sidebar_exports);
34
34
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -43,15 +43,14 @@ var import_interface = require("@wordpress/interface");
43
43
  var import_plugin_sidebar = __toESM(require("../plugin-sidebar"));
44
44
  var import_constants = require("./constants");
45
45
  var import_comments = require("./comments");
46
- var import_add_comment = require("./add-comment");
47
46
  var import_store = require("../../store");
48
47
  var import_comment_menu_item = __toESM(require("./comment-menu-item"));
49
48
  var import_comment_indicator_toolbar = __toESM(require("./comment-indicator-toolbar"));
50
49
  var import_global_styles_provider = require("../global-styles-provider");
51
50
  var import_hooks = require("./hooks");
52
51
  var import_utils = require("./utils");
53
- var import_plugin_more_menu_item = __toESM(require("../plugin-more-menu-item"));
54
- function CollabSidebarContent({
52
+ var import_post_type_support_check = __toESM(require("../post-type-support-check"));
53
+ function NotesSidebarContent({
55
54
  showCommentBoard,
56
55
  setShowCommentBoard,
57
56
  styles,
@@ -62,7 +61,7 @@ function CollabSidebarContent({
62
61
  isFloating = false
63
62
  }) {
64
63
  const { onCreate, onEdit, onDelete } = (0, import_hooks.useBlockCommentsActions)(reflowComments);
65
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
64
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
66
65
  import_components.__experimentalVStack,
67
66
  {
68
67
  className: "editor-collab-sidebar-panel",
@@ -71,49 +70,35 @@ function CollabSidebarContent({
71
70
  spacing: "3",
72
71
  justify: "flex-start",
73
72
  ref: (node) => {
74
- commentSidebarRef.current = node;
73
+ if (node) {
74
+ commentSidebarRef.current = node;
75
+ }
75
76
  },
76
- children: [
77
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
78
- import_add_comment.AddComment,
79
- {
80
- onSubmit: onCreate,
81
- showCommentBoard,
82
- setShowCommentBoard,
83
- commentSidebarRef
84
- }
85
- ),
86
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
87
- import_comments.Comments,
88
- {
89
- threads: comments,
90
- onEditComment: onEdit,
91
- onAddReply: onCreate,
92
- onCommentDelete: onDelete,
93
- showCommentBoard,
94
- setShowCommentBoard,
95
- commentSidebarRef,
96
- reflowComments,
97
- commentLastUpdated,
98
- isFloating
99
- }
100
- )
101
- ]
77
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
78
+ import_comments.Comments,
79
+ {
80
+ threads: comments,
81
+ onEditComment: onEdit,
82
+ onAddReply: onCreate,
83
+ onCommentDelete: onDelete,
84
+ showCommentBoard,
85
+ setShowCommentBoard,
86
+ commentSidebarRef,
87
+ reflowComments,
88
+ commentLastUpdated,
89
+ isFloating
90
+ }
91
+ )
102
92
  }
103
93
  );
104
94
  }
105
- function CollabSidebar() {
95
+ function NotesSidebar({ postId, mode }) {
106
96
  const [showCommentBoard, setShowCommentBoard] = (0, import_element.useState)(false);
107
97
  const { getActiveComplementaryArea } = (0, import_data.useSelect)(import_interface.store);
108
98
  const { enableComplementaryArea } = (0, import_data.useDispatch)(import_interface.store);
109
99
  const isLargeViewport = (0, import_compose.useViewportMatch)("medium");
110
100
  const commentSidebarRef = (0, import_element.useRef)(null);
111
- const { postId } = (0, import_data.useSelect)((select) => {
112
- const { getCurrentPostId } = select(import_store.store);
113
- return {
114
- postId: getCurrentPostId()
115
- };
116
- }, []);
101
+ const showFloatingSidebar = isLargeViewport && mode === "post-only";
117
102
  const blockCommentId = (0, import_data.useSelect)((select) => {
118
103
  const { getBlockAttributes, getSelectedBlockClientId } = select(import_block_editor.store);
119
104
  const clientId = getSelectedBlockClientId();
@@ -122,23 +107,25 @@ function CollabSidebar() {
122
107
  const {
123
108
  resultComments,
124
109
  unresolvedSortedThreads,
125
- totalPages,
126
110
  reflowComments,
127
111
  commentLastUpdated
128
112
  } = (0, import_hooks.useBlockComments)(postId);
129
- (0, import_hooks.useEnableFloatingSidebar)(resultComments.length > 0);
130
- const hasMoreComments = totalPages && totalPages > 1;
113
+ (0, import_hooks.useEnableFloatingSidebar)(
114
+ showFloatingSidebar && (unresolvedSortedThreads.length > 0 || showCommentBoard)
115
+ );
131
116
  const { merged: GlobalStyles } = (0, import_global_styles_provider.useGlobalStylesContext)();
132
117
  const backgroundColor = GlobalStyles?.styles?.color?.background;
133
118
  const currentThread = blockCommentId ? resultComments.find((thread) => thread.id === blockCommentId) : null;
134
- if (!(!!postId && typeof postId === "number")) {
135
- return null;
136
- }
137
119
  async function openTheSidebar() {
138
120
  const prevArea = await getActiveComplementaryArea("core");
139
121
  const activeNotesArea = import_constants.SIDEBARS.find((name) => name === prevArea);
140
- if (!activeNotesArea) {
141
- enableComplementaryArea("core", import_constants.collabSidebarName);
122
+ if (currentThread?.status === "approved") {
123
+ enableComplementaryArea("core", import_constants.collabHistorySidebarName);
124
+ } else if (!activeNotesArea) {
125
+ enableComplementaryArea(
126
+ "core",
127
+ showFloatingSidebar ? import_constants.collabSidebarName : import_constants.collabHistorySidebarName
128
+ );
142
129
  }
143
130
  const currentArea = await getActiveComplementaryArea("core");
144
131
  if (!import_constants.SIDEBARS.includes(currentArea)) {
@@ -157,7 +144,6 @@ function CollabSidebar() {
157
144
  import_comment_indicator_toolbar.default,
158
145
  {
159
146
  thread: currentThread,
160
- hasMoreComments,
161
147
  onClick: openTheSidebar
162
148
  }
163
149
  ),
@@ -166,11 +152,12 @@ function CollabSidebar() {
166
152
  import_plugin_sidebar.default,
167
153
  {
168
154
  identifier: import_constants.collabHistorySidebarName,
155
+ name: import_constants.collabHistorySidebarName,
169
156
  title: (0, import_i18n.__)("Notes"),
170
157
  icon: import_icons.comment,
171
158
  closeLabel: (0, import_i18n.__)("Close Notes"),
172
159
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
173
- CollabSidebarContent,
160
+ NotesSidebarContent,
174
161
  {
175
162
  comments: resultComments,
176
163
  showCommentBoard,
@@ -182,7 +169,7 @@ function CollabSidebar() {
182
169
  )
183
170
  }
184
171
  ),
185
- isLargeViewport && (unresolvedSortedThreads.length > 0 || showCommentBoard) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
172
+ isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
186
173
  import_plugin_sidebar.default,
187
174
  {
188
175
  isPinnable: false,
@@ -192,7 +179,7 @@ function CollabSidebar() {
192
179
  headerClassName: "editor-collab-sidebar__header",
193
180
  backgroundColor,
194
181
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
195
- CollabSidebarContent,
182
+ NotesSidebarContent,
196
183
  {
197
184
  comments: unresolvedSortedThreads,
198
185
  showCommentBoard,
@@ -207,15 +194,20 @@ function CollabSidebar() {
207
194
  }
208
195
  )
209
196
  }
210
- ),
211
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
212
- import_plugin_more_menu_item.default,
213
- {
214
- icon: import_icons.comment,
215
- onClick: () => enableComplementaryArea("core", import_constants.collabHistorySidebarName),
216
- children: (0, import_i18n.__)("Notes")
217
- }
218
197
  )
219
198
  ] });
220
199
  }
200
+ function NotesSidebarContainer() {
201
+ const { postId, mode } = (0, import_data.useSelect)((select) => {
202
+ const { getCurrentPostId, getRenderingMode } = select(import_store.store);
203
+ return {
204
+ postId: getCurrentPostId(),
205
+ mode: getRenderingMode()
206
+ };
207
+ }, []);
208
+ if (!postId || typeof postId !== "number") {
209
+ return null;
210
+ }
211
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_type_support_check.default, { supportKeys: "editor.notes", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NotesSidebar, { postId, mode }) });
212
+ }
221
213
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/collab-sidebar/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { useState, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { comment as commentIcon } from '@wordpress/icons';\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 {\n\tcollabHistorySidebarName,\n\tcollabSidebarName,\n\tSIDEBARS,\n} from './constants';\nimport { Comments } from './comments';\nimport { AddComment } from './add-comment';\nimport { store as editorStore } from '../../store';\nimport AddCommentMenuItem from './comment-menu-item';\nimport CommentAvatarIndicator from './comment-indicator-toolbar';\nimport { useGlobalStylesContext } from '../global-styles-provider';\nimport {\n\tuseBlockComments,\n\tuseBlockCommentsActions,\n\tuseEnableFloatingSidebar,\n} from './hooks';\nimport { focusCommentThread } from './utils';\nimport PluginMoreMenuItem from '../plugin-more-menu-item';\n\nfunction CollabSidebarContent( {\n\tshowCommentBoard,\n\tsetShowCommentBoard,\n\tstyles,\n\tcomments,\n\tcommentSidebarRef,\n\treflowComments,\n\tcommentLastUpdated,\n\tisFloating = false,\n} ) {\n\tconst { onCreate, onEdit, onDelete } =\n\t\tuseBlockCommentsActions( reflowComments );\n\n\treturn (\n\t\t<VStack\n\t\t\tclassName=\"editor-collab-sidebar-panel\"\n\t\t\tstyle={ styles }\n\t\t\trole=\"list\"\n\t\t\tspacing=\"3\"\n\t\t\tjustify=\"flex-start\"\n\t\t\tref={ ( node ) => {\n\t\t\t\t// Keeps the ref fresh when switching between floating and pinned sidebar.\n\t\t\t\tcommentSidebarRef.current = node;\n\t\t\t} }\n\t\t>\n\t\t\t<AddComment\n\t\t\t\tonSubmit={ onCreate }\n\t\t\t\tshowCommentBoard={ showCommentBoard }\n\t\t\t\tsetShowCommentBoard={ setShowCommentBoard }\n\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t/>\n\t\t\t<Comments\n\t\t\t\tthreads={ comments }\n\t\t\t\tonEditComment={ onEdit }\n\t\t\t\tonAddReply={ onCreate }\n\t\t\t\tonCommentDelete={ onDelete }\n\t\t\t\tshowCommentBoard={ showCommentBoard }\n\t\t\t\tsetShowCommentBoard={ setShowCommentBoard }\n\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\treflowComments={ reflowComments }\n\t\t\t\tcommentLastUpdated={ commentLastUpdated }\n\t\t\t\tisFloating={ isFloating }\n\t\t\t/>\n\t\t</VStack>\n\t);\n}\n\n/**\n * Renders the Collab sidebar.\n */\nexport default function CollabSidebar() {\n\tconst [ showCommentBoard, setShowCommentBoard ] = useState( false );\n\tconst { getActiveComplementaryArea } = useSelect( interfaceStore );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst commentSidebarRef = useRef( null );\n\n\tconst { postId } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId } = select( editorStore );\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\n\tconst blockCommentId = useSelect( ( select ) => {\n\t\tconst { getBlockAttributes, getSelectedBlockClientId } =\n\t\t\tselect( blockEditorStore );\n\t\tconst clientId = getSelectedBlockClientId();\n\t\treturn clientId\n\t\t\t? getBlockAttributes( clientId )?.metadata?.noteId\n\t\t\t: null;\n\t}, [] );\n\n\tconst {\n\t\tresultComments,\n\t\tunresolvedSortedThreads,\n\t\ttotalPages,\n\t\treflowComments,\n\t\tcommentLastUpdated,\n\t} = useBlockComments( postId );\n\tuseEnableFloatingSidebar( resultComments.length > 0 );\n\n\tconst hasMoreComments = totalPages && totalPages > 1;\n\n\t// Get the global styles to set the background color of the sidebar.\n\tconst { merged: GlobalStyles } = useGlobalStylesContext();\n\tconst backgroundColor = GlobalStyles?.styles?.color?.background;\n\n\t// Find the current thread for the selected block.\n\tconst currentThread = blockCommentId\n\t\t? resultComments.find( ( thread ) => thread.id === blockCommentId )\n\t\t: null;\n\n\t// If postId is not a valid number, do not render the comment sidebar.\n\tif ( ! ( !! postId && typeof postId === 'number' ) ) {\n\t\treturn null;\n\t}\n\n\tasync function openTheSidebar() {\n\t\tconst prevArea = await getActiveComplementaryArea( 'core' );\n\t\tconst activeNotesArea = SIDEBARS.find( ( name ) => name === prevArea );\n\n\t\t// If the notes sidebar is not already active, enable the pinned sidebar.\n\t\tif ( ! activeNotesArea ) {\n\t\t\tenableComplementaryArea( 'core', collabSidebarName );\n\t\t}\n\n\t\tconst currentArea = await getActiveComplementaryArea( 'core' );\n\t\t// Bail out if the current active area is not one of note sidebars.\n\t\tif ( ! SIDEBARS.includes( currentArea ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetShowCommentBoard( ! blockCommentId );\n\t\tfocusCommentThread(\n\t\t\tblockCommentId,\n\t\t\tcommentSidebarRef.current,\n\t\t\t// Focus a comment thread when there's a selected block with a comment.\n\t\t\t! blockCommentId ? 'textarea' : undefined\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ blockCommentId && (\n\t\t\t\t<CommentAvatarIndicator\n\t\t\t\t\tthread={ currentThread }\n\t\t\t\t\thasMoreComments={ hasMoreComments }\n\t\t\t\t\tonClick={ openTheSidebar }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<AddCommentMenuItem onClick={ openTheSidebar } />\n\t\t\t<PluginSidebar\n\t\t\t\tidentifier={ collabHistorySidebarName }\n\t\t\t\ttitle={ __( 'Notes' ) }\n\t\t\t\ticon={ commentIcon }\n\t\t\t\tcloseLabel={ __( 'Close Notes' ) }\n\t\t\t>\n\t\t\t\t<CollabSidebarContent\n\t\t\t\t\tcomments={ resultComments }\n\t\t\t\t\tshowCommentBoard={ showCommentBoard }\n\t\t\t\t\tsetShowCommentBoard={ setShowCommentBoard }\n\t\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t\tcommentLastUpdated={ commentLastUpdated }\n\t\t\t\t/>\n\t\t\t</PluginSidebar>\n\t\t\t{ isLargeViewport &&\n\t\t\t\t( unresolvedSortedThreads.length > 0 || showCommentBoard ) && (\n\t\t\t\t\t<PluginSidebar\n\t\t\t\t\t\tisPinnable={ false }\n\t\t\t\t\t\theader={ false }\n\t\t\t\t\t\tidentifier={ collabSidebarName }\n\t\t\t\t\t\tclassName=\"editor-collab-sidebar\"\n\t\t\t\t\t\theaderClassName=\"editor-collab-sidebar__header\"\n\t\t\t\t\t\tbackgroundColor={ backgroundColor }\n\t\t\t\t\t>\n\t\t\t\t\t\t<CollabSidebarContent\n\t\t\t\t\t\t\tcomments={ unresolvedSortedThreads }\n\t\t\t\t\t\t\tshowCommentBoard={ showCommentBoard }\n\t\t\t\t\t\t\tsetShowCommentBoard={ setShowCommentBoard }\n\t\t\t\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t\t\t\tcommentLastUpdated={ commentLastUpdated }\n\t\t\t\t\t\t\tstyles={ {\n\t\t\t\t\t\t\t\tbackgroundColor,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisFloating\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PluginSidebar>\n\t\t\t\t) }\n\t\t\t<PluginMoreMenuItem\n\t\t\t\ticon={ commentIcon }\n\t\t\t\tonClick={ () =>\n\t\t\t\t\tenableComplementaryArea( 'core', collabHistorySidebarName )\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ __( 'Notes' ) }\n\t\t\t</PluginMoreMenuItem>\n\t\t</>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiDE;AA9CF,kBAAmB;AACnB,kBAAuC;AACvC,wBAA+C;AAC/C,qBAAiC;AACjC,qBAAiC;AACjC,mBAAuC;AACvC,0BAA0C;AAC1C,uBAAwC;AAKxC,4BAA0B;AAC1B,uBAIO;AACP,sBAAyB;AACzB,yBAA2B;AAC3B,mBAAqC;AACrC,+BAA+B;AAC/B,uCAAmC;AACnC,oCAAuC;AACvC,mBAIO;AACP,mBAAmC;AACnC,mCAA+B;AAE/B,SAAS,qBAAsB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AACd,GAAI;AACH,QAAM,EAAE,UAAU,QAAQ,SAAS,QAClC,sCAAyB,cAAe;AAEzC,SACC;AAAA,IAAC,kBAAAA;AAAA,IAAA;AAAA,MACA,WAAU;AAAA,MACV,OAAQ;AAAA,MACR,MAAK;AAAA,MACL,SAAQ;AAAA,MACR,SAAQ;AAAA,MACR,KAAM,CAAE,SAAU;AAEjB,0BAAkB,UAAU;AAAA,MAC7B;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACA,UAAW;AAAA,YACX;AAAA,Y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YACA,QAAS;AAAA,cACR;AAAA,YACD;AAAA,YACA,YAAU;AAAA;AAAA,QACX;AAAA;AAAA,IACD;AAAA,IAEF;AAAA,MAAC,6BAAAE;AAAA,MAAA;AAAA,QACA,MAAO,aAAAD;AAAA,QACP,SAAU,MACT,wBAAyB,QAAQ,yCAAyB;AAAA,QAGzD,8BAAI,OAAQ;AAAA;AAAA,IACf;AAAA,KACD;AAEF;",
6
- "names": ["VStack", "interfaceStore", "editorStore", "blockEditorStore", "CommentAvatarIndicator", "AddCommentMenuItem", "PluginSidebar", "commentIcon", "PluginMoreMenuItem"]
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { useState, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { comment as commentIcon } from '@wordpress/icons';\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 {\n\tcollabHistorySidebarName,\n\tcollabSidebarName,\n\tSIDEBARS,\n} from './constants';\nimport { Comments } from './comments';\nimport { store as editorStore } from '../../store';\nimport AddCommentMenuItem from './comment-menu-item';\nimport CommentAvatarIndicator from './comment-indicator-toolbar';\nimport { useGlobalStylesContext } from '../global-styles-provider';\nimport {\n\tuseBlockComments,\n\tuseBlockCommentsActions,\n\tuseEnableFloatingSidebar,\n} from './hooks';\nimport { focusCommentThread } from './utils';\nimport PostTypeSupportCheck from '../post-type-support-check';\n\nfunction NotesSidebarContent( {\n\tshowCommentBoard,\n\tsetShowCommentBoard,\n\tstyles,\n\tcomments,\n\tcommentSidebarRef,\n\treflowComments,\n\tcommentLastUpdated,\n\tisFloating = false,\n} ) {\n\tconst { onCreate, onEdit, onDelete } =\n\t\tuseBlockCommentsActions( reflowComments );\n\n\treturn (\n\t\t<VStack\n\t\t\tclassName=\"editor-collab-sidebar-panel\"\n\t\t\tstyle={ styles }\n\t\t\trole=\"list\"\n\t\t\tspacing=\"3\"\n\t\t\tjustify=\"flex-start\"\n\t\t\tref={ ( node ) => {\n\t\t\t\t// Sometimes previous sidebar unmounts after the new one mounts.\n\t\t\t\t// This ensures we always have the latest reference.\n\t\t\t\tif ( node ) {\n\t\t\t\t\tcommentSidebarRef.current = node;\n\t\t\t\t}\n\t\t\t} }\n\t\t>\n\t\t\t<Comments\n\t\t\t\tthreads={ comments }\n\t\t\t\tonEditComment={ onEdit }\n\t\t\t\tonAddReply={ onCreate }\n\t\t\t\tonCommentDelete={ onDelete }\n\t\t\t\tshowCommentBoard={ showCommentBoard }\n\t\t\t\tsetShowCommentBoard={ setShowCommentBoard }\n\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\treflowComments={ reflowComments }\n\t\t\t\tcommentLastUpdated={ commentLastUpdated }\n\t\t\t\tisFloating={ isFloating }\n\t\t\t/>\n\t\t</VStack>\n\t);\n}\n\nfunction NotesSidebar( { postId, mode } ) {\n\tconst [ showCommentBoard, setShowCommentBoard ] = useState( false );\n\tconst { getActiveComplementaryArea } = useSelect( interfaceStore );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst commentSidebarRef = useRef( null );\n\n\tconst showFloatingSidebar = isLargeViewport && mode === 'post-only';\n\n\tconst blockCommentId = useSelect( ( select ) => {\n\t\tconst { getBlockAttributes, getSelectedBlockClientId } =\n\t\t\tselect( blockEditorStore );\n\t\tconst clientId = getSelectedBlockClientId();\n\t\treturn clientId\n\t\t\t? getBlockAttributes( clientId )?.metadata?.noteId\n\t\t\t: null;\n\t}, [] );\n\n\tconst {\n\t\tresultComments,\n\t\tunresolvedSortedThreads,\n\t\treflowComments,\n\t\tcommentLastUpdated,\n\t} = useBlockComments( postId );\n\tuseEnableFloatingSidebar(\n\t\tshowFloatingSidebar &&\n\t\t\t( unresolvedSortedThreads.length > 0 || showCommentBoard )\n\t);\n\n\t// Get the global styles to set the background color of the sidebar.\n\tconst { merged: GlobalStyles } = useGlobalStylesContext();\n\tconst backgroundColor = GlobalStyles?.styles?.color?.background;\n\n\t// Find the current thread for the selected block.\n\tconst currentThread = blockCommentId\n\t\t? resultComments.find( ( thread ) => thread.id === blockCommentId )\n\t\t: null;\n\n\tasync function openTheSidebar() {\n\t\tconst prevArea = await getActiveComplementaryArea( 'core' );\n\t\tconst activeNotesArea = SIDEBARS.find( ( name ) => name === prevArea );\n\n\t\tif ( currentThread?.status === 'approved' ) {\n\t\t\tenableComplementaryArea( 'core', collabHistorySidebarName );\n\t\t} else if ( ! activeNotesArea ) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core',\n\t\t\t\tshowFloatingSidebar\n\t\t\t\t\t? collabSidebarName\n\t\t\t\t\t: collabHistorySidebarName\n\t\t\t);\n\t\t}\n\n\t\tconst currentArea = await getActiveComplementaryArea( 'core' );\n\t\t// Bail out if the current active area is not one of note sidebars.\n\t\tif ( ! SIDEBARS.includes( currentArea ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetShowCommentBoard( ! blockCommentId );\n\t\tfocusCommentThread(\n\t\t\tblockCommentId,\n\t\t\tcommentSidebarRef.current,\n\t\t\t// Focus a comment thread when there's a selected block with a comment.\n\t\t\t! blockCommentId ? 'textarea' : undefined\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ blockCommentId && (\n\t\t\t\t<CommentAvatarIndicator\n\t\t\t\t\tthread={ currentThread }\n\t\t\t\t\tonClick={ openTheSidebar }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<AddCommentMenuItem onClick={ openTheSidebar } />\n\t\t\t<PluginSidebar\n\t\t\t\tidentifier={ collabHistorySidebarName }\n\t\t\t\tname={ collabHistorySidebarName }\n\t\t\t\ttitle={ __( 'Notes' ) }\n\t\t\t\ticon={ commentIcon }\n\t\t\t\tcloseLabel={ __( 'Close Notes' ) }\n\t\t\t>\n\t\t\t\t<NotesSidebarContent\n\t\t\t\t\tcomments={ resultComments }\n\t\t\t\t\tshowCommentBoard={ showCommentBoard }\n\t\t\t\t\tsetShowCommentBoard={ setShowCommentBoard }\n\t\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t\tcommentLastUpdated={ commentLastUpdated }\n\t\t\t\t/>\n\t\t\t</PluginSidebar>\n\t\t\t{ isLargeViewport && (\n\t\t\t\t<PluginSidebar\n\t\t\t\t\tisPinnable={ false }\n\t\t\t\t\theader={ false }\n\t\t\t\t\tidentifier={ collabSidebarName }\n\t\t\t\t\tclassName=\"editor-collab-sidebar\"\n\t\t\t\t\theaderClassName=\"editor-collab-sidebar__header\"\n\t\t\t\t\tbackgroundColor={ backgroundColor }\n\t\t\t\t>\n\t\t\t\t\t<NotesSidebarContent\n\t\t\t\t\t\tcomments={ unresolvedSortedThreads }\n\t\t\t\t\t\tshowCommentBoard={ showCommentBoard }\n\t\t\t\t\t\tsetShowCommentBoard={ setShowCommentBoard }\n\t\t\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t\t\tcommentLastUpdated={ commentLastUpdated }\n\t\t\t\t\t\tstyles={ {\n\t\t\t\t\t\t\tbackgroundColor,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisFloating\n\t\t\t\t\t/>\n\t\t\t\t</PluginSidebar>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default function NotesSidebarContainer() {\n\tconst { postId, mode } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getRenderingMode } = select( editorStore );\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tmode: getRenderingMode(),\n\t\t};\n\t}, [] );\n\n\tif ( ! postId || typeof postId !== 'number' ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck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ginSidebar", "commentIcon", "editorStore", "PostTypeSupportCheck"]
7
7
  }
@@ -40,6 +40,7 @@ var import_constants = require("../../store/constants");
40
40
  var import_editor_interface = __toESM(require("../editor-interface"));
41
41
  var import_provider = require("../provider");
42
42
  var import_sidebar = __toESM(require("../sidebar"));
43
+ var import_collab_sidebar = __toESM(require("../collab-sidebar"));
43
44
  function Editor({
44
45
  postType,
45
46
  postId,
@@ -101,6 +102,7 @@ function Editor({
101
102
  children: [
102
103
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_editor_interface.default, { ...props, children: extraContent }),
103
104
  children,
105
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_collab_sidebar.default, {}),
104
106
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
105
107
  import_sidebar.default,
106
108
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/editor/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { Notice } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\nimport EditorInterface from '../editor-interface';\nimport { ExperimentalEditorProvider } from '../provider';\nimport Sidebar from '../sidebar';\n\nfunction Editor( {\n\tpostType,\n\tpostId,\n\ttemplateId,\n\tsettings,\n\tchildren,\n\tinitialEdits,\n\n\t// This could be part of the settings.\n\tonActionPerformed,\n\n\t// The following abstractions are not ideal but necessary\n\t// to account for site editor and post editor differences for now.\n\textraContent,\n\textraSidebarPanels,\n\t...props\n} ) {\n\tconst { post, template, hasLoadedPost, error } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetResolutionError,\n\t\t\t\thasFinishedResolution,\n\t\t\t} = select( coreStore );\n\n\t\t\tconst postArgs = [ 'postType', postType, postId ];\n\t\t\treturn {\n\t\t\t\tpost: getEntityRecord( ...postArgs ),\n\t\t\t\ttemplate: templateId\n\t\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\t\t\ttemplateId\n\t\t\t\t\t )\n\t\t\t\t\t: undefined,\n\t\t\t\thasLoadedPost: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecord',\n\t\t\t\t\tpostArgs\n\t\t\t\t),\n\t\t\t\terror: getResolutionError( 'getEntityRecord', postArgs )\n\t\t\t\t\t?.message,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, templateId ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ hasLoadedPost && ! post && (\n\t\t\t\t<Notice\n\t\t\t\t\tstatus={ !! error ? 'error' : 'warning' }\n\t\t\t\t\tisDismissible={ false }\n\t\t\t\t>\n\t\t\t\t\t{ ! error\n\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: error }\n\t\t\t\t</Notice>\n\t\t\t) }\n\t\t\t{ !! post && (\n\t\t\t\t<ExperimentalEditorProvider\n\t\t\t\t\tpost={ post }\n\t\t\t\t\t__unstableTemplate={ template }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t>\n\t\t\t\t\t<EditorInterface { ...props }>\n\t\t\t\t\t\t{ extraContent }\n\t\t\t\t\t</EditorInterface>\n\t\t\t\t\t{ children }\n\t\t\t\t\t<Sidebar\n\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\textraPanels={ extraSidebarPanels }\n\t\t\t\t\t/>\n\t\t\t\t</ExperimentalEditorProvider>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Editor;\n"],
5
- "mappings": ";;;;;;;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F;AAAA,YAAC,eAAAC;AAAA,YAAA;AAAA,cACA;AAAA,cACA,aAAc;AAAA;AAAA,UACf;AAAA;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;AAEA,IAAO,iBAAQ;",
6
- "names": ["coreStore", "EditorInterface", "Sidebar"]
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { Notice } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\nimport EditorInterface from '../editor-interface';\nimport { ExperimentalEditorProvider } from '../provider';\nimport Sidebar from '../sidebar';\nimport NotesSidebar from '../collab-sidebar';\n\nfunction Editor( {\n\tpostType,\n\tpostId,\n\ttemplateId,\n\tsettings,\n\tchildren,\n\tinitialEdits,\n\n\t// This could be part of the settings.\n\tonActionPerformed,\n\n\t// The following abstractions are not ideal but necessary\n\t// to account for site editor and post editor differences for now.\n\textraContent,\n\textraSidebarPanels,\n\t...props\n} ) {\n\tconst { post, template, hasLoadedPost, error } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetResolutionError,\n\t\t\t\thasFinishedResolution,\n\t\t\t} = select( coreStore );\n\n\t\t\tconst postArgs = [ 'postType', postType, postId ];\n\t\t\treturn {\n\t\t\t\tpost: getEntityRecord( ...postArgs ),\n\t\t\t\ttemplate: templateId\n\t\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\t\t\ttemplateId\n\t\t\t\t\t )\n\t\t\t\t\t: undefined,\n\t\t\t\thasLoadedPost: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecord',\n\t\t\t\t\tpostArgs\n\t\t\t\t),\n\t\t\t\terror: getResolutionError( 'getEntityRecord', postArgs )\n\t\t\t\t\t?.message,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, templateId ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ hasLoadedPost && ! post && (\n\t\t\t\t<Notice\n\t\t\t\t\tstatus={ !! error ? 'error' : 'warning' }\n\t\t\t\t\tisDismissible={ false }\n\t\t\t\t>\n\t\t\t\t\t{ ! error\n\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: error }\n\t\t\t\t</Notice>\n\t\t\t) }\n\t\t\t{ !! post && (\n\t\t\t\t<ExperimentalEditorProvider\n\t\t\t\t\tpost={ post }\n\t\t\t\t\t__unstableTemplate={ template }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t>\n\t\t\t\t\t<EditorInterface { ...props }>\n\t\t\t\t\t\t{ extraContent }\n\t\t\t\t\t</EditorInterface>\n\t\t\t\t\t{ children }\n\t\t\t\t\t<NotesSidebar />\n\t\t\t\t\t<Sidebar\n\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\textraPanels={ extraSidebarPanels }\n\t\t\t\t\t/>\n\t\t\t\t</ExperimentalEditorProvider>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Editor;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgEE;AA7DF,kBAA0B;AAC1B,uBAAmC;AACnC,wBAAuB;AACvB,kBAAmB;AAKnB,uBAAmC;AACnC,8BAA4B;AAC5B,sBAA2C;AAC3C,qBAAoB;AACpB,4BAAyB;AAEzB,SAAS,OAAQ;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAGA;AAAA;AAAA;AAAA,EAIA;AAAA,EACA;AAAA,EACA,GAAG;AACJ,GAAI;AACH,QAAM,EAAE,MAAM,UAAU,eAAe,MAAM,QAAI;AAAA,IAChD,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,iBAAAA,KAAU;AAEtB,YAAM,WAAW,CAAE,YAAY,UAAU,MAAO;AAChD,aAAO;AAAA,QACN,MAAM,gBAAiB,GAAG,QAAS;AAAA,QACnC,UAAU,aACP;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACA,IACA;AAAA,QACH,eAAe;AAAA,UACd;AAAA,UACA;AAAA,QACD;AAAA,QACA,OAAO,mBAAoB,mBAAmB,QAAS,GACpD;AAAA,MACJ;AAAA,IACD;AAAA,IACA,CAAE,UAAU,QAAQ,UAAW;AAAA,EAChC;AAEA,SACC,4EACG;AAAA,qBAAiB,CAAE,QACpB;AAAA,MAAC;AAAA;AAAA,QACA,QAAS,CAAC,CAAE,QAAQ,UAAU;AAAA,QAC9B,eAAgB;AAAA,QAEd,WAAE,YACD;AAAA,UACA;AAAA,QACA,IACA;AAAA;AAAA,IACJ;AAAA,IAEC,CAAC,CAAE,QACJ;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA,oBAAqB;AAAA,QACrB;AAAA,QACA;AAAA,QACA,gBAAiB;AAAA,QAEjB;AAAA,sDAAC,wBAAAC,SAAA,EAAkB,GAAG,OACnB,wBACH;AAAA,UACE;AAAA,UACF,4CAAC,sBAAAC,SAAA,EAAa;AAAA,UACd;AAAA,YAAC,eAAAC;AAAA,YAAA;AAAA,cACA;AAAA,cACA,aAAc;AAAA;AAAA,UACf;AAAA;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;AAEA,IAAO,iBAAQ;",
6
+ "names": ["coreStore", "EditorInterface", "NotesSidebar", "Sidebar"]
7
7
  }
@@ -39,7 +39,6 @@ var import_components = require("@wordpress/components");
39
39
  var import_preferences = require("@wordpress/preferences");
40
40
  var import_element = require("@wordpress/element");
41
41
  var import_interface = require("@wordpress/interface");
42
- var import_collab_sidebar = __toESM(require("../collab-sidebar"));
43
42
  var import_back_button = __toESM(require("./back-button"));
44
43
  var import_collapsible_block_toolbar = __toESM(require("../collapsible-block-toolbar"));
45
44
  var import_document_bar = __toESM(require("../document-bar"));
@@ -51,7 +50,6 @@ var import_post_saved_state = __toESM(require("../post-saved-state"));
51
50
  var import_post_view_link = __toESM(require("../post-view-link"));
52
51
  var import_preview_dropdown = __toESM(require("../preview-dropdown"));
53
52
  var import_zoom_out_toggle = __toESM(require("../zoom-out-toggle"));
54
- var import_post_type_support_check = __toESM(require("../post-type-support-check"));
55
53
  var import_store = require("../../store");
56
54
  var import_constants = require("../../store/constants");
57
55
  var import_lock_unlock = require("../../lock-unlock");
@@ -197,7 +195,6 @@ function Header({
197
195
  setEntitiesSavedStatesCallback
198
196
  }
199
197
  ),
200
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_type_support_check.default, { supportKeys: "editor.notes", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_collab_sidebar.default, {}) }),
201
198
  customSaveButton,
202
199
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_more_menu.default, {})
203
200
  ]
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/header/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMediaQuery, useViewportMatch } from '@wordpress/compose';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useState } from '@wordpress/element';\nimport { PinnedItems } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport CollabSidebar from '../collab-sidebar';\nimport BackButton, { useHasBackButton } from './back-button';\nimport CollapsibleBlockToolbar from '../collapsible-block-toolbar';\nimport DocumentBar from '../document-bar';\nimport DocumentTools from '../document-tools';\nimport MoreMenu from '../more-menu';\nimport PostPreviewButton from '../post-preview-button';\nimport PostPublishButtonOrToggle from '../post-publish-button/post-publish-button-or-toggle';\nimport PostSavedState from '../post-saved-state';\nimport PostViewLink from '../post-view-link';\nimport PreviewDropdown from '../preview-dropdown';\nimport ZoomOutToggle from '../zoom-out-toggle';\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../../store/constants';\nimport { unlock } from '../../lock-unlock';\n\nconst toolbarVariations = {\n\tdistractionFreeDisabled: { y: '-50px' },\n\tdistractionFreeHover: { y: 0 },\n\tdistractionFreeHidden: { y: '-50px' },\n\tvisible: { y: 0 },\n\thidden: { y: 0 },\n};\n\nconst backButtonVariations = {\n\tdistractionFreeDisabled: { x: '-100%' },\n\tdistractionFreeHover: { x: 0 },\n\tdistractionFreeHidden: { x: '-100%' },\n\tvisible: { x: 0 },\n\thidden: { x: 0 },\n};\n\nfunction Header( {\n\tcustomSaveButton,\n\tforceIsDirty,\n\tforceDisableBlockTools,\n\tsetEntitiesSavedStatesCallback,\n\ttitle,\n} ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isTooNarrowForDocumentBar = useMediaQuery( '(max-width: 403px)' );\n\tconst {\n\t\tpostType,\n\t\tisTextEditor,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasFixedToolbar,\n\t\thasBlockSelection,\n\t\thasSectionRootClientId,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst {\n\t\t\tgetEditorMode,\n\t\t\tgetCurrentPostType,\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened,\n\t\t} = select( editorStore );\n\t\tconst { getBlockSelectionStart, getSectionRootClientId } = unlock(\n\t\t\tselect( blockEditorStore )\n\t\t);\n\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tisTextEditor: getEditorMode() === 'text',\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened(),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t\thasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),\n\t\t\thasBlockSelection: !! getBlockSelectionStart(),\n\t\t\thasSectionRootClientId: !! getSectionRootClientId(),\n\t\t};\n\t}, [] );\n\n\tconst canBeZoomedOut =\n\t\t[ 'post', 'page', 'wp_template' ].includes( postType ) &&\n\t\thasSectionRootClientId;\n\n\tconst disablePreviewOption =\n\t\t[\n\t\t\tNAVIGATION_POST_TYPE,\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\tPATTERN_POST_TYPE,\n\t\t].includes( postType ) || forceDisableBlockTools;\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\tconst hasCenter =\n\t\t! isTooNarrowForDocumentBar &&\n\t\t( ! hasFixedToolbar ||\n\t\t\t( hasFixedToolbar &&\n\t\t\t\t( ! hasBlockSelection || isBlockToolsCollapsed ) ) );\n\tconst hasBackButton = useHasBackButton();\n\n\t/*\n\t * The edit-post-header classname is only kept for backward compatibility\n\t * as some plugins might be relying on its presence.\n\t */\n\treturn (\n\t\t<div className=\"editor-header edit-post-header\">\n\t\t\t{ hasBackButton && (\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"editor-header__back-button\"\n\t\t\t\t\tvariants={ backButtonVariations }\n\t\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\t>\n\t\t\t\t\t<BackButton.Slot />\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t<motion.div\n\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\tclassName=\"editor-header__toolbar\"\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t>\n\t\t\t\t<DocumentTools\n\t\t\t\t\tdisableBlockTools={ forceDisableBlockTools || isTextEditor }\n\t\t\t\t/>\n\t\t\t\t{ hasFixedToolbar && isLargeViewport && (\n\t\t\t\t\t<CollapsibleBlockToolbar\n\t\t\t\t\t\tisCollapsed={ isBlockToolsCollapsed }\n\t\t\t\t\t\tonToggle={ setIsBlockToolsCollapsed }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t\t{ hasCenter && (\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"editor-header__center\"\n\t\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\t>\n\t\t\t\t\t<DocumentBar title={ title } />\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t<motion.div\n\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\tclassName=\"editor-header__settings\"\n\t\t\t>\n\t\t\t\t{ ! customSaveButton && ! isPublishSidebarOpened && (\n\t\t\t\t\t/*\n\t\t\t\t\t * This button isn't completely hidden by the publish sidebar.\n\t\t\t\t\t * We can't hide the whole toolbar when the publish sidebar is open because\n\t\t\t\t\t * we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.\n\t\t\t\t\t * We track that DOM node to return focus to the PostPublishButtonOrToggle\n\t\t\t\t\t * when the publish sidebar has been closed.\n\t\t\t\t\t */\n\t\t\t\t\t<PostSavedState forceIsDirty={ forceIsDirty } />\n\t\t\t\t) }\n\n\t\t\t\t<PostViewLink />\n\n\t\t\t\t<PreviewDropdown\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t\tdisabled={ disablePreviewOption }\n\t\t\t\t/>\n\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tclassName=\"editor-header__post-preview-button\"\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t/>\n\n\t\t\t\t{ isWideViewport && canBeZoomedOut && (\n\t\t\t\t\t<ZoomOutToggle disabled={ forceDisableBlockTools } />\n\t\t\t\t) }\n\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<PinnedItems.Slot scope=\"core\" />\n\t\t\t\t) }\n\n\t\t\t\t{ ! customSaveButton && (\n\t\t\t\t\t<PostPublishButtonOrToggle\n\t\t\t\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t<PostTypeSupportCheck supportKeys=\"editor.notes\">\n\t\t\t\t\t<CollabSidebar />\n\t\t\t\t</PostTypeSupportCheck>\n\n\t\t\t\t{ customSaveButton }\n\t\t\t\t<MoreMenu />\n\t\t\t</motion.div>\n\t\t</div>\n\t);\n}\n\nexport default Header;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4HK;AAzHL,0BAA0C;AAC1C,kBAA0B;AAC1B,qBAAgD;AAChD,wBAA2C;AAC3C,yBAA0C;AAC1C,qBAAyB;AACzB,uBAA4B;AAK5B,4BAA0B;AAC1B,yBAA6C;AAC7C,uCAAoC;AACpC,0BAAwB;AACxB,4BAA0B;AAC1B,uBAAqB;AACrB,iCAA8B;AAC9B,2CAAsC;AACtC,8BAA2B;AAC3B,4BAAyB;AACzB,8BAA4B;AAC5B,6BAA0B;AAC1B,qCAAiC;AACjC,mBAAqC;AACrC,uBAIO;AACP,yBAAuB;AAEvB,MAAM,oBAAoB;AAAA,EACzB,yBAAyB,EAAE,GAAG,QAAQ;AAAA,EACtC,sBAAsB,EAAE,GAAG,EAAE;AAAA,EAC7B,uBAAuB,EAAE,GAAG,QAAQ;AAAA,EACpC,SAAS,EAAE,GAAG,EAAE;AAAA,EAChB,QAAQ,EAAE,GAAG,EAAE;AAChB;AAEA,MAAM,uBAAuB;AAAA,EAC5B,yBA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B;AAAA,cACtB,UAAW;AAAA;AAAA,UACZ;AAAA,UAEA;AAAA,YAAC,2BAAAC;AAAA,YAAA;AAAA,cACA,WAAU;AAAA,cACV,qBAAsB;AAAA;AAAA,UACvB;AAAA,UAEE,kBAAkB,kBACnB,4CAAC,uBAAAC,SAAA,EAAc,UAAW,wBAAyB;AAAA,WAGhD,kBAAkB,CAAE,mBACvB,4CAAC,6BAAY,MAAZ,EAAiB,OAAM,QAAO;AAAA,UAG9B,CAAE,oBACH;AAAA,YAAC,qCAAAC;AAAA,YAAA;AAAA,cACA;AAAA,cACA;AAAA;AAAA,UAGD;AAAA,UAGD,4CAAC,+BAAAC,SAAA,EAAqB,aAAY,gBACjC,sDAAC,sBAAAC,SAAA,EAAc,GAChB;AAAA,UAEE;AAAA,UACF,4CAAC,iBAAAC,SAAA,EAAS;AAAA;AAAA;AAAA,IACX;AAAA,KACD;AAEF;AAEA,IAAO,iBAAQ;",
6
- "names": ["preferencesStore", "editorStore", "blockEditorStore", "motion", "BackButton", "DocumentTools", "CollapsibleBlockToolbar", "DocumentBar", "PostSavedState", "PostViewLink", "PreviewDropdown", "PostPreviewButton", "ZoomOutToggle", "PostPublishButtonOrToggle", "PostTypeSupportCheck", "CollabSidebar", "MoreMenu"]
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMediaQuery, useViewportMatch } from '@wordpress/compose';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useState } from '@wordpress/element';\nimport { PinnedItems } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport BackButton, { useHasBackButton } from './back-button';\nimport CollapsibleBlockToolbar from '../collapsible-block-toolbar';\nimport DocumentBar from '../document-bar';\nimport DocumentTools from '../document-tools';\nimport MoreMenu from '../more-menu';\nimport PostPreviewButton from '../post-preview-button';\nimport PostPublishButtonOrToggle from '../post-publish-button/post-publish-button-or-toggle';\nimport PostSavedState from '../post-saved-state';\nimport PostViewLink from '../post-view-link';\nimport PreviewDropdown from '../preview-dropdown';\nimport ZoomOutToggle from '../zoom-out-toggle';\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../../store/constants';\nimport { unlock } from '../../lock-unlock';\n\nconst toolbarVariations = {\n\tdistractionFreeDisabled: { y: '-50px' },\n\tdistractionFreeHover: { y: 0 },\n\tdistractionFreeHidden: { y: '-50px' },\n\tvisible: { y: 0 },\n\thidden: { y: 0 },\n};\n\nconst backButtonVariations = {\n\tdistractionFreeDisabled: { x: '-100%' },\n\tdistractionFreeHover: { x: 0 },\n\tdistractionFreeHidden: { x: '-100%' },\n\tvisible: { x: 0 },\n\thidden: { x: 0 },\n};\n\nfunction Header( {\n\tcustomSaveButton,\n\tforceIsDirty,\n\tforceDisableBlockTools,\n\tsetEntitiesSavedStatesCallback,\n\ttitle,\n} ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isTooNarrowForDocumentBar = useMediaQuery( '(max-width: 403px)' );\n\tconst {\n\t\tpostType,\n\t\tisTextEditor,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasFixedToolbar,\n\t\thasBlockSelection,\n\t\thasSectionRootClientId,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst {\n\t\t\tgetEditorMode,\n\t\t\tgetCurrentPostType,\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened,\n\t\t} = select( editorStore );\n\t\tconst { getBlockSelectionStart, getSectionRootClientId } = unlock(\n\t\t\tselect( blockEditorStore )\n\t\t);\n\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tisTextEditor: getEditorMode() === 'text',\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened(),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t\thasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),\n\t\t\thasBlockSelection: !! getBlockSelectionStart(),\n\t\t\thasSectionRootClientId: !! getSectionRootClientId(),\n\t\t};\n\t}, [] );\n\n\tconst canBeZoomedOut =\n\t\t[ 'post', 'page', 'wp_template' ].includes( postType ) &&\n\t\thasSectionRootClientId;\n\n\tconst disablePreviewOption =\n\t\t[\n\t\t\tNAVIGATION_POST_TYPE,\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\tPATTERN_POST_TYPE,\n\t\t].includes( postType ) || forceDisableBlockTools;\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\tconst hasCenter =\n\t\t! isTooNarrowForDocumentBar &&\n\t\t( ! hasFixedToolbar ||\n\t\t\t( hasFixedToolbar &&\n\t\t\t\t( ! hasBlockSelection || isBlockToolsCollapsed ) ) );\n\tconst hasBackButton = useHasBackButton();\n\n\t/*\n\t * The edit-post-header classname is only kept for backward compatibility\n\t * as some plugins might be relying on its presence.\n\t */\n\treturn (\n\t\t<div className=\"editor-header edit-post-header\">\n\t\t\t{ hasBackButton && (\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"editor-header__back-button\"\n\t\t\t\t\tvariants={ backButtonVariations }\n\t\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\t>\n\t\t\t\t\t<BackButton.Slot />\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t<motion.div\n\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\tclassName=\"editor-header__toolbar\"\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t>\n\t\t\t\t<DocumentTools\n\t\t\t\t\tdisableBlockTools={ forceDisableBlockTools || isTextEditor }\n\t\t\t\t/>\n\t\t\t\t{ hasFixedToolbar && isLargeViewport && (\n\t\t\t\t\t<CollapsibleBlockToolbar\n\t\t\t\t\t\tisCollapsed={ isBlockToolsCollapsed }\n\t\t\t\t\t\tonToggle={ setIsBlockToolsCollapsed }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t\t{ hasCenter && (\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"editor-header__center\"\n\t\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\t>\n\t\t\t\t\t<DocumentBar title={ title } />\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t<motion.div\n\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\tclassName=\"editor-header__settings\"\n\t\t\t>\n\t\t\t\t{ ! customSaveButton && ! isPublishSidebarOpened && (\n\t\t\t\t\t/*\n\t\t\t\t\t * This button isn't completely hidden by the publish sidebar.\n\t\t\t\t\t * We can't hide the whole toolbar when the publish sidebar is open because\n\t\t\t\t\t * we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.\n\t\t\t\t\t * We track that DOM node to return focus to the PostPublishButtonOrToggle\n\t\t\t\t\t * when the publish sidebar has been closed.\n\t\t\t\t\t */\n\t\t\t\t\t<PostSavedState forceIsDirty={ forceIsDirty } />\n\t\t\t\t) }\n\n\t\t\t\t<PostViewLink />\n\n\t\t\t\t<PreviewDropdown\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t\tdisabled={ disablePreviewOption }\n\t\t\t\t/>\n\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tclassName=\"editor-header__post-preview-button\"\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t/>\n\n\t\t\t\t{ isWideViewport && canBeZoomedOut && (\n\t\t\t\t\t<ZoomOutToggle disabled={ forceDisableBlockTools } />\n\t\t\t\t) }\n\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<PinnedItems.Slot scope=\"core\" />\n\t\t\t\t) }\n\n\t\t\t\t{ ! customSaveButton && (\n\t\t\t\t\t<PostPublishButtonOrToggle\n\t\t\t\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ customSaveButton }\n\t\t\t\t<MoreMenu />\n\t\t\t</motion.div>\n\t\t</div>\n\t);\n}\n\nexport default Header;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA0HK;AAvHL,0BAA0C;AAC1C,kBAA0B;AAC1B,qBAAgD;AAChD,wBAA2C;AAC3C,yBAA0C;AAC1C,qBAAyB;AACzB,uBAA4B;AAK5B,yBAA6C;AAC7C,uCAAoC;AACpC,0BAAwB;AACxB,4BAA0B;AAC1B,uBAAqB;AACrB,iCAA8B;AAC9B,2CAAsC;AACtC,8BAA2B;AAC3B,4BAAyB;AACzB,8BAA4B;AAC5B,6BAA0B;AAC1B,mBAAqC;AACrC,uBAIO;AACP,yBAAuB;AAEvB,MAAM,oBAAoB;AAAA,EACzB,yBAAyB,EAAE,GAAG,QAAQ;AAAA,EACtC,sBAAsB,EAAE,GAAG,EAAE;AAAA,EAC7B,uBAAuB,EAAE,GAAG,QAAQ;AAAA,EACpC,SAAS,EAAE,GAAG,EAAE;AAAA,EAChB,QAAQ,EAAE,GAAG,EAAE;AAChB;AAEA,MAAM,uBAAuB;AAAA,EAC5B,yBAAyB,EAAE,GAAG,QAAQ;AAAA,EACtC,sBAAsB,EAAE,GAAG,EAAE;AAAA,EAC7B,uBAAuB,EAAE,GAAG,QAAQ;AAAA,EACpC,SAAS,EAAE,GAAG,EAAE;AAAA,EAChB,QAAQ,EAAE,GAAG,EAAE;AAChB;AAEA,SAAS,OAAQ;AAAA,EAChB;AAAA,EACA;AAAA,EACA;A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ACvB,4CAAC,6BAAY,MAAZ,EAAiB,OAAM,QAAO;AAAA,UAG9B,CAAE,oBACH;AAAA,YAAC,qCAAAC;AAAA,YAAA;AAAA,cACA;AAAA,cACA;AAAA;AAAA,UAGD;AAAA,UAEC;AAAA,UACF,4CAAC,iBAAAC,SAAA,EAAS;AAAA;AAAA;AAAA,IACX;AAAA,KACD;AAEF;AAEA,IAAO,iBAAQ;",
6
+ "names": ["preferencesStore", "editorStore", "blockEditorStore", "motion", "BackButton", "DocumentTools", "CollapsibleBlockToolbar", "DocumentBar", "PostSavedState", "PostViewLink", "PreviewDropdown", "PostPreviewButton", "ZoomOutToggle", "PostPublishButtonOrToggle", "MoreMenu"]
7
7
  }
@@ -58,46 +58,15 @@ function useAllowSwitchingTemplates() {
58
58
  );
59
59
  }
60
60
  function useTemplates(postType) {
61
- const { defaultTemplateTypes, registeredTemplates, userTemplates } = (0, import_data.useSelect)(
62
- (select) => {
63
- return {
64
- defaultTemplateTypes: select(import_core_data.store).getCurrentTheme()?.default_template_types,
65
- registeredTemplates: select(import_core_data.store).getEntityRecords(
66
- "postType",
67
- "wp_registered_template",
68
- {
69
- per_page: -1,
70
- post_type: postType
71
- }
72
- ),
73
- userTemplates: select(import_core_data.store).getEntityRecords(
74
- "postType",
75
- "wp_template",
76
- { per_page: -1, combinedTemplates: false }
77
- )
78
- };
79
- },
61
+ return (0, import_data.useSelect)(
62
+ (select) => select(import_core_data.store).getEntityRecords("postType", "wp_template", {
63
+ per_page: -1,
64
+ post_type: postType
65
+ // We look at the combined templates for now (old endpoint)
66
+ // because posts only accept slugs for templates, not IDs.
67
+ }),
80
68
  [postType]
81
69
  );
82
- return (0, import_element.useMemo)(() => {
83
- if (!defaultTemplateTypes || !registeredTemplates || !userTemplates) {
84
- return [];
85
- }
86
- return [
87
- ...registeredTemplates,
88
- ...userTemplates.filter(
89
- (template) => (
90
- // Only give "custom" templates as an option, which
91
- // means the is_wp_suggestion meta field is not set and
92
- // the slug is not found in the default template types.
93
- // https://github.com/WordPress/wordpress-develop/blob/97382397b2bd7c85aef6d4cd1c10bafd397957fc/src/wp-includes/block-template-utils.php#L858-L867
94
- !template.meta.is_wp_suggestion && !defaultTemplateTypes.find(
95
- (type) => type.slug === template.slug
96
- )
97
- )
98
- )
99
- ];
100
- }, [registeredTemplates, userTemplates, defaultTemplateTypes]);
101
70
  }
102
71
  function useAvailableTemplates(postType) {
103
72
  const currentTemplateSlug = useCurrentTemplateSlug();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/post-template/hooks.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function useEditedPostContext() {\n\treturn useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n}\nexport function useAllowSwitchingTemplates() {\n\tconst { postType, postId } = useEditedPostContext();\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser, getEntityRecord, getEntityRecords } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\n\t\t\tconst isPostsPage = +postId === siteSettings?.page_for_posts;\n\t\t\tconst isFrontPage =\n\t\t\t\tpostType === 'page' && +postId === siteSettings?.page_on_front;\n\t\t\t// If current page is set front page or posts page, we also need\n\t\t\t// to check if the current theme has a template for it. If not\n\t\t\tconst templates = isFrontPage\n\t\t\t\t? getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\t\t\tper_page: -1,\n\t\t\t\t } )\n\t\t\t\t: [];\n\t\t\tconst hasFrontPage =\n\t\t\t\tisFrontPage &&\n\t\t\t\t!! templates?.some( ( { slug } ) => slug === 'front-page' );\n\t\t\treturn ! isPostsPage && ! hasFrontPage;\n\t\t},\n\t\t[ postId, postType ]\n\t);\n}\n\nfunction useTemplates( postType ) {\n\t// To do: create a new selector to checks if templates exist at all instead\n\t// of and unbound request. In the modal, the user templates should be\n\t// paginated and we should not make an unbound request.\n\tconst { defaultTemplateTypes, registeredTemplates, userTemplates } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\treturn {\n\t\t\t\t\tdefaultTemplateTypes:\n\t\t\t\t\t\tselect( coreStore ).getCurrentTheme()\n\t\t\t\t\t\t\t?.default_template_types,\n\t\t\t\t\tregisteredTemplates: select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'wp_registered_template',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t\t\tpost_type: postType,\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t\t\tuserTemplates: select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'wp_template',\n\t\t\t\t\t\t{ per_page: -1, combinedTemplates: false }\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ postType ]\n\t\t);\n\n\treturn useMemo( () => {\n\t\tif (\n\t\t\t! defaultTemplateTypes ||\n\t\t\t! registeredTemplates ||\n\t\t\t! userTemplates\n\t\t) {\n\t\t\treturn [];\n\t\t}\n\t\treturn [\n\t\t\t...registeredTemplates,\n\t\t\t...userTemplates.filter(\n\t\t\t\t( template ) =>\n\t\t\t\t\t// Only give \"custom\" templates as an option, which\n\t\t\t\t\t// means the is_wp_suggestion meta field is not set and\n\t\t\t\t\t// the slug is not found in the default template types.\n\t\t\t\t\t// https://github.com/WordPress/wordpress-develop/blob/97382397b2bd7c85aef6d4cd1c10bafd397957fc/src/wp-includes/block-template-utils.php#L858-L867\n\t\t\t\t\t! template.meta.is_wp_suggestion &&\n\t\t\t\t\t! defaultTemplateTypes.find(\n\t\t\t\t\t\t( type ) => type.slug === template.slug\n\t\t\t\t\t)\n\t\t\t),\n\t\t];\n\t}, [ registeredTemplates, userTemplates, defaultTemplateTypes ] );\n}\n\nexport function useAvailableTemplates( postType ) {\n\tconst currentTemplateSlug = useCurrentTemplateSlug();\n\tconst allowSwitchingTemplate = useAllowSwitchingTemplates();\n\tconst templates = useTemplates( postType );\n\treturn useMemo(\n\t\t() =>\n\t\t\tallowSwitchingTemplate &&\n\t\t\ttemplates?.filter(\n\t\t\t\t( template ) =>\n\t\t\t\t\t( template.is_custom || template.type === 'wp_template' ) &&\n\t\t\t\t\ttemplate.slug !== currentTemplateSlug &&\n\t\t\t\t\t!! template.content.raw // Skip empty templates.\n\t\t\t),\n\t\t[ templates, currentTemplateSlug, allowSwitchingTemplate ]\n\t);\n}\n\nexport function useCurrentTemplateSlug() {\n\tconst { postType, postId } = useEditedPostContext();\n\tconst templates = useTemplates( postType );\n\tconst entityTemplate = useSelect(\n\t\t( select ) => {\n\t\t\tconst post = select( coreStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\treturn post?.template;\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tif ( ! entityTemplate ) {\n\t\treturn;\n\t}\n\t// If a page has a `template` set and is not included in the list\n\t// of the theme's templates, do not return it, in order to resolve\n\t// to the current theme's default template.\n\treturn templates?.find( ( template ) => template.slug === entityTemplate )\n\t\t?.slug;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,qBAAwB;AACxB,uBAAmC;AAKnC,mBAAqC;AAE9B,SAAS,uBAAuB;AACtC,aAAO,uBAAW,CAAE,WAAY;AAC/B,UAAM,EAA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,IACD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AAED,aAAO,wBAAS,MAAM;AACrB,QACC,CAAE,wBACF,CAAE,uBACF,CAAE,eACD;AACD,aAAO,CAAC;AAAA,IACT;AACA,WAAO;AAAA,MACN,GAAG;AAAA,MACH,GAAG,cAAc;AAAA,QAChB,CAAE;AAAA;AAAA;AAAA;AAAA;AAAA,UAKD,CAAE,SAAS,KAAK,oBAChB,CAAE,qBAAqB;AAAA,YACtB,CAAE,SAAU,KAAK,SAAS,SAAS;AAAA,UACpC;AAAA;AAAA,MACF;AAAA,IACD;AAAA,EACD,GAAG,CAAE,qBAAqB,eAAe,oBAAqB,CAAE;AACjE;AAEO,SAAS,sBAAuB,UAAW;AACjD,QAAM,sBAAsB,uBAAuB;AACnD,QAAM,yBAAyB,2BAA2B;AAC1D,QAAM,YAAY,aAAc,QAAS;AACzC,aAAO;AAAA,IACN,MACC,0BACA,WAAW;AAAA,MACV,CAAE,cACC,SAAS,aAAa,SAAS,SAAS,kBAC1C,SAAS,SAAS,uBAClB,CAAC,CAAE,SAAS,QAAQ;AAAA;AAAA,IACtB;AAAA,IACD,CAAE,WAAW,qBAAqB,sBAAuB;AAAA,EAC1D;AACD;AAEO,SAAS,yBAAyB;AACxC,QAAM,EAAE,UAAU,OAAO,IAAI,qBAAqB;AAClD,QAAM,YAAY,aAAc,QAAS;AACzC,QAAM,qBAAiB;AAAA,IACtB,CAAE,WAAY;AACb,YAAM,OAAO,OAAQ,iBAAAA,KAAU,EAAE;AAAA,QAChC;AAAA,QACA;AAAA,QACA;AAAA,MACD;AACA,aAAO,MAAM;AAAA,IACd;AAAA,IACA,CAAE,UAAU,MAAO;AAAA,EACpB;AAEA,MAAK,CAAE,gBAAiB;AACvB;AAAA,EACD;AAIA,SAAO,WAAW,KAAM,CAAE,aAAc,SAAS,SAAS,cAAe,GACtE;AACJ;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function useEditedPostContext() {\n\treturn useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n}\nexport function useAllowSwitchingTemplates() {\n\tconst { postType, postId } = useEditedPostContext();\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser, getEntityRecord, getEntityRecords } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\n\t\t\tconst isPostsPage = +postId === siteSettings?.page_for_posts;\n\t\t\tconst isFrontPage =\n\t\t\t\tpostType === 'page' && +postId === siteSettings?.page_on_front;\n\t\t\t// If current page is set front page or posts page, we also need\n\t\t\t// to check if the current theme has a template for it. If not\n\t\t\tconst templates = isFrontPage\n\t\t\t\t? getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\t\t\tper_page: -1,\n\t\t\t\t } )\n\t\t\t\t: [];\n\t\t\tconst hasFrontPage =\n\t\t\t\tisFrontPage &&\n\t\t\t\t!! templates?.some( ( { slug } ) => slug === 'front-page' );\n\t\t\treturn ! isPostsPage && ! hasFrontPage;\n\t\t},\n\t\t[ postId, postType ]\n\t);\n}\n\nfunction useTemplates( postType ) {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\tper_page: -1,\n\t\t\t\tpost_type: postType,\n\t\t\t\t// We look at the combined templates for now (old endpoint)\n\t\t\t\t// because posts only accept slugs for templates, not IDs.\n\t\t\t} ),\n\t\t[ postType ]\n\t);\n}\n\nexport function useAvailableTemplates( postType ) {\n\tconst currentTemplateSlug = useCurrentTemplateSlug();\n\tconst allowSwitchingTemplate = useAllowSwitchingTemplates();\n\tconst templates = useTemplates( postType );\n\treturn useMemo(\n\t\t() =>\n\t\t\tallowSwitchingTemplate &&\n\t\t\ttemplates?.filter(\n\t\t\t\t( template ) =>\n\t\t\t\t\t( template.is_custom || template.type === 'wp_template' ) &&\n\t\t\t\t\ttemplate.slug !== currentTemplateSlug &&\n\t\t\t\t\t!! template.content.raw // Skip empty templates.\n\t\t\t),\n\t\t[ templates, currentTemplateSlug, allowSwitchingTemplate ]\n\t);\n}\n\nexport function useCurrentTemplateSlug() {\n\tconst { postType, postId } = useEditedPostContext();\n\tconst templates = useTemplates( postType );\n\tconst entityTemplate = useSelect(\n\t\t( select ) => {\n\t\t\tconst post = select( coreStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\treturn post?.template;\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tif ( ! entityTemplate ) {\n\t\treturn;\n\t}\n\t// If a page has a `template` set and is not included in the list\n\t// of the theme's templates, do not return it, in order to resolve\n\t// to the current theme's default template.\n\treturn templates?.find( ( template ) => template.slug === entityTemplate )\n\t\t?.slug;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,qBAAwB;AACxB,uBAAmC;AAKnC,mBAAqC;AAE9B,SAAS,uBAAuB;AACtC,aAAO,uBAAW,CAAE,WAAY;AAC/B,UAAM,EAAE,kBAAkB,mBAAmB,IAAI,OAAQ,aAAAA,KAAY;AACrE,WAAO;AAAA,MACN,QAAQ,iBAAiB;AAAA,MACzB,UAAU,mBAAmB;AAAA,IAC9B;AAAA,EACD,GAAG,CAAC,CAAE;AACP;AACO,SAAS,6BAA6B;AAC5C,QAAM,EAAE,UAAU,OAAO,IAAI,qBAAq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IACtB,CAAE,WAAY;AACb,YAAM,OAAO,OAAQ,iBAAAA,KAAU,EAAE;AAAA,QAChC;AAAA,QACA;AAAA,QACA;AAAA,MACD;AACA,aAAO,MAAM;AAAA,IACd;AAAA,IACA,CAAE,UAAU,MAAO;AAAA,EACpB;AAEA,MAAK,CAAE,gBAAiB;AACvB;AAAA,EACD;AAIA,SAAO,WAAW,KAAM,CAAE,aAAc,SAAS,SAAS,cAAe,GACtE;AACJ;",
6
6
  "names": ["editorStore", "coreStore"]
7
7
  }
@@ -157,7 +157,7 @@ const ExperimentalEditorProvider = (0, import_with_registry_provider.default)(
157
157
  const rootLevelPost = shouldRenderTemplate ? template : post;
158
158
  const defaultBlockContext = (0, import_element.useMemo)(() => {
159
159
  const postContext = {};
160
- if (post.type === "wp_template" || post.type === "wp_registered_template") {
160
+ if (post.type === "wp_template") {
161
161
  if (post.slug === "page") {
162
162
  postContext.postType = "page";
163
163
  } else if (post.slug === "single") {