Skip to content

Commit

Permalink
Merge pull request #573 from robinvandernoord/custom-image-input-name…
Browse files Browse the repository at this point in the history
…-option

Allow setting a custom `name` for the upload-image input
  • Loading branch information
Ionaru authored Dec 21, 2023
2 parents 35587a9 + c68bdf1 commit f039bae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/js/easymde.js
Original file line number Diff line number Diff line change
Expand Up @@ -1870,6 +1870,7 @@ function EasyMDE(options) {
options.imagePathAbsolute = options.imagePathAbsolute || false;
options.imageCSRFName = options.imageCSRFName || 'csrfmiddlewaretoken';
options.imageCSRFHeader = options.imageCSRFHeader || false;
options.imageInputName = options.imageInputName || 'image';


// Change unique_id to uniqueId for backwards compatibility
Expand Down Expand Up @@ -2689,7 +2690,7 @@ EasyMDE.prototype.createToolbar = function (items) {
imageInput.className = 'imageInput';
imageInput.type = 'file';
imageInput.multiple = true;
imageInput.name = 'image';
imageInput.name = self.options.imageInputName;
imageInput.accept = self.options.imageAccept;
imageInput.style.display = 'none';
imageInput.style.opacity = 0;
Expand Down
1 change: 1 addition & 0 deletions types/easymde.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ declare namespace EasyMDE {
imageCSRFName?: string;
imageCSRFHeader?: boolean;
imageTexts?: ImageTextsOptions;
imageInputName?: string
errorMessages?: ImageErrorTextsOptions;
errorCallback?: (errorMessage: string) => void;

Expand Down

0 comments on commit f039bae

Please sign in to comment.