@wordpress/edit-post 6.1.0-next.e230fbab09.0 → 6.2.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 (52) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/header/plugin-more-menu-item/index.js +5 -0
  3. package/build/components/header/plugin-more-menu-item/index.js.map +1 -1
  4. package/build/components/header/template-title/delete-template.js +3 -1
  5. package/build/components/header/template-title/delete-template.js.map +1 -1
  6. package/build/editor.js +1 -4
  7. package/build/editor.js.map +1 -1
  8. package/build/index.js +2 -0
  9. package/build/index.js.map +1 -1
  10. package/build/index.native.js +12 -0
  11. package/build/index.native.js.map +1 -1
  12. package/build/store/actions.js +47 -49
  13. package/build/store/actions.js.map +1 -1
  14. package/build/store/defaults.js +1 -5
  15. package/build/store/defaults.js.map +1 -1
  16. package/build/store/reducer.js +0 -38
  17. package/build/store/reducer.js.map +1 -1
  18. package/build/store/selectors.js +10 -10
  19. package/build/store/selectors.js.map +1 -1
  20. package/build-module/components/header/plugin-more-menu-item/index.js +4 -0
  21. package/build-module/components/header/plugin-more-menu-item/index.js.map +1 -1
  22. package/build-module/components/header/template-title/delete-template.js +3 -1
  23. package/build-module/components/header/template-title/delete-template.js.map +1 -1
  24. package/build-module/editor.js +1 -4
  25. package/build-module/editor.js.map +1 -1
  26. package/build-module/index.js +2 -0
  27. package/build-module/index.js.map +1 -1
  28. package/build-module/index.native.js +10 -0
  29. package/build-module/index.native.js.map +1 -1
  30. package/build-module/store/actions.js +45 -47
  31. package/build-module/store/actions.js.map +1 -1
  32. package/build-module/store/defaults.js +1 -5
  33. package/build-module/store/defaults.js.map +1 -1
  34. package/build-module/store/reducer.js +1 -39
  35. package/build-module/store/reducer.js.map +1 -1
  36. package/build-module/store/selectors.js +8 -6
  37. package/build-module/store/selectors.js.map +1 -1
  38. package/build-style/style-rtl.css +1 -1
  39. package/build-style/style.css +1 -1
  40. package/package.json +26 -26
  41. package/src/components/header/plugin-more-menu-item/index.js +2 -0
  42. package/src/components/header/template-title/delete-template.js +3 -1
  43. package/src/editor.js +0 -6
  44. package/src/index.js +2 -0
  45. package/src/index.native.js +11 -0
  46. package/src/store/actions.js +40 -27
  47. package/src/store/defaults.js +0 -4
  48. package/src/store/reducer.js +1 -33
  49. package/src/store/selectors.js +8 -4
  50. package/src/store/test/actions.js +61 -15
  51. package/src/store/test/reducer.js +0 -9
  52. package/src/store/test/selectors.js +0 -19
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/store/reducer.js"],"names":["flow","get","includes","omit","combineReducers","PREFERENCES_DEFAULTS","createWithInitialState","initialState","reducer","state","action","preferences","panels","type","panelName","enabled","isOpen","opened","editorMode","mode","preferredStyleVariations","blockName","blockStyle","localAutosaveInterval","interval","removedPanels","activeModal","name","publishSidebarActive","isSavingMetaBoxes","metaBoxLocations","metaBoxesPerLocation","deviceType","blockInserterPanel","value","listViewPanel","isEditingTemplate","metaBoxesInitialized","metaBoxes","isSaving","locations","initialized"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,GAAf,EAAoBC,QAApB,EAA8BC,IAA9B,QAA0C,QAA1C;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;;AACA,SAASC,oBAAT,QAAqC,YAArC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,sBAAsB,GAAKC,YAAF,IAAsBC,OAAF,IAAe;AACjE,SAAO;AAAA,QAAEC,KAAF,uEAAUF,YAAV;AAAA,QAAwBG,MAAxB;AAAA,WAAoCF,OAAO,CAAEC,KAAF,EAASC,MAAT,CAA3C;AAAA,GAAP;AACA,CAFD;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMC,WAAW,GAAGX,IAAI,CAAE,CAChCI,eADgC,EAEhCE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;AACA;AACA;AACA;;AACA,OAAO,SAAS0B,aAAT,GAAgD;AAAA,MAAxB1B,KAAwB,uEAAhB,KAAgB;AAAA,MAATC,MAAS;;AACtD,UAASA,MAAM,CAACG,IAAhB;AACC,SAAK,wBAAL;AACC,aAAOH,MAAM,CAACwB,KAAP,GAAe,KAAf,GAAuBzB,KAA9B;;AACD,SAAK,yBAAL;AACC,aAAOC,MAAM,CAACM,MAAd;AAJF;;AAMA,SAAOP,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,SAAS2B,iBAAT,GAAoD;AAAA,MAAxB3B,KAAwB,uEAAhB,KAAgB;AAAA,MAATC,MAAS;;AACnD,UAASA,MAAM,CAACG,IAAhB;AACC,SAAK,yBAAL;AACC,aAAOH,MAAM,CAACwB,KAAd;AAFF;;AAIA,SAAOzB,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS4B,oBAAT,GAAuD;AAAA,MAAxB5B,KAAwB,uEAAhB,KAAgB;AAAA,MAATC,MAAS;;AACtD,UAASA,MAAM,CAACG,IAAhB;AACC,SAAK,wBAAL;AACC,aAAO,IAAP;AAFF;;AAIA,SAAOJ,KAAP;AACA;;AAED,MAAM6B,SAAS,GAAGlC,eAAe,CAAE;AAClCmC,EAAAA,QAAQ,EAAEV,iBADwB;AAElCW,EAAAA,SAAS,EAAEV,gBAFuB;AAGlCW,EAAAA,WAAW,EAAEJ;AAHqB,CAAF,CAAjC;AAMA,eAAejC,eAAe,CAAE;AAC/BsB,EAAAA,WAD+B;AAE/BY,EAAAA,SAF+B;AAG/B3B,EAAAA,WAH+B;AAI/BiB,EAAAA,oBAJ+B;AAK/BH,EAAAA,aAL+B;AAM/BO,EAAAA,UAN+B;AAO/BC,EAAAA,kBAP+B;AAQ/BE,EAAAA,aAR+B;AAS/BC,EAAAA;AAT+B,CAAF,CAA9B","sourcesContent":["/**\n * External dependencies\n */\nimport { flow, get, includes, omit } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { PREFERENCES_DEFAULTS } from './defaults';\n\n/**\n * Higher-order reducer creator which provides the given initial state for the\n * original reducer.\n *\n * @param {*} initialState Initial state to provide to reducer.\n *\n * @return {Function} Higher-order reducer.\n */\nconst createWithInitialState = ( initialState ) => ( reducer ) => {\n\treturn ( state = initialState, action ) => reducer( state, action );\n};\n\n/**\n * Reducer returning the user preferences.\n *\n * @param {Object} state Current state.\n * @param {string} state.mode Current editor mode, either\n * \"visual\" or \"text\".\n * @param {boolean} state.isGeneralSidebarDismissed Whether general sidebar is\n * dismissed. False by default\n * or when closing general\n * sidebar, true when opening\n * sidebar.\n * @param {boolean} state.isSidebarOpened Whether the sidebar is\n * opened or closed.\n * @param {Object} state.panels The state of the different\n * sidebar panels.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const preferences = flow( [\n\tcombineReducers,\n\tcreateWithInitialState( PREFERENCES_DEFAULTS ),\n] )( {\n\tpanels( state, action ) {\n\t\tswitch ( action.type ) {\n\t\t\tcase 'TOGGLE_PANEL_ENABLED': {\n\t\t\t\tconst { panelName } = action;\n\t\t\t\treturn {\n\t\t\t\t\t...state,\n\t\t\t\t\t[ panelName ]: {\n\t\t\t\t\t\t...state[ panelName ],\n\t\t\t\t\t\tenabled: ! get( state, [ panelName, 'enabled' ], true ),\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tcase 'TOGGLE_PANEL_OPENED': {\n\t\t\t\tconst { panelName } = action;\n\t\t\t\tconst isOpen =\n\t\t\t\t\tstate[ panelName ] === true ||\n\t\t\t\t\tget( state, [ panelName, 'opened' ], false );\n\t\t\t\treturn {\n\t\t\t\t\t...state,\n\t\t\t\t\t[ panelName ]: {\n\t\t\t\t\t\t...state[ panelName ],\n\t\t\t\t\t\topened: ! isOpen,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn state;\n\t},\n\teditorMode( state, action ) {\n\t\tif ( action.type === 'SWITCH_MODE' ) {\n\t\t\treturn action.mode;\n\t\t}\n\n\t\treturn state;\n\t},\n\tpreferredStyleVariations( state, action ) {\n\t\tswitch ( action.type ) {\n\t\t\tcase 'UPDATE_PREFERRED_STYLE_VARIATIONS': {\n\t\t\t\tif ( ! action.blockName ) {\n\t\t\t\t\treturn state;\n\t\t\t\t}\n\t\t\t\tif ( ! action.blockStyle ) {\n\t\t\t\t\treturn omit( state, [ action.blockName ] );\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\t...state,\n\t\t\t\t\t[ action.blockName ]: action.blockStyle,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\treturn state;\n\t},\n\tlocalAutosaveInterval( state, action ) {\n\t\tswitch ( action.type ) {\n\t\t\tcase 'UPDATE_LOCAL_AUTOSAVE_INTERVAL':\n\t\t\t\treturn action.interval;\n\t\t}\n\n\t\treturn state;\n\t},\n} );\n\n/**\n * Reducer storing the list of all programmatically removed panels.\n *\n * @param {Array} state Current state.\n * @param {Object} action Action object.\n *\n * @return {Array} Updated state.\n */\nexport function removedPanels( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REMOVE_PANEL':\n\t\t\tif ( ! includes( state, action.panelName ) ) {\n\t\t\t\treturn [ ...state, action.panelName ];\n\t\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for storing the name of the open modal, or null if no modal is open.\n *\n * @param {Object} state Previous state.\n * @param {Object} action Action object containing the `name` of the modal\n *\n * @return {Object} Updated state\n */\nexport function activeModal( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_MODAL':\n\t\t\treturn action.name;\n\t\tcase 'CLOSE_MODAL':\n\t\t\treturn null;\n\t}\n\n\treturn state;\n}\n\nexport function publishSidebarActive( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_PUBLISH_SIDEBAR':\n\t\t\treturn true;\n\t\tcase 'CLOSE_PUBLISH_SIDEBAR':\n\t\t\treturn false;\n\t\tcase 'TOGGLE_PUBLISH_SIDEBAR':\n\t\t\treturn ! state;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the meta boxes isSaving state.\n * A \"true\" value means the meta boxes saving request is in-flight.\n *\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action Object.\n *\n * @return {Object} Updated state.\n */\nexport function isSavingMetaBoxes( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REQUEST_META_BOX_UPDATES':\n\t\t\treturn true;\n\t\tcase 'META_BOX_UPDATES_SUCCESS':\n\t\tcase 'META_BOX_UPDATES_FAILURE':\n\t\t\treturn false;\n\t\tdefault:\n\t\t\treturn state;\n\t}\n}\n\n/**\n * Reducer keeping track of the meta boxes per location.\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action Object.\n *\n * @return {Object} Updated state.\n */\nexport function metaBoxLocations( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_META_BOXES_PER_LOCATIONS':\n\t\t\treturn action.metaBoxesPerLocation;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the editing canvas device type.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deviceType( state = 'Desktop', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_PREVIEW_DEVICE_TYPE':\n\t\t\treturn action.deviceType;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the list view panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the inserter panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer tracking whether the inserter is open.\n *\n * @param {boolean} state\n * @param {Object} action\n */\nfunction isEditingTemplate( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_EDITING_TEMPLATE':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer tracking whether meta boxes are initialized.\n *\n * @param {boolean} state\n * @param {Object} action\n *\n * @return {boolean} Updated state.\n */\nfunction metaBoxesInitialized( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'META_BOXES_INITIALIZED':\n\t\t\treturn true;\n\t}\n\treturn state;\n}\n\nconst metaBoxes = combineReducers( {\n\tisSaving: isSavingMetaBoxes,\n\tlocations: metaBoxLocations,\n\tinitialized: metaBoxesInitialized,\n} );\n\nexport default combineReducers( {\n\tactiveModal,\n\tmetaBoxes,\n\tpreferences,\n\tpublishSidebarActive,\n\tremovedPanels,\n\tdeviceType,\n\tblockInserterPanel,\n\tlistViewPanel,\n\tisEditingTemplate,\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/store/reducer.js"],"names":["flow","get","includes","combineReducers","PREFERENCES_DEFAULTS","createWithInitialState","initialState","reducer","state","action","preferences","panels","type","panelName","enabled","isOpen","opened","removedPanels","activeModal","name","publishSidebarActive","isSavingMetaBoxes","metaBoxLocations","metaBoxesPerLocation","deviceType","blockInserterPanel","value","listViewPanel","isEditingTemplate","metaBoxesInitialized","metaBoxes","isSaving","locations","initialized"],"mappings":"AAAA;AACA;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AAJF;;AAMA,SAAOP,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,SAASoB,iBAAT,GAAoD;AAAA,MAAxBpB,KAAwB,uEAAhB,KAAgB;AAAA,MAATC,MAAS;;AACnD,UAASA,MAAM,CAACG,IAAhB;AACC,SAAK,yBAAL;AACC,aAAOH,MAAM,CAACiB,KAAd;AAFF;;AAIA,SAAOlB,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASqB,oBAAT,GAAuD;AAAA,MAAxBrB,KAAwB,uEAAhB,KAAgB;AAAA,MAATC,MAAS;;AACtD,UAASA,MAAM,CAACG,IAAhB;AACC,SAAK,wBAAL;AACC,aAAO,IAAP;AAFF;;AAIA,SAAOJ,KAAP;AACA;;AAED,MAAMsB,SAAS,GAAG3B,eAAe,CAAE;AAClC4B,EAAAA,QAAQ,EAAEV,iBADwB;AAElCW,EAAAA,SAAS,EAAEV,gBAFuB;AAGlCW,EAAAA,WAAW,EAAEJ;AAHqB,CAAF,CAAjC;AAMA,eAAe1B,eAAe,CAAE;AAC/Be,EAAAA,WAD+B;AAE/BY,EAAAA,SAF+B;AAG/BpB,EAAAA,WAH+B;AAI/BU,EAAAA,oBAJ+B;AAK/BH,EAAAA,aAL+B;AAM/BO,EAAAA,UAN+B;AAO/BC,EAAAA,kBAP+B;AAQ/BE,EAAAA,aAR+B;AAS/BC,EAAAA;AAT+B,CAAF,CAA9B","sourcesContent":["/**\n * External dependencies\n */\nimport { flow, get, includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { PREFERENCES_DEFAULTS } from './defaults';\n\n/**\n * Higher-order reducer creator which provides the given initial state for the\n * original reducer.\n *\n * @param {*} initialState Initial state to provide to reducer.\n *\n * @return {Function} Higher-order reducer.\n */\nconst createWithInitialState = ( initialState ) => ( reducer ) => {\n\treturn ( state = initialState, action ) => reducer( state, action );\n};\n\n/**\n * Reducer returning the user preferences.\n *\n * @param {Object} state Current state.\n * @param {string} state.mode Current editor mode, either\n * \"visual\" or \"text\".\n * @param {boolean} state.isGeneralSidebarDismissed Whether general sidebar is\n * dismissed. False by default\n * or when closing general\n * sidebar, true when opening\n * sidebar.\n * @param {boolean} state.isSidebarOpened Whether the sidebar is\n * opened or closed.\n * @param {Object} state.panels The state of the different\n * sidebar panels.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const preferences = flow( [\n\tcombineReducers,\n\tcreateWithInitialState( PREFERENCES_DEFAULTS ),\n] )( {\n\tpanels( state, action ) {\n\t\tswitch ( action.type ) {\n\t\t\tcase 'TOGGLE_PANEL_ENABLED': {\n\t\t\t\tconst { panelName } = action;\n\t\t\t\treturn {\n\t\t\t\t\t...state,\n\t\t\t\t\t[ panelName ]: {\n\t\t\t\t\t\t...state[ panelName ],\n\t\t\t\t\t\tenabled: ! get( state, [ panelName, 'enabled' ], true ),\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tcase 'TOGGLE_PANEL_OPENED': {\n\t\t\t\tconst { panelName } = action;\n\t\t\t\tconst isOpen =\n\t\t\t\t\tstate[ panelName ] === true ||\n\t\t\t\t\tget( state, [ panelName, 'opened' ], false );\n\t\t\t\treturn {\n\t\t\t\t\t...state,\n\t\t\t\t\t[ panelName ]: {\n\t\t\t\t\t\t...state[ panelName ],\n\t\t\t\t\t\topened: ! isOpen,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn state;\n\t},\n} );\n\n/**\n * Reducer storing the list of all programmatically removed panels.\n *\n * @param {Array} state Current state.\n * @param {Object} action Action object.\n *\n * @return {Array} Updated state.\n */\nexport function removedPanels( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REMOVE_PANEL':\n\t\t\tif ( ! includes( state, action.panelName ) ) {\n\t\t\t\treturn [ ...state, action.panelName ];\n\t\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for storing the name of the open modal, or null if no modal is open.\n *\n * @param {Object} state Previous state.\n * @param {Object} action Action object containing the `name` of the modal\n *\n * @return {Object} Updated state\n */\nexport function activeModal( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_MODAL':\n\t\t\treturn action.name;\n\t\tcase 'CLOSE_MODAL':\n\t\t\treturn null;\n\t}\n\n\treturn state;\n}\n\nexport function publishSidebarActive( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_PUBLISH_SIDEBAR':\n\t\t\treturn true;\n\t\tcase 'CLOSE_PUBLISH_SIDEBAR':\n\t\t\treturn false;\n\t\tcase 'TOGGLE_PUBLISH_SIDEBAR':\n\t\t\treturn ! state;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the meta boxes isSaving state.\n * A \"true\" value means the meta boxes saving request is in-flight.\n *\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action Object.\n *\n * @return {Object} Updated state.\n */\nexport function isSavingMetaBoxes( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REQUEST_META_BOX_UPDATES':\n\t\t\treturn true;\n\t\tcase 'META_BOX_UPDATES_SUCCESS':\n\t\tcase 'META_BOX_UPDATES_FAILURE':\n\t\t\treturn false;\n\t\tdefault:\n\t\t\treturn state;\n\t}\n}\n\n/**\n * Reducer keeping track of the meta boxes per location.\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action Object.\n *\n * @return {Object} Updated state.\n */\nexport function metaBoxLocations( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_META_BOXES_PER_LOCATIONS':\n\t\t\treturn action.metaBoxesPerLocation;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the editing canvas device type.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deviceType( state = 'Desktop', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_PREVIEW_DEVICE_TYPE':\n\t\t\treturn action.deviceType;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the list view panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the inserter panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer tracking whether the inserter is open.\n *\n * @param {boolean} state\n * @param {Object} action\n */\nfunction isEditingTemplate( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_EDITING_TEMPLATE':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer tracking whether meta boxes are initialized.\n *\n * @param {boolean} state\n * @param {Object} action\n *\n * @return {boolean} Updated state.\n */\nfunction metaBoxesInitialized( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'META_BOXES_INITIALIZED':\n\t\t\treturn true;\n\t}\n\treturn state;\n}\n\nconst metaBoxes = combineReducers( {\n\tisSaving: isSavingMetaBoxes,\n\tlocations: metaBoxLocations,\n\tinitialized: metaBoxesInitialized,\n} );\n\nexport default combineReducers( {\n\tactiveModal,\n\tmetaBoxes,\n\tpreferences,\n\tpublishSidebarActive,\n\tremovedPanels,\n\tdeviceType,\n\tblockInserterPanel,\n\tlistViewPanel,\n\tisEditingTemplate,\n} );\n"]}
@@ -21,9 +21,11 @@ const EMPTY_ARRAY = [];
21
21
  * @return {string} Editing mode.
22
22
  */
23
23
 
24
- export function getEditorMode(state) {
25
- return getPreference(state, 'editorMode', 'visual');
26
- }
24
+ export const getEditorMode = createRegistrySelector(select => () => {
25
+ var _select$get;
26
+
27
+ return (_select$get = select(preferencesStore).get('core/edit-post', 'editorMode')) !== null && _select$get !== void 0 ? _select$get : 'visual';
28
+ });
27
29
  /**
28
30
  * Returns true if the editor sidebar is opened.
29
31
  *
@@ -68,7 +70,7 @@ export const getActiveGeneralSidebarName = createRegistrySelector(select => () =
68
70
  }); // The current list of preference keys that have been migrated to the
69
71
  // preferences package.
70
72
 
71
- const MIGRATED_KEYS = ['hiddenBlockTypes'];
73
+ const MIGRATED_KEYS = ['hiddenBlockTypes', 'editorMode', 'preferredStyleVariations'];
72
74
  /**
73
75
  * Returns the preferences (these preferences are persisted locally).
74
76
  *
@@ -115,9 +117,9 @@ export function getPreference(state, preferenceKey, defaultValue) {
115
117
  */
116
118
 
117
119
  export const getHiddenBlockTypes = createRegistrySelector(select => () => {
118
- var _select$get;
120
+ var _select$get2;
119
121
 
120
- return (_select$get = select(preferencesStore).get('core/edit-post', 'hiddenBlockTypes')) !== null && _select$get !== void 0 ? _select$get : EMPTY_ARRAY;
122
+ return (_select$get2 = select(preferencesStore).get('core/edit-post', 'hiddenBlockTypes')) !== null && _select$get2 !== void 0 ? _select$get2 : EMPTY_ARRAY;
121
123
  });
122
124
  /**
123
125
  * Returns true if the publish sidebar is opened.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/store/selectors.js"],"names":["createSelector","get","includes","some","flatten","values","createRegistrySelector","store","interfaceStore","preferencesStore","coreStore","editorStore","EMPTY_ARRAY","getEditorMode","state","getPreference","isEditorSidebarOpened","select","activeGeneralSidebar","getActiveComplementaryArea","isPluginSidebarOpened","getActiveGeneralSidebarName","MIGRATED_KEYS","getPreferences","editPostPreferences","preferences","preferenceStorePreferences","reduce","accumulatedPrefs","preferenceKey","value","defaultValue","isMigratedKey","undefined","getHiddenBlockTypes","isPublishSidebarOpened","publishSidebarActive","isEditorPanelRemoved","panelName","removedPanels","isEditorPanelEnabled","panels","isEditorPanelOpened","isModalActive","modalName","activeModal","isFeatureActive","feature","isPluginItemPinned","pluginName","isItemPinned","getActiveMetaBoxLocations","Object","keys","metaBoxes","locations","filter","location","isMetaBoxLocationActive","isMetaBoxLocationVisible","getMetaBoxesPerLocation","id","length","getAllMetaBoxes","hasMetaBoxes","isSavingMetaBoxes","isSaving","__experimentalGetPreviewDeviceType","deviceType","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","isEditingTemplate","areMetaBoxesInitialized","initialized","getEditedPostTemplate","currentTemplate","getEditedPostAttribute","templateWithSameSlug","getEntityRecords","per_page","find","template","slug","getEditedEntityRecord","post","getCurrentPost","link","__experimentalGetTemplateForLink"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,cAAP,MAA2B,QAA3B;AACA,SAASC,GAAT,EAAcC,QAAd,EAAwBC,IAAxB,EAA8BC,OAA9B,EAAuCC,MAAvC,QAAqD,QAArD;AAEA;AACA;AACA;;AACA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,sBAAxC;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,wBAA1C;AACA,SAASF,KAAK,IAAIG,SAAlB,QAAmC,sBAAnC;AACA,SAASH,KAAK,IAAII,WAAlB,QAAqC,mBAArC;AAEA,MAAMC,WAAW,GAAG,EAApB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAwBC,KAAxB,EAAgC;AACtC,SAAOC,aAAa,CAAED,KAAF,EAAS,YAAT,EAAuB,QAAvB,CAApB;AACA;AAED;AACA;A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D,KAA5B,EAAoC;AAC1C,SAAOA,KAAK,CAAC+D,iBAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,uBAAT,CAAkChE,KAAlC,EAA0C;AAChD,SAAOA,KAAK,CAACwC,SAAN,CAAgByB,WAAvB;AACA;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,qBAAqB,GAAG1E,sBAAsB,CACxDW,MAAF,IAAc,MAAM;AACnB,QAAMgE,eAAe,GAAGhE,MAAM,CAAEN,WAAF,CAAN,CAAsBuE,sBAAtB,CACvB,UADuB,CAAxB;;AAGA,MAAKD,eAAL,EAAuB;AAAA;;AACtB,UAAME,oBAAoB,4BAAGlE,MAAM,CAAEP,SAAF,CAAN,CAC3B0E,gBAD2B,CACT,UADS,EACG,aADH,EACkB;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KADlB,CAAH,0DAAG,sBAE1BC,IAF0B,CAElBC,QAAF,IAAgBA,QAAQ,CAACC,IAAT,KAAkBP,eAFd,CAA7B;;AAGA,QAAK,CAAEE,oBAAP,EAA8B;AAC7B,aAAOA,oBAAP;AACA;;AACD,WAAOlE,MAAM,CAAEP,SAAF,CAAN,CAAoB+E,qBAApB,CACN,UADM,EAEN,aAFM,EAGNN,oBAAoB,CAACtB,EAHf,CAAP;AAKA;;AAED,QAAM6B,IAAI,GAAGzE,MAAM,CAAEN,WAAF,CAAN,CAAsBgF,cAAtB,EAAb;;AACA,MAAKD,IAAI,CAACE,IAAV,EAAiB;AAChB,WAAO3E,MAAM,CAAEP,SAAF,CAAN,CAAoBmF,gCAApB,CACNH,IAAI,CAACE,IADC,CAAP;AAGA;;AAED,SAAO,IAAP;AACA,CA3ByD,CAApD","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\nimport { get, includes, some, flatten, values } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport function getEditorMode( state ) {\n\treturn getPreference( state, 'editorMode', 'visual' );\n}\n\n/**\n * Returns true if the editor sidebar is opened.\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether the editor sidebar is opened.\n */\nexport const isEditorSidebarOpened = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst activeGeneralSidebar = select(\n\t\t\tinterfaceStore\n\t\t).getActiveComplementaryArea( 'core/edit-post' );\n\t\treturn includes(\n\t\t\t[ 'edit-post/document', 'edit-post/block' ],\n\t\t\tactiveGeneralSidebar\n\t\t);\n\t}\n);\n\n/**\n * Returns true if the plugin sidebar is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the plugin sidebar is opened.\n */\nexport const isPluginSidebarOpened = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst activeGeneralSidebar = select(\n\t\t\tinterfaceStore\n\t\t).getActiveComplementaryArea( 'core/edit-post' );\n\t\treturn (\n\t\t\t!! activeGeneralSidebar &&\n\t\t\t! includes(\n\t\t\t\t[ 'edit-post/document', 'edit-post/block' ],\n\t\t\t\tactiveGeneralSidebar\n\t\t\t)\n\t\t);\n\t}\n);\n\n/**\n * Returns the current active general sidebar name, or null if there is no\n * general sidebar active. The active general sidebar is a unique name to\n * identify either an editor or plugin sidebar.\n *\n * Examples:\n *\n * - `edit-post/document`\n * - `my-plugin/insert-image-sidebar`\n *\n * @param {Object} state Global application state.\n *\n * @return {?string} Active general sidebar name.\n */\nexport const getActiveGeneralSidebarName = createRegistrySelector(\n\t( select ) => () => {\n\t\treturn select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t'core/edit-post'\n\t\t);\n\t}\n);\n\n// The current list of preference keys that have been migrated to the\n// preferences package.\nconst MIGRATED_KEYS = [ 'hiddenBlockTypes' ];\n\n/**\n * Returns the preferences (these preferences are persisted locally).\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Preferences Object.\n */\nexport const getPreferences = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst editPostPreferences = state.preferences;\n\n\t\t// Some preferences now exist in the preferences store.\n\t\t// Fetch them so that they can be merged into the post\n\t\t// editor preferences.\n\t\tconst preferenceStorePreferences = MIGRATED_KEYS.reduce(\n\t\t\t( accumulatedPrefs, preferenceKey ) => {\n\t\t\t\tconst value = select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\tpreferenceKey\n\t\t\t\t);\n\n\t\t\t\treturn {\n\t\t\t\t\t...accumulatedPrefs,\n\t\t\t\t\t[ preferenceKey ]: value,\n\t\t\t\t};\n\t\t\t},\n\t\t\t{}\n\t\t);\n\n\t\treturn {\n\t\t\t...editPostPreferences,\n\t\t\t...preferenceStorePreferences,\n\t\t};\n\t}\n);\n\n/**\n *\n * @param {Object} state Global application state.\n * @param {string} preferenceKey Preference Key.\n * @param {*} defaultValue Default Value.\n *\n * @return {*} Preference Value.\n */\nexport function getPreference( state, preferenceKey, defaultValue ) {\n\t// Avoid using the `getPreferences` registry selector where possible.\n\tconst isMigratedKey = MIGRATED_KEYS.includes( preferenceKey );\n\tconst preferences = isMigratedKey\n\t\t? getPreferences( state )\n\t\t: state.preferences;\n\tconst value = preferences[ preferenceKey ];\n\treturn value === undefined ? defaultValue : value;\n}\n\n/**\n * Returns an array of blocks that are hidden.\n *\n * @return {Array} A list of the hidden block types\n */\nexport const getHiddenBlockTypes = createRegistrySelector( ( select ) => () => {\n\treturn (\n\t\tselect( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\t'hiddenBlockTypes'\n\t\t) ?? EMPTY_ARRAY\n\t);\n} );\n\n/**\n * Returns true if the publish sidebar is opened.\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether the publish sidebar is open.\n */\nexport function isPublishSidebarOpened( state ) {\n\treturn state.publishSidebarActive;\n}\n\n/**\n * Returns true if the given panel was programmatically removed, or false otherwise.\n * All panels are not removed by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is removed.\n */\nexport function isEditorPanelRemoved( state, panelName ) {\n\treturn includes( state.removedPanels, panelName );\n}\n\n/**\n * Returns true if the given panel is enabled, or false otherwise. Panels are\n * enabled by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is enabled.\n */\nexport function isEditorPanelEnabled( state, panelName ) {\n\tconst panels = getPreference( state, 'panels' );\n\n\treturn (\n\t\t! isEditorPanelRemoved( state, panelName ) &&\n\t\tget( panels, [ panelName, 'enabled' ], true )\n\t);\n}\n\n/**\n * Returns true if the given panel is open, or false otherwise. Panels are\n * closed by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is open.\n */\nexport function isEditorPanelOpened( state, panelName ) {\n\tconst panels = getPreference( state, 'panels' );\n\treturn (\n\t\tget( panels, [ panelName ] ) === true ||\n\t\tget( panels, [ panelName, 'opened' ] ) === true\n\t);\n}\n\n/**\n * Returns true if a modal is active, or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} modalName A string that uniquely identifies the modal.\n *\n * @return {boolean} Whether the modal is active.\n */\nexport function isModalActive( state, modalName ) {\n\treturn state.activeModal === modalName;\n}\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} feature Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( state, feature ) => {\n\t\treturn !! select( preferencesStore ).get( 'core/edit-post', feature );\n\t}\n);\n\n/**\n * Returns true if the plugin item is pinned to the header.\n * When the value is not set it defaults to true.\n *\n * @param {Object} state Global application state.\n * @param {string} pluginName Plugin item name.\n *\n * @return {boolean} Whether the plugin item is pinned.\n */\nexport const isPluginItemPinned = createRegistrySelector(\n\t( select ) => ( state, pluginName ) => {\n\t\treturn select( interfaceStore ).isItemPinned(\n\t\t\t'core/edit-post',\n\t\t\tpluginName\n\t\t);\n\t}\n);\n\n/**\n * Returns an array of active meta box locations.\n *\n * @param {Object} state Post editor state.\n *\n * @return {string[]} Active meta box locations.\n */\nexport const getActiveMetaBoxLocations = createSelector(\n\t( state ) => {\n\t\treturn Object.keys( state.metaBoxes.locations ).filter( ( location ) =>\n\t\t\tisMetaBoxLocationActive( state, location )\n\t\t);\n\t},\n\t( state ) => [ state.metaBoxes.locations ]\n);\n\n/**\n * Returns true if a metabox location is active and visible\n *\n * @param {Object} state Post editor state.\n * @param {string} location Meta box location to test.\n *\n * @return {boolean} Whether the meta box location is active and visible.\n */\nexport function isMetaBoxLocationVisible( state, location ) {\n\treturn (\n\t\tisMetaBoxLocationActive( state, location ) &&\n\t\tsome( getMetaBoxesPerLocation( state, location ), ( { id } ) => {\n\t\t\treturn isEditorPanelEnabled( state, `meta-box-${ id }` );\n\t\t} )\n\t);\n}\n\n/**\n * Returns true if there is an active meta box in the given location, or false\n * otherwise.\n *\n * @param {Object} state Post editor state.\n * @param {string} location Meta box location to test.\n *\n * @return {boolean} Whether the meta box location is active.\n */\nexport function isMetaBoxLocationActive( state, location ) {\n\tconst metaBoxes = getMetaBoxesPerLocation( state, location );\n\treturn !! metaBoxes && metaBoxes.length !== 0;\n}\n\n/**\n * Returns the list of all the available meta boxes for a given location.\n *\n * @param {Object} state Global application state.\n * @param {string} location Meta box location to test.\n *\n * @return {?Array} List of meta boxes.\n */\nexport function getMetaBoxesPerLocation( state, location ) {\n\treturn state.metaBoxes.locations[ location ];\n}\n\n/**\n * Returns the list of all the available meta boxes.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} List of meta boxes.\n */\nexport const getAllMetaBoxes = createSelector(\n\t( state ) => {\n\t\treturn flatten( values( state.metaBoxes.locations ) );\n\t},\n\t( state ) => [ state.metaBoxes.locations ]\n);\n\n/**\n * Returns true if the post is using Meta Boxes\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether there are metaboxes or not.\n */\nexport function hasMetaBoxes( state ) {\n\treturn getActiveMetaBoxLocations( state ).length > 0;\n}\n\n/**\n * Returns true if the Meta Boxes are being saved.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the metaboxes are being saved.\n */\nexport function isSavingMetaBoxes( state ) {\n\treturn state.metaBoxes.isSaving;\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst {\n\t\trootClientId,\n\t\tinsertionIndex,\n\t\tfilterValue,\n\t} = state.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns true if the template editing mode is enabled.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether we're editing the template.\n */\nexport function isEditingTemplate( state ) {\n\treturn state.isEditingTemplate;\n}\n\n/**\n * Returns true if meta boxes are initialized.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether meta boxes are initialized.\n */\nexport function areMetaBoxesInitialized( state ) {\n\treturn state.metaBoxes.initialized;\n}\n\n/**\n * Retrieves the template of the currently edited post.\n *\n * @return {Object?} Post Template.\n */\nexport const getEditedPostTemplate = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst currentTemplate = select( editorStore ).getEditedPostAttribute(\n\t\t\t'template'\n\t\t);\n\t\tif ( currentTemplate ) {\n\t\t\tconst templateWithSameSlug = select( coreStore )\n\t\t\t\t.getEntityRecords( 'postType', 'wp_template', { per_page: -1 } )\n\t\t\t\t?.find( ( template ) => template.slug === currentTemplate );\n\t\t\tif ( ! templateWithSameSlug ) {\n\t\t\t\treturn templateWithSameSlug;\n\t\t\t}\n\t\t\treturn select( coreStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\ttemplateWithSameSlug.id\n\t\t\t);\n\t\t}\n\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tif ( post.link ) {\n\t\t\treturn select( coreStore ).__experimentalGetTemplateForLink(\n\t\t\t\tpost.link\n\t\t\t);\n\t\t}\n\n\t\treturn null;\n\t}\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/store/selectors.js"],"names":["createSelector","get","includes","some","flatten","values","createRegistrySelector","store","interfaceStore","preferencesStore","coreStore","editorStore","EMPTY_ARRAY","getEditorMode","select","isEditorSidebarOpened","activeGeneralSidebar","getActiveComplementaryArea","isPluginSidebarOpened","getActiveGeneralSidebarName","MIGRATED_KEYS","getPreferences","state","editPostPreferences","preferences","preferenceStorePreferences","reduce","accumulatedPrefs","preferenceKey","value","getPreference","defaultValue","isMigratedKey","undefined","getHiddenBlockTypes","isPublishSidebarOpened","publishSidebarActive","isEditorPanelRemoved","panelName","removedPanels","isEditorPanelEnabled","panels","isEditorPanelOpened","isModalActive","modalName","activeModal","isFeatureActive","feature","isPluginItemPinned","pluginName","isItemPinned","getActiveMetaBoxLocations","Object","keys","metaBoxes","locations","filter","location","isMetaBoxLocationActive","isMetaBoxLocationVisible","getMetaBoxesPerLocation","id","length","getAllMetaBoxes","hasMetaBoxes","isSavingMetaBoxes","isSaving","__experimentalGetPreviewDeviceType","deviceType","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","isEditingTemplate","areMetaBoxesInitialized","initialized","getEditedPostTemplate","currentTemplate","getEditedPostAttribute","templateWithSameSlug","getEntityRecords","per_page","find","template","slug","getEditedEntityRecord","post","getCurrentPost","link","__experimentalGetTemplateForLink"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,cAAP,MAA2B,QAA3B;AACA,SAASC,GAAT,EAAcC,QAAd,EAAwBC,IAAxB,EAA8BC,OAA9B,EAAuCC,MAAvC,QAAqD,QAArD;AAEA;AACA;AACA;;AACA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,sBAAxC;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,wBAA1C;AACA,SAASF,KAAK,IAAIG,SAAlB,QAAmC,sBAAnC;AACA,SAASH,KAAK,IAAII,WAAlB,QAAqC,mBAArC;AAEA,MAAMC,WAAW,GAAG,EAApB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,aAAa,GAAGP,sBAAsB,CAAIQ,MAAF,IAAc;AAAA;;AAAA,wBAClEA,MAAM,CAAEL,gBAAF,CAAN,CAA2BR,GAA3B,CAAgC,gBAAhC,EAAkD,YAAlD,CADkE,qDACE,QADF;AAAA,CAAhB,CAA5C;AAIP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMc,qBAAqB,GAAGT,sBAAsB,CACxDQ,MAAF,IAAc,MAAM;AACnB,QAAME,oBAAoB,GAAGF,MAAM,CAClCN,cADkC,CAAN,CAE3BS,0BAF2B,CAEC,gBAFD,CAA7B;AAGA,SAAOf,QAAQ,CACd,CAAE,oBAAF,EAAwB,iBAAxB,CADc,EAEdc,oBAFc,CAAf;AAIA,CATyD,CAApD;AAYP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OA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AM;AACnB,QAAMmE,eAAe,GAAGnE,MAAM,CAAEH,WAAF,CAAN,CAAsBuE,sBAAtB,CACvB,UADuB,CAAxB;;AAGA,MAAKD,eAAL,EAAuB;AAAA;;AACtB,UAAME,oBAAoB,4BAAGrE,MAAM,CAAEJ,SAAF,CAAN,CAC3B0E,gBAD2B,CACT,UADS,EACG,aADH,EACkB;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KADlB,CAAH,0DAAG,sBAE1BC,IAF0B,CAElBC,QAAF,IAAgBA,QAAQ,CAACC,IAAT,KAAkBP,eAFd,CAA7B;;AAGA,QAAK,CAAEE,oBAAP,EAA8B;AAC7B,aAAOA,oBAAP;AACA;;AACD,WAAOrE,MAAM,CAAEJ,SAAF,CAAN,CAAoB+E,qBAApB,CACN,UADM,EAEN,aAFM,EAGNN,oBAAoB,CAACtB,EAHf,CAAP;AAKA;;AAED,QAAM6B,IAAI,GAAG5E,MAAM,CAAEH,WAAF,CAAN,CAAsBgF,cAAtB,EAAb;;AACA,MAAKD,IAAI,CAACE,IAAV,EAAiB;AAChB,WAAO9E,MAAM,CAAEJ,SAAF,CAAN,CAAoBmF,gCAApB,CACNH,IAAI,CAACE,IADC,CAAP;AAGA;;AAED,SAAO,IAAP;AACA,CA3ByD,CAApD","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\nimport { get, includes, some, flatten, values } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector( ( select ) => () =>\n\tselect( preferencesStore ).get( 'core/edit-post', 'editorMode' ) ?? 'visual'\n);\n\n/**\n * Returns true if the editor sidebar is opened.\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether the editor sidebar is opened.\n */\nexport const isEditorSidebarOpened = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst activeGeneralSidebar = select(\n\t\t\tinterfaceStore\n\t\t).getActiveComplementaryArea( 'core/edit-post' );\n\t\treturn includes(\n\t\t\t[ 'edit-post/document', 'edit-post/block' ],\n\t\t\tactiveGeneralSidebar\n\t\t);\n\t}\n);\n\n/**\n * Returns true if the plugin sidebar is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the plugin sidebar is opened.\n */\nexport const isPluginSidebarOpened = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst activeGeneralSidebar = select(\n\t\t\tinterfaceStore\n\t\t).getActiveComplementaryArea( 'core/edit-post' );\n\t\treturn (\n\t\t\t!! activeGeneralSidebar &&\n\t\t\t! includes(\n\t\t\t\t[ 'edit-post/document', 'edit-post/block' ],\n\t\t\t\tactiveGeneralSidebar\n\t\t\t)\n\t\t);\n\t}\n);\n\n/**\n * Returns the current active general sidebar name, or null if there is no\n * general sidebar active. The active general sidebar is a unique name to\n * identify either an editor or plugin sidebar.\n *\n * Examples:\n *\n * - `edit-post/document`\n * - `my-plugin/insert-image-sidebar`\n *\n * @param {Object} state Global application state.\n *\n * @return {?string} Active general sidebar name.\n */\nexport const getActiveGeneralSidebarName = createRegistrySelector(\n\t( select ) => () => {\n\t\treturn select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t'core/edit-post'\n\t\t);\n\t}\n);\n\n// The current list of preference keys that have been migrated to the\n// preferences package.\nconst MIGRATED_KEYS = [\n\t'hiddenBlockTypes',\n\t'editorMode',\n\t'preferredStyleVariations',\n];\n\n/**\n * Returns the preferences (these preferences are persisted locally).\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Preferences Object.\n */\nexport const getPreferences = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst editPostPreferences = state.preferences;\n\n\t\t// Some preferences now exist in the preferences store.\n\t\t// Fetch them so that they can be merged into the post\n\t\t// editor preferences.\n\t\tconst preferenceStorePreferences = MIGRATED_KEYS.reduce(\n\t\t\t( accumulatedPrefs, preferenceKey ) => {\n\t\t\t\tconst value = select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\tpreferenceKey\n\t\t\t\t);\n\n\t\t\t\treturn {\n\t\t\t\t\t...accumulatedPrefs,\n\t\t\t\t\t[ preferenceKey ]: value,\n\t\t\t\t};\n\t\t\t},\n\t\t\t{}\n\t\t);\n\n\t\treturn {\n\t\t\t...editPostPreferences,\n\t\t\t...preferenceStorePreferences,\n\t\t};\n\t}\n);\n\n/**\n *\n * @param {Object} state Global application state.\n * @param {string} preferenceKey Preference Key.\n * @param {*} defaultValue Default Value.\n *\n * @return {*} Preference Value.\n */\nexport function getPreference( state, preferenceKey, defaultValue ) {\n\t// Avoid using the `getPreferences` registry selector where possible.\n\tconst isMigratedKey = MIGRATED_KEYS.includes( preferenceKey );\n\tconst preferences = isMigratedKey\n\t\t? getPreferences( state )\n\t\t: state.preferences;\n\tconst value = preferences[ preferenceKey ];\n\treturn value === undefined ? defaultValue : value;\n}\n\n/**\n * Returns an array of blocks that are hidden.\n *\n * @return {Array} A list of the hidden block types\n */\nexport const getHiddenBlockTypes = createRegistrySelector( ( select ) => () => {\n\treturn (\n\t\tselect( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\t'hiddenBlockTypes'\n\t\t) ?? EMPTY_ARRAY\n\t);\n} );\n\n/**\n * Returns true if the publish sidebar is opened.\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether the publish sidebar is open.\n */\nexport function isPublishSidebarOpened( state ) {\n\treturn state.publishSidebarActive;\n}\n\n/**\n * Returns true if the given panel was programmatically removed, or false otherwise.\n * All panels are not removed by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is removed.\n */\nexport function isEditorPanelRemoved( state, panelName ) {\n\treturn includes( state.removedPanels, panelName );\n}\n\n/**\n * Returns true if the given panel is enabled, or false otherwise. Panels are\n * enabled by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is enabled.\n */\nexport function isEditorPanelEnabled( state, panelName ) {\n\tconst panels = getPreference( state, 'panels' );\n\n\treturn (\n\t\t! isEditorPanelRemoved( state, panelName ) &&\n\t\tget( panels, [ panelName, 'enabled' ], true )\n\t);\n}\n\n/**\n * Returns true if the given panel is open, or false otherwise. Panels are\n * closed by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is open.\n */\nexport function isEditorPanelOpened( state, panelName ) {\n\tconst panels = getPreference( state, 'panels' );\n\treturn (\n\t\tget( panels, [ panelName ] ) === true ||\n\t\tget( panels, [ panelName, 'opened' ] ) === true\n\t);\n}\n\n/**\n * Returns true if a modal is active, or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} modalName A string that uniquely identifies the modal.\n *\n * @return {boolean} Whether the modal is active.\n */\nexport function isModalActive( state, modalName ) {\n\treturn state.activeModal === modalName;\n}\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} feature Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( state, feature ) => {\n\t\treturn !! select( preferencesStore ).get( 'core/edit-post', feature );\n\t}\n);\n\n/**\n * Returns true if the plugin item is pinned to the header.\n * When the value is not set it defaults to true.\n *\n * @param {Object} state Global application state.\n * @param {string} pluginName Plugin item name.\n *\n * @return {boolean} Whether the plugin item is pinned.\n */\nexport const isPluginItemPinned = createRegistrySelector(\n\t( select ) => ( state, pluginName ) => {\n\t\treturn select( interfaceStore ).isItemPinned(\n\t\t\t'core/edit-post',\n\t\t\tpluginName\n\t\t);\n\t}\n);\n\n/**\n * Returns an array of active meta box locations.\n *\n * @param {Object} state Post editor state.\n *\n * @return {string[]} Active meta box locations.\n */\nexport const getActiveMetaBoxLocations = createSelector(\n\t( state ) => {\n\t\treturn Object.keys( state.metaBoxes.locations ).filter( ( location ) =>\n\t\t\tisMetaBoxLocationActive( state, location )\n\t\t);\n\t},\n\t( state ) => [ state.metaBoxes.locations ]\n);\n\n/**\n * Returns true if a metabox location is active and visible\n *\n * @param {Object} state Post editor state.\n * @param {string} location Meta box location to test.\n *\n * @return {boolean} Whether the meta box location is active and visible.\n */\nexport function isMetaBoxLocationVisible( state, location ) {\n\treturn (\n\t\tisMetaBoxLocationActive( state, location ) &&\n\t\tsome( getMetaBoxesPerLocation( state, location ), ( { id } ) => {\n\t\t\treturn isEditorPanelEnabled( state, `meta-box-${ id }` );\n\t\t} )\n\t);\n}\n\n/**\n * Returns true if there is an active meta box in the given location, or false\n * otherwise.\n *\n * @param {Object} state Post editor state.\n * @param {string} location Meta box location to test.\n *\n * @return {boolean} Whether the meta box location is active.\n */\nexport function isMetaBoxLocationActive( state, location ) {\n\tconst metaBoxes = getMetaBoxesPerLocation( state, location );\n\treturn !! metaBoxes && metaBoxes.length !== 0;\n}\n\n/**\n * Returns the list of all the available meta boxes for a given location.\n *\n * @param {Object} state Global application state.\n * @param {string} location Meta box location to test.\n *\n * @return {?Array} List of meta boxes.\n */\nexport function getMetaBoxesPerLocation( state, location ) {\n\treturn state.metaBoxes.locations[ location ];\n}\n\n/**\n * Returns the list of all the available meta boxes.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} List of meta boxes.\n */\nexport const getAllMetaBoxes = createSelector(\n\t( state ) => {\n\t\treturn flatten( values( state.metaBoxes.locations ) );\n\t},\n\t( state ) => [ state.metaBoxes.locations ]\n);\n\n/**\n * Returns true if the post is using Meta Boxes\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether there are metaboxes or not.\n */\nexport function hasMetaBoxes( state ) {\n\treturn getActiveMetaBoxLocations( state ).length > 0;\n}\n\n/**\n * Returns true if the Meta Boxes are being saved.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the metaboxes are being saved.\n */\nexport function isSavingMetaBoxes( state ) {\n\treturn state.metaBoxes.isSaving;\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst {\n\t\trootClientId,\n\t\tinsertionIndex,\n\t\tfilterValue,\n\t} = state.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns true if the template editing mode is enabled.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether we're editing the template.\n */\nexport function isEditingTemplate( state ) {\n\treturn state.isEditingTemplate;\n}\n\n/**\n * Returns true if meta boxes are initialized.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether meta boxes are initialized.\n */\nexport function areMetaBoxesInitialized( state ) {\n\treturn state.metaBoxes.initialized;\n}\n\n/**\n * Retrieves the template of the currently edited post.\n *\n * @return {Object?} Post Template.\n */\nexport const getEditedPostTemplate = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst currentTemplate = select( editorStore ).getEditedPostAttribute(\n\t\t\t'template'\n\t\t);\n\t\tif ( currentTemplate ) {\n\t\t\tconst templateWithSameSlug = select( coreStore )\n\t\t\t\t.getEntityRecords( 'postType', 'wp_template', { per_page: -1 } )\n\t\t\t\t?.find( ( template ) => template.slug === currentTemplate );\n\t\t\tif ( ! templateWithSameSlug ) {\n\t\t\t\treturn templateWithSameSlug;\n\t\t\t}\n\t\t\treturn select( coreStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\ttemplateWithSameSlug.id\n\t\t\t);\n\t\t}\n\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tif ( post.link ) {\n\t\t\treturn select( coreStore ).__experimentalGetTemplateForLink(\n\t\t\t\tpost.link\n\t\t\t);\n\t\t}\n\n\t\treturn null;\n\t}\n);\n"]}
@@ -304,7 +304,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
304
304
  display: flex;
305
305
  flex-direction: column;
306
306
  overflow: auto;
307
- z-index: 91;
307
+ z-index: 20;
308
308
  }
309
309
 
310
310
  .interface-interface-skeleton__secondary-sidebar,
@@ -304,7 +304,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
304
304
  display: flex;
305
305
  flex-direction: column;
306
306
  overflow: auto;
307
- z-index: 91;
307
+ z-index: 20;
308
308
  }
309
309
 
310
310
  .interface-interface-skeleton__secondary-sidebar,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-post",
3
- "version": "6.1.0-next.e230fbab09.0",
3
+ "version": "6.2.0",
4
4
  "description": "Edit Post module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,30 +27,30 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/a11y": "^3.4.0-next.e230fbab09.0",
31
- "@wordpress/api-fetch": "^6.1.0-next.e230fbab09.0",
32
- "@wordpress/block-editor": "^8.3.0-next.e230fbab09.0",
33
- "@wordpress/block-library": "^7.1.0-next.e230fbab09.0",
34
- "@wordpress/blocks": "^11.3.0-next.e230fbab09.0",
35
- "@wordpress/components": "^19.7.0-next.e230fbab09.0",
36
- "@wordpress/compose": "^5.2.0-next.e230fbab09.0",
37
- "@wordpress/core-data": "^4.2.0-next.e230fbab09.0",
38
- "@wordpress/data": "^6.4.0-next.e230fbab09.0",
39
- "@wordpress/editor": "^12.4.0-next.e230fbab09.0",
40
- "@wordpress/element": "^4.3.0-next.e230fbab09.0",
41
- "@wordpress/hooks": "^3.4.0-next.e230fbab09.0",
42
- "@wordpress/i18n": "^4.4.0-next.e230fbab09.0",
43
- "@wordpress/icons": "^7.1.0-next.e230fbab09.0",
44
- "@wordpress/interface": "^4.3.0-next.e230fbab09.0",
45
- "@wordpress/keyboard-shortcuts": "^3.2.0-next.e230fbab09.0",
46
- "@wordpress/keycodes": "^3.4.0-next.e230fbab09.0",
47
- "@wordpress/media-utils": "^3.2.0-next.e230fbab09.0",
48
- "@wordpress/notices": "^3.4.0-next.e230fbab09.0",
49
- "@wordpress/plugins": "^4.2.0-next.e230fbab09.0",
50
- "@wordpress/preferences": "^1.0.0-prerelease",
51
- "@wordpress/url": "^3.5.0-next.e230fbab09.0",
52
- "@wordpress/viewport": "^4.2.0-next.e230fbab09.0",
53
- "@wordpress/warning": "^2.4.0-next.e230fbab09.0",
30
+ "@wordpress/a11y": "^3.5.0",
31
+ "@wordpress/api-fetch": "^6.2.0",
32
+ "@wordpress/block-editor": "^8.4.0",
33
+ "@wordpress/block-library": "^7.2.0",
34
+ "@wordpress/blocks": "^11.4.0",
35
+ "@wordpress/components": "^19.7.0",
36
+ "@wordpress/compose": "^5.3.0",
37
+ "@wordpress/core-data": "^4.3.0",
38
+ "@wordpress/data": "^6.5.0",
39
+ "@wordpress/editor": "^12.4.0",
40
+ "@wordpress/element": "^4.3.0",
41
+ "@wordpress/hooks": "^3.5.0",
42
+ "@wordpress/i18n": "^4.5.0",
43
+ "@wordpress/icons": "^8.1.0",
44
+ "@wordpress/interface": "^4.4.0",
45
+ "@wordpress/keyboard-shortcuts": "^3.3.0",
46
+ "@wordpress/keycodes": "^3.5.0",
47
+ "@wordpress/media-utils": "^3.3.0",
48
+ "@wordpress/notices": "^3.5.0",
49
+ "@wordpress/plugins": "^4.3.0",
50
+ "@wordpress/preferences": "^1.1.0",
51
+ "@wordpress/url": "^3.6.0",
52
+ "@wordpress/viewport": "^4.3.0",
53
+ "@wordpress/warning": "^2.5.0",
54
54
  "classnames": "^2.3.1",
55
55
  "lodash": "^4.17.21",
56
56
  "memize": "^1.1.0",
@@ -63,5 +63,5 @@
63
63
  "publishConfig": {
64
64
  "access": "public"
65
65
  },
66
- "gitHead": "308df03e6a96ded732f9c4e32471b1b4f8dea54a"
66
+ "gitHead": "aa003c3634016cc4ab6348b2106907e371c648e1"
67
67
  }
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import { ActionItem } from '@wordpress/interface';
5
5
  import { compose } from '@wordpress/compose';
6
+ import { MenuItem } from '@wordpress/components';
6
7
  import { withPluginContext } from '@wordpress/plugins';
7
8
 
8
9
  /**
@@ -64,6 +65,7 @@ import { withPluginContext } from '@wordpress/plugins';
64
65
  export default compose(
65
66
  withPluginContext( ( context, ownProps ) => {
66
67
  return {
68
+ as: ownProps.as ?? MenuItem,
67
69
  icon: ownProps.icon || context.icon,
68
70
  name: 'core/edit-post/plugin-more-menu',
69
71
  };
@@ -67,7 +67,9 @@ export default function DeleteTemplate() {
67
67
  ...settings,
68
68
  availableTemplates: newAvailableTemplates,
69
69
  } );
70
- deleteEntityRecord( 'postType', 'wp_template', template.id );
70
+ deleteEntityRecord( 'postType', 'wp_template', template.id, {
71
+ throwOnError: true,
72
+ } );
71
73
  };
72
74
 
73
75
  return (
package/src/editor.js CHANGED
@@ -43,7 +43,6 @@ function Editor( {
43
43
  preferredStyleVariations,
44
44
  hiddenBlockTypes,
45
45
  blockTypes,
46
- __experimentalLocalAutosaveInterval,
47
46
  keepCaretInsideBlock,
48
47
  isTemplateMode,
49
48
  template,
@@ -92,9 +91,6 @@ function Editor( {
92
91
  ),
93
92
  hiddenBlockTypes: getHiddenBlockTypes(),
94
93
  blockTypes: getBlockTypes(),
95
- __experimentalLocalAutosaveInterval: getPreference(
96
- 'localAutosaveInterval'
97
- ),
98
94
  keepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),
99
95
  isTemplateMode: isEditingTemplate(),
100
96
  template:
@@ -121,7 +117,6 @@ function Editor( {
121
117
  hasFixedToolbar,
122
118
  focusMode,
123
119
  hasReducedUI,
124
- __experimentalLocalAutosaveInterval,
125
120
 
126
121
  // This is marked as experimental to give time for the quick inserter to mature.
127
122
  __experimentalSetIsInserterOpened: setIsInserterOpened,
@@ -156,7 +151,6 @@ function Editor( {
156
151
  hiddenBlockTypes,
157
152
  blockTypes,
158
153
  preferredStyleVariations,
159
- __experimentalLocalAutosaveInterval,
160
154
  setIsInserterOpened,
161
155
  updatePreferredStyleVariations,
162
156
  keepCaretInsideBlock,
package/src/index.js CHANGED
@@ -107,9 +107,11 @@ export function initializeEditor(
107
107
  );
108
108
 
109
109
  dispatch( preferencesStore ).setDefaults( 'core/edit-post', {
110
+ editorMode: 'visual',
110
111
  fixedToolbar: false,
111
112
  fullscreenMode: true,
112
113
  hiddenBlockTypes: [],
114
+ preferredStyleVariations: {},
113
115
  showBlockBreadcrumbs: true,
114
116
  showIconLabels: false,
115
117
  themeStyles: true,
@@ -3,6 +3,8 @@
3
3
  */
4
4
  import '@wordpress/core-data';
5
5
  import '@wordpress/format-library';
6
+ import { dispatch } from '@wordpress/data';
7
+ import { store as preferencesStore } from '@wordpress/preferences';
6
8
 
7
9
  /**
8
10
  * Internal dependencies
@@ -19,5 +21,14 @@ import Editor from './editor';
19
21
  * @param {Object} postId ID of the post to edit (unused right now)
20
22
  */
21
23
  export function initializeEditor( id, postType, postId ) {
24
+ dispatch( preferencesStore ).setDefaults( 'core/edit-post', {
25
+ editorMode: 'visual',
26
+ fixedToolbar: false,
27
+ fullscreenMode: true,
28
+ hiddenBlockTypes: [],
29
+ preferredStyleVariations: {},
30
+ welcomeGuide: true,
31
+ } );
32
+
22
33
  return <Editor postId={ postId } postType={ postType } />;
23
34
  }
@@ -155,11 +155,10 @@ export const toggleFeature = ( feature ) => ( { registry } ) =>
155
155
  *
156
156
  * @param {string} mode The editor mode.
157
157
  */
158
- export const switchEditorMode = ( mode ) => ( { dispatch, registry } ) => {
159
- dispatch( {
160
- type: 'SWITCH_MODE',
161
- mode,
162
- } );
158
+ export const switchEditorMode = ( mode ) => ( { registry } ) => {
159
+ registry
160
+ .dispatch( preferencesStore )
161
+ .set( 'core/edit-post', 'editorMode', mode );
163
162
 
164
163
  // Unselect blocks when we switch to the code editor.
165
164
  if ( mode !== 'visual' ) {
@@ -193,30 +192,44 @@ export const togglePinnedPluginItem = ( pluginName ) => ( { registry } ) => {
193
192
  *
194
193
  * @param {string} blockName Name of the block.
195
194
  * @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the "auto apply" setting of the block is removed.
196
- *
197
- * @return {Object} Action object.
198
195
  */
199
- export function updatePreferredStyleVariations( blockName, blockStyle ) {
200
- return {
201
- type: 'UPDATE_PREFERRED_STYLE_VARIATIONS',
202
- blockName,
203
- blockStyle,
204
- };
205
- }
196
+ export const updatePreferredStyleVariations = ( blockName, blockStyle ) => ( {
197
+ registry,
198
+ } ) => {
199
+ if ( ! blockName ) {
200
+ return;
201
+ }
206
202
 
207
- /**
208
- * Returns an action object used in signalling that the editor should attempt
209
- * to locally autosave the current post every `interval` seconds.
210
- *
211
- * @param {number} interval The new interval, in seconds.
212
- * @return {Object} Action object.
213
- */
214
- export function __experimentalUpdateLocalAutosaveInterval( interval ) {
215
- return {
216
- type: 'UPDATE_LOCAL_AUTOSAVE_INTERVAL',
217
- interval,
218
- };
219
- }
203
+ const existingVariations =
204
+ registry
205
+ .select( preferencesStore )
206
+ .get( 'core/edit-post', 'preferredStyleVariations' ) ?? {};
207
+
208
+ // When the blockStyle is omitted, remove the block's preferred variation.
209
+ if ( ! blockStyle ) {
210
+ const updatedVariations = {
211
+ ...existingVariations,
212
+ };
213
+
214
+ delete updatedVariations[ blockName ];
215
+
216
+ registry
217
+ .dispatch( preferencesStore )
218
+ .set(
219
+ 'core/edit-post',
220
+ 'preferredStyleVariations',
221
+ updatedVariations
222
+ );
223
+ } else {
224
+ // Else add the variation.
225
+ registry
226
+ .dispatch( preferencesStore )
227
+ .set( 'core/edit-post', 'preferredStyleVariations', {
228
+ ...existingVariations,
229
+ [ blockName ]: blockStyle,
230
+ } );
231
+ }
232
+ };
220
233
 
221
234
  /**
222
235
  * Update the provided block types to be visible.
@@ -1,11 +1,7 @@
1
1
  export const PREFERENCES_DEFAULTS = {
2
- editorMode: 'visual',
3
2
  panels: {
4
3
  'post-status': {
5
4
  opened: true,
6
5
  },
7
6
  },
8
- hiddenBlockTypes: [],
9
- preferredStyleVariations: {},
10
- localAutosaveInterval: 15,
11
7
  };
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { flow, get, includes, omit } from 'lodash';
4
+ import { flow, get, includes } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -76,38 +76,6 @@ export const preferences = flow( [
76
76
  }
77
77
  }
78
78
 
79
- return state;
80
- },
81
- editorMode( state, action ) {
82
- if ( action.type === 'SWITCH_MODE' ) {
83
- return action.mode;
84
- }
85
-
86
- return state;
87
- },
88
- preferredStyleVariations( state, action ) {
89
- switch ( action.type ) {
90
- case 'UPDATE_PREFERRED_STYLE_VARIATIONS': {
91
- if ( ! action.blockName ) {
92
- return state;
93
- }
94
- if ( ! action.blockStyle ) {
95
- return omit( state, [ action.blockName ] );
96
- }
97
- return {
98
- ...state,
99
- [ action.blockName ]: action.blockStyle,
100
- };
101
- }
102
- }
103
- return state;
104
- },
105
- localAutosaveInterval( state, action ) {
106
- switch ( action.type ) {
107
- case 'UPDATE_LOCAL_AUTOSAVE_INTERVAL':
108
- return action.interval;
109
- }
110
-
111
79
  return state;
112
80
  },
113
81
  } );
@@ -22,9 +22,9 @@ const EMPTY_ARRAY = [];
22
22
  *
23
23
  * @return {string} Editing mode.
24
24
  */
25
- export function getEditorMode( state ) {
26
- return getPreference( state, 'editorMode', 'visual' );
27
- }
25
+ export const getEditorMode = createRegistrySelector( ( select ) => () =>
26
+ select( preferencesStore ).get( 'core/edit-post', 'editorMode' ) ?? 'visual'
27
+ );
28
28
 
29
29
  /**
30
30
  * Returns true if the editor sidebar is opened.
@@ -91,7 +91,11 @@ export const getActiveGeneralSidebarName = createRegistrySelector(
91
91
 
92
92
  // The current list of preference keys that have been migrated to the
93
93
  // preferences package.
94
- const MIGRATED_KEYS = [ 'hiddenBlockTypes' ];
94
+ const MIGRATED_KEYS = [
95
+ 'hiddenBlockTypes',
96
+ 'editorMode',
97
+ 'preferredStyleVariations',
98
+ ];
95
99
 
96
100
  /**
97
101
  * Returns the preferences (these preferences are persisted locally).