From 83148616117d791d3346bca7bbc3547c5de6050f Mon Sep 17 00:00:00 2001 From: admini Date: Wed, 21 Feb 2018 23:39:44 +0100 Subject: [PATCH] =?UTF-8?q?=09ge=C3=A4ndert:=20=20=20=20=20=20=20static/js?= =?UTF-8?q?/index.js=20=09ge=C3=A4ndert:=20=20=20=20=20=20=20static/js/sav?= =?UTF-8?q?e.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/js/index.js | 7 +++++-- static/js/save.js | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/static/js/index.js b/static/js/index.js index d9e0ef7..3244827 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -35,13 +35,16 @@ $(function() { editor.getSession().setMode("ace/mode/markdown"); editor.getSession().setUseWrapMode(true); editor.setShowPrintMargin(true); - $.get('/slides.md', function(data) { editor.setValue(data, -1); }); - + var lastSRow = -1; ace.edit('editor').getSession().selection.on('changeCursor', function(e) { var cursorRow = ace.edit('editor').getCursorPosition().row; + if(lastSRow === cursorRow){ + return; // no update + } + lastSRow = cursorRow; var currentSlide = currentCursorSlide(cursorRow); $('#slides-frame')[0].contentWindow.postMessage(JSON.stringify({ method: 'slide', diff --git a/static/js/save.js b/static/js/save.js index 835edb1..4ed9d3e 100644 --- a/static/js/save.js +++ b/static/js/save.js @@ -15,5 +15,5 @@ $(function() { }); }; - $('#editor').keyup($.debounce(window.save, 300)); + $('#editor').keyup($.debounce(window.save, 600)); });