@wordpress/editor 12.3.1 → 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 (62) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/entities-saved-states/entity-type-list.js +2 -2
  3. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  4. package/build/components/local-autosave-monitor/index.js +1 -1
  5. package/build/components/local-autosave-monitor/index.js.map +1 -1
  6. package/build/components/post-excerpt/index.js +1 -1
  7. package/build/components/post-excerpt/index.js.map +1 -1
  8. package/build/components/provider/use-block-editor-settings.js +15 -2
  9. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  10. package/build/store/actions.js +27 -26
  11. package/build/store/actions.js.map +1 -1
  12. package/build/store/defaults.js +17 -24
  13. package/build/store/defaults.js.map +1 -1
  14. package/build/store/index.js +3 -8
  15. package/build/store/index.js.map +1 -1
  16. package/build/store/reducer.js +0 -30
  17. package/build/store/reducer.js.map +1 -1
  18. package/build/store/reducer.native.js +0 -1
  19. package/build/store/reducer.native.js.map +1 -1
  20. package/build/store/selectors.js +4 -11
  21. package/build/store/selectors.js.map +1 -1
  22. package/build/store/utils/notice-builder.js +5 -4
  23. package/build/store/utils/notice-builder.js.map +1 -1
  24. package/build-module/components/entities-saved-states/entity-type-list.js +2 -2
  25. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  26. package/build-module/components/local-autosave-monitor/index.js +1 -1
  27. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  28. package/build-module/components/post-excerpt/index.js +1 -1
  29. package/build-module/components/post-excerpt/index.js.map +1 -1
  30. package/build-module/components/provider/use-block-editor-settings.js +15 -2
  31. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  32. package/build-module/store/actions.js +21 -22
  33. package/build-module/store/actions.js.map +1 -1
  34. package/build-module/store/defaults.js +15 -21
  35. package/build-module/store/defaults.js.map +1 -1
  36. package/build-module/store/index.js +3 -8
  37. package/build-module/store/index.js.map +1 -1
  38. package/build-module/store/reducer.js +1 -29
  39. package/build-module/store/reducer.js.map +1 -1
  40. package/build-module/store/reducer.native.js +1 -2
  41. package/build-module/store/reducer.native.js.map +1 -1
  42. package/build-module/store/selectors.js +2 -10
  43. package/build-module/store/selectors.js.map +1 -1
  44. package/build-module/store/utils/notice-builder.js +5 -4
  45. package/build-module/store/utils/notice-builder.js.map +1 -1
  46. package/package.json +27 -26
  47. package/src/components/entities-saved-states/entity-type-list.js +6 -3
  48. package/src/components/local-autosave-monitor/README.md +8 -1
  49. package/src/components/local-autosave-monitor/index.js +1 -1
  50. package/src/components/post-excerpt/index.js +3 -1
  51. package/src/components/provider/use-block-editor-settings.js +22 -3
  52. package/src/store/actions.js +13 -16
  53. package/src/store/defaults.js +15 -21
  54. package/src/store/index.js +2 -8
  55. package/src/store/reducer.js +1 -28
  56. package/src/store/reducer.native.js +0 -2
  57. package/src/store/selectors.js +8 -9
  58. package/src/store/test/actions.js +61 -1
  59. package/src/store/test/reducer.js +0 -31
  60. package/src/store/test/selectors.js +0 -35
  61. package/src/store/utils/notice-builder.js +4 -3
  62. package/src/store/utils/test/notice-builder.js +1 -1
@@ -2,29 +2,23 @@
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
- * The default post editor settings
6
+ * The default post editor settings.
12
7
  *
13
- * allowedBlockTypes boolean|Array Allowed block types
14
- * richEditingEnabled boolean Whether rich editing is enabled or not
15
- * codeEditingEnabled boolean Whether code editing is enabled or not
16
- * enableCustomFields boolean Whether the WordPress custom fields are enabled or not.
17
- * true = the user has opted to show the Custom Fields panel at the bottom of the editor.
18
- * false = the user has opted to hide the Custom Fields panel at the bottom of the editor.
19
- * undefined = the current environment does not support Custom Fields,
20
- * so the option toggle in Preferences -> Panels to
21
- * enable the Custom Fields panel is not displayed.
22
- * autosaveInterval number Autosave Interval
23
- * availableTemplates array? The available post templates
24
- * disablePostFormats boolean Whether or not the post formats are disabled
25
- * allowedMimeTypes array? List of allowed mime types and file extensions
26
- * maxUploadFileSize number Maximum upload file size
27
- * supportsLayout boolean Whether the editor supports layouts.
8
+ * @property {boolean|Array} allowedBlockTypes Allowed block types
9
+ * @property {boolean} richEditingEnabled Whether rich editing is enabled or not
10
+ * @property {boolean} codeEditingEnabled Whether code editing is enabled or not
11
+ * @property {boolean} enableCustomFields Whether the WordPress custom fields are enabled or not.
12
+ * true = the user has opted to show the Custom Fields panel at the bottom of the editor.
13
+ * false = the user has opted to hide the Custom Fields panel at the bottom of the editor.
14
+ * 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.
15
+ * @property {number} autosaveInterval How often in seconds the post will be auto-saved via the REST API.
16
+ * @property {number} localAutosaveInterval How often in seconds the post will be backed up to sessionStorage.
17
+ * @property {Array?} availableTemplates The available post templates
18
+ * @property {boolean} disablePostFormats Whether or not the post formats are disabled
19
+ * @property {Array?} allowedMimeTypes List of allowed mime types and file extensions
20
+ * @property {number} maxUploadFileSize Maximum upload file size
21
+ * @property {boolean} supportsLayout Whether the editor supports layouts.
28
22
  */
29
23
 
30
24
  export const EDITOR_SETTINGS_DEFAULTS = { ...SETTINGS_DEFAULTS,
@@ -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;;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 * allowedBlockTypes boolean|Array Allowed block types\n * richEditingEnabled boolean Whether rich editing is enabled or not\n * codeEditingEnabled boolean Whether code editing is enabled or not\n * enableCustomFields boolean 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,\n * so the option toggle in Preferences -> Panels to\n * enable the Custom Fields panel is not displayed.\n * autosaveInterval number Autosave Interval\n * availableTemplates array? The available post templates\n * disablePostFormats boolean Whether or not the post formats are disabled\n * allowedMimeTypes array? List of allowed mime types and file extensions\n * maxUploadFileSize number Maximum upload file size\n * supportsLayout boolean 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;A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A,OAR+B;AAS/BC,EAAAA,cAT+B;AAU/BF,EAAAA;AAV+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 { 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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/**\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,EA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BR,EAAAA,MAJ+B;AAK/BC,EAAAA,QAL+B;AAM/BC,EAAAA,cAN+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
  *