From 9ea1dad62d6286a4df9d2bf2d743521bfa2b8db3 Mon Sep 17 00:00:00 2001 From: Benjamin Gamard Date: Fri, 3 May 2019 13:19:21 +0200 Subject: [PATCH] Closes #296: firefox hack to prevent file open on drag & drop --- .../controller/document/DocumentViewContent.js | 14 ++++++++++++-- .../src/partial/docs/document.view.content.html | 6 +++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentViewContent.js b/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentViewContent.js index fcbfd0bd..c943e3ad 100644 --- a/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentViewContent.js +++ b/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentViewContent.js @@ -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}) + } }; /** diff --git a/docs-web/src/main/webapp/src/partial/docs/document.view.content.html b/docs-web/src/main/webapp/src/partial/docs/document.view.content.html index d91e5795..d04301b0 100644 --- a/docs-web/src/main/webapp/src/partial/docs/document.view.content.html +++ b/docs-web/src/main/webapp/src/partial/docs/document.view.content.html @@ -70,7 +70,7 @@ - + @@ -148,12 +148,12 @@ - +
- + {{ file.name }}