in packages/core/src/models/Workspace.ts [53:95]
constructor(engine: Engine, props: IWorkspaceProps) {
this.engine = engine
this.props = props
this.id = props.id || uid()
this.title = props.title
this.description = props.description
this.viewport = new Viewport({
engine: this.engine,
workspace: this,
viewportElement: props.viewportElement,
contentWindow: props.contentWindow,
nodeIdAttrName: this.engine.props.nodeIdAttrName,
moveSensitive: true,
moveInsertionType: 'all',
})
this.outline = new Viewport({
engine: this.engine,
workspace: this,
viewportElement: props.viewportElement,
contentWindow: props.contentWindow,
nodeIdAttrName: this.engine.props.outlineNodeIdAttrName,
moveSensitive: false,
moveInsertionType: 'block',
})
this.operation = new Operation(this)
this.history = new History(this, {
onPush: (item) => {
this.operation.dispatch(new HistoryPushEvent(item))
},
onRedo: (item) => {
this.operation.hover.clear()
this.operation.dispatch(new HistoryRedoEvent(item))
},
onUndo: (item) => {
this.operation.hover.clear()
this.operation.dispatch(new HistoryUndoEvent(item))
},
onGoto: (item) => {
this.operation.hover.clear()
this.operation.dispatch(new HistoryGotoEvent(item))
},
})
}