summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCheng-Han, Wu2016-06-17 15:58:23 +0800
committerCheng-Han, Wu2016-06-17 15:58:23 +0800
commitcca567453d68752d343904c0a51def1d6426b3ba (patch)
treec793b8c80df1802512330ada14501844933ee9a5
parent2c58b05d058e264f1222874ac163613ca94437c5 (diff)
Fix on paste long document to editor might cause scroll not syncing
Diffstat (limited to '')
-rw-r--r--public/js/index.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/public/js/index.js b/public/js/index.js
index e873e732..bbd49685 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -2518,6 +2518,12 @@ editor.on('changes', function (cm, changes) {
windowResize();
}
checkEditorScrollbar();
+ if (editorHasFocus()) {
+ postUpdateEvent = function () {
+ syncScrollToView();
+ postUpdateEvent = null;
+ };
+ }
});
editor.on('focus', function (cm) {
for (var i = 0; i < onlineUsers.length; i++) {
@@ -2636,6 +2642,7 @@ function refreshView() {
var updateView = _.debounce(updateViewInner, updateViewDebounce);
var lastResult = null;
+var postUpdateEvent = null;
function updateViewInner() {
if (currentMode == modeType.edit || !isDirty) return;
@@ -2668,6 +2675,8 @@ function updateViewInner() {
clearMap();
//buildMap();
updateTitleReminder();
+ if (postUpdateEvent && typeof postUpdateEvent === 'function')
+ postUpdateEvent();
}
var updateHistoryDebounce = 600;