mirror of
https://github.com/zadam/trilium.git
synced 2025-11-06 21:36:05 +01:00
all JS functions are now inside old-school JS modules, preparation for ES6 modularization
This commit is contained in:
@@ -1,32 +1,39 @@
|
||||
"use strict";
|
||||
|
||||
function exportSubTree(noteId) {
|
||||
const url = utils.getHost() + "/api/export/" + noteId + "?protectedSessionId="
|
||||
+ encodeURIComponent(protected_session.getProtectedSessionId());
|
||||
const exportService = (function () {
|
||||
function exportSubTree(noteId) {
|
||||
const url = utils.getHost() + "/api/export/" + noteId + "?protectedSessionId="
|
||||
+ encodeURIComponent(protected_session.getProtectedSessionId());
|
||||
|
||||
utils.download(url);
|
||||
}
|
||||
utils.download(url);
|
||||
}
|
||||
|
||||
let importNoteId;
|
||||
let importNoteId;
|
||||
|
||||
function importSubTree(noteId) {
|
||||
importNoteId = noteId;
|
||||
function importSubTree(noteId) {
|
||||
importNoteId = noteId;
|
||||
|
||||
$("#import-upload").trigger('click');
|
||||
}
|
||||
$("#import-upload").trigger('click');
|
||||
}
|
||||
|
||||
$("#import-upload").change(async function() {
|
||||
const formData = new FormData();
|
||||
formData.append('upload', this.files[0]);
|
||||
$("#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
|
||||
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
|
||||
});
|
||||
|
||||
await treeService.reload();
|
||||
});
|
||||
|
||||
await treeService.reload();
|
||||
});
|
||||
return {
|
||||
exportSubTree,
|
||||
importSubTree
|
||||
};
|
||||
})();
|
||||
Reference in New Issue
Block a user