mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
commit
9c401dfda3
5 changed files with 41 additions and 20 deletions
|
@ -1,4 +1,4 @@
|
||||||
import React, { FC } from 'react';
|
import React, { FC, useMemo } from 'react';
|
||||||
import { ICommentBlockProps } from '~/constants/comment';
|
import { ICommentBlockProps } from '~/constants/comment';
|
||||||
import styles from './styles.module.scss';
|
import styles from './styles.module.scss';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
@ -8,11 +8,13 @@ import { formatText } from '~/utils/dom';
|
||||||
interface IProps extends ICommentBlockProps {}
|
interface IProps extends ICommentBlockProps {}
|
||||||
|
|
||||||
const CommentTextBlock: FC<IProps> = ({ block }) => {
|
const CommentTextBlock: FC<IProps> = ({ block }) => {
|
||||||
|
const content = useMemo(() => formatText(block.content), [block.content]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={classNames(styles.text, markdown.wrapper)}
|
className={classNames(styles.text, markdown.wrapper)}
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: formatText(block.content),
|
__html: content,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { formatCellText, getURL } from '~/utils/dom';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import styles from './styles.module.scss';
|
import styles from './styles.module.scss';
|
||||||
|
import markdown from '~/styles/common/markdown.module.scss';
|
||||||
import { Icon } from '~/components/input/Icon';
|
import { Icon } from '~/components/input/Icon';
|
||||||
import { flowSetCellView } from '~/redux/flow/actions';
|
import { flowSetCellView } from '~/redux/flow/actions';
|
||||||
import { PRESETS } from '~/constants/urls';
|
import { PRESETS } from '~/constants/urls';
|
||||||
|
@ -119,6 +120,8 @@ const Cell: FC<IProps> = ({
|
||||||
}
|
}
|
||||||
}, [title]);
|
}, [title]);
|
||||||
|
|
||||||
|
const cellText = useMemo(() => formatCellText(text), [text]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames(styles.cell, styles[(flow && flow.display) || 'single'])} ref={ref}>
|
<div className={classNames(styles.cell, styles[(flow && flow.display) || 'single'])} ref={ref}>
|
||||||
{is_visible && (
|
{is_visible && (
|
||||||
|
@ -150,7 +153,10 @@ const Cell: FC<IProps> = ({
|
||||||
<div className={styles.text}>
|
<div className={styles.text}>
|
||||||
{title && <div className={styles.text_title}>{title}</div>}
|
{title && <div className={styles.text_title}>{title}</div>}
|
||||||
|
|
||||||
<Group dangerouslySetInnerHTML={{ __html: formatCellText(text) }} />
|
<div
|
||||||
|
dangerouslySetInnerHTML={{ __html: cellText }}
|
||||||
|
className={markdown.wrapper}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
@ -158,7 +164,10 @@ const Cell: FC<IProps> = ({
|
||||||
<div className={styles.text_only}>
|
<div className={styles.text_only}>
|
||||||
{title && <div className={styles.text_title}>{title}</div>}
|
{title && <div className={styles.text_title}>{title}</div>}
|
||||||
|
|
||||||
<Group dangerouslySetInnerHTML={{ __html: formatCellText(text) }} />
|
<div
|
||||||
|
dangerouslySetInnerHTML={{ __html: cellText }}
|
||||||
|
className={markdown.wrapper}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -327,6 +327,7 @@
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
font-size: 6px;
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
content: ' ';
|
content: ' ';
|
||||||
|
|
|
@ -1,19 +1,26 @@
|
||||||
import React, { FC } from 'react';
|
import React, { FC, useMemo } from 'react';
|
||||||
import { INode } from '~/redux/types';
|
|
||||||
import { path } from 'ramda';
|
import { path } from 'ramda';
|
||||||
import { formatTextParagraphs } from '~/utils/dom';
|
import { formatTextParagraphs } from '~/utils/dom';
|
||||||
import styles from './styles.module.scss';
|
|
||||||
import { INodeComponentProps } from '~/redux/node/constants';
|
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 {}
|
interface IProps extends INodeComponentProps {}
|
||||||
|
|
||||||
const NodeTextBlock: FC<IProps> = ({ node }) => (
|
const NodeTextBlock: FC<IProps> = ({ node }) => {
|
||||||
<div
|
const content = useMemo(() => formatTextParagraphs(path(['blocks', 0, 'text'], node)), [
|
||||||
className={styles.text}
|
node.blocks,
|
||||||
dangerouslySetInnerHTML={{
|
]);
|
||||||
__html: formatTextParagraphs(path(['blocks', 0, 'text'], node)),
|
|
||||||
}}
|
return (
|
||||||
/>
|
<div
|
||||||
);
|
className={classNames(styles.text, markdown.wrapper)}
|
||||||
|
dangerouslySetInnerHTML={{
|
||||||
|
__html: content,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export { NodeTextBlock };
|
export { NodeTextBlock };
|
||||||
|
|
|
@ -8,27 +8,29 @@
|
||||||
right: 4px solid $red;
|
right: 4px solid $red;
|
||||||
}
|
}
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
font-size: 13px;
|
font-size: 0.9em;
|
||||||
border-radius: $radius;
|
border-radius: $radius;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
padding: $gap;
|
padding: $gap;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
margin-bottom: 0.3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
margin-bottom: $gap;
|
margin-bottom: 0.3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
margin-bottom: $gap;
|
margin-bottom: 0.3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
h5, h4, h3, h2, h1 {
|
h5, h4, h3, h2, h1 {
|
||||||
color: white;
|
color: white;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
line-height: 1.2em;
|
line-height: 1.2em;
|
||||||
|
margin-bottom: 0.3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
|
@ -54,10 +56,10 @@
|
||||||
ul {
|
ul {
|
||||||
list-style: disc;
|
list-style: disc;
|
||||||
padding-left: 20px;
|
padding-left: 20px;
|
||||||
margin-bottom: $gap;
|
margin-bottom: 0.3em;
|
||||||
|
|
||||||
li {
|
li {
|
||||||
margin: 5px 0;
|
margin: 0.1em 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue