@wordpress/editor 12.7.0 → 12.10.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 (181) 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/local-autosave-monitor/index.js.map +1 -1
  18. package/build/components/page-attributes/parent.js.map +1 -1
  19. package/build/components/post-author/select.js.map +1 -1
  20. package/build/components/post-comments/index.js.map +1 -1
  21. package/build/components/post-format/index.js.map +1 -1
  22. package/build/components/post-last-revision/check.js.map +1 -1
  23. package/build/components/post-last-revision/index.js.map +1 -1
  24. package/build/components/post-pending-status/check.js.map +1 -1
  25. package/build/components/post-pingbacks/index.js.map +1 -1
  26. package/build/components/post-publish-button/index.js +4 -2
  27. package/build/components/post-publish-button/index.js.map +1 -1
  28. package/build/components/post-publish-panel/index.js.map +1 -1
  29. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  30. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  31. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  32. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  33. package/build/components/post-schedule/index.js +11 -18
  34. package/build/components/post-schedule/index.js.map +1 -1
  35. package/build/components/post-slug/index.js.map +1 -1
  36. package/build/components/post-sticky/index.js.map +1 -1
  37. package/build/components/post-switch-to-draft-button/index.js.map +1 -1
  38. package/build/components/post-taxonomies/flat-term-selector.js +2 -2
  39. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  40. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  41. package/build/components/post-text-editor/index.js +6 -6
  42. package/build/components/post-text-editor/index.js.map +1 -1
  43. package/build/components/post-title/index.js.map +1 -1
  44. package/build/components/post-title/index.native.js.map +1 -1
  45. package/build/components/post-trash/check.js.map +1 -1
  46. package/build/components/post-visibility/index.js +8 -11
  47. package/build/components/post-visibility/index.js.map +1 -1
  48. package/build/components/provider/index.js.map +1 -1
  49. package/build/components/provider/index.native.js +3 -1
  50. package/build/components/provider/index.native.js.map +1 -1
  51. package/build/components/provider/use-block-editor-settings.js +18 -10
  52. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  53. package/build/components/template-validation-notice/index.js.map +1 -1
  54. package/build/components/theme-support-check/index.js +1 -1
  55. package/build/components/theme-support-check/index.js.map +1 -1
  56. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  57. package/build/store/actions.js.map +1 -1
  58. package/build/store/selectors.js +2 -2
  59. package/build/store/selectors.js.map +1 -1
  60. package/build/utils/media-upload/index.js +4 -8
  61. package/build/utils/media-upload/index.js.map +1 -1
  62. package/build-module/components/editor-help/help-section-title.native.js +31 -0
  63. package/build-module/components/editor-help/help-section-title.native.js.map +1 -0
  64. package/build-module/components/editor-help/help-topic-row.native.js +3 -2
  65. package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
  66. package/build-module/components/editor-help/icon-move-blocks.native.js +13 -0
  67. package/build-module/components/editor-help/icon-move-blocks.native.js.map +1 -0
  68. package/build-module/components/editor-help/index.native.js +10 -12
  69. package/build-module/components/editor-help/index.native.js.map +1 -1
  70. package/build-module/components/editor-help/move-blocks.native.js +15 -3
  71. package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
  72. package/build-module/components/editor-help/view-sections.native.js +22 -6
  73. package/build-module/components/editor-help/view-sections.native.js.map +1 -1
  74. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  75. package/build-module/components/entities-saved-states/index.js.map +1 -1
  76. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  77. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  78. package/build-module/components/page-attributes/parent.js.map +1 -1
  79. package/build-module/components/post-author/select.js.map +1 -1
  80. package/build-module/components/post-comments/index.js.map +1 -1
  81. package/build-module/components/post-format/index.js.map +1 -1
  82. package/build-module/components/post-last-revision/check.js.map +1 -1
  83. package/build-module/components/post-last-revision/index.js.map +1 -1
  84. package/build-module/components/post-pending-status/check.js.map +1 -1
  85. package/build-module/components/post-pingbacks/index.js.map +1 -1
  86. package/build-module/components/post-publish-button/index.js +4 -1
  87. package/build-module/components/post-publish-button/index.js.map +1 -1
  88. package/build-module/components/post-publish-panel/index.js.map +1 -1
  89. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  90. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  91. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  92. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  93. package/build-module/components/post-schedule/index.js +12 -19
  94. package/build-module/components/post-schedule/index.js.map +1 -1
  95. package/build-module/components/post-slug/index.js.map +1 -1
  96. package/build-module/components/post-sticky/index.js.map +1 -1
  97. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  98. package/build-module/components/post-taxonomies/flat-term-selector.js +2 -2
  99. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  100. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  101. package/build-module/components/post-text-editor/index.js +6 -6
  102. package/build-module/components/post-text-editor/index.js.map +1 -1
  103. package/build-module/components/post-title/index.js.map +1 -1
  104. package/build-module/components/post-title/index.native.js.map +1 -1
  105. package/build-module/components/post-trash/check.js.map +1 -1
  106. package/build-module/components/post-visibility/index.js +9 -12
  107. package/build-module/components/post-visibility/index.js.map +1 -1
  108. package/build-module/components/provider/index.js.map +1 -1
  109. package/build-module/components/provider/index.native.js +2 -1
  110. package/build-module/components/provider/index.native.js.map +1 -1
  111. package/build-module/components/provider/use-block-editor-settings.js +19 -11
  112. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  113. package/build-module/components/template-validation-notice/index.js.map +1 -1
  114. package/build-module/components/theme-support-check/index.js +2 -2
  115. package/build-module/components/theme-support-check/index.js.map +1 -1
  116. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  117. package/build-module/store/actions.js.map +1 -1
  118. package/build-module/store/selectors.js +2 -2
  119. package/build-module/store/selectors.js.map +1 -1
  120. package/build-module/utils/media-upload/index.js +3 -5
  121. package/build-module/utils/media-upload/index.js.map +1 -1
  122. package/build-style/style-rtl.css +9 -17
  123. package/build-style/style.css +9 -17
  124. package/package.json +29 -29
  125. package/src/components/editor-help/help-section-title.native.js +29 -0
  126. package/src/components/editor-help/help-topic-row.native.js +2 -2
  127. package/src/components/editor-help/icon-move-blocks.native.js +10 -0
  128. package/src/components/editor-help/images/drag-and-drop-dark.png +0 -0
  129. package/src/components/editor-help/images/drag-and-drop-dark@2x.png +0 -0
  130. package/src/components/editor-help/images/drag-and-drop-dark@3x.png +0 -0
  131. package/src/components/editor-help/images/drag-and-drop-light.png +0 -0
  132. package/src/components/editor-help/images/drag-and-drop-light@2x.png +0 -0
  133. package/src/components/editor-help/images/drag-and-drop-light@3x.png +0 -0
  134. package/src/components/editor-help/index.native.js +26 -28
  135. package/src/components/editor-help/move-blocks.native.js +22 -2
  136. package/src/components/editor-help/style.scss +36 -4
  137. package/src/components/editor-help/test/index.native.js +1 -1
  138. package/src/components/editor-help/view-sections.native.js +23 -8
  139. package/src/components/entities-saved-states/entity-record-item.js +6 -6
  140. package/src/components/entities-saved-states/index.js +6 -9
  141. package/src/components/global-keyboard-shortcuts/save-shortcut.js +2 -3
  142. package/src/components/local-autosave-monitor/index.js +15 -20
  143. package/src/components/page-attributes/parent.js +4 -6
  144. package/src/components/post-author/select.js +2 -3
  145. package/src/components/post-comments/index.js +4 -3
  146. package/src/components/post-format/index.js +2 -3
  147. package/src/components/post-last-revision/check.js +2 -4
  148. package/src/components/post-last-revision/index.js +2 -4
  149. package/src/components/post-pending-status/check.js +2 -5
  150. package/src/components/post-pingbacks/index.js +2 -3
  151. package/src/components/post-publish-button/index.js +7 -8
  152. package/src/components/post-publish-panel/index.js +2 -3
  153. package/src/components/post-publish-panel/maybe-category-panel.js +2 -3
  154. package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -3
  155. package/src/components/post-publish-panel/postpublish.js +2 -5
  156. package/src/components/post-publish-panel/prepublish.js +2 -3
  157. package/src/components/post-saved-state/style.scss +9 -0
  158. package/src/components/post-schedule/index.js +6 -13
  159. package/src/components/post-slug/index.js +2 -3
  160. package/src/components/post-slug/test/index.js +4 -4
  161. package/src/components/post-sticky/index.js +2 -3
  162. package/src/components/post-switch-to-draft-button/index.js +2 -5
  163. package/src/components/post-taxonomies/flat-term-selector.js +9 -10
  164. package/src/components/post-taxonomies/hierarchical-term-selector.js +4 -6
  165. package/src/components/post-text-editor/index.js +5 -6
  166. package/src/components/post-title/index.js +21 -31
  167. package/src/components/post-title/index.native.js +10 -16
  168. package/src/components/post-trash/check.js +2 -3
  169. package/src/components/post-visibility/index.js +9 -15
  170. package/src/components/post-visibility/style.scss +0 -17
  171. package/src/components/provider/index.js +2 -3
  172. package/src/components/provider/index.native.js +13 -11
  173. package/src/components/provider/use-block-editor-settings.js +27 -15
  174. package/src/components/table-of-contents/style.scss +1 -3
  175. package/src/components/template-validation-notice/index.js +2 -3
  176. package/src/components/theme-support-check/index.js +2 -2
  177. package/src/hooks/custom-sources-backwards-compatibility.js +45 -44
  178. package/src/store/actions.js +211 -190
  179. package/src/store/selectors.js +16 -21
  180. package/src/store/test/selectors.js +7 -8
  181. package/src/utils/media-upload/index.js +2 -5
@@ -0,0 +1,29 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { Text, View } from 'react-native';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { usePreferredColorSchemeStyle } from '@wordpress/compose';
10
+
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+ import styles from './style.scss';
15
+
16
+ const HelpSectionTitle = ( { children } ) => {
17
+ const helpSectionTitle = usePreferredColorSchemeStyle(
18
+ styles.helpSectionTitle,
19
+ styles.helpSectionTitleDark
20
+ );
21
+
22
+ return (
23
+ <View style={ styles.helpSectionTitleContainer }>
24
+ <Text style={ helpSectionTitle }>{ children }</Text>
25
+ </View>
26
+ );
27
+ };
28
+
29
+ export default HelpSectionTitle;
@@ -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
+ }
@@ -35,7 +35,7 @@ it( 'navigates back from help topic detail screen', async () => {
35
35
  const backButton = screen.getAllByA11yLabel( 'Go back' );
36
36
  fireEvent.press( backButton[ backButton.length - 1 ] );
37
37
 
38
- // Currently logs `act` warning due to https://git.io/JYYGE
38
+ // Currently logs `act` warning due to https://github.com/callstack/react-native-testing-library/issues/379
39
39
  await waitForElementToBeRemoved( () =>
40
40
  screen.getByText(
41
41
  'Each block has its own settings. To find them, tap on a block. Its settings will appear on the toolbar at the bottom of the screen.'
@@ -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();
@@ -54,8 +54,8 @@ function useAutosaveNotice() {
54
54
  ( select ) => ( {
55
55
  postId: select( editorStore ).getCurrentPostId(),
56
56
  isEditedPostNew: select( editorStore ).isEditedPostNew(),
57
- hasRemoteAutosave: !! select( editorStore ).getEditorSettings()
58
- .autosave,
57
+ hasRemoteAutosave:
58
+ !! select( editorStore ).getEditorSettings().autosave,
59
59
  } ),
60
60
  []
61
61
  );
@@ -124,22 +124,17 @@ function useAutosaveNotice() {
124
124
  * Custom hook which ejects a local autosave after a successful save occurs.
125
125
  */
126
126
  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
- );
127
+ const { postId, isEditedPostNew, isDirty, isAutosaving, didError } =
128
+ useSelect(
129
+ ( select ) => ( {
130
+ postId: select( editorStore ).getCurrentPostId(),
131
+ isEditedPostNew: select( editorStore ).isEditedPostNew(),
132
+ isDirty: select( editorStore ).isEditedPostDirty(),
133
+ isAutosaving: select( editorStore ).isAutosavingPost(),
134
+ didError: select( editorStore ).didPostSaveRequestFail(),
135
+ } ),
136
+ []
137
+ );
143
138
 
144
139
  const lastIsDirty = useRef( isDirty );
145
140
  const lastIsAutosaving = useRef( isAutosaving );
@@ -177,8 +172,8 @@ function LocalAutosaveMonitor() {
177
172
 
178
173
  const { localAutosaveInterval } = useSelect(
179
174
  ( select ) => ( {
180
- localAutosaveInterval: select( editorStore ).getEditorSettings()
181
- .localAutosaveInterval,
175
+ localAutosaveInterval:
176
+ select( editorStore ).getEditorSettings().localAutosaveInterval,
182
177
  } ),
183
178
  []
184
179
  );
@@ -52,12 +52,10 @@ export function PageAttributesParent() {
52
52
  const [ fieldValue, setFieldValue ] = useState( false );
53
53
  const { parentPost, parentPostId, items, postType } = useSelect(
54
54
  ( select ) => {
55
- const { getPostType, getEntityRecords, getEntityRecord } = select(
56
- coreStore
57
- );
58
- const { getCurrentPostId, getEditedPostAttribute } = select(
59
- editorStore
60
- );
55
+ const { getPostType, getEntityRecords, getEntityRecord } =
56
+ select( coreStore );
57
+ const { getCurrentPostId, getEditedPostAttribute } =
58
+ select( editorStore );
61
59
  const postTypeSlug = getEditedPostAttribute( 'type' );
62
60
  const pageId = getEditedPostAttribute( 'parent' );
63
61
  const pType = getPostType( postTypeSlug );
@@ -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 ) => ( {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { noop, get, some } from 'lodash';
4
+ import { get, some } from 'lodash';
5
5
  import classnames from 'classnames';
6
6
 
7
7
  /**
@@ -19,15 +19,16 @@ import { __ } from '@wordpress/i18n';
19
19
  import PublishButtonLabel from './label';
20
20
  import { store as editorStore } from '../../store';
21
21
 
22
+ const noop = () => {};
23
+
22
24
  export class PostPublishButton extends Component {
23
25
  constructor( props ) {
24
26
  super( props );
25
27
  this.buttonNode = createRef();
26
28
 
27
29
  this.createOnClick = this.createOnClick.bind( this );
28
- this.closeEntitiesSavedStates = this.closeEntitiesSavedStates.bind(
29
- this
30
- );
30
+ this.closeEntitiesSavedStates =
31
+ this.closeEntitiesSavedStates.bind( this );
31
32
 
32
33
  this.state = {
33
34
  entitiesSavedStatesCallback: false,
@@ -41,10 +42,8 @@ export class PostPublishButton extends Component {
41
42
 
42
43
  createOnClick( callback ) {
43
44
  return ( ...args ) => {
44
- const {
45
- hasNonPostEntityChanges,
46
- setEntitiesSavedStatesCallback,
47
- } = this.props;
45
+ const { hasNonPostEntityChanges, setEntitiesSavedStatesCallback } =
46
+ this.props;
48
47
  // If a post with non-post entities is published, but the user
49
48
  // elects to not save changes to the non-post entities, those
50
49
  // entities will still be dirty when the Publish button is clicked.
@@ -167,9 +167,8 @@ export default compose( [
167
167
  };
168
168
  } ),
169
169
  withDispatch( ( dispatch, { isPublishSidebarEnabled } ) => {
170
- const { disablePublishSidebar, enablePublishSidebar } = dispatch(
171
- editorStore
172
- );
170
+ const { disablePublishSidebar, enablePublishSidebar } =
171
+ dispatch( editorStore );
173
172
  return {
174
173
  onTogglePublishSidebar: () => {
175
174
  if ( isPublishSidebarEnabled ) {
@@ -21,9 +21,8 @@ import { store as editorStore } from '../../store';
21
21
  function MaybeCategoryPanel() {
22
22
  const hasNoCategory = useSelect( ( select ) => {
23
23
  const postType = select( editorStore ).getCurrentPostType();
24
- const categoriesTaxonomy = select( coreStore ).getTaxonomy(
25
- 'category'
26
- );
24
+ const categoriesTaxonomy =
25
+ select( coreStore ).getTaxonomy( 'category' );
27
26
  const defaultCategorySlug = 'uncategorized';
28
27
  const defaultCategory = select( coreStore ).getEntityRecords(
29
28
  'taxonomy',