@wordpress/editor 12.4.0 → 12.5.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/post-excerpt/index.js +1 -1
  3. package/build/components/post-excerpt/index.js.map +1 -1
  4. package/build/components/provider/use-block-editor-settings.js +15 -2
  5. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  6. package/build/store/actions.js +27 -26
  7. package/build/store/actions.js.map +1 -1
  8. package/build/store/defaults.js +2 -8
  9. package/build/store/defaults.js.map +1 -1
  10. package/build/store/index.js +3 -8
  11. package/build/store/index.js.map +1 -1
  12. package/build/store/reducer.js +0 -30
  13. package/build/store/reducer.js.map +1 -1
  14. package/build/store/reducer.native.js +0 -1
  15. package/build/store/reducer.native.js.map +1 -1
  16. package/build/store/selectors.js +4 -11
  17. package/build/store/selectors.js.map +1 -1
  18. package/build-module/components/post-excerpt/index.js +1 -1
  19. package/build-module/components/post-excerpt/index.js.map +1 -1
  20. package/build-module/components/provider/use-block-editor-settings.js +15 -2
  21. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  22. package/build-module/store/actions.js +21 -22
  23. package/build-module/store/actions.js.map +1 -1
  24. package/build-module/store/defaults.js +0 -5
  25. package/build-module/store/defaults.js.map +1 -1
  26. package/build-module/store/index.js +3 -8
  27. package/build-module/store/index.js.map +1 -1
  28. package/build-module/store/reducer.js +1 -29
  29. package/build-module/store/reducer.js.map +1 -1
  30. package/build-module/store/reducer.native.js +1 -2
  31. package/build-module/store/reducer.native.js.map +1 -1
  32. package/build-module/store/selectors.js +2 -10
  33. package/build-module/store/selectors.js.map +1 -1
  34. package/package.json +27 -26
  35. package/src/components/post-excerpt/index.js +3 -1
  36. package/src/components/provider/use-block-editor-settings.js +22 -3
  37. package/src/store/actions.js +13 -16
  38. package/src/store/defaults.js +0 -5
  39. package/src/store/index.js +2 -8
  40. package/src/store/reducer.js +1 -28
  41. package/src/store/reducer.native.js +0 -2
  42. package/src/store/selectors.js +8 -9
  43. package/src/store/test/actions.js +37 -0
  44. package/src/store/test/reducer.js +0 -31
  45. package/src/store/test/selectors.js +0 -35
@@ -12,6 +12,7 @@ import { parse, synchronizeBlocksWithTemplate, __unstableSerializeAndClean } fro
12
12
  import { store as noticesStore } from '@wordpress/notices';
13
13
  import { store as coreStore } from '@wordpress/core-data';
14
14
  import { store as blockEditorStore } from '@wordpress/block-editor';
15
+ import { store as preferencesStore } from '@wordpress/preferences';
15
16
  /**
16
17
  * Internal dependencies
17
18
  */
@@ -349,27 +350,25 @@ export function updatePostLock(lock) {
349
350
  };
350
351
  }
351
352
  /**
352
- * Action that enables the publish sidebar.
353
- *
354
- * @return {Object} Action object
353
+ * Enable the publish sidebar.
355
354
  */
356
355
 
357
- export function enablePublishSidebar() {
358
- return {
359
- type: 'ENABLE_PUBLISH_SIDEBAR'
360
- };
361
- }
356
+ export const enablePublishSidebar = () => _ref9 => {
357
+ let {
358
+ registry
359
+ } = _ref9;
360
+ registry.dispatch(preferencesStore).set('core/edit-post', 'isPublishSidebarEnabled', true);
361
+ };
362
362
  /**
363
- * Action that disables the publish sidebar.
364
- *
365
- * @return {Object} Action object
363
+ * Disables the publish sidebar.
366
364
  */
367
365
 
368
- export function disablePublishSidebar() {
369
- return {
370
- type: 'DISABLE_PUBLISH_SIDEBAR'
371
- };
372
- }
366
+ export const disablePublishSidebar = () => _ref10 => {
367
+ let {
368
+ registry
369
+ } = _ref10;
370
+ registry.dispatch(preferencesStore).set('core/edit-post', 'isPublishSidebarEnabled', false);
371
+ };
373
372
  /**
374
373
  * Action that locks post saving.
375
374
  *
@@ -489,12 +488,12 @@ export function unlockPostAutosaving(lockName) {
489
488
 
490
489
  export const resetEditorBlocks = function (blocks) {
491
490
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
492
- return _ref9 => {
491
+ return _ref11 => {
493
492
  let {
494
493
  select,
495
494
  dispatch,
496
495
  registry
497
- } = _ref9;
496
+ } = _ref11;
498
497
  const {
499
498
  __unstableShouldCreateUndoLevel,
500
499
  selection
@@ -520,10 +519,10 @@ export const resetEditorBlocks = function (blocks) {
520
519
  // a new undo level.
521
520
 
522
521
 
523
- edits.content = _ref10 => {
522
+ edits.content = _ref12 => {
524
523
  let {
525
524
  blocks: blocksForSerialization = []
526
- } = _ref10;
525
+ } = _ref12;
527
526
  return __unstableSerializeAndClean(blocksForSerialization);
528
527
  };
529
528
  }
@@ -554,10 +553,10 @@ const getBlockEditorAction = name => function () {
554
553
  args[_key] = arguments[_key];
555
554
  }
556
555
 
557
- return _ref11 => {
556
+ return _ref13 => {
558
557
  let {
559
558
  registry
560
- } = _ref11;
559
+ } = _ref13;
561
560
  deprecated("`wp.data.dispatch( 'core/editor' )." + name + '`', {
562
561
  since: '5.3',
563
562
  alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`',
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/store/actions.js"],"names":["has","apiFetch","deprecated","parse","synchronizeBlocksWithTemplate","__unstableSerializeAndClean","store","noticesStore","coreStore","blockEditorStore","TRASH_POST_NOTICE_ID","localAutosaveSet","getNotificationArgumentsForSaveSuccess","getNotificationArgumentsForSaveFail","getNotificationArgumentsForTrashFail","setupEditor","post","edits","template","dispatch","setupEditorState","isNewPost","status","content","raw","blocks","resetEditorBlocks","__unstableShouldCreateUndoLevel","Object","values","some","key","edit","editPost","__experimentalTearDownEditor","type","resetPost","since","version","alternative","updatePost","options","select","registry","id","getCurrentPost","editEntityRecord","savePost","isEditedPostSaveable","getEditedPostContent","isAutosave","undoIgnore","previousRecord","getEntityRecordNonTransientEdits","saveEntityRecord","error","getLastEntitySaveError","args","length","createErrorNotice","updatedRecord","previousPost","postType","resolveSelect","getPostType","createSuccessNotice","__unstableMarkLastChangeAsPersistent","refreshPost","trashPost","postTypeSlug","getCurrentPostType","removeNotice","path","rest_base","method","autosave","local","isPostNew","isEditedPostNew","title","getEditedPostAttribute","excerpt","redo","undo","createUndoLevel","updatePostLock","lock","enablePublishSidebar","disablePublishSidebar","lockPostSaving","lockName","unlockPostSaving","lockPostAutosaving","unlockPostAutosaving","selection","noChange","getEditedEntityRecord","__unstableCreateUndoLevel","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":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,OAAOC,QAAP,MAAqB,sBAArB;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SACCC,KADD,EAECC,6BAFD,EAGCC,2BAHD,QAIO,mBAJP;AAKA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASF,KAAK,IAAIG,gBAAlB,QAA0C,yBAA1C;AAEA;AACA;AACA;;AACA,SAASC,oBAAT,QAAqC,aAArC;AACA,SAASC,gBAAT,QAAiC,kBAAjC;AACA,SACCC,sCADD,EAECC,mCAFD,EAGCC,oCAHD,QAIO,wBAJP;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAG,CAAEC,IAAF,EAAQC,KAAR,EAAeC,QAAf,KAA6B,QAAoB;AAAA,MAAlB;AAAEC,IAAAA;AAAF,GAAkB;AAC3EA,EAAAA,QAAQ,CAACC,gBAAT,CAA2BJ,IAA3B,EAD2E,CAE3E;;AACA,QAAMK,SAAS,GAAGL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AGhC,oBAAoB,CAC1D,yBAD0D,CAApD","sourcesContent":["/**\n * External dependencies\n */\nimport { has } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport deprecated from '@wordpress/deprecated';\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 { TRASH_POST_NOTICE_ID } from './constants';\nimport { localAutosaveSet } from './local-autosave';\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 const setupEditor = ( post, edits, template ) => ( { dispatch } ) => {\n\tdispatch.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\tdispatch.resetEditorBlocks( blocks, {\n\t\t\t__unstableShouldCreateUndoLevel: false,\n\t\t} );\n\t}\n\tif (\n\t\tedits &&\n\t\tObject.values( edits ).some(\n\t\t\t( [ key, edit ] ) => edit !== ( post[ key ]?.raw ?? post[ key ] )\n\t\t)\n\t) {\n\t\tdispatch.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 * @deprecated Since WordPress 6.0.\n */\nexport function resetPost() {\n\tdeprecated( \"wp.data.dispatch( 'core/editor' ).resetPost\", {\n\t\tsince: '6.0',\n\t\tversion: '6.3',\n\t\talternative: 'Initialize the editor with the setupEditorState action',\n\t} );\n\treturn { type: 'DO_NOTHING' };\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 */\nexport const editPost = ( edits, options ) => ( { select, registry } ) => {\n\tconst { id, type } = select.getCurrentPost();\n\tregistry\n\t\t.dispatch( coreStore )\n\t\t.editEntityRecord( 'postType', type, id, edits, options );\n};\n\n/**\n * Action for saving the current post in the editor.\n *\n * @param {Object} options\n */\nexport const savePost = ( options = {} ) => async ( {\n\tselect,\n\tdispatch,\n\tregistry,\n} ) => {\n\tif ( ! select.isEditedPostSaveable() ) {\n\t\treturn;\n\t}\n\n\tconst content = select.getEditedPostContent();\n\n\tif ( ! options.isAutosave ) {\n\t\tdispatch.editPost( { content }, { undoIgnore: true } );\n\t}\n\n\tconst previousRecord = select.getCurrentPost();\n\tconst edits = {\n\t\tid: previousRecord.id,\n\t\t...registry\n\t\t\t.select( coreStore )\n\t\t\t.getEntityRecordNonTransientEdits(\n\t\t\t\t'postType',\n\t\t\t\tpreviousRecord.type,\n\t\t\t\tpreviousRecord.id\n\t\t\t),\n\t\tcontent,\n\t};\n\tdispatch( { type: 'REQUEST_POST_UPDATE_START', options } );\n\tawait registry\n\t\t.dispatch( coreStore )\n\t\t.saveEntityRecord( 'postType', previousRecord.type, edits, options );\n\tdispatch( { type: 'REQUEST_POST_UPDATE_FINISH', options } );\n\n\tconst error = registry\n\t\t.select( coreStore )\n\t\t.getLastEntitySaveError(\n\t\t\t'postType',\n\t\t\tpreviousRecord.type,\n\t\t\tpreviousRecord.id\n\t\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\tregistry.dispatch( noticesStore ).createErrorNotice( ...args );\n\t\t}\n\t} else {\n\t\tconst updatedRecord = select.getCurrentPost();\n\t\tconst args = getNotificationArgumentsForSaveSuccess( {\n\t\t\tpreviousPost: previousRecord,\n\t\t\tpost: updatedRecord,\n\t\t\tpostType: await registry\n\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t.getPostType( updatedRecord.type ),\n\t\t\toptions,\n\t\t} );\n\t\tif ( args.length ) {\n\t\t\tregistry.dispatch( noticesStore ).createSuccessNotice( ...args );\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\tregistry\n\t\t\t\t.dispatch( blockEditorStore )\n\t\t\t\t.__unstableMarkLastChangeAsPersistent();\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 for trashing the current post in the editor.\n */\nexport const trashPost = () => async ( { select, dispatch, registry } ) => {\n\tconst postTypeSlug = select.getCurrentPostType();\n\tconst postType = await registry\n\t\t.resolveSelect( coreStore )\n\t\t.getPostType( postTypeSlug );\n\tregistry.dispatch( noticesStore ).removeNotice( TRASH_POST_NOTICE_ID );\n\ttry {\n\t\tconst post = select.getCurrentPost();\n\t\tawait apiFetch( {\n\t\t\tpath: `/wp/v2/${ postType.rest_base }/${ post.id }`,\n\t\t\tmethod: 'DELETE',\n\t\t} );\n\n\t\tawait dispatch.savePost();\n\t} catch ( error ) {\n\t\tregistry\n\t\t\t.dispatch( noticesStore )\n\t\t\t.createErrorNotice(\n\t\t\t\t...getNotificationArgumentsForTrashFail( { error } )\n\t\t\t);\n\t}\n};\n\n/**\n * Action that autosaves the current post. 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 const autosave = ( { local = false, ...options } = {} ) => async ( {\n\tselect,\n\tdispatch,\n} ) => {\n\tif ( local ) {\n\t\tconst post = select.getCurrentPost();\n\t\tconst isPostNew = select.isEditedPostNew();\n\t\tconst title = select.getEditedPostAttribute( 'title' );\n\t\tconst content = select.getEditedPostAttribute( 'content' );\n\t\tconst excerpt = select.getEditedPostAttribute( 'excerpt' );\n\t\tlocalAutosaveSet( post.id, isPostNew, title, content, excerpt );\n\t} else {\n\t\tawait dispatch.savePost( { isAutosave: true, ...options } );\n\t}\n};\n\n/**\n * Action that restores last popped state in undo history.\n */\nexport const redo = () => ( { registry } ) => {\n\tregistry.dispatch( coreStore ).redo();\n};\n\n/**\n * Action that pops a record from undo history and undoes the edit.\n */\nexport const undo = () => ( { registry } ) => {\n\tregistry.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 * Action that locks the editor.\n *\n * @param {Object} lock Details about the post lock status, user, and nonce.\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 * Action that enables the 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 * Action that disables the 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 * Action that locks post saving.\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 * Action that unlocks post saving.\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 * Action that locks post autosaving.\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 * Action that unlocks post autosaving.\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 */\nexport const resetEditorBlocks = ( blocks, options = {} ) => ( {\n\tselect,\n\tdispatch,\n\tregistry,\n} ) => {\n\tconst { __unstableShouldCreateUndoLevel, selection } = options;\n\tconst edits = { blocks, selection };\n\n\tif ( __unstableShouldCreateUndoLevel !== false ) {\n\t\tconst { id, type } = select.getCurrentPost();\n\t\tconst noChange =\n\t\t\tregistry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEditedEntityRecord( 'postType', type, id ).blocks ===\n\t\t\tedits.blocks;\n\t\tif ( noChange ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.__unstableCreateUndoLevel( 'postType', type, id );\n\t\t\treturn;\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\n\tdispatch.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 ) => ( ...args ) => ( { registry } ) => {\n\tdeprecated( \"`wp.data.dispatch( 'core/editor' ).\" + name + '`', {\n\t\tsince: '5.3',\n\t\talternative: \"`wp.data.dispatch( 'core/block-editor' ).\" + name + '`',\n\t\tversion: '6.2',\n\t} );\n\tregistry.dispatch( blockEditorStore )[ name ]( ...args );\n};\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":["has","apiFetch","deprecated","parse","synchronizeBlocksWithTemplate","__unstableSerializeAndClean","store","noticesStore","coreStore","blockEditorStore","preferencesStore","TRASH_POST_NOTICE_ID","localAutosaveSet","getNotificationArgumentsForSaveSuccess","getNotificationArgumentsForSaveFail","getNotificationArgumentsForTrashFail","setupEditor","post","edits","template","dispatch","setupEditorState","isNewPost","status","content","raw","blocks","resetEditorBlocks","__unstableShouldCreateUndoLevel","Object","values","some","key","edit","editPost","__experimentalTearDownEditor","type","resetPost","since","version","alternative","updatePost","options","select","registry","id","getCurrentPost","editEntityRecord","savePost","isEditedPostSaveable","getEditedPostContent","isAutosave","undoIgnore","previousRecord","getEntityRecordNonTransientEdits","saveEntityRecord","error","getLastEntitySaveError","args","length","createErrorNotice","updatedRecord","previousPost","postType","resolveSelect","getPostType","createSuccessNotice","__unstableMarkLastChangeAsPersistent","refreshPost","trashPost","postTypeSlug","getCurrentPostType","removeNotice","path","rest_base","method","autosave","local","isPostNew","isEditedPostNew","title","getEditedPostAttribute","excerpt","redo","undo","createUndoLevel","updatePostLock","lock","enablePublishSidebar","set","disablePublishSidebar","lockPostSaving","lockName","unlockPostSaving","lockPostAutosaving","unlockPostAutosaving","selection","noChange","getEditedEntityRecord","__unstableCreateUndoLevel","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":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,OAAOC,QAAP,MAAqB,sBAArB;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SACCC,KADD,EAECC,6BAFD,EAGCC,2BAHD,QAIO,mBAJP;AAKA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASF,KAAK,IAAIG,gBAAlB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AEP;AACA;AACA;;AACA,OAAO,MAAMwB,YAAY,GAAGxB,oBAAoB,CAAE,cAAF,CAAzC;AAEP;AACA;AACA;;AACA,OAAO,MAAMyB,WAAW,GAAGzB,oBAAoB,CAAE,aAAF,CAAxC;AAEP;AACA;AACA;;AACA,OAAO,MAAM0B,eAAe,GAAG1B,oBAAoB,CAAE,iBAAF,CAA5C;AAEP;AACA;AACA;;AACA,OAAO,MAAM2B,WAAW,GAAG3B,oBAAoB,CAAE,aAAF,CAAxC;AAEP;AACA;AACA;;AACA,OAAO,MAAM4B,UAAU,GAAG5B,oBAAoB,CAAE,YAAF,CAAvC;AAEP;AACA;AACA;;AACA,OAAO,MAAM6B,kBAAkB,GAAG7B,oBAAoB,CAAE,oBAAF,CAA/C;AAEP;AACA;AACA;;AACA,OAAO,MAAM8B,iBAAiB,GAAG9B,oBAAoB,CAAE,mBAAF,CAA9C;AAEP;AACA;AACA;;AACA,OAAO,MAAM+B,kBAAkB,GAAG/B,oBAAoB,CAAE,oBAAF,CAA/C;AAEP;AACA;AACA;;AACA,OAAO,MAAMgC,uBAAuB,GAAGhC,oBAAoB,CAC1D,yBAD0D,CAApD","sourcesContent":["/**\n * External dependencies\n */\nimport { has } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport deprecated from '@wordpress/deprecated';\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';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { TRASH_POST_NOTICE_ID } from './constants';\nimport { localAutosaveSet } from './local-autosave';\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 const setupEditor = ( post, edits, template ) => ( { dispatch } ) => {\n\tdispatch.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\tdispatch.resetEditorBlocks( blocks, {\n\t\t\t__unstableShouldCreateUndoLevel: false,\n\t\t} );\n\t}\n\tif (\n\t\tedits &&\n\t\tObject.values( edits ).some(\n\t\t\t( [ key, edit ] ) => edit !== ( post[ key ]?.raw ?? post[ key ] )\n\t\t)\n\t) {\n\t\tdispatch.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 * @deprecated Since WordPress 6.0.\n */\nexport function resetPost() {\n\tdeprecated( \"wp.data.dispatch( 'core/editor' ).resetPost\", {\n\t\tsince: '6.0',\n\t\tversion: '6.3',\n\t\talternative: 'Initialize the editor with the setupEditorState action',\n\t} );\n\treturn { type: 'DO_NOTHING' };\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 */\nexport const editPost = ( edits, options ) => ( { select, registry } ) => {\n\tconst { id, type } = select.getCurrentPost();\n\tregistry\n\t\t.dispatch( coreStore )\n\t\t.editEntityRecord( 'postType', type, id, edits, options );\n};\n\n/**\n * Action for saving the current post in the editor.\n *\n * @param {Object} options\n */\nexport const savePost = ( options = {} ) => async ( {\n\tselect,\n\tdispatch,\n\tregistry,\n} ) => {\n\tif ( ! select.isEditedPostSaveable() ) {\n\t\treturn;\n\t}\n\n\tconst content = select.getEditedPostContent();\n\n\tif ( ! options.isAutosave ) {\n\t\tdispatch.editPost( { content }, { undoIgnore: true } );\n\t}\n\n\tconst previousRecord = select.getCurrentPost();\n\tconst edits = {\n\t\tid: previousRecord.id,\n\t\t...registry\n\t\t\t.select( coreStore )\n\t\t\t.getEntityRecordNonTransientEdits(\n\t\t\t\t'postType',\n\t\t\t\tpreviousRecord.type,\n\t\t\t\tpreviousRecord.id\n\t\t\t),\n\t\tcontent,\n\t};\n\tdispatch( { type: 'REQUEST_POST_UPDATE_START', options } );\n\tawait registry\n\t\t.dispatch( coreStore )\n\t\t.saveEntityRecord( 'postType', previousRecord.type, edits, options );\n\tdispatch( { type: 'REQUEST_POST_UPDATE_FINISH', options } );\n\n\tconst error = registry\n\t\t.select( coreStore )\n\t\t.getLastEntitySaveError(\n\t\t\t'postType',\n\t\t\tpreviousRecord.type,\n\t\t\tpreviousRecord.id\n\t\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\tregistry.dispatch( noticesStore ).createErrorNotice( ...args );\n\t\t}\n\t} else {\n\t\tconst updatedRecord = select.getCurrentPost();\n\t\tconst args = getNotificationArgumentsForSaveSuccess( {\n\t\t\tpreviousPost: previousRecord,\n\t\t\tpost: updatedRecord,\n\t\t\tpostType: await registry\n\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t.getPostType( updatedRecord.type ),\n\t\t\toptions,\n\t\t} );\n\t\tif ( args.length ) {\n\t\t\tregistry.dispatch( noticesStore ).createSuccessNotice( ...args );\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\tregistry\n\t\t\t\t.dispatch( blockEditorStore )\n\t\t\t\t.__unstableMarkLastChangeAsPersistent();\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 for trashing the current post in the editor.\n */\nexport const trashPost = () => async ( { select, dispatch, registry } ) => {\n\tconst postTypeSlug = select.getCurrentPostType();\n\tconst postType = await registry\n\t\t.resolveSelect( coreStore )\n\t\t.getPostType( postTypeSlug );\n\tregistry.dispatch( noticesStore ).removeNotice( TRASH_POST_NOTICE_ID );\n\ttry {\n\t\tconst post = select.getCurrentPost();\n\t\tawait apiFetch( {\n\t\t\tpath: `/wp/v2/${ postType.rest_base }/${ post.id }`,\n\t\t\tmethod: 'DELETE',\n\t\t} );\n\n\t\tawait dispatch.savePost();\n\t} catch ( error ) {\n\t\tregistry\n\t\t\t.dispatch( noticesStore )\n\t\t\t.createErrorNotice(\n\t\t\t\t...getNotificationArgumentsForTrashFail( { error } )\n\t\t\t);\n\t}\n};\n\n/**\n * Action that autosaves the current post. 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 const autosave = ( { local = false, ...options } = {} ) => async ( {\n\tselect,\n\tdispatch,\n} ) => {\n\tif ( local ) {\n\t\tconst post = select.getCurrentPost();\n\t\tconst isPostNew = select.isEditedPostNew();\n\t\tconst title = select.getEditedPostAttribute( 'title' );\n\t\tconst content = select.getEditedPostAttribute( 'content' );\n\t\tconst excerpt = select.getEditedPostAttribute( 'excerpt' );\n\t\tlocalAutosaveSet( post.id, isPostNew, title, content, excerpt );\n\t} else {\n\t\tawait dispatch.savePost( { isAutosave: true, ...options } );\n\t}\n};\n\n/**\n * Action that restores last popped state in undo history.\n */\nexport const redo = () => ( { registry } ) => {\n\tregistry.dispatch( coreStore ).redo();\n};\n\n/**\n * Action that pops a record from undo history and undoes the edit.\n */\nexport const undo = () => ( { registry } ) => {\n\tregistry.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 * Action that locks the editor.\n *\n * @param {Object} lock Details about the post lock status, user, and nonce.\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 * Enable the publish sidebar.\n */\nexport const enablePublishSidebar = () => ( { registry } ) => {\n\tregistry\n\t\t.dispatch( preferencesStore )\n\t\t.set( 'core/edit-post', 'isPublishSidebarEnabled', true );\n};\n\n/**\n * Disables the publish sidebar.\n */\nexport const disablePublishSidebar = () => ( { registry } ) => {\n\tregistry\n\t\t.dispatch( preferencesStore )\n\t\t.set( 'core/edit-post', 'isPublishSidebarEnabled', false );\n};\n\n/**\n * Action that locks post saving.\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 * Action that unlocks post saving.\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 * Action that locks post autosaving.\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 * Action that unlocks post autosaving.\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 */\nexport const resetEditorBlocks = ( blocks, options = {} ) => ( {\n\tselect,\n\tdispatch,\n\tregistry,\n} ) => {\n\tconst { __unstableShouldCreateUndoLevel, selection } = options;\n\tconst edits = { blocks, selection };\n\n\tif ( __unstableShouldCreateUndoLevel !== false ) {\n\t\tconst { id, type } = select.getCurrentPost();\n\t\tconst noChange =\n\t\t\tregistry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEditedEntityRecord( 'postType', type, id ).blocks ===\n\t\t\tedits.blocks;\n\t\tif ( noChange ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.__unstableCreateUndoLevel( 'postType', type, id );\n\t\t\treturn;\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\n\tdispatch.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 ) => ( ...args ) => ( { registry } ) => {\n\tdeprecated( \"`wp.data.dispatch( 'core/editor' ).\" + name + '`', {\n\t\tsince: '5.3',\n\t\talternative: \"`wp.data.dispatch( 'core/block-editor' ).\" + name + '`',\n\t\tversion: '6.2',\n\t} );\n\tregistry.dispatch( blockEditorStore )[ name ]( ...args );\n};\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"]}
@@ -2,11 +2,6 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { SETTINGS_DEFAULTS } from '@wordpress/block-editor';
5
- export const PREFERENCES_DEFAULTS = {
6
- insertUsage: {},
7
- // Should be kept for backward compatibility, see: https://github.com/WordPress/gutenberg/issues/14580.
8
- isPublishSidebarEnabled: true
9
- };
10
5
  /**
11
6
  * The default post editor settings.
12
7
  *
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/store/defaults.js"],"names":["SETTINGS_DEFAULTS","PREFERENCES_DEFAULTS","insertUsage","isPublishSidebarEnabled","EDITOR_SETTINGS_DEFAULTS","richEditingEnabled","codeEditingEnabled","enableCustomFields","undefined","supportsLayout"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,iBAAT,QAAkC,yBAAlC;AAEA,OAAO,MAAMC,oBAAoB,GAAG;AACnCC,EAAAA,WAAW,EAAE,EADsB;AAClB;AACjBC,EAAAA,uBAAuB,EAAE;AAFU,CAA7B;AAKP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,wBAAwB,GAAG,EACvC,GAAGJ,iBADoC;AAGvCK,EAAAA,kBAAkB,EAAE,IAHmB;AAIvCC,EAAAA,kBAAkB,EAAE,IAJmB;AAKvCC,EAAAA,kBAAkB,EAAEC,SALmB;AAMvCC,EAAAA,cAAc,EAAE;AANuB,CAAjC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SETTINGS_DEFAULTS } from '@wordpress/block-editor';\n\nexport const PREFERENCES_DEFAULTS = {\n\tinsertUsage: {}, // Should be kept for backward compatibility, see: https://github.com/WordPress/gutenberg/issues/14580.\n\tisPublishSidebarEnabled: true,\n};\n\n/**\n * The default post editor settings.\n *\n * @property {boolean|Array} allowedBlockTypes Allowed block types\n * @property {boolean} richEditingEnabled Whether rich editing is enabled or not\n * @property {boolean} codeEditingEnabled Whether code editing is enabled or not\n * @property {boolean} enableCustomFields Whether the WordPress custom fields are enabled or not.\n * true = the user has opted to show the Custom Fields panel at the bottom of the editor.\n * false = the user has opted to hide the Custom Fields panel at the bottom of the editor.\n * undefined = the current environment does not support Custom Fields, so the option toggle in Preferences -> Panels to enable the Custom Fields panel is not displayed.\n * @property {number} autosaveInterval How often in seconds the post will be auto-saved via the REST API.\n * @property {number} localAutosaveInterval How often in seconds the post will be backed up to sessionStorage.\n * @property {Array?} availableTemplates The available post templates\n * @property {boolean} disablePostFormats Whether or not the post formats are disabled\n * @property {Array?} allowedMimeTypes List of allowed mime types and file extensions\n * @property {number} maxUploadFileSize Maximum upload file size\n * @property {boolean} supportsLayout Whether the editor supports layouts.\n */\nexport const EDITOR_SETTINGS_DEFAULTS = {\n\t...SETTINGS_DEFAULTS,\n\n\trichEditingEnabled: true,\n\tcodeEditingEnabled: true,\n\tenableCustomFields: undefined,\n\tsupportsLayout: true,\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/store/defaults.js"],"names":["SETTINGS_DEFAULTS","EDITOR_SETTINGS_DEFAULTS","richEditingEnabled","codeEditingEnabled","enableCustomFields","undefined","supportsLayout"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,iBAAT,QAAkC,yBAAlC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,wBAAwB,GAAG,EACvC,GAAGD,iBADoC;AAGvCE,EAAAA,kBAAkB,EAAE,IAHmB;AAIvCC,EAAAA,kBAAkB,EAAE,IAJmB;AAKvCC,EAAAA,kBAAkB,EAAEC,SALmB;AAMvCC,EAAAA,cAAc,EAAE;AANuB,CAAjC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SETTINGS_DEFAULTS } from '@wordpress/block-editor';\n\n/**\n * The default post editor settings.\n *\n * @property {boolean|Array} allowedBlockTypes Allowed block types\n * @property {boolean} richEditingEnabled Whether rich editing is enabled or not\n * @property {boolean} codeEditingEnabled Whether code editing is enabled or not\n * @property {boolean} enableCustomFields Whether the WordPress custom fields are enabled or not.\n * true = the user has opted to show the Custom Fields panel at the bottom of the editor.\n * false = the user has opted to hide the Custom Fields panel at the bottom of the editor.\n * undefined = the current environment does not support Custom Fields, so the option toggle in Preferences -> Panels to enable the Custom Fields panel is not displayed.\n * @property {number} autosaveInterval How often in seconds the post will be auto-saved via the REST API.\n * @property {number} localAutosaveInterval How often in seconds the post will be backed up to sessionStorage.\n * @property {Array?} availableTemplates The available post templates\n * @property {boolean} disablePostFormats Whether or not the post formats are disabled\n * @property {Array?} allowedMimeTypes List of allowed mime types and file extensions\n * @property {number} maxUploadFileSize Maximum upload file size\n * @property {boolean} supportsLayout Whether the editor supports layouts.\n */\nexport const EDITOR_SETTINGS_DEFAULTS = {\n\t...SETTINGS_DEFAULTS,\n\n\trichEditingEnabled: true,\n\tcodeEditingEnabled: true,\n\tenableCustomFields: undefined,\n\tsupportsLayout: true,\n};\n"]}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { createReduxStore, registerStore } from '@wordpress/data';
4
+ import { createReduxStore, register } from '@wordpress/data';
5
5
  /**
6
6
  * Internal dependencies
7
7
  */
@@ -31,12 +31,7 @@ export const storeConfig = {
31
31
  * @type {Object}
32
32
  */
33
33
 
34
- export const store = createReduxStore(STORE_NAME, { ...storeConfig,
35
- persist: ['preferences']
36
- }); // Once we build a more generic persistence plugin that works across types of stores
37
- // we'd be able to replace this with a register call.
38
-
39
- registerStore(STORE_NAME, { ...storeConfig,
40
- persist: ['preferences']
34
+ export const store = createReduxStore(STORE_NAME, { ...storeConfig
41
35
  });
36
+ register(store);
42
37
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/store/index.js"],"names":["createReduxStore","registerStore","reducer","selectors","actions","STORE_NAME","storeConfig","store","persist"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAT,EAA2BC,aAA3B,QAAgD,iBAAhD;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,OAAO,KAAKC,SAAZ,MAA2B,aAA3B;AACA,OAAO,KAAKC,OAAZ,MAAyB,WAAzB;AACA,SAASC,UAAT,QAA2B,aAA3B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAG;AAC1BJ,EAAAA,OAD0B;AAE1BC,EAAAA,SAF0B;AAG1BC,EAAAA;AAH0B,CAApB;AAMP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMG,KAAK,GAAGP,gBAAgB,CAAEK,UAAF,EAAc,EAClD,GAAGC,WAD+C;AAElDE,EAAAA,OAAO,EAAE,CAAE,aAAF;AAFyC,CAAd,CAA9B,C,CAKP;AACA;;AACAP,aAAa,CAAEI,UAAF,EAAc,EAC1B,GAAGC,WADuB;AAE1BE,EAAAA,OAAO,EAAE,CAAE,aAAF;AAFiB,CAAd,CAAb","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, registerStore } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\nimport { STORE_NAME } from './constants';\n\n/**\n * Post editor data store configuration.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore\n *\n * @type {Object}\n */\nexport const storeConfig = {\n\treducer,\n\tselectors,\n\tactions,\n};\n\n/**\n * Store definition for the editor namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, {\n\t...storeConfig,\n\tpersist: [ 'preferences' ],\n} );\n\n// Once we build a more generic persistence plugin that works across types of stores\n// we'd be able to replace this with a register call.\nregisterStore( STORE_NAME, {\n\t...storeConfig,\n\tpersist: [ 'preferences' ],\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/store/index.js"],"names":["createReduxStore","register","reducer","selectors","actions","STORE_NAME","storeConfig","store"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAT,EAA2BC,QAA3B,QAA2C,iBAA3C;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,OAAO,KAAKC,SAAZ,MAA2B,aAA3B;AACA,OAAO,KAAKC,OAAZ,MAAyB,WAAzB;AACA,SAASC,UAAT,QAA2B,aAA3B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAG;AAC1BJ,EAAAA,OAD0B;AAE1BC,EAAAA,SAF0B;AAG1BC,EAAAA;AAH0B,CAApB;AAMP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMG,KAAK,GAAGP,gBAAgB,CAAEK,UAAF,EAAc,EAClD,GAAGC;AAD+C,CAAd,CAA9B;AAIPL,QAAQ,CAAEM,KAAF,CAAR","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\nimport { STORE_NAME } from './constants';\n\n/**\n * Post editor data store configuration.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore\n *\n * @type {Object}\n */\nexport const storeConfig = {\n\treducer,\n\tselectors,\n\tactions,\n};\n\n/**\n * Store definition for the editor namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, {\n\t...storeConfig,\n} );\n\nregister( store );\n"]}
@@ -11,7 +11,7 @@ import { combineReducers } from '@wordpress/data';
11
11
  * Internal dependencies
12
12
  */
13
13
 
14
- import { PREFERENCES_DEFAULTS, EDITOR_SETTINGS_DEFAULTS } from './defaults';
14
+ import { EDITOR_SETTINGS_DEFAULTS } from './defaults';
15
15
  /**
16
16
  * Returns a post attribute value, flattening nested rendered content using its
17
17
  * raw value in place of its original object form.
@@ -123,33 +123,6 @@ export function template() {
123
123
 
124
124
  return state;
125
125
  }
126
- /**
127
- * Reducer returning the user preferences.
128
- *
129
- * @param {Object} state Current state.
130
- * @param {Object} action Dispatched action.
131
- *
132
- * @return {string} Updated state.
133
- */
134
-
135
- export function preferences() {
136
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : PREFERENCES_DEFAULTS;
137
- let action = arguments.length > 1 ? arguments[1] : undefined;
138
-
139
- switch (action.type) {
140
- case 'ENABLE_PUBLISH_SIDEBAR':
141
- return { ...state,
142
- isPublishSidebarEnabled: true
143
- };
144
-
145
- case 'DISABLE_PUBLISH_SIDEBAR':
146
- return { ...state,
147
- isPublishSidebarEnabled: false
148
- };
149
- }
150
-
151
- return state;
152
- }
153
126
  /**
154
127
  * Reducer returning current network request state (whether a request to
155
128
  * the WP REST API is in progress, successful, or failed).
@@ -312,7 +285,6 @@ export function editorSettings() {
312
285
  export default combineReducers({
313
286
  postId,
314
287
  postType,
315
- preferences,
316
288
  saving,
317
289
  postLock,
318
290
  template,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/store/reducer.js"],"names":["omit","keys","isEqual","combineReducers","PREFERENCES_DEFAULTS","EDITOR_SETTINGS_DEFAULTS","getPostRawValue","value","raw","hasSameKeys","a","b","isUpdatingSamePostProperty","action","previousAction","type","edits","shouldOverwriteState","shouldCreateUndoLevel","postId","state","post","id","postType","template","isValid","preferences","isPublishSidebarEnabled","saving","pending","options","postLock","isLocked","lock","postSavingLock","lockName","postAutosavingLock","isReady","editorSettings","settings"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,IAAf,EAAqBC,OAArB,QAAoC,QAApC;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;;AACA,SAASC,oBAAT,EAA+BC,wBAA/B,QAA+D,YAA/D;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,eAAT,CAA0BC,KAA1B,EAAkC;AACxC,MAAKA,KAAK,IAAI,aAAa,OAAOA,KAA7B,IAAsC,SAASA,KAApD,EAA4D;AAC3D,WAAOA,KAAK,CAACC,GAAb;AACA;;AAED,SAAOD,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,WAAT,CAAsBC,CAAtB,EAAyBC,CAAzB,EAA6B;AACnC,SAAOT,OAAO,CAAED,IAAI,CAAES,CAAF,CAAN,EAAaT,IAAI,CAAEU,CAAF,CAAjB,CAAd;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,0BAAT,CAAqCC,MAArC,EAA6CC,cAA7C,EAA8D;AACpE,SACCD,MAAM,CAACE,IAAP,KAAgB,WAAhB,IACAN,WAAW,CAAEI,MAAM,CAACG,KAAT,EAAgBF,cAAc,CAACE,KAA/B,CAFZ;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,oBAA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,CAA9B","sourcesContent":["/**\n * External dependencies\n */\nimport { omit, keys, isEqual } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { PREFERENCES_DEFAULTS, EDITOR_SETTINGS_DEFAULTS } from './defaults';\n\n/**\n * Returns a post attribute value, flattening nested rendered content using its\n * raw value in place of its original object form.\n *\n * @param {*} value Original value.\n *\n * @return {*} Raw value.\n */\nexport function getPostRawValue( value ) {\n\tif ( value && 'object' === typeof value && 'raw' in value ) {\n\t\treturn value.raw;\n\t}\n\n\treturn value;\n}\n\n/**\n * Returns true if the two object arguments have the same keys, or false\n * otherwise.\n *\n * @param {Object} a First object.\n * @param {Object} b Second object.\n *\n * @return {boolean} Whether the two objects have the same keys.\n */\nexport function hasSameKeys( a, b ) {\n\treturn isEqual( keys( a ), keys( b ) );\n}\n\n/**\n * Returns true if, given the currently dispatching action and the previously\n * dispatched action, the two actions are editing the same post property, or\n * false otherwise.\n *\n * @param {Object} action Currently dispatching action.\n * @param {Object} previousAction Previously dispatched action.\n *\n * @return {boolean} Whether actions are updating the same post property.\n */\nexport function isUpdatingSamePostProperty( action, previousAction ) {\n\treturn (\n\t\taction.type === 'EDIT_POST' &&\n\t\thasSameKeys( action.edits, previousAction.edits )\n\t);\n}\n\n/**\n * Returns true if, given the currently dispatching action and the previously\n * dispatched action, the two actions are modifying the same property such that\n * undo history should be batched.\n *\n * @param {Object} action Currently dispatching action.\n * @param {Object} previousAction Previously dispatched action.\n *\n * @return {boolean} Whether to overwrite present state.\n */\nexport function shouldOverwriteState( action, previousAction ) {\n\tif ( action.type === 'RESET_EDITOR_BLOCKS' ) {\n\t\treturn ! action.shouldCreateUndoLevel;\n\t}\n\n\tif ( ! previousAction || action.type !== previousAction.type ) {\n\t\treturn false;\n\t}\n\n\treturn isUpdatingSamePostProperty( action, previousAction );\n}\n\nexport function postId( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SETUP_EDITOR_STATE':\n\t\t\treturn action.post.id;\n\t}\n\n\treturn state;\n}\n\nexport function postType( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SETUP_EDITOR_STATE':\n\t\t\treturn action.post.type;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning whether the post blocks match the defined template or not.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {boolean} Updated state.\n */\nexport function template( state = { isValid: true }, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_TEMPLATE_VALIDITY':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisValid: action.isValid,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the user preferences.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {string} Updated state.\n */\nexport function preferences( state = PREFERENCES_DEFAULTS, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'ENABLE_PUBLISH_SIDEBAR':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisPublishSidebarEnabled: true,\n\t\t\t};\n\n\t\tcase 'DISABLE_PUBLISH_SIDEBAR':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisPublishSidebarEnabled: false,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning current network request state (whether a request to\n * the WP REST API is in progress, successful, or failed).\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function saving( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REQUEST_POST_UPDATE_START':\n\t\tcase 'REQUEST_POST_UPDATE_FINISH':\n\t\t\treturn {\n\t\t\t\tpending: action.type === 'REQUEST_POST_UPDATE_START',\n\t\t\t\toptions: action.options || {},\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Post Lock State.\n *\n * @typedef {Object} PostLockState\n *\n * @property {boolean} isLocked Whether the post is locked.\n * @property {?boolean} isTakeover Whether the post editing has been taken over.\n * @property {?boolean} activePostLock Active post lock value.\n * @property {?Object} user User that took over the post.\n */\n\n/**\n * Reducer returning the post lock status.\n *\n * @param {PostLockState} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {PostLockState} Updated state.\n */\nexport function postLock( state = { isLocked: false }, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_POST_LOCK':\n\t\t\treturn action.lock;\n\t}\n\n\treturn state;\n}\n\n/**\n * Post saving lock.\n *\n * When post saving is locked, the post cannot be published or updated.\n *\n * @param {PostLockState} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {PostLockState} Updated state.\n */\nexport function postSavingLock( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'LOCK_POST_SAVING':\n\t\t\treturn { ...state, [ action.lockName ]: true };\n\n\t\tcase 'UNLOCK_POST_SAVING':\n\t\t\treturn omit( state, action.lockName );\n\t}\n\treturn state;\n}\n\n/**\n * Post autosaving lock.\n *\n * When post autosaving is locked, the post will not autosave.\n *\n * @param {PostLockState} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {PostLockState} Updated state.\n */\nexport function postAutosavingLock( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'LOCK_POST_AUTOSAVING':\n\t\t\treturn { ...state, [ action.lockName ]: true };\n\n\t\tcase 'UNLOCK_POST_AUTOSAVING':\n\t\t\treturn omit( state, action.lockName );\n\t}\n\treturn state;\n}\n\n/**\n * Reducer returning whether the editor is ready to be rendered.\n * The editor is considered ready to be rendered once\n * the post object is loaded properly and the initial blocks parsed.\n *\n * @param {boolean} state\n * @param {Object} action\n *\n * @return {boolean} Updated state.\n */\nexport function isReady( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SETUP_EDITOR_STATE':\n\t\t\treturn true;\n\n\t\tcase 'TEAR_DOWN_EDITOR':\n\t\t\treturn false;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the post editor setting.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function editorSettings( state = EDITOR_SETTINGS_DEFAULTS, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_EDITOR_SETTINGS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.settings,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tpostId,\n\tpostType,\n\tpreferences,\n\tsaving,\n\tpostLock,\n\ttemplate,\n\tpostSavingLock,\n\tisReady,\n\teditorSettings,\n\tpostAutosavingLock,\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/store/reducer.js"],"names":["omit","keys","isEqual","combineReducers","EDITOR_SETTINGS_DEFAULTS","getPostRawValue","value","raw","hasSameKeys","a","b","isUpdatingSamePostProperty","action","previousAction","type","edits","shouldOverwriteState","shouldCreateUndoLevel","postId","state","post","id","postType","template","isValid","saving","pending","options","postLock","isLocked","lock","postSavingLock","lockName","postAutosavingLock","isReady","editorSettings","settings"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,IAAf,EAAqBC,OAArB,QAAoC,QAApC;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;;AACA,SAASC,wBAAT,QAAyC,YAAzC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,eAAT,CAA0BC,KAA1B,EAAkC;AACxC,MAAKA,KAAK,IAAI,aAAa,OAAOA,KAA7B,IAAsC,SAASA,KAApD,EAA4D;AAC3D,WAAOA,KAAK,CAACC,GAAb;AACA;;AAED,SAAOD,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,WAAT,CAAsBC,CAAtB,EAAyBC,CAAzB,EAA6B;AACnC,SAAOR,OAAO,CAAED,IAAI,CAAEQ,CAAF,CAAN,EAAaR,IAAI,CAAES,CAAF,C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A;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASc,kBAAT,GAAkD;AAAA,MAArBd,KAAqB,uEAAb,EAAa;AAAA,MAATP,MAAS;;AACxD,UAASA,MAAM,CAACE,IAAhB;AACC,SAAK,sBAAL;AACC,aAAO,EAAE,GAAGK,KAAL;AAAY,SAAEP,MAAM,CAACoB,QAAT,GAAqB;AAAjC,OAAP;;AAED,SAAK,wBAAL;AACC,aAAOhC,IAAI,CAAEmB,KAAF,EAASP,MAAM,CAACoB,QAAhB,CAAX;AALF;;AAOA,SAAOb,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASe,OAAT,GAA0C;AAAA,MAAxBf,KAAwB,uEAAhB,KAAgB;AAAA,MAATP,MAAS;;AAChD,UAASA,MAAM,CAACE,IAAhB;AACC,SAAK,oBAAL;AACC,aAAO,IAAP;;AAED,SAAK,kBAAL;AACC,aAAO,KAAP;AALF;;AAQA,SAAOK,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASgB,cAAT,GAAoE;AAAA,MAA3ChB,KAA2C,uEAAnCf,wBAAmC;AAAA,MAATQ,MAAS;;AAC1E,UAASA,MAAM,CAACE,IAAhB;AACC,SAAK,wBAAL;AACC,aAAO,EACN,GAAGK,KADG;AAEN,WAAGP,MAAM,CAACwB;AAFJ,OAAP;AAFF;;AAQA,SAAOjB,KAAP;AACA;AAED,eAAehB,eAAe,CAAE;AAC/Be,EAAAA,MAD+B;AAE/BI,EAAAA,QAF+B;AAG/BG,EAAAA,MAH+B;AAI/BG,EAAAA,QAJ+B;AAK/BL,EAAAA,QAL+B;AAM/BQ,EAAAA,cAN+B;AAO/BG,EAAAA,OAP+B;AAQ/BC,EAAAA,cAR+B;AAS/BF,EAAAA;AAT+B,CAAF,CAA9B","sourcesContent":["/**\n * External dependencies\n */\nimport { omit, keys, isEqual } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { EDITOR_SETTINGS_DEFAULTS } from './defaults';\n\n/**\n * Returns a post attribute value, flattening nested rendered content using its\n * raw value in place of its original object form.\n *\n * @param {*} value Original value.\n *\n * @return {*} Raw value.\n */\nexport function getPostRawValue( value ) {\n\tif ( value && 'object' === typeof value && 'raw' in value ) {\n\t\treturn value.raw;\n\t}\n\n\treturn value;\n}\n\n/**\n * Returns true if the two object arguments have the same keys, or false\n * otherwise.\n *\n * @param {Object} a First object.\n * @param {Object} b Second object.\n *\n * @return {boolean} Whether the two objects have the same keys.\n */\nexport function hasSameKeys( a, b ) {\n\treturn isEqual( keys( a ), keys( b ) );\n}\n\n/**\n * Returns true if, given the currently dispatching action and the previously\n * dispatched action, the two actions are editing the same post property, or\n * false otherwise.\n *\n * @param {Object} action Currently dispatching action.\n * @param {Object} previousAction Previously dispatched action.\n *\n * @return {boolean} Whether actions are updating the same post property.\n */\nexport function isUpdatingSamePostProperty( action, previousAction ) {\n\treturn (\n\t\taction.type === 'EDIT_POST' &&\n\t\thasSameKeys( action.edits, previousAction.edits )\n\t);\n}\n\n/**\n * Returns true if, given the currently dispatching action and the previously\n * dispatched action, the two actions are modifying the same property such that\n * undo history should be batched.\n *\n * @param {Object} action Currently dispatching action.\n * @param {Object} previousAction Previously dispatched action.\n *\n * @return {boolean} Whether to overwrite present state.\n */\nexport function shouldOverwriteState( action, previousAction ) {\n\tif ( action.type === 'RESET_EDITOR_BLOCKS' ) {\n\t\treturn ! action.shouldCreateUndoLevel;\n\t}\n\n\tif ( ! previousAction || action.type !== previousAction.type ) {\n\t\treturn false;\n\t}\n\n\treturn isUpdatingSamePostProperty( action, previousAction );\n}\n\nexport function postId( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SETUP_EDITOR_STATE':\n\t\t\treturn action.post.id;\n\t}\n\n\treturn state;\n}\n\nexport function postType( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SETUP_EDITOR_STATE':\n\t\t\treturn action.post.type;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning whether the post blocks match the defined template or not.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {boolean} Updated state.\n */\nexport function template( state = { isValid: true }, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_TEMPLATE_VALIDITY':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisValid: action.isValid,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning current network request state (whether a request to\n * the WP REST API is in progress, successful, or failed).\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function saving( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REQUEST_POST_UPDATE_START':\n\t\tcase 'REQUEST_POST_UPDATE_FINISH':\n\t\t\treturn {\n\t\t\t\tpending: action.type === 'REQUEST_POST_UPDATE_START',\n\t\t\t\toptions: action.options || {},\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Post Lock State.\n *\n * @typedef {Object} PostLockState\n *\n * @property {boolean} isLocked Whether the post is locked.\n * @property {?boolean} isTakeover Whether the post editing has been taken over.\n * @property {?boolean} activePostLock Active post lock value.\n * @property {?Object} user User that took over the post.\n */\n\n/**\n * Reducer returning the post lock status.\n *\n * @param {PostLockState} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {PostLockState} Updated state.\n */\nexport function postLock( state = { isLocked: false }, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_POST_LOCK':\n\t\t\treturn action.lock;\n\t}\n\n\treturn state;\n}\n\n/**\n * Post saving lock.\n *\n * When post saving is locked, the post cannot be published or updated.\n *\n * @param {PostLockState} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {PostLockState} Updated state.\n */\nexport function postSavingLock( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'LOCK_POST_SAVING':\n\t\t\treturn { ...state, [ action.lockName ]: true };\n\n\t\tcase 'UNLOCK_POST_SAVING':\n\t\t\treturn omit( state, action.lockName );\n\t}\n\treturn state;\n}\n\n/**\n * Post autosaving lock.\n *\n * When post autosaving is locked, the post will not autosave.\n *\n * @param {PostLockState} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {PostLockState} Updated state.\n */\nexport function postAutosavingLock( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'LOCK_POST_AUTOSAVING':\n\t\t\treturn { ...state, [ action.lockName ]: true };\n\n\t\tcase 'UNLOCK_POST_AUTOSAVING':\n\t\t\treturn omit( state, action.lockName );\n\t}\n\treturn state;\n}\n\n/**\n * Reducer returning whether the editor is ready to be rendered.\n * The editor is considered ready to be rendered once\n * the post object is loaded properly and the initial blocks parsed.\n *\n * @param {boolean} state\n * @param {Object} action\n *\n * @return {boolean} Updated state.\n */\nexport function isReady( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SETUP_EDITOR_STATE':\n\t\t\treturn true;\n\n\t\tcase 'TEAR_DOWN_EDITOR':\n\t\t\treturn false;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the post editor setting.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function editorSettings( state = EDITOR_SETTINGS_DEFAULTS, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_EDITOR_SETTINGS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.settings,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tpostId,\n\tpostType,\n\tsaving,\n\tpostLock,\n\ttemplate,\n\tpostSavingLock,\n\tisReady,\n\teditorSettings,\n\tpostAutosavingLock,\n} );\n"]}
@@ -6,7 +6,7 @@ import { combineReducers } from '@wordpress/data';
6
6
  * Internal dependencies
7
7
  */
8
8
 
9
- import { postId, postType, preferences, saving, postLock, postSavingLock, template, isReady, editorSettings } from './reducer.js';
9
+ import { postId, postType, saving, postLock, postSavingLock, template, isReady, editorSettings } from './reducer.js';
10
10
  import { EDITOR_SETTINGS_DEFAULTS } from './defaults.js';
11
11
  EDITOR_SETTINGS_DEFAULTS.autosaveInterval = 1; // This is a way to override default behavior on mobile, and make it ping the native save every second as long as something changed
12
12
 
@@ -84,7 +84,6 @@ export default combineReducers({
84
84
  postId,
85
85
  postType,
86
86
  postTitle,
87
- preferences,
88
87
  saving,
89
88
  postLock,
90
89
  postSavingLock,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/store/reducer.native.js"],"names":["combineReducers","postId","postType","preferences","saving","postLock","postSavingLock","template","isReady","editorSettings","EDITOR_SETTINGS_DEFAULTS","autosaveInterval","postTitle","isSelected","state","action","type","clipboard","notices","notice","filter","id"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;;AACA,SACCC,MADD,EAECC,QAFD,EAGCC,WAHD,EAICC,MAJD,EAKCC,QALD,EAMCC,cAND,EAOCC,QAPD,EAQCC,OARD,EASCC,cATD,QAUO,cAVP;AAYA,SAASC,wBAAT,QAAyC,eAAzC;AAEAA,wBAAwB,CAACC,gBAAzB,GAA4C,CAA5C,C,CAA+C;;AAE/C,cAAc,cAAd;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,SAAS,GAAGZ,eAAe,CAAE;AACzCa,EAAAA,UAAU,GAA0B;AAAA,QAAxBC,KAAwB,uEAAhB,KAAgB;AAAA,QAATC,MAAS;;AACnC,YAASA,MAAM,CAACC,IAAhB;AACC,WAAK,6BAAL;AACC,eAAOD,MAAM,CAACF,UAAd;AAFF;;AAKA,WAAOC,KAAP;AACA;;AARwC,CAAF,CAAjC;AAWP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,SAAT,GAA2C;AAAA,MAAvBH,KAAuB,uEAAf,IAAe;AAAA,MAATC,MAAS;;AACjD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,kBAAL;AACC,aAAOD,MAAM,CAACE,SAAd;AAFF;;AAKA,SAAOH,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASI,OAAT,GAAuC;AAAA,MAArBJ,KAAqB,uEAAb,EAAa;AAAA,MAATC,MAAS;;AAC7C,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,eAAL;AACC,aAAO,CAAE,GAAGF,KAAL,EAAYC,MAAM,CAACI,MAAnB,CAAP;;AACD,SAAK,oBAAL;AACC,aAAO,EAAP;;AACD,SAAK,eAAL;AACC,aAAOL,KAAK,CAACM,MAAN,CAAgBD,MAAF,IAAcA,MAAM,CAACE,EAAP,KAAcN,MAAM,CAACM,EAAjD,CAAP;AANF;;AAQA,SAAOP,KAAP;AACA;AAED,eAAed,eAAe,CAAE;AAC/BC,EAAAA,MAD+B;AAE/BC,EAAAA,QAF+B;AAG/BU,EAAAA,SAH+B;AAI/BT,EAAAA,WAJ+B;AAK/BC,EAAAA,MAL+B;AAM/BC,EAAAA,QAN+B;AAO/BC,EAAAA,cAP+B;AAQ/BC,EAAAA,QAR+B;AAS/BC,EAAAA,OAT+B;AAU/BC,EAAAA,cAV+B;AAW/BQ,EAAAA,SAX+B;AAY/BC,EAAAA;AAZ+B,CAAF,CAA9B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tpostId,\n\tpostType,\n\tpreferences,\n\tsaving,\n\tpostLock,\n\tpostSavingLock,\n\ttemplate,\n\tisReady,\n\teditorSettings,\n} from './reducer.js';\n\nimport { EDITOR_SETTINGS_DEFAULTS } from './defaults.js';\n\nEDITOR_SETTINGS_DEFAULTS.autosaveInterval = 1; // This is a way to override default behavior on mobile, and make it ping the native save every second as long as something changed\n\nexport * from './reducer.js';\n\n/**\n * Reducer returning the post title state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const postTitle = combineReducers( {\n\tisSelected( state = false, action ) {\n\t\tswitch ( action.type ) {\n\t\t\tcase 'TOGGLE_POST_TITLE_SELECTION':\n\t\t\t\treturn action.isSelected;\n\t\t}\n\n\t\treturn state;\n\t},\n} );\n\n/**\n * Reducer returning the clipboard state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function clipboard( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_CLIPBOARD':\n\t\t\treturn action.clipboard;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the notices state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function notices( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'CREATE_NOTICE':\n\t\t\treturn [ ...state, action.notice ];\n\t\tcase 'REMOVE_ALL_NOTICES':\n\t\t\treturn [];\n\t\tcase 'REMOVE_NOTICE':\n\t\t\treturn state.filter( ( notice ) => notice.id !== action.id );\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tpostId,\n\tpostType,\n\tpostTitle,\n\tpreferences,\n\tsaving,\n\tpostLock,\n\tpostSavingLock,\n\ttemplate,\n\tisReady,\n\teditorSettings,\n\tclipboard,\n\tnotices,\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/store/reducer.native.js"],"names":["combineReducers","postId","postType","saving","postLock","postSavingLock","template","isReady","editorSettings","EDITOR_SETTINGS_DEFAULTS","autosaveInterval","postTitle","isSelected","state","action","type","clipboard","notices","notice","filter","id"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;;AACA,SACCC,MADD,EAECC,QAFD,EAGCC,MAHD,EAICC,QAJD,EAKCC,cALD,EAMCC,QAND,EAOCC,OAPD,EAQCC,cARD,Q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N+B;AAO/BC,EAAAA,QAP+B;AAQ/BC,EAAAA,OAR+B;AAS/BC,EAAAA,cAT+B;AAU/BQ,EAAAA,SAV+B;AAW/BC,EAAAA;AAX+B,CAAF,CAA9B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tpostId,\n\tpostType,\n\tsaving,\n\tpostLock,\n\tpostSavingLock,\n\ttemplate,\n\tisReady,\n\teditorSettings,\n} from './reducer.js';\n\nimport { EDITOR_SETTINGS_DEFAULTS } from './defaults.js';\n\nEDITOR_SETTINGS_DEFAULTS.autosaveInterval = 1; // This is a way to override default behavior on mobile, and make it ping the native save every second as long as something changed\n\nexport * from './reducer.js';\n\n/**\n * Reducer returning the post title state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const postTitle = combineReducers( {\n\tisSelected( state = false, action ) {\n\t\tswitch ( action.type ) {\n\t\t\tcase 'TOGGLE_POST_TITLE_SELECTION':\n\t\t\t\treturn action.isSelected;\n\t\t}\n\n\t\treturn state;\n\t},\n} );\n\n/**\n * Reducer returning the clipboard state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function clipboard( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_CLIPBOARD':\n\t\t\treturn action.clipboard;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the notices state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function notices( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'CREATE_NOTICE':\n\t\t\treturn [ ...state, action.notice ];\n\t\tcase 'REMOVE_ALL_NOTICES':\n\t\t\treturn [];\n\t\tcase 'REMOVE_NOTICE':\n\t\t\treturn state.filter( ( notice ) => notice.id !== action.id );\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tpostId,\n\tpostType,\n\tpostTitle,\n\tsaving,\n\tpostLock,\n\tpostSavingLock,\n\ttemplate,\n\tisReady,\n\teditorSettings,\n\tclipboard,\n\tnotices,\n} );\n"]}
@@ -16,11 +16,11 @@ import { Platform } from '@wordpress/element';
16
16
  import { layout } from '@wordpress/icons';
17
17
  import { store as blockEditorStore } from '@wordpress/block-editor';
18
18
  import { store as coreStore } from '@wordpress/core-data';
19
+ import { store as preferencesStore } from '@wordpress/preferences';
19
20
  /**
20
21
  * Internal dependencies
21
22
  */
22
23
 
23
- import { PREFERENCES_DEFAULTS } from './defaults';
24
24
  import { EDIT_MERGE_PROPERTIES, PERMALINK_POSTNAME_REGEX, ONE_MINUTE_IN_MS, AUTOSAVE_PROPERTIES } from './constants';
25
25
  import { getPostRawValue } from './reducer';
26
26
  import { getTemplatePartIcon } from '../utils/get-template-part-icon';
@@ -965,18 +965,10 @@ export function canUserUseUnfilteredHTML(state) {
965
965
  * Returns whether the pre-publish panel should be shown
966
966
  * or skipped when the user clicks the "publish" button.
967
967
  *
968
- * @param {Object} state Global application state.
969
- *
970
968
  * @return {boolean} Whether the pre-publish panel should be shown or not.
971
969
  */
972
970
 
973
- export function isPublishSidebarEnabled(state) {
974
- if (state.preferences.hasOwnProperty('isPublishSidebarEnabled')) {
975
- return state.preferences.isPublishSidebarEnabled;
976
- }
977
-
978
- return PREFERENCES_DEFAULTS.isPublishSidebarEnabled;
979
- }
971
+ export const isPublishSidebarEnabled = createRegistrySelector(select => () => !!select(preferencesStore).get('core/edit-post', 'isPublishSidebarEnabled'));
980
972
  /**
981
973
  * Return the current block list.
982
974
  *