make node-views emit instead of calling the store
This commit is contained in:
@@ -191,11 +191,12 @@ export default {
|
||||
// BASIC HANDLERS
|
||||
|
||||
onNodeClick (nodeData) {
|
||||
// FIXME CURRENT PROBLEM AS API TREATING TEXTPRODs as TEXTREFs (no `parents:`)
|
||||
const { id, parents } = nodeData
|
||||
if (parents) {
|
||||
this.$emit('open', parents[0].id, id)
|
||||
this.$emit('open-node', parents[0].id, id)
|
||||
} else {
|
||||
this.$emit('open', id)
|
||||
this.$emit('open-node', id)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -36,12 +36,12 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapGetters(['activeNodes']),
|
||||
...mapGetters(['activeNodes'])
|
||||
},
|
||||
|
||||
methods: {
|
||||
onOpen (childId) {
|
||||
this.$store.dispatch('OPEN_NODE', [this.parentId, childId])
|
||||
this.$emit('open-child', childId)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -71,8 +71,8 @@ export default {
|
||||
methods: {
|
||||
toCommaList,
|
||||
|
||||
onOpen (nodeId) {
|
||||
this.$store.dispatch('OPEN_NODE', [nodeId])
|
||||
onOpen (siblingId) {
|
||||
this.$parent.$emit('open-node', siblingId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ export default {
|
||||
toCommaList,
|
||||
|
||||
onClose () {
|
||||
this.$store.dispatch('CLOSE_NODE', this.node.id)
|
||||
this.$parent.$emit('close-node', this.node.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,12 @@
|
||||
</div>
|
||||
</h4>
|
||||
|
||||
<node-view-child-list v-if="mode === 'view'" :children="node.children" :parent-id="node.id" />
|
||||
<node-view-child-list
|
||||
v-if="mode === 'view'"
|
||||
:children="node.children"
|
||||
:parent-id="node.id"
|
||||
@open-child="$parent.$emit('open-child', $event)"
|
||||
/>
|
||||
<button-close v-if="mode === 'view'" @click="onClose()" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -42,7 +47,7 @@ export default {
|
||||
toCommaList,
|
||||
|
||||
onClose () {
|
||||
this.$store.dispatch('CLOSE_NODE', this.node.id)
|
||||
this.$parent.$emit('close-node', this.node.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
v-for="parent in parents" :key="parent.id"
|
||||
:node="parent"
|
||||
mode="card"
|
||||
@open-node="$emit('open-node', $event)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user