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 07312e303195..0fb2b4ef286e 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 @@ -18,7 +18,9 @@ function ActionBarWidgetExtension(): Extension { if (transaction.selection) { if (shouldShowActionBarWidget(transaction)) { const tooltip = createActionBarWidget(transaction.state) - return tooltip?.pos !== value?.pos ? tooltip : value + // avoid flickering + // return tooltip?.pos !== value?.pos ? tooltip : value + return tooltip } return null } @@ -28,6 +30,8 @@ function ActionBarWidgetExtension(): Extension { }) } +let delayTimer: number + function createActionBarWidget(state: EditorState): Tooltip { const { selection } = state const lineFrom = state.doc.lineAt(selection.main.from) @@ -43,10 +47,15 @@ function createActionBarWidget(state: EditorState): Tooltip { create() { const dom = document.createElement('div') dom.style.background = 'transparent' - // dom.style.border = 'none' + dom.style.border = 'none' const root = ReactDOM.createRoot(dom) dom.onclick = e => e.stopImmediatePropagation() - root.render() + // delay popup + if (delayTimer) clearTimeout(delayTimer) + delayTimer = window.setTimeout(() => { + root.render() + }, 500) + return { dom } } } diff --git a/ee/tabby-ui/app/files/components/action-bar-widget/action-bar-widget.tsx b/ee/tabby-ui/app/files/components/action-bar-widget/action-bar-widget.tsx index 1d8534ce2732..049136e38afa 100644 --- a/ee/tabby-ui/app/files/components/action-bar-widget/action-bar-widget.tsx +++ b/ee/tabby-ui/app/files/components/action-bar-widget/action-bar-widget.tsx @@ -25,7 +25,7 @@ export const ActionBarWidget: React.FC = ({ return (