@wordpress/editor 11.0.2 → 12.0.3
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.
- package/CHANGELOG.md +7 -0
- package/README.md +1 -1
- package/build/components/autosave-monitor/index.js +5 -0
- package/build/components/autosave-monitor/index.js.map +1 -1
- package/build/components/character-count/index.js +1 -1
- package/build/components/character-count/index.js.map +1 -1
- package/build/components/editor-help/help-get-support-button.native.js +46 -0
- package/build/components/editor-help/help-get-support-button.native.js.map +1 -0
- package/build/components/editor-help/index.native.js +24 -5
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/entities-saved-states/entity-type-list.js +22 -13
- package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build/components/entities-saved-states/index.js +23 -4
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/save-shortcut.js +12 -14
- package/build/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/visual-editor-shortcuts.js +0 -4
- package/build/components/global-keyboard-shortcuts/visual-editor-shortcuts.js.map +1 -1
- package/build/components/post-format/index.js +3 -1
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-locked-modal/index.js +1 -1
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-saved-state/index.js +37 -46
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +154 -211
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-title/index.js +5 -3
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/provider/index.native.js +3 -1
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +32 -5
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/word-count/index.js +1 -1
- package/build/components/word-count/index.js.map +1 -1
- package/build/store/actions.js +0 -25
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +3 -84
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils/notice-builder.js +15 -18
- package/build/store/utils/notice-builder.js.map +1 -1
- package/build/{store/utils → utils}/get-template-part-icon.js +1 -1
- package/build/utils/get-template-part-icon.js.map +1 -0
- package/build/utils/index.js +8 -0
- package/build/utils/index.js.map +1 -1
- package/build-module/components/autosave-monitor/index.js +5 -0
- package/build-module/components/autosave-monitor/index.js.map +1 -1
- package/build-module/components/character-count/index.js +1 -1
- package/build-module/components/character-count/index.js.map +1 -1
- package/build-module/components/editor-help/help-get-support-button.native.js +34 -0
- package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -0
- package/build-module/components/editor-help/index.native.js +22 -6
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-type-list.js +24 -13
- package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +23 -4
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/save-shortcut.js +12 -14
- package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js +0 -4
- package/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js.map +1 -1
- package/build-module/components/post-format/index.js +4 -2
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js +1 -1
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +38 -46
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +156 -214
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-title/index.js +5 -3
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +3 -1
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +31 -5
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/word-count/index.js +1 -1
- package/build-module/components/word-count/index.js.map +1 -1
- package/build-module/store/actions.js +0 -23
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +3 -80
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils/notice-builder.js +15 -18
- package/build-module/store/utils/notice-builder.js.map +1 -1
- package/build-module/{store/utils → utils}/get-template-part-icon.js +2 -2
- package/build-module/utils/get-template-part-icon.js.map +1 -0
- package/build-module/utils/index.js +1 -0
- package/build-module/utils/index.js.map +1 -1
- package/build-style/style-rtl.css +6 -1
- package/build-style/style.css +6 -1
- package/package.json +28 -28
- package/src/components/autosave-monitor/index.js +5 -0
- package/src/components/autosave-monitor/test/index.js +10 -4
- package/src/components/character-count/index.js +3 -2
- package/src/components/editor-help/help-get-support-button.native.js +38 -0
- package/src/components/editor-help/index.native.js +130 -80
- package/src/components/editor-help/style.android.scss +6 -0
- package/src/components/editor-help/style.ios.scss +6 -0
- package/src/components/editor-help/style.scss +25 -0
- package/src/components/editor-help/test/index.native.js +80 -0
- package/src/components/entities-saved-states/entity-type-list.js +29 -10
- package/src/components/entities-saved-states/index.js +38 -8
- package/src/components/global-keyboard-shortcuts/save-shortcut.js +34 -42
- package/src/components/global-keyboard-shortcuts/visual-editor-shortcuts.js +8 -16
- package/src/components/post-format/index.js +6 -2
- package/src/components/post-format/style.scss +1 -0
- package/src/components/post-locked-modal/index.js +1 -1
- package/src/components/post-saved-state/index.js +41 -55
- package/src/components/post-saved-state/style.scss +10 -1
- package/src/components/post-saved-state/test/__snapshots__/index.js.snap +20 -0
- package/src/components/post-saved-state/test/index.js +2 -2
- package/src/components/post-taxonomies/flat-term-selector.js +220 -254
- package/src/components/post-title/index.js +5 -3
- package/src/components/provider/index.native.js +2 -0
- package/src/components/provider/use-block-editor-settings.js +24 -2
- package/src/components/word-count/index.js +3 -2
- package/src/store/actions.js +0 -28
- package/src/store/selectors.js +2 -105
- package/src/store/test/actions.js +4 -2
- package/src/store/utils/notice-builder.js +17 -19
- package/src/store/utils/test/notice-builder.js +1 -1
- package/src/{store/utils → utils}/get-template-part-icon.js +2 -2
- package/src/utils/index.js +1 -0
- package/build/store/utils/get-template-part-icon.js.map +0 -1
- package/build-module/store/utils/get-template-part-icon.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.3",
|
|
4
4
|
"description": "Enhanced block editor for WordPress posts.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -31,34 +31,34 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.13.10",
|
|
34
|
-
"@wordpress/a11y": "^3.2.
|
|
35
|
-
"@wordpress/api-fetch": "^5.2.
|
|
36
|
-
"@wordpress/autop": "^3.2.
|
|
34
|
+
"@wordpress/a11y": "^3.2.3",
|
|
35
|
+
"@wordpress/api-fetch": "^5.2.5",
|
|
36
|
+
"@wordpress/autop": "^3.2.2",
|
|
37
37
|
"@wordpress/blob": "^3.2.1",
|
|
38
|
-
"@wordpress/block-editor": "^
|
|
39
|
-
"@wordpress/blocks": "^11.1.
|
|
40
|
-
"@wordpress/components": "^
|
|
41
|
-
"@wordpress/compose": "^5.0.
|
|
42
|
-
"@wordpress/core-data": "^4.0.
|
|
43
|
-
"@wordpress/data": "^6.1.
|
|
44
|
-
"@wordpress/data-controls": "^2.2.
|
|
45
|
-
"@wordpress/date": "^4.2.
|
|
46
|
-
"@wordpress/deprecated": "^3.2.
|
|
47
|
-
"@wordpress/element": "^4.0.
|
|
48
|
-
"@wordpress/hooks": "^3.2.
|
|
49
|
-
"@wordpress/html-entities": "^3.2.
|
|
50
|
-
"@wordpress/i18n": "^4.2.
|
|
51
|
-
"@wordpress/icons": "^
|
|
38
|
+
"@wordpress/block-editor": "^8.0.1",
|
|
39
|
+
"@wordpress/blocks": "^11.1.3",
|
|
40
|
+
"@wordpress/components": "^19.0.1",
|
|
41
|
+
"@wordpress/compose": "^5.0.5",
|
|
42
|
+
"@wordpress/core-data": "^4.0.5",
|
|
43
|
+
"@wordpress/data": "^6.1.3",
|
|
44
|
+
"@wordpress/data-controls": "^2.2.6",
|
|
45
|
+
"@wordpress/date": "^4.2.2",
|
|
46
|
+
"@wordpress/deprecated": "^3.2.2",
|
|
47
|
+
"@wordpress/element": "^4.0.3",
|
|
48
|
+
"@wordpress/hooks": "^3.2.1",
|
|
49
|
+
"@wordpress/html-entities": "^3.2.2",
|
|
50
|
+
"@wordpress/i18n": "^4.2.3",
|
|
51
|
+
"@wordpress/icons": "^6.1.0",
|
|
52
52
|
"@wordpress/is-shallow-equal": "^4.2.0",
|
|
53
|
-
"@wordpress/keyboard-shortcuts": "^3.0.
|
|
54
|
-
"@wordpress/keycodes": "^3.2.
|
|
55
|
-
"@wordpress/media-utils": "^3.0.
|
|
56
|
-
"@wordpress/notices": "^3.2.
|
|
57
|
-
"@wordpress/reusable-blocks": "^3.0.
|
|
58
|
-
"@wordpress/rich-text": "^5.0.
|
|
59
|
-
"@wordpress/server-side-render": "^3.0.
|
|
60
|
-
"@wordpress/url": "^3.
|
|
61
|
-
"@wordpress/wordcount": "^3.2.
|
|
53
|
+
"@wordpress/keyboard-shortcuts": "^3.0.5",
|
|
54
|
+
"@wordpress/keycodes": "^3.2.3",
|
|
55
|
+
"@wordpress/media-utils": "^3.0.4",
|
|
56
|
+
"@wordpress/notices": "^3.2.6",
|
|
57
|
+
"@wordpress/reusable-blocks": "^3.0.6",
|
|
58
|
+
"@wordpress/rich-text": "^5.0.5",
|
|
59
|
+
"@wordpress/server-side-render": "^3.0.5",
|
|
60
|
+
"@wordpress/url": "^3.3.0",
|
|
61
|
+
"@wordpress/wordcount": "^3.2.2",
|
|
62
62
|
"classnames": "^2.3.1",
|
|
63
63
|
"lodash": "^4.17.21",
|
|
64
64
|
"memize": "^1.1.0",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "f89b63995376fe6efe920d858b48268b510920e1"
|
|
72
72
|
}
|
|
@@ -42,6 +42,11 @@ export class AutosaveMonitor extends Component {
|
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
if ( this.props.interval !== prevProps.interval ) {
|
|
46
|
+
clearTimeout( this.timerId );
|
|
47
|
+
this.setAutosaveTimer();
|
|
48
|
+
}
|
|
49
|
+
|
|
45
50
|
if ( ! this.props.isDirty ) {
|
|
46
51
|
this.needsAutosave = false;
|
|
47
52
|
return;
|
|
@@ -36,6 +36,12 @@ describe( 'AutosaveMonitor', () => {
|
|
|
36
36
|
} );
|
|
37
37
|
|
|
38
38
|
describe( '#componentDidUpdate()', () => {
|
|
39
|
+
it( 'should clear and restart autosave timer when the interval changes', () => {
|
|
40
|
+
wrapper.setProps( { interval: 999 } );
|
|
41
|
+
expect( clearTimeout ).toHaveBeenCalled();
|
|
42
|
+
expect( setAutosaveTimerSpy ).toHaveBeenCalledTimes( 2 );
|
|
43
|
+
} );
|
|
44
|
+
|
|
39
45
|
it( 'should set needsAutosave=true when editReference changes', () => {
|
|
40
46
|
expect( wrapper.instance().needsAutosave ).toBe( false );
|
|
41
47
|
wrapper.setProps( {
|
|
@@ -95,9 +101,9 @@ describe( 'AutosaveMonitor', () => {
|
|
|
95
101
|
isAutosaveable: true,
|
|
96
102
|
interval: 5,
|
|
97
103
|
} );
|
|
98
|
-
expect( setAutosaveTimerSpy ).toHaveBeenCalledTimes( 1 );
|
|
99
|
-
wrapper.instance().autosaveTimerHandler();
|
|
100
104
|
expect( setAutosaveTimerSpy ).toHaveBeenCalledTimes( 2 );
|
|
105
|
+
wrapper.instance().autosaveTimerHandler();
|
|
106
|
+
expect( setAutosaveTimerSpy ).toHaveBeenCalledTimes( 3 );
|
|
101
107
|
expect( setTimeout ).lastCalledWith( expect.any( Function ), 5000 );
|
|
102
108
|
} );
|
|
103
109
|
|
|
@@ -106,9 +112,9 @@ describe( 'AutosaveMonitor', () => {
|
|
|
106
112
|
isAutosaveable: false,
|
|
107
113
|
interval: 5,
|
|
108
114
|
} );
|
|
109
|
-
expect( setAutosaveTimerSpy ).toHaveBeenCalledTimes( 1 );
|
|
110
|
-
wrapper.instance().autosaveTimerHandler();
|
|
111
115
|
expect( setAutosaveTimerSpy ).toHaveBeenCalledTimes( 2 );
|
|
116
|
+
wrapper.instance().autosaveTimerHandler();
|
|
117
|
+
expect( setAutosaveTimerSpy ).toHaveBeenCalledTimes( 3 );
|
|
112
118
|
expect( setTimeout ).lastCalledWith( expect.any( Function ), 1000 );
|
|
113
119
|
} );
|
|
114
120
|
|
|
@@ -10,8 +10,9 @@ import { count as characterCount } from '@wordpress/wordcount';
|
|
|
10
10
|
import { store as editorStore } from '../../store';
|
|
11
11
|
|
|
12
12
|
export default function CharacterCount() {
|
|
13
|
-
const content = useSelect(
|
|
14
|
-
select( editorStore ).getEditedPostAttribute( 'content' )
|
|
13
|
+
const content = useSelect(
|
|
14
|
+
( select ) => select( editorStore ).getEditedPostAttribute( 'content' ),
|
|
15
|
+
[]
|
|
15
16
|
);
|
|
16
17
|
|
|
17
18
|
return characterCount( content, 'characters_including_spaces' );
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Pressable, Text } 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 HelpGetSupportButton = ( { onPress, title } ) => {
|
|
17
|
+
const buttonStyle = usePreferredColorSchemeStyle(
|
|
18
|
+
styles.button,
|
|
19
|
+
styles.buttonDark
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const textStyle = usePreferredColorSchemeStyle(
|
|
23
|
+
styles.buttonText,
|
|
24
|
+
styles.buttonTextDark
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<Pressable
|
|
29
|
+
style={ buttonStyle }
|
|
30
|
+
onPress={ onPress }
|
|
31
|
+
accessibilityRole={ 'button' }
|
|
32
|
+
>
|
|
33
|
+
<Text style={ textStyle }>{ title }</Text>
|
|
34
|
+
</Pressable>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default HelpGetSupportButton;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { kebabCase } from 'lodash';
|
|
5
|
-
import { ScrollView, StyleSheet, View } from 'react-native';
|
|
5
|
+
import { Text, SafeAreaView, ScrollView, StyleSheet, View } from 'react-native';
|
|
6
6
|
import { TransitionPresets } from '@react-navigation/stack';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -23,6 +23,11 @@ import {
|
|
|
23
23
|
} from '@wordpress/icons';
|
|
24
24
|
import { useSelect } from '@wordpress/data';
|
|
25
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';
|
|
26
31
|
|
|
27
32
|
/**
|
|
28
33
|
* Internal dependencies
|
|
@@ -30,6 +35,7 @@ import { store as editorStore } from '@wordpress/editor';
|
|
|
30
35
|
import styles from './style.scss';
|
|
31
36
|
import HelpDetailNavigationScreen from './help-detail-navigation-screen';
|
|
32
37
|
import HelpTopicRow from './help-topic-row';
|
|
38
|
+
import HelpGetSupportButton from './help-get-support-button';
|
|
33
39
|
import IntroToBlocks from './intro-to-blocks';
|
|
34
40
|
import AddBlocks from './add-blocks';
|
|
35
41
|
import MoveBlocks from './move-blocks';
|
|
@@ -61,6 +67,11 @@ function EditorHelpTopics( { close, isVisible, onClose } ) {
|
|
|
61
67
|
postType: select( editorStore ).getEditedPostAttribute( 'type' ),
|
|
62
68
|
} ) );
|
|
63
69
|
|
|
70
|
+
const sectionTitle = usePreferredColorSchemeStyle(
|
|
71
|
+
styles.helpDetailSectionHeading,
|
|
72
|
+
styles.helpDetailSectionHeadingDark
|
|
73
|
+
);
|
|
74
|
+
|
|
64
75
|
const title =
|
|
65
76
|
postType === 'page'
|
|
66
77
|
? __( 'How to edit your page' )
|
|
@@ -73,88 +84,127 @@ function EditorHelpTopics( { close, isVisible, onClose } ) {
|
|
|
73
84
|
hideHeader
|
|
74
85
|
hasNavigation
|
|
75
86
|
contentStyle={ styles.contentContainer }
|
|
87
|
+
testID="editor-help-modal"
|
|
76
88
|
>
|
|
77
|
-
<
|
|
78
|
-
<BottomSheet.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
89
|
+
<SafeAreaView>
|
|
90
|
+
<BottomSheet.NavigationContainer
|
|
91
|
+
animate
|
|
92
|
+
main
|
|
93
|
+
style={ styles.navigationContainer }
|
|
82
94
|
>
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
<BottomSheet.NavBar
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
contentContainerStyle
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
95
|
+
<BottomSheet.NavigationScreen
|
|
96
|
+
isScrollable
|
|
97
|
+
fullScreen
|
|
98
|
+
name="help-topics"
|
|
99
|
+
>
|
|
100
|
+
<View style={ styles.container }>
|
|
101
|
+
<BottomSheet.NavBar>
|
|
102
|
+
<BottomSheet.NavBar.DismissButton
|
|
103
|
+
onPress={ close }
|
|
104
|
+
iosText={ __( 'Close' ) }
|
|
105
|
+
/>
|
|
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>
|
|
132
162
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
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>
|
|
158
208
|
</BottomSheet>
|
|
159
209
|
);
|
|
160
210
|
}
|
|
@@ -1,3 +1,28 @@
|
|
|
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;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.buttonDark {
|
|
9
|
+
border-color: $gray-700;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.buttonText {
|
|
13
|
+
font-weight: 600;
|
|
14
|
+
font-size: 16px;
|
|
15
|
+
color: $light-primary;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.buttonTextDark {
|
|
19
|
+
color: $dark-primary;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.navigationContainer {
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
}
|
|
25
|
+
|
|
1
26
|
.container {
|
|
2
27
|
height: 100%;
|
|
3
28
|
}
|
|
@@ -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
|
+
} );
|
|
@@ -6,9 +6,9 @@ import { some } from 'lodash';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
+
import { __, _n } from '@wordpress/i18n';
|
|
9
10
|
import { useSelect } from '@wordpress/data';
|
|
10
|
-
import { PanelBody } from '@wordpress/components';
|
|
11
|
-
import { page, layout } from '@wordpress/icons';
|
|
11
|
+
import { PanelBody, PanelRow } from '@wordpress/components';
|
|
12
12
|
import { store as coreStore } from '@wordpress/core-data';
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -16,10 +16,25 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
16
16
|
*/
|
|
17
17
|
import EntityRecordItem from './entity-record-item';
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
function getEntityDescription( entity, length ) {
|
|
20
|
+
switch ( entity ) {
|
|
21
|
+
case 'site':
|
|
22
|
+
return _n(
|
|
23
|
+
'This change will affect your whole site.',
|
|
24
|
+
'These changes will affect your whole site.',
|
|
25
|
+
length
|
|
26
|
+
);
|
|
27
|
+
case 'wp_template':
|
|
28
|
+
return _n(
|
|
29
|
+
'This change will affect pages and posts that use this template.',
|
|
30
|
+
'These changes will affect pages and posts that use these templates.',
|
|
31
|
+
length
|
|
32
|
+
);
|
|
33
|
+
case 'page':
|
|
34
|
+
case 'post':
|
|
35
|
+
return __( 'The following content has been modified.' );
|
|
36
|
+
}
|
|
37
|
+
}
|
|
23
38
|
|
|
24
39
|
export default function EntityTypeList( {
|
|
25
40
|
list,
|
|
@@ -33,13 +48,17 @@ export default function EntityTypeList( {
|
|
|
33
48
|
select( coreStore ).getEntity( firstRecord.kind, firstRecord.name ),
|
|
34
49
|
[ firstRecord.kind, firstRecord.name ]
|
|
35
50
|
);
|
|
36
|
-
|
|
37
|
-
// Set icon based on type of entity.
|
|
38
51
|
const { name } = firstRecord;
|
|
39
|
-
const
|
|
52
|
+
const entityLabel =
|
|
53
|
+
name === 'wp_template_part'
|
|
54
|
+
? _n( 'Template Part', 'Template Parts', list.length )
|
|
55
|
+
: entity.label;
|
|
56
|
+
// Set description based on type of entity.
|
|
57
|
+
const description = getEntityDescription( name, list.length );
|
|
40
58
|
|
|
41
59
|
return (
|
|
42
|
-
<PanelBody title={
|
|
60
|
+
<PanelBody title={ entityLabel } initialOpen={ true }>
|
|
61
|
+
{ description && <PanelRow>{ description }</PanelRow> }
|
|
43
62
|
{ list.map( ( record ) => {
|
|
44
63
|
return (
|
|
45
64
|
<EntityRecordItem
|