only God can help us now

This commit is contained in:
Crazypersonalph
2023-12-04 13:06:59 +08:00
parent 528baa8bc1
commit ab60048f22
21 changed files with 73 additions and 138 deletions
+12
View File
@@ -0,0 +1,12 @@
import DOMPurify from 'dompurify';
export default function stringToHTML(str, styles = false) {
var parser = new DOMParser();
str = DOMPurify.sanitize(str, { ADD_ATTR: ['onclick'] });
var doc = parser.parseFromString(str, 'text/html');
if (styles) {
doc.body.style.cssText =
'height: auto; overflow: scroll; margin: 0px; background: var(--background-primary);';
}
return doc.body;
}