mirror of
https://github.com/friendica/friendica
synced 2024-12-23 09:20:17 +00:00
fix composer dropzone
This commit is contained in:
parent
5107d4418e
commit
6a7f17559e
2 changed files with 7 additions and 6 deletions
|
@ -96,7 +96,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<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
|
paramName: "userfile", // The name that will be used to transfer the file
|
||||||
maxFilesize: 2, // MB
|
maxFilesize: 2, // MB
|
||||||
previewsContainer: '#dz-previewsCompose',
|
previewsContainer: '#dz-previewsCompose',
|
||||||
|
@ -110,7 +111,7 @@
|
||||||
},
|
},
|
||||||
init: function() {
|
init: function() {
|
||||||
this.on("success", function(file, serverResponse) {
|
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()
|
var resp = $(serverResponse).find('div#content').text()
|
||||||
if (target.setRangeText) {
|
if (target.setRangeText) {
|
||||||
//if setRangeText function is supported by current browser
|
//if setRangeText function is supported by current browser
|
||||||
|
@ -122,7 +123,8 @@
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
document.onpaste = function(event){
|
|
||||||
|
$('#comment-edit-form-{{$id}}').on('paste', function(event){
|
||||||
const items = (event.clipboardData || event.originalEvent.clipboardData).items;
|
const items = (event.clipboardData || event.originalEvent.clipboardData).items;
|
||||||
items.forEach((item) => {
|
items.forEach((item) => {
|
||||||
if (item.kind === 'file') {
|
if (item.kind === 'file') {
|
||||||
|
@ -131,5 +133,5 @@
|
||||||
dropzoneCompose.addFile(item.getAsFile())
|
dropzoneCompose.addFile(item.getAsFile())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -68,7 +68,6 @@
|
||||||
<script>
|
<script>
|
||||||
Dropzone.autoDiscover = false;
|
Dropzone.autoDiscover = false;
|
||||||
var dropzone{{$id}} = new Dropzone( '#comment-edit-wrapper-{{$id}}', {
|
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
|
paramName: "userfile", // The name that will be used to transfer the file
|
||||||
maxFilesize: 6, // MB
|
maxFilesize: 6, // MB
|
||||||
previewsContainer: '#dz-preview-{{$id}}',
|
previewsContainer: '#dz-preview-{{$id}}',
|
||||||
|
@ -104,7 +103,7 @@
|
||||||
dropzone{{$id}}.addFile(item.getAsFile())
|
dropzone{{$id}}.addFile(item.getAsFile())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
});
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue