@wordpress/editor 12.8.0 → 12.11.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 (198) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/editor-help/help-section-title.native.js +43 -0
  3. package/build/components/editor-help/help-section-title.native.js.map +1 -0
  4. package/build/components/editor-help/help-topic-row.native.js +3 -2
  5. package/build/components/editor-help/help-topic-row.native.js.map +1 -1
  6. package/build/components/editor-help/icon-move-blocks.native.js +23 -0
  7. package/build/components/editor-help/icon-move-blocks.native.js.map +1 -0
  8. package/build/components/editor-help/index.native.js +10 -11
  9. package/build/components/editor-help/index.native.js.map +1 -1
  10. package/build/components/editor-help/move-blocks.native.js +14 -2
  11. package/build/components/editor-help/move-blocks.native.js.map +1 -1
  12. package/build/components/editor-help/view-sections.native.js +21 -5
  13. package/build/components/editor-help/view-sections.native.js.map +1 -1
  14. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  15. package/build/components/entities-saved-states/index.js.map +1 -1
  16. package/build/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  17. package/build/components/index.js +12 -1
  18. package/build/components/index.js.map +1 -1
  19. package/build/components/local-autosave-monitor/index.js +24 -19
  20. package/build/components/local-autosave-monitor/index.js.map +1 -1
  21. package/build/components/page-attributes/parent.js +1 -1
  22. package/build/components/page-attributes/parent.js.map +1 -1
  23. package/build/components/post-author/select.js.map +1 -1
  24. package/build/components/post-comments/index.js.map +1 -1
  25. package/build/components/post-format/index.js.map +1 -1
  26. package/build/components/post-last-revision/check.js.map +1 -1
  27. package/build/components/post-last-revision/index.js.map +1 -1
  28. package/build/components/post-pending-status/check.js.map +1 -1
  29. package/build/components/post-pingbacks/index.js.map +1 -1
  30. package/build/components/post-publish-button/index.js +4 -2
  31. package/build/components/post-publish-button/index.js.map +1 -1
  32. package/build/components/post-publish-panel/index.js.map +1 -1
  33. package/build/components/post-publish-panel/maybe-category-panel.js +5 -5
  34. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  35. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  36. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  37. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  38. package/build/components/post-schedule/index.js +11 -18
  39. package/build/components/post-schedule/index.js.map +1 -1
  40. package/build/components/post-schedule/label.js +93 -13
  41. package/build/components/post-schedule/label.js.map +1 -1
  42. package/build/components/post-slug/index.js.map +1 -1
  43. package/build/components/post-sticky/index.js.map +1 -1
  44. package/build/components/post-switch-to-draft-button/index.js.map +1 -1
  45. package/build/components/post-taxonomies/flat-term-selector.js +7 -4
  46. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  47. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  48. package/build/components/post-title/index.js.map +1 -1
  49. package/build/components/post-title/index.native.js.map +1 -1
  50. package/build/components/post-trash/check.js.map +1 -1
  51. package/build/components/post-visibility/index.js +10 -11
  52. package/build/components/post-visibility/index.js.map +1 -1
  53. package/build/components/provider/index.js.map +1 -1
  54. package/build/components/provider/index.native.js +0 -1
  55. package/build/components/provider/index.native.js.map +1 -1
  56. package/build/components/provider/use-block-editor-settings.js +3 -1
  57. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  58. package/build/components/template-validation-notice/index.js.map +1 -1
  59. package/build/components/theme-support-check/index.js +1 -1
  60. package/build/components/theme-support-check/index.js.map +1 -1
  61. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  62. package/build/store/actions.js +5 -1
  63. package/build/store/actions.js.map +1 -1
  64. package/build/store/reducer.js +1 -1
  65. package/build/store/reducer.js.map +1 -1
  66. package/build/store/selectors.js +2 -2
  67. package/build/store/selectors.js.map +1 -1
  68. package/build/utils/media-upload/index.js +4 -8
  69. package/build/utils/media-upload/index.js.map +1 -1
  70. package/build-module/components/editor-help/help-section-title.native.js +31 -0
  71. package/build-module/components/editor-help/help-section-title.native.js.map +1 -0
  72. package/build-module/components/editor-help/help-topic-row.native.js +3 -2
  73. package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
  74. package/build-module/components/editor-help/icon-move-blocks.native.js +13 -0
  75. package/build-module/components/editor-help/icon-move-blocks.native.js.map +1 -0
  76. package/build-module/components/editor-help/index.native.js +10 -12
  77. package/build-module/components/editor-help/index.native.js.map +1 -1
  78. package/build-module/components/editor-help/move-blocks.native.js +15 -3
  79. package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
  80. package/build-module/components/editor-help/view-sections.native.js +22 -6
  81. package/build-module/components/editor-help/view-sections.native.js.map +1 -1
  82. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  83. package/build-module/components/entities-saved-states/index.js.map +1 -1
  84. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  85. package/build-module/components/index.js +1 -1
  86. package/build-module/components/index.js.map +1 -1
  87. package/build-module/components/local-autosave-monitor/index.js +24 -18
  88. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  89. package/build-module/components/page-attributes/parent.js +2 -2
  90. package/build-module/components/page-attributes/parent.js.map +1 -1
  91. package/build-module/components/post-author/select.js.map +1 -1
  92. package/build-module/components/post-comments/index.js.map +1 -1
  93. package/build-module/components/post-format/index.js.map +1 -1
  94. package/build-module/components/post-last-revision/check.js.map +1 -1
  95. package/build-module/components/post-last-revision/index.js.map +1 -1
  96. package/build-module/components/post-pending-status/check.js.map +1 -1
  97. package/build-module/components/post-pingbacks/index.js.map +1 -1
  98. package/build-module/components/post-publish-button/index.js +4 -1
  99. package/build-module/components/post-publish-button/index.js.map +1 -1
  100. package/build-module/components/post-publish-panel/index.js.map +1 -1
  101. package/build-module/components/post-publish-panel/maybe-category-panel.js +5 -5
  102. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  103. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  104. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  105. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  106. package/build-module/components/post-schedule/index.js +12 -19
  107. package/build-module/components/post-schedule/index.js.map +1 -1
  108. package/build-module/components/post-schedule/label.js +90 -13
  109. package/build-module/components/post-schedule/label.js.map +1 -1
  110. package/build-module/components/post-slug/index.js.map +1 -1
  111. package/build-module/components/post-sticky/index.js.map +1 -1
  112. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  113. package/build-module/components/post-taxonomies/flat-term-selector.js +7 -4
  114. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  115. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  116. package/build-module/components/post-title/index.js.map +1 -1
  117. package/build-module/components/post-title/index.native.js.map +1 -1
  118. package/build-module/components/post-trash/check.js.map +1 -1
  119. package/build-module/components/post-visibility/index.js +12 -13
  120. package/build-module/components/post-visibility/index.js.map +1 -1
  121. package/build-module/components/provider/index.js.map +1 -1
  122. package/build-module/components/provider/index.native.js +0 -1
  123. package/build-module/components/provider/index.native.js.map +1 -1
  124. package/build-module/components/provider/use-block-editor-settings.js +4 -2
  125. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  126. package/build-module/components/template-validation-notice/index.js.map +1 -1
  127. package/build-module/components/theme-support-check/index.js +2 -2
  128. package/build-module/components/theme-support-check/index.js.map +1 -1
  129. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  130. package/build-module/store/actions.js +5 -1
  131. package/build-module/store/actions.js.map +1 -1
  132. package/build-module/store/reducer.js +2 -2
  133. package/build-module/store/reducer.js.map +1 -1
  134. package/build-module/store/selectors.js +2 -2
  135. package/build-module/store/selectors.js.map +1 -1
  136. package/build-module/utils/media-upload/index.js +3 -5
  137. package/build-module/utils/media-upload/index.js.map +1 -1
  138. package/build-style/style-rtl.css +1 -17
  139. package/build-style/style.css +1 -17
  140. package/package.json +29 -29
  141. package/src/components/editor-help/help-section-title.native.js +29 -0
  142. package/src/components/editor-help/help-topic-row.native.js +2 -2
  143. package/src/components/editor-help/icon-move-blocks.native.js +10 -0
  144. package/src/components/editor-help/images/drag-and-drop-dark.png +0 -0
  145. package/src/components/editor-help/images/drag-and-drop-dark@2x.png +0 -0
  146. package/src/components/editor-help/images/drag-and-drop-dark@3x.png +0 -0
  147. package/src/components/editor-help/images/drag-and-drop-light.png +0 -0
  148. package/src/components/editor-help/images/drag-and-drop-light@2x.png +0 -0
  149. package/src/components/editor-help/images/drag-and-drop-light@3x.png +0 -0
  150. package/src/components/editor-help/index.native.js +26 -28
  151. package/src/components/editor-help/move-blocks.native.js +22 -2
  152. package/src/components/editor-help/style.scss +36 -4
  153. package/src/components/editor-help/view-sections.native.js +23 -8
  154. package/src/components/entities-saved-states/entity-record-item.js +6 -6
  155. package/src/components/entities-saved-states/index.js +6 -9
  156. package/src/components/global-keyboard-shortcuts/save-shortcut.js +2 -3
  157. package/src/components/index.js +4 -1
  158. package/src/components/local-autosave-monitor/index.js +39 -38
  159. package/src/components/page-attributes/parent.js +5 -8
  160. package/src/components/post-author/select.js +2 -3
  161. package/src/components/post-comments/index.js +4 -3
  162. package/src/components/post-format/index.js +2 -3
  163. package/src/components/post-last-revision/check.js +2 -4
  164. package/src/components/post-last-revision/index.js +2 -4
  165. package/src/components/post-pending-status/check.js +2 -5
  166. package/src/components/post-pingbacks/index.js +2 -3
  167. package/src/components/post-publish-button/index.js +7 -8
  168. package/src/components/post-publish-panel/index.js +2 -3
  169. package/src/components/post-publish-panel/maybe-category-panel.js +7 -5
  170. package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -3
  171. package/src/components/post-publish-panel/postpublish.js +2 -5
  172. package/src/components/post-publish-panel/prepublish.js +2 -3
  173. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +1 -1
  174. package/src/components/post-schedule/index.js +6 -13
  175. package/src/components/post-schedule/label.js +111 -17
  176. package/src/components/post-schedule/test/label.js +127 -15
  177. package/src/components/post-slug/index.js +2 -3
  178. package/src/components/post-sticky/index.js +2 -3
  179. package/src/components/post-switch-to-draft-button/index.js +2 -5
  180. package/src/components/post-taxonomies/flat-term-selector.js +9 -12
  181. package/src/components/post-taxonomies/hierarchical-term-selector.js +4 -6
  182. package/src/components/post-title/index.js +21 -31
  183. package/src/components/post-title/index.native.js +10 -16
  184. package/src/components/post-title/style.scss +1 -1
  185. package/src/components/post-trash/check.js +2 -3
  186. package/src/components/post-visibility/index.js +11 -17
  187. package/src/components/post-visibility/style.scss +0 -17
  188. package/src/components/provider/index.js +2 -3
  189. package/src/components/provider/index.native.js +12 -17
  190. package/src/components/provider/use-block-editor-settings.js +4 -8
  191. package/src/components/template-validation-notice/index.js +2 -3
  192. package/src/components/theme-support-check/index.js +2 -2
  193. package/src/hooks/custom-sources-backwards-compatibility.js +45 -44
  194. package/src/store/actions.js +213 -190
  195. package/src/store/reducer.js +2 -2
  196. package/src/store/selectors.js +16 -21
  197. package/src/store/test/selectors.js +13 -16
  198. package/src/utils/media-upload/index.js +2 -5
@@ -9,7 +9,7 @@ import { useNavigation } from '@react-navigation/native';
9
9
  import { TextControl, Icon } from '@wordpress/components';
10
10
  import { chevronRight } from '@wordpress/icons';
11
11
 
12
- const HelpTopicRow = ( { label, icon, screenName } ) => {
12
+ const HelpTopicRow = ( { label, icon, screenName, isLastItem } ) => {
13
13
  const navigation = useNavigation();
14
14
 
15
15
  const openSubSheet = () => {
@@ -18,7 +18,7 @@ const HelpTopicRow = ( { label, icon, screenName } ) => {
18
18
 
19
19
  return (
20
20
  <TextControl
21
- separatorType="leftMargin"
21
+ separatorType={ isLastItem ? 'none' : 'leftMargin' }
22
22
  customActionButton
23
23
  leftAlign
24
24
  onPress={ openSubSheet }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { SVG, Path } from '@wordpress/primitives';
5
+
6
+ export default (
7
+ <SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
8
+ <Path d="M9.53 17.47 9 16.94 7.94 18l.53.53 2 2 .53.53.53-.53 2-2 .53-.53L13 16.94l-.53.53-.72.72v-4.94h-1.5v4.94l-.72-.72Zm-1.06-14L7.94 4 9 5.06l.53-.53.72-.72v4.94h1.5V3.81l.72.72.53.53L14.06 4l-.53-.53-2-2L11 .94l-.53.53-2 2ZM4.53 9.53 5.06 9 4 7.94l-.53.53-2 2-.53.53.53.53 2 2 .53.53L5.06 13l-.53-.53-.72-.72h4.94v-1.5H3.81l.72-.72Zm14-1.06L18 7.94 16.94 9l.53.53.72.72h-4.94v1.5h4.94l-.72.72-.53.53L18 14.06l.53-.53 2-2 .53-.53-.53-.53-2-2Z" />
9
+ </SVG>
10
+ );
@@ -2,7 +2,7 @@
2
2
  * External dependencies
3
3
  */
4
4
  import { kebabCase } from 'lodash';
5
- import { Text, SafeAreaView, ScrollView, StyleSheet, View } from 'react-native';
5
+ import { SafeAreaView, ScrollView, StyleSheet, View } from 'react-native';
6
6
  import { TransitionPresets } from '@react-navigation/stack';
7
7
 
8
8
  /**
@@ -14,16 +14,9 @@ import {
14
14
  PanelBody,
15
15
  } from '@wordpress/components';
16
16
  import { __ } from '@wordpress/i18n';
17
- import {
18
- helpFilled,
19
- plusCircleFilled,
20
- alignJustify,
21
- trash,
22
- cog,
23
- } from '@wordpress/icons';
17
+ import { helpFilled, plusCircleFilled, trash, cog } from '@wordpress/icons';
24
18
  import { useSelect } from '@wordpress/data';
25
19
  import { store as editorStore } from '@wordpress/editor';
26
- import { usePreferredColorSchemeStyle } from '@wordpress/compose';
27
20
  import {
28
21
  requestContactCustomerSupport,
29
22
  requestGotoCustomerSupportOptions,
@@ -41,6 +34,8 @@ import AddBlocks from './add-blocks';
41
34
  import MoveBlocks from './move-blocks';
42
35
  import RemoveBlocks from './remove-blocks';
43
36
  import CustomizeBlocks from './customize-blocks';
37
+ import moveBlocksIcon from './icon-move-blocks';
38
+ import HelpSectionTitle from './help-section-title';
44
39
 
45
40
  const HELP_TOPICS = [
46
41
  {
@@ -53,7 +48,7 @@ const HELP_TOPICS = [
53
48
  icon: plusCircleFilled,
54
49
  view: <AddBlocks />,
55
50
  },
56
- { label: __( 'Move blocks' ), icon: alignJustify, view: <MoveBlocks /> },
51
+ { label: __( 'Move blocks' ), icon: moveBlocksIcon, view: <MoveBlocks /> },
57
52
  { label: __( 'Remove blocks' ), icon: trash, view: <RemoveBlocks /> },
58
53
  {
59
54
  label: __( 'Customize blocks' ),
@@ -67,11 +62,6 @@ function EditorHelpTopics( { close, isVisible, onClose } ) {
67
62
  postType: select( editorStore ).getEditedPostAttribute( 'type' ),
68
63
  } ) );
69
64
 
70
- const sectionTitle = usePreferredColorSchemeStyle(
71
- styles.helpDetailSectionHeading,
72
- styles.helpDetailSectionHeadingDark
73
- );
74
-
75
65
  const title =
76
66
  postType === 'page'
77
67
  ? __( 'How to edit your page' )
@@ -109,9 +99,10 @@ function EditorHelpTopics( { close, isVisible, onClose } ) {
109
99
  </BottomSheet.NavBar>
110
100
  <BottomSheetConsumer>
111
101
  { ( { listProps } ) => {
112
- const contentContainerStyle = StyleSheet.flatten(
113
- listProps.contentContainerStyle
114
- );
102
+ const contentContainerStyle =
103
+ StyleSheet.flatten(
104
+ listProps.contentContainerStyle
105
+ );
115
106
  return (
116
107
  <ScrollView
117
108
  { ...listProps }
@@ -130,15 +121,21 @@ function EditorHelpTopics( { close, isVisible, onClose } ) {
130
121
  } }
131
122
  >
132
123
  <PanelBody>
133
- <Text style={ sectionTitle }>
124
+ <HelpSectionTitle>
134
125
  { __( 'The basics' ) }
135
- </Text>
126
+ </HelpSectionTitle>
136
127
  { /* Print out help topics. */ }
137
128
  { HELP_TOPICS.map(
138
- ( { label, icon } ) => {
139
- const labelSlug = kebabCase(
140
- label
141
- );
129
+ (
130
+ { label, icon },
131
+ index
132
+ ) => {
133
+ const labelSlug =
134
+ kebabCase( label );
135
+ const isLastItem =
136
+ index ===
137
+ HELP_TOPICS.length -
138
+ 1;
142
139
  return (
143
140
  <HelpTopicRow
144
141
  key={
@@ -149,16 +146,17 @@ function EditorHelpTopics( { close, isVisible, onClose } ) {
149
146
  screenName={
150
147
  labelSlug
151
148
  }
149
+ isLastItem={
150
+ isLastItem
151
+ }
152
152
  />
153
153
  );
154
154
  }
155
155
  ) }
156
156
  {
157
- <Text
158
- style={ sectionTitle }
159
- >
157
+ <HelpSectionTitle>
160
158
  { __( 'Get support' ) }
161
- </Text>
159
+ </HelpSectionTitle>
162
160
  }
163
161
  {
164
162
  <HelpGetSupportButton
@@ -12,19 +12,39 @@ import { __ } from '@wordpress/i18n';
12
12
  * Internal dependencies
13
13
  */
14
14
  import styles from './style.scss';
15
- import { HelpDetailBodyText, HelpDetailImage } from './view-sections';
15
+ import {
16
+ HelpDetailBodyText,
17
+ HelpDetailImage,
18
+ HelpDetailSectionHeadingText,
19
+ } from './view-sections';
16
20
 
17
21
  const MoveBlocks = () => {
18
22
  return (
19
23
  <>
24
+ <HelpDetailImage
25
+ source={ require( './images/drag-and-drop-light.png' ) }
26
+ sourceDarkMode={ require( './images/drag-and-drop-dark.png' ) }
27
+ />
28
+ <View style={ styles.helpDetailContainer }>
29
+ <HelpDetailSectionHeadingText
30
+ text={ __( 'Drag & drop' ) }
31
+ badge={ __( 'NEW' ) }
32
+ />
33
+ <HelpDetailBodyText
34
+ text={ __(
35
+ 'Drag & drop makes rearranging blocks a breeze. Press and hold on a block, then drag it to its new location and release.'
36
+ ) }
37
+ />
38
+ </View>
20
39
  <HelpDetailImage
21
40
  source={ require( './images/move-light.png' ) }
22
41
  sourceDarkMode={ require( './images/move-dark.png' ) }
23
42
  />
24
43
  <View style={ styles.helpDetailContainer }>
44
+ <HelpDetailSectionHeadingText text={ __( 'Arrow buttons' ) } />
25
45
  <HelpDetailBodyText
26
46
  text={ __(
27
- 'You can rearrange blocks by tapping a block and then tapping the up and down arrows that appear on the bottom left side of the block to move it above or below other blocks.'
47
+ 'You can also rearrange blocks by tapping a block and then tapping the up and down arrows that appear on the bottom left side of the block to move it up or down.'
28
48
  ) }
29
49
  />
30
50
  </View>
@@ -31,6 +31,21 @@
31
31
  padding: 0;
32
32
  }
33
33
 
34
+ .helpSectionTitleContainer {
35
+ margin-top: 24px;
36
+ margin-bottom: 16px;
37
+ }
38
+
39
+ .helpSectionTitle {
40
+ color: $light-primary;
41
+ font-weight: 600;
42
+ font-size: 16px;
43
+ }
44
+
45
+ .helpSectionTitleDark {
46
+ color: $dark-secondary;
47
+ }
48
+
34
49
  .helpDetailContainer {
35
50
  padding: 0 16px;
36
51
  }
@@ -62,14 +77,18 @@
62
77
  }
63
78
 
64
79
  .helpDetailSectionHeading {
80
+ flex-direction: row;
81
+ align-items: center;
82
+ }
83
+
84
+ .helpDetailSectionHeadingText {
65
85
  color: $light-primary;
66
- font-weight: 600;
86
+ font-weight: 700;
67
87
  font-size: 16px;
68
- margin-top: 24px;
69
88
  }
70
89
 
71
- .helpDetailSectionHeadingDark {
72
- color: $dark-secondary;
90
+ .helpDetailSectionHeadingTextDark {
91
+ color: $dark-primary;
73
92
  }
74
93
 
75
94
  .helpDetailBody {
@@ -81,3 +100,16 @@
81
100
  .helpDetailBodyDark {
82
101
  color: $dark-secondary;
83
102
  }
103
+
104
+ .helpDetailBadgeContainer {
105
+ padding: 2px 6px;
106
+ margin-right: 8px;
107
+ border-radius: 6px;
108
+ background-color: #c9356e;
109
+ }
110
+
111
+ .helpDetailBadgeText {
112
+ color: $white;
113
+ font-weight: 500;
114
+ font-size: 12px;
115
+ }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { Text, Image } from 'react-native';
4
+ import { Text, Image, View } from 'react-native';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -28,15 +28,22 @@ export const HelpDetailBodyText = ( { text } ) => {
28
28
  );
29
29
  };
30
30
 
31
- export const HelpDetailSectionHeadingText = ( { text } ) => {
32
- const headingStyle = usePreferredColorSchemeStyle(
33
- styles.helpDetailSectionHeading,
34
- styles.helpDetailSectionHeadingDark
31
+ export const HelpDetailSectionHeadingText = ( { text, badge } ) => {
32
+ const headingTextStyle = usePreferredColorSchemeStyle(
33
+ styles.helpDetailSectionHeadingText,
34
+ styles.helpDetailSectionHeadingTextDark
35
35
  );
36
36
  return (
37
- <Text accessibilityRole="header" selectable style={ headingStyle }>
38
- { text }
39
- </Text>
37
+ <View style={ styles.helpDetailSectionHeading }>
38
+ { badge && <HelpDetailBadge text={ badge } /> }
39
+ <Text
40
+ accessibilityRole="header"
41
+ selectable
42
+ style={ headingTextStyle }
43
+ >
44
+ { text }
45
+ </Text>
46
+ </View>
40
47
  );
41
48
  };
42
49
 
@@ -62,3 +69,11 @@ export const HelpDetailImage = ( {
62
69
  />
63
70
  );
64
71
  };
72
+
73
+ const HelpDetailBadge = ( { text } ) => {
74
+ return (
75
+ <View style={ styles.helpDetailBadgeContainer }>
76
+ <Text style={ styles.helpDetailBadgeText }>{ text }</Text>
77
+ </View>
78
+ );
79
+ };
@@ -57,18 +57,18 @@ export default function EntityRecordItem( {
57
57
 
58
58
  const isSelected = useSelect(
59
59
  ( select ) => {
60
- const selectedBlockId = select(
61
- blockEditorStore
62
- ).getSelectedBlockClientId();
60
+ const selectedBlockId =
61
+ select( blockEditorStore ).getSelectedBlockClientId();
63
62
  return selectedBlockId === parentBlockId;
64
63
  },
65
64
  [ parentBlockId ]
66
65
  );
67
66
  const isSelectedText = isSelected ? __( 'Selected' ) : __( 'Select' );
68
67
  const { selectBlock } = useDispatch( blockEditorStore );
69
- const selectParentBlock = useCallback( () => selectBlock( parentBlockId ), [
70
- parentBlockId,
71
- ] );
68
+ const selectParentBlock = useCallback(
69
+ () => selectBlock( parentBlockId ),
70
+ [ parentBlockId ]
71
+ );
72
72
  const selectAndDismiss = useCallback( () => {
73
73
  selectBlock( parentBlockId );
74
74
  closePanel();
@@ -39,9 +39,8 @@ const PUBLISH_ON_SAVE_ENTITIES = [
39
39
  export default function EntitiesSavedStates( { close } ) {
40
40
  const saveButtonRef = useRef();
41
41
  const { dirtyEntityRecords } = useSelect( ( select ) => {
42
- const dirtyRecords = select(
43
- coreStore
44
- ).__experimentalGetDirtyEntityRecords();
42
+ const dirtyRecords =
43
+ select( coreStore ).__experimentalGetDirtyEntityRecords();
45
44
 
46
45
  // Remove site object and decouple into its edited pieces.
47
46
  const dirtyRecordsWithoutSite = dirtyRecords.filter(
@@ -77,13 +76,11 @@ export default function EntitiesSavedStates( { close } ) {
77
76
  __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,
78
77
  } = useDispatch( coreStore );
79
78
 
80
- const { __unstableMarkLastChangeAsPersistent } = useDispatch(
81
- blockEditorStore
82
- );
79
+ const { __unstableMarkLastChangeAsPersistent } =
80
+ useDispatch( blockEditorStore );
83
81
 
84
- const { createSuccessNotice, createErrorNotice } = useDispatch(
85
- noticesStore
86
- );
82
+ const { createSuccessNotice, createErrorNotice } =
83
+ useDispatch( noticesStore );
87
84
 
88
85
  // To group entities by type.
89
86
  const partitionedSavables = groupBy( dirtyEntityRecords, 'name' );
@@ -12,9 +12,8 @@ import { store as editorStore } from '../../store';
12
12
 
13
13
  function SaveShortcut( { resetBlocksOnSave } ) {
14
14
  const { resetEditorBlocks, savePost } = useDispatch( editorStore );
15
- const { isEditedPostDirty, getPostEdits, isPostSavingLocked } = useSelect(
16
- editorStore
17
- );
15
+ const { isEditedPostDirty, getPostEdits, isPostSavingLocked } =
16
+ useSelect( editorStore );
18
17
 
19
18
  useShortcut( 'core/editor/save', ( event ) => {
20
19
  event.preventDefault();
@@ -41,7 +41,10 @@ export { default as PostPublishPanel } from './post-publish-panel';
41
41
  export { default as PostSavedState } from './post-saved-state';
42
42
  export { default as PostSchedule } from './post-schedule';
43
43
  export { default as PostScheduleCheck } from './post-schedule/check';
44
- export { default as PostScheduleLabel } from './post-schedule/label';
44
+ export {
45
+ default as PostScheduleLabel,
46
+ usePostScheduleLabel,
47
+ } from './post-schedule/label';
45
48
  export { default as PostSlug } from './post-slug';
46
49
  export { default as PostSlugCheck } from './post-slug/check';
47
50
  export { default as PostSticky } from './post-sticky';
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { once, uniqueId, omit } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -27,23 +22,30 @@ const requestIdleCallback = window.requestIdleCallback
27
22
  ? window.requestIdleCallback
28
23
  : window.requestAnimationFrame;
29
24
 
25
+ let hasStorageSupport;
26
+ let uniqueId = 0;
27
+
30
28
  /**
31
29
  * Function which returns true if the current environment supports browser
32
30
  * sessionStorage, or false otherwise. The result of this function is cached and
33
31
  * reused in subsequent invocations.
34
32
  */
35
- const hasSessionStorageSupport = once( () => {
36
- try {
37
- // Private Browsing in Safari 10 and earlier will throw an error when
38
- // attempting to set into sessionStorage. The test here is intentional in
39
- // causing a thrown error as condition bailing from local autosave.
40
- window.sessionStorage.setItem( '__wpEditorTestSessionStorage', '' );
41
- window.sessionStorage.removeItem( '__wpEditorTestSessionStorage' );
42
- return true;
43
- } catch ( error ) {
44
- return false;
33
+ const hasSessionStorageSupport = () => {
34
+ if ( typeof hasStorageSupport === 'undefined' ) {
35
+ try {
36
+ // Private Browsing in Safari 10 and earlier will throw an error when
37
+ // attempting to set into sessionStorage. The test here is intentional in
38
+ // causing a thrown error as condition bailing from local autosave.
39
+ window.sessionStorage.setItem( '__wpEditorTestSessionStorage', '' );
40
+ window.sessionStorage.removeItem( '__wpEditorTestSessionStorage' );
41
+ hasStorageSupport = true;
42
+ } catch ( error ) {
43
+ hasStorageSupport = false;
44
+ }
45
45
  }
46
- } );
46
+
47
+ return hasStorageSupport;
48
+ };
47
49
 
48
50
  /**
49
51
  * Custom hook which manages the creation of a notice prompting the user to
@@ -54,8 +56,8 @@ function useAutosaveNotice() {
54
56
  ( select ) => ( {
55
57
  postId: select( editorStore ).getCurrentPostId(),
56
58
  isEditedPostNew: select( editorStore ).isEditedPostNew(),
57
- hasRemoteAutosave: !! select( editorStore ).getEditorSettings()
58
- .autosave,
59
+ hasRemoteAutosave:
60
+ !! select( editorStore ).getEditorSettings().autosave,
59
61
  } ),
60
62
  []
61
63
  );
@@ -98,7 +100,7 @@ function useAutosaveNotice() {
98
100
  return;
99
101
  }
100
102
 
101
- const noticeId = uniqueId( 'wpEditorAutosaveRestore' );
103
+ const noticeId = `wpEditorAutosaveRestore${ ++uniqueId }`;
102
104
  createWarningNotice(
103
105
  __(
104
106
  'The backup of this post in your browser is different from the version below.'
@@ -109,7 +111,11 @@ function useAutosaveNotice() {
109
111
  {
110
112
  label: __( 'Restore the backup' ),
111
113
  onClick() {
112
- editPost( omit( edits, [ 'content' ] ) );
114
+ const {
115
+ content: editsContent,
116
+ ...editsWithoutContent
117
+ } = edits;
118
+ editPost( editsWithoutContent );
113
119
  resetEditorBlocks( parse( edits.content ) );
114
120
  removeNotice( noticeId );
115
121
  },
@@ -124,22 +130,17 @@ function useAutosaveNotice() {
124
130
  * Custom hook which ejects a local autosave after a successful save occurs.
125
131
  */
126
132
  function useAutosavePurge() {
127
- const {
128
- postId,
129
- isEditedPostNew,
130
- isDirty,
131
- isAutosaving,
132
- didError,
133
- } = useSelect(
134
- ( select ) => ( {
135
- postId: select( editorStore ).getCurrentPostId(),
136
- isEditedPostNew: select( editorStore ).isEditedPostNew(),
137
- isDirty: select( editorStore ).isEditedPostDirty(),
138
- isAutosaving: select( editorStore ).isAutosavingPost(),
139
- didError: select( editorStore ).didPostSaveRequestFail(),
140
- } ),
141
- []
142
- );
133
+ const { postId, isEditedPostNew, isDirty, isAutosaving, didError } =
134
+ useSelect(
135
+ ( select ) => ( {
136
+ postId: select( editorStore ).getCurrentPostId(),
137
+ isEditedPostNew: select( editorStore ).isEditedPostNew(),
138
+ isDirty: select( editorStore ).isEditedPostDirty(),
139
+ isAutosaving: select( editorStore ).isAutosavingPost(),
140
+ didError: select( editorStore ).didPostSaveRequestFail(),
141
+ } ),
142
+ []
143
+ );
143
144
 
144
145
  const lastIsDirty = useRef( isDirty );
145
146
  const lastIsAutosaving = useRef( isAutosaving );
@@ -177,8 +178,8 @@ function LocalAutosaveMonitor() {
177
178
 
178
179
  const { localAutosaveInterval } = useSelect(
179
180
  ( select ) => ( {
180
- localAutosaveInterval: select( editorStore ).getEditorSettings()
181
- .localAutosaveInterval,
181
+ localAutosaveInterval:
182
+ select( editorStore ).getEditorSettings().localAutosaveInterval,
182
183
  } ),
183
184
  []
184
185
  );
@@ -7,7 +7,6 @@ import {
7
7
  debounce,
8
8
  repeat,
9
9
  find,
10
- flatten,
11
10
  deburr,
12
11
  } from 'lodash';
13
12
 
@@ -52,12 +51,10 @@ export function PageAttributesParent() {
52
51
  const [ fieldValue, setFieldValue ] = useState( false );
53
52
  const { parentPost, parentPostId, items, postType } = useSelect(
54
53
  ( select ) => {
55
- const { getPostType, getEntityRecords, getEntityRecord } = select(
56
- coreStore
57
- );
58
- const { getCurrentPostId, getEditedPostAttribute } = select(
59
- editorStore
60
- );
54
+ const { getPostType, getEntityRecords, getEntityRecord } =
55
+ select( coreStore );
56
+ const { getCurrentPostId, getEditedPostAttribute } =
57
+ select( editorStore );
61
58
  const postTypeSlug = getEditedPostAttribute( 'type' );
62
59
  const pageId = getEditedPostAttribute( 'parent' );
63
60
  const pType = getPostType( postTypeSlug );
@@ -113,7 +110,7 @@ export function PageAttributesParent() {
113
110
  return priorityA >= priorityB ? 1 : -1;
114
111
  } );
115
112
 
116
- return flatten( sortedNodes );
113
+ return sortedNodes.flat();
117
114
  };
118
115
 
119
116
  let tree = pageItems.map( ( item ) => ( {
@@ -18,9 +18,8 @@ function PostAuthorSelect() {
18
18
  const { editPost } = useDispatch( editorStore );
19
19
  const { postAuthor, authors } = useSelect( ( select ) => {
20
20
  return {
21
- postAuthor: select( editorStore ).getEditedPostAttribute(
22
- 'author'
23
- ),
21
+ postAuthor:
22
+ select( editorStore ).getEditedPostAttribute( 'author' ),
24
23
  authors: select( coreStore ).getUsers( AUTHORS_QUERY ),
25
24
  };
26
25
  }, [] );
@@ -29,9 +29,10 @@ function PostComments( { commentStatus = 'open', ...props } ) {
29
29
  export default compose( [
30
30
  withSelect( ( select ) => {
31
31
  return {
32
- commentStatus: select( editorStore ).getEditedPostAttribute(
33
- 'comment_status'
34
- ),
32
+ commentStatus:
33
+ select( editorStore ).getEditedPostAttribute(
34
+ 'comment_status'
35
+ ),
35
36
  };
36
37
  } ),
37
38
  withDispatch( ( dispatch ) => ( {
@@ -49,9 +49,8 @@ export default function PostFormat() {
49
49
 
50
50
  const { postFormat, suggestedFormat, supportedFormats } = useSelect(
51
51
  ( select ) => {
52
- const { getEditedPostAttribute, getSuggestedPostFormat } = select(
53
- editorStore
54
- );
52
+ const { getEditedPostAttribute, getSuggestedPostFormat } =
53
+ select( editorStore );
55
54
  const _postFormat = getEditedPostAttribute( 'format' );
56
55
  const themeSupports = select( coreStore ).getThemeSupports();
57
56
  return {
@@ -26,10 +26,8 @@ export function PostLastRevisionCheck( {
26
26
  }
27
27
 
28
28
  export default withSelect( ( select ) => {
29
- const {
30
- getCurrentPostLastRevisionId,
31
- getCurrentPostRevisionsCount,
32
- } = select( editorStore );
29
+ const { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } =
30
+ select( editorStore );
33
31
  return {
34
32
  lastRevisionId: getCurrentPostLastRevisionId(),
35
33
  revisionsCount: getCurrentPostRevisionsCount(),
@@ -35,10 +35,8 @@ function LastRevision( { lastRevisionId, revisionsCount } ) {
35
35
  }
36
36
 
37
37
  export default withSelect( ( select ) => {
38
- const {
39
- getCurrentPostLastRevisionId,
40
- getCurrentPostRevisionsCount,
41
- } = select( editorStore );
38
+ const { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } =
39
+ select( editorStore );
42
40
  return {
43
41
  lastRevisionId: getCurrentPostLastRevisionId(),
44
42
  revisionsCount: getCurrentPostRevisionsCount(),
@@ -28,11 +28,8 @@ export function PostPendingStatusCheck( {
28
28
 
29
29
  export default compose(
30
30
  withSelect( ( select ) => {
31
- const {
32
- isCurrentPostPublished,
33
- getCurrentPostType,
34
- getCurrentPost,
35
- } = select( editorStore );
31
+ const { isCurrentPostPublished, getCurrentPostType, getCurrentPost } =
32
+ select( editorStore );
36
33
  return {
37
34
  hasPublishAction: get(
38
35
  getCurrentPost(),
@@ -29,9 +29,8 @@ function PostPingbacks( { pingStatus = 'open', ...props } ) {
29
29
  export default compose( [
30
30
  withSelect( ( select ) => {
31
31
  return {
32
- pingStatus: select( editorStore ).getEditedPostAttribute(
33
- 'ping_status'
34
- ),
32
+ pingStatus:
33
+ select( editorStore ).getEditedPostAttribute( 'ping_status' ),
35
34
  };
36
35
  } ),
37
36
  withDispatch( ( dispatch ) => ( {