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

Better scroll sync between the editor and the preview in the SplitEditor #2405

Merged
merged 8 commits into from
Jul 20, 2020

Conversation

daiyam
Copy link
Contributor

@daiyam daiyam commented Sep 17, 2018

Description

This change implements better positioning between the editor and the preview in the SplitEditor (particularly with lot of images).

When scrolling, it calculates the position of the shown block (at 1/3 below the top) based on the previous blocks' heights.
When the cursor is active, the preview is moved at a position so we can see what we are typing.

Issue fixed

Type of changes

  • 🔘 Bug fix (Change that fixed an issue)
  • ⚪ Breaking change (Change that can cause existing functionality to change)
  • 🔘 Improvement (Change that improves the code. Maybe performance or development improvement)
  • ⚪ Feature (Change that adds new functionality)
  • ⚪ Documentation change (Change that modifies documentation. Maybe typo fixes)

Checklist:

  • 🔘 My code follows the project code style
  • ⚪ I have written test for my code and it has been tested
  • 🔘 All existing tests have been passed
  • ⚪ I have attached a screenshot/video to visualize my change if possible

IssueHunt Summary

Referenced issues

This pull request has been submitted to:


…he SplitEditor (particularly with lot of images)
@ZeroX-DG ZeroX-DG added the awaiting review ❇️ Pull request is awaiting a review. label Sep 18, 2018
@daiyam daiyam changed the title Better scroll sync between the editor and the preview in the SplitEditor [WIP] Better scroll sync between the editor and the preview in the SplitEditor Nov 8, 2018
- support checkbox preference `When scrolling, synchronize preview with editor`
@daiyam
Copy link
Contributor Author

daiyam commented Dec 24, 2018

I've tested it with the preferences scroll past the last line.
I've added the support to the preference When scrolling, synchronize preview with editor.

It's working fine.

@daiyam daiyam changed the title [WIP] Better scroll sync between the editor and the preview in the SplitEditor Better scroll sync between the editor and the preview in the SplitEditor Dec 24, 2018
@Shagon94
Copy link

Would love to see this be added, its really hard to navigate when viewing side by side due to inconsistency between the live preview and the text itself

@Aaron-Bird
Copy link
Contributor

Was this pr abandoned?

@daiyam
Copy link
Contributor Author

daiyam commented Mar 3, 2019

@Aaron-Bird not by me 😉

@ZeroX-DG
Copy link
Member

ZeroX-DG commented Mar 4, 2019

Sorry for not being able to review this soon, I'll try to work on this when I have time.

@hzhangxyz
Copy link

is there any update for this pr?

@ZeroX-DG
Copy link
Member

@daiyam sorry for the wait, can you resolve conflict for this PR please?

@daiyam
Copy link
Contributor Author

daiyam commented May 15, 2020

@ZeroX-DG I've resolved the conflicts

@ZeroX-DG
Copy link
Member

@daiyam the feature does work well but one bug that I found is if you don't separate the lines with an empty line. The whole thing will be rendered as a paragraph with each line separate with <br> and the data-line is 0. This will make the preview doesn't scroll at all when it encounter multiple sticky line.
Peek 2020-05-16 16-21

@daiyam
Copy link
Contributor Author

daiyam commented May 16, 2020

@ZeroX-DG I've pushed a fix. Can you test it?

Copy link
Member

@ZeroX-DG ZeroX-DG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool, I think everything looks good now 🎉

@ZeroX-DG ZeroX-DG added approved 👍 Pull request has been approved by sufficient reviewers. and removed awaiting review ❇️ Pull request is awaiting a review. labels May 21, 2020
@arcturus140
Copy link
Contributor

@daiyam i Think that this pull request is still maintained after almost 2 years deserves some mention. 😮
you're awesome!

@Rokt33r Rokt33r added this to the v0.16.0 milestone Jul 20, 2020
@daiyam daiyam deleted the fix-scroll branch July 20, 2020 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved 👍 Pull request has been approved by sufficient reviewers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants