mirror of
https://github.com/zadam/trilium.git
synced 2024-11-18 05:35:56 +08:00
32 lines
No EOL
740 B
JavaScript
32 lines
No EOL
740 B
JavaScript
import treeService from './tree.js';
|
|
import server from './server.js';
|
|
|
|
async function cloneNoteTo(childNoteId, parentNoteId, prefix) {
|
|
const resp = await server.put('notes/' + childNoteId + '/clone-to/' + parentNoteId, {
|
|
prefix: prefix
|
|
});
|
|
|
|
if (!resp.success) {
|
|
alert(resp.message);
|
|
return;
|
|
}
|
|
|
|
await treeService.reload();
|
|
}
|
|
|
|
// beware that first arg is noteId and second is branchId!
|
|
async function cloneNoteAfter(noteId, afterBranchId) {
|
|
const resp = await server.put('notes/' + noteId + '/clone-after/' + afterBranchId);
|
|
|
|
if (!resp.success) {
|
|
alert(resp.message);
|
|
return;
|
|
}
|
|
|
|
await treeService.reload();
|
|
}
|
|
|
|
export default {
|
|
cloneNoteAfter,
|
|
cloneNoteTo
|
|
}; |