How to use the @ephox/imagetools.BlobConversions.blobToImage function in @ephox/imagetools

To help you get started, we’ve selected a few @ephox/imagetools 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 tinymce / tinymce / modules / tinymce / src / plugins / imagetools / main / ts / core / Actions.ts View on Github external
return new Promise(function (resolve) {
    BlobConversions.blobToImage(blob).
      then(function (newImage) {
        const newSize = ImageSize.getNaturalImageSize(newImage);

        if (originalSize.w !== newSize.w || originalSize.h !== newSize.h) {
          if (ImageSize.getImageSize(img)) {
            ImageSize.setImageSize(img, newSize);
          }
        }

        URL.revokeObjectURL(newImage.src);
        return blob;
      }).
      then(ResultConversions.blobToImageResult).
      then(function (imageResult) {
        return updateSelectedImage(editor, imageResult, true, imageUploadTimerState, img);
      }, function () {