@wordpress/edit-post 7.14.0 → 7.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/device-preview/index.js +6 -6
- package/build/components/device-preview/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.js +7 -6
- package/build/components/header/header-toolbar/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.native.js +91 -49
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/index.js +1 -6
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/post-publish-button-or-toggle.js +0 -2
- package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build/components/layout/actions-panel.js +5 -10
- package/build/components/layout/actions-panel.js.map +1 -1
- package/build/components/layout/index.js +2 -12
- package/build/components/layout/index.js.map +1 -1
- package/build/components/text-editor/index.js +1 -1
- package/build/components/text-editor/index.js.map +1 -1
- package/build/components/visual-editor/header.native.js +1 -13
- package/build/components/visual-editor/header.native.js.map +1 -1
- package/build/components/visual-editor/index.js +1 -1
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/plugins/index.js +35 -6
- package/build/plugins/index.js.map +1 -1
- package/build/store/actions.js +12 -14
- package/build/store/actions.js.map +1 -1
- package/build-module/components/device-preview/index.js +6 -6
- package/build-module/components/device-preview/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.js +7 -6
- package/build-module/components/header/header-toolbar/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.native.js +92 -53
- package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
- package/build-module/components/header/index.js +1 -6
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/post-publish-button-or-toggle.js +0 -2
- package/build-module/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build-module/components/layout/actions-panel.js +5 -10
- package/build-module/components/layout/actions-panel.js.map +1 -1
- package/build-module/components/layout/index.js +4 -13
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/text-editor/index.js +2 -2
- package/build-module/components/text-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/header.native.js +1 -10
- package/build-module/components/visual-editor/header.native.js.map +1 -1
- package/build-module/components/visual-editor/index.js +2 -2
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/plugins/index.js +33 -6
- package/build-module/plugins/index.js.map +1 -1
- package/build-module/store/actions.js +11 -14
- package/build-module/store/actions.js.map +1 -1
- package/build-style/style-rtl.css +9 -13
- package/build-style/style.css +9 -13
- package/package.json +32 -32
- package/src/components/device-preview/index.js +35 -39
- package/src/components/header/header-toolbar/index.js +3 -2
- package/src/components/header/header-toolbar/index.native.js +124 -68
- package/src/components/header/header-toolbar/style.native.scss +23 -4
- package/src/components/header/index.js +12 -22
- package/src/components/header/post-publish-button-or-toggle.js +0 -2
- package/src/components/layout/actions-panel.js +5 -7
- package/src/components/layout/index.js +5 -14
- package/src/components/layout/style.native.scss +1 -1
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +11 -3
- package/src/components/text-editor/index.js +0 -2
- package/src/components/visual-editor/header.native.js +1 -17
- package/src/components/visual-editor/index.js +1 -6
- package/src/components/visual-editor/test/__snapshots__/index.native.js.snap +15 -0
- package/src/components/visual-editor/test/index.native.js +118 -1
- package/src/plugins/index.js +32 -8
- package/src/store/actions.js +18 -27
- package/src/style.scss +1 -7
- package/src/components/visual-editor/style.native.scss +0 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/store/actions.js"],"names":["openGeneralSidebar","name","registry","dispatch","interfaceStore","enableComplementaryArea","editPostStore","closeGeneralSidebar","disableComplementaryArea","openModal","since","alternative","closeModal","openPublishSidebar","type","closePublishSidebar","togglePublishSidebar","toggleEditorPanelEnabled","panelName","inactivePanels","select","preferencesStore","get","isPanelInactive","includes","updatedInactivePanels","filter","invactivePanelName","set","toggleEditorPanelOpened","openPanels","isPanelOpen","updatedOpenPanels","openPanelName","removeEditorPanel","toggleFeature","feature","toggle","switchEditorMode","mode","blockEditorStore","clearSelectedBlock","message","togglePinnedPluginItem","pluginName","isPinned","isItemPinned","updatePreferredStyleVariations","blockName","blockStyle","existingVariations","updatedVariations","showBlockTypes","blockNames","existingBlockNames","newBlockNames","Array","isArray","hideBlockTypes","mergedBlockNames","Set","setAvailableMetaBoxesPerLocation","metaBoxesPerLocation","requestMetaBoxUpdates","window","tinyMCE","triggerSave","post","editorStore","getCurrentPost","additionalData","comment_status","ping_status","sticky","author","Boolean","baseFormData","FormData","document","querySelector","activeMetaBoxLocations","getActiveMetaBoxLocations","formDataToMerge","map","location","formData","reduce","memo","currentFormData","key","value","append","forEach","url","_wpMetaBoxUrl","method","body","parse","metaBoxUpdatesSuccess","metaBoxUpdatesFailure","__experimentalSetPreviewDeviceType","deviceType","setIsInserterOpened","setIsListViewOpened","isOpen","setIsEditingTemplate","__unstableSwitchToTemplateMode","newTemplate","isWelcomeGuideActive","isFeatureActive","noticesStore","createSuccessNotice","__unstableCreateTemplate","template","savedTemplate","coreStore","saveEntityRecord","editEntityRecord","id","slug","metaBoxesInitialized","initializeMetaBoxes","isEditorReady","__unstableIsEditorReady","postType","getCurrentPostType","postboxes","page","add_postbox_toggles","wasSavingPost","isSavingPost","wasAutosavingPost","isAutosavingPost","subscribe","shouldTriggerMetaboxesSave","hasMetaBoxes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAlBA;AACA;AACA;;AAYA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,MAAMA,kBAAkB,GAC5BC,IAAF,IACA,CAAE;AAAEC,EAAAA;AAAF,CAAF,KACCA,QAAQ,CACNC,QADF,CACYC,gBADZ,EAEEC,uBAFF,CAE2BC,QAAcL,IAFzC,EAE+CA,IAF/C,CAHK;AAOP;AACA;AACA;;;;;AACO,MAAMM,mBAAmB,GAC/B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**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport apiFetch from '@wordpress/api-fetch';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { speak } from '@wordpress/a11y';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { getMetaBoxContainer } from '../utils/meta-boxes';\nimport { store as editPostStore } from '.';\n\n/**\n * Returns an action object used in signalling that the user opened an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { registry } ) =>\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( editPostStore.name, name );\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\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.disableComplementaryArea( editPostStore.name );\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 *\n * @return {Object} Action object\n */\nexport function openPublishSidebar() {\n\treturn {\n\t\ttype: 'OPEN_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user closed the\n * publish sidebar.\n *\n * @return {Object} Action object.\n */\nexport function closePublishSidebar() {\n\treturn {\n\t\ttype: 'CLOSE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user toggles the publish sidebar.\n *\n * @return {Object} Action object\n */\nexport function togglePublishSidebar() {\n\treturn {\n\t\ttype: 'TOGGLE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used to enable or disable a panel in the editor.\n *\n * @param {string} panelName A string that identifies the panel to enable or disable.\n *\n * @return {Object} Action object.\n */\nexport const toggleEditorPanelEnabled =\n\t( panelName ) =>\n\t( { registry } ) => {\n\t\tconst inactivePanels =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-post', 'inactivePanels' ) ?? [];\n\n\t\tconst isPanelInactive = !! inactivePanels?.includes( panelName );\n\n\t\t// If the panel is inactive, remove it to enable it, else add it to\n\t\t// make it inactive.\n\t\tlet updatedInactivePanels;\n\t\tif ( isPanelInactive ) {\n\t\t\tupdatedInactivePanels = inactivePanels.filter(\n\t\t\t\t( invactivePanelName ) => invactivePanelName !== panelName\n\t\t\t);\n\t\t} else {\n\t\t\tupdatedInactivePanels = [ ...inactivePanels, panelName ];\n\t\t}\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core/edit-post', 'inactivePanels', updatedInactivePanels );\n\t};\n\n/**\n * Opens a closed panel and closes an open panel.\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\tconst openPanels =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-post', 'openPanels' ) ?? [];\n\n\t\tconst isPanelOpen = !! openPanels?.includes( panelName );\n\n\t\t// If the panel is open, remove it to close it, else add it to\n\t\t// make it open.\n\t\tlet updatedOpenPanels;\n\t\tif ( isPanelOpen ) {\n\t\t\tupdatedOpenPanels = openPanels.filter(\n\t\t\t\t( openPanelName ) => openPanelName !== panelName\n\t\t\t);\n\t\t} else {\n\t\t\tupdatedOpenPanels = [ ...openPanels, panelName ];\n\t\t}\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core/edit-post', 'openPanels', updatedOpenPanels );\n\t};\n\n/**\n * Returns an action object used to remove a panel from the editor.\n *\n * @param {string} panelName A string that identifies the panel to remove.\n *\n * @return {Object} Action object.\n */\nexport function removeEditorPanel( panelName ) {\n\treturn {\n\t\ttype: 'REMOVE_PANEL',\n\t\tpanelName,\n\t};\n}\n\n/**\n * Triggers an action used to toggle a feature flag.\n *\n * @param {string} feature Feature name.\n */\nexport const toggleFeature =\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 * @param {string} mode The editor mode.\n */\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core/edit-post', 'editorMode', mode );\n\n\t\t// Unselect blocks when we switch to the code editor.\n\t\tif ( mode !== 'visual' ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\n\t\tconst message =\n\t\t\tmode === 'visual'\n\t\t\t\t? __( 'Visual editor selected' )\n\t\t\t\t: __( 'Code editor selected' );\n\t\tspeak( message, 'assertive' );\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/edit-post', pluginName );\n\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t[ isPinned ? 'unpinItem' : 'pinItem' ](\n\t\t\t\t'core/edit-post',\n\t\t\t\tpluginName\n\t\t\t);\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 * @param {string} blockName Name of the block.\n * @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the \"auto apply\" setting of the block is removed.\n */\nexport const updatePreferredStyleVariations =\n\t( blockName, blockStyle ) =>\n\t( { registry } ) => {\n\t\tif ( ! blockName ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst existingVariations =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-post', 'preferredStyleVariations' ) ?? {};\n\n\t\t// When the blockStyle is omitted, remove the block's preferred variation.\n\t\tif ( ! blockStyle ) {\n\t\t\tconst updatedVariations = {\n\t\t\t\t...existingVariations,\n\t\t\t};\n\n\t\t\tdelete updatedVariations[ blockName ];\n\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations',\n\t\t\t\t\tupdatedVariations\n\t\t\t\t);\n\t\t} else {\n\t\t\t// Else add the variation.\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set( 'core/edit-post', 'preferredStyleVariations', {\n\t\t\t\t\t...existingVariations,\n\t\t\t\t\t[ blockName ]: blockStyle,\n\t\t\t\t} );\n\t\t}\n\t};\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\tconst existingBlockNames =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-post', 'hiddenBlockTypes' ) ?? [];\n\n\t\tconst newBlockNames = existingBlockNames.filter(\n\t\t\t( type ) =>\n\t\t\t\t! (\n\t\t\t\t\tArray.isArray( blockNames ) ? blockNames : [ blockNames ]\n\t\t\t\t).includes( type )\n\t\t);\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core/edit-post', 'hiddenBlockTypes', newBlockNames );\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\tconst existingBlockNames =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-post', 'hiddenBlockTypes' ) ?? [];\n\n\t\tconst mergedBlockNames = new Set( [\n\t\t\t...existingBlockNames,\n\t\t\t...( Array.isArray( blockNames ) ? blockNames : [ blockNames ] ),\n\t\t] );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core/edit-post', 'hiddenBlockTypes', [\n\t\t\t\t...mergedBlockNames,\n\t\t\t] );\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// 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\tconst post = registry.select( editorStore ).getCurrentPost();\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 data and the base form data.\n\t\tconst baseFormData = new window.FormData(\n\t\t\tdocument.querySelector( '.metabox-base-form' )\n\t\t);\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 * Returns an action object used to toggle the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Returns an action object used to open/close the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to open/close the list view.\n *\n * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.\n * @return {Object} Action object.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Returns an action object used to switch to template editing.\n *\n * @param {boolean} value Is editing template.\n * @return {Object} Action object.\n */\nexport function setIsEditingTemplate( value ) {\n\treturn {\n\t\ttype: 'SET_IS_EDITING_TEMPLATE',\n\t\tvalue,\n\t};\n}\n\n/**\n * Switches to the template mode.\n *\n * @param {boolean} newTemplate Is new template.\n */\nexport const __unstableSwitchToTemplateMode =\n\t( newTemplate = false ) =>\n\t( { registry, select, dispatch } ) => {\n\t\tdispatch( setIsEditingTemplate( true ) );\n\t\tconst isWelcomeGuideActive = select.isFeatureActive(\n\t\t\t'welcomeGuideTemplate'\n\t\t);\n\t\tif ( ! isWelcomeGuideActive ) {\n\t\t\tconst message = newTemplate\n\t\t\t\t? __( \"Custom template created. You're in template mode now.\" )\n\t\t\t\t: __(\n\t\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t\t );\n\t\t\tregistry.dispatch( noticesStore ).createSuccessNotice( message, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t};\n\n/**\n * Create a block based template.\n *\n * @param {Object?} template Template to create and assign.\n */\nexport const __unstableCreateTemplate =\n\t( template ) =>\n\tasync ( { registry } ) => {\n\t\tconst savedTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\t\tconst post = registry.select( editorStore ).getCurrentPost();\n\t\tregistry\n\t\t\t.dispatch( coreStore )\n\t\t\t.editEntityRecord( 'postType', post.type, post.id, {\n\t\t\t\ttemplate: savedTemplate.slug,\n\t\t\t} );\n\t};\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\tlet wasSavingPost = registry.select( editorStore ).isSavingPost();\n\t\tlet wasAutosavingPost = registry\n\t\t\t.select( editorStore )\n\t\t\t.isAutosavingPost();\n\n\t\t// Save metaboxes when performing a full save on the post.\n\t\tregistry.subscribe( async () => {\n\t\t\tconst isSavingPost = registry.select( editorStore ).isSavingPost();\n\t\t\tconst isAutosavingPost = registry\n\t\t\t\t.select( editorStore )\n\t\t\t\t.isAutosavingPost();\n\n\t\t\t// Save metaboxes on save completion, except for autosaves.\n\t\t\tconst shouldTriggerMetaboxesSave =\n\t\t\t\twasSavingPost &&\n\t\t\t\t! wasAutosavingPost &&\n\t\t\t\t! isSavingPost &&\n\t\t\t\tselect.hasMetaBoxes();\n\n\t\t\t// Save current state for next inspection.\n\t\t\twasSavingPost = isSavingPost;\n\t\t\twasAutosavingPost = isAutosavingPost;\n\n\t\t\tif ( shouldTriggerMetaboxesSave ) {\n\t\t\t\tawait dispatch.requestMetaBoxUpdates();\n\t\t\t}\n\t\t} );\n\n\t\tdispatch( {\n\t\t\ttype: 'META_BOXES_INITIALIZED',\n\t\t} );\n\t};\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/store/actions.js"],"names":["openGeneralSidebar","name","registry","dispatch","interfaceStore","enableComplementaryArea","editPostStore","closeGeneralSidebar","disableComplementaryArea","openModal","since","alternative","closeModal","openPublishSidebar","type","closePublishSidebar","togglePublishSidebar","toggleEditorPanelEnabled","panelName","inactivePanels","select","preferencesStore","get","isPanelInactive","includes","updatedInactivePanels","filter","invactivePanelName","set","toggleEditorPanelOpened","openPanels","isPanelOpen","updatedOpenPanels","openPanelName","removeEditorPanel","toggleFeature","feature","toggle","switchEditorMode","mode","blockEditorStore","clearSelectedBlock","message","togglePinnedPluginItem","pluginName","isPinned","isItemPinned","updatePreferredStyleVariations","blockName","blockStyle","existingVariations","updatedVariations","showBlockTypes","blockNames","existingBlockNames","newBlockNames","Array","isArray","hideBlockTypes","mergedBlockNames","Set","setAvailableMetaBoxesPerLocation","metaBoxesPerLocation","requestMetaBoxUpdates","window","tinyMCE","triggerSave","post","editorStore","getCurrentPost","additionalData","comment_status","ping_status","sticky","author","Boolean","baseFormData","FormData","document","querySelector","activeMetaBoxLocations","getActiveMetaBoxLocations","formDataToMerge","map","location","formData","reduce","memo","currentFormData","key","value","append","forEach","url","_wpMetaBoxUrl","method","body","parse","metaBoxUpdatesSuccess","metaBoxUpdatesFailure","__experimentalSetPreviewDeviceType","deviceType","setIsInserterOpened","setIsListViewOpened","isOpen","setIsEditingTemplate","__unstableSwitchToTemplateMode","newTemplate","isWelcomeGuideActive","isFeatureActive","noticesStore","createSuccessNotice","__unstableCreateTemplate","template","savedTemplate","coreStore","saveEntityRecord","editEntityRecord","id","slug","metaBoxesInitialized","initializeMetaBoxes","isEditorReady","__unstableIsEditorReady","postType","getCurrentPostType","postboxes","page","add_postbox_toggles","previous","options","then","isAutosave","hasMetaBoxes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAnBA;AACA;AACA;;AAaA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,MAAMA,kBAAkB,GAC5BC,IAAF,IACA,CAAE;AAAEC,EAAAA;AAAF,CAAF,KACCA,QAAQ,CACNC,QADF,CACYC,gBADZ,EAEEC,uBAFF,CAE2BC,QAAcL,IAFzC,EAE+CA,IAF/C,CAHK;AAOP;AACA;AACA;;;;;AACO,MAAMM,mBAAmB,GAC/B,MACA,CAAE;AAAEL,EAAAA;AAAF,CAAF,KACCA,QAAQ,CACNC,QADF,CACYC,gBADZ,EAEEI,wBAFF,CAE4BF,QAAcL,IAF1C,CAHK;AAOP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMQ,SAAS,GACnBR,IAAF,IACA,CAAE;AAAEC,EAAAA;AAAF,CAAF,KAAoB;AACnB,2BAAY,8CAAZ,EAA4D;AAC3DQ,IAAAA,KAAK,EAAE,KADoD;AAE3DC,IAAAA,WAAW,EAAE;AAF8C,GAA5D;AAIA,SAAOT,QAAQ,CAACC,QAAT,CAAmBC,gBAAnB,EAAoCK,SAApC,CAA+CR,IAA/C,CAAP;AACA,CARK;AAUP;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMW,UAAU,GACtB,MACA,CAAE;AAAEV,EAAAA;AAAF,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pB,QAAKD,OAAO,CAACE,UAAb,EAA0B;AACzB;AACA;;AAED,QAAK,CAAEhH,MAAM,CAACiH,YAAP,EAAP,EAA+B;AAC9B;AACA;;AAED,WAAOlI,QAAQ,CAAC4D,qBAAT,EAAP;AACA,GAVD,CAJF;AAiBA5D,EAAAA,QAAQ,CAAE;AACTW,IAAAA,IAAI,EAAE;AADG,GAAF,CAAR;AAGA,CA1CK","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport apiFetch from '@wordpress/api-fetch';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { speak } from '@wordpress/a11y';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport deprecated from '@wordpress/deprecated';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { getMetaBoxContainer } from '../utils/meta-boxes';\nimport { store as editPostStore } from '.';\n\n/**\n * Returns an action object used in signalling that the user opened an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { registry } ) =>\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( editPostStore.name, name );\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\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.disableComplementaryArea( editPostStore.name );\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 *\n * @return {Object} Action object\n */\nexport function openPublishSidebar() {\n\treturn {\n\t\ttype: 'OPEN_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user closed the\n * publish sidebar.\n *\n * @return {Object} Action object.\n */\nexport function closePublishSidebar() {\n\treturn {\n\t\ttype: 'CLOSE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user toggles the publish sidebar.\n *\n * @return {Object} Action object\n */\nexport function togglePublishSidebar() {\n\treturn {\n\t\ttype: 'TOGGLE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used to enable or disable a panel in the editor.\n *\n * @param {string} panelName A string that identifies the panel to enable or disable.\n *\n * @return {Object} Action object.\n */\nexport const toggleEditorPanelEnabled =\n\t( panelName ) =>\n\t( { registry } ) => {\n\t\tconst inactivePanels =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-post', 'inactivePanels' ) ?? [];\n\n\t\tconst isPanelInactive = !! inactivePanels?.includes( panelName );\n\n\t\t// If the panel is inactive, remove it to enable it, else add it to\n\t\t// make it inactive.\n\t\tlet updatedInactivePanels;\n\t\tif ( isPanelInactive ) {\n\t\t\tupdatedInactivePanels = inactivePanels.filter(\n\t\t\t\t( invactivePanelName ) => invactivePanelName !== panelName\n\t\t\t);\n\t\t} else {\n\t\t\tupdatedInactivePanels = [ ...inactivePanels, panelName ];\n\t\t}\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core/edit-post', 'inactivePanels', updatedInactivePanels );\n\t};\n\n/**\n * Opens a closed panel and closes an open panel.\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\tconst openPanels =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-post', 'openPanels' ) ?? [];\n\n\t\tconst isPanelOpen = !! openPanels?.includes( panelName );\n\n\t\t// If the panel is open, remove it to close it, else add it to\n\t\t// make it open.\n\t\tlet updatedOpenPanels;\n\t\tif ( isPanelOpen ) {\n\t\t\tupdatedOpenPanels = openPanels.filter(\n\t\t\t\t( openPanelName ) => openPanelName !== panelName\n\t\t\t);\n\t\t} else {\n\t\t\tupdatedOpenPanels = [ ...openPanels, panelName ];\n\t\t}\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core/edit-post', 'openPanels', updatedOpenPanels );\n\t};\n\n/**\n * Returns an action object used to remove a panel from the editor.\n *\n * @param {string} panelName A string that identifies the panel to remove.\n *\n * @return {Object} Action object.\n */\nexport function removeEditorPanel( panelName ) {\n\treturn {\n\t\ttype: 'REMOVE_PANEL',\n\t\tpanelName,\n\t};\n}\n\n/**\n * Triggers an action used to toggle a feature flag.\n *\n * @param {string} feature Feature name.\n */\nexport const toggleFeature =\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 * @param {string} mode The editor mode.\n */\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core/edit-post', 'editorMode', mode );\n\n\t\t// Unselect blocks when we switch to the code editor.\n\t\tif ( mode !== 'visual' ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\n\t\tconst message =\n\t\t\tmode === 'visual'\n\t\t\t\t? __( 'Visual editor selected' )\n\t\t\t\t: __( 'Code editor selected' );\n\t\tspeak( message, 'assertive' );\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/edit-post', pluginName );\n\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t[ isPinned ? 'unpinItem' : 'pinItem' ](\n\t\t\t\t'core/edit-post',\n\t\t\t\tpluginName\n\t\t\t);\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 * @param {string} blockName Name of the block.\n * @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the \"auto apply\" setting of the block is removed.\n */\nexport const updatePreferredStyleVariations =\n\t( blockName, blockStyle ) =>\n\t( { registry } ) => {\n\t\tif ( ! blockName ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst existingVariations =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-post', 'preferredStyleVariations' ) ?? {};\n\n\t\t// When the blockStyle is omitted, remove the block's preferred variation.\n\t\tif ( ! blockStyle ) {\n\t\t\tconst updatedVariations = {\n\t\t\t\t...existingVariations,\n\t\t\t};\n\n\t\t\tdelete updatedVariations[ blockName ];\n\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations',\n\t\t\t\t\tupdatedVariations\n\t\t\t\t);\n\t\t} else {\n\t\t\t// Else add the variation.\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set( 'core/edit-post', 'preferredStyleVariations', {\n\t\t\t\t\t...existingVariations,\n\t\t\t\t\t[ blockName ]: blockStyle,\n\t\t\t\t} );\n\t\t}\n\t};\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\tconst existingBlockNames =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-post', 'hiddenBlockTypes' ) ?? [];\n\n\t\tconst newBlockNames = existingBlockNames.filter(\n\t\t\t( type ) =>\n\t\t\t\t! (\n\t\t\t\t\tArray.isArray( blockNames ) ? blockNames : [ blockNames ]\n\t\t\t\t).includes( type )\n\t\t);\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core/edit-post', 'hiddenBlockTypes', newBlockNames );\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\tconst existingBlockNames =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-post', 'hiddenBlockTypes' ) ?? [];\n\n\t\tconst mergedBlockNames = new Set( [\n\t\t\t...existingBlockNames,\n\t\t\t...( Array.isArray( blockNames ) ? blockNames : [ blockNames ] ),\n\t\t] );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core/edit-post', 'hiddenBlockTypes', [\n\t\t\t\t...mergedBlockNames,\n\t\t\t] );\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// 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\tconst post = registry.select( editorStore ).getCurrentPost();\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 data and the base form data.\n\t\tconst baseFormData = new window.FormData(\n\t\t\tdocument.querySelector( '.metabox-base-form' )\n\t\t);\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 * Returns an action object used to toggle the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Returns an action object used to open/close the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to open/close the list view.\n *\n * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.\n * @return {Object} Action object.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Returns an action object used to switch to template editing.\n *\n * @param {boolean} value Is editing template.\n * @return {Object} Action object.\n */\nexport function setIsEditingTemplate( value ) {\n\treturn {\n\t\ttype: 'SET_IS_EDITING_TEMPLATE',\n\t\tvalue,\n\t};\n}\n\n/**\n * Switches to the template mode.\n *\n * @param {boolean} newTemplate Is new template.\n */\nexport const __unstableSwitchToTemplateMode =\n\t( newTemplate = false ) =>\n\t( { registry, select, dispatch } ) => {\n\t\tdispatch( setIsEditingTemplate( true ) );\n\t\tconst isWelcomeGuideActive = select.isFeatureActive(\n\t\t\t'welcomeGuideTemplate'\n\t\t);\n\t\tif ( ! isWelcomeGuideActive ) {\n\t\t\tconst message = newTemplate\n\t\t\t\t? __( \"Custom template created. You're in template mode now.\" )\n\t\t\t\t: __(\n\t\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t\t );\n\t\t\tregistry.dispatch( noticesStore ).createSuccessNotice( message, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t};\n\n/**\n * Create a block based template.\n *\n * @param {Object?} template Template to create and assign.\n */\nexport const __unstableCreateTemplate =\n\t( template ) =>\n\tasync ( { registry } ) => {\n\t\tconst savedTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\t\tconst post = registry.select( editorStore ).getCurrentPost();\n\t\tregistry\n\t\t\t.dispatch( coreStore )\n\t\t\t.editEntityRecord( 'postType', post.type, post.id, {\n\t\t\t\ttemplate: savedTemplate.slug,\n\t\t\t} );\n\t};\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\taddFilter(\n\t\t\t'editor.__unstableSavePost',\n\t\t\t'core/edit-post/save-metaboxes',\n\t\t\t( previous, options ) =>\n\t\t\t\tprevious.then( () => {\n\t\t\t\t\tif ( options.isAutosave ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! select.hasMetaBoxes() ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn dispatch.requestMetaBoxUpdates();\n\t\t\t\t} )\n\t\t);\n\n\t\tdispatch( {\n\t\t\ttype: 'META_BOXES_INITIALIZED',\n\t\t} );\n\t};\n"]}
|
|
@@ -19,7 +19,6 @@ export default function DevicePreview() {
|
|
|
19
19
|
const {
|
|
20
20
|
hasActiveMetaboxes,
|
|
21
21
|
isPostSaveable,
|
|
22
|
-
isSaving,
|
|
23
22
|
isViewable,
|
|
24
23
|
deviceType
|
|
25
24
|
} = useSelect(select => {
|
|
@@ -34,7 +33,6 @@ export default function DevicePreview() {
|
|
|
34
33
|
const postType = getPostType(getEditedPostAttribute('type'));
|
|
35
34
|
return {
|
|
36
35
|
hasActiveMetaboxes: select(editPostStore).hasMetaBoxes(),
|
|
37
|
-
isSaving: select(editPostStore).isSavingMetaBoxes(),
|
|
38
36
|
isPostSaveable: select(editorStore).isEditedPostSaveable(),
|
|
39
37
|
isViewable: (_postType$viewable = postType?.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false,
|
|
40
38
|
deviceType: select(editPostStore).__experimentalGetPreviewDeviceType()
|
|
@@ -49,16 +47,18 @@ export default function DevicePreview() {
|
|
|
49
47
|
deviceType: deviceType,
|
|
50
48
|
setDeviceType: setPreviewDeviceType,
|
|
51
49
|
label: __('Preview')
|
|
52
|
-
},
|
|
50
|
+
}, ({
|
|
51
|
+
onClose
|
|
52
|
+
}) => isViewable && createElement(MenuGroup, null, createElement("div", {
|
|
53
53
|
className: "edit-post-header-preview__grouping-external"
|
|
54
54
|
}, createElement(PostPreviewButton, {
|
|
55
|
-
className:
|
|
55
|
+
className: "edit-post-header-preview__button-external",
|
|
56
56
|
role: "menuitem",
|
|
57
57
|
forceIsAutosaveable: hasActiveMetaboxes,
|
|
58
|
-
forcePreviewLink: isSaving ? null : undefined,
|
|
59
58
|
textContent: createElement(Fragment, null, __('Preview in new tab'), createElement(Icon, {
|
|
60
59
|
icon: external
|
|
61
|
-
}))
|
|
60
|
+
})),
|
|
61
|
+
onPreview: onClose
|
|
62
62
|
}))));
|
|
63
63
|
}
|
|
64
64
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/device-preview/index.js"],"names":["Icon","MenuGroup","PostPreviewButton","store","editorStore","external","__","__experimentalPreviewOptions","PreviewOptions","useDispatch","useSelect","coreStore","editPostStore","DevicePreview","hasActiveMetaboxes","isPostSaveable","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/device-preview/index.js"],"names":["Icon","MenuGroup","PostPreviewButton","store","editorStore","external","__","__experimentalPreviewOptions","PreviewOptions","useDispatch","useSelect","coreStore","editPostStore","DevicePreview","hasActiveMetaboxes","isPostSaveable","isViewable","deviceType","select","getEditedPostAttribute","getPostType","postType","hasMetaBoxes","isEditedPostSaveable","viewable","__experimentalGetPreviewDeviceType","__experimentalSetPreviewDeviceType","setPreviewDeviceType","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,SAAf,QAAgC,uBAAhC;AACA,SAASC,iBAAT,EAA4BC,KAAK,IAAIC,WAArC,QAAwD,mBAAxD;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,4BAA4B,IAAIC,cAAzC,QAA+D,yBAA/D;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASP,KAAK,IAAIQ,SAAlB,QAAmC,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,EAAC,UAFN;AAGC,IAAA,mBAAmB,EAAGF,kBAHvB;AAIC,IAAA,WAAW,EACV,8BACGR,EAAE,CAAE,oBAAF,CADL,EAEC,cAAC,IAAD;AAAM,MAAA,IAAI,EAAGD;AAAb,MAFD,CALF;AAUC,IAAA,SAAS,EAAGuB;AAVb,IADD,CADD,CATH,CADD;AA8BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Icon, MenuGroup } from '@wordpress/components';\nimport { PostPreviewButton, store as editorStore } from '@wordpress/editor';\nimport { external } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalPreviewOptions as PreviewOptions } from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nexport default function DevicePreview() {\n\tconst { hasActiveMetaboxes, isPostSaveable, isViewable, deviceType } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\t\tconst { getPostType } = select( coreStore );\n\t\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\n\t\t\treturn {\n\t\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\t\tisPostSaveable: select( editorStore ).isEditedPostSaveable(),\n\t\t\t\tisViewable: postType?.viewable ?? false,\n\t\t\t\tdeviceType:\n\t\t\t\t\tselect(\n\t\t\t\t\t\teditPostStore\n\t\t\t\t\t).__experimentalGetPreviewDeviceType(),\n\t\t\t};\n\t\t}, [] );\n\tconst { __experimentalSetPreviewDeviceType: setPreviewDeviceType } =\n\t\tuseDispatch( editPostStore );\n\n\treturn (\n\t\t<PreviewOptions\n\t\t\tisEnabled={ isPostSaveable }\n\t\t\tclassName=\"edit-post-post-preview-dropdown\"\n\t\t\tdeviceType={ deviceType }\n\t\t\tsetDeviceType={ setPreviewDeviceType }\n\t\t\tlabel={ __( 'Preview' ) }\n\t\t>\n\t\t\t{ ( { onClose } ) =>\n\t\t\t\tisViewable && (\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<div className=\"edit-post-header-preview__grouping-external\">\n\t\t\t\t\t\t\t<PostPreviewButton\n\t\t\t\t\t\t\t\tclassName=\"edit-post-header-preview__button-external\"\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\tforceIsAutosaveable={ hasActiveMetaboxes }\n\t\t\t\t\t\t\t\ttextContent={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\t\t\t<Icon icon={ external } />\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonPreview={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t)\n\t\t\t}\n\t\t</PreviewOptions>\n\t);\n}\n"]}
|
|
@@ -33,17 +33,14 @@ function HeaderToolbar() {
|
|
|
33
33
|
setIsInserterOpened,
|
|
34
34
|
setIsListViewOpened
|
|
35
35
|
} = useDispatch(editPostStore);
|
|
36
|
-
const {
|
|
37
|
-
get: getPreference
|
|
38
|
-
} = useSelect(preferencesStore);
|
|
39
|
-
const hasFixedToolbar = getPreference('core/edit-post', 'fixedToolbar');
|
|
40
36
|
const {
|
|
41
37
|
isInserterEnabled,
|
|
42
38
|
isInserterOpened,
|
|
43
39
|
isTextModeEnabled,
|
|
44
40
|
showIconLabels,
|
|
45
41
|
isListViewOpen,
|
|
46
|
-
listViewShortcut
|
|
42
|
+
listViewShortcut,
|
|
43
|
+
hasFixedToolbar
|
|
47
44
|
} = useSelect(select => {
|
|
48
45
|
const {
|
|
49
46
|
hasInserterItems,
|
|
@@ -61,6 +58,9 @@ function HeaderToolbar() {
|
|
|
61
58
|
const {
|
|
62
59
|
getShortcutRepresentation
|
|
63
60
|
} = select(keyboardShortcutsStore);
|
|
61
|
+
const {
|
|
62
|
+
get: getPreference
|
|
63
|
+
} = select(preferencesStore);
|
|
64
64
|
return {
|
|
65
65
|
// This setting (richEditingEnabled) should not live in the block editor's setting.
|
|
66
66
|
isInserterEnabled: getEditorMode() === 'visual' && getEditorSettings().richEditingEnabled && hasInserterItems(getBlockRootClientId(getBlockSelectionEnd())),
|
|
@@ -68,7 +68,8 @@ function HeaderToolbar() {
|
|
|
68
68
|
isTextModeEnabled: getEditorMode() === 'text',
|
|
69
69
|
showIconLabels: isFeatureActive('showIconLabels'),
|
|
70
70
|
isListViewOpen: isListViewOpened(),
|
|
71
|
-
listViewShortcut: getShortcutRepresentation('core/edit-post/toggle-list-view')
|
|
71
|
+
listViewShortcut: getShortcutRepresentation('core/edit-post/toggle-list-view'),
|
|
72
|
+
hasFixedToolbar: getPreference('core/edit-post', 'fixedToolbar')
|
|
72
73
|
};
|
|
73
74
|
}, []);
|
|
74
75
|
const isLargeViewport = useViewportMatch('medium');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/header-toolbar/index.js"],"names":["useViewportMatch","useSelect","useDispatch","__","_x","NavigableToolbar","ToolSelector","store","blockEditorStore","privateApis","blockEditorPrivateApis","EditorHistoryRedo","EditorHistoryUndo","editorStore","Button","ToolbarItem","listView","plus","useRef","useCallback","keyboardShortcutsStore","preferencesStore","editPostStore","unlock","useShouldContextualToolbarShow","preventDefault","event","HeaderToolbar","inserterButton","setIsInserterOpened","setIsListViewOpened","get","getPreference","hasFixedToolbar","isInserterEnabled","isInserterOpened","isTextModeEnabled","showIconLabels","isListViewOpen","listViewShortcut","select","hasInserterItems","getBlockRootClientId","getBlockSelectionEnd","getEditorSettings","getEditorMode","isFeatureActive","isListViewOpened","getShortcutRepresentation","richEditingEnabled","isLargeViewport","isWideViewport","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","toolbarAriaLabel","toggleListView","overflowItems","undefined","toggleInserter","current","focus","longLabel","shortLabel"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,gBAAT,QAAiC,oBAAjC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SACCC,gBADD,EAECC,YAFD,EAGCC,KAAK,IAAIC,gBAHV,EAICC,WAAW,IAAIC,sBAJhB,QAKO,yBALP;AAMA,SACCC,iBADD,EAECC,iBAFD,EAGCL,KAAK,IAAIM,WAHV,QAIO,mBAJP;AAKA,SAASC,MAAT,EAAiBC,WAAjB,QAAoC,uBAApC;AACA,SAASC,QAAT,EAAmBC,IAAnB,QAA+B,kBAA/B;AACA,SAASC,MAAT,EAAiBC,WAAjB,QAAoC,oBAApC;AACA,SAASZ,KAAK,IAAIa,sBAAlB,QAAgD,+BAAhD;AACA,SAASb,KAAK,IAAIc,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,SAASd,KAAK,IAAIe,aAAlB,QAAuC,gBAAvC;AACA,SAASC,MAAT,QAAuB,sBAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAqCD,MAAM,CAAEb,sBAAF,CAAjD;;AAEA,MAAMe,cAAc,GAAKC,KAAF,IAAa;AACnCA,EAAAA,KAAK,CAACD,cAAN;AACA,CAFD;;AAIA,SAASE,aAAT,GAAyB;AACxB,QAAMC,cAAc,GAAGV,MAAM,EAA7B;AACA,QAAM;AAAEW,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,MACL5B,WAAW,CAAEoB,aAAF,CADZ;AAEA,QAAM;AAAES,IAAAA,GAAG,EAAEC;AAAP,MAAyB/B,SAAS,CAAEoB,gBAAF,CAAxC;AACA,QAAMY,eAAe,GAAGD,aAAa,CAAE,gBAAF,EAAoB,cAApB,CAArC;AACA,QAAM;AACLE,IAAAA,iBADK;AAELC,IAAAA,gBAFK;AAGLC,IAAAA,iBAHK;AAILC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KAKC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,WAAD;AACC,IAAA,GAAG,EAAG3B,cADP;AAEC,IAAA,EAAE,EAAGd,MAFN;AAGC,IAAA,SAAS,EAAC,2CAHX;AAIC,IAAA,OAAO,EAAC,SAJT;AAKC,IAAA,SAAS,EAAGqB,gBALb;AAMC,IAAA,WAAW,EAAGV,cANf;AAOC,IAAA,OAAO,EAAGmC,cAPX;AAQC,IAAA,QAAQ,EAAG,CAAE1B,iBARd;AASC,IAAA,IAAI,EAAGjB,IATR;AAUC,IAAA,KAAK,EAAGoB,cAAc,GAAG2B,UAAH,GAAgBD,SAVvC;AAWC,IAAA,WAAW,EAAG,CAAE1B;AAXjB,IADD,EAcG,CAAEc,cAAc,IAAI,CAAEd,cAAtB,KACD,8BACGa,eAAe,IAAI,CAAEjB,eAArB,IACD,cAAC,WAAD;AACC,IAAA,EAAE,EAAG3B,YADN;AAEC,IAAA,WAAW,EAAG,CAAE+B,cAFjB;AAGC,IAAA,OAAO,EACNA,cAAc,GAAG,UAAH,GAAgBsB,SAJhC;AAMC,IAAA,QAAQ,EAAGvB;AANZ,IAFF,EAWC,cAAC,WAAD;AACC,IAAA,EAAE,EAAGxB,iBADN;AAEC,IAAA,WAAW,EAAG,CAAEyB,cAFjB;AAGC,IAAA,OAAO,EAAGA,cAAc,GAAG,UAAH,GAAgBsB;AAHzC,IAXD,EAgBC,cAAC,WAAD;AACC,IAAA,EAAE,EAAGhD,iBADN;AAEC,IAAA,WAAW,EAAG,CAAE0B,cAFjB;AAGC,IAAA,OAAO,EAAGA,cAAc,GAAG,UAAH,GAAgBsB;AAHzC,IAhBD,EAqBGD,aArBH,CAfF,CALD,CADD;AAgDA;;AAED,eAAe/B,aAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tNavigableToolbar,\n\tToolSelector,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tEditorHistoryRedo,\n\tEditorHistoryUndo,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport { listView, plus } from '@wordpress/icons';\nimport { useRef, useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nconst { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nfunction HeaderToolbar() {\n\tconst inserterButton = useRef();\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editPostStore );\n\tconst { get: getPreference } = useSelect( preferencesStore );\n\tconst hasFixedToolbar = getPreference( 'core/edit-post', 'fixedToolbar' );\n\tconst {\n\t\tisInserterEnabled,\n\t\tisInserterOpened,\n\t\tisTextModeEnabled,\n\t\tshowIconLabels,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t} = useSelect( ( select ) => {\n\t\tconst { hasInserterItems, getBlockRootClientId, getBlockSelectionEnd } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst { getEditorMode, isFeatureActive, isListViewOpened } =\n\t\t\tselect( editPostStore );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\n\t\treturn {\n\t\t\t// This setting (richEditingEnabled) should not live in the block editor's setting.\n\t\t\tisInserterEnabled:\n\t\t\t\tgetEditorMode() === 'visual' &&\n\t\t\t\tgetEditorSettings().richEditingEnabled &&\n\t\t\t\thasInserterItems(\n\t\t\t\t\tgetBlockRootClientId( getBlockSelectionEnd() )\n\t\t\t\t),\n\t\t\tisInserterOpened: select( editPostStore ).isInserterOpened(),\n\t\t\tisTextModeEnabled: getEditorMode() === 'text',\n\t\t\tshowIconLabels: isFeatureActive( 'showIconLabels' ),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/edit-post/toggle-list-view'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideViewport = useViewportMatch( 'wide' );\n\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useShouldContextualToolbarShow();\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\t// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.\n\tconst blockToolbarCanBeFocused =\n\t\tshouldShowContextualToolbar ||\n\t\tcanFocusHiddenToolbar ||\n\t\tfixedToolbarCanBeFocused;\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\tconst overflowItems = (\n\t\t<>\n\t\t\t<ToolbarItem\n\t\t\t\tas={ Button }\n\t\t\t\tclassName=\"edit-post-header-toolbar__document-overview-toggle\"\n\t\t\t\ticon={ listView }\n\t\t\t\tdisabled={ isTextModeEnabled }\n\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\tlabel={ __( 'Document Overview' ) }\n\t\t\t\tonClick={ toggleListView }\n\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t/>\n\t\t</>\n\t);\n\tconst toggleInserter = useCallback( () => {\n\t\tif ( isInserterOpened ) {\n\t\t\t// Focusing the inserter button should close the inserter popover.\n\t\t\t// However, there are some cases it won't close when the focus is lost.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/43090 for more details.\n\t\t\tinserterButton.current.focus();\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tsetIsInserterOpened( true );\n\t\t}\n\t}, [ isInserterOpened, setIsInserterOpened ] );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Toggle block inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName=\"edit-post-header-toolbar\"\n\t\t\taria-label={ toolbarAriaLabel }\n\t\t\tshouldUseKeyboardFocusShortcut={ ! blockToolbarCanBeFocused }\n\t\t>\n\t\t\t<div className=\"edit-post-header-toolbar__left\">\n\t\t\t\t<ToolbarItem\n\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tclassName=\"edit-post-header-toolbar__inserter-toggle\"\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\tonClick={ toggleInserter }\n\t\t\t\t\tdisabled={ ! isInserterEnabled }\n\t\t\t\t\ticon={ plus }\n\t\t\t\t\tlabel={ showIconLabels ? shortLabel : longLabel }\n\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t/>\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && ! hasFixedToolbar && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisabled={ isTextModeEnabled }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryUndo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryRedo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ overflowItems }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default HeaderToolbar;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/header-toolbar/index.js"],"names":["useViewportMatch","useSelect","useDispatch","__","_x","NavigableToolbar","ToolSelector","store","blockEditorStore","privateApis","blockEditorPrivateApis","EditorHistoryRedo","EditorHistoryUndo","editorStore","Button","ToolbarItem","listView","plus","useRef","useCallback","keyboardShortcutsStore","preferencesStore","editPostStore","unlock","useShouldContextualToolbarShow","preventDefault","event","HeaderToolbar","inserterButton","setIsInserterOpened","setIsListViewOpened","isInserterEnabled","isInserterOpened","isTextModeEnabled","showIconLabels","isListViewOpen","listViewShortcut","hasFixedToolbar","select","hasInserterItems","getBlockRootClientId","getBlockSelectionEnd","getEditorSettings","getEditorMode","isFeatureActive","isListViewOpened","getShortcutRepresentation","get","getPreference","richEditingEnabled","isLargeViewport","isWideViewport","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","toolbarAriaLabel","toggleListView","overflowItems","undefined","toggleInserter","current","focus","longLabel","shortLabel"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,gBAAT,QAAiC,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,EAAG3B,cADP;AAEC,IAAA,EAAE,EAAGd,MAFN;AAGC,IAAA,SAAS,EAAC,2CAHX;AAIC,IAAA,OAAO,EAAC,SAJT;AAKC,IAAA,SAAS,EAAGkB,gBALb;AAMC,IAAA,WAAW,EAAGP,cANf;AAOC,IAAA,OAAO,EAAGmC,cAPX;AAQC,IAAA,QAAQ,EAAG,CAAE7B,iBARd;AASC,IAAA,IAAI,EAAGd,IATR;AAUC,IAAA,KAAK,EAAGiB,cAAc,GAAG8B,UAAH,GAAgBD,SAVvC;AAWC,IAAA,WAAW,EAAG,CAAE7B;AAXjB,IADD,EAcG,CAAEiB,cAAc,IAAI,CAAEjB,cAAtB,KACD,8BACGgB,eAAe,IAAI,CAAEb,eAArB,IACD,cAAC,WAAD;AACC,IAAA,EAAE,EAAG/B,YADN;AAEC,IAAA,WAAW,EAAG,CAAE4B,cAFjB;AAGC,IAAA,OAAO,EACNA,cAAc,GAAG,UAAH,GAAgByB,SAJhC;AAMC,IAAA,QAAQ,EAAG1B;AANZ,IAFF,EAWC,cAAC,WAAD;AACC,IAAA,EAAE,EAAGrB,iBADN;AAEC,IAAA,WAAW,EAAG,CAAEsB,cAFjB;AAGC,IAAA,OAAO,EAAGA,cAAc,GAAG,UAAH,GAAgByB;AAHzC,IAXD,EAgBC,cAAC,WAAD;AACC,IAAA,EAAE,EAAGhD,iBADN;AAEC,IAAA,WAAW,EAAG,CAAEuB,cAFjB;AAGC,IAAA,OAAO,EAAGA,cAAc,GAAG,UAAH,GAAgByB;AAHzC,IAhBD,EAqBGD,aArBH,CAfF,CALD,CADD;AAgDA;;AAED,eAAe/B,aAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tNavigableToolbar,\n\tToolSelector,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tEditorHistoryRedo,\n\tEditorHistoryUndo,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport { listView, plus } from '@wordpress/icons';\nimport { useRef, useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nconst { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nfunction HeaderToolbar() {\n\tconst inserterButton = useRef();\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editPostStore );\n\tconst {\n\t\tisInserterEnabled,\n\t\tisInserterOpened,\n\t\tisTextModeEnabled,\n\t\tshowIconLabels,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t\thasFixedToolbar,\n\t} = useSelect( ( select ) => {\n\t\tconst { hasInserterItems, getBlockRootClientId, getBlockSelectionEnd } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst { getEditorMode, isFeatureActive, isListViewOpened } =\n\t\t\tselect( editPostStore );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\t\tconst { get: getPreference } = select( preferencesStore );\n\n\t\treturn {\n\t\t\t// This setting (richEditingEnabled) should not live in the block editor's setting.\n\t\t\tisInserterEnabled:\n\t\t\t\tgetEditorMode() === 'visual' &&\n\t\t\t\tgetEditorSettings().richEditingEnabled &&\n\t\t\t\thasInserterItems(\n\t\t\t\t\tgetBlockRootClientId( getBlockSelectionEnd() )\n\t\t\t\t),\n\t\t\tisInserterOpened: select( editPostStore ).isInserterOpened(),\n\t\t\tisTextModeEnabled: getEditorMode() === 'text',\n\t\t\tshowIconLabels: isFeatureActive( 'showIconLabels' ),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/edit-post/toggle-list-view'\n\t\t\t),\n\t\t\thasFixedToolbar: getPreference( 'core/edit-post', 'fixedToolbar' ),\n\t\t};\n\t}, [] );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideViewport = useViewportMatch( 'wide' );\n\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useShouldContextualToolbarShow();\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\t// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.\n\tconst blockToolbarCanBeFocused =\n\t\tshouldShowContextualToolbar ||\n\t\tcanFocusHiddenToolbar ||\n\t\tfixedToolbarCanBeFocused;\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\tconst overflowItems = (\n\t\t<>\n\t\t\t<ToolbarItem\n\t\t\t\tas={ Button }\n\t\t\t\tclassName=\"edit-post-header-toolbar__document-overview-toggle\"\n\t\t\t\ticon={ listView }\n\t\t\t\tdisabled={ isTextModeEnabled }\n\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\tlabel={ __( 'Document Overview' ) }\n\t\t\t\tonClick={ toggleListView }\n\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t/>\n\t\t</>\n\t);\n\tconst toggleInserter = useCallback( () => {\n\t\tif ( isInserterOpened ) {\n\t\t\t// Focusing the inserter button should close the inserter popover.\n\t\t\t// However, there are some cases it won't close when the focus is lost.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/43090 for more details.\n\t\t\tinserterButton.current.focus();\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tsetIsInserterOpened( true );\n\t\t}\n\t}, [ isInserterOpened, setIsInserterOpened ] );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Toggle block inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName=\"edit-post-header-toolbar\"\n\t\t\taria-label={ toolbarAriaLabel }\n\t\t\tshouldUseKeyboardFocusShortcut={ ! blockToolbarCanBeFocused }\n\t\t>\n\t\t\t<div className=\"edit-post-header-toolbar__left\">\n\t\t\t\t<ToolbarItem\n\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tclassName=\"edit-post-header-toolbar__inserter-toggle\"\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\tonClick={ toggleInserter }\n\t\t\t\t\tdisabled={ ! isInserterEnabled }\n\t\t\t\t\ticon={ plus }\n\t\t\t\t\tlabel={ showIconLabels ? shortLabel : longLabel }\n\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t/>\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && ! hasFixedToolbar && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisabled={ isTextModeEnabled }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryUndo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryRedo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ overflowItems }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default HeaderToolbar;\n"]}
|
|
@@ -3,26 +3,37 @@ import { createElement } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* External dependencies
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { ScrollView, StyleSheet, View } from 'react-native';
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { useCallback, useRef,
|
|
12
|
-
import { compose,
|
|
11
|
+
import { useCallback, useRef, useEffect, Platform } from '@wordpress/element';
|
|
12
|
+
import { compose, usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
13
13
|
import { withSelect, withDispatch } from '@wordpress/data';
|
|
14
14
|
import { withViewportMatch } from '@wordpress/viewport';
|
|
15
15
|
import { __ } from '@wordpress/i18n';
|
|
16
16
|
import { Inserter, BlockToolbar, store as blockEditorStore } from '@wordpress/block-editor';
|
|
17
17
|
import { ToolbarGroup, ToolbarButton } from '@wordpress/components';
|
|
18
|
-
import { keyboardClose,
|
|
18
|
+
import { keyboardClose, audio as audioIcon, media as imageIcon, video as videoIcon, gallery as galleryIcon } from '@wordpress/icons';
|
|
19
19
|
import { store as editorStore } from '@wordpress/editor';
|
|
20
|
+
import { createBlock } from '@wordpress/blocks';
|
|
21
|
+
import { toggleUndoButton, toggleRedoButton, subscribeOnUndoPressed, subscribeOnRedoPressed } from '@wordpress/react-native-bridge';
|
|
20
22
|
/**
|
|
21
23
|
* Internal dependencies
|
|
22
24
|
*/
|
|
23
25
|
|
|
24
26
|
import styles from './style.scss';
|
|
25
27
|
import { store as editPostStore } from '../../../store';
|
|
28
|
+
const shadowStyle = {
|
|
29
|
+
shadowOffset: {
|
|
30
|
+
width: 2,
|
|
31
|
+
height: 2
|
|
32
|
+
},
|
|
33
|
+
shadowOpacity: 1,
|
|
34
|
+
shadowRadius: 6,
|
|
35
|
+
elevation: 18
|
|
36
|
+
};
|
|
26
37
|
|
|
27
38
|
function HeaderToolbar({
|
|
28
39
|
hasRedo,
|
|
@@ -31,20 +42,34 @@ function HeaderToolbar({
|
|
|
31
42
|
undo,
|
|
32
43
|
showInserter,
|
|
33
44
|
showKeyboardHideButton,
|
|
34
|
-
|
|
45
|
+
insertBlock,
|
|
35
46
|
onHideKeyboard,
|
|
36
47
|
isRTL,
|
|
37
48
|
noContentSelected
|
|
38
49
|
}) {
|
|
39
|
-
const
|
|
40
|
-
const [
|
|
50
|
+
const anchorNodeRef = useRef();
|
|
51
|
+
const containerStyle = [usePreferredColorSchemeStyle(styles['header-toolbar__container'], styles['header-toolbar__container--dark']), {
|
|
52
|
+
borderTopWidth: StyleSheet.hairlineWidth
|
|
53
|
+
}];
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
const onUndoSubscription = subscribeOnUndoPressed(undo);
|
|
56
|
+
const onRedoSubscription = subscribeOnRedoPressed(redo);
|
|
57
|
+
return () => {
|
|
58
|
+
onUndoSubscription?.remove();
|
|
59
|
+
onRedoSubscription?.remove();
|
|
60
|
+
};
|
|
61
|
+
}, [undo, redo]);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
toggleUndoButton(!hasUndo);
|
|
64
|
+
}, [hasUndo]);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
toggleRedoButton(!hasRedo);
|
|
67
|
+
}, [hasRedo]);
|
|
41
68
|
const scrollViewRef = useRef(null);
|
|
42
69
|
|
|
43
70
|
const scrollToStart = () => {
|
|
44
71
|
// scrollview doesn't seem to automatically adjust to RTL on Android so, scroll to end when Android
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (isAndroid && isRTL) {
|
|
72
|
+
if (Platform.isAndroid && isRTL) {
|
|
48
73
|
scrollViewRef.current.scrollToEnd();
|
|
49
74
|
} else {
|
|
50
75
|
scrollViewRef.current.scrollTo({
|
|
@@ -53,49 +78,61 @@ function HeaderToolbar({
|
|
|
53
78
|
}
|
|
54
79
|
};
|
|
55
80
|
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
key: "redoButton",
|
|
70
|
-
title: __('Redo'),
|
|
71
|
-
icon: !isRTL ? redoIcon : undoIcon,
|
|
72
|
-
isDisabled: !hasRedo,
|
|
73
|
-
onClick: redo,
|
|
74
|
-
extraProps: {
|
|
75
|
-
hint: __('Double tap to redo last change')
|
|
76
|
-
}
|
|
77
|
-
})];
|
|
78
|
-
return isRTL ? buttons.reverse() : buttons;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const onToggleInserter = useCallback(isOpen => {
|
|
82
|
-
if (isOpen) {
|
|
83
|
-
wasNoContentSelected.current = noContentSelected;
|
|
81
|
+
const onInsertBlock = useCallback(blockType => () => {
|
|
82
|
+
insertBlock(createBlock(blockType), undefined, undefined, true, {
|
|
83
|
+
source: 'inserter_menu'
|
|
84
|
+
});
|
|
85
|
+
}, [insertBlock]);
|
|
86
|
+
const renderMediaButtons = createElement(ToolbarGroup, null, createElement(ToolbarButton, {
|
|
87
|
+
key: "imageButton",
|
|
88
|
+
title: __('Image'),
|
|
89
|
+
icon: imageIcon,
|
|
90
|
+
onClick: onInsertBlock('core/image'),
|
|
91
|
+
testID: "insert-image-button",
|
|
92
|
+
extraProps: {
|
|
93
|
+
hint: __('Insert Image Block')
|
|
84
94
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
95
|
+
}), createElement(ToolbarButton, {
|
|
96
|
+
key: "videoButton",
|
|
97
|
+
title: __('Video'),
|
|
98
|
+
icon: videoIcon,
|
|
99
|
+
onClick: onInsertBlock('core/video'),
|
|
100
|
+
testID: "insert-video-button",
|
|
101
|
+
extraProps: {
|
|
102
|
+
hint: __('Insert Video Block')
|
|
103
|
+
}
|
|
104
|
+
}), createElement(ToolbarButton, {
|
|
105
|
+
key: "galleryButton",
|
|
106
|
+
title: __('Gallery'),
|
|
107
|
+
icon: galleryIcon,
|
|
108
|
+
onClick: onInsertBlock('core/gallery'),
|
|
109
|
+
testID: "insert-gallery-button",
|
|
110
|
+
extraProps: {
|
|
111
|
+
hint: __('Insert Gallery Block')
|
|
112
|
+
}
|
|
113
|
+
}), createElement(ToolbarButton, {
|
|
114
|
+
key: "audioButton",
|
|
115
|
+
title: __('Audio'),
|
|
116
|
+
icon: audioIcon,
|
|
117
|
+
onClick: onInsertBlock('core/audio'),
|
|
118
|
+
testID: "insert-audio-button",
|
|
119
|
+
extraProps: {
|
|
120
|
+
hint: __('Insert Audio Block')
|
|
121
|
+
}
|
|
122
|
+
}));
|
|
91
123
|
/* translators: accessibility text for the editor toolbar */
|
|
92
124
|
|
|
93
125
|
const toolbarAriaLabel = __('Document tools');
|
|
94
126
|
|
|
127
|
+
const shadowColor = usePreferredColorSchemeStyle(styles['header-toolbar__keyboard-hide-shadow--light'], styles['header-toolbar__keyboard-hide-shadow--dark']);
|
|
128
|
+
const showKeyboardButtonStyles = [usePreferredColorSchemeStyle(styles['header-toolbar__keyboard-hide-container'], styles['header-toolbar__keyboard-hide-container--dark']), shadowStyle, {
|
|
129
|
+
shadowColor: Platform.isAndroid ? styles['header-toolbar__keyboard-hide-shadow--solid'].color : shadowColor.color
|
|
130
|
+
}];
|
|
95
131
|
return createElement(View, {
|
|
132
|
+
ref: anchorNodeRef,
|
|
96
133
|
testID: toolbarAriaLabel,
|
|
97
134
|
accessibilityLabel: toolbarAriaLabel,
|
|
98
|
-
style:
|
|
135
|
+
style: containerStyle
|
|
99
136
|
}, createElement(ScrollView, {
|
|
100
137
|
ref: scrollViewRef,
|
|
101
138
|
onContentSizeChange: scrollToStart,
|
|
@@ -105,11 +142,11 @@ function HeaderToolbar({
|
|
|
105
142
|
alwaysBounceHorizontal: false,
|
|
106
143
|
contentContainerStyle: styles['header-toolbar__scrollable-content']
|
|
107
144
|
}, createElement(Inserter, {
|
|
108
|
-
disabled: !showInserter
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
})
|
|
112
|
-
passedStyle:
|
|
145
|
+
disabled: !showInserter
|
|
146
|
+
}), noContentSelected && renderMediaButtons, createElement(BlockToolbar, {
|
|
147
|
+
anchorNodeRef: anchorNodeRef.current
|
|
148
|
+
})), showKeyboardHideButton && createElement(ToolbarGroup, {
|
|
149
|
+
passedStyle: showKeyboardButtonStyles
|
|
113
150
|
}, createElement(ToolbarButton, {
|
|
114
151
|
title: __('Hide keyboard'),
|
|
115
152
|
icon: keyboardClose,
|
|
@@ -142,7 +179,8 @@ export default compose([withSelect(select => {
|
|
|
142
179
|
};
|
|
143
180
|
}), withDispatch(dispatch => {
|
|
144
181
|
const {
|
|
145
|
-
clearSelectedBlock
|
|
182
|
+
clearSelectedBlock,
|
|
183
|
+
insertBlock
|
|
146
184
|
} = dispatch(blockEditorStore);
|
|
147
185
|
const {
|
|
148
186
|
togglePostTitleSelection
|
|
@@ -154,10 +192,11 @@ export default compose([withSelect(select => {
|
|
|
154
192
|
onHideKeyboard() {
|
|
155
193
|
clearSelectedBlock();
|
|
156
194
|
togglePostTitleSelection(false);
|
|
157
|
-
}
|
|
195
|
+
},
|
|
158
196
|
|
|
197
|
+
insertBlock
|
|
159
198
|
};
|
|
160
199
|
}), withViewportMatch({
|
|
161
200
|
isLargeViewport: 'medium'
|
|
162
|
-
})
|
|
201
|
+
})])(HeaderToolbar);
|
|
163
202
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/header-toolbar/index.native.js"],"names":["Platform","ScrollView","View","useCallback","useRef","useState","compose","withPreferredColorScheme","withSelect","withDispatch","withViewportMatch","__","Inserter","BlockToolbar","store","blockEditorStore","ToolbarGroup","ToolbarButton","keyboardClose","undo","undoIcon","redo","redoIcon","editorStore","styles","editPostStore","HeaderToolbar","hasRedo","hasUndo","showInserter","showKeyboardHideButton","getStylesFromColorScheme","onHideKeyboard","isRTL","noContentSelected","wasNoContentSelected","isInserterOpen","setIsInserterOpen","scrollViewRef","scrollToStart","isAndroid","OS","current","scrollToEnd","scrollTo","x","renderHistoryButtons","buttons","hint","reverse","onToggleInserter","isOpen","useExpandedMode","toolbarAriaLabel","select","getBlockRootClientId","getBlockSelectionEnd","hasInserterItems","hasSelectedBlock","getEditorSettings","isAnyBlockSelected","hasEditorRedo","hasEditorUndo","getEditorMode","richEditingEnabled","isTextModeEnabled","getSettings","dispatch","clearSelectedBlock","togglePostTitleSelection","isLargeViewport"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,UAAnB,EAA+BC,IAA/B,QAA2C,cAA3C;AAEA;AACA;AACA;;AACA,SAASC,WAAT,EAAsBC,MAAtB,EAA8BC,QAA9B,QAA8C,oBAA9C;AACA,SAASC,OAAT,EAAkBC,wBAAlB,QAAkD,oBAAlD;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,QADD,EAECC,YAFD,EAGCC,KAAK,IAAIC,gBAHV,QAIO,yBAJP;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aAAtB,EAFH;AAGN;AACAjC,IAAAA,YAAY,EACXyB,MAAM,CAAE7B,aAAF,CAAN,CAAwBsC,aAAxB,OAA4C,QAA5C,IACAJ,iBAAiB,GAAGK,kBADpB,IAEAP,gBAAgB,CACfF,oBAAoB,CAAEC,oBAAoB,EAAtB,CADL,CAPX;AAUNS,IAAAA,iBAAiB,EAChBX,MAAM,CAAE7B,aAAF,CAAN,CAAwBsC,aAAxB,OAA4C,MAXvC;AAYN9B,IAAAA,KAAK,EAAEqB,MAAM,CAAEvC,gBAAF,CAAN,CAA2BmD,WAA3B,GAAyCjC,KAZ1C;AAaNC,IAAAA,iBAAiB,EAAE,CAAE0B;AAbf,GAAP;AAeA,CAxBS,CADa,EA0BvBnD,YAAY,CAAI0D,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA;AAAF,MAAyBD,QAAQ,CAAEpD,gBAAF,CAAvC;AACA,QAAM;AAAEsD,IAAAA;AAAF,MAA+BF,QAAQ,CAAE5C,WAAF,CAA7C;AAEA,SAAO;AACNF,IAAAA,IAAI,EAAE8C,QAAQ,CAAE5C,WAAF,CAAR,CAAwBF,IADxB;AAENF,IAAAA,IAAI,EAAEgD,QAAQ,CAAE5C,WAAF,CAAR,CAAwBJ,IAFxB;;AAGNa,IAAAA,cAAc,GAAG;AAChBoC,MAAAA,kBAAkB;AAClBC,MAAAA,wBAAwB,CAAE,KAAF,CAAxB;AACA;;AANK,GAAP;AAQA,CAZW,CA1BW,EAuCvB3D,iBAAiB,CAAE;AAAE4D,EAAAA,eAAe,EAAE;AAAnB,CAAF,CAvCM,EAwCvB/D,wBAxCuB,CAAF,CAAP,CAyCVmB,aAzCU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { Platform, ScrollView, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useRef, useState } from '@wordpress/element';\nimport { compose, withPreferredColorScheme } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { withViewportMatch } from '@wordpress/viewport';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInserter,\n\tBlockToolbar,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { ToolbarGroup, ToolbarButton } from '@wordpress/components';\nimport {\n\tkeyboardClose,\n\tundo as undoIcon,\n\tredo as redoIcon,\n} from '@wordpress/icons';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport { store as editPostStore } from '../../../store';\n\nfunction HeaderToolbar( {\n\thasRedo,\n\thasUndo,\n\tredo,\n\tundo,\n\tshowInserter,\n\tshowKeyboardHideButton,\n\tgetStylesFromColorScheme,\n\tonHideKeyboard,\n\tisRTL,\n\tnoContentSelected,\n} ) {\n\tconst wasNoContentSelected = useRef( noContentSelected );\n\tconst [ isInserterOpen, setIsInserterOpen ] = useState( false );\n\n\tconst scrollViewRef = useRef( null );\n\tconst scrollToStart = () => {\n\t\t// scrollview doesn't seem to automatically adjust to RTL on Android so, scroll to end when Android\n\t\tconst isAndroid = Platform.OS === 'android';\n\t\tif ( isAndroid && isRTL ) {\n\t\t\tscrollViewRef.current.scrollToEnd();\n\t\t} else {\n\t\t\tscrollViewRef.current.scrollTo( { x: 0 } );\n\t\t}\n\t};\n\tconst renderHistoryButtons = () => {\n\t\tconst buttons = [\n\t\t\t/* TODO: replace with EditorHistoryRedo and EditorHistoryUndo. */\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"undoButton\"\n\t\t\t\ttitle={ __( 'Undo' ) }\n\t\t\t\ticon={ ! isRTL ? undoIcon : redoIcon }\n\t\t\t\tisDisabled={ ! hasUndo }\n\t\t\t\tonClick={ undo }\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Double tap to undo last change' ),\n\t\t\t\t} }\n\t\t\t/>,\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"redoButton\"\n\t\t\t\ttitle={ __( 'Redo' ) }\n\t\t\t\ticon={ ! isRTL ? redoIcon : undoIcon }\n\t\t\t\tisDisabled={ ! hasRedo }\n\t\t\t\tonClick={ redo }\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Double tap to redo last change' ),\n\t\t\t\t} }\n\t\t\t/>,\n\t\t];\n\n\t\treturn isRTL ? buttons.reverse() : buttons;\n\t};\n\n\tconst onToggleInserter = useCallback(\n\t\t( isOpen ) => {\n\t\t\tif ( isOpen ) {\n\t\t\t\twasNoContentSelected.current = noContentSelected;\n\t\t\t}\n\t\t\tsetIsInserterOpen( isOpen );\n\t\t},\n\t\t[ noContentSelected ]\n\t);\n\n\t// Expanded mode should be preserved while the inserter is open.\n\t// This way we prevent style updates during the opening transition.\n\tconst useExpandedMode = isInserterOpen\n\t\t? wasNoContentSelected.current\n\t\t: noContentSelected;\n\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\treturn (\n\t\t<View\n\t\t\ttestID={ toolbarAriaLabel }\n\t\t\taccessibilityLabel={ toolbarAriaLabel }\n\t\t\tstyle={ [\n\t\t\t\tgetStylesFromColorScheme(\n\t\t\t\t\tstyles[ 'header-toolbar__container' ],\n\t\t\t\t\tstyles[ 'header-toolbar__container--dark' ]\n\t\t\t\t),\n\t\t\t\tuseExpandedMode &&\n\t\t\t\t\tstyles[ 'header-toolbar__container--expanded' ],\n\t\t\t] }\n\t\t>\n\t\t\t<ScrollView\n\t\t\t\tref={ scrollViewRef }\n\t\t\t\tonContentSizeChange={ scrollToStart }\n\t\t\t\thorizontal={ true }\n\t\t\t\tshowsHorizontalScrollIndicator={ false }\n\t\t\t\tkeyboardShouldPersistTaps=\"always\"\n\t\t\t\talwaysBounceHorizontal={ false }\n\t\t\t\tcontentContainerStyle={\n\t\t\t\t\tstyles[ 'header-toolbar__scrollable-content' ]\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<Inserter\n\t\t\t\t\tdisabled={ ! showInserter }\n\t\t\t\t\tuseExpandedMode={ useExpandedMode }\n\t\t\t\t\tonToggle={ onToggleInserter }\n\t\t\t\t/>\n\t\t\t\t{ renderHistoryButtons() }\n\t\t\t\t<BlockToolbar />\n\t\t\t</ScrollView>\n\t\t\t{ showKeyboardHideButton && (\n\t\t\t\t<ToolbarGroup\n\t\t\t\t\tpassedStyle={\n\t\t\t\t\t\tstyles[ 'header-toolbar__keyboard-hide-container' ]\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ttitle={ __( 'Hide keyboard' ) }\n\t\t\t\t\t\ticon={ keyboardClose }\n\t\t\t\t\t\tonClick={ onHideKeyboard }\n\t\t\t\t\t\textraProps={ {\n\t\t\t\t\t\t\thint: __( 'Tap to hide the keyboard' ),\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t) }\n\t\t</View>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockSelectionEnd,\n\t\t\thasInserterItems,\n\t\t\thasSelectedBlock,\n\t\t} = select( blockEditorStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst isAnyBlockSelected = hasSelectedBlock();\n\t\treturn {\n\t\t\thasRedo: select( editorStore ).hasEditorRedo(),\n\t\t\thasUndo: select( editorStore ).hasEditorUndo(),\n\t\t\t// This setting (richEditingEnabled) should not live in the block editor's setting.\n\t\t\tshowInserter:\n\t\t\t\tselect( editPostStore ).getEditorMode() === 'visual' &&\n\t\t\t\tgetEditorSettings().richEditingEnabled &&\n\t\t\t\thasInserterItems(\n\t\t\t\t\tgetBlockRootClientId( getBlockSelectionEnd() )\n\t\t\t\t),\n\t\t\tisTextModeEnabled:\n\t\t\t\tselect( editPostStore ).getEditorMode() === 'text',\n\t\t\tisRTL: select( blockEditorStore ).getSettings().isRTL,\n\t\t\tnoContentSelected: ! isAnyBlockSelected,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { clearSelectedBlock } = dispatch( blockEditorStore );\n\t\tconst { togglePostTitleSelection } = dispatch( editorStore );\n\n\t\treturn {\n\t\t\tredo: dispatch( editorStore ).redo,\n\t\t\tundo: dispatch( editorStore ).undo,\n\t\t\tonHideKeyboard() {\n\t\t\t\tclearSelectedBlock();\n\t\t\t\ttogglePostTitleSelection( false );\n\t\t\t},\n\t\t};\n\t} ),\n\twithViewportMatch( { isLargeViewport: 'medium' } ),\n\twithPreferredColorScheme,\n] )( HeaderToolbar );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/header-toolbar/index.native.js"],"names":["ScrollView","StyleSheet","View","useCallback","useRef","useEffect","Platform","compose","usePreferredColorSchemeStyle","withSelect","withDispatch","withViewportMatch","__","Inserter","BlockToolbar","store","blockEditorStore","ToolbarGroup","ToolbarButton","keyboardClose","audio","audioIcon","media","imageIcon","video","videoIcon","gallery","galleryIcon","editorStore","createBlock","toggleUndoButton","toggleRedoButton","subscribeOnUndoPressed","subscribeOnRedoPressed","styles","editPostStore","shadowStyle","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","HeaderToolbar","hasRedo","hasUndo","redo","undo","showInserter","showKeyboardHideButton","insertBlock","onHideKeyboard","isRTL","noContentSelected","anchorNodeRef","containerStyle","borderTopWidth","hairlineWidth","onUndoSubscription","onRedoSubscription","remove","scrollViewRef","scrollToStart","isAndroid","current","scrollToEnd","scrollTo","x","onInsertBlock","blockType","undefined","source","renderMediaButtons","hint","toolbarAriaLabel","shadowColor","showKeyboardButtonStyles","color","select","getBlockRootClientId","getBlockSelectionEnd","hasInserterItems","hasSelectedBlock","getEditorSettings","isAnyBlockSelected","hasEditorRedo","hasEditorUndo","getEditorMode","richEditingEnabled","isTextModeEnabled","getSettings","dispatch","clearSelectedBlock","togglePostTitleSelection","isLargeViewport"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,UAAT,EAAqBC,UAArB,EAAiCC,IAAjC,QAA6C,cAA7C;AA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AAA,kBAAF;AAAsB1C,IAAAA;AAAtB,MACLyC,QAAQ,CAAE3E,gBAAF,CADT;AAEA,QAAM;AAAE6E,IAAAA;AAAF,MAA+BF,QAAQ,CAAE/D,WAAF,CAA7C;AAEA,SAAO;AACNkB,IAAAA,IAAI,EAAE6C,QAAQ,CAAE/D,WAAF,CAAR,CAAwBkB,IADxB;AAENC,IAAAA,IAAI,EAAE4C,QAAQ,CAAE/D,WAAF,CAAR,CAAwBmB,IAFxB;;AAGNI,IAAAA,cAAc,GAAG;AAChByC,MAAAA,kBAAkB;AAClBC,MAAAA,wBAAwB,CAAE,KAAF,CAAxB;AACA,KANK;;AAON3C,IAAAA;AAPM,GAAP;AASA,CAdW,CA1BW,EAyCvBvC,iBAAiB,CAAE;AAAEmF,EAAAA,eAAe,EAAE;AAAnB,CAAF,CAzCM,CAAF,CAAP,CA0CVnD,aA1CU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { ScrollView, StyleSheet, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useRef, useEffect, Platform } from '@wordpress/element';\nimport { compose, usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { withViewportMatch } from '@wordpress/viewport';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInserter,\n\tBlockToolbar,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { ToolbarGroup, ToolbarButton } from '@wordpress/components';\nimport {\n\tkeyboardClose,\n\taudio as audioIcon,\n\tmedia as imageIcon,\n\tvideo as videoIcon,\n\tgallery as galleryIcon,\n} from '@wordpress/icons';\nimport { store as editorStore } from '@wordpress/editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\ttoggleUndoButton,\n\ttoggleRedoButton,\n\tsubscribeOnUndoPressed,\n\tsubscribeOnRedoPressed,\n} from '@wordpress/react-native-bridge';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport { store as editPostStore } from '../../../store';\n\nconst shadowStyle = {\n\tshadowOffset: { width: 2, height: 2 },\n\tshadowOpacity: 1,\n\tshadowRadius: 6,\n\televation: 18,\n};\n\nfunction HeaderToolbar( {\n\thasRedo,\n\thasUndo,\n\tredo,\n\tundo,\n\tshowInserter,\n\tshowKeyboardHideButton,\n\tinsertBlock,\n\tonHideKeyboard,\n\tisRTL,\n\tnoContentSelected,\n} ) {\n\tconst anchorNodeRef = useRef();\n\n\tconst containerStyle = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles[ 'header-toolbar__container' ],\n\t\t\tstyles[ 'header-toolbar__container--dark' ]\n\t\t),\n\t\t{ borderTopWidth: StyleSheet.hairlineWidth },\n\t];\n\n\tuseEffect( () => {\n\t\tconst onUndoSubscription = subscribeOnUndoPressed( undo );\n\t\tconst onRedoSubscription = subscribeOnRedoPressed( redo );\n\n\t\treturn () => {\n\t\t\tonUndoSubscription?.remove();\n\t\t\tonRedoSubscription?.remove();\n\t\t};\n\t}, [ undo, redo ] );\n\n\tuseEffect( () => {\n\t\ttoggleUndoButton( ! hasUndo );\n\t}, [ hasUndo ] );\n\n\tuseEffect( () => {\n\t\ttoggleRedoButton( ! hasRedo );\n\t}, [ hasRedo ] );\n\n\tconst scrollViewRef = useRef( null );\n\tconst scrollToStart = () => {\n\t\t// scrollview doesn't seem to automatically adjust to RTL on Android so, scroll to end when Android\n\t\tif ( Platform.isAndroid && isRTL ) {\n\t\t\tscrollViewRef.current.scrollToEnd();\n\t\t} else {\n\t\t\tscrollViewRef.current.scrollTo( { x: 0 } );\n\t\t}\n\t};\n\n\tconst onInsertBlock = useCallback(\n\t\t( blockType ) => () => {\n\t\t\tinsertBlock( createBlock( blockType ), undefined, undefined, true, {\n\t\t\t\tsource: 'inserter_menu',\n\t\t\t} );\n\t\t},\n\t\t[ insertBlock ]\n\t);\n\n\tconst renderMediaButtons = (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"imageButton\"\n\t\t\t\ttitle={ __( 'Image' ) }\n\t\t\t\ticon={ imageIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/image' ) }\n\t\t\t\ttestID=\"insert-image-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Image Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"videoButton\"\n\t\t\t\ttitle={ __( 'Video' ) }\n\t\t\t\ticon={ videoIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/video' ) }\n\t\t\t\ttestID=\"insert-video-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Video Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"galleryButton\"\n\t\t\t\ttitle={ __( 'Gallery' ) }\n\t\t\t\ticon={ galleryIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/gallery' ) }\n\t\t\t\ttestID=\"insert-gallery-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Gallery Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"audioButton\"\n\t\t\t\ttitle={ __( 'Audio' ) }\n\t\t\t\ticon={ audioIcon }\n\t\t\t\tonClick={ onInsertBlock( 'core/audio' ) }\n\t\t\t\ttestID=\"insert-audio-button\"\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Insert Audio Block' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t</ToolbarGroup>\n\t);\n\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst shadowColor = usePreferredColorSchemeStyle(\n\t\tstyles[ 'header-toolbar__keyboard-hide-shadow--light' ],\n\t\tstyles[ 'header-toolbar__keyboard-hide-shadow--dark' ]\n\t);\n\tconst showKeyboardButtonStyles = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles[ 'header-toolbar__keyboard-hide-container' ],\n\t\t\tstyles[ 'header-toolbar__keyboard-hide-container--dark' ]\n\t\t),\n\t\tshadowStyle,\n\t\t{\n\t\t\tshadowColor: Platform.isAndroid\n\t\t\t\t? styles[ 'header-toolbar__keyboard-hide-shadow--solid' ].color\n\t\t\t\t: shadowColor.color,\n\t\t},\n\t];\n\n\treturn (\n\t\t<View\n\t\t\tref={ anchorNodeRef }\n\t\t\ttestID={ toolbarAriaLabel }\n\t\t\taccessibilityLabel={ toolbarAriaLabel }\n\t\t\tstyle={ containerStyle }\n\t\t>\n\t\t\t<ScrollView\n\t\t\t\tref={ scrollViewRef }\n\t\t\t\tonContentSizeChange={ scrollToStart }\n\t\t\t\thorizontal={ true }\n\t\t\t\tshowsHorizontalScrollIndicator={ false }\n\t\t\t\tkeyboardShouldPersistTaps=\"always\"\n\t\t\t\talwaysBounceHorizontal={ false }\n\t\t\t\tcontentContainerStyle={\n\t\t\t\t\tstyles[ 'header-toolbar__scrollable-content' ]\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<Inserter disabled={ ! showInserter } />\n\n\t\t\t\t{ noContentSelected && renderMediaButtons }\n\t\t\t\t<BlockToolbar anchorNodeRef={ anchorNodeRef.current } />\n\t\t\t</ScrollView>\n\t\t\t{ showKeyboardHideButton && (\n\t\t\t\t<ToolbarGroup passedStyle={ showKeyboardButtonStyles }>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ttitle={ __( 'Hide keyboard' ) }\n\t\t\t\t\t\ticon={ keyboardClose }\n\t\t\t\t\t\tonClick={ onHideKeyboard }\n\t\t\t\t\t\textraProps={ {\n\t\t\t\t\t\t\thint: __( 'Tap to hide the keyboard' ),\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t) }\n\t\t</View>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockSelectionEnd,\n\t\t\thasInserterItems,\n\t\t\thasSelectedBlock,\n\t\t} = select( blockEditorStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst isAnyBlockSelected = hasSelectedBlock();\n\t\treturn {\n\t\t\thasRedo: select( editorStore ).hasEditorRedo(),\n\t\t\thasUndo: select( editorStore ).hasEditorUndo(),\n\t\t\t// This setting (richEditingEnabled) should not live in the block editor's setting.\n\t\t\tshowInserter:\n\t\t\t\tselect( editPostStore ).getEditorMode() === 'visual' &&\n\t\t\t\tgetEditorSettings().richEditingEnabled &&\n\t\t\t\thasInserterItems(\n\t\t\t\t\tgetBlockRootClientId( getBlockSelectionEnd() )\n\t\t\t\t),\n\t\t\tisTextModeEnabled:\n\t\t\t\tselect( editPostStore ).getEditorMode() === 'text',\n\t\t\tisRTL: select( blockEditorStore ).getSettings().isRTL,\n\t\t\tnoContentSelected: ! isAnyBlockSelected,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { clearSelectedBlock, insertBlock } =\n\t\t\tdispatch( blockEditorStore );\n\t\tconst { togglePostTitleSelection } = dispatch( editorStore );\n\n\t\treturn {\n\t\t\tredo: dispatch( editorStore ).redo,\n\t\t\tundo: dispatch( editorStore ).undo,\n\t\t\tonHideKeyboard() {\n\t\t\t\tclearSelectedBlock();\n\t\t\t\ttogglePostTitleSelection( false );\n\t\t\t},\n\t\t\tinsertBlock,\n\t\t};\n\t} ),\n\twithViewportMatch( { isLargeViewport: 'medium' } ),\n] )( HeaderToolbar );\n"]}
|