Open xenogenesi opened 6 years ago
I solved. Go to vendor/perminder-klair/dropzone/assets/DropZoneAssets.php change
public $js = [
"dropzone/dist/min/dropzone.min.js"
];
to
public $js = [
"dropzone/dist/dropzone.js"
];
now open dropzone.js and change
Dropzone.autoDiscover = true;
to
Dropzone.autoDiscover = false;
感谢楼上大神的回答,解决了我的问题,另一种方式可以修改dropzone/dist/dropzone.js的Dropzone.autoDiscover = false, 然后使用压缩工具压缩并覆盖"dropzone/dist/min/dropzone.min.js"
Problem has been solved in my last pull request.
@perminder-klair Please check it and merge
@mrstroz thanks, I can't test it right now but is looking good (much better/simple than my workaround). I'll give it a try as soon as I get some spare time
@xenogenesi Can you merge this PR?
@whizsid nope sorry, @perminder-klair should do it, but you can clone @mrstroz 's repository meanwhile
I'm using Chromium (Chrome) and I've a couple of errors in the javascript console:
registerJs()
by default bind/wrap its code to theonready
event (using jQuery) and this addon use it to configure the AutoDiscover option to true or false.asset::register()
doesn't bind/wrap to anything, as it should be for any javascript library/module, it is included at the end of the body after its dependencies and executed as soon as possible.The problem is that DropZone, at least the version used by this addon, execute as soon as possible a
contentLoaded
function that seems to bind to theonload
event, when the content is loaded the autoDiscover start.So what is happening (at least on the Chromium I'm using) is that the DropZone's autoDiscover function is executed before the addon javascript set the autoDiscover configuration.
Currently the only solution I've found is to add a new asset, with the js code to disable the autoDiscover, add to it DropZoneAsset as dependency, and in DropZone.php register it instead, but is far from optimal.