remove code related to encrypted file download button in iframe (#7940)
* remove code related to encrypted file download button in iframe Signed-off-by: Kerry Archibald <kerrya@element.io> * i18n Signed-off-by: Kerry Archibald <kerrya@element.io> * remove getIframeFn in mfilebody filedownloader Signed-off-by: Kerry Archibald <kerrya@element.io> * remove iframe ref too Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
parent
d01ea1824b
commit
26216ec527
4 changed files with 5 additions and 87 deletions
|
@ -16,18 +16,10 @@ limitations under the License.
|
|||
|
||||
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;
|
||||
};
|
||||
|
||||
// set up the iframe as a singleton so we don't have to figure out destruction of it down the line.
|
||||
|
@ -89,11 +81,10 @@ export class FileDownloader {
|
|||
return iframe;
|
||||
}
|
||||
|
||||
public async download({ blob, name, autoDownload = true, opts = DEFAULT_STYLES }: DownloadOptions) {
|
||||
public async download({ blob, name, autoDownload = true }: DownloadOptions) {
|
||||
const iframe = this.iframe; // get the iframe first just in case we need to await onload
|
||||
if (this.onLoadPromise) await this.onLoadPromise;
|
||||
iframe.contentWindow.postMessage({
|
||||
...opts,
|
||||
blob: blob,
|
||||
download: name,
|
||||
auto: autoDownload,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue