diff --git a/src/renderer/src/windows/selection/toolbar/SelectionToolbar.tsx b/src/renderer/src/windows/selection/toolbar/SelectionToolbar.tsx index 2d00b127b0..52c97ebf58 100644 --- a/src/renderer/src/windows/selection/toolbar/SelectionToolbar.tsx +++ b/src/renderer/src/windows/selection/toolbar/SelectionToolbar.tsx @@ -204,31 +204,6 @@ const SelectionToolbar: FC<{ demo?: boolean }> = ({ demo = false }) => { } }, [setTimeoutTimer]) - const handleAction = useCallback( - (action: ActionItem) => { - if (demo) return - - /** avoid mutating the original action, it will cause syncing issue */ - const newAction = { ...action, selectedText: selectedText.current } - - switch (action.id) { - case 'copy': - handleCopy() - break - case 'search': - handleSearch(newAction) - break - case 'quote': - handleQuote(newAction) - break - default: - handleDefaultAction(newAction) - break - } - }, - [demo, handleCopy] - ) - const handleSearch = (action: ActionItem) => { if (!action.searchEngine) return @@ -256,6 +231,31 @@ const SelectionToolbar: FC<{ demo?: boolean }> = ({ demo = false }) => { window.api?.selection.hideToolbar() } + const handleAction = useCallback( + (action: ActionItem) => { + if (demo) return + + /** avoid mutating the original action, it will cause syncing issue */ + const newAction = { ...action, selectedText: selectedText.current } + + switch (action.id) { + case 'copy': + handleCopy() + break + case 'search': + handleSearch(newAction) + break + case 'quote': + handleQuote(newAction) + break + default: + handleDefaultAction(newAction) + break + } + }, + [demo, handleCopy] + ) + return (