mirror of
https://github.com/status-im/codimd.git
synced 2025-01-11 23:14:24 +00:00
Fix on paste long document to editor might cause scroll not syncing
This commit is contained in:
parent
2c58b05d05
commit
cca567453d
@ -2518,6 +2518,12 @@ editor.on('changes', function (cm, changes) {
|
|||||||
windowResize();
|
windowResize();
|
||||||
}
|
}
|
||||||
checkEditorScrollbar();
|
checkEditorScrollbar();
|
||||||
|
if (editorHasFocus()) {
|
||||||
|
postUpdateEvent = function () {
|
||||||
|
syncScrollToView();
|
||||||
|
postUpdateEvent = null;
|
||||||
|
};
|
||||||
|
}
|
||||||
});
|
});
|
||||||
editor.on('focus', function (cm) {
|
editor.on('focus', function (cm) {
|
||||||
for (var i = 0; i < onlineUsers.length; i++) {
|
for (var i = 0; i < onlineUsers.length; i++) {
|
||||||
@ -2636,6 +2642,7 @@ function refreshView() {
|
|||||||
var updateView = _.debounce(updateViewInner, updateViewDebounce);
|
var updateView = _.debounce(updateViewInner, updateViewDebounce);
|
||||||
|
|
||||||
var lastResult = null;
|
var lastResult = null;
|
||||||
|
var postUpdateEvent = null;
|
||||||
|
|
||||||
function updateViewInner() {
|
function updateViewInner() {
|
||||||
if (currentMode == modeType.edit || !isDirty) return;
|
if (currentMode == modeType.edit || !isDirty) return;
|
||||||
@ -2668,6 +2675,8 @@ function updateViewInner() {
|
|||||||
clearMap();
|
clearMap();
|
||||||
//buildMap();
|
//buildMap();
|
||||||
updateTitleReminder();
|
updateTitleReminder();
|
||||||
|
if (postUpdateEvent && typeof postUpdateEvent === 'function')
|
||||||
|
postUpdateEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
var updateHistoryDebounce = 600;
|
var updateHistoryDebounce = 600;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user