@wordpress/editor 12.0.0 → 12.0.4
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 +4 -3
- 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/store/utils/notice-builder.js +15 -18
- package/build/store/utils/notice-builder.js.map +1 -1
- package/build/utils/get-template-part-icon.js +1 -1
- package/build/utils/get-template-part-icon.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 +5 -4
- 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/build-module/store/utils/notice-builder.js +15 -18
- package/build-module/store/utils/notice-builder.js.map +1 -1
- package/build-module/utils/get-template-part-icon.js +2 -2
- package/build-module/utils/get-template-part-icon.js.map +1 -1
- package/build-style/style-rtl.css +1 -1
- package/build-style/style.css +1 -1
- package/package.json +19 -19
- 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 -106
- package/src/components/editor-help/style.scss +4 -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/post-saved-state/style.scss +2 -0
- 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
- 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/utils/get-template-part-icon.js +2 -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,SA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R,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAEM,GAAV,KAAiB,EAdpB;AAeNd,MAAAA,kBAAkB,EAAEK,OAAO,CAAE,QAAF,EAAY,OAAZ;AAfrB,KAAP;AAiBA,GA9BY,EA8BV,EA9BU,CALb;AAqCA,QAAM;AAAEU,IAAAA;AAAF,MAAWhC,WAAW,CAAEU,WAAF,CAA5B;AAEA,QAAM;AAAEuB,IAAAA;AAAF,MAAuBjC,WAAW,CAAEG,SAAF,CAAxC;AAEA;AACD;AACA;AACA;AACA;AACA;AACA;;AACC,QAAM+B,gBAAgB,GAAKC,OAAF,IAAe;AACvC,QAAK,CAAElB,kBAAP,EAA4B;AAC3B,aAAOmB,OAAO,CAACC,MAAR,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,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,CAAIiB,MAAF,IAAc;AAC5B,UAAM;AAAEC,MAAAA;AAAF,QAA+BD,MAAM,CAAER,WAAF,CAA3C;AACA,UAAMU,KAAK,GAAGtB,QAAQ,CAACuB,EAAT,KAAgB,KAA9B;AACA,UAAM;AAAEC,MAAAA,OAAF;AAAWC,MAAAA,eAAX;AAA4BC,MAAAA;AAA5B,QAAsDN,MAAM,CACjEf,SADiE,CAAlE;AAIA,UAAMsB,QAAQ,GAAGF,eAAe,EAAhC;AAEA,UAAMG,4BAA4B,GAAGF,qBAAqB,CACzD,iBADyD,CAA1D;AAIA,WAAO;AACNR,MAAAA,oBAAoB,EAAEG,wBAAwB,EADxC;AAENL,MAAAA,cAAc,EAAEM,KAAK,GAClBF,MAAM,CAAEf,SAAF,CAAN,CAAoBwB,gBAApB,CACA,UADA,EAEA,UAFA,EAGA;AAAEC,QAAAA,QAAQ,EAAE,CA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,EAsBlB,iBAtBkB,EAuBlB,cAvBkB,EAwBlB,kBAxBkB,EAyBlB,iBAzBkB,EA0BlB,cA1BkB,EA2BlB,YA3BkB,EA4BlB,OA5BkB,EA6BlB,sBA7BkB,EA8BlB,UA9BkB,EA+BlB,4BA/BkB,EAgClB,QAhCkB,EAiClB,UAjCkB,EAkClB,cAlCkB,EAmClB,kBAnCkB,EAoClB,gBApCkB,EAqClB,wCArCkB,CAAZ,CADA;AAwCPH,IAAAA,WAAW,EAAEM,oBAAoB,GAAGN,WAAH,GAAiB8B,SAxC3C;AAyCPC,IAAAA,4BAA4B,EAAE1B,cAzCvB;AA0CPV,IAAAA,kCAAkC,EAAE,CAAEqC,MAAF,EAAUC,aAAV,KACnCrC,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"]}
|
|
@@ -36,11 +36,12 @@ export function getNotificationArgumentsForSaveSuccess(data) {
|
|
|
36
36
|
const isPublished = includes(publishStatus, previousPost.status);
|
|
37
37
|
const willPublish = includes(publishStatus, post.status);
|
|
38
38
|
let noticeMessage;
|
|
39
|
-
let shouldShowLink = get(postType, ['viewable'], false);
|
|
39
|
+
let shouldShowLink = get(postType, ['viewable'], false); // Always should a notice, which will be spoken for accessibility.
|
|
40
40
|
|
|
41
41
|
if (!isPublished && !willPublish) {
|
|
42
42
|
// If saving a non-published post, don't show notice.
|
|
43
|
-
noticeMessage =
|
|
43
|
+
noticeMessage = __('Saved');
|
|
44
|
+
shouldShowLink = false;
|
|
44
45
|
} else if (isPublished && !willPublish) {
|
|
45
46
|
// If undoing publish status, show specific notice
|
|
46
47
|
noticeMessage = postType.labels.item_reverted_to_draft;
|
|
@@ -58,24 +59,20 @@ export function getNotificationArgumentsForSaveSuccess(data) {
|
|
|
58
59
|
noticeMessage = postType.labels.item_updated;
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return [noticeMessage, {
|
|
72
|
-
id: SAVE_POST_NOTICE_ID,
|
|
73
|
-
type: 'snackbar',
|
|
74
|
-
actions
|
|
75
|
-
}];
|
|
62
|
+
const actions = [];
|
|
63
|
+
|
|
64
|
+
if (shouldShowLink) {
|
|
65
|
+
actions.push({
|
|
66
|
+
label: postType.labels.view_item,
|
|
67
|
+
url: post.link
|
|
68
|
+
});
|
|
76
69
|
}
|
|
77
70
|
|
|
78
|
-
return [
|
|
71
|
+
return [noticeMessage, {
|
|
72
|
+
id: SAVE_POST_NOTICE_ID,
|
|
73
|
+
type: 'snackbar',
|
|
74
|
+
actions
|
|
75
|
+
}];
|
|
79
76
|
}
|
|
80
77
|
/**
|
|
81
78
|
* Builds the fail notification arguments for dispatch.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/store/utils/notice-builder.js"],"names":["__","SAVE_POST_NOTICE_ID","TRASH_POST_NOTICE_ID","get","includes","getNotificationArgumentsForSaveSuccess","data","previousPost","post","postType","options","publishStatus","isPublished","status","willPublish","noticeMessage","shouldShowLink","labels","item_reverted_to_draft","publish","item_published","private","item_published_privately","future","item_scheduled","item_updated","actions","push","label","view_item","url","link","id","type","getNotificationArgumentsForSaveFail","edits","error","code","indexOf","messages","message","test","join","getNotificationArgumentsForTrashFail"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,mBAAT,EAA8BC,oBAA9B,QAA0D,cAA1D;AAEA;AACA;AACA;;AACA,SAASC,GAAT,EAAcC,QAAd,QAA8B,QAA9B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,sCAAT,CAAiDC,IAAjD,EAAwD;AAC9D,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,IAAhB;AAAsBC,IAAAA;AAAtB,MAAmCH,IAAzC,CAD8D,CAE9D;;AACA,MAAKH,GAAG,CAAEG,IAAI,CAACI,OAAP,EAAgB,CAAE,YAAF,CAAhB,CAAR,EAA6C;AAC5C,WAAO,EAAP;AACA;;AAED,QAAMC,aAAa,GAAG,CAAE,SAAF,EAAa,SAAb,EAAwB,QAAxB,CAAtB;AACA,QAAMC,WAAW,GAAGR,QAAQ,CAAEO,aAAF,EAAiBJ,YAAY,CAACM,MAA9B,CAA5B;AACA,QAAMC,WAAW,GAAGV,QAAQ,CAAEO,aAAF,EAAiBH,IAAI,CAACK,MAAtB,CAA5B;AAEA,MAAIE,aAAJ;AACA,MAAIC,cAAc,GAAGb,GAAG,CAAEM,QAAF,EAAY,CAAE,UAAF,CAAZ,EAA4B,KAA5B,CAAxB;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/store/utils/notice-builder.js"],"names":["__","SAVE_POST_NOTICE_ID","TRASH_POST_NOTICE_ID","get","includes","getNotificationArgumentsForSaveSuccess","data","previousPost","post","postType","options","publishStatus","isPublished","status","willPublish","noticeMessage","shouldShowLink","labels","item_reverted_to_draft","publish","item_published","private","item_published_privately","future","item_scheduled","item_updated","actions","push","label","view_item","url","link","id","type","getNotificationArgumentsForSaveFail","edits","error","code","indexOf","messages","message","test","join","getNotificationArgumentsForTrashFail"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,mBAAT,EAA8BC,oBAA9B,QAA0D,cAA1D;AAEA;AACA;AACA;;AACA,SAASC,GAAT,EAAcC,QAAd,QAA8B,QAA9B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,sCAAT,CAAiDC,IAAjD,EAAwD;AAC9D,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,IAAhB;AAAsBC,IAAAA;AAAtB,MAAmCH,IAAzC,CAD8D,CAE9D;;AACA,MAAKH,GAAG,CAAEG,IAAI,CAACI,OAAP,EAAgB,CAAE,YAAF,CAAhB,CAAR,EAA6C;AAC5C,WAAO,EAAP;AACA;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iBqB,KAAK,CAACI,OAAvB,EAAiCE,IAAjC,CAAuC,GAAvC,CAAhB;AACA;;AACD,SAAO,CACN3B,aADM,EAEN;AACCiB,IAAAA,EAAE,EAAE/B;AADL,GAFM,CAAP;AAMA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAAS0C,oCAAT,CAA+CrC,IAA/C,EAAsD;AAC5D,SAAO,CACNA,IAAI,CAAC8B,KAAL,CAAWI,OAAX,IAAsBlC,IAAI,CAAC8B,KAAL,CAAWC,IAAX,KAAoB,eAA1C,GACG/B,IAAI,CAAC8B,KAAL,CAAWI,OADd,GAEGxC,EAAE,CAAE,iBAAF,CAHC,EAIN;AACCgC,IAAAA,EAAE,EAAE9B;AADL,GAJM,CAAP;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { SAVE_POST_NOTICE_ID, TRASH_POST_NOTICE_ID } from '../constants';\n\n/**\n * External dependencies\n */\nimport { get, includes } from 'lodash';\n\n/**\n * Builds the arguments for a success notification dispatch.\n *\n * @param {Object} data Incoming data to build the arguments from.\n *\n * @return {Array} Arguments for dispatch. An empty array signals no\n * notification should be sent.\n */\nexport function getNotificationArgumentsForSaveSuccess( data ) {\n\tconst { previousPost, post, postType } = data;\n\t// Autosaves are neither shown a notice nor redirected.\n\tif ( get( data.options, [ 'isAutosave' ] ) ) {\n\t\treturn [];\n\t}\n\n\tconst publishStatus = [ 'publish', 'private', 'future' ];\n\tconst isPublished = includes( publishStatus, previousPost.status );\n\tconst willPublish = includes( publishStatus, post.status );\n\n\tlet noticeMessage;\n\tlet shouldShowLink = get( postType, [ 'viewable' ], false );\n\n\t// Always should a notice, which will be spoken for accessibility.\n\tif ( ! isPublished && ! willPublish ) {\n\t\t// If saving a non-published post, don't show notice.\n\t\tnoticeMessage = __( 'Saved' );\n\t\tshouldShowLink = false;\n\t} else if ( isPublished && ! willPublish ) {\n\t\t// If undoing publish status, show specific notice\n\t\tnoticeMessage = postType.labels.item_reverted_to_draft;\n\t\tshouldShowLink = false;\n\t} else if ( ! isPublished && willPublish ) {\n\t\t// If publishing or scheduling a post, show the corresponding\n\t\t// publish message\n\t\tnoticeMessage = {\n\t\t\tpublish: postType.labels.item_published,\n\t\t\tprivate: postType.labels.item_published_privately,\n\t\t\tfuture: postType.labels.item_scheduled,\n\t\t}[ post.status ];\n\t} else {\n\t\t// Generic fallback notice\n\t\tnoticeMessage = postType.labels.item_updated;\n\t}\n\n\tconst actions = [];\n\tif ( shouldShowLink ) {\n\t\tactions.push( {\n\t\t\tlabel: postType.labels.view_item,\n\t\t\turl: post.link,\n\t\t} );\n\t}\n\treturn [\n\t\tnoticeMessage,\n\t\t{\n\t\t\tid: SAVE_POST_NOTICE_ID,\n\t\t\ttype: 'snackbar',\n\t\t\tactions,\n\t\t},\n\t];\n}\n\n/**\n * Builds the fail notification arguments for dispatch.\n *\n * @param {Object} data Incoming data to build the arguments with.\n *\n * @return {Array} Arguments for dispatch. An empty array signals no\n * notification should be sent.\n */\nexport function getNotificationArgumentsForSaveFail( data ) {\n\tconst { post, edits, error } = data;\n\tif ( error && 'rest_autosave_no_changes' === error.code ) {\n\t\t// Autosave requested a new autosave, but there were no changes. This shouldn't\n\t\t// result in an error notice for the user.\n\t\treturn [];\n\t}\n\n\tconst publishStatus = [ 'publish', 'private', 'future' ];\n\tconst isPublished = publishStatus.indexOf( post.status ) !== -1;\n\t// If the post was being published, we show the corresponding publish error message\n\t// Unless we publish an \"updating failed\" message\n\tconst messages = {\n\t\tpublish: __( 'Publishing failed.' ),\n\t\tprivate: __( 'Publishing failed.' ),\n\t\tfuture: __( 'Scheduling failed.' ),\n\t};\n\tlet noticeMessage =\n\t\t! isPublished && publishStatus.indexOf( edits.status ) !== -1\n\t\t\t? messages[ edits.status ]\n\t\t\t: __( 'Updating failed.' );\n\n\t// Check if message string contains HTML. Notice text is currently only\n\t// supported as plaintext, and stripping the tags may muddle the meaning.\n\tif ( error.message && ! /<\\/?[^>]*>/.test( error.message ) ) {\n\t\tnoticeMessage = [ noticeMessage, error.message ].join( ' ' );\n\t}\n\treturn [\n\t\tnoticeMessage,\n\t\t{\n\t\t\tid: SAVE_POST_NOTICE_ID,\n\t\t},\n\t];\n}\n\n/**\n * Builds the trash fail notification arguments for dispatch.\n *\n * @param {Object} data\n *\n * @return {Array} Arguments for dispatch.\n */\nexport function getNotificationArgumentsForTrashFail( data ) {\n\treturn [\n\t\tdata.error.message && data.error.code !== 'unknown_error'\n\t\t\t? data.error.message\n\t\t\t: __( 'Trashing failed' ),\n\t\t{\n\t\t\tid: TRASH_POST_NOTICE_ID,\n\t\t},\n\t];\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { header as headerIcon, footer as footerIcon, sidebar as sidebarIcon,
|
|
4
|
+
import { header as headerIcon, footer as footerIcon, sidebar as sidebarIcon, symbolFilled as symbolFilledIcon } from '@wordpress/icons';
|
|
5
5
|
/**
|
|
6
6
|
* Helper function to retrieve the corresponding icon by name.
|
|
7
7
|
*
|
|
@@ -19,6 +19,6 @@ export function getTemplatePartIcon(iconName) {
|
|
|
19
19
|
return sidebarIcon;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
return
|
|
22
|
+
return symbolFilledIcon;
|
|
23
23
|
}
|
|
24
24
|
//# sourceMappingURL=get-template-part-icon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/utils/get-template-part-icon.js"],"names":["header","headerIcon","footer","footerIcon","sidebar","sidebarIcon","
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/utils/get-template-part-icon.js"],"names":["header","headerIcon","footer","footerIcon","sidebar","sidebarIcon","symbolFilled","symbolFilledIcon","getTemplatePartIcon","iconName"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,MAAM,IAAIC,UADX,EAECC,MAAM,IAAIC,UAFX,EAGCC,OAAO,IAAIC,WAHZ,EAICC,YAAY,IAAIC,gBAJjB,QAKO,kBALP;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,mBAAT,CAA8BC,QAA9B,EAAyC;AAC/C,MAAK,aAAaA,QAAlB,EAA6B;AAC5B,WAAOR,UAAP;AACA,GAFD,MAEO,IAAK,aAAaQ,QAAlB,EAA6B;AACnC,WAAON,UAAP;AACA,GAFM,MAEA,IAAK,cAAcM,QAAnB,EAA8B;AACpC,WAAOJ,WAAP;AACA;;AACD,SAAOE,gBAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\theader as headerIcon,\n\tfooter as footerIcon,\n\tsidebar as sidebarIcon,\n\tsymbolFilled as symbolFilledIcon,\n} from '@wordpress/icons';\n/**\n * Helper function to retrieve the corresponding icon by name.\n *\n * @param {string} iconName The name of the icon.\n *\n * @return {Object} The corresponding icon.\n */\nexport function getTemplatePartIcon( iconName ) {\n\tif ( 'header' === iconName ) {\n\t\treturn headerIcon;\n\t} else if ( 'footer' === iconName ) {\n\t\treturn footerIcon;\n\t} else if ( 'sidebar' === iconName ) {\n\t\treturn sidebarIcon;\n\t}\n\treturn symbolFilledIcon;\n}\n"]}
|
|
@@ -635,7 +635,7 @@
|
|
|
635
635
|
overflow: hidden;
|
|
636
636
|
white-space: nowrap;
|
|
637
637
|
}
|
|
638
|
-
.editor-post-saved-state.is-saved[aria-disabled=true], .editor-post-saved-state.is-saved[aria-disabled=true]:hover {
|
|
638
|
+
.editor-post-saved-state.is-saving[aria-disabled=true], .editor-post-saved-state.is-saving[aria-disabled=true]:hover, .editor-post-saved-state.is-saved[aria-disabled=true], .editor-post-saved-state.is-saved[aria-disabled=true]:hover {
|
|
639
639
|
background: transparent;
|
|
640
640
|
color: #757575;
|
|
641
641
|
}
|
package/build-style/style.css
CHANGED
|
@@ -635,7 +635,7 @@
|
|
|
635
635
|
overflow: hidden;
|
|
636
636
|
white-space: nowrap;
|
|
637
637
|
}
|
|
638
|
-
.editor-post-saved-state.is-saved[aria-disabled=true], .editor-post-saved-state.is-saved[aria-disabled=true]:hover {
|
|
638
|
+
.editor-post-saved-state.is-saving[aria-disabled=true], .editor-post-saved-state.is-saving[aria-disabled=true]:hover, .editor-post-saved-state.is-saved[aria-disabled=true], .editor-post-saved-state.is-saved[aria-disabled=true]:hover {
|
|
639
639
|
background: transparent;
|
|
640
640
|
color: #757575;
|
|
641
641
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.4",
|
|
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": "^
|
|
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.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.6",
|
|
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
|
-
"@wordpress/element": "^4.0.
|
|
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.
|
|
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.7",
|
|
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": "68d15d606a5ebcbea3977f39b0e758bcf282b96a"
|
|
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,115 +86,125 @@ function EditorHelpTopics( { close, isVisible, onClose } ) {
|
|
|
86
86
|
contentStyle={ styles.contentContainer }
|
|
87
87
|
testID="editor-help-modal"
|
|
88
88
|
>
|
|
89
|
-
<
|
|
90
|
-
<BottomSheet.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
<SafeAreaView>
|
|
90
|
+
<BottomSheet.NavigationContainer
|
|
91
|
+
animate
|
|
92
|
+
main
|
|
93
|
+
style={ styles.navigationContainer }
|
|
94
94
|
>
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
<BottomSheet.NavBar
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
contentContainerStyle
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
( { label, icon } ) => {
|
|
134
|
-
const labelSlug = kebabCase(
|
|
135
|
-
label
|
|
136
|
-
);
|
|
137
|
-
return (
|
|
138
|
-
<HelpTopicRow
|
|
139
|
-
key={ labelSlug }
|
|
140
|
-
label={ label }
|
|
141
|
-
icon={ icon }
|
|
142
|
-
screenName={
|
|
143
|
-
labelSlug
|
|
144
|
-
}
|
|
145
|
-
/>
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
) }
|
|
149
|
-
{
|
|
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>
|
|
150
133
|
<Text style={ sectionTitle }>
|
|
151
|
-
{ __( '
|
|
134
|
+
{ __( 'The basics' ) }
|
|
152
135
|
</Text>
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
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
|
+
);
|
|
161
154
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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
|
-
|
|
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>
|
|
198
208
|
</BottomSheet>
|
|
199
209
|
);
|
|
200
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
|