Show plain text files on attachment page.

This commit is contained in:
Mikael Nordfeldth 2016-01-25 16:54:40 +01:00
parent a9d18a077e
commit b15434375c
2 changed files with 9 additions and 0 deletions

View File

@ -169,6 +169,8 @@ class AttachmentListItem extends Widget
default: default:
unset($thumb); // there's no need carrying this along unset($thumb); // there's no need carrying this along
switch ($this->attachment->mimetype) { switch ($this->attachment->mimetype) {
case 'text/plain':
$this->element('div', ['class'=>'e-content plaintext'], file_get_contents($this->attachment->getPath()));
case 'text/html': case 'text/html':
if (!empty($this->attachment->filename) if (!empty($this->attachment->filename)
&& (GNUsocial::isAjax() || common_config('attachments', 'show_html'))) { && (GNUsocial::isAjax() || common_config('attachments', 'show_html'))) {

View File

@ -1503,6 +1503,13 @@ font-size:150%;
font-style: normal; font-style: normal;
} }
div.e-content.plaintext {
border: dashed 1px gray;
font-family: monospace;
padding: 1em;
white-space: pre-line;
}
span.rtl { span.rtl {
display: block; display: block;
direction: rtl; direction: rtl;