Table Panel: Fix image disappearing when datalinks applied (#84625)

* Fix link image disappearing

* Prettier

* i18n

* Fix offset to compensate for padding

* Prettier

---------

Co-authored-by: nmarrs <nathanielmarrs@gmail.com>
This commit is contained in:
Kyle Cunningham 2024-03-25 16:13:24 -05:00 committed by GitHub
parent dfe61db7a5
commit 154868e624
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,6 +8,8 @@ import { DataLinksContextMenu } from '../DataLinks/DataLinksContextMenu';
import { TableCellProps } from './types';
const DATALINKS_HEIGHT_OFFSET = 10;
export const ImageCell = (props: TableCellProps) => {
const { field, cell, tableStyles, row, cellProps } = props;
@ -20,7 +22,10 @@ export const ImageCell = (props: TableCellProps) => {
<div {...cellProps} className={tableStyles.cellContainer}>
{!hasLinks && <img src={displayValue.text} className={tableStyles.imageCell} alt="" />}
{hasLinks && (
<DataLinksContextMenu style={{ height: '100%' }} links={() => getCellLinks(field, row) || []}>
<DataLinksContextMenu
style={{ height: tableStyles.cellHeight - DATALINKS_HEIGHT_OFFSET, width: 'auto' }}
links={() => getCellLinks(field, row) || []}
>
{(api) => {
const img = <img src={displayValue.text} className={tableStyles.imageCell} alt="" />;
if (api.openMenu) {