@wordpress/editor 13.3.6 → 13.5.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 (127) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/document-outline/index.js +7 -1
  3. package/build/components/document-outline/index.js.map +1 -1
  4. package/build/components/page-attributes/check.js +6 -10
  5. package/build/components/page-attributes/check.js.map +1 -1
  6. package/build/components/page-attributes/order.js +3 -5
  7. package/build/components/page-attributes/order.js.map +1 -1
  8. package/build/components/page-attributes/parent.js +9 -6
  9. package/build/components/page-attributes/parent.js.map +1 -1
  10. package/build/components/post-author/check.js +3 -7
  11. package/build/components/post-author/check.js.map +1 -1
  12. package/build/components/post-featured-image/index.js +7 -12
  13. package/build/components/post-featured-image/index.js.map +1 -1
  14. package/build/components/post-locked-modal/index.js +1 -7
  15. package/build/components/post-locked-modal/index.js.map +1 -1
  16. package/build/components/post-pending-status/check.js +3 -7
  17. package/build/components/post-pending-status/check.js.map +1 -1
  18. package/build/components/post-preview-button/index.js +3 -3
  19. package/build/components/post-preview-button/index.js.map +1 -1
  20. package/build/components/post-publish-button/index.js +4 -4
  21. package/build/components/post-publish-button/index.js.map +1 -1
  22. package/build/components/post-publish-button/label.js +3 -7
  23. package/build/components/post-publish-button/label.js.map +1 -1
  24. package/build/components/post-publish-panel/index.js +4 -8
  25. package/build/components/post-publish-panel/index.js.map +1 -1
  26. package/build/components/post-publish-panel/maybe-post-format-panel.js +3 -7
  27. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  28. package/build/components/post-publish-panel/postpublish.js +5 -9
  29. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  30. package/build/components/post-publish-panel/prepublish.js +3 -7
  31. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  32. package/build/components/post-schedule/check.js +3 -7
  33. package/build/components/post-schedule/check.js.map +1 -1
  34. package/build/components/post-sticky/check.js +3 -7
  35. package/build/components/post-sticky/check.js.map +1 -1
  36. package/build/components/post-taxonomies/flat-term-selector.js +12 -9
  37. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  38. package/build/components/post-taxonomies/hierarchical-term-selector.js +18 -12
  39. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  40. package/build/components/post-taxonomies/most-used-terms.js +2 -9
  41. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  42. package/build/components/post-title/index.native.js +1 -0
  43. package/build/components/post-title/index.native.js.map +1 -1
  44. package/build/components/post-visibility/check.js +3 -7
  45. package/build/components/post-visibility/check.js.map +1 -1
  46. package/build/components/theme-support-check/index.js +3 -7
  47. package/build/components/theme-support-check/index.js.map +1 -1
  48. package/build/store/utils/notice-builder.js +4 -8
  49. package/build/store/utils/notice-builder.js.map +1 -1
  50. package/build-module/components/document-outline/index.js +8 -2
  51. package/build-module/components/document-outline/index.js.map +1 -1
  52. package/build-module/components/page-attributes/check.js +6 -9
  53. package/build-module/components/page-attributes/check.js.map +1 -1
  54. package/build-module/components/page-attributes/order.js +4 -6
  55. package/build-module/components/page-attributes/order.js.map +1 -1
  56. package/build-module/components/page-attributes/parent.js +9 -5
  57. package/build-module/components/page-attributes/parent.js.map +1 -1
  58. package/build-module/components/post-author/check.js +3 -6
  59. package/build-module/components/post-author/check.js.map +1 -1
  60. package/build-module/components/post-featured-image/index.js +7 -11
  61. package/build-module/components/post-featured-image/index.js.map +1 -1
  62. package/build-module/components/post-locked-modal/index.js +1 -6
  63. package/build-module/components/post-locked-modal/index.js.map +1 -1
  64. package/build-module/components/post-pending-status/check.js +3 -6
  65. package/build-module/components/post-pending-status/check.js.map +1 -1
  66. package/build-module/components/post-preview-button/index.js +3 -2
  67. package/build-module/components/post-preview-button/index.js.map +1 -1
  68. package/build-module/components/post-publish-button/index.js +4 -3
  69. package/build-module/components/post-publish-button/index.js.map +1 -1
  70. package/build-module/components/post-publish-button/label.js +3 -6
  71. package/build-module/components/post-publish-button/label.js.map +1 -1
  72. package/build-module/components/post-publish-panel/index.js +4 -7
  73. package/build-module/components/post-publish-panel/index.js.map +1 -1
  74. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +3 -6
  75. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  76. package/build-module/components/post-publish-panel/postpublish.js +5 -8
  77. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  78. package/build-module/components/post-publish-panel/prepublish.js +3 -6
  79. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  80. package/build-module/components/post-schedule/check.js +3 -6
  81. package/build-module/components/post-schedule/check.js.map +1 -1
  82. package/build-module/components/post-sticky/check.js +3 -6
  83. package/build-module/components/post-sticky/check.js.map +1 -1
  84. package/build-module/components/post-taxonomies/flat-term-selector.js +12 -8
  85. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  86. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +18 -11
  87. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  88. package/build-module/components/post-taxonomies/most-used-terms.js +2 -8
  89. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  90. package/build-module/components/post-title/index.native.js +1 -0
  91. package/build-module/components/post-title/index.native.js.map +1 -1
  92. package/build-module/components/post-visibility/check.js +3 -6
  93. package/build-module/components/post-visibility/check.js.map +1 -1
  94. package/build-module/components/theme-support-check/index.js +3 -6
  95. package/build-module/components/theme-support-check/index.js.map +1 -1
  96. package/build-module/store/utils/notice-builder.js +4 -7
  97. package/build-module/store/utils/notice-builder.js.map +1 -1
  98. package/build-style/style-rtl.css +1 -13
  99. package/build-style/style.css +1 -13
  100. package/package.json +30 -30
  101. package/src/components/document-outline/index.js +6 -3
  102. package/src/components/page-attributes/check.js +3 -12
  103. package/src/components/page-attributes/order.js +18 -12
  104. package/src/components/page-attributes/parent.js +41 -41
  105. package/src/components/post-author/check.js +2 -10
  106. package/src/components/post-featured-image/index.js +5 -10
  107. package/src/components/post-locked-modal/index.js +1 -6
  108. package/src/components/post-pending-status/check.js +2 -10
  109. package/src/components/post-preview-button/index.js +1 -2
  110. package/src/components/post-publish-button/index.js +3 -7
  111. package/src/components/post-publish-button/label.js +2 -10
  112. package/src/components/post-publish-panel/index.js +3 -11
  113. package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -10
  114. package/src/components/post-publish-panel/postpublish.js +3 -8
  115. package/src/components/post-publish-panel/prepublish.js +2 -10
  116. package/src/components/post-publish-panel/style.scss +1 -1
  117. package/src/components/post-schedule/check.js +2 -10
  118. package/src/components/post-sticky/check.js +1 -10
  119. package/src/components/post-taxonomies/flat-term-selector.js +14 -34
  120. package/src/components/post-taxonomies/hierarchical-term-selector.js +15 -37
  121. package/src/components/post-taxonomies/most-used-terms.js +15 -18
  122. package/src/components/post-title/index.native.js +1 -0
  123. package/src/components/post-visibility/check.js +2 -10
  124. package/src/components/theme-support-check/index.js +1 -6
  125. package/src/store/utils/notice-builder.js +2 -7
  126. package/src/style.scss +0 -1
  127. package/src/components/page-attributes/style.scss +0 -12
@@ -7,11 +7,6 @@ import { __ } from '@wordpress/i18n';
7
7
  */
8
8
 
9
9
  import { SAVE_POST_NOTICE_ID, TRASH_POST_NOTICE_ID } from '../constants';
10
- /**
11
- * External dependencies
12
- */
13
-
14
- import { get } from 'lodash';
15
10
  /**
16
11
  * Builds the arguments for a success notification dispatch.
17
12
  *
@@ -22,13 +17,15 @@ import { get } from 'lodash';
22
17
  */
23
18
 
24
19
  export function getNotificationArgumentsForSaveSuccess(data) {
20
+ var _data$options, _postType$viewable;
21
+
25
22
  const {
26
23
  previousPost,
27
24
  post,
28
25
  postType
29
26
  } = data; // Autosaves are neither shown a notice nor redirected.
30
27
 
31
- if (get(data.options, ['isAutosave'])) {
28
+ if ((_data$options = data.options) !== null && _data$options !== void 0 && _data$options.isAutosave) {
32
29
  return [];
33
30
  } // No notice is shown after trashing a post
34
31
 
@@ -41,7 +38,7 @@ export function getNotificationArgumentsForSaveSuccess(data) {
41
38
  const isPublished = publishStatus.includes(previousPost.status);
42
39
  const willPublish = publishStatus.includes(post.status);
43
40
  let noticeMessage;
44
- let shouldShowLink = get(postType, ['viewable'], false);
41
+ let shouldShowLink = (_postType$viewable = postType === null || postType === void 0 ? void 0 : postType.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false;
45
42
  let isDraft; // Always should a notice, which will be spoken for accessibility.
46
43
 
47
44
  if (!isPublished && !willPublish) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/store/utils/notice-builder.js"],"names":["__","SAVE_POST_NOTICE_ID","TRASH_POST_NOTICE_ID","get","getNotificationArgumentsForSaveSuccess","data","previousPost","post","postType","options","status","publishStatus","isPublished","includes","willPublish","noticeMessage","shouldShowLink","isDraft","labels","item_reverted_to_draft","publish","item_published","private","item_published_privately","future","item_scheduled","item_updated","actions","push","label","view_item","url","link","id","type","getNotificationArgumentsForSaveFail","edits","error","code","indexOf","messages","message","test","join","getNotificationArgumentsForTrashFail"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,mBAAT,EAA8BC,oBAA9B,QAA0D,cAA1D;AAEA;AACA;AACA;;AACA,SAASC,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,sCAAT,CAAiDC,IAAjD,EAAwD;AAC9D,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,IAAhB;AAAsBC,IAAAA;AAAtB,MAAmCH,IAAzC,CAD8D,CAE9D;;AACA,MAAKF,GAAG,CAAEE,IAAI,CAACI,OAAP,EAAgB,CAAE,YAAF,CAAhB,CAAR,EAA6C;AAC5C,WAAO,EAAP;AACA,GAL6D,CAO9D;;;AACA,MAAKF,IAAI,CAACG,MAAL,KAAgB,OAAhB,IAA2BJ,YAAY,CAACI,MAAb,KAAwB,OAAxD,EAAkE;AACjE,WAAO,EAAP;AACA;;AAED,QAAMC,aAAa,GA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A,aAAa,GAAG,CAAEA,aAAF,EAAiBsB,KAAK,CAACI,OAAvB,EAAiCE,IAAjC,CAAuC,GAAvC,CAAhB;AACA;;AACD,SAAO,CACN5B,aADM,EAEN;AACCkB,IAAAA,EAAE,EAAEhC;AADL,GAFM,CAAP;AAMA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAAS2C,oCAAT,CAA+CvC,IAA/C,EAAsD;AAC5D,SAAO,CACNA,IAAI,CAACgC,KAAL,CAAWI,OAAX,IAAsBpC,IAAI,CAACgC,KAAL,CAAWC,IAAX,KAAoB,eAA1C,GACGjC,IAAI,CAACgC,KAAL,CAAWI,OADd,GAEGzC,EAAE,CAAE,iBAAF,CAHC,EAIN;AACCiC,IAAAA,EAAE,EAAE/B;AADL,GAJM,CAAP;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { SAVE_POST_NOTICE_ID, TRASH_POST_NOTICE_ID } from '../constants';\n\n/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * Builds the arguments for a success notification dispatch.\n *\n * @param {Object} data Incoming data to build the arguments from.\n *\n * @return {Array} Arguments for dispatch. An empty array signals no\n * notification should be sent.\n */\nexport function getNotificationArgumentsForSaveSuccess( data ) {\n\tconst { previousPost, post, postType } = data;\n\t// Autosaves are neither shown a notice nor redirected.\n\tif ( get( data.options, [ 'isAutosave' ] ) ) {\n\t\treturn [];\n\t}\n\n\t// No notice is shown after trashing a post\n\tif ( post.status === 'trash' && previousPost.status !== 'trash' ) {\n\t\treturn [];\n\t}\n\n\tconst publishStatus = [ 'publish', 'private', 'future' ];\n\tconst isPublished = publishStatus.includes( previousPost.status );\n\tconst willPublish = publishStatus.includes( post.status );\n\n\tlet noticeMessage;\n\tlet shouldShowLink = get( postType, [ 'viewable' ], false );\n\tlet isDraft;\n\n\t// Always should a notice, which will be spoken for accessibility.\n\tif ( ! isPublished && ! willPublish ) {\n\t\t// If saving a non-published post, don't show notice.\n\t\tnoticeMessage = __( 'Draft saved.' );\n\t\tisDraft = true;\n\t} else if ( isPublished && ! willPublish ) {\n\t\t// If undoing publish status, show specific notice.\n\t\tnoticeMessage = postType.labels.item_reverted_to_draft;\n\t\tshouldShowLink = false;\n\t} else if ( ! isPublished && willPublish ) {\n\t\t// If publishing or scheduling a post, show the corresponding\n\t\t// publish message.\n\t\tnoticeMessage = {\n\t\t\tpublish: postType.labels.item_published,\n\t\t\tprivate: postType.labels.item_published_privately,\n\t\t\tfuture: postType.labels.item_scheduled,\n\t\t}[ post.status ];\n\t} else {\n\t\t// Generic fallback notice.\n\t\tnoticeMessage = postType.labels.item_updated;\n\t}\n\n\tconst actions = [];\n\tif ( shouldShowLink ) {\n\t\tactions.push( {\n\t\t\tlabel: isDraft ? __( 'View Preview' ) : postType.labels.view_item,\n\t\t\turl: post.link,\n\t\t} );\n\t}\n\treturn [\n\t\tnoticeMessage,\n\t\t{\n\t\t\tid: SAVE_POST_NOTICE_ID,\n\t\t\ttype: 'snackbar',\n\t\t\tactions,\n\t\t},\n\t];\n}\n\n/**\n * Builds the fail notification arguments for dispatch.\n *\n * @param {Object} data Incoming data to build the arguments with.\n *\n * @return {Array} Arguments for dispatch. An empty array signals no\n * notification should be sent.\n */\nexport function getNotificationArgumentsForSaveFail( data ) {\n\tconst { post, edits, error } = data;\n\tif ( error && 'rest_autosave_no_changes' === error.code ) {\n\t\t// Autosave requested a new autosave, but there were no changes. This shouldn't\n\t\t// result in an error notice for the user.\n\t\treturn [];\n\t}\n\n\tconst publishStatus = [ 'publish', 'private', 'future' ];\n\tconst isPublished = publishStatus.indexOf( post.status ) !== -1;\n\t// If the post was being published, we show the corresponding publish error message\n\t// Unless we publish an \"updating failed\" message.\n\tconst messages = {\n\t\tpublish: __( 'Publishing failed.' ),\n\t\tprivate: __( 'Publishing failed.' ),\n\t\tfuture: __( 'Scheduling failed.' ),\n\t};\n\tlet noticeMessage =\n\t\t! isPublished && publishStatus.indexOf( edits.status ) !== -1\n\t\t\t? messages[ edits.status ]\n\t\t\t: __( 'Updating failed.' );\n\n\t// Check if message string contains HTML. Notice text is currently only\n\t// supported as plaintext, and stripping the tags may muddle the meaning.\n\tif ( error.message && ! /<\\/?[^>]*>/.test( error.message ) ) {\n\t\tnoticeMessage = [ noticeMessage, error.message ].join( ' ' );\n\t}\n\treturn [\n\t\tnoticeMessage,\n\t\t{\n\t\t\tid: SAVE_POST_NOTICE_ID,\n\t\t},\n\t];\n}\n\n/**\n * Builds the trash fail notification arguments for dispatch.\n *\n * @param {Object} data\n *\n * @return {Array} Arguments for dispatch.\n */\nexport function getNotificationArgumentsForTrashFail( data ) {\n\treturn [\n\t\tdata.error.message && data.error.code !== 'unknown_error'\n\t\t\t? data.error.message\n\t\t\t: __( 'Trashing failed' ),\n\t\t{\n\t\t\tid: TRASH_POST_NOTICE_ID,\n\t\t},\n\t];\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/store/utils/notice-builder.js"],"names":["__","SAVE_POST_NOTICE_ID","TRASH_POST_NOTICE_ID","getNotificationArgumentsForSaveSuccess","data","previousPost","post","postType","options","isAutosave","status","publishStatus","isPublished","includes","willPublish","noticeMessage","shouldShowLink","viewable","isDraft","labels","item_reverted_to_draft","publish","item_published","private","item_published_privately","future","item_scheduled","item_updated","actions","push","label","view_item","url","link","id","type","getNotificationArgumentsForSaveFail","edits","error","code","indexOf","messages","message","test","join","getNotificationArgumentsForTrashFail"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,mBAAT,EAA8BC,oBAA9B,QAA0D,cAA1D;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,sCAAT,CAAiDC,IAAjD,EAAwD;AAAA;;AAC9D,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,IAAhB;AAAsBC,IAAAA;AAAtB,MAAmCH,IAAzC,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,CAAC3B,MAA7B,MAA0C,CAAC,CAA5D,GACG+B,QAAQ,CAAEJ,KAAK,CAAC3B,MAAR,CADX,GAEGV,EAAE,CAAE,kBAAF,CAHN,CAjB2D,CAsB3D;AACA;;AACA,MAAKsC,KAAK,CAACI,OAAN,IAAiB,CAAE,aAAaC,IAAb,CAAmBL,KAAK,CAACI,OAAzB,CAAxB,EAA6D;AAC5D3B,IAAAA,aAAa,GAAG,CAAEA,aAAF,EAAiBuB,KAAK,CAACI,OAAvB,EAAiCE,IAAjC,CAAuC,GAAvC,CAAhB;AACA;;AACD,SAAO,CACN7B,aADM,EAEN;AACCmB,IAAAA,EAAE,EAAEjC;AADL,GAFM,CAAP;AAMA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAAS4C,oCAAT,CAA+CzC,IAA/C,EAAsD;AAC5D,SAAO,CACNA,IAAI,CAACkC,KAAL,CAAWI,OAAX,IAAsBtC,IAAI,CAACkC,KAAL,CAAWC,IAAX,KAAoB,eAA1C,GACGnC,IAAI,CAACkC,KAAL,CAAWI,OADd,GAEG1C,EAAE,CAAE,iBAAF,CAHC,EAIN;AACCkC,IAAAA,EAAE,EAAEhC;AADL,GAJM,CAAP;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { SAVE_POST_NOTICE_ID, TRASH_POST_NOTICE_ID } from '../constants';\n\n/**\n * Builds the arguments for a success notification dispatch.\n *\n * @param {Object} data Incoming data to build the arguments from.\n *\n * @return {Array} Arguments for dispatch. An empty array signals no\n * notification should be sent.\n */\nexport function getNotificationArgumentsForSaveSuccess( data ) {\n\tconst { previousPost, post, postType } = data;\n\t// Autosaves are neither shown a notice nor redirected.\n\tif ( data.options?.isAutosave ) {\n\t\treturn [];\n\t}\n\n\t// No notice is shown after trashing a post\n\tif ( post.status === 'trash' && previousPost.status !== 'trash' ) {\n\t\treturn [];\n\t}\n\n\tconst publishStatus = [ 'publish', 'private', 'future' ];\n\tconst isPublished = publishStatus.includes( previousPost.status );\n\tconst willPublish = publishStatus.includes( post.status );\n\n\tlet noticeMessage;\n\tlet shouldShowLink = postType?.viewable ?? false;\n\tlet isDraft;\n\n\t// Always should a notice, which will be spoken for accessibility.\n\tif ( ! isPublished && ! willPublish ) {\n\t\t// If saving a non-published post, don't show notice.\n\t\tnoticeMessage = __( 'Draft saved.' );\n\t\tisDraft = true;\n\t} else if ( isPublished && ! willPublish ) {\n\t\t// If undoing publish status, show specific notice.\n\t\tnoticeMessage = postType.labels.item_reverted_to_draft;\n\t\tshouldShowLink = false;\n\t} else if ( ! isPublished && willPublish ) {\n\t\t// If publishing or scheduling a post, show the corresponding\n\t\t// publish message.\n\t\tnoticeMessage = {\n\t\t\tpublish: postType.labels.item_published,\n\t\t\tprivate: postType.labels.item_published_privately,\n\t\t\tfuture: postType.labels.item_scheduled,\n\t\t}[ post.status ];\n\t} else {\n\t\t// Generic fallback notice.\n\t\tnoticeMessage = postType.labels.item_updated;\n\t}\n\n\tconst actions = [];\n\tif ( shouldShowLink ) {\n\t\tactions.push( {\n\t\t\tlabel: isDraft ? __( 'View Preview' ) : postType.labels.view_item,\n\t\t\turl: post.link,\n\t\t} );\n\t}\n\treturn [\n\t\tnoticeMessage,\n\t\t{\n\t\t\tid: SAVE_POST_NOTICE_ID,\n\t\t\ttype: 'snackbar',\n\t\t\tactions,\n\t\t},\n\t];\n}\n\n/**\n * Builds the fail notification arguments for dispatch.\n *\n * @param {Object} data Incoming data to build the arguments with.\n *\n * @return {Array} Arguments for dispatch. An empty array signals no\n * notification should be sent.\n */\nexport function getNotificationArgumentsForSaveFail( data ) {\n\tconst { post, edits, error } = data;\n\tif ( error && 'rest_autosave_no_changes' === error.code ) {\n\t\t// Autosave requested a new autosave, but there were no changes. This shouldn't\n\t\t// result in an error notice for the user.\n\t\treturn [];\n\t}\n\n\tconst publishStatus = [ 'publish', 'private', 'future' ];\n\tconst isPublished = publishStatus.indexOf( post.status ) !== -1;\n\t// If the post was being published, we show the corresponding publish error message\n\t// Unless we publish an \"updating failed\" message.\n\tconst messages = {\n\t\tpublish: __( 'Publishing failed.' ),\n\t\tprivate: __( 'Publishing failed.' ),\n\t\tfuture: __( 'Scheduling failed.' ),\n\t};\n\tlet noticeMessage =\n\t\t! isPublished && publishStatus.indexOf( edits.status ) !== -1\n\t\t\t? messages[ edits.status ]\n\t\t\t: __( 'Updating failed.' );\n\n\t// Check if message string contains HTML. Notice text is currently only\n\t// supported as plaintext, and stripping the tags may muddle the meaning.\n\tif ( error.message && ! /<\\/?[^>]*>/.test( error.message ) ) {\n\t\tnoticeMessage = [ noticeMessage, error.message ].join( ' ' );\n\t}\n\treturn [\n\t\tnoticeMessage,\n\t\t{\n\t\t\tid: SAVE_POST_NOTICE_ID,\n\t\t},\n\t];\n}\n\n/**\n * Builds the trash fail notification arguments for dispatch.\n *\n * @param {Object} data\n *\n * @return {Array} Arguments for dispatch.\n */\nexport function getNotificationArgumentsForTrashFail( data ) {\n\treturn [\n\t\tdata.error.message && data.error.code !== 'unknown_error'\n\t\t\t? data.error.message\n\t\t\t: __( 'Trashing failed' ),\n\t\t{\n\t\t\tid: TRASH_POST_NOTICE_ID,\n\t\t},\n\t];\n}\n"]}
@@ -274,18 +274,6 @@
274
274
  box-shadow: 0 0.7px 1px rgba(0, 0, 0, 0.15), 0 2.7px 3.8px -0.2px rgba(0, 0, 0, 0.15), 0 5.5px 7.8px -0.3px rgba(0, 0, 0, 0.15), -0.1px 11.5px 16.4px -0.5px rgba(0, 0, 0, 0.15);
275
275
  }
276
276
 
277
- .editor-page-attributes__order {
278
- width: 100%;
279
- }
280
- .editor-page-attributes__order .components-base-control__field {
281
- display: flex;
282
- justify-content: space-between;
283
- align-items: center;
284
- }
285
- .editor-page-attributes__order input {
286
- width: 66px;
287
- }
288
-
289
277
  .editor-post-excerpt__textarea {
290
278
  width: 100%;
291
279
  margin-bottom: 10px;
@@ -460,7 +448,7 @@
460
448
 
461
449
  .editor-post-publish-panel__header-publish-button,
462
450
  .editor-post-publish-panel__header-cancel-button {
463
- flex-grow: 1;
451
+ flex: 1;
464
452
  }
465
453
  @media (min-width: 480px) {
466
454
  .editor-post-publish-panel__header-publish-button,
@@ -274,18 +274,6 @@
274
274
  box-shadow: 0 0.7px 1px rgba(0, 0, 0, 0.15), 0 2.7px 3.8px -0.2px rgba(0, 0, 0, 0.15), 0 5.5px 7.8px -0.3px rgba(0, 0, 0, 0.15), 0.1px 11.5px 16.4px -0.5px rgba(0, 0, 0, 0.15);
275
275
  }
276
276
 
277
- .editor-page-attributes__order {
278
- width: 100%;
279
- }
280
- .editor-page-attributes__order .components-base-control__field {
281
- display: flex;
282
- justify-content: space-between;
283
- align-items: center;
284
- }
285
- .editor-page-attributes__order input {
286
- width: 66px;
287
- }
288
-
289
277
  .editor-post-excerpt__textarea {
290
278
  width: 100%;
291
279
  margin-bottom: 10px;
@@ -460,7 +448,7 @@
460
448
 
461
449
  .editor-post-publish-panel__header-publish-button,
462
450
  .editor-post-publish-panel__header-cancel-button {
463
- flex-grow: 1;
451
+ flex: 1;
464
452
  }
465
453
  @media (min-width: 480px) {
466
454
  .editor-post-publish-panel__header-publish-button,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/editor",
3
- "version": "13.3.6",
3
+ "version": "13.5.0",
4
4
  "description": "Enhanced block editor for WordPress posts.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -31,34 +31,34 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.16.0",
34
- "@wordpress/a11y": "^3.26.1",
35
- "@wordpress/api-fetch": "^6.23.1",
36
- "@wordpress/blob": "^3.26.1",
37
- "@wordpress/block-editor": "^11.3.6",
38
- "@wordpress/blocks": "^12.3.3",
39
- "@wordpress/components": "^23.3.5",
40
- "@wordpress/compose": "^6.3.3",
41
- "@wordpress/core-data": "^6.3.3",
42
- "@wordpress/data": "^8.3.3",
43
- "@wordpress/date": "^4.26.2",
44
- "@wordpress/deprecated": "^3.26.1",
45
- "@wordpress/dom": "^3.26.1",
46
- "@wordpress/element": "^5.3.2",
47
- "@wordpress/hooks": "^3.26.1",
48
- "@wordpress/html-entities": "^3.26.1",
49
- "@wordpress/i18n": "^4.26.1",
50
- "@wordpress/icons": "^9.17.2",
51
- "@wordpress/keyboard-shortcuts": "^4.3.3",
52
- "@wordpress/keycodes": "^3.26.2",
53
- "@wordpress/media-utils": "^4.17.2",
54
- "@wordpress/notices": "^3.26.3",
55
- "@wordpress/preferences": "^3.3.5",
56
- "@wordpress/private-apis": "^0.8.1",
57
- "@wordpress/reusable-blocks": "^4.3.6",
58
- "@wordpress/rich-text": "^6.3.3",
59
- "@wordpress/server-side-render": "^4.3.5",
60
- "@wordpress/url": "^3.27.1",
61
- "@wordpress/wordcount": "^3.26.1",
34
+ "@wordpress/a11y": "^3.28.0",
35
+ "@wordpress/api-fetch": "^6.25.0",
36
+ "@wordpress/blob": "^3.28.0",
37
+ "@wordpress/block-editor": "^11.5.0",
38
+ "@wordpress/blocks": "^12.5.0",
39
+ "@wordpress/components": "^23.5.0",
40
+ "@wordpress/compose": "^6.5.0",
41
+ "@wordpress/core-data": "^6.5.0",
42
+ "@wordpress/data": "^8.5.0",
43
+ "@wordpress/date": "^4.28.0",
44
+ "@wordpress/deprecated": "^3.28.0",
45
+ "@wordpress/dom": "^3.28.0",
46
+ "@wordpress/element": "^5.5.0",
47
+ "@wordpress/hooks": "^3.28.0",
48
+ "@wordpress/html-entities": "^3.28.0",
49
+ "@wordpress/i18n": "^4.28.0",
50
+ "@wordpress/icons": "^9.19.0",
51
+ "@wordpress/keyboard-shortcuts": "^4.5.0",
52
+ "@wordpress/keycodes": "^3.28.0",
53
+ "@wordpress/media-utils": "^4.19.0",
54
+ "@wordpress/notices": "^3.28.0",
55
+ "@wordpress/preferences": "^3.5.0",
56
+ "@wordpress/private-apis": "^0.10.0",
57
+ "@wordpress/reusable-blocks": "^4.5.0",
58
+ "@wordpress/rich-text": "^6.5.0",
59
+ "@wordpress/server-side-render": "^4.5.0",
60
+ "@wordpress/url": "^3.29.0",
61
+ "@wordpress/wordcount": "^3.28.0",
62
62
  "classnames": "^2.3.1",
63
63
  "date-fns": "^2.28.0",
64
64
  "escape-html": "^1.0.3",
@@ -75,5 +75,5 @@
75
75
  "publishConfig": {
76
76
  "access": "public"
77
77
  },
78
- "gitHead": "35f10c183655e9196d4ea12b8fa499a8ecbb7b6a"
78
+ "gitHead": "d5e03a74b79e3ca84afda24375474a103a063ee4"
79
79
  }
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
5
  import { compose } from '@wordpress/compose';
6
- import { withSelect } from '@wordpress/data';
6
+ import { withSelect, useDispatch } from '@wordpress/data';
7
7
  import { create, getTextContent } from '@wordpress/rich-text';
8
8
  import { store as blockEditorStore } from '@wordpress/block-editor';
9
9
  import { store as coreStore } from '@wordpress/core-data';
@@ -68,7 +68,7 @@ export const DocumentOutline = ( {
68
68
  hasOutlineItemsDisabled,
69
69
  } ) => {
70
70
  const headings = computeOutlineHeadings( blocks );
71
-
71
+ const { selectBlock } = useDispatch( blockEditorStore );
72
72
  if ( headings.length < 1 ) {
73
73
  return null;
74
74
  }
@@ -121,7 +121,10 @@ export const DocumentOutline = ( {
121
121
  isValid={ isValid }
122
122
  isDisabled={ hasOutlineItemsDisabled }
123
123
  href={ `#block-${ item.clientId }` }
124
- onSelect={ onSelect }
124
+ onSelect={ () => {
125
+ selectBlock( item.clientId );
126
+ onSelect?.();
127
+ } }
125
128
  >
126
129
  { item.isEmpty
127
130
  ? emptyHeadingContent
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { get } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -15,17 +10,13 @@ import { store as coreStore } from '@wordpress/core-data';
15
10
  import { store as editorStore } from '../../store';
16
11
 
17
12
  export function PageAttributesCheck( { children } ) {
18
- const postType = useSelect( ( select ) => {
13
+ const supportsPageAttributes = useSelect( ( select ) => {
19
14
  const { getEditedPostAttribute } = select( editorStore );
20
15
  const { getPostType } = select( coreStore );
16
+ const postType = getPostType( getEditedPostAttribute( 'type' ) );
21
17
 
22
- return getPostType( getEditedPostAttribute( 'type' ) );
18
+ return !! postType?.supports?.[ 'page-attributes' ];
23
19
  }, [] );
24
- const supportsPageAttributes = get(
25
- postType,
26
- [ 'supports', 'page-attributes' ],
27
- false
28
- );
29
20
 
30
21
  // Only render fields if post type supports page attributes or available templates exist.
31
22
  if ( ! supportsPageAttributes ) {
@@ -2,7 +2,11 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { TextControl } from '@wordpress/components';
5
+ import {
6
+ Flex,
7
+ FlexBlock,
8
+ __experimentalNumberControl as NumberControl,
9
+ } from '@wordpress/components';
6
10
  import { withSelect, withDispatch } from '@wordpress/data';
7
11
  import { compose } from '@wordpress/compose';
8
12
  import { useState } from '@wordpress/element';
@@ -25,17 +29,19 @@ export const PageAttributesOrder = ( { onUpdateOrder, order = 0 } ) => {
25
29
  };
26
30
  const value = orderInput === null ? order : orderInput;
27
31
  return (
28
- <TextControl
29
- className="editor-page-attributes__order"
30
- type="number"
31
- label={ __( 'Order' ) }
32
- value={ value }
33
- onChange={ setUpdatedOrder }
34
- size={ 6 }
35
- onBlur={ () => {
36
- setOrderInput( null );
37
- } }
38
- />
32
+ <Flex>
33
+ <FlexBlock>
34
+ <NumberControl
35
+ label={ __( 'Order' ) }
36
+ value={ value }
37
+ onChange={ setUpdatedOrder }
38
+ labelPosition="side"
39
+ onBlur={ () => {
40
+ setOrderInput( null );
41
+ } }
42
+ />
43
+ </FlexBlock>
44
+ </Flex>
39
45
  );
40
46
  };
41
47
 
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { get } from 'lodash';
5
4
  import removeAccents from 'remove-accents';
6
5
 
7
6
  /**
@@ -44,47 +43,48 @@ export const getItemPriority = ( name, searchValue ) => {
44
43
  export function PageAttributesParent() {
45
44
  const { editPost } = useDispatch( editorStore );
46
45
  const [ fieldValue, setFieldValue ] = useState( false );
47
- const { parentPost, parentPostId, items, postType } = useSelect(
48
- ( select ) => {
49
- const { getPostType, getEntityRecords, getEntityRecord } =
50
- select( coreStore );
51
- const { getCurrentPostId, getEditedPostAttribute } =
52
- select( editorStore );
53
- const postTypeSlug = getEditedPostAttribute( 'type' );
54
- const pageId = getEditedPostAttribute( 'parent' );
55
- const pType = getPostType( postTypeSlug );
56
- const postId = getCurrentPostId();
57
- const isHierarchical = get( pType, [ 'hierarchical' ], false );
58
- const query = {
59
- per_page: 100,
60
- exclude: postId,
61
- parent_exclude: postId,
62
- orderby: 'menu_order',
63
- order: 'asc',
64
- _fields: 'id,title,parent',
65
- };
66
-
67
- // Perform a search when the field is changed.
68
- if ( !! fieldValue ) {
69
- query.search = fieldValue;
70
- }
71
-
72
- return {
73
- parentPostId: pageId,
74
- parentPost: pageId
75
- ? getEntityRecord( 'postType', postTypeSlug, pageId )
76
- : null,
77
- items: isHierarchical
78
- ? getEntityRecords( 'postType', postTypeSlug, query )
79
- : [],
80
- postType: pType,
81
- };
82
- },
83
- [ fieldValue ]
84
- );
46
+ const { isHierarchical, parentPost, parentPostId, items, postType } =
47
+ useSelect(
48
+ ( select ) => {
49
+ const { getPostType, getEntityRecords, getEntityRecord } =
50
+ select( coreStore );
51
+ const { getCurrentPostId, getEditedPostAttribute } =
52
+ select( editorStore );
53
+ const postTypeSlug = getEditedPostAttribute( 'type' );
54
+ const pageId = getEditedPostAttribute( 'parent' );
55
+ const pType = getPostType( postTypeSlug );
56
+ const postId = getCurrentPostId();
57
+ const postIsHierarchical = pType?.hierarchical ?? false;
58
+ const query = {
59
+ per_page: 100,
60
+ exclude: postId,
61
+ parent_exclude: postId,
62
+ orderby: 'menu_order',
63
+ order: 'asc',
64
+ _fields: 'id,title,parent',
65
+ };
66
+
67
+ // Perform a search when the field is changed.
68
+ if ( !! fieldValue ) {
69
+ query.search = fieldValue;
70
+ }
71
+
72
+ return {
73
+ isHierarchical: postIsHierarchical,
74
+ parentPostId: pageId,
75
+ parentPost: pageId
76
+ ? getEntityRecord( 'postType', postTypeSlug, pageId )
77
+ : null,
78
+ items: postIsHierarchical
79
+ ? getEntityRecords( 'postType', postTypeSlug, query )
80
+ : [],
81
+ postType: pType,
82
+ };
83
+ },
84
+ [ fieldValue ]
85
+ );
85
86
 
86
- const isHierarchical = get( postType, [ 'hierarchical' ], false );
87
- const parentPageLabel = get( postType, [ 'labels', 'parent_item_colon' ] );
87
+ const parentPageLabel = postType?.labels?.parent_item_colon;
88
88
  const pageItems = items || [];
89
89
 
90
90
  const parentOptions = useMemo( () => {
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { get } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -21,11 +16,8 @@ export default function PostAuthorCheck( { children } ) {
21
16
  const post = select( editorStore ).getCurrentPost();
22
17
  const authors = select( coreStore ).getUsers( AUTHORS_QUERY );
23
18
  return {
24
- hasAssignAuthorAction: get(
25
- post,
26
- [ '_links', 'wp:action-assign-author' ],
27
- false
28
- ),
19
+ hasAssignAuthorAction:
20
+ post._links?.[ 'wp:action-assign-author' ] ?? false,
29
21
  hasAuthors: authors?.length >= 1,
30
22
  };
31
23
  }, [] );
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { get } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -105,7 +100,6 @@ function PostFeaturedImage( {
105
100
  const mediaUpload = useSelect( ( select ) => {
106
101
  return select( blockEditorStore ).getSettings().mediaUpload;
107
102
  }, [] );
108
- const postLabel = get( postType, [ 'labels' ], {} );
109
103
  const { mediaWidth, mediaHeight, mediaSourceUrl } = getMediaDetails(
110
104
  media,
111
105
  currentPostId
@@ -159,7 +153,7 @@ function PostFeaturedImage( {
159
153
  <MediaUploadCheck fallback={ instructions }>
160
154
  <MediaUpload
161
155
  title={
162
- postLabel.featured_image ||
156
+ postType?.labels?.featured_image ||
163
157
  DEFAULT_FEATURE_IMAGE_LABEL
164
158
  }
165
159
  onSelect={ onUpdateImage }
@@ -201,7 +195,8 @@ function PostFeaturedImage( {
201
195
  { isLoading && <Spinner /> }
202
196
  { ! featuredImageId &&
203
197
  ! isLoading &&
204
- ( postLabel.set_featured_image ||
198
+ ( postType?.labels
199
+ ?.set_featured_image ||
205
200
  DEFAULT_SET_FEATURE_IMAGE_LABEL ) }
206
201
  </Button>
207
202
  <DropZone onFilesDrop={ onDropFiles } />
@@ -215,7 +210,7 @@ function PostFeaturedImage( {
215
210
  { media && (
216
211
  <MediaUpload
217
212
  title={
218
- postLabel.featured_image ||
213
+ postType?.labels?.featured_image ||
219
214
  DEFAULT_FEATURE_IMAGE_LABEL
220
215
  }
221
216
  onSelect={ onUpdateImage }
@@ -237,7 +232,7 @@ function PostFeaturedImage( {
237
232
  variant="link"
238
233
  isDestructive
239
234
  >
240
- { postLabel.remove_featured_image ||
235
+ { postType?.labels?.remove_featured_image ||
241
236
  DEFAULT_REMOVE_FEATURE_IMAGE_LABEL }
242
237
  </Button>
243
238
  </MediaUploadCheck>
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { get } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -164,7 +159,7 @@ export default function PostLockedModal() {
164
159
  _wpnonce: postLockUtils.nonce,
165
160
  } );
166
161
  const allPostsUrl = addQueryArgs( 'edit.php', {
167
- post_type: get( postType, [ 'slug' ] ),
162
+ post_type: postType?.slug,
168
163
  } );
169
164
  const allPostsLabel = __( 'Exit editor' );
170
165
  return (
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { get } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -31,11 +26,8 @@ export default compose(
31
26
  const { isCurrentPostPublished, getCurrentPostType, getCurrentPost } =
32
27
  select( editorStore );
33
28
  return {
34
- hasPublishAction: get(
35
- getCurrentPost(),
36
- [ '_links', 'wp:action-publish' ],
37
- false
38
- ),
29
+ hasPublishAction:
30
+ getCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,
39
31
  isPublished: isCurrentPostPublished(),
40
32
  postType: getCurrentPostType(),
41
33
  };
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { get } from 'lodash';
5
4
  import classnames from 'classnames';
6
5
 
7
6
  /**
@@ -256,7 +255,7 @@ export default compose( [
256
255
  forcePreviewLink !== undefined ? forcePreviewLink : previewLink,
257
256
  isSaveable: isEditedPostSaveable(),
258
257
  isAutosaveable: forceIsAutosaveable || isEditedPostAutosaveable(),
259
- isViewable: get( postType, [ 'viewable' ], false ),
258
+ isViewable: postType?.viewable ?? false,
260
259
  isDraft:
261
260
  [ 'draft', 'auto-draft' ].indexOf(
262
261
  getEditedPostAttribute( 'status' )
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { get } from 'lodash';
5
4
  import classnames from 'classnames';
6
5
 
7
6
  /**
@@ -169,7 +168,7 @@ export class PostPublishButton extends Component {
169
168
  const buttonProps = {
170
169
  'aria-disabled': isButtonDisabled,
171
170
  className: 'editor-post-publish-button',
172
- isBusy: ! isAutoSaving && isSaving && isPublished,
171
+ isBusy: ! isAutoSaving && isSaving,
173
172
  variant: 'primary',
174
173
  onClick: this.createOnClick( onClickButton ),
175
174
  };
@@ -242,11 +241,8 @@ export default compose( [
242
241
  isPostSavingLocked: isPostSavingLocked(),
243
242
  isPublishable: isEditedPostPublishable(),
244
243
  isPublished: isCurrentPostPublished(),
245
- hasPublishAction: get(
246
- getCurrentPost(),
247
- [ '_links', 'wp:action-publish' ],
248
- false
249
- ),
244
+ hasPublishAction:
245
+ getCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,
250
246
  postType: getCurrentPostType(),
251
247
  postId: getCurrentPostId(),
252
248
  hasNonPostEntityChanges: hasNonPostEntityChanges(),
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { get } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -64,11 +59,8 @@ export default compose( [
64
59
  isBeingScheduled: isEditedPostBeingScheduled(),
65
60
  isSaving: forceIsSaving || isSavingPost(),
66
61
  isPublishing: isPublishingPost(),
67
- hasPublishAction: get(
68
- getCurrentPost(),
69
- [ '_links', 'wp:action-publish' ],
70
- false
71
- ),
62
+ hasPublishAction:
63
+ getCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,
72
64
  postType: getCurrentPostType(),
73
65
  isAutosaving: isAutosavingPost(),
74
66
  };
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { get } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -153,12 +148,9 @@ export default compose( [
153
148
  const postType = getPostType( getEditedPostAttribute( 'type' ) );
154
149
 
155
150
  return {
156
- hasPublishAction: get(
157
- getCurrentPost(),
158
- [ '_links', 'wp:action-publish' ],
159
- false
160
- ),
161
- isPostTypeViewable: get( postType, [ 'viewable' ], false ),
151
+ hasPublishAction:
152
+ getCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,
153
+ isPostTypeViewable: postType?.viewable,
162
154
  isBeingScheduled: isEditedPostBeingScheduled(),
163
155
  isDirty: isEditedPostDirty(),
164
156
  isPublished: isCurrentPostPublished(),