5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-05-18 00:00:48 +00:00

borrar <script> y <style>

This commit is contained in:
void 2021-02-12 21:01:22 +00:00
parent 792047d4c8
commit 570752edec

View file

@ -22,6 +22,11 @@ export interface Editor {
// Lo hace para que siga la estructura del documento y que no se borren por
// cleanContent luego.
function fixContent (editor: Editor, node: Element = editor.contentEl): void {
if (node.tagName === 'SCRIPT' || node.tagName === 'STYLE') {
node.parentElement?.removeChild(node)
return
}
if (node.tagName === 'I') {
const el = document.createElement('em')
moveChildren(node, el, null)