diff --git a/web/markdown/markdown-spoiler.react.js b/web/markdown/markdown-spoiler.react.js new file mode 100644 --- /dev/null +++ b/web/markdown/markdown-spoiler.react.js @@ -0,0 +1,21 @@ +// @flow + +import * as React from 'react'; + +import type { ReactElement } from 'lib/shared/markdown'; + +type MarkdownSpoilerProps = { + +text: ReactElement, +}; + +function MarkdownSpoiler(props: MarkdownSpoilerProps): React.Node { + const { text } = props; + + return {text}; +} + +const MemoizedMarkdownSpoiler: React.ComponentType = React.memo( + MarkdownSpoiler, +); + +export default MemoizedMarkdownSpoiler; diff --git a/web/markdown/rules.react.js b/web/markdown/rules.react.js --- a/web/markdown/rules.react.js +++ b/web/markdown/rules.react.js @@ -9,6 +9,7 @@ import type { RelativeMemberInfo } from 'lib/types/thread-types'; import { useSelector } from '../redux/redux-utils'; +import MarkdownSpoiler from './markdown-spoiler.react'; export type MarkdownRules = { +simpleMarkdownRules: SharedMarkdown.ParserRules, @@ -99,7 +100,9 @@ node: SharedMarkdown.SingleASTNode, output: SharedMarkdown.Output, state: SharedMarkdown.State, - ) => {output(node.content, state)}, + ) => ( + + ), }, inlineCode: SimpleMarkdown.defaultRules.inlineCode, em: SimpleMarkdown.defaultRules.em,