diff --git a/src/components/node/NodeTextBlock/index.tsx b/src/components/node/NodeTextBlock/index.tsx index adb38d73..93100b84 100644 --- a/src/components/node/NodeTextBlock/index.tsx +++ b/src/components/node/NodeTextBlock/index.tsx @@ -1,7 +1,7 @@ import React, { FC } from 'react'; import { INode } from '~/redux/types'; import path from 'ramda/es/path'; -import { formatText } from '~/utils/dom'; +import { formatTextParagraphs } from '~/utils/dom'; import * as styles from './styles.scss'; interface IProps { @@ -12,7 +12,7 @@ const NodeTextBlock: FC = ({ node }) => (
); diff --git a/src/utils/dom.ts b/src/utils/dom.ts index b13ed3f1..ecefc029 100644 --- a/src/utils/dom.ts +++ b/src/utils/dom.ts @@ -94,9 +94,14 @@ export const formatText = (text: string): string => .replace(/:\|--\|/gim, '://') .split('\n') .filter(el => el.trim().length) - // .map(el => `

${el}

`) .join('\n'); +export const formatTextParagraphs = (text: string): string => + text + .split('\n') + .map(str => `

${str}

`) + .join('\n'); + export const findBlockType = (line: string): ValueOf => { const match = Object.values(COMMENT_BLOCK_DETECTORS).find(detector => line.match(detector.test)); return (match && match.type) || COMMENT_BLOCK_TYPES.TEXT;