Proper text previews

Fixes #17828

* Modified the preview provider to provider smaller fonts for the
  previes (so it is not so screaming)
* Modified the sidebar to show plain text and markdown files full size.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
This commit is contained in:
Roeland Jago Douma 2020-01-14 14:21:12 +01:00 committed by npmbuildbot[bot]
parent 092a1fb90f
commit 17256781a6
4 changed files with 17 additions and 7 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -176,6 +176,7 @@ export default {
starred: this.fileInfo.isFavourited,
subtitle: this.subtitle,
title: this.fileInfo.name,
'data-mimetype': this.fileInfo.mimetype,
}
} else if (this.error) {
return {
@ -381,8 +382,17 @@ export default {
</script>
<style lang="scss" scoped>
#app-sidebar {
&.has-preview::v-deep .app-sidebar-header__figure {
background-size: cover;
&.has-preview::v-deep {
.app-sidebar-header__figure {
background-size: cover;
}
&[data-mimetype="text/plain"],
&[data-mimetype="text/markdown"] {
.app-sidebar-header__figure {
background-size: contain;
}
}
}
}
</style>

View File

@ -68,7 +68,7 @@ class TXT extends ProviderV2 {
$lines = preg_split("/\r\n|\n|\r/", $content);
// Define text size of text file preview
$fontSize = $maxX ? (int) ((2 / 32) * $maxX) : 5; //5px
$fontSize = $maxX ? (int) ((1 / 32) * $maxX) : 5; //5px
$lineSize = ceil($fontSize * 1.5);
$image = imagecreate($maxX, $maxY);