4
0
Fork 0
PresentazioneEtherpadEtherc.../static/js/save.js
2016-02-29 20:31:32 +02:00

19 lines
427 B
JavaScript

$(function() {
function reloadMarkdown() {
$('#slides-frame')[0].contentWindow.postMessage(JSON.stringify({
method: 'reloadMarkdown'
}), window.location.origin);
}
window.save = function() {
var editor = ace.edit("editor");
$.ajax("/slides.md", {
type: 'put',
data: editor.getValue(),
success: reloadMarkdown
});
};
$('#editor').keyup($.debounce(window.save, 300));
});