Page 1 of 1

Editor-buttons not changing scrollbar

Posted: Tue Mar 17, 2009 11:41 pm
by onli
When using the non-wysiswygeditor there are these buttons injecting pieces of html-code. That's great, but it changes the position of the scrollbar of the editarea. That's kind of annoying when writing large entries.
This can be solved by changing the serendipity_editor.js:

Code: Select all

function wrapSelection(txtarea, lft, rgt) {
    if (document.all) {
        IEWrap(txtarea, lft, rgt);
    } else if (document.getElementById) {
        mozWrap(txtarea, lft, rgt);
    }
}
to

Code: Select all

function wrapSelection(txtarea, lft, rgt) {
    var scrollPos = txtarea.scrollTop;
    if (document.all) {
        IEWrap(txtarea, lft, rgt);
    } else if (document.getElementById) {
        mozWrap(txtarea, lft, rgt);
    }
    txtarea.focus();
    txtarea.scrollTop = scrollPos;
}
It also refocus the textarea. Tested with Firefox 3 and Opera 9.63
sincerely

Re: Editor-buttons not changing scrollbar

Posted: Wed Mar 18, 2009 10:44 am
by garvinhicking
Hi!

Well noticed! I committed your fix with a slight adjustment to first check if scrollTop is available.

Regards,
Garvin

Re: Editor-buttons not changing scrollbar

Posted: Wed Mar 18, 2009 1:56 pm
by onli
Thanks Garvin :)

Re: Editor-buttons not changing scrollbar

Posted: Wed Mar 18, 2009 3:06 pm
by Don Chambers
Thank you, thank you, thank you!!!! :wink: