Hi All,
Does Yii2 Redactor extension support multiple images upload? (Redactor itself supports this feature.)
If yes, how configuration should looks like?
Appreciate a working example!
Thank you!
Vladas.
Hi All,
Does Yii2 Redactor extension support multiple images upload? (Redactor itself supports this feature.)
If yes, how configuration should looks like?
Appreciate a working example!
Thank you!
Vladas.
Well, forum was not helpful, but I would like to post back my findings:
Problem:
Current licensed version of WYSIWYG Redactor by Imperavi is version dated October 2015 (really old and outdated).
Redactor supports multipleImageUpload setting starting from version 1.2 dated December 16th, 2015
Workaround:
I’ve found the problematic place in the redactor.js file that is located in vendor/yiidoc/yii2-redactor/assets/
onDrop: function (e) {
e = e.originalEvent || e;
var files = e.dataTransfer.files;
this.upload.traverseFile(files[0], e);
As you can see, only the first image will be uploaded, as it is hardcoded files[0] in the JavaScript
So, small change to have a loop on all images helped me to solve the problem:
onDrop: function (e) {
e = e.originalEvent || e;
var files = e.dataTransfer.files;
for (var index = 0; index < files.length; ++index) {
this.upload.traverseFile(files[index], e);
}
Now user can drop multiple files to the upload box and it works fine, except of progress bar that works incorrectly.
PS. No changes are needed on PHP side