markdown-editor
markdown-editor copied to clipboard
[WIP] Chained scrollbars
Ok this isn't quite complete, but here's my initial stab at implementing chained scrollbars - for #4.
So the way I've currently bashed it is as suggested in that issue - use the markdown parser to attribute source lines to elements in the output.
Then, when you scroll, down, it'll look and see how far down you've scrolled down as a %age of viewport height, find what element's at that position in the view, and try and align the corresponding input line / output element to the same Y position.
Kinda hard to explain. Currently I've left some helper elements in for the time being to see what's going on. Basically whatever's under the red line in each view should correspond. The line moves so that when you're at the very top, both views are scrolled to the top, and when you're at the very end, both views are at the end.
If anyone has any thoughts on this then do let me know, otherwise I'll just keep experimenting to see if I can make this as smooth as possible (and also have a way of disabling it, as suggested in the issue) because it definitely won't be able to get everything right.
nice, Still some strange jumping arround when you edit and have a large amount of text with some whitespace/newlines between them.
Maybe a idea to jump to the line you're editing and than disable the scrolling for the time beeeing until you move to an other line. Any progress on this issue.