mirror of https://github.com/xwiki-labs/cryptpad
Stay at max scroll in rich text on content update
This commit is contained in:
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…
Reference in New Issue