Add file preview for Markdown and text files

This commit is contained in:
Frederic Guillot
2016-02-16 22:06:53 -05:00
parent 4961805e0f
commit 9249498503
11 changed files with 109 additions and 38 deletions

View File

@@ -82,4 +82,26 @@ class File extends \Kanboard\Core\Base
return 'image/jpeg';
}
}
/**
* Get the preview type
*
* @access public
* @param string $filename
* @return string
*/
public function getPreviewType($filename)
{
$extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
switch ($extension) {
case 'md':
case 'markdown':
return 'markdown';
case 'txt':
return 'text';
}
return null;
}
}