-var DzFactory = function () {
+Dropzone.autoDiscover = false;
+var DzFactory = function (max_imagesize) {
this.createDropzone = function(dropSelector, textareaElementId) {
return new Dropzone(dropSelector, {
paramName: 'userfile', // The name that will be used to transfer the file
maxFilesize: max_imagesize, // MB
url: '/media/photo/upload?album=',
- addRemoveLinks: true,
acceptedFiles: 'image/*',
clickable: true,
+ dictDefaultMessage: dzStrings.dictDefaultMessage,
+ dictFallbackMessage: dzStrings.dictFallbackMessage,
+ dictFallbackText: dzStrings.dictFallbackText,
+ dictFileTooBig: dzStrings.dictFileTooBig,
+ dictInvalidFileType: dzStrings.dictInvalidFileType,
+ dictResponseError: dzStrings.dictResponseError,
+ dictCancelUpload: dzStrings.dictCancelUpload,
+ dictUploadCanceled: dzStrings.dictUploadCanceled,
+ dictCancelUploadConfirmation: dzStrings.dictCancelUploadConfirmation,
+ dictRemoveFile: dzStrings.dictRemoveFile,
+ dictMaxFilesExceeded: dzStrings.dictMaxFilesExceeded,
accept: function(file, done) {
done();
},
const targetTextarea = document.getElementById(textareaElementId);
if (targetTextarea.setRangeText) {
//if setRangeText function is supported by current browser
- targetTextarea.setRangeText(' ' + $.trim(serverResponse) + ' ');
+ targetTextarea.setRangeText(serverResponse);
} else {
targetTextarea.focus();
- document.execCommand('insertText', false /*no UI*/, '\n' + $.trim(serverResponse) + '\n');
+ document.execCommand('insertText', false /*no UI*/, serverResponse);
}
});
this.on('complete', function(file) {
};
this.setupDropzone = function(dropSelector, textareaElementId) {
+ const self = this;
var dropzone = this.createDropzone(dropSelector, textareaElementId);
$(dropSelector).on('paste', function(event) {
- dzFactory.copyPaste(event, dropzone);
+ self.copyPaste(event, dropzone);
})
};
}