Headings can be accidentally nested within themselves
Repro steps:
- Create a list (orderded or unordered)
- Click a header button multiple times
- See (in the output HTML) that the header nest inside itself each time
While html should follow basic W3C rules, a quick (not-really-a) fix would be a button that removes the formatting from the current selection.
@Sjeiti see "removeFormat" https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand
@jaredreich yeah I tried that with Pell. It removes formatting set by style but not formatting implied by element. I'm afraid you'll need a custom method to strip all elements for that (also needed for #53).
A really easy content.textContent += '' works but also strips the linebreaks. So you might need something fancier.
@Sjeiti ok I see, thanks for the investigation. I'll have to dig deeper.
This doesn't happen in all browsers. I tried recreating this problem in both Chrome and Firefox and Firefox works fine. I found this on StackOverflow to help explain the issue. Looks like it could be fixed from chromium since the problem is with how the browser determines the blocks used by formatBlock.