From dfe070adb1a2e543a35eeef37d4d0404f7bb2bde Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 11 Dec 2023 22:03:27 +0800 Subject: [PATCH] :bug: --- app/src/protyle/render/av/render.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts index 46bbb18f4..2620f4024 100644 --- a/app/src/protyle/render/av/render.ts +++ b/app/src/protyle/render/av/render.ts @@ -313,7 +313,9 @@ ${cell.color ? `color:${cell.color};` : ""}">${text}`; } }; -let refreshTimeout: number; +const refreshTimeouts: { + [key: string]: number; +} = {}; export const refreshAV = (protyle: IProtyle, operation: IOperation, isUndo: boolean) => { if (operation.action === "setAttrViewName") { Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.id}"]`)).forEach((item: HTMLElement) => { @@ -326,8 +328,8 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation, isUndo: bool }); } // 只能 setTimeout,以前方案快速输入后最后一次修改会被忽略 - clearTimeout(refreshTimeout); - refreshTimeout = window.setTimeout(() => { + clearTimeout(refreshTimeouts[protyle.id]); + refreshTimeouts[protyle.id] = window.setTimeout(() => { if (operation.action === "setAttrViewColWidth") { Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.avID}"]`)).forEach((item: HTMLElement) => { const cellElement = item.querySelector(`.av__cell[data-col-id="${operation.id}"]`) as HTMLElement;