Remove regex lookbehind in rasterization which is unsupported by Safari
This commit is contained in:
parent
85c635f92d
commit
5876c853d0
|
|
@ -62,11 +62,12 @@ export function blobToBase64(blob: Blob): Promise<string> {
|
|||
}
|
||||
|
||||
export async function replaceBlobURLsWithBase64(svg: string): Promise<string> {
|
||||
const splitByBlobs = svg.split(/(?<=")(blob:.*?)(?=")/);
|
||||
const splitByBlobs = svg.split(/("blob:.*?")/);
|
||||
const onlyBlobs = splitByBlobs.filter((_, i) => i % 2 === 1);
|
||||
|
||||
const onlyBlobsConverted = onlyBlobs.map(async (blobURL) => {
|
||||
const data = await fetch(blobURL);
|
||||
const urlWithoutQuotes = blobURL.slice(1, -1);
|
||||
const data = await fetch(urlWithoutQuotes);
|
||||
const dataBlob = await data.blob();
|
||||
return blobToBase64(dataBlob);
|
||||
});
|
||||
|
|
@ -76,7 +77,7 @@ export async function replaceBlobURLsWithBase64(svg: string): Promise<string> {
|
|||
if (i % 2 === 0) return segment;
|
||||
|
||||
const blobsIndex = Math.floor(i / 2);
|
||||
return base64Images[blobsIndex];
|
||||
return `"${base64Images[blobsIndex]}"`;
|
||||
});
|
||||
return substituted.join("");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue