Skip to content

Commit 8717a66

Browse files
authored
hook 兼容非 Promise 返回值 (#378)
1 parent 0fe8ce8 commit 8717a66

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/core/Editor.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ class Editor extends EventEmitter {
8989
if (hook) {
9090
this.hooksEntity[hookName].tapPromise(plugin.pluginName + hookName, function () {
9191
// eslint-disable-next-line prefer-rest-params
92-
return hook.apply(plugin, [...arguments]);
92+
const result = hook.apply(plugin, [...arguments]);
93+
// hook 兼容非 Promise 返回值
94+
return result instanceof Promise ? result : Promise.resolve(result);
9395
});
9496
}
9597
});

0 commit comments

Comments
 (0)