[feat] finish new welcome

This commit is contained in:
kwaroran
2024-01-04 02:14:05 +09:00
parent eed172f37e
commit 1d5d69b71b
3 changed files with 70 additions and 18 deletions

View File

@@ -64,6 +64,14 @@ DOMPurify.addHook("uponSanitizeAttribute", (node, data) => {
}
break
}
case 'href':{
if(data.attrValue.startsWith('http://') || data.attrValue.startsWith('https://')){
node.setAttribute('target', '_blank')
break
}
data.attrValue = ''
break
}
}
})
@@ -171,7 +179,6 @@ export async function ParseMarkdown(data:string, charArg:(character|simpleCharac
return (DOMPurify.sanitize(autoMarkNew(data), {
ADD_TAGS: ["iframe", "style", "risu-style", "x-em"],
ADD_ATTR: ["allow", "allowfullscreen", "frameborder", "scrolling", "risu-btn"],
FORBID_ATTR: ["href"]
}))
}
else{
@@ -180,7 +187,6 @@ export async function ParseMarkdown(data:string, charArg:(character|simpleCharac
return decodeStyle(DOMPurify.sanitize(data, {
ADD_TAGS: ["iframe", "style", "risu-style", "x-em"],
ADD_ATTR: ["allow", "allowfullscreen", "frameborder", "scrolling", "risu-btn"],
FORBID_ATTR: ["href"]
}))
}
}