merge: 获取最新
Former-commit-id: 2aebe34392493814e9e04a5b2f5704f31231ed5c
This commit is contained in:
@@ -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 mime = arr[0].match(/:(.*?);/);
|
||||||
|
if (mime && !mime.length) {
|
||||||
const bstr = atob(arr[1]);
|
const bstr = atob(arr[1]);
|
||||||
let n = bstr.length;
|
let n = bstr.length;
|
||||||
const u8arr = new Uint8Array(n);
|
const u8arr = new Uint8Array(n);
|
||||||
while (n--) {
|
while (n--) {
|
||||||
u8arr[n] = bstr.charCodeAt(n);
|
u8arr[n] = bstr.charCodeAt(n);
|
||||||
}
|
}
|
||||||
return new File([u8arr], filename, { type: mime });
|
return new File([u8arr], filename, { type: mime[0] });
|
||||||
|
}
|
||||||
};
|
};
|
||||||
// canvas 画图
|
// canvas 画图
|
||||||
function paint(
|
function paint(
|
||||||
|
|||||||
Reference in New Issue
Block a user