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

Scroll into view #243

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

cristianoccazinsp
Copy link

When focusing the editor, if there's scrolling and the selection is below the scroll position (e.g., end), the current implementation will not adjust the scroll position to the caret position.

With this PR, I'm adding some code that will also scroll to the caret position using a hacky work-around found on stack overflow (https://stackoverflow.com/questions/47361276/javascript-scroll-to-cursor-post-a-paste-in-contenteditable-div).

Further, I'm also exposing the scrollSelectionIntoView method.

Lastly, I've also added missing calls to saveSelection so cursor state is always up to date.

@stulip please review and let me know your thoughts.

@jakehasler
Copy link
Contributor

@cristianocca I was just looking for this functionality. I've got my own fork in my project now with a few small things. I'm going to try merging this into mine and seeing how it works 👍

@stulip
Copy link
Member

stulip commented Apr 3, 2023

Thank you, I need some examples to verify this problem

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

Successfully merging this pull request may close these issues.

None yet

4 participants