diff --git a/src/components/views/messages/MFileBody.tsx b/src/components/views/messages/MFileBody.tsx index ecc60bc3e3..13449ff6d9 100644 --- a/src/components/views/messages/MFileBody.tsx +++ b/src/components/views/messages/MFileBody.tsx @@ -113,7 +113,7 @@ export default class MFileBody extends React.Component { private iframe: React.RefObject = createRef(); private dummyLink: React.RefObject = createRef(); private userDidClick = false; - private fileDownloader: FileDownloader = new FileDownloader(() => this.iframe.current) + private fileDownloader: FileDownloader = new FileDownloader(() => this.iframe.current); public constructor(props: IProps) { super(props); @@ -142,7 +142,7 @@ export default class MFileBody extends React.Component { imgSrc: DOWNLOAD_ICON_URL, imgStyle: null, style: computedStyle(this.dummyLink.current), - textContent: _t("Download %(text)s", { text }) + textContent: _t("Download %(text)s", { text }), }, }); } diff --git a/src/utils/FileDownloader.ts b/src/utils/FileDownloader.ts index 0f329e6ada..a22ff506de 100644 --- a/src/utils/FileDownloader.ts +++ b/src/utils/FileDownloader.ts @@ -14,21 +14,21 @@ See the License for the specific language governing permissions and limitations under the License. */ -export type getIframeFn = () => HTMLIFrameElement; +export type getIframeFn = () => HTMLIFrameElement; // eslint-disable-line @typescript-eslint/naming-convention export const DEFAULT_STYLES = { imgSrc: "", imgStyle: null, // css props style: "", textContent: "", -} +}; type DownloadOptions = { - blob: Blob, - name: string, - autoDownload?: boolean, - opts?: typeof DEFAULT_STYLES -} + blob: Blob; + name: string; + autoDownload?: boolean; + opts?: typeof DEFAULT_STYLES; +}; // set up the iframe as a singleton so we don't have to figure out destruction of it down the line. let managedIframe: HTMLIFrameElement; @@ -90,9 +90,8 @@ export class FileDownloader { return iframe; } - public async download({blob, name, autoDownload = true, opts = DEFAULT_STYLES}: DownloadOptions) { + public async download({ blob, name, autoDownload = true, opts = DEFAULT_STYLES }: DownloadOptions) { const iframe = this.iframe; // get the iframe first just in case we need to await onload - console.log("@@", {blob, name, autoDownload, opts, iframe, m: iframe === managedIframe, p: this.onLoadPromise}); if (this.onLoadPromise) await this.onLoadPromise; iframe.contentWindow.postMessage({ ...opts,