pell icon indicating copy to clipboard operation
pell copied to clipboard

Headings can be accidentally nested within themselves

Open jaredreich opened this issue 8 years ago • 5 comments

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

jaredreich avatar Mar 14 '18 19:03 jaredreich

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 avatar Mar 22 '18 15:03 Sjeiti

@Sjeiti see "removeFormat" https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand

jaredreich avatar Mar 25 '18 20:03 jaredreich

@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 avatar Mar 25 '18 21:03 Sjeiti

@Sjeiti ok I see, thanks for the investigation. I'll have to dig deeper.

jaredreich avatar Mar 25 '18 21:03 jaredreich

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.

Mera-Gangapersaud avatar Dec 08 '18 09:12 Mera-Gangapersaud