Skip to content

Commit

Permalink
Show scrollbar in txt preview
Browse files Browse the repository at this point in the history
  • Loading branch information
milanmajchrak committed Sep 29, 2023
1 parent 32190b5 commit 70f0120
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,16 @@
<i class="fa fa-remove">&nbsp;</i>
</a>
</div>
<div style="max-height: 500px; overflow: hidden; padding: 0px;" class="panel-body">
<div [style]="'max-height: 500px; padding: 0px; ' + dynamicOverflow()" class="
panel-body">
<ul class="treeview in collapse show">
<ng-container *ngIf="fileInput.format === 'application/zip'">
<ds-file-tree-view
*ngFor="let node of fileInput.fileInfo"
[node]="node"
></ds-file-tree-view>
</ng-container>
<ng-container *ngIf="fileInput.format === 'text/plain'">
<ng-container *ngIf="isTxt()">
<pre>{{ fileInput.fileInfo[0].content }}</pre>
</ng-container>
<ng-container *ngIf="fileInput.format === 'text/html'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,15 @@ export class FileDescriptionComponent implements OnInit {
public downloadFiles() {
window.location.href = `${BASE_LOCAL_URL}${this.fileInput.href}`;
}

public isTxt() {
return this.fileInput?.format === 'text/plain';
}

/**
* Show scrollbar in the `.txt` preview, but it should be hidden in the other formats.
*/
public dynamicOverflow() {
return this.isTxt() ? 'overflow: scroll' : 'overflow: hidden';
}
}

0 comments on commit 70f0120

Please sign in to comment.