-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for scroll position sync #2404
base: master
Are you sure you want to change the base?
Conversation
You can see the demonstration ↓ 2024-09-03-markdown-scroll-sync.mp4 |
has conflicts |
Conflicts are resolved :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried locally,
unfortunately not works quite well for both directions. From View-Mode to Edit-Mode it seems to works good enough.
But from Edit to View mode it seems to not work, always jumps to top of document.
This is the builtin Markdown reference.
screenrecord-2024-09-25_00.59.29.webm
I've merged your other PR to master as well, made conflicts again |
Conflicts are resolved now. |
Sure, from Edit to View, it works well for quite a lot common text blocks such as Headings, Bold, Italic, Blockquotes, Lists, Links, ... , but it works not quite well for some special text blocks. I have tried to solve this, it's quite difficult, and I think this is already a big progress for Markor can provide a rough position synch for Markdown. As mentioned above, you can merge it first, it is stable now, and I will improve it if I have some better solutions later, or other contributors would make it perfect on this basis. |
What I would suggest for now: Save/Restore last webview scroll position after short delay (when blocks have the right rendered size). As far I recall this has been before like that, but somehow it doesn't work currently on master either |
Can an option be added? Allow users to choose to let Markor restore last WebView scroll position, or sync WebView scroll position from Edit. |
I don't think it's neccassary. When scroll sync work good enough in praxis there is also the editor position saved/restored - so will be view-mode position when switiching to. |
Unfortunatley also keep in mind what I tried to say always - Markor is not only Markdown. This all relies on Markdown specific injections/adjusting the original. This won't work for stuff that doesn't base on Markdown converter. So we need in any case such a fallback. And saving/restoring the view-mode scroll position should be viable for that. It can't be resolved generically for everything and not easy to get much stable. |
Improvements: If we want to go back to the last view position, just long click the toolbar. |
@harshad1 @wshoy @elyahw I watched guanglinns video again, but it just not works as good here at least in one way, which overall seems also worse then without the PR. In such case I don't feel too well either with bearing that by default to users. Also very important to me: it's a feature for Markdown. People will rumble because not available/broken for others, issues inevitable. |
This feature feels great on an emulator, but unfortunately, it mostly doesn't work on my phone. On an emulator, when going from view mode to edit mode, it often jumps to the next line. Probably because of the word wrapping. |
Add basic support for scroll position sync between Markdown preview (view-mode) and its source code (edit-mode).
This feature supports:
The related issues:
#2373 #2189 #1070 #1060 #679.