Ionaru / easy-markdown-editor

EasyMDE: A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving and spell checking.
https://stackblitz.com/edit/easymde
MIT License
2.45k stars 319 forks source link

Is there plan for ES Module support? #262

Open CaptainYouz opened 4 years ago

CaptainYouz commented 4 years ago

Everything in the title!

(thanks for this great fork 👍 )

Ionaru commented 4 years ago

I did a quick test with browserify and the plugin efmify but it does not look like I can easily convert the editor to an ESM compatible package. However I do think providing an ESM package should be a goal to work towards.

jameschristopher commented 3 years ago

+1 here too! Seems like there is a lot of opportunity to reduce the codemirror bundle size through selective imports.

Warfenix commented 3 years ago

+1

amcsi commented 2 years ago

How do I import this library whether it's ES Modules or not? I don't see any examples using import in the README.

Ionaru commented 2 years ago

Using npm you can import it like any other npm package: https://docs.npmjs.com/using-npm-packages-in-your-projects

Otherwise use one of the CDN scripts, the editor will then be available globally.

amcsi commented 2 years ago

I tried this:

import EasyMDE from "easymde";

new EasyMDE();

And I got:

TypeError: Cannot read properties of undefined (reading 'getAttribute')
push../node_modules/easymde/src/js/easymde.js.EasyMDE.render
node_modules/easymde/src/js/easymde.js:2110