Skip to content

Commit

Permalink
Give File block a low files transform priority (#8042)
Browse files Browse the repository at this point in the history
When dragging and dropping a file into Gutenberg, other transforms (e.g.
to an image block) should take precedence over a transform to a File
block.
  • Loading branch information
noisysocks authored Jul 19, 2018
1 parent 7ab5a9e commit 3aa78ca
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core-blocks/file/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ export const settings = {
{
type: 'files',
isMatch: ( files ) => files.length === 1,
// We define a lower priorty (higher number) than the default of 10. This
// ensures that the File block is only created as a fallback.
priority: 15,
transform: ( files ) => {
const file = files[ 0 ];
const blobURL = createBlobURL( file );
Expand Down

0 comments on commit 3aa78ca

Please sign in to comment.