trilium/src/public/javascripts/export.js

32 lines
797 B
JavaScript
Raw Normal View History

2018-02-25 23:55:21 +08:00
"use strict";
function exportSubTree(noteId) {
2018-03-25 11:37:55 +08:00
const url = utils.getHost() + "/api/export/" + noteId + "?protectedSessionId="
2018-02-27 22:47:05 +08:00
+ encodeURIComponent(protected_session.getProtectedSessionId());
2018-02-25 23:55:21 +08:00
2018-03-25 11:37:55 +08:00
utils.download(url);
2018-02-25 23:55:21 +08:00
}
let importNoteId;
2018-02-25 23:55:21 +08:00
function importSubTree(noteId) {
importNoteId = noteId;
$("#import-upload").trigger('click');
}
$("#import-upload").change(async function() {
const formData = new FormData();
formData.append('upload', this.files[0]);
await $.ajax({
url: baseApiUrl + 'import/' + importNoteId,
headers: server.getHeaders(),
data: formData,
type: 'POST',
contentType: false, // NEEDED, DON'T OMIT THIS
processData: false, // NEEDED, DON'T OMIT THIS
});
2018-02-25 23:55:21 +08:00
2018-03-25 09:39:15 +08:00
await treeService.reload();
});