diff --git a/packages/edit-site/src/components/editor/use-resolve-edited-entity.js b/packages/edit-site/src/components/editor/use-resolve-edited-entity.js index c460fd28870d95..0288ba0cd0ac3b 100644 --- a/packages/edit-site/src/components/editor/use-resolve-edited-entity.js +++ b/packages/edit-site/src/components/editor/use-resolve-edited-entity.js @@ -47,8 +47,6 @@ function getPostType( name ) { postType = 'page'; } else if ( name === 'post-item' || name === 'posts' ) { postType = 'post'; - } else if ( name === 'attachment-item' ) { - postType = ATTACHMENT_POST_TYPE; } return postType; diff --git a/packages/edit-site/src/components/site-editor-routes/attachment-item.js b/packages/edit-site/src/components/site-editor-routes/attachment-item.js deleted file mode 100644 index 9a5c7637e9b453..00000000000000 --- a/packages/edit-site/src/components/site-editor-routes/attachment-item.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * WordPress dependencies - */ -import { __ } from '@wordpress/i18n'; - -/** - * Internal dependencies - */ -import Editor from '../editor'; -import SidebarNavigationScreen from '../sidebar-navigation-screen'; - -export const attachmentItemRoute = { - name: 'attachment-item', - path: '/attachment/:postId', - areas: { - sidebar: ( - - ), - mobile: , - preview: , - }, -}; diff --git a/packages/edit-site/src/components/site-editor-routes/index.js b/packages/edit-site/src/components/site-editor-routes/index.js index 231cae42894f69..db4307df7a6f9e 100644 --- a/packages/edit-site/src/components/site-editor-routes/index.js +++ b/packages/edit-site/src/components/site-editor-routes/index.js @@ -21,12 +21,10 @@ import { templatesRoute } from './templates'; import { templateItemRoute } from './template-item'; import { pagesRoute } from './pages'; import { pageItemRoute } from './page-item'; -import { attachmentItemRoute } from './attachment-item'; import { stylebookRoute } from './stylebook'; import { notFoundRoute } from './notfound'; const routes = [ - ...( window?.__experimentalMediaEditor ? [ attachmentItemRoute ] : [] ), pageItemRoute, pagesRoute, templateItemRoute, diff --git a/packages/editor/src/components/editor-interface/index.js b/packages/editor/src/components/editor-interface/index.js index d90b72212100d3..a60de573266f64 100644 --- a/packages/editor/src/components/editor-interface/index.js +++ b/packages/editor/src/components/editor-interface/index.js @@ -36,7 +36,6 @@ import SavePublishPanels from '../save-publish-panels'; import TextEditor from '../text-editor'; import VisualEditor from '../visual-editor'; import StylesCanvas from '../styles-canvas'; -import { MediaPreview } from '../media'; const interfaceLabels = { /* translators: accessibility text for the editor top bar landmark region. */ @@ -83,7 +82,6 @@ export default function EditorInterface( { mode, postId, postType, - isAttachment, isInserterOpened, isListViewOpened, isDistractionFree, @@ -130,9 +128,6 @@ export default function EditorInterface( { postTypeLabel: getPostTypeLabel(), stylesPath: getStylesPath(), showStylebook: getShowStylebook(), - isAttachment: - getCurrentPostType() === 'attachment' && - window?.__experimentalMediaEditor, isRevisionsMode: _isRevisionsMode(), showDiff: isShowingRevisionDiff(), }; @@ -147,12 +142,9 @@ export default function EditorInterface( { const secondarySidebarLabel = isListViewOpened ? __( 'Document Overview' ) : __( 'Block Library' ); - const shouldShowMediaEditor = !! isAttachment; const shouldShowStylesCanvas = - ! isAttachment && - ( showStylebook || stylesPath?.startsWith( '/revisions' ) ); - const shouldShowBlockEditor = - ! shouldShowMediaEditor && ! shouldShowStylesCanvas; + showStylebook || stylesPath?.startsWith( '/revisions' ); + const shouldShowBlockEditor = ! shouldShowStylesCanvas; // Local state for save panel. // Note 'truthy' callback implies an open panel. @@ -211,7 +203,6 @@ export default function EditorInterface( { } editorNotices={ } secondarySidebar={ - ! isAttachment && ! isPreviewMode && mode === 'visual' && ( ( isInserterOpened && ) || @@ -224,9 +215,6 @@ export default function EditorInterface( { content={ <> { ! isDistractionFree && ! isPreviewMode && } - { shouldShowMediaEditor && ( - - ) } { shouldShowStylesCanvas && } { shouldShowBlockEditor && ( <> diff --git a/packages/editor/src/components/header/index.js b/packages/editor/src/components/header/index.js index 6f374aa0848fb4..7f270ff485ae05 100644 --- a/packages/editor/src/components/header/index.js +++ b/packages/editor/src/components/header/index.js @@ -50,7 +50,6 @@ function Header( { hasBlockSelection, hasSectionRootClientId, isStylesCanvasActive, - isAttachment, } = useSelect( ( select ) => { const { get: getPreference } = select( preferencesStore ); const { @@ -78,9 +77,6 @@ function Header( { isStylesCanvasActive: !! getStylesPath()?.startsWith( '/revisions' ) || getShowStylebook(), - isAttachment: - getCurrentPostType() === ATTACHMENT_POST_TYPE && - window?.__experimentalMediaEditor, }; }, [] ); @@ -109,13 +105,11 @@ function Header( { - { ! isAttachment && ( - - ) } + { hasFixedToolbar && isLargeViewport && ( ) } { customSaveButton } - { ! isAttachment && } + } /> diff --git a/packages/editor/src/components/media/index.js b/packages/editor/src/components/media/index.js deleted file mode 100644 index 88d892af3473c8..00000000000000 --- a/packages/editor/src/components/media/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default as MediaPreview } from './preview'; -export { default as MediaMetadataPanel } from './metadata-panel'; diff --git a/packages/editor/src/components/media/metadata-panel.js b/packages/editor/src/components/media/metadata-panel.js deleted file mode 100644 index f7e1f5e3db20fb..00000000000000 --- a/packages/editor/src/components/media/metadata-panel.js +++ /dev/null @@ -1,77 +0,0 @@ -/** - * WordPress dependencies - */ -import { MediaEditorProvider, MediaForm } from '@wordpress/media-editor'; -import { useSelect, useDispatch } from '@wordpress/data'; -import { useMemo } from '@wordpress/element'; -import { store as coreStore } from '@wordpress/core-data'; - -/** - * Internal dependencies - */ -import { store as editorStore } from '../../store'; -import usePostFields from '../post-fields'; -import PostCardPanel from '../post-card-panel'; -import PostPanelSection from '../post-panel-section'; - -/** - * Media metadata panel for the editor sidebar. - * Displays a form for editing media properties with PostCardPanel header. - * - * @param {Object} props - Component props. - * @param {Function} props.onActionPerformed - Callback when an action is performed. - * @return {Element} The MediaMetadataPanel component. - */ -export default function MediaMetadataPanel( { onActionPerformed } ) { - const { media, postType, postId } = useSelect( ( select ) => { - const _postType = select( editorStore ).getCurrentPostType(); - const _postId = select( editorStore ).getCurrentPostId(); - const currentPost = select( coreStore ).getEditedEntityRecord( - 'postType', - _postType, - _postId, - { - _embed: 'author,wp:attached-to', - } - ); - return { - media: currentPost, - postType: _postType, - postId: _postId, - }; - }, [] ); - - const { editPost } = useDispatch( editorStore ); - const fields = usePostFields( { postType: 'attachment' } ); - - const settings = useMemo( - () => ( { - fields, - } ), - [ fields ] - ); - - const handleUpdate = ( updates ) => { - editPost( updates ); - }; - - return ( - - - - } - /> - - - ); -} diff --git a/packages/editor/src/components/media/preview.js b/packages/editor/src/components/media/preview.js deleted file mode 100644 index c443c2d964b011..00000000000000 --- a/packages/editor/src/components/media/preview.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * WordPress dependencies - */ -import { - MediaEditorProvider, - MediaPreview as BaseMediaPreview, -} from '@wordpress/media-editor'; -import { useSelect } from '@wordpress/data'; - -/** - * Internal dependencies - */ -import { store as editorStore } from '../../store'; - -/** - * Media preview component for the editor. - * Connects the base MediaPreview component to the editor store. - * - * @param {Object} props - Additional props to spread on MediaPreview. - * @return {Element} The MediaPreview component. - */ -export default function MediaPreview( props ) { - const { media } = useSelect( ( select ) => { - const currentPost = select( editorStore ).getCurrentPost(); - return { - media: currentPost, - }; - }, [] ); - - return ( - - - - ); -} diff --git a/packages/editor/src/components/post-publish-button/label.js b/packages/editor/src/components/post-publish-button/label.js index 5fa28c3b41907e..ba91510558cbf3 100644 --- a/packages/editor/src/components/post-publish-button/label.js +++ b/packages/editor/src/components/post-publish-button/label.js @@ -9,7 +9,6 @@ import { useViewportMatch } from '@wordpress/compose'; * Internal dependencies */ import { store as editorStore } from '../../store'; -import { ATTACHMENT_POST_TYPE } from '../../store/constants'; /** * Renders the label for the publish button. @@ -28,7 +27,6 @@ export default function PublishButtonLabel() { hasNonPostEntityChanges, postStatusHasChanged, postStatus, - postType, isPostSavingLocked, } = useSelect( ( select ) => { const { @@ -37,7 +35,6 @@ export default function PublishButtonLabel() { isSavingPost, isPublishingPost, getCurrentPost, - getCurrentPostType, isAutosavingPost, getPostEdits, getEditedPostAttribute, @@ -49,7 +46,6 @@ export default function PublishButtonLabel() { isPublishing: isPublishingPost(), hasPublishAction: getCurrentPost()._links?.[ 'wp:action-publish' ] ?? false, - postType: getCurrentPostType(), isAutosaving: isAutosavingPost(), hasNonPostEntityChanges: select( editorStore ).hasNonPostEntityChanges(), @@ -70,13 +66,6 @@ export default function PublishButtonLabel() { return __( 'Saving…' ); } if ( ! hasPublishAction ) { - // For attachments, always show "Save" since they don't have a publish workflow - if ( - postType === ATTACHMENT_POST_TYPE && - window?.__experimentalMediaEditor - ) { - return __( 'Save' ); - } // TODO: this is because "Submit for review" string is too long in some languages. // @see https://github.com/WordPress/gutenberg/issues/10475 return isSmallerThanMediumViewport diff --git a/packages/editor/src/components/provider/index.js b/packages/editor/src/components/provider/index.js index 0708561db201a3..eaf6420d4a3c11 100644 --- a/packages/editor/src/components/provider/index.js +++ b/packages/editor/src/components/provider/index.js @@ -28,7 +28,6 @@ import { createBlock } from '@wordpress/blocks'; */ import withRegistryProvider from './with-registry-provider'; import { store as editorStore } from '../../store'; -import { ATTACHMENT_POST_TYPE } from '../../store/constants'; import useBlockEditorSettings from './use-block-editor-settings'; import { unlock } from '../../lock-unlock'; import DisableNonPageContentBlocks from './disable-non-page-content-blocks'; @@ -401,31 +400,6 @@ export const ExperimentalEditorProvider = withRegistryProvider( return null; } - const isAttachment = - post.type === ATTACHMENT_POST_TYPE && - window?.__experimentalMediaEditor; - - // Early return for attachments - no block editor needed - if ( isAttachment ) { - return ( - - - { children } - { ! settings.isPreviewMode && ( - <> - - - - ) } - - - ); - } - return ( { - const { postTypeLabel, isAttachment, isRevisionsMode } = useSelect( - ( select ) => { - const { getPostTypeLabel, getCurrentPostType } = - select( editorStore ); - const { isRevisionsMode: _isRevisionsMode } = unlock( - select( editorStore ) - ); - return { - postTypeLabel: getPostTypeLabel(), - isAttachment: - getCurrentPostType() === ATTACHMENT_POST_TYPE && - window?.__experimentalMediaEditor, - isRevisionsMode: _isRevisionsMode(), - }; - }, - [] - ); + const { postTypeLabel, isRevisionsMode } = useSelect( ( select ) => { + const { getPostTypeLabel } = select( editorStore ); + const { isRevisionsMode: _isRevisionsMode } = unlock( + select( editorStore ) + ); + return { + postTypeLabel: getPostTypeLabel(), + isRevisionsMode: _isRevisionsMode(), + }; + }, [] ); let documentLabel; if ( isRevisionsMode ) { @@ -55,16 +47,14 @@ const SidebarHeader = ( _, ref ) => { > { documentLabel } - { ! isAttachment && ( - - { /* translators: Text label for the Block Settings Sidebar tab. */ } - { __( 'Block' ) } - - ) } + + { /* translators: Text label for the Block Settings Sidebar tab. */ } + { __( 'Block' ) } + ); }; diff --git a/packages/editor/src/components/sidebar/index.js b/packages/editor/src/components/sidebar/index.js index 0d45a931ad45e3..cf2951813afafb 100644 --- a/packages/editor/src/components/sidebar/index.js +++ b/packages/editor/src/components/sidebar/index.js @@ -33,7 +33,6 @@ import SidebarHeader from './header'; import TemplateActionsPanel from '../template-actions-panel'; import TemplateContentPanel from '../template-content-panel'; import TemplatePartContentPanel from '../template-part-content-panel'; -import { MediaMetadataPanel } from '../media'; import PostRevisionsPanel from '../post-revisions-panel'; import RevisionBlockDiffPanel from '../revision-block-diff'; import useAutoSwitchEditorSidebars from '../provider/use-auto-switch-editor-sidebars'; @@ -41,7 +40,6 @@ import { sidebars } from './constants'; import { unlock } from '../../lock-unlock'; import { store as editorStore } from '../../store'; import { - ATTACHMENT_POST_TYPE, NAVIGATION_POST_TYPE, TEMPLATE_PART_POST_TYPE, TEMPLATE_POST_TYPE, @@ -66,7 +64,6 @@ const SidebarContent = ( { // need to forward the `Tabs` context so it can be passed through the // underlying slot/fill. const tabsContextValue = useContext( Tabs.Context ); - const isAttachment = postType === ATTACHMENT_POST_TYPE; const isRevisionsMode = useSelect( ( select ) => { return unlock( select( editorStore ) ).isRevisionsMode(); } ); @@ -99,11 +96,7 @@ const SidebarContent = ( { }, [ tabName ] ); let tabContent; - if ( isAttachment ) { - tabContent = ( - - ); - } else if ( isRevisionsMode ) { + if ( isRevisionsMode ) { tabContent = ; } else { tabContent = ( @@ -159,12 +152,10 @@ const SidebarContent = ( { { tabContent } - { ! isAttachment && ( - - - { isRevisionsMode && } - - ) } + + + { isRevisionsMode && } + ); diff --git a/packages/editor/src/dataviews/store/private-actions.ts b/packages/editor/src/dataviews/store/private-actions.ts index e9b9882fbadc3f..c8023428544c54 100644 --- a/packages/editor/src/dataviews/store/private-actions.ts +++ b/packages/editor/src/dataviews/store/private-actions.ts @@ -65,7 +65,6 @@ import { unlock } from '../../lock-unlock'; declare global { interface Window { __experimentalTemplateActivate?: boolean; - __experimentalMediaEditor?: boolean; } }