RTE: cleanup imported document code

If you paste a clipboard with this exact text/html content in rich editor mode you get a content resulting in this markdown:

## Plattenplatz ermitteln

Filtern auf ext4, was ist verfügbar?

```
 root@tokoeka ~ # df -h -t ext4 --total Filesystem Size Used Avail Use% Mounted on /dev/mapper/pve-root 196G 39G 148G 21% / /dev/md0 486M 400M 57M 88% /boot /dev/mapper/pve-data 3.0T 560G 2.3T 20% /mnt/data /dev/mapper/pve-backup 414G 40K 393G 1% /mnt/backup total 3.6T 598G 2.8T 18% - 
```

 

Filtern auf ext4, was wird genutzt?

```
 root@tokoeka ~ # df -h -t ext4 --output=used Used 39G 400M 560G 40K 598G 
```

It’s lossy regarding stuff we don’t care about (divs, classes, etc), but will understand hN, pre, or anything defined in our ProseMirror schema, respecting our various editor extensions registering parseDOM definitions used by ProseMirror’s parser, including those from theme components or plugins.

As for the original request:

I think when the rich editor is loading the document, it’s not this same HTML anymore, is it?

Because a post raw containing HTML blocks should be rendered as a “pass-through” code editor node:

This can then be edited the same way it could in Markdown mode.

1 Like