Skip to content

Commit cd76666

Browse files
authored
feat: hint支持异步 (Vanessa219#1097)
1 parent ce22c41 commit cd76666

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Diff for: src/ts/hint/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ export class Hint {
5959
vditor.options.hint.extend.forEach((item) => {
6060
if (item.key === this.splitChar) {
6161
clearTimeout(this.timeId);
62-
this.timeId = window.setTimeout(() => {
63-
this.genHTML(item.hint(key), key, vditor);
62+
this.timeId = window.setTimeout(async () => {
63+
this.genHTML(await item.hint(key), key, vditor);
6464
}, vditor.options.hint.delay);
6565
}
6666
});

Diff for: types/index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ interface IHintData {
537537
interface IHintExtend {
538538
key: string;
539539

540-
hint?(value: string): IHintData[];
540+
hint?(value: string): IHintData[] | Promise<IHintData[]>;
541541
}
542542

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

0 commit comments

Comments
 (0)