Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.dropzone.on('addedfile', function (file) {
let isDuplicate = false // eslint-disable-line no-unused-vars
const _removeLink = Dropzone.createElement('<a data-dz-remove="" class="dz-remove btn-icon"><i class="fas fa-times"></i></a>')
file.previewElement.appendChild(_removeLink)
if (vm.duplicateCheck) {
if (this.files.length) {
var _i, _len
// -1 to exclude current file
for (_i = 0, _len = this.files.length; _i < _len - 1; _i++) {
if (this.files[_i].name === file.name &&
this.files[_i].size === file.size &&
this.files[_i].lastModifiedDate.toString() === file.lastModifiedDate.toString()) {
this.removeFile(file)
isDuplicate = true
vm.$emit('vdropzone-duplicate-file', file)
}
}
}
this.on('addedfile', (e) => {
console.log('dropzone.addedfile');
if (this.files.length > this.options.maxFiles) {
window.platform.alert('Validation error', 'Max files');
this.removeFile(e);
}
const removeButton = Dropzone.createElement('<a class="btn-remove">×</a>');
const editButton = Dropzone.createElement('<a class="btn-edit"><i aria-hidden="true" class="icon-note"></i></a>');
removeButton.addEventListener('click', (event) => {
event.preventDefault();
event.stopPropagation();
this.removeFile(e);
});
editButton.addEventListener('click', () => {
loadInfo(e.data);
$(`${dropname} .attachment.modal`).modal('show');
});
e.previewElement.appendChild(removeButton);
e.previewElement.appendChild(editButton);
if (e.data !== undefined) {
this.on('addedfile', (e) => {
console.log('dropzone.addedfile');
if (this.files.length > this.options.maxFiles) {
window.platform.alert('Validation error', 'Max files');
this.removeFile(e);
}
const removeButton = Dropzone.createElement('<a class="btn-remove">×</a>');
const editButton = Dropzone.createElement('<a class="btn-edit"><i aria-hidden="true" class="icon-note"></i></a>');
removeButton.addEventListener('click', (event) => {
event.preventDefault();
event.stopPropagation();
this.removeFile(e);
});
editButton.addEventListener('click', () => {
loadInfo(e.data);
$(`${dropname} .attachment.modal`).modal('show');
});
e.previewElement.appendChild(removeButton);
e.previewElement.appendChild(editButton);