diff --git a/src/js/easymde.js b/src/js/easymde.js index 3283ef7..f9a3414 100644 --- a/src/js/easymde.js +++ b/src/js/easymde.js @@ -2340,7 +2340,7 @@ EasyMDE.prototype.uploadImage = function (file, onSuccess, onError) { return; } if (this.status === 200 && response && !response.error && response.data && response.data.filePath) { - onSuccess(window.location.origin + '/' + response.data.filePath); + onSuccess((self.options.imagePathAbsolute ? '' : (window.location.origin + '/')) + response.data.filePath); } else { if (response.error && response.error in self.options.errorMessages) { // preformatted error message onErrorSup(fillErrorMessage(self.options.errorMessages[response.error])); diff --git a/types/easymde.d.ts b/types/easymde.d.ts index 98a6a95..ea88a54 100644 --- a/types/easymde.d.ts +++ b/types/easymde.d.ts @@ -207,6 +207,7 @@ declare namespace EasyMDE { imageAccept?: string; imageUploadFunction?: (file: File, onSuccess: (url: string) => void, onError: (error: string) => void) => void; imageUploadEndpoint?: string; + imagePathAbsolute?: boolean; imageCSRFToken?: string; imageTexts?: ImageTextsOptions; errorMessages?: ImageErrorTextsOptions;