Skip to content

Commit

Permalink
Prevent incorrect notice in transforms
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Jul 26, 2024
1 parent 95863ce commit 16c5fc6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/editor/src/transforms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ type Writable< T > = { -readonly [ P in keyof T ]: Writable< T[ P ] > };

type FilterableBlock = Writable< Block >;

// TODO: Prevent incorrect 'If uploading to a gallery all files need to be image formats' snackbar from image block.
function addMultiFileTransformToBlock(
settings: FilterableBlock,
name: string
Expand All @@ -20,6 +19,14 @@ function addMultiFileTransformToBlock(
if ( ! settings.transforms || ! settings.transforms.from ) {
return;
}

// Prevent incorrect 'If uploading to a gallery all files need to be image formats' snackbar from image block.
if ( 'core/image' === name ) {
settings.transforms.from = settings.transforms.from.filter(
( transform ) => transform.type !== 'files'
);
}

settings.transforms.from.unshift( {
type: 'files',
// Higher than the default priority of 10, so that this is picked up
Expand Down

0 comments on commit 16c5fc6

Please sign in to comment.