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.39k stars 315 forks source link

Image preview handler #411

Closed diego-gw closed 2 years ago

diego-gw commented 2 years ago

Added the option to for the user to provide a handling function imagesPreviewHandler(parsedUrl: string) => string when previewing images in the editor allowing dynamic previewing of images directly in the frontend.

diego-gw commented 2 years ago

Can you provide an example of how this would be used? I'm confused about what the exact input/output of this function should be.

When copy-pasting images to the editor, I can use the clipboard event in the frontend to extract the image file and name. Then I can refer to the image in the markdown and use the handling function to preview it immediately. Images can be copy-pasted to the editor in the frontend only and uploaded all at once on save.

Sorry for the late reply.