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

Scrolling the editor should also scroll the preview #1275

Open
ahus1 opened this issue Jan 18, 2023 · 5 comments
Open

Scrolling the editor should also scroll the preview #1275

ahus1 opened this issue Jan 18, 2023 · 5 comments

Comments

@ahus1
Copy link
Contributor

ahus1 commented Jan 18, 2023

Why the new feature should be added

At the moment the preview scrolls to the editor position. To scroll through the preview, one would need to use the up/down keys to scroll in the editor.

Scrolling with the scollbar in the editor does nothing - the same for the preview.

A similar setting is available in VS Code and in the Markdown Extension ("sync preview").

How the new feature should work

There should be an option in the plugin's settings. Not sure about the default setting, yet. While it is in preview, it should be disabled.

@dipeshsingh253
Copy link

Hey @ahus1, I would like to work on this issue. Let me know the next set of steps to follow.
Thanks !!!

@dipeshsingh253
Copy link

Hey @ahus1 , any updates regarding this issue?

@ahus1
Copy link
Contributor Author

ahus1 commented Oct 7, 2023

Hi @dipeshsingh253 - thanks for reaching out and offering your help.

There's a guide that helps you to get started with this project. Once you have the plugin running in your IDE, you can debug it and inspect what is happening in AsciiDocSplitEditor.MyCaretListener#caretPositionChanged: Whenever the caret position changes, it ensures that the preview is scrolled to that line.

You'll need to investigate how a different listener can translate the currently visible area in the editor to a line number in the document that is then sent to the preview.

Once that is solved, we might need a new option in the plugin's settings. For that, the AsciiDocPreviewSettingsForm.form need to change as well as the settings class. The last change in that area has been done to add the Mermaid diagram, see 4bfcf96, which can serve as a blueprint.

Let me know if this information is helpful to get you started. If you get stuck in the settings, I can help out with that part.

@dipeshsingh253
Copy link

Hi @ahus1 , Thanks for your response.

I'm looking forward to working on this issue. By the way, I was wondering if Ascidoctor has any community channels on Discord or Slack ?

Thanks! 😄

@dipeshsingh253
Copy link

Hi @ahus1 , I checked out the source code. AsciiDocSplitEditor.MyCaretListener#caretPositionChanged This method is only invoked on caret position change, and we have to display the preview on scroll, right? Is there any method that is invoked on scroll in the editor?

Thanks !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants