mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-23 01:23:59 +00:00
Toggle the dots at the end of bib preview, based on size of payload.
This commit is contained in:
parent
0ea16f0bcc
commit
9a6876d237
2 changed files with 6 additions and 1 deletions
|
@ -28,7 +28,7 @@ div.binary-file.full-size(
|
|||
div.scroll-container
|
||||
p
|
||||
| {{ bibtexPreview.data }}
|
||||
p
|
||||
p(ng-show="bibtexPreview.shouldShowDots")
|
||||
| ...
|
||||
|
||||
p.no-preview(
|
||||
|
|
|
@ -7,6 +7,7 @@ define [
|
|||
|
||||
$scope.bibtexPreview =
|
||||
loading: false
|
||||
shouldShowDots: false
|
||||
error: false
|
||||
data: null
|
||||
|
||||
|
@ -31,11 +32,15 @@ define [
|
|||
$scope.loadBibtexFilePreview = () ->
|
||||
url = "/project/#{project_id}/file/#{$scope.openFile.id}?range=0-#{TWO_MEGABYTES}"
|
||||
$scope.bibtexPreview.loading = true
|
||||
$scope.bibtexPreview.shouldShowDots = false
|
||||
$scope.$apply()
|
||||
$http.get(url)
|
||||
.success (data) ->
|
||||
$scope.bibtexPreview.loading = false
|
||||
$scope.bibtexPreview.error = false
|
||||
# show dots when payload is closs to cutoff
|
||||
if data.length >= (TWO_MEGABYTES - 200)
|
||||
$scope.bibtexPreview.shouldShowDots = true
|
||||
try
|
||||
# remove last partial line
|
||||
data = data.replace(/\n.*$/, '')
|
||||
|
|
Loading…
Reference in a new issue