bevacqua / woofmark

:dog2: Barking up the DOM tree. A modular, progressive, and beautiful Markdown and HTML editor
https://bevacqua.github.io/woofmark
MIT License
1.62k stars 74 forks source link

delete key on empty textarea in wysiwyg mode does not clear formatting tags in some cases #35

Open jywarren opened 7 years ago

jywarren commented 7 years ago

I've found a small issue I'm able to reproduce if:

  1. HTML (an h1) already exists at load-time in the .wk-wysiwyg element (wysiwyg mode)
  2. All content in the contentEditable div is selected and deleted
  3. Delete key is hit once again to leave the div completely empty
  4. New text is typed into the div
  5. h1 text appears, not plain p text

Note that to clear this formatting, you can click outside the div and click back in. This makes me think that there's some preserved formatting state in this (chromium) contentEditable which is cleared when it loses focus.

You can try it here: https://publiclab.github.io/PublicLab.Editor/examples/

Although I'm not able to reproduce it on the default demo at https://bevacqua.github.io/woofmark/ -- and I'm wondering if there's something about the interaction of the stylesheets with the contentEditable that causes it in one demo but not another.

bevacqua commented 7 years ago

Works as expected for me in Chrome.