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