diff --git a/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/Actions/ResultSet/isResultSetBinaryFileValue.ts b/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/Actions/ResultSet/isResultSetBinaryFileValue.ts index 87afa5cb3e..ae85c5deba 100644 --- a/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/Actions/ResultSet/isResultSetBinaryFileValue.ts +++ b/webapp/packages/plugin-data-viewer/src/DatabaseDataModel/Actions/ResultSet/isResultSetBinaryFileValue.ts @@ -1,6 +1,5 @@ import type { IResultSetBinaryFileValue } from './IResultSetBinaryFileValue'; -import type { IResultSetContentValue } from './IResultSetContentValue'; -export function isResultSetBinaryFileValue(value: IResultSetContentValue): value is IResultSetBinaryFileValue { - return value.contentType === 'application/octet-stream' && Boolean(value?.binary); +export function isResultSetBinaryFileValue(value: any): value is IResultSetBinaryFileValue { + return value?.contentType === 'application/octet-stream' && Boolean(value?.binary); } diff --git a/webapp/packages/plugin-data-viewer/src/ValuePanelPresentation/TextValue/useTextValue.ts b/webapp/packages/plugin-data-viewer/src/ValuePanelPresentation/TextValue/useTextValue.ts index 62d8bf187e..a2d81fdea6 100644 --- a/webapp/packages/plugin-data-viewer/src/ValuePanelPresentation/TextValue/useTextValue.ts +++ b/webapp/packages/plugin-data-viewer/src/ValuePanelPresentation/TextValue/useTextValue.ts @@ -5,7 +5,9 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { isResultSetContentValue } from '../../DatabaseDataModel/Actions/ResultSet/isResultSetContentValue'; +import { isNotNullDefined } from '@cloudbeaver/core-utils'; + +import { isResultSetBinaryFileValue } from '../../DatabaseDataModel/Actions/ResultSet/isResultSetBinaryFileValue'; import { ResultSetEditAction } from '../../DatabaseDataModel/Actions/ResultSet/ResultSetEditAction'; import { ResultSetFormatAction } from '../../DatabaseDataModel/Actions/ResultSet/ResultSetFormatAction'; import { ResultSetSelectAction } from '../../DatabaseDataModel/Actions/ResultSet/ResultSetSelectAction'; @@ -25,16 +27,19 @@ export function useTextValue({ model, resultIndex, currentContentType }: IUseTex const selection = model.source.getAction(resultIndex, ResultSetSelectAction); const focusCell = selection.getFocusedElement(); const firstSelectedCell = selection.elements?.[0] ?? focusCell; - const autoFormat = !!firstSelectedCell && !editor.isElementEdited(firstSelectedCell); const formatter = useAutoFormat(); - if (!autoFormat) { - return; + if (!isNotNullDefined(firstSelectedCell)) { + return ''; + } + + if (editor.isElementEdited(firstSelectedCell)) { + return format.getText(firstSelectedCell); } const blob = format.get(firstSelectedCell); - if (isResultSetContentValue(blob)) { + if (isResultSetBinaryFileValue(blob)) { const value = formatter.formatBlob(currentContentType, blob); if (value) {