Skip to content

Commit 9664d74

Browse files
committed
fixes onLoad props
1 parent 93adf82 commit 9664d74

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-design-editor",
3-
"version": "0.0.27",
3+
"version": "0.0.28",
44
"description": "Design Editor Tools with React.js + ant.design + fabric.js",
55
"main": "dist/react-design-editor.min.js",
66
"typings": "lib/index.d.ts",

src/components/canvas/Canvas.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ class Canvas extends Component<CanvasProps> {
9797
responsive,
9898
propertiesToInclude,
9999
gridOption,
100+
onLoad,
100101
...other
101102
} = this.props;
102103
const { id } = this.state;
@@ -123,6 +124,7 @@ class Canvas extends Component<CanvasProps> {
123124
defaultOption,
124125
propertiesToInclude: mergedPropertiesToInclude,
125126
gridOption: Object.assign({}, defaultGripOption, gridOption),
127+
onLoad,
126128
...other,
127129
});
128130
this.handler.gridHandler.init();
@@ -134,6 +136,9 @@ class Canvas extends Component<CanvasProps> {
134136
}
135137
}
136138
this.handler.eventHandler.attachEventListener();
139+
if (onLoad) {
140+
onLoad(this.handler, this.canvas);
141+
}
137142
}
138143

139144
componentDidUpdate(prevProps: CanvasProps) {

src/components/canvas/handlers/Handler.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,6 @@ class Handler implements HandlerOptions {
292292
this.init(options);
293293
this.initCallback(options);
294294
this.initHandler(options);
295-
if (this.onLoad) {
296-
this.onLoad(this, this.canvas);
297-
}
298295
}
299296

300297
/**
@@ -321,7 +318,6 @@ class Handler implements HandlerOptions {
321318
this.width = options.width;
322319
this.height = options.height;
323320
this.keyEvent = options.keyEvent;
324-
325321
this.objects = [];
326322
};
327323

0 commit comments

Comments
 (0)