Skip to content
Snippets Groups Projects

B17536: Changed initialization handling. Initialize only upload elements which...

Merged Enis Nuredini requested to merge B17536_filepond_multiple_pills into develop
3 files
+ 54
18
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -6,7 +6,15 @@
var QfqNS = QfqNS || {};
/**
* Qfq Helper Namespace
*
* @namespace QfqNS.Helper
*/
QfqNS.Helper = QfqNS.Helper || {};
(function (n) {
'use strict';
n.filePond = function createFileUpload(inputElement) {
// Retrieve all needed data and configurations
@@ -455,5 +463,32 @@ var QfqNS = QfqNS || {};
}).join(',');
}
})(QfqNS);
n.initializeFilePondInContainer = function (container, form) {
const inputElements = container.querySelectorAll('input[type="file"].fileupload');
const visibleInputElements = Array.from(inputElements).filter(input => input.offsetParent !== null);
visibleInputElements.forEach(inputElement => {
inputElements.forEach((inputElement, index) => {
let fileObject = new n.filePond(inputElement);
fileObject.createFilePondObject();
// Call the form change after file remove
if (form !== '') {
fileObject.pond.on('removefile', function(file) {
const element = fileObject.pond.element;
form.inputAndPasteHandlerCalled = true;
form.markChanged(element);
});
fileObject.pond.on('processfile', function(file) {
const element = fileObject.pond.element;
form.inputAndPasteHandlerCalled = true;
form.markChanged(element);
});
}
});
});
}
})(QfqNS.Helper);
Loading