diff options
| author | Elizabeth Hunt <me@liz.coffee> | 2025-10-05 16:42:02 -0700 |
|---|---|---|
| committer | Elizabeth Hunt <me@liz.coffee> | 2025-10-05 23:11:41 -0700 |
| commit | de43eb05d2e43ab31effce3dcca62ad91a556b26 (patch) | |
| tree | 47a62b61bfc97dda639dea70627ecf3005ba7b02 /src/components/grid/Cell.tsx | |
| parent | 35add63ec4dce39710095f17abd86777de9e5b49 (diff) | |
| download | ansicolor-main.tar.gz ansicolor-main.zip | |
Diffstat (limited to 'src/components/grid/Cell.tsx')
| -rw-r--r-- | src/components/grid/Cell.tsx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/components/grid/Cell.tsx b/src/components/grid/Cell.tsx index fe91da8..1a21164 100644 --- a/src/components/grid/Cell.tsx +++ b/src/components/grid/Cell.tsx @@ -4,13 +4,20 @@ import { getStyleForAnsiColor } from '@/utils/ansi'; interface CellProps { cell: GridCell; onClick?: () => void; + onMouseEnter?: () => void; } -export const Cell: React.FC<CellProps> = ({ cell, onClick }) => { +export const Cell: React.FC<CellProps> = ({ cell, onClick, onMouseEnter }) => { + const handleMouseDown = (e: React.MouseEvent) => { + e.preventDefault(); // Prevent text selection + onClick?.(); + }; + return ( <span className={`grid-cell ${onClick ? 'highlightable' : ''}`} - onMouseDown={onClick} + onMouseDown={handleMouseDown} + onMouseEnter={onMouseEnter} style={getStyleForAnsiColor(cell.color)} > {cell.char === ' ' ? '\u00A0' : cell.char} |
