@wordpress/editor 11.0.1 → 12.0.2

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 (241) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +1 -1
  3. package/build/components/autosave-monitor/index.js +5 -0
  4. package/build/components/autosave-monitor/index.js.map +1 -1
  5. package/build/components/character-count/index.js +1 -1
  6. package/build/components/character-count/index.js.map +1 -1
  7. package/build/components/editor-help/add-blocks.native.js +6 -5
  8. package/build/components/editor-help/add-blocks.native.js.map +1 -1
  9. package/build/components/editor-help/customize-blocks.native.js +7 -6
  10. package/build/components/editor-help/customize-blocks.native.js.map +1 -1
  11. package/build/components/editor-help/help-detail-navigation-screen.native.js +29 -15
  12. package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  13. package/build/components/editor-help/help-get-support-button.native.js +46 -0
  14. package/build/components/editor-help/help-get-support-button.native.js.map +1 -0
  15. package/build/components/editor-help/help-topic-row.native.js +3 -2
  16. package/build/components/editor-help/help-topic-row.native.js.map +1 -1
  17. package/build/components/editor-help/index.native.js +87 -26
  18. package/build/components/editor-help/index.native.js.map +1 -1
  19. package/build/components/editor-help/intro-to-blocks.native.js +19 -9
  20. package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
  21. package/build/components/editor-help/move-blocks.native.js +6 -5
  22. package/build/components/editor-help/move-blocks.native.js.map +1 -1
  23. package/build/components/editor-help/remove-blocks.native.js +6 -5
  24. package/build/components/editor-help/remove-blocks.native.js.map +1 -1
  25. package/build/components/editor-help/view-sections.native.js +23 -5
  26. package/build/components/editor-help/view-sections.native.js.map +1 -1
  27. package/build/components/entities-saved-states/entity-type-list.js +22 -13
  28. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  29. package/build/components/entities-saved-states/index.js +23 -4
  30. package/build/components/entities-saved-states/index.js.map +1 -1
  31. package/build/components/global-keyboard-shortcuts/save-shortcut.js +12 -14
  32. package/build/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  33. package/build/components/global-keyboard-shortcuts/visual-editor-shortcuts.js +0 -4
  34. package/build/components/global-keyboard-shortcuts/visual-editor-shortcuts.js.map +1 -1
  35. package/build/components/index.js +9 -0
  36. package/build/components/index.js.map +1 -1
  37. package/build/components/local-autosave-monitor/index.js +1 -2
  38. package/build/components/local-autosave-monitor/index.js.map +1 -1
  39. package/build/components/post-format/index.js +3 -1
  40. package/build/components/post-format/index.js.map +1 -1
  41. package/build/components/post-locked-modal/index.js +1 -1
  42. package/build/components/post-locked-modal/index.js.map +1 -1
  43. package/build/components/post-saved-state/index.js +37 -46
  44. package/build/components/post-saved-state/index.js.map +1 -1
  45. package/build/components/post-taxonomies/flat-term-selector.js +154 -211
  46. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  47. package/build/components/post-title/index.js +53 -25
  48. package/build/components/post-title/index.js.map +1 -1
  49. package/build/components/provider/index.native.js +18 -7
  50. package/build/components/provider/index.native.js.map +1 -1
  51. package/build/components/provider/use-block-editor-settings.js +32 -5
  52. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  53. package/build/components/word-count/index.js +1 -1
  54. package/build/components/word-count/index.js.map +1 -1
  55. package/build/store/actions.js +13 -38
  56. package/build/store/actions.js.map +1 -1
  57. package/build/store/defaults.js +7 -2
  58. package/build/store/defaults.js.map +1 -1
  59. package/build/store/selectors.js +4 -93
  60. package/build/store/selectors.js.map +1 -1
  61. package/build/store/utils/notice-builder.js +15 -18
  62. package/build/store/utils/notice-builder.js.map +1 -1
  63. package/build/{store/utils → utils}/get-template-part-icon.js +1 -1
  64. package/build/utils/get-template-part-icon.js.map +1 -0
  65. package/build/utils/index.js +8 -0
  66. package/build/utils/index.js.map +1 -1
  67. package/build-module/components/autosave-monitor/index.js +5 -0
  68. package/build-module/components/autosave-monitor/index.js.map +1 -1
  69. package/build-module/components/character-count/index.js +1 -1
  70. package/build-module/components/character-count/index.js.map +1 -1
  71. package/build-module/components/editor-help/add-blocks.native.js +7 -6
  72. package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
  73. package/build-module/components/editor-help/customize-blocks.native.js +8 -7
  74. package/build-module/components/editor-help/customize-blocks.native.js.map +1 -1
  75. package/build-module/components/editor-help/help-detail-navigation-screen.native.js +31 -18
  76. package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  77. package/build-module/components/editor-help/help-get-support-button.native.js +34 -0
  78. package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -0
  79. package/build-module/components/editor-help/help-topic-row.native.js +3 -2
  80. package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
  81. package/build-module/components/editor-help/index.native.js +81 -28
  82. package/build-module/components/editor-help/index.native.js.map +1 -1
  83. package/build-module/components/editor-help/intro-to-blocks.native.js +19 -10
  84. package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
  85. package/build-module/components/editor-help/move-blocks.native.js +7 -6
  86. package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
  87. package/build-module/components/editor-help/remove-blocks.native.js +7 -6
  88. package/build-module/components/editor-help/remove-blocks.native.js.map +1 -1
  89. package/build-module/components/editor-help/view-sections.native.js +22 -5
  90. package/build-module/components/editor-help/view-sections.native.js.map +1 -1
  91. package/build-module/components/entities-saved-states/entity-type-list.js +24 -13
  92. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  93. package/build-module/components/entities-saved-states/index.js +23 -4
  94. package/build-module/components/entities-saved-states/index.js.map +1 -1
  95. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js +12 -14
  96. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  97. package/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js +0 -4
  98. package/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js.map +1 -1
  99. package/build-module/components/index.js +1 -0
  100. package/build-module/components/index.js.map +1 -1
  101. package/build-module/components/local-autosave-monitor/index.js +1 -2
  102. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  103. package/build-module/components/post-format/index.js +4 -2
  104. package/build-module/components/post-format/index.js.map +1 -1
  105. package/build-module/components/post-locked-modal/index.js +1 -1
  106. package/build-module/components/post-locked-modal/index.js.map +1 -1
  107. package/build-module/components/post-saved-state/index.js +38 -46
  108. package/build-module/components/post-saved-state/index.js.map +1 -1
  109. package/build-module/components/post-taxonomies/flat-term-selector.js +156 -214
  110. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  111. package/build-module/components/post-title/index.js +53 -22
  112. package/build-module/components/post-title/index.js.map +1 -1
  113. package/build-module/components/provider/index.native.js +18 -7
  114. package/build-module/components/provider/index.native.js.map +1 -1
  115. package/build-module/components/provider/use-block-editor-settings.js +31 -5
  116. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  117. package/build-module/components/word-count/index.js +1 -1
  118. package/build-module/components/word-count/index.js.map +1 -1
  119. package/build-module/store/actions.js +13 -36
  120. package/build-module/store/actions.js.map +1 -1
  121. package/build-module/store/defaults.js +7 -2
  122. package/build-module/store/defaults.js.map +1 -1
  123. package/build-module/store/selectors.js +3 -85
  124. package/build-module/store/selectors.js.map +1 -1
  125. package/build-module/store/utils/notice-builder.js +15 -18
  126. package/build-module/store/utils/notice-builder.js.map +1 -1
  127. package/build-module/{store/utils → utils}/get-template-part-icon.js +2 -2
  128. package/build-module/utils/get-template-part-icon.js.map +1 -0
  129. package/build-module/utils/index.js +1 -0
  130. package/build-module/utils/index.js.map +1 -1
  131. package/build-style/style-rtl.css +9 -60
  132. package/build-style/style.css +9 -60
  133. package/package.json +28 -28
  134. package/src/components/autosave-monitor/index.js +5 -0
  135. package/src/components/autosave-monitor/test/index.js +10 -4
  136. package/src/components/character-count/index.js +3 -2
  137. package/src/components/editor-help/add-blocks.native.js +17 -12
  138. package/src/components/editor-help/customize-blocks.native.js +16 -13
  139. package/src/components/editor-help/help-detail-navigation-screen.native.js +45 -15
  140. package/src/components/editor-help/help-get-support-button.native.js +38 -0
  141. package/src/components/editor-help/help-topic-row.native.js +2 -2
  142. package/src/components/editor-help/images/add-dark.png +0 -0
  143. package/src/components/editor-help/images/add-dark@2x.png +0 -0
  144. package/src/components/editor-help/images/add-dark@3x.png +0 -0
  145. package/src/components/editor-help/images/add-light.png +0 -0
  146. package/src/components/editor-help/images/add-light@2x.png +0 -0
  147. package/src/components/editor-help/images/add-light@3x.png +0 -0
  148. package/src/components/editor-help/images/block-layout-collage.png +0 -0
  149. package/src/components/editor-help/images/block-layout-collage@2x.png +0 -0
  150. package/src/components/editor-help/images/block-layout-collage@3x.png +0 -0
  151. package/src/components/editor-help/images/build-layouts-dark.png +0 -0
  152. package/src/components/editor-help/images/build-layouts-dark@2x.png +0 -0
  153. package/src/components/editor-help/images/build-layouts-dark@3x.png +0 -0
  154. package/src/components/editor-help/images/build-layouts-light.png +0 -0
  155. package/src/components/editor-help/images/build-layouts-light@2x.png +0 -0
  156. package/src/components/editor-help/images/build-layouts-light@3x.png +0 -0
  157. package/src/components/editor-help/images/edit-media-dark.png +0 -0
  158. package/src/components/editor-help/images/edit-media-dark@2x.png +0 -0
  159. package/src/components/editor-help/images/edit-media-dark@3x.png +0 -0
  160. package/src/components/editor-help/images/edit-media-light.png +0 -0
  161. package/src/components/editor-help/images/edit-media-light@2x.png +0 -0
  162. package/src/components/editor-help/images/edit-media-light@3x.png +0 -0
  163. package/src/components/editor-help/images/embed-media-dark.png +0 -0
  164. package/src/components/editor-help/images/embed-media-dark@2x.png +0 -0
  165. package/src/components/editor-help/images/embed-media-dark@3x.png +0 -0
  166. package/src/components/editor-help/images/embed-media-light.png +0 -0
  167. package/src/components/editor-help/images/embed-media-light@2x.png +0 -0
  168. package/src/components/editor-help/images/embed-media-light@3x.png +0 -0
  169. package/src/components/editor-help/images/move-dark.png +0 -0
  170. package/src/components/editor-help/images/move-dark@2x.png +0 -0
  171. package/src/components/editor-help/images/move-dark@3x.png +0 -0
  172. package/src/components/editor-help/images/move-light.png +0 -0
  173. package/src/components/editor-help/images/move-light@2x.png +0 -0
  174. package/src/components/editor-help/images/move-light@3x.png +0 -0
  175. package/src/components/editor-help/images/options-dark.png +0 -0
  176. package/src/components/editor-help/images/options-dark@2x.png +0 -0
  177. package/src/components/editor-help/images/options-dark@3x.png +0 -0
  178. package/src/components/editor-help/images/options-light.png +0 -0
  179. package/src/components/editor-help/images/options-light@2x.png +0 -0
  180. package/src/components/editor-help/images/options-light@3x.png +0 -0
  181. package/src/components/editor-help/images/rich-text-dark.png +0 -0
  182. package/src/components/editor-help/images/rich-text-dark@2x.png +0 -0
  183. package/src/components/editor-help/images/rich-text-dark@3x.png +0 -0
  184. package/src/components/editor-help/images/rich-text-light.png +0 -0
  185. package/src/components/editor-help/images/rich-text-light@2x.png +0 -0
  186. package/src/components/editor-help/images/rich-text-light@3x.png +0 -0
  187. package/src/components/editor-help/images/settings-dark.png +0 -0
  188. package/src/components/editor-help/images/settings-dark@2x.png +0 -0
  189. package/src/components/editor-help/images/settings-dark@3x.png +0 -0
  190. package/src/components/editor-help/images/settings-light.png +0 -0
  191. package/src/components/editor-help/images/settings-light@2x.png +0 -0
  192. package/src/components/editor-help/images/settings-light@3x.png +0 -0
  193. package/src/components/editor-help/index.native.js +147 -43
  194. package/src/components/editor-help/intro-to-blocks.native.js +63 -43
  195. package/src/components/editor-help/move-blocks.native.js +12 -7
  196. package/src/components/editor-help/remove-blocks.native.js +11 -8
  197. package/src/components/editor-help/style.android.scss +6 -0
  198. package/src/components/editor-help/style.ios.scss +6 -0
  199. package/src/components/editor-help/style.scss +49 -32
  200. package/src/components/editor-help/test/index.native.js +80 -0
  201. package/src/components/editor-help/view-sections.native.js +47 -4
  202. package/src/components/entities-saved-states/entity-type-list.js +29 -10
  203. package/src/components/entities-saved-states/index.js +38 -8
  204. package/src/components/global-keyboard-shortcuts/save-shortcut.js +34 -42
  205. package/src/components/global-keyboard-shortcuts/visual-editor-shortcuts.js +8 -16
  206. package/src/components/index.js +1 -0
  207. package/src/components/local-autosave-monitor/index.js +1 -3
  208. package/src/components/post-format/index.js +6 -2
  209. package/src/components/post-format/style.scss +1 -0
  210. package/src/components/post-locked-modal/index.js +1 -1
  211. package/src/components/post-saved-state/index.js +41 -55
  212. package/src/components/post-saved-state/style.scss +10 -1
  213. package/src/components/post-saved-state/test/__snapshots__/index.js.snap +20 -0
  214. package/src/components/post-saved-state/test/index.js +2 -2
  215. package/src/components/post-taxonomies/flat-term-selector.js +220 -254
  216. package/src/components/post-title/index.js +47 -30
  217. package/src/components/post-title/style.scss +1 -70
  218. package/src/components/provider/index.native.js +17 -5
  219. package/src/components/provider/use-block-editor-settings.js +25 -2
  220. package/src/components/word-count/index.js +3 -2
  221. package/src/store/actions.js +13 -41
  222. package/src/store/defaults.js +7 -2
  223. package/src/store/selectors.js +2 -112
  224. package/src/store/test/actions.js +4 -2
  225. package/src/store/utils/notice-builder.js +17 -19
  226. package/src/store/utils/test/notice-builder.js +1 -1
  227. package/src/{store/utils → utils}/get-template-part-icon.js +2 -2
  228. package/src/utils/index.js +1 -0
  229. package/build/store/utils/get-template-part-icon.js.map +0 -1
  230. package/build-module/store/utils/get-template-part-icon.js.map +0 -1
  231. package/src/components/editor-help/images/add-blocks.png +0 -0
  232. package/src/components/editor-help/images/customize-blocks.png +0 -0
  233. package/src/components/editor-help/images/cut-copy-duplicate-blocks.png +0 -0
  234. package/src/components/editor-help/images/edit-or-replace-media.png +0 -0
  235. package/src/components/editor-help/images/intro-blocks-1.png +0 -0
  236. package/src/components/editor-help/images/intro-blocks-2.png +0 -0
  237. package/src/components/editor-help/images/intro-blocks-3.png +0 -0
  238. package/src/components/editor-help/images/intro-blocks-4.png +0 -0
  239. package/src/components/editor-help/images/move-blocks.png +0 -0
  240. package/src/components/editor-help/images/remove-blocks.png +0 -0
  241. package/src/components/editor-help/images/what-is-a-block.png +0 -0
@@ -1,14 +1,19 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { View, Text } from 'react-native';
4
+ import { kebabCase } from 'lodash';
5
+ import { Text, SafeAreaView, ScrollView, StyleSheet, View } from 'react-native';
6
+ import { TransitionPresets } from '@react-navigation/stack';
5
7
 
6
8
  /**
7
9
  * WordPress dependencies
8
10
  */
9
- import { BottomSheet, PanelBody } from '@wordpress/components';
11
+ import {
12
+ BottomSheet,
13
+ BottomSheetConsumer,
14
+ PanelBody,
15
+ } from '@wordpress/components';
10
16
  import { __ } from '@wordpress/i18n';
11
- import { usePreferredColorSchemeStyle } from '@wordpress/compose';
12
17
  import {
13
18
  helpFilled,
14
19
  plusCircleFilled,
@@ -16,6 +21,13 @@ import {
16
21
  trashFilled,
17
22
  cogAlt,
18
23
  } from '@wordpress/icons';
24
+ import { useSelect } from '@wordpress/data';
25
+ import { store as editorStore } from '@wordpress/editor';
26
+ import { usePreferredColorSchemeStyle } from '@wordpress/compose';
27
+ import {
28
+ requestContactCustomerSupport,
29
+ requestGotoCustomerSupportOptions,
30
+ } from '@wordpress/react-native-bridge';
19
31
 
20
32
  /**
21
33
  * Internal dependencies
@@ -23,6 +35,7 @@ import {
23
35
  import styles from './style.scss';
24
36
  import HelpDetailNavigationScreen from './help-detail-navigation-screen';
25
37
  import HelpTopicRow from './help-topic-row';
38
+ import HelpGetSupportButton from './help-get-support-button';
26
39
  import IntroToBlocks from './intro-to-blocks';
27
40
  import AddBlocks from './add-blocks';
28
41
  import MoveBlocks from './move-blocks';
@@ -49,12 +62,21 @@ const HELP_TOPICS = [
49
62
  },
50
63
  ];
51
64
 
52
- function EditorHelpTopics( { isVisible, onClose } ) {
53
- const bottomSheetHeaderTitleStyle = usePreferredColorSchemeStyle(
54
- styles.bottomSheetHeaderTitle,
55
- styles.bottomSheetHeaderTitleDark
65
+ function EditorHelpTopics( { close, isVisible, onClose } ) {
66
+ const { postType } = useSelect( ( select ) => ( {
67
+ postType: select( editorStore ).getEditedPostAttribute( 'type' ),
68
+ } ) );
69
+
70
+ const sectionTitle = usePreferredColorSchemeStyle(
71
+ styles.helpDetailSectionHeading,
72
+ styles.helpDetailSectionHeadingDark
56
73
  );
57
74
 
75
+ const title =
76
+ postType === 'page'
77
+ ? __( 'How to edit your page' )
78
+ : __( 'How to edit your post' );
79
+
58
80
  return (
59
81
  <BottomSheet
60
82
  isVisible={ isVisible }
@@ -62,45 +84,127 @@ function EditorHelpTopics( { isVisible, onClose } ) {
62
84
  hideHeader
63
85
  hasNavigation
64
86
  contentStyle={ styles.contentContainer }
87
+ testID="editor-help-modal"
65
88
  >
66
- <BottomSheet.NavigationContainer animate main>
67
- <BottomSheet.NavigationScreen name={ __( 'Topics' ) }>
68
- <View style={ styles.bottomSheetHeader }>
69
- <Text
70
- style={ bottomSheetHeaderTitleStyle }
71
- maxFontSizeMultiplier={ 3 }
72
- >
73
- { __( 'How to edit your site' ) }
74
- </Text>
75
- </View>
76
- <View style={ styles.separator } />
77
- <PanelBody
78
- title={ __( 'The basics' ) }
79
- style={ styles.sectionContainer }
89
+ <SafeAreaView>
90
+ <BottomSheet.NavigationContainer
91
+ animate
92
+ main
93
+ style={ styles.navigationContainer }
94
+ >
95
+ <BottomSheet.NavigationScreen
96
+ isScrollable
97
+ fullScreen
98
+ name="help-topics"
80
99
  >
81
- { /* Print out help topics */ }
82
- { HELP_TOPICS.map( ( topic ) => {
83
- return (
84
- <HelpTopicRow
85
- key={ topic.label }
86
- label={ topic.label }
87
- icon={ topic.icon }
100
+ <View style={ styles.container }>
101
+ <BottomSheet.NavBar>
102
+ <BottomSheet.NavBar.DismissButton
103
+ onPress={ close }
104
+ iosText={ __( 'Close' ) }
88
105
  />
89
- );
90
- } ) }
91
- </PanelBody>
92
- </BottomSheet.NavigationScreen>
93
- { /* Print out help detail screens */ }
94
- { HELP_TOPICS.map( ( topic ) => {
95
- return (
96
- <HelpDetailNavigationScreen
97
- key={ topic.label }
98
- name={ topic.label }
99
- content={ topic.view }
100
- />
101
- );
102
- } ) }
103
- </BottomSheet.NavigationContainer>
106
+ <BottomSheet.NavBar.Heading>
107
+ { title }
108
+ </BottomSheet.NavBar.Heading>
109
+ </BottomSheet.NavBar>
110
+ <BottomSheetConsumer>
111
+ { ( { listProps } ) => {
112
+ const contentContainerStyle = StyleSheet.flatten(
113
+ listProps.contentContainerStyle
114
+ );
115
+ return (
116
+ <ScrollView
117
+ { ...listProps }
118
+ contentContainerStyle={ {
119
+ ...contentContainerStyle,
120
+ paddingBottom: Math.max(
121
+ listProps.safeAreaBottomInset,
122
+ contentContainerStyle.paddingBottom
123
+ ),
124
+ /**
125
+ * Remove margin set via `hideHeader`. Combining a header
126
+ * and navigation in this bottom sheet is at odds with the
127
+ * current `BottomSheet` implementation.
128
+ */
129
+ marginTop: 0,
130
+ } }
131
+ >
132
+ <PanelBody>
133
+ <Text style={ sectionTitle }>
134
+ { __( 'The basics' ) }
135
+ </Text>
136
+ { /* Print out help topics */ }
137
+ { HELP_TOPICS.map(
138
+ ( { label, icon } ) => {
139
+ const labelSlug = kebabCase(
140
+ label
141
+ );
142
+ return (
143
+ <HelpTopicRow
144
+ key={
145
+ labelSlug
146
+ }
147
+ label={ label }
148
+ icon={ icon }
149
+ screenName={
150
+ labelSlug
151
+ }
152
+ />
153
+ );
154
+ }
155
+ ) }
156
+ {
157
+ <Text
158
+ style={ sectionTitle }
159
+ >
160
+ { __( 'Get support' ) }
161
+ </Text>
162
+ }
163
+ {
164
+ <HelpGetSupportButton
165
+ title={ __(
166
+ 'Contact support'
167
+ ) }
168
+ onPress={
169
+ requestContactCustomerSupport
170
+ }
171
+ />
172
+ }
173
+ {
174
+ <HelpGetSupportButton
175
+ title={ __(
176
+ 'More support options'
177
+ ) }
178
+ onPress={
179
+ requestGotoCustomerSupportOptions
180
+ }
181
+ />
182
+ }
183
+ </PanelBody>
184
+ </ScrollView>
185
+ );
186
+ } }
187
+ </BottomSheetConsumer>
188
+ </View>
189
+ </BottomSheet.NavigationScreen>
190
+ { /* Print out help detail screens */ }
191
+ { HELP_TOPICS.map( ( { view, label } ) => {
192
+ const labelSlug = kebabCase( label );
193
+ return (
194
+ <HelpDetailNavigationScreen
195
+ key={ labelSlug }
196
+ name={ labelSlug }
197
+ content={ view }
198
+ label={ label }
199
+ options={ {
200
+ gestureEnabled: true,
201
+ ...TransitionPresets.DefaultTransition,
202
+ } }
203
+ />
204
+ );
205
+ } ) }
206
+ </BottomSheet.NavigationContainer>
207
+ </SafeAreaView>
104
208
  </BottomSheet>
105
209
  );
106
210
  }
@@ -7,6 +7,7 @@ import { View, Text } from 'react-native';
7
7
  * WordPress dependencies
8
8
  */
9
9
  import { __ } from '@wordpress/i18n';
10
+ import { usePreferredColorSchemeStyle } from '@wordpress/compose';
10
11
 
11
12
  /**
12
13
  * Internal dependencies
@@ -19,52 +20,71 @@ import {
19
20
  } from './view-sections';
20
21
 
21
22
  const IntroToBlocks = () => {
23
+ const titleStyle = usePreferredColorSchemeStyle(
24
+ styles.helpDetailTitle,
25
+ styles.helpDetailTitleDark
26
+ );
22
27
  return (
23
- <View style={ styles.helpDetailContainer }>
24
- <HelpDetailImage
25
- source={ require( './images/intro-blocks-1.png' ) }
26
- />
27
- <Text style={ styles.helpDetailTitle }>
28
- { __( 'Welcome to the world of blocks' ) }
29
- </Text>
30
- <HelpDetailBodyText
31
- text={ __(
32
- 'Blocks are pieces of content that you can insert, rearrange, and style without needing to know how to code. Blocks are an easy and modern way for you to create beautiful layouts.'
33
- ) }
34
- />
35
- <HelpDetailSectionHeadingText text={ __( 'Rich text editing' ) } />
36
- <HelpDetailBodyText
37
- text={ __(
38
- 'Blocks allow you to focus on writing your content, knowing that all the formatting tools you need are there to help you get your message across.'
39
- ) }
40
- />
41
- <HelpDetailImage
42
- source={ require( './images/intro-blocks-2.png' ) }
43
- />
44
- <HelpDetailSectionHeadingText text={ __( 'Embed media' ) } />
45
- <HelpDetailBodyText
46
- text={ __(
47
- 'Make your content stand out by adding images, gifs, videos, and embedded media to your pages.'
48
- ) }
49
- />
50
- <HelpDetailImage
51
- source={ require( './images/intro-blocks-3.png' ) }
52
- />
53
- <HelpDetailSectionHeadingText text={ __( 'Build layouts' ) } />
54
- <HelpDetailBodyText
55
- text={ __(
56
- 'Arrange your content into columns, add Call to Action buttons, and overlay images with text.'
57
- ) }
58
- />
28
+ <>
59
29
  <HelpDetailImage
60
- source={ require( './images/intro-blocks-4.png' ) }
61
- />
62
- <HelpDetailBodyText
63
- text={ __(
64
- 'Give it a try by adding a few blocks to your post or page!'
65
- ) }
30
+ source={ require( './images/block-layout-collage.png' ) }
66
31
  />
67
- </View>
32
+ <View style={ styles.helpDetailContainer }>
33
+ <Text
34
+ accessibilityRole="header"
35
+ selectable
36
+ style={ titleStyle }
37
+ >
38
+ { __( 'Welcome to the world of blocks' ) }
39
+ </Text>
40
+ <HelpDetailBodyText
41
+ text={ __(
42
+ 'Blocks are pieces of content that you can insert, rearrange, and style without needing to know how to code. Blocks are an easy and modern way for you to create beautiful layouts.'
43
+ ) }
44
+ />
45
+ <HelpDetailSectionHeadingText
46
+ text={ __( 'Rich text editing' ) }
47
+ />
48
+ <HelpDetailBodyText
49
+ text={ __(
50
+ 'Blocks allow you to focus on writing your content, knowing that all the formatting tools you need are there to help you get your message across.'
51
+ ) }
52
+ />
53
+ <HelpDetailImage
54
+ accessible={ true }
55
+ accessibilityLabel={ __(
56
+ 'Text formatting controls are located within the toolbar positioned above the keyboard while editing a text block'
57
+ ) }
58
+ source={ require( './images/rich-text-light.png' ) }
59
+ sourceDarkMode={ require( './images/rich-text-dark.png' ) }
60
+ />
61
+ <HelpDetailSectionHeadingText text={ __( 'Embed media' ) } />
62
+ <HelpDetailBodyText
63
+ text={ __(
64
+ 'Make your content stand out by adding images, gifs, videos, and embedded media to your pages.'
65
+ ) }
66
+ />
67
+ <HelpDetailImage
68
+ source={ require( './images/embed-media-light.png' ) }
69
+ sourceDarkMode={ require( './images/embed-media-dark.png' ) }
70
+ />
71
+ <HelpDetailSectionHeadingText text={ __( 'Build layouts' ) } />
72
+ <HelpDetailBodyText
73
+ text={ __(
74
+ 'Arrange your content into columns, add Call to Action buttons, and overlay images with text.'
75
+ ) }
76
+ />
77
+ <HelpDetailImage
78
+ source={ require( './images/build-layouts-light.png' ) }
79
+ sourceDarkMode={ require( './images/build-layouts-dark.png' ) }
80
+ />
81
+ <HelpDetailBodyText
82
+ text={ __(
83
+ 'Give it a try by adding a few blocks to your post or page!'
84
+ ) }
85
+ />
86
+ </View>
87
+ </>
68
88
  );
69
89
  };
70
90
 
@@ -16,14 +16,19 @@ import { HelpDetailBodyText, HelpDetailImage } from './view-sections';
16
16
 
17
17
  const MoveBlocks = () => {
18
18
  return (
19
- <View style={ styles.helpDetailContainer }>
20
- <HelpDetailImage source={ require( './images/move-blocks.png' ) } />
21
- <HelpDetailBodyText
22
- text={ __(
23
- '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.'
24
- ) }
19
+ <>
20
+ <HelpDetailImage
21
+ source={ require( './images/move-light.png' ) }
22
+ sourceDarkMode={ require( './images/move-dark.png' ) }
25
23
  />
26
- </View>
24
+ <View style={ styles.helpDetailContainer }>
25
+ <HelpDetailBodyText
26
+ 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.'
28
+ ) }
29
+ />
30
+ </View>
31
+ </>
27
32
  );
28
33
  };
29
34
 
@@ -16,16 +16,19 @@ import { HelpDetailBodyText, HelpDetailImage } from './view-sections';
16
16
 
17
17
  const RemoveBlocks = () => {
18
18
  return (
19
- <View style={ styles.helpDetailContainer }>
19
+ <>
20
20
  <HelpDetailImage
21
- source={ require( './images/remove-blocks.png' ) }
21
+ source={ require( './images/options-light.png' ) }
22
+ sourceDarkMode={ require( './images/options-dark.png' ) }
22
23
  />
23
- <HelpDetailBodyText
24
- text={ __(
25
- 'To remove a block, select the block and click the three dots in the bottom right of the block to view the settings. From there, choose the option to remove the block.'
26
- ) }
27
- />
28
- </View>
24
+ <View style={ styles.helpDetailContainer }>
25
+ <HelpDetailBodyText
26
+ text={ __(
27
+ 'To remove a block, select the block and click the three dots in the bottom right of the block to view the settings. From there, choose the option to remove the block.'
28
+ ) }
29
+ />
30
+ </View>
31
+ </>
29
32
  );
30
33
  };
31
34
 
@@ -0,0 +1,6 @@
1
+ @import "./style.scss";
2
+
3
+ .button {
4
+ border-radius: $border-width * 4;
5
+ padding: $grid-unit-10;
6
+ }
@@ -0,0 +1,6 @@
1
+ @import "./style.scss";
2
+
3
+ .button {
4
+ border-radius: $border-width * 8;
5
+ padding: $grid-unit-15;
6
+ }
@@ -1,66 +1,83 @@
1
- .contentContainer {
2
- padding: 0;
1
+ .button {
2
+ margin: $grid-unit-10 $grid-unit-05;
3
+ align-items: center;
4
+ justify-content: center;
5
+ border: $border-width solid $gray-300;
3
6
  }
4
7
 
5
- .sectionContainer {
6
- padding: 0 16px;
8
+ .buttonDark {
9
+ border-color: $gray-700;
7
10
  }
8
11
 
9
- .separator {
10
- background-color: $light-gray-400;
11
- height: 1px;
12
- width: 100%;
12
+ .buttonText {
13
+ font-weight: 600;
14
+ font-size: 16px;
15
+ color: $light-primary;
13
16
  }
14
17
 
15
- .separatorDark {
16
- background-color: $gray-70;
18
+ .buttonTextDark {
19
+ color: $dark-primary;
17
20
  }
18
21
 
19
- .bottomSheetHeader {
20
- flex-direction: row;
21
- align-items: center;
22
- padding-right: $grid-unit-20;
23
- padding-left: $grid-unit-20;
24
- min-height: 44px;
22
+ .navigationContainer {
23
+ overflow: hidden;
25
24
  }
26
25
 
27
- .bottomSheetHeaderTitle {
28
- color: $light-primary;
29
- text-align: center;
30
- font-weight: 600;
31
- font-size: 16px;
32
- flex: 2;
26
+ .container {
27
+ height: 100%;
33
28
  }
34
29
 
35
- .bottomSheetHeaderTitleDark {
36
- color: $dark-primary;
30
+ .contentContainer {
31
+ padding: 0;
37
32
  }
38
33
 
39
34
  .helpDetailContainer {
40
- width: 100%;
41
- padding: 0;
42
- height: 100%;
35
+ padding: 0 16px;
43
36
  }
44
37
 
45
38
  .helpDetailImage {
39
+ background-color: $gray-light;
40
+ margin-bottom: 16px;
46
41
  width: 100%;
42
+ }
43
+
44
+ .helpDetailImageDark {
45
+ background-color: $gray-dark;
46
+ }
47
+
48
+ .helpDetailTitle,
49
+ .helpDetailSectionHeading,
50
+ .helpDetailBody {
47
51
  margin-bottom: 16px;
48
52
  }
49
53
 
50
54
  .helpDetailTitle {
51
- font-weight: 700;
55
+ color: $light-primary;
56
+ font-weight: 600;
52
57
  font-size: 28px;
53
- padding: 16px;
58
+ }
59
+
60
+ .helpDetailTitleDark {
61
+ color: $dark-primary;
54
62
  }
55
63
 
56
64
  .helpDetailSectionHeading {
65
+ color: $light-primary;
57
66
  font-weight: 600;
58
67
  font-size: 16px;
59
- padding: 0 16px 16px 16px;
68
+ margin-top: 24px;
69
+ }
70
+
71
+ .helpDetailSectionHeadingDark {
72
+ color: $dark-secondary;
60
73
  }
61
74
 
62
75
  .helpDetailBody {
63
- width: 100%;
64
- padding: 0 16px 16px 16px;
76
+ color: $light-secondary;
65
77
  font-size: 16px;
78
+ line-height: 24px;
79
+ }
80
+
81
+ .helpDetailBodyDark {
82
+ color: $dark-secondary;
66
83
  }
@@ -0,0 +1,80 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { fireEvent, render, waitForElementToBeRemoved } from 'test/helpers';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import EditorHelp from '../index';
10
+
11
+ it( 'lists help topics', async () => {
12
+ const screen = render( <EditorHelp isVisible /> );
13
+ const helpTopic = await screen.findByText( 'Customize blocks' );
14
+
15
+ expect( helpTopic ).toBeTruthy();
16
+ } );
17
+
18
+ it( 'navigates to help topic detail screen', async () => {
19
+ const screen = render( <EditorHelp isVisible /> );
20
+ const helpTopic = await screen.findByText( 'Customize blocks' );
21
+ fireEvent.press( helpTopic );
22
+
23
+ expect(
24
+ screen.getByText(
25
+ '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.'
26
+ )
27
+ ).toBeTruthy();
28
+ } );
29
+
30
+ it( 'navigates back from help topic detail screen', async () => {
31
+ const screen = render( <EditorHelp isVisible /> );
32
+ const helpTopic = await screen.findByText( 'Customize blocks' );
33
+ fireEvent.press( helpTopic );
34
+
35
+ const backButton = screen.getAllByA11yLabel( 'Go back' );
36
+ fireEvent.press( backButton[ backButton.length - 1 ] );
37
+
38
+ // Currently logs `act` warning due to https://git.io/JYYGE
39
+ await waitForElementToBeRemoved( () =>
40
+ screen.getByText(
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.'
42
+ )
43
+ );
44
+ } );
45
+
46
+ it( 'dismisses when close button is pressed', async () => {
47
+ const closeMock = jest.fn();
48
+ const screen = render( <EditorHelp isVisible close={ closeMock } /> );
49
+ const closeButton = await screen.findByA11yLabel( 'Go back' );
50
+ fireEvent.press( closeButton );
51
+
52
+ expect( closeMock ).toHaveBeenCalled();
53
+ } );
54
+
55
+ it( 'dismisses when parent modal backdrop is pressed', async () => {
56
+ const onCloseMock = jest.fn();
57
+ const screen = render( <EditorHelp isVisible onClose={ onCloseMock } /> );
58
+ const modal = await screen.findByTestId( 'editor-help-modal' );
59
+ fireEvent( modal, 'backdropPress' );
60
+
61
+ expect( onCloseMock ).toHaveBeenCalled();
62
+ } );
63
+
64
+ it( 'dismisses when parent modal backdrop is swiped', async () => {
65
+ const onCloseMock = jest.fn();
66
+ const screen = render( <EditorHelp isVisible onClose={ onCloseMock } /> );
67
+ const modal = await screen.findByTestId( 'editor-help-modal' );
68
+ fireEvent( modal, 'swipeComplete' );
69
+
70
+ expect( onCloseMock ).toHaveBeenCalled();
71
+ } );
72
+
73
+ it( 'dismisses when hardware back button is pressed', async () => {
74
+ const onCloseMock = jest.fn();
75
+ const screen = render( <EditorHelp isVisible onClose={ onCloseMock } /> );
76
+ const modal = await screen.findByTestId( 'editor-help-modal' );
77
+ fireEvent( modal, 'backButtonPress' );
78
+
79
+ expect( onCloseMock ).toHaveBeenCalled();
80
+ } );