internet-condominiale/static/js/save.js
2018-03-05 20:23:12 -05:00

19 satır
429 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, 600));
});