Hi there,
I'm using CKEditor for a year now and I've seen bug-reports that CKEditor scrolls the browser-viewport to the top or bottom of the editor-contents on various events (i.e. when the editor is loaded or a command like 'bold' has been executed), mostly in Firefox only though. I also had to deal with these issues myself and sometimes the problem seemed to solve itself without me changing anything.
I recently discovered the problem occurs every time I paste text in the editor using Firefox. I found the cause of the problem and also a solution to this. I don't want to go too far, but maybe this is the solution to all these ambiguous scroll-problems.
The thing is, if you paste something CKEditor creates a textarea and pastes the clipboard's contents in it. It also gives that textarea the focus. It's Firefox' behavior to always scroll to elements that receive the focus which causes the scrolling. The textarea is set to position absolute and left: -1000px which is why you can't see the area.
I found out that when don't position the textarea outside the viewport, but simply apply display:none to the area everything still works fine, but Firefox does not do any scrolling and thus the problem is fixed.
In the case of the pasting-bug you have to edit the clipboard-plugin (plugins/clipboard/plugin.js) in your source-directory and replace lines 196-209 (pastebin.setStyles(...) - pastebin.setStyle(...)) and replace it with
And of course replace the _source plugin with your production-plugin.
That did it for me.
--Lukas
I'm using CKEditor for a year now and I've seen bug-reports that CKEditor scrolls the browser-viewport to the top or bottom of the editor-contents on various events (i.e. when the editor is loaded or a command like 'bold' has been executed), mostly in Firefox only though. I also had to deal with these issues myself and sometimes the problem seemed to solve itself without me changing anything.
I recently discovered the problem occurs every time I paste text in the editor using Firefox. I found the cause of the problem and also a solution to this. I don't want to go too far, but maybe this is the solution to all these ambiguous scroll-problems.
The thing is, if you paste something CKEditor creates a textarea and pastes the clipboard's contents in it. It also gives that textarea the focus. It's Firefox' behavior to always scroll to elements that receive the focus which causes the scrolling. The textarea is set to position absolute and left: -1000px which is why you can't see the area.
I found out that when don't position the textarea outside the viewport, but simply apply display:none to the area everything still works fine, but Firefox does not do any scrolling and thus the problem is fixed.
In the case of the pasting-bug you have to edit the clipboard-plugin (plugins/clipboard/plugin.js) in your source-directory and replace lines 196-209 (pastebin.setStyles(...) - pastebin.setStyle(...)) and replace it with
pastebin.setStyles( { position : 'absolute', width : '1px', height : '1px', overflow : 'hidden', display : 'none' });
And of course replace the _source plugin with your production-plugin.
That did it for me.
--Lukas
Re: Ambiguous page scroll (i.e. on pasting) + solution
Could you report this issue on our Development site, as described here, attaching your solution, and giving as much detail as possible to describe it? This will let the developers inverstigate the issue. Thanks!
Documentation Manager, CKSource
See CKEditor 5 docs, CKEditor 4 docs, CKEditor 3 docs, CKFinder 3 docs, CKFinder 2 docs for help.
Visit the new CKEditor SDK for samples showcasing editor features to try out and download!
Re: Ambiguous page scroll (i.e. on pasting) + solution
This solution causes forcePasteAsPlainText to fail - http://dev.ckeditor.com/ticket/8714.