Closed imbhargav5 closed 3 years ago
@imbhargav5 https://github.com/uiwjs/react-md-editor/issues/52 Hope it helps you.
@imbhargav5 Have you solved this?
https://github.com/uiwjs/react-md-editor/issues/52#issuecomment-848969341 @stLoiz @imbhargav5
uiwjs/react-md-editor#52 quote @jaywcjlove
i used like this
import MarkdownEditor from '@uiw/react-markdown-editor';
import '@uiw/react-markdown-editor/dist/markdown-editor.css';
import '@uiw/react-markdown-preview/dist/markdown.css';
....
<MarkdownEditor
value={''}
onChange={(editor: any, data: any, value: any) => setMkdStr(value)}
/>
i can't solved this problem with next-remove-imports
error :
Server Error
ReferenceError: navigator is not defined
This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
<unknown>
...../node_modules/codemirror/lib/codemirror.js (18:19)
plz help me what should i do 😥
https://codesandbox.io/s/nextjs-example-react-codemirror-bimq7?file=/pages/index.js
@imbhargav5
import { useEffect, useState } from "react";
function HomePage() {
const [comp, setComp] = useState();
useEffect(() => {
if (window) {
import("@uiw/react-codemirror").then((obj) => {
if (!comp) {
setComp(obj.default);
}
});
}
}, []);
const Comps = comp;
return (
<div>
{Comps && (
<Comps
value="const a = 0;"
options={{
mode: "jsx"
}}
/>
)}
</div>
);
}
export default HomePage;
When using this component with Next.js, I am facing this error. Specifically at lines like these. https://github.com/uiwjs/react-markdown-editor/blob/2fd2077ec910cd2a21a99b3b5085d30266392eff/src/components/CodeMirror/index.tsx#L6 https://github.com/uiwjs/react-markdown-editor/blob/2fd2077ec910cd2a21a99b3b5085d30266392eff/src/components/CodeMirror/index.tsx#L7
error - ./node_modules/@uiw/react-markdown-editor/lib/esm/components/CodeMirror/codemirror.css Global CSS cannot be imported from within node_modules. Read more: https://err.sh/next.js/css-npm
Perhaps we can expose an export that is unstyled and one that is styled?
export default ...