Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function init() {
// Disable auto discover for all elements
Dropzone.autoDiscover = false;
return {
add: (id, view, uploadUrl) => {
let loader = new Dropzone(view, {
url : uploadUrl,
paramName: 'award',
clickable: true,
maxFiles : 1,
headers: {
'x-ns-award-entity-id': id,
'x-csrf-token' : window.config.csrf_token
},
thumbnailWidth : null,
thumbnailHeight: null,
})
this.on('error', function (file, errorMessage, xhr) {
console.error(errorMessage)
})
this.on('sending', function (file, xhr, formData) {
xhr.ontimeout = () => {
_self.options.onError('Server Timeout')
console.error('Server Timeout')
}
})
}
}
Dropzone.autoDiscover = this.options.autoDiscover
try {
/* eslint-disable no-new */
new Dropzone(this.options.selector, Dropzone.options.uploadDropzoneDocument)
let $dropzone = $(this.options.selector)
$dropzone.append(`<div class="dz-default dz-message"><span>${this.options.dictDefaultMessage}</span></div>`)
let $dzMessage = $dropzone.find('.dz-message')
$dzMessage.append(`
<div class="circles-icons">
<div class="circle circle-1"></div>
<div class="circle circle-2"></div>
<div class="circle circle-3"></div>
<div class="circle circle-4"></div>
<div class="circle circle-5"></div>
<i class="uk-icon-rz-file"></i></div>
this.on(eventName, handlers[eventName]);
}
},
url : backend.servicesEndpoint + "/api/file/upload",
headers : backend.getAuthorizationHeaders(),
acceptedFiles : "image/*",
params : { companyId: backend.getUserId()},
createImageThumbnails : false,
addRemoveLinks : false,
// clickable : ".library-page__upload .zone",
previewTemplate : '<div></div>',
previewsContainer : ReactDom.findDOMNode(this.refs.dropzone_output),
// previewsContainer : ".user-images .dropzone .zone",
};
Dropzone.autoDiscover = false;
var dropzone_el = ReactDom.findDOMNode(this.refs.dropzone);
this.dropzone = new Dropzone(dropzone_el, config);
}
function composerDropzone(
attachmentFileFormat,
tools,
attachmentModel,
dispatchers,
notification,
gettextCatalog,
$state,
translator
) {
Dropzone.autoDiscover = false;
const isEO = $state.includes('eo.*');
const numberLimit = { number: ATTACHMENT_SIZE_LIMIT };
const sizeLimit = { number: ATTACHMENT_SIZE_LIMIT };
const I18N = translator(() => ({
0: gettextCatalog.getString('Empty attachment', null, 'Composer'),
[ATTACHMENT_NUMBER_LIMIT]: gettextCatalog.getString(
'Messages are limited to {{number}} attachments',
numberLimit,
'Composer'
),
[ATTACHMENT_SIZE_LIMIT]: gettextCatalog.getString(
'Attachments are limited to {{number}} MB.',
sizeLimit,
'Composer'
initAvatarUpload() {
Dropzone.autoDiscover = false;
this.dropzone = new Dropzone(this.$refs.uploadContainer, {
url: ApiClient.$baseUrl + '/users/' + this.user.id,
method: 'put',
maxFiles: 1,
timeout: 0,
paramName: 'avatar',
parallelUploads: 1,
uploadMultiple: false,
thumbnailWidth: null,
thumbnailHeight: null,
addRemoveLinks: false,
createImageThumbnails: false,
acceptedFiles: '.png, .jpg, .jpeg, .svg',
previewTemplate: '<div style="display: none"></div>',
});
componentDidMount: function () {
var self = this;
Dropzone.autoDiscover = false;
dropzone = new Dropzone(this.view, {
url : this.props.action,
paramName: 'award',
clickable: true,
maxFiles : 1,
//Overwrite Dropzone events
addedfile: function (file) {
},
error: function (file, error) {
self.props.error(file, error);
},
success: function (file, response) {
create_dropzone: function() {
var selector = '#' + this.get_selector();
Dropzone.autoDiscover = false;
if (this.$(selector).is(':visible')) {
this.dropzone = new Dropzone(this.$(selector).get(0), {
maxFiles: 1,
clickable: [selector + '_placeholder', selector + '_swap'],
acceptedFiles: this.acceptedFiles,
url: this.upload_url,
previewTemplate: this.dropzone_template(null, { data: this.get_intl_data() }),
previewsContainer: selector,
headers: {
'X-CSRFToken': get_cookie('csrftoken'),
Preset: this.preset_id,
Node: this.model.id,
},
});
this.dropzone.on('success', this.image_uploaded);
this.dropzone.on('addedfile', this.image_added);
mounted() {
Dropzone.autoDiscover = false;
},
destroyed() {
});
$('.media-file').on('click', '.media-rename', (event) => {
media.rename(event.target);
});
$('.media-file').on('click', '.media-move', (event) => {
media.move(event.target);
});
$('#new_folder').click(() => {
media.new_folder();
});
const DropzoneOptions = media.dropzone_options();
Dropzone.autoDiscover = false;
const filemanagerDropzone = new Dropzone('#filemanager', DropzoneOptions);
const fileuploadDropzone = new Dropzone('#upload', DropzoneOptions);
}
dragUpload(){
let Dropzone = require('dropzone'); //eslint-disable-line
Dropzone.autoDiscover = false;
this.dropzone = new Dropzone("div#mediaManagerDropZone", {
clickable: false,
createImageThumbnails: false,
dictDefaultMessage: "",
enqueueForUpload: true,
paramName: "files",
previewsContainer: null,
previewTemplate: "<span class="\"hidden\""></span>",
hiddenInputContainer: true,
uploadMultiple: true,
url: `${this.prefix}browser/file`,
headers: {
"X-CSRF-TOKEN": window.axios.defaults.headers.common["X-CSRF-TOKEN"]
},
sending: (file, xhr, form) => {