standardnotes / markdown-basic

[Moved to https://github.com/standardnotes/app] A basic Markdown editor for Standard Notes
https://standardnotes.com
GNU Affero General Public License v3.0
11 stars 12 forks source link

Viewport resets itself randomly in long documents #27

Open nabati opened 4 years ago

nabati commented 4 years ago

Repro:

  1. Create a note with Markdown Basic as the editor.
  2. Paste the snippet below:
# asjkdljsa kjads
asj
dasj
dasjd
sajd
asj
asjkdljsa kjads
## asj
dasj
dasjd
sajd
asj
asjkdljsa kjads
asj
dasj
dasjd
sajd
asj
asjkdljsa kjads
asj
###dasj
dasjd
sajd
asj
asjkdljsa kjads
asj
dasj
dasjd
sajd
asj
asjkdljsa kjads
asj
dasj
dasjd
sajd
asj
asjkdljsa kjads
asj
## dasj
dasjd
sajd
# asj
asjkdljsa kjads
asj
dasj
## dasjd
sajd
asj
asjkdljsa kjads
asj
dasj
dasjd
sajd
asj
asjkdljsa kjads
asj
dasj
dasjd
sajd
asj
asjkdljsa kjads
asj
dasj
dasjd
sajd
asj
asjkdljsa kjads
asj
dasj
dasjd
sajd
asj
asjkdljsa kjads
asj
dasj
dasjd
sajd
asj
asjkdljsa kjads
asj
dasj
dasjd
sajd
asj
asjkdljsa kjads
asj
dasj
dasjd
sajd
asj
asjkdljsa kjads
asj
dasj
dasjd
sajd
asj
asjkdljsa kjads
asj
dasj
dasjd
sajd
asj
asjkdljsa kjads
asj
dasj
dasjd
sajd
asj
asjkdljsa kjads
asj
dasj
dasjd
sajd
asj
asjkdljsa kjads
asj
dasj
dasjd
sajd
asj
asjkdljsa kjads
asj
dasj
dasjd
sajd
asj
asjkdljsa kjads
# asj
dasj
dasjd
sajd
asj
jkanmasm,nsdamn,as,mnas
asdjklasjdklas
bbvbvcbvcbvc
mnbnbmmnbmnbmnb
mnbmn
mnbmnb
mnb
bmn
mnb
mnbmnb
mnb
mnb
mnb
m
bnmnbnbmmnbmnbmnb
mnbmn
mnbmnb
mnb
bmn
mnb
mnbmnb
mnb
mnb
mnb
m
bnmnbnbmmnbmnbmnb
mn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mnb
mnb
mnb
m
bnmnbnbmmnbmnbmnb
mnbmn
mnbmnb
mnb
bmn
mnb
mnbmnb
mnb
mnb
mnb
m
bnmnbnbmmnbmnbmnb
mnbmn
mnbmnb
mnb
bmn
mnb
mnbmnb
mnb
mnb
mnb
m
bn
  1. Try editing it half-way down. Repeat multiple times at different location. At some point you will notice that the editor viewport will jump so that the caret is at the top of the viewport (note, the caret is still in the right place, it's just the viewport that jumps).

It doesn't happen consistently, but it happens often enough to be incredibly disruptive.

You see this behaviour at the end of this GIF:

caretjumping

moughxyz commented 4 years ago

Can replicate, thanks!

TheodoreChu commented 4 years ago

I'm not sure what's causing this issue. I'm also experiencing it with the Append Editor. Do you have any ideas @ningsongshen?

ningsongshen commented 4 years ago

Hm I'm having trouble replicating it...but I looked at the code and there seems to be a couple areas that handle scrolling (that are not in other editors, like the Bold Editor)