restore scrollTop maybe ?

This commit is contained in:
Charlotte Som 2025-03-05 13:35:50 +00:00
parent d03f849e3b
commit 2c1cfbc701

View file

@ -16,8 +16,13 @@ pt.onevent = (event, textIndex, affectedLength) => {
if (textIndex <= start) start += affectedLength;
if (textIndex <= end) end += affectedLength;
const scrollTop = textarea.scrollTop;
// TODO: check if scrolled to bottom
textarea.value = pt.render()[0];
textarea.setSelectionRange(start, end);
textarea.scrollTop = scrollTop;
};
const socket = new WebSocket("/api/connect");