diff --git a/packages/edit-post/src/blockMediaPanel/coverControls.tsx b/packages/edit-post/src/blockMediaPanel/coverControls.tsx index b000a7ac..5259a997 100644 --- a/packages/edit-post/src/blockMediaPanel/coverControls.tsx +++ b/packages/edit-post/src/blockMediaPanel/coverControls.tsx @@ -50,13 +50,11 @@ export function CoverControls( props: CoverControlsProps ) { onSuccess={ onChange } /> { 'video' === props.attributes.backgroundType ? ( - <> - - + ) : null } diff --git a/packages/edit-post/src/blockMediaPanel/index.tsx b/packages/edit-post/src/blockMediaPanel/index.tsx index 3f0bbd07..2bb16fd7 100644 --- a/packages/edit-post/src/blockMediaPanel/index.tsx +++ b/packages/edit-post/src/blockMediaPanel/index.tsx @@ -43,59 +43,27 @@ type PerBlockControlsProps = MediaPanelProps; function PerBlockControls( props: PerBlockControlsProps ) { switch ( props.name ) { case 'core/video': - return ( - <> - - - ); + return ; case 'core/image': - return ( - <> - - - ); + return ; case 'core/audio': - return ( - <> - - - ); + return ; case 'core/media-text': - return ( - <> - - - ); + return ; case 'core/gallery': - return ( - <> - - - ); + return ; case 'core/cover': - return ( - <> - - - ); + return ; case 'core/post-featured-image': - return ( - <> - - - ); + return ; case 'core/site-logo': - return ( - <> - - - ); + return ; default: return null; diff --git a/packages/edit-post/src/blockMediaPanel/mediaTextControls.tsx b/packages/edit-post/src/blockMediaPanel/mediaTextControls.tsx index 8b9cba42..3aee6ec1 100644 --- a/packages/edit-post/src/blockMediaPanel/mediaTextControls.tsx +++ b/packages/edit-post/src/blockMediaPanel/mediaTextControls.tsx @@ -49,13 +49,11 @@ export function MediaTextControls( props: MediaTextControlsProps ) { onSuccess={ onChange } /> { 'video' === props.attributes.mediaType ? ( - <> - - + ) : null } diff --git a/packages/edit-post/src/blockMediaPanel/recordingControls.tsx b/packages/edit-post/src/blockMediaPanel/recordingControls.tsx index b877fc4f..bbc1384b 100644 --- a/packages/edit-post/src/blockMediaPanel/recordingControls.tsx +++ b/packages/edit-post/src/blockMediaPanel/recordingControls.tsx @@ -58,18 +58,15 @@ function InputControls() { } ) ); // Videos can be recorded with or without audio. - const audioControls = [ - ...audioDevices.map( ( device ) => ( { - title: device.label, - onClick: () => { - void setAudioInput( device.deviceId ); - }, - isActive: audioInput === device.deviceId, - role: 'menuitemradio', - icon: - hasAudio && audioInput === device.deviceId ? check : undefined, - } ) ), - ]; + const audioControls = audioDevices.map( ( device ) => ( { + title: device.label, + onClick: () => { + void setAudioInput( device.deviceId ); + }, + isActive: audioInput === device.deviceId, + role: 'menuitemradio', + icon: hasAudio && audioInput === device.deviceId ? check : undefined, + } ) ); if ( 'video' === recordingType ) { audioControls.unshift( { diff --git a/packages/edit-post/src/crossOriginIsolation/index.ts b/packages/edit-post/src/crossOriginIsolation/index.ts index fdf3fc7f..93fef313 100644 --- a/packages/edit-post/src/crossOriginIsolation/index.ts +++ b/packages/edit-post/src/crossOriginIsolation/index.ts @@ -9,6 +9,30 @@ function forceCrossOrigin( imgCrossOrigin: CrossOriginValue, url: string ) { return 'anonymous' as CrossOriginValue; } +async function waitForChildren( element: Element ) { + return new Promise< void >( ( resolve ) => { + if ( ! element ) { + return resolve(); + } + + if ( element.children.length ) { + return resolve(); + } + + const obs = new MutationObserver( () => { + if ( element.children.length ) { + obs.disconnect(); + resolve(); + } + } ); + + obs.observe( element, { + childList: true, + subtree: true, + } ); + } ); +} + if ( window.crossOriginIsolated ) { addFilter( 'media.crossOrigin', @@ -66,30 +90,6 @@ if ( window.crossOriginIsolated ) { } ); } ); - async function waitForChildren( element: Element ) { - return new Promise< void >( ( resolve ) => { - if ( ! element ) { - return resolve(); - } - - if ( element.children.length ) { - return resolve(); - } - - const obs = new MutationObserver( () => { - if ( element.children.length ) { - observer.disconnect(); - resolve(); - } - } ); - - obs.observe( element, { - childList: true, - subtree: true, - } ); - } ); - } - const unsubscribe = subscribe( async () => { const wrapperEl = document.querySelector( '.edit-post-layout__metaboxes' diff --git a/packages/edit-post/src/preferencesModal/modal.tsx b/packages/edit-post/src/preferencesModal/modal.tsx index 6b446dba..886daac6 100644 --- a/packages/edit-post/src/preferencesModal/modal.tsx +++ b/packages/edit-post/src/preferencesModal/modal.tsx @@ -171,136 +171,123 @@ export function Modal() { name: 'general', tabLabel: __( 'General', 'media-experiments' ), content: ( - <> - + - - - { /* default for jpeg: 82, for webp: 86 */ } - - - + label={ __( 'Approval', 'media-experiments' ) } + /> + + { /* default for jpeg: 82, for webp: 86 */ } + + ), }, { name: 'recording', tabLabel: __( 'Recording', 'media-experiments' ), content: ( - <> - + ( { + label: device.label, + value: device.deviceId, + } ) ) } + /> + - ( { - label: device.label, - value: device.deviceId, - } ) ) } - /> - ( { - label: device.label, - value: device.deviceId, - } ) ) } - /> - - + label={ __( 'Microphone', 'media-experiments' ) } + options={ audioDevices.map( ( device ) => ( { + label: device.label, + value: device.deviceId, + } ) ) } + /> + ), }, ], diff --git a/packages/jsquash/src/index.ts b/packages/jsquash/src/index.ts index 98d97212..c9800ac5 100644 --- a/packages/jsquash/src/index.ts +++ b/packages/jsquash/src/index.ts @@ -34,8 +34,6 @@ export async function convertImageToJpeg( file: File ) { fileName, 'image/jpeg' ); - } catch ( err ) { - throw err; } finally { URL.revokeObjectURL( url ); } @@ -74,8 +72,6 @@ export async function convertImageToAvif( file: File ) { fileName, 'image/avif' ); - } catch ( err ) { - throw err; } finally { URL.revokeObjectURL( url ); }