Closes #296: firefox hack to prevent file open on drag & drop

This commit is contained in:
Benjamin Gamard 2019-05-03 13:19:21 +02:00
parent 58bc374e64
commit 9ea1dad62d
2 changed files with 15 additions and 5 deletions

View File

@ -20,7 +20,15 @@ angular.module('docs').controller('DocumentViewContent', function ($scope, $root
forceHelperSize: true,
forcePlaceholderSize: true,
tolerance: 'pointer',
start: function() {
$(this).addClass('currently-dragging');
},
stop: function () {
var _this = this;
setTimeout(function(){
$(_this).removeClass('currently-dragging');
}, 300);
// Send new positions to server
$scope.$apply(function () {
Restangular.one('file').post('reorder', {
@ -45,8 +53,10 @@ angular.module('docs').controller('DocumentViewContent', function ($scope, $root
/**
* Navigate to the selected file.
*/
$scope.openFile = function (file) {
$state.go('document.view.content.file', { id: $stateParams.id, fileId: file.id })
$scope.openFile = function (file, $event) {
if ($($event.target).parents('.currently-dragging').length === 0) {
$state.go('document.view.content.file', {id: $stateParams.id, fileId: file.id})
}
};
/**

View File

@ -70,7 +70,7 @@
<span class="fas fa-spin fa-circle-notch"></span>
</div>
<a class="file-thumbnail" ng-click="openFile(file)">
<a class="file-thumbnail" ng-click="openFile(file, $event)">
<img ng-src="../api/file/{{ file.id }}/data?size=thumb" uib-tooltip="{{ file.mimetype }} | {{ file.size | filesize }}" tooltip-placement="top" />
</a>
@ -148,12 +148,12 @@
</thead>
<tbody ui-sortable="fileSortableOptions" ng-model="files">
<tr ng-repeat="file in files">
<td class="pointer" ng-click="openFile(file)">
<td class="pointer" ng-click="openFile(file, $event)">
<div class="thumbnail-list">
<img ng-src="../api/file/{{ file.id }}/data?size=thumb" />
</div>
</td>
<td class="pointer" ng-click="openFile(file)">
<td class="pointer" ng-click="openFile(file, $event)">
{{ file.name }}
<span class="fas fa-spin fa-circle-notch"
ng-show="file.processing"