Force reload BinaryFile view when a new object is selected.

This commit is contained in:
Shane Kilkelly 2016-05-20 11:20:00 +01:00
parent 2e2354c574
commit 939c7a8c72
2 changed files with 14 additions and 10 deletions

View file

@ -9,4 +9,12 @@ define [
openFile: (file) -> openFile: (file) ->
@$scope.ui.view = "file" @$scope.ui.view = "file"
@$scope.openFile = file @$scope.openFile = null
@$scope.$apply()
window.setTimeout(
() =>
@$scope.openFile = file
@$scope.$apply()
, 0
, this
)

View file

@ -13,15 +13,6 @@ define [
$scope.failedLoad = false $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 = () => window.sl_binaryFilePreviewError = () =>
$scope.failedLoad = true $scope.failedLoad = true
$scope.$apply() $scope.$apply()
@ -61,6 +52,11 @@ define [
table_wrap.style.height = desired_height + 'px' table_wrap.style.height = desired_height + 'px'
table_wrap.style['max-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() $scope.loadBibtexIfRequired()
] ]