uiwjs / react-markdown-editor

A markdown editor with preview, implemented with React.js and TypeScript.
https://uiwjs.github.io/react-markdown-editor
MIT License
337 stars 34 forks source link

Creates two div with class: CodeMirror cm-s-default #178

Open muratsesen opened 2 years ago

muratsesen commented 2 years ago

When I implement the basic example in a newly created react app, it creates two separate text fields inside the editor. This is really weird. It looks like this:

Toolbar section

| 1 | #this is a text field which can be edited | 1 | #this is another text field which is also editable

jaywcjlove commented 2 years ago

@muratsesen I didn't understand what you meant

berkaycimsir commented 2 years ago

i also faced with this issue i fixed it with hiding the last one by the css below

    '.cm-s-default:last-child': {
          display: 'none !important',
     },

also i realized that it does not create the second one in production, creates in only local

so i am using this in my project

const StyledMarkdownEditor = styled(MarkdownEditor)({
  ...(!prod
    ? {
        '.cm-s-default:last-child': {
          display: 'none !important',
        },
      }
    : {}),
});

my package versions

    "@uiw/react-markdown-editor": "^4.0.3",
    "next": "latest",
    "next-remove-imports": "^1.0.6",
    "react": "latest",

screenshot of the issue

Screen Shot 2022-04-29 at 03 26 45

also there is an another issue, if i hit enter one time the space does not apply. i need to hit two times to enter to put space check screenshot below

Screen Shot 2022-04-29 at 03 31 06