@wordpress/edit-post 6.2.0 → 6.3.2
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 +2 -0
- package/build/components/layout/index.js +7 -4
- package/build/components/layout/index.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/start-page-options/index.js +116 -0
- package/build/components/start-page-options/index.js.map +1 -0
- package/build/components/visual-editor/index.js +3 -3
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/editor.js +3 -2
- package/build/editor.js.map +1 -1
- package/build/index.js +3 -0
- package/build/index.js.map +1 -1
- package/build/index.native.js +3 -0
- package/build/index.native.js.map +1 -1
- package/build/store/actions.js +76 -49
- 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 -80
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +86 -25
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/layout/index.js +6 -4
- package/build-module/components/layout/index.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/start-page-options/index.js +103 -0
- package/build-module/components/start-page-options/index.js.map +1 -0
- 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 +2 -2
- package/build-module/editor.js.map +1 -1
- package/build-module/index.js +3 -0
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +3 -0
- package/build-module/index.native.js.map +1 -1
- package/build-module/store/actions.js +71 -45
- 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 -77
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +82 -23
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +38 -3
- package/build-style/style.css +38 -3
- package/package.json +27 -26
- package/src/components/layout/index.js +10 -2
- package/src/components/sidebar/post-link/index.js +1 -1
- package/src/components/start-page-options/index.js +121 -0
- package/src/components/start-page-options/style.scss +42 -0
- package/src/components/visual-editor/index.js +5 -3
- package/src/editor.js +3 -2
- package/src/index.js +3 -0
- package/src/index.native.js +3 -0
- package/src/store/actions.js +47 -15
- package/src/store/index.js +7 -11
- package/src/store/reducer.js +1 -74
- package/src/store/selectors.js +121 -51
- package/src/store/test/actions.js +30 -33
- package/src/store/test/reducer.js +0 -126
- package/src/store/test/selectors.js +0 -155
- package/src/style.scss +1 -4
- package/build/store/defaults.js +0 -15
- package/build/store/defaults.js.map +0 -1
- package/build-module/store/defaults.js +0 -8
- package/build-module/store/defaults.js.map +0 -1
- package/src/store/defaults.js +0 -7
|
@@ -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","select","isEditorSidebarOpened","activeGeneralSidebar","getActiveComplementaryArea","isPluginSidebarOpened","getActiveGeneralSidebarName","MIGRATED_KEYS","getPreferences","state","editPostPreferences","preferences","preferenceStorePreferences","reduce","accumulatedPrefs","preferenceKey","value","getPreference","defaultValue","isMigratedKey","undefined","getHiddenBlockTypes","isPublishSidebarOpened","publishSidebarActive","isEditorPanelRemoved","panelName","removedPanels","isEditorPanelEnabled","panels","isEditorPanelOpened","isModalActive","modalName","activeModal","isFeatureActive","feature","isPluginItemPinned","pluginName","isItemPinned","getActiveMetaBoxLocations","Object","keys","metaBoxes","locations","filter","location","isMetaBoxLocationActive","isMetaBoxLocationVisible","getMetaBoxesPerLocation","id","length","getAllMetaBoxes","hasMetaBoxes","isSavingMetaBoxes","isSaving","__experimentalGetPreviewDeviceType","deviceType","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","isEditingTemplate","areMetaBoxesInitialized","initialized","getEditedPostTemplate","currentTemplate","getEditedPostAttribute","templateWithSameSlug","getEntityRecords","per_page","find","template","slug","getEditedEntityRecord","post","getCurrentPost","link","__experimentalGetTemplateForLink"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,cAAP,MAA2B,QAA3B;AACA,SAASC,GAAT,EAAcC,QAAd,EAAwBC,IAAxB,EAA8BC,OAA9B,EAAuCC,MAAvC,QAAqD,QAArD;AAEA;AACA;AACA;;AACA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,sBAAxC;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,wBAA1C;AACA,SAASF,KAAK,IAAIG,SAAlB,QAAmC,sBAAnC;AACA,SAASH,KAAK,IAAII,WAAlB,QAAqC,mBAArC;AAEA,MAAMC,WAAW,GAAG,EAApB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,aAAa,GAAGP,sBAAsB,CAAIQ,MAAF,IAAc;AAAA;;AAAA,wBAClEA,MAAM,CAAEL,gBAAF,CAAN,CAA2BR,GAA3B,CAAgC,gBAAhC,EAAkD,YAAlD,CADkE,qDACE,QADF;AAAA,CAAhB,CAA5C;AAIP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMc,qBAAqB,GAAGT,sBAAsB,CACxDQ,MAAF,IAAc,MAAM;AACnB,QAAME,oBAAoB,GAAGF,MAAM,CAClCN,cADkC,CAAN,CAE3BS,0BAF2B,CAEC,gBAFD,CAA7B;AAGA,SAAOf,QAAQ,CACd,CAAE,oBAAF,EAAwB,iBAAxB,CADc,EAEdc,oBAFc,CAAf;AAIA,CATyD,CAApD;AAYP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAME,qBAAqB,GAAGZ,sBAAsB,CACxDQ,MAAF,IAAc,MAAM;AACnB,QAAME,oB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CACvB,UADuB,CAAxB;;AAGA,MAAKD,eAAL,EAAuB;AAAA;;AACtB,UAAME,oBAAoB,4BAAGrE,MAAM,CAAEJ,SAAF,CAAN,CAC3B0E,gBAD2B,CACT,UADS,EACG,aADH,EACkB;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KADlB,CAAH,0DAAG,sBAE1BC,IAF0B,CAElBC,QAAF,IAAgBA,QAAQ,CAACC,IAAT,KAAkBP,eAFd,CAA7B;;AAGA,QAAK,CAAEE,oBAAP,EAA8B;AAC7B,aAAOA,oBAAP;AACA;;AACD,WAAOrE,MAAM,CAAEJ,SAAF,CAAN,CAAoB+E,qBAApB,CACN,UADM,EAEN,aAFM,EAGNN,oBAAoB,CAACtB,EAHf,CAAP;AAKA;;AAED,QAAM6B,IAAI,GAAG5E,MAAM,CAAEH,WAAF,CAAN,CAAsBgF,cAAtB,EAAb;;AACA,MAAKD,IAAI,CAACE,IAAV,EAAiB;AAChB,WAAO9E,MAAM,CAAEJ,SAAF,CAAN,CAAoBmF,gCAApB,CACNH,IAAI,CAACE,IADC,CAAP;AAGA;;AAED,SAAO,IAAP;AACA,CA3ByD,CAApD","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\nimport { get, includes, some, flatten, values } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector( ( select ) => () =>\n\tselect( preferencesStore ).get( 'core/edit-post', 'editorMode' ) ?? 'visual'\n);\n\n/**\n * Returns true if the editor sidebar is opened.\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether the editor sidebar is opened.\n */\nexport const isEditorSidebarOpened = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst activeGeneralSidebar = select(\n\t\t\tinterfaceStore\n\t\t).getActiveComplementaryArea( 'core/edit-post' );\n\t\treturn includes(\n\t\t\t[ 'edit-post/document', 'edit-post/block' ],\n\t\t\tactiveGeneralSidebar\n\t\t);\n\t}\n);\n\n/**\n * Returns true if the plugin sidebar is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the plugin sidebar is opened.\n */\nexport const isPluginSidebarOpened = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst activeGeneralSidebar = select(\n\t\t\tinterfaceStore\n\t\t).getActiveComplementaryArea( 'core/edit-post' );\n\t\treturn (\n\t\t\t!! activeGeneralSidebar &&\n\t\t\t! includes(\n\t\t\t\t[ 'edit-post/document', 'edit-post/block' ],\n\t\t\t\tactiveGeneralSidebar\n\t\t\t)\n\t\t);\n\t}\n);\n\n/**\n * Returns the current active general sidebar name, or null if there is no\n * general sidebar active. The active general sidebar is a unique name to\n * identify either an editor or plugin sidebar.\n *\n * Examples:\n *\n * - `edit-post/document`\n * - `my-plugin/insert-image-sidebar`\n *\n * @param {Object} state Global application state.\n *\n * @return {?string} Active general sidebar name.\n */\nexport const getActiveGeneralSidebarName = createRegistrySelector(\n\t( select ) => () => {\n\t\treturn select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t'core/edit-post'\n\t\t);\n\t}\n);\n\n// The current list of preference keys that have been migrated to the\n// preferences package.\nconst MIGRATED_KEYS = [\n\t'hiddenBlockTypes',\n\t'editorMode',\n\t'preferredStyleVariations',\n];\n\n/**\n * Returns the preferences (these preferences are persisted locally).\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Preferences Object.\n */\nexport const getPreferences = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst editPostPreferences = state.preferences;\n\n\t\t// Some preferences now exist in the preferences store.\n\t\t// Fetch them so that they can be merged into the post\n\t\t// editor preferences.\n\t\tconst preferenceStorePreferences = MIGRATED_KEYS.reduce(\n\t\t\t( accumulatedPrefs, preferenceKey ) => {\n\t\t\t\tconst value = select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\tpreferenceKey\n\t\t\t\t);\n\n\t\t\t\treturn {\n\t\t\t\t\t...accumulatedPrefs,\n\t\t\t\t\t[ preferenceKey ]: value,\n\t\t\t\t};\n\t\t\t},\n\t\t\t{}\n\t\t);\n\n\t\treturn {\n\t\t\t...editPostPreferences,\n\t\t\t...preferenceStorePreferences,\n\t\t};\n\t}\n);\n\n/**\n *\n * @param {Object} state Global application state.\n * @param {string} preferenceKey Preference Key.\n * @param {*} defaultValue Default Value.\n *\n * @return {*} Preference Value.\n */\nexport function getPreference( state, preferenceKey, defaultValue ) {\n\t// Avoid using the `getPreferences` registry selector where possible.\n\tconst isMigratedKey = MIGRATED_KEYS.includes( preferenceKey );\n\tconst preferences = isMigratedKey\n\t\t? getPreferences( state )\n\t\t: state.preferences;\n\tconst value = preferences[ preferenceKey ];\n\treturn value === undefined ? defaultValue : value;\n}\n\n/**\n * Returns an array of blocks that are hidden.\n *\n * @return {Array} A list of the hidden block types\n */\nexport const getHiddenBlockTypes = createRegistrySelector( ( select ) => () => {\n\treturn (\n\t\tselect( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\t'hiddenBlockTypes'\n\t\t) ?? EMPTY_ARRAY\n\t);\n} );\n\n/**\n * Returns true if the publish sidebar is opened.\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether the publish sidebar is open.\n */\nexport function isPublishSidebarOpened( state ) {\n\treturn state.publishSidebarActive;\n}\n\n/**\n * Returns true if the given panel was programmatically removed, or false otherwise.\n * All panels are not removed by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is removed.\n */\nexport function isEditorPanelRemoved( state, panelName ) {\n\treturn includes( state.removedPanels, panelName );\n}\n\n/**\n * Returns true if the given panel is enabled, or false otherwise. Panels are\n * enabled by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is enabled.\n */\nexport function isEditorPanelEnabled( state, panelName ) {\n\tconst panels = getPreference( state, 'panels' );\n\n\treturn (\n\t\t! isEditorPanelRemoved( state, panelName ) &&\n\t\tget( panels, [ panelName, 'enabled' ], true )\n\t);\n}\n\n/**\n * Returns true if the given panel is open, or false otherwise. Panels are\n * closed by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is open.\n */\nexport function isEditorPanelOpened( state, panelName ) {\n\tconst panels = getPreference( state, 'panels' );\n\treturn (\n\t\tget( panels, [ panelName ] ) === true ||\n\t\tget( panels, [ panelName, 'opened' ] ) === true\n\t);\n}\n\n/**\n * Returns true if a modal is active, or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} modalName A string that uniquely identifies the modal.\n *\n * @return {boolean} Whether the modal is active.\n */\nexport function isModalActive( state, modalName ) {\n\treturn state.activeModal === modalName;\n}\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} feature Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( state, feature ) => {\n\t\treturn !! select( preferencesStore ).get( 'core/edit-post', feature );\n\t}\n);\n\n/**\n * Returns true if the plugin item is pinned to the header.\n * When the value is not set it defaults to true.\n *\n * @param {Object} state Global application state.\n * @param {string} pluginName Plugin item name.\n *\n * @return {boolean} Whether the plugin item is pinned.\n */\nexport const isPluginItemPinned = createRegistrySelector(\n\t( select ) => ( state, pluginName ) => {\n\t\treturn select( interfaceStore ).isItemPinned(\n\t\t\t'core/edit-post',\n\t\t\tpluginName\n\t\t);\n\t}\n);\n\n/**\n * Returns an array of active meta box locations.\n *\n * @param {Object} state Post editor state.\n *\n * @return {string[]} Active meta box locations.\n */\nexport const getActiveMetaBoxLocations = createSelector(\n\t( state ) => {\n\t\treturn Object.keys( state.metaBoxes.locations ).filter( ( location ) =>\n\t\t\tisMetaBoxLocationActive( state, location )\n\t\t);\n\t},\n\t( state ) => [ state.metaBoxes.locations ]\n);\n\n/**\n * Returns true if a metabox location is active and visible\n *\n * @param {Object} state Post editor state.\n * @param {string} location Meta box location to test.\n *\n * @return {boolean} Whether the meta box location is active and visible.\n */\nexport function isMetaBoxLocationVisible( state, location ) {\n\treturn (\n\t\tisMetaBoxLocationActive( state, location ) &&\n\t\tsome( getMetaBoxesPerLocation( state, location ), ( { id } ) => {\n\t\t\treturn isEditorPanelEnabled( state, `meta-box-${ id }` );\n\t\t} )\n\t);\n}\n\n/**\n * Returns true if there is an active meta box in the given location, or false\n * otherwise.\n *\n * @param {Object} state Post editor state.\n * @param {string} location Meta box location to test.\n *\n * @return {boolean} Whether the meta box location is active.\n */\nexport function isMetaBoxLocationActive( state, location ) {\n\tconst metaBoxes = getMetaBoxesPerLocation( state, location );\n\treturn !! metaBoxes && metaBoxes.length !== 0;\n}\n\n/**\n * Returns the list of all the available meta boxes for a given location.\n *\n * @param {Object} state Global application state.\n * @param {string} location Meta box location to test.\n *\n * @return {?Array} List of meta boxes.\n */\nexport function getMetaBoxesPerLocation( state, location ) {\n\treturn state.metaBoxes.locations[ location ];\n}\n\n/**\n * Returns the list of all the available meta boxes.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} List of meta boxes.\n */\nexport const getAllMetaBoxes = createSelector(\n\t( state ) => {\n\t\treturn flatten( values( state.metaBoxes.locations ) );\n\t},\n\t( state ) => [ state.metaBoxes.locations ]\n);\n\n/**\n * Returns true if the post is using Meta Boxes\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether there are metaboxes or not.\n */\nexport function hasMetaBoxes( state ) {\n\treturn getActiveMetaBoxLocations( state ).length > 0;\n}\n\n/**\n * Returns true if the Meta Boxes are being saved.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the metaboxes are being saved.\n */\nexport function isSavingMetaBoxes( state ) {\n\treturn state.metaBoxes.isSaving;\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst {\n\t\trootClientId,\n\t\tinsertionIndex,\n\t\tfilterValue,\n\t} = state.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns true if the template editing mode is enabled.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether we're editing the template.\n */\nexport function isEditingTemplate( state ) {\n\treturn state.isEditingTemplate;\n}\n\n/**\n * Returns true if meta boxes are initialized.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether meta boxes are initialized.\n */\nexport function areMetaBoxesInitialized( state ) {\n\treturn state.metaBoxes.initialized;\n}\n\n/**\n * Retrieves the template of the currently edited post.\n *\n * @return {Object?} Post Template.\n */\nexport const getEditedPostTemplate = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst currentTemplate = select( editorStore ).getEditedPostAttribute(\n\t\t\t'template'\n\t\t);\n\t\tif ( currentTemplate ) {\n\t\t\tconst templateWithSameSlug = select( coreStore )\n\t\t\t\t.getEntityRecords( 'postType', 'wp_template', { per_page: -1 } )\n\t\t\t\t?.find( ( template ) => template.slug === currentTemplate );\n\t\t\tif ( ! templateWithSameSlug ) {\n\t\t\t\treturn templateWithSameSlug;\n\t\t\t}\n\t\t\treturn select( coreStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\ttemplateWithSameSlug.id\n\t\t\t);\n\t\t}\n\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tif ( post.link ) {\n\t\t\treturn select( coreStore ).__experimentalGetTemplateForLink(\n\t\t\t\tpost.link\n\t\t\t);\n\t\t}\n\n\t\treturn null;\n\t}\n);\n"]}
|
|
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","get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AM0E,eAAe,GAAG1E,MAAM,CAAEL,WAAF,CAAN,CAAsBgF,sBAAtB,CACvB,UADuB,CAAxB;;AAGA,MAAKD,eAAL,EAAuB;AAAA;;AACtB,UAAME,oBAAoB,4BAAG5E,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"]}
|
|
@@ -1782,6 +1782,44 @@ h2.edit-post-template-summary__title {
|
|
|
1782
1782
|
fill: #fff;
|
|
1783
1783
|
}
|
|
1784
1784
|
|
|
1785
|
+
@media (min-width: 600px) {
|
|
1786
|
+
.edit-post-start-page-options__modal {
|
|
1787
|
+
width: calc(100% - 32px);
|
|
1788
|
+
height: calc(100% - 120px);
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
@media (min-width: 782px) {
|
|
1792
|
+
.edit-post-start-page-options__modal {
|
|
1793
|
+
width: 750px;
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
@media (min-width: 960px) {
|
|
1797
|
+
.edit-post-start-page-options__modal {
|
|
1798
|
+
height: 70%;
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
.edit-post-start-page-options__modal .components-modal__header {
|
|
1802
|
+
border-bottom: none;
|
|
1803
|
+
}
|
|
1804
|
+
.edit-post-start-page-options__modal .components-modal__content::before {
|
|
1805
|
+
content: none;
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
.edit-post-start-page-options__modal-content .block-editor-block-patterns-list {
|
|
1809
|
+
column-count: 2;
|
|
1810
|
+
column-gap: 24px;
|
|
1811
|
+
}
|
|
1812
|
+
.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item {
|
|
1813
|
+
break-inside: avoid-column;
|
|
1814
|
+
margin-bottom: 24px;
|
|
1815
|
+
}
|
|
1816
|
+
.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container {
|
|
1817
|
+
min-height: 100px;
|
|
1818
|
+
}
|
|
1819
|
+
.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__content {
|
|
1820
|
+
width: 100%;
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1785
1823
|
/**
|
|
1786
1824
|
* Animations
|
|
1787
1825
|
*/
|
|
@@ -1891,9 +1929,6 @@ body.block-editor-page .media-frame select.attachment-filters:last-of-type {
|
|
|
1891
1929
|
max-width: 100%;
|
|
1892
1930
|
height: auto;
|
|
1893
1931
|
}
|
|
1894
|
-
.block-editor__container iframe {
|
|
1895
|
-
width: 100%;
|
|
1896
|
-
}
|
|
1897
1932
|
|
|
1898
1933
|
body.admin-color-light {
|
|
1899
1934
|
--wp-admin-theme-color: #0085ba;
|
package/build-style/style.css
CHANGED
|
@@ -1786,6 +1786,44 @@ h2.edit-post-template-summary__title {
|
|
|
1786
1786
|
fill: #fff;
|
|
1787
1787
|
}
|
|
1788
1788
|
|
|
1789
|
+
@media (min-width: 600px) {
|
|
1790
|
+
.edit-post-start-page-options__modal {
|
|
1791
|
+
width: calc(100% - 32px);
|
|
1792
|
+
height: calc(100% - 120px);
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
@media (min-width: 782px) {
|
|
1796
|
+
.edit-post-start-page-options__modal {
|
|
1797
|
+
width: 750px;
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
@media (min-width: 960px) {
|
|
1801
|
+
.edit-post-start-page-options__modal {
|
|
1802
|
+
height: 70%;
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
.edit-post-start-page-options__modal .components-modal__header {
|
|
1806
|
+
border-bottom: none;
|
|
1807
|
+
}
|
|
1808
|
+
.edit-post-start-page-options__modal .components-modal__content::before {
|
|
1809
|
+
content: none;
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
.edit-post-start-page-options__modal-content .block-editor-block-patterns-list {
|
|
1813
|
+
column-count: 2;
|
|
1814
|
+
column-gap: 24px;
|
|
1815
|
+
}
|
|
1816
|
+
.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item {
|
|
1817
|
+
break-inside: avoid-column;
|
|
1818
|
+
margin-bottom: 24px;
|
|
1819
|
+
}
|
|
1820
|
+
.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container {
|
|
1821
|
+
min-height: 100px;
|
|
1822
|
+
}
|
|
1823
|
+
.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__content {
|
|
1824
|
+
width: 100%;
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1789
1827
|
/**
|
|
1790
1828
|
* Animations
|
|
1791
1829
|
*/
|
|
@@ -1895,9 +1933,6 @@ body.block-editor-page .media-frame select.attachment-filters:last-of-type {
|
|
|
1895
1933
|
max-width: 100%;
|
|
1896
1934
|
height: auto;
|
|
1897
1935
|
}
|
|
1898
|
-
.block-editor__container iframe {
|
|
1899
|
-
width: 100%;
|
|
1900
|
-
}
|
|
1901
1936
|
|
|
1902
1937
|
body.admin-color-light {
|
|
1903
1938
|
--wp-admin-theme-color: #0085ba;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-post",
|
|
3
|
-
"version": "6.2
|
|
3
|
+
"version": "6.3.2",
|
|
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.2
|
|
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.1",
|
|
31
|
+
"@wordpress/api-fetch": "^6.3.1",
|
|
32
|
+
"@wordpress/block-editor": "^8.5.2",
|
|
33
|
+
"@wordpress/block-library": "^7.3.2",
|
|
34
|
+
"@wordpress/blocks": "^11.5.2",
|
|
35
|
+
"@wordpress/components": "^19.8.1",
|
|
36
|
+
"@wordpress/compose": "^5.4.1",
|
|
37
|
+
"@wordpress/core-data": "^4.4.2",
|
|
38
|
+
"@wordpress/data": "^6.6.1",
|
|
39
|
+
"@wordpress/deprecated": "^3.6.1",
|
|
40
|
+
"@wordpress/editor": "^12.5.2",
|
|
41
|
+
"@wordpress/element": "^4.4.1",
|
|
42
|
+
"@wordpress/hooks": "^3.6.1",
|
|
43
|
+
"@wordpress/i18n": "^4.6.1",
|
|
44
|
+
"@wordpress/icons": "^8.2.1",
|
|
45
|
+
"@wordpress/interface": "^4.5.1",
|
|
46
|
+
"@wordpress/keyboard-shortcuts": "^3.4.1",
|
|
47
|
+
"@wordpress/keycodes": "^3.6.1",
|
|
48
|
+
"@wordpress/media-utils": "^3.4.1",
|
|
49
|
+
"@wordpress/notices": "^3.6.1",
|
|
50
|
+
"@wordpress/plugins": "^4.4.1",
|
|
51
|
+
"@wordpress/preferences": "^1.2.1",
|
|
52
|
+
"@wordpress/url": "^3.7.1",
|
|
53
|
+
"@wordpress/viewport": "^4.4.1",
|
|
54
|
+
"@wordpress/warning": "^2.6.1",
|
|
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": "446565ecaa40370173c18926535e975ec5652b71"
|
|
67
68
|
}
|
|
@@ -47,10 +47,10 @@ import SettingsSidebar from '../sidebar/settings-sidebar';
|
|
|
47
47
|
import MetaBoxes from '../meta-boxes';
|
|
48
48
|
import WelcomeGuide from '../welcome-guide';
|
|
49
49
|
import ActionsPanel from './actions-panel';
|
|
50
|
+
import StartPageOptions from '../start-page-options';
|
|
50
51
|
import { store as editPostStore } from '../../store';
|
|
51
52
|
|
|
52
53
|
const interfaceLabels = {
|
|
53
|
-
secondarySidebar: __( 'Block library' ),
|
|
54
54
|
/* translators: accessibility text for the editor top bar landmark region. */
|
|
55
55
|
header: __( 'Editor top bar' ),
|
|
56
56
|
/* translators: accessibility text for the editor content landmark region. */
|
|
@@ -170,6 +170,10 @@ function Layout( { styles } ) {
|
|
|
170
170
|
[ entitiesSavedStatesCallback ]
|
|
171
171
|
);
|
|
172
172
|
|
|
173
|
+
const secondarySidebarLabel = isListViewOpened
|
|
174
|
+
? __( 'List View' )
|
|
175
|
+
: __( 'Block Library' );
|
|
176
|
+
|
|
173
177
|
const secondarySidebar = () => {
|
|
174
178
|
if ( mode === 'visual' && isInserterOpened ) {
|
|
175
179
|
return <InserterSidebar />;
|
|
@@ -204,7 +208,10 @@ function Layout( { styles } ) {
|
|
|
204
208
|
<SettingsSidebar />
|
|
205
209
|
<InterfaceSkeleton
|
|
206
210
|
className={ className }
|
|
207
|
-
labels={
|
|
211
|
+
labels={ {
|
|
212
|
+
...interfaceLabels,
|
|
213
|
+
secondarySidebar: secondarySidebarLabel,
|
|
214
|
+
} }
|
|
208
215
|
header={
|
|
209
216
|
<Header
|
|
210
217
|
setEntitiesSavedStatesCallback={
|
|
@@ -286,6 +293,7 @@ function Layout( { styles } ) {
|
|
|
286
293
|
<EditPostPreferencesModal />
|
|
287
294
|
<KeyboardShortcutHelpModal />
|
|
288
295
|
<WelcomeGuide />
|
|
296
|
+
<StartPageOptions />
|
|
289
297
|
<Popover.Slot />
|
|
290
298
|
<PluginArea onError={ onPluginAreaError } />
|
|
291
299
|
</>
|
|
@@ -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' ) }
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Modal } from '@wordpress/components';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
import { useState, useEffect } from '@wordpress/element';
|
|
7
|
+
import {
|
|
8
|
+
store as blockEditorStore,
|
|
9
|
+
__experimentalBlockPatternsList as BlockPatternsList,
|
|
10
|
+
} from '@wordpress/block-editor';
|
|
11
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
12
|
+
import { useAsyncList } from '@wordpress/compose';
|
|
13
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
import { store as editPostStore } from '../../store';
|
|
19
|
+
|
|
20
|
+
function PatternSelection( { onChoosePattern } ) {
|
|
21
|
+
const { blockPatterns } = useSelect( ( select ) => {
|
|
22
|
+
const { __experimentalGetPatternsByBlockTypes } = select(
|
|
23
|
+
blockEditorStore
|
|
24
|
+
);
|
|
25
|
+
return {
|
|
26
|
+
blockPatterns: __experimentalGetPatternsByBlockTypes(
|
|
27
|
+
'core/post-content'
|
|
28
|
+
),
|
|
29
|
+
};
|
|
30
|
+
}, [] );
|
|
31
|
+
const shownBlockPatterns = useAsyncList( blockPatterns );
|
|
32
|
+
const { resetEditorBlocks } = useDispatch( editorStore );
|
|
33
|
+
useEffect( () => {
|
|
34
|
+
if ( blockPatterns.length <= 1 ) {
|
|
35
|
+
onChoosePattern();
|
|
36
|
+
}
|
|
37
|
+
}, [ blockPatterns.length ] );
|
|
38
|
+
return (
|
|
39
|
+
<BlockPatternsList
|
|
40
|
+
blockPatterns={ blockPatterns }
|
|
41
|
+
shownPatterns={ shownBlockPatterns }
|
|
42
|
+
onClickPattern={ ( _pattern, blocks ) => {
|
|
43
|
+
resetEditorBlocks( blocks );
|
|
44
|
+
onChoosePattern();
|
|
45
|
+
} }
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const START_PAGE_MODAL_STATES = {
|
|
51
|
+
INITIAL: 'INITIAL',
|
|
52
|
+
PATTERN: 'PATTERN',
|
|
53
|
+
CLOSED: 'CLOSED',
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default function StartPageOptions() {
|
|
57
|
+
const [ modalState, setModalState ] = useState(
|
|
58
|
+
START_PAGE_MODAL_STATES.INITIAL
|
|
59
|
+
);
|
|
60
|
+
const shouldOpenModel = useSelect(
|
|
61
|
+
( select ) => {
|
|
62
|
+
if ( modalState !== START_PAGE_MODAL_STATES.INITIAL ) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
const { __experimentalGetPatternsByBlockTypes } = select(
|
|
66
|
+
blockEditorStore
|
|
67
|
+
);
|
|
68
|
+
const {
|
|
69
|
+
getCurrentPostType,
|
|
70
|
+
getEditedPostContent,
|
|
71
|
+
isEditedPostSaveable,
|
|
72
|
+
} = select( editorStore );
|
|
73
|
+
const { isEditingTemplate, isFeatureActive } = select(
|
|
74
|
+
editPostStore
|
|
75
|
+
);
|
|
76
|
+
return (
|
|
77
|
+
getCurrentPostType() === 'page' &&
|
|
78
|
+
! isEditedPostSaveable() &&
|
|
79
|
+
'' === getEditedPostContent() &&
|
|
80
|
+
! isEditingTemplate() &&
|
|
81
|
+
! isFeatureActive( 'welcomeGuide' ) &&
|
|
82
|
+
__experimentalGetPatternsByBlockTypes( 'core/post-content' )
|
|
83
|
+
.length >= 1
|
|
84
|
+
);
|
|
85
|
+
},
|
|
86
|
+
[ modalState ]
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
useEffect( () => {
|
|
90
|
+
if ( shouldOpenModel ) {
|
|
91
|
+
setModalState( START_PAGE_MODAL_STATES.PATTERN );
|
|
92
|
+
}
|
|
93
|
+
}, [ shouldOpenModel ] );
|
|
94
|
+
|
|
95
|
+
if (
|
|
96
|
+
modalState === START_PAGE_MODAL_STATES.INITIAL ||
|
|
97
|
+
modalState === START_PAGE_MODAL_STATES.CLOSED
|
|
98
|
+
) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
return (
|
|
102
|
+
<Modal
|
|
103
|
+
className="edit-post-start-page-options__modal"
|
|
104
|
+
title={ __( 'Choose a pattern' ) }
|
|
105
|
+
closeLabel={ __( 'Cancel' ) }
|
|
106
|
+
onRequestClose={ () => {
|
|
107
|
+
setModalState( START_PAGE_MODAL_STATES.CLOSED );
|
|
108
|
+
} }
|
|
109
|
+
>
|
|
110
|
+
<div className="edit-post-start-page-options__modal-content">
|
|
111
|
+
{ modalState === START_PAGE_MODAL_STATES.PATTERN && (
|
|
112
|
+
<PatternSelection
|
|
113
|
+
onChoosePattern={ () => {
|
|
114
|
+
setModalState( START_PAGE_MODAL_STATES.CLOSED );
|
|
115
|
+
} }
|
|
116
|
+
/>
|
|
117
|
+
) }
|
|
118
|
+
</div>
|
|
119
|
+
</Modal>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.edit-post-start-page-options__modal {
|
|
2
|
+
// To keep modal dimensions consistent as subsections are navigated, width
|
|
3
|
+
// and height are used instead of max-(width/height).
|
|
4
|
+
@include break-small() {
|
|
5
|
+
width: calc(100% - #{ $grid-unit-20 * 2 });
|
|
6
|
+
height: calc(100% - #{ $header-height * 2 });
|
|
7
|
+
}
|
|
8
|
+
@include break-medium() {
|
|
9
|
+
width: $break-medium - $grid-unit-20 * 2;
|
|
10
|
+
}
|
|
11
|
+
@include break-large() {
|
|
12
|
+
height: 70%;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// @todo: Consider this for a minimal modal prop.
|
|
16
|
+
.components-modal__header {
|
|
17
|
+
border-bottom: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.components-modal__content::before {
|
|
21
|
+
content: none;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// 2 column masonry layout.
|
|
26
|
+
.edit-post-start-page-options__modal-content .block-editor-block-patterns-list {
|
|
27
|
+
column-count: 2;
|
|
28
|
+
column-gap: $grid-unit-30;
|
|
29
|
+
|
|
30
|
+
.block-editor-block-patterns-list__list-item {
|
|
31
|
+
break-inside: avoid-column;
|
|
32
|
+
margin-bottom: $grid-unit-30;
|
|
33
|
+
|
|
34
|
+
.block-editor-block-preview__container {
|
|
35
|
+
min-height: 100px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.block-editor-block-preview__content {
|
|
39
|
+
width: 100%;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -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
|
|
@@ -50,7 +51,6 @@ function Editor( {
|
|
|
50
51
|
( select ) => {
|
|
51
52
|
const {
|
|
52
53
|
isFeatureActive,
|
|
53
|
-
getPreference,
|
|
54
54
|
__experimentalGetPreviewDeviceType,
|
|
55
55
|
isEditingTemplate,
|
|
56
56
|
getEditedPostTemplate,
|
|
@@ -86,7 +86,8 @@ function Editor( {
|
|
|
86
86
|
focusMode: isFeatureActive( 'focusMode' ),
|
|
87
87
|
hasReducedUI: isFeatureActive( 'reducedUI' ),
|
|
88
88
|
hasThemeStyles: isFeatureActive( 'themeStyles' ),
|
|
89
|
-
preferredStyleVariations:
|
|
89
|
+
preferredStyleVariations: select( preferencesStore ).get(
|
|
90
|
+
'core/edit-post',
|
|
90
91
|
'preferredStyleVariations'
|
|
91
92
|
),
|
|
92
93
|
hiddenBlockTypes: getHiddenBlockTypes(),
|
package/src/index.js
CHANGED
|
@@ -111,6 +111,9 @@ export function initializeEditor(
|
|
|
111
111
|
fixedToolbar: false,
|
|
112
112
|
fullscreenMode: true,
|
|
113
113
|
hiddenBlockTypes: [],
|
|
114
|
+
inactivePanels: [],
|
|
115
|
+
isPublishSidebarEnabled: true,
|
|
116
|
+
openPanels: [ 'post-status' ],
|
|
114
117
|
preferredStyleVariations: {},
|
|
115
118
|
showBlockBreadcrumbs: true,
|
|
116
119
|
showIconLabels: false,
|
package/src/index.native.js
CHANGED
|
@@ -26,6 +26,9 @@ export function initializeEditor( id, postType, postId ) {
|
|
|
26
26
|
fixedToolbar: false,
|
|
27
27
|
fullscreenMode: true,
|
|
28
28
|
hiddenBlockTypes: [],
|
|
29
|
+
inactivePanels: [],
|
|
30
|
+
isPublishSidebarEnabled: true,
|
|
31
|
+
openPanels: [ 'post-status' ],
|
|
29
32
|
preferredStyleVariations: {},
|
|
30
33
|
welcomeGuide: true,
|
|
31
34
|
} );
|
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.
|