Stay at max scroll in rich text on content update

pull/1/head
yflory 4 years ago
parent b33225e2d7
commit a09d25a35a

@ -729,6 +729,11 @@ define([
cursor.offsetUpdate();
var oldText = inner.outerHTML;
// Get scroll position
var sTop = $iframe.scrollTop();
var sTopMax = $iframe.innerHeight() - $('iframe').innerHeight();
var scrollMax = sTop === sTopMax;
// Apply the changes
var patch = (DD).diff(inner, userDocStateDom);
(DD).apply(inner, patch);
@ -765,6 +770,10 @@ define([
comments.onContentUpdate();
updateTOC();
if (scrollMax) {
$iframe.scrollTop($iframe.innerHeight());
}
});
framework.setTextContentGetter(function() {

Loading…
Cancel
Save