@wordpress/editor 12.0.20 → 12.1.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 (75) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/build/components/deprecated.js +4 -2
  4. package/build/components/deprecated.js.map +1 -1
  5. package/build/components/editor-help/add-blocks.native.js +1 -1
  6. package/build/components/editor-help/add-blocks.native.js.map +1 -1
  7. package/build/components/editor-help/index.native.js +1 -1
  8. package/build/components/editor-help/index.native.js.map +1 -1
  9. package/build/components/entities-saved-states/index.js +18 -16
  10. package/build/components/entities-saved-states/index.js.map +1 -1
  11. package/build/components/post-locked-modal/index.js +34 -25
  12. package/build/components/post-locked-modal/index.js.map +1 -1
  13. package/build/components/post-publish-panel/maybe-category-panel.js +81 -0
  14. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -0
  15. package/build/components/post-publish-panel/prepublish.js +3 -1
  16. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  17. package/build/components/post-trash/index.js +1 -1
  18. package/build/components/post-trash/index.js.map +1 -1
  19. package/build/components/provider/index.native.js +12 -6
  20. package/build/components/provider/index.native.js.map +1 -1
  21. package/build/components/provider/use-block-editor-settings.js +11 -6
  22. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  23. package/build/store/actions.js +2 -1
  24. package/build/store/actions.js.map +1 -1
  25. package/build/store/selectors.js +10 -7
  26. package/build/store/selectors.js.map +1 -1
  27. package/build/store/utils/notice-builder.js +1 -1
  28. package/build/store/utils/notice-builder.js.map +1 -1
  29. package/build-module/components/deprecated.js +4 -2
  30. package/build-module/components/deprecated.js.map +1 -1
  31. package/build-module/components/editor-help/add-blocks.native.js +1 -1
  32. package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
  33. package/build-module/components/editor-help/index.native.js +1 -1
  34. package/build-module/components/editor-help/index.native.js.map +1 -1
  35. package/build-module/components/entities-saved-states/index.js +19 -16
  36. package/build-module/components/entities-saved-states/index.js.map +1 -1
  37. package/build-module/components/post-locked-modal/index.js +37 -25
  38. package/build-module/components/post-locked-modal/index.js.map +1 -1
  39. package/build-module/components/post-publish-panel/maybe-category-panel.js +66 -0
  40. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -0
  41. package/build-module/components/post-publish-panel/prepublish.js +2 -1
  42. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  43. package/build-module/components/post-trash/index.js +1 -1
  44. package/build-module/components/post-trash/index.js.map +1 -1
  45. package/build-module/components/provider/index.native.js +10 -7
  46. package/build-module/components/provider/index.native.js.map +1 -1
  47. package/build-module/components/provider/use-block-editor-settings.js +11 -6
  48. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  49. package/build-module/store/actions.js +2 -1
  50. package/build-module/store/actions.js.map +1 -1
  51. package/build-module/store/selectors.js +10 -7
  52. package/build-module/store/selectors.js.map +1 -1
  53. package/build-module/store/utils/notice-builder.js +1 -1
  54. package/build-module/store/utils/notice-builder.js.map +1 -1
  55. package/build-style/style-rtl.css +9 -27
  56. package/build-style/style.css +9 -27
  57. package/package.json +34 -30
  58. package/src/components/autosave-monitor/test/index.js +1 -1
  59. package/src/components/deprecated.js +2 -0
  60. package/src/components/editor-help/add-blocks.native.js +1 -1
  61. package/src/components/editor-help/index.native.js +1 -1
  62. package/src/components/entities-saved-states/index.js +21 -15
  63. package/src/components/entities-saved-states/style.scss +0 -12
  64. package/src/components/post-locked-modal/index.js +92 -53
  65. package/src/components/post-locked-modal/style.scss +7 -17
  66. package/src/components/post-publish-panel/maybe-category-panel.js +88 -0
  67. package/src/components/post-publish-panel/prepublish.js +2 -0
  68. package/src/components/post-trash/index.js +1 -1
  69. package/src/components/provider/index.native.js +10 -7
  70. package/src/components/provider/use-block-editor-settings.js +14 -3
  71. package/src/store/actions.js +1 -0
  72. package/src/store/selectors.js +9 -5
  73. package/src/store/test/actions.js +1 -1
  74. package/src/store/utils/notice-builder.js +1 -1
  75. package/src/store/utils/test/notice-builder.js +1 -1
@@ -35,12 +35,18 @@ function useBlockEditorSettings( settings, hasTemplate ) {
35
35
  hasUploadPermissions,
36
36
  canUseUnfilteredHTML,
37
37
  userCanCreatePages,
38
+ pageOnFront,
38
39
  } = useSelect( ( select ) => {
39
40
  const { canUserUseUnfilteredHTML } = select( editorStore );
40
41
  const isWeb = Platform.OS === 'web';
41
- const { canUser, getUnstableBase, hasFinishedResolution } = select(
42
- coreStore
43
- );
42
+ const {
43
+ canUser,
44
+ getUnstableBase,
45
+ hasFinishedResolution,
46
+ getEntityRecord,
47
+ } = select( coreStore );
48
+
49
+ const siteSettings = getEntityRecord( 'root', 'site' );
44
50
 
45
51
  const siteData = getUnstableBase();
46
52
 
@@ -64,6 +70,7 @@ function useBlockEditorSettings( settings, hasTemplate ) {
64
70
  hasResolvedLocalSiteData: hasFinishedResolvingSiteData,
65
71
  baseUrl: siteData?.url || '',
66
72
  userCanCreatePages: canUser( 'create', 'pages' ),
73
+ pageOnFront: siteSettings?.page_on_front,
67
74
  };
68
75
  }, [] );
69
76
 
@@ -93,6 +100,7 @@ function useBlockEditorSettings( settings, hasTemplate ) {
93
100
  '__experimentalBlockDirectory',
94
101
  '__experimentalBlockPatternCategories',
95
102
  '__experimentalBlockPatterns',
103
+ '__experimentalDiscussionSettings',
96
104
  '__experimentalFeatures',
97
105
  '__experimentalPreferredStyleVariations',
98
106
  '__experimentalSetIsInserterOpened',
@@ -127,6 +135,7 @@ function useBlockEditorSettings( settings, hasTemplate ) {
127
135
  'titlePlaceholder',
128
136
  'supportsLayout',
129
137
  'widgetTypesToHideFromLegacyWidgetBlock',
138
+ '__unstableResolvedAssets',
130
139
  ] ),
131
140
  mediaUpload: hasUploadPermissions ? mediaUpload : undefined,
132
141
  __experimentalReusableBlocks: reusableBlocks,
@@ -138,6 +147,7 @@ function useBlockEditorSettings( settings, hasTemplate ) {
138
147
  outlineMode: hasTemplate,
139
148
  __experimentalCreatePageEntity: createPageEntity,
140
149
  __experimentalUserCanCreatePages: userCanCreatePages,
150
+ pageOnFront,
141
151
  } ),
142
152
  [
143
153
  settings,
@@ -147,6 +157,7 @@ function useBlockEditorSettings( settings, hasTemplate ) {
147
157
  undo,
148
158
  hasTemplate,
149
159
  userCanCreatePages,
160
+ pageOnFront,
150
161
  ]
151
162
  );
152
163
  }
@@ -629,6 +629,7 @@ const getBlockEditorAction = ( name ) =>
629
629
  since: '5.3',
630
630
  alternative:
631
631
  "`wp.data.dispatch( 'core/block-editor' )." + name + '`',
632
+ version: '6.2',
632
633
  } );
633
634
  yield controls.dispatch( blockEditorStore, name, ...args );
634
635
  };
@@ -839,7 +839,12 @@ export function getEditedPostPreviewLink( state ) {
839
839
  }
840
840
 
841
841
  let previewLink = getAutosaveAttribute( state, 'preview_link' );
842
- if ( ! previewLink ) {
842
+ // Fix for issue: https://github.com/WordPress/gutenberg/issues/33616
843
+ // If the post is draft, ignore the preview link from the autosave record,
844
+ // because the preview could be a stale autosave if the post was switched from
845
+ // published to draft.
846
+ // See: https://github.com/WordPress/gutenberg/pull/37952
847
+ if ( ! previewLink || 'draft' === getCurrentPost( state ).status ) {
843
848
  previewLink = getEditedPostAttribute( state, 'link' );
844
849
  if ( previewLink ) {
845
850
  previewLink = addQueryArgs( previewLink, { preview: true } );
@@ -1166,8 +1171,7 @@ export function getEditorBlocks( state ) {
1166
1171
  */
1167
1172
  export function getEditorSelectionStart( state ) {
1168
1173
  deprecated( "select('core/editor').getEditorSelectionStart", {
1169
- since: '10.0',
1170
- plugin: 'Gutenberg',
1174
+ since: '5.8',
1171
1175
  alternative: "select('core/editor').getEditorSelection",
1172
1176
  } );
1173
1177
  return getEditedPostAttribute( state, 'selection' )?.selectionStart;
@@ -1183,8 +1187,7 @@ export function getEditorSelectionStart( state ) {
1183
1187
  */
1184
1188
  export function getEditorSelectionEnd( state ) {
1185
1189
  deprecated( "select('core/editor').getEditorSelectionStart", {
1186
- since: '10.0',
1187
- plugin: 'Gutenberg',
1190
+ since: '5.8',
1188
1191
  alternative: "select('core/editor').getEditorSelection",
1189
1192
  } );
1190
1193
  return getEditedPostAttribute( state, 'selection' )?.selectionEnd;
@@ -1258,6 +1261,7 @@ function getBlockEditorSelector( name ) {
1258
1261
  deprecated( "`wp.data.select( 'core/editor' )." + name + '`', {
1259
1262
  since: '5.3',
1260
1263
  alternative: "`wp.data.select( 'core/block-editor' )." + name + '`',
1264
+ version: '6.2',
1261
1265
  } );
1262
1266
 
1263
1267
  return select( blockEditorStore )[ name ]( ...args );
@@ -196,7 +196,7 @@ describe( 'Post generator actions', () => {
196
196
  'createSuccessNotice',
197
197
  currentPostStatus === 'publish'
198
198
  ? 'Updated Post'
199
- : 'Saved',
199
+ : 'Draft saved',
200
200
  {
201
201
  actions: [],
202
202
  id: 'SAVE_POST_NOTICE_ID',
@@ -38,7 +38,7 @@ export function getNotificationArgumentsForSaveSuccess( data ) {
38
38
  // Always should a notice, which will be spoken for accessibility.
39
39
  if ( ! isPublished && ! willPublish ) {
40
40
  // If saving a non-published post, don't show notice.
41
- noticeMessage = __( 'Saved' );
41
+ noticeMessage = __( 'Draft saved' );
42
42
  shouldShowLink = false;
43
43
  } else if ( isPublished && ! willPublish ) {
44
44
  // If undoing publish status, show specific notice
@@ -34,7 +34,7 @@ describe( 'getNotificationArgumentsForSaveSuccess()', () => {
34
34
  [
35
35
  'when previous post is not published and post will not be published',
36
36
  [ 'draft', 'draft', false ],
37
- [ 'Saved', defaultExpectedAction ],
37
+ [ 'Draft saved', defaultExpectedAction ],
38
38
  ],
39
39
  [
40
40
  'when previous post is published and post will be unpublished',