Feat:Node类改名为MindMapNode类,避免和HTML原生Node类冲突

This commit is contained in:
街角小林 2024-08-19 16:44:35 +08:00
parent 6bfac34368
commit d01038e617
5 changed files with 10 additions and 10 deletions

View File

@ -16,7 +16,7 @@ import {
} from '../../../utils/index' } from '../../../utils/index'
// 节点类 // 节点类
class Node { class MindMapNode {
// 构造函数 // 构造函数
constructor(opt = {}) { constructor(opt = {}) {
this.opt = opt this.opt = opt
@ -1282,7 +1282,7 @@ class Node {
// 伪克隆节点 // 伪克隆节点
// 克隆出的节点并不能真正当做一个节点使用 // 克隆出的节点并不能真正当做一个节点使用
fakeClone() { fakeClone() {
const newNode = new Node({ const newNode = new MindMapNode({
...this.opt, ...this.opt,
uid: createUid() uid: createUid()
}) })
@ -1298,4 +1298,4 @@ class Node {
} }
} }
export default Node export default MindMapNode

View File

@ -1,4 +1,4 @@
import Node from './Node' import MindMapNode from './MindMapNode'
import { createUid } from '../../../utils/index' import { createUid } from '../../../utils/index'
// 获取节点概要数据 // 获取节点概要数据
@ -49,7 +49,7 @@ function createGeneralizationNode() {
cur.generalizationLine = this.lineDraw.path() cur.generalizationLine = this.lineDraw.path()
} }
if (!cur.generalizationNode) { if (!cur.generalizationNode) {
cur.generalizationNode = new Node({ cur.generalizationNode = new MindMapNode({
data: { data: {
inserting: item.inserting, inserting: item.inserting,
data: item data: item

View File

@ -1,4 +1,4 @@
import Node from '../core/render/node/Node' import MindMapNode from '../core/render/node/MindMapNode'
import { CONSTANTS, initRootNodePositionMap } from '../constants/constant' import { CONSTANTS, initRootNodePositionMap } from '../constants/constant'
import Lru from '../utils/Lru' import Lru from '../utils/Lru'
import { createUid } from '../utils/index' import { createUid } from '../utils/index'
@ -190,7 +190,7 @@ class Base {
} else { } else {
// 创建新节点 // 创建新节点
const newUid = uid || createUid() const newUid = uid || createUid()
newNode = new Node({ newNode = new MindMapNode({
data, data,
uid: newUid, uid: newUid,
renderer: this.renderer, renderer: this.renderer,

View File

@ -13,7 +13,7 @@ import {
nodeRichTextToTextWithWrap nodeRichTextToTextWithWrap
} from '../utils' } from '../utils'
import { CONSTANTS } from '../constants/constant' import { CONSTANTS } from '../constants/constant'
import MindMapNode from '../core/render/node/Node' import MindMapNode from '../core/render/node/MindMapNode'
let extended = false let extended = false

View File

@ -5,7 +5,7 @@ import {
replaceHtmlText, replaceHtmlText,
formatGetNodeGeneralization formatGetNodeGeneralization
} from '../utils/index' } from '../utils/index'
import Node from '../core/render/node/Node' import MindMapNode from '../core/render/node/MindMapNode'
import { CONSTANTS } from '../constants/constant' import { CONSTANTS } from '../constants/constant'
// 搜索插件 // 搜索插件
@ -145,7 +145,7 @@ class Search {
// 判断对象是否是节点实例 // 判断对象是否是节点实例
isNodeInstance(node) { isNodeInstance(node) {
return node instanceof Node return node instanceof MindMapNode
} }
// 搜索下一个,定位到下一个匹配节点 // 搜索下一个,定位到下一个匹配节点