#2210 Replace line breaks with <br> in unknown elements

This commit is contained in:
Cohee 2024-05-10 15:59:01 +03:00
parent 07a6cb1252
commit e17a18ad5d

View File

@ -288,6 +288,11 @@ DOMPurify.addHook('uponSanitizeElement', (node, _, config) => {
return;
}
// Replace line breaks with <br> in unknown elements
if (node instanceof HTMLUnknownElement) {
node.innerHTML = node.innerHTML.replaceAll('\n', '<br>');
}
const isMediaAllowed = isExternalMediaAllowed();
if (isMediaAllowed) {
return;