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

Selecting a bit of text and then pressing bold, italic, bold, ruins the selection. #61

Open szm1 opened 6 years ago

szm1 commented 6 years ago

Type the following into a fresh instance of the editor in chrome:

This is a test line.

Then, using the keyboard or mouse, select the entire line. Press the bold button, followed by the italic button, and then the bold button again.

The resulting selection will now be:

This is a t

and subsequent presses of the bold and italic buttons do odd things (either causing the selection to reduce in size again, disappear, or do absolutely nothing).

I would expect the text selection to remain the same regardless of how many times the bold and or italic buttons are pressed in this situation. The same thing happens if the shortcut keys for bold and italic are used.

Depending on which browser is used, depends on how much of the text selection is changed. I have tested this on both the demo site (https://bevacqua.github.io/woofmark/), and a version I downloaded from npm (version 4.2.3).

Running on chrome: woofmarkbolditalic