-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Copying and pasting text into Quill 1.1.3 makes the page scroll jump #1082
Comments
Whats the purpose of the code that is commented out above? The editor pasting works so much better without it. |
I apologize scrollbar jumping has been a recurring issue. It is caused by the lines commented out, and I have tried to remove them in the paste and in some release, but they serve an important purpose. It essentially intercepts pasted content by switching focus to another contenteditable div and analyzing what is pasted there. A side effect of the focus switching is the scroll jumping. Pasting directly into Quill would solve the jumping but it's important for the integrity of the Quill document to not allow uncontrolled content into it, so arbitrary paste is not allowed. Immediate problems are not always obvious but trying to paste into different browsers, pasting more obscure content, pasting from different applications, and long edit sessions after these scenarios and many issues start to crop up. The current version of Quill will restore scroll position of the editor, but some users prefer for the scrollbar to appear in an ancestor element, which sounds like your use case, the restoration doesn't do anything because it was never targeting the right scroll container. A workaround is to do the scroll restoration yourself like this: http://codepen.io/quill/pen/XNJqav. I'm not sure what the best official long term solution is and am open to ideas. The focus switching seems necessary until browsers standardize paste behavior. Quill could restore the scroll position for you but you'd have to pass in the element that does the scrolling which could be possible through a configuration option. This does not seem particularly cleanest nor elegant though. |
Ah I understand the issue. I will try and think about a long term solution and post it here. But... Your codepen solution is works great as a temporary fix. I have uncommented the paste code in quill.js that was initially causing the issue, and am now using the extension of the clipboard module that you show in your codepen. It works perfectly and I can paste and the scroll position does not jump. |
Hi, this is still happen for horizontal scroll, and i'm using quill 1.3.7 |
Just updating since I got a bit sidetracked as a result of this issue. Quill has fixed this with setting scrolling container: https://quilljs.com/docs/configuration/#scrollingcontainer |
The quill container I am using auto expands as you add text. So the quill editor itself does not have scroll but the document does.
When I copy and paste text into the quill editor it makes the page jump scroll position.
I found the code in quill.js that is causing this issue. When I comment it out, the scroll position does not jump anymore
Expected behavior:
When copying and pasting any text, the scroll position of the document should not jump.
Actual behavior:
The scroll position of the page jumps when pasting in text.
Platforms:
Chrome Latest
Version:
Quill 1.1.3
The text was updated successfully, but these errors were encountered: