codex-team / editor.js

A block-style editor with clean JSON output
https://editorjs.io
Apache License 2.0
28.79k stars 2.09k forks source link

Clear formatting #2726

Open mauritskorse opened 5 months ago

mauritskorse commented 5 months ago

At some point I had the issue that texts being saved had empty inline tags (for example bold or italics. I only noticed because it broke another custom inline tag I have (showing tooltips). Hence I made a simple clear formatting inline tool. However, it needs further improvements as it does not cover all the cases in which formatting should/can be cleared yet. This is quite complex actually. That's why I was looking at the Rangy library. But that would also cause duplicate code as the core of editor.js does have some functionality already implemented that Rangy also provides.

Hence, it would be good if clearing formatting would be within the core of editor.js such that there is no need to include additional libraries.

mauritskorse commented 5 months ago

For those interested, I have published this clear formatting tool: https://github.com/ympact/editorjs-clear-formatting