@wordpress/editor 13.20.1 → 13.21.1-next.f8d8eceb.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 +2 -0
- package/build/components/post-author/select.js +1 -0
- package/build/components/post-author/select.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +4 -1
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/lock-unlock.js +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/store/utils/notice-builder.js +5 -6
- package/build/store/utils/notice-builder.js.map +1 -1
- package/build-module/components/post-author/select.js +1 -0
- package/build-module/components/post-author/select.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +4 -1
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/lock-unlock.js +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/store/utils/notice-builder.js +5 -6
- package/build-module/store/utils/notice-builder.js.map +1 -1
- package/package.json +31 -31
- package/src/components/post-author/select.js +1 -0
- package/src/components/provider/use-block-editor-settings.js +4 -0
- package/src/lock-unlock.js +1 -1
- package/src/store/test/actions.js +7 -1
- package/src/store/utils/notice-builder.js +6 -6
- package/src/store/utils/test/notice-builder.js +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_element","_data","_htmlEntities","_components","_coreData","_store","_constants","PostAuthorSelect","editPost","useDispatch","editorStore","postAuthor","authors","useSelect","select","getEditedPostAttribute","coreStore","getUsers","AUTHORS_QUERY","authorOptions","useMemo","map","author","value","id","label","decodeEntities","name","setAuthorId","Number","_react","createElement","SelectControl","__nextHasNoMarginBottom","className","__","options","onChange","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-author/select.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { SelectControl } from '@wordpress/components';\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 PostAuthorSelect() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { postAuthor, authors } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostAuthor:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'author' ),\n\t\t\tauthors: select( coreStore ).getUsers( AUTHORS_QUERY ),\n\t\t};\n\t}, [] );\n\n\tconst authorOptions = useMemo( () => {\n\t\treturn ( 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\t}, [ authors ] );\n\n\tconst setAuthorId = ( value ) => {\n\t\tconst author = Number( value );\n\t\teditPost( { author } );\n\t};\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"post-author-selector\"\n\t\t\tlabel={ __( 'Author' ) }\n\t\t\toptions={ authorOptions }\n\t\t\tonChange={ setAuthorId }\n\t\t\tvalue={ postAuthor }\n\t\t/>\n\t);\n}\n\nexport default PostAuthorSelect;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAdA;AACA;AACA;;AAQA;AACA;AACA;;AAIA,SAASQ,gBAAgBA,CAAA,EAAG;EAC3B,MAAM;IAAEC;EAAS,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAY,CAAC;EAC/C,MAAM;IAAEC,UAAU;IAAEC;EAAQ,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACxD,OAAO;MACNH,UAAU,EACTG,MAAM,CAAEJ,YAAY,CAAC,CAACK,sBAAsB,CAAE,QAAS,CAAC;MACzDH,OAAO,EAAEE,MAAM,CAAEE,eAAU,CAAC,CAACC,QAAQ,CAAEC,wBAAc;IACtD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMC,aAAa,GAAG,IAAAC,gBAAO,EAAE,MAAM;IACpC,OAAO,CAAER,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAI,EAAE,EAAGS,GAAG,CAAIC,MAAM,IAAM;MAC3C,OAAO;QACNC,KAAK,EAAED,MAAM,CAACE,EAAE;QAChBC,KAAK,EAAE,IAAAC,4BAAc,EAAEJ,MAAM,CAACK,IAAK;MACpC,CAAC;IACF,CAAE,CAAC;EACJ,CAAC,EAAE,CAAEf,OAAO,CAAG,CAAC;EAEhB,MAAMgB,WAAW,GAAKL,KAAK,IAAM;IAChC,MAAMD,MAAM,GAAGO,MAAM,CAAEN,KAAM,CAAC;IAC9Bf,QAAQ,CAAE;MAAEc;IAAO,CAAE,CAAC;EACvB,CAAC;EAED,OACC,IAAAQ,MAAA,CAAAC,aAAA,EAAC5B,WAAA,CAAA6B,aAAa;IACbC,uBAAuB;IACvBC,SAAS,EAAC,sBAAsB;
|
|
1
|
+
{"version":3,"names":["_i18n","require","_element","_data","_htmlEntities","_components","_coreData","_store","_constants","PostAuthorSelect","editPost","useDispatch","editorStore","postAuthor","authors","useSelect","select","getEditedPostAttribute","coreStore","getUsers","AUTHORS_QUERY","authorOptions","useMemo","map","author","value","id","label","decodeEntities","name","setAuthorId","Number","_react","createElement","SelectControl","__next40pxDefaultSize","__nextHasNoMarginBottom","className","__","options","onChange","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-author/select.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { SelectControl } from '@wordpress/components';\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 PostAuthorSelect() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { postAuthor, authors } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostAuthor:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'author' ),\n\t\t\tauthors: select( coreStore ).getUsers( AUTHORS_QUERY ),\n\t\t};\n\t}, [] );\n\n\tconst authorOptions = useMemo( () => {\n\t\treturn ( 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\t}, [ authors ] );\n\n\tconst setAuthorId = ( value ) => {\n\t\tconst author = Number( value );\n\t\teditPost( { author } );\n\t};\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__next40pxDefaultSize\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"post-author-selector\"\n\t\t\tlabel={ __( 'Author' ) }\n\t\t\toptions={ authorOptions }\n\t\t\tonChange={ setAuthorId }\n\t\t\tvalue={ postAuthor }\n\t\t/>\n\t);\n}\n\nexport default PostAuthorSelect;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAdA;AACA;AACA;;AAQA;AACA;AACA;;AAIA,SAASQ,gBAAg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,7 @@ function useBlockEditorSettings(settings, hasTemplate) {
|
|
|
39
39
|
canUseUnfilteredHTML,
|
|
40
40
|
userCanCreatePages,
|
|
41
41
|
pageOnFront,
|
|
42
|
+
pageForPosts,
|
|
42
43
|
postType,
|
|
43
44
|
userPatternCategories
|
|
44
45
|
} = (0, _data.useSelect)(select => {
|
|
@@ -63,6 +64,7 @@ function useBlockEditorSettings(settings, hasTemplate) {
|
|
|
63
64
|
hasUploadPermissions: (_canUser = canUser('create', 'media')) !== null && _canUser !== void 0 ? _canUser : true,
|
|
64
65
|
userCanCreatePages: canUser('create', 'pages'),
|
|
65
66
|
pageOnFront: siteSettings?.page_on_front,
|
|
67
|
+
pageForPosts: siteSettings?.page_for_posts,
|
|
66
68
|
postType: getCurrentPostType(),
|
|
67
69
|
userPatternCategories: getUserPatternCategories()
|
|
68
70
|
};
|
|
@@ -125,8 +127,9 @@ function useBlockEditorSettings(settings, hasTemplate) {
|
|
|
125
127
|
__experimentalCreatePageEntity: createPageEntity,
|
|
126
128
|
__experimentalUserCanCreatePages: userCanCreatePages,
|
|
127
129
|
pageOnFront,
|
|
130
|
+
pageForPosts,
|
|
128
131
|
__experimentalPreferPatternsOnRoot: hasTemplate
|
|
129
|
-
}), [settings, hasUploadPermissions, reusableBlocks, userPatternCategories, blockPatterns, blockPatternCategories, canUseUnfilteredHTML, undo, hasTemplate, createPageEntity, userCanCreatePages, pageOnFront]);
|
|
132
|
+
}), [settings, hasUploadPermissions, reusableBlocks, userPatternCategories, blockPatterns, blockPatternCategories, canUseUnfilteredHTML, undo, hasTemplate, createPageEntity, userCanCreatePages, pageOnFront, pageForPosts]);
|
|
130
133
|
}
|
|
131
134
|
var _default = useBlockEditorSettings;
|
|
132
135
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_data","_coreData","_i18n","_mediaCategories","_interopRequireDefault","_utils","_store","EMPTY_BLOCKS_LIST","BLOCK_EDITOR_SETTINGS","useBlockEditorSettings","settings","hasTemplate","_settings$__experimen","_settings$__experimen2","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","postType","userPatternCategories","useSelect","select","_canUser","canUserUseUnfilteredHTML","getCurrentPostType","editorStore","isWeb","Platform","OS","canUser","getEntityRecord","getUserPatternCategories","coreStore","siteSettings","undefined","getEntityRecords","per_page","page_on_front","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","getBlockPatterns","getBlockPatternCategories","blockPatterns","useMemo","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","undo","useDispatch","saveEntityRecord","createPageEntity","useCallback","options","Promise","reject","message","__","Object","fromEntries","entries","key","mediaUpload","__experimentalReusableBlocks","__experimentalUserPatternCategories","__experimentalFetchLinkSuggestions","search","searchOptions","fetchLinkSuggestions","inserterMediaCategories","__experimentalFetchRichUrlData","fetchUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot","_default","exports","default"],"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Platform, useMemo, useCallback } 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 inserterMediaCategories from '../media-categories';\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\n\nconst EMPTY_BLOCKS_LIST = [];\n\nconst BLOCK_EDITOR_SETTINGS = [\n\t'__experimentalBlockDirectory',\n\t'__experimentalDiscussionSettings',\n\t'__experimentalFeatures',\n\t'__experimentalGlobalStylesBaseStyles',\n\t'__experimentalPreferredStyleVariations',\n\t'__experimentalSetIsInserterOpened',\n\t'__unstableGalleryWithImageBlocks',\n\t'alignWide',\n\t'allowedBlockTypes',\n\t'blockInspectorTabs',\n\t'allowedMimeTypes',\n\t'bodyPlaceholder',\n\t'canLockBlocks',\n\t'capabilities',\n\t'clearBlockSelection',\n\t'codeEditingEnabled',\n\t'colors',\n\t'disableCustomColors',\n\t'disableCustomFontSizes',\n\t'disableCustomSpacingSizes',\n\t'disableCustomGradients',\n\t'disableLayoutStyles',\n\t'enableCustomLineHeight',\n\t'enableCustomSpacing',\n\t'enableCustomUnits',\n\t'enableOpenverseMediaCategory',\n\t'focusMode',\n\t'distractionFree',\n\t'fontSizes',\n\t'gradients',\n\t'generateAnchors',\n\t'hasFixedToolbar',\n\t'hasInlineToolbar',\n\t'isDistractionFree',\n\t'imageDefaultSize',\n\t'imageDimensions',\n\t'imageEditing',\n\t'imageSizes',\n\t'isRTL',\n\t'keepCaretInsideBlock',\n\t'locale',\n\t'maxWidth',\n\t'onUpdateDefaultBlockStyles',\n\t'postContentAttributes',\n\t'postsPerPage',\n\t'readOnly',\n\t'styles',\n\t'template',\n\t'templateLock',\n\t'titlePlaceholder',\n\t'supportsLayout',\n\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t'__unstableHasCustomAppender',\n\t'__unstableIsPreviewMode',\n\t'__unstableResolvedAssets',\n\t'__unstableIsBlockBasedTheme',\n];\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\tuserPatternCategories,\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, getUserPatternCategories } =\n\t\t\tselect( 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\tuserPatternCategories: getUserPatternCategories(),\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 = useCallback(\n\t\t( options ) => {\n\t\t\tif ( ! userCanCreatePages ) {\n\t\t\t\treturn Promise.reject( {\n\t\t\t\t\tmessage: __(\n\t\t\t\t\t\t'You do not have permission to create Pages.'\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t\t},\n\t\t[ saveEntityRecord, userCanCreatePages ]\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\tBLOCK_EDITOR_SETTINGS.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__experimentalUserPatternCategories: userPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\tinserterMediaCategories,\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\tuserPatternCategories,\n\t\t\tblockPatterns,\n\t\t\tblockPatternCategories,\n\t\t\tcanUseUnfilteredHTML,\n\t\t\tundo,\n\t\t\thasTemplate,\n\t\t\tcreatePageEntity,\n\t\t\tuserCanCreatePages,\n\t\t\tpageOnFront,\n\t\t]\n\t);\n}\n\nexport default useBlockEditorSettings;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,gBAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAjBA;AACA;AACA;;AAUA;AACA;AACA;;AAKA,MAAMQ,iBAAiB,GAAG,EAAE;AAE5B,MAAMC,qBAAqB,GAAG,CAC7B,8BAA8B,EAC9B,kCAAkC,EA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AkB,EAClBC,WAAW,CAEb,CAAC;AACF;AAAC,IAAA2E,QAAA,GAEcpF,sBAAsB;AAAAqF,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
1
|
+
{"version":3,"names":["_element","require","_data","_coreData","_i18n","_mediaCategories","_interopRequireDefault","_utils","_store","EMPTY_BLOCKS_LIST","BLOCK_EDITOR_SETTINGS","useBlockEditorSettings","settings","hasTemplate","_settings$__experimen","_settings$__experimen2","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","pageForPosts","postType","userPatternCategories","useSelect","select","_canUser","canUserUseUnfilteredHTML","getCurrentPostType","editorStore","isWeb","Platform","OS","canUser","getEntityRecord","getUserPatternCategories","coreStore","siteSettings","undefined","getEntityRecords","per_page","page_on_front","page_for_posts","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","getBlockPatterns","getBlockPatternCategories","blockPatterns","useMemo","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","undo","useDispatch","saveEntityRecord","createPageEntity","useCallback","options","Promise","reject","message","__","Object","fromEntries","entries","key","mediaUpload","__experimentalReusableBlocks","__experimentalUserPatternCategories","__experimentalFetchLinkSuggestions","search","searchOptions","fetchLinkSuggestions","inserterMediaCategories","__experimentalFetchRichUrlData","fetchUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot","_default","exports","default"],"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Platform, useMemo, useCallback } 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 inserterMediaCategories from '../media-categories';\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\n\nconst EMPTY_BLOCKS_LIST = [];\n\nconst BLOCK_EDITOR_SETTINGS = [\n\t'__experimentalBlockDirectory',\n\t'__experimentalDiscussionSettings',\n\t'__experimentalFeatures',\n\t'__experimentalGlobalStylesBaseStyles',\n\t'__experimentalPreferredStyleVariations',\n\t'__experimentalSetIsInserterOpened',\n\t'__unstableGalleryWithImageBlocks',\n\t'alignWide',\n\t'allowedBlockTypes',\n\t'blockInspectorTabs',\n\t'allowedMimeTypes',\n\t'bodyPlaceholder',\n\t'canLockBlocks',\n\t'capabilities',\n\t'clearBlockSelection',\n\t'codeEditingEnabled',\n\t'colors',\n\t'disableCustomColors',\n\t'disableCustomFontSizes',\n\t'disableCustomSpacingSizes',\n\t'disableCustomGradients',\n\t'disableLayoutStyles',\n\t'enableCustomLineHeight',\n\t'enableCustomSpacing',\n\t'enableCustomUnits',\n\t'enableOpenverseMediaCategory',\n\t'focusMode',\n\t'distractionFree',\n\t'fontSizes',\n\t'gradients',\n\t'generateAnchors',\n\t'hasFixedToolbar',\n\t'hasInlineToolbar',\n\t'isDistractionFree',\n\t'imageDefaultSize',\n\t'imageDimensions',\n\t'imageEditing',\n\t'imageSizes',\n\t'isRTL',\n\t'keepCaretInsideBlock',\n\t'locale',\n\t'maxWidth',\n\t'onUpdateDefaultBlockStyles',\n\t'postContentAttributes',\n\t'postsPerPage',\n\t'readOnly',\n\t'styles',\n\t'template',\n\t'templateLock',\n\t'titlePlaceholder',\n\t'supportsLayout',\n\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t'__unstableHasCustomAppender',\n\t'__unstableIsPreviewMode',\n\t'__unstableResolvedAssets',\n\t'__unstableIsBlockBasedTheme',\n];\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\tpageForPosts,\n\t\tpostType,\n\t\tuserPatternCategories,\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, getUserPatternCategories } =\n\t\t\tselect( 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\tpageForPosts: siteSettings?.page_for_posts,\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tuserPatternCategories: getUserPatternCategories(),\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 = useCallback(\n\t\t( options ) => {\n\t\t\tif ( ! userCanCreatePages ) {\n\t\t\t\treturn Promise.reject( {\n\t\t\t\t\tmessage: __(\n\t\t\t\t\t\t'You do not have permission to create Pages.'\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t\t},\n\t\t[ saveEntityRecord, userCanCreatePages ]\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\tBLOCK_EDITOR_SETTINGS.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__experimentalUserPatternCategories: userPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\tinserterMediaCategories,\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\tpageForPosts,\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\tuserPatternCategories,\n\t\t\tblockPatterns,\n\t\t\tblockPatternCategories,\n\t\t\tcanUseUnfilteredHTML,\n\t\t\tundo,\n\t\t\thasTemplate,\n\t\t\tcreatePageEntity,\n\t\t\tuserCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\tpageForPosts,\n\t\t]\n\t);\n}\n\nexport default useBlockEditorSettings;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAA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A8B,EAAEC,oCAAY;IAC5CC,sCAAsC,EAAEzE,oBAAoB;IAC5D0E,kBAAkB,EAAEzB,IAAI;IACxB0B,WAAW,EAAEhF,WAAW;IACxBiF,8BAA8B,EAAExB,gBAAgB;IAChDyB,gCAAgC,EAAE5E,kBAAkB;IACpDC,WAAW;IACXC,YAAY;IACZ2E,kCAAkC,EAAEnF;EACrC,CAAC,CAAE,EACH,CACCD,QAAQ,EACRK,oBAAoB,EACpBD,cAAc,EACdO,qBAAqB,EACrB8B,aAAa,EACba,sBAAsB,EACtBhD,oBAAoB,EACpBiD,IAAI,EACJtD,WAAW,EACXyD,gBAAgB,EAChBnD,kBAAkB,EAClBC,WAAW,EACXC,YAAY,CAEd,CAAC;AACF;AAAC,IAAA4E,QAAA,GAEctF,sBAAsB;AAAAuF,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
package/build/lock-unlock.js
CHANGED
|
@@ -12,7 +12,7 @@ var _privateApis = require("@wordpress/private-apis");
|
|
|
12
12
|
const {
|
|
13
13
|
lock,
|
|
14
14
|
unlock
|
|
15
|
-
} = (0, _privateApis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my
|
|
15
|
+
} = (0, _privateApis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/editor');
|
|
16
16
|
exports.unlock = unlock;
|
|
17
17
|
exports.lock = lock;
|
|
18
18
|
//# sourceMappingURL=lock-unlock.js.map
|
package/build/lock-unlock.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_privateApis","require","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports"],"sources":["@wordpress/editor/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my
|
|
1
|
+
{"version":3,"names":["_privateApis","require","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports"],"sources":["@wordpress/editor/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',\n\t\t'@wordpress/editor'\n\t);\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAEO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5B,IAAAC,6DAAgD,EAC/C,iHAAiH,EACjH,mBACD,CAAC;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA"}
|
|
@@ -35,20 +35,19 @@ function getNotificationArgumentsForSaveSuccess(data) {
|
|
|
35
35
|
if (data.options?.isAutosave) {
|
|
36
36
|
return [];
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
// No notice is shown after trashing a post
|
|
40
|
-
if (post.status === 'trash' && previousPost.status !== 'trash') {
|
|
41
|
-
return [];
|
|
42
|
-
}
|
|
43
38
|
const publishStatus = ['publish', 'private', 'future'];
|
|
44
39
|
const isPublished = publishStatus.includes(previousPost.status);
|
|
45
40
|
const willPublish = publishStatus.includes(post.status);
|
|
41
|
+
const willTrash = post.status === 'trash' && previousPost.status !== 'trash';
|
|
46
42
|
let noticeMessage;
|
|
47
43
|
let shouldShowLink = (_postType$viewable = postType?.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false;
|
|
48
44
|
let isDraft;
|
|
49
45
|
|
|
50
46
|
// Always should a notice, which will be spoken for accessibility.
|
|
51
|
-
if (
|
|
47
|
+
if (willTrash) {
|
|
48
|
+
noticeMessage = postType.labels.item_trashed;
|
|
49
|
+
shouldShowLink = false;
|
|
50
|
+
} else if (!isPublished && !willPublish) {
|
|
52
51
|
// If saving a non-published post, don't show notice.
|
|
53
52
|
noticeMessage = (0, _i18n.__)('Draft saved.');
|
|
54
53
|
isDraft = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_constants","getNotificationArgumentsForSaveSuccess","data","_postType$viewable","previousPost","post","postType","options","isAutosave","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_constants","getNotificationArgumentsForSaveSuccess","data","_postType$viewable","previousPost","post","postType","options","isAutosave","publishStatus","isPublished","includes","status","willPublish","willTrash","noticeMessage","shouldShowLink","viewable","isDraft","labels","item_trashed","__","item_reverted_to_draft","publish","item_published","private","item_published_privately","future","item_scheduled","item_updated","actions","push","label","view_item","url","link","id","SAVE_POST_NOTICE_ID","type","getNotificationArgumentsForSaveFail","edits","error","code","indexOf","messages","message","test","join","getNotificationArgumentsForTrashFail","TRASH_POST_NOTICE_ID"],"sources":["@wordpress/editor/src/store/utils/notice-builder.js"],"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 * 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 ( data.options?.isAutosave ) {\n\t\treturn [];\n\t}\n\n\tconst publishStatus = [ 'publish', 'private', 'future' ];\n\tconst isPublished = publishStatus.includes( previousPost.status );\n\tconst willPublish = publishStatus.includes( post.status );\n\tconst willTrash =\n\t\tpost.status === 'trash' && previousPost.status !== 'trash';\n\n\tlet noticeMessage;\n\tlet shouldShowLink = postType?.viewable ?? false;\n\tlet isDraft;\n\n\t// Always should a notice, which will be spoken for accessibility.\n\tif ( willTrash ) {\n\t\tnoticeMessage = postType.labels.item_trashed;\n\t\tshouldShowLink = false;\n\t} else if ( ! isPublished && ! willPublish ) {\n\t\t// If saving a non-published post, don't show notice.\n\t\tnoticeMessage = __( 'Draft saved.' );\n\t\tisDraft = true;\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: isDraft ? __( 'View Preview' ) : 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"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,sCAAsCA,CAAEC,IAAI,EAAG;EAAA,IAAAC,kBAAA;EAC9D,MAAM;IAAEC,YAAY;IAAEC,IAAI;IAAEC;EAAS,CAAC,GAAGJ,IAAI;EAC7C;EACA,IAAKA,IAAI,CAACK,OAAO,EAAEC,UAAU,EAAG;IAC/B,OAAO,EAAE;EACV;EAEA,MAAMC,aAAa,GAAG,CAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAE;EACxD,MAAMC,WAAW,GAAGD,aAAa,CAACE,QAAQ,CAAEP,YAAY,CAACQ,MAAO,CAAC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E,GAAI,CAAC;EAC7D;EACA,OAAO,CACNhC,aAAa,EACb;IACCqB,EAAE,EAAEC;EACL,CAAC,CACD;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASW,oCAAoCA,CAAE9C,IAAI,EAAG;EAC5D,OAAO,CACNA,IAAI,CAACuC,KAAK,CAACI,OAAO,IAAI3C,IAAI,CAACuC,KAAK,CAACC,IAAI,KAAK,eAAe,GACtDxC,IAAI,CAACuC,KAAK,CAACI,OAAO,GAClB,IAAAxB,QAAE,EAAE,iBAAkB,CAAC,EAC1B;IACCe,EAAE,EAAEa;EACL,CAAC,CACD;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","useMemo","useSelect","useDispatch","decodeEntities","SelectControl","store","coreStore","editorStore","AUTHORS_QUERY","PostAuthorSelect","editPost","postAuthor","authors","select","getEditedPostAttribute","getUsers","authorOptions","map","author","value","id","label","name","setAuthorId","Number","createElement","__nextHasNoMarginBottom","className","options","onChange"],"sources":["@wordpress/editor/src/components/post-author/select.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { SelectControl } from '@wordpress/components';\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 PostAuthorSelect() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { postAuthor, authors } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostAuthor:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'author' ),\n\t\t\tauthors: select( coreStore ).getUsers( AUTHORS_QUERY ),\n\t\t};\n\t}, [] );\n\n\tconst authorOptions = useMemo( () => {\n\t\treturn ( 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\t}, [ authors ] );\n\n\tconst setAuthorId = ( value ) => {\n\t\tconst author = Number( value );\n\t\teditPost( { author } );\n\t};\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"post-author-selector\"\n\t\t\tlabel={ __( 'Author' ) }\n\t\t\toptions={ authorOptions }\n\t\t\tonChange={ setAuthorId }\n\t\t\tvalue={ postAuthor }\n\t\t/>\n\t);\n}\n\nexport default PostAuthorSelect;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAClD,SAASC,aAAa,QAAQ,aAAa;AAE3C,SAASC,gBAAgBA,CAAA,EAAG;EAC3B,MAAM;IAAEC;EAAS,CAAC,GAAGR,WAAW,CAAEK,WAAY,CAAC;EAC/C,MAAM;IAAEI,UAAU;IAAEC;EAAQ,CAAC,GAAGX,SAAS,CAAIY,MAAM,IAAM;IACxD,OAAO;MACNF,UAAU,EACTE,MAAM,CAAEN,WAAY,CAAC,CAACO,sBAAsB,CAAE,QAAS,CAAC;MACzDF,OAAO,EAAEC,MAAM,CAAEP,SAAU,CAAC,CAACS,QAAQ,CAAEP,aAAc;IACtD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMQ,aAAa,GAAGhB,OAAO,CAAE,MAAM;IACpC,OAAO,CAAEY,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAI,EAAE,EAAGK,GAAG,CAAIC,MAAM,IAAM;MAC3C,OAAO;QACNC,KAAK,EAAED,MAAM,CAACE,EAAE;QAChBC,KAAK,EAAElB,cAAc,CAAEe,MAAM,CAACI,IAAK;MACpC,CAAC;IACF,CAAE,CAAC;EACJ,CAAC,EAAE,CAAEV,OAAO,CAAG,CAAC;EAEhB,MAAMW,WAAW,GAAKJ,KAAK,IAAM;IAChC,MAAMD,MAAM,GAAGM,MAAM,CAAEL,KAAM,CAAC;IAC9BT,QAAQ,CAAE;MAAEQ;IAAO,CAAE,CAAC;EACvB,CAAC;EAED,OACCO,aAAA,CAACrB,aAAa;IACbsB,uBAAuB;IACvBC,SAAS,EAAC,sBAAsB;
|
|
1
|
+
{"version":3,"names":["__","useMemo","useSelect","useDispatch","decodeEntities","SelectControl","store","coreStore","editorStore","AUTHORS_QUERY","PostAuthorSelect","editPost","postAuthor","authors","select","getEditedPostAttribute","getUsers","authorOptions","map","author","value","id","label","name","setAuthorId","Number","createElement","__next40pxDefaultSize","__nextHasNoMarginBottom","className","options","onChange"],"sources":["@wordpress/editor/src/components/post-author/select.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { SelectControl } from '@wordpress/components';\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 PostAuthorSelect() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { postAuthor, authors } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostAuthor:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'author' ),\n\t\t\tauthors: select( coreStore ).getUsers( AUTHORS_QUERY ),\n\t\t};\n\t}, [] );\n\n\tconst authorOptions = useMemo( () => {\n\t\treturn ( 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\t}, [ authors ] );\n\n\tconst setAuthorId = ( value ) => {\n\t\tconst author = Number( value );\n\t\teditPost( { author } );\n\t};\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__next40pxDefaultSize\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"post-author-selector\"\n\t\t\tlabel={ __( 'Author' ) }\n\t\t\toptions={ authorOptions }\n\t\t\tonChange={ setAuthorId }\n\t\t\tvalue={ postAuthor }\n\t\t/>\n\t);\n}\n\nexport default PostAuthorSelect;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAClD,SAASC,aAAa,QAAQ,aAAa;AAE3C,SAASC,gBAAgBA,CAAA,EAAG;EAC3B,MAAM;IAAEC;EAAS,CAAC,GAAGR,WAAW,CAAEK,WAAY,CAAC;EAC/C,MAAM;IAAEI,UAAU;IAAEC;EAAQ,CAAC,GAAGX,SAAS,CAAIY,MAAM,IAAM;IACxD,OAAO;MACNF,UAAU,EACTE,MAAM,CAAEN,WAAY,CAAC,CAACO,sBAAsB,CAAE,QAAS,CAAC;MACzDF,OAAO,EAAEC,MAAM,CAAEP,SAAU,CAAC,CAACS,QAAQ,CAAEP,aAAc;IACtD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMQ,aAAa,GAAGhB,OAAO,CAAE,MAAM;IACpC,OAAO,CAAEY,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAI,EAAE,EAAGK,GAAG,CAAIC,MAAM,IAAM;MAC3C,OAAO;QACNC,KAAK,EAAED,MAAM,CAACE,EAAE;QAChBC,KAAK,EAAElB,cAAc,CAAEe,MAAM,CAACI,IAAK;MACpC,CAAC;IACF,CAAE,CAAC;EACJ,CAAC,EAAE,CAAEV,OAAO,CAAG,CAAC;EAEhB,MAAMW,WAAW,GAAKJ,KAAK,IAAM;IAChC,MAAMD,MAAM,GAAGM,MAAM,CAAEL,KAAM,CAAC;IAC9BT,QAAQ,CAAE;MAAEQ;IAAO,CAAE,CAAC;EACvB,CAAC;EAED,OACCO,aAAA,CAACrB,aAAa;IACbsB,qBAAqB;IACrBC,uBAAuB;IACvBC,SAAS,EAAC,sBAAsB;IAChCP,KAAK,EAAGtB,EAAE,CAAE,QAAS,CAAG;IACxB8B,OAAO,EAAGb,aAAe;IACzBc,QAAQ,EAAGP,WAAa;IACxBJ,KAAK,EAAGR;EAAY,CACpB,CAAC;AAEJ;AAEA,eAAeF,gBAAgB"}
|
|
@@ -31,6 +31,7 @@ function useBlockEditorSettings(settings, hasTemplate) {
|
|
|
31
31
|
canUseUnfilteredHTML,
|
|
32
32
|
userCanCreatePages,
|
|
33
33
|
pageOnFront,
|
|
34
|
+
pageForPosts,
|
|
34
35
|
postType,
|
|
35
36
|
userPatternCategories
|
|
36
37
|
} = useSelect(select => {
|
|
@@ -55,6 +56,7 @@ function useBlockEditorSettings(settings, hasTemplate) {
|
|
|
55
56
|
hasUploadPermissions: (_canUser = canUser('create', 'media')) !== null && _canUser !== void 0 ? _canUser : true,
|
|
56
57
|
userCanCreatePages: canUser('create', 'pages'),
|
|
57
58
|
pageOnFront: siteSettings?.page_on_front,
|
|
59
|
+
pageForPosts: siteSettings?.page_for_posts,
|
|
58
60
|
postType: getCurrentPostType(),
|
|
59
61
|
userPatternCategories: getUserPatternCategories()
|
|
60
62
|
};
|
|
@@ -117,8 +119,9 @@ function useBlockEditorSettings(settings, hasTemplate) {
|
|
|
117
119
|
__experimentalCreatePageEntity: createPageEntity,
|
|
118
120
|
__experimentalUserCanCreatePages: userCanCreatePages,
|
|
119
121
|
pageOnFront,
|
|
122
|
+
pageForPosts,
|
|
120
123
|
__experimentalPreferPatternsOnRoot: hasTemplate
|
|
121
|
-
}), [settings, hasUploadPermissions, reusableBlocks, userPatternCategories, blockPatterns, blockPatternCategories, canUseUnfilteredHTML, undo, hasTemplate, createPageEntity, userCanCreatePages, pageOnFront]);
|
|
124
|
+
}), [settings, hasUploadPermissions, reusableBlocks, userPatternCategories, blockPatterns, blockPatternCategories, canUseUnfilteredHTML, undo, hasTemplate, createPageEntity, userCanCreatePages, pageOnFront, pageForPosts]);
|
|
122
125
|
}
|
|
123
126
|
export default useBlockEditorSettings;
|
|
124
127
|
//# sourceMappingURL=use-block-editor-settings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","useMemo","useCallback","useDispatch","useSelect","store","coreStore","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","__","inserterMediaCategories","mediaUpload","editorStore","EMPTY_BLOCKS_LIST","BLOCK_EDITOR_SETTINGS","useBlockEditorSettings","settings","hasTemplate","_settings$__experimen","_settings$__experimen2","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","postType","userPatternCategories","select","_canUser","canUserUseUnfilteredHTML","getCurrentPostType","isWeb","OS","canUser","getEntityRecord","getUserPatternCategories","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","__experimentalReusableBlocks","__experimentalUserPatternCategories","search","searchOptions","__experimentalFetchRichUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot"],"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Platform, useMemo, useCallback } 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 inserterMediaCategories from '../media-categories';\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\n\nconst EMPTY_BLOCKS_LIST = [];\n\nconst BLOCK_EDITOR_SETTINGS = [\n\t'__experimentalBlockDirectory',\n\t'__experimentalDiscussionSettings',\n\t'__experimentalFeatures',\n\t'__experimentalGlobalStylesBaseStyles',\n\t'__experimentalPreferredStyleVariations',\n\t'__experimentalSetIsInserterOpened',\n\t'__unstableGalleryWithImageBlocks',\n\t'alignWide',\n\t'allowedBlockTypes',\n\t'blockInspectorTabs',\n\t'allowedMimeTypes',\n\t'bodyPlaceholder',\n\t'canLockBlocks',\n\t'capabilities',\n\t'clearBlockSelection',\n\t'codeEditingEnabled',\n\t'colors',\n\t'disableCustomColors',\n\t'disableCustomFontSizes',\n\t'disableCustomSpacingSizes',\n\t'disableCustomGradients',\n\t'disableLayoutStyles',\n\t'enableCustomLineHeight',\n\t'enableCustomSpacing',\n\t'enableCustomUnits',\n\t'enableOpenverseMediaCategory',\n\t'focusMode',\n\t'distractionFree',\n\t'fontSizes',\n\t'gradients',\n\t'generateAnchors',\n\t'hasFixedToolbar',\n\t'hasInlineToolbar',\n\t'isDistractionFree',\n\t'imageDefaultSize',\n\t'imageDimensions',\n\t'imageEditing',\n\t'imageSizes',\n\t'isRTL',\n\t'keepCaretInsideBlock',\n\t'locale',\n\t'maxWidth',\n\t'onUpdateDefaultBlockStyles',\n\t'postContentAttributes',\n\t'postsPerPage',\n\t'readOnly',\n\t'styles',\n\t'template',\n\t'templateLock',\n\t'titlePlaceholder',\n\t'supportsLayout',\n\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t'__unstableHasCustomAppender',\n\t'__unstableIsPreviewMode',\n\t'__unstableResolvedAssets',\n\t'__unstableIsBlockBasedTheme',\n];\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\tuserPatternCategories,\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, getUserPatternCategories } =\n\t\t\tselect( 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\tuserPatternCategories: getUserPatternCategories(),\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 = useCallback(\n\t\t( options ) => {\n\t\t\tif ( ! userCanCreatePages ) {\n\t\t\t\treturn Promise.reject( {\n\t\t\t\t\tmessage: __(\n\t\t\t\t\t\t'You do not have permission to create Pages.'\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t\t},\n\t\t[ saveEntityRecord, userCanCreatePages ]\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\tBLOCK_EDITOR_SETTINGS.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__experimentalUserPatternCategories: userPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\tinserterMediaCategories,\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\tuserPatternCategories,\n\t\t\tblockPatterns,\n\t\t\tblockPatternCategories,\n\t\t\tcanUseUnfilteredHTML,\n\t\t\tundo,\n\t\t\thasTemplate,\n\t\t\tcreatePageEntity,\n\t\t\tuserCanCreatePages,\n\t\t\tpageOnFront,\n\t\t]\n\t);\n}\n\nexport default useBlockEditorSettings;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,OAAO,EAAEC,WAAW,QAAQ,oBAAoB;AACnE,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SACCC,KAAK,IAAIC,SAAS,EAClBC,kCAAkC,IAAIC,oBAAoB,EAC1DC,0BAA0B,IAAIC,YAAY,QACpC,sBAAsB;AAC7B,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,qBAAqB;AACzD,SAASC,WAAW,QAAQ,aAAa;AACzC,SAASR,KAAK,IAAIS,WAAW,QAAQ,aAAa;AAElD,MAAMC,iBAAiB,GAAG,EAAE;AAE5B,MAAMC,qBAAqB,GAAG,CAC7B,8BAA8B,EAC9B,kCAAkC,EAClC,wBAAwB,EACxB,sCAAsC,EACtC,wCAAwC,EACxC,mCAAmC,EACnC,kCAAkC,EAClC,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,QAAQ,EACR,qBAAqB,EACrB,wBAAwB,EACxB,2BAA2B,EAC3B,wBAAwB,EACxB,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACnB,8BAA8B,EAC9B,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,OAAO,EACP,sBAAsB,EACtB,QAAQ,EACR,UAAU,E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A2B,EAAEQ,aAAa;IAC1CL,oCAAoC,EAAEiB,sBAAsB;IAC5Da,mCAAmC,EAAElD,qBAAqB;IAC1DrB,kCAAkC,EAAEA,CAAEwE,MAAM,EAAEC,aAAa,KAC1DxE,oBAAoB,CAAEuE,MAAM,EAAEC,aAAa,EAAE9D,QAAS,CAAC;IACxDN,uBAAuB;IACvBqE,8BAA8B,EAAEvE,YAAY;IAC5CwE,sCAAsC,EAAE1D,oBAAoB;IAC5D2D,kBAAkB,EAAEjB,IAAI;IACxBkB,WAAW,EAAEjE,WAAW;IACxBkE,8BAA8B,EAAEjB,gBAAgB;IAChDkB,gCAAgC,EAAE7D,kBAAkB;IACpDC,WAAW;IACX6D,kCAAkC,EAAEpE;EACrC,CAAC,CAAE,EACH,CACCD,QAAQ,EACRK,oBAAoB,EACpBD,cAAc,EACdM,qBAAqB,EACrByB,aAAa,EACbY,sBAAsB,EACtBzC,oBAAoB,EACpB0C,IAAI,EACJ/C,WAAW,EACXiD,gBAAgB,EAChB3C,kBAAkB,EAClBC,WAAW,CAEb,CAAC;AACF;AAEA,eAAeT,sBAAsB"}
|
|
1
|
+
{"version":3,"names":["Platform","useMemo","useCallback","useDispatch","useSelect","store","coreStore","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","__","inserterMediaCategories","mediaUpload","editorStore","EMPTY_BLOCKS_LIST","BLOCK_EDITOR_SETTINGS","useBlockEditorSettings","settings","hasTemplate","_settings$__experimen","_settings$__experimen2","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","pageForPosts","postType","userPatternCategories","select","_canUser","canUserUseUnfilteredHTML","getCurrentPostType","isWeb","OS","canUser","getEntityRecord","getUserPatternCategories","siteSettings","undefined","getEntityRecords","per_page","page_on_front","page_for_posts","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","__experimentalReusableBlocks","__experimentalUserPatternCategories","search","searchOptions","__experimentalFetchRichUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot"],"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Platform, useMemo, useCallback } 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 inserterMediaCategories from '../media-categories';\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\n\nconst EMPTY_BLOCKS_LIST = [];\n\nconst BLOCK_EDITOR_SETTINGS = [\n\t'__experimentalBlockDirectory',\n\t'__experimentalDiscussionSettings',\n\t'__experimentalFeatures',\n\t'__experimentalGlobalStylesBaseStyles',\n\t'__experimentalPreferredStyleVariations',\n\t'__experimentalSetIsInserterOpened',\n\t'__unstableGalleryWithImageBlocks',\n\t'alignWide',\n\t'allowedBlockTypes',\n\t'blockInspectorTabs',\n\t'allowedMimeTypes',\n\t'bodyPlaceholder',\n\t'canLockBlocks',\n\t'capabilities',\n\t'clearBlockSelection',\n\t'codeEditingEnabled',\n\t'colors',\n\t'disableCustomColors',\n\t'disableCustomFontSizes',\n\t'disableCustomSpacingSizes',\n\t'disableCustomGradients',\n\t'disableLayoutStyles',\n\t'enableCustomLineHeight',\n\t'enableCustomSpacing',\n\t'enableCustomUnits',\n\t'enableOpenverseMediaCategory',\n\t'focusMode',\n\t'distractionFree',\n\t'fontSizes',\n\t'gradients',\n\t'generateAnchors',\n\t'hasFixedToolbar',\n\t'hasInlineToolbar',\n\t'isDistractionFree',\n\t'imageDefaultSize',\n\t'imageDimensions',\n\t'imageEditing',\n\t'imageSizes',\n\t'isRTL',\n\t'keepCaretInsideBlock',\n\t'locale',\n\t'maxWidth',\n\t'onUpdateDefaultBlockStyles',\n\t'postContentAttributes',\n\t'postsPerPage',\n\t'readOnly',\n\t'styles',\n\t'template',\n\t'templateLock',\n\t'titlePlaceholder',\n\t'supportsLayout',\n\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t'__unstableHasCustomAppender',\n\t'__unstableIsPreviewMode',\n\t'__unstableResolvedAssets',\n\t'__unstableIsBlockBasedTheme',\n];\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\tpageForPosts,\n\t\tpostType,\n\t\tuserPatternCategories,\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, getUserPatternCategories } =\n\t\t\tselect( 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\tpageForPosts: siteSettings?.page_for_posts,\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tuserPatternCategories: getUserPatternCategories(),\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 = useCallback(\n\t\t( options ) => {\n\t\t\tif ( ! userCanCreatePages ) {\n\t\t\t\treturn Promise.reject( {\n\t\t\t\t\tmessage: __(\n\t\t\t\t\t\t'You do not have permission to create Pages.'\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t\t},\n\t\t[ saveEntityRecord, userCanCreatePages ]\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\tBLOCK_EDITOR_SETTINGS.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__experimentalUserPatternCategories: userPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\tinserterMediaCategories,\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\tpageForPosts,\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\tuserPatternCategories,\n\t\t\tblockPatterns,\n\t\t\tblockPatternCategories,\n\t\t\tcanUseUnfilteredHTML,\n\t\t\tundo,\n\t\t\thasTemplate,\n\t\t\tcreatePageEntity,\n\t\t\tuserCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\tpageForPosts,\n\t\t]\n\t);\n}\n\nexport default useBlockEditorSettings;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,OAAO,EAAEC,WAAW,QAAQ,oBAAoB;AACnE,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SACCC,KAAK,IAAIC,SAAS,EAClBC,kCAAkC,IAAIC,oBAAoB,EAC1DC,0BAA0B,IAAIC,YAAY,QACpC,sBAAsB;AAC7B,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,qBAAqB;AACzD,SAASC,WAAW,QAAQ,aAAa;AACzC,SAASR,KAAK,IAAIS,WAAW,QAAQ,aAAa;AAElD,MAAMC,iBAAiB,GAAG,EAAE;AAE5B,MAAMC,qBAAqB,GAAG,CAC7B,8BAA8B,EAC9B,kCAAkC,EAClC,wBAAwB,EACxB,sCAAsC,EACtC,wCAAwC,EACxC,mCAAmC,EACnC,kCAAkC,EAClC,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,QAAQ,EACR,qBAAqB,EACrB,wBAAwB,EACxB,2BAA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lyForCoreModules('I know using unstable features means my
|
|
8
|
+
} = __dangerousOptInToUnstableAPIsOnlyForCoreModules('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/editor');
|
|
9
9
|
//# sourceMappingURL=lock-unlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__dangerousOptInToUnstableAPIsOnlyForCoreModules","lock","unlock"],"sources":["@wordpress/editor/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my
|
|
1
|
+
{"version":3,"names":["__dangerousOptInToUnstableAPIsOnlyForCoreModules","lock","unlock"],"sources":["@wordpress/editor/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',\n\t\t'@wordpress/editor'\n\t);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gDAAgD,QAAQ,yBAAyB;AAC1F,OAAO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5BF,gDAAgD,CAC/C,iHAAiH,EACjH,mBACD,CAAC"}
|
|
@@ -27,20 +27,19 @@ export function getNotificationArgumentsForSaveSuccess(data) {
|
|
|
27
27
|
if (data.options?.isAutosave) {
|
|
28
28
|
return [];
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
// No notice is shown after trashing a post
|
|
32
|
-
if (post.status === 'trash' && previousPost.status !== 'trash') {
|
|
33
|
-
return [];
|
|
34
|
-
}
|
|
35
30
|
const publishStatus = ['publish', 'private', 'future'];
|
|
36
31
|
const isPublished = publishStatus.includes(previousPost.status);
|
|
37
32
|
const willPublish = publishStatus.includes(post.status);
|
|
33
|
+
const willTrash = post.status === 'trash' && previousPost.status !== 'trash';
|
|
38
34
|
let noticeMessage;
|
|
39
35
|
let shouldShowLink = (_postType$viewable = postType?.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false;
|
|
40
36
|
let isDraft;
|
|
41
37
|
|
|
42
38
|
// Always should a notice, which will be spoken for accessibility.
|
|
43
|
-
if (
|
|
39
|
+
if (willTrash) {
|
|
40
|
+
noticeMessage = postType.labels.item_trashed;
|
|
41
|
+
shouldShowLink = false;
|
|
42
|
+
} else if (!isPublished && !willPublish) {
|
|
44
43
|
// If saving a non-published post, don't show notice.
|
|
45
44
|
noticeMessage = __('Draft saved.');
|
|
46
45
|
isDraft = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","SAVE_POST_NOTICE_ID","TRASH_POST_NOTICE_ID","getNotificationArgumentsForSaveSuccess","data","_postType$viewable","previousPost","post","postType","options","isAutosave","
|
|
1
|
+
{"version":3,"names":["__","SAVE_POST_NOTICE_ID","TRASH_POST_NOTICE_ID","getNotificationArgumentsForSaveSuccess","data","_postType$viewable","previousPost","post","postType","options","isAutosave","publishStatus","isPublished","includes","status","willPublish","willTrash","noticeMessage","shouldShowLink","viewable","isDraft","labels","item_trashed","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"],"sources":["@wordpress/editor/src/store/utils/notice-builder.js"],"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 * 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 ( data.options?.isAutosave ) {\n\t\treturn [];\n\t}\n\n\tconst publishStatus = [ 'publish', 'private', 'future' ];\n\tconst isPublished = publishStatus.includes( previousPost.status );\n\tconst willPublish = publishStatus.includes( post.status );\n\tconst willTrash =\n\t\tpost.status === 'trash' && previousPost.status !== 'trash';\n\n\tlet noticeMessage;\n\tlet shouldShowLink = postType?.viewable ?? false;\n\tlet isDraft;\n\n\t// Always should a notice, which will be spoken for accessibility.\n\tif ( willTrash ) {\n\t\tnoticeMessage = postType.labels.item_trashed;\n\t\tshouldShowLink = false;\n\t} else if ( ! isPublished && ! willPublish ) {\n\t\t// If saving a non-published post, don't show notice.\n\t\tnoticeMessage = __( 'Draft saved.' );\n\t\tisDraft = true;\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: isDraft ? __( 'View Preview' ) : 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"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,mBAAmB,EAAEC,oBAAoB,QAAQ,cAAc;;AAExE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC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,CAAEH,KAAK,CAAC1B,MAAO,CAAC,KAAK,CAAC,CAAC,GAC1D8B,QAAQ,CAAEJ,KAAK,CAAC1B,MAAM,CAAE,GACxBd,EAAE,CAAE,kBAAmB,CAAC;;EAE5B;EACA;EACA,IAAKyC,KAAK,CAACI,OAAO,IAAI,CAAE,YAAY,CAACC,IAAI,CAAEL,KAAK,CAACI,OAAQ,CAAC,EAAG;IAC5D5B,aAAa,GAAG,CAAEA,aAAa,EAAEwB,KAAK,CAACI,OAAO,CAAE,CAACE,IAAI,CAAE,GAAI,CAAC;EAC7D;EACA,OAAO,CACN9B,aAAa,EACb;IACCoB,EAAE,EAAEpC;EACL,CAAC,CACD;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS+C,oCAAoCA,CAAE5C,IAAI,EAAG;EAC5D,OAAO,CACNA,IAAI,CAACqC,KAAK,CAACI,OAAO,IAAIzC,IAAI,CAACqC,KAAK,CAACC,IAAI,KAAK,eAAe,GACtDtC,IAAI,CAACqC,KAAK,CAACI,OAAO,GAClB7C,EAAE,CAAE,iBAAkB,CAAC,EAC1B;IACCqC,EAAE,EAAEnC;EACL,CAAC,CACD;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.21.1-next.f8d8eceb.0",
|
|
4
4
|
"description": "Enhanced block editor for WordPress posts.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -31,35 +31,35 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.16.0",
|
|
34
|
-
"@wordpress/a11y": "^3.
|
|
35
|
-
"@wordpress/api-fetch": "^6.
|
|
36
|
-
"@wordpress/blob": "^3.
|
|
37
|
-
"@wordpress/block-editor": "^12.
|
|
38
|
-
"@wordpress/blocks": "^12.
|
|
39
|
-
"@wordpress/components": "^25.
|
|
40
|
-
"@wordpress/compose": "^6.
|
|
41
|
-
"@wordpress/core-data": "^6.
|
|
42
|
-
"@wordpress/data": "^9.
|
|
43
|
-
"@wordpress/date": "^4.
|
|
44
|
-
"@wordpress/deprecated": "^3.
|
|
45
|
-
"@wordpress/dom": "^3.
|
|
46
|
-
"@wordpress/element": "^5.
|
|
47
|
-
"@wordpress/hooks": "^3.
|
|
48
|
-
"@wordpress/html-entities": "^3.
|
|
49
|
-
"@wordpress/i18n": "^4.
|
|
50
|
-
"@wordpress/icons": "^9.
|
|
51
|
-
"@wordpress/keyboard-shortcuts": "^4.
|
|
52
|
-
"@wordpress/keycodes": "^3.
|
|
53
|
-
"@wordpress/media-utils": "^4.
|
|
54
|
-
"@wordpress/notices": "^4.
|
|
55
|
-
"@wordpress/patterns": "^1.
|
|
56
|
-
"@wordpress/preferences": "^3.
|
|
57
|
-
"@wordpress/private-apis": "^0.
|
|
58
|
-
"@wordpress/reusable-blocks": "^4.
|
|
59
|
-
"@wordpress/rich-text": "^6.
|
|
60
|
-
"@wordpress/server-side-render": "^4.
|
|
61
|
-
"@wordpress/url": "^3.
|
|
62
|
-
"@wordpress/wordcount": "^3.
|
|
34
|
+
"@wordpress/a11y": "^3.44.1-next.f8d8eceb.0",
|
|
35
|
+
"@wordpress/api-fetch": "^6.41.1-next.f8d8eceb.0",
|
|
36
|
+
"@wordpress/blob": "^3.44.1-next.f8d8eceb.0",
|
|
37
|
+
"@wordpress/block-editor": "^12.12.2-next.f8d8eceb.0",
|
|
38
|
+
"@wordpress/blocks": "^12.21.1-next.f8d8eceb.0",
|
|
39
|
+
"@wordpress/components": "^25.11.1-next.f8d8eceb.0",
|
|
40
|
+
"@wordpress/compose": "^6.21.1-next.f8d8eceb.0",
|
|
41
|
+
"@wordpress/core-data": "^6.21.1-next.f8d8eceb.0",
|
|
42
|
+
"@wordpress/data": "^9.14.1-next.f8d8eceb.0",
|
|
43
|
+
"@wordpress/date": "^4.44.1-next.f8d8eceb.0",
|
|
44
|
+
"@wordpress/deprecated": "^3.44.1-next.f8d8eceb.0",
|
|
45
|
+
"@wordpress/dom": "^3.44.1-next.f8d8eceb.0",
|
|
46
|
+
"@wordpress/element": "^5.21.1-next.f8d8eceb.0",
|
|
47
|
+
"@wordpress/hooks": "^3.44.1-next.f8d8eceb.0",
|
|
48
|
+
"@wordpress/html-entities": "^3.44.1-next.f8d8eceb.0",
|
|
49
|
+
"@wordpress/i18n": "^4.44.1-next.f8d8eceb.0",
|
|
50
|
+
"@wordpress/icons": "^9.35.1-next.f8d8eceb.0",
|
|
51
|
+
"@wordpress/keyboard-shortcuts": "^4.21.1-next.f8d8eceb.0",
|
|
52
|
+
"@wordpress/keycodes": "^3.44.1-next.f8d8eceb.0",
|
|
53
|
+
"@wordpress/media-utils": "^4.35.1-next.f8d8eceb.0",
|
|
54
|
+
"@wordpress/notices": "^4.12.1-next.f8d8eceb.0",
|
|
55
|
+
"@wordpress/patterns": "^1.5.1-next.f8d8eceb.0",
|
|
56
|
+
"@wordpress/preferences": "^3.21.1-next.f8d8eceb.0",
|
|
57
|
+
"@wordpress/private-apis": "^0.26.1-next.f8d8eceb.0",
|
|
58
|
+
"@wordpress/reusable-blocks": "^4.21.1-next.f8d8eceb.0",
|
|
59
|
+
"@wordpress/rich-text": "^6.21.1-next.f8d8eceb.0",
|
|
60
|
+
"@wordpress/server-side-render": "^4.21.1-next.f8d8eceb.0",
|
|
61
|
+
"@wordpress/url": "^3.45.1-next.f8d8eceb.0",
|
|
62
|
+
"@wordpress/wordcount": "^3.44.1-next.f8d8eceb.0",
|
|
63
63
|
"classnames": "^2.3.1",
|
|
64
64
|
"date-fns": "^2.28.0",
|
|
65
65
|
"memize": "^2.1.0",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "8d8fd197e202b8104ffb1cb83048efd0a6c3faf4"
|
|
78
78
|
}
|
|
@@ -93,6 +93,7 @@ function useBlockEditorSettings( settings, hasTemplate ) {
|
|
|
93
93
|
canUseUnfilteredHTML,
|
|
94
94
|
userCanCreatePages,
|
|
95
95
|
pageOnFront,
|
|
96
|
+
pageForPosts,
|
|
96
97
|
postType,
|
|
97
98
|
userPatternCategories,
|
|
98
99
|
} = useSelect( ( select ) => {
|
|
@@ -118,6 +119,7 @@ function useBlockEditorSettings( settings, hasTemplate ) {
|
|
|
118
119
|
hasUploadPermissions: canUser( 'create', 'media' ) ?? true,
|
|
119
120
|
userCanCreatePages: canUser( 'create', 'pages' ),
|
|
120
121
|
pageOnFront: siteSettings?.page_on_front,
|
|
122
|
+
pageForPosts: siteSettings?.page_for_posts,
|
|
121
123
|
postType: getCurrentPostType(),
|
|
122
124
|
userPatternCategories: getUserPatternCategories(),
|
|
123
125
|
};
|
|
@@ -218,6 +220,7 @@ function useBlockEditorSettings( settings, hasTemplate ) {
|
|
|
218
220
|
__experimentalCreatePageEntity: createPageEntity,
|
|
219
221
|
__experimentalUserCanCreatePages: userCanCreatePages,
|
|
220
222
|
pageOnFront,
|
|
223
|
+
pageForPosts,
|
|
221
224
|
__experimentalPreferPatternsOnRoot: hasTemplate,
|
|
222
225
|
} ),
|
|
223
226
|
[
|
|
@@ -233,6 +236,7 @@ function useBlockEditorSettings( settings, hasTemplate ) {
|
|
|
233
236
|
createPageEntity,
|
|
234
237
|
userCanCreatePages,
|
|
235
238
|
pageOnFront,
|
|
239
|
+
pageForPosts,
|
|
236
240
|
]
|
|
237
241
|
);
|
|
238
242
|
}
|
package/src/lock-unlock.js
CHANGED
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';
|
|
5
5
|
export const { lock, unlock } =
|
|
6
6
|
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
|
|
7
|
-
'I know using unstable features means my
|
|
7
|
+
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
|
|
8
8
|
'@wordpress/editor'
|
|
9
9
|
);
|
|
@@ -33,6 +33,7 @@ const postTypeEntity = {
|
|
|
33
33
|
item_updated: 'Updated Post',
|
|
34
34
|
item_published: 'Post published',
|
|
35
35
|
item_reverted_to_draft: 'Post reverted to draft.',
|
|
36
|
+
item_trashed: 'Post trashed.',
|
|
36
37
|
},
|
|
37
38
|
};
|
|
38
39
|
|
|
@@ -286,7 +287,12 @@ describe( 'Post actions', () => {
|
|
|
286
287
|
|
|
287
288
|
// Check that there are no notices.
|
|
288
289
|
const notices = registry.select( noticesStore ).getNotices();
|
|
289
|
-
expect( notices ).
|
|
290
|
+
expect( notices ).toMatchObject( [
|
|
291
|
+
{
|
|
292
|
+
status: 'success',
|
|
293
|
+
content: 'Post trashed.',
|
|
294
|
+
},
|
|
295
|
+
] );
|
|
290
296
|
|
|
291
297
|
// Check the new status.
|
|
292
298
|
const { status } = registry.select( editorStore ).getCurrentPost();
|
|
@@ -23,21 +23,21 @@ export function getNotificationArgumentsForSaveSuccess( data ) {
|
|
|
23
23
|
return [];
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
// No notice is shown after trashing a post
|
|
27
|
-
if ( post.status === 'trash' && previousPost.status !== 'trash' ) {
|
|
28
|
-
return [];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
26
|
const publishStatus = [ 'publish', 'private', 'future' ];
|
|
32
27
|
const isPublished = publishStatus.includes( previousPost.status );
|
|
33
28
|
const willPublish = publishStatus.includes( post.status );
|
|
29
|
+
const willTrash =
|
|
30
|
+
post.status === 'trash' && previousPost.status !== 'trash';
|
|
34
31
|
|
|
35
32
|
let noticeMessage;
|
|
36
33
|
let shouldShowLink = postType?.viewable ?? false;
|
|
37
34
|
let isDraft;
|
|
38
35
|
|
|
39
36
|
// Always should a notice, which will be spoken for accessibility.
|
|
40
|
-
if (
|
|
37
|
+
if ( willTrash ) {
|
|
38
|
+
noticeMessage = postType.labels.item_trashed;
|
|
39
|
+
shouldShowLink = false;
|
|
40
|
+
} else if ( ! isPublished && ! willPublish ) {
|
|
41
41
|
// If saving a non-published post, don't show notice.
|
|
42
42
|
noticeMessage = __( 'Draft saved.' );
|
|
43
43
|
isDraft = true;
|
|
@@ -17,6 +17,7 @@ describe( 'getNotificationArgumentsForSaveSuccess()', () => {
|
|
|
17
17
|
item_scheduled: 'scheduled',
|
|
18
18
|
item_updated: 'updated',
|
|
19
19
|
view_item: 'view',
|
|
20
|
+
item_trashed: 'trash',
|
|
20
21
|
},
|
|
21
22
|
viewable: false,
|
|
22
23
|
};
|
|
@@ -74,7 +75,11 @@ describe( 'getNotificationArgumentsForSaveSuccess()', () => {
|
|
|
74
75
|
},
|
|
75
76
|
],
|
|
76
77
|
],
|
|
77
|
-
[
|
|
78
|
+
[
|
|
79
|
+
'when post will be trashed',
|
|
80
|
+
[ 'publish', 'trash', true ],
|
|
81
|
+
[ 'trash', defaultExpectedAction ],
|
|
82
|
+
],
|
|
78
83
|
].forEach(
|
|
79
84
|
( [
|
|
80
85
|
description,
|