overleaf/services/web/public/coffee/ide/binary-files/controllers/BinaryFileController.coffee

16 lines
396 B
CoffeeScript

define [
"base"
], (App) ->
App.controller "BinaryFileController", ["$scope", "$rootScope", ($scope, $rootScope) ->
$scope.failedLoad = false
$rootScope.$on 'entity:selected', () ->
$scope.failedLoad = false
window.sl_binaryFilePreviewError = () =>
$scope.failedLoad = true
$scope.$apply()
$scope.extension = (file) ->
return file.name.split(".").pop()?.toLowerCase()
]