From 93ec43c3dcb9a45992b525c8ac1bd292c60bd296 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Sun, 18 Sep 2016 17:04:33 +0800 Subject: Fix revision viewer might not update after data init, try to use editor operation queue to enhance updateView performance --- public/js/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'public/js') diff --git a/public/js/index.js b/public/js/index.js index 8216b61a..41618ccf 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -138,7 +138,7 @@ function wrapTextWith(cm, symbol) { } var idleTime = 300000; //5 mins -var updateViewDebounce = 200; +var updateViewDebounce = 100; var cursorMenuThrottle = 50; var cursorActivityDebounce = 50; var cursorAnimatePeriod = 100; @@ -1761,6 +1761,7 @@ function initRevisionViewer() { }); revisionInsertAnnotation = revisionViewer.annotateScrollbar({ className:"CodeMirror-insert-match" }); revisionDeleteAnnotation = revisionViewer.annotateScrollbar({ className:"CodeMirror-delete-match" }); + checkRevisionViewer(); } $('#revisionModalDownload').click(function () { if (!revision) return; @@ -3248,7 +3249,9 @@ function refreshView() { updateViewInner(); } -var updateView = _.debounce(updateViewInner, updateViewDebounce); +var updateView = _.debounce(function () { + editor.operation(updateViewInner); +}, updateViewDebounce); var lastResult = null; var postUpdateEvent = null; -- cgit v1.2.3