[fix] additional assets not working after regex 2
This commit is contained in:
@@ -58,11 +58,7 @@ DOMPurify.addHook("uponSanitizeAttribute", (node, data) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
export async function ParseMarkdown(data:string, char:(character | groupChat) = null, mode:'normal'|'back' = 'normal') {
|
async function parseAdditionalAssets(data:string, char:character, mode:'normal'|'back'){
|
||||||
if(char){
|
|
||||||
data = processScript(char, data, 'editdisplay')
|
|
||||||
}
|
|
||||||
if(char && char.type !== 'group'){
|
|
||||||
if(char.additionalAssets){
|
if(char.additionalAssets){
|
||||||
for(const asset of char.additionalAssets){
|
for(const asset of char.additionalAssets){
|
||||||
const assetPath = await getFileSrc(asset[1])
|
const assetPath = await getFileSrc(asset[1])
|
||||||
@@ -75,6 +71,21 @@ export async function ParseMarkdown(data:string, char:(character | groupChat) =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function ParseMarkdown(data:string, char:(character | groupChat) = null, mode:'normal'|'back' = 'normal') {
|
||||||
|
let firstParsed = ''
|
||||||
|
if(char && char.type !== 'group'){
|
||||||
|
data = await parseAdditionalAssets(data, char, mode)
|
||||||
|
firstParsed = data
|
||||||
|
}
|
||||||
|
if(char){
|
||||||
|
data = processScript(char, data, 'editdisplay')
|
||||||
|
}
|
||||||
|
if(firstParsed !== data && char && char.type !== 'group'){
|
||||||
|
data = await parseAdditionalAssets(data, char, mode)
|
||||||
}
|
}
|
||||||
return DOMPurify.sanitize(convertor.makeHtml(data), {
|
return DOMPurify.sanitize(convertor.makeHtml(data), {
|
||||||
ADD_TAGS: ["iframe"],
|
ADD_TAGS: ["iframe"],
|
||||||
|
|||||||
Reference in New Issue
Block a user