|
|
|
@ -12,7 +12,15 @@ module.exports = {
|
|
|
|
if(src.includes('base64')) {
|
|
|
|
if(src.includes('base64')) {
|
|
|
|
//base 64 pasted image
|
|
|
|
//base 64 pasted image
|
|
|
|
console.log('Found base64 image.')
|
|
|
|
console.log('Found base64 image.')
|
|
|
|
return {base64: src};
|
|
|
|
|
|
|
|
|
|
|
|
const regex = /^data:(?<contentType>[^;]+);base64,(?<data>.+)/g;
|
|
|
|
|
|
|
|
const matches = data.matchAll(regex);
|
|
|
|
|
|
|
|
const groups = Array.from(matches, m => m.groups)[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return {base64: groups.data,
|
|
|
|
|
|
|
|
contentType: groups.contentType};
|
|
|
|
} else if(src.startsWith('http')) {
|
|
|
|
} else if(src.startsWith('http')) {
|
|
|
|
return { url: src };
|
|
|
|
return { url: src };
|
|
|
|
|
|
|
|
|
|
|
|
|