Allow setting a custom `name` for the upload-image input

pull/573/head
Robin van der Noord 4 months ago
parent 35587a9477
commit c68bdf148a
No known key found for this signature in database
GPG Key ID: C48F4649BEAE9AEE

@ -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
@ -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;

@ -227,6 +227,7 @@ declare namespace EasyMDE {
imageCSRFName?: string;
imageCSRFHeader?: boolean;
imageTexts?: ImageTextsOptions;
imageInputName?: string
errorMessages?: ImageErrorTextsOptions;
errorCallback?: (errorMessage: string) => void;

Loading…
Cancel
Save