diff --git a/src/downloader.js b/src/downloader.js index c1020c4b..4cfa4e78 100644 --- a/src/downloader.js +++ b/src/downloader.js @@ -12,7 +12,7 @@ export default class Downloader { */ constructor({ config, onDownload, onError }) { this.config = config; - this.onDownload = onDownload + this.onDownload = onDownload; this.onError = onError; } diff --git a/src/index.js b/src/index.js index c4273c10..d700f637 100644 --- a/src/index.js +++ b/src/index.js @@ -63,9 +63,10 @@ import { IconAddBorder, IconStretch, IconAddBackground, IconPicture } from '@cod * @property {object} additionalRequestHeaders - allows to pass custom headers with Request * @property {string} buttonContent - overrides for Select File button * @property {object} [uploader] - optional custom uploader - * @property {object} [downloader] - optional custom downloader * @property {function(File): Promise.} [uploader.uploadByFile] - method that upload image by File * @property {function(string): Promise.} [uploader.uploadByUrl] - method that upload image by URL + * @property {object} [downloader] - optional custom downloader + * @property {function(string): Promise.} [downloader.download] - method that download image by data key */ /** @@ -155,7 +156,7 @@ export default class ImageTool { buttonContent: config.buttonContent || '', uploader: config.uploader || undefined, actions: config.actions || [], - downloader: config.downloader || undefined + downloader: config.downloader || undefined, }; /** @@ -190,7 +191,7 @@ export default class ImageTool { config: this.config, onDownload: (url) => this.onDownload(url), onError: this.downloadingFileError, - }) + }); /** * Set saved state @@ -396,7 +397,7 @@ export default class ImageTool { this._data.file = file || {}; if (file && file.url) { - this.downloader.download(file.url) + this.downloader.download(file.url); } } @@ -451,11 +452,11 @@ export default class ImageTool { /** * File downloading callback, fills file data into image - * + * * @param {*} url - file url after downloading */ onDownload(url) { - this.ui.fillImage(url) + this.ui.fillImage(url); } /** diff --git a/src/ui.js b/src/ui.js index d63cfe08..9676a071 100644 --- a/src/ui.js +++ b/src/ui.js @@ -249,4 +249,3 @@ export default class Ui { this.nodes.wrapper.classList.toggle(`${this.CSS.wrapper}--${tuneName}`, status); } } - diff --git a/src/uploader.js b/src/uploader.js index bfa6e2a5..d42e96d4 100644 --- a/src/uploader.js +++ b/src/uploader.js @@ -176,4 +176,3 @@ export default class Uploader { }); } } -