diff --git a/merge/src/Internal.tsx b/merge/src/Internal.tsx index 7bce755c3..e09f6ee99 100644 --- a/merge/src/Internal.tsx +++ b/merge/src/Internal.tsx @@ -36,11 +36,7 @@ export const Internal = React.forwardRef((props: CodeMirrorMergeProps, ref?: Rea } }, [editor.current, original, modified, view]); - useEffect(() => { - return () => { - view && view.destroy(); - }; - }, []); + useEffect(() => () => view && view.destroy(), []); useEffect(() => { if (view) { diff --git a/www/src/components/Markdown.tsx b/www/src/components/Markdown.tsx index 5c6f6a94e..b5a3c32da 100644 --- a/www/src/components/Markdown.tsx +++ b/www/src/components/Markdown.tsx @@ -1,9 +1,10 @@ -import { FC, PropsWithChildren, useEffect, useRef } from 'react'; +import { FC, PropsWithChildren, useRef } from 'react'; import CodeLayout from 'react-code-preview-layout'; import { getMetaId, isMeta, getURLParameters, CodeBlockData } from 'markdown-react-code-preview-loader'; import MarkdownPreview, { MarkdownPreviewProps } from '@uiw/react-markdown-preview'; import rehypeIgnore from 'rehype-ignore'; import { CodeProps } from 'react-markdown/lib/ast-to-react'; +import styled from 'styled-components'; const Preview = CodeLayout.Preview; const Code = CodeLayout.Code; @@ -13,6 +14,12 @@ interface CodePreviewProps extends CodeProps { mdData?: CodeBlockData; } +const CodeLayoutView = styled(CodeLayout)` + & + div.copied { + display: none !important; + } +`; + const CodePreview: FC> = ({ inline, node, ...props }) => { const $dom = useRef(null); const { mdData, ...rest } = props; @@ -35,15 +42,15 @@ const CodePreview: FC> = ({ inline, node, .. const code = mdData?.data[metaId].value || ''; const param = getURLParameters(meta); return ( - + - {param.title || 'Example'} + {param.title || 'Example'}
         
-      
+      
     );
   }
   return ;
@@ -59,7 +66,7 @@ export default function Markdown(props: MarkdownProps) {