How to use the @wordpress/blob.revokeBlobURL function in @wordpress/blob

To help you get started, we’ve selected a few @wordpress/blob examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github WordPress / gutenberg / packages / block-library / src / file / edit.js View on Github external
const { downloadButtonText, href } = attributes;

		// Upload a file drag-and-dropped into the editor
		if ( isBlobURL( href ) ) {
			const file = getBlobByURL( href );

			mediaUpload( {
				filesList: [ file ],
				onFileChange: ( [ media ] ) => this.onSelectFile( media ),
				onError: ( message ) => {
					this.setState( { hasError: true } );
					noticeOperations.createErrorNotice( message );
				},
			} );

			revokeBlobURL( href );
		}

		if ( downloadButtonText === undefined ) {
			setAttributes( {
				downloadButtonText: _x( 'Download', 'button label' ),
			} );
		}
	}
github WordPress / gutenberg / packages / block-library / src / file / edit.js View on Github external
const { downloadButtonText, href } = attributes;

		// Upload a file drag-and-dropped into the editor
		if ( isBlobURL( href ) ) {
			const file = getBlobByURL( href );

			mediaUpload( {
				filesList: [ file ],
				onFileChange: ( [ media ] ) => this.onSelectFile( media ),
				onError: ( message ) => {
					this.setState( { hasError: true } );
					noticeOperations.createErrorNotice( message );
				},
			} );

			revokeBlobURL( href );
		}

		if ( downloadButtonText === undefined ) {
			setAttributes( {
				downloadButtonText: _x( 'Download', 'button label' ),
			} );
		}
	}
github WordPress / gutenberg / packages / block-library / src / image / edit.js View on Github external
componentDidUpdate( prevProps ) {
		const { id: prevID, url: prevURL = '' } = prevProps.attributes;
		const { id, url = '' } = this.props.attributes;

		if ( isTemporaryImage( prevID, prevURL ) && ! isTemporaryImage( id, url ) ) {
			revokeBlobURL( url );
		}

		if ( ! this.props.isSelected && prevProps.isSelected && this.state.captionFocused ) {
			this.setState( {
				captionFocused: false,
			} );
		}
	}
github front / gutenberg-js / src / js / gutenberg-overrides / @wordpress / block-library / build-module / image / edit.js View on Github external
componentDidUpdate (prevProps) {
    const { id: prevID, url: prevURL = '' } = prevProps.attributes;
    const { id, url = '' } = this.props.attributes;

    if (isTemporaryImage(prevID, prevURL) && ! isTemporaryImage(id, url)) {
      revokeBlobURL(url);
    }

    if (! this.props.isSelected && prevProps.isSelected && this.state.captionFocused) {
      this.setState({
        captionFocused: false,
      });
    }
  }
github WordPress / gutenberg / packages / media-utils / src / utils / upload-media.js View on Github external
const setAndUpdateFiles = ( idx, value ) => {
		revokeBlobURL( get( filesSet, [ idx, 'url' ] ) );
		filesSet[ idx ] = value;
		onFileChange( compact( filesSet ) );
	};
github WordPress / gutenberg / packages / block-library / src / image / edit.js View on Github external
componentDidUpdate( prevProps ) {
		const { id: prevID, url: prevURL = '' } = prevProps.attributes;
		const { id, url = '' } = this.props.attributes;

		if ( isTemporaryImage( prevID, prevURL ) && ! isTemporaryImage( id, url ) ) {
			revokeBlobURL( url );
		}

		if ( ! this.props.isSelected && prevProps.isSelected && this.state.captionFocused ) {
			this.setState( {
				captionFocused: false,
			} );
		}
	}
github WordPress / gutenberg / packages / block-library / src / gallery / edit.js View on Github external
			forEach( images, ( { url } ) => revokeBlobURL( url ) );
			mediaUpload( {
github godaddy-wordpress / coblocks / src / components / block-gallery / gallery-placeholder.js View on Github external
			forEach( images, ( { url } ) => revokeBlobURL( url ) );
			mediaUpload( {

@wordpress/blob

Blob utilities for WordPress.

GPL-2.0-or-later
Latest version published 3 days ago

Package Health Score

95 / 100
Full package analysis