patleeman / quill-markdown-shortcuts

Quill.js module that converts markdown to rich text formatting while typing.
https://patleeman.github.io/quill-markdown-shortcuts/
140 stars 49 forks source link

Text corruption when shortcut is used on an existing line #12

Closed aral closed 6 years ago

aral commented 6 years ago

To reproduce

  1. Go to https://patleeman.github.io/quill-markdown-shortcuts/
  2. Enter:
    
    hello

there

how are you

3. Go to the start of the `there` line and type `# ` (octothorpe + space) to trigger an H1

hello

there

^ type it here

how are you


## What should happen

You should get:

hello

there <-- this should be H1

how are you


## What actually happens

The text gets corrupted:

hethere

how are you

amka commented 6 years ago

Seems like there is invalid range detection. Module replaces existed text or throw an exception if it happens on the 1st line.

amka commented 6 years ago

Sent PR #15. Maybe it doesn't cover all cases but I cannot imagine more than that

kapture 2018-04-06 at 15 40 33