fix: ?<= not work at safari

This commit is contained in:
fantasticit 2022-04-01 15:02:43 +08:00
parent 159ed5f799
commit 4c071a5573
1 changed files with 3 additions and 3 deletions

View File

@ -18,9 +18,9 @@ export * from './markdown-source-map';
const extractImage = (html) => {
let matches = [];
while ((matches = html.match(/(?<=\<p.*?\>)\<img(.|\s)*?\>(?=\<\/p\>)/g))) {
const source = html.match(/\<p.*?\>\<img(.|\s)*?\>\<\/p\>/g)[0];
html = html.replace(source, matches[0]);
while ((matches = html.match(/\<p.*?\>\<img(.|\s)*?\>\<\/p\>/g))) {
const target = matches[0].match(/<img.*?>/)[0];
html = html.replace(matches[0], target);
}
return html;