MCPcopy Create free account
hub / github.com/Easy-Editor/EasyEditor / constructor

Method constructor

packages/core/src/document/node/node.ts:116–141  ·  view source on GitHub ↗
(
    readonly document: Document,
    Schema: Schema,
  )

Source from the content-addressed store, hash-verified

114 }
115
116 constructor(
117 readonly document: Document,
118 Schema: Schema,
119 ) {
120 const { id, componentName, children, props, ...extras } = Schema
121
122 this.id = id || uniqueId('node')
123 this.componentName = componentName
124 this.props = new Props(this, props, extras)
125 this.props.merge(this.upgradeProps(this.initProps(props || {})), this.upgradeProps(extras))
126 this.initBuiltinProps()
127 this._children = new NodeChildren(this, this.initialChildren(children))
128
129 this.onVisibleChange(visible => {
130 this.document.designer.postEvent(DESIGNER_EVENT.NODE_VISIBLE_CHANGE, this, visible)
131 })
132 this.onLockChange(locked => {
133 this.document.designer.postEvent(DESIGNER_EVENT.NODE_LOCK_CHANGE, this, locked)
134 })
135 this.onChildrenChange(info => {
136 this.document.designer.postEvent(DESIGNER_EVENT.NODE_CHILDREN_CHANGE, {
137 type: info?.type,
138 node: this,
139 })
140 })
141 }
142
143 import(data: Schema, checkId = false) {
144 const { componentName, id, children, props, ...extras } = data

Callers

nothing calls this directly

Calls 10

upgradePropsMethod · 0.95
initPropsMethod · 0.95
initBuiltinPropsMethod · 0.95
initialChildrenMethod · 0.95
onVisibleChangeMethod · 0.95
onLockChangeMethod · 0.95
onChildrenChangeMethod · 0.95
uniqueIdFunction · 0.90
mergeMethod · 0.80
postEventMethod · 0.45

Tested by

no test coverage detected