Skip to content
Merged
Show file tree
Hide file tree
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
17 changes: 16 additions & 1 deletion src/components/AggregationPanel/AggregationPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,23 @@ const AggregationPanel = ({
);
}

const handleKeyDown = (e) => {
if ((e.ctrlKey || e.metaKey) && e.key === 'c') {
const selection = window.getSelection();
if (selection && selection.toString().length > 0) {
// Stop the event from propagating to parent handlers
e.stopPropagation();
// Let the default copy behavior happen by not calling preventDefault
return;
}
}
};

return (
<div className={styles.aggregationPanel}>
<div
onKeyDown={handleKeyDown}
tabIndex={0}
>
{isLoadingInfoPanel ? (
<div className={styles.center}>
<LoaderDots />
Expand Down
15 changes: 15 additions & 0 deletions src/dashboard/Data/Browser/DataBrowser.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,21 @@ export default class DataBrowser extends React.Component {
return;
}
if (e.keyCode === 67 && (e.ctrlKey || e.metaKey)) {
// Check for text selection FIRST
const selection = window.getSelection();
const selectedText = selection ? selection.toString() : '';

// If there's text selected, check if we're in the aggregation panel
if (selectedText.length > 0) {
const target = e.target;
const isWithinPanel = this.aggregationPanelRef?.current && this.aggregationPanelRef.current.contains(target);

if (isWithinPanel) {
// Let the browser handle the copy operation for selected text
return;
}
}

// check if there is multiple selected cells
const { rowStart, rowEnd, colStart, colEnd } = this.state.selectedCells;
if (rowStart !== -1 && rowEnd !== -1 && colStart !== -1 && colEnd !== -1) {
Expand Down
Loading