sparksuite / simplemde-markdown-editor

A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving and spell checking.
https://simplemde.com
MIT License
9.79k stars 1.12k forks source link

'modeOption' of undefined #757

Open ghost opened 4 years ago

ghost commented 4 years ago

import React from 'react'; import SimpleMDE from 'simplemde';

class MDEditor extends React.Component<any, any> { public editor = null; public componentDidMount() { this.init(); } public init = () => { this.editor = new SimpleMDE({ element: document.getElementById('mdEditor') }); this.editor.value('test'); }; public render() { return

; } }

export default MDEditor;

image

Tracy4ever commented 4 years ago

Do you find out the resolution?I met the same problem.

mengdu commented 4 years ago

I got the same message; maybe the element you're using is not textarea.

xyshirly commented 4 years ago

it works for me following three steps: 1.

2.need to import both js and css import SimpleMDE from 'simplemde'; import 'simplemde/dist/simplemde.min.css';

3.var simplemde = new SimpleMDE({ element: document.getElementById("editor") });