Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/block-library/src/image/transforms.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { createBlobURL } from '@wordpress/blob';
import { createBlobURL, isBlobURL } from '@wordpress/blob';
import { createBlock, getBlockAttributes } from '@wordpress/blocks';
import { dispatch } from '@wordpress/data';
import { store as noticesStore } from '@wordpress/notices';
Expand Down Expand Up @@ -123,6 +123,12 @@ const transforms = {
anchor,
}
);

if ( isBlobURL( attributes.url ) ) {
attributes.blob = attributes.url;
delete attributes.url;
}

return createBlock( 'core/image', attributes );
},
},
Expand Down
6 changes: 5 additions & 1 deletion packages/block-library/src/video/transforms.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { createBlobURL } from '@wordpress/blob';
import { createBlobURL, isBlobURL } from '@wordpress/blob';
import { createBlock } from '@wordpress/blocks';

const transforms = {
Expand Down Expand Up @@ -92,6 +92,10 @@ const transforms = {
poster: videoElement.getAttribute( 'poster' ) || undefined,
src: videoElement.getAttribute( 'src' ) || undefined,
};
if ( isBlobURL( attributes.src ) ) {
attributes.blob = attributes.src;
delete attributes.src;
}
return createBlock( 'core/video', attributes );
},
},
Expand Down