Skip to content

Commit 2df86cc

Browse files
committed
fix: handle undefined this.el in findEle function
1 parent 5710c2c commit 2df86cc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mind-elixir",
3-
"version": "5.0.0",
3+
"version": "5.0.1",
44
"type": "module",
55
"description": "Mind elixir is a free open source mind map core.",
66
"keywords": [

src/utils/dom.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { layoutChildren } from './layout'
77
// DOM manipulation
88
const $d = document
99
export const findEle = function (this: MindElixirInstance, id: string, el?: HTMLElement) {
10-
const scope = this.el ? this.el : el ? el : document
10+
const scope = this?.el ? this.el : el ? el : document
1111
const ele = scope.querySelector<Topic>(`[data-nodeid=me${id}]`)
1212
if (!ele) throw new Error(`FindEle: Node ${id} not found, maybe it's collapsed.`)
1313
return ele

0 commit comments

Comments
 (0)