@wordpress/editor 11.0.2 → 12.0.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 (123) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +1 -1
  3. package/build/components/autosave-monitor/index.js +5 -0
  4. package/build/components/autosave-monitor/index.js.map +1 -1
  5. package/build/components/character-count/index.js +1 -1
  6. package/build/components/character-count/index.js.map +1 -1
  7. package/build/components/editor-help/help-get-support-button.native.js +46 -0
  8. package/build/components/editor-help/help-get-support-button.native.js.map +1 -0
  9. package/build/components/editor-help/index.native.js +24 -5
  10. package/build/components/editor-help/index.native.js.map +1 -1
  11. package/build/components/entities-saved-states/entity-type-list.js +22 -13
  12. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  13. package/build/components/entities-saved-states/index.js +23 -4
  14. package/build/components/entities-saved-states/index.js.map +1 -1
  15. package/build/components/global-keyboard-shortcuts/save-shortcut.js +12 -14
  16. package/build/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  17. package/build/components/global-keyboard-shortcuts/visual-editor-shortcuts.js +0 -4
  18. package/build/components/global-keyboard-shortcuts/visual-editor-shortcuts.js.map +1 -1
  19. package/build/components/post-format/index.js +3 -1
  20. package/build/components/post-format/index.js.map +1 -1
  21. package/build/components/post-locked-modal/index.js +1 -1
  22. package/build/components/post-locked-modal/index.js.map +1 -1
  23. package/build/components/post-saved-state/index.js +37 -46
  24. package/build/components/post-saved-state/index.js.map +1 -1
  25. package/build/components/post-taxonomies/flat-term-selector.js +154 -211
  26. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  27. package/build/components/post-title/index.js +5 -3
  28. package/build/components/post-title/index.js.map +1 -1
  29. package/build/components/provider/index.native.js +3 -1
  30. package/build/components/provider/index.native.js.map +1 -1
  31. package/build/components/provider/use-block-editor-settings.js +32 -5
  32. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  33. package/build/components/word-count/index.js +1 -1
  34. package/build/components/word-count/index.js.map +1 -1
  35. package/build/store/actions.js +0 -25
  36. package/build/store/actions.js.map +1 -1
  37. package/build/store/selectors.js +3 -84
  38. package/build/store/selectors.js.map +1 -1
  39. package/build/store/utils/notice-builder.js +15 -18
  40. package/build/store/utils/notice-builder.js.map +1 -1
  41. package/build/{store/utils → utils}/get-template-part-icon.js +1 -1
  42. package/build/utils/get-template-part-icon.js.map +1 -0
  43. package/build/utils/index.js +8 -0
  44. package/build/utils/index.js.map +1 -1
  45. package/build-module/components/autosave-monitor/index.js +5 -0
  46. package/build-module/components/autosave-monitor/index.js.map +1 -1
  47. package/build-module/components/character-count/index.js +1 -1
  48. package/build-module/components/character-count/index.js.map +1 -1
  49. package/build-module/components/editor-help/help-get-support-button.native.js +34 -0
  50. package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -0
  51. package/build-module/components/editor-help/index.native.js +22 -6
  52. package/build-module/components/editor-help/index.native.js.map +1 -1
  53. package/build-module/components/entities-saved-states/entity-type-list.js +24 -13
  54. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  55. package/build-module/components/entities-saved-states/index.js +23 -4
  56. package/build-module/components/entities-saved-states/index.js.map +1 -1
  57. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js +12 -14
  58. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  59. package/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js +0 -4
  60. package/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js.map +1 -1
  61. package/build-module/components/post-format/index.js +4 -2
  62. package/build-module/components/post-format/index.js.map +1 -1
  63. package/build-module/components/post-locked-modal/index.js +1 -1
  64. package/build-module/components/post-locked-modal/index.js.map +1 -1
  65. package/build-module/components/post-saved-state/index.js +38 -46
  66. package/build-module/components/post-saved-state/index.js.map +1 -1
  67. package/build-module/components/post-taxonomies/flat-term-selector.js +156 -214
  68. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  69. package/build-module/components/post-title/index.js +5 -3
  70. package/build-module/components/post-title/index.js.map +1 -1
  71. package/build-module/components/provider/index.native.js +3 -1
  72. package/build-module/components/provider/index.native.js.map +1 -1
  73. package/build-module/components/provider/use-block-editor-settings.js +31 -5
  74. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  75. package/build-module/components/word-count/index.js +1 -1
  76. package/build-module/components/word-count/index.js.map +1 -1
  77. package/build-module/store/actions.js +0 -23
  78. package/build-module/store/actions.js.map +1 -1
  79. package/build-module/store/selectors.js +3 -80
  80. package/build-module/store/selectors.js.map +1 -1
  81. package/build-module/store/utils/notice-builder.js +15 -18
  82. package/build-module/store/utils/notice-builder.js.map +1 -1
  83. package/build-module/{store/utils → utils}/get-template-part-icon.js +2 -2
  84. package/build-module/utils/get-template-part-icon.js.map +1 -0
  85. package/build-module/utils/index.js +1 -0
  86. package/build-module/utils/index.js.map +1 -1
  87. package/build-style/style-rtl.css +6 -1
  88. package/build-style/style.css +6 -1
  89. package/package.json +28 -28
  90. package/src/components/autosave-monitor/index.js +5 -0
  91. package/src/components/autosave-monitor/test/index.js +10 -4
  92. package/src/components/character-count/index.js +3 -2
  93. package/src/components/editor-help/help-get-support-button.native.js +38 -0
  94. package/src/components/editor-help/index.native.js +130 -80
  95. package/src/components/editor-help/style.android.scss +6 -0
  96. package/src/components/editor-help/style.ios.scss +6 -0
  97. package/src/components/editor-help/style.scss +25 -0
  98. package/src/components/editor-help/test/index.native.js +80 -0
  99. package/src/components/entities-saved-states/entity-type-list.js +29 -10
  100. package/src/components/entities-saved-states/index.js +38 -8
  101. package/src/components/global-keyboard-shortcuts/save-shortcut.js +34 -42
  102. package/src/components/global-keyboard-shortcuts/visual-editor-shortcuts.js +8 -16
  103. package/src/components/post-format/index.js +6 -2
  104. package/src/components/post-format/style.scss +1 -0
  105. package/src/components/post-locked-modal/index.js +1 -1
  106. package/src/components/post-saved-state/index.js +41 -55
  107. package/src/components/post-saved-state/style.scss +10 -1
  108. package/src/components/post-saved-state/test/__snapshots__/index.js.snap +20 -0
  109. package/src/components/post-saved-state/test/index.js +2 -2
  110. package/src/components/post-taxonomies/flat-term-selector.js +220 -254
  111. package/src/components/post-title/index.js +5 -3
  112. package/src/components/provider/index.native.js +2 -0
  113. package/src/components/provider/use-block-editor-settings.js +24 -2
  114. package/src/components/word-count/index.js +3 -2
  115. package/src/store/actions.js +0 -28
  116. package/src/store/selectors.js +2 -105
  117. package/src/store/test/actions.js +4 -2
  118. package/src/store/utils/notice-builder.js +17 -19
  119. package/src/store/utils/test/notice-builder.js +1 -1
  120. package/src/{store/utils → utils}/get-template-part-icon.js +2 -2
  121. package/src/utils/index.js +1 -0
  122. package/build/store/utils/get-template-part-icon.js.map +0 -1
  123. package/build-module/store/utils/get-template-part-icon.js.map +0 -1
@@ -100,34 +100,6 @@ export function resetPost( post ) {
100
100
  };
101
101
  }
102
102
 
103
- /**
104
- * Returns an action object used in signalling that the latest autosave of the
105
- * post has been received, by initialization or autosave.
106
- *
107
- * @deprecated since 5.6. Callers should use the `receiveAutosaves( postId, autosave )`
108
- * selector from the '@wordpress/core-data' package.
109
- *
110
- * @param {Object} newAutosave Autosave post object.
111
- *
112
- * @return {Object} Action object.
113
- */
114
- export function* resetAutosave( newAutosave ) {
115
- deprecated( 'resetAutosave action (`core/editor` store)', {
116
- since: '5.3',
117
- alternative: 'receiveAutosaves action (`core` store)',
118
- } );
119
-
120
- const postId = yield controls.select( STORE_NAME, 'getCurrentPostId' );
121
- yield controls.dispatch(
122
- coreStore,
123
- 'receiveAutosaves',
124
- postId,
125
- newAutosave
126
- );
127
-
128
- return { type: '__INERT__' };
129
- }
130
-
131
103
  /**
132
104
  * Action for dispatching that a post update request has started.
133
105
  *
@@ -1,16 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import {
5
- find,
6
- get,
7
- has,
8
- isString,
9
- pick,
10
- mapValues,
11
- includes,
12
- some,
13
- } from 'lodash';
4
+ import { find, get, has, isString, includes, some } from 'lodash';
14
5
  import createSelector from 'rememo';
15
6
 
16
7
  /**
@@ -19,7 +10,6 @@ import createSelector from 'rememo';
19
10
  import {
20
11
  getFreeformContentHandlerName,
21
12
  getDefaultBlockName,
22
- isUnmodifiedDefaultBlock,
23
13
  __unstableSerializeAndClean,
24
14
  } from '@wordpress/blocks';
25
15
  import { isInTheFuture, getDate } from '@wordpress/date';
@@ -43,7 +33,7 @@ import {
43
33
  } from './constants';
44
34
  import { getPostRawValue } from './reducer';
45
35
  import { cleanForSlug } from '../utils/url';
46
- import { getTemplatePartIcon } from './utils/get-template-part-icon';
36
+ import { getTemplatePartIcon } from '../utils/get-template-part-icon';
47
37
 
48
38
  /**
49
39
  * Shared reference to an empty object for cases where it is important to avoid
@@ -678,63 +668,6 @@ export const isEditedPostAutosaveable = createRegistrySelector(
678
668
  }
679
669
  );
680
670
 
681
- /**
682
- * Returns the current autosave, or null if one is not set (i.e. if the post
683
- * has yet to be autosaved, or has been saved or published since the last
684
- * autosave).
685
- *
686
- * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )`
687
- * selector from the '@wordpress/core-data' package.
688
- *
689
- * @param {Object} state Editor state.
690
- *
691
- * @return {?Object} Current autosave, if exists.
692
- */
693
- export const getAutosave = createRegistrySelector( ( select ) => ( state ) => {
694
- deprecated( "`wp.data.select( 'core/editor' ).getAutosave()`", {
695
- since: '5.3',
696
- alternative:
697
- "`wp.data.select( 'core' ).getAutosave( postType, postId, userId )`",
698
- } );
699
-
700
- const postType = getCurrentPostType( state );
701
- const postId = getCurrentPostId( state );
702
- const currentUserId = get( select( coreStore ).getCurrentUser(), [ 'id' ] );
703
- const autosave = select( coreStore ).getAutosave(
704
- postType,
705
- postId,
706
- currentUserId
707
- );
708
- return mapValues( pick( autosave, AUTOSAVE_PROPERTIES ), getPostRawValue );
709
- } );
710
-
711
- /**
712
- * Returns the true if there is an existing autosave, otherwise false.
713
- *
714
- * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector
715
- * from the '@wordpress/core-data' package and check for a truthy value.
716
- *
717
- * @param {Object} state Global application state.
718
- *
719
- * @return {boolean} Whether there is an existing autosave.
720
- */
721
- export const hasAutosave = createRegistrySelector( ( select ) => ( state ) => {
722
- deprecated( "`wp.data.select( 'core/editor' ).hasAutosave()`", {
723
- since: '5.3',
724
- alternative:
725
- "`!! wp.data.select( 'core' ).getAutosave( postType, postId, userId )`",
726
- } );
727
-
728
- const postType = getCurrentPostType( state );
729
- const postId = getCurrentPostId( state );
730
- const currentUserId = get( select( coreStore ).getCurrentUser(), [ 'id' ] );
731
- return !! select( coreStore ).getAutosave(
732
- postType,
733
- postId,
734
- currentUserId
735
- );
736
- } );
737
-
738
671
  /**
739
672
  * Return true if the post being edited is being scheduled. Preferring the
740
673
  * unsaved status values.
@@ -975,42 +908,6 @@ export function getSuggestedPostFormat( state ) {
975
908
  }
976
909
  }
977
910
 
978
- /**
979
- * Returns a set of blocks which are to be used in consideration of the post's
980
- * generated save content.
981
- *
982
- * @deprecated since Gutenberg 6.2.0.
983
- *
984
- * @param {Object} state Editor state.
985
- *
986
- * @return {WPBlock[]} Filtered set of blocks for save.
987
- */
988
- export function getBlocksForSerialization( state ) {
989
- deprecated( '`core/editor` getBlocksForSerialization selector', {
990
- since: '5.3',
991
- alternative: 'getEditorBlocks',
992
- hint: 'Blocks serialization pre-processing occurs at save time',
993
- } );
994
-
995
- const blocks = state.editor.present.blocks.value;
996
-
997
- // WARNING: Any changes to the logic of this function should be verified
998
- // against the implementation of isEditedPostEmpty, which bypasses this
999
- // function for performance' sake, in an assumption of this current logic
1000
- // being irrelevant to the optimized condition of emptiness.
1001
-
1002
- // A single unmodified default block is assumed to be equivalent to an
1003
- // empty post.
1004
- const isSingleUnmodifiedDefaultBlock =
1005
- blocks.length === 1 && isUnmodifiedDefaultBlock( blocks[ 0 ] );
1006
-
1007
- if ( isSingleUnmodifiedDefaultBlock ) {
1008
- return [];
1009
- }
1010
-
1011
- return blocks;
1012
- }
1013
-
1014
911
  /**
1015
912
  * Returns the content of the post being edited.
1016
913
  *
@@ -188,13 +188,15 @@ describe( 'Post generator actions', () => {
188
188
  'yields an action for dispatching a success notice',
189
189
  () => true,
190
190
  () => {
191
- if ( ! isAutosave && currentPostStatus === 'publish' ) {
191
+ if ( ! isAutosave ) {
192
192
  const { value } = fulfillment.next( postType );
193
193
  expect( value ).toEqual(
194
194
  controls.dispatch(
195
195
  noticesStore,
196
196
  'createSuccessNotice',
197
- 'Updated Post',
197
+ currentPostStatus === 'publish'
198
+ ? 'Updated Post'
199
+ : 'Saved',
198
200
  {
199
201
  actions: [],
200
202
  id: 'SAVE_POST_NOTICE_ID',
@@ -35,9 +35,11 @@ export function getNotificationArgumentsForSaveSuccess( data ) {
35
35
  let noticeMessage;
36
36
  let shouldShowLink = get( postType, [ 'viewable' ], false );
37
37
 
38
+ // Always should a notice, which will be spoken for accessibility.
38
39
  if ( ! isPublished && ! willPublish ) {
39
40
  // If saving a non-published post, don't show notice.
40
- noticeMessage = null;
41
+ noticeMessage = __( 'Saved' );
42
+ shouldShowLink = false;
41
43
  } else if ( isPublished && ! willPublish ) {
42
44
  // If undoing publish status, show specific notice
43
45
  noticeMessage = postType.labels.item_reverted_to_draft;
@@ -55,25 +57,21 @@ export function getNotificationArgumentsForSaveSuccess( data ) {
55
57
  noticeMessage = postType.labels.item_updated;
56
58
  }
57
59
 
58
- if ( noticeMessage ) {
59
- const actions = [];
60
- if ( shouldShowLink ) {
61
- actions.push( {
62
- label: postType.labels.view_item,
63
- url: post.link,
64
- } );
65
- }
66
- return [
67
- noticeMessage,
68
- {
69
- id: SAVE_POST_NOTICE_ID,
70
- type: 'snackbar',
71
- actions,
72
- },
73
- ];
60
+ const actions = [];
61
+ if ( shouldShowLink ) {
62
+ actions.push( {
63
+ label: postType.labels.view_item,
64
+ url: post.link,
65
+ } );
74
66
  }
75
-
76
- return [];
67
+ return [
68
+ noticeMessage,
69
+ {
70
+ id: SAVE_POST_NOTICE_ID,
71
+ type: 'snackbar',
72
+ actions,
73
+ },
74
+ ];
77
75
  }
78
76
 
79
77
  /**
@@ -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
- [],
37
+ [ 'Saved', defaultExpectedAction ],
38
38
  ],
39
39
  [
40
40
  'when previous post is published and post will be unpublished',
@@ -5,7 +5,7 @@ import {
5
5
  header as headerIcon,
6
6
  footer as footerIcon,
7
7
  sidebar as sidebarIcon,
8
- layout as layoutIcon,
8
+ symbolFilled as symbolFilledIcon,
9
9
  } from '@wordpress/icons';
10
10
  /**
11
11
  * Helper function to retrieve the corresponding icon by name.
@@ -22,5 +22,5 @@ export function getTemplatePartIcon( iconName ) {
22
22
  } else if ( 'sidebar' === iconName ) {
23
23
  return sidebarIcon;
24
24
  }
25
- return layoutIcon;
25
+ return symbolFilledIcon;
26
26
  }
@@ -5,3 +5,4 @@ import mediaUpload from './media-upload';
5
5
 
6
6
  export { mediaUpload };
7
7
  export { cleanForSlug } from './url.js';
8
+ export { getTemplatePartIcon } from './get-template-part-icon';
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/editor/src/store/utils/get-template-part-icon.js"],"names":["getTemplatePartIcon","iconName","headerIcon","footerIcon","sidebarIcon","layoutIcon"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mBAAT,CAA8BC,QAA9B,EAAyC;AAC/C,MAAK,aAAaA,QAAlB,EAA6B;AAC5B,WAAOC,aAAP;AACA,GAFD,MAEO,IAAK,aAAaD,QAAlB,EAA6B;AACnC,WAAOE,aAAP;AACA,GAFM,MAEA,IAAK,cAAcF,QAAnB,EAA8B;AACpC,WAAOG,cAAP;AACA;;AACD,SAAOC,aAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\theader as headerIcon,\n\tfooter as footerIcon,\n\tsidebar as sidebarIcon,\n\tlayout as layoutIcon,\n} from '@wordpress/icons';\n/**\n * Helper function to retrieve the corresponding icon by name.\n *\n * @param {string} iconName The name of the icon.\n *\n * @return {Object} The corresponding icon.\n */\nexport function getTemplatePartIcon( iconName ) {\n\tif ( 'header' === iconName ) {\n\t\treturn headerIcon;\n\t} else if ( 'footer' === iconName ) {\n\t\treturn footerIcon;\n\t} else if ( 'sidebar' === iconName ) {\n\t\treturn sidebarIcon;\n\t}\n\treturn layoutIcon;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/editor/src/store/utils/get-template-part-icon.js"],"names":["header","headerIcon","footer","footerIcon","sidebar","sidebarIcon","layout","layoutIcon","getTemplatePartIcon","iconName"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,MAAM,IAAIC,UADX,EAECC,MAAM,IAAIC,UAFX,EAGCC,OAAO,IAAIC,WAHZ,EAICC,MAAM,IAAIC,UAJX,QAKO,kBALP;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,mBAAT,CAA8BC,QAA9B,EAAyC;AAC/C,MAAK,aAAaA,QAAlB,EAA6B;AAC5B,WAAOR,UAAP;AACA,GAFD,MAEO,IAAK,aAAaQ,QAAlB,EAA6B;AACnC,WAAON,UAAP;AACA,GAFM,MAEA,IAAK,cAAcM,QAAnB,EAA8B;AACpC,WAAOJ,WAAP;AACA;;AACD,SAAOE,UAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\theader as headerIcon,\n\tfooter as footerIcon,\n\tsidebar as sidebarIcon,\n\tlayout as layoutIcon,\n} from '@wordpress/icons';\n/**\n * Helper function to retrieve the corresponding icon by name.\n *\n * @param {string} iconName The name of the icon.\n *\n * @return {Object} The corresponding icon.\n */\nexport function getTemplatePartIcon( iconName ) {\n\tif ( 'header' === iconName ) {\n\t\treturn headerIcon;\n\t} else if ( 'footer' === iconName ) {\n\t\treturn footerIcon;\n\t} else if ( 'sidebar' === iconName ) {\n\t\treturn sidebarIcon;\n\t}\n\treturn layoutIcon;\n}\n"]}