@wordpress/editor 12.8.0 → 12.9.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 (50) hide show
  1. package/CHANGELOG.md +2 -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/post-schedule/index.js +11 -18
  15. package/build/components/post-schedule/index.js.map +1 -1
  16. package/build/store/selectors.js +2 -2
  17. package/build/store/selectors.js.map +1 -1
  18. package/build-module/components/editor-help/help-section-title.native.js +31 -0
  19. package/build-module/components/editor-help/help-section-title.native.js.map +1 -0
  20. package/build-module/components/editor-help/help-topic-row.native.js +3 -2
  21. package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
  22. package/build-module/components/editor-help/icon-move-blocks.native.js +13 -0
  23. package/build-module/components/editor-help/icon-move-blocks.native.js.map +1 -0
  24. package/build-module/components/editor-help/index.native.js +10 -12
  25. package/build-module/components/editor-help/index.native.js.map +1 -1
  26. package/build-module/components/editor-help/move-blocks.native.js +15 -3
  27. package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
  28. package/build-module/components/editor-help/view-sections.native.js +22 -6
  29. package/build-module/components/editor-help/view-sections.native.js.map +1 -1
  30. package/build-module/components/post-schedule/index.js +12 -19
  31. package/build-module/components/post-schedule/index.js.map +1 -1
  32. package/build-module/store/selectors.js +2 -2
  33. package/build-module/store/selectors.js.map +1 -1
  34. package/package.json +29 -29
  35. package/src/components/editor-help/help-section-title.native.js +29 -0
  36. package/src/components/editor-help/help-topic-row.native.js +2 -2
  37. package/src/components/editor-help/icon-move-blocks.native.js +10 -0
  38. package/src/components/editor-help/images/drag-and-drop-dark.png +0 -0
  39. package/src/components/editor-help/images/drag-and-drop-dark@2x.png +0 -0
  40. package/src/components/editor-help/images/drag-and-drop-dark@3x.png +0 -0
  41. package/src/components/editor-help/images/drag-and-drop-light.png +0 -0
  42. package/src/components/editor-help/images/drag-and-drop-light@2x.png +0 -0
  43. package/src/components/editor-help/images/drag-and-drop-light@3x.png +0 -0
  44. package/src/components/editor-help/index.native.js +20 -22
  45. package/src/components/editor-help/move-blocks.native.js +22 -2
  46. package/src/components/editor-help/style.scss +36 -4
  47. package/src/components/editor-help/view-sections.native.js +23 -8
  48. package/src/components/post-schedule/index.js +6 -13
  49. package/src/store/selectors.js +4 -2
  50. package/src/store/test/selectors.js +3 -3
@@ -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' )
@@ -130,15 +120,22 @@ function EditorHelpTopics( { close, isVisible, onClose } ) {
130
120
  } }
131
121
  >
132
122
  <PanelBody>
133
- <Text style={ sectionTitle }>
123
+ <HelpSectionTitle>
134
124
  { __( 'The basics' ) }
135
- </Text>
125
+ </HelpSectionTitle>
136
126
  { /* Print out help topics. */ }
137
127
  { HELP_TOPICS.map(
138
- ( { label, icon } ) => {
128
+ (
129
+ { label, icon },
130
+ index
131
+ ) => {
139
132
  const labelSlug = kebabCase(
140
133
  label
141
134
  );
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
+ };
@@ -3,8 +3,8 @@
3
3
  */
4
4
  import { __experimentalGetSettings } from '@wordpress/date';
5
5
  import { useDispatch, useSelect } from '@wordpress/data';
6
- import { DateTimePicker } from '@wordpress/components';
7
- import { useRef, useState, useMemo } from '@wordpress/element';
6
+ import { __experimentalPublishDateTimePicker as PublishDateTimePicker } from '@wordpress/block-editor';
7
+ import { useState, useMemo } from '@wordpress/element';
8
8
  import { store as coreStore } from '@wordpress/core-data';
9
9
 
10
10
  /**
@@ -21,7 +21,7 @@ function getDayOfTheMonth( date = new Date(), firstDay = true ) {
21
21
  ).toISOString();
22
22
  }
23
23
 
24
- export default function PostSchedule() {
24
+ export default function PostSchedule( { onClose } ) {
25
25
  const { postDate, postType } = useSelect(
26
26
  ( select ) => ( {
27
27
  postDate: select( editorStore ).getEditedPostAttribute( 'date' ),
@@ -61,7 +61,6 @@ export default function PostSchedule() {
61
61
  [ eventsByPostType ]
62
62
  );
63
63
 
64
- const ref = useRef();
65
64
  const settings = __experimentalGetSettings();
66
65
 
67
66
  // To know if the current timezone is a 12 hour time with look for "a" in the time format
@@ -75,20 +74,14 @@ export default function PostSchedule() {
75
74
  .join( '' ) // Reverse the string and test for "a" not followed by a slash.
76
75
  );
77
76
 
78
- function onChange( newDate ) {
79
- onUpdateDate( newDate );
80
- const { ownerDocument } = ref.current;
81
- ownerDocument.activeElement.blur();
82
- }
83
-
84
77
  return (
85
- <DateTimePicker
86
- ref={ ref }
78
+ <PublishDateTimePicker
87
79
  currentDate={ postDate }
88
- onChange={ onChange }
80
+ onChange={ onUpdateDate }
89
81
  is12Hour={ is12HourTime }
90
82
  events={ events }
91
83
  onMonthPreviewed={ setPreviewedMonth }
84
+ onClose={ onClose }
92
85
  />
93
86
  );
94
87
  }
@@ -1606,14 +1606,16 @@ export function __experimentalGetTemplateInfo( state, template ) {
1606
1606
  return {};
1607
1607
  }
1608
1608
 
1609
- const { excerpt, slug, title, area } = template;
1609
+ const { description, slug, title, area } = template;
1610
1610
  const {
1611
1611
  title: defaultTitle,
1612
1612
  description: defaultDescription,
1613
1613
  } = __experimentalGetDefaultTemplateType( state, slug );
1614
1614
 
1615
1615
  const templateTitle = isString( title ) ? title : title?.rendered;
1616
- const templateDescription = isString( excerpt ) ? excerpt : excerpt?.raw;
1616
+ const templateDescription = isString( description )
1617
+ ? description
1618
+ : description?.raw;
1617
1619
  const templateIcon =
1618
1620
  __experimentalGetDefaultTemplatePartAreas( state ).find(
1619
1621
  ( item ) => area === item.area
@@ -2968,7 +2968,7 @@ describe( 'selectors', () => {
2968
2968
  expect(
2969
2969
  __experimentalGetTemplateInfo( state, {
2970
2970
  slug: 'index',
2971
- excerpt: { raw: 'test description' },
2971
+ description: { raw: 'test description' },
2972
2972
  } ).description
2973
2973
  ).toEqual( 'test description' );
2974
2974
  } );
@@ -2996,7 +2996,7 @@ describe( 'selectors', () => {
2996
2996
  expect(
2997
2997
  __experimentalGetTemplateInfo( state, {
2998
2998
  slug: 'index',
2999
- excerpt: { raw: 'test description' },
2999
+ description: { raw: 'test description' },
3000
3000
  } )
3001
3001
  ).toEqual( {
3002
3002
  title: 'Default (Index)',
@@ -3008,7 +3008,7 @@ describe( 'selectors', () => {
3008
3008
  __experimentalGetTemplateInfo( state, {
3009
3009
  slug: 'index',
3010
3010
  title: { rendered: 'test title' },
3011
- excerpt: { raw: 'test description' },
3011
+ description: { raw: 'test description' },
3012
3012
  } )
3013
3013
  ).toEqual( {
3014
3014
  title: 'test title',