@wordpress/editor 14.33.3-next.36001005c.0 → 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 (104) 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/block-settings-menu/content-only-settings-menu.js +186 -0
  8. package/build/components/block-settings-menu/content-only-settings-menu.js.map +7 -0
  9. package/build/components/collab-sidebar/add-comment.js +26 -3
  10. package/build/components/collab-sidebar/add-comment.js.map +3 -3
  11. package/build/components/collab-sidebar/comment-indicator-toolbar.js +6 -22
  12. package/build/components/collab-sidebar/comment-indicator-toolbar.js.map +3 -3
  13. package/build/components/collab-sidebar/comments.js +105 -28
  14. package/build/components/collab-sidebar/comments.js.map +3 -3
  15. package/build/components/collab-sidebar/hooks.js +3 -4
  16. package/build/components/collab-sidebar/hooks.js.map +2 -2
  17. package/build/components/collab-sidebar/index.js +42 -57
  18. package/build/components/collab-sidebar/index.js.map +3 -3
  19. package/build/components/editor/index.js +2 -0
  20. package/build/components/editor/index.js.map +3 -3
  21. package/build/components/header/index.js +0 -3
  22. package/build/components/header/index.js.map +3 -3
  23. package/build/components/post-template/hooks.js +7 -38
  24. package/build/components/post-template/hooks.js.map +2 -2
  25. package/build/components/provider/index.js +3 -1
  26. package/build/components/provider/index.js.map +3 -3
  27. package/build/store/actions.js +1 -1
  28. package/build/store/actions.js.map +2 -2
  29. package/build-module/bindings/post-data.js +10 -17
  30. package/build-module/bindings/post-data.js.map +2 -2
  31. package/build-module/bindings/post-meta.js +7 -14
  32. package/build-module/bindings/post-meta.js.map +2 -2
  33. package/build-module/bindings/term-data.js +6 -16
  34. package/build-module/bindings/term-data.js.map +2 -2
  35. package/build-module/components/block-settings-menu/content-only-settings-menu.js +161 -0
  36. package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +7 -0
  37. package/build-module/components/collab-sidebar/add-comment.js +27 -4
  38. package/build-module/components/collab-sidebar/add-comment.js.map +2 -2
  39. package/build-module/components/collab-sidebar/comment-indicator-toolbar.js +6 -12
  40. package/build-module/components/collab-sidebar/comment-indicator-toolbar.js.map +2 -2
  41. package/build-module/components/collab-sidebar/comments.js +114 -31
  42. package/build-module/components/collab-sidebar/comments.js.map +2 -2
  43. package/build-module/components/collab-sidebar/hooks.js +3 -4
  44. package/build-module/components/collab-sidebar/hooks.js.map +2 -2
  45. package/build-module/components/collab-sidebar/index.js +42 -57
  46. package/build-module/components/collab-sidebar/index.js.map +2 -2
  47. package/build-module/components/editor/index.js +2 -0
  48. package/build-module/components/editor/index.js.map +2 -2
  49. package/build-module/components/header/index.js +0 -3
  50. package/build-module/components/header/index.js.map +2 -2
  51. package/build-module/components/post-template/hooks.js +7 -38
  52. package/build-module/components/post-template/hooks.js.map +2 -2
  53. package/build-module/components/provider/index.js +3 -1
  54. package/build-module/components/provider/index.js.map +2 -2
  55. package/build-module/store/actions.js +1 -1
  56. package/build-module/store/actions.js.map +2 -2
  57. package/build-style/style-rtl.css +12 -23
  58. package/build-style/style.css +12 -23
  59. package/build-types/bindings/post-data.d.ts +6 -16
  60. package/build-types/bindings/post-meta.d.ts +6 -13
  61. package/build-types/bindings/term-data.d.ts +6 -16
  62. package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts +2 -0
  63. package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts.map +1 -0
  64. package/build-types/components/collab-sidebar/add-comment.d.ts +6 -1
  65. package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -1
  66. package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts +1 -2
  67. package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts.map +1 -1
  68. package/build-types/components/collab-sidebar/comments.d.ts +12 -26
  69. package/build-types/components/collab-sidebar/comments.d.ts.map +1 -1
  70. package/build-types/components/collab-sidebar/hooks.d.ts +0 -1
  71. package/build-types/components/collab-sidebar/hooks.d.ts.map +1 -1
  72. package/build-types/components/collab-sidebar/index.d.ts +1 -4
  73. package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
  74. package/build-types/components/editor/index.d.ts.map +1 -1
  75. package/build-types/components/header/index.d.ts.map +1 -1
  76. package/build-types/components/post-template/hooks.d.ts +1 -1
  77. package/build-types/components/post-template/hooks.d.ts.map +1 -1
  78. package/build-types/components/provider/index.d.ts.map +1 -1
  79. package/build-types/store/actions.d.ts.map +1 -1
  80. package/package.json +38 -38
  81. package/src/bindings/post-data.js +9 -20
  82. package/src/bindings/post-meta.js +6 -17
  83. package/src/bindings/term-data.js +6 -21
  84. package/src/components/block-settings-menu/content-only-settings-menu.js +185 -0
  85. package/src/components/block-settings-menu/content-only-settings-menu.native.js +4 -0
  86. package/src/components/block-settings-menu/style.scss +6 -0
  87. package/src/components/collab-sidebar/add-comment.js +31 -3
  88. package/src/components/collab-sidebar/comment-indicator-toolbar.js +6 -22
  89. package/src/components/collab-sidebar/comments.js +108 -35
  90. package/src/components/collab-sidebar/hooks.js +3 -4
  91. package/src/components/collab-sidebar/index.js +34 -42
  92. package/src/components/collab-sidebar/style.scss +2 -23
  93. package/src/components/editor/index.js +2 -0
  94. package/src/components/editor-help/style.scss +1 -1
  95. package/src/components/header/index.js +0 -7
  96. package/src/components/post-last-revision/style.scss +1 -1
  97. package/src/components/post-panel-row/style.scss +0 -1
  98. package/src/components/post-publish-panel/style.scss +1 -1
  99. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +2 -2
  100. package/src/components/post-template/hooks.js +10 -51
  101. package/src/components/provider/index.js +3 -4
  102. package/src/store/actions.js +4 -1
  103. package/src/style.scss +1 -0
  104. package/tsconfig.tsbuildinfo +1 -1
@@ -20,7 +20,6 @@ import {
20
20
  SIDEBARS,
21
21
  } from './constants';
22
22
  import { Comments } from './comments';
23
- import { AddComment } from './add-comment';
24
23
  import { store as editorStore } from '../../store';
25
24
  import AddCommentMenuItem from './comment-menu-item';
26
25
  import CommentAvatarIndicator from './comment-indicator-toolbar';
@@ -31,9 +30,9 @@ import {
31
30
  useEnableFloatingSidebar,
32
31
  } from './hooks';
33
32
  import { focusCommentThread } from './utils';
34
- import PluginMoreMenuItem from '../plugin-more-menu-item';
33
+ import PostTypeSupportCheck from '../post-type-support-check';
35
34
 
36
- function CollabSidebarContent( {
35
+ function NotesSidebarContent( {
37
36
  showCommentBoard,
38
37
  setShowCommentBoard,
39
38
  styles,
@@ -61,12 +60,6 @@ function CollabSidebarContent( {
61
60
  }
62
61
  } }
63
62
  >
64
- <AddComment
65
- onSubmit={ onCreate }
66
- showCommentBoard={ showCommentBoard }
67
- setShowCommentBoard={ setShowCommentBoard }
68
- commentSidebarRef={ commentSidebarRef }
69
- />
70
63
  <Comments
71
64
  threads={ comments }
72
65
  onEditComment={ onEdit }
@@ -83,22 +76,14 @@ function CollabSidebarContent( {
83
76
  );
84
77
  }
85
78
 
86
- /**
87
- * Renders the Collab sidebar.
88
- */
89
- export default function CollabSidebar() {
79
+ function NotesSidebar( { postId, mode } ) {
90
80
  const [ showCommentBoard, setShowCommentBoard ] = useState( false );
91
81
  const { getActiveComplementaryArea } = useSelect( interfaceStore );
92
82
  const { enableComplementaryArea } = useDispatch( interfaceStore );
93
83
  const isLargeViewport = useViewportMatch( 'medium' );
94
84
  const commentSidebarRef = useRef( null );
95
85
 
96
- const { postId } = useSelect( ( select ) => {
97
- const { getCurrentPostId } = select( editorStore );
98
- return {
99
- postId: getCurrentPostId(),
100
- };
101
- }, [] );
86
+ const showFloatingSidebar = isLargeViewport && mode === 'post-only';
102
87
 
103
88
  const blockCommentId = useSelect( ( select ) => {
104
89
  const { getBlockAttributes, getSelectedBlockClientId } =
@@ -112,17 +97,14 @@ export default function CollabSidebar() {
112
97
  const {
113
98
  resultComments,
114
99
  unresolvedSortedThreads,
115
- totalPages,
116
100
  reflowComments,
117
101
  commentLastUpdated,
118
102
  } = useBlockComments( postId );
119
103
  useEnableFloatingSidebar(
120
- isLargeViewport &&
104
+ showFloatingSidebar &&
121
105
  ( unresolvedSortedThreads.length > 0 || showCommentBoard )
122
106
  );
123
107
 
124
- const hasMoreComments = totalPages && totalPages > 1;
125
-
126
108
  // Get the global styles to set the background color of the sidebar.
127
109
  const { merged: GlobalStyles } = useGlobalStylesContext();
128
110
  const backgroundColor = GlobalStyles?.styles?.color?.background;
@@ -132,20 +114,18 @@ export default function CollabSidebar() {
132
114
  ? resultComments.find( ( thread ) => thread.id === blockCommentId )
133
115
  : null;
134
116
 
135
- // If postId is not a valid number, do not render the comment sidebar.
136
- if ( ! ( !! postId && typeof postId === 'number' ) ) {
137
- return null;
138
- }
139
-
140
117
  async function openTheSidebar() {
141
118
  const prevArea = await getActiveComplementaryArea( 'core' );
142
119
  const activeNotesArea = SIDEBARS.find( ( name ) => name === prevArea );
143
120
 
144
- // If the notes sidebar is not already active, enable the floating sidebar.
145
- if ( ! activeNotesArea ) {
121
+ if ( currentThread?.status === 'approved' ) {
122
+ enableComplementaryArea( 'core', collabHistorySidebarName );
123
+ } else if ( ! activeNotesArea ) {
146
124
  enableComplementaryArea(
147
125
  'core',
148
- isLargeViewport ? collabSidebarName : collabHistorySidebarName
126
+ showFloatingSidebar
127
+ ? collabSidebarName
128
+ : collabHistorySidebarName
149
129
  );
150
130
  }
151
131
 
@@ -169,18 +149,18 @@ export default function CollabSidebar() {
169
149
  { blockCommentId && (
170
150
  <CommentAvatarIndicator
171
151
  thread={ currentThread }
172
- hasMoreComments={ hasMoreComments }
173
152
  onClick={ openTheSidebar }
174
153
  />
175
154
  ) }
176
155
  <AddCommentMenuItem onClick={ openTheSidebar } />
177
156
  <PluginSidebar
178
157
  identifier={ collabHistorySidebarName }
158
+ name={ collabHistorySidebarName }
179
159
  title={ __( 'Notes' ) }
180
160
  icon={ commentIcon }
181
161
  closeLabel={ __( 'Close Notes' ) }
182
162
  >
183
- <CollabSidebarContent
163
+ <NotesSidebarContent
184
164
  comments={ resultComments }
185
165
  showCommentBoard={ showCommentBoard }
186
166
  setShowCommentBoard={ setShowCommentBoard }
@@ -198,7 +178,7 @@ export default function CollabSidebar() {
198
178
  headerClassName="editor-collab-sidebar__header"
199
179
  backgroundColor={ backgroundColor }
200
180
  >
201
- <CollabSidebarContent
181
+ <NotesSidebarContent
202
182
  comments={ unresolvedSortedThreads }
203
183
  showCommentBoard={ showCommentBoard }
204
184
  setShowCommentBoard={ setShowCommentBoard }
@@ -212,14 +192,26 @@ export default function CollabSidebar() {
212
192
  />
213
193
  </PluginSidebar>
214
194
  ) }
215
- <PluginMoreMenuItem
216
- icon={ commentIcon }
217
- onClick={ () =>
218
- enableComplementaryArea( 'core', collabHistorySidebarName )
219
- }
220
- >
221
- { __( 'Notes' ) }
222
- </PluginMoreMenuItem>
223
195
  </>
224
196
  );
225
197
  }
198
+
199
+ export default function NotesSidebarContainer() {
200
+ const { postId, mode } = useSelect( ( select ) => {
201
+ const { getCurrentPostId, getRenderingMode } = select( editorStore );
202
+ return {
203
+ postId: getCurrentPostId(),
204
+ mode: getRenderingMode(),
205
+ };
206
+ }, [] );
207
+
208
+ if ( ! postId || typeof postId !== 'number' ) {
209
+ return null;
210
+ }
211
+
212
+ return (
213
+ <PostTypeSupportCheck supportKeys="editor.notes">
214
+ <NotesSidebar postId={ postId } mode={ mode } />
215
+ </PostTypeSupportCheck>
216
+ );
217
+ }
@@ -16,7 +16,7 @@
16
16
  }
17
17
 
18
18
  .editor-collab-sidebar-panel {
19
- padding: $grid-unit-20;
19
+ padding: $grid-unit-20 $grid-unit-20 $grid-unit-30;
20
20
  height: 100%;
21
21
  overflow: hidden;
22
22
  }
@@ -111,7 +111,7 @@
111
111
  }
112
112
 
113
113
  .editor-collab-sidebar-panel__more-reply-button {
114
- font-weight: $font-weight-medium;
114
+ font-weight: 500;
115
115
  }
116
116
 
117
117
  .editor-collab-sidebar-panel__resolution-text {
@@ -161,27 +161,6 @@
161
161
  min-width: auto;
162
162
  background: transparent;
163
163
  border: none;
164
-
165
- &:hover::before {
166
- background: rgba(0, 0, 0, 0.04);
167
- }
168
-
169
- &.has-unresolved {
170
- .comment-avatar-stack {
171
- &::after {
172
- content: "";
173
- position: absolute;
174
- top: -2px;
175
- right: -2px;
176
- width: $grid-unit-10;
177
- height: $grid-unit-10;
178
- background: #d63638;
179
- border-radius: $radius-round;
180
- border: $border-width solid $white;
181
- z-index: 10;
182
- }
183
- }
184
- }
185
164
  }
186
165
 
187
166
  .comment-avatar-stack {
@@ -13,6 +13,7 @@ import { TEMPLATE_POST_TYPE } from '../../store/constants';
13
13
  import EditorInterface from '../editor-interface';
14
14
  import { ExperimentalEditorProvider } from '../provider';
15
15
  import Sidebar from '../sidebar';
16
+ import NotesSidebar from '../collab-sidebar';
16
17
 
17
18
  function Editor( {
18
19
  postType,
@@ -86,6 +87,7 @@ function Editor( {
86
87
  { extraContent }
87
88
  </EditorInterface>
88
89
  { children }
90
+ <NotesSidebar />
89
91
  <Sidebar
90
92
  onActionPerformed={ onActionPerformed }
91
93
  extraPanels={ extraSidebarPanels }
@@ -118,6 +118,6 @@
118
118
 
119
119
  .helpDetailBadgeText {
120
120
  color: $white;
121
- font-weight: $font-weight-medium;
121
+ font-weight: 500;
122
122
  font-size: 12px;
123
123
  }
@@ -12,7 +12,6 @@ import { PinnedItems } from '@wordpress/interface';
12
12
  /**
13
13
  * Internal dependencies
14
14
  */
15
- import CollabSidebar from '../collab-sidebar';
16
15
  import BackButton, { useHasBackButton } from './back-button';
17
16
  import CollapsibleBlockToolbar from '../collapsible-block-toolbar';
18
17
  import DocumentBar from '../document-bar';
@@ -24,7 +23,6 @@ import PostSavedState from '../post-saved-state';
24
23
  import PostViewLink from '../post-view-link';
25
24
  import PreviewDropdown from '../preview-dropdown';
26
25
  import ZoomOutToggle from '../zoom-out-toggle';
27
- import PostTypeSupportCheck from '../post-type-support-check';
28
26
  import { store as editorStore } from '../../store';
29
27
  import {
30
28
  TEMPLATE_PART_POST_TYPE,
@@ -193,11 +191,6 @@ function Header( {
193
191
  }
194
192
  />
195
193
  ) }
196
-
197
- <PostTypeSupportCheck supportKeys="editor.notes">
198
- <CollabSidebar />
199
- </PostTypeSupportCheck>
200
-
201
194
  { customSaveButton }
202
195
  <MoreMenu />
203
196
  </motion.div>
@@ -3,7 +3,7 @@
3
3
 
4
4
  .editor-post-last-revision__title {
5
5
  width: 100%;
6
- font-weight: $font-weight-medium;
6
+ font-weight: 500;
7
7
  }
8
8
 
9
9
  .editor-post-last-revision__title.components-button.has-icon {
@@ -32,7 +32,6 @@
32
32
  text-wrap: pretty;
33
33
  height: auto;
34
34
  min-height: $button-size-compact;
35
- font-weight: $font-weight-regular;
36
35
  }
37
36
 
38
37
  .components-dropdown {
@@ -182,7 +182,7 @@
182
182
  }
183
183
 
184
184
  .post-publish-panel__postpublish-header {
185
- font-weight: $font-weight-medium;
185
+ font-weight: 500;
186
186
  }
187
187
 
188
188
  .post-publish-panel__postpublish-subheader {
@@ -19,7 +19,7 @@ exports[`PostPublishPanel should render the post-publish panel if the post is pu
19
19
 
20
20
  .emotion-4 {
21
21
  font-size: 11px;
22
- font-weight: 499;
22
+ font-weight: 500;
23
23
  line-height: 1.4;
24
24
  text-transform: uppercase;
25
25
  display: block;
@@ -246,7 +246,7 @@ exports[`PostPublishPanel should render the post-publish panel if the post is sc
246
246
 
247
247
  .emotion-4 {
248
248
  font-size: 11px;
249
- font-weight: 499;
249
+ font-weight: 500;
250
250
  line-height: 1.4;
251
251
  text-transform: uppercase;
252
252
  display: block;
@@ -52,57 +52,16 @@ export function useAllowSwitchingTemplates() {
52
52
  }
53
53
 
54
54
  function useTemplates( postType ) {
55
- // To do: create a new selector to checks if templates exist at all instead
56
- // of and unbound request. In the modal, the user templates should be
57
- // paginated and we should not make an unbound request.
58
- const { defaultTemplateTypes, registeredTemplates, userTemplates } =
59
- useSelect(
60
- ( select ) => {
61
- return {
62
- defaultTemplateTypes:
63
- select( coreStore ).getCurrentTheme()
64
- ?.default_template_types,
65
- registeredTemplates: select( coreStore ).getEntityRecords(
66
- 'postType',
67
- 'wp_registered_template',
68
- {
69
- per_page: -1,
70
- post_type: postType,
71
- }
72
- ),
73
- userTemplates: select( coreStore ).getEntityRecords(
74
- 'postType',
75
- 'wp_template',
76
- { per_page: -1, combinedTemplates: false }
77
- ),
78
- };
79
- },
80
- [ postType ]
81
- );
82
-
83
- return useMemo( () => {
84
- if (
85
- ! defaultTemplateTypes ||
86
- ! registeredTemplates ||
87
- ! userTemplates
88
- ) {
89
- return [];
90
- }
91
- return [
92
- ...registeredTemplates,
93
- ...userTemplates.filter(
94
- ( template ) =>
95
- // Only give "custom" templates as an option, which
96
- // means the is_wp_suggestion meta field is not set and
97
- // the slug is not found in the default template types.
98
- // https://github.com/WordPress/wordpress-develop/blob/97382397b2bd7c85aef6d4cd1c10bafd397957fc/src/wp-includes/block-template-utils.php#L858-L867
99
- ! template.meta.is_wp_suggestion &&
100
- ! defaultTemplateTypes.find(
101
- ( type ) => type.slug === template.slug
102
- )
103
- ),
104
- ];
105
- }, [ registeredTemplates, userTemplates, defaultTemplateTypes ] );
55
+ return useSelect(
56
+ ( select ) =>
57
+ select( coreStore ).getEntityRecords( 'postType', 'wp_template', {
58
+ per_page: -1,
59
+ post_type: postType,
60
+ // We look at the combined templates for now (old endpoint)
61
+ // because posts only accept slugs for templates, not IDs.
62
+ } ),
63
+ [ postType ]
64
+ );
106
65
  }
107
66
 
108
67
  export function useAvailableTemplates( postType ) {
@@ -32,6 +32,7 @@ import useCommands from '../commands';
32
32
  import BlockRemovalWarnings from '../block-removal-warnings';
33
33
  import StartPageOptions from '../start-page-options';
34
34
  import KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';
35
+ import ContentOnlySettingsMenu from '../block-settings-menu/content-only-settings-menu';
35
36
  import StartTemplateOptions from '../start-template-options';
36
37
  import EditorKeyboardShortcuts from '../global-keyboard-shortcuts';
37
38
  import PatternRenameModal from '../pattern-rename-modal';
@@ -219,10 +220,7 @@ export const ExperimentalEditorProvider = withRegistryProvider(
219
220
  const defaultBlockContext = useMemo( () => {
220
221
  const postContext = {};
221
222
  // If it is a template, try to inherit the post type from the name.
222
- if (
223
- post.type === 'wp_template' ||
224
- post.type === 'wp_registered_template'
225
- ) {
223
+ if ( post.type === 'wp_template' ) {
226
224
  if ( post.slug === 'page' ) {
227
225
  postContext.postType = 'page';
228
226
  } else if ( post.slug === 'single' ) {
@@ -372,6 +370,7 @@ export const ExperimentalEditorProvider = withRegistryProvider(
372
370
  <>
373
371
  <PatternsMenuItems />
374
372
  <TemplatePartMenuItems />
373
+ <ContentOnlySettingsMenu />
375
374
  { mode === 'template-locked' && (
376
375
  <DisableNonPageContentBlocks />
377
376
  ) }
@@ -734,7 +734,10 @@ export function updateEditorSettings( settings ) {
734
734
  export const setRenderingMode =
735
735
  ( mode ) =>
736
736
  ( { dispatch, registry, select } ) => {
737
- if ( select.__unstableIsEditorReady() ) {
737
+ if (
738
+ select.__unstableIsEditorReady() &&
739
+ ! select.getEditorSettings().isPreviewMode
740
+ ) {
738
741
  // We clear the block selection but we also need to clear the selection from the core store.
739
742
  registry.dispatch( blockEditorStore ).clearSelectedBlock();
740
743
  dispatch.editPost( { selection: undefined }, { undoIgnore: true } );
package/src/style.scss CHANGED
@@ -3,6 +3,7 @@
3
3
  @use "./components/autocompleters/style.scss" as *;
4
4
  @use "./components/collab-sidebar/style.scss" as *;
5
5
  @use "./components/collapsible-block-toolbar/style.scss" as *;
6
+ @use "./components/block-settings-menu/style.scss" as *;
6
7
  @use "./components/block-visibility/style.scss" as *;
7
8
  @use "./components/blog-title/style.scss" as *;
8
9
  @use "./components/document-bar/style.scss" as *;