geändert: static/js/index.js
geändert: static/js/save.js
This commit is contained in:
parent
ebaeea93ca
commit
8314861611
2 changed files with 6 additions and 3 deletions
|
@ -35,13 +35,16 @@ $(function() {
|
||||||
editor.getSession().setMode("ace/mode/markdown");
|
editor.getSession().setMode("ace/mode/markdown");
|
||||||
editor.getSession().setUseWrapMode(true);
|
editor.getSession().setUseWrapMode(true);
|
||||||
editor.setShowPrintMargin(true);
|
editor.setShowPrintMargin(true);
|
||||||
|
|
||||||
$.get('/slides.md', function(data) {
|
$.get('/slides.md', function(data) {
|
||||||
editor.setValue(data, -1);
|
editor.setValue(data, -1);
|
||||||
});
|
});
|
||||||
|
var lastSRow = -1;
|
||||||
ace.edit('editor').getSession().selection.on('changeCursor', function(e) {
|
ace.edit('editor').getSession().selection.on('changeCursor', function(e) {
|
||||||
var cursorRow = ace.edit('editor').getCursorPosition().row;
|
var cursorRow = ace.edit('editor').getCursorPosition().row;
|
||||||
|
if(lastSRow === cursorRow){
|
||||||
|
return; // no update
|
||||||
|
}
|
||||||
|
lastSRow = cursorRow;
|
||||||
var currentSlide = currentCursorSlide(cursorRow);
|
var currentSlide = currentCursorSlide(cursorRow);
|
||||||
$('#slides-frame')[0].contentWindow.postMessage(JSON.stringify({
|
$('#slides-frame')[0].contentWindow.postMessage(JSON.stringify({
|
||||||
method: 'slide',
|
method: 'slide',
|
||||||
|
|
|
@ -15,5 +15,5 @@ $(function() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$('#editor').keyup($.debounce(window.save, 300));
|
$('#editor').keyup($.debounce(window.save, 600));
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue