@wordpress/edit-post 6.0.2 → 6.0.3-next.a55ed9455a.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 (145) hide show
  1. package/build/components/block-manager/category.js +2 -2
  2. package/build/components/block-manager/category.js.map +1 -1
  3. package/build/components/block-manager/index.js +2 -2
  4. package/build/components/block-manager/index.js.map +1 -1
  5. package/build/components/header/header-toolbar/index.js +1 -1
  6. package/build/components/header/header-toolbar/index.js.map +1 -1
  7. package/build/components/header/header-toolbar/index.native.js +1 -1
  8. package/build/components/header/header-toolbar/index.native.js.map +1 -1
  9. package/build/components/header/more-menu/index.js +0 -6
  10. package/build/components/header/more-menu/index.js.map +1 -1
  11. package/build/components/header/writing-menu/index.js +7 -7
  12. package/build/components/header/writing-menu/index.js.map +1 -1
  13. package/build/components/keyboard-shortcut-help-modal/config.js +5 -0
  14. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  15. package/build/components/layout/index.js.map +1 -1
  16. package/build/components/layout/index.native.js +1 -1
  17. package/build/components/layout/index.native.js.map +1 -1
  18. package/build/components/preferences-modal/index.js +14 -99
  19. package/build/components/preferences-modal/index.js.map +1 -1
  20. package/build/components/preferences-modal/meta-boxes-section.js +2 -4
  21. package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
  22. package/build/components/preferences-modal/options/enable-custom-fields.js +2 -8
  23. package/build/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
  24. package/build/components/preferences-modal/options/enable-feature.js +2 -4
  25. package/build/components/preferences-modal/options/enable-feature.js.map +1 -1
  26. package/build/components/preferences-modal/options/enable-panel.js +2 -4
  27. package/build/components/preferences-modal/options/enable-panel.js.map +1 -1
  28. package/build/components/preferences-modal/options/enable-publish-sidebar.js +2 -8
  29. package/build/components/preferences-modal/options/enable-publish-sidebar.js.map +1 -1
  30. package/build/components/sidebar/post-link/index.js +1 -1
  31. package/build/components/sidebar/post-link/index.js.map +1 -1
  32. package/build/editor.js +4 -3
  33. package/build/editor.js.map +1 -1
  34. package/build/editor.native.js +8 -8
  35. package/build/editor.native.js.map +1 -1
  36. package/build/hooks/validate-multiple-use/index.js +1 -1
  37. package/build/hooks/validate-multiple-use/index.js.map +1 -1
  38. package/build/index.js +5 -4
  39. package/build/index.js.map +1 -1
  40. package/build/plugins/welcome-guide-menu-item/index.js +3 -3
  41. package/build/plugins/welcome-guide-menu-item/index.js.map +1 -1
  42. package/build/store/actions.js +62 -50
  43. package/build/store/actions.js.map +1 -1
  44. package/build/store/reducer.js +0 -12
  45. package/build/store/reducer.js.map +1 -1
  46. package/build/store/selectors.js +44 -10
  47. package/build/store/selectors.js.map +1 -1
  48. package/build-module/components/block-manager/category.js +2 -2
  49. package/build-module/components/block-manager/category.js.map +1 -1
  50. package/build-module/components/block-manager/index.js +2 -2
  51. package/build-module/components/block-manager/index.js.map +1 -1
  52. package/build-module/components/header/header-toolbar/index.js +1 -1
  53. package/build-module/components/header/header-toolbar/index.js.map +1 -1
  54. package/build-module/components/header/header-toolbar/index.native.js +1 -1
  55. package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
  56. package/build-module/components/header/more-menu/index.js +0 -5
  57. package/build-module/components/header/more-menu/index.js.map +1 -1
  58. package/build-module/components/header/writing-menu/index.js +7 -7
  59. package/build-module/components/header/writing-menu/index.js.map +1 -1
  60. package/build-module/components/keyboard-shortcut-help-modal/config.js +5 -0
  61. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  62. package/build-module/components/layout/index.js +2 -2
  63. package/build-module/components/layout/index.js.map +1 -1
  64. package/build-module/components/layout/index.native.js +1 -1
  65. package/build-module/components/layout/index.native.js.map +1 -1
  66. package/build-module/components/preferences-modal/index.js +15 -98
  67. package/build-module/components/preferences-modal/index.js.map +1 -1
  68. package/build-module/components/preferences-modal/meta-boxes-section.js +2 -2
  69. package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
  70. package/build-module/components/preferences-modal/options/enable-custom-fields.js +1 -5
  71. package/build-module/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
  72. package/build-module/components/preferences-modal/options/enable-feature.js +1 -1
  73. package/build-module/components/preferences-modal/options/enable-feature.js.map +1 -1
  74. package/build-module/components/preferences-modal/options/enable-panel.js +1 -1
  75. package/build-module/components/preferences-modal/options/enable-panel.js.map +1 -1
  76. package/build-module/components/preferences-modal/options/enable-publish-sidebar.js +1 -5
  77. package/build-module/components/preferences-modal/options/enable-publish-sidebar.js.map +1 -1
  78. package/build-module/components/sidebar/post-link/index.js +2 -2
  79. package/build-module/components/sidebar/post-link/index.js.map +1 -1
  80. package/build-module/editor.js +5 -4
  81. package/build-module/editor.js.map +1 -1
  82. package/build-module/editor.native.js +8 -8
  83. package/build-module/editor.native.js.map +1 -1
  84. package/build-module/hooks/validate-multiple-use/index.js +1 -1
  85. package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
  86. package/build-module/index.js +5 -4
  87. package/build-module/index.js.map +1 -1
  88. package/build-module/plugins/welcome-guide-menu-item/index.js +3 -3
  89. package/build-module/plugins/welcome-guide-menu-item/index.js.map +1 -1
  90. package/build-module/store/actions.js +52 -43
  91. package/build-module/store/actions.js.map +1 -1
  92. package/build-module/store/reducer.js +1 -13
  93. package/build-module/store/reducer.js.map +1 -1
  94. package/build-module/store/selectors.js +36 -6
  95. package/build-module/store/selectors.js.map +1 -1
  96. package/build-style/style-rtl.css +90 -129
  97. package/build-style/style.css +90 -129
  98. package/package.json +30 -25
  99. package/src/components/block-manager/category.js +2 -2
  100. package/src/components/block-manager/index.js +2 -2
  101. package/src/components/header/fullscreen-mode-close/test/index.js +1 -1
  102. package/src/components/header/header-toolbar/index.js +1 -1
  103. package/src/components/header/header-toolbar/index.native.js +1 -1
  104. package/src/components/header/more-menu/index.js +0 -6
  105. package/src/components/header/style.scss +1 -1
  106. package/src/components/header/writing-menu/index.js +7 -7
  107. package/src/components/keyboard-shortcut-help-modal/config.js +4 -0
  108. package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +6 -0
  109. package/src/components/layout/index.js +2 -2
  110. package/src/components/layout/index.native.js +1 -1
  111. package/src/components/preferences-modal/index.js +24 -150
  112. package/src/components/preferences-modal/meta-boxes-section.js +3 -3
  113. package/src/components/preferences-modal/options/enable-custom-fields.js +1 -5
  114. package/src/components/preferences-modal/options/enable-feature.js +1 -1
  115. package/src/components/preferences-modal/options/enable-panel.js +1 -1
  116. package/src/components/preferences-modal/options/enable-publish-sidebar.js +1 -5
  117. package/src/components/preferences-modal/options/test/__snapshots__/enable-custom-fields.js.snap +4 -4
  118. package/src/components/preferences-modal/options/test/enable-custom-fields.js +1 -1
  119. package/src/components/preferences-modal/test/__snapshots__/index.js.snap +235 -357
  120. package/src/components/preferences-modal/test/index.js +6 -6
  121. package/src/components/sidebar/post-link/index.js +2 -2
  122. package/src/editor.js +4 -3
  123. package/src/editor.native.js +7 -7
  124. package/src/hooks/validate-multiple-use/index.js +1 -1
  125. package/src/index.js +5 -4
  126. package/src/plugins/welcome-guide-menu-item/index.js +3 -3
  127. package/src/store/actions.js +49 -33
  128. package/src/store/reducer.js +1 -12
  129. package/src/store/selectors.js +56 -8
  130. package/src/store/test/actions.js +167 -4
  131. package/src/store/test/reducer.js +0 -28
  132. package/src/style.scss +0 -2
  133. package/src/test/editor.native.js +2 -2
  134. package/build/components/preferences-modal/options/base.js +0 -35
  135. package/build/components/preferences-modal/options/base.js.map +0 -1
  136. package/build/components/preferences-modal/section.js +0 -27
  137. package/build/components/preferences-modal/section.js.map +0 -1
  138. package/build-module/components/preferences-modal/options/base.js +0 -27
  139. package/build-module/components/preferences-modal/options/base.js.map +0 -1
  140. package/build-module/components/preferences-modal/section.js +0 -19
  141. package/build-module/components/preferences-modal/section.js.map +0 -1
  142. package/src/components/header/more-menu/style.scss +0 -35
  143. package/src/components/preferences-modal/options/base.js +0 -20
  144. package/src/components/preferences-modal/section.js +0 -15
  145. package/src/components/preferences-modal/style.scss +0 -112
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/store/actions.js"],"names":["openGeneralSidebar","name","registry","dispatch","interfaceStore","enableComplementaryArea","editPostStore","closeGeneralSidebar","disableComplementaryArea","openModal","type","closeModal","openPublishSidebar","closePublishSidebar","togglePublishSidebar","toggleEditorPanelEnabled","panelName","toggleEditorPanelOpened","removeEditorPanel","toggleFeature","feature","switchEditorMode","mode","blockEditorStore","clearSelectedBlock","message","togglePinnedPluginItem","pluginName","isPinned","select","isItemPinned","hideBlockTypes","blockNames","updatePreferredStyleVariations","blockName","blockStyle","__experimentalUpdateLocalAutosaveInterval","interval","showBlockTypes","setAvailableMetaBoxesPerLocation","metaBoxesPerLocation","requestMetaBoxUpdates","window","tinyMCE","triggerSave","post","editorStore","getCurrentPost","additionalData","comment_status","ping_status","sticky","author","filter","Boolean","baseFormData","FormData","document","querySelector","activeMetaBoxLocations","getActiveMetaBoxLocations","formDataToMerge","map","location","formData","memo","currentFormData","key","value","append","forEach","url","_wpMetaBoxUrl","method","body","parse","metaBoxUpdatesSuccess","metaBoxUpdatesFailure","__experimentalSetPreviewDeviceType","deviceType","setIsInserterOpened","setIsListViewOpened","isOpen","setIsEditingTemplate","__unstableSwitchToTemplateMode","newTemplate","isWelcomeGuideActive","isFeatureActive","noticesStore","createSuccessNotice","__unstableCreateTemplate","template","savedTemplate","coreStore","saveEntityRecord","editEntityRecord","id","slug","metaBoxesInitialized","initializeMetaBoxes","isEditorReady","__unstableIsEditorReady","postType","getCurrentPostType","postboxes","page","add_postbox_toggles","wasSavingPost","isSavingPost","wasAutosavingPost","isAutosavingPost","hasMetaBoxes","subscribe","shouldTriggerMetaboxesSave"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,MAAMA,kB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G,0BAA0B,GAC/BF,YAAY,IACZJ,aADA,IAEA,CAAEC,YAFF,IAGA,CAAEC,iBAJH,CAZ+B,CAkB/B;;AACAF,IAAAA,aAAa,GAAGC,YAAhB;AACAC,IAAAA,iBAAiB,GAAGC,gBAApB;;AAEA,QAAKG,0BAAL,EAAkC;AACjC,YAAM9G,QAAQ,CAACsC,qBAAT,EAAN;AACA;AACD,GAzBD;AA2BAtC,EAAAA,QAAQ,CAAE;AACTO,IAAAA,IAAI,EAAE;AADG,GAAF,CAAR;AAGA,CAtDM","sourcesContent":["/**\n * External dependencies\n */\nimport { castArray, reduce } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport apiFetch from '@wordpress/api-fetch';\nimport { speak } from '@wordpress/a11y';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { getMetaBoxContainer } from '../utils/meta-boxes';\nimport { store as editPostStore } from '.';\n\n/**\n * Returns an action object used in signalling that the user opened an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar = ( name ) => ( { registry } ) =>\n\tregistry\n\t\t.dispatch( interfaceStore )\n\t\t.enableComplementaryArea( editPostStore.name, name );\n\n/**\n * Returns an action object signalling that the user closed the sidebar.\n */\nexport const closeGeneralSidebar = () => ( { registry } ) =>\n\tregistry\n\t\t.dispatch( interfaceStore )\n\t\t.disableComplementaryArea( editPostStore.name );\n\n/**\n * Returns an action object used in signalling that the user opened a modal.\n *\n * @param {string} name A string that uniquely identifies the modal.\n *\n * @return {Object} Action object.\n */\nexport function openModal( name ) {\n\treturn {\n\t\ttype: 'OPEN_MODAL',\n\t\tname,\n\t};\n}\n\n/**\n * Returns an action object signalling that the user closed a modal.\n *\n * @return {Object} Action object.\n */\nexport function closeModal() {\n\treturn {\n\t\ttype: 'CLOSE_MODAL',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user opened the publish\n * sidebar.\n *\n * @return {Object} Action object\n */\nexport function openPublishSidebar() {\n\treturn {\n\t\ttype: 'OPEN_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user closed the\n * publish sidebar.\n *\n * @return {Object} Action object.\n */\nexport function closePublishSidebar() {\n\treturn {\n\t\ttype: 'CLOSE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user toggles the publish sidebar.\n *\n * @return {Object} Action object\n */\nexport function togglePublishSidebar() {\n\treturn {\n\t\ttype: 'TOGGLE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used to enable or disable a panel in the editor.\n *\n * @param {string} panelName A string that identifies the panel to enable or disable.\n *\n * @return {Object} Action object.\n */\nexport function toggleEditorPanelEnabled( panelName ) {\n\treturn {\n\t\ttype: 'TOGGLE_PANEL_ENABLED',\n\t\tpanelName,\n\t};\n}\n\n/**\n * Returns an action object used to open or close a panel in the editor.\n *\n * @param {string} panelName A string that identifies the panel to open or close.\n *\n * @return {Object} Action object.\n */\nexport function toggleEditorPanelOpened( panelName ) {\n\treturn {\n\t\ttype: 'TOGGLE_PANEL_OPENED',\n\t\tpanelName,\n\t};\n}\n\n/**\n * Returns an action object used to remove a panel from the editor.\n *\n * @param {string} panelName A string that identifies the panel to remove.\n *\n * @return {Object} Action object.\n */\nexport function removeEditorPanel( panelName ) {\n\treturn {\n\t\ttype: 'REMOVE_PANEL',\n\t\tpanelName,\n\t};\n}\n\n/**\n * Triggers an action used to toggle a feature flag.\n *\n * @param {string} feature Feature name.\n */\nexport const toggleFeature = ( feature ) => ( { registry } ) =>\n\tregistry\n\t\t.dispatch( interfaceStore )\n\t\t.toggleFeature( 'core/edit-post', feature );\n\nexport const switchEditorMode = ( mode ) => ( { dispatch, registry } ) => {\n\tdispatch( {\n\t\ttype: 'SWITCH_MODE',\n\t\tmode,\n\t} );\n\n\t// Unselect blocks when we switch to the code editor.\n\tif ( mode !== 'visual' ) {\n\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t}\n\n\tconst message =\n\t\tmode === 'visual'\n\t\t\t? __( 'Visual editor selected' )\n\t\t\t: __( 'Code editor selected' );\n\tspeak( message, 'assertive' );\n};\n\n/**\n * Triggers an action object used to toggle a plugin name flag.\n *\n * @param {string} pluginName Plugin name.\n */\nexport const togglePinnedPluginItem = ( pluginName ) => ( { registry } ) => {\n\tconst isPinned = registry\n\t\t.select( interfaceStore )\n\t\t.isItemPinned( 'core/edit-post', pluginName );\n\n\tregistry\n\t\t.dispatch( interfaceStore )\n\t\t[ isPinned ? 'unpinItem' : 'pinItem' ]( 'core/edit-post', pluginName );\n};\n\n/**\n * Returns an action object used in signalling that block types by the given\n * name(s) should be hidden.\n *\n * @param {string[]} blockNames Names of block types to hide.\n *\n * @return {Object} Action object.\n */\nexport function hideBlockTypes( blockNames ) {\n\treturn {\n\t\ttype: 'HIDE_BLOCK_TYPES',\n\t\tblockNames: castArray( blockNames ),\n\t};\n}\n\n/**\n * Returns an action object used in signaling that a style should be auto-applied when a block is created.\n *\n * @param {string} blockName Name of the block.\n * @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the \"auto apply\" setting of the block is removed.\n *\n * @return {Object} Action object.\n */\nexport function updatePreferredStyleVariations( blockName, blockStyle ) {\n\treturn {\n\t\ttype: 'UPDATE_PREFERRED_STYLE_VARIATIONS',\n\t\tblockName,\n\t\tblockStyle,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the editor should attempt\n * to locally autosave the current post every `interval` seconds.\n *\n * @param {number} interval The new interval, in seconds.\n * @return {Object} Action object.\n */\nexport function __experimentalUpdateLocalAutosaveInterval( interval ) {\n\treturn {\n\t\ttype: 'UPDATE_LOCAL_AUTOSAVE_INTERVAL',\n\t\tinterval,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that block types by the given\n * name(s) should be shown.\n *\n * @param {string[]} blockNames Names of block types to show.\n *\n * @return {Object} Action object.\n */\nexport function showBlockTypes( blockNames ) {\n\treturn {\n\t\ttype: 'SHOW_BLOCK_TYPES',\n\t\tblockNames: castArray( blockNames ),\n\t};\n}\n\n/**\n * Returns an action object used in signaling\n * what Meta boxes are available in which location.\n *\n * @param {Object} metaBoxesPerLocation Meta boxes per location.\n */\nexport const setAvailableMetaBoxesPerLocation = ( metaBoxesPerLocation ) => ( {\n\tdispatch,\n} ) =>\n\tdispatch( {\n\t\ttype: 'SET_META_BOXES_PER_LOCATIONS',\n\t\tmetaBoxesPerLocation,\n\t} );\n\n/**\n * Update a metabox.\n */\nexport const requestMetaBoxUpdates = () => async ( {\n\tregistry,\n\tselect,\n\tdispatch,\n} ) => {\n\tdispatch( {\n\t\ttype: 'REQUEST_META_BOX_UPDATES',\n\t} );\n\n\t// Saves the wp_editor fields\n\tif ( window.tinyMCE ) {\n\t\twindow.tinyMCE.triggerSave();\n\t}\n\n\t// Additional data needed for backward compatibility.\n\t// If we do not provide this data, the post will be overridden with the default values.\n\tconst post = registry.select( editorStore ).getCurrentPost();\n\tconst additionalData = [\n\t\tpost.comment_status ? [ 'comment_status', post.comment_status ] : false,\n\t\tpost.ping_status ? [ 'ping_status', post.ping_status ] : false,\n\t\tpost.sticky ? [ 'sticky', post.sticky ] : false,\n\t\tpost.author ? [ 'post_author', post.author ] : false,\n\t].filter( Boolean );\n\n\t// We gather all the metaboxes locations data and the base form data\n\tconst baseFormData = new window.FormData(\n\t\tdocument.querySelector( '.metabox-base-form' )\n\t);\n\tconst activeMetaBoxLocations = select.getActiveMetaBoxLocations();\n\tconst formDataToMerge = [\n\t\tbaseFormData,\n\t\t...activeMetaBoxLocations.map(\n\t\t\t( location ) =>\n\t\t\t\tnew window.FormData( getMetaBoxContainer( location ) )\n\t\t),\n\t];\n\n\t// Merge all form data objects into a single one.\n\tconst formData = reduce(\n\t\tformDataToMerge,\n\t\t( memo, currentFormData ) => {\n\t\t\tfor ( const [ key, value ] of currentFormData ) {\n\t\t\t\tmemo.append( key, value );\n\t\t\t}\n\t\t\treturn memo;\n\t\t},\n\t\tnew window.FormData()\n\t);\n\tadditionalData.forEach( ( [ key, value ] ) =>\n\t\tformData.append( key, value )\n\t);\n\n\ttry {\n\t\t// Save the metaboxes\n\t\tawait apiFetch( {\n\t\t\turl: window._wpMetaBoxUrl,\n\t\t\tmethod: 'POST',\n\t\t\tbody: formData,\n\t\t\tparse: false,\n\t\t} );\n\t\tdispatch.metaBoxUpdatesSuccess();\n\t} catch {\n\t\tdispatch.metaBoxUpdatesFailure();\n\t}\n};\n\n/**\n * Returns an action object used to signal a successful meta box update.\n *\n * @return {Object} Action object.\n */\nexport function metaBoxUpdatesSuccess() {\n\treturn {\n\t\ttype: 'META_BOX_UPDATES_SUCCESS',\n\t};\n}\n\n/**\n * Returns an action object used to signal a failed meta box update.\n *\n * @return {Object} Action object.\n */\nexport function metaBoxUpdatesFailure() {\n\treturn {\n\t\ttype: 'META_BOX_UPDATES_FAILURE',\n\t};\n}\n\n/**\n * Returns an action object used to toggle the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Returns an action object used to open/close the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to open/close the list view.\n *\n * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.\n * @return {Object} Action object.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Returns an action object used to switch to template editing.\n *\n * @param {boolean} value Is editing template.\n * @return {Object} Action object.\n */\nexport function setIsEditingTemplate( value ) {\n\treturn {\n\t\ttype: 'SET_IS_EDITING_TEMPLATE',\n\t\tvalue,\n\t};\n}\n\n/**\n * Switches to the template mode.\n *\n * @param {boolean} newTemplate Is new template.\n */\nexport const __unstableSwitchToTemplateMode = ( newTemplate = false ) => ( {\n\tregistry,\n\tselect,\n\tdispatch,\n} ) => {\n\tdispatch( setIsEditingTemplate( true ) );\n\tconst isWelcomeGuideActive = select.isFeatureActive(\n\t\t'welcomeGuideTemplate'\n\t);\n\tif ( ! isWelcomeGuideActive ) {\n\t\tconst message = newTemplate\n\t\t\t? __( \"Custom template created. You're in template mode now.\" )\n\t\t\t: __(\n\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t );\n\t\tregistry.dispatch( noticesStore ).createSuccessNotice( message, {\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t}\n};\n\n/**\n * Create a block based template.\n *\n * @param {Object?} template Template to create and assign.\n */\nexport const __unstableCreateTemplate = ( template ) => async ( {\n\tregistry,\n} ) => {\n\tconst savedTemplate = await registry\n\t\t.dispatch( coreStore )\n\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\tconst post = registry.select( editorStore ).getCurrentPost();\n\tregistry\n\t\t.dispatch( coreStore )\n\t\t.editEntityRecord( 'postType', post.type, post.id, {\n\t\t\ttemplate: savedTemplate.slug,\n\t\t} );\n};\n\nlet metaBoxesInitialized = false;\n\n/**\n * Initializes WordPress `postboxes` script and the logic for saving meta boxes.\n */\nexport const initializeMetaBoxes = () => ( { registry, select, dispatch } ) => {\n\tconst isEditorReady = registry\n\t\t.select( editorStore )\n\t\t.__unstableIsEditorReady();\n\n\tif ( ! isEditorReady ) {\n\t\treturn;\n\t}\n\t// Only initialize once.\n\tif ( metaBoxesInitialized ) {\n\t\treturn;\n\t}\n\tconst postType = registry.select( editorStore ).getCurrentPostType();\n\tif ( window.postboxes.page !== postType ) {\n\t\twindow.postboxes.add_postbox_toggles( postType );\n\t}\n\n\tmetaBoxesInitialized = true;\n\n\tlet wasSavingPost = registry.select( editorStore ).isSavingPost();\n\tlet wasAutosavingPost = registry.select( editorStore ).isAutosavingPost();\n\tconst hasMetaBoxes = select.hasMetaBoxes();\n\n\t// Save metaboxes when performing a full save on the post.\n\tregistry.subscribe( async () => {\n\t\tconst isSavingPost = registry.select( editorStore ).isSavingPost();\n\t\tconst isAutosavingPost = registry\n\t\t\t.select( editorStore )\n\t\t\t.isAutosavingPost();\n\n\t\t// Save metaboxes on save completion, except for autosaves that are not a post preview.\n\t\t//\n\t\t// Meta boxes are initialized once at page load. It is not necessary to\n\t\t// account for updates on each state change.\n\t\t//\n\t\t// See: https://github.com/WordPress/WordPress/blob/5.1.1/wp-admin/includes/post.php#L2307-L2309\n\t\tconst shouldTriggerMetaboxesSave =\n\t\t\thasMetaBoxes &&\n\t\t\twasSavingPost &&\n\t\t\t! isSavingPost &&\n\t\t\t! wasAutosavingPost;\n\n\t\t// Save current state for next inspection.\n\t\twasSavingPost = isSavingPost;\n\t\twasAutosavingPost = isAutosavingPost;\n\n\t\tif ( shouldTriggerMetaboxesSave ) {\n\t\t\tawait dispatch.requestMetaBoxUpdates();\n\t\t}\n\t} );\n\n\tdispatch( {\n\t\ttype: 'META_BOXES_INITIALIZED',\n\t} );\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/store/actions.js"],"names":["openGeneralSidebar","name","registry","dispatch","interfaceStore","enableComplementaryArea","editPostStore","closeGeneralSidebar","disableComplementaryArea","openModal","type","closeModal","openPublishSidebar","closePublishSidebar","togglePublishSidebar","toggleEditorPanelEnabled","panelName","toggleEditorPanelOpened","removeEditorPanel","toggleFeature","feature","preferencesStore","toggle","switchEditorMode","mode","blockEditorStore","clearSelectedBlock","message","togglePinnedPluginItem","pluginName","isPinned","select","isItemPinned","updatePreferredStyleVariations","blockName","blockStyle","__experimentalUpdateLocalAutosaveInterval","interval","showBlockTypes","blockNames","existingBlockNames","get","newBlockNames","set","hideBlockTypes","mergedBlockNames","Set","setAvailableMetaBoxesPerLocation","metaBoxesPerLocation","requestMetaBoxUpdates","window","tinyMCE","triggerSave","post","editorStore","getCurrentPost","additionalData","comment_status","ping_status","sticky","author","filter","Boolean","baseFormData","FormData","document","querySelector","activeMetaBoxLocations","getActiveMetaBoxLocations","formDataToMerge","map","location","formData","memo","currentFormData","key","value","append","forEach","url","_wpMetaBoxUrl","method","body","parse","metaBoxUpdatesSuccess","metaBoxUpdatesFailure","__experimentalSetPreviewDeviceType","deviceType","setIsInserterOpened","setIsListViewOpened","isOpen","setIsEditingTemplate","__unstableSwitchToTemplateMode","newTemplate","isWelcomeGuideActive","isFeatureActive","noticesStore","createSuccessNotice","__unstableCreateTemplate","template","savedTemplate","coreStore","saveEntityRecord","editEntityRecord","id","slug","metaBoxesInitialized","initializeMetaBoxes","isEditorReady","__unstableIsEditorReady","postType","getCurrentPostType","postboxes","page","add_postbox_toggles","wasSavingPost","isSavingPost","wasAutosavingPost","isAutosavingPost","hasMetaBoxes","subscribe","shouldTriggerMetaboxesSave"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,MAAMA,kBAAkB,GAAKC,IAAF,IAAY;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA,SAC7CA,QAAQ,CACNC,QADF,CACYC,gBADZ,EAEEC,uBAFF,CAE2BC,QAAcL,IAFzC,EAE+CA,IAF/C,CAD6C;AAAA,CAAvC;AAKP;AACA;AACA;;;;;AACO,MAAMM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Q,CAAC6B,MAAT,CAAiBuB,aAAjB,EAA+BgE,gBAA/B,EAAxB;AACA,QAAMC,YAAY,GAAGxF,MAAM,CAACwF,YAAP,EAArB,CArB8E,CAuB9E;;AACArH,EAAAA,QAAQ,CAACsH,SAAT,CAAoB,YAAY;AAC/B,UAAMJ,YAAY,GAAGlH,QAAQ,CAAC6B,MAAT,CAAiBuB,aAAjB,EAA+B8D,YAA/B,EAArB;AACA,UAAME,gBAAgB,GAAGpH,QAAQ,CAC/B6B,MADuB,CACfuB,aADe,EAEvBgE,gBAFuB,EAAzB,CAF+B,CAM/B;AACA;AACA;AACA;AACA;AACA;;AACA,UAAMG,0BAA0B,GAC/BF,YAAY,IACZJ,aADA,IAEA,CAAEC,YAFF,IAGA,CAAEC,iBAJH,CAZ+B,CAkB/B;;AACAF,IAAAA,aAAa,GAAGC,YAAhB;AACAC,IAAAA,iBAAiB,GAAGC,gBAApB;;AAEA,QAAKG,0BAAL,EAAkC;AACjC,YAAMtH,QAAQ,CAAC8C,qBAAT,EAAN;AACA;AACD,GAzBD;AA2BA9C,EAAAA,QAAQ,CAAE;AACTO,IAAAA,IAAI,EAAE;AADG,GAAF,CAAR;AAGA,CAtDM","sourcesContent":["/**\n * External dependencies\n */\nimport { castArray, reduce, without } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport apiFetch from '@wordpress/api-fetch';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { speak } from '@wordpress/a11y';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { getMetaBoxContainer } from '../utils/meta-boxes';\nimport { store as editPostStore } from '.';\n\n/**\n * Returns an action object used in signalling that the user opened an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar = ( name ) => ( { registry } ) =>\n\tregistry\n\t\t.dispatch( interfaceStore )\n\t\t.enableComplementaryArea( editPostStore.name, name );\n\n/**\n * Returns an action object signalling that the user closed the sidebar.\n */\nexport const closeGeneralSidebar = () => ( { registry } ) =>\n\tregistry\n\t\t.dispatch( interfaceStore )\n\t\t.disableComplementaryArea( editPostStore.name );\n\n/**\n * Returns an action object used in signalling that the user opened a modal.\n *\n * @param {string} name A string that uniquely identifies the modal.\n *\n * @return {Object} Action object.\n */\nexport function openModal( name ) {\n\treturn {\n\t\ttype: 'OPEN_MODAL',\n\t\tname,\n\t};\n}\n\n/**\n * Returns an action object signalling that the user closed a modal.\n *\n * @return {Object} Action object.\n */\nexport function closeModal() {\n\treturn {\n\t\ttype: 'CLOSE_MODAL',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user opened the publish\n * sidebar.\n *\n * @return {Object} Action object\n */\nexport function openPublishSidebar() {\n\treturn {\n\t\ttype: 'OPEN_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user closed the\n * publish sidebar.\n *\n * @return {Object} Action object.\n */\nexport function closePublishSidebar() {\n\treturn {\n\t\ttype: 'CLOSE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user toggles the publish sidebar.\n *\n * @return {Object} Action object\n */\nexport function togglePublishSidebar() {\n\treturn {\n\t\ttype: 'TOGGLE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used to enable or disable a panel in the editor.\n *\n * @param {string} panelName A string that identifies the panel to enable or disable.\n *\n * @return {Object} Action object.\n */\nexport function toggleEditorPanelEnabled( panelName ) {\n\treturn {\n\t\ttype: 'TOGGLE_PANEL_ENABLED',\n\t\tpanelName,\n\t};\n}\n\n/**\n * Returns an action object used to open or close a panel in the editor.\n *\n * @param {string} panelName A string that identifies the panel to open or close.\n *\n * @return {Object} Action object.\n */\nexport function toggleEditorPanelOpened( panelName ) {\n\treturn {\n\t\ttype: 'TOGGLE_PANEL_OPENED',\n\t\tpanelName,\n\t};\n}\n\n/**\n * Returns an action object used to remove a panel from the editor.\n *\n * @param {string} panelName A string that identifies the panel to remove.\n *\n * @return {Object} Action object.\n */\nexport function removeEditorPanel( panelName ) {\n\treturn {\n\t\ttype: 'REMOVE_PANEL',\n\t\tpanelName,\n\t};\n}\n\n/**\n * Triggers an action used to toggle a feature flag.\n *\n * @param {string} feature Feature name.\n */\nexport const toggleFeature = ( feature ) => ( { registry } ) =>\n\tregistry.dispatch( preferencesStore ).toggle( 'core/edit-post', feature );\n\n/**\n * Triggers an action used to switch editor mode.\n *\n * @param {string} mode The editor mode.\n */\nexport const switchEditorMode = ( mode ) => ( { dispatch, registry } ) => {\n\tdispatch( {\n\t\ttype: 'SWITCH_MODE',\n\t\tmode,\n\t} );\n\n\t// Unselect blocks when we switch to the code editor.\n\tif ( mode !== 'visual' ) {\n\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t}\n\n\tconst message =\n\t\tmode === 'visual'\n\t\t\t? __( 'Visual editor selected' )\n\t\t\t: __( 'Code editor selected' );\n\tspeak( message, 'assertive' );\n};\n\n/**\n * Triggers an action object used to toggle a plugin name flag.\n *\n * @param {string} pluginName Plugin name.\n */\nexport const togglePinnedPluginItem = ( pluginName ) => ( { registry } ) => {\n\tconst isPinned = registry\n\t\t.select( interfaceStore )\n\t\t.isItemPinned( 'core/edit-post', pluginName );\n\n\tregistry\n\t\t.dispatch( interfaceStore )\n\t\t[ isPinned ? 'unpinItem' : 'pinItem' ]( 'core/edit-post', pluginName );\n};\n\n/**\n * Returns an action object used in signaling that a style should be auto-applied when a block is created.\n *\n * @param {string} blockName Name of the block.\n * @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the \"auto apply\" setting of the block is removed.\n *\n * @return {Object} Action object.\n */\nexport function updatePreferredStyleVariations( blockName, blockStyle ) {\n\treturn {\n\t\ttype: 'UPDATE_PREFERRED_STYLE_VARIATIONS',\n\t\tblockName,\n\t\tblockStyle,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the editor should attempt\n * to locally autosave the current post every `interval` seconds.\n *\n * @param {number} interval The new interval, in seconds.\n * @return {Object} Action object.\n */\nexport function __experimentalUpdateLocalAutosaveInterval( interval ) {\n\treturn {\n\t\ttype: 'UPDATE_LOCAL_AUTOSAVE_INTERVAL',\n\t\tinterval,\n\t};\n}\n\n/**\n * Update the provided block types to be visible.\n *\n * @param {string[]} blockNames Names of block types to show.\n */\nexport const showBlockTypes = ( blockNames ) => ( { registry } ) => {\n\tconst existingBlockNames =\n\t\tregistry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-post', 'hiddenBlockTypes' ) ?? [];\n\n\tconst newBlockNames = without(\n\t\texistingBlockNames,\n\t\t...castArray( blockNames )\n\t);\n\n\tregistry\n\t\t.dispatch( preferencesStore )\n\t\t.set( 'core/edit-post', 'hiddenBlockTypes', newBlockNames );\n};\n\n/**\n * Update the provided block types to be hidden.\n *\n * @param {string[]} blockNames Names of block types to hide.\n */\nexport const hideBlockTypes = ( blockNames ) => ( { registry } ) => {\n\tconst existingBlockNames =\n\t\tregistry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-post', 'hiddenBlockTypes' ) ?? [];\n\n\tconst mergedBlockNames = new Set( [\n\t\t...existingBlockNames,\n\t\t...castArray( blockNames ),\n\t] );\n\n\tregistry\n\t\t.dispatch( preferencesStore )\n\t\t.set( 'core/edit-post', 'hiddenBlockTypes', [ ...mergedBlockNames ] );\n};\n\n/**\n * Returns an action object used in signaling\n * what Meta boxes are available in which location.\n *\n * @param {Object} metaBoxesPerLocation Meta boxes per location.\n */\nexport const setAvailableMetaBoxesPerLocation = ( metaBoxesPerLocation ) => ( {\n\tdispatch,\n} ) =>\n\tdispatch( {\n\t\ttype: 'SET_META_BOXES_PER_LOCATIONS',\n\t\tmetaBoxesPerLocation,\n\t} );\n\n/**\n * Update a metabox.\n */\nexport const requestMetaBoxUpdates = () => async ( {\n\tregistry,\n\tselect,\n\tdispatch,\n} ) => {\n\tdispatch( {\n\t\ttype: 'REQUEST_META_BOX_UPDATES',\n\t} );\n\n\t// Saves the wp_editor fields.\n\tif ( window.tinyMCE ) {\n\t\twindow.tinyMCE.triggerSave();\n\t}\n\n\t// Additional data needed for backward compatibility.\n\t// If we do not provide this data, the post will be overridden with the default values.\n\tconst post = registry.select( editorStore ).getCurrentPost();\n\tconst additionalData = [\n\t\tpost.comment_status ? [ 'comment_status', post.comment_status ] : false,\n\t\tpost.ping_status ? [ 'ping_status', post.ping_status ] : false,\n\t\tpost.sticky ? [ 'sticky', post.sticky ] : false,\n\t\tpost.author ? [ 'post_author', post.author ] : false,\n\t].filter( Boolean );\n\n\t// We gather all the metaboxes locations data and the base form data.\n\tconst baseFormData = new window.FormData(\n\t\tdocument.querySelector( '.metabox-base-form' )\n\t);\n\tconst activeMetaBoxLocations = select.getActiveMetaBoxLocations();\n\tconst formDataToMerge = [\n\t\tbaseFormData,\n\t\t...activeMetaBoxLocations.map(\n\t\t\t( location ) =>\n\t\t\t\tnew window.FormData( getMetaBoxContainer( location ) )\n\t\t),\n\t];\n\n\t// Merge all form data objects into a single one.\n\tconst formData = reduce(\n\t\tformDataToMerge,\n\t\t( memo, currentFormData ) => {\n\t\t\tfor ( const [ key, value ] of currentFormData ) {\n\t\t\t\tmemo.append( key, value );\n\t\t\t}\n\t\t\treturn memo;\n\t\t},\n\t\tnew window.FormData()\n\t);\n\tadditionalData.forEach( ( [ key, value ] ) =>\n\t\tformData.append( key, value )\n\t);\n\n\ttry {\n\t\t// Save the metaboxes.\n\t\tawait apiFetch( {\n\t\t\turl: window._wpMetaBoxUrl,\n\t\t\tmethod: 'POST',\n\t\t\tbody: formData,\n\t\t\tparse: false,\n\t\t} );\n\t\tdispatch.metaBoxUpdatesSuccess();\n\t} catch {\n\t\tdispatch.metaBoxUpdatesFailure();\n\t}\n};\n\n/**\n * Returns an action object used to signal a successful meta box update.\n *\n * @return {Object} Action object.\n */\nexport function metaBoxUpdatesSuccess() {\n\treturn {\n\t\ttype: 'META_BOX_UPDATES_SUCCESS',\n\t};\n}\n\n/**\n * Returns an action object used to signal a failed meta box update.\n *\n * @return {Object} Action object.\n */\nexport function metaBoxUpdatesFailure() {\n\treturn {\n\t\ttype: 'META_BOX_UPDATES_FAILURE',\n\t};\n}\n\n/**\n * Returns an action object used to toggle the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Returns an action object used to open/close the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to open/close the list view.\n *\n * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.\n * @return {Object} Action object.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Returns an action object used to switch to template editing.\n *\n * @param {boolean} value Is editing template.\n * @return {Object} Action object.\n */\nexport function setIsEditingTemplate( value ) {\n\treturn {\n\t\ttype: 'SET_IS_EDITING_TEMPLATE',\n\t\tvalue,\n\t};\n}\n\n/**\n * Switches to the template mode.\n *\n * @param {boolean} newTemplate Is new template.\n */\nexport const __unstableSwitchToTemplateMode = ( newTemplate = false ) => ( {\n\tregistry,\n\tselect,\n\tdispatch,\n} ) => {\n\tdispatch( setIsEditingTemplate( true ) );\n\tconst isWelcomeGuideActive = select.isFeatureActive(\n\t\t'welcomeGuideTemplate'\n\t);\n\tif ( ! isWelcomeGuideActive ) {\n\t\tconst message = newTemplate\n\t\t\t? __( \"Custom template created. You're in template mode now.\" )\n\t\t\t: __(\n\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t );\n\t\tregistry.dispatch( noticesStore ).createSuccessNotice( message, {\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t}\n};\n\n/**\n * Create a block based template.\n *\n * @param {Object?} template Template to create and assign.\n */\nexport const __unstableCreateTemplate = ( template ) => async ( {\n\tregistry,\n} ) => {\n\tconst savedTemplate = await registry\n\t\t.dispatch( coreStore )\n\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\tconst post = registry.select( editorStore ).getCurrentPost();\n\tregistry\n\t\t.dispatch( coreStore )\n\t\t.editEntityRecord( 'postType', post.type, post.id, {\n\t\t\ttemplate: savedTemplate.slug,\n\t\t} );\n};\n\nlet metaBoxesInitialized = false;\n\n/**\n * Initializes WordPress `postboxes` script and the logic for saving meta boxes.\n */\nexport const initializeMetaBoxes = () => ( { registry, select, dispatch } ) => {\n\tconst isEditorReady = registry\n\t\t.select( editorStore )\n\t\t.__unstableIsEditorReady();\n\n\tif ( ! isEditorReady ) {\n\t\treturn;\n\t}\n\t// Only initialize once.\n\tif ( metaBoxesInitialized ) {\n\t\treturn;\n\t}\n\tconst postType = registry.select( editorStore ).getCurrentPostType();\n\tif ( window.postboxes.page !== postType ) {\n\t\twindow.postboxes.add_postbox_toggles( postType );\n\t}\n\n\tmetaBoxesInitialized = true;\n\n\tlet wasSavingPost = registry.select( editorStore ).isSavingPost();\n\tlet wasAutosavingPost = registry.select( editorStore ).isAutosavingPost();\n\tconst hasMetaBoxes = select.hasMetaBoxes();\n\n\t// Save metaboxes when performing a full save on the post.\n\tregistry.subscribe( async () => {\n\t\tconst isSavingPost = registry.select( editorStore ).isSavingPost();\n\t\tconst isAutosavingPost = registry\n\t\t\t.select( editorStore )\n\t\t\t.isAutosavingPost();\n\n\t\t// Save metaboxes on save completion, except for autosaves that are not a post preview.\n\t\t//\n\t\t// Meta boxes are initialized once at page load. It is not necessary to\n\t\t// account for updates on each state change.\n\t\t//\n\t\t// See: https://github.com/WordPress/WordPress/blob/5.1.1/wp-admin/includes/post.php#L2307-L2309.\n\t\tconst shouldTriggerMetaboxesSave =\n\t\t\thasMetaBoxes &&\n\t\t\twasSavingPost &&\n\t\t\t! isSavingPost &&\n\t\t\t! wasAutosavingPost;\n\n\t\t// Save current state for next inspection.\n\t\twasSavingPost = isSavingPost;\n\t\twasAutosavingPost = isAutosavingPost;\n\n\t\tif ( shouldTriggerMetaboxesSave ) {\n\t\t\tawait dispatch.requestMetaBoxUpdates();\n\t\t}\n\t} );\n\n\tdispatch( {\n\t\ttype: 'META_BOXES_INITIALIZED',\n\t} );\n};\n"]}
@@ -108,18 +108,6 @@ const preferences = (0, _lodash.flow)([_data.combineReducers, createWithInitialS
108
108
  return state;
109
109
  },
110
110
 
111
- hiddenBlockTypes(state, action) {
112
- switch (action.type) {
113
- case 'SHOW_BLOCK_TYPES':
114
- return (0, _lodash.without)(state, ...action.blockNames);
115
-
116
- case 'HIDE_BLOCK_TYPES':
117
- return (0, _lodash.union)(state, action.blockNames);
118
- }
119
-
120
- return state;
121
- },
122
-
123
111
  preferredStyleVariations(state, action) {
124
112
  switch (action.type) {
125
113
  case 'UPDATE_PREFERRED_STYLE_VARIATIONS':
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/store/reducer.js"],"names":["createWithInitialState","initialState","reducer","state","action","preferences","combineReducers","PREFERENCES_DEFAULTS","panels","type","panelName","enabled","isOpen","opened","editorMode","mode","hiddenBlockTypes","blockNames","preferredStyleVariations","blockName","blockStyle","localAutosaveInterval","interval","removedPanels","activeModal","name","publishSidebarActive","isSavingMetaBoxes","metaBoxLocations","metaBoxesPerLocation","deviceType","blockInserterPanel","value","listViewPanel","isEditingTemplate","metaBoxesInitialized","metaBoxes","isSaving","locations","initialized"],"m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;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASgC,oBAAT,GAAuD;AAAA,MAAxBhC,KAAwB,uEAAhB,KAAgB;AAAA,MAATC,MAAS;;AACtD,UAASA,MAAM,CAACK,IAAhB;AACC,SAAK,wBAAL;AACC,aAAO,IAAP;AAFF;;AAIA,SAAON,KAAP;AACA;;AAED,MAAMiC,SAAS,GAAG,2BAAiB;AAClCC,EAAAA,QAAQ,EAAEV,iBADwB;AAElCW,EAAAA,SAAS,EAAEV,gBAFuB;AAGlCW,EAAAA,WAAW,EAAEJ;AAHqB,CAAjB,CAAlB;;eAMe,2BAAiB;AAC/BX,EAAAA,WAD+B;AAE/BY,EAAAA,SAF+B;AAG/B/B,EAAAA,WAH+B;AAI/BqB,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,CAAjB,C","sourcesContent":["/**\n * External dependencies\n */\nimport { flow, get, includes, omit, union, without } 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\thiddenBlockTypes( state, action ) {\n\t\tswitch ( action.type ) {\n\t\t\tcase 'SHOW_BLOCK_TYPES':\n\t\t\t\treturn without( state, ...action.blockNames );\n\n\t\t\tcase 'HIDE_BLOCK_TYPES':\n\t\t\t\treturn union( state, action.blockNames );\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":["createWithInitialState","initialState","reducer","state","action","preferences","combineReducers","PREFERENCES_DEFAULTS","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":";;;;;;;;;;;;;;;;AAGA;;AAKA;;AAKA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,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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A;AAT+B,CAAjB,C","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"]}
@@ -10,9 +10,10 @@ exports.__experimentalGetPreviewDeviceType = __experimentalGetPreviewDeviceType;
10
10
  exports.areMetaBoxesInitialized = areMetaBoxesInitialized;
11
11
  exports.getEditedPostTemplate = exports.getAllMetaBoxes = exports.getActiveMetaBoxLocations = exports.getActiveGeneralSidebarName = void 0;
12
12
  exports.getEditorMode = getEditorMode;
13
+ exports.getHiddenBlockTypes = void 0;
13
14
  exports.getMetaBoxesPerLocation = getMetaBoxesPerLocation;
14
15
  exports.getPreference = getPreference;
15
- exports.getPreferences = getPreferences;
16
+ exports.getPreferences = void 0;
16
17
  exports.hasMetaBoxes = hasMetaBoxes;
17
18
  exports.isEditingTemplate = isEditingTemplate;
18
19
  exports.isEditorPanelEnabled = isEditorPanelEnabled;
@@ -36,6 +37,8 @@ var _data = require("@wordpress/data");
36
37
 
37
38
  var _interface = require("@wordpress/interface");
38
39
 
40
+ var _preferences = require("@wordpress/preferences");
41
+
39
42
  var _coreData = require("@wordpress/core-data");
40
43
 
41
44
  var _editor = require("@wordpress/editor");
@@ -47,7 +50,7 @@ var _editor = require("@wordpress/editor");
47
50
  /**
48
51
  * WordPress dependencies
49
52
  */
50
-
53
+ const EMPTY_ARRAY = [];
51
54
  /**
52
55
  * Returns the current editing mode.
53
56
  *
@@ -55,6 +58,7 @@ var _editor = require("@wordpress/editor");
55
58
  *
56
59
  * @return {string} Editing mode.
57
60
  */
61
+
58
62
  function getEditorMode(state) {
59
63
  return getPreference(state, 'editorMode', 'visual');
60
64
  }
@@ -102,7 +106,11 @@ const isPluginSidebarOpened = (0, _data.createRegistrySelector)(select => () =>
102
106
  exports.isPluginSidebarOpened = isPluginSidebarOpened;
103
107
  const getActiveGeneralSidebarName = (0, _data.createRegistrySelector)(select => () => {
104
108
  return select(_interface.store).getActiveComplementaryArea('core/edit-post');
105
- });
109
+ }); // The current list of preference keys that have been migrated to the
110
+ // preferences package.
111
+
112
+ exports.getActiveGeneralSidebarName = getActiveGeneralSidebarName;
113
+ const MIGRATED_KEYS = ['hiddenBlockTypes'];
106
114
  /**
107
115
  * Returns the preferences (these preferences are persisted locally).
108
116
  *
@@ -111,11 +119,21 @@ const getActiveGeneralSidebarName = (0, _data.createRegistrySelector)(select =>
111
119
  * @return {Object} Preferences Object.
112
120
  */
113
121
 
114
- exports.getActiveGeneralSidebarName = getActiveGeneralSidebarName;
115
-
116
- function getPreferences(state) {
117
- return state.preferences;
118
- }
122
+ const getPreferences = (0, _data.createRegistrySelector)(select => state => {
123
+ const editPostPreferences = state.preferences; // Some preferences now exist in the preferences store.
124
+ // Fetch them so that they can be merged into the post
125
+ // editor preferences.
126
+
127
+ const preferenceStorePreferences = MIGRATED_KEYS.reduce((accumulatedPrefs, preferenceKey) => {
128
+ const value = select(_preferences.store).get('core/edit-post', preferenceKey);
129
+ return { ...accumulatedPrefs,
130
+ [preferenceKey]: value
131
+ };
132
+ }, {});
133
+ return { ...editPostPreferences,
134
+ ...preferenceStorePreferences
135
+ };
136
+ });
119
137
  /**
120
138
  *
121
139
  * @param {Object} state Global application state.
@@ -125,12 +143,27 @@ function getPreferences(state) {
125
143
  * @return {*} Preference Value.
126
144
  */
127
145
 
146
+ exports.getPreferences = getPreferences;
128
147
 
129
148
  function getPreference(state, preferenceKey, defaultValue) {
130
- const preferences = getPreferences(state);
149
+ // Avoid using the `getPreferences` registry selector where possible.
150
+ const isMigratedKey = MIGRATED_KEYS.includes(preferenceKey);
151
+ const preferences = isMigratedKey ? getPreferences(state) : state.preferences;
131
152
  const value = preferences[preferenceKey];
132
153
  return value === undefined ? defaultValue : value;
133
154
  }
155
+ /**
156
+ * Returns an array of blocks that are hidden.
157
+ *
158
+ * @return {Array} A list of the hidden block types
159
+ */
160
+
161
+
162
+ const getHiddenBlockTypes = (0, _data.createRegistrySelector)(select => () => {
163
+ var _select$get;
164
+
165
+ return (_select$get = select(_preferences.store).get('core/edit-post', 'hiddenBlockTypes')) !== null && _select$get !== void 0 ? _select$get : EMPTY_ARRAY;
166
+ });
134
167
  /**
135
168
  * Returns true if the publish sidebar is opened.
136
169
  *
@@ -139,6 +172,7 @@ function getPreference(state, preferenceKey, defaultValue) {
139
172
  * @return {boolean} Whether the publish sidebar is open.
140
173
  */
141
174
 
175
+ exports.getHiddenBlockTypes = getHiddenBlockTypes;
142
176
 
143
177
  function isPublishSidebarOpened(state) {
144
178
  return state.publishSidebarActive;
@@ -211,7 +245,7 @@ function isModalActive(state, modalName) {
211
245
 
212
246
 
213
247
  const isFeatureActive = (0, _data.createRegistrySelector)(select => (state, feature) => {
214
- return select(_interface.store).isFeatureActive('core/edit-post', feature);
248
+ return !!select(_preferences.store).get('core/edit-post', feature);
215
249
  });
216
250
  /**
217
251
  * Returns true if the plugin item is pinned to the header.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/store/selectors.js"],"names":["getEditorMode","state","getPreference","isEditorSidebarOpened","select","activeGeneralSidebar","interfaceStore","getActiveComplementaryArea","isPluginSidebarOpened","getActiveGeneralSidebarName","getPreferences","preferences","preferenceKey","defaultValue","value","undefined","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","editorStore","getEditedPostAttribute","templateWithSameSlug","coreStore","getEntityRecords","per_page","find","template","slug","getEditedEntityRecord","post","getCurrentPost","link","__experimentalGetTemplateForLink"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAZA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAT,CAAwBC,KAAxB,EAAgC;AACtC,SAAOC,aAAa,CAAED,KAAF,EAAS,YAAT,EAAuB,QAAvB,CAApB;AACA;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\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 coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\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/**\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 function getPreferences( state ) {\n\treturn state.preferences;\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\tconst preferences = getPreferences( state );\n\tconst value = preferences[ preferenceKey ];\n\treturn value === undefined ? defaultValue : value;\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( interfaceStore ).isFeatureActive(\n\t\t\t'core/edit-post',\n\t\t\tfeature\n\t\t);\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":["EMPTY_ARRAY","getEditorMode","state","getPreference","isEditorSidebarOpened","select","activeGeneralSidebar","interfaceStore","getActiveComplementaryArea","isPluginSidebarOpened","getActiveGeneralSidebarName","MIGRATED_KEYS","getPreferences","editPostPreferences","preferences","preferenceStorePreferences","reduce","accumulatedPrefs","preferenceKey","value","preferencesStore","get","defaultValue","isMigratedKey","includes","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","editorStore","getEditedPostAttribute","templateWithSameSlug","coreStore","getEntityRecords","per_page","find","template","slug","getEditedEntityRecord","post","getCurrentPost","link","__experimentalGetTemplateForLink"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAbA;AACA;AACA;;AAIA;AACA;AACA;AAOA,MAAMA,WAAW,GAAG,EAApB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,aAAT,CAAwBC,KAAxB,EAAgC;AACtC,SAAOC,aAAa,CAAED,KAAF,EAAS,YAAT,EAAuB,QAAvB,CAApB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAME,qBAAqB,GAAG,kCAClCC,MAAF,IAAc,MAAM;AACnB,QAAMC,oBAAoB,GAAGD,MAAM,CAClCE,gBADkC,CAAN,CAE3BC,0BAF2B,CAEC,gBAFD,CAA7B;AAGA,SAAO,sBACN,CAAE,oBAAF,EAAwB,iBAAxB,CADM,E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BC,gBAD2B,CACT,UADS,EACG,aADH,EACkB;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KADlB,CAAH,0DAAG,sBAE1BC,IAF0B,CAElBC,QAAF,IAAgBA,QAAQ,CAACC,IAAT,KAAkBT,eAFd,CAA7B;;AAGA,QAAK,CAAEG,oBAAP,EAA8B;AAC7B,aAAOA,oBAAP;AACA;;AACD,WAAOvE,MAAM,CAAEwE,eAAF,CAAN,CAAoBM,qBAApB,CACN,UADM,EAEN,aAFM,EAGNP,oBAAoB,CAACvB,EAHf,CAAP;AAKA;;AAED,QAAM+B,IAAI,GAAG/E,MAAM,CAAEqE,aAAF,CAAN,CAAsBW,cAAtB,EAAb;;AACA,MAAKD,IAAI,CAACE,IAAV,EAAiB;AAChB,WAAOjF,MAAM,CAAEwE,eAAF,CAAN,CAAoBU,gCAApB,CACNH,IAAI,CAACE,IADC,CAAP;AAGA;;AAED,SAAO,IAAP;AACA,CA3BmC,CAA9B","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"]}
@@ -34,11 +34,11 @@ function BlockManagerCategory(_ref) {
34
34
  getEditorSettings
35
35
  } = select(editorStore);
36
36
  const {
37
- getPreference
37
+ getHiddenBlockTypes
38
38
  } = select(editPostStore);
39
39
  return {
40
40
  defaultAllowedBlockTypes: getEditorSettings().defaultAllowedBlockTypes,
41
- hiddenBlockTypes: getPreference('hiddenBlockTypes')
41
+ hiddenBlockTypes: getHiddenBlockTypes()
42
42
  };
43
43
  }, []);
44
44
  const filteredBlockTypes = useMemo(() => {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/category.js"],"names":["includes","map","without","useMemo","useCallback","useDispatch","useSelect","useInstanceId","CheckboxControl","store","editorStore","BlockTypesChecklist","editPostStore","BlockManagerCategory","title","blockTypes","instanceId","defaultAllowedBlockTypes","hiddenBlockTypes","select","getEditorSettings","getPreference","filteredBlockTypes","filter","name","showBlockTypes","hideBlockTypes","toggleVisible","blockName","nextIsChecked","toggleAllVisible","blockNames","length","checkedBlockNames","titleId","isAllChecked","ariaChecked"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,GAAnB,EAAwBC,OAAxB,QAAuC,QAAvC;AAEA;AACA;AACA;;AACA,SAASC,OAAT,EAAkBC,WAAlB,QAAqC,oBAArC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,aAAhC;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,aAAvC;;AAEA,SAASC,oBAAT,OAAuD;AAA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BAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { includes, map, without } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { CheckboxControl } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesChecklist from './checklist';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManagerCategory( { title, blockTypes } ) {\n\tconst instanceId = useInstanceId( BlockManagerCategory );\n\tconst { defaultAllowedBlockTypes, hiddenBlockTypes } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getPreference } = select( editPostStore );\n\t\t\treturn {\n\t\t\t\tdefaultAllowedBlockTypes: getEditorSettings()\n\t\t\t\t\t.defaultAllowedBlockTypes,\n\t\t\t\thiddenBlockTypes: getPreference( 'hiddenBlockTypes' ),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( defaultAllowedBlockTypes === true ) {\n\t\t\treturn blockTypes;\n\t\t}\n\t\treturn blockTypes.filter( ( { name } ) => {\n\t\t\treturn includes( defaultAllowedBlockTypes || [], name );\n\t\t} );\n\t}, [ defaultAllowedBlockTypes, blockTypes ] );\n\tconst { showBlockTypes, hideBlockTypes } = useDispatch( editPostStore );\n\tconst toggleVisible = useCallback( ( blockName, nextIsChecked ) => {\n\t\tif ( nextIsChecked ) {\n\t\t\tshowBlockTypes( blockName );\n\t\t} else {\n\t\t\thideBlockTypes( blockName );\n\t\t}\n\t}, [] );\n\tconst toggleAllVisible = useCallback(\n\t\t( nextIsChecked ) => {\n\t\t\tconst blockNames = map( blockTypes, 'name' );\n\t\t\tif ( nextIsChecked ) {\n\t\t\t\tshowBlockTypes( blockNames );\n\t\t\t} else {\n\t\t\t\thideBlockTypes( blockNames );\n\t\t\t}\n\t\t},\n\t\t[ blockTypes ]\n\t);\n\n\tif ( ! filteredBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\tconst checkedBlockNames = without(\n\t\tmap( filteredBlockTypes, 'name' ),\n\t\t...hiddenBlockTypes\n\t);\n\n\tconst titleId = 'edit-post-block-manager__category-title-' + instanceId;\n\n\tconst isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;\n\n\tlet ariaChecked;\n\tif ( isAllChecked ) {\n\t\tariaChecked = 'true';\n\t} else if ( checkedBlockNames.length > 0 ) {\n\t\tariaChecked = 'mixed';\n\t} else {\n\t\tariaChecked = 'false';\n\t}\n\n\treturn (\n\t\t<div\n\t\t\trole=\"group\"\n\t\t\taria-labelledby={ titleId }\n\t\t\tclassName=\"edit-post-block-manager__category\"\n\t\t>\n\t\t\t<CheckboxControl\n\t\t\t\tchecked={ isAllChecked }\n\t\t\t\tonChange={ toggleAllVisible }\n\t\t\t\tclassName=\"edit-post-block-manager__category-title\"\n\t\t\t\taria-checked={ ariaChecked }\n\t\t\t\tlabel={ <span id={ titleId }>{ title }</span> }\n\t\t\t/>\n\t\t\t<BlockTypesChecklist\n\t\t\t\tblockTypes={ filteredBlockTypes }\n\t\t\t\tvalue={ checkedBlockNames }\n\t\t\t\tonItemChange={ toggleVisible }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default BlockManagerCategory;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/category.js"],"names":["includes","map","without","useMemo","useCallback","useDispatch","useSelect","useInstanceId","CheckboxControl","store","editorStore","BlockTypesChecklist","editPostStore","BlockManagerCategory","title","blockTypes","instanceId","defaultAllowedBlockTypes","hiddenBlockTypes","select","getEditorSettings","getHiddenBlockTypes","filteredBlockTypes","filter","name","showBlockTypes","hideBlockTypes","toggleVisible","blockName","nextIsChecked","toggleAllVisible","blockNames","length","checkedBlockNames","titleId","isAllChecked","ariaChecked"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EA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,SAAS,EAAC;AAHX,KAKC,cAAC,eAAD;AACC,IAAA,OAAO,EAAGC,YADX;AAEC,IAAA,QAAQ,EAAGL,gBAFZ;AAGC,IAAA,SAAS,EAAC,yCAHX;AAIC,oBAAeM,WAJhB;AAKC,IAAA,KAAK,EAAG;AAAM,MAAA,EAAE,EAAGF;AAAX,OAAuBpB,KAAvB;AALT,IALD,EAYC,cAAC,mBAAD;AACC,IAAA,UAAU,EAAGQ,kBADd;AAEC,IAAA,KAAK,EAAGW,iBAFT;AAGC,IAAA,YAAY,EAAGN;AAHhB,IAZD,CADD;AAoBA;;AAED,eAAed,oBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { includes, map, without } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { CheckboxControl } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesChecklist from './checklist';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManagerCategory( { title, blockTypes } ) {\n\tconst instanceId = useInstanceId( BlockManagerCategory );\n\tconst { defaultAllowedBlockTypes, hiddenBlockTypes } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getHiddenBlockTypes } = select( editPostStore );\n\t\t\treturn {\n\t\t\t\tdefaultAllowedBlockTypes: getEditorSettings()\n\t\t\t\t\t.defaultAllowedBlockTypes,\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( defaultAllowedBlockTypes === true ) {\n\t\t\treturn blockTypes;\n\t\t}\n\t\treturn blockTypes.filter( ( { name } ) => {\n\t\t\treturn includes( defaultAllowedBlockTypes || [], name );\n\t\t} );\n\t}, [ defaultAllowedBlockTypes, blockTypes ] );\n\tconst { showBlockTypes, hideBlockTypes } = useDispatch( editPostStore );\n\tconst toggleVisible = useCallback( ( blockName, nextIsChecked ) => {\n\t\tif ( nextIsChecked ) {\n\t\t\tshowBlockTypes( blockName );\n\t\t} else {\n\t\t\thideBlockTypes( blockName );\n\t\t}\n\t}, [] );\n\tconst toggleAllVisible = useCallback(\n\t\t( nextIsChecked ) => {\n\t\t\tconst blockNames = map( blockTypes, 'name' );\n\t\t\tif ( nextIsChecked ) {\n\t\t\t\tshowBlockTypes( blockNames );\n\t\t\t} else {\n\t\t\t\thideBlockTypes( blockNames );\n\t\t\t}\n\t\t},\n\t\t[ blockTypes ]\n\t);\n\n\tif ( ! filteredBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\tconst checkedBlockNames = without(\n\t\tmap( filteredBlockTypes, 'name' ),\n\t\t...hiddenBlockTypes\n\t);\n\n\tconst titleId = 'edit-post-block-manager__category-title-' + instanceId;\n\n\tconst isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;\n\n\tlet ariaChecked;\n\tif ( isAllChecked ) {\n\t\tariaChecked = 'true';\n\t} else if ( checkedBlockNames.length > 0 ) {\n\t\tariaChecked = 'mixed';\n\t} else {\n\t\tariaChecked = 'false';\n\t}\n\n\treturn (\n\t\t<div\n\t\t\trole=\"group\"\n\t\t\taria-labelledby={ titleId }\n\t\t\tclassName=\"edit-post-block-manager__category\"\n\t\t>\n\t\t\t<CheckboxControl\n\t\t\t\tchecked={ isAllChecked }\n\t\t\t\tonChange={ toggleAllVisible }\n\t\t\t\tclassName=\"edit-post-block-manager__category-title\"\n\t\t\t\taria-checked={ ariaChecked }\n\t\t\t\tlabel={ <span id={ titleId }>{ title }</span> }\n\t\t\t/>\n\t\t\t<BlockTypesChecklist\n\t\t\t\tblockTypes={ filteredBlockTypes }\n\t\t\t\tvalue={ checkedBlockNames }\n\t\t\t\tonItemChange={ toggleVisible }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default BlockManagerCategory;\n"]}
@@ -92,9 +92,9 @@ export default withSelect(select => {
92
92
  isMatchingSearchTerm
93
93
  } = select(blocksStore);
94
94
  const {
95
- getPreference
95
+ getHiddenBlockTypes
96
96
  } = select(editPostStore);
97
- const hiddenBlockTypes = getPreference('hiddenBlockTypes');
97
+ const hiddenBlockTypes = getHiddenBlockTypes();
98
98
  const numberOfHiddenBlocks = isArray(hiddenBlockTypes) && hiddenBlockTypes.length;
99
99
  return {
100
100
  blockTypes: getBlockTypes(),
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/index.js"],"names":["filter","includes","isArray","store","blocksStore","withSelect","SearchControl","__","_n","sprintf","useEffect","useState","useDebounce","speak","BlockManagerCategory","editPostStore","BlockManager","blockTypes","categories","hasBlockSupport","isMatchingSearchTerm","numberOfHiddenBlocks","debouncedSpeak","search","setSearch","blockType","parent","count","length","resultsFoundMessage","nextSearch","map","category","slug","title","select","getBlockTypes","getCategories","getPreference","hiddenBlockTypes"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,QAAjB,EAA2BC,OAA3B,QAA0C,QAA1C;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,aAAT,QAA8B,uBAA9B;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,oBAApC;AACA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SAASC,KAAT,QAAsB,iBAAtB;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,YAAjC;AACA,SAASX,KAAK,IAAIY,aAAlB,QAAuC,aAAvC;;AAEA,SAASC,YAAT,OAMI;AAAA,MANmB;AACtBC,IAAAA,UADsB;AAEtBC,IAAAA,UAFsB;AAGtBC,IAAAA,eAHsB;AAItBC,IAAAA,oBAJsB;AAKtB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O;AACNX,IAAAA,UAAU,EAAEmB,aAAa,EADnB;AAENlB,IAAAA,UAAU,EAAEmB,aAAa,EAFnB;AAGNlB,IAAAA,eAHM;AAINC,IAAAA,oBAJM;AAKNC,IAAAA;AALM,GAAP;AAOA,CAnBwB,CAAV,CAmBVL,YAnBU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { filter, includes, isArray } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { withSelect } from '@wordpress/data';\nimport { SearchControl } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport BlockManagerCategory from './category';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManager( {\n\tblockTypes,\n\tcategories,\n\thasBlockSupport,\n\tisMatchingSearchTerm,\n\tnumberOfHiddenBlocks,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst [ search, setSearch ] = useState( '' );\n\n\t// Filtering occurs here (as opposed to `withSelect`) to avoid\n\t// wasted renders by consequence of `Array#filter` producing\n\t// a new value reference on each call.\n\tblockTypes = blockTypes.filter(\n\t\t( blockType ) =>\n\t\t\thasBlockSupport( blockType, 'inserter', true ) &&\n\t\t\t( ! search || isMatchingSearchTerm( blockType, search ) ) &&\n\t\t\t( ! blockType.parent ||\n\t\t\t\tincludes( blockType.parent, 'core/post-content' ) )\n\t);\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! search ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = blockTypes.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ blockTypes.length, search, debouncedSpeak ] );\n\n\treturn (\n\t\t<div className=\"edit-post-block-manager__content\">\n\t\t\t{ !! numberOfHiddenBlocks && (\n\t\t\t\t<div className=\"edit-post-block-manager__disabled-blocks-count\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d block is hidden.',\n\t\t\t\t\t\t\t'%d blocks are hidden.',\n\t\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<SearchControl\n\t\t\t\tlabel={ __( 'Search for a block' ) }\n\t\t\t\tplaceholder={ __( 'Search for a block' ) }\n\t\t\t\tvalue={ search }\n\t\t\t\tonChange={ ( nextSearch ) => setSearch( nextSearch ) }\n\t\t\t\tclassName=\"edit-post-block-manager__search\"\n\t\t\t/>\n\t\t\t<div\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"region\"\n\t\t\t\taria-label={ __( 'Available block types' ) }\n\t\t\t\tclassName=\"edit-post-block-manager__results\"\n\t\t\t>\n\t\t\t\t{ blockTypes.length === 0 && (\n\t\t\t\t\t<p className=\"edit-post-block-manager__no-results\">\n\t\t\t\t\t\t{ __( 'No blocks found.' ) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<BlockManagerCategory\n\t\t\t\t\t\tkey={ category.slug }\n\t\t\t\t\t\ttitle={ category.title }\n\t\t\t\t\t\tblockTypes={ filter( blockTypes, {\n\t\t\t\t\t\t\tcategory: category.slug,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t\t<BlockManagerCategory\n\t\t\t\t\ttitle={ __( 'Uncategorized' ) }\n\t\t\t\t\tblockTypes={ filter(\n\t\t\t\t\t\tblockTypes,\n\t\t\t\t\t\t( { category } ) => ! category\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\tconst {\n\t\tgetBlockTypes,\n\t\tgetCategories,\n\t\thasBlockSupport,\n\t\tisMatchingSearchTerm,\n\t} = select( blocksStore );\n\tconst { getPreference } = select( editPostStore );\n\tconst hiddenBlockTypes = getPreference( 'hiddenBlockTypes' );\n\tconst numberOfHiddenBlocks =\n\t\tisArray( hiddenBlockTypes ) && hiddenBlockTypes.length;\n\n\treturn {\n\t\tblockTypes: getBlockTypes(),\n\t\tcategories: getCategories(),\n\t\thasBlockSupport,\n\t\tisMatchingSearchTerm,\n\t\tnumberOfHiddenBlocks,\n\t};\n} )( BlockManager );\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/index.js"],"names":["filter","includes","isArray","store","blocksStore","withSelect","SearchControl","__","_n","sprintf","useEffect","useState","useDebounce","speak","BlockManagerCategory","editPostStore","BlockManager","blockTypes","categories","hasBlockSupport","isMatchingSearchTerm","numberOfHiddenBlocks","debouncedSpeak","search","setSearch","blockType","parent","count","length","resultsFoundMessage","nextSearch","map","category","slug","title","select","getBlockTypes","getCategories","getHiddenBlockTypes","hiddenBlockTypes"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,QAAjB,EAA2BC,OAA3B,QAA0C,QAA1C;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,aAAT,QAA8B,uBAA9B;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,oBAApC;AACA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SAASC,KAAT,QAAsB,iBAAtB;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,YAAjC;AACA,SAASX,KAAK,IAAIY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tC;AACA,QAAMwB,gBAAgB,GAAGD,mBAAmB,EAA5C;AACA,QAAMjB,oBAAoB,GACzBnB,OAAO,CAAEqC,gBAAF,CAAP,IAA+BA,gBAAgB,CAACX,MADjD;AAGA,SAAO;AACNX,IAAAA,UAAU,EAAEmB,aAAa,EADnB;AAENlB,IAAAA,UAAU,EAAEmB,aAAa,EAFnB;AAGNlB,IAAAA,eAHM;AAINC,IAAAA,oBAJM;AAKNC,IAAAA;AALM,GAAP;AAOA,CAnBwB,CAAV,CAmBVL,YAnBU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { filter, includes, isArray } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { withSelect } from '@wordpress/data';\nimport { SearchControl } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport BlockManagerCategory from './category';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManager( {\n\tblockTypes,\n\tcategories,\n\thasBlockSupport,\n\tisMatchingSearchTerm,\n\tnumberOfHiddenBlocks,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst [ search, setSearch ] = useState( '' );\n\n\t// Filtering occurs here (as opposed to `withSelect`) to avoid\n\t// wasted renders by consequence of `Array#filter` producing\n\t// a new value reference on each call.\n\tblockTypes = blockTypes.filter(\n\t\t( blockType ) =>\n\t\t\thasBlockSupport( blockType, 'inserter', true ) &&\n\t\t\t( ! search || isMatchingSearchTerm( blockType, search ) ) &&\n\t\t\t( ! blockType.parent ||\n\t\t\t\tincludes( blockType.parent, 'core/post-content' ) )\n\t);\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! search ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = blockTypes.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ blockTypes.length, search, debouncedSpeak ] );\n\n\treturn (\n\t\t<div className=\"edit-post-block-manager__content\">\n\t\t\t{ !! numberOfHiddenBlocks && (\n\t\t\t\t<div className=\"edit-post-block-manager__disabled-blocks-count\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d block is hidden.',\n\t\t\t\t\t\t\t'%d blocks are hidden.',\n\t\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<SearchControl\n\t\t\t\tlabel={ __( 'Search for a block' ) }\n\t\t\t\tplaceholder={ __( 'Search for a block' ) }\n\t\t\t\tvalue={ search }\n\t\t\t\tonChange={ ( nextSearch ) => setSearch( nextSearch ) }\n\t\t\t\tclassName=\"edit-post-block-manager__search\"\n\t\t\t/>\n\t\t\t<div\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"region\"\n\t\t\t\taria-label={ __( 'Available block types' ) }\n\t\t\t\tclassName=\"edit-post-block-manager__results\"\n\t\t\t>\n\t\t\t\t{ blockTypes.length === 0 && (\n\t\t\t\t\t<p className=\"edit-post-block-manager__no-results\">\n\t\t\t\t\t\t{ __( 'No blocks found.' ) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<BlockManagerCategory\n\t\t\t\t\t\tkey={ category.slug }\n\t\t\t\t\t\ttitle={ category.title }\n\t\t\t\t\t\tblockTypes={ filter( blockTypes, {\n\t\t\t\t\t\t\tcategory: category.slug,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t\t<BlockManagerCategory\n\t\t\t\t\ttitle={ __( 'Uncategorized' ) }\n\t\t\t\t\tblockTypes={ filter(\n\t\t\t\t\t\tblockTypes,\n\t\t\t\t\t\t( { category } ) => ! category\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\tconst {\n\t\tgetBlockTypes,\n\t\tgetCategories,\n\t\thasBlockSupport,\n\t\tisMatchingSearchTerm,\n\t} = select( blocksStore );\n\tconst { getHiddenBlockTypes } = select( editPostStore );\n\tconst hiddenBlockTypes = getHiddenBlockTypes();\n\tconst numberOfHiddenBlocks =\n\t\tisArray( hiddenBlockTypes ) && hiddenBlockTypes.length;\n\n\treturn {\n\t\tblockTypes: getBlockTypes(),\n\t\tcategories: getCategories(),\n\t\thasBlockSupport,\n\t\tisMatchingSearchTerm,\n\t\tnumberOfHiddenBlocks,\n\t};\n} )( BlockManager );\n"]}
@@ -90,7 +90,7 @@ function HeaderToolbar() {
90
90
  }));
91
91
  const openInserter = useCallback(() => {
92
92
  if (isInserterOpened) {
93
- // Focusing the inserter button closes the inserter popover
93
+ // Focusing the inserter button closes the inserter popover.
94
94
  inserterButton.current.focus();
95
95
  } else {
96
96
  setIsInserterOpened(true);