Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RICH_TEXT display on cell #8676

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { useTextFieldDisplay } from '@/object-record/record-field/meta-types/hooks/useTextFieldDisplay';
import { isFieldText } from '@/object-record/record-field/types/guards/isFieldText';
import { TextDisplay } from '@/ui/field/display/components/TextDisplay';

export const TextFieldDisplay = () => {
const { fieldValue, fieldDefinition } = useTextFieldDisplay();

return (
<TextDisplay
text={fieldValue}
displayedMaxRows={fieldDefinition.metadata?.settings?.displayedMaxRows}
/>
);
const displayedMaxRows = isFieldText(fieldDefinition)
? fieldDefinition.metadata?.settings?.displayedMaxRows
: 1;

return <TextDisplay text={fieldValue} displayedMaxRows={displayedMaxRows} />;
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@ import { useContext } from 'react';

import { useRecordFieldValue } from '@/object-record/record-store/contexts/RecordFieldValueSelectorContext';

import { assertFieldMetadata } from '@/object-record/record-field/types/guards/assertFieldMetadata';
import { isFieldText } from '@/object-record/record-field/types/guards/isFieldText';
import { FieldMetadataType } from '~/generated-metadata/graphql';
import { FieldContext } from '../../contexts/FieldContext';

export const useTextFieldDisplay = () => {
const { recordId, fieldDefinition, hotkeyScope } = useContext(FieldContext);

assertFieldMetadata(FieldMetadataType.Text, isFieldText, fieldDefinition);
const fieldName = fieldDefinition.metadata.fieldName;

const fieldValue =
Expand Down
Loading