Skip to content

Commit 944b895

Browse files
committed
fix: use html-node as model type
1 parent a169ef7 commit 944b895

File tree

3 files changed

+3
-20
lines changed

3 files changed

+3
-20
lines changed

packages/core/src/constant/constant.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export enum ModelType {
2020
TEXT_NODE = 'text-node',
2121
ELLIPSE_NODE = 'ellipse-node',
2222
DIAMOND_NODE = 'diamond-node',
23+
HTML_NODE ='html-node',
2324
EDGE = 'edge',
2425
LINE_EDGE = 'line-edge',
2526
POLYLINE_EDGE = 'polyline-edge',

packages/core/src/model/node/HtmlNodeModel.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
import { computed, observable } from 'mobx';
1+
import { computed } from 'mobx';
22
import { Point } from '../../type';
33
import BaseNodeModel from './BaseNodeModel';
44
import { ModelType } from '../../constant/constant';
55
import GraphModel from '../GraphModel';
6-
import { defaultTheme } from '../../constant/DefaultTheme';
76

87
class HtmlNodeModel extends BaseNodeModel {
9-
modelType = ModelType.RECT_NODE;
10-
@observable radius = defaultTheme.rect.radius;
8+
modelType = ModelType.HTML_NODE;
119

1210
constructor(data, graphModel: GraphModel) {
1311
super(data, graphModel, 'html');

packages/core/src/view/node/HtmlNode.tsx

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,6 @@ export default class HtmlNode extends BaseNode {
1919
get rootEl() {
2020
return document.querySelector(`#${this.rootElId}`) as HTMLElement;
2121
}
22-
getShapeStyle() {
23-
const attributes = super.getShapeStyle();
24-
const { model: { radius } } = this.props as IProps;
25-
return {
26-
...attributes,
27-
radius,
28-
};
29-
}
30-
getAttributes() {
31-
const attributes = super.getAttributes();
32-
const style = this.getShapeStyle();
33-
return {
34-
...attributes,
35-
...style,
36-
};
37-
}
3822
setHtml(rootEl: HTMLElement) {
3923
rootEl.appendChild(document.createElement('div'));
4024
}

0 commit comments

Comments
 (0)