Skip to content

Commit

Permalink
给 insertSvgFile 添加回调处理 (#319)
Browse files Browse the repository at this point in the history
给 insertSvgFile 添加回调处理方便添加类似隐藏进度条,加载成功之类的情况
  • Loading branch information
ylx252 authored Mar 25, 2024
1 parent 4f23284 commit 87b8fad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/core/ServersPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class ServersPlugin {
});
}

insertSvgFile(jsonFile: string) {
insertSvgFile(jsonFile: string, callback: () => void = null) {
// 加载前钩子
this.editor.hooksEntity.hookImportBefore.callAsync(jsonFile, () => {
this.canvas.loadFromJSON(jsonFile, () => {
Expand All @@ -75,6 +75,7 @@ class ServersPlugin {
this.editor.hooksEntity.hookImportAfter.callAsync(jsonFile, () => {
this.canvas.renderAll();
// this.editor.getPlugin('HistoryPlugin').history.clear();
callback && callback();
});
});
});
Expand Down

0 comments on commit 87b8fad

Please sign in to comment.