improvement(ui): bring compact markdown viewer changes to OSS (#13593)

This commit is contained in:
purnimagarg1 2025-05-29 19:17:39 +05:30 committed by GitHub
parent 7b21a5cea3
commit f335093607
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,7 +2,7 @@ import React, { useCallback, useState } from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { Editor } from '@app/entityV2/shared/tabs/Documentation/components/editor/Editor'; import { Editor } from '@app/entityV2/shared/tabs/Documentation/components/editor/Editor';
import { Button } from '@src/alchemy-components'; import { Button, Tooltip } from '@src/alchemy-components';
const LINE_HEIGHT = 1.5; const LINE_HEIGHT = 1.5;
@ -88,6 +88,10 @@ const FixedLineHeightEditor = styled(CompactEditor)<{ customStyle?: React.CSSPro
} }
`; `;
const MoreIndicator = styled.span`
break-word: normal;
`;
export type Props = { export type Props = {
content: string; content: string;
lineLimit?: number | null; lineLimit?: number | null;
@ -131,7 +135,11 @@ export default function CompactMarkdownViewer({
readOnly readOnly
/> />
</MarkdownViewContainer> </MarkdownViewContainer>
{hideShowMore && <>...</>} {hideShowMore && isTruncated && (
<Tooltip title={content}>
<MoreIndicator>...</MoreIndicator>
</Tooltip>
)}
{!hideShowMore && {!hideShowMore &&
(isShowingMore || isTruncated) && ( // "show more" when isTruncated, "show less" when isShowingMore (isShowingMore || isTruncated) && ( // "show more" when isTruncated, "show less" when isShowingMore