@wordpress/editor 12.0.21 → 12.2.1-next.f435e9e01b.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 +16 -0
- package/LICENSE.md +1 -1
- package/README.md +7 -1
- package/build/components/deprecated.js +5 -5
- package/build/components/deprecated.js.map +1 -1
- package/build/components/editor-help/add-blocks.native.js +1 -1
- package/build/components/editor-help/add-blocks.native.js.map +1 -1
- package/build/components/editor-help/index.native.js +1 -1
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/entities-saved-states/index.js +18 -16
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/index.js +18 -0
- package/build/components/index.js.map +1 -1
- package/build/components/post-format/index.js +6 -4
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-locked-modal/index.js +34 -25
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js +81 -0
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -0
- package/build/components/post-publish-panel/prepublish.js +3 -1
- package/build/components/post-publish-panel/prepublish.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js +3 -3
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-title/index.native.js +1 -0
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-trash/index.js +1 -1
- package/build/components/post-trash/index.js.map +1 -1
- package/build/components/post-visibility/index.js +30 -14
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/provider/index.native.js +12 -6
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +11 -6
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/store/actions.js +21 -15
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +12 -39
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils/notice-builder.js +1 -1
- package/build/store/utils/notice-builder.js.map +1 -1
- package/build-module/components/deprecated.js +5 -4
- package/build-module/components/deprecated.js.map +1 -1
- package/build-module/components/editor-help/add-blocks.native.js +1 -1
- package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/index.native.js +1 -1
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +19 -16
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/index.js +2 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/post-format/index.js +7 -5
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js +37 -25
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +66 -0
- package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -0
- package/build-module/components/post-publish-panel/prepublish.js +2 -1
- package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js +3 -3
- package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build-module/components/post-title/index.native.js +1 -0
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-trash/index.js +1 -1
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/post-visibility/index.js +31 -15
- package/build-module/components/post-visibility/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +10 -7
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +11 -6
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/store/actions.js +21 -15
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +10 -35
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils/notice-builder.js +1 -1
- package/build-module/store/utils/notice-builder.js.map +1 -1
- package/build-style/style-rtl.css +9 -27
- package/build-style/style.css +9 -27
- package/package.json +31 -30
- package/src/components/autosave-monitor/test/index.js +1 -1
- package/src/components/deprecated.js +2 -5
- package/src/components/editor-help/add-blocks.native.js +1 -1
- package/src/components/editor-help/index.native.js +1 -1
- package/src/components/entities-saved-states/index.js +21 -15
- package/src/components/entities-saved-states/style.scss +0 -12
- package/src/components/index.js +2 -0
- package/src/components/post-format/index.js +9 -10
- package/src/components/post-locked-modal/index.js +92 -53
- package/src/components/post-locked-modal/style.scss +7 -17
- package/src/components/post-publish-panel/maybe-category-panel.js +88 -0
- package/src/components/post-publish-panel/prepublish.js +2 -0
- package/src/components/post-taxonomies/README.md +25 -1
- package/src/components/post-taxonomies/most-used-terms.js +3 -3
- package/src/components/post-title/index.native.js +1 -0
- package/src/components/post-trash/index.js +1 -1
- package/src/components/post-visibility/index.js +25 -11
- package/src/components/provider/index.native.js +10 -7
- package/src/components/provider/use-block-editor-settings.js +14 -4
- package/src/store/actions.js +18 -23
- package/src/store/selectors.js +9 -40
- package/src/store/test/actions.js +1 -41
- package/src/store/utils/notice-builder.js +1 -1
- package/src/store/utils/test/notice-builder.js +1 -1
|
@@ -33,6 +33,12 @@ var _blockLibrary = require("@wordpress/block-library");
|
|
|
33
33
|
|
|
34
34
|
var _editor = require("@wordpress/editor");
|
|
35
35
|
|
|
36
|
+
var _notices = require("@wordpress/notices");
|
|
37
|
+
|
|
38
|
+
var _coreData = require("@wordpress/core-data");
|
|
39
|
+
|
|
40
|
+
var _editPost = require("@wordpress/edit-post");
|
|
41
|
+
|
|
36
42
|
var _index = _interopRequireDefault(require("./index.js"));
|
|
37
43
|
|
|
38
44
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -325,10 +331,10 @@ var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
|
|
|
325
331
|
getEditorBlocks,
|
|
326
332
|
getEditedPostAttribute,
|
|
327
333
|
getEditedPostContent
|
|
328
|
-
} = select(
|
|
334
|
+
} = select(_editor.store);
|
|
329
335
|
const {
|
|
330
336
|
getEditorMode
|
|
331
|
-
} = select(
|
|
337
|
+
} = select(_editPost.store);
|
|
332
338
|
const {
|
|
333
339
|
getBlockIndex,
|
|
334
340
|
getSelectedBlockClientId,
|
|
@@ -351,7 +357,7 @@ var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
|
|
|
351
357
|
const {
|
|
352
358
|
editPost,
|
|
353
359
|
resetEditorBlocks
|
|
354
|
-
} = dispatch(
|
|
360
|
+
} = dispatch(_editor.store);
|
|
355
361
|
const {
|
|
356
362
|
updateSettings,
|
|
357
363
|
clearSelectedBlock,
|
|
@@ -360,14 +366,14 @@ var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
|
|
|
360
366
|
} = dispatch(_blockEditor.store);
|
|
361
367
|
const {
|
|
362
368
|
switchEditorMode
|
|
363
|
-
} = dispatch(
|
|
369
|
+
} = dispatch(_editPost.store);
|
|
364
370
|
const {
|
|
365
371
|
addEntities,
|
|
366
372
|
receiveEntityRecords
|
|
367
|
-
} = dispatch(
|
|
373
|
+
} = dispatch(_coreData.store);
|
|
368
374
|
const {
|
|
369
375
|
createSuccessNotice
|
|
370
|
-
} = dispatch(
|
|
376
|
+
} = dispatch(_notices.store);
|
|
371
377
|
return {
|
|
372
378
|
updateSettings,
|
|
373
379
|
addEntities,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/provider/index.native.js"],"names":["postTypeEntities","name","baseURL","map","postTypeEntity","kind","transientEdits","blocks","selection","mergedEdits","meta","rawAttributes","NativeEditorProvider","Component","constructor","arguments","post","props","addEntities","receiveEntityRecords","type","getEditorSettings","settings","capabilities","maxSize","state","isHelpVisible","componentDidMount","locale","updateSettings","getThemeColors","subscriptionParentGetHtml","serializeToNativeAction","subscriptionParentToggleHTMLMode","toggleMode","subscriptionParentSetTitle","payload","editTitle","title","subscriptionParentUpdateHtml","updateHtmlAction","html","subscriptionParentReplaceBlock","replaceBlockAction","clientId","subscriptionParentMediaAppend","blockName","mediaType","newBlock","id","mediaId","mediaUrl","indexAfterSelected","selectedBlockIndex","insertionIndex","blockCount","insertBlock","subscriptionParentUpdateEditorSettings","galleryWithImageBlocks","editorSettings","window","wp","galleryBlockV2Enabled","subscriptionParentUpdateCapabilities","updateCapabilitiesAction","subscriptionParentShowNotice","createSuccessNotice","message","subscriptionParentShowEditorHelp","setState","storedImpressions","impressions","NEW_BLOCK_TYPES","storedImpressionKeys","Object","keys","storedImpressionsCurrent","every","newKey","includes","componentWillUnmount","remove","colors","gradients","rawStyles","rawFeatures","componentDidUpdate","prevProps","isReady","isUnsupportedBlock","unsupportedBlockNames","filter","block","attributes","originalName","RNReactNativeGutenbergBridge","editorDidMount","mode","hasChanges","raw","content","contentInfo","characterCount","wordCount","paragraphCount","provideToNative_Html","parsed","resetEditorBlocksWithoutUndoLevel","blockClientId","replaceBlock","switchMode","clearSelectedBlock","render","children","select","__unstableIsEditorReady","isEditorReady","getEditorBlocks","getEditedPostAttribute","getEditedPostContent","getEditorMode","getBlockIndex","getSelectedBlockClientId","getGlobalBlockCount","getSettings","getBlockEditorSettings","blockEditorStore","selectedBlockClientId","dispatch","editPost","resetEditorBlocks","switchEditorMode","__unstableShouldCreateUndoLevel"],"mappings":";;;;;;;;;AAsBA;;;;AAnBA;;AAKA;;AAeA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAmBA;;AAKA;;;;;;AA/DA;AACA;AACA;;AAGA;AACA;AACA;AAkCA,MAAMA,gBAAgB,GAAG,CACxB;AAAEC,EAAAA,IAAI,EAAE,MAAR;AAAgBC,EAAAA,OAAO,EAAE;AAAzB,CADwB,EAExB;AAAED,EAAAA,IAAI,EAAE,MAAR;AAAgBC,EAAAA,OAAO,EAAE;AAAzB,CAFwB,EAGxB;AAAED,EAAAA,IAAI,EAAE,YAAR;AAAsBC,EAAAA,OAAO,EAAE;AAA/B,CAHwB,EAIxB;AAAED,EA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QAAQ,CAAEF,kBAAF,CALZ;AAMA,QAAM;AAAEK,IAAAA;AAAF,MAAuBH,QAAQ,CAAE,gBAAF,CAArC;AACA,QAAM;AAAE9G,IAAAA,WAAF;AAAeC,IAAAA;AAAf,MAAwC6G,QAAQ,CAAE,MAAF,CAAtD;AACA,QAAM;AAAE9D,IAAAA;AAAF,MAA0B8D,QAAQ,CAAE,cAAF,CAAxC;AAEA,SAAO;AACNnG,IAAAA,cADM;AAENX,IAAAA,WAFM;AAGN6F,IAAAA,kBAHM;AAINvD,IAAAA,WAJM;AAKNU,IAAAA,mBALM;;AAMN7B,IAAAA,SAAS,CAAEC,KAAF,EAAU;AAClB2F,MAAAA,QAAQ,CAAE;AAAE3F,QAAAA;AAAF,OAAF,CAAR;AACA,KARK;;AASNnB,IAAAA,oBATM;;AAUNwF,IAAAA,iCAAiC,CAAEpG,MAAF,EAAW;AAC3C2H,MAAAA,iBAAiB,CAAE3H,MAAF,EAAU;AAC1B6H,QAAAA,+BAA+B,EAAE;AADP,OAAV,CAAjB;AAGA,KAdK;;AAeNtB,IAAAA,UAAU,CAAEb,IAAF,EAAS;AAClBkC,MAAAA,gBAAgB,CAAElC,IAAF,CAAhB;AACA,KAjBK;;AAkBNY,IAAAA;AAlBM,GAAP;AAoBA,CAhCD,CA9BuB,CAAT,EA+DVjG,oBA/DU,C","sourcesContent":["/**\n * External dependencies\n */\nimport memize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport RNReactNativeGutenbergBridge, {\n\trequestBlockTypeImpressions,\n\tsetBlockTypeImpressions,\n\tsubscribeParentGetHtml,\n\tsubscribeParentToggleHTMLMode,\n\tsubscribeUpdateHtml,\n\tsubscribeSetTitle,\n\tsubscribeMediaAppend,\n\tsubscribeReplaceBlock,\n\tsubscribeUpdateEditorSettings,\n\tsubscribeUpdateCapabilities,\n\tsubscribeShowNotice,\n\tsubscribeShowEditorHelp,\n} from '@wordpress/react-native-bridge';\nimport { Component } from '@wordpress/element';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport {\n\tparse,\n\tserialize,\n\tgetUnregisteredTypeHandlerName,\n\tcreateBlock,\n} from '@wordpress/blocks';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { applyFilters } from '@wordpress/hooks';\nimport {\n\tvalidateThemeColors,\n\tvalidateThemeGradients,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { getGlobalStyles } from '@wordpress/components';\nimport { NEW_BLOCK_TYPES } from '@wordpress/block-library';\n\nconst postTypeEntities = [\n\t{ name: 'post', baseURL: '/wp/v2/posts' },\n\t{ name: 'page', baseURL: '/wp/v2/pages' },\n\t{ name: 'attachment', baseURL: '/wp/v2/media' },\n\t{ name: 'wp_block', baseURL: '/wp/v2/blocks' },\n].map( ( postTypeEntity ) => ( {\n\tkind: 'postType',\n\t...postTypeEntity,\n\ttransientEdits: {\n\t\tblocks: true,\n\t\tselection: true,\n\t},\n\tmergedEdits: {\n\t\tmeta: true,\n\t},\n\trawAttributes: [ 'title', 'excerpt', 'content' ],\n} ) );\nimport { EditorHelpTopics } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport EditorProvider from './index.js';\n\nclass NativeEditorProvider extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\t// Keep a local reference to `post` to detect changes\n\t\tthis.post = this.props.post;\n\t\tthis.props.addEntities( postTypeEntities );\n\t\tthis.props.receiveEntityRecords(\n\t\t\t'postType',\n\t\t\tthis.post.type,\n\t\t\tthis.post\n\t\t);\n\n\t\tthis.getEditorSettings = memize(\n\t\t\t( settings, capabilities ) => ( {\n\t\t\t\t...settings,\n\t\t\t\tcapabilities,\n\t\t\t} ),\n\t\t\t{\n\t\t\t\tmaxSize: 1,\n\t\t\t}\n\t\t);\n\t\tthis.state = {\n\t\t\tisHelpVisible: false,\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { capabilities, locale, updateSettings } = this.props;\n\n\t\tupdateSettings( {\n\t\t\t...capabilities,\n\t\t\t...this.getThemeColors( this.props ),\n\t\t\tlocale,\n\t\t} );\n\n\t\tthis.subscriptionParentGetHtml = subscribeParentGetHtml( () => {\n\t\t\tthis.serializeToNativeAction();\n\t\t} );\n\n\t\tthis.subscriptionParentToggleHTMLMode = subscribeParentToggleHTMLMode(\n\t\t\t() => {\n\t\t\t\tthis.toggleMode();\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentSetTitle = subscribeSetTitle( ( payload ) => {\n\t\t\tthis.props.editTitle( payload.title );\n\t\t} );\n\n\t\tthis.subscriptionParentUpdateHtml = subscribeUpdateHtml(\n\t\t\t( payload ) => {\n\t\t\t\tthis.updateHtmlAction( payload.html );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentReplaceBlock = subscribeReplaceBlock(\n\t\t\t( payload ) => {\n\t\t\t\tthis.replaceBlockAction( payload.html, payload.clientId );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentMediaAppend = subscribeMediaAppend(\n\t\t\t( payload ) => {\n\t\t\t\tconst blockName = 'core/' + payload.mediaType;\n\t\t\t\tconst newBlock = createBlock( blockName, {\n\t\t\t\t\tid: payload.mediaId,\n\t\t\t\t\t[ payload.mediaType === 'image'\n\t\t\t\t\t\t? 'url'\n\t\t\t\t\t\t: 'src' ]: payload.mediaUrl,\n\t\t\t\t} );\n\n\t\t\t\tconst indexAfterSelected = this.props.selectedBlockIndex + 1;\n\t\t\t\tconst insertionIndex =\n\t\t\t\t\tindexAfterSelected || this.props.blockCount;\n\n\t\t\t\tthis.props.insertBlock( newBlock, insertionIndex );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentUpdateEditorSettings = subscribeUpdateEditorSettings(\n\t\t\t( { galleryWithImageBlocks, ...editorSettings } ) => {\n\t\t\t\tif ( typeof galleryWithImageBlocks === 'boolean' ) {\n\t\t\t\t\twindow.wp.galleryBlockV2Enabled = galleryWithImageBlocks;\n\t\t\t\t}\n\t\t\t\tupdateSettings( this.getThemeColors( editorSettings ) );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentUpdateCapabilities = subscribeUpdateCapabilities(\n\t\t\t( payload ) => {\n\t\t\t\tthis.updateCapabilitiesAction( payload );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentShowNotice = subscribeShowNotice(\n\t\t\t( payload ) => {\n\t\t\t\tthis.props.createSuccessNotice( payload.message );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentShowEditorHelp = subscribeShowEditorHelp( () => {\n\t\t\tthis.setState( { isHelpVisible: true } );\n\t\t} );\n\n\t\t// Request current block impressions from native app\n\t\trequestBlockTypeImpressions( ( storedImpressions ) => {\n\t\t\tconst impressions = { ...NEW_BLOCK_TYPES, ...storedImpressions };\n\n\t\t\t// Persist impressions to JavaScript store\n\t\t\tupdateSettings( { impressions } );\n\n\t\t\t// Persist impressions to native store if they do not include latest\n\t\t\t// `NEW_BLOCK_TYPES` configuration\n\t\t\tconst storedImpressionKeys = Object.keys( storedImpressions );\n\t\t\tconst storedImpressionsCurrent = Object.keys(\n\t\t\t\tNEW_BLOCK_TYPES\n\t\t\t).every( ( newKey ) => storedImpressionKeys.includes( newKey ) );\n\t\t\tif ( ! storedImpressionsCurrent ) {\n\t\t\t\tsetBlockTypeImpressions( impressions );\n\t\t\t}\n\t\t} );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.subscriptionParentGetHtml ) {\n\t\t\tthis.subscriptionParentGetHtml.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentToggleHTMLMode ) {\n\t\t\tthis.subscriptionParentToggleHTMLMode.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentSetTitle ) {\n\t\t\tthis.subscriptionParentSetTitle.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateHtml ) {\n\t\t\tthis.subscriptionParentUpdateHtml.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentReplaceBlock ) {\n\t\t\tthis.subscriptionParentReplaceBlock.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentMediaAppend ) {\n\t\t\tthis.subscriptionParentMediaAppend.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateEditorSettings ) {\n\t\t\tthis.subscriptionParentUpdateEditorSettings.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateCapabilities ) {\n\t\t\tthis.subscriptionParentUpdateCapabilities.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentShowNotice ) {\n\t\t\tthis.subscriptionParentShowNotice.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentShowEditorHelp ) {\n\t\t\tthis.subscriptionParentShowEditorHelp.remove();\n\t\t}\n\t}\n\n\tgetThemeColors( { colors, gradients, rawStyles, rawFeatures } ) {\n\t\treturn {\n\t\t\t...( rawStyles && rawFeatures\n\t\t\t\t? getGlobalStyles( rawStyles, rawFeatures )\n\t\t\t\t: {\n\t\t\t\t\t\tcolors: validateThemeColors( colors ),\n\t\t\t\t\t\tgradients: validateThemeGradients( gradients ),\n\t\t\t\t } ),\n\t\t};\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tif ( ! prevProps.isReady && this.props.isReady ) {\n\t\t\tconst blocks = this.props.blocks;\n\t\t\tconst isUnsupportedBlock = ( { name } ) =>\n\t\t\t\tname === getUnregisteredTypeHandlerName();\n\t\t\tconst unsupportedBlockNames = blocks\n\t\t\t\t.filter( isUnsupportedBlock )\n\t\t\t\t.map( ( block ) => block.attributes.originalName );\n\t\t\tRNReactNativeGutenbergBridge.editorDidMount(\n\t\t\t\tunsupportedBlockNames\n\t\t\t);\n\t\t}\n\t}\n\n\tserializeToNativeAction() {\n\t\tconst title = this.props.title;\n\t\tlet html;\n\n\t\tif ( this.props.mode === 'text' ) {\n\t\t\t// The HTMLTextInput component does not update the store when user is doing changes\n\t\t\t// Let's request the HTML from the component's state directly\n\t\t\thtml = applyFilters( 'native.persist-html' );\n\t\t} else {\n\t\t\thtml = serialize( this.props.blocks );\n\t\t}\n\n\t\tconst hasChanges =\n\t\t\ttitle !== this.post.title.raw || html !== this.post.content.raw;\n\n\t\t// Variable to store the content structure metrics.\n\t\tconst contentInfo = {};\n\t\tcontentInfo.characterCount = wordCount(\n\t\t\thtml,\n\t\t\t'characters_including_spaces'\n\t\t);\n\t\tcontentInfo.wordCount = wordCount( html, 'words' );\n\t\tcontentInfo.paragraphCount = this.props.paragraphCount;\n\t\tcontentInfo.blockCount = this.props.blockCount;\n\t\tRNReactNativeGutenbergBridge.provideToNative_Html(\n\t\t\thtml,\n\t\t\ttitle,\n\t\t\thasChanges,\n\t\t\tcontentInfo\n\t\t);\n\n\t\tif ( hasChanges ) {\n\t\t\tthis.post.title.raw = title;\n\t\t\tthis.post.content.raw = html;\n\t\t}\n\t}\n\n\tupdateHtmlAction( html ) {\n\t\tconst parsed = parse( html );\n\t\tthis.props.resetEditorBlocksWithoutUndoLevel( parsed );\n\t}\n\n\treplaceBlockAction( html, blockClientId ) {\n\t\tconst parsed = parse( html );\n\t\tthis.props.replaceBlock( blockClientId, parsed );\n\t}\n\n\ttoggleMode() {\n\t\tconst { mode, switchMode } = this.props;\n\t\t// refresh html content first\n\t\tthis.serializeToNativeAction();\n\t\t// make sure to blur the selected block and dismiss the keyboard\n\t\tthis.props.clearSelectedBlock();\n\t\tswitchMode( mode === 'visual' ? 'text' : 'visual' );\n\t}\n\n\tupdateCapabilitiesAction( capabilities ) {\n\t\tthis.props.updateSettings( capabilities );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tchildren,\n\t\t\tpost, // eslint-disable-line no-unused-vars\n\t\t\tcapabilities,\n\t\t\tsettings,\n\t\t\t...props\n\t\t} = this.props;\n\t\tconst editorSettings = this.getEditorSettings( settings, capabilities );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorProvider\n\t\t\t\t\tpost={ this.post }\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</EditorProvider>\n\t\t\t\t<EditorHelpTopics\n\t\t\t\t\tisVisible={ this.state.isHelpVisible }\n\t\t\t\t\tonClose={ () => this.setState( { isHelpVisible: false } ) }\n\t\t\t\t\tclose={ () => this.setState( { isHelpVisible: false } ) }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\t__unstableIsEditorReady: isEditorReady,\n\t\t\tgetEditorBlocks,\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetEditedPostContent,\n\t\t} = select( 'core/editor' );\n\t\tconst { getEditorMode } = select( 'core/edit-post' );\n\n\t\tconst {\n\t\t\tgetBlockIndex,\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetGlobalBlockCount,\n\t\t\tgetSettings: getBlockEditorSettings,\n\t\t} = select( blockEditorStore );\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\treturn {\n\t\t\tmode: getEditorMode(),\n\t\t\tisReady: isEditorReady(),\n\t\t\tblocks: getEditorBlocks(),\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tgetEditedPostContent,\n\t\t\tgetBlockEditorSettings,\n\t\t\tselectedBlockIndex: getBlockIndex( selectedBlockClientId ),\n\t\t\tblockCount: getGlobalBlockCount(),\n\t\t\tparagraphCount: getGlobalBlockCount( 'core/paragraph' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, resetEditorBlocks } = dispatch( 'core/editor' );\n\t\tconst {\n\t\t\tupdateSettings,\n\t\t\tclearSelectedBlock,\n\t\t\tinsertBlock,\n\t\t\treplaceBlock,\n\t\t} = dispatch( blockEditorStore );\n\t\tconst { switchEditorMode } = dispatch( 'core/edit-post' );\n\t\tconst { addEntities, receiveEntityRecords } = dispatch( 'core' );\n\t\tconst { createSuccessNotice } = dispatch( 'core/notices' );\n\n\t\treturn {\n\t\t\tupdateSettings,\n\t\t\taddEntities,\n\t\t\tclearSelectedBlock,\n\t\t\tinsertBlock,\n\t\t\tcreateSuccessNotice,\n\t\t\teditTitle( title ) {\n\t\t\t\teditPost( { title } );\n\t\t\t},\n\t\t\treceiveEntityRecords,\n\t\t\tresetEditorBlocksWithoutUndoLevel( blocks ) {\n\t\t\t\tresetEditorBlocks( blocks, {\n\t\t\t\t\t__unstableShouldCreateUndoLevel: false,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tswitchMode( mode ) {\n\t\t\t\tswitchEditorMode( mode );\n\t\t\t},\n\t\t\treplaceBlock,\n\t\t};\n\t} ),\n] )( NativeEditorProvider );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/provider/index.native.js"],"names":["postTypeEntities","name","baseURL","map","postTypeEntity","kind","transientEdits","blocks","selection","mergedEdits","meta","rawAttributes","NativeEditorProvider","Component","constructor","arguments","post","props","addEntities","receiveEntityRecords","type","getEditorSettings","settings","capabilities","maxSize","state","isHelpVisible","componentDidMount","locale","updateSettings","getThemeColors","subscriptionParentGetHtml","serializeToNativeAction","subscriptionParentToggleHTMLMode","toggleMode","subscriptionParentSetTitle","payload","editTitle","title","subscriptionParentUpdateHtml","updateHtmlAction","html","subscriptionParentReplaceBlock","replaceBlockAction","clientId","subscriptionParentMediaAppend","blockName","mediaType","newBlock","id","mediaId","mediaUrl","indexAfterSelected","selectedBlockIndex","insertionIndex","blockCount","insertBlock","subscriptionParentUpdateEditorSettings","galleryWithImageBlocks","editorSettings","window","wp","galleryBlockV2Enabled","subscriptionParentUpdateCapabilities","updateCapabilitiesAction","subscriptionParentShowNotice","createSuccessNotice","message","subscriptionParentShowEditorHelp","setState","storedImpressions","impressions","NEW_BLOCK_TYPES","storedImpressionKeys","Object","keys","storedImpressionsCurrent","every","newKey","includes","componentWillUnmount","remove","colors","gradients","rawStyles","rawFeatures","componentDidUpdate","prevProps","isReady","isUnsupportedBlock","unsupportedBlockNames","filter","block","attributes","originalName","RNReactNativeGutenbergBridge","editorDidMount","mode","hasChanges","raw","content","contentInfo","characterCount","wordCount","paragraphCount","provideToNative_Html","parsed","resetEditorBlocksWithoutUndoLevel","blockClientId","replaceBlock","switchMode","clearSelectedBlock","render","children","select","__unstableIsEditorReady","isEditorReady","getEditorBlocks","getEditedPostAttribute","getEditedPostContent","editorStore","getEditorMode","editPostStore","getBlockIndex","getSelectedBlockClientId","getGlobalBlockCount","getSettings","getBlockEditorSettings","blockEditorStore","selectedBlockClientId","dispatch","editPost","resetEditorBlocks","switchEditorMode","coreStore","noticesStore","__unstableShouldCreateUndoLevel"],"mappings":";;;;;;;;;AAsBA;;;;AAnBA;;AAKA;;AAeA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAmBA;;AACA;;AACA;;AACA;;AAKA;;;;;;AAlEA;AACA;AACA;;AAGA;AACA;AACA;AAkCA,MAAMA,gBAAgB,GAAG,CACxB;AAAEC,EAAAA,IAAI,EAAE,MAAR;AAAgBC,EAAAA,OAAO,EAAE;AAAzB,CADwB,EAExB;AAAED,EAAAA,IAAI,EAAE,MAAR;AAAgBC,EAAAA,OAAO,EAAE;AAAzB,CAFwB,EAGxB;AAAED,EAAAA,IAAI,EAAE,YAAR;AAAsBC,EAAAA,OAAO,EAAE;AAA/B,CAHwB,EAIxB;AAAED,EAAAA,IAAI,EAAE,UAAR;AAAoBC,EAAAA,OAAO,EAAE;AAA7B,CAJwB,EAKvBC,GALuB,CAKhBC,cAAF,KAAwB;AAC9BC,EAAAA,IAAI,EAAE,UADwB;AAE9B,KAAGD,cAF2B;AAG9BE,EAAAA,cAAc,EAAE;AACfC,IAAAA,MAAM,EAAE,IADO;AAEfC,IAAAA,SAAS,EAAE;AAFI,GAHc;AAO9BC,EAAAA,WAAW,EAAE;AACZC,IAAAA,IAAI,EAAE;AADM,GAPiB;AAU9BC,EAAAA,aAAa,EAAE,CAAE,OAAF,EAAW,SAAX,EAAsB,SAAtB;AAVe,CAAxB,CALkB,CAAzB;;AA2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AClB6F,MAAAA,QAAQ,CAAE;AAAE7F,QAAAA;AAAF,OAAF,CAAR;AACA,KARK;;AASNnB,IAAAA,oBATM;;AAUNwF,IAAAA,iCAAiC,CAAEpG,MAAF,EAAW;AAC3C6H,MAAAA,iBAAiB,CAAE7H,MAAF,EAAU;AAC1BiI,QAAAA,+BAA+B,EAAE;AADP,OAAV,CAAjB;AAGA,KAdK;;AAeN1B,IAAAA,UAAU,CAAEb,IAAF,EAAS;AAClBoC,MAAAA,gBAAgB,CAAEpC,IAAF,CAAhB;AACA,KAjBK;;AAkBNY,IAAAA;AAlBM,GAAP;AAoBA,CAhCD,CA9BuB,CAAT,EA+DVjG,oBA/DU,C","sourcesContent":["/**\n * External dependencies\n */\nimport memize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport RNReactNativeGutenbergBridge, {\n\trequestBlockTypeImpressions,\n\tsetBlockTypeImpressions,\n\tsubscribeParentGetHtml,\n\tsubscribeParentToggleHTMLMode,\n\tsubscribeUpdateHtml,\n\tsubscribeSetTitle,\n\tsubscribeMediaAppend,\n\tsubscribeReplaceBlock,\n\tsubscribeUpdateEditorSettings,\n\tsubscribeUpdateCapabilities,\n\tsubscribeShowNotice,\n\tsubscribeShowEditorHelp,\n} from '@wordpress/react-native-bridge';\nimport { Component } from '@wordpress/element';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport {\n\tparse,\n\tserialize,\n\tgetUnregisteredTypeHandlerName,\n\tcreateBlock,\n} from '@wordpress/blocks';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { applyFilters } from '@wordpress/hooks';\nimport {\n\tvalidateThemeColors,\n\tvalidateThemeGradients,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { getGlobalStyles } from '@wordpress/components';\nimport { NEW_BLOCK_TYPES } from '@wordpress/block-library';\n\nconst postTypeEntities = [\n\t{ name: 'post', baseURL: '/wp/v2/posts' },\n\t{ name: 'page', baseURL: '/wp/v2/pages' },\n\t{ name: 'attachment', baseURL: '/wp/v2/media' },\n\t{ name: 'wp_block', baseURL: '/wp/v2/blocks' },\n].map( ( postTypeEntity ) => ( {\n\tkind: 'postType',\n\t...postTypeEntity,\n\ttransientEdits: {\n\t\tblocks: true,\n\t\tselection: true,\n\t},\n\tmergedEdits: {\n\t\tmeta: true,\n\t},\n\trawAttributes: [ 'title', 'excerpt', 'content' ],\n} ) );\nimport { EditorHelpTopics, store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editPostStore } from '@wordpress/edit-post';\n\n/**\n * Internal dependencies\n */\nimport EditorProvider from './index.js';\n\nclass NativeEditorProvider extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\t// Keep a local reference to `post` to detect changes\n\t\tthis.post = this.props.post;\n\t\tthis.props.addEntities( postTypeEntities );\n\t\tthis.props.receiveEntityRecords(\n\t\t\t'postType',\n\t\t\tthis.post.type,\n\t\t\tthis.post\n\t\t);\n\n\t\tthis.getEditorSettings = memize(\n\t\t\t( settings, capabilities ) => ( {\n\t\t\t\t...settings,\n\t\t\t\tcapabilities,\n\t\t\t} ),\n\t\t\t{\n\t\t\t\tmaxSize: 1,\n\t\t\t}\n\t\t);\n\t\tthis.state = {\n\t\t\tisHelpVisible: false,\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { capabilities, locale, updateSettings } = this.props;\n\n\t\tupdateSettings( {\n\t\t\t...capabilities,\n\t\t\t...this.getThemeColors( this.props ),\n\t\t\tlocale,\n\t\t} );\n\n\t\tthis.subscriptionParentGetHtml = subscribeParentGetHtml( () => {\n\t\t\tthis.serializeToNativeAction();\n\t\t} );\n\n\t\tthis.subscriptionParentToggleHTMLMode = subscribeParentToggleHTMLMode(\n\t\t\t() => {\n\t\t\t\tthis.toggleMode();\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentSetTitle = subscribeSetTitle( ( payload ) => {\n\t\t\tthis.props.editTitle( payload.title );\n\t\t} );\n\n\t\tthis.subscriptionParentUpdateHtml = subscribeUpdateHtml(\n\t\t\t( payload ) => {\n\t\t\t\tthis.updateHtmlAction( payload.html );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentReplaceBlock = subscribeReplaceBlock(\n\t\t\t( payload ) => {\n\t\t\t\tthis.replaceBlockAction( payload.html, payload.clientId );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentMediaAppend = subscribeMediaAppend(\n\t\t\t( payload ) => {\n\t\t\t\tconst blockName = 'core/' + payload.mediaType;\n\t\t\t\tconst newBlock = createBlock( blockName, {\n\t\t\t\t\tid: payload.mediaId,\n\t\t\t\t\t[ payload.mediaType === 'image'\n\t\t\t\t\t\t? 'url'\n\t\t\t\t\t\t: 'src' ]: payload.mediaUrl,\n\t\t\t\t} );\n\n\t\t\t\tconst indexAfterSelected = this.props.selectedBlockIndex + 1;\n\t\t\t\tconst insertionIndex =\n\t\t\t\t\tindexAfterSelected || this.props.blockCount;\n\n\t\t\t\tthis.props.insertBlock( newBlock, insertionIndex );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentUpdateEditorSettings = subscribeUpdateEditorSettings(\n\t\t\t( { galleryWithImageBlocks, ...editorSettings } ) => {\n\t\t\t\tif ( typeof galleryWithImageBlocks === 'boolean' ) {\n\t\t\t\t\twindow.wp.galleryBlockV2Enabled = galleryWithImageBlocks;\n\t\t\t\t}\n\t\t\t\tupdateSettings( this.getThemeColors( editorSettings ) );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentUpdateCapabilities = subscribeUpdateCapabilities(\n\t\t\t( payload ) => {\n\t\t\t\tthis.updateCapabilitiesAction( payload );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentShowNotice = subscribeShowNotice(\n\t\t\t( payload ) => {\n\t\t\t\tthis.props.createSuccessNotice( payload.message );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentShowEditorHelp = subscribeShowEditorHelp( () => {\n\t\t\tthis.setState( { isHelpVisible: true } );\n\t\t} );\n\n\t\t// Request current block impressions from native app\n\t\trequestBlockTypeImpressions( ( storedImpressions ) => {\n\t\t\tconst impressions = { ...NEW_BLOCK_TYPES, ...storedImpressions };\n\n\t\t\t// Persist impressions to JavaScript store\n\t\t\tupdateSettings( { impressions } );\n\n\t\t\t// Persist impressions to native store if they do not include latest\n\t\t\t// `NEW_BLOCK_TYPES` configuration\n\t\t\tconst storedImpressionKeys = Object.keys( storedImpressions );\n\t\t\tconst storedImpressionsCurrent = Object.keys(\n\t\t\t\tNEW_BLOCK_TYPES\n\t\t\t).every( ( newKey ) => storedImpressionKeys.includes( newKey ) );\n\t\t\tif ( ! storedImpressionsCurrent ) {\n\t\t\t\tsetBlockTypeImpressions( impressions );\n\t\t\t}\n\t\t} );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.subscriptionParentGetHtml ) {\n\t\t\tthis.subscriptionParentGetHtml.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentToggleHTMLMode ) {\n\t\t\tthis.subscriptionParentToggleHTMLMode.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentSetTitle ) {\n\t\t\tthis.subscriptionParentSetTitle.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateHtml ) {\n\t\t\tthis.subscriptionParentUpdateHtml.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentReplaceBlock ) {\n\t\t\tthis.subscriptionParentReplaceBlock.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentMediaAppend ) {\n\t\t\tthis.subscriptionParentMediaAppend.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateEditorSettings ) {\n\t\t\tthis.subscriptionParentUpdateEditorSettings.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateCapabilities ) {\n\t\t\tthis.subscriptionParentUpdateCapabilities.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentShowNotice ) {\n\t\t\tthis.subscriptionParentShowNotice.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentShowEditorHelp ) {\n\t\t\tthis.subscriptionParentShowEditorHelp.remove();\n\t\t}\n\t}\n\n\tgetThemeColors( { colors, gradients, rawStyles, rawFeatures } ) {\n\t\treturn {\n\t\t\t...( rawStyles && rawFeatures\n\t\t\t\t? getGlobalStyles( rawStyles, rawFeatures )\n\t\t\t\t: {\n\t\t\t\t\t\tcolors: validateThemeColors( colors ),\n\t\t\t\t\t\tgradients: validateThemeGradients( gradients ),\n\t\t\t\t } ),\n\t\t};\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tif ( ! prevProps.isReady && this.props.isReady ) {\n\t\t\tconst blocks = this.props.blocks;\n\t\t\tconst isUnsupportedBlock = ( { name } ) =>\n\t\t\t\tname === getUnregisteredTypeHandlerName();\n\t\t\tconst unsupportedBlockNames = blocks\n\t\t\t\t.filter( isUnsupportedBlock )\n\t\t\t\t.map( ( block ) => block.attributes.originalName );\n\t\t\tRNReactNativeGutenbergBridge.editorDidMount(\n\t\t\t\tunsupportedBlockNames\n\t\t\t);\n\t\t}\n\t}\n\n\tserializeToNativeAction() {\n\t\tconst title = this.props.title;\n\t\tlet html;\n\n\t\tif ( this.props.mode === 'text' ) {\n\t\t\t// The HTMLTextInput component does not update the store when user is doing changes\n\t\t\t// Let's request the HTML from the component's state directly\n\t\t\thtml = applyFilters( 'native.persist-html' );\n\t\t} else {\n\t\t\thtml = serialize( this.props.blocks );\n\t\t}\n\n\t\tconst hasChanges =\n\t\t\ttitle !== this.post.title.raw || html !== this.post.content.raw;\n\n\t\t// Variable to store the content structure metrics.\n\t\tconst contentInfo = {};\n\t\tcontentInfo.characterCount = wordCount(\n\t\t\thtml,\n\t\t\t'characters_including_spaces'\n\t\t);\n\t\tcontentInfo.wordCount = wordCount( html, 'words' );\n\t\tcontentInfo.paragraphCount = this.props.paragraphCount;\n\t\tcontentInfo.blockCount = this.props.blockCount;\n\t\tRNReactNativeGutenbergBridge.provideToNative_Html(\n\t\t\thtml,\n\t\t\ttitle,\n\t\t\thasChanges,\n\t\t\tcontentInfo\n\t\t);\n\n\t\tif ( hasChanges ) {\n\t\t\tthis.post.title.raw = title;\n\t\t\tthis.post.content.raw = html;\n\t\t}\n\t}\n\n\tupdateHtmlAction( html ) {\n\t\tconst parsed = parse( html );\n\t\tthis.props.resetEditorBlocksWithoutUndoLevel( parsed );\n\t}\n\n\treplaceBlockAction( html, blockClientId ) {\n\t\tconst parsed = parse( html );\n\t\tthis.props.replaceBlock( blockClientId, parsed );\n\t}\n\n\ttoggleMode() {\n\t\tconst { mode, switchMode } = this.props;\n\t\t// refresh html content first\n\t\tthis.serializeToNativeAction();\n\t\t// make sure to blur the selected block and dismiss the keyboard\n\t\tthis.props.clearSelectedBlock();\n\t\tswitchMode( mode === 'visual' ? 'text' : 'visual' );\n\t}\n\n\tupdateCapabilitiesAction( capabilities ) {\n\t\tthis.props.updateSettings( capabilities );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tchildren,\n\t\t\tpost, // eslint-disable-line no-unused-vars\n\t\t\tcapabilities,\n\t\t\tsettings,\n\t\t\t...props\n\t\t} = this.props;\n\t\tconst editorSettings = this.getEditorSettings( settings, capabilities );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorProvider\n\t\t\t\t\tpost={ this.post }\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</EditorProvider>\n\t\t\t\t<EditorHelpTopics\n\t\t\t\t\tisVisible={ this.state.isHelpVisible }\n\t\t\t\t\tonClose={ () => this.setState( { isHelpVisible: false } ) }\n\t\t\t\t\tclose={ () => this.setState( { isHelpVisible: false } ) }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\t__unstableIsEditorReady: isEditorReady,\n\t\t\tgetEditorBlocks,\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetEditedPostContent,\n\t\t} = select( editorStore );\n\t\tconst { getEditorMode } = select( editPostStore );\n\n\t\tconst {\n\t\t\tgetBlockIndex,\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetGlobalBlockCount,\n\t\t\tgetSettings: getBlockEditorSettings,\n\t\t} = select( blockEditorStore );\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\treturn {\n\t\t\tmode: getEditorMode(),\n\t\t\tisReady: isEditorReady(),\n\t\t\tblocks: getEditorBlocks(),\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tgetEditedPostContent,\n\t\t\tgetBlockEditorSettings,\n\t\t\tselectedBlockIndex: getBlockIndex( selectedBlockClientId ),\n\t\t\tblockCount: getGlobalBlockCount(),\n\t\t\tparagraphCount: getGlobalBlockCount( 'core/paragraph' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, resetEditorBlocks } = dispatch( editorStore );\n\t\tconst {\n\t\t\tupdateSettings,\n\t\t\tclearSelectedBlock,\n\t\t\tinsertBlock,\n\t\t\treplaceBlock,\n\t\t} = dispatch( blockEditorStore );\n\t\tconst { switchEditorMode } = dispatch( editPostStore );\n\t\tconst { addEntities, receiveEntityRecords } = dispatch( coreStore );\n\t\tconst { createSuccessNotice } = dispatch( noticesStore );\n\n\t\treturn {\n\t\t\tupdateSettings,\n\t\t\taddEntities,\n\t\t\tclearSelectedBlock,\n\t\t\tinsertBlock,\n\t\t\tcreateSuccessNotice,\n\t\t\teditTitle( title ) {\n\t\t\t\teditPost( { title } );\n\t\t\t},\n\t\t\treceiveEntityRecords,\n\t\t\tresetEditorBlocksWithoutUndoLevel( blocks ) {\n\t\t\t\tresetEditorBlocks( blocks, {\n\t\t\t\t\t__unstableShouldCreateUndoLevel: false,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tswitchMode( mode ) {\n\t\t\t\tswitchEditorMode( mode );\n\t\t\t},\n\t\t\treplaceBlock,\n\t\t};\n\t} ),\n] )( NativeEditorProvider );\n"]}
|
|
@@ -44,7 +44,8 @@ function useBlockEditorSettings(settings, hasTemplate) {
|
|
|
44
44
|
reusableBlocks,
|
|
45
45
|
hasUploadPermissions,
|
|
46
46
|
canUseUnfilteredHTML,
|
|
47
|
-
userCanCreatePages
|
|
47
|
+
userCanCreatePages,
|
|
48
|
+
pageOnFront
|
|
48
49
|
} = (0, _data.useSelect)(select => {
|
|
49
50
|
const {
|
|
50
51
|
canUserUseUnfilteredHTML
|
|
@@ -53,8 +54,10 @@ function useBlockEditorSettings(settings, hasTemplate) {
|
|
|
53
54
|
const {
|
|
54
55
|
canUser,
|
|
55
56
|
getUnstableBase,
|
|
56
|
-
hasFinishedResolution
|
|
57
|
+
hasFinishedResolution,
|
|
58
|
+
getEntityRecord
|
|
57
59
|
} = select(_coreData.store);
|
|
60
|
+
const siteSettings = getEntityRecord('root', 'site');
|
|
58
61
|
const siteData = getUnstableBase();
|
|
59
62
|
const hasFinishedResolvingSiteData = hasFinishedResolution('getUnstableBase');
|
|
60
63
|
return {
|
|
@@ -66,7 +69,8 @@ function useBlockEditorSettings(settings, hasTemplate) {
|
|
|
66
69
|
hasUploadPermissions: (0, _lodash.defaultTo)(canUser('create', 'media'), true),
|
|
67
70
|
hasResolvedLocalSiteData: hasFinishedResolvingSiteData,
|
|
68
71
|
baseUrl: (siteData === null || siteData === void 0 ? void 0 : siteData.url) || '',
|
|
69
|
-
userCanCreatePages: canUser('create', 'pages')
|
|
72
|
+
userCanCreatePages: canUser('create', 'pages'),
|
|
73
|
+
pageOnFront: siteSettings === null || siteSettings === void 0 ? void 0 : siteSettings.page_on_front
|
|
70
74
|
};
|
|
71
75
|
}, []);
|
|
72
76
|
const {
|
|
@@ -93,7 +97,7 @@ function useBlockEditorSettings(settings, hasTemplate) {
|
|
|
93
97
|
return saveEntityRecord('postType', 'page', options);
|
|
94
98
|
};
|
|
95
99
|
|
|
96
|
-
return (0, _element.useMemo)(() => ({ ...(0, _lodash.pick)(settings, ['__experimentalBlockDirectory', '__experimentalBlockPatternCategories', '__experimentalBlockPatterns', '
|
|
100
|
+
return (0, _element.useMemo)(() => ({ ...(0, _lodash.pick)(settings, ['__experimentalBlockDirectory', '__experimentalBlockPatternCategories', '__experimentalBlockPatterns', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', '__unstableGalleryWithImageBlocks', 'alignWide', 'allowedBlockTypes', 'bodyPlaceholder', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomGradients', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'focusMode', 'fontSizes', 'gradients', 'hasFixedToolbar', 'hasReducedUI', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'keepCaretInsideBlock', 'maxWidth', 'onUpdateDefaultBlockStyles', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableResolvedAssets']),
|
|
97
101
|
mediaUpload: hasUploadPermissions ? _utils.mediaUpload : undefined,
|
|
98
102
|
__experimentalReusableBlocks: reusableBlocks,
|
|
99
103
|
__experimentalFetchLinkSuggestions: (search, searchOptions) => (0, _coreData.__experimentalFetchLinkSuggestions)(search, searchOptions, settings),
|
|
@@ -102,8 +106,9 @@ function useBlockEditorSettings(settings, hasTemplate) {
|
|
|
102
106
|
__experimentalUndo: undo,
|
|
103
107
|
outlineMode: hasTemplate,
|
|
104
108
|
__experimentalCreatePageEntity: createPageEntity,
|
|
105
|
-
__experimentalUserCanCreatePages: userCanCreatePages
|
|
106
|
-
|
|
109
|
+
__experimentalUserCanCreatePages: userCanCreatePages,
|
|
110
|
+
pageOnFront
|
|
111
|
+
}), [settings, hasUploadPermissions, reusableBlocks, canUseUnfilteredHTML, undo, hasTemplate, userCanCreatePages, pageOnFront]);
|
|
107
112
|
}
|
|
108
113
|
|
|
109
114
|
var _default = useBlockEditorSettings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"names":["useBlockEditorSettings","settings","hasTemplate","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","select","canUserUseUnfilteredHTML","editorStore","isWeb","Platform","OS","canUser","getUnstableBase","hasFinishedResolution","coreStore","siteData","hasFinishedResolvingSiteData","getEntityRecords","per_page","hasResolvedLocalSiteData","baseUrl","url","undo","saveEntityRecord","createPageEntity","options","Promise","reject","message","mediaUpload","undefined","__experimentalReusableBlocks","__experimentalFetchLinkSuggestions","search","searchOptions","__experimentalFetchRichUrlData","fetchUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages"],"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;AACxD,QAAM;AACLC,IAAAA,cADK;AAELC,IAAAA,oBAFK;AAGLC,IAAAA,oBAHK;AAILC,IAAAA;
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"names":["useBlockEditorSettings","settings","hasTemplate","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","select","canUserUseUnfilteredHTML","editorStore","isWeb","Platform","OS","canUser","getUnstableBase","hasFinishedResolution","getEntityRecord","coreStore","siteSettings","siteData","hasFinishedResolvingSiteData","getEntityRecords","per_page","hasResolvedLocalSiteData","baseUrl","url","page_on_front","undo","saveEntityRecord","createPageEntity","options","Promise","reject","message","mediaUpload","undefined","__experimentalReusableBlocks","__experimentalFetchLinkSuggestions","search","searchOptions","__experimentalFetchRichUrlData","fetchUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages"],"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;AACxD,QAAM;AACLC,IAAAA,cADK;AAELC,IAAAA,oBAFK;AAGLC,IAAAA,oBAHK;AAILC,IAAAA,kBAJK;AAKLC,IAAAA;AALK,MAMF,qBAAaC,MAAF,IAAc;AAC5B,UAAM;AAAEC,MAAAA;AAAF,QAA+BD,MAAM,CAAEE,YAAF,CAA3C;AACA,UAAMC,KAAK,GAAGC,kBAASC,EAAT,KAAgB,KAA9B;AACA,UAAM;AACLC,MAAAA,OADK;AAELC,MAAAA,eAFK;AAGLC,MAAAA,qBAHK;AAILC,MAAAA;AAJK,QAKFT,MAAM,CAAEU,eAAF,CALV;AAOA,UAAMC,YAAY,GAAGF,eAAe,CAAE,MAAF,EAAU,MAAV,CAApC;AAEA,UAAMG,QAAQ,GAAGL,eAAe,EAAhC;AAEA,UAAMM,4BAA4B,GAAGL,qBAAqB,CACzD,iBADyD,CAA1D;AAIA,WAAO;AACNX,MAAAA,oBAAoB,EAAEI,wBAAwB,EADxC;AAENN,MAAAA,cAAc,EAAEQ,KAAK,GAClBH,MAAM,CAAEU,eAAF,CAAN,CAAoBI,gBAApB,CACA,UADA,EAEA,UAFA,EAGA;AAAEC,QAAAA,QAAQ,EAAE,CAAC;AAAb,OAHA,CADkB,GAMlB,EARG;AAQC;AACPnB,MAAAA,oBAAoB,EAAE,uBACrBU,OAAO,CAAE,QAAF,EAAY,OAAZ,CADc,EAErB,IAFqB,CAThB;AAaNU,MAAAA,wBAAwB,EAAE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EA6BlB,OA7BkB,EA8BlB,sBA9BkB,EA+BlB,UA/BkB,EAgClB,4BAhCkB,EAiClB,QAjCkB,EAkClB,UAlCkB,EAmClB,cAnCkB,EAoClB,kBApCkB,EAqClB,gBArCkB,EAsClB,wCAtCkB,EAuClB,0BAvCkB,CAAhB,CADI;AA0CPkC,IAAAA,WAAW,EAAE/B,oBAAoB,GAAG+B,kBAAH,GAAiBC,SA1C3C;AA2CPC,IAAAA,4BAA4B,EAAElC,cA3CvB;AA4CPmC,IAAAA,kCAAkC,EAAE,CAAEC,MAAF,EAAUC,aAAV,KACnC,kDAAsBD,MAAtB,EAA8BC,aAA9B,EAA6CvC,QAA7C,CA7CM;AA8CPwC,IAAAA,8BAA8B,EAAEC,oCA9CzB;AA+CPC,IAAAA,sCAAsC,EAAEtC,oBA/CjC;AAgDPuC,IAAAA,kBAAkB,EAAEhB,IAhDb;AAiDPiB,IAAAA,WAAW,EAAE3C,WAjDN;AAkDP4C,IAAAA,8BAA8B,EAAEhB,gBAlDzB;AAmDPiB,IAAAA,gCAAgC,EAAEzC,kBAnD3B;AAoDPC,IAAAA;AApDO,GAAR,CADM,EAuDN,CACCN,QADD,EAECG,oBAFD,EAGCD,cAHD,EAICE,oBAJD,EAKCuB,IALD,EAMC1B,WAND,EAOCI,kBAPD,EAQCC,WARD,CAvDM,CAAP;AAkEA;;eAEcP,sB","sourcesContent":["/**\n * External dependencies\n */\nimport { pick, defaultTo } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Platform, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {boolean} hasTemplate Whether template mode is enabled.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, hasTemplate ) {\n\tconst {\n\t\treusableBlocks,\n\t\thasUploadPermissions,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUserUseUnfilteredHTML } = select( editorStore );\n\t\tconst isWeb = Platform.OS === 'web';\n\t\tconst {\n\t\t\tcanUser,\n\t\t\tgetUnstableBase,\n\t\t\thasFinishedResolution,\n\t\t\tgetEntityRecord,\n\t\t} = select( coreStore );\n\n\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\n\t\tconst siteData = getUnstableBase();\n\n\t\tconst hasFinishedResolvingSiteData = hasFinishedResolution(\n\t\t\t'getUnstableBase'\n\t\t);\n\n\t\treturn {\n\t\t\tcanUseUnfilteredHTML: canUserUseUnfilteredHTML(),\n\t\t\treusableBlocks: isWeb\n\t\t\t\t? select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'wp_block',\n\t\t\t\t\t\t{ per_page: -1 }\n\t\t\t\t )\n\t\t\t\t: [], // Reusable blocks are fetched in the native version of this hook.\n\t\t\thasUploadPermissions: defaultTo(\n\t\t\t\tcanUser( 'create', 'media' ),\n\t\t\t\ttrue\n\t\t\t),\n\t\t\thasResolvedLocalSiteData: hasFinishedResolvingSiteData,\n\t\t\tbaseUrl: siteData?.url || '',\n\t\t\tuserCanCreatePages: canUser( 'create', 'pages' ),\n\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t};\n\t}, [] );\n\n\tconst { undo } = useDispatch( editorStore );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = ( options ) => {\n\t\tif ( ! userCanCreatePages ) {\n\t\t\treturn Promise.reject( {\n\t\t\t\tmessage: __( 'You do not have permission to create Pages.' ),\n\t\t\t} );\n\t\t}\n\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t};\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...pick( settings, [\n\t\t\t\t'__experimentalBlockDirectory',\n\t\t\t\t'__experimentalBlockPatternCategories',\n\t\t\t\t'__experimentalBlockPatterns',\n\t\t\t\t'__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'codeEditingEnabled',\n\t\t\t\t'colors',\n\t\t\t\t'disableCustomColors',\n\t\t\t\t'disableCustomFontSizes',\n\t\t\t\t'disableCustomGradients',\n\t\t\t\t'enableCustomLineHeight',\n\t\t\t\t'enableCustomSpacing',\n\t\t\t\t'enableCustomUnits',\n\t\t\t\t'focusMode',\n\t\t\t\t'fontSizes',\n\t\t\t\t'gradients',\n\t\t\t\t'hasFixedToolbar',\n\t\t\t\t'hasReducedUI',\n\t\t\t\t'imageDefaultSize',\n\t\t\t\t'imageDimensions',\n\t\t\t\t'imageEditing',\n\t\t\t\t'imageSizes',\n\t\t\t\t'isRTL',\n\t\t\t\t'keepCaretInsideBlock',\n\t\t\t\t'maxWidth',\n\t\t\t\t'onUpdateDefaultBlockStyles',\n\t\t\t\t'styles',\n\t\t\t\t'template',\n\t\t\t\t'templateLock',\n\t\t\t\t'titlePlaceholder',\n\t\t\t\t'supportsLayout',\n\t\t\t\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t\t\t\t'__unstableResolvedAssets',\n\t\t\t] ),\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t__experimentalUndo: undo,\n\t\t\toutlineMode: hasTemplate,\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\thasUploadPermissions,\n\t\t\treusableBlocks,\n\t\t\tcanUseUnfilteredHTML,\n\t\t\tundo,\n\t\t\thasTemplate,\n\t\t\tuserCanCreatePages,\n\t\t\tpageOnFront,\n\t\t]\n\t);\n}\n\nexport default useBlockEditorSettings;\n"]}
|
package/build/store/actions.js
CHANGED
|
@@ -291,20 +291,21 @@ function* savePost() {
|
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
293
|
/**
|
|
294
|
-
* Action
|
|
294
|
+
* Action for refreshing the current post.
|
|
295
|
+
*
|
|
296
|
+
* @deprecated Since WordPress 6.0.
|
|
295
297
|
*/
|
|
296
298
|
|
|
297
299
|
|
|
298
|
-
function
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
// Timestamp arg allows caller to bypass browser caching, which is
|
|
304
|
-
// expected for this specific function.
|
|
305
|
-
path: `/wp/v2/${postType.rest_base}/${post.id}` + `?context=edit&_timestamp=${Date.now()}`
|
|
300
|
+
function refreshPost() {
|
|
301
|
+
(0, _deprecated.default)("wp.data.dispatch( 'core/editor' ).refreshPost", {
|
|
302
|
+
since: '6.0',
|
|
303
|
+
version: '6.3',
|
|
304
|
+
alternative: 'Use the core entities store instead'
|
|
306
305
|
});
|
|
307
|
-
|
|
306
|
+
return {
|
|
307
|
+
type: 'DO_NOTHING'
|
|
308
|
+
};
|
|
308
309
|
}
|
|
309
310
|
/**
|
|
310
311
|
* Action generator for trashing the current post in the editor.
|
|
@@ -388,16 +389,20 @@ function* undo() {
|
|
|
388
389
|
yield _data.controls.dispatch(_coreData.store, 'undo');
|
|
389
390
|
}
|
|
390
391
|
/**
|
|
391
|
-
*
|
|
392
|
-
* be created.
|
|
392
|
+
* Action that creates an undo history record.
|
|
393
393
|
*
|
|
394
|
-
* @
|
|
394
|
+
* @deprecated Since WordPress 6.0
|
|
395
395
|
*/
|
|
396
396
|
|
|
397
397
|
|
|
398
398
|
function createUndoLevel() {
|
|
399
|
+
(0, _deprecated.default)("wp.data.dispatch( 'core/editor' ).createUndoLevel", {
|
|
400
|
+
since: '6.0',
|
|
401
|
+
version: '6.3',
|
|
402
|
+
alternative: 'Use the core entities store instead'
|
|
403
|
+
});
|
|
399
404
|
return {
|
|
400
|
-
type: '
|
|
405
|
+
type: 'DO_NOTHING'
|
|
401
406
|
};
|
|
402
407
|
}
|
|
403
408
|
/**
|
|
@@ -623,7 +628,8 @@ function updateEditorSettings(settings) {
|
|
|
623
628
|
const getBlockEditorAction = name => function* () {
|
|
624
629
|
(0, _deprecated.default)("`wp.data.dispatch( 'core/editor' )." + name + '`', {
|
|
625
630
|
since: '5.3',
|
|
626
|
-
alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`'
|
|
631
|
+
alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`',
|
|
632
|
+
version: '6.2'
|
|
627
633
|
});
|
|
628
634
|
|
|
629
635
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/store/actions.js"],"names":["setupEditor","post","edits","template","resetPost","type","setupEditorState","isNewPost","status","content","raw","blocks","resetEditorBlocks","__unstableShouldCreateUndoLevel","Object","keys","some","key","editPost","__experimentalTearDownEditor","__experimentalRequestPostUpdateStart","options","__experimentalRequestPostUpdateFinish","updatePost","since","alternative","id","controls","select","STORE_NAME","dispatch","coreStore","savePost","isAutosave","undoIgnore","previousRecord","error","args","length","noticesStore","updatedRecord","previousPost","postType","resolveSelect","blockEditorStore","refreshPost","postTypeSlug","newPost","path","rest_base","Date","now","trashPost","TRASH_POST_NOTICE_ID","method","autosave","local","isPostNew","title","excerpt","postId","redo","undo","createUndoLevel","updatePostLock","lock","enablePublishSidebar","disablePublishSidebar","lockPostSaving","lockName","unlockPostSaving","lockPostAutosaving","unlockPostAutosaving","selection","noChange","blocksForSerialization","updateEditorSettings","settings","getBlockEditorAction","name","resetBlocks","receiveBlocks","updateBlock","updateBlockAttributes","selectBlock","startMultiSelect","stopMultiSelect","multiSelect","clearSelectedBlock","toggleSelection","replaceBlocks","replaceBlock","moveBlocksDown","moveBlocksUp","moveBlockToPosition","insertBlock","insertBlocks","showInsertionPoint","hideInsertionPoint","setTemplateValidity","synchronizeTemplate","mergeBlocks","removeBlocks","removeBlock","toggleBlockMode","startTyping","stopTyping","enterFormattedText","exitFormattedText","insertDefaultBlock","updateBlockListSettings"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,UAAUA,WAAV,CAAuBC,IAAvB,EAA6BC,KAA7B,EAAoCC,QAApC,EAA+C;AACrD,QAAMC,SAAS,CAAEH,IAAF,CAAf;AACA,QAAM;AACLI,IAAAA,IAAI,EAAE,cADD;AAELJ,IAAAA,IAFK;AAGLC,IAAAA,KAHK;AAILC,IAAAA;AAJK,GAAN;AAMA,QAAMG,gBAAgB,CAAEL,IAAF,CAAtB,CARqD,CASrD;;AACA,QAAMM,SAAS,GAAGN,IAAI,CAACO,MAAL,K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AAoB,CACtD,qBADsD,CAAhD;AAIP;AACA;AACA;;;AACO,MAAMsB,mBAAmB,GAAGtB,oBAAoB,CACtD,qBADsD,CAAhD;AAIP;AACA;AACA;;;AACO,MAAMuB,WAAW,GAAGvB,oBAAoB,CAAE,aAAF,CAAxC;AAEP;AACA;AACA;;;AACO,MAAMwB,YAAY,GAAGxB,oBAAoB,CAAE,cAAF,CAAzC;AAEP;AACA;AACA;;;AACO,MAAMyB,WAAW,GAAGzB,oBAAoB,CAAE,aAAF,CAAxC;AAEP;AACA;AACA;;;AACO,MAAM0B,eAAe,GAAG1B,oBAAoB,CAAE,iBAAF,CAA5C;AAEP;AACA;AACA;;;AACO,MAAM2B,WAAW,GAAG3B,oBAAoB,CAAE,aAAF,CAAxC;AAEP;AACA;AACA;;;AACO,MAAM4B,UAAU,GAAG5B,oBAAoB,CAAE,YAAF,CAAvC;AAEP;AACA;AACA;;;AACO,MAAM6B,kBAAkB,GAAG7B,oBAAoB,CAAE,oBAAF,CAA/C;AAEP;AACA;AACA;;;AACO,MAAM8B,iBAAiB,GAAG9B,oBAAoB,CAAE,mBAAF,CAA9C;AAEP;AACA;AACA;;;AACO,MAAM+B,kBAAkB,GAAG/B,oBAAoB,CAAE,oBAAF,CAA/C;AAEP;AACA;AACA;;;AACO,MAAMgC,uBAAuB,GAAGhC,oBAAoB,CAC1D,yBAD0D,CAApD","sourcesContent":["/**\n * External dependencies\n */\nimport { has } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { controls } from '@wordpress/data';\nimport { apiFetch } from '@wordpress/data-controls';\nimport {\n\tparse,\n\tsynchronizeBlocksWithTemplate,\n\t__unstableSerializeAndClean,\n} from '@wordpress/blocks';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME, TRASH_POST_NOTICE_ID } from './constants';\nimport {\n\tgetNotificationArgumentsForSaveSuccess,\n\tgetNotificationArgumentsForSaveFail,\n\tgetNotificationArgumentsForTrashFail,\n} from './utils/notice-builder';\n\n/**\n * Returns an action generator used in signalling that editor has initialized with\n * the specified post object and editor settings.\n *\n * @param {Object} post Post object.\n * @param {Object} edits Initial edited attributes object.\n * @param {Array?} template Block Template.\n */\nexport function* setupEditor( post, edits, template ) {\n\tyield resetPost( post );\n\tyield {\n\t\ttype: 'SETUP_EDITOR',\n\t\tpost,\n\t\tedits,\n\t\ttemplate,\n\t};\n\tyield setupEditorState( post );\n\t// Apply a template for new posts only, if exists.\n\tconst isNewPost = post.status === 'auto-draft';\n\tif ( isNewPost && template ) {\n\t\t// In order to ensure maximum of a single parse during setup, edits are\n\t\t// included as part of editor setup action. Assume edited content as\n\t\t// canonical if provided, falling back to post.\n\t\tlet content;\n\t\tif ( has( edits, [ 'content' ] ) ) {\n\t\t\tcontent = edits.content;\n\t\t} else {\n\t\t\tcontent = post.content.raw;\n\t\t}\n\t\tlet blocks = parse( content );\n\t\tblocks = synchronizeBlocksWithTemplate( blocks, template );\n\t\tyield resetEditorBlocks( blocks, {\n\t\t\t__unstableShouldCreateUndoLevel: false,\n\t\t} );\n\t}\n\tif (\n\t\tedits &&\n\t\tObject.keys( edits ).some(\n\t\t\t( key ) =>\n\t\t\t\tedits[ key ] !==\n\t\t\t\t( has( post, [ key, 'raw' ] ) ? post[ key ].raw : post[ key ] )\n\t\t)\n\t) {\n\t\tyield editPost( edits );\n\t}\n}\n\n/**\n * Returns an action object signalling that the editor is being destroyed and\n * that any necessary state or side-effect cleanup should occur.\n *\n * @return {Object} Action object.\n */\nexport function __experimentalTearDownEditor() {\n\treturn { type: 'TEAR_DOWN_EDITOR' };\n}\n\n/**\n * Returns an action object used in signalling that the latest version of the\n * post has been received, either by initialization or save.\n *\n * @param {Object} post Post object.\n *\n * @return {Object} Action object.\n */\nexport function resetPost( post ) {\n\treturn {\n\t\ttype: 'RESET_POST',\n\t\tpost,\n\t};\n}\n\n/**\n * Action for dispatching that a post update request has started.\n *\n * @param {Object} options\n *\n * @return {Object} An action object\n */\nexport function __experimentalRequestPostUpdateStart( options = {} ) {\n\treturn {\n\t\ttype: 'REQUEST_POST_UPDATE_START',\n\t\toptions,\n\t};\n}\n\n/**\n * Action for dispatching that a post update request has finished.\n *\n * @param {Object} options\n *\n * @return {Object} An action object\n */\nexport function __experimentalRequestPostUpdateFinish( options = {} ) {\n\treturn {\n\t\ttype: 'REQUEST_POST_UPDATE_FINISH',\n\t\toptions,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a patch of updates for the\n * latest version of the post have been received.\n *\n * @return {Object} Action object.\n * @deprecated since Gutenberg 9.7.0.\n */\nexport function updatePost() {\n\tdeprecated( \"wp.data.dispatch( 'core/editor' ).updatePost\", {\n\t\tsince: '5.7',\n\t\talternative: 'Use the core entities store instead',\n\t} );\n\treturn {\n\t\ttype: 'DO_NOTHING',\n\t};\n}\n\n/**\n * Returns an action object used to setup the editor state when first opening\n * an editor.\n *\n * @param {Object} post Post object.\n *\n * @return {Object} Action object.\n */\nexport function setupEditorState( post ) {\n\treturn {\n\t\ttype: 'SETUP_EDITOR_STATE',\n\t\tpost,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that attributes of the post have\n * been edited.\n *\n * @param {Object} edits Post attributes to edit.\n * @param {Object} options Options for the edit.\n *\n * @yield {Object} Action object or control.\n */\nexport function* editPost( edits, options ) {\n\tconst { id, type } = yield controls.select( STORE_NAME, 'getCurrentPost' );\n\tyield controls.dispatch(\n\t\tcoreStore,\n\t\t'editEntityRecord',\n\t\t'postType',\n\t\ttype,\n\t\tid,\n\t\tedits,\n\t\toptions\n\t);\n}\n\n/**\n * Action generator for saving the current post in the editor.\n *\n * @param {Object} options\n */\nexport function* savePost( options = {} ) {\n\tif ( ! ( yield controls.select( STORE_NAME, 'isEditedPostSaveable' ) ) ) {\n\t\treturn;\n\t}\n\tlet edits = {\n\t\tcontent: yield controls.select( STORE_NAME, 'getEditedPostContent' ),\n\t};\n\tif ( ! options.isAutosave ) {\n\t\tyield controls.dispatch( STORE_NAME, 'editPost', edits, {\n\t\t\tundoIgnore: true,\n\t\t} );\n\t}\n\n\tyield __experimentalRequestPostUpdateStart( options );\n\tconst previousRecord = yield controls.select(\n\t\tSTORE_NAME,\n\t\t'getCurrentPost'\n\t);\n\tedits = {\n\t\tid: previousRecord.id,\n\t\t...( yield controls.select(\n\t\t\tcoreStore,\n\t\t\t'getEntityRecordNonTransientEdits',\n\t\t\t'postType',\n\t\t\tpreviousRecord.type,\n\t\t\tpreviousRecord.id\n\t\t) ),\n\t\t...edits,\n\t};\n\tyield controls.dispatch(\n\t\tcoreStore,\n\t\t'saveEntityRecord',\n\t\t'postType',\n\t\tpreviousRecord.type,\n\t\tedits,\n\t\toptions\n\t);\n\tyield __experimentalRequestPostUpdateFinish( options );\n\n\tconst error = yield controls.select(\n\t\tcoreStore,\n\t\t'getLastEntitySaveError',\n\t\t'postType',\n\t\tpreviousRecord.type,\n\t\tpreviousRecord.id\n\t);\n\tif ( error ) {\n\t\tconst args = getNotificationArgumentsForSaveFail( {\n\t\t\tpost: previousRecord,\n\t\t\tedits,\n\t\t\terror,\n\t\t} );\n\t\tif ( args.length ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createErrorNotice',\n\t\t\t\t...args\n\t\t\t);\n\t\t}\n\t} else {\n\t\tconst updatedRecord = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'getCurrentPost'\n\t\t);\n\t\tconst args = getNotificationArgumentsForSaveSuccess( {\n\t\t\tpreviousPost: previousRecord,\n\t\t\tpost: updatedRecord,\n\t\t\tpostType: yield controls.resolveSelect(\n\t\t\t\tcoreStore,\n\t\t\t\t'getPostType',\n\t\t\t\tupdatedRecord.type\n\t\t\t),\n\t\t\toptions,\n\t\t} );\n\t\tif ( args.length ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createSuccessNotice',\n\t\t\t\t...args\n\t\t\t);\n\t\t}\n\t\t// Make sure that any edits after saving create an undo level and are\n\t\t// considered for change detection.\n\t\tif ( ! options.isAutosave ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tblockEditorStore,\n\t\t\t\t'__unstableMarkLastChangeAsPersistent'\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Action generator for handling refreshing the current post.\n */\nexport function* refreshPost() {\n\tconst post = yield controls.select( STORE_NAME, 'getCurrentPost' );\n\tconst postTypeSlug = yield controls.select(\n\t\tSTORE_NAME,\n\t\t'getCurrentPostType'\n\t);\n\tconst postType = yield controls.resolveSelect(\n\t\tcoreStore,\n\t\t'getPostType',\n\t\tpostTypeSlug\n\t);\n\tconst newPost = yield apiFetch( {\n\t\t// Timestamp arg allows caller to bypass browser caching, which is\n\t\t// expected for this specific function.\n\t\tpath:\n\t\t\t`/wp/v2/${ postType.rest_base }/${ post.id }` +\n\t\t\t`?context=edit&_timestamp=${ Date.now() }`,\n\t} );\n\tyield controls.dispatch( STORE_NAME, 'resetPost', newPost );\n}\n\n/**\n * Action generator for trashing the current post in the editor.\n */\nexport function* trashPost() {\n\tconst postTypeSlug = yield controls.select(\n\t\tSTORE_NAME,\n\t\t'getCurrentPostType'\n\t);\n\tconst postType = yield controls.resolveSelect(\n\t\tcoreStore,\n\t\t'getPostType',\n\t\tpostTypeSlug\n\t);\n\tyield controls.dispatch(\n\t\tnoticesStore,\n\t\t'removeNotice',\n\t\tTRASH_POST_NOTICE_ID\n\t);\n\ttry {\n\t\tconst post = yield controls.select( STORE_NAME, 'getCurrentPost' );\n\t\tyield apiFetch( {\n\t\t\tpath: `/wp/v2/${ postType.rest_base }/${ post.id }`,\n\t\t\tmethod: 'DELETE',\n\t\t} );\n\n\t\tyield controls.dispatch( STORE_NAME, 'savePost' );\n\t} catch ( error ) {\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createErrorNotice',\n\t\t\t...getNotificationArgumentsForTrashFail( { error } )\n\t\t);\n\t}\n}\n\n/**\n * Action generator used in signalling that the post should autosave. This\n * includes server-side autosaving (default) and client-side (a.k.a. local)\n * autosaving (e.g. on the Web, the post might be committed to Session\n * Storage).\n *\n * @param {Object?} options Extra flags to identify the autosave.\n */\nexport function* autosave( { local = false, ...options } = {} ) {\n\tif ( local ) {\n\t\tconst post = yield controls.select( STORE_NAME, 'getCurrentPost' );\n\t\tconst isPostNew = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'isEditedPostNew'\n\t\t);\n\t\tconst title = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'getEditedPostAttribute',\n\t\t\t'title'\n\t\t);\n\t\tconst content = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'getEditedPostAttribute',\n\t\t\t'content'\n\t\t);\n\t\tconst excerpt = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'getEditedPostAttribute',\n\t\t\t'excerpt'\n\t\t);\n\t\tyield {\n\t\t\ttype: 'LOCAL_AUTOSAVE_SET',\n\t\t\tpostId: post.id,\n\t\t\tisPostNew,\n\t\t\ttitle,\n\t\t\tcontent,\n\t\t\texcerpt,\n\t\t};\n\t} else {\n\t\tyield controls.dispatch( STORE_NAME, 'savePost', {\n\t\t\tisAutosave: true,\n\t\t\t...options,\n\t\t} );\n\t}\n}\n\n/**\n * Returns an action object used in signalling that undo history should\n * restore last popped state.\n *\n * @yield {Object} Action object.\n */\nexport function* redo() {\n\tyield controls.dispatch( coreStore, 'redo' );\n}\n\n/**\n * Returns an action object used in signalling that undo history should pop.\n *\n * @yield {Object} Action object.\n */\nexport function* undo() {\n\tyield controls.dispatch( coreStore, 'undo' );\n}\n\n/**\n * Returns an action object used in signalling that undo history record should\n * be created.\n *\n * @return {Object} Action object.\n */\nexport function createUndoLevel() {\n\treturn { type: 'CREATE_UNDO_LEVEL' };\n}\n\n/**\n * Returns an action object used to lock the editor.\n *\n * @param {Object} lock Details about the post lock status, user, and nonce.\n *\n * @return {Object} Action object.\n */\nexport function updatePostLock( lock ) {\n\treturn {\n\t\ttype: 'UPDATE_POST_LOCK',\n\t\tlock,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user has enabled the\n * publish sidebar.\n *\n * @return {Object} Action object\n */\nexport function enablePublishSidebar() {\n\treturn {\n\t\ttype: 'ENABLE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user has disabled the\n * publish sidebar.\n *\n * @return {Object} Action object\n */\nexport function disablePublishSidebar() {\n\treturn {\n\t\ttype: 'DISABLE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used to signal that post saving is locked.\n *\n * @param {string} lockName The lock name.\n *\n * @example\n * ```\n * const { subscribe } = wp.data;\n *\n * const initialPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );\n *\n * // Only allow publishing posts that are set to a future date.\n * if ( 'publish' !== initialPostStatus ) {\n *\n * \t// Track locking.\n * \tlet locked = false;\n *\n * \t// Watch for the publish event.\n * \tlet unssubscribe = subscribe( () => {\n * \t\tconst currentPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );\n * \t\tif ( 'publish' !== currentPostStatus ) {\n *\n * \t\t\t// Compare the post date to the current date, lock the post if the date isn't in the future.\n * \t\t\tconst postDate = new Date( wp.data.select( 'core/editor' ).getEditedPostAttribute( 'date' ) );\n * \t\t\tconst currentDate = new Date();\n * \t\t\tif ( postDate.getTime() <= currentDate.getTime() ) {\n * \t\t\t\tif ( ! locked ) {\n * \t\t\t\t\tlocked = true;\n * \t\t\t\t\twp.data.dispatch( 'core/editor' ).lockPostSaving( 'futurelock' );\n * \t\t\t\t}\n * \t\t\t} else {\n * \t\t\t\tif ( locked ) {\n * \t\t\t\t\tlocked = false;\n * \t\t\t\t\twp.data.dispatch( 'core/editor' ).unlockPostSaving( 'futurelock' );\n * \t\t\t\t}\n * \t\t\t}\n * \t\t}\n * \t} );\n * }\n * ```\n *\n * @return {Object} Action object\n */\nexport function lockPostSaving( lockName ) {\n\treturn {\n\t\ttype: 'LOCK_POST_SAVING',\n\t\tlockName,\n\t};\n}\n\n/**\n * Returns an action object used to signal that post saving is unlocked.\n *\n * @param {string} lockName The lock name.\n *\n * @example\n * ```\n * // Unlock post saving with the lock key `mylock`:\n * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' );\n * ```\n *\n * @return {Object} Action object\n */\nexport function unlockPostSaving( lockName ) {\n\treturn {\n\t\ttype: 'UNLOCK_POST_SAVING',\n\t\tlockName,\n\t};\n}\n\n/**\n * Returns an action object used to signal that post autosaving is locked.\n *\n * @param {string} lockName The lock name.\n *\n * @example\n * ```\n * // Lock post autosaving with the lock key `mylock`:\n * wp.data.dispatch( 'core/editor' ).lockPostAutosaving( 'mylock' );\n * ```\n *\n * @return {Object} Action object\n */\nexport function lockPostAutosaving( lockName ) {\n\treturn {\n\t\ttype: 'LOCK_POST_AUTOSAVING',\n\t\tlockName,\n\t};\n}\n\n/**\n * Returns an action object used to signal that post autosaving is unlocked.\n *\n * @param {string} lockName The lock name.\n *\n * @example\n * ```\n * // Unlock post saving with the lock key `mylock`:\n * wp.data.dispatch( 'core/editor' ).unlockPostAutosaving( 'mylock' );\n * ```\n *\n * @return {Object} Action object\n */\nexport function unlockPostAutosaving( lockName ) {\n\treturn {\n\t\ttype: 'UNLOCK_POST_AUTOSAVING',\n\t\tlockName,\n\t};\n}\n\n/**\n * Returns an action object used to signal that the blocks have been updated.\n *\n * @param {Array} blocks Block Array.\n * @param {?Object} options Optional options.\n *\n * @yield {Object} Action object\n */\nexport function* resetEditorBlocks( blocks, options = {} ) {\n\tconst { __unstableShouldCreateUndoLevel, selection } = options;\n\tconst edits = { blocks, selection };\n\n\tif ( __unstableShouldCreateUndoLevel !== false ) {\n\t\tconst { id, type } = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'getCurrentPost'\n\t\t);\n\t\tconst noChange =\n\t\t\t( yield controls.select(\n\t\t\t\tcoreStore,\n\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t'postType',\n\t\t\t\ttype,\n\t\t\t\tid\n\t\t\t) ).blocks === edits.blocks;\n\t\tif ( noChange ) {\n\t\t\treturn yield controls.dispatch(\n\t\t\t\tcoreStore,\n\t\t\t\t'__unstableCreateUndoLevel',\n\t\t\t\t'postType',\n\t\t\t\ttype,\n\t\t\t\tid\n\t\t\t);\n\t\t}\n\n\t\t// We create a new function here on every persistent edit\n\t\t// to make sure the edit makes the post dirty and creates\n\t\t// a new undo level.\n\t\tedits.content = ( { blocks: blocksForSerialization = [] } ) =>\n\t\t\t__unstableSerializeAndClean( blocksForSerialization );\n\t}\n\tyield* editPost( edits );\n}\n\n/*\n * Returns an action object used in signalling that the post editor settings have been updated.\n *\n * @param {Object} settings Updated settings\n *\n * @return {Object} Action object\n */\nexport function updateEditorSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_EDITOR_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Backward compatibility\n */\n\nconst getBlockEditorAction = ( name ) =>\n\tfunction* ( ...args ) {\n\t\tdeprecated( \"`wp.data.dispatch( 'core/editor' ).\" + name + '`', {\n\t\t\tsince: '5.3',\n\t\t\talternative:\n\t\t\t\t\"`wp.data.dispatch( 'core/block-editor' ).\" + name + '`',\n\t\t} );\n\t\tyield controls.dispatch( blockEditorStore, name, ...args );\n\t};\n\n/**\n * @see resetBlocks in core/block-editor store.\n */\nexport const resetBlocks = getBlockEditorAction( 'resetBlocks' );\n\n/**\n * @see receiveBlocks in core/block-editor store.\n */\nexport const receiveBlocks = getBlockEditorAction( 'receiveBlocks' );\n\n/**\n * @see updateBlock in core/block-editor store.\n */\nexport const updateBlock = getBlockEditorAction( 'updateBlock' );\n\n/**\n * @see updateBlockAttributes in core/block-editor store.\n */\nexport const updateBlockAttributes = getBlockEditorAction(\n\t'updateBlockAttributes'\n);\n\n/**\n * @see selectBlock in core/block-editor store.\n */\nexport const selectBlock = getBlockEditorAction( 'selectBlock' );\n\n/**\n * @see startMultiSelect in core/block-editor store.\n */\nexport const startMultiSelect = getBlockEditorAction( 'startMultiSelect' );\n\n/**\n * @see stopMultiSelect in core/block-editor store.\n */\nexport const stopMultiSelect = getBlockEditorAction( 'stopMultiSelect' );\n\n/**\n * @see multiSelect in core/block-editor store.\n */\nexport const multiSelect = getBlockEditorAction( 'multiSelect' );\n\n/**\n * @see clearSelectedBlock in core/block-editor store.\n */\nexport const clearSelectedBlock = getBlockEditorAction( 'clearSelectedBlock' );\n\n/**\n * @see toggleSelection in core/block-editor store.\n */\nexport const toggleSelection = getBlockEditorAction( 'toggleSelection' );\n\n/**\n * @see replaceBlocks in core/block-editor store.\n */\nexport const replaceBlocks = getBlockEditorAction( 'replaceBlocks' );\n\n/**\n * @see replaceBlock in core/block-editor store.\n */\nexport const replaceBlock = getBlockEditorAction( 'replaceBlock' );\n\n/**\n * @see moveBlocksDown in core/block-editor store.\n */\nexport const moveBlocksDown = getBlockEditorAction( 'moveBlocksDown' );\n\n/**\n * @see moveBlocksUp in core/block-editor store.\n */\nexport const moveBlocksUp = getBlockEditorAction( 'moveBlocksUp' );\n\n/**\n * @see moveBlockToPosition in core/block-editor store.\n */\nexport const moveBlockToPosition = getBlockEditorAction(\n\t'moveBlockToPosition'\n);\n\n/**\n * @see insertBlock in core/block-editor store.\n */\nexport const insertBlock = getBlockEditorAction( 'insertBlock' );\n\n/**\n * @see insertBlocks in core/block-editor store.\n */\nexport const insertBlocks = getBlockEditorAction( 'insertBlocks' );\n\n/**\n * @see showInsertionPoint in core/block-editor store.\n */\nexport const showInsertionPoint = getBlockEditorAction( 'showInsertionPoint' );\n\n/**\n * @see hideInsertionPoint in core/block-editor store.\n */\nexport const hideInsertionPoint = getBlockEditorAction( 'hideInsertionPoint' );\n\n/**\n * @see setTemplateValidity in core/block-editor store.\n */\nexport const setTemplateValidity = getBlockEditorAction(\n\t'setTemplateValidity'\n);\n\n/**\n * @see synchronizeTemplate in core/block-editor store.\n */\nexport const synchronizeTemplate = getBlockEditorAction(\n\t'synchronizeTemplate'\n);\n\n/**\n * @see mergeBlocks in core/block-editor store.\n */\nexport const mergeBlocks = getBlockEditorAction( 'mergeBlocks' );\n\n/**\n * @see removeBlocks in core/block-editor store.\n */\nexport const removeBlocks = getBlockEditorAction( 'removeBlocks' );\n\n/**\n * @see removeBlock in core/block-editor store.\n */\nexport const removeBlock = getBlockEditorAction( 'removeBlock' );\n\n/**\n * @see toggleBlockMode in core/block-editor store.\n */\nexport const toggleBlockMode = getBlockEditorAction( 'toggleBlockMode' );\n\n/**\n * @see startTyping in core/block-editor store.\n */\nexport const startTyping = getBlockEditorAction( 'startTyping' );\n\n/**\n * @see stopTyping in core/block-editor store.\n */\nexport const stopTyping = getBlockEditorAction( 'stopTyping' );\n\n/**\n * @see enterFormattedText in core/block-editor store.\n */\nexport const enterFormattedText = getBlockEditorAction( 'enterFormattedText' );\n\n/**\n * @see exitFormattedText in core/block-editor store.\n */\nexport const exitFormattedText = getBlockEditorAction( 'exitFormattedText' );\n\n/**\n * @see insertDefaultBlock in core/block-editor store.\n */\nexport const insertDefaultBlock = getBlockEditorAction( 'insertDefaultBlock' );\n\n/**\n * @see updateBlockListSettings in core/block-editor store.\n */\nexport const updateBlockListSettings = getBlockEditorAction(\n\t'updateBlockListSettings'\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/store/actions.js"],"names":["setupEditor","post","edits","template","resetPost","type","setupEditorState","isNewPost","status","content","raw","blocks","resetEditorBlocks","__unstableShouldCreateUndoLevel","Object","keys","some","key","editPost","__experimentalTearDownEditor","__experimentalRequestPostUpdateStart","options","__experimentalRequestPostUpdateFinish","updatePost","since","alternative","id","controls","select","STORE_NAME","dispatch","coreStore","savePost","isAutosave","undoIgnore","previousRecord","error","args","length","noticesStore","updatedRecord","previousPost","postType","resolveSelect","blockEditorStore","refreshPost","version","trashPost","postTypeSlug","TRASH_POST_NOTICE_ID","path","rest_base","method","autosave","local","isPostNew","title","excerpt","postId","redo","undo","createUndoLevel","updatePostLock","lock","enablePublishSidebar","disablePublishSidebar","lockPostSaving","lockName","unlockPostSaving","lockPostAutosaving","unlockPostAutosaving","selection","noChange","blocksForSerialization","updateEditorSettings","settings","getBlockEditorAction","name","resetBlocks","receiveBlocks","updateBlock","updateBlockAttributes","selectBlock","startMultiSelect","stopMultiSelect","multiSelect","clearSelectedBlock","toggleSelection","replaceBlocks","replaceBlock","moveBlocksDown","moveBlocksUp","moveBlockToPosition","insertBlock","insertBlocks","showInsertionPoint","hideInsertionPoint","setTemplateValidity","synchronizeTemplate","mergeBlocks","removeBlocks","removeBlock","toggleBlockMode","startTyping","stopTyping","enterFormattedText","exitFormattedText","insertDefaultBlock","updateBlockListSettings"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,UAAUA,WAAV,CAAuBC,IAAvB,EAA6BC,KAA7B,EAAoCC,QAApC,EAA+C;AACrD,QAAMC,SAAS,CAAEH,IAAF,CAAf;AACA,QAAM;AACLI,IAAAA,IAAI,EAAE,cADD;AAELJ,IAAAA,IAFK;AAGLC,IAAAA,KAHK;AAILC,IAAAA;AAJK,GAAN;AAMA,QAAMG,gBAAgB,CAAEL,IAAF,CAAtB,CARqD,CASrD;;AACA,QAAMM,SAAS,GAAGN,IAAI,CAACO,MAAL,KAAgB,YAAlC;;AACA,MAAKD,SAAS,IAAIJ,QAAlB,EAA6B;AAC5B;AACA;AACA;AACA,QAAIM,OAAJ;;AACA,QAAK,iBAAKP,KAAL,EAAY,CAAE,SAAF,CAAZ,CAAL,EAAmC;AAClCO,MAAAA,OAAO,GAAGP,KAAK,CAACO,OAAhB;AACA,KAFD,MAEO;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,QAAMjC,eAASG,QAAT,CAAmBC,eAAnB,EAA8B,MAA9B,CAAN;AACA;AAED;AACA;AACA;AACA;AACA;;;AACO,SAAS8B,eAAT,GAA2B;AACjC,2BAAY,mDAAZ,EAAiE;AAChErC,IAAAA,KAAK,EAAE,KADyD;AAEhEsB,IAAAA,OAAO,EAAE,KAFuD;AAGhErB,IAAAA,WAAW,EAAE;AAHmD,GAAjE;AAKA,SAAO;AAAEpB,IAAAA,IAAI,EAAE;AAAR,GAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASyD,cAAT,CAAyBC,IAAzB,EAAgC;AACtC,SAAO;AACN1D,IAAAA,IAAI,EAAE,kBADA;AAEN0D,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,oBAAT,GAAgC;AACtC,SAAO;AACN3D,IAAAA,IAAI,EAAE;AADA,GAAP;AAGA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAAS4D,qBAAT,GAAiC;AACvC,SAAO;AACN5D,IAAAA,IAAI,EAAE;AADA,GAAP;AAGA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAAS6D,cAAT,CAAyBC,QAAzB,EAAoC;AAC1C,SAAO;AACN9D,IAAAA,IAAI,EAAE,kBADA;AAEN8D,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,gBAAT,CAA2BD,QAA3B,EAAsC;AAC5C,SAAO;AACN9D,IAAAA,IAAI,EAAE,oBADA;AAEN8D,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA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AAF,CAA5C;AAEP;AACA;AACA;;;AACO,MAAM2B,WAAW,GAAG3B,oBAAoB,CAAE,aAAF,CAAxC;AAEP;AACA;AACA;;;AACO,MAAM4B,UAAU,GAAG5B,oBAAoB,CAAE,YAAF,CAAvC;AAEP;AACA;AACA;;;AACO,MAAM6B,kBAAkB,GAAG7B,oBAAoB,CAAE,oBAAF,CAA/C;AAEP;AACA;AACA;;;AACO,MAAM8B,iBAAiB,GAAG9B,oBAAoB,CAAE,mBAAF,CAA9C;AAEP;AACA;AACA;;;AACO,MAAM+B,kBAAkB,GAAG/B,oBAAoB,CAAE,oBAAF,CAA/C;AAEP;AACA;AACA;;;AACO,MAAMgC,uBAAuB,GAAGhC,oBAAoB,CAC1D,yBAD0D,CAApD","sourcesContent":["/**\n * External dependencies\n */\nimport { has } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { controls } from '@wordpress/data';\nimport { apiFetch } from '@wordpress/data-controls';\nimport {\n\tparse,\n\tsynchronizeBlocksWithTemplate,\n\t__unstableSerializeAndClean,\n} from '@wordpress/blocks';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME, TRASH_POST_NOTICE_ID } from './constants';\nimport {\n\tgetNotificationArgumentsForSaveSuccess,\n\tgetNotificationArgumentsForSaveFail,\n\tgetNotificationArgumentsForTrashFail,\n} from './utils/notice-builder';\n\n/**\n * Returns an action generator used in signalling that editor has initialized with\n * the specified post object and editor settings.\n *\n * @param {Object} post Post object.\n * @param {Object} edits Initial edited attributes object.\n * @param {Array?} template Block Template.\n */\nexport function* setupEditor( post, edits, template ) {\n\tyield resetPost( post );\n\tyield {\n\t\ttype: 'SETUP_EDITOR',\n\t\tpost,\n\t\tedits,\n\t\ttemplate,\n\t};\n\tyield setupEditorState( post );\n\t// Apply a template for new posts only, if exists.\n\tconst isNewPost = post.status === 'auto-draft';\n\tif ( isNewPost && template ) {\n\t\t// In order to ensure maximum of a single parse during setup, edits are\n\t\t// included as part of editor setup action. Assume edited content as\n\t\t// canonical if provided, falling back to post.\n\t\tlet content;\n\t\tif ( has( edits, [ 'content' ] ) ) {\n\t\t\tcontent = edits.content;\n\t\t} else {\n\t\t\tcontent = post.content.raw;\n\t\t}\n\t\tlet blocks = parse( content );\n\t\tblocks = synchronizeBlocksWithTemplate( blocks, template );\n\t\tyield resetEditorBlocks( blocks, {\n\t\t\t__unstableShouldCreateUndoLevel: false,\n\t\t} );\n\t}\n\tif (\n\t\tedits &&\n\t\tObject.keys( edits ).some(\n\t\t\t( key ) =>\n\t\t\t\tedits[ key ] !==\n\t\t\t\t( has( post, [ key, 'raw' ] ) ? post[ key ].raw : post[ key ] )\n\t\t)\n\t) {\n\t\tyield editPost( edits );\n\t}\n}\n\n/**\n * Returns an action object signalling that the editor is being destroyed and\n * that any necessary state or side-effect cleanup should occur.\n *\n * @return {Object} Action object.\n */\nexport function __experimentalTearDownEditor() {\n\treturn { type: 'TEAR_DOWN_EDITOR' };\n}\n\n/**\n * Returns an action object used in signalling that the latest version of the\n * post has been received, either by initialization or save.\n *\n * @param {Object} post Post object.\n *\n * @return {Object} Action object.\n */\nexport function resetPost( post ) {\n\treturn {\n\t\ttype: 'RESET_POST',\n\t\tpost,\n\t};\n}\n\n/**\n * Action for dispatching that a post update request has started.\n *\n * @param {Object} options\n *\n * @return {Object} An action object\n */\nexport function __experimentalRequestPostUpdateStart( options = {} ) {\n\treturn {\n\t\ttype: 'REQUEST_POST_UPDATE_START',\n\t\toptions,\n\t};\n}\n\n/**\n * Action for dispatching that a post update request has finished.\n *\n * @param {Object} options\n *\n * @return {Object} An action object\n */\nexport function __experimentalRequestPostUpdateFinish( options = {} ) {\n\treturn {\n\t\ttype: 'REQUEST_POST_UPDATE_FINISH',\n\t\toptions,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a patch of updates for the\n * latest version of the post have been received.\n *\n * @return {Object} Action object.\n * @deprecated since Gutenberg 9.7.0.\n */\nexport function updatePost() {\n\tdeprecated( \"wp.data.dispatch( 'core/editor' ).updatePost\", {\n\t\tsince: '5.7',\n\t\talternative: 'Use the core entities store instead',\n\t} );\n\treturn {\n\t\ttype: 'DO_NOTHING',\n\t};\n}\n\n/**\n * Returns an action object used to setup the editor state when first opening\n * an editor.\n *\n * @param {Object} post Post object.\n *\n * @return {Object} Action object.\n */\nexport function setupEditorState( post ) {\n\treturn {\n\t\ttype: 'SETUP_EDITOR_STATE',\n\t\tpost,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that attributes of the post have\n * been edited.\n *\n * @param {Object} edits Post attributes to edit.\n * @param {Object} options Options for the edit.\n *\n * @yield {Object} Action object or control.\n */\nexport function* editPost( edits, options ) {\n\tconst { id, type } = yield controls.select( STORE_NAME, 'getCurrentPost' );\n\tyield controls.dispatch(\n\t\tcoreStore,\n\t\t'editEntityRecord',\n\t\t'postType',\n\t\ttype,\n\t\tid,\n\t\tedits,\n\t\toptions\n\t);\n}\n\n/**\n * Action generator for saving the current post in the editor.\n *\n * @param {Object} options\n */\nexport function* savePost( options = {} ) {\n\tif ( ! ( yield controls.select( STORE_NAME, 'isEditedPostSaveable' ) ) ) {\n\t\treturn;\n\t}\n\tlet edits = {\n\t\tcontent: yield controls.select( STORE_NAME, 'getEditedPostContent' ),\n\t};\n\tif ( ! options.isAutosave ) {\n\t\tyield controls.dispatch( STORE_NAME, 'editPost', edits, {\n\t\t\tundoIgnore: true,\n\t\t} );\n\t}\n\n\tyield __experimentalRequestPostUpdateStart( options );\n\tconst previousRecord = yield controls.select(\n\t\tSTORE_NAME,\n\t\t'getCurrentPost'\n\t);\n\tedits = {\n\t\tid: previousRecord.id,\n\t\t...( yield controls.select(\n\t\t\tcoreStore,\n\t\t\t'getEntityRecordNonTransientEdits',\n\t\t\t'postType',\n\t\t\tpreviousRecord.type,\n\t\t\tpreviousRecord.id\n\t\t) ),\n\t\t...edits,\n\t};\n\tyield controls.dispatch(\n\t\tcoreStore,\n\t\t'saveEntityRecord',\n\t\t'postType',\n\t\tpreviousRecord.type,\n\t\tedits,\n\t\toptions\n\t);\n\tyield __experimentalRequestPostUpdateFinish( options );\n\n\tconst error = yield controls.select(\n\t\tcoreStore,\n\t\t'getLastEntitySaveError',\n\t\t'postType',\n\t\tpreviousRecord.type,\n\t\tpreviousRecord.id\n\t);\n\tif ( error ) {\n\t\tconst args = getNotificationArgumentsForSaveFail( {\n\t\t\tpost: previousRecord,\n\t\t\tedits,\n\t\t\terror,\n\t\t} );\n\t\tif ( args.length ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createErrorNotice',\n\t\t\t\t...args\n\t\t\t);\n\t\t}\n\t} else {\n\t\tconst updatedRecord = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'getCurrentPost'\n\t\t);\n\t\tconst args = getNotificationArgumentsForSaveSuccess( {\n\t\t\tpreviousPost: previousRecord,\n\t\t\tpost: updatedRecord,\n\t\t\tpostType: yield controls.resolveSelect(\n\t\t\t\tcoreStore,\n\t\t\t\t'getPostType',\n\t\t\t\tupdatedRecord.type\n\t\t\t),\n\t\t\toptions,\n\t\t} );\n\t\tif ( args.length ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createSuccessNotice',\n\t\t\t\t...args\n\t\t\t);\n\t\t}\n\t\t// Make sure that any edits after saving create an undo level and are\n\t\t// considered for change detection.\n\t\tif ( ! options.isAutosave ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tblockEditorStore,\n\t\t\t\t'__unstableMarkLastChangeAsPersistent'\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Action for refreshing the current post.\n *\n * @deprecated Since WordPress 6.0.\n */\nexport function refreshPost() {\n\tdeprecated( \"wp.data.dispatch( 'core/editor' ).refreshPost\", {\n\t\tsince: '6.0',\n\t\tversion: '6.3',\n\t\talternative: 'Use the core entities store instead',\n\t} );\n\treturn { type: 'DO_NOTHING' };\n}\n\n/**\n * Action generator for trashing the current post in the editor.\n */\nexport function* trashPost() {\n\tconst postTypeSlug = yield controls.select(\n\t\tSTORE_NAME,\n\t\t'getCurrentPostType'\n\t);\n\tconst postType = yield controls.resolveSelect(\n\t\tcoreStore,\n\t\t'getPostType',\n\t\tpostTypeSlug\n\t);\n\tyield controls.dispatch(\n\t\tnoticesStore,\n\t\t'removeNotice',\n\t\tTRASH_POST_NOTICE_ID\n\t);\n\ttry {\n\t\tconst post = yield controls.select( STORE_NAME, 'getCurrentPost' );\n\t\tyield apiFetch( {\n\t\t\tpath: `/wp/v2/${ postType.rest_base }/${ post.id }`,\n\t\t\tmethod: 'DELETE',\n\t\t} );\n\n\t\tyield controls.dispatch( STORE_NAME, 'savePost' );\n\t} catch ( error ) {\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createErrorNotice',\n\t\t\t...getNotificationArgumentsForTrashFail( { error } )\n\t\t);\n\t}\n}\n\n/**\n * Action generator used in signalling that the post should autosave. This\n * includes server-side autosaving (default) and client-side (a.k.a. local)\n * autosaving (e.g. on the Web, the post might be committed to Session\n * Storage).\n *\n * @param {Object?} options Extra flags to identify the autosave.\n */\nexport function* autosave( { local = false, ...options } = {} ) {\n\tif ( local ) {\n\t\tconst post = yield controls.select( STORE_NAME, 'getCurrentPost' );\n\t\tconst isPostNew = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'isEditedPostNew'\n\t\t);\n\t\tconst title = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'getEditedPostAttribute',\n\t\t\t'title'\n\t\t);\n\t\tconst content = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'getEditedPostAttribute',\n\t\t\t'content'\n\t\t);\n\t\tconst excerpt = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'getEditedPostAttribute',\n\t\t\t'excerpt'\n\t\t);\n\t\tyield {\n\t\t\ttype: 'LOCAL_AUTOSAVE_SET',\n\t\t\tpostId: post.id,\n\t\t\tisPostNew,\n\t\t\ttitle,\n\t\t\tcontent,\n\t\t\texcerpt,\n\t\t};\n\t} else {\n\t\tyield controls.dispatch( STORE_NAME, 'savePost', {\n\t\t\tisAutosave: true,\n\t\t\t...options,\n\t\t} );\n\t}\n}\n\n/**\n * Returns an action object used in signalling that undo history should\n * restore last popped state.\n *\n * @yield {Object} Action object.\n */\nexport function* redo() {\n\tyield controls.dispatch( coreStore, 'redo' );\n}\n\n/**\n * Returns an action object used in signalling that undo history should pop.\n *\n * @yield {Object} Action object.\n */\nexport function* undo() {\n\tyield controls.dispatch( coreStore, 'undo' );\n}\n\n/**\n * Action that creates an undo history record.\n *\n * @deprecated Since WordPress 6.0\n */\nexport function createUndoLevel() {\n\tdeprecated( \"wp.data.dispatch( 'core/editor' ).createUndoLevel\", {\n\t\tsince: '6.0',\n\t\tversion: '6.3',\n\t\talternative: 'Use the core entities store instead',\n\t} );\n\treturn { type: 'DO_NOTHING' };\n}\n\n/**\n * Returns an action object used to lock the editor.\n *\n * @param {Object} lock Details about the post lock status, user, and nonce.\n *\n * @return {Object} Action object.\n */\nexport function updatePostLock( lock ) {\n\treturn {\n\t\ttype: 'UPDATE_POST_LOCK',\n\t\tlock,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user has enabled the\n * publish sidebar.\n *\n * @return {Object} Action object\n */\nexport function enablePublishSidebar() {\n\treturn {\n\t\ttype: 'ENABLE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user has disabled the\n * publish sidebar.\n *\n * @return {Object} Action object\n */\nexport function disablePublishSidebar() {\n\treturn {\n\t\ttype: 'DISABLE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used to signal that post saving is locked.\n *\n * @param {string} lockName The lock name.\n *\n * @example\n * ```\n * const { subscribe } = wp.data;\n *\n * const initialPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );\n *\n * // Only allow publishing posts that are set to a future date.\n * if ( 'publish' !== initialPostStatus ) {\n *\n * \t// Track locking.\n * \tlet locked = false;\n *\n * \t// Watch for the publish event.\n * \tlet unssubscribe = subscribe( () => {\n * \t\tconst currentPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );\n * \t\tif ( 'publish' !== currentPostStatus ) {\n *\n * \t\t\t// Compare the post date to the current date, lock the post if the date isn't in the future.\n * \t\t\tconst postDate = new Date( wp.data.select( 'core/editor' ).getEditedPostAttribute( 'date' ) );\n * \t\t\tconst currentDate = new Date();\n * \t\t\tif ( postDate.getTime() <= currentDate.getTime() ) {\n * \t\t\t\tif ( ! locked ) {\n * \t\t\t\t\tlocked = true;\n * \t\t\t\t\twp.data.dispatch( 'core/editor' ).lockPostSaving( 'futurelock' );\n * \t\t\t\t}\n * \t\t\t} else {\n * \t\t\t\tif ( locked ) {\n * \t\t\t\t\tlocked = false;\n * \t\t\t\t\twp.data.dispatch( 'core/editor' ).unlockPostSaving( 'futurelock' );\n * \t\t\t\t}\n * \t\t\t}\n * \t\t}\n * \t} );\n * }\n * ```\n *\n * @return {Object} Action object\n */\nexport function lockPostSaving( lockName ) {\n\treturn {\n\t\ttype: 'LOCK_POST_SAVING',\n\t\tlockName,\n\t};\n}\n\n/**\n * Returns an action object used to signal that post saving is unlocked.\n *\n * @param {string} lockName The lock name.\n *\n * @example\n * ```\n * // Unlock post saving with the lock key `mylock`:\n * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' );\n * ```\n *\n * @return {Object} Action object\n */\nexport function unlockPostSaving( lockName ) {\n\treturn {\n\t\ttype: 'UNLOCK_POST_SAVING',\n\t\tlockName,\n\t};\n}\n\n/**\n * Returns an action object used to signal that post autosaving is locked.\n *\n * @param {string} lockName The lock name.\n *\n * @example\n * ```\n * // Lock post autosaving with the lock key `mylock`:\n * wp.data.dispatch( 'core/editor' ).lockPostAutosaving( 'mylock' );\n * ```\n *\n * @return {Object} Action object\n */\nexport function lockPostAutosaving( lockName ) {\n\treturn {\n\t\ttype: 'LOCK_POST_AUTOSAVING',\n\t\tlockName,\n\t};\n}\n\n/**\n * Returns an action object used to signal that post autosaving is unlocked.\n *\n * @param {string} lockName The lock name.\n *\n * @example\n * ```\n * // Unlock post saving with the lock key `mylock`:\n * wp.data.dispatch( 'core/editor' ).unlockPostAutosaving( 'mylock' );\n * ```\n *\n * @return {Object} Action object\n */\nexport function unlockPostAutosaving( lockName ) {\n\treturn {\n\t\ttype: 'UNLOCK_POST_AUTOSAVING',\n\t\tlockName,\n\t};\n}\n\n/**\n * Returns an action object used to signal that the blocks have been updated.\n *\n * @param {Array} blocks Block Array.\n * @param {?Object} options Optional options.\n *\n * @yield {Object} Action object\n */\nexport function* resetEditorBlocks( blocks, options = {} ) {\n\tconst { __unstableShouldCreateUndoLevel, selection } = options;\n\tconst edits = { blocks, selection };\n\n\tif ( __unstableShouldCreateUndoLevel !== false ) {\n\t\tconst { id, type } = yield controls.select(\n\t\t\tSTORE_NAME,\n\t\t\t'getCurrentPost'\n\t\t);\n\t\tconst noChange =\n\t\t\t( yield controls.select(\n\t\t\t\tcoreStore,\n\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t'postType',\n\t\t\t\ttype,\n\t\t\t\tid\n\t\t\t) ).blocks === edits.blocks;\n\t\tif ( noChange ) {\n\t\t\treturn yield controls.dispatch(\n\t\t\t\tcoreStore,\n\t\t\t\t'__unstableCreateUndoLevel',\n\t\t\t\t'postType',\n\t\t\t\ttype,\n\t\t\t\tid\n\t\t\t);\n\t\t}\n\n\t\t// We create a new function here on every persistent edit\n\t\t// to make sure the edit makes the post dirty and creates\n\t\t// a new undo level.\n\t\tedits.content = ( { blocks: blocksForSerialization = [] } ) =>\n\t\t\t__unstableSerializeAndClean( blocksForSerialization );\n\t}\n\tyield* editPost( edits );\n}\n\n/*\n * Returns an action object used in signalling that the post editor settings have been updated.\n *\n * @param {Object} settings Updated settings\n *\n * @return {Object} Action object\n */\nexport function updateEditorSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_EDITOR_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Backward compatibility\n */\n\nconst getBlockEditorAction = ( name ) =>\n\tfunction* ( ...args ) {\n\t\tdeprecated( \"`wp.data.dispatch( 'core/editor' ).\" + name + '`', {\n\t\t\tsince: '5.3',\n\t\t\talternative:\n\t\t\t\t\"`wp.data.dispatch( 'core/block-editor' ).\" + name + '`',\n\t\t\tversion: '6.2',\n\t\t} );\n\t\tyield controls.dispatch( blockEditorStore, name, ...args );\n\t};\n\n/**\n * @see resetBlocks in core/block-editor store.\n */\nexport const resetBlocks = getBlockEditorAction( 'resetBlocks' );\n\n/**\n * @see receiveBlocks in core/block-editor store.\n */\nexport const receiveBlocks = getBlockEditorAction( 'receiveBlocks' );\n\n/**\n * @see updateBlock in core/block-editor store.\n */\nexport const updateBlock = getBlockEditorAction( 'updateBlock' );\n\n/**\n * @see updateBlockAttributes in core/block-editor store.\n */\nexport const updateBlockAttributes = getBlockEditorAction(\n\t'updateBlockAttributes'\n);\n\n/**\n * @see selectBlock in core/block-editor store.\n */\nexport const selectBlock = getBlockEditorAction( 'selectBlock' );\n\n/**\n * @see startMultiSelect in core/block-editor store.\n */\nexport const startMultiSelect = getBlockEditorAction( 'startMultiSelect' );\n\n/**\n * @see stopMultiSelect in core/block-editor store.\n */\nexport const stopMultiSelect = getBlockEditorAction( 'stopMultiSelect' );\n\n/**\n * @see multiSelect in core/block-editor store.\n */\nexport const multiSelect = getBlockEditorAction( 'multiSelect' );\n\n/**\n * @see clearSelectedBlock in core/block-editor store.\n */\nexport const clearSelectedBlock = getBlockEditorAction( 'clearSelectedBlock' );\n\n/**\n * @see toggleSelection in core/block-editor store.\n */\nexport const toggleSelection = getBlockEditorAction( 'toggleSelection' );\n\n/**\n * @see replaceBlocks in core/block-editor store.\n */\nexport const replaceBlocks = getBlockEditorAction( 'replaceBlocks' );\n\n/**\n * @see replaceBlock in core/block-editor store.\n */\nexport const replaceBlock = getBlockEditorAction( 'replaceBlock' );\n\n/**\n * @see moveBlocksDown in core/block-editor store.\n */\nexport const moveBlocksDown = getBlockEditorAction( 'moveBlocksDown' );\n\n/**\n * @see moveBlocksUp in core/block-editor store.\n */\nexport const moveBlocksUp = getBlockEditorAction( 'moveBlocksUp' );\n\n/**\n * @see moveBlockToPosition in core/block-editor store.\n */\nexport const moveBlockToPosition = getBlockEditorAction(\n\t'moveBlockToPosition'\n);\n\n/**\n * @see insertBlock in core/block-editor store.\n */\nexport const insertBlock = getBlockEditorAction( 'insertBlock' );\n\n/**\n * @see insertBlocks in core/block-editor store.\n */\nexport const insertBlocks = getBlockEditorAction( 'insertBlocks' );\n\n/**\n * @see showInsertionPoint in core/block-editor store.\n */\nexport const showInsertionPoint = getBlockEditorAction( 'showInsertionPoint' );\n\n/**\n * @see hideInsertionPoint in core/block-editor store.\n */\nexport const hideInsertionPoint = getBlockEditorAction( 'hideInsertionPoint' );\n\n/**\n * @see setTemplateValidity in core/block-editor store.\n */\nexport const setTemplateValidity = getBlockEditorAction(\n\t'setTemplateValidity'\n);\n\n/**\n * @see synchronizeTemplate in core/block-editor store.\n */\nexport const synchronizeTemplate = getBlockEditorAction(\n\t'synchronizeTemplate'\n);\n\n/**\n * @see mergeBlocks in core/block-editor store.\n */\nexport const mergeBlocks = getBlockEditorAction( 'mergeBlocks' );\n\n/**\n * @see removeBlocks in core/block-editor store.\n */\nexport const removeBlocks = getBlockEditorAction( 'removeBlocks' );\n\n/**\n * @see removeBlock in core/block-editor store.\n */\nexport const removeBlock = getBlockEditorAction( 'removeBlock' );\n\n/**\n * @see toggleBlockMode in core/block-editor store.\n */\nexport const toggleBlockMode = getBlockEditorAction( 'toggleBlockMode' );\n\n/**\n * @see startTyping in core/block-editor store.\n */\nexport const startTyping = getBlockEditorAction( 'startTyping' );\n\n/**\n * @see stopTyping in core/block-editor store.\n */\nexport const stopTyping = getBlockEditorAction( 'stopTyping' );\n\n/**\n * @see enterFormattedText in core/block-editor store.\n */\nexport const enterFormattedText = getBlockEditorAction( 'enterFormattedText' );\n\n/**\n * @see exitFormattedText in core/block-editor store.\n */\nexport const exitFormattedText = getBlockEditorAction( 'exitFormattedText' );\n\n/**\n * @see insertDefaultBlock in core/block-editor store.\n */\nexport const insertDefaultBlock = getBlockEditorAction( 'insertDefaultBlock' );\n\n/**\n * @see updateBlockListSettings in core/block-editor store.\n */\nexport const updateBlockListSettings = getBlockEditorAction(\n\t'updateBlockListSettings'\n);\n"]}
|