Skip to content
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

Auto scroll Discord preview with editor #3

Open
Towsti opened this issue Jul 16, 2022 · 0 comments
Open

Auto scroll Discord preview with editor #3

Towsti opened this issue Jul 16, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@Towsti
Copy link
Member

Towsti commented Jul 16, 2022

Auto scroll (scroll-sync) the discord preview with the editor.
Ie the preview scrolls to the information that is visible in the editor.

I've experimented with this quite a bit and also tried out some existing implementation.
None of the third-party scroll sync implementations I could find are suitable because they're all using a relative scroll sync.
This eventually misses information, especially for things like images and embeds where the height of the preview is very different from the editor.

What seems like the best solution is to assign the line as a div id for the Discord preview.
The editor can use cm.getViewport() to get the visible lines in the editor. The Discord preview then scrolls to the div with a ID that matches the top visible line.

@Towsti Towsti added the enhancement New feature or request label Jul 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant