updating data model after change parent of the note

This commit is contained in:
azivner
2017-12-17 16:28:13 -05:00
parent cf7ab2b8d6
commit 42dfbaa986
2 changed files with 31 additions and 14 deletions

View File

@@ -93,6 +93,15 @@ const noteTree = (function() {
});
}
function removeParentChildRelation(parentNoteId, childNoteId) {
const key = parentNoteId + "-" + childNoteId;
delete parentChildToNoteTreeId[key];
parentToChildren[parentNoteId] = parentToChildren[parentNoteId].filter(noteId => noteId !== childNoteId);
childToParents[childNoteId] = childToParents[childNoteId].filter(noteId => noteId !== parentNoteId);
}
function setParentChildRelation(noteTreeId, parentNoteId, childNoteId) {
const key = parentNoteId + "-" + childNoteId;
@@ -653,6 +662,8 @@ const noteTree = (function() {
createNewTopLevelNote,
createNote,
setPrefix,
getNotePathTitle
getNotePathTitle,
removeParentChildRelation,
setParentChildRelation
};
})();