</div>
</div>
<script>
- var dropzoneCompose = new Dropzone(document.body, { // camelized version of the `id`
+ Dropzone.autoDiscover = false;
+ var dropzoneCompose = new Dropzone( '#comment-edit-form-{{$id}}', {
paramName: "userfile", // The name that will be used to transfer the file
maxFilesize: 2, // MB
previewsContainer: '#dz-previewsCompose',
},
init: function() {
this.on("success", function(file, serverResponse) {
- var target = $(':focus').closest('.comment-edit-form').find('.comment-edit-text');
+ var target = $('#comment-edit-text-{{$id}}')
var resp = $(serverResponse).find('div#content').text()
if (target.setRangeText) {
//if setRangeText function is supported by current browser
});
},
});
- document.onpaste = function(event){
+
+ $('#comment-edit-form-{{$id}}').on('paste', function(event){
const items = (event.clipboardData || event.originalEvent.clipboardData).items;
items.forEach((item) => {
if (item.kind === 'file') {
dropzoneCompose.addFile(item.getAsFile())
}
})
- }
+ });
</script>
<script>
Dropzone.autoDiscover = false;
var dropzone{{$id}} = new Dropzone( '#comment-edit-wrapper-{{$id}}', {
- //var dropzone{{$id}} = new Dropzone( document.body, {
paramName: "userfile", // The name that will be used to transfer the file
maxFilesize: 6, // MB
previewsContainer: '#dz-preview-{{$id}}',
dropzone{{$id}}.addFile(item.getAsFile())
}
})
- })
+ });
</script>