Skip to content

Commit

Permalink
add callback for psd plugin (#455)
Browse files Browse the repository at this point in the history
* add callback for psd plugin

* Update PsdPlugin.ts
  • Loading branch information
ijry authored Jul 2, 2024
1 parent f866b42 commit c4b778a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/core/plugin/PsdPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PsdPlugin implements IPluginTempl {
static apis = ['insertPSD'];
constructor(public canvas: fabric.Canvas, public editor: IEditor) {}

insertPSD() {
insertPSD(callback?: () => void) {
return new Promise((resolve, reject) => {
selectFiles({ accept: '.psd' })
.then((files) => {
Expand All @@ -33,7 +33,7 @@ class PsdPlugin implements IPluginTempl {
console.log(psdFile, '11111');
const json = await psdToJson(psdFile);
// 加载json
this.loadJSON(json);
this.loadJSON(json, callback);
resolve('');
};
}
Expand All @@ -42,8 +42,8 @@ class PsdPlugin implements IPluginTempl {
});
}

loadJSON(json: string) {
this.editor.loadJSON(json);
loadJSON(json: string, callback?: () => void) {
this.editor.loadJSON(json, callback);
}
}

Expand Down

0 comments on commit c4b778a

Please sign in to comment.