Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clearout code selection from ctrl l #25

Merged
merged 3 commits into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions extensions/void/src/sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ const Sidebar = () => {

}, [messageStream])

//Clear code selection
const clearSelection = () => {
setSelection(null);
};

return <>
<div className="flex flex-col h-full w-full">
<div className="flex-grow overflow-y-auto overflow-x-hidden p-4">
Expand All @@ -259,8 +264,17 @@ const Sidebar = () => {
<FilesSelector files={files} setFiles={setFiles} />
{/* selected code */}
{!selection?.selectionStr ? null
: <BlockCode text={selection?.selectionStr} disableApplyButton={true} />
}
: (
<div className="relative">
<button
onClick={clearSelection}
className="absolute top-2 right-2 text-white hover:text-gray-300 z-10"
>
X
</button>
<BlockCode text={selection.selectionStr} disableApplyButton={true} />
</div>
)}
</div>
<form
ref={formRef}
Expand Down