Skip to content
This repository was archived by the owner on Jan 16, 2024. It is now read-only.

Commit b2c789c

Browse files
committed
Add back original scroll to reference functionality (issue 78).
--HG-- extra : rebase_source : 55b766fdd86ebe54cd6adb9d90de49c8cc72766f
1 parent 8d1af0e commit b2c789c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

ProveIt_Wikipedia.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,22 @@ window.proveit = jQuery.extend({
129129
this.log("highlightStringAtIndex: invalid negative arguments");
130130
}
131131
var box = this.getMWEditBox();
132+
var origText = box.value;
133+
var editTop = this.getPosition(box).top;
134+
box.value = origText.substring(0, startInd);
135+
box.focus();
136+
box.scrollTop = 1000000; //Larger than any real textarea (hopefully)
137+
var curScrollTop = box.scrollTop;
138+
box.value += origText.substring(startInd);
139+
if(curScrollTop > 0)
140+
{
141+
box.scrollTop = curScrollTop + this.HALF_EDIT_BOX_HEIGHT;
142+
}
132143
jQuery(box).focus().textSelection('setSelection',
133144
{
134145
start: startInd,
135146
end: startInd + length
136-
}).textSelection('scrollToCaretPosition', {force: true});
147+
});
137148
var editTop = this.getPosition(box).top;
138149
window.scroll(0, editTop);
139150
return true;

0 commit comments

Comments
 (0)