react-simplemde-editor icon indicating copy to clipboard operation
react-simplemde-editor copied to clipboard

Preview not working (showing undefined)

Open Omer1Yuval1 opened this issue 1 year ago • 5 comments

When I click the preview button, the raw text is replaced by undefined, instead of the compiled markdown.

import SimpleMdeReact from "react-simplemde-editor";

const component_name = () => {
    const [value, setValue] = useState("");
    const options = useMemo(() => {
        return {
            blockStyles: {
                code: "```"
              },
              toolbar: [
                  "bold",
                  "italic",
                  "heading",
                  "|",
                  "code",
                  "quote",
                  "unordered-list",
                  "ordered-list",
                  "|",
                  "link",
                  "image",
                  "table",
                  "horizontal-rule",
                  "preview",
                  "guide"
                ],
        }
    }, []);

     return (
          <SimpleMdeReact value={value} options={options}/>
     );
}

Versions:

"react": "^18.2.0",
"easymde": "^2.18.0",
"react-simplemde-editor": "^5.2.0",

Omer1Yuval1 avatar May 27 '23 07:05 Omer1Yuval1

same

ElGranTorino avatar Jun 29 '23 08:06 ElGranTorino

Try easymde 2.16.0 or less

necimye avatar Jun 29 '23 17:06 necimye

Try easymde 2.16.0 or less

Doesn't work for me

Dhalion avatar Jul 13 '23 12:07 Dhalion

This worked for me. I had to set "easymde": "2.16.0" in my package.json instead of "easymde": "^2.16.0". Note the missing carrot symbol to prevent npm from auto-upgrading it.

joecrop avatar Aug 09 '23 16:08 joecrop

I saw this issue with easymed ^2.18.0. Downgrading to 2.16.0 fixes it for me.

asbjornenge avatar Aug 28 '23 14:08 asbjornenge