allow customizable work wrap property

This commit is contained in:
Abhinav 2022-03-11 14:23:17 +05:30
parent 0c2ef1f9b8
commit c7065731b5
2 changed files with 5 additions and 3 deletions

View file

@ -30,6 +30,7 @@ export const CodeWrapper = styled.div`
type Iprops = React.PropsWithChildren<{
code: string;
wordBreak?: 'normal' | 'break-all' | 'keep-all' | 'break-word';
}>;
export const CodeBlock = (props: Iprops) => {
const [copied, setCopied] = useState<boolean>(false);
@ -56,7 +57,9 @@ export const CodeBlock = (props: Iprops) => {
<Wrapper>
<CodeWrapper>
{props.code ? (
<FreeFlowText>{props.code}</FreeFlowText>
<FreeFlowText style={{ wordBreak: props.wordBreak }}>
{props.code}
</FreeFlowText>
) : (
<EnteSpinner />
)}

View file

@ -62,8 +62,7 @@ export const FlexWrapper = styled.div`
`;
export const FreeFlowText = styled.div`
word-wrap: break-word;
overflow-wrap: break-word;
word-break: break-word;
min-width: 30%;
text-align: left;
`;