diff --git a/src/components/layouts/NodeBook.vue b/src/components/layouts/NodeBook.vue
index 8b317a5..6fa9833 100644
--- a/src/components/layouts/NodeBook.vue
+++ b/src/components/layouts/NodeBook.vue
@@ -12,15 +12,20 @@
:class="{ active: i === nodes.length - 1 }"
:style="`--nth: ${i}`"
>
-
+
diff --git a/src/components/nodes/NodeViewChildList.vue b/src/components/nodes/NodeViewChildList.vue
index d17867d..775dabf 100644
--- a/src/components/nodes/NodeViewChildList.vue
+++ b/src/components/nodes/NodeViewChildList.vue
@@ -41,7 +41,7 @@ export default {
methods: {
onOpen (childId) {
- this.$emit('open-child', childId)
+ this.$emit('open-child', { childId })
}
},
diff --git a/src/components/nodes/NodeViewFooter.vue b/src/components/nodes/NodeViewFooter.vue
index 3aa9f84..1eaa8ac 100644
--- a/src/components/nodes/NodeViewFooter.vue
+++ b/src/components/nodes/NodeViewFooter.vue
@@ -71,8 +71,8 @@ export default {
methods: {
toCommaList,
- onOpen (siblingId) {
- this.$parent.$emit('open-node', siblingId)
+ onOpen (parentId) {
+ this.$parent.$emit('open-node', { parentId })
}
}
}
diff --git a/src/pages/Library.vue b/src/pages/Library.vue
index 6a06dd0..e0d71d0 100644
--- a/src/pages/Library.vue
+++ b/src/pages/Library.vue
@@ -74,12 +74,12 @@ export default {
}
},
- openNode (parentId, childId) {
- this.$store.dispatch('OPEN_NODE', [parentId, childId])
+ openNode (ids) {
+ this.$store.dispatch('OPEN_NODE', ids)
},
- closeNode (parentId, childId) {
- this.$store.dispatch('CLOSE_NODE', [parentId, childId])
+ closeNode (ids) {
+ this.$store.dispatch('CLOSE_NODE', ids)
}
},
diff --git a/src/pages/library/LibraryMap.vue b/src/pages/library/LibraryMap.vue
index 4f1484f..6f54ccd 100644
--- a/src/pages/library/LibraryMap.vue
+++ b/src/pages/library/LibraryMap.vue
@@ -58,8 +58,11 @@ export default {
methods: {
onOpen (node) {
- // FIXME ALSO CHECK IF PARENT
- this.$emit('open-node', node.id)
+ if (node.parents) {
+ this.$emit('open-node', { parentId: node.parents[0].id, childId: node.id })
+ } else {
+ this.$emit('open-node', { parentId: node.id })
+ }
}
},
diff --git a/src/pages/library/LibraryTree.vue b/src/pages/library/LibraryTree.vue
index 38136ec..72b09da 100644
--- a/src/pages/library/LibraryTree.vue
+++ b/src/pages/library/LibraryTree.vue
@@ -106,7 +106,15 @@ export default {
methods: {
toCommaList,
- trim
+ trim,
+
+ onNodeClick (node) {
+ if (node.parents) {
+ this.$emit('open-node', { parentId: node.parents[0].id, childId: node.id })
+ } else {
+ this.$emit('open-node', { parentId: node.id })
+ }
+ }
},
created () {
diff --git a/src/store/modules/library.js b/src/store/modules/library.js
index 211315e..e914da0 100644
--- a/src/store/modules/library.js
+++ b/src/store/modules/library.js
@@ -132,14 +132,14 @@ export default {
router.push({ query })
},
- async 'OPEN_NODE' ({ state, commit, dispatch }, [parentId, childId]) {
+ async 'OPEN_NODE' ({ state, commit, dispatch }, { parentId, childId }) {
const stack = state.nodebook.find(stack => stack[0] === parentId)
if (stack && (childId === undefined || stack.includes(childId))) return
commit('ADD_NODEBOOK_NODE', [stack, parentId, childId])
dispatch('UPDATE_QUERY_NODES')
},
- 'CLOSE_NODE' ({ state, commit, dispatch }, [parentId, childId]) {
+ 'CLOSE_NODE' ({ state, commit, dispatch }, { parentId, childId }) {
const stack = state.nodebook.find(stack => stack.includes(parentId) && (childId ? stack.includes(childId) : true))
commit('REMOVE_NODEBOOK_NODE', [stack, childId || parentId])
dispatch('UPDATE_QUERY_NODES')