Skip to content

Commit

Permalink
[UI] @uiw/react-md-editor NextJS 오류 대처
Browse files Browse the repository at this point in the history
  • Loading branch information
woogieReal committed Oct 28, 2022
1 parent 9d3a83a commit 5fb701d
Show file tree
Hide file tree
Showing 4 changed files with 1,427 additions and 120 deletions.
21 changes: 20 additions & 1 deletion components/tree/sections/viewSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { useState } from 'react';
import { Button, Box } from '@mui/material';
import styles from '@/styles/tree.module.scss'
import { Tree } from '@/src/models/tree.model';
import "@uiw/react-md-editor/markdown-editor.css";
import "@uiw/react-markdown-preview/markdown.css";
import dynamic from "next/dynamic";

interface Props {
open: boolean;
Expand Down Expand Up @@ -34,11 +37,27 @@ const ViewSection = ({ open, drawerWidth, fileTabVaue, files }: Props) => {
}),
}));

const MDEditor = dynamic(
() => import("@uiw/react-md-editor").then((mod) => mod.default),
{ ssr: false }
);
const EditerMarkdown = dynamic(
() =>
import("@uiw/react-md-editor").then((mod) => {
return mod.default.Markdown;
}),
{ ssr: false }
);

return (
<Box sx={{ marginTop: styles.appHeaderHeightPX }} >
<CssBaseline />
<Main open={open}>
{files[fileTabVaue]?.treeContent || ''}
<MDEditor
value={files[fileTabVaue]?.treeContent || ''}
onChange={() => {}}
/>
<EditerMarkdown source={files[fileTabVaue]?.treeContent || ''} style={{ whiteSpace: 'pre-wrap' }} />
</Main>
</Box>
);
Expand Down
5 changes: 4 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/** @type {import('next').NextConfig} */

const removeImports = require("next-remove-imports")();

const nextConfig = {
reactStrictMode: true,
swcMinify: true,
}

module.exports = nextConfig
module.exports = removeImports(nextConfig);
Loading

0 comments on commit 5fb701d

Please sign in to comment.