Skip to content

Commit

Permalink
fix: v3.0.2, fix refresh() error
Browse files Browse the repository at this point in the history
fixed #216
  • Loading branch information
SSShooter committed Aug 22, 2023
1 parent d75b5c6 commit 69afe8f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mind-elixir",
"version": "3.0.1",
"version": "3.0.2",
"type": "module",
"description": "Mind elixir is a free open source mind map core.",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ MindElixir.DARK_THEME = DARK_THEME
* @memberof MindElixir
* @static
*/
MindElixir.version = '3.0.1'
MindElixir.version = '3.0.2'
/**
* @function
* @memberof MindElixir
Expand Down
3 changes: 1 addition & 2 deletions src/interact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,8 @@ export const expandNode = function (this: MindElixirInstance, el: Topic, isExpan
* @param {TargetElement} data mind elixir data
*/
export const refresh = function (this: MindElixirInstance, data?: MindElixirData) {
data = JSON.parse(JSON.stringify(data)) // it shouldn't contanimate the original data
// add parent property to every node
if (data) {
data = JSON.parse(JSON.stringify(data)) as MindElixirData // it shouldn't contanimate the original data
this.nodeData = data.nodeData
this.linkData = data.linkData || {}
}
Expand Down
3 changes: 3 additions & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export const getObjById = function (id: string, data: NodeObj): NodeObj | null {
}
}

/**
* Add parent property to every node
*/
export const fillParent = (data: NodeObj, parent?: NodeObj) => {
data.parent = parent
if (data.children) {
Expand Down

0 comments on commit 69afe8f

Please sign in to comment.