From fa957db272f0adb2d3bc1f881c91de9b1ccee6f0 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Fri, 25 Sep 2015 18:05:50 +0800 Subject: Updated updateView, now will updateHistory in editor changes event, support preventSyncScroll and workaround editor might scroll to no where on changes in the doc bottom --- public/js/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index 244b6aa5..bfb793c2 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -1596,6 +1596,12 @@ editor.on('beforeChange', function (cm, change) { break; } } +editor.on('changes', function (cm, changes) { + updateHistory(); + preventSyncScroll = true; + var scrollInfo = editor.getScrollInfo(); + editor.scrollTo(null, scrollInfo.top - 1); + editor.scrollTo(null, scrollInfo.top); }); editor.on('focus', function (cm) { for (var i = 0; i < onlineUsers.length; i++) { @@ -1731,7 +1737,6 @@ function updateViewInner() { generateToc('toc-affix'); generateScrollspy(); smoothHashScroll(); - writeHistory(ui.area.markdown); isDirty = false; clearMap(); buildMap(); -- cgit v1.2.3