@wordpress/edit-post 6.1.0 → 6.3.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.
- package/CHANGELOG.md +4 -0
- package/build/components/header/plugin-more-menu-item/index.js +5 -0
- package/build/components/header/plugin-more-menu-item/index.js.map +1 -1
- package/build/components/header/template-title/delete-template.js +3 -1
- package/build/components/header/template-title/delete-template.js.map +1 -1
- package/build/components/sidebar/post-link/index.js +1 -1
- package/build/components/sidebar/post-link/index.js.map +1 -1
- package/build/components/visual-editor/index.js +3 -3
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/editor.js +4 -6
- package/build/editor.js.map +1 -1
- package/build/index.js +5 -0
- package/build/index.js.map +1 -1
- package/build/index.native.js +15 -0
- package/build/index.native.js.map +1 -1
- package/build/store/actions.js +99 -74
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +7 -10
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +0 -118
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +95 -34
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/header/plugin-more-menu-item/index.js +4 -0
- package/build-module/components/header/plugin-more-menu-item/index.js.map +1 -1
- package/build-module/components/header/template-title/delete-template.js +3 -1
- package/build-module/components/header/template-title/delete-template.js.map +1 -1
- package/build-module/components/sidebar/post-link/index.js +1 -1
- package/build-module/components/sidebar/post-link/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +3 -3
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/editor.js +3 -6
- package/build-module/editor.js.map +1 -1
- package/build-module/index.js +5 -0
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +13 -0
- package/build-module/index.native.js.map +1 -1
- package/build-module/store/actions.js +92 -68
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +7 -10
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +1 -115
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +89 -28
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +1 -4
- package/build-style/style.css +1 -4
- package/package.json +27 -26
- package/src/components/header/plugin-more-menu-item/index.js +2 -0
- package/src/components/header/template-title/delete-template.js +3 -1
- package/src/components/sidebar/post-link/index.js +1 -1
- package/src/components/visual-editor/index.js +5 -3
- package/src/editor.js +3 -8
- package/src/index.js +5 -0
- package/src/index.native.js +14 -0
- package/src/store/actions.js +87 -42
- package/src/store/index.js +7 -11
- package/src/store/reducer.js +1 -106
- package/src/store/selectors.js +124 -50
- package/src/store/test/actions.js +89 -46
- package/src/store/test/reducer.js +0 -135
- package/src/store/test/selectors.js +0 -174
- package/src/style.scss +0 -4
- package/build/store/defaults.js +0 -19
- package/build/store/defaults.js.map +0 -1
- package/build-module/store/defaults.js +0 -12
- package/build-module/store/defaults.js.map +0 -1
- package/src/store/defaults.js +0 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/store/selectors.js"],"names":["createSelector","get","includes","some","flatten","values","createRegistrySelector","store","interfaceStore","preferencesStore","coreStore","editorStore","EMPTY_ARRAY","getEditorMode","state","getPreference","isEditorSidebarOpened","select","activeGeneralSidebar","getActiveComplementaryArea","isPluginSidebarOpened","getActiveGeneralSidebarName","MIGRATED_KEYS","getPreferences","editPostPreferences","preferences","preferenceStorePreferences","reduce","accumulatedPrefs","preferenceKey","value","defaultValue","isMigratedKey","undefined","getHiddenBlockTypes","isPublishSidebarOpened","publishSidebarActive","isEditorPanelRemoved","panelName","removedPanels","isEditorPanelEnabled","panels","isEditorPanelOpened","isModalActive","modalName","activeModal","isFeatureActive","feature","isPluginItemPinned","pluginName","isItemPinned","getActiveMetaBoxLocations","Object","keys","metaBoxes","locations","filter","location","isMetaBoxLocationActive","isMetaBoxLocationVisible","getMetaBoxesPerLocation","id","length","getAllMetaBoxes","hasMetaBoxes","isSavingMetaBoxes","isSaving","__experimentalGetPreviewDeviceType","deviceType","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","isEditingTemplate","areMetaBoxesInitialized","initialized","getEditedPostTemplate","currentTemplate","getEditedPostAttribute","templateWithSameSlug","getEntityRecords","per_page","find","template","slug","getEditedEntityRecord","post","getCurrentPost","link","__experimentalGetTemplateForLink"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,cAAP,MAA2B,QAA3B;AACA,SAASC,GAAT,EAAcC,QAAd,EAAwBC,IAAxB,EAA8BC,OAA9B,EAAuCC,MAAvC,QAAqD,QAArD;AAEA;AACA;AACA;;AACA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,sBAAxC;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,wBAA1C;AACA,SAASF,KAAK,IAAIG,SAAlB,QAAmC,sBAAnC;AACA,SAASH,KAAK,IAAII,WAAlB,QAAqC,mBAArC;AAEA,MAAMC,WAAW,GAAG,EAApB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAwBC,KAAxB,EAAgC;AACtC,SAAOC,aAAa,CAAED,KAAF,EAAS,YAAT,EAAuB,QAAvB,CAApB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAME,qBAAqB,GAAGV,sBAAsB,CACxDW,MAAF,IAAc,MAAM;AACnB,QAAMC,oBAAoB,GAAGD,MAAM,CAClCT,cADkC,CAAN,CAE3BW,0BAF2B,CAEC,gBAFD,CAA7B;AAGA,SAAOjB,QAAQ,CACd,CAAE,oBAAF,EAAwB,iBAAxB,CADc,EAEdgB,oBAFc,CAAf;AAIA,CATyD,CAApD;AAYP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAME,qBAAqB,GAAGd,sBAAsB,CACxDW,MAAF,IAAc,MAAM;AACnB,QAAMC,oBAAoB,GAAGD,MAAM,CAClCT,c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AAoB,4BAAGlE,MAAM,CAAEP,SAAF,CAAN,CAC3B0E,gBAD2B,CACT,UADS,EACG,aADH,EACkB;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KADlB,CAAH,0DAAG,sBAE1BC,IAF0B,CAElBC,QAAF,IAAgBA,QAAQ,CAACC,IAAT,KAAkBP,eAFd,CAA7B;;AAGA,QAAK,CAAEE,oBAAP,EAA8B;AAC7B,aAAOA,oBAAP;AACA;;AACD,WAAOlE,MAAM,CAAEP,SAAF,CAAN,CAAoB+E,qBAApB,CACN,UADM,EAEN,aAFM,EAGNN,oBAAoB,CAACtB,EAHf,CAAP;AAKA;;AAED,QAAM6B,IAAI,GAAGzE,MAAM,CAAEN,WAAF,CAAN,CAAsBgF,cAAtB,EAAb;;AACA,MAAKD,IAAI,CAACE,IAAV,EAAiB;AAChB,WAAO3E,MAAM,CAAEP,SAAF,CAAN,CAAoBmF,gCAApB,CACNH,IAAI,CAACE,IADC,CAAP;AAGA;;AAED,SAAO,IAAP;AACA,CA3ByD,CAApD","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\nimport { get, includes, some, flatten, values } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport function getEditorMode( state ) {\n\treturn getPreference( state, 'editorMode', 'visual' );\n}\n\n/**\n * Returns true if the editor sidebar is opened.\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether the editor sidebar is opened.\n */\nexport const isEditorSidebarOpened = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst activeGeneralSidebar = select(\n\t\t\tinterfaceStore\n\t\t).getActiveComplementaryArea( 'core/edit-post' );\n\t\treturn includes(\n\t\t\t[ 'edit-post/document', 'edit-post/block' ],\n\t\t\tactiveGeneralSidebar\n\t\t);\n\t}\n);\n\n/**\n * Returns true if the plugin sidebar is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the plugin sidebar is opened.\n */\nexport const isPluginSidebarOpened = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst activeGeneralSidebar = select(\n\t\t\tinterfaceStore\n\t\t).getActiveComplementaryArea( 'core/edit-post' );\n\t\treturn (\n\t\t\t!! activeGeneralSidebar &&\n\t\t\t! includes(\n\t\t\t\t[ 'edit-post/document', 'edit-post/block' ],\n\t\t\t\tactiveGeneralSidebar\n\t\t\t)\n\t\t);\n\t}\n);\n\n/**\n * Returns the current active general sidebar name, or null if there is no\n * general sidebar active. The active general sidebar is a unique name to\n * identify either an editor or plugin sidebar.\n *\n * Examples:\n *\n * - `edit-post/document`\n * - `my-plugin/insert-image-sidebar`\n *\n * @param {Object} state Global application state.\n *\n * @return {?string} Active general sidebar name.\n */\nexport const getActiveGeneralSidebarName = createRegistrySelector(\n\t( select ) => () => {\n\t\treturn select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t'core/edit-post'\n\t\t);\n\t}\n);\n\n// The current list of preference keys that have been migrated to the\n// preferences package.\nconst MIGRATED_KEYS = [ 'hiddenBlockTypes' ];\n\n/**\n * Returns the preferences (these preferences are persisted locally).\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Preferences Object.\n */\nexport const getPreferences = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst editPostPreferences = state.preferences;\n\n\t\t// Some preferences now exist in the preferences store.\n\t\t// Fetch them so that they can be merged into the post\n\t\t// editor preferences.\n\t\tconst preferenceStorePreferences = MIGRATED_KEYS.reduce(\n\t\t\t( accumulatedPrefs, preferenceKey ) => {\n\t\t\t\tconst value = select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\tpreferenceKey\n\t\t\t\t);\n\n\t\t\t\treturn {\n\t\t\t\t\t...accumulatedPrefs,\n\t\t\t\t\t[ preferenceKey ]: value,\n\t\t\t\t};\n\t\t\t},\n\t\t\t{}\n\t\t);\n\n\t\treturn {\n\t\t\t...editPostPreferences,\n\t\t\t...preferenceStorePreferences,\n\t\t};\n\t}\n);\n\n/**\n *\n * @param {Object} state Global application state.\n * @param {string} preferenceKey Preference Key.\n * @param {*} defaultValue Default Value.\n *\n * @return {*} Preference Value.\n */\nexport function getPreference( state, preferenceKey, defaultValue ) {\n\t// Avoid using the `getPreferences` registry selector where possible.\n\tconst isMigratedKey = MIGRATED_KEYS.includes( preferenceKey );\n\tconst preferences = isMigratedKey\n\t\t? getPreferences( state )\n\t\t: state.preferences;\n\tconst value = preferences[ preferenceKey ];\n\treturn value === undefined ? defaultValue : value;\n}\n\n/**\n * Returns an array of blocks that are hidden.\n *\n * @return {Array} A list of the hidden block types\n */\nexport const getHiddenBlockTypes = createRegistrySelector( ( select ) => () => {\n\treturn (\n\t\tselect( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\t'hiddenBlockTypes'\n\t\t) ?? EMPTY_ARRAY\n\t);\n} );\n\n/**\n * Returns true if the publish sidebar is opened.\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether the publish sidebar is open.\n */\nexport function isPublishSidebarOpened( state ) {\n\treturn state.publishSidebarActive;\n}\n\n/**\n * Returns true if the given panel was programmatically removed, or false otherwise.\n * All panels are not removed by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is removed.\n */\nexport function isEditorPanelRemoved( state, panelName ) {\n\treturn includes( state.removedPanels, panelName );\n}\n\n/**\n * Returns true if the given panel is enabled, or false otherwise. Panels are\n * enabled by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is enabled.\n */\nexport function isEditorPanelEnabled( state, panelName ) {\n\tconst panels = getPreference( state, 'panels' );\n\n\treturn (\n\t\t! isEditorPanelRemoved( state, panelName ) &&\n\t\tget( panels, [ panelName, 'enabled' ], true )\n\t);\n}\n\n/**\n * Returns true if the given panel is open, or false otherwise. Panels are\n * closed by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is open.\n */\nexport function isEditorPanelOpened( state, panelName ) {\n\tconst panels = getPreference( state, 'panels' );\n\treturn (\n\t\tget( panels, [ panelName ] ) === true ||\n\t\tget( panels, [ panelName, 'opened' ] ) === true\n\t);\n}\n\n/**\n * Returns true if a modal is active, or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} modalName A string that uniquely identifies the modal.\n *\n * @return {boolean} Whether the modal is active.\n */\nexport function isModalActive( state, modalName ) {\n\treturn state.activeModal === modalName;\n}\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} feature Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( state, feature ) => {\n\t\treturn !! select( preferencesStore ).get( 'core/edit-post', feature );\n\t}\n);\n\n/**\n * Returns true if the plugin item is pinned to the header.\n * When the value is not set it defaults to true.\n *\n * @param {Object} state Global application state.\n * @param {string} pluginName Plugin item name.\n *\n * @return {boolean} Whether the plugin item is pinned.\n */\nexport const isPluginItemPinned = createRegistrySelector(\n\t( select ) => ( state, pluginName ) => {\n\t\treturn select( interfaceStore ).isItemPinned(\n\t\t\t'core/edit-post',\n\t\t\tpluginName\n\t\t);\n\t}\n);\n\n/**\n * Returns an array of active meta box locations.\n *\n * @param {Object} state Post editor state.\n *\n * @return {string[]} Active meta box locations.\n */\nexport const getActiveMetaBoxLocations = createSelector(\n\t( state ) => {\n\t\treturn Object.keys( state.metaBoxes.locations ).filter( ( location ) =>\n\t\t\tisMetaBoxLocationActive( state, location )\n\t\t);\n\t},\n\t( state ) => [ state.metaBoxes.locations ]\n);\n\n/**\n * Returns true if a metabox location is active and visible\n *\n * @param {Object} state Post editor state.\n * @param {string} location Meta box location to test.\n *\n * @return {boolean} Whether the meta box location is active and visible.\n */\nexport function isMetaBoxLocationVisible( state, location ) {\n\treturn (\n\t\tisMetaBoxLocationActive( state, location ) &&\n\t\tsome( getMetaBoxesPerLocation( state, location ), ( { id } ) => {\n\t\t\treturn isEditorPanelEnabled( state, `meta-box-${ id }` );\n\t\t} )\n\t);\n}\n\n/**\n * Returns true if there is an active meta box in the given location, or false\n * otherwise.\n *\n * @param {Object} state Post editor state.\n * @param {string} location Meta box location to test.\n *\n * @return {boolean} Whether the meta box location is active.\n */\nexport function isMetaBoxLocationActive( state, location ) {\n\tconst metaBoxes = getMetaBoxesPerLocation( state, location );\n\treturn !! metaBoxes && metaBoxes.length !== 0;\n}\n\n/**\n * Returns the list of all the available meta boxes for a given location.\n *\n * @param {Object} state Global application state.\n * @param {string} location Meta box location to test.\n *\n * @return {?Array} List of meta boxes.\n */\nexport function getMetaBoxesPerLocation( state, location ) {\n\treturn state.metaBoxes.locations[ location ];\n}\n\n/**\n * Returns the list of all the available meta boxes.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} List of meta boxes.\n */\nexport const getAllMetaBoxes = createSelector(\n\t( state ) => {\n\t\treturn flatten( values( state.metaBoxes.locations ) );\n\t},\n\t( state ) => [ state.metaBoxes.locations ]\n);\n\n/**\n * Returns true if the post is using Meta Boxes\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether there are metaboxes or not.\n */\nexport function hasMetaBoxes( state ) {\n\treturn getActiveMetaBoxLocations( state ).length > 0;\n}\n\n/**\n * Returns true if the Meta Boxes are being saved.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the metaboxes are being saved.\n */\nexport function isSavingMetaBoxes( state ) {\n\treturn state.metaBoxes.isSaving;\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst {\n\t\trootClientId,\n\t\tinsertionIndex,\n\t\tfilterValue,\n\t} = state.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns true if the template editing mode is enabled.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether we're editing the template.\n */\nexport function isEditingTemplate( state ) {\n\treturn state.isEditingTemplate;\n}\n\n/**\n * Returns true if meta boxes are initialized.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether meta boxes are initialized.\n */\nexport function areMetaBoxesInitialized( state ) {\n\treturn state.metaBoxes.initialized;\n}\n\n/**\n * Retrieves the template of the currently edited post.\n *\n * @return {Object?} Post Template.\n */\nexport const getEditedPostTemplate = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst currentTemplate = select( editorStore ).getEditedPostAttribute(\n\t\t\t'template'\n\t\t);\n\t\tif ( currentTemplate ) {\n\t\t\tconst templateWithSameSlug = select( coreStore )\n\t\t\t\t.getEntityRecords( 'postType', 'wp_template', { per_page: -1 } )\n\t\t\t\t?.find( ( template ) => template.slug === currentTemplate );\n\t\t\tif ( ! templateWithSameSlug ) {\n\t\t\t\treturn templateWithSameSlug;\n\t\t\t}\n\t\t\treturn select( coreStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\ttemplateWithSameSlug.id\n\t\t\t);\n\t\t}\n\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tif ( post.link ) {\n\t\t\treturn select( coreStore ).__experimentalGetTemplateForLink(\n\t\t\t\tpost.link\n\t\t\t);\n\t\t}\n\n\t\treturn null;\n\t}\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/store/selectors.js"],"names":["createSelector","includes","some","flatten","values","createRegistrySelector","store","interfaceStore","preferencesStore","coreStore","editorStore","deprecated","EMPTY_ARRAY","EMPTY_OBJECT","getEditorMode","select","get","isEditorSidebarOpened","activeGeneralSidebar","getActiveComplementaryArea","isPluginSidebarOpened","getActiveGeneralSidebarName","convertPanelsToOldFormat","inactivePanels","openPanels","panelsWithEnabledState","reduce","accumulatedPanels","panelName","enabled","panels","currentPanelState","opened","getPreferences","since","alternative","preferences","accumulatedPrefs","preferenceKey","value","getPreference","state","defaultValue","undefined","getHiddenBlockTypes","isPublishSidebarOpened","publishSidebarActive","isEditorPanelRemoved","removedPanels","isEditorPanelEnabled","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,QAAT,EAAmBC,IAAnB,EAAyBC,OAAzB,EAAkCC,M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G5E,MAAM,CAAEN,SAAF,CAAN,CAC3BmF,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,WAAO5E,MAAM,CAAEN,SAAF,CAAN,CAAoBwF,qBAApB,CACN,UADM,EAEN,aAFM,EAGNN,oBAAoB,CAACtB,EAHf,CAAP;AAKA;;AAED,QAAM6B,IAAI,GAAGnF,MAAM,CAAEL,WAAF,CAAN,CAAsByF,cAAtB,EAAb;;AACA,MAAKD,IAAI,CAACE,IAAV,EAAiB;AAChB,WAAOrF,MAAM,CAAEN,SAAF,CAAN,CAAoB4F,gCAApB,CACNH,IAAI,CAACE,IADC,CAAP;AAGA;;AAED,SAAO,IAAP;AACA,CA3ByD,CAApD","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\nimport { 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';\nimport deprecated from '@wordpress/deprecated';\n\nconst EMPTY_ARRAY = [];\nconst EMPTY_OBJECT = {};\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector( ( select ) => () =>\n\tselect( preferencesStore ).get( 'core/edit-post', 'editorMode' ) ?? 'visual'\n);\n\n/**\n * Returns true if the editor sidebar is opened.\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether the editor sidebar is opened.\n */\nexport const isEditorSidebarOpened = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst activeGeneralSidebar = select(\n\t\t\tinterfaceStore\n\t\t).getActiveComplementaryArea( 'core/edit-post' );\n\t\treturn includes(\n\t\t\t[ 'edit-post/document', 'edit-post/block' ],\n\t\t\tactiveGeneralSidebar\n\t\t);\n\t}\n);\n\n/**\n * Returns true if the plugin sidebar is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the plugin sidebar is opened.\n */\nexport const isPluginSidebarOpened = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst activeGeneralSidebar = select(\n\t\t\tinterfaceStore\n\t\t).getActiveComplementaryArea( 'core/edit-post' );\n\t\treturn (\n\t\t\t!! activeGeneralSidebar &&\n\t\t\t! includes(\n\t\t\t\t[ 'edit-post/document', 'edit-post/block' ],\n\t\t\t\tactiveGeneralSidebar\n\t\t\t)\n\t\t);\n\t}\n);\n\n/**\n * Returns the current active general sidebar name, or null if there is no\n * general sidebar active. The active general sidebar is a unique name to\n * identify either an editor or plugin sidebar.\n *\n * Examples:\n *\n * - `edit-post/document`\n * - `my-plugin/insert-image-sidebar`\n *\n * @param {Object} state Global application state.\n *\n * @return {?string} Active general sidebar name.\n */\nexport const getActiveGeneralSidebarName = createRegistrySelector(\n\t( select ) => () => {\n\t\treturn select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t'core/edit-post'\n\t\t);\n\t}\n);\n\n/**\n * Converts panels from the new preferences store format to the old format\n * that the post editor previously used.\n *\n * The resultant converted data should look like this:\n * {\n * panelName: {\n * enabled: false,\n * opened: true,\n * },\n * anotherPanelName: {\n * opened: true\n * },\n * }\n *\n * @param {string[] | undefined} inactivePanels An array of inactive panel names.\n * @param {string[] | undefined} openPanels An array of open panel names.\n *\n * @return {Object} The converted panel data.\n */\nfunction convertPanelsToOldFormat( inactivePanels, openPanels ) {\n\t// First reduce the inactive panels.\n\tconst panelsWithEnabledState = inactivePanels?.reduce(\n\t\t( accumulatedPanels, panelName ) => ( {\n\t\t\t...accumulatedPanels,\n\t\t\t[ panelName ]: {\n\t\t\t\tenabled: false,\n\t\t\t},\n\t\t} ),\n\t\t{}\n\t);\n\n\t// Then reduce the open panels, passing in the result of the previous\n\t// reduction as the initial value so that both open and inactive\n\t// panel state is combined.\n\tconst panels = openPanels?.reduce( ( accumulatedPanels, panelName ) => {\n\t\tconst currentPanelState = accumulatedPanels?.[ panelName ];\n\t\treturn {\n\t\t\t...accumulatedPanels,\n\t\t\t[ panelName ]: {\n\t\t\t\t...currentPanelState,\n\t\t\t\topened: true,\n\t\t\t},\n\t\t};\n\t}, panelsWithEnabledState ?? {} );\n\n\t// The panels variable will only be set if openPanels wasn't `undefined`.\n\t// If it isn't set just return `panelsWithEnabledState`, and if that isn't\n\t// set return an empty object.\n\treturn panels ?? panelsWithEnabledState ?? EMPTY_OBJECT;\n}\n\n/**\n * Returns the preferences (these preferences are persisted locally).\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Preferences Object.\n */\nexport const getPreferences = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `wp.data.select( 'core/edit-post' ).getPreferences`, {\n\t\tsince: '6.0',\n\t\talternative: `wp.data.select( 'core/preferences' ).get`,\n\t} );\n\n\t// These preferences now exist in the preferences store.\n\t// Fetch them so that they can be merged into the post\n\t// editor preferences.\n\tconst preferences = [\n\t\t'hiddenBlockTypes',\n\t\t'editorMode',\n\t\t'preferredStyleVariations',\n\t].reduce( ( accumulatedPrefs, preferenceKey ) => {\n\t\tconst value = select( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\tpreferenceKey\n\t\t);\n\n\t\treturn {\n\t\t\t...accumulatedPrefs,\n\t\t\t[ preferenceKey ]: value,\n\t\t};\n\t}, {} );\n\n\t// Panels were a preference, but the data structure changed when the state\n\t// was migrated to the preferences store. They need to be converted from\n\t// the new preferences store format to old format to ensure no breaking\n\t// changes for plugins.\n\tconst inactivePanels = select( preferencesStore ).get(\n\t\t'core/edit-post',\n\t\t'inactivePanels'\n\t);\n\tconst openPanels = select( preferencesStore ).get(\n\t\t'core/edit-post',\n\t\t'openPanels'\n\t);\n\tconst panels = convertPanelsToOldFormat( inactivePanels, openPanels );\n\n\treturn {\n\t\t...preferences,\n\t\tpanels,\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\tdeprecated( `wp.data.select( 'core/edit-post' ).getPreference`, {\n\t\tsince: '6.0',\n\t\talternative: `wp.data.select( 'core/preferences' ).get`,\n\t} );\n\n\t// Avoid using the `getPreferences` registry selector where possible.\n\tconst preferences = getPreferences( state );\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 const isEditorPanelEnabled = createRegistrySelector(\n\t( select ) => ( state, panelName ) => {\n\t\tconst inactivePanels = select( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\t'inactivePanels'\n\t\t);\n\t\treturn (\n\t\t\t! isEditorPanelRemoved( state, panelName ) &&\n\t\t\t! inactivePanels?.includes( panelName )\n\t\t);\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 const isEditorPanelOpened = createRegistrySelector(\n\t( select ) => ( state, panelName ) => {\n\t\tconst openPanels = select( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\t'openPanels'\n\t\t);\n\t\treturn !! openPanels?.includes( panelName );\n\t}\n);\n\n/**\n * Returns true if a modal is active, or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} modalName A string that uniquely identifies the modal.\n *\n * @return {boolean} Whether the modal is active.\n */\nexport function isModalActive( state, modalName ) {\n\treturn state.activeModal === modalName;\n}\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} feature Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( state, feature ) => {\n\t\treturn !! select( preferencesStore ).get( 'core/edit-post', feature );\n\t}\n);\n\n/**\n * Returns true if the plugin item is pinned to the header.\n * When the value is not set it defaults to true.\n *\n * @param {Object} state Global application state.\n * @param {string} pluginName Plugin item name.\n *\n * @return {boolean} Whether the plugin item is pinned.\n */\nexport const isPluginItemPinned = createRegistrySelector(\n\t( select ) => ( state, pluginName ) => {\n\t\treturn select( interfaceStore ).isItemPinned(\n\t\t\t'core/edit-post',\n\t\t\tpluginName\n\t\t);\n\t}\n);\n\n/**\n * Returns an array of active meta box locations.\n *\n * @param {Object} state Post editor state.\n *\n * @return {string[]} Active meta box locations.\n */\nexport const getActiveMetaBoxLocations = createSelector(\n\t( state ) => {\n\t\treturn Object.keys( state.metaBoxes.locations ).filter( ( location ) =>\n\t\t\tisMetaBoxLocationActive( state, location )\n\t\t);\n\t},\n\t( state ) => [ state.metaBoxes.locations ]\n);\n\n/**\n * Returns true if a metabox location is active and visible\n *\n * @param {Object} state Post editor state.\n * @param {string} location Meta box location to test.\n *\n * @return {boolean} Whether the meta box location is active and visible.\n */\nexport function isMetaBoxLocationVisible( state, location ) {\n\treturn (\n\t\tisMetaBoxLocationActive( state, location ) &&\n\t\tsome( getMetaBoxesPerLocation( state, location ), ( { id } ) => {\n\t\t\treturn isEditorPanelEnabled( state, `meta-box-${ id }` );\n\t\t} )\n\t);\n}\n\n/**\n * Returns true if there is an active meta box in the given location, or false\n * otherwise.\n *\n * @param {Object} state Post editor state.\n * @param {string} location Meta box location to test.\n *\n * @return {boolean} Whether the meta box location is active.\n */\nexport function isMetaBoxLocationActive( state, location ) {\n\tconst metaBoxes = getMetaBoxesPerLocation( state, location );\n\treturn !! metaBoxes && metaBoxes.length !== 0;\n}\n\n/**\n * Returns the list of all the available meta boxes for a given location.\n *\n * @param {Object} state Global application state.\n * @param {string} location Meta box location to test.\n *\n * @return {?Array} List of meta boxes.\n */\nexport function getMetaBoxesPerLocation( state, location ) {\n\treturn state.metaBoxes.locations[ location ];\n}\n\n/**\n * Returns the list of all the available meta boxes.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} List of meta boxes.\n */\nexport const getAllMetaBoxes = createSelector(\n\t( state ) => {\n\t\treturn flatten( values( state.metaBoxes.locations ) );\n\t},\n\t( state ) => [ state.metaBoxes.locations ]\n);\n\n/**\n * Returns true if the post is using Meta Boxes\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether there are metaboxes or not.\n */\nexport function hasMetaBoxes( state ) {\n\treturn getActiveMetaBoxLocations( state ).length > 0;\n}\n\n/**\n * Returns true if the Meta Boxes are being saved.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the metaboxes are being saved.\n */\nexport function isSavingMetaBoxes( state ) {\n\treturn state.metaBoxes.isSaving;\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst {\n\t\trootClientId,\n\t\tinsertionIndex,\n\t\tfilterValue,\n\t} = state.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns true if the template editing mode is enabled.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether we're editing the template.\n */\nexport function isEditingTemplate( state ) {\n\treturn state.isEditingTemplate;\n}\n\n/**\n * Returns true if meta boxes are initialized.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether meta boxes are initialized.\n */\nexport function areMetaBoxesInitialized( state ) {\n\treturn state.metaBoxes.initialized;\n}\n\n/**\n * Retrieves the template of the currently edited post.\n *\n * @return {Object?} Post Template.\n */\nexport const getEditedPostTemplate = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst currentTemplate = select( editorStore ).getEditedPostAttribute(\n\t\t\t'template'\n\t\t);\n\t\tif ( currentTemplate ) {\n\t\t\tconst templateWithSameSlug = select( coreStore )\n\t\t\t\t.getEntityRecords( 'postType', 'wp_template', { per_page: -1 } )\n\t\t\t\t?.find( ( template ) => template.slug === currentTemplate );\n\t\t\tif ( ! templateWithSameSlug ) {\n\t\t\t\treturn templateWithSameSlug;\n\t\t\t}\n\t\t\treturn select( coreStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\ttemplateWithSameSlug.id\n\t\t\t);\n\t\t}\n\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tif ( post.link ) {\n\t\t\treturn select( coreStore ).__experimentalGetTemplateForLink(\n\t\t\t\tpost.link\n\t\t\t);\n\t\t}\n\n\t\treturn null;\n\t}\n);\n"]}
|
|
@@ -304,7 +304,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
304
304
|
display: flex;
|
|
305
305
|
flex-direction: column;
|
|
306
306
|
overflow: auto;
|
|
307
|
-
z-index:
|
|
307
|
+
z-index: 20;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
.interface-interface-skeleton__secondary-sidebar,
|
|
@@ -1891,9 +1891,6 @@ body.block-editor-page .media-frame select.attachment-filters:last-of-type {
|
|
|
1891
1891
|
max-width: 100%;
|
|
1892
1892
|
height: auto;
|
|
1893
1893
|
}
|
|
1894
|
-
.block-editor__container iframe {
|
|
1895
|
-
width: 100%;
|
|
1896
|
-
}
|
|
1897
1894
|
|
|
1898
1895
|
body.admin-color-light {
|
|
1899
1896
|
--wp-admin-theme-color: #0085ba;
|
package/build-style/style.css
CHANGED
|
@@ -304,7 +304,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
304
304
|
display: flex;
|
|
305
305
|
flex-direction: column;
|
|
306
306
|
overflow: auto;
|
|
307
|
-
z-index:
|
|
307
|
+
z-index: 20;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
.interface-interface-skeleton__secondary-sidebar,
|
|
@@ -1895,9 +1895,6 @@ body.block-editor-page .media-frame select.attachment-filters:last-of-type {
|
|
|
1895
1895
|
max-width: 100%;
|
|
1896
1896
|
height: auto;
|
|
1897
1897
|
}
|
|
1898
|
-
.block-editor__container iframe {
|
|
1899
|
-
width: 100%;
|
|
1900
|
-
}
|
|
1901
1898
|
|
|
1902
1899
|
body.admin-color-light {
|
|
1903
1900
|
--wp-admin-theme-color: #0085ba;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-post",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.0",
|
|
4
4
|
"description": "Edit Post module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,30 +27,31 @@
|
|
|
27
27
|
"react-native": "src/index",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
|
-
"@wordpress/a11y": "^3.
|
|
31
|
-
"@wordpress/api-fetch": "^6.
|
|
32
|
-
"@wordpress/block-editor": "^8.
|
|
33
|
-
"@wordpress/block-library": "^7.
|
|
34
|
-
"@wordpress/blocks": "^11.
|
|
35
|
-
"@wordpress/components": "^19.
|
|
36
|
-
"@wordpress/compose": "^5.
|
|
37
|
-
"@wordpress/core-data": "^4.
|
|
38
|
-
"@wordpress/data": "^6.
|
|
39
|
-
"@wordpress/
|
|
40
|
-
"@wordpress/
|
|
41
|
-
"@wordpress/
|
|
42
|
-
"@wordpress/
|
|
43
|
-
"@wordpress/
|
|
44
|
-
"@wordpress/
|
|
45
|
-
"@wordpress/
|
|
46
|
-
"@wordpress/
|
|
47
|
-
"@wordpress/
|
|
48
|
-
"@wordpress/
|
|
49
|
-
"@wordpress/
|
|
50
|
-
"@wordpress/
|
|
51
|
-
"@wordpress/
|
|
52
|
-
"@wordpress/
|
|
53
|
-
"@wordpress/
|
|
30
|
+
"@wordpress/a11y": "^3.6.0",
|
|
31
|
+
"@wordpress/api-fetch": "^6.3.0",
|
|
32
|
+
"@wordpress/block-editor": "^8.5.0",
|
|
33
|
+
"@wordpress/block-library": "^7.3.0",
|
|
34
|
+
"@wordpress/blocks": "^11.5.0",
|
|
35
|
+
"@wordpress/components": "^19.8.0",
|
|
36
|
+
"@wordpress/compose": "^5.4.0",
|
|
37
|
+
"@wordpress/core-data": "^4.4.0",
|
|
38
|
+
"@wordpress/data": "^6.6.0",
|
|
39
|
+
"@wordpress/deprecated": "^3.6.0",
|
|
40
|
+
"@wordpress/editor": "^12.5.0",
|
|
41
|
+
"@wordpress/element": "^4.4.0",
|
|
42
|
+
"@wordpress/hooks": "^3.6.0",
|
|
43
|
+
"@wordpress/i18n": "^4.6.0",
|
|
44
|
+
"@wordpress/icons": "^8.2.0",
|
|
45
|
+
"@wordpress/interface": "^4.5.0",
|
|
46
|
+
"@wordpress/keyboard-shortcuts": "^3.4.0",
|
|
47
|
+
"@wordpress/keycodes": "^3.6.0",
|
|
48
|
+
"@wordpress/media-utils": "^3.4.0",
|
|
49
|
+
"@wordpress/notices": "^3.6.0",
|
|
50
|
+
"@wordpress/plugins": "^4.4.0",
|
|
51
|
+
"@wordpress/preferences": "^1.2.0",
|
|
52
|
+
"@wordpress/url": "^3.7.0",
|
|
53
|
+
"@wordpress/viewport": "^4.4.0",
|
|
54
|
+
"@wordpress/warning": "^2.6.0",
|
|
54
55
|
"classnames": "^2.3.1",
|
|
55
56
|
"lodash": "^4.17.21",
|
|
56
57
|
"memize": "^1.1.0",
|
|
@@ -63,5 +64,5 @@
|
|
|
63
64
|
"publishConfig": {
|
|
64
65
|
"access": "public"
|
|
65
66
|
},
|
|
66
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "11eb1241e63c9240018323551c6753f8a5fa96f9"
|
|
67
68
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { ActionItem } from '@wordpress/interface';
|
|
5
5
|
import { compose } from '@wordpress/compose';
|
|
6
|
+
import { MenuItem } from '@wordpress/components';
|
|
6
7
|
import { withPluginContext } from '@wordpress/plugins';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -64,6 +65,7 @@ import { withPluginContext } from '@wordpress/plugins';
|
|
|
64
65
|
export default compose(
|
|
65
66
|
withPluginContext( ( context, ownProps ) => {
|
|
66
67
|
return {
|
|
68
|
+
as: ownProps.as ?? MenuItem,
|
|
67
69
|
icon: ownProps.icon || context.icon,
|
|
68
70
|
name: 'core/edit-post/plugin-more-menu',
|
|
69
71
|
};
|
|
@@ -67,7 +67,9 @@ export default function DeleteTemplate() {
|
|
|
67
67
|
...settings,
|
|
68
68
|
availableTemplates: newAvailableTemplates,
|
|
69
69
|
} );
|
|
70
|
-
deleteEntityRecord( 'postType', 'wp_template', template.id
|
|
70
|
+
deleteEntityRecord( 'postType', 'wp_template', template.id, {
|
|
71
|
+
throwOnError: true,
|
|
72
|
+
} );
|
|
71
73
|
};
|
|
72
74
|
|
|
73
75
|
return (
|
|
@@ -97,7 +97,7 @@ function PostLink( {
|
|
|
97
97
|
{ __( 'The last part of the URL.' ) }{ ' ' }
|
|
98
98
|
<ExternalLink
|
|
99
99
|
href={ __(
|
|
100
|
-
'https://wordpress.org/support/article/
|
|
100
|
+
'https://wordpress.org/support/article/settings-sidebar/#permalink'
|
|
101
101
|
) }
|
|
102
102
|
>
|
|
103
103
|
{ __( 'Read about permalinks' ) }
|
|
@@ -124,8 +124,7 @@ export default function VisualEditor( { styles } ) {
|
|
|
124
124
|
const { clearSelectedBlock } = useDispatch( blockEditorStore );
|
|
125
125
|
const { setIsEditingTemplate } = useDispatch( editPostStore );
|
|
126
126
|
const desktopCanvasStyles = {
|
|
127
|
-
|
|
128
|
-
// If a percentage height is present, older browsers such as Safari 13 apply that, but do so incorrectly as the inheritance is buggy.
|
|
127
|
+
height: '100%',
|
|
129
128
|
width: '100%',
|
|
130
129
|
margin: 0,
|
|
131
130
|
display: 'flex',
|
|
@@ -237,7 +236,10 @@ export default function VisualEditor( { styles } ) {
|
|
|
237
236
|
/>
|
|
238
237
|
) }
|
|
239
238
|
{ ! isTemplateMode && (
|
|
240
|
-
<div
|
|
239
|
+
<div
|
|
240
|
+
className="edit-post-visual-editor__post-title-wrapper"
|
|
241
|
+
contentEditable={ false }
|
|
242
|
+
>
|
|
241
243
|
<PostTitle />
|
|
242
244
|
</div>
|
|
243
245
|
) }
|
package/src/editor.js
CHANGED
|
@@ -18,6 +18,7 @@ import { StrictMode, useMemo } from '@wordpress/element';
|
|
|
18
18
|
import { SlotFillProvider } from '@wordpress/components';
|
|
19
19
|
import { store as coreStore } from '@wordpress/core-data';
|
|
20
20
|
import { ShortcutProvider } from '@wordpress/keyboard-shortcuts';
|
|
21
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* Internal dependencies
|
|
@@ -43,7 +44,6 @@ function Editor( {
|
|
|
43
44
|
preferredStyleVariations,
|
|
44
45
|
hiddenBlockTypes,
|
|
45
46
|
blockTypes,
|
|
46
|
-
__experimentalLocalAutosaveInterval,
|
|
47
47
|
keepCaretInsideBlock,
|
|
48
48
|
isTemplateMode,
|
|
49
49
|
template,
|
|
@@ -51,7 +51,6 @@ function Editor( {
|
|
|
51
51
|
( select ) => {
|
|
52
52
|
const {
|
|
53
53
|
isFeatureActive,
|
|
54
|
-
getPreference,
|
|
55
54
|
__experimentalGetPreviewDeviceType,
|
|
56
55
|
isEditingTemplate,
|
|
57
56
|
getEditedPostTemplate,
|
|
@@ -87,14 +86,12 @@ function Editor( {
|
|
|
87
86
|
focusMode: isFeatureActive( 'focusMode' ),
|
|
88
87
|
hasReducedUI: isFeatureActive( 'reducedUI' ),
|
|
89
88
|
hasThemeStyles: isFeatureActive( 'themeStyles' ),
|
|
90
|
-
preferredStyleVariations:
|
|
89
|
+
preferredStyleVariations: select( preferencesStore ).get(
|
|
90
|
+
'core/edit-post',
|
|
91
91
|
'preferredStyleVariations'
|
|
92
92
|
),
|
|
93
93
|
hiddenBlockTypes: getHiddenBlockTypes(),
|
|
94
94
|
blockTypes: getBlockTypes(),
|
|
95
|
-
__experimentalLocalAutosaveInterval: getPreference(
|
|
96
|
-
'localAutosaveInterval'
|
|
97
|
-
),
|
|
98
95
|
keepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),
|
|
99
96
|
isTemplateMode: isEditingTemplate(),
|
|
100
97
|
template:
|
|
@@ -121,7 +118,6 @@ function Editor( {
|
|
|
121
118
|
hasFixedToolbar,
|
|
122
119
|
focusMode,
|
|
123
120
|
hasReducedUI,
|
|
124
|
-
__experimentalLocalAutosaveInterval,
|
|
125
121
|
|
|
126
122
|
// This is marked as experimental to give time for the quick inserter to mature.
|
|
127
123
|
__experimentalSetIsInserterOpened: setIsInserterOpened,
|
|
@@ -156,7 +152,6 @@ function Editor( {
|
|
|
156
152
|
hiddenBlockTypes,
|
|
157
153
|
blockTypes,
|
|
158
154
|
preferredStyleVariations,
|
|
159
|
-
__experimentalLocalAutosaveInterval,
|
|
160
155
|
setIsInserterOpened,
|
|
161
156
|
updatePreferredStyleVariations,
|
|
162
157
|
keepCaretInsideBlock,
|
package/src/index.js
CHANGED
|
@@ -107,9 +107,14 @@ export function initializeEditor(
|
|
|
107
107
|
);
|
|
108
108
|
|
|
109
109
|
dispatch( preferencesStore ).setDefaults( 'core/edit-post', {
|
|
110
|
+
editorMode: 'visual',
|
|
110
111
|
fixedToolbar: false,
|
|
111
112
|
fullscreenMode: true,
|
|
112
113
|
hiddenBlockTypes: [],
|
|
114
|
+
inactivePanels: [],
|
|
115
|
+
isPublishSidebarEnabled: true,
|
|
116
|
+
openPanels: [ 'post-status' ],
|
|
117
|
+
preferredStyleVariations: {},
|
|
113
118
|
showBlockBreadcrumbs: true,
|
|
114
119
|
showIconLabels: false,
|
|
115
120
|
themeStyles: true,
|
package/src/index.native.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import '@wordpress/core-data';
|
|
5
5
|
import '@wordpress/format-library';
|
|
6
|
+
import { dispatch } from '@wordpress/data';
|
|
7
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* Internal dependencies
|
|
@@ -19,5 +21,17 @@ import Editor from './editor';
|
|
|
19
21
|
* @param {Object} postId ID of the post to edit (unused right now)
|
|
20
22
|
*/
|
|
21
23
|
export function initializeEditor( id, postType, postId ) {
|
|
24
|
+
dispatch( preferencesStore ).setDefaults( 'core/edit-post', {
|
|
25
|
+
editorMode: 'visual',
|
|
26
|
+
fixedToolbar: false,
|
|
27
|
+
fullscreenMode: true,
|
|
28
|
+
hiddenBlockTypes: [],
|
|
29
|
+
inactivePanels: [],
|
|
30
|
+
isPublishSidebarEnabled: true,
|
|
31
|
+
openPanels: [ 'post-status' ],
|
|
32
|
+
preferredStyleVariations: {},
|
|
33
|
+
welcomeGuide: true,
|
|
34
|
+
} );
|
|
35
|
+
|
|
22
36
|
return <Editor postId={ postId } postType={ postType } />;
|
|
23
37
|
}
|
package/src/store/actions.js
CHANGED
|
@@ -107,26 +107,58 @@ export function togglePublishSidebar() {
|
|
|
107
107
|
*
|
|
108
108
|
* @return {Object} Action object.
|
|
109
109
|
*/
|
|
110
|
-
export
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
export const toggleEditorPanelEnabled = ( panelName ) => ( { registry } ) => {
|
|
111
|
+
const inactivePanels =
|
|
112
|
+
registry
|
|
113
|
+
.select( preferencesStore )
|
|
114
|
+
.get( 'core/edit-post', 'inactivePanels' ) ?? [];
|
|
115
|
+
|
|
116
|
+
const isPanelInactive = !! inactivePanels?.includes( panelName );
|
|
117
|
+
|
|
118
|
+
// If the panel is inactive, remove it to enable it, else add it to
|
|
119
|
+
// make it inactive.
|
|
120
|
+
let updatedInactivePanels;
|
|
121
|
+
if ( isPanelInactive ) {
|
|
122
|
+
updatedInactivePanels = inactivePanels.filter(
|
|
123
|
+
( invactivePanelName ) => invactivePanelName !== panelName
|
|
124
|
+
);
|
|
125
|
+
} else {
|
|
126
|
+
updatedInactivePanels = [ ...inactivePanels, panelName ];
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
registry
|
|
130
|
+
.dispatch( preferencesStore )
|
|
131
|
+
.set( 'core/edit-post', 'inactivePanels', updatedInactivePanels );
|
|
132
|
+
};
|
|
116
133
|
|
|
117
134
|
/**
|
|
118
|
-
*
|
|
135
|
+
* Opens a closed panel and closes an open panel.
|
|
119
136
|
*
|
|
120
137
|
* @param {string} panelName A string that identifies the panel to open or close.
|
|
121
|
-
*
|
|
122
|
-
* @return {Object} Action object.
|
|
123
138
|
*/
|
|
124
|
-
export
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
139
|
+
export const toggleEditorPanelOpened = ( panelName ) => ( { registry } ) => {
|
|
140
|
+
const openPanels =
|
|
141
|
+
registry
|
|
142
|
+
.select( preferencesStore )
|
|
143
|
+
.get( 'core/edit-post', 'openPanels' ) ?? [];
|
|
144
|
+
|
|
145
|
+
const isPanelOpen = !! openPanels?.includes( panelName );
|
|
146
|
+
|
|
147
|
+
// If the panel is open, remove it to close it, else add it to
|
|
148
|
+
// make it open.
|
|
149
|
+
let updatedOpenPanels;
|
|
150
|
+
if ( isPanelOpen ) {
|
|
151
|
+
updatedOpenPanels = openPanels.filter(
|
|
152
|
+
( openPanelName ) => openPanelName !== panelName
|
|
153
|
+
);
|
|
154
|
+
} else {
|
|
155
|
+
updatedOpenPanels = [ ...openPanels, panelName ];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
registry
|
|
159
|
+
.dispatch( preferencesStore )
|
|
160
|
+
.set( 'core/edit-post', 'openPanels', updatedOpenPanels );
|
|
161
|
+
};
|
|
130
162
|
|
|
131
163
|
/**
|
|
132
164
|
* Returns an action object used to remove a panel from the editor.
|
|
@@ -155,11 +187,10 @@ export const toggleFeature = ( feature ) => ( { registry } ) =>
|
|
|
155
187
|
*
|
|
156
188
|
* @param {string} mode The editor mode.
|
|
157
189
|
*/
|
|
158
|
-
export const switchEditorMode = ( mode ) => ( {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
mode
|
|
162
|
-
} );
|
|
190
|
+
export const switchEditorMode = ( mode ) => ( { registry } ) => {
|
|
191
|
+
registry
|
|
192
|
+
.dispatch( preferencesStore )
|
|
193
|
+
.set( 'core/edit-post', 'editorMode', mode );
|
|
163
194
|
|
|
164
195
|
// Unselect blocks when we switch to the code editor.
|
|
165
196
|
if ( mode !== 'visual' ) {
|
|
@@ -193,30 +224,44 @@ export const togglePinnedPluginItem = ( pluginName ) => ( { registry } ) => {
|
|
|
193
224
|
*
|
|
194
225
|
* @param {string} blockName Name of the block.
|
|
195
226
|
* @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the "auto apply" setting of the block is removed.
|
|
196
|
-
*
|
|
197
|
-
* @return {Object} Action object.
|
|
198
227
|
*/
|
|
199
|
-
export
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
}
|
|
228
|
+
export const updatePreferredStyleVariations = ( blockName, blockStyle ) => ( {
|
|
229
|
+
registry,
|
|
230
|
+
} ) => {
|
|
231
|
+
if ( ! blockName ) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
206
234
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
235
|
+
const existingVariations =
|
|
236
|
+
registry
|
|
237
|
+
.select( preferencesStore )
|
|
238
|
+
.get( 'core/edit-post', 'preferredStyleVariations' ) ?? {};
|
|
239
|
+
|
|
240
|
+
// When the blockStyle is omitted, remove the block's preferred variation.
|
|
241
|
+
if ( ! blockStyle ) {
|
|
242
|
+
const updatedVariations = {
|
|
243
|
+
...existingVariations,
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
delete updatedVariations[ blockName ];
|
|
247
|
+
|
|
248
|
+
registry
|
|
249
|
+
.dispatch( preferencesStore )
|
|
250
|
+
.set(
|
|
251
|
+
'core/edit-post',
|
|
252
|
+
'preferredStyleVariations',
|
|
253
|
+
updatedVariations
|
|
254
|
+
);
|
|
255
|
+
} else {
|
|
256
|
+
// Else add the variation.
|
|
257
|
+
registry
|
|
258
|
+
.dispatch( preferencesStore )
|
|
259
|
+
.set( 'core/edit-post', 'preferredStyleVariations', {
|
|
260
|
+
...existingVariations,
|
|
261
|
+
[ blockName ]: blockStyle,
|
|
262
|
+
} );
|
|
263
|
+
}
|
|
264
|
+
};
|
|
220
265
|
|
|
221
266
|
/**
|
|
222
267
|
* Update the provided block types to be visible.
|
package/src/store/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { createReduxStore,
|
|
4
|
+
import { createReduxStore, register } from '@wordpress/data';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -11,13 +11,6 @@ import * as actions from './actions';
|
|
|
11
11
|
import * as selectors from './selectors';
|
|
12
12
|
import { STORE_NAME } from './constants';
|
|
13
13
|
|
|
14
|
-
const storeConfig = {
|
|
15
|
-
reducer,
|
|
16
|
-
actions,
|
|
17
|
-
selectors,
|
|
18
|
-
persist: [ 'preferences' ],
|
|
19
|
-
};
|
|
20
|
-
|
|
21
14
|
/**
|
|
22
15
|
* Store definition for the edit post namespace.
|
|
23
16
|
*
|
|
@@ -25,7 +18,10 @@ const storeConfig = {
|
|
|
25
18
|
*
|
|
26
19
|
* @type {Object}
|
|
27
20
|
*/
|
|
28
|
-
export const store = createReduxStore( STORE_NAME,
|
|
21
|
+
export const store = createReduxStore( STORE_NAME, {
|
|
22
|
+
reducer,
|
|
23
|
+
actions,
|
|
24
|
+
selectors,
|
|
25
|
+
} );
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
registerStore( STORE_NAME, storeConfig );
|
|
27
|
+
register( store );
|