From 939c7a8c720344b88af2332b04ca3f519e4f122a Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 20 May 2016 11:20:00 +0100 Subject: [PATCH] Force reload BinaryFile view when a new object is selected. --- .../ide/binary-files/BinaryFilesManager.coffee | 10 +++++++++- .../controllers/BinaryFileController.coffee | 14 +++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/services/web/public/coffee/ide/binary-files/BinaryFilesManager.coffee b/services/web/public/coffee/ide/binary-files/BinaryFilesManager.coffee index 9b80c0e0dc..02283bc49e 100644 --- a/services/web/public/coffee/ide/binary-files/BinaryFilesManager.coffee +++ b/services/web/public/coffee/ide/binary-files/BinaryFilesManager.coffee @@ -9,4 +9,12 @@ define [ openFile: (file) -> @$scope.ui.view = "file" - @$scope.openFile = file \ No newline at end of file + @$scope.openFile = null + @$scope.$apply() + window.setTimeout( + () => + @$scope.openFile = file + @$scope.$apply() + , 0 + , this + ) diff --git a/services/web/public/coffee/ide/binary-files/controllers/BinaryFileController.coffee b/services/web/public/coffee/ide/binary-files/controllers/BinaryFileController.coffee index ef1fb77389..7dceeff965 100644 --- a/services/web/public/coffee/ide/binary-files/controllers/BinaryFileController.coffee +++ b/services/web/public/coffee/ide/binary-files/controllers/BinaryFileController.coffee @@ -13,15 +13,6 @@ define [ $scope.failedLoad = false - $rootScope.$on 'entity:selected', () -> - $scope.failedLoad = false - $scope.loadBibtexIfRequired() - - $scope.loadBibtexIfRequired = () -> - if $scope.extension($scope.openFile) == 'bib' - $scope.bibtexPreview.data = null - $scope.loadBibtexFilePreview() - window.sl_binaryFilePreviewError = () => $scope.failedLoad = true $scope.$apply() @@ -61,6 +52,11 @@ define [ table_wrap.style.height = desired_height + 'px' table_wrap.style['max-height'] = desired_height + 'px' + $scope.loadBibtexIfRequired = () -> + if $scope.extension($scope.openFile) == 'bib' + $scope.bibtexPreview.data = null + $scope.loadBibtexFilePreview() + $scope.loadBibtexIfRequired() ]