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

Scrolls if cursor not visible after enter/deletion/paste #435

Merged
merged 1 commit into from
Aug 19, 2015

Conversation

emannes
Copy link
Contributor

@emannes emannes commented Aug 3, 2015

This fixes issue #433. When the user pastes or presses enter/backspace/delete, the browser's default scrolling behavior is prevented. (See src/lib/dom.coffee:142-143.) I wrote a function that scrolls the cursor into view and added it to the enter/deletion/paste event handlers.

@@ -109,6 +109,19 @@ class Editor
top: bounds.top - containerBounds.top
}

scrollCursorIntoView: () ->
Copy link
Member

Choose a reason for hiding this comment

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

Can you move this into selection.coffee and just call scrollIntoView? I'm trying to start grouping API calls into selection, editor, document, etc and only having quill.coffee have passthroughs into the most common ones.

@ericmannes ericmannes force-pushed the cursor-scrolling branch 3 times, most recently from 8fb7c0e to 86984a6 Compare August 19, 2015 00:33
@jhchen
Copy link
Member

jhchen commented Aug 19, 2015

Thanks!

jhchen added a commit that referenced this pull request Aug 19, 2015
Scrolls if cursor not visible after enter/deletion/paste
@jhchen jhchen merged commit 91b3958 into slab:develop Aug 19, 2015
@ericmannes ericmannes deleted the cursor-scrolling branch August 19, 2015 19:11
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.

2 participants