Skip to content

Commit f039bae

Browse files
authored
Merge pull request #573 from robinvandernoord/custom-image-input-name-option
Allow setting a custom `name` for the upload-image input
2 parents 35587a9 + c68bdf1 commit f039bae

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/js/easymde.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1870,6 +1870,7 @@ function EasyMDE(options) {
18701870
options.imagePathAbsolute = options.imagePathAbsolute || false;
18711871
options.imageCSRFName = options.imageCSRFName || 'csrfmiddlewaretoken';
18721872
options.imageCSRFHeader = options.imageCSRFHeader || false;
1873+
options.imageInputName = options.imageInputName || 'image';
18731874

18741875

18751876
// Change unique_id to uniqueId for backwards compatibility
@@ -2689,7 +2690,7 @@ EasyMDE.prototype.createToolbar = function (items) {
26892690
imageInput.className = 'imageInput';
26902691
imageInput.type = 'file';
26912692
imageInput.multiple = true;
2692-
imageInput.name = 'image';
2693+
imageInput.name = self.options.imageInputName;
26932694
imageInput.accept = self.options.imageAccept;
26942695
imageInput.style.display = 'none';
26952696
imageInput.style.opacity = 0;

types/easymde.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ declare namespace EasyMDE {
227227
imageCSRFName?: string;
228228
imageCSRFHeader?: boolean;
229229
imageTexts?: ImageTextsOptions;
230+
imageInputName?: string
230231
errorMessages?: ImageErrorTextsOptions;
231232
errorCallback?: (errorMessage: string) => void;
232233

0 commit comments

Comments
 (0)