mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-11 17:55:51 +00:00
remove file-saver
This commit is contained in:
parent
8409695acd
commit
35593404f5
@ -20,7 +20,6 @@ import '@material/mwc-dialog';
|
||||
import '@material/mwc-icon';
|
||||
import { EmojiPicker } from 'emoji-picker-js';
|
||||
import { generateHTML } from '@tiptap/core';
|
||||
import { saveAs } from 'file-saver';
|
||||
import axios from "axios";
|
||||
import StarterKit from '@tiptap/starter-kit'
|
||||
import Underline from '@tiptap/extension-underline';
|
||||
@ -476,12 +475,32 @@ class MessageTemplate extends LitElement {
|
||||
.then(response =>{
|
||||
let filename = attachment.attachmentName;
|
||||
let blob = new Blob([response.data], { type:"application/octet-stream" });
|
||||
saveAs(blob , filename);
|
||||
this.saveFileToDisk(blob , filename);
|
||||
})
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
async saveFileToDisk(blob, fileName) {
|
||||
try {
|
||||
const fileHandle = await self.showSaveFilePicker({
|
||||
suggestedName: fileName,
|
||||
types: [{
|
||||
description: "File",
|
||||
}]
|
||||
})
|
||||
const writeFile = async (fileHandle, contents) => {
|
||||
const writable = await fileHandle.createWritable()
|
||||
await writable.write(contents)
|
||||
await writable.close()
|
||||
}
|
||||
writeFile(fileHandle, blob).then(() => console.log("FILE SAVED"))
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
|
||||
firstUpdated(){
|
||||
const autoSeeChatList = window.parent.reduxStore.getState().app.autoLoadImageChats
|
||||
if(autoSeeChatList.includes(this.chatId) || this.listSeenMessages.includes(this.messageObj.signature)){
|
||||
|
Loading…
x
Reference in New Issue
Block a user