allow customizable work wrap property
This commit is contained in:
parent
0c2ef1f9b8
commit
c7065731b5
|
@ -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 />
|
||||
)}
|
||||
|
|
|
@ -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;
|
||||
`;
|
||||
|
|
Loading…
Reference in a new issue