forked from alibaba/lowcode-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditor-view.ts
More file actions
35 lines (29 loc) · 1007 Bytes
/
editor-view.ts
File metadata and controls
35 lines (29 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { editorViewSymbol, pluginContextSymbol } from '../symbols';
import { IPublicModelPluginContext } from '@alilc/lowcode-types';
import { IViewContext } from '@alilc/lowcode-workspace';
export class EditorView {
[editorViewSymbol]: IViewContext;
[pluginContextSymbol]: IPublicModelPluginContext;
constructor(editorView: IViewContext) {
this[editorViewSymbol] = editorView;
this[pluginContextSymbol] = this[editorViewSymbol].innerPlugins._getLowCodePluginContext({
pluginName: editorView.editorWindow + editorView.viewName,
});
}
toProxy() {
return new Proxy(this, {
get(target, prop, receiver) {
if ((target[pluginContextSymbol] as any)[prop as string]) {
return Reflect.get(target[pluginContextSymbol], prop, receiver);
}
return Reflect.get(target, prop, receiver);
},
});
}
get viewName() {
return this[editorViewSymbol].viewName;
}
get viewType() {
return this[editorViewSymbol].viewType;
}
}