justinchuby / cantonese-whiteboard

justinchuby.github.io/cantonese-whiteboard
MIT License
0 stars 0 forks source link

(Bug) "The given range isn't in document." When clear and restart typing. #22

Open SAMFYB opened 6 years ago

SAMFYB commented 6 years ago

By default the whiteboard starts with some characters already entered. When we attempt to clear the characters and start from scratch to type some words, the first character or word typed is not rendered immediately due to a bug break called "The given range isn't in document." The character or word is only rendered after a spacebar.

justinchuby commented 6 years ago

Hi @SAMFYB, Thank you for spotting the bug! I also notice that words will not display if I clear the editor and type in multiple characters at once. I'll look into that in my free time.

You're also very welcome to try and fix the bug and make a pull request. All the logics are in https://github.com/justinchuby/cantonese-whiteboard/blob/master/src/cantonese.js and https://github.com/justinchuby/cantonese-whiteboard/blob/master/src/app.js . I appreciate your help!

SAMFYB commented 6 years ago

No problem :) I'll look into that, too

SAMFYB commented 6 years ago

Hi @justinchuby I just found a simple patch. Just insert a whitespace when there is no characters. Then the issue seems gone.