mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 11:56:01 +01:00
refactoring and check for existing clone in a parent
This commit is contained in:
@@ -27,12 +27,17 @@ const treeChanges = (function() {
|
||||
|
||||
// beware that first arg is noteId and second is noteTreeId!
|
||||
async function cloneNoteAfter(noteId, afterNoteTreeId) {
|
||||
await $.ajax({
|
||||
const resp = await $.ajax({
|
||||
url: baseApiUrl + 'notes/' + noteId + '/cloneAfter/' + afterNoteTreeId,
|
||||
type: 'PUT',
|
||||
error: () => showError("Error cloning note.")
|
||||
});
|
||||
|
||||
if (!resp.success) {
|
||||
alert(resp.message);
|
||||
return;
|
||||
}
|
||||
|
||||
await noteTree.reload();
|
||||
}
|
||||
|
||||
@@ -54,12 +59,17 @@ const treeChanges = (function() {
|
||||
}
|
||||
|
||||
async function cloneNoteTo(childNoteId, parentNoteId) {
|
||||
await $.ajax({
|
||||
const resp = await $.ajax({
|
||||
url: baseApiUrl + 'notes/' + childNoteId + '/cloneTo/' + parentNoteId,
|
||||
type: 'PUT',
|
||||
error: () => showError("Error cloning note.")
|
||||
});
|
||||
|
||||
if (!resp.success) {
|
||||
alert(resp.message);
|
||||
return;
|
||||
}
|
||||
|
||||
await noteTree.reload();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user