mirror of
https://github.com/friendica/friendica
synced 2024-11-17 23:43:40 +00:00
make dropzone work on editing postings/Comments
This commit is contained in:
parent
8242d1c72b
commit
00ae7d0f59
4 changed files with 16 additions and 12 deletions
|
@ -28,6 +28,7 @@ use Friendica\Core\Hook;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session\Capability\IHandleUserSessions;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Model\User;
|
||||
|
@ -35,8 +36,8 @@ use Friendica\Module\Response;
|
|||
use Friendica\Navigation\SystemMessages;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Util\Crypto;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\Profiler;
|
||||
use Friendica\DI;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
|
@ -184,6 +185,9 @@ class Edit extends BaseModule
|
|||
|
||||
'$compose_link_title' => $this->t('Open Compose page'),
|
||||
// Dropzone
|
||||
//'$max_imagesize' => Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
|
||||
//'$max_imagesize' => \Friendica\\Util\\Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
|
||||
// both not working, so just workaround here until fixed
|
||||
'$max_imagesize' => DI::config()->get('system', 'maximagesize'),
|
||||
]);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class="generic-page-wrapper">
|
||||
<div class="generic-page-wrapper"css>
|
||||
<h2>{{$l10n.compose_title}}</h2>
|
||||
{{if $l10n.always_open_compose}}
|
||||
<p>{{$l10n.always_open_compose nofilter}}</p>
|
||||
|
@ -97,7 +97,7 @@
|
|||
</div>
|
||||
<script>
|
||||
Dropzone.autoDiscover = false;
|
||||
var maxis = {{$max_imagesize}} / 100000;
|
||||
var maxis = {{$max_imagesize}} / 10^6;
|
||||
var dropzoneCompose = new Dropzone( '#comment-edit-form-{{$id}}', {
|
||||
paramName: "userfile", // The name that will be used to transfer the file
|
||||
maxFilesize: maxis, // MB
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
|
||||
<script>
|
||||
Dropzone.autoDiscover = false;
|
||||
var maxis = {{$max_imagesize}} / 100000;
|
||||
var maxis = {{$max_imagesize}} / 10^6;
|
||||
var dropzone{{$id}} = new Dropzone( '#comment-edit-wrapper-{{$id}}', {
|
||||
paramName: "userfile", // The name that will be used to transfer the file
|
||||
maxFilesize: maxis, // MB
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="jot-modal-body" class="modal-body dropzone">
|
||||
<div id="jot-modal-body" class="modal-body">
|
||||
<form id="profile-jot-form" action="{{$action}}" method="post">
|
||||
<div id="profile-jot-wrapper" aria-labelledby="jot-text-lnk" role="tabpanel" aria-hidden="false">
|
||||
<div>
|
||||
|
@ -163,26 +163,26 @@
|
|||
{{* The jot modal - We use a own modal for the jot and not the standard modal
|
||||
from the page template. This is because the special structure of the jot
|
||||
(e.g.jot navigation tabs in the modal titel area).
|
||||
The in the frio theme the jot will loaded regulary and is hidden by default.)
|
||||
Then in the frio theme the jot will loaded regulary and is hidden by default.)
|
||||
The js function jotShow() loads the jot into the modal. With this structure we
|
||||
can load different content into the jot moadl (e.g. the item edit jot)
|
||||
can load different content into the jot modal (e.g. the item edit jot)
|
||||
*}}
|
||||
<div id="jot-modal" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<div id="jot-modal-content" class="modal-content"></div>
|
||||
<div id="jot-modal-content" class="modal-content dropzone"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$('iframe').load(function() {
|
||||
this.style.height = this.contentWindow.document.body.offsetHeight + 'px';
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
Dropzone.autoDiscover = false;
|
||||
var maxis = {{$max_imagesize}} / 100000;
|
||||
var dropzoneJot = new Dropzone( '#jot-modal-body', {
|
||||
var maxis = {{$max_filesize}} / 10^6;
|
||||
var dropzoneJot = new Dropzone( '#jot-modal-content', {
|
||||
paramName: "userfile", // The name that will be used to transfer the file
|
||||
maxFilesize: maxis, // MB
|
||||
previewsContainer: '#dz-preview-jot',
|
||||
|
@ -205,7 +205,7 @@ can load different content into the jot moadl (e.g. the item edit jot)
|
|||
},
|
||||
});
|
||||
|
||||
$('#jot-modal-body').on('paste', function(event){
|
||||
$('#jot-modal-content').on('paste', function(event){
|
||||
const items = (event.clipboardData || event.originalEvent.clipboardData).items;
|
||||
items.forEach((item) => {
|
||||
if (item.kind === 'file') {
|
||||
|
|
Loading…
Reference in a new issue