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, forceHelperSize: true,
forcePlaceholderSize: true, forcePlaceholderSize: true,
tolerance: 'pointer', tolerance: 'pointer',
start: function() {
$(this).addClass('currently-dragging');
},
stop: function () { stop: function () {
var _this = this;
setTimeout(function(){
$(_this).removeClass('currently-dragging');
}, 300);
// Send new positions to server // Send new positions to server
$scope.$apply(function () { $scope.$apply(function () {
Restangular.one('file').post('reorder', { Restangular.one('file').post('reorder', {
@ -45,8 +53,10 @@ angular.module('docs').controller('DocumentViewContent', function ($scope, $root
/** /**
* Navigate to the selected file. * Navigate to the selected file.
*/ */
$scope.openFile = function (file) { $scope.openFile = function (file, $event) {
$state.go('document.view.content.file', { id: $stateParams.id, fileId: file.id }) 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> <span class="fas fa-spin fa-circle-notch"></span>
</div> </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" /> <img ng-src="../api/file/{{ file.id }}/data?size=thumb" uib-tooltip="{{ file.mimetype }} | {{ file.size | filesize }}" tooltip-placement="top" />
</a> </a>
@ -148,12 +148,12 @@
</thead> </thead>
<tbody ui-sortable="fileSortableOptions" ng-model="files"> <tbody ui-sortable="fileSortableOptions" ng-model="files">
<tr ng-repeat="file in 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"> <div class="thumbnail-list">
<img ng-src="../api/file/{{ file.id }}/data?size=thumb" /> <img ng-src="../api/file/{{ file.id }}/data?size=thumb" />
</div> </div>
</td> </td>
<td class="pointer" ng-click="openFile(file)"> <td class="pointer" ng-click="openFile(file, $event)">
{{ file.name }} {{ file.name }}
<span class="fas fa-spin fa-circle-notch" <span class="fas fa-spin fa-circle-notch"
ng-show="file.processing" ng-show="file.processing"