@wordpress/edit-post 8.11.0 → 8.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/keyboard-shortcuts/index.js +2 -2
  3. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  4. package/build/components/layout/index.js +1 -1
  5. package/build/components/layout/index.js.map +1 -1
  6. package/build/components/layout/use-should-iframe.js +15 -25
  7. package/build/components/layout/use-should-iframe.js.map +1 -1
  8. package/build/components/more-menu/index.js +3 -3
  9. package/build/components/more-menu/index.js.map +1 -1
  10. package/build/index.js +1 -0
  11. package/build/index.js.map +1 -1
  12. package/build/index.native.js +1 -0
  13. package/build/index.native.js.map +1 -1
  14. package/build/store/actions.js +24 -1
  15. package/build/store/actions.js.map +1 -1
  16. package/build-module/components/keyboard-shortcuts/index.js +2 -2
  17. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  18. package/build-module/components/layout/index.js +1 -1
  19. package/build-module/components/layout/index.js.map +1 -1
  20. package/build-module/components/layout/use-should-iframe.js +15 -25
  21. package/build-module/components/layout/use-should-iframe.js.map +1 -1
  22. package/build-module/components/more-menu/index.js +3 -3
  23. package/build-module/components/more-menu/index.js.map +1 -1
  24. package/build-module/index.js +1 -0
  25. package/build-module/index.js.map +1 -1
  26. package/build-module/index.native.js +1 -0
  27. package/build-module/index.native.js.map +1 -1
  28. package/build-module/store/actions.js +22 -0
  29. package/build-module/store/actions.js.map +1 -1
  30. package/package.json +3 -3
  31. package/src/components/keyboard-shortcuts/index.js +2 -2
  32. package/src/components/layout/index.js +1 -1
  33. package/src/components/layout/use-should-iframe.js +19 -31
  34. package/src/components/more-menu/index.js +3 -3
  35. package/src/index.js +1 -0
  36. package/src/index.native.js +1 -0
  37. package/src/store/actions.js +43 -0
@@ -1 +1 @@
1
- {"version":3,"names":["dispatch","store","preferencesStore","Editor","jsx","_jsx","initializeEditor","id","postType","postId","setDefaults","editorMode","fullscreenMode","inactivePanels","openPanels","welcomeGuide","hiddenBlockTypes","isPublishSidebarEnabled","fixedToolbar"],"sources":["@wordpress/edit-post/src/index.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport '@wordpress/core-data';\nimport '@wordpress/format-library';\nimport { dispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nexport { store } from './store';\nimport Editor from './editor';\n\n/**\n * Initializes the Editor and returns a componentProvider\n * that can be registered with `AppRegistry.registerComponent`\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {Object} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit (unused right now)\n */\nexport function initializeEditor( id, postType, postId ) {\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\teditorMode: 'visual',\n\t\tfullscreenMode: true,\n\t\tinactivePanels: [],\n\t\topenPanels: [ 'post-status' ],\n\t\twelcomeGuide: true,\n\t} );\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\topenPanels: [ 'post-status' ],\n\t\tisPublishSidebarEnabled: true,\n\t\tfixedToolbar: false,\n\t} );\n\n\treturn <Editor postId={ postId } postType={ postType } />;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,sBAAsB;AAC7B,OAAO,2BAA2B;AAClC,SAASA,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,SAASD,KAAK,QAAQ,SAAS;AAC/B,OAAOE,MAAM,MAAM,UAAU;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,SAAAC,GAAA,IAAAC,IAAA;AAQA,OAAO,SAASC,gBAAgBA,CAAEC,EAAE,EAAEC,QAAQ,EAAEC,MAAM,EAAG;EACxDT,QAAQ,CAAEE,gBAAiB,CAAC,CAACQ,WAAW,CAAE,gBAAgB,EAAE;IAC3DC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,IAAI;IACpBC,cAAc,EAAE,EAAE;IAClBC,UAAU,EAAE,CAAE,aAAa,CAAE;IAC7BC,YAAY,EAAE;EACf,CAAE,CAAC;EACHf,QAAQ,CAAEE,gBAAiB,CAAC,CAACQ,WAAW,CAAE,MAAM,EAAE;IACjDM,gBAAgB,EAAE,EAAE;IACpBH,cAAc,EAAE,EAAE;IAClBC,UAAU,EAAE,CAAE,aAAa,CAAE;IAC7BG,uBAAuB,EAAE,IAAI;IAC7BC,YAAY,EAAE;EACf,CAAE,CAAC;EAEH,oBAAOb,IAAA,CAACF,MAAM;IAACM,MAAM,EAAGA,MAAQ;IAACD,QAAQ,EAAGA;EAAU,CAAE,CAAC;AAC1D","ignoreList":[]}
1
+ {"version":3,"names":["dispatch","store","preferencesStore","Editor","jsx","_jsx","initializeEditor","id","postType","postId","setDefaults","editorMode","fullscreenMode","inactivePanels","openPanels","welcomeGuide","editorTool","hiddenBlockTypes","isPublishSidebarEnabled","fixedToolbar"],"sources":["@wordpress/edit-post/src/index.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport '@wordpress/core-data';\nimport '@wordpress/format-library';\nimport { dispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nexport { store } from './store';\nimport Editor from './editor';\n\n/**\n * Initializes the Editor and returns a componentProvider\n * that can be registered with `AppRegistry.registerComponent`\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {Object} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit (unused right now)\n */\nexport function initializeEditor( id, postType, postId ) {\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\teditorMode: 'visual',\n\t\tfullscreenMode: true,\n\t\tinactivePanels: [],\n\t\topenPanels: [ 'post-status' ],\n\t\twelcomeGuide: true,\n\t} );\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\teditorTool: 'edit',\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\topenPanels: [ 'post-status' ],\n\t\tisPublishSidebarEnabled: true,\n\t\tfixedToolbar: false,\n\t} );\n\n\treturn <Editor postId={ postId } postType={ postType } />;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,sBAAsB;AAC7B,OAAO,2BAA2B;AAClC,SAASA,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,SAASD,KAAK,QAAQ,SAAS;AAC/B,OAAOE,MAAM,MAAM,UAAU;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,SAAAC,GAAA,IAAAC,IAAA;AAQA,OAAO,SAASC,gBAAgBA,CAAEC,EAAE,EAAEC,QAAQ,EAAEC,MAAM,EAAG;EACxDT,QAAQ,CAAEE,gBAAiB,CAAC,CAACQ,WAAW,CAAE,gBAAgB,EAAE;IAC3DC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,IAAI;IACpBC,cAAc,EAAE,EAAE;IAClBC,UAAU,EAAE,CAAE,aAAa,CAAE;IAC7BC,YAAY,EAAE;EACf,CAAE,CAAC;EACHf,QAAQ,CAAEE,gBAAiB,CAAC,CAACQ,WAAW,CAAE,MAAM,EAAE;IACjDM,UAAU,EAAE,MAAM;IAClBC,gBAAgB,EAAE,EAAE;IACpBJ,cAAc,EAAE,EAAE;IAClBC,UAAU,EAAE,CAAE,aAAa,CAAE;IAC7BI,uBAAuB,EAAE,IAAI;IAC7BC,YAAY,EAAE;EACf,CAAE,CAAC;EAEH,oBAAOd,IAAA,CAACF,MAAM;IAACM,MAAM,EAAGA,MAAQ;IAACD,QAAQ,EAAGA;EAAU,CAAE,CAAC;AAC1D","ignoreList":[]}
@@ -7,6 +7,8 @@ import { store as editorStore, privateApis as editorPrivateApis } from '@wordpre
7
7
  import deprecated from '@wordpress/deprecated';
8
8
  import { addAction } from '@wordpress/hooks';
9
9
  import { store as coreStore } from '@wordpress/core-data';
10
+ import { store as noticesStore } from '@wordpress/notices';
11
+ import { __ } from '@wordpress/i18n';
10
12
 
11
13
  /**
12
14
  * Internal dependencies
@@ -472,4 +474,24 @@ export const toggleDistractionFree = () => ({
472
474
  });
473
475
  registry.dispatch(editorStore).toggleDistractionFree();
474
476
  };
477
+
478
+ /**
479
+ * Action that toggles the Fullscreen Mode view option.
480
+ */
481
+ export const toggleFullscreenMode = () => ({
482
+ registry
483
+ }) => {
484
+ const isFullscreen = registry.select(preferencesStore).get('core/edit-post', 'fullscreenMode');
485
+ registry.dispatch(preferencesStore).toggle('core/edit-post', 'fullscreenMode');
486
+ registry.dispatch(noticesStore).createInfoNotice(isFullscreen ? __('Fullscreen mode activated.') : __('Fullscreen mode deactivated.'), {
487
+ id: 'core/edit-post/toggle-fullscreen-mode/notice',
488
+ type: 'snackbar',
489
+ actions: [{
490
+ label: __('Undo'),
491
+ onClick: () => {
492
+ registry.dispatch(preferencesStore).toggle('core/edit-post', 'fullscreenMode');
493
+ }
494
+ }]
495
+ });
496
+ };
475
497
  //# sourceMappingURL=actions.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["apiFetch","store","preferencesStore","editorStore","privateApis","editorPrivateApis","deprecated","addAction","coreStore","getMetaBoxContainer","unlock","interfaceStore","openGeneralSidebar","name","registry","dispatch","enableComplementaryArea","closeGeneralSidebar","disableComplementaryArea","openModal","since","alternative","closeModal","openPublishSidebar","closePublishSidebar","togglePublishSidebar","toggleEditorPanelEnabled","panelName","toggleEditorPanelOpened","removeEditorPanel","toggleFeature","feature","toggle","switchEditorMode","mode","togglePinnedPluginItem","pluginName","isPinned","select","isItemPinned","updatePreferredStyleVariations","hint","type","showBlockTypes","blockNames","hideBlockTypes","setAvailableMetaBoxesPerLocation","metaBoxesPerLocation","requestMetaBoxUpdates","window","tinyMCE","triggerSave","baseFormData","FormData","document","querySelector","postId","get","postType","post","getEditedEntityRecord","additionalData","comment_status","ping_status","sticky","author","filter","Boolean","activeMetaBoxLocations","getActiveMetaBoxLocations","formDataToMerge","map","location","formData","reduce","memo","currentFormData","key","value","append","forEach","url","_wpMetaBoxUrl","method","body","parse","metaBoxUpdatesSuccess","metaBoxUpdatesFailure","__experimentalSetPreviewDeviceType","deviceType","version","setDeviceType","setIsInserterOpened","setIsListViewOpened","isOpen","setIsEditingTemplate","__unstableCreateTemplate","metaBoxesInitialized","initializeMetaBoxes","isEditorReady","__unstableIsEditorReady","getCurrentPostType","postboxes","page","add_postbox_toggles","options","isAutosave","hasMetaBoxes","toggleDistractionFree"],"sources":["@wordpress/edit-post/src/store/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport deprecated from '@wordpress/deprecated';\nimport { addAction } from '@wordpress/hooks';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { getMetaBoxContainer } from '../utils/meta-boxes';\nimport { unlock } from '../lock-unlock';\n\nconst { interfaceStore } = unlock( editorPrivateApis );\n\n/**\n * Returns an action object used in signalling that the user opened an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( 'core', name );\n\t};\n\n/**\n * Returns an action object signalling that the user closed the sidebar.\n */\nexport const closeGeneralSidebar =\n\t() =>\n\t( { registry } ) =>\n\t\tregistry.dispatch( interfaceStore ).disableComplementaryArea( 'core' );\n\n/**\n * Returns an action object used in signalling that the user opened a modal.\n *\n * @deprecated since WP 6.3 use `core/interface` store's action with the same name instead.\n *\n *\n * @param {string} name A string that uniquely identifies the modal.\n *\n * @return {Object} Action object.\n */\nexport const openModal =\n\t( name ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"select( 'core/edit-post' ).openModal( name )\", {\n\t\t\tsince: '6.3',\n\t\t\talternative: \"select( 'core/interface').openModal( name )\",\n\t\t} );\n\t\treturn registry.dispatch( interfaceStore ).openModal( name );\n\t};\n\n/**\n * Returns an action object signalling that the user closed a modal.\n *\n * @deprecated since WP 6.3 use `core/interface` store's action with the same name instead.\n *\n * @return {Object} Action object.\n */\nexport const closeModal =\n\t() =>\n\t( { registry } ) => {\n\t\tdeprecated( \"select( 'core/edit-post' ).closeModal()\", {\n\t\t\tsince: '6.3',\n\t\t\talternative: \"select( 'core/interface').closeModal()\",\n\t\t} );\n\t\treturn registry.dispatch( interfaceStore ).closeModal();\n\t};\n\n/**\n * Returns an action object used in signalling that the user opened the publish\n * sidebar.\n * @deprecated\n *\n * @return {Object} Action object\n */\nexport const openPublishSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).openPublishSidebar\", {\n\t\t\tsince: '6.6',\n\t\t\talternative: \"dispatch( 'core/editor').openPublishSidebar\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).openPublishSidebar();\n\t};\n\n/**\n * Returns an action object used in signalling that the user closed the\n * publish sidebar.\n * @deprecated\n *\n * @return {Object} Action object.\n */\nexport const closePublishSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).closePublishSidebar\", {\n\t\t\tsince: '6.6',\n\t\t\talternative: \"dispatch( 'core/editor').closePublishSidebar\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).closePublishSidebar();\n\t};\n\n/**\n * Returns an action object used in signalling that the user toggles the publish sidebar.\n * @deprecated\n *\n * @return {Object} Action object\n */\nexport const togglePublishSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).togglePublishSidebar\", {\n\t\t\tsince: '6.6',\n\t\t\talternative: \"dispatch( 'core/editor').togglePublishSidebar\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).togglePublishSidebar();\n\t};\n\n/**\n * Returns an action object used to enable or disable a panel in the editor.\n *\n * @deprecated\n *\n * @param {string} panelName A string that identifies the panel to enable or disable.\n *\n * @return {Object} Action object.\n */\nexport const toggleEditorPanelEnabled =\n\t( panelName ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).toggleEditorPanelEnabled\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').toggleEditorPanelEnabled\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).toggleEditorPanelEnabled( panelName );\n\t};\n\n/**\n * Opens a closed panel and closes an open panel.\n *\n * @deprecated\n *\n * @param {string} panelName A string that identifies the panel to open or close.\n */\nexport const toggleEditorPanelOpened =\n\t( panelName ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).toggleEditorPanelOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').toggleEditorPanelOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).toggleEditorPanelOpened( panelName );\n\t};\n\n/**\n * Returns an action object used to remove a panel from the editor.\n *\n * @deprecated\n *\n * @param {string} panelName A string that identifies the panel to remove.\n *\n * @return {Object} Action object.\n */\nexport const removeEditorPanel =\n\t( panelName ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).removeEditorPanel\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').removeEditorPanel\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).removeEditorPanel( panelName );\n\t};\n\n/**\n * Triggers an action used to toggle a feature flag.\n *\n * @param {string} feature Feature name.\n */\nexport const toggleFeature =\n\t( feature ) =>\n\t( { registry } ) =>\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-post', feature );\n\n/**\n * Triggers an action used to switch editor mode.\n *\n * @deprecated\n *\n * @param {string} mode The editor mode.\n */\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).switchEditorMode\", {\n\t\t\tsince: '6.6',\n\t\t\talternative: \"dispatch( 'core/editor').switchEditorMode\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).switchEditorMode( mode );\n\t};\n\n/**\n * Triggers an action object used to toggle a plugin name flag.\n *\n * @param {string} pluginName Plugin name.\n */\nexport const togglePinnedPluginItem =\n\t( pluginName ) =>\n\t( { registry } ) => {\n\t\tconst isPinned = registry\n\t\t\t.select( interfaceStore )\n\t\t\t.isItemPinned( 'core', pluginName );\n\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t[ isPinned ? 'unpinItem' : 'pinItem' ]( 'core', pluginName );\n\t};\n\n/**\n * Returns an action object used in signaling that a style should be auto-applied when a block is created.\n *\n * @deprecated\n */\nexport function updatePreferredStyleVariations() {\n\tdeprecated( \"dispatch( 'core/edit-post' ).updatePreferredStyleVariations\", {\n\t\tsince: '6.6',\n\t\thint: 'Preferred Style Variations are not supported anymore.',\n\t} );\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Update the provided block types to be visible.\n *\n * @param {string[]} blockNames Names of block types to show.\n */\nexport const showBlockTypes =\n\t( blockNames ) =>\n\t( { registry } ) => {\n\t\tunlock( registry.dispatch( editorStore ) ).showBlockTypes( blockNames );\n\t};\n\n/**\n * Update the provided block types to be hidden.\n *\n * @param {string[]} blockNames Names of block types to hide.\n */\nexport const hideBlockTypes =\n\t( blockNames ) =>\n\t( { registry } ) => {\n\t\tunlock( registry.dispatch( editorStore ) ).hideBlockTypes( blockNames );\n\t};\n\n/**\n * Stores info about which Meta boxes are available in which location.\n *\n * @param {Object} metaBoxesPerLocation Meta boxes per location.\n */\nexport function setAvailableMetaBoxesPerLocation( metaBoxesPerLocation ) {\n\treturn {\n\t\ttype: 'SET_META_BOXES_PER_LOCATIONS',\n\t\tmetaBoxesPerLocation,\n\t};\n}\n\n/**\n * Update a metabox.\n */\nexport const requestMetaBoxUpdates =\n\t() =>\n\tasync ( { registry, select, dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'REQUEST_META_BOX_UPDATES',\n\t\t} );\n\n\t\t// Saves the wp_editor fields.\n\t\tif ( window.tinyMCE ) {\n\t\t\twindow.tinyMCE.triggerSave();\n\t\t}\n\n\t\t// We gather the base form data.\n\t\tconst baseFormData = new window.FormData(\n\t\t\tdocument.querySelector( '.metabox-base-form' )\n\t\t);\n\n\t\tconst postId = baseFormData.get( 'post_ID' );\n\t\tconst postType = baseFormData.get( 'post_type' );\n\n\t\t// Additional data needed for backward compatibility.\n\t\t// If we do not provide this data, the post will be overridden with the default values.\n\t\t// We cannot rely on getCurrentPost because right now on the editor we may be editing a pattern or a template.\n\t\t// We need to retrieve the post that the base form data is referring to.\n\t\tconst post = registry\n\t\t\t.select( coreStore )\n\t\t\t.getEditedEntityRecord( 'postType', postType, postId );\n\t\tconst additionalData = [\n\t\t\tpost.comment_status\n\t\t\t\t? [ 'comment_status', post.comment_status ]\n\t\t\t\t: false,\n\t\t\tpost.ping_status ? [ 'ping_status', post.ping_status ] : false,\n\t\t\tpost.sticky ? [ 'sticky', post.sticky ] : false,\n\t\t\tpost.author ? [ 'post_author', post.author ] : false,\n\t\t].filter( Boolean );\n\n\t\t// We gather all the metaboxes locations.\n\t\tconst activeMetaBoxLocations = select.getActiveMetaBoxLocations();\n\t\tconst formDataToMerge = [\n\t\t\tbaseFormData,\n\t\t\t...activeMetaBoxLocations.map(\n\t\t\t\t( location ) =>\n\t\t\t\t\tnew window.FormData( getMetaBoxContainer( location ) )\n\t\t\t),\n\t\t];\n\n\t\t// Merge all form data objects into a single one.\n\t\tconst formData = formDataToMerge.reduce( ( memo, currentFormData ) => {\n\t\t\tfor ( const [ key, value ] of currentFormData ) {\n\t\t\t\tmemo.append( key, value );\n\t\t\t}\n\t\t\treturn memo;\n\t\t}, new window.FormData() );\n\t\tadditionalData.forEach( ( [ key, value ] ) =>\n\t\t\tformData.append( key, value )\n\t\t);\n\n\t\ttry {\n\t\t\t// Save the metaboxes.\n\t\t\tawait apiFetch( {\n\t\t\t\turl: window._wpMetaBoxUrl,\n\t\t\t\tmethod: 'POST',\n\t\t\t\tbody: formData,\n\t\t\t\tparse: false,\n\t\t\t} );\n\t\t\tdispatch.metaBoxUpdatesSuccess();\n\t\t} catch {\n\t\t\tdispatch.metaBoxUpdatesFailure();\n\t\t}\n\t};\n\n/**\n * Returns an action object used to signal a successful meta box update.\n *\n * @return {Object} Action object.\n */\nexport function metaBoxUpdatesSuccess() {\n\treturn {\n\t\ttype: 'META_BOX_UPDATES_SUCCESS',\n\t};\n}\n\n/**\n * Returns an action object used to signal a failed meta box update.\n *\n * @return {Object} Action object.\n */\nexport function metaBoxUpdatesFailure() {\n\treturn {\n\t\ttype: 'META_BOX_UPDATES_FAILURE',\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @deprecated\n *\n * @param {string} deviceType\n */\nexport const __experimentalSetPreviewDeviceType =\n\t( deviceType ) =>\n\t( { registry } ) => {\n\t\tdeprecated(\n\t\t\t\"dispatch( 'core/edit-post' ).__experimentalSetPreviewDeviceType\",\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\thint: 'registry.dispatch( editorStore ).setDeviceType',\n\t\t\t}\n\t\t);\n\t\tregistry.dispatch( editorStore ).setDeviceType( deviceType );\n\t};\n\n/**\n * Returns an action object used to open/close the inserter.\n *\n * @deprecated\n *\n * @param {boolean|Object} value Whether the inserter should be opened (true) or closed (false).\n */\nexport const setIsInserterOpened =\n\t( value ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).setIsInserterOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').setIsInserterOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).setIsInserterOpened( value );\n\t};\n\n/**\n * Returns an action object used to open/close the list view.\n *\n * @deprecated\n *\n * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.\n */\nexport const setIsListViewOpened =\n\t( isOpen ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).setIsListViewOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').setIsListViewOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).setIsListViewOpened( isOpen );\n\t};\n\n/**\n * Returns an action object used to switch to template editing.\n *\n * @deprecated\n */\nexport function setIsEditingTemplate() {\n\tdeprecated( \"dispatch( 'core/edit-post' ).setIsEditingTemplate\", {\n\t\tsince: '6.5',\n\t\talternative: \"dispatch( 'core/editor').setRenderingMode\",\n\t} );\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Create a block based template.\n *\n * @deprecated\n */\nexport function __unstableCreateTemplate() {\n\tdeprecated( \"dispatch( 'core/edit-post' ).__unstableCreateTemplate\", {\n\t\tsince: '6.5',\n\t} );\n\treturn { type: 'NOTHING' };\n}\n\nlet metaBoxesInitialized = false;\n\n/**\n * Initializes WordPress `postboxes` script and the logic for saving meta boxes.\n */\nexport const initializeMetaBoxes =\n\t() =>\n\t( { registry, select, dispatch } ) => {\n\t\tconst isEditorReady = registry\n\t\t\t.select( editorStore )\n\t\t\t.__unstableIsEditorReady();\n\n\t\tif ( ! isEditorReady ) {\n\t\t\treturn;\n\t\t}\n\t\t// Only initialize once.\n\t\tif ( metaBoxesInitialized ) {\n\t\t\treturn;\n\t\t}\n\t\tconst postType = registry.select( editorStore ).getCurrentPostType();\n\t\tif ( window.postboxes.page !== postType ) {\n\t\t\twindow.postboxes.add_postbox_toggles( postType );\n\t\t}\n\n\t\tmetaBoxesInitialized = true;\n\n\t\t// Save metaboxes on save completion, except for autosaves.\n\t\taddAction(\n\t\t\t'editor.savePost',\n\t\t\t'core/edit-post/save-metaboxes',\n\t\t\tasync ( post, options ) => {\n\t\t\t\tif ( ! options.isAutosave && select.hasMetaBoxes() ) {\n\t\t\t\t\tawait dispatch.requestMetaBoxUpdates();\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\tdispatch( {\n\t\t\ttype: 'META_BOXES_INITIALIZED',\n\t\t} );\n\t};\n\n/**\n * Action that toggles Distraction free mode.\n * Distraction free mode expects there are no sidebars, as due to the\n * z-index values set, you can't close sidebars.\n *\n * @deprecated\n */\nexport const toggleDistractionFree =\n\t() =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).toggleDistractionFree\", {\n\t\t\tsince: '6.6',\n\t\t\talternative: \"dispatch( 'core/editor').toggleDistractionFree\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).toggleDistractionFree();\n\t};\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,QAAQ,MAAM,sBAAsB;AAC3C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;AAClE,SACCD,KAAK,IAAIE,WAAW,EACpBC,WAAW,IAAIC,iBAAiB,QAC1B,mBAAmB;AAC1B,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASN,KAAK,IAAIO,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,qBAAqB;AACzD,SAASC,MAAM,QAAQ,gBAAgB;AAEvC,MAAM;EAAEC;AAAe,CAAC,GAAGD,MAAM,CAAEL,iBAAkB,CAAC;;AAEtD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMO,kBAAkB,GAC5BC,IAAI,IACN,CAAE;EAAEC;AAAS,CAAC,KAAM;EACnBA,QAAQ,CACNC,QAAQ,CAAEJ,cAAe,CAAC,CAC1BK,uBAAuB,CAAE,MAAM,EAAEH,IAAK,CAAC;AAC1C,CAAC;;AAEF;AACA;AACA;AACA,OAAO,MAAMI,mBAAmB,GAC/BA,CAAA,KACA,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CAAC,CAAC;IACvC;EACD,CACD,CAAC;EAEDjC,QAAQ,CAAE;IACT2B,IAAI,EAAE;EACP,CAAE,CAAC;AACJ,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMkE,qBAAqB,GACjCA,CAAA,KACA,CAAE;EAAE9F;AAAS,CAAC,KAAM;EACnBR,UAAU,CAAE,oDAAoD,EAAE;IACjEc,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE;EACd,CAAE,CAAC;EACHP,QAAQ,CAACC,QAAQ,CAAEZ,WAAY,CAAC,CAACyG,qBAAqB,CAAC,CAAC;AACzD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["apiFetch","store","preferencesStore","editorStore","privateApis","editorPrivateApis","deprecated","addAction","coreStore","noticesStore","__","getMetaBoxContainer","unlock","interfaceStore","openGeneralSidebar","name","registry","dispatch","enableComplementaryArea","closeGeneralSidebar","disableComplementaryArea","openModal","since","alternative","closeModal","openPublishSidebar","closePublishSidebar","togglePublishSidebar","toggleEditorPanelEnabled","panelName","toggleEditorPanelOpened","removeEditorPanel","toggleFeature","feature","toggle","switchEditorMode","mode","togglePinnedPluginItem","pluginName","isPinned","select","isItemPinned","updatePreferredStyleVariations","hint","type","showBlockTypes","blockNames","hideBlockTypes","setAvailableMetaBoxesPerLocation","metaBoxesPerLocation","requestMetaBoxUpdates","window","tinyMCE","triggerSave","baseFormData","FormData","document","querySelector","postId","get","postType","post","getEditedEntityRecord","additionalData","comment_status","ping_status","sticky","author","filter","Boolean","activeMetaBoxLocations","getActiveMetaBoxLocations","formDataToMerge","map","location","formData","reduce","memo","currentFormData","key","value","append","forEach","url","_wpMetaBoxUrl","method","body","parse","metaBoxUpdatesSuccess","metaBoxUpdatesFailure","__experimentalSetPreviewDeviceType","deviceType","version","setDeviceType","setIsInserterOpened","setIsListViewOpened","isOpen","setIsEditingTemplate","__unstableCreateTemplate","metaBoxesInitialized","initializeMetaBoxes","isEditorReady","__unstableIsEditorReady","getCurrentPostType","postboxes","page","add_postbox_toggles","options","isAutosave","hasMetaBoxes","toggleDistractionFree","toggleFullscreenMode","isFullscreen","createInfoNotice","id","actions","label","onClick"],"sources":["@wordpress/edit-post/src/store/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport deprecated from '@wordpress/deprecated';\nimport { addAction } from '@wordpress/hooks';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getMetaBoxContainer } from '../utils/meta-boxes';\nimport { unlock } from '../lock-unlock';\n\nconst { interfaceStore } = unlock( editorPrivateApis );\n\n/**\n * Returns an action object used in signalling that the user opened an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( 'core', name );\n\t};\n\n/**\n * Returns an action object signalling that the user closed the sidebar.\n */\nexport const closeGeneralSidebar =\n\t() =>\n\t( { registry } ) =>\n\t\tregistry.dispatch( interfaceStore ).disableComplementaryArea( 'core' );\n\n/**\n * Returns an action object used in signalling that the user opened a modal.\n *\n * @deprecated since WP 6.3 use `core/interface` store's action with the same name instead.\n *\n *\n * @param {string} name A string that uniquely identifies the modal.\n *\n * @return {Object} Action object.\n */\nexport const openModal =\n\t( name ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"select( 'core/edit-post' ).openModal( name )\", {\n\t\t\tsince: '6.3',\n\t\t\talternative: \"select( 'core/interface').openModal( name )\",\n\t\t} );\n\t\treturn registry.dispatch( interfaceStore ).openModal( name );\n\t};\n\n/**\n * Returns an action object signalling that the user closed a modal.\n *\n * @deprecated since WP 6.3 use `core/interface` store's action with the same name instead.\n *\n * @return {Object} Action object.\n */\nexport const closeModal =\n\t() =>\n\t( { registry } ) => {\n\t\tdeprecated( \"select( 'core/edit-post' ).closeModal()\", {\n\t\t\tsince: '6.3',\n\t\t\talternative: \"select( 'core/interface').closeModal()\",\n\t\t} );\n\t\treturn registry.dispatch( interfaceStore ).closeModal();\n\t};\n\n/**\n * Returns an action object used in signalling that the user opened the publish\n * sidebar.\n * @deprecated\n *\n * @return {Object} Action object\n */\nexport const openPublishSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).openPublishSidebar\", {\n\t\t\tsince: '6.6',\n\t\t\talternative: \"dispatch( 'core/editor').openPublishSidebar\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).openPublishSidebar();\n\t};\n\n/**\n * Returns an action object used in signalling that the user closed the\n * publish sidebar.\n * @deprecated\n *\n * @return {Object} Action object.\n */\nexport const closePublishSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).closePublishSidebar\", {\n\t\t\tsince: '6.6',\n\t\t\talternative: \"dispatch( 'core/editor').closePublishSidebar\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).closePublishSidebar();\n\t};\n\n/**\n * Returns an action object used in signalling that the user toggles the publish sidebar.\n * @deprecated\n *\n * @return {Object} Action object\n */\nexport const togglePublishSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).togglePublishSidebar\", {\n\t\t\tsince: '6.6',\n\t\t\talternative: \"dispatch( 'core/editor').togglePublishSidebar\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).togglePublishSidebar();\n\t};\n\n/**\n * Returns an action object used to enable or disable a panel in the editor.\n *\n * @deprecated\n *\n * @param {string} panelName A string that identifies the panel to enable or disable.\n *\n * @return {Object} Action object.\n */\nexport const toggleEditorPanelEnabled =\n\t( panelName ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).toggleEditorPanelEnabled\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').toggleEditorPanelEnabled\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).toggleEditorPanelEnabled( panelName );\n\t};\n\n/**\n * Opens a closed panel and closes an open panel.\n *\n * @deprecated\n *\n * @param {string} panelName A string that identifies the panel to open or close.\n */\nexport const toggleEditorPanelOpened =\n\t( panelName ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).toggleEditorPanelOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').toggleEditorPanelOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).toggleEditorPanelOpened( panelName );\n\t};\n\n/**\n * Returns an action object used to remove a panel from the editor.\n *\n * @deprecated\n *\n * @param {string} panelName A string that identifies the panel to remove.\n *\n * @return {Object} Action object.\n */\nexport const removeEditorPanel =\n\t( panelName ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).removeEditorPanel\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').removeEditorPanel\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).removeEditorPanel( panelName );\n\t};\n\n/**\n * Triggers an action used to toggle a feature flag.\n *\n * @param {string} feature Feature name.\n */\nexport const toggleFeature =\n\t( feature ) =>\n\t( { registry } ) =>\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-post', feature );\n\n/**\n * Triggers an action used to switch editor mode.\n *\n * @deprecated\n *\n * @param {string} mode The editor mode.\n */\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).switchEditorMode\", {\n\t\t\tsince: '6.6',\n\t\t\talternative: \"dispatch( 'core/editor').switchEditorMode\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).switchEditorMode( mode );\n\t};\n\n/**\n * Triggers an action object used to toggle a plugin name flag.\n *\n * @param {string} pluginName Plugin name.\n */\nexport const togglePinnedPluginItem =\n\t( pluginName ) =>\n\t( { registry } ) => {\n\t\tconst isPinned = registry\n\t\t\t.select( interfaceStore )\n\t\t\t.isItemPinned( 'core', pluginName );\n\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t[ isPinned ? 'unpinItem' : 'pinItem' ]( 'core', pluginName );\n\t};\n\n/**\n * Returns an action object used in signaling that a style should be auto-applied when a block is created.\n *\n * @deprecated\n */\nexport function updatePreferredStyleVariations() {\n\tdeprecated( \"dispatch( 'core/edit-post' ).updatePreferredStyleVariations\", {\n\t\tsince: '6.6',\n\t\thint: 'Preferred Style Variations are not supported anymore.',\n\t} );\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Update the provided block types to be visible.\n *\n * @param {string[]} blockNames Names of block types to show.\n */\nexport const showBlockTypes =\n\t( blockNames ) =>\n\t( { registry } ) => {\n\t\tunlock( registry.dispatch( editorStore ) ).showBlockTypes( blockNames );\n\t};\n\n/**\n * Update the provided block types to be hidden.\n *\n * @param {string[]} blockNames Names of block types to hide.\n */\nexport const hideBlockTypes =\n\t( blockNames ) =>\n\t( { registry } ) => {\n\t\tunlock( registry.dispatch( editorStore ) ).hideBlockTypes( blockNames );\n\t};\n\n/**\n * Stores info about which Meta boxes are available in which location.\n *\n * @param {Object} metaBoxesPerLocation Meta boxes per location.\n */\nexport function setAvailableMetaBoxesPerLocation( metaBoxesPerLocation ) {\n\treturn {\n\t\ttype: 'SET_META_BOXES_PER_LOCATIONS',\n\t\tmetaBoxesPerLocation,\n\t};\n}\n\n/**\n * Update a metabox.\n */\nexport const requestMetaBoxUpdates =\n\t() =>\n\tasync ( { registry, select, dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'REQUEST_META_BOX_UPDATES',\n\t\t} );\n\n\t\t// Saves the wp_editor fields.\n\t\tif ( window.tinyMCE ) {\n\t\t\twindow.tinyMCE.triggerSave();\n\t\t}\n\n\t\t// We gather the base form data.\n\t\tconst baseFormData = new window.FormData(\n\t\t\tdocument.querySelector( '.metabox-base-form' )\n\t\t);\n\n\t\tconst postId = baseFormData.get( 'post_ID' );\n\t\tconst postType = baseFormData.get( 'post_type' );\n\n\t\t// Additional data needed for backward compatibility.\n\t\t// If we do not provide this data, the post will be overridden with the default values.\n\t\t// We cannot rely on getCurrentPost because right now on the editor we may be editing a pattern or a template.\n\t\t// We need to retrieve the post that the base form data is referring to.\n\t\tconst post = registry\n\t\t\t.select( coreStore )\n\t\t\t.getEditedEntityRecord( 'postType', postType, postId );\n\t\tconst additionalData = [\n\t\t\tpost.comment_status\n\t\t\t\t? [ 'comment_status', post.comment_status ]\n\t\t\t\t: false,\n\t\t\tpost.ping_status ? [ 'ping_status', post.ping_status ] : false,\n\t\t\tpost.sticky ? [ 'sticky', post.sticky ] : false,\n\t\t\tpost.author ? [ 'post_author', post.author ] : false,\n\t\t].filter( Boolean );\n\n\t\t// We gather all the metaboxes locations.\n\t\tconst activeMetaBoxLocations = select.getActiveMetaBoxLocations();\n\t\tconst formDataToMerge = [\n\t\t\tbaseFormData,\n\t\t\t...activeMetaBoxLocations.map(\n\t\t\t\t( location ) =>\n\t\t\t\t\tnew window.FormData( getMetaBoxContainer( location ) )\n\t\t\t),\n\t\t];\n\n\t\t// Merge all form data objects into a single one.\n\t\tconst formData = formDataToMerge.reduce( ( memo, currentFormData ) => {\n\t\t\tfor ( const [ key, value ] of currentFormData ) {\n\t\t\t\tmemo.append( key, value );\n\t\t\t}\n\t\t\treturn memo;\n\t\t}, new window.FormData() );\n\t\tadditionalData.forEach( ( [ key, value ] ) =>\n\t\t\tformData.append( key, value )\n\t\t);\n\n\t\ttry {\n\t\t\t// Save the metaboxes.\n\t\t\tawait apiFetch( {\n\t\t\t\turl: window._wpMetaBoxUrl,\n\t\t\t\tmethod: 'POST',\n\t\t\t\tbody: formData,\n\t\t\t\tparse: false,\n\t\t\t} );\n\t\t\tdispatch.metaBoxUpdatesSuccess();\n\t\t} catch {\n\t\t\tdispatch.metaBoxUpdatesFailure();\n\t\t}\n\t};\n\n/**\n * Returns an action object used to signal a successful meta box update.\n *\n * @return {Object} Action object.\n */\nexport function metaBoxUpdatesSuccess() {\n\treturn {\n\t\ttype: 'META_BOX_UPDATES_SUCCESS',\n\t};\n}\n\n/**\n * Returns an action object used to signal a failed meta box update.\n *\n * @return {Object} Action object.\n */\nexport function metaBoxUpdatesFailure() {\n\treturn {\n\t\ttype: 'META_BOX_UPDATES_FAILURE',\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @deprecated\n *\n * @param {string} deviceType\n */\nexport const __experimentalSetPreviewDeviceType =\n\t( deviceType ) =>\n\t( { registry } ) => {\n\t\tdeprecated(\n\t\t\t\"dispatch( 'core/edit-post' ).__experimentalSetPreviewDeviceType\",\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\thint: 'registry.dispatch( editorStore ).setDeviceType',\n\t\t\t}\n\t\t);\n\t\tregistry.dispatch( editorStore ).setDeviceType( deviceType );\n\t};\n\n/**\n * Returns an action object used to open/close the inserter.\n *\n * @deprecated\n *\n * @param {boolean|Object} value Whether the inserter should be opened (true) or closed (false).\n */\nexport const setIsInserterOpened =\n\t( value ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).setIsInserterOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').setIsInserterOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).setIsInserterOpened( value );\n\t};\n\n/**\n * Returns an action object used to open/close the list view.\n *\n * @deprecated\n *\n * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.\n */\nexport const setIsListViewOpened =\n\t( isOpen ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).setIsListViewOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').setIsListViewOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).setIsListViewOpened( isOpen );\n\t};\n\n/**\n * Returns an action object used to switch to template editing.\n *\n * @deprecated\n */\nexport function setIsEditingTemplate() {\n\tdeprecated( \"dispatch( 'core/edit-post' ).setIsEditingTemplate\", {\n\t\tsince: '6.5',\n\t\talternative: \"dispatch( 'core/editor').setRenderingMode\",\n\t} );\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Create a block based template.\n *\n * @deprecated\n */\nexport function __unstableCreateTemplate() {\n\tdeprecated( \"dispatch( 'core/edit-post' ).__unstableCreateTemplate\", {\n\t\tsince: '6.5',\n\t} );\n\treturn { type: 'NOTHING' };\n}\n\nlet metaBoxesInitialized = false;\n\n/**\n * Initializes WordPress `postboxes` script and the logic for saving meta boxes.\n */\nexport const initializeMetaBoxes =\n\t() =>\n\t( { registry, select, dispatch } ) => {\n\t\tconst isEditorReady = registry\n\t\t\t.select( editorStore )\n\t\t\t.__unstableIsEditorReady();\n\n\t\tif ( ! isEditorReady ) {\n\t\t\treturn;\n\t\t}\n\t\t// Only initialize once.\n\t\tif ( metaBoxesInitialized ) {\n\t\t\treturn;\n\t\t}\n\t\tconst postType = registry.select( editorStore ).getCurrentPostType();\n\t\tif ( window.postboxes.page !== postType ) {\n\t\t\twindow.postboxes.add_postbox_toggles( postType );\n\t\t}\n\n\t\tmetaBoxesInitialized = true;\n\n\t\t// Save metaboxes on save completion, except for autosaves.\n\t\taddAction(\n\t\t\t'editor.savePost',\n\t\t\t'core/edit-post/save-metaboxes',\n\t\t\tasync ( post, options ) => {\n\t\t\t\tif ( ! options.isAutosave && select.hasMetaBoxes() ) {\n\t\t\t\t\tawait dispatch.requestMetaBoxUpdates();\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\tdispatch( {\n\t\t\ttype: 'META_BOXES_INITIALIZED',\n\t\t} );\n\t};\n\n/**\n * Action that toggles Distraction free mode.\n * Distraction free mode expects there are no sidebars, as due to the\n * z-index values set, you can't close sidebars.\n *\n * @deprecated\n */\nexport const toggleDistractionFree =\n\t() =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).toggleDistractionFree\", {\n\t\t\tsince: '6.6',\n\t\t\talternative: \"dispatch( 'core/editor').toggleDistractionFree\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).toggleDistractionFree();\n\t};\n\n/**\n * Action that toggles the Fullscreen Mode view option.\n */\nexport const toggleFullscreenMode =\n\t() =>\n\t( { registry } ) => {\n\t\tconst isFullscreen = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-post', 'fullscreenMode' );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-post', 'fullscreenMode' );\n\n\t\tregistry\n\t\t\t.dispatch( noticesStore )\n\t\t\t.createInfoNotice(\n\t\t\t\tisFullscreen\n\t\t\t\t\t? __( 'Fullscreen mode activated.' )\n\t\t\t\t\t: __( 'Fullscreen mode deactivated.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/toggle-fullscreen-mode/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\tregistry\n\t\t\t\t\t\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t\t\t\t\t\t.toggle(\n\t\t\t\t\t\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t\t\t\t\t\t'fullscreenMode'\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t};\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,QAAQ,MAAM,sBAAsB;AAC3C,SAASC,KAAK,IAAIC,gBAAgB,QAA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GhG,QAAQ,CAC3BwB,MAAM,CAAEtC,gBAAiB,CAAC,CAC1ByD,GAAG,CAAE,gBAAgB,EAAE,gBAAiB,CAAC;EAE3C3C,QAAQ,CACNC,QAAQ,CAAEf,gBAAiB,CAAC,CAC5BgC,MAAM,CAAE,gBAAgB,EAAE,gBAAiB,CAAC;EAE9ClB,QAAQ,CACNC,QAAQ,CAAER,YAAa,CAAC,CACxBwG,gBAAgB,CAChBD,YAAY,GACTtG,EAAE,CAAE,4BAA6B,CAAC,GAClCA,EAAE,CAAE,8BAA+B,CAAC,EACvC;IACCwG,EAAE,EAAE,8CAA8C;IAClDtE,IAAI,EAAE,UAAU;IAChBuE,OAAO,EAAE,CACR;MACCC,KAAK,EAAE1G,EAAE,CAAE,MAAO,CAAC;MAEnB2G,OAAO,EAAEA,CAAA,KAAM;QACdrG,QAAQ,CACNC,QAAQ,CAAEf,gBAAiB,CAAC,CAC5BgC,MAAM,CACN,gBAAgB,EAChB,gBACD,CAAC;MACH;IACD,CAAC;EAEH,CACD,CAAC;AACH,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-post",
3
- "version": "8.11.0",
3
+ "version": "8.12.0",
4
4
  "description": "Edit Post module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -26,6 +26,7 @@
26
26
  "main": "build/index.js",
27
27
  "module": "build-module/index.js",
28
28
  "react-native": "src/index",
29
+ "wpScript": true,
29
30
  "dependencies": {
30
31
  "@babel/runtime": "7.25.7",
31
32
  "@wordpress/a11y": "*",
@@ -67,6 +68,5 @@
67
68
  "publishConfig": {
68
69
  "access": "public"
69
70
  },
70
- "wpScript": true,
71
- "gitHead": "dcf4613b33b0eda14e203ac30f700ed0db70347f"
71
+ "gitHead": "510540d99f3d222a96f08d3d7b66c9e7a726f705"
72
72
  }
@@ -15,7 +15,7 @@ import { __ } from '@wordpress/i18n';
15
15
  import { store as editPostStore } from '../../store';
16
16
 
17
17
  function KeyboardShortcuts() {
18
- const { toggleFeature } = useDispatch( editPostStore );
18
+ const { toggleFullscreenMode } = useDispatch( editPostStore );
19
19
  const { registerShortcut } = useDispatch( keyboardShortcutsStore );
20
20
 
21
21
  useEffect( () => {
@@ -31,7 +31,7 @@ function KeyboardShortcuts() {
31
31
  }, [] );
32
32
 
33
33
  useShortcut( 'core/edit-post/toggle-fullscreen', () => {
34
- toggleFeature( 'fullscreenMode' );
34
+ toggleFullscreenMode();
35
35
  } );
36
36
 
37
37
  return null;
@@ -426,7 +426,7 @@ function Layout( {
426
426
  isDistractionFree: get( 'core', 'distractionFree' ),
427
427
  showMetaBoxes:
428
428
  ! DESIGN_POST_TYPES.includes( currentPostType ) &&
429
- isRenderingPostOnly,
429
+ ! isZoomOut(),
430
430
  isWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),
431
431
  templateId:
432
432
  supportsTemplateMode &&
@@ -11,39 +11,27 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
11
11
  */
12
12
  import { unlock } from '../../lock-unlock';
13
13
 
14
- const isGutenbergPlugin = globalThis.IS_GUTENBERG_PLUGIN ? true : false;
15
-
16
14
  export function useShouldIframe() {
17
- const {
18
- isBlockBasedTheme,
19
- hasV3BlocksOnly,
20
- isEditingTemplateOrPattern,
21
- isZoomOutMode,
22
- deviceType,
23
- } = useSelect( ( select ) => {
15
+ return useSelect( ( select ) => {
24
16
  const { getEditorSettings, getCurrentPostType, getDeviceType } =
25
17
  select( editorStore );
26
- const { isZoomOut } = unlock( select( blockEditorStore ) );
27
- const { getBlockTypes } = select( blocksStore );
28
- const editorSettings = getEditorSettings();
29
- return {
30
- isBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme,
31
- hasV3BlocksOnly: getBlockTypes().every( ( type ) => {
32
- return type.apiVersion >= 3;
33
- } ),
34
- isEditingTemplateOrPattern: [ 'wp_template', 'wp_block' ].includes(
35
- getCurrentPostType()
36
- ),
37
- isZoomOutMode: isZoomOut(),
38
- deviceType: getDeviceType(),
39
- };
18
+ return (
19
+ // If the theme is block based, we ALWAYS use the iframe for
20
+ // consistency across the post and site editor. The iframe was
21
+ // introduced long before the sited editor and block themes, so
22
+ // these themes are expecting it.
23
+ getEditorSettings().__unstableIsBlockBasedTheme ||
24
+ // For classic themes, we also still want to iframe all the special
25
+ // editor features and modes such as device previews, zoom out, and
26
+ // template/pattern editing.
27
+ getDeviceType() !== 'Desktop' ||
28
+ [ 'wp_template', 'wp_block' ].includes( getCurrentPostType() ) ||
29
+ unlock( select( blockEditorStore ) ).isZoomOut() ||
30
+ // Finally, still iframe the editor for classic themes if all blocks
31
+ // are v3 (which means they are marked as iframe-compatible).
32
+ select( blocksStore )
33
+ .getBlockTypes()
34
+ .every( ( type ) => type.apiVersion >= 3 )
35
+ );
40
36
  }, [] );
41
-
42
- return (
43
- hasV3BlocksOnly ||
44
- ( isGutenbergPlugin && isBlockBasedTheme ) ||
45
- isEditingTemplateOrPattern ||
46
- isZoomOutMode ||
47
- [ 'Tablet', 'Mobile' ].includes( deviceType )
48
- );
49
37
  }
@@ -4,8 +4,8 @@
4
4
  import { __ } from '@wordpress/i18n';
5
5
  import { useViewportMatch } from '@wordpress/compose';
6
6
  import { privateApis as editorPrivateApis } from '@wordpress/editor';
7
- import { PreferenceToggleMenuItem } from '@wordpress/preferences';
8
7
  import { displayShortcut } from '@wordpress/keycodes';
8
+ import { PreferenceToggleMenuItem } from '@wordpress/preferences';
9
9
 
10
10
  /**
11
11
  * Internal dependencies
@@ -29,9 +29,9 @@ const MoreMenu = () => {
29
29
  name="fullscreenMode"
30
30
  label={ __( 'Fullscreen mode' ) }
31
31
  info={ __( 'Show and hide the admin user interface' ) }
32
- messageActivated={ __( 'Fullscreen mode activated' ) }
32
+ messageActivated={ __( 'Fullscreen mode activated.' ) }
33
33
  messageDeactivated={ __(
34
- 'Fullscreen mode deactivated'
34
+ 'Fullscreen mode deactivated.'
35
35
  ) }
36
36
  shortcut={ displayShortcut.secondary( 'f' ) }
37
37
  />
package/src/index.js CHANGED
@@ -62,6 +62,7 @@ export function initializeEditor(
62
62
  dispatch( preferencesStore ).setDefaults( 'core', {
63
63
  allowRightClickOverrides: true,
64
64
  editorMode: 'visual',
65
+ editorTool: 'edit',
65
66
  fixedToolbar: false,
66
67
  hiddenBlockTypes: [],
67
68
  inactivePanels: [],
@@ -29,6 +29,7 @@ export function initializeEditor( id, postType, postId ) {
29
29
  welcomeGuide: true,
30
30
  } );
31
31
  dispatch( preferencesStore ).setDefaults( 'core', {
32
+ editorTool: 'edit',
32
33
  hiddenBlockTypes: [],
33
34
  inactivePanels: [],
34
35
  openPanels: [ 'post-status' ],
@@ -10,6 +10,8 @@ import {
10
10
  import deprecated from '@wordpress/deprecated';
11
11
  import { addAction } from '@wordpress/hooks';
12
12
  import { store as coreStore } from '@wordpress/core-data';
13
+ import { store as noticesStore } from '@wordpress/notices';
14
+ import { __ } from '@wordpress/i18n';
13
15
 
14
16
  /**
15
17
  * Internal dependencies
@@ -509,3 +511,44 @@ export const toggleDistractionFree =
509
511
  } );
510
512
  registry.dispatch( editorStore ).toggleDistractionFree();
511
513
  };
514
+
515
+ /**
516
+ * Action that toggles the Fullscreen Mode view option.
517
+ */
518
+ export const toggleFullscreenMode =
519
+ () =>
520
+ ( { registry } ) => {
521
+ const isFullscreen = registry
522
+ .select( preferencesStore )
523
+ .get( 'core/edit-post', 'fullscreenMode' );
524
+
525
+ registry
526
+ .dispatch( preferencesStore )
527
+ .toggle( 'core/edit-post', 'fullscreenMode' );
528
+
529
+ registry
530
+ .dispatch( noticesStore )
531
+ .createInfoNotice(
532
+ isFullscreen
533
+ ? __( 'Fullscreen mode activated.' )
534
+ : __( 'Fullscreen mode deactivated.' ),
535
+ {
536
+ id: 'core/edit-post/toggle-fullscreen-mode/notice',
537
+ type: 'snackbar',
538
+ actions: [
539
+ {
540
+ label: __( 'Undo' ),
541
+
542
+ onClick: () => {
543
+ registry
544
+ .dispatch( preferencesStore )
545
+ .toggle(
546
+ 'core/edit-post',
547
+ 'fullscreenMode'
548
+ );
549
+ },
550
+ },
551
+ ],
552
+ }
553
+ );
554
+ };