Skip to content

Commit 4e43d37

Browse files
committed
Remove key handler
1 parent 6209496 commit 4e43d37

6 files changed

Lines changed: 20 additions & 64 deletions

File tree

packages/dashboard-core-plugins/src/panels/IrisGridPanel.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ $panel-message-overlay-top: 30px;
3131
.grid-cursor-linker {
3232
cursor: crosshair;
3333
}
34+
35+
.grid-cursor-copy {
36+
cursor: copy;
37+
}

packages/iris-grid/src/IrisGrid.tsx

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ import FilterInputField from './FilterInputField';
113113
import {
114114
ClearFilterKeyHandler,
115115
CopyKeyHandler,
116-
CopyCursorKeyHandler,
117116
ReverseKeyHandler,
118117
} from './key-handlers';
119118
import {
@@ -312,6 +311,8 @@ export interface IrisGridProps {
312311

313312
// eslint-disable-next-line react/no-unused-prop-types
314313
columnNotAllowedCursor: string;
314+
315+
// eslint-disable-next-line react/no-unused-prop-types
315316
copyCursor: string;
316317
name: string;
317318
onlyFetchVisibleColumns: boolean;
@@ -529,8 +530,6 @@ export class IrisGrid extends Component<IrisGridProps, IrisGridState> {
529530
this.handleAdvancedMenuOpened = this.handleAdvancedMenuOpened.bind(this);
530531
this.handleGotoRowOpened = this.handleGotoRowOpened.bind(this);
531532
this.handleGotoRowClosed = this.handleGotoRowClosed.bind(this);
532-
this.handleShowCopyCursor = this.handleShowCopyCursor.bind(this);
533-
this.handleHideCopyCursor = this.handleHideCopyCursor.bind(this);
534533
this.handleAdvancedMenuClosed = this.handleAdvancedMenuClosed.bind(this);
535534
this.handleAggregationChange = this.handleAggregationChange.bind(this);
536535
this.handleAggregationsChange = this.handleAggregationsChange.bind(this);
@@ -707,7 +706,6 @@ export class IrisGrid extends Component<IrisGridProps, IrisGridState> {
707706
];
708707
if (canCopy) {
709708
keyHandlers.push(new CopyKeyHandler(this));
710-
keyHandlers.push(new CopyCursorKeyHandler(this));
711709
}
712710
const { dh } = model;
713711
const mouseHandlers = [
@@ -2791,26 +2789,6 @@ export class IrisGrid extends Component<IrisGridProps, IrisGridState> {
27912789
this.setState({ isGotoShown: false });
27922790
}
27932791

2794-
handleShowCopyCursor(): void {
2795-
if (!this.grid) {
2796-
return;
2797-
}
2798-
const { copyCursor } = this.props;
2799-
const { cursor } = this.grid.state;
2800-
if (cursor !== copyCursor) {
2801-
this.isCopying = true;
2802-
this.grid.setState({ cursor: copyCursor });
2803-
}
2804-
}
2805-
2806-
handleHideCopyCursor(): void {
2807-
if (!this.grid) {
2808-
return;
2809-
}
2810-
this.isCopying = false;
2811-
this.grid.setState({ cursor: null });
2812-
}
2813-
28142792
handleAdvancedMenuClosed(columnIndex: number): void {
28152793
const { focusedFilterBarColumn, isFilterBarShown } = this.state;
28162794
if (

packages/iris-grid/src/key-handlers/CopyCursorKeyHandler.ts

Lines changed: 0 additions & 33 deletions
This file was deleted.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
export { default as CopyKeyHandler } from './CopyKeyHandler';
2-
export { default as CopyCursorKeyHandler } from './CopyCursorKeyHandler';
32
export { default as ReverseKeyHandler } from './ReverseKeyHandler';
43
export { default as ClearFilterKeyHandler } from './ClearFilterKeyHandler';

packages/iris-grid/src/mousehandlers/IrisGridContextMenuHandler.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,7 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
337337
actions.push({
338338
title: 'Copy Column Name',
339339
group: IrisGridContextMenuHandler.GROUP_COPY,
340-
shortcutText: ContextActionUtils.isMacPlatform()
341-
? 'Opt+Click'
342-
: 'Alt+Click',
340+
shortcutText: ContextActionUtils.isMacPlatform() ? '⌥Click' : 'Alt+Click',
343341
action: () => {
344342
copyToClipboard(model.textForColumnHeader(modelIndex) ?? '').catch(e =>
345343
log.error('Unable to copy header', e)
@@ -636,7 +634,7 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
636634
title: 'Copy Cell',
637635
group: IrisGridContextMenuHandler.GROUP_COPY,
638636
shortcutText: ContextActionUtils.isMacPlatform()
639-
? 'Opt+Click'
637+
? 'Click'
640638
: 'Alt+Click',
641639
order: 10,
642640
action: () => {

packages/iris-grid/src/mousehandlers/IrisGridCopyCellMouseHandler.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,18 @@ class IrisGridCopyCellMouseHandler extends GridMouseHandler {
3939
return false;
4040
}
4141

42-
onMove(): EventHandlerResult {
43-
if (this.irisGrid.isCopying) {
42+
onMove(
43+
gridPoint: GridPoint,
44+
_grid: Grid,
45+
event: GridMouseEvent
46+
): EventHandlerResult {
47+
if (
48+
event.altKey &&
49+
!ContextActionUtils.isModifierKeyDown(event) &&
50+
!event.shiftKey &&
51+
gridPoint.column != null &&
52+
(gridPoint.row != null || gridPoint.columnHeaderDepth != null)
53+
) {
4454
this.cursor = this.irisGrid.props.copyCursor;
4555
return true;
4656
}

0 commit comments

Comments
 (0)