mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Added restauration of scroll state inside replaceSelection
SVN revision: 2215
This commit is contained in:
parent
96fdacb2aa
commit
2ade7175ba
@ -38,7 +38,8 @@ function replaceSelection(doc, text, newSelection, cursorPos)
|
|||||||
stop--;
|
stop--;
|
||||||
end = text.textLength;
|
end = text.textLength;
|
||||||
endtext = text.value.substring(stop, end);
|
endtext = text.value.substring(stop, end);
|
||||||
starttext = text.value.substring(0, start);
|
starttext = text.value.substring(0, start);
|
||||||
|
oldTop = text.scrollTop;
|
||||||
text.value = starttext + newSelection + endtext;
|
text.value = starttext + newSelection + endtext;
|
||||||
if (start != stop) {
|
if (start != stop) {
|
||||||
text.selectionStart = start;
|
text.selectionStart = start;
|
||||||
@ -46,7 +47,8 @@ function replaceSelection(doc, text, newSelection, cursorPos)
|
|||||||
} else {
|
} else {
|
||||||
text.selectionStart = start + cursorPos;
|
text.selectionStart = start + cursorPos;
|
||||||
text.selectionEnd = text.selectionStart;
|
text.selectionEnd = text.selectionStart;
|
||||||
}
|
}
|
||||||
|
text.scrollTop = oldTop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user