add NodeBook NodeView click for ordering

This commit is contained in:
axolotle
2021-06-25 12:15:25 +02:00
parent e15fb85761
commit 737e699815
4 changed files with 30 additions and 28 deletions
+1 -24
View File
@@ -10,6 +10,7 @@
class="library-node-book no-events-container"
@open-node="openNode"
@close-node="closeNode"
@select-node="openNode"
/>
</div>
</template>
@@ -50,30 +51,6 @@ export default {
},
methods: {
onMainTextClick (mainTextIndex) {
if (mainTextIndex === this.texts.length - 1) return
this.parents.push(this.parents.splice(mainTextIndex, 1)[0])
this.updateQuery(this.parents)
},
onSubTextClick (mainTextIndex, subTextIndex) {
// FIXME clean this
const children = this.parents[mainTextIndex].children
let needUpdate = false
if (subTextIndex !== children.length - 1) {
children.push(children.splice(subTextIndex, 1)[0])
needUpdate = true
}
if (mainTextIndex !== this.texts.length - 1) {
this.parents.push(this.parents.splice(mainTextIndex, 1)[0])
needUpdate = true
}
if (needUpdate) {
this.updateQuery(this.parents)
}
},
openNode (ids) {
this.$store.dispatch('OPEN_NODE', ids)
},