@wordpress/editor 12.21.0 → 13.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/build/components/document-outline/check.js +1 -7
- package/build/components/document-outline/check.js.map +1 -1
- package/build/components/editor-help/index.native.js +10 -8
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/editor-notices/index.js +12 -12
- package/build/components/editor-notices/index.js.map +1 -1
- package/build/components/editor-snackbars/index.js +5 -8
- package/build/components/editor-snackbars/index.js.map +1 -1
- package/build/components/page-attributes/parent.js +2 -1
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-author/combobox.js +1 -0
- package/build/components/post-author/combobox.js.map +1 -1
- package/build/components/post-excerpt/index.js +1 -0
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-format/index.js +1 -7
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js +10 -5
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +2 -2
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +2 -8
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-title/index.native.js +2 -4
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-url/index.js +6 -2
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/provider/index.native.js +2 -1
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +10 -9
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.native.js +3 -1
- package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build-module/components/document-outline/check.js +1 -6
- package/build-module/components/document-outline/check.js.map +1 -1
- package/build-module/components/editor-help/index.native.js +11 -9
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/editor-notices/index.js +12 -11
- package/build-module/components/editor-notices/index.js.map +1 -1
- package/build-module/components/editor-snackbars/index.js +5 -7
- package/build-module/components/editor-snackbars/index.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +3 -2
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-author/combobox.js +1 -0
- package/build-module/components/post-author/combobox.js.map +1 -1
- package/build-module/components/post-excerpt/index.js +1 -0
- package/build-module/components/post-excerpt/index.js.map +1 -1
- package/build-module/components/post-format/index.js +1 -6
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +10 -5
- package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js +2 -2
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +3 -3
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +2 -7
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-title/index.native.js +2 -3
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-url/index.js +6 -2
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +4 -2
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +10 -8
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.native.js +2 -1
- package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build-style/style-rtl.css +20 -6
- package/build-style/style.css +20 -6
- package/package.json +31 -31
- package/src/components/document-outline/check.js +1 -7
- package/src/components/editor-help/index.native.js +17 -26
- package/src/components/editor-notices/index.js +6 -13
- package/src/components/editor-snackbars/index.js +3 -8
- package/src/components/page-attributes/parent.js +3 -3
- package/src/components/page-attributes/test/order.js +2 -0
- package/src/components/post-author/combobox.js +1 -0
- package/src/components/post-excerpt/index.js +1 -0
- package/src/components/post-format/index.js +1 -7
- package/src/components/post-preview-button/test/index.js +2 -0
- package/src/components/post-publish-button/test/index.js +2 -0
- package/src/components/post-publish-panel/maybe-category-panel.js +9 -12
- package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -2
- package/src/components/post-saved-state/test/index.js +2 -0
- package/src/components/post-slug/test/index.js +3 -5
- package/src/components/post-taxonomies/flat-term-selector.js +3 -3
- package/src/components/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/src/components/post-taxonomies/index.js +2 -8
- package/src/components/post-taxonomies/test/index.js +1 -1
- package/src/components/post-title/index.native.js +2 -3
- package/src/components/post-url/index.js +6 -2
- package/src/components/provider/index.native.js +2 -0
- package/src/components/provider/use-block-editor-settings.js +56 -50
- package/src/components/provider/use-block-editor-settings.native.js +3 -1
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _lodash = require("lodash");
|
|
9
|
-
|
|
10
8
|
var _element = require("@wordpress/element");
|
|
11
9
|
|
|
12
10
|
var _data = require("@wordpress/data");
|
|
@@ -19,10 +17,6 @@ var _utils = require("../../utils");
|
|
|
19
17
|
|
|
20
18
|
var _store = require("../../store");
|
|
21
19
|
|
|
22
|
-
/**
|
|
23
|
-
* External dependencies
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
20
|
/**
|
|
27
21
|
* WordPress dependencies
|
|
28
22
|
*/
|
|
@@ -30,7 +24,7 @@ var _store = require("../../store");
|
|
|
30
24
|
/**
|
|
31
25
|
* Internal dependencies
|
|
32
26
|
*/
|
|
33
|
-
|
|
27
|
+
const EMPTY_BLOCKS_LIST = [];
|
|
34
28
|
/**
|
|
35
29
|
* React hook used to compute the block editor settings to use for the post editor.
|
|
36
30
|
*
|
|
@@ -39,6 +33,7 @@ var _store = require("../../store");
|
|
|
39
33
|
*
|
|
40
34
|
* @return {Object} Block Editor Settings.
|
|
41
35
|
*/
|
|
36
|
+
|
|
42
37
|
function useBlockEditorSettings(settings, hasTemplate) {
|
|
43
38
|
var _settings$__experimen, _settings$__experimen2;
|
|
44
39
|
|
|
@@ -66,7 +61,7 @@ function useBlockEditorSettings(settings, hasTemplate) {
|
|
|
66
61
|
canUseUnfilteredHTML: canUserUseUnfilteredHTML(),
|
|
67
62
|
reusableBlocks: isWeb ? select(_coreData.store).getEntityRecords('postType', 'wp_block', {
|
|
68
63
|
per_page: -1
|
|
69
|
-
}) :
|
|
64
|
+
}) : EMPTY_BLOCKS_LIST,
|
|
70
65
|
// Reusable blocks are fetched in the native version of this hook.
|
|
71
66
|
hasUploadPermissions: (_canUser = canUser('create', 'media')) !== null && _canUser !== void 0 ? _canUser : true,
|
|
72
67
|
userCanCreatePages: canUser('create', 'pages'),
|
|
@@ -118,12 +113,18 @@ function useBlockEditorSettings(settings, hasTemplate) {
|
|
|
118
113
|
return saveEntityRecord('postType', 'page', options);
|
|
119
114
|
};
|
|
120
115
|
|
|
121
|
-
return (0, _element.useMemo)(() => ({ ...(
|
|
116
|
+
return (0, _element.useMemo)(() => ({ ...Object.fromEntries(Object.entries(settings).filter(_ref2 => {
|
|
117
|
+
let [key] = _ref2;
|
|
118
|
+
return ['__experimentalBlockDirectory', '__experimentalBlockInspectorTabs', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', '__unstableGalleryWithImageBlocks', 'alignWide', 'allowedBlockTypes', 'bodyPlaceholder', 'canLockBlocks', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'focusMode', 'fontSizes', 'gradients', 'generateAnchors', 'hasFixedToolbar', 'isDistractionFree', 'hasInlineToolbar', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'keepCaretInsideBlock', 'maxWidth', 'onUpdateDefaultBlockStyles', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableResolvedAssets'].includes(key);
|
|
119
|
+
})),
|
|
122
120
|
mediaUpload: hasUploadPermissions ? _utils.mediaUpload : undefined,
|
|
123
121
|
__experimentalReusableBlocks: reusableBlocks,
|
|
124
122
|
__experimentalBlockPatterns: blockPatterns,
|
|
125
123
|
__experimentalBlockPatternCategories: blockPatternCategories,
|
|
126
124
|
__experimentalFetchLinkSuggestions: (search, searchOptions) => (0, _coreData.__experimentalFetchLinkSuggestions)(search, searchOptions, settings),
|
|
125
|
+
// TODO: We should find a proper way to consolidate similar cases
|
|
126
|
+
// like reusable blocks, fetch entities, etc.
|
|
127
|
+
__unstableFetchMedia: _coreData.__experimentalFetchMedia,
|
|
127
128
|
__experimentalFetchRichUrlData: _coreData.__experimentalFetchUrlData,
|
|
128
129
|
__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,
|
|
129
130
|
__experimentalUndo: undo,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"names":["useBlockEditorSettings","settings","hasTemplate","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","postType","select","canUserUseUnfilteredHTML","getCurrentPostType","editorStore","isWeb","Platform","OS","canUser","getEntityRecord","coreStore","siteSettings","undefined","getEntityRecords","per_page","page_on_front","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","getBlockPatterns","getBlockPatternCategories","blockPatterns","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","undo","saveEntityRecord","createPageEntity","options","Promise","reject","message","mediaUpload","__experimentalReusableBlocks","__experimentalFetchLinkSuggestions","search","searchOptions","__experimentalFetchRichUrlData","fetchUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAKA;;AAKA;;AACA;;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,sBAAT,CAAiCC,QAAjC,EAA2CC,WAA3C,EAAyD;AAAA;;AACxD,QAAM;AACLC,IAAAA,cADK;AAELC,IAAAA,oBAFK;AAGLC,IAAAA,oBAHK;AAILC,IAAAA,kBAJK;AAKLC,IAAAA,WALK;AAMLC,IAAAA;AANK,MAOF,qBAAaC,MAAF,IAAc;AAAA;;AAC5B,UAAM;AAAEC,MAAAA,wBAAF;AAA4BC,MAAAA;AAA5B,QACLF,MAAM,CAAEG,YAAF,CADP;AAEA,UAAMC,KAAK,GAAGC,kBAASC,EAAT,KAAgB,KAA9B;AACA,UAAM;AAAEC,MAAAA,OAAF;AAAWC,MAAAA;AAAX,QAA+BR,MAAM,CAAES,eAAF,CAA3C;AAEA,UAAMC,YAAY,GAAGH,OAAO,CAAE,MAAF,EAAU,UAAV,CAAP,GAClBC,eAAe,CAAE,MAAF,EAAU,MAAV,CADG,GAElBG,SAFH;AAIA,WAAO;AACNf,MAAAA,oBAAoB,EAAEK,wBAAwB,EADxC;AAENP,MAAAA,cAAc,EAAEU,KAAK,GAClBJ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BAFD,EAGCD,cAHD,EAIC+B,aAJD,EAKCY,sBALD,EAMCzC,oBAND,EAOC0C,IAPD,EAQC7C,WARD,EASCI,kBATD,EAUCC,WAVD,CA7DM,CAAP;AA0EA;;eAEcP,sB","sourcesContent":["/**\n * External dependencies\n */\nimport { pick } 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\tpageOnFront,\n\t\tpostType,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUserUseUnfilteredHTML, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\tconst isWeb = Platform.OS === 'web';\n\t\tconst { canUser, getEntityRecord } = select( coreStore );\n\n\t\tconst siteSettings = canUser( 'read', 'settings' )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\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: canUser( 'create', 'media' ) ?? true,\n\t\t\tuserCanCreatePages: canUser( 'create', 'pages' ),\n\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories:\n\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\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'__experimentalDiscussionSettings',\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'canLockBlocks',\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'disableCustomSpacingSizes',\n\t\t\t\t'disableCustomGradients',\n\t\t\t\t'disableLayoutStyles',\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'generateAnchors',\n\t\t\t\t'hasFixedToolbar',\n\t\t\t\t'isDistractionFree',\n\t\t\t\t'hasInlineToolbar',\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\t'__unstableResolvedAssets',\n\t\t\t] ),\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\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\tpageOnFront,\n\t\t\t__experimentalPreferPatternsOnRoot: hasTemplate,\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\thasUploadPermissions,\n\t\t\treusableBlocks,\n\t\t\tblockPatterns,\n\t\t\tblockPatternCategories,\n\t\t\tcanUseUnfilteredHTML,\n\t\t\tundo,\n\t\t\thasTemplate,\n\t\t\tuserCanCreatePages,\n\t\t\tpageOnFront,\n\t\t]\n\t);\n}\n\nexport default useBlockEditorSettings;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"names":["EMPTY_BLOCKS_LIST","useBlockEditorSettings","settings","hasTemplate","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","postType","select","canUserUseUnfilteredHTML","getCurrentPostType","editorStore","isWeb","Platform","OS","canUser","getEntityRecord","coreStore","siteSettings","undefined","getEntityRecords","per_page","page_on_front","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","getBlockPatterns","getBlockPatternCategories","blockPatterns","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","undo","saveEntityRecord","createPageEntity","options","Promise","reject","message","Object","fromEntries","entries","key","mediaUpload","__experimentalReusableBlocks","__experimentalFetchLinkSuggestions","search","searchOptions","__unstableFetchMedia","fetchMedia","__experimentalFetchRichUrlData","fetchUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAMA;;AAKA;;AACA;;AAjBA;AACA;AACA;;AAWA;AACA;AACA;AAIA,MAAMA,iBAAiB,GAAG,EAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,sBAAT,CAAiCC,QAAjC,EAA2CC,WAA3C,EAAyD;AAAA;;AACxD,QAAM;AACLC,IAAAA,cADK;AAELC,IAAAA,oBAFK;AAGLC,IAAAA,oBAHK;AAILC,IAAAA,kBAJK;AAKLC,IAAAA,WALK;AAMLC,IAAAA;AANK,MAOF,qBAAaC,MAAF,IAAc;AAAA;;AAC5B,UAAM;AAAEC,MAAAA,wBAAF;AAA4BC,MAAAA;AAA5B,QACLF,MAAM,CAAEG,YAAF,CADP;AAEA,UAAMC,KAAK,GAAGC,kBAASC,EAAT,KAAgB,KAA9B;AACA,UAAM;AAAEC,MAAAA,OAAF;AAAWC,MAAAA;AAAX,QAA+BR,MAAM,CAAES,eAAF,CAA3C;AAEA,UAAMC,YAAY,GAAGH,OAAO,CAAE,MAAF,EAAU,UAAV,CAAP,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,sCAAsC,EAAE9D,oBA5DjC;AA6DP+D,IAAAA,kBAAkB,EAAErB,IA7Db;AA8DPsB,IAAAA,WAAW,EAAEnE,WA9DN;AA+DPoE,IAAAA,8BAA8B,EAAErB,gBA/DzB;AAgEPsB,IAAAA,gCAAgC,EAAEjE,kBAhE3B;AAiEPC,IAAAA,WAjEO;AAkEPiE,IAAAA,kCAAkC,EAAEtE;AAlE7B,GAAR,CADM,EAqEN,CACCD,QADD,EAECG,oBAFD,EAGCD,cAHD,EAIC+B,aAJD,EAKCY,sBALD,EAMCzC,oBAND,EAOC0C,IAPD,EAQC7C,WARD,EASCI,kBATD,EAUCC,WAVD,CArEM,CAAP;AAkFA;;eAEcP,sB","sourcesContent":["/**\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\t__experimentalFetchMedia as fetchMedia,\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\nconst EMPTY_BLOCKS_LIST = [];\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\tpageOnFront,\n\t\tpostType,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUserUseUnfilteredHTML, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\tconst isWeb = Platform.OS === 'web';\n\t\tconst { canUser, getEntityRecord } = select( coreStore );\n\n\t\tconst siteSettings = canUser( 'read', 'settings' )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\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: EMPTY_BLOCKS_LIST, // Reusable blocks are fetched in the native version of this hook.\n\t\t\thasUploadPermissions: canUser( 'create', 'media' ) ?? true,\n\t\t\tuserCanCreatePages: canUser( 'create', 'pages' ),\n\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories:\n\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\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...Object.fromEntries(\n\t\t\t\tObject.entries( settings ).filter( ( [ key ] ) =>\n\t\t\t\t\t[\n\t\t\t\t\t\t'__experimentalBlockDirectory',\n\t\t\t\t\t\t'__experimentalBlockInspectorTabs',\n\t\t\t\t\t\t'__experimentalDiscussionSettings',\n\t\t\t\t\t\t'__experimentalFeatures',\n\t\t\t\t\t\t'__experimentalPreferredStyleVariations',\n\t\t\t\t\t\t'__experimentalSetIsInserterOpened',\n\t\t\t\t\t\t'__unstableGalleryWithImageBlocks',\n\t\t\t\t\t\t'alignWide',\n\t\t\t\t\t\t'allowedBlockTypes',\n\t\t\t\t\t\t'bodyPlaceholder',\n\t\t\t\t\t\t'canLockBlocks',\n\t\t\t\t\t\t'codeEditingEnabled',\n\t\t\t\t\t\t'colors',\n\t\t\t\t\t\t'disableCustomColors',\n\t\t\t\t\t\t'disableCustomFontSizes',\n\t\t\t\t\t\t'disableCustomSpacingSizes',\n\t\t\t\t\t\t'disableCustomGradients',\n\t\t\t\t\t\t'disableLayoutStyles',\n\t\t\t\t\t\t'enableCustomLineHeight',\n\t\t\t\t\t\t'enableCustomSpacing',\n\t\t\t\t\t\t'enableCustomUnits',\n\t\t\t\t\t\t'focusMode',\n\t\t\t\t\t\t'fontSizes',\n\t\t\t\t\t\t'gradients',\n\t\t\t\t\t\t'generateAnchors',\n\t\t\t\t\t\t'hasFixedToolbar',\n\t\t\t\t\t\t'isDistractionFree',\n\t\t\t\t\t\t'hasInlineToolbar',\n\t\t\t\t\t\t'imageDefaultSize',\n\t\t\t\t\t\t'imageDimensions',\n\t\t\t\t\t\t'imageEditing',\n\t\t\t\t\t\t'imageSizes',\n\t\t\t\t\t\t'isRTL',\n\t\t\t\t\t\t'keepCaretInsideBlock',\n\t\t\t\t\t\t'maxWidth',\n\t\t\t\t\t\t'onUpdateDefaultBlockStyles',\n\t\t\t\t\t\t'styles',\n\t\t\t\t\t\t'template',\n\t\t\t\t\t\t'templateLock',\n\t\t\t\t\t\t'titlePlaceholder',\n\t\t\t\t\t\t'supportsLayout',\n\t\t\t\t\t\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t\t\t\t\t\t'__unstableResolvedAssets',\n\t\t\t\t\t].includes( key )\n\t\t\t\t)\n\t\t\t),\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\t// TODO: We should find a proper way to consolidate similar cases\n\t\t\t// like reusable blocks, fetch entities, etc.\n\t\t\t__unstableFetchMedia: fetchMedia,\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\tpageOnFront,\n\t\t\t__experimentalPreferPatternsOnRoot: hasTemplate,\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\thasUploadPermissions,\n\t\t\treusableBlocks,\n\t\t\tblockPatterns,\n\t\t\tblockPatternCategories,\n\t\t\tcanUseUnfilteredHTML,\n\t\t\tundo,\n\t\t\thasTemplate,\n\t\t\tuserCanCreatePages,\n\t\t\tpageOnFront,\n\t\t]\n\t);\n}\n\nexport default useBlockEditorSettings;\n"]}
|
|
@@ -24,6 +24,8 @@ var _store = require("../../store");
|
|
|
24
24
|
/**
|
|
25
25
|
* Internal dependencies
|
|
26
26
|
*/
|
|
27
|
+
const EMPTY_BLOCKS_LIST = [];
|
|
28
|
+
|
|
27
29
|
function useNativeBlockEditorSettings(settings, hasTemplate) {
|
|
28
30
|
var _settings$capabilitie;
|
|
29
31
|
|
|
@@ -39,7 +41,7 @@ function useNativeBlockEditorSettings(settings, hasTemplate) {
|
|
|
39
41
|
// Related issue: https://github.com/wordpress-mobile/gutenberg-mobile/issues/2661
|
|
40
42
|
{
|
|
41
43
|
per_page: 100
|
|
42
|
-
}) :
|
|
44
|
+
}) : EMPTY_BLOCKS_LIST,
|
|
43
45
|
isTitleSelected: select(_store.store).isPostTitleSelected()
|
|
44
46
|
};
|
|
45
47
|
}, [supportReusableBlock]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.native.js"],"names":["useNativeBlockEditorSettings","settings","hasTemplate","capabilities","editorSettings","supportReusableBlock","reusableBlock","reusableBlocks","isTitleSelected","select","coreStore","getEntityRecords","per_page","editorStore","isPostTitleSelected","__experimentalReusableBlocks","__experimentalShouldInsertAtTheTop"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;;AAKA;AACA;AACA;AAIA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.native.js"],"names":["EMPTY_BLOCKS_LIST","useNativeBlockEditorSettings","settings","hasTemplate","capabilities","editorSettings","supportReusableBlock","reusableBlock","reusableBlocks","isTitleSelected","select","coreStore","getEntityRecords","per_page","editorStore","isPostTitleSelected","__experimentalReusableBlocks","__experimentalShouldInsertAtTheTop"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;;AAKA;AACA;AACA;AAIA,MAAMA,iBAAiB,GAAG,EAA1B;;AAEA,SAASC,4BAAT,CAAuCC,QAAvC,EAAiDC,WAAjD,EAA+D;AAAA;;AAC9D,QAAMC,YAAY,4BAAGF,QAAQ,CAACE,YAAZ,yEAA4B,EAA9C;AACA,QAAMC,cAAc,GAAG,qCAAwBH,QAAxB,EAAkCC,WAAlC,CAAvB;AAEA,QAAMG,oBAAoB,GAAGF,YAAY,CAACG,aAAb,KAA+B,IAA5D;AACA,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MAAsC,qBACzCC,MAAF,IAAc;AACb,WAAO;AACNF,MAAAA,cAAc,EAAEF,oBAAoB,GACjCI,MAAM,CAAEC,eAAF,CAAN,CAAoBC,gBAApB,CACA,UADA,EAEA,UAFA,EAGA;AACA;AACA;AAAEC,QAAAA,QAAQ,EAAE;AAAZ,OALA,CADiC,GAQjCb,iBATG;AAUNS,MAAAA,eAAe,EAAEC,MAAM,CAAEI,YAAF,CAAN,CAAsBC,mBAAtB;AAVX,KAAP;AAYA,GAd0C,EAe3C,CAAET,oBAAF,CAf2C,CAA5C;AAkBA,SAAO,sBACN,OAAQ,EACP,GAAGD,cADI;AAEPW,IAAAA,4BAA4B,EAAER,cAFvB;AAGPS,IAAAA,kCAAkC,EAAER;AAH7B,GAAR,CADM,EAMN,CAAEJ,cAAF,EAAkBG,cAAlB,EAAkCC,eAAlC,CANM,CAAP;AAQA;;eAEcR,4B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport useBlockEditorSettings from './use-block-editor-settings.js';\nimport { store as editorStore } from '../../store';\n\nconst EMPTY_BLOCKS_LIST = [];\n\nfunction useNativeBlockEditorSettings( settings, hasTemplate ) {\n\tconst capabilities = settings.capabilities ?? {};\n\tconst editorSettings = useBlockEditorSettings( settings, hasTemplate );\n\n\tconst supportReusableBlock = capabilities.reusableBlock === true;\n\tconst { reusableBlocks, isTitleSelected } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\treusableBlocks: supportReusableBlock\n\t\t\t\t\t? select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t'wp_block',\n\t\t\t\t\t\t\t// Unbounded queries are not supported on native so as a workaround, we set per_page with the maximum value that native version can handle.\n\t\t\t\t\t\t\t// Related issue: https://github.com/wordpress-mobile/gutenberg-mobile/issues/2661\n\t\t\t\t\t\t\t{ per_page: 100 }\n\t\t\t\t\t )\n\t\t\t\t\t: EMPTY_BLOCKS_LIST,\n\t\t\t\tisTitleSelected: select( editorStore ).isPostTitleSelected(),\n\t\t\t};\n\t\t},\n\t\t[ supportReusableBlock ]\n\t);\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...editorSettings,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalShouldInsertAtTheTop: isTitleSelected,\n\t\t} ),\n\t\t[ editorSettings, reusableBlocks, isTitleSelected ]\n\t);\n}\n\nexport default useNativeBlockEditorSettings;\n"]}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { filter } from 'lodash';
|
|
5
1
|
/**
|
|
6
2
|
* WordPress dependencies
|
|
7
3
|
*/
|
|
8
|
-
|
|
9
4
|
import { withSelect } from '@wordpress/data';
|
|
10
5
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
11
6
|
|
|
@@ -14,7 +9,7 @@ function DocumentOutlineCheck(_ref) {
|
|
|
14
9
|
blocks,
|
|
15
10
|
children
|
|
16
11
|
} = _ref;
|
|
17
|
-
const headings = filter(
|
|
12
|
+
const headings = blocks.filter(block => block.name === 'core/heading');
|
|
18
13
|
|
|
19
14
|
if (headings.length < 1) {
|
|
20
15
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/document-outline/check.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/document-outline/check.js"],"names":["withSelect","store","blockEditorStore","DocumentOutlineCheck","blocks","children","headings","filter","block","name","length","select","getBlocks"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,iBAA3B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;;AAEA,SAASC,oBAAT,OAAsD;AAAA,MAAvB;AAAEC,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAAuB;AACrD,QAAMC,QAAQ,GAAGF,MAAM,CAACG,MAAP,CACdC,KAAF,IAAaA,KAAK,CAACC,IAAN,KAAe,cADZ,CAAjB;;AAIA,MAAKH,QAAQ,CAACI,MAAT,GAAkB,CAAvB,EAA2B;AAC1B,WAAO,IAAP;AACA;;AAED,SAAOL,QAAP;AACA;;AAED,eAAeL,UAAU,CAAIW,MAAF,KAAgB;AAC1CP,EAAAA,MAAM,EAAEO,MAAM,CAAET,gBAAF,CAAN,CAA2BU,SAA3B;AADkC,CAAhB,CAAF,CAAV,CAERT,oBAFQ,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction DocumentOutlineCheck( { blocks, children } ) {\n\tconst headings = blocks.filter(\n\t\t( block ) => block.name === 'core/heading'\n\t);\n\n\tif ( headings.length < 1 ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default withSelect( ( select ) => ( {\n\tblocks: select( blockEditorStore ).getBlocks(),\n} ) )( DocumentOutlineCheck );\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { createElement } from "@wordpress/element";
|
|
2
|
+
import { createElement, Fragment } from "@wordpress/element";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* External dependencies
|
|
@@ -58,7 +58,8 @@ function EditorHelpTopics(_ref) {
|
|
|
58
58
|
let {
|
|
59
59
|
close,
|
|
60
60
|
isVisible,
|
|
61
|
-
onClose
|
|
61
|
+
onClose,
|
|
62
|
+
showSupport
|
|
62
63
|
} = _ref;
|
|
63
64
|
const {
|
|
64
65
|
postType
|
|
@@ -66,6 +67,13 @@ function EditorHelpTopics(_ref) {
|
|
|
66
67
|
postType: select(editorStore).getEditedPostAttribute('type')
|
|
67
68
|
}));
|
|
68
69
|
const title = postType === 'page' ? __('How to edit your page') : __('How to edit your post');
|
|
70
|
+
const supportSection = createElement(Fragment, null, createElement(HelpSectionTitle, null, __('Get support')), createElement(HelpGetSupportButton, {
|
|
71
|
+
title: __('Contact support'),
|
|
72
|
+
onPress: requestContactCustomerSupport
|
|
73
|
+
}), createElement(HelpGetSupportButton, {
|
|
74
|
+
title: __('More support options'),
|
|
75
|
+
onPress: requestGotoCustomerSupportOptions
|
|
76
|
+
}));
|
|
69
77
|
return createElement(BottomSheet, {
|
|
70
78
|
isVisible: isVisible,
|
|
71
79
|
onClose: onClose,
|
|
@@ -116,13 +124,7 @@ function EditorHelpTopics(_ref) {
|
|
|
116
124
|
screenName: labelSlug,
|
|
117
125
|
isLastItem: isLastItem
|
|
118
126
|
});
|
|
119
|
-
}),
|
|
120
|
-
title: __('Contact support'),
|
|
121
|
-
onPress: requestContactCustomerSupport
|
|
122
|
-
}), createElement(HelpGetSupportButton, {
|
|
123
|
-
title: __('More support options'),
|
|
124
|
-
onPress: requestGotoCustomerSupportOptions
|
|
125
|
-
})));
|
|
127
|
+
}), showSupport && supportSection));
|
|
126
128
|
}))), HELP_TOPICS.map(_ref4 => {
|
|
127
129
|
let {
|
|
128
130
|
view,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/editor-help/index.native.js"],"names":["kebabCase","SafeAreaView","ScrollView","StyleSheet","View","TransitionPresets","BottomSheet","BottomSheetConsumer","PanelBody","__","helpFilled","plusCircleFilled","trash","cog","useSelect","store","editorStore","requestContactCustomerSupport","requestGotoCustomerSupportOptions","styles","HelpDetailNavigationScreen","HelpTopicRow","HelpGetSupportButton","IntroToBlocks","AddBlocks","MoveBlocks","RemoveBlocks","CustomizeBlocks","moveBlocksIcon","HelpSectionTitle","HELP_TOPICS","label","icon","view","EditorHelpTopics","close","isVisible","onClose","postType","select","getEditedPostAttribute","title","contentContainer","navigationContainer","container","listProps","contentContainerStyle","flatten","paddingBottom","Math","max","safeAreaBottomInset","marginTop","map","index","labelSlug","isLastItem","length","gestureEnabled","DefaultTransition"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AACA,SAASC,YAAT,EAAuBC,UAAvB,EAAmCC,UAAnC,EAA+CC,IAA/C,QAA2D,cAA3D;AACA,SAASC,iBAAT,QAAkC,yBAAlC;AAEA;AACA;AACA;;AACA,SACCC,WADD,EAECC,mBAFD,EAGCC,SAHD,QAIO,uBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,EAAqBC,gBAArB,EAAuCC,KAAvC,EAA8CC,GAA9C,QAAy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AAA,QAArB;AAAEpB,MAAAA,IAAF;AAAQF,MAAAA;AAAR,KAAqB;AACzC,UAAMwB,SAAS,GAAGvD,SAAS,CAAE+B,KAAF,CAA3B;AACA,WACC,cAAC,0BAAD;AACC,MAAA,GAAG,EAAGwB,SADP;AAEC,MAAA,IAAI,EAAGA,SAFR;AAGC,MAAA,OAAO,EAAGtB,IAHX;AAIC,MAAA,KAAK,EAAGF,KAJT;AAKC,MAAA,OAAO,EAAG;AACT2B,QAAAA,cAAc,EAAE,KADP;AAET,WAAGrD,iBAAiB,CAACsD;AAFZ;AALX,MADD;AAYA,GAdC,CA7GH,CADD,CARD,CADD;AA0IA;;AAED,eAAezB,gBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\nimport { SafeAreaView, ScrollView, StyleSheet, View } from 'react-native';\nimport { TransitionPresets } from '@react-navigation/stack';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBottomSheet,\n\tBottomSheetConsumer,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { helpFilled, plusCircleFilled, trash, cog } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport {\n\trequestContactCustomerSupport,\n\trequestGotoCustomerSupportOptions,\n} from '@wordpress/react-native-bridge';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport HelpDetailNavigationScreen from './help-detail-navigation-screen';\nimport HelpTopicRow from './help-topic-row';\nimport HelpGetSupportButton from './help-get-support-button';\nimport IntroToBlocks from './intro-to-blocks';\nimport AddBlocks from './add-blocks';\nimport MoveBlocks from './move-blocks';\nimport RemoveBlocks from './remove-blocks';\nimport CustomizeBlocks from './customize-blocks';\nimport moveBlocksIcon from './icon-move-blocks';\nimport HelpSectionTitle from './help-section-title';\n\nconst HELP_TOPICS = [\n\t{\n\t\tlabel: __( 'What is a block?' ),\n\t\ticon: helpFilled,\n\t\tview: <IntroToBlocks />,\n\t},\n\t{\n\t\tlabel: __( 'Add blocks' ),\n\t\ticon: plusCircleFilled,\n\t\tview: <AddBlocks />,\n\t},\n\t{ label: __( 'Move blocks' ), icon: moveBlocksIcon, view: <MoveBlocks /> },\n\t{ label: __( 'Remove blocks' ), icon: trash, view: <RemoveBlocks /> },\n\t{\n\t\tlabel: __( 'Customize blocks' ),\n\t\ticon: cog,\n\t\tview: <CustomizeBlocks />,\n\t},\n];\n\nfunction EditorHelpTopics( { close, isVisible, onClose } ) {\n\tconst { postType } = useSelect( ( select ) => ( {\n\t\tpostType: select( editorStore ).getEditedPostAttribute( 'type' ),\n\t} ) );\n\n\tconst title =\n\t\tpostType === 'page'\n\t\t\t? __( 'How to edit your page' )\n\t\t\t: __( 'How to edit your post' );\n\n\treturn (\n\t\t<BottomSheet\n\t\t\tisVisible={ isVisible }\n\t\t\tonClose={ onClose }\n\t\t\thideHeader\n\t\t\thasNavigation\n\t\t\tcontentStyle={ styles.contentContainer }\n\t\t\ttestID=\"editor-help-modal\"\n\t\t>\n\t\t\t<SafeAreaView>\n\t\t\t\t<BottomSheet.NavigationContainer\n\t\t\t\t\tanimate\n\t\t\t\t\tmain\n\t\t\t\t\tstyle={ styles.navigationContainer }\n\t\t\t\t>\n\t\t\t\t\t<BottomSheet.NavigationScreen\n\t\t\t\t\t\tisScrollable\n\t\t\t\t\t\tfullScreen\n\t\t\t\t\t\tname=\"help-topics\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<View style={ styles.container }>\n\t\t\t\t\t\t\t<BottomSheet.NavBar>\n\t\t\t\t\t\t\t\t<BottomSheet.NavBar.DismissButton\n\t\t\t\t\t\t\t\t\tonPress={ close }\n\t\t\t\t\t\t\t\t\tiosText={ __( 'Close' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<BottomSheet.NavBar.Heading>\n\t\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t\t</BottomSheet.NavBar.Heading>\n\t\t\t\t\t\t\t</BottomSheet.NavBar>\n\t\t\t\t\t\t\t<BottomSheetConsumer>\n\t\t\t\t\t\t\t\t{ ( { listProps } ) => {\n\t\t\t\t\t\t\t\t\tconst contentContainerStyle =\n\t\t\t\t\t\t\t\t\t\tStyleSheet.flatten(\n\t\t\t\t\t\t\t\t\t\t\tlistProps.contentContainerStyle\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<ScrollView\n\t\t\t\t\t\t\t\t\t\t\t{ ...listProps }\n\t\t\t\t\t\t\t\t\t\t\tcontentContainerStyle={ {\n\t\t\t\t\t\t\t\t\t\t\t\t...contentContainerStyle,\n\t\t\t\t\t\t\t\t\t\t\t\tpaddingBottom: Math.max(\n\t\t\t\t\t\t\t\t\t\t\t\t\tlistProps.safeAreaBottomInset,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontentContainerStyle.paddingBottom\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t\t\t\t\t * Remove margin set via `hideHeader`. Combining a header\n\t\t\t\t\t\t\t\t\t\t\t\t * and navigation in this bottom sheet is at odds with the\n\t\t\t\t\t\t\t\t\t\t\t\t * current `BottomSheet` implementation.\n\t\t\t\t\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\t\t\t\t\tmarginTop: 0,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<PanelBody>\n\t\t\t\t\t\t\t\t\t\t\t\t<HelpSectionTitle>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'The basics' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</HelpSectionTitle>\n\t\t\t\t\t\t\t\t\t\t\t\t{ /* Print out help topics. */ }\n\t\t\t\t\t\t\t\t\t\t\t\t{ HELP_TOPICS.map(\n\t\t\t\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ label, icon },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst labelSlug =\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkebabCase( label );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst isLastItem =\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tHELP_TOPICS.length -\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<HelpTopicRow\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabelSlug\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tscreenName={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabelSlug\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisLastItem={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisLastItem\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t<HelpSectionTitle>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'Get support' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</HelpSectionTitle>\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t<HelpGetSupportButton\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttitle={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Contact support'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonPress={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trequestContactCustomerSupport\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t<HelpGetSupportButton\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttitle={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'More support options'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonPress={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trequestGotoCustomerSupportOptions\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t</PanelBody>\n\t\t\t\t\t\t\t\t\t\t</ScrollView>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t</BottomSheetConsumer>\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</BottomSheet.NavigationScreen>\n\t\t\t\t\t{ /* Print out help detail screens. */ }\n\t\t\t\t\t{ HELP_TOPICS.map( ( { view, label } ) => {\n\t\t\t\t\t\tconst labelSlug = kebabCase( label );\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<HelpDetailNavigationScreen\n\t\t\t\t\t\t\t\tkey={ labelSlug }\n\t\t\t\t\t\t\t\tname={ labelSlug }\n\t\t\t\t\t\t\t\tcontent={ view }\n\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\toptions={ {\n\t\t\t\t\t\t\t\t\tgestureEnabled: false,\n\t\t\t\t\t\t\t\t\t...TransitionPresets.DefaultTransition,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</BottomSheet.NavigationContainer>\n\t\t\t</SafeAreaView>\n\t\t</BottomSheet>\n\t);\n}\n\nexport default EditorHelpTopics;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/editor-help/index.native.js"],"names":["kebabCase","SafeAreaView","ScrollView","StyleSheet","View","TransitionPresets","BottomSheet","BottomSheetConsumer","PanelBody","__","helpFilled","plusCircleFilled","trash","cog","useSelect","store","editorStore","requestContactCustomerSupport","requestGotoCustomerSupportOptions","styles","HelpDetailNavigationScreen","HelpTopicRow","HelpGetSupportButton","IntroToBlocks","AddBlocks","MoveBlocks","RemoveBlocks","CustomizeBlocks","moveBlocksIcon","HelpSectionTitle","HELP_TOPICS","label","icon","view","EditorHelpTopics","close","isVisible","onClose","showSupport","postType","select","getEditedPostAttribute","title","supportSection","contentContainer","navigationContainer","container","listProps","contentContainerStyle","flatten","paddingBottom","Math","max","safeAreaBottomInset","marginTop","map","index","labelSlug","isLastItem","length","gestureEnabled","DefaultTransition"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AACA,SAASC,YAAT,EAAuBC,UAAvB,EAAmCC,UAAnC,EAA+CC,IAA/C,QAA2D,cAA3D;AACA,SAASC,iBAAT,QAAkC,yBAAlC;AAEA;AACA;AACA;;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K,EAAG1B,KAJT;AAKC,QAAA,IAAI,EAAGC,IALR;AAMC,QAAA,UAAU,EACTyB,SAPF;AASC,QAAA,UAAU,EACTC;AAVF,QADD;AAeA,KA1BA,CALH,EAiCGpB,WAAW,IACZK,cAlCF,CAhBD,CADD;AAuDA,GA7DF,CAVD,CALD,CALD,EAsFGb,WAAW,CAACyB,GAAZ,CAAiB,SAAuB;AAAA,QAArB;AAAEtB,MAAAA,IAAF;AAAQF,MAAAA;AAAR,KAAqB;AACzC,UAAM0B,SAAS,GAAGzD,SAAS,CAAE+B,KAAF,CAA3B;AACA,WACC,cAAC,0BAAD;AACC,MAAA,GAAG,EAAG0B,SADP;AAEC,MAAA,IAAI,EAAGA,SAFR;AAGC,MAAA,OAAO,EAAGxB,IAHX;AAIC,MAAA,KAAK,EAAGF,KAJT;AAKC,MAAA,OAAO,EAAG;AACT6B,QAAAA,cAAc,EAAE,KADP;AAET,WAAGvD,iBAAiB,CAACwD;AAFZ;AALX,MADD;AAYA,GAdC,CAtFH,CADD,CARD,CADD;AAmHA;;AAED,eAAe3B,gBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\nimport { SafeAreaView, ScrollView, StyleSheet, View } from 'react-native';\nimport { TransitionPresets } from '@react-navigation/stack';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBottomSheet,\n\tBottomSheetConsumer,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { helpFilled, plusCircleFilled, trash, cog } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport {\n\trequestContactCustomerSupport,\n\trequestGotoCustomerSupportOptions,\n} from '@wordpress/react-native-bridge';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport HelpDetailNavigationScreen from './help-detail-navigation-screen';\nimport HelpTopicRow from './help-topic-row';\nimport HelpGetSupportButton from './help-get-support-button';\nimport IntroToBlocks from './intro-to-blocks';\nimport AddBlocks from './add-blocks';\nimport MoveBlocks from './move-blocks';\nimport RemoveBlocks from './remove-blocks';\nimport CustomizeBlocks from './customize-blocks';\nimport moveBlocksIcon from './icon-move-blocks';\nimport HelpSectionTitle from './help-section-title';\n\nconst HELP_TOPICS = [\n\t{\n\t\tlabel: __( 'What is a block?' ),\n\t\ticon: helpFilled,\n\t\tview: <IntroToBlocks />,\n\t},\n\t{\n\t\tlabel: __( 'Add blocks' ),\n\t\ticon: plusCircleFilled,\n\t\tview: <AddBlocks />,\n\t},\n\t{ label: __( 'Move blocks' ), icon: moveBlocksIcon, view: <MoveBlocks /> },\n\t{ label: __( 'Remove blocks' ), icon: trash, view: <RemoveBlocks /> },\n\t{\n\t\tlabel: __( 'Customize blocks' ),\n\t\ticon: cog,\n\t\tview: <CustomizeBlocks />,\n\t},\n];\n\nfunction EditorHelpTopics( { close, isVisible, onClose, showSupport } ) {\n\tconst { postType } = useSelect( ( select ) => ( {\n\t\tpostType: select( editorStore ).getEditedPostAttribute( 'type' ),\n\t} ) );\n\n\tconst title =\n\t\tpostType === 'page'\n\t\t\t? __( 'How to edit your page' )\n\t\t\t: __( 'How to edit your post' );\n\n\tconst supportSection = (\n\t\t<>\n\t\t\t<HelpSectionTitle>{ __( 'Get support' ) }</HelpSectionTitle>\n\t\t\t<HelpGetSupportButton\n\t\t\t\ttitle={ __( 'Contact support' ) }\n\t\t\t\tonPress={ requestContactCustomerSupport }\n\t\t\t/>\n\t\t\t<HelpGetSupportButton\n\t\t\t\ttitle={ __( 'More support options' ) }\n\t\t\t\tonPress={ requestGotoCustomerSupportOptions }\n\t\t\t/>\n\t\t</>\n\t);\n\n\treturn (\n\t\t<BottomSheet\n\t\t\tisVisible={ isVisible }\n\t\t\tonClose={ onClose }\n\t\t\thideHeader\n\t\t\thasNavigation\n\t\t\tcontentStyle={ styles.contentContainer }\n\t\t\ttestID=\"editor-help-modal\"\n\t\t>\n\t\t\t<SafeAreaView>\n\t\t\t\t<BottomSheet.NavigationContainer\n\t\t\t\t\tanimate\n\t\t\t\t\tmain\n\t\t\t\t\tstyle={ styles.navigationContainer }\n\t\t\t\t>\n\t\t\t\t\t<BottomSheet.NavigationScreen\n\t\t\t\t\t\tisScrollable\n\t\t\t\t\t\tfullScreen\n\t\t\t\t\t\tname=\"help-topics\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<View style={ styles.container }>\n\t\t\t\t\t\t\t<BottomSheet.NavBar>\n\t\t\t\t\t\t\t\t<BottomSheet.NavBar.DismissButton\n\t\t\t\t\t\t\t\t\tonPress={ close }\n\t\t\t\t\t\t\t\t\tiosText={ __( 'Close' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<BottomSheet.NavBar.Heading>\n\t\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t\t</BottomSheet.NavBar.Heading>\n\t\t\t\t\t\t\t</BottomSheet.NavBar>\n\t\t\t\t\t\t\t<BottomSheetConsumer>\n\t\t\t\t\t\t\t\t{ ( { listProps } ) => {\n\t\t\t\t\t\t\t\t\tconst contentContainerStyle =\n\t\t\t\t\t\t\t\t\t\tStyleSheet.flatten(\n\t\t\t\t\t\t\t\t\t\t\tlistProps.contentContainerStyle\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<ScrollView\n\t\t\t\t\t\t\t\t\t\t\t{ ...listProps }\n\t\t\t\t\t\t\t\t\t\t\tcontentContainerStyle={ {\n\t\t\t\t\t\t\t\t\t\t\t\t...contentContainerStyle,\n\t\t\t\t\t\t\t\t\t\t\t\tpaddingBottom: Math.max(\n\t\t\t\t\t\t\t\t\t\t\t\t\tlistProps.safeAreaBottomInset,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontentContainerStyle.paddingBottom\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t\t\t\t\t * Remove margin set via `hideHeader`. Combining a header\n\t\t\t\t\t\t\t\t\t\t\t\t * and navigation in this bottom sheet is at odds with the\n\t\t\t\t\t\t\t\t\t\t\t\t * current `BottomSheet` implementation.\n\t\t\t\t\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\t\t\t\t\tmarginTop: 0,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<PanelBody>\n\t\t\t\t\t\t\t\t\t\t\t\t<HelpSectionTitle>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'The basics' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</HelpSectionTitle>\n\t\t\t\t\t\t\t\t\t\t\t\t{ /* Print out help topics. */ }\n\t\t\t\t\t\t\t\t\t\t\t\t{ HELP_TOPICS.map(\n\t\t\t\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ label, icon },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst labelSlug =\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkebabCase( label );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tconst isLastItem =\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tHELP_TOPICS.length -\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<HelpTopicRow\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabelSlug\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tscreenName={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabelSlug\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisLastItem={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisLastItem\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t{ showSupport &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tsupportSection }\n\t\t\t\t\t\t\t\t\t\t\t</PanelBody>\n\t\t\t\t\t\t\t\t\t\t</ScrollView>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t</BottomSheetConsumer>\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</BottomSheet.NavigationScreen>\n\t\t\t\t\t{ /* Print out help detail screens. */ }\n\t\t\t\t\t{ HELP_TOPICS.map( ( { view, label } ) => {\n\t\t\t\t\t\tconst labelSlug = kebabCase( label );\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<HelpDetailNavigationScreen\n\t\t\t\t\t\t\t\tkey={ labelSlug }\n\t\t\t\t\t\t\t\tname={ labelSlug }\n\t\t\t\t\t\t\t\tcontent={ view }\n\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\toptions={ {\n\t\t\t\t\t\t\t\t\tgestureEnabled: false,\n\t\t\t\t\t\t\t\t\t...TransitionPresets.DefaultTransition,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</BottomSheet.NavigationContainer>\n\t\t\t</SafeAreaView>\n\t\t</BottomSheet>\n\t);\n}\n\nexport default EditorHelpTopics;\n"]}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { createElement, Fragment } from "@wordpress/element";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* External dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { filter } from 'lodash';
|
|
7
3
|
/**
|
|
8
4
|
* WordPress dependencies
|
|
9
5
|
*/
|
|
10
|
-
|
|
11
6
|
import { NoticeList } from '@wordpress/components';
|
|
12
7
|
import { withSelect, withDispatch } from '@wordpress/data';
|
|
13
8
|
import { compose } from '@wordpress/compose';
|
|
@@ -22,13 +17,19 @@ export function EditorNotices(_ref) {
|
|
|
22
17
|
notices,
|
|
23
18
|
onRemove
|
|
24
19
|
} = _ref;
|
|
25
|
-
const dismissibleNotices = filter(
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
const dismissibleNotices = notices.filter(_ref2 => {
|
|
21
|
+
let {
|
|
22
|
+
isDismissible,
|
|
23
|
+
type
|
|
24
|
+
} = _ref2;
|
|
25
|
+
return isDismissible && type === 'default';
|
|
28
26
|
});
|
|
29
|
-
const nonDismissibleNotices = filter(
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
const nonDismissibleNotices = notices.filter(_ref3 => {
|
|
28
|
+
let {
|
|
29
|
+
isDismissible,
|
|
30
|
+
type
|
|
31
|
+
} = _ref3;
|
|
32
|
+
return !isDismissible && type === 'default';
|
|
32
33
|
});
|
|
33
34
|
return createElement(Fragment, null, createElement(NoticeList, {
|
|
34
35
|
notices: nonDismissibleNotices,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/editor-notices/index.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/editor-notices/index.js"],"names":["NoticeList","withSelect","withDispatch","compose","store","noticesStore","TemplateValidationNotice","EditorNotices","notices","onRemove","dismissibleNotices","filter","isDismissible","type","nonDismissibleNotices","select","getNotices","dispatch","removeNotice"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,uBAA3B;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,OAAOC,wBAAP,MAAqC,+BAArC;AAEA,OAAO,SAASC,aAAT,OAAgD;AAAA,MAAxB;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,GAAwB;AACtD,QAAMC,kBAAkB,GAAGF,OAAO,CAACG,MAAR,CAC1B;AAAA,QAAE;AAAEC,MAAAA,aAAF;AAAiBC,MAAAA;AAAjB,KAAF;AAAA,WAA+BD,aAAa,IAAIC,IAAI,KAAK,SAAzD;AAAA,GAD0B,CAA3B;AAGA,QAAMC,qBAAqB,GAAGN,OAAO,CAACG,MAAR,CAC7B;AAAA,QAAE;AAAEC,MAAAA,aAAF;AAAiBC,MAAAA;AAAjB,KAAF;AAAA,WAA+B,CAAED,aAAF,IAAmBC,IAAI,KAAK,SAA3D;AAAA,GAD6B,CAA9B;AAIA,SACC,8BACC,cAAC,UAAD;AACC,IAAA,OAAO,EAAGC,qBADX;AAEC,IAAA,SAAS,EAAC;AAFX,IADD,EAKC,cAAC,UAAD;AACC,IAAA,OAAO,EAAGJ,kBADX;AAEC,IAAA,SAAS,EAAC,wCAFX;AAGC,IAAA,QAAQ,EAAGD;AAHZ,KAKC,cAAC,wBAAD,OALD,CALD,CADD;AAeA;AAED,eAAeN,OAAO,CAAE,CACvBF,UAAU,CAAIc,MAAF,KAAgB;AAC3BP,EAAAA,OAAO,EAAEO,MAAM,CAAEV,YAAF,CAAN,CAAuBW,UAAvB;AADkB,CAAhB,CAAF,CADa,EAIvBd,YAAY,CAAIe,QAAF,KAAkB;AAC/BR,EAAAA,QAAQ,EAAEQ,QAAQ,CAAEZ,YAAF,CAAR,CAAyBa;AADJ,CAAlB,CAAF,CAJW,CAAF,CAAP,CAOVX,aAPU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { NoticeList } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport TemplateValidationNotice from '../template-validation-notice';\n\nexport function EditorNotices( { notices, onRemove } ) {\n\tconst dismissibleNotices = notices.filter(\n\t\t( { isDismissible, type } ) => isDismissible && type === 'default'\n\t);\n\tconst nonDismissibleNotices = notices.filter(\n\t\t( { isDismissible, type } ) => ! isDismissible && type === 'default'\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<NoticeList\n\t\t\t\tnotices={ nonDismissibleNotices }\n\t\t\t\tclassName=\"components-editor-notices__pinned\"\n\t\t\t/>\n\t\t\t<NoticeList\n\t\t\t\tnotices={ dismissibleNotices }\n\t\t\t\tclassName=\"components-editor-notices__dismissible\"\n\t\t\t\tonRemove={ onRemove }\n\t\t\t>\n\t\t\t\t<TemplateValidationNotice />\n\t\t\t</NoticeList>\n\t\t</>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => ( {\n\t\tnotices: select( noticesStore ).getNotices(),\n\t} ) ),\n\twithDispatch( ( dispatch ) => ( {\n\t\tonRemove: dispatch( noticesStore ).removeNotice,\n\t} ) ),\n] )( EditorNotices );\n"]}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* External dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { filter } from 'lodash';
|
|
7
3
|
/**
|
|
8
4
|
* WordPress dependencies
|
|
9
5
|
*/
|
|
10
|
-
|
|
11
6
|
import { SnackbarList } from '@wordpress/components';
|
|
12
7
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
13
8
|
import { store as noticesStore } from '@wordpress/notices';
|
|
@@ -16,8 +11,11 @@ export default function EditorSnackbars() {
|
|
|
16
11
|
const {
|
|
17
12
|
removeNotice
|
|
18
13
|
} = useDispatch(noticesStore);
|
|
19
|
-
const snackbarNotices = filter(
|
|
20
|
-
|
|
14
|
+
const snackbarNotices = notices.filter(_ref => {
|
|
15
|
+
let {
|
|
16
|
+
type
|
|
17
|
+
} = _ref;
|
|
18
|
+
return type === 'snackbar';
|
|
21
19
|
});
|
|
22
20
|
return createElement(SnackbarList, {
|
|
23
21
|
notices: snackbarNotices,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/editor-snackbars/index.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/editor-snackbars/index.js"],"names":["SnackbarList","useSelect","useDispatch","store","noticesStore","EditorSnackbars","notices","select","getNotices","removeNotice","snackbarNotices","filter","type"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,YAAT,QAA6B,uBAA7B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AAEA,eAAe,SAASC,eAAT,GAA2B;AACzC,QAAMC,OAAO,GAAGL,SAAS,CACtBM,MAAF,IAAcA,MAAM,CAAEH,YAAF,CAAN,CAAuBI,UAAvB,EADU,EAExB,EAFwB,CAAzB;AAIA,QAAM;AAAEC,IAAAA;AAAF,MAAmBP,WAAW,CAAEE,YAAF,CAApC;AACA,QAAMM,eAAe,GAAGJ,OAAO,CAACK,MAAR,CACvB;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WAAgBA,IAAI,KAAK,UAAzB;AAAA,GADuB,CAAxB;AAIA,SACC,cAAC,YAAD;AACC,IAAA,OAAO,EAAGF,eADX;AAEC,IAAA,SAAS,EAAC,qCAFX;AAGC,IAAA,QAAQ,EAAGD;AAHZ,IADD;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SnackbarList } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function EditorSnackbars() {\n\tconst notices = useSelect(\n\t\t( select ) => select( noticesStore ).getNotices(),\n\t\t[]\n\t);\n\tconst { removeNotice } = useDispatch( noticesStore );\n\tconst snackbarNotices = notices.filter(\n\t\t( { type } ) => type === 'snackbar'\n\t);\n\n\treturn (\n\t\t<SnackbarList\n\t\t\tnotices={ snackbarNotices }\n\t\t\tclassName=\"components-editor-notices__snackbar\"\n\t\t\tonRemove={ removeNotice }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import { createElement } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* External dependencies
|
|
5
5
|
*/
|
|
6
|
-
import { get, unescape as unescapeString
|
|
6
|
+
import { get, unescape as unescapeString } from 'lodash';
|
|
7
7
|
import removeAccents from 'remove-accents';
|
|
8
8
|
/**
|
|
9
9
|
* WordPress dependencies
|
|
@@ -121,7 +121,7 @@ export function PageAttributesParent() {
|
|
|
121
121
|
|
|
122
122
|
const opts = getOptionsFromTree(tree); // Ensure the current parent is in the options list.
|
|
123
123
|
|
|
124
|
-
const optsHasParent = find(
|
|
124
|
+
const optsHasParent = opts.find(item => item.value === parentPostId);
|
|
125
125
|
|
|
126
126
|
if (parentPost && !optsHasParent) {
|
|
127
127
|
opts.unshift({
|
|
@@ -160,6 +160,7 @@ export function PageAttributesParent() {
|
|
|
160
160
|
};
|
|
161
161
|
|
|
162
162
|
return createElement(ComboboxControl, {
|
|
163
|
+
__nextHasNoMarginBottom: true,
|
|
163
164
|
className: "editor-page-attributes__parent",
|
|
164
165
|
label: parentPageLabel,
|
|
165
166
|
value: parentPostId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/page-attributes/parent.js"],"names":["get","unescape","unescapeString","find","removeAccents","__","ComboboxControl","debounce","useState","useMemo","useSelect","useDispatch","decodeEntities","store","coreStore","buildTermsTree","editorStore","getTitle","post","title","rendered","id","getItemPriority","name","searchValue","normalizedName","toLowerCase","normalizedSearch","startsWith","length","Infinity","PageAttributesParent","editPost","fieldValue","setFieldValue","parentPost","parentPostId","items","postType","select","getPostType","getEntityRecords","getEntityRecord","getCurrentPostId","getEditedPostAttribute","postTypeSlug","pageId","pType","postId","isHierarchical","query","per_page","exclude","parent_exclude","orderby","order","_fields","search","parentPageLabel","pageItems","parentOptions","getOptionsFromTree","tree","level","mappedNodes","map","treeNode","value","label","repeat","rawName","children","sortedNodes","sort","a","b","priorityA","priorityB","flat","item","parent","opts","optsHasParent","unshift","handleKeydown","inputValue","handleChange","selectedPostId"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,QAAQ,IAAIC,cAA1B,EAA0CC,IAA1C,QAAsD,QAAtD;AACA,OAAOC,aAAP,MAA0B,gBAA1B;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASC,cAAT,QAA+B,mBAA/B;AACA,SAASF,KAAK,IAAIG,WAAlB,QAAqC,aAArC;;AAEA,SAASC,QAAT,CAAmBC,IAAnB,EAA0B;AAAA;;AACzB,SAAOA,IAAI,SAAJ,IAAAA,IAAI,WAAJ,mBAAAA,IAAI,CAAEC,KAAN,oDAAaC,QAAb,GACJR,cAAc,CAAEM,IAAI,CAACC,KAAL,CAAWC,QAAb,CADV,GAEH,IAAIF,IAAI,CAACG,EAAI,KAAKhB,EAAE,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AAU,IAAI,CAAE+C,aAArB,EAAqC;AACpCD,MAAAA,IAAI,CAACE,OAAL,CAAc;AACbhB,QAAAA,KAAK,EAAE/B,YADM;AAEbgC,QAAAA,KAAK,EAAEnD,QAAQ,CAAEkB,UAAF;AAFF,OAAd;AAIA;;AACD,WAAO8C,IAAP;AACA,GA9C4B,EA8C1B,CAAEtB,SAAF,EAAa1B,UAAb,CA9C0B,CAA7B;;AAgDA,MAAK,CAAEgB,cAAF,IAAoB,CAAES,eAA3B,EAA6C;AAC5C,WAAO,IAAP;AACA;AACD;AACD;AACA;AACA;AACA;;;AACC,QAAM0B,aAAa,GAAKC,UAAF,IAAkB;AACvCnD,IAAAA,aAAa,CAAEmD,UAAF,CAAb;AACA,GAFD;AAIA;AACD;AACA;AACA;AACA;;;AACC,QAAMC,YAAY,GAAKC,cAAF,IAAsB;AAC1CvD,IAAAA,QAAQ,CAAE;AAAEgD,MAAAA,MAAM,EAAEO;AAAV,KAAF,CAAR;AACA,GAFD;;AAIA,SACC,cAAC,eAAD;AACC,IAAA,SAAS,EAAC,gCADX;AAEC,IAAA,KAAK,EAAG7B,eAFT;AAGC,IAAA,KAAK,EAAGtB,YAHT;AAIC,IAAA,OAAO,EAAGwB,aAJX;AAKC,IAAA,mBAAmB,EAAGrD,QAAQ,CAAE6E,aAAF,EAAiB,GAAjB,CAL/B;AAMC,IAAA,QAAQ,EAAGE;AANZ,IADD;AAUA;AAED,eAAevD,oBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { get, unescape as unescapeString, find } from 'lodash';\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ComboboxControl } from '@wordpress/components';\nimport { debounce } from '@wordpress/compose';\nimport { useState, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { buildTermsTree } from '../../utils/terms';\nimport { store as editorStore } from '../../store';\n\nfunction getTitle( post ) {\n\treturn post?.title?.rendered\n\t\t? decodeEntities( post.title.rendered )\n\t\t: `#${ post.id } (${ __( 'no title' ) })`;\n}\n\nexport const getItemPriority = ( name, searchValue ) => {\n\tconst normalizedName = removeAccents( name || '' ).toLowerCase();\n\tconst normalizedSearch = removeAccents( searchValue || '' ).toLowerCase();\n\tif ( normalizedName === normalizedSearch ) {\n\t\treturn 0;\n\t}\n\n\tif ( normalizedName.startsWith( normalizedSearch ) ) {\n\t\treturn normalizedName.length;\n\t}\n\n\treturn Infinity;\n};\n\nexport function PageAttributesParent() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ fieldValue, setFieldValue ] = useState( false );\n\tconst { parentPost, parentPostId, items, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType, getEntityRecords, getEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getCurrentPostId, getEditedPostAttribute } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst postTypeSlug = getEditedPostAttribute( 'type' );\n\t\t\tconst pageId = getEditedPostAttribute( 'parent' );\n\t\t\tconst pType = getPostType( postTypeSlug );\n\t\t\tconst postId = getCurrentPostId();\n\t\t\tconst isHierarchical = get( pType, [ 'hierarchical' ], false );\n\t\t\tconst query = {\n\t\t\t\tper_page: 100,\n\t\t\t\texclude: postId,\n\t\t\t\tparent_exclude: postId,\n\t\t\t\torderby: 'menu_order',\n\t\t\t\torder: 'asc',\n\t\t\t\t_fields: 'id,title,parent',\n\t\t\t};\n\n\t\t\t// Perform a search when the field is changed.\n\t\t\tif ( !! fieldValue ) {\n\t\t\t\tquery.search = fieldValue;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tparentPostId: pageId,\n\t\t\t\tparentPost: pageId\n\t\t\t\t\t? getEntityRecord( 'postType', postTypeSlug, pageId )\n\t\t\t\t\t: null,\n\t\t\t\titems: isHierarchical\n\t\t\t\t\t? getEntityRecords( 'postType', postTypeSlug, query )\n\t\t\t\t\t: [],\n\t\t\t\tpostType: pType,\n\t\t\t};\n\t\t},\n\t\t[ fieldValue ]\n\t);\n\n\tconst isHierarchical = get( postType, [ 'hierarchical' ], false );\n\tconst parentPageLabel = get( postType, [ 'labels', 'parent_item_colon' ] );\n\tconst pageItems = items || [];\n\n\tconst parentOptions = useMemo( () => {\n\t\tconst getOptionsFromTree = ( tree, level = 0 ) => {\n\t\t\tconst mappedNodes = tree.map( ( treeNode ) => [\n\t\t\t\t{\n\t\t\t\t\tvalue: treeNode.id,\n\t\t\t\t\tlabel:\n\t\t\t\t\t\t'— '.repeat( level ) + unescapeString( treeNode.name ),\n\t\t\t\t\trawName: treeNode.name,\n\t\t\t\t},\n\t\t\t\t...getOptionsFromTree( treeNode.children || [], level + 1 ),\n\t\t\t] );\n\n\t\t\tconst sortedNodes = mappedNodes.sort( ( [ a ], [ b ] ) => {\n\t\t\t\tconst priorityA = getItemPriority( a.rawName, fieldValue );\n\t\t\t\tconst priorityB = getItemPriority( b.rawName, fieldValue );\n\t\t\t\treturn priorityA >= priorityB ? 1 : -1;\n\t\t\t} );\n\n\t\t\treturn sortedNodes.flat();\n\t\t};\n\n\t\tlet tree = pageItems.map( ( item ) => ( {\n\t\t\tid: item.id,\n\t\t\tparent: item.parent,\n\t\t\tname: getTitle( item ),\n\t\t} ) );\n\n\t\t// Only build a hierarchical tree when not searching.\n\t\tif ( ! fieldValue ) {\n\t\t\ttree = buildTermsTree( tree );\n\t\t}\n\n\t\tconst opts = getOptionsFromTree( tree );\n\n\t\t// Ensure the current parent is in the options list.\n\t\tconst optsHasParent = find(\n\t\t\topts,\n\t\t\t( item ) => item.value === parentPostId\n\t\t);\n\t\tif ( parentPost && ! optsHasParent ) {\n\t\t\topts.unshift( {\n\t\t\t\tvalue: parentPostId,\n\t\t\t\tlabel: getTitle( parentPost ),\n\t\t\t} );\n\t\t}\n\t\treturn opts;\n\t}, [ pageItems, fieldValue ] );\n\n\tif ( ! isHierarchical || ! parentPageLabel ) {\n\t\treturn null;\n\t}\n\t/**\n\t * Handle user input.\n\t *\n\t * @param {string} inputValue The current value of the input field.\n\t */\n\tconst handleKeydown = ( inputValue ) => {\n\t\tsetFieldValue( inputValue );\n\t};\n\n\t/**\n\t * Handle author selection.\n\t *\n\t * @param {Object} selectedPostId The selected Author.\n\t */\n\tconst handleChange = ( selectedPostId ) => {\n\t\teditPost( { parent: selectedPostId } );\n\t};\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\tclassName=\"editor-page-attributes__parent\"\n\t\t\tlabel={ parentPageLabel }\n\t\t\tvalue={ parentPostId }\n\t\t\toptions={ parentOptions }\n\t\t\tonFilterValueChange={ debounce( handleKeydown, 300 ) }\n\t\t\tonChange={ handleChange }\n\t\t/>\n\t);\n}\n\nexport default PageAttributesParent;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/page-attributes/parent.js"],"names":["get","unescape","unescapeString","removeAccents","__","ComboboxControl","debounce","useState","useMemo","useSelect","useDispatch","decodeEntities","store","coreStore","buildTermsTree","editorStore","getTitle","post","title","rendered","id","getItemPriority","name","searchValue","normalizedName","toLowerCase","normalizedSearch","startsWith","length","Infinity","PageAttributesParent","editPost","fieldValue","setFieldValue","parentPost","parentPostId","items","postType","select","getPostType","getEntityRecords","getEntityRecord","getCurrentPostId","getEditedPostAttribute","postTypeSlug","pageId","pType","postId","isHierarchical","query","per_page","exclude","parent_exclude","orderby","order","_fields","search","parentPageLabel","pageItems","parentOptions","getOptionsFromTree","tree","level","mappedNodes","map","treeNode","value","label","repeat","rawName","children","sortedNodes","sort","a","b","priorityA","priorityB","flat","item","parent","opts","optsHasParent","find","unshift","handleKeydown","inputValue","handleChange","selectedPostId"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,QAAQ,IAAIC,cAA1B,QAAgD,QAAhD;AACA,OAAOC,aAAP,MAA0B,gBAA1B;AAEA;AACA;AACA;;AACA,SAASC,EAA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AAA,uBAAuB,MADxB;AAEC,IAAA,SAAS,EAAC,gCAFX;AAGC,IAAA,KAAK,EAAG9B,eAHT;AAIC,IAAA,KAAK,EAAGtB,YAJT;AAKC,IAAA,OAAO,EAAGwB,aALX;AAMC,IAAA,mBAAmB,EAAGrD,QAAQ,CAAE8E,aAAF,EAAiB,GAAjB,CAN/B;AAOC,IAAA,QAAQ,EAAGE;AAPZ,IADD;AAWA;AAED,eAAexD,oBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { get, unescape as unescapeString } from 'lodash';\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ComboboxControl } from '@wordpress/components';\nimport { debounce } from '@wordpress/compose';\nimport { useState, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { buildTermsTree } from '../../utils/terms';\nimport { store as editorStore } from '../../store';\n\nfunction getTitle( post ) {\n\treturn post?.title?.rendered\n\t\t? decodeEntities( post.title.rendered )\n\t\t: `#${ post.id } (${ __( 'no title' ) })`;\n}\n\nexport const getItemPriority = ( name, searchValue ) => {\n\tconst normalizedName = removeAccents( name || '' ).toLowerCase();\n\tconst normalizedSearch = removeAccents( searchValue || '' ).toLowerCase();\n\tif ( normalizedName === normalizedSearch ) {\n\t\treturn 0;\n\t}\n\n\tif ( normalizedName.startsWith( normalizedSearch ) ) {\n\t\treturn normalizedName.length;\n\t}\n\n\treturn Infinity;\n};\n\nexport function PageAttributesParent() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ fieldValue, setFieldValue ] = useState( false );\n\tconst { parentPost, parentPostId, items, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType, getEntityRecords, getEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getCurrentPostId, getEditedPostAttribute } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst postTypeSlug = getEditedPostAttribute( 'type' );\n\t\t\tconst pageId = getEditedPostAttribute( 'parent' );\n\t\t\tconst pType = getPostType( postTypeSlug );\n\t\t\tconst postId = getCurrentPostId();\n\t\t\tconst isHierarchical = get( pType, [ 'hierarchical' ], false );\n\t\t\tconst query = {\n\t\t\t\tper_page: 100,\n\t\t\t\texclude: postId,\n\t\t\t\tparent_exclude: postId,\n\t\t\t\torderby: 'menu_order',\n\t\t\t\torder: 'asc',\n\t\t\t\t_fields: 'id,title,parent',\n\t\t\t};\n\n\t\t\t// Perform a search when the field is changed.\n\t\t\tif ( !! fieldValue ) {\n\t\t\t\tquery.search = fieldValue;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tparentPostId: pageId,\n\t\t\t\tparentPost: pageId\n\t\t\t\t\t? getEntityRecord( 'postType', postTypeSlug, pageId )\n\t\t\t\t\t: null,\n\t\t\t\titems: isHierarchical\n\t\t\t\t\t? getEntityRecords( 'postType', postTypeSlug, query )\n\t\t\t\t\t: [],\n\t\t\t\tpostType: pType,\n\t\t\t};\n\t\t},\n\t\t[ fieldValue ]\n\t);\n\n\tconst isHierarchical = get( postType, [ 'hierarchical' ], false );\n\tconst parentPageLabel = get( postType, [ 'labels', 'parent_item_colon' ] );\n\tconst pageItems = items || [];\n\n\tconst parentOptions = useMemo( () => {\n\t\tconst getOptionsFromTree = ( tree, level = 0 ) => {\n\t\t\tconst mappedNodes = tree.map( ( treeNode ) => [\n\t\t\t\t{\n\t\t\t\t\tvalue: treeNode.id,\n\t\t\t\t\tlabel:\n\t\t\t\t\t\t'— '.repeat( level ) + unescapeString( treeNode.name ),\n\t\t\t\t\trawName: treeNode.name,\n\t\t\t\t},\n\t\t\t\t...getOptionsFromTree( treeNode.children || [], level + 1 ),\n\t\t\t] );\n\n\t\t\tconst sortedNodes = mappedNodes.sort( ( [ a ], [ b ] ) => {\n\t\t\t\tconst priorityA = getItemPriority( a.rawName, fieldValue );\n\t\t\t\tconst priorityB = getItemPriority( b.rawName, fieldValue );\n\t\t\t\treturn priorityA >= priorityB ? 1 : -1;\n\t\t\t} );\n\n\t\t\treturn sortedNodes.flat();\n\t\t};\n\n\t\tlet tree = pageItems.map( ( item ) => ( {\n\t\t\tid: item.id,\n\t\t\tparent: item.parent,\n\t\t\tname: getTitle( item ),\n\t\t} ) );\n\n\t\t// Only build a hierarchical tree when not searching.\n\t\tif ( ! fieldValue ) {\n\t\t\ttree = buildTermsTree( tree );\n\t\t}\n\n\t\tconst opts = getOptionsFromTree( tree );\n\n\t\t// Ensure the current parent is in the options list.\n\t\tconst optsHasParent = opts.find(\n\t\t\t( item ) => item.value === parentPostId\n\t\t);\n\t\tif ( parentPost && ! optsHasParent ) {\n\t\t\topts.unshift( {\n\t\t\t\tvalue: parentPostId,\n\t\t\t\tlabel: getTitle( parentPost ),\n\t\t\t} );\n\t\t}\n\t\treturn opts;\n\t}, [ pageItems, fieldValue ] );\n\n\tif ( ! isHierarchical || ! parentPageLabel ) {\n\t\treturn null;\n\t}\n\t/**\n\t * Handle user input.\n\t *\n\t * @param {string} inputValue The current value of the input field.\n\t */\n\tconst handleKeydown = ( inputValue ) => {\n\t\tsetFieldValue( inputValue );\n\t};\n\n\t/**\n\t * Handle author selection.\n\t *\n\t * @param {Object} selectedPostId The selected Author.\n\t */\n\tconst handleChange = ( selectedPostId ) => {\n\t\teditPost( { parent: selectedPostId } );\n\t};\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"editor-page-attributes__parent\"\n\t\t\tlabel={ parentPageLabel }\n\t\t\tvalue={ parentPostId }\n\t\t\toptions={ parentOptions }\n\t\t\tonFilterValueChange={ debounce( handleKeydown, 300 ) }\n\t\t\tonChange={ handleChange }\n\t\t/>\n\t);\n}\n\nexport default PageAttributesParent;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-author/combobox.js"],"names":["debounce","useState","useMemo","useSelect","useDispatch","__","ComboboxControl","decodeEntities","store","coreStore","editorStore","AUTHORS_QUERY","PostAuthorCombobox","fieldValue","setFieldValue","authorId","isLoading","authors","postAuthor","select","getUser","getUsers","isResolving","getEditedPostAttribute","author","context","query","search","editPost","authorOptions","fetchedAuthors","map","value","id","label","name","foundAuthor","findIndex","handleSelect","postAuthorId","handleKeydown","inputValue"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,oBAAzB;AACA,SAASC,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AACA,SAASC,aAAT,QAA8B,aAA9B;;AAEA,SAASC,kBAAT,GAA8B;AAC7B,QAAM,CAAEC,UAAF,EAAcC,aAAd,IAAgCb,QAAQ,EAA9C;AAEA,QAAM;AAAEc,IAAAA,QAAF;AAAYC,IAAAA,SAAZ;AAAuBC,IAAAA,OAAvB;AAAgCC,IAAAA;AAAhC,MAA+Cf,SAAS,CAC3DgB,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,OAAF;AAAWC,MAAAA,QAAX;AAAqBC,MAAAA;AAArB,QAAqCH,MAAM,CAAEV,SAAF,CAAjD;AACA,UAAM;AAAEc,MAAAA;AAAF,QAA6BJ,MAAM,CAAET,WAAF,CAAzC;AACA,UAAMc,MAAM,GAAGJ,OAAO,CAAEG,sBAAsB,CAAE,QAAF,CAAxB,EAAsC;AAC3DE,MAAAA,OAAO,EAAE;AADkD,KAAtC,CAAtB;AAGA,UAAMC,KAAK,GAAG,EAAE,GAAGf;AAAL,KAAd;;AAEA,QAAKE,U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AWC,UAAX,CAxB0B,CAA7B;AA0BA;AACD;AACA;AACA;AACA;;AACC,QAAMoB,YAAY,GAAKC,YAAF,IAAoB;AACxC,QAAK,CAAEA,YAAP,EAAsB;AACrB;AACA;;AACDX,IAAAA,QAAQ,CAAE;AAAEJ,MAAAA,MAAM,EAAEe;AAAV,KAAF,CAAR;AACA,GALD;AAOA;AACD;AACA;AACA;AACA;;;AACC,QAAMC,aAAa,GAAKC,UAAF,IAAkB;AACvC3B,IAAAA,aAAa,CAAE2B,UAAF,CAAb;AACA,GAFD;;AAIA,MAAK,CAAEvB,UAAP,EAAoB;AACnB,WAAO,IAAP;AACA;;AAED,SACC,cAAC,eAAD;AACC,IAAA,KAAK,EAAGb,EAAE,CAAE,QAAF,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-author/combobox.js"],"names":["debounce","useState","useMemo","useSelect","useDispatch","__","ComboboxControl","decodeEntities","store","coreStore","editorStore","AUTHORS_QUERY","PostAuthorCombobox","fieldValue","setFieldValue","authorId","isLoading","authors","postAuthor","select","getUser","getUsers","isResolving","getEditedPostAttribute","author","context","query","search","editPost","authorOptions","fetchedAuthors","map","value","id","label","name","foundAuthor","findIndex","handleSelect","postAuthorId","handleKeydown","inputValue"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,oBAAzB;AACA,SAASC,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AACA,SAASC,aAAT,QAA8B,aAA9B;;AAEA,SAASC,kBAAT,GAA8B;AAC7B,QAAM,CAAEC,UAAF,EAAcC,aAAd,IA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U,EAAG;AARd,IADD;AAYA;;AAED,eAAeJ,kBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { debounce } from '@wordpress/compose';\nimport { useState, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { ComboboxControl } from '@wordpress/components';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { AUTHORS_QUERY } from './constants';\n\nfunction PostAuthorCombobox() {\n\tconst [ fieldValue, setFieldValue ] = useState();\n\n\tconst { authorId, isLoading, authors, postAuthor } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getUser, getUsers, isResolving } = select( coreStore );\n\t\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\t\tconst author = getUser( getEditedPostAttribute( 'author' ), {\n\t\t\t\tcontext: 'view',\n\t\t\t} );\n\t\t\tconst query = { ...AUTHORS_QUERY };\n\n\t\t\tif ( fieldValue ) {\n\t\t\t\tquery.search = fieldValue;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tauthorId: getEditedPostAttribute( 'author' ),\n\t\t\t\tpostAuthor: author,\n\t\t\t\tauthors: getUsers( query ),\n\t\t\t\tisLoading: isResolving( 'core', 'getUsers', [ query ] ),\n\t\t\t};\n\t\t},\n\t\t[ fieldValue ]\n\t);\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst authorOptions = useMemo( () => {\n\t\tconst fetchedAuthors = ( authors ?? [] ).map( ( author ) => {\n\t\t\treturn {\n\t\t\t\tvalue: author.id,\n\t\t\t\tlabel: decodeEntities( author.name ),\n\t\t\t};\n\t\t} );\n\n\t\t// Ensure the current author is included in the dropdown list.\n\t\tconst foundAuthor = fetchedAuthors.findIndex(\n\t\t\t( { value } ) => postAuthor?.id === value\n\t\t);\n\n\t\tif ( foundAuthor < 0 && postAuthor ) {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tvalue: postAuthor.id,\n\t\t\t\t\tlabel: decodeEntities( postAuthor.name ),\n\t\t\t\t},\n\t\t\t\t...fetchedAuthors,\n\t\t\t];\n\t\t}\n\n\t\treturn fetchedAuthors;\n\t}, [ authors, postAuthor ] );\n\n\t/**\n\t * Handle author selection.\n\t *\n\t * @param {number} postAuthorId The selected Author.\n\t */\n\tconst handleSelect = ( postAuthorId ) => {\n\t\tif ( ! postAuthorId ) {\n\t\t\treturn;\n\t\t}\n\t\teditPost( { author: postAuthorId } );\n\t};\n\n\t/**\n\t * Handle user input.\n\t *\n\t * @param {string} inputValue The current value of the input field.\n\t */\n\tconst handleKeydown = ( inputValue ) => {\n\t\tsetFieldValue( inputValue );\n\t};\n\n\tif ( ! postAuthor ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Author' ) }\n\t\t\toptions={ authorOptions }\n\t\t\tvalue={ authorId }\n\t\t\tonFilterValueChange={ debounce( handleKeydown, 300 ) }\n\t\t\tonChange={ handleSelect }\n\t\t\tisLoading={ isLoading }\n\t\t\tallowReset={ false }\n\t\t/>\n\t);\n}\n\nexport default PostAuthorCombobox;\n"]}
|
|
@@ -21,6 +21,7 @@ function PostExcerpt(_ref) {
|
|
|
21
21
|
return createElement("div", {
|
|
22
22
|
className: "editor-post-excerpt"
|
|
23
23
|
}, createElement(TextareaControl, {
|
|
24
|
+
__nextHasNoMarginBottom: true,
|
|
24
25
|
label: __('Write an excerpt (optional)'),
|
|
25
26
|
className: "editor-post-excerpt__textarea",
|
|
26
27
|
onChange: value => onUpdateExcerpt(value),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-excerpt/index.js"],"names":["__","ExternalLink","TextareaControl","withSelect","withDispatch","compose","store","editorStore","PostExcerpt","excerpt","onUpdateExcerpt","value","select","getEditedPostAttribute","dispatch","editPost"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,EAAuBC,eAAvB,QAA8C,uBAA9C;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,WAAT,OAAqD;AAAA,MAA/B;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,GAA+B;AACpD,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,eAAD;AACC,IAAA,KAAK,EAAGV,EAAE,CAAE,6BAAF,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-excerpt/index.js"],"names":["__","ExternalLink","TextareaControl","withSelect","withDispatch","compose","store","editorStore","PostExcerpt","excerpt","onUpdateExcerpt","value","select","getEditedPostAttribute","dispatch","editPost"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,EAAuBC,eAAvB,QAA8C,uBAA9C;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,WAAT,OAAqD;AAAA,MAA/B;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,GAA+B;AACpD,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGV,EAAE,CAAE,6BAAF,CAFX;AAGC,IAAA,SAAS,EAAC,+BAHX;AAIC,IAAA,QAAQ,EAAKW,KAAF,IAAaD,eAAe,CAAEC,KAAF,CAJxC;AAKC,IAAA,KAAK,EAAGF;AALT,IADD,EAQC,cAAC,YAAD;AACC,IAAA,IAAI,EAAGT,EAAE,CACR,iEADQ;AADV,KAKGA,EAAE,CAAE,kCAAF,CALL,CARD,CADD;AAkBA;;AAED,eAAeK,OAAO,CAAE,CACvBF,UAAU,CAAIS,MAAF,IAAc;AACzB,SAAO;AACNH,IAAAA,OAAO,EAAEG,MAAM,CAAEL,WAAF,CAAN,CAAsBM,sBAAtB,CAA8C,SAA9C;AADH,GAAP;AAGA,CAJS,CADa,EAMvBT,YAAY,CAAIU,QAAF,KAAkB;AAC/BJ,EAAAA,eAAe,CAAED,OAAF,EAAY;AAC1BK,IAAAA,QAAQ,CAAEP,WAAF,CAAR,CAAwBQ,QAAxB,CAAkC;AAAEN,MAAAA;AAAF,KAAlC;AACA;;AAH8B,CAAlB,CAAF,CANW,CAAF,CAAP,CAWVD,WAXU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ExternalLink, TextareaControl } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostExcerpt( { excerpt, onUpdateExcerpt } ) {\n\treturn (\n\t\t<div className=\"editor-post-excerpt\">\n\t\t\t<TextareaControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Write an excerpt (optional)' ) }\n\t\t\t\tclassName=\"editor-post-excerpt__textarea\"\n\t\t\t\tonChange={ ( value ) => onUpdateExcerpt( value ) }\n\t\t\t\tvalue={ excerpt }\n\t\t\t/>\n\t\t\t<ExternalLink\n\t\t\t\thref={ __(\n\t\t\t\t\t'https://wordpress.org/support/article/settings-sidebar/#excerpt'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t{ __( 'Learn more about manual excerpts' ) }\n\t\t\t</ExternalLink>\n\t\t</div>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\texcerpt: select( editorStore ).getEditedPostAttribute( 'excerpt' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => ( {\n\t\tonUpdateExcerpt( excerpt ) {\n\t\t\tdispatch( editorStore ).editPost( { excerpt } );\n\t\t},\n\t} ) ),\n] )( PostExcerpt );\n"]}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* External dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { find } from 'lodash';
|
|
7
3
|
/**
|
|
8
4
|
* WordPress dependencies
|
|
9
5
|
*/
|
|
10
|
-
|
|
11
6
|
import { __, sprintf } from '@wordpress/i18n';
|
|
12
7
|
import { Button, SelectControl } from '@wordpress/components';
|
|
13
8
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
@@ -91,7 +86,7 @@ export default function PostFormat() {
|
|
|
91
86
|
// The current format may not be a format supported by the theme.
|
|
92
87
|
return (supportedFormats === null || supportedFormats === void 0 ? void 0 : supportedFormats.includes(format.id)) || postFormat === format.id;
|
|
93
88
|
});
|
|
94
|
-
const suggestion = find(
|
|
89
|
+
const suggestion = formats.find(format => format.id === suggestedFormat);
|
|
95
90
|
const {
|
|
96
91
|
editPost
|
|
97
92
|
} = useDispatch(editorStore);
|