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

Absolute instead of relative path for image upload? #305

Closed wwsalmon closed 3 years ago

wwsalmon commented 3 years ago

I'm implementing inlnie image upload and have an endpoint set up to upload the image to an S3 bucket and return the URL.

However, the URL is treated as a relative path, i.e. the inserted image is ![](http://localhost:3000/https://postulate.s3.us-west-1.amazonaws.com/myimage.jpg). Any way to have the returned path treated as an absolute URL?

wwsalmon commented 3 years ago

Looking through the source code, looks like path is necessarily relative (easymde.js line 2343):

onSuccess(window.location.origin + '/' + response.data.filePath);

Any chance of adding an option like boolean imagePathAbsolute to support absolute paths? I'd be willing to make a PR if it can be merged soon!

Ionaru commented 3 years ago

Closed in #313