From deee346f0acf95dfdfdeb3bf1f35c26d595cddff Mon Sep 17 00:00:00 2001 From: liangfung <1098486429@qq.com> Date: Fri, 29 Mar 2024 00:54:27 +0800 Subject: [PATCH] update --- .../action-bar-widget/action-bar-widget-extension.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ee/tabby-ui/app/files/components/action-bar-widget/action-bar-widget-extension.tsx b/ee/tabby-ui/app/files/components/action-bar-widget/action-bar-widget-extension.tsx index 0fb2b4ef286e..e3518fa52624 100644 --- a/ee/tabby-ui/app/files/components/action-bar-widget/action-bar-widget-extension.tsx +++ b/ee/tabby-ui/app/files/components/action-bar-widget/action-bar-widget-extension.tsx @@ -6,6 +6,8 @@ import ReactDOM from 'react-dom/client' import { ActionBarWidget } from './action-bar-widget' +let delayTimer: number + function ActionBarWidgetExtension(): Extension { return StateField.define({ create() { @@ -13,6 +15,7 @@ function ActionBarWidgetExtension(): Extension { }, update(value, transaction) { if (transaction.newSelection.main.empty) { + clearTimeout(delayTimer) return null } if (transaction.selection) { @@ -22,6 +25,8 @@ function ActionBarWidgetExtension(): Extension { // return tooltip?.pos !== value?.pos ? tooltip : value return tooltip } + + clearTimeout(delayTimer) return null } return value @@ -30,8 +35,6 @@ function ActionBarWidgetExtension(): Extension { }) } -let delayTimer: number - function createActionBarWidget(state: EditorState): Tooltip { const { selection } = state const lineFrom = state.doc.lineAt(selection.main.from)