From 51695db2dc40c0903dd8da50f66ebce4941abf58 Mon Sep 17 00:00:00 2001 From: Aleksei Potsetsuev Date: Tue, 14 May 2024 00:46:23 +0700 Subject: [PATCH] CB-4698 fix: limit grid inline editor --- .../src/DataGrid/DataGridTable.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridTable.tsx b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridTable.tsx index 414b94124f..e81714e076 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridTable.tsx +++ b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridTable.tsx @@ -54,6 +54,7 @@ function isAtBottom(event: React.UIEvent): boolean { const rowHeight = 25; const headerHeight = 28; +const MAX_CELL_TEXT_SIZE = 100 * 1024; export const DataGridTable = observer>(function DataGridTable({ model, @@ -82,6 +83,7 @@ export const DataGridTable = observer(null); + const tableData = useTableData(model, resultIndex, dataGridDivRef); const editingContext = useEditing({ readonly: model.isReadonly(resultIndex) || model.isDisabled(resultIndex), onEdit: (position, code, key) => { @@ -114,6 +116,14 @@ export const DataGridTable = observer MAX_CELL_TEXT_SIZE; + + if (isHugeText || isTruncated) { + actions.setValuePresentation('value-text-presentation'); + return false; + } + return true; }, onCloseEditor: () => { @@ -121,7 +131,6 @@ export const DataGridTable = observer