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

This commit is contained in:
Wu Cheng-Han 2015-09-25 18:05:50 +08:00
parent 11c4a0404e
commit fa957db272
2 changed files with 12 additions and 1 deletions

View file

@ -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();