Skip to content

Commit

Permalink
feat: hint支持异步 (#1097)
Browse files Browse the repository at this point in the history
  • Loading branch information
myml committed Oct 22, 2021
1 parent ce22c41 commit cd76666
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/ts/hint/index.ts
Expand Up @@ -59,8 +59,8 @@ export class Hint {
vditor.options.hint.extend.forEach((item) => {
if (item.key === this.splitChar) {
clearTimeout(this.timeId);
this.timeId = window.setTimeout(() => {
this.genHTML(item.hint(key), key, vditor);
this.timeId = window.setTimeout(async () => {
this.genHTML(await item.hint(key), key, vditor);
}, vditor.options.hint.delay);
}
});
Expand Down
2 changes: 1 addition & 1 deletion types/index.d.ts
Expand Up @@ -537,7 +537,7 @@ interface IHintData {
interface IHintExtend {
key: string;

hint?(value: string): IHintData[];
hint?(value: string): IHintData[] | Promise<IHintData[]>;
}

/** @link https://ld246.com/article/1549638745630#options-hint */
Expand Down

0 comments on commit cd76666

Please sign in to comment.