Skip to content

Commit

Permalink
#69 Node.id changed on Drag-Drop
Browse files Browse the repository at this point in the history
  • Loading branch information
amsik authored and KP73410 committed Nov 5, 2018
1 parent 728864e commit 54a0b5c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "liquor-tree",
"description": "A Vue.js tree component.",
"version": "0.2.40",
"version": "0.2.41",
"author": "Kostiantyn <[email protected]>",
"library": "LiquorTree",
"homepage": "https://amsik.github.io/liquor-tree/",
Expand Down
5 changes: 3 additions & 2 deletions src/lib/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ export default class Node {
this.isBatch = item.isBatch || false
this.isEditing = false

this.data = Object.assign({}, {
this.data = Object.assign({}, item.data || {}, {
text: item.text
}, item.data || {})
})

if (!tree) {
throw new Error('Node must has a Tree context!')
Expand Down Expand Up @@ -427,6 +427,7 @@ export default class Node {
const clone = this.clone()
const parent = this.parent

clone.id = this.id
tree.__silence = true

if (destinationPosition === 'drag-on') {
Expand Down
4 changes: 4 additions & 0 deletions src/mixins/TreeMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export default {
return this.tree.sort(...args)
},

setModel (data) {
return this.tree.setModel(data)
},

getRootNode () {
return this.tree.model.length === 1
? this.tree.model[0]
Expand Down

0 comments on commit 54a0b5c

Please sign in to comment.