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.38k stars 314 forks source link

Detached preview rendering #471

Closed LevitatingOrange closed 2 years ago

LevitatingOrange commented 2 years ago

This is a very simple PR to allow more flexibility when rendering the preview. At the moment the innerHTML of the preview node will be overwritten with the result from previewRender with every showing of the preview. If you want to control this node via external means, for example with vdom diffing frameworks like Mithril.js or React, this gets in your way. With this change, the innerHtml of the preview node will only be overwritten if the result of previewRender is not null. I updated the type definitions and documentation accordingly.