image/imageupload/utils
module
Functions
createImageTypeRegExp( types ) → RegExpmodule:image/imageupload/utils~createImageTypeRegExpCreates a regular expression used to test for image files.
const imageType = createImageTypeRegExp( [ 'png', 'jpeg', 'svg+xml', 'vnd.microsoft.icon' ] ); console.log( 'is supported image', imageType.test( file.type ) );Copy codeParameters
types : Array<string>
Returns
RegExp
fetchLocalImage( image ) → Promise<File>internalmodule:image/imageupload/utils~fetchLocalImageCreates a promise that fetches the image local source (Base64 or blob) and resolves with a
Fileobject.Parameters
image : ViewElementImage whose source to fetch.
Returns
Promise<File>A promise which resolves when an image source is fetched and converted to a
Fileinstance. It resolves with aFileobject. If there were any errors during file processing, the promise will be rejected.
isLocalImage( imageUtils, node ) → booleaninternalmodule:image/imageupload/utils~isLocalImageChecks whether a given node is an image element with a local source (Base64 or blob).
Parameters
imageUtils : ImageUtilsnode : ViewElementThe node to check.
Returns
boolean