mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
commit
9d8346b315
14 changed files with 249 additions and 73 deletions
|
@ -1,19 +1,26 @@
|
|||
import React, { FC } from 'react';
|
||||
import { INode } from '~/redux/types';
|
||||
import React, { FC, useMemo } from 'react';
|
||||
import { path } from 'ramda';
|
||||
import { formatTextParagraphs } from '~/utils/dom';
|
||||
import styles from './styles.module.scss';
|
||||
import { INodeComponentProps } from '~/redux/node/constants';
|
||||
import classNames from 'classnames';
|
||||
import styles from './styles.module.scss';
|
||||
import markdown from '~/styles/common/markdown.module.scss';
|
||||
|
||||
interface IProps extends INodeComponentProps {}
|
||||
|
||||
const NodeTextBlock: FC<IProps> = ({ node }) => (
|
||||
<div
|
||||
className={styles.text}
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: formatTextParagraphs(path(['blocks', 0, 'text'], node)),
|
||||
}}
|
||||
/>
|
||||
);
|
||||
const NodeTextBlock: FC<IProps> = ({ node }) => {
|
||||
const content = useMemo(() => formatTextParagraphs(path(['blocks', 0, 'text'], node)), [
|
||||
node.blocks,
|
||||
]);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classNames(styles.text, markdown.wrapper)}
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: content,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export { NodeTextBlock };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue