merge: 获取最新

Former-commit-id: 2aebe34392493814e9e04a5b2f5704f31231ed5c
This commit is contained in:
april
2023-06-12 17:12:29 +08:00

View File

@@ -102,14 +102,17 @@ const handleSaveImg = () => {
const dataURLtoFile = (dataurl: string, filename: string) => { const dataURLtoFile = (dataurl: string, filename: string) => {
const arr: string[] = dataurl.split(","); const arr: string[] = dataurl.split(",");
if (!arr.length) return; if (!arr.length) return;
const mime = arr[0]?.match(/:(.*?);/)[1];
const bstr = atob(arr[1]); const mime = arr[0].match(/:(.*?);/);
let n = bstr.length; if (mime && !mime.length) {
const u8arr = new Uint8Array(n); const bstr = atob(arr[1]);
while (n--) { let n = bstr.length;
u8arr[n] = bstr.charCodeAt(n); const u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
return new File([u8arr], filename, { type: mime[0] });
} }
return new File([u8arr], filename, { type: mime });
}; };
// canvas 画图 // canvas 画图
function paint( function paint(