From cd76666db82c43673872b75da4157efe078094f9 Mon Sep 17 00:00:00 2001 From: myml Date: Fri, 22 Oct 2021 22:36:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20hint=E6=94=AF=E6=8C=81=E5=BC=82?= =?UTF-8?q?=E6=AD=A5=20(#1097)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ts/hint/index.ts | 4 ++-- types/index.d.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ts/hint/index.ts b/src/ts/hint/index.ts index 5b843556d..961fa639e 100644 --- a/src/ts/hint/index.ts +++ b/src/ts/hint/index.ts @@ -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); } }); diff --git a/types/index.d.ts b/types/index.d.ts index 392337fac..d05719d86 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -537,7 +537,7 @@ interface IHintData { interface IHintExtend { key: string; - hint?(value: string): IHintData[]; + hint?(value: string): IHintData[] | Promise; } /** @link https://ld246.com/article/1549638745630#options-hint */