@wordpress/edit-post 5.0.26 → 5.1.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 (92) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/build/components/block-manager/category.js +42 -47
  4. package/build/components/block-manager/category.js.map +1 -1
  5. package/build/components/header/index.native.js +4 -6
  6. package/build/components/header/index.native.js.map +1 -1
  7. package/build/components/layout/index.js +3 -1
  8. package/build/components/layout/index.js.map +1 -1
  9. package/build/components/layout/index.native.js +3 -3
  10. package/build/components/layout/index.native.js.map +1 -1
  11. package/build/components/preferences-modal/index.js +20 -10
  12. package/build/components/preferences-modal/index.js.map +1 -1
  13. package/build/components/secondary-sidebar/inserter-sidebar.js +13 -3
  14. package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  15. package/build/components/secondary-sidebar/list-view-sidebar.js +7 -5
  16. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  17. package/build/components/sidebar/post-author/index.js +3 -1
  18. package/build/components/sidebar/post-author/index.js.map +1 -1
  19. package/build/components/sidebar/template/index.js +2 -1
  20. package/build/components/sidebar/template/index.js.map +1 -1
  21. package/build/components/visual-editor/index.js +14 -6
  22. package/build/components/visual-editor/index.js.map +1 -1
  23. package/build/components/welcome-guide/template.js +1 -1
  24. package/build/components/welcome-guide/template.js.map +1 -1
  25. package/build/editor.js +6 -11
  26. package/build/editor.js.map +1 -1
  27. package/build/index.native.js +3 -9
  28. package/build/index.native.js.map +1 -1
  29. package/build/store/selectors.js +3 -1
  30. package/build/store/selectors.js.map +1 -1
  31. package/build-module/components/block-manager/category.js +44 -48
  32. package/build-module/components/block-manager/category.js.map +1 -1
  33. package/build-module/components/header/index.native.js +4 -4
  34. package/build-module/components/header/index.native.js.map +1 -1
  35. package/build-module/components/layout/index.js +4 -2
  36. package/build-module/components/layout/index.js.map +1 -1
  37. package/build-module/components/layout/index.native.js +4 -2
  38. package/build-module/components/layout/index.native.js.map +1 -1
  39. package/build-module/components/preferences-modal/index.js +20 -10
  40. package/build-module/components/preferences-modal/index.js.map +1 -1
  41. package/build-module/components/secondary-sidebar/inserter-sidebar.js +14 -4
  42. package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  43. package/build-module/components/secondary-sidebar/list-view-sidebar.js +7 -5
  44. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  45. package/build-module/components/sidebar/post-author/index.js +3 -1
  46. package/build-module/components/sidebar/post-author/index.js.map +1 -1
  47. package/build-module/components/sidebar/template/index.js +2 -1
  48. package/build-module/components/sidebar/template/index.js.map +1 -1
  49. package/build-module/components/visual-editor/index.js +15 -7
  50. package/build-module/components/visual-editor/index.js.map +1 -1
  51. package/build-module/components/welcome-guide/template.js +1 -1
  52. package/build-module/components/welcome-guide/template.js.map +1 -1
  53. package/build-module/editor.js +7 -10
  54. package/build-module/editor.js.map +1 -1
  55. package/build-module/index.native.js +2 -9
  56. package/build-module/index.native.js.map +1 -1
  57. package/build-module/store/selectors.js +3 -1
  58. package/build-module/store/selectors.js.map +1 -1
  59. package/build-style/style-rtl.css +17 -16
  60. package/build-style/style.css +17 -16
  61. package/package.json +27 -27
  62. package/src/components/block-manager/category.js +41 -48
  63. package/src/components/header/index.native.js +10 -4
  64. package/src/components/header/template-title/style.scss +1 -1
  65. package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +2 -2
  66. package/src/components/layout/index.js +2 -1
  67. package/src/components/layout/index.native.js +2 -5
  68. package/src/components/preferences-modal/index.js +9 -16
  69. package/src/components/preferences-modal/test/__snapshots__/index.js.snap +7 -13
  70. package/src/components/secondary-sidebar/inserter-sidebar.js +14 -3
  71. package/src/components/secondary-sidebar/list-view-sidebar.js +12 -5
  72. package/src/components/secondary-sidebar/style.scss +0 -4
  73. package/src/components/sidebar/post-author/index.js +1 -1
  74. package/src/components/sidebar/template/index.js +1 -0
  75. package/src/components/visual-editor/index.js +16 -6
  76. package/src/components/welcome-guide/style.scss +8 -1
  77. package/src/components/welcome-guide/template.js +1 -1
  78. package/src/editor.js +22 -26
  79. package/src/index.native.js +1 -10
  80. package/src/store/selectors.js +1 -1
  81. package/src/style.scss +1 -2
  82. package/src/test/editor.native.js +4 -4
  83. package/build/components/edit-post-settings/index.js +0 -16
  84. package/build/components/edit-post-settings/index.js.map +0 -1
  85. package/build/prevent-event-discovery.js +0 -24
  86. package/build/prevent-event-discovery.js.map +0 -1
  87. package/build-module/components/edit-post-settings/index.js +0 -7
  88. package/build-module/components/edit-post-settings/index.js.map +0 -1
  89. package/build-module/prevent-event-discovery.js +0 -17
  90. package/build-module/prevent-event-discovery.js.map +0 -1
  91. package/src/components/edit-post-settings/index.js +0 -7
  92. package/src/prevent-event-discovery.js +0 -21
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/store/selectors.js"],"names":["createSelector","get","includes","some","flatten","values","createRegistrySelector","store","interfaceStore","coreStore","editorStore","getEditorMode","state","getPreference","isEditorSidebarOpened","select","activeGeneralSidebar","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","getEditedPostAttribute","templateWithSameSlug","getEntityRecords","find","template","slug","getEditedEntityRecord","post","getCurrentPost","link","__experimentalGetTemplateForLink"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,cAAP,MAA2B,QAA3B;AACA,SAASC,GAAT,EAAcC,QAAd,EAAwBC,IAAxB,EAA8BC,OAA9B,EAAuCC,MAAvC,QAAqD,QAArD;AAEA;AACA;AACA;;AACA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,sBAAxC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASF,KAAK,IAAIG,WAAlB,QAAqC,mBAArC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAwBC,KAAxB,EAAgC;AACtC,SAAOC,aAAa,CAAED,KAAF,EAAS,YAAT,EAAuB,QAAvB,CAApB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAME,qBAAqB,GAAGR,sBAAsB,CACxDS,MAAF,IAAc,MAAM;AACnB,QAAMC,oBAAoB,GAAGD,MAAM,CAClCP,cADkC,CAAN,CAE3BS,0BAF2B,CAEC,gBAFD,CAA7B;AAGA,SAAOf,QAAQ,CACd,CAAE,oBAAF,EAAwB,iBAAxB,CADc,EAEdc,oBAFc,CAAf;AAIA,CATyD,CAApD;AAYP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAME,qBAAqB,GAAGZ,sBAAsB,CACxDS,MAAF,IAAc,MAAM;AACnB,QAAMC,oBAAoB,GAAGD,MAAM,CAClCP,cADkC,CAAN,CAE3BS,0BAF2B,CAEC,gBAFD,CAA7B;AAGA,SACC,CAAC,CAAED,oBAAH,IACA,CAAEd,QAAQ,CACT,CAAE,oBAAF,EAAwB,iBAAxB,CADS,EAETc,oBAFS,CAFX;AAOA,CAZyD,CAApD;AAeP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMG,2BA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AAEL,WAAF,CAAN,CAAsB+D,sBAAtB,CACvB,UADuB,CAAxB;;AAGA,MAAKD,eAAL,EAAuB;AAAA;;AACtB,UAAME,oBAAoB,4BAAG3D,MAAM,CAAEN,SAAF,CAAN,CAC3BkE,gBAD2B,CACT,UADS,EACG,aADH,CAAH,0DAAG,sBAE1BC,IAF0B,CAElBC,QAAF,IAAgBA,QAAQ,CAACC,IAAT,KAAkBN,eAFd,CAA7B;;AAGA,QAAK,CAAEE,oBAAP,EAA8B;AAC7B,aAAOA,oBAAP;AACA;;AACD,WAAO3D,MAAM,CAAEN,SAAF,CAAN,CAAoBsE,qBAApB,CACN,UADM,EAEN,aAFM,EAGNL,oBAAoB,CAACtB,EAHf,CAAP;AAKA;;AAED,QAAM4B,IAAI,GAAGjE,MAAM,CAAEL,WAAF,CAAN,CAAsBuE,cAAtB,EAAb;;AACA,MAAKD,IAAI,CAACE,IAAV,EAAiB;AAChB,WAAOnE,MAAM,CAAEN,SAAF,CAAN,CAAoB0E,gCAApB,CACNH,IAAI,CAACE,IADC,CAAP;AAGA;;AAED,SAAO,IAAP;AACA,CA3ByD,CAApD","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\nimport { get, includes, some, flatten, values } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as 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' )\n\t\t\t\t?.find( ( template ) => template.slug === currentTemplate );\n\t\t\tif ( ! templateWithSameSlug ) {\n\t\t\t\treturn templateWithSameSlug;\n\t\t\t}\n\t\t\treturn select( coreStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\ttemplateWithSameSlug.id\n\t\t\t);\n\t\t}\n\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tif ( post.link ) {\n\t\t\treturn select( coreStore ).__experimentalGetTemplateForLink(\n\t\t\t\tpost.link\n\t\t\t);\n\t\t}\n\n\t\treturn null;\n\t}\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/store/selectors.js"],"names":["createSelector","get","includes","some","flatten","values","createRegistrySelector","store","interfaceStore","coreStore","editorStore","getEditorMode","state","getPreference","isEditorSidebarOpened","select","activeGeneralSidebar","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","getEditedPostAttribute","templateWithSameSlug","getEntityRecords","per_page","find","template","slug","getEditedEntityRecord","post","getCurrentPost","link","__experimentalGetTemplateForLink"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,cAAP,MAA2B,QAA3B;AACA,SAASC,GAAT,EAAcC,QAAd,EAAwBC,IAAxB,EAA8BC,OAA9B,EAAuCC,MAAvC,QAAqD,QAArD;AAEA;AACA;AACA;;AACA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,sBAAxC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASF,KAAK,IAAIG,WAAlB,QAAqC,mBAArC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAwBC,KAAxB,EAAgC;AACtC,SAAOC,aAAa,CAAED,KAAF,EAAS,YAAT,EAAuB,QAAvB,CAApB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAME,qBAAqB,GAAGR,sBAAsB,CACxDS,MAAF,IAAc,MAAM;AACnB,QAAMC,oBAAoB,GAAGD,MAAM,CAClCP,cADkC,CAAN,CAE3BS,0BAF2B,CAEC,gBAFD,CAA7B;AAGA,SAAOf,QAAQ,CACd,CAAE,oBAAF,EAAwB,iBAAxB,CADc,EAEdc,oBAFc,CAAf;AAIA,CATyD,CAApD;AAYP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAME,qBAAqB,GAAGZ,sBAAsB,CACxDS,MAAF,IAAc,MAAM;AACnB,QAAMC,oBAAoB,GAAGD,MAAM,CAClCP,cADkC,CAAN,CAE3BS,0BAF2B,CAEC,gBAFD,CAA7B;AAGA,SACC,CAAC,CAAED,oBAAH,IACA,CAAEd,QAAQ,CACT,CAAE,oBAAF,EAAwB,iBAAxB,CADS,EAETc,oBAFS,CAFX;AAOA,CAZyD,CAApD;AAeP;AACA;AACA;AACA;AAC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BAAsB,CACxDS,MAAF,IAAc,MAAM;AACnB,QAAMyD,eAAe,GAAGzD,MAAM,CAAEL,WAAF,CAAN,CAAsB+D,sBAAtB,CACvB,UADuB,CAAxB;;AAGA,MAAKD,eAAL,EAAuB;AAAA;;AACtB,UAAME,oBAAoB,4BAAG3D,MAAM,CAAEN,SAAF,CAAN,CAC3BkE,gBAD2B,CACT,UADS,EACG,aADH,EACkB;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KADlB,CAAH,0DAAG,sBAE1BC,IAF0B,CAElBC,QAAF,IAAgBA,QAAQ,CAACC,IAAT,KAAkBP,eAFd,CAA7B;;AAGA,QAAK,CAAEE,oBAAP,EAA8B;AAC7B,aAAOA,oBAAP;AACA;;AACD,WAAO3D,MAAM,CAAEN,SAAF,CAAN,CAAoBuE,qBAApB,CACN,UADM,EAEN,aAFM,EAGNN,oBAAoB,CAACtB,EAHf,CAAP;AAKA;;AAED,QAAM6B,IAAI,GAAGlE,MAAM,CAAEL,WAAF,CAAN,CAAsBwE,cAAtB,EAAb;;AACA,MAAKD,IAAI,CAACE,IAAV,EAAiB;AAChB,WAAOpE,MAAM,CAAEN,SAAF,CAAN,CAAoB2E,gCAApB,CACNH,IAAI,CAACE,IADC,CAAP;AAGA;;AAED,SAAO,IAAP;AACA,CA3ByD,CAApD","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\nimport { get, includes, some, flatten, values } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as 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"]}
@@ -925,7 +925,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
925
925
  }
926
926
  @media (min-width: 1080px) {
927
927
  .edit-post-template-top-area .edit-post-template-post-title {
928
- max-width: none;
928
+ max-width: 400px;
929
929
  }
930
930
  }
931
931
 
@@ -1415,11 +1415,6 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
1415
1415
  display: flex;
1416
1416
  justify-content: flex-end;
1417
1417
  }
1418
- @media (min-width: 782px) {
1419
- .edit-post-editor__inserter-panel-header {
1420
- display: none;
1421
- }
1422
- }
1423
1418
 
1424
1419
  .edit-post-editor__inserter-panel-content,
1425
1420
  .edit-post-editor__list-view-panel-content {
@@ -1772,37 +1767,47 @@ h2.edit-post-template-summary__title {
1772
1767
  flex-grow: 1;
1773
1768
  }
1774
1769
 
1775
- .edit-post-welcome-guide {
1770
+ .edit-post-welcome-guide,
1771
+ .edit-template-welcome-guide {
1776
1772
  width: 312px;
1777
1773
  }
1778
- .edit-post-welcome-guide__image {
1774
+ .edit-post-welcome-guide__image,
1775
+ .edit-template-welcome-guide__image {
1779
1776
  background: #00a0d2;
1780
1777
  margin: 0 0 16px;
1781
1778
  }
1782
- .edit-post-welcome-guide__image > img {
1779
+ .edit-post-welcome-guide__image > img,
1780
+ .edit-template-welcome-guide__image > img {
1783
1781
  display: block;
1784
1782
  max-width: 100%;
1785
1783
  -o-object-fit: cover;
1786
1784
  object-fit: cover;
1787
1785
  }
1788
- .edit-post-welcome-guide__heading {
1786
+ .edit-post-welcome-guide__heading,
1787
+ .edit-template-welcome-guide__heading {
1789
1788
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
1790
1789
  font-size: 24px;
1791
1790
  line-height: 1.4;
1792
1791
  margin: 16px 0 16px 0;
1793
1792
  padding: 0 32px;
1794
1793
  }
1795
- .edit-post-welcome-guide__text {
1794
+ .edit-post-welcome-guide__text,
1795
+ .edit-template-welcome-guide__text {
1796
1796
  font-size: 13px;
1797
1797
  line-height: 1.4;
1798
1798
  margin: 0 0 24px 0;
1799
1799
  padding: 0 32px;
1800
1800
  }
1801
- .edit-post-welcome-guide__inserter-icon {
1801
+ .edit-post-welcome-guide__inserter-icon,
1802
+ .edit-template-welcome-guide__inserter-icon {
1802
1803
  margin: 0 4px;
1803
1804
  vertical-align: text-top;
1804
1805
  }
1805
1806
 
1807
+ .edit-template-welcome-guide .components-button svg {
1808
+ fill: #fff;
1809
+ }
1810
+
1806
1811
  /**
1807
1812
  * Animations
1808
1813
  */
@@ -1858,7 +1863,6 @@ body.block-editor-page .media-frame select.attachment-filters:last-of-type {
1858
1863
  }
1859
1864
 
1860
1865
  .edit-post-header,
1861
- .edit-post-visual-editor,
1862
1866
  .edit-post-text-editor,
1863
1867
  .edit-post-sidebar,
1864
1868
  .editor-post-publish-panel,
@@ -1870,9 +1874,6 @@ body.block-editor-page .media-frame select.attachment-filters:last-of-type {
1870
1874
  .edit-post-header *,
1871
1875
  .edit-post-header *::before,
1872
1876
  .edit-post-header *::after,
1873
- .edit-post-visual-editor *,
1874
- .edit-post-visual-editor *::before,
1875
- .edit-post-visual-editor *::after,
1876
1877
  .edit-post-text-editor *,
1877
1878
  .edit-post-text-editor *::before,
1878
1879
  .edit-post-text-editor *::after,
@@ -925,7 +925,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
925
925
  }
926
926
  @media (min-width: 1080px) {
927
927
  .edit-post-template-top-area .edit-post-template-post-title {
928
- max-width: none;
928
+ max-width: 400px;
929
929
  }
930
930
  }
931
931
 
@@ -1415,11 +1415,6 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
1415
1415
  display: flex;
1416
1416
  justify-content: flex-end;
1417
1417
  }
1418
- @media (min-width: 782px) {
1419
- .edit-post-editor__inserter-panel-header {
1420
- display: none;
1421
- }
1422
- }
1423
1418
 
1424
1419
  .edit-post-editor__inserter-panel-content,
1425
1420
  .edit-post-editor__list-view-panel-content {
@@ -1776,37 +1771,47 @@ h2.edit-post-template-summary__title {
1776
1771
  flex-grow: 1;
1777
1772
  }
1778
1773
 
1779
- .edit-post-welcome-guide {
1774
+ .edit-post-welcome-guide,
1775
+ .edit-template-welcome-guide {
1780
1776
  width: 312px;
1781
1777
  }
1782
- .edit-post-welcome-guide__image {
1778
+ .edit-post-welcome-guide__image,
1779
+ .edit-template-welcome-guide__image {
1783
1780
  background: #00a0d2;
1784
1781
  margin: 0 0 16px;
1785
1782
  }
1786
- .edit-post-welcome-guide__image > img {
1783
+ .edit-post-welcome-guide__image > img,
1784
+ .edit-template-welcome-guide__image > img {
1787
1785
  display: block;
1788
1786
  max-width: 100%;
1789
1787
  -o-object-fit: cover;
1790
1788
  object-fit: cover;
1791
1789
  }
1792
- .edit-post-welcome-guide__heading {
1790
+ .edit-post-welcome-guide__heading,
1791
+ .edit-template-welcome-guide__heading {
1793
1792
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
1794
1793
  font-size: 24px;
1795
1794
  line-height: 1.4;
1796
1795
  margin: 16px 0 16px 0;
1797
1796
  padding: 0 32px;
1798
1797
  }
1799
- .edit-post-welcome-guide__text {
1798
+ .edit-post-welcome-guide__text,
1799
+ .edit-template-welcome-guide__text {
1800
1800
  font-size: 13px;
1801
1801
  line-height: 1.4;
1802
1802
  margin: 0 0 24px 0;
1803
1803
  padding: 0 32px;
1804
1804
  }
1805
- .edit-post-welcome-guide__inserter-icon {
1805
+ .edit-post-welcome-guide__inserter-icon,
1806
+ .edit-template-welcome-guide__inserter-icon {
1806
1807
  margin: 0 4px;
1807
1808
  vertical-align: text-top;
1808
1809
  }
1809
1810
 
1811
+ .edit-template-welcome-guide .components-button svg {
1812
+ fill: #fff;
1813
+ }
1814
+
1810
1815
  /**
1811
1816
  * Animations
1812
1817
  */
@@ -1862,7 +1867,6 @@ body.block-editor-page .media-frame select.attachment-filters:last-of-type {
1862
1867
  }
1863
1868
 
1864
1869
  .edit-post-header,
1865
- .edit-post-visual-editor,
1866
1870
  .edit-post-text-editor,
1867
1871
  .edit-post-sidebar,
1868
1872
  .editor-post-publish-panel,
@@ -1874,9 +1878,6 @@ body.block-editor-page .media-frame select.attachment-filters:last-of-type {
1874
1878
  .edit-post-header *,
1875
1879
  .edit-post-header *::before,
1876
1880
  .edit-post-header *::after,
1877
- .edit-post-visual-editor *,
1878
- .edit-post-visual-editor *::before,
1879
- .edit-post-visual-editor *::after,
1880
1881
  .edit-post-text-editor *,
1881
1882
  .edit-post-text-editor *::before,
1882
1883
  .edit-post-text-editor *::after,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-post",
3
- "version": "5.0.26",
3
+ "version": "5.1.0",
4
4
  "description": "Edit Post module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,31 +27,31 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/a11y": "^3.2.4",
31
- "@wordpress/api-fetch": "^5.2.6",
32
- "@wordpress/block-editor": "^8.0.16",
33
- "@wordpress/block-library": "^6.0.25",
34
- "@wordpress/blocks": "^11.1.5",
35
- "@wordpress/components": "^19.2.2",
36
- "@wordpress/compose": "^5.0.7",
37
- "@wordpress/core-data": "^4.0.9",
38
- "@wordpress/data": "^6.1.5",
39
- "@wordpress/data-controls": "^2.2.8",
40
- "@wordpress/editor": "^12.0.20",
41
- "@wordpress/element": "^4.0.4",
42
- "@wordpress/hooks": "^3.2.2",
43
- "@wordpress/i18n": "^4.2.4",
44
- "@wordpress/icons": "^6.1.1",
45
- "@wordpress/interface": "^4.1.17",
46
- "@wordpress/keyboard-shortcuts": "^3.0.7",
47
- "@wordpress/keycodes": "^3.2.4",
48
- "@wordpress/media-utils": "^3.0.5",
49
- "@wordpress/notices": "^3.2.8",
50
- "@wordpress/plugins": "^4.0.7",
51
- "@wordpress/primitives": "^3.0.4",
52
- "@wordpress/url": "^3.3.1",
53
- "@wordpress/viewport": "^4.0.7",
54
- "@wordpress/warning": "^2.2.2",
30
+ "@wordpress/a11y": "^3.3.0",
31
+ "@wordpress/api-fetch": "^6.0.0",
32
+ "@wordpress/block-editor": "^8.1.0",
33
+ "@wordpress/block-library": "^6.1.0",
34
+ "@wordpress/blocks": "^11.2.0",
35
+ "@wordpress/components": "^19.3.0",
36
+ "@wordpress/compose": "^5.1.0",
37
+ "@wordpress/core-data": "^4.1.0",
38
+ "@wordpress/data": "^6.2.0",
39
+ "@wordpress/data-controls": "^2.3.0",
40
+ "@wordpress/editor": "^12.1.0",
41
+ "@wordpress/element": "^4.1.0",
42
+ "@wordpress/hooks": "^3.3.0",
43
+ "@wordpress/i18n": "^4.3.0",
44
+ "@wordpress/icons": "^6.2.0",
45
+ "@wordpress/interface": "^4.2.0",
46
+ "@wordpress/keyboard-shortcuts": "^3.1.0",
47
+ "@wordpress/keycodes": "^3.3.0",
48
+ "@wordpress/media-utils": "^3.1.0",
49
+ "@wordpress/notices": "^3.3.0",
50
+ "@wordpress/plugins": "^4.1.0",
51
+ "@wordpress/primitives": "^3.1.0",
52
+ "@wordpress/url": "^3.4.0",
53
+ "@wordpress/viewport": "^4.1.0",
54
+ "@wordpress/warning": "^2.3.0",
55
55
  "classnames": "^2.3.1",
56
56
  "lodash": "^4.17.21",
57
57
  "memize": "^1.1.0",
@@ -61,5 +61,5 @@
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "gitHead": "cac1a1f3c854fc282d67b91a74936c3fe42d7d0a"
64
+ "gitHead": "d95ccb9366e249133cdb1d7b25c382446b9ee502"
65
65
  }
@@ -6,36 +6,59 @@ import { includes, map, without } from 'lodash';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { useContext, useMemo } from '@wordpress/element';
10
- import { withSelect, withDispatch } from '@wordpress/data';
11
- import { compose, withInstanceId } from '@wordpress/compose';
9
+ import { useMemo, useCallback } from '@wordpress/element';
10
+ import { useDispatch, useSelect } from '@wordpress/data';
11
+ import { useInstanceId } from '@wordpress/compose';
12
12
  import { CheckboxControl } from '@wordpress/components';
13
+ import { store as editorStore } from '@wordpress/editor';
13
14
 
14
15
  /**
15
16
  * Internal dependencies
16
17
  */
17
18
  import BlockTypesChecklist from './checklist';
18
- import EditPostSettings from '../edit-post-settings';
19
19
  import { store as editPostStore } from '../../store';
20
20
 
21
- function BlockManagerCategory( {
22
- instanceId,
23
- title,
24
- blockTypes,
25
- hiddenBlockTypes,
26
- toggleVisible,
27
- toggleAllVisible,
28
- } ) {
29
- const settings = useContext( EditPostSettings );
30
- const { allowedBlockTypes } = settings;
21
+ function BlockManagerCategory( { title, blockTypes } ) {
22
+ const instanceId = useInstanceId( BlockManagerCategory );
23
+ const { defaultAllowedBlockTypes, hiddenBlockTypes } = useSelect(
24
+ ( select ) => {
25
+ const { getEditorSettings } = select( editorStore );
26
+ const { getPreference } = select( editPostStore );
27
+ return {
28
+ defaultAllowedBlockTypes: getEditorSettings()
29
+ .defaultAllowedBlockTypes,
30
+ hiddenBlockTypes: getPreference( 'hiddenBlockTypes' ),
31
+ };
32
+ },
33
+ []
34
+ );
31
35
  const filteredBlockTypes = useMemo( () => {
32
- if ( allowedBlockTypes === true ) {
36
+ if ( defaultAllowedBlockTypes === true ) {
33
37
  return blockTypes;
34
38
  }
35
39
  return blockTypes.filter( ( { name } ) => {
36
- return includes( allowedBlockTypes || [], name );
40
+ return includes( defaultAllowedBlockTypes || [], name );
37
41
  } );
38
- }, [ allowedBlockTypes, blockTypes ] );
42
+ }, [ defaultAllowedBlockTypes, blockTypes ] );
43
+ const { showBlockTypes, hideBlockTypes } = useDispatch( editPostStore );
44
+ const toggleVisible = useCallback( ( blockName, nextIsChecked ) => {
45
+ if ( nextIsChecked ) {
46
+ showBlockTypes( blockName );
47
+ } else {
48
+ hideBlockTypes( blockName );
49
+ }
50
+ }, [] );
51
+ const toggleAllVisible = useCallback(
52
+ ( nextIsChecked ) => {
53
+ const blockNames = map( blockTypes, 'name' );
54
+ if ( nextIsChecked ) {
55
+ showBlockTypes( blockNames );
56
+ } else {
57
+ hideBlockTypes( blockNames );
58
+ }
59
+ },
60
+ [ blockTypes ]
61
+ );
39
62
 
40
63
  if ( ! filteredBlockTypes.length ) {
41
64
  return null;
@@ -81,34 +104,4 @@ function BlockManagerCategory( {
81
104
  );
82
105
  }
83
106
 
84
- export default compose( [
85
- withInstanceId,
86
- withSelect( ( select ) => {
87
- const { getPreference } = select( editPostStore );
88
-
89
- return {
90
- hiddenBlockTypes: getPreference( 'hiddenBlockTypes' ),
91
- };
92
- } ),
93
- withDispatch( ( dispatch, ownProps ) => {
94
- const { showBlockTypes, hideBlockTypes } = dispatch( editPostStore );
95
-
96
- return {
97
- toggleVisible( blockName, nextIsChecked ) {
98
- if ( nextIsChecked ) {
99
- showBlockTypes( blockName );
100
- } else {
101
- hideBlockTypes( blockName );
102
- }
103
- },
104
- toggleAllVisible( nextIsChecked ) {
105
- const blockNames = map( ownProps.blockTypes, 'name' );
106
- if ( nextIsChecked ) {
107
- showBlockTypes( blockNames );
108
- } else {
109
- hideBlockTypes( blockNames );
110
- }
111
- },
112
- };
113
- } ),
114
- ] )( BlockManagerCategory );
107
+ export default BlockManagerCategory;
@@ -27,13 +27,19 @@ export default class Header extends Component {
27
27
  }
28
28
 
29
29
  componentDidMount() {
30
- Keyboard.addListener( 'keyboardDidShow', this.keyboardDidShow );
31
- Keyboard.addListener( 'keyboardDidHide', this.keyboardDidHide );
30
+ this.keyboardShowSubscription = Keyboard.addListener(
31
+ 'keyboardDidShow',
32
+ this.keyboardDidShow
33
+ );
34
+ this.keyboardHideSubscription = Keyboard.addListener(
35
+ 'keyboardDidHide',
36
+ this.keyboardDidHide
37
+ );
32
38
  }
33
39
 
34
40
  componentWillUnmount() {
35
- Keyboard.removeListener( 'keyboardDidShow', this.keyboardDidShow );
36
- Keyboard.removeListener( 'keyboardDidHide', this.keyboardDidHide );
41
+ this.keyboardShowSubscription.remove();
42
+ this.keyboardHideSubscription.remove();
37
43
  }
38
44
 
39
45
  keyboardDidShow() {
@@ -41,7 +41,7 @@
41
41
  }
42
42
 
43
43
  @include break-xlarge() {
44
- max-width: none;
44
+ max-width: 400px;
45
45
  }
46
46
  }
47
47
  }
@@ -1,7 +1,7 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`KeyboardShortcutHelpModal should match snapshot when the modal is active 1`] = `
4
- <Modal
4
+ <ForwardRef(Modal)
5
5
  className="edit-post-keyboard-shortcut-help-modal"
6
6
  closeLabel="Close"
7
7
  onRequestClose={[Function]}
@@ -80,7 +80,7 @@ exports[`KeyboardShortcutHelpModal should match snapshot when the modal is activ
80
80
  }
81
81
  title="Text formatting"
82
82
  />
83
- </Modal>
83
+ </ForwardRef(Modal)>
84
84
  `;
85
85
 
86
86
  exports[`KeyboardShortcutHelpModal should match snapshot when the modal is not active 1`] = `""`;
@@ -16,7 +16,7 @@ import {
16
16
  store as editorStore,
17
17
  } from '@wordpress/editor';
18
18
  import { useSelect, useDispatch } from '@wordpress/data';
19
- import { BlockBreadcrumb } from '@wordpress/block-editor';
19
+ import { BlockBreadcrumb, BlockStyles } from '@wordpress/block-editor';
20
20
  import { Button, ScrollLock, Popover } from '@wordpress/components';
21
21
  import { useViewportMatch } from '@wordpress/compose';
22
22
  import { PluginArea } from '@wordpress/plugins';
@@ -239,6 +239,7 @@ function Layout( { styles } ) {
239
239
  { isMobileViewport && sidebarIsOpened && (
240
240
  <ScrollLock />
241
241
  ) }
242
+ <BlockStyles.Slot scope="core/block-inspector" />
242
243
  </>
243
244
  }
244
245
  footer={
@@ -53,17 +53,14 @@ class Layout extends Component {
53
53
 
54
54
  componentDidMount() {
55
55
  this._isMounted = true;
56
- SafeArea.addEventListener(
56
+ this.safeAreaSubscription = SafeArea.addEventListener(
57
57
  'safeAreaInsetsForRootViewDidChange',
58
58
  this.onSafeAreaInsetsUpdate
59
59
  );
60
60
  }
61
61
 
62
62
  componentWillUnmount() {
63
- SafeArea.removeEventListener(
64
- 'safeAreaInsetsForRootViewDidChange',
65
- this.onSafeAreaInsetsUpdate
66
- );
63
+ this.safeAreaSubscription?.remove();
67
64
  this._isMounted = false;
68
65
  }
69
66
 
@@ -55,19 +55,14 @@ import BlockManager from '../block-manager';
55
55
  const MODAL_NAME = 'edit-post/preferences';
56
56
  const PREFERENCES_MENU = 'preferences-menu';
57
57
 
58
- function NavigationButton( {
59
- as: Tag = Button,
60
- path,
61
- isBack = false,
62
- ...props
63
- } ) {
64
- const navigator = useNavigator();
65
- return (
66
- <Tag
67
- onClick={ () => navigator.push( path, { isBack } ) }
68
- { ...props }
69
- />
70
- );
58
+ function NavigationButton( { as: Tag = Button, path, ...props } ) {
59
+ const { push } = useNavigator();
60
+ return <Tag onClick={ () => push( path ) } { ...props } />;
61
+ }
62
+
63
+ function NavigationBackButton( { as: Tag = Button, ...props } ) {
64
+ const { pop } = useNavigator();
65
+ return <Tag onClick={ pop } { ...props } />;
71
66
  }
72
67
 
73
68
  export default function PreferencesModal() {
@@ -376,12 +371,10 @@ export default function PreferencesModal() {
376
371
  size="small"
377
372
  gap="6"
378
373
  >
379
- <NavigationButton
380
- path="/"
374
+ <NavigationBackButton
381
375
  icon={
382
376
  isRTL() ? chevronRight : chevronLeft
383
377
  }
384
- isBack
385
378
  aria-label={ __(
386
379
  'Navigate to the previous view'
387
380
  ) }