Merge pull request #2595 from openchamber/feat/ctrl-l-add-selection-to-chat-58c2
feat(ui): Ctrl/Cmd+L adds selected text to chat
This commit is contained in:
@@ -16,6 +16,7 @@ import { useEffectiveDirectory } from '@/hooks/useEffectiveDirectory';
|
||||
import { isVSCodeRuntime } from '@/lib/desktop';
|
||||
import { useI18n } from '@/lib/i18n';
|
||||
import { rangeToMarkdown, trimSelectionValue, wrapMarkdownSelectionForChat } from './selectionMarkdown';
|
||||
import { focusChatInput } from '@/components/chat/composer/editor/dom';
|
||||
|
||||
interface TextSelectionMenuProps {
|
||||
containerRef: React.RefObject<HTMLElement | null>;
|
||||
@@ -309,6 +310,9 @@ export const TextSelectionMenu: React.FC<TextSelectionMenuProps> = ({ containerR
|
||||
|
||||
// Clear selection
|
||||
window.getSelection()?.removeAllRanges();
|
||||
queueMicrotask(() => {
|
||||
focusChatInput();
|
||||
});
|
||||
}, [selectedTextMarkdown, setPendingInputText, hideMenu]);
|
||||
|
||||
const handleCreateNewSession = React.useCallback(async () => {
|
||||
|
||||
@@ -65,6 +65,12 @@ export const HelpDialog: React.FC = () => {
|
||||
icon: "layout-left",
|
||||
keys: '',
|
||||
},
|
||||
{
|
||||
id: 'add_selection_to_chat',
|
||||
descriptionKey: "helpDialog.item.addSelectionToChat",
|
||||
icon: "add",
|
||||
keys: '',
|
||||
},
|
||||
{
|
||||
id: 'cycle_agent',
|
||||
keys: '',
|
||||
|
||||
Reference in New Issue
Block a user