Stay at max scroll in rich text on content update

This commit is contained in:
yflory 2021-01-07 16:21:05 +01:00
parent b33225e2d7
commit a09d25a35a
1 changed files with 9 additions and 0 deletions

View File

@ -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() {