@wordpress/editor 12.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.
- package/build/components/autosave-monitor/index.js +5 -0
- package/build/components/autosave-monitor/index.js.map +1 -1
- package/build/components/editor-help/index.native.js +2 -2
- 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/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 +4 -2
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +1 -1
- package/build/components/provider/use-block-editor-settings.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/editor-help/index.native.js +3 -3
- 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/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 +4 -2
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +1 -1
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/package.json +18 -18
- package/src/components/autosave-monitor/index.js +5 -0
- package/src/components/autosave-monitor/test/index.js +10 -4
- package/src/components/editor-help/index.native.js +116 -110
- 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/post-taxonomies/flat-term-selector.js +220 -254
- package/src/components/post-title/index.js +4 -2
- package/src/components/provider/use-block-editor-settings.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"names":["pick","defaultTo","Platform","useMemo","useDispatch","useSelect","store","coreStore","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","__","mediaUpload","editorStore","useBlockEditorSettings","settings","hasTemplate","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","select","canUserUseUnfilteredHTML","isWeb","OS","canUser","getUnstableBase","hasFinishedResolution","siteData","hasFinishedResolvingSiteData","getEntityRecords","per_page","hasResolvedLocalSiteData","baseUrl","url","undo","saveEntityRecord","createPageEntity","options","Promise","reject","message","undefined","__experimentalReusableBlocks","search","searchOptions","__experimentalFetchRichUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,SAAf,QAAgC,QAAhC;AAEA;AACA;AACA;;AACA,SAASC,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SACCC,KAAK,IAAIC,SADV,EAECC,kCAAkC,IAAIC,oBAFvC,EAGCC,0BAA0B,IAAIC,YAH/B,QAIO,sBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,aAA5B;AACA,SAASP,KAAK,IAAIQ,WAAlB,QAAqC,aAArC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,sBAAT,CAAiCC,QAAjC,EAA2CC,WAA3C,EAAyD;AACxD,QAAM;AACLC,IAAAA,cADK;AAELC,IAAAA,oBAFK;AAGLC,IAAAA,oBAHK;AAILC,IAAAA;AAJK,MAKFhB,SAAS,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R,CAAgB;AACtBC,QAAAA,OAAO,EAAE9B,EAAE,CAAE,6CAAF;AADW,OAAhB,CAAP;AAGA;;AACD,WAAOyB,gBAAgB,CAAE,UAAF,EAAc,MAAd,EAAsBE,OAAtB,CAAvB;AACA,GAPD;;AASA,SAAOpC,OAAO,CACb,OAAQ,EACP,GAAGH,IAAI,CAAEgB,QAAF,EAAY,CAClB,8BADkB,EAElB,sCAFkB,EAGlB,6BAHkB,EAIlB,wBAJkB,EAKlB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"names":["pick","defaultTo","Platform","useMemo","useDispatch","useSelect","store","coreStore","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","__","mediaUpload","editorStore","useBlockEditorSettings","settings","hasTemplate","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","select","canUserUseUnfilteredHTML","isWeb","OS","canUser","getUnstableBase","hasFinishedResolution","siteData","hasFinishedResolvingSiteData","getEntityRecords","per_page","hasResolvedLocalSiteData","baseUrl","url","undo","saveEntityRecord","createPageEntity","options","Promise","reject","message","undefined","__experimentalReusableBlocks","search","searchOptions","__experimentalFetchRichUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,SAAf,QAAgC,QAAhC;AAEA;AACA;AACA;;AACA,SAASC,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SACCC,KAAK,IAAIC,SADV,EAECC,kCAAkC,IAAIC,oBAFvC,EAGCC,0BAA0B,IAAIC,YAH/B,QAIO,sBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,aAA5B;AACA,SAASP,KAAK,IAAIQ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CrC,oBAAoB,CAAEoC,MAAF,EAAUC,aAAV,EAAyB9B,QAAzB,CA3Cd;AA4CP+B,IAAAA,8BAA8B,EAAEpC,YA5CzB;AA6CPqC,IAAAA,sCAAsC,EAAE5B,oBA7CjC;AA8CP6B,IAAAA,kBAAkB,EAAEb,IA9Cb;AA+CPc,IAAAA,WAAW,EAAEjC,WA/CN;AAgDPkC,IAAAA,8BAA8B,EAAEb,gBAhDzB;AAiDPc,IAAAA,gCAAgC,EAAE/B;AAjD3B,GAAR,CADa,EAoDb,CACCL,QADD,EAECG,oBAFD,EAGCD,cAHD,EAICE,oBAJD,EAKCgB,IALD,EAMCnB,WAND,EAOCI,kBAPD,CApDa,CAAd;AA8DA;;AAED,eAAeN,sBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { pick, defaultTo } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Platform, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {boolean} hasTemplate Whether template mode is enabled.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, hasTemplate ) {\n\tconst {\n\t\treusableBlocks,\n\t\thasUploadPermissions,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUserUseUnfilteredHTML } = select( editorStore );\n\t\tconst isWeb = Platform.OS === 'web';\n\t\tconst { canUser, getUnstableBase, hasFinishedResolution } = select(\n\t\t\tcoreStore\n\t\t);\n\n\t\tconst siteData = getUnstableBase();\n\n\t\tconst hasFinishedResolvingSiteData = hasFinishedResolution(\n\t\t\t'getUnstableBase'\n\t\t);\n\n\t\treturn {\n\t\t\tcanUseUnfilteredHTML: canUserUseUnfilteredHTML(),\n\t\t\treusableBlocks: isWeb\n\t\t\t\t? select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'wp_block',\n\t\t\t\t\t\t{ per_page: -1 }\n\t\t\t\t )\n\t\t\t\t: [], // Reusable blocks are fetched in the native version of this hook.\n\t\t\thasUploadPermissions: defaultTo(\n\t\t\t\tcanUser( 'create', 'media' ),\n\t\t\t\ttrue\n\t\t\t),\n\t\t\thasResolvedLocalSiteData: hasFinishedResolvingSiteData,\n\t\t\tbaseUrl: siteData?.url || '',\n\t\t\tuserCanCreatePages: canUser( 'create', 'pages' ),\n\t\t};\n\t}, [] );\n\n\tconst { undo } = useDispatch( editorStore );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = ( options ) => {\n\t\tif ( ! userCanCreatePages ) {\n\t\t\treturn Promise.reject( {\n\t\t\t\tmessage: __( 'You do not have permission to create Pages.' ),\n\t\t\t} );\n\t\t}\n\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t};\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...pick( settings, [\n\t\t\t\t'__experimentalBlockDirectory',\n\t\t\t\t'__experimentalBlockPatternCategories',\n\t\t\t\t'__experimentalBlockPatterns',\n\t\t\t\t'__experimentalFeatures',\n\t\t\t\t'__experimentalPreferredStyleVariations',\n\t\t\t\t'__experimentalSetIsInserterOpened',\n\t\t\t\t'__unstableGalleryWithImageBlocks',\n\t\t\t\t'alignWide',\n\t\t\t\t'allowedBlockTypes',\n\t\t\t\t'bodyPlaceholder',\n\t\t\t\t'codeEditingEnabled',\n\t\t\t\t'colors',\n\t\t\t\t'disableCustomColors',\n\t\t\t\t'disableCustomFontSizes',\n\t\t\t\t'disableCustomGradients',\n\t\t\t\t'enableCustomLineHeight',\n\t\t\t\t'enableCustomSpacing',\n\t\t\t\t'enableCustomUnits',\n\t\t\t\t'focusMode',\n\t\t\t\t'fontSizes',\n\t\t\t\t'gradients',\n\t\t\t\t'hasFixedToolbar',\n\t\t\t\t'hasReducedUI',\n\t\t\t\t'imageDefaultSize',\n\t\t\t\t'imageDimensions',\n\t\t\t\t'imageEditing',\n\t\t\t\t'imageSizes',\n\t\t\t\t'isRTL',\n\t\t\t\t'keepCaretInsideBlock',\n\t\t\t\t'maxWidth',\n\t\t\t\t'onUpdateDefaultBlockStyles',\n\t\t\t\t'styles',\n\t\t\t\t'template',\n\t\t\t\t'templateLock',\n\t\t\t\t'titlePlaceholder',\n\t\t\t\t'supportsLayout',\n\t\t\t\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t\t\t] ),\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t__experimentalUndo: undo,\n\t\t\toutlineMode: hasTemplate,\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\thasUploadPermissions,\n\t\t\treusableBlocks,\n\t\t\tcanUseUnfilteredHTML,\n\t\t\tundo,\n\t\t\thasTemplate,\n\t\t\tuserCanCreatePages,\n\t\t]\n\t);\n}\n\nexport default useBlockEditorSettings;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.2",
|
|
4
4
|
"description": "Enhanced block editor for WordPress posts.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -32,32 +32,32 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.13.10",
|
|
34
34
|
"@wordpress/a11y": "^3.2.3",
|
|
35
|
-
"@wordpress/api-fetch": "^5.2.
|
|
35
|
+
"@wordpress/api-fetch": "^5.2.5",
|
|
36
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": "^19.0.
|
|
41
|
-
"@wordpress/compose": "^5.0.
|
|
42
|
-
"@wordpress/core-data": "^4.0.
|
|
43
|
-
"@wordpress/data": "^6.1.
|
|
44
|
-
"@wordpress/data-controls": "^2.2.
|
|
38
|
+
"@wordpress/block-editor": "^8.0.0",
|
|
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
45
|
"@wordpress/date": "^4.2.2",
|
|
46
46
|
"@wordpress/deprecated": "^3.2.2",
|
|
47
47
|
"@wordpress/element": "^4.0.3",
|
|
48
48
|
"@wordpress/hooks": "^3.2.1",
|
|
49
49
|
"@wordpress/html-entities": "^3.2.2",
|
|
50
50
|
"@wordpress/i18n": "^4.2.3",
|
|
51
|
-
"@wordpress/icons": "^6.0
|
|
51
|
+
"@wordpress/icons": "^6.1.0",
|
|
52
52
|
"@wordpress/is-shallow-equal": "^4.2.0",
|
|
53
|
-
"@wordpress/keyboard-shortcuts": "^3.0.
|
|
53
|
+
"@wordpress/keyboard-shortcuts": "^3.0.5",
|
|
54
54
|
"@wordpress/keycodes": "^3.2.3",
|
|
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.
|
|
55
|
+
"@wordpress/media-utils": "^3.0.4",
|
|
56
|
+
"@wordpress/notices": "^3.2.6",
|
|
57
|
+
"@wordpress/reusable-blocks": "^3.0.5",
|
|
58
|
+
"@wordpress/rich-text": "^5.0.5",
|
|
59
|
+
"@wordpress/server-side-render": "^3.0.5",
|
|
60
|
+
"@wordpress/url": "^3.3.0",
|
|
61
61
|
"@wordpress/wordcount": "^3.2.2",
|
|
62
62
|
"classnames": "^2.3.1",
|
|
63
63
|
"lodash": "^4.17.21",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "393c2b5533837fd637e998d23f0124c081a10df0"
|
|
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
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { kebabCase } from 'lodash';
|
|
5
|
-
import { Text, 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
|
/**
|
|
@@ -86,119 +86,125 @@ function EditorHelpTopics( { close, isVisible, onClose } ) {
|
|
|
86
86
|
contentStyle={ styles.contentContainer }
|
|
87
87
|
testID="editor-help-modal"
|
|
88
88
|
>
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
<BottomSheet.NavigationScreen
|
|
95
|
-
isScrollable
|
|
96
|
-
fullScreen
|
|
97
|
-
name="help-topics"
|
|
89
|
+
<SafeAreaView>
|
|
90
|
+
<BottomSheet.NavigationContainer
|
|
91
|
+
animate
|
|
92
|
+
main
|
|
93
|
+
style={ styles.navigationContainer }
|
|
98
94
|
>
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
<BottomSheet.NavBar
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
contentContainerStyle
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
( { label, icon } ) => {
|
|
138
|
-
const labelSlug = kebabCase(
|
|
139
|
-
label
|
|
140
|
-
);
|
|
141
|
-
return (
|
|
142
|
-
<HelpTopicRow
|
|
143
|
-
key={ labelSlug }
|
|
144
|
-
label={ label }
|
|
145
|
-
icon={ icon }
|
|
146
|
-
screenName={
|
|
147
|
-
labelSlug
|
|
148
|
-
}
|
|
149
|
-
/>
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
) }
|
|
153
|
-
{
|
|
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>
|
|
154
133
|
<Text style={ sectionTitle }>
|
|
155
|
-
{ __( '
|
|
134
|
+
{ __( 'The basics' ) }
|
|
156
135
|
</Text>
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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
|
+
);
|
|
165
154
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
'
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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>
|
|
202
208
|
</BottomSheet>
|
|
203
209
|
);
|
|
204
210
|
}
|
|
@@ -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
|
|
@@ -19,7 +19,7 @@ import { close as closeIcon } from '@wordpress/icons';
|
|
|
19
19
|
*/
|
|
20
20
|
import EntityTypeList from './entity-type-list';
|
|
21
21
|
|
|
22
|
-
const
|
|
22
|
+
const TRANSLATED_SITE_PROPERTIES = {
|
|
23
23
|
title: __( 'Title' ),
|
|
24
24
|
description: __( 'Tagline' ),
|
|
25
25
|
site_logo: __( 'Logo' ),
|
|
@@ -27,6 +27,13 @@ const TRANSLATED_SITE_PROTPERTIES = {
|
|
|
27
27
|
page_on_front: __( 'Page on front' ),
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
const PUBLISH_ON_SAVE_ENTITIES = [
|
|
31
|
+
{
|
|
32
|
+
kind: 'postType',
|
|
33
|
+
name: 'wp_navigation',
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
|
|
30
37
|
export default function EntitiesSavedStates( { close } ) {
|
|
31
38
|
const saveButtonRef = useRef();
|
|
32
39
|
const { dirtyEntityRecords } = useSelect( ( select ) => {
|
|
@@ -49,7 +56,7 @@ export default function EntitiesSavedStates( { close } ) {
|
|
|
49
56
|
siteEditsAsEntities.push( {
|
|
50
57
|
kind: 'root',
|
|
51
58
|
name: 'site',
|
|
52
|
-
title:
|
|
59
|
+
title: TRANSLATED_SITE_PROPERTIES[ property ] || property,
|
|
53
60
|
property,
|
|
54
61
|
} );
|
|
55
62
|
}
|
|
@@ -63,14 +70,27 @@ export default function EntitiesSavedStates( { close } ) {
|
|
|
63
70
|
};
|
|
64
71
|
}, [] );
|
|
65
72
|
const {
|
|
73
|
+
editEntityRecord,
|
|
66
74
|
saveEditedEntityRecord,
|
|
67
75
|
__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,
|
|
68
76
|
} = useDispatch( coreStore );
|
|
69
77
|
|
|
70
78
|
// To group entities by type.
|
|
71
|
-
const partitionedSavables =
|
|
72
|
-
|
|
73
|
-
|
|
79
|
+
const partitionedSavables = groupBy( dirtyEntityRecords, 'name' );
|
|
80
|
+
|
|
81
|
+
// Sort entity groups.
|
|
82
|
+
const {
|
|
83
|
+
site: siteSavables,
|
|
84
|
+
wp_template: templateSavables,
|
|
85
|
+
wp_template_part: templatePartSavables,
|
|
86
|
+
...contentSavables
|
|
87
|
+
} = partitionedSavables;
|
|
88
|
+
const sortedPartitionedSavables = [
|
|
89
|
+
siteSavables,
|
|
90
|
+
templateSavables,
|
|
91
|
+
templatePartSavables,
|
|
92
|
+
...Object.values( contentSavables ),
|
|
93
|
+
].filter( Array.isArray );
|
|
74
94
|
|
|
75
95
|
// Unchecked entities to be ignored by save function.
|
|
76
96
|
const [ unselectedEntities, _setUnselectedEntities ] = useState( [] );
|
|
@@ -118,6 +138,16 @@ export default function EntitiesSavedStates( { close } ) {
|
|
|
118
138
|
if ( 'root' === kind && 'site' === name ) {
|
|
119
139
|
siteItemsToSave.push( property );
|
|
120
140
|
} else {
|
|
141
|
+
if (
|
|
142
|
+
PUBLISH_ON_SAVE_ENTITIES.some(
|
|
143
|
+
( typeToPublish ) =>
|
|
144
|
+
typeToPublish.kind === kind &&
|
|
145
|
+
typeToPublish.name === name
|
|
146
|
+
)
|
|
147
|
+
) {
|
|
148
|
+
editEntityRecord( kind, name, key, { status: 'publish' } );
|
|
149
|
+
}
|
|
150
|
+
|
|
121
151
|
saveEditedEntityRecord( kind, name, key );
|
|
122
152
|
}
|
|
123
153
|
} );
|
|
@@ -160,15 +190,15 @@ export default function EntitiesSavedStates( { close } ) {
|
|
|
160
190
|
</div>
|
|
161
191
|
|
|
162
192
|
<div className="entities-saved-states__text-prompt">
|
|
163
|
-
<strong>{ __( '
|
|
193
|
+
<strong>{ __( 'Are you ready to save?' ) }</strong>
|
|
164
194
|
<p>
|
|
165
195
|
{ __(
|
|
166
|
-
'
|
|
196
|
+
'The following changes have been made to your site, templates, and content.'
|
|
167
197
|
) }
|
|
168
198
|
</p>
|
|
169
199
|
</div>
|
|
170
200
|
|
|
171
|
-
{
|
|
201
|
+
{ sortedPartitionedSavables.map( ( list ) => {
|
|
172
202
|
return (
|
|
173
203
|
<EntityTypeList
|
|
174
204
|
key={ list[ 0 ].name }
|