summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorYusuke Nemoto <kaakaa@users.noreply.github.com>2017-04-13 06:26:02 +0900
committerCorey Hulen <corey@hulen.com>2017-04-12 14:26:02 -0700
commit0aa84799fd41cf7c94dc4901095b0ee9f4c511b3 (patch)
treee498cba7f17e585f97f5e27c8a8e4181c3b35b34 /webapp
parent9b9788cf110b57a080d4a4dae43c7deff0274710 (diff)
downloadchat-0aa84799fd41cf7c94dc4901095b0ee9f4c511b3.tar.gz
chat-0aa84799fd41cf7c94dc4901095b0ee9f4c511b3.tar.bz2
chat-0aa84799fd41cf7c94dc4901095b0ee9f4c511b3.zip
svg preview (#6045)
Diffstat (limited to 'webapp')
-rw-r--r--webapp/components/file_preview.jsx2
-rw-r--r--webapp/components/view_image.jsx2
-rw-r--r--webapp/utils/constants.jsx1
-rw-r--r--webapp/utils/utils.jsx6
4 files changed, 8 insertions, 3 deletions
diff --git a/webapp/components/file_preview.jsx b/webapp/components/file_preview.jsx
index afdb701e0..1e747b372 100644
--- a/webapp/components/file_preview.jsx
+++ b/webapp/components/file_preview.jsx
@@ -33,7 +33,7 @@ export default class FilePreview extends React.Component {
let className = 'file-preview';
let previewImage;
- if (type === 'image') {
+ if (type === 'image' || type === 'svg') {
previewImage = (
<img
className='file-preview__image'
diff --git a/webapp/components/view_image.jsx b/webapp/components/view_image.jsx
index 4447e9966..580c9e7a4 100644
--- a/webapp/components/view_image.jsx
+++ b/webapp/components/view_image.jsx
@@ -180,7 +180,7 @@ export default class ViewImageModal extends React.Component {
if (this.state.loaded[this.state.imgId]) {
const fileType = Utils.getFileType(fileInfo.extension);
- if (fileType === 'image') {
+ if (fileType === 'image' || fileType === 'svg') {
content = (
<ImagePreview
fileInfo={fileInfo}
diff --git a/webapp/utils/constants.jsx b/webapp/utils/constants.jsx
index c32731a0d..d1bc73228 100644
--- a/webapp/utils/constants.jsx
+++ b/webapp/utils/constants.jsx
@@ -335,6 +335,7 @@ export const Constants = {
CODE_TYPES: ['as', 'applescript', 'osascript', 'scpt', 'bash', 'sh', 'zsh', 'clj', 'boot', 'cl2', 'cljc', 'cljs', 'cljs.hl', 'cljscm', 'cljx', 'hic', 'coffee', '_coffee', 'cake', 'cjsx', 'cson', 'iced', 'cpp', 'c', 'cc', 'h', 'c++', 'h++', 'hpp', 'cs', 'csharp', 'css', 'd', 'di', 'dart', 'delphi', 'dpr', 'dfm', 'pas', 'pascal', 'freepascal', 'lazarus', 'lpr', 'lfm', 'diff', 'django', 'jinja', 'dockerfile', 'docker', 'erl', 'f90', 'f95', 'fsharp', 'fs', 'gcode', 'nc', 'go', 'groovy', 'handlebars', 'hbs', 'html.hbs', 'html.handlebars', 'hs', 'hx', 'java', 'jsp', 'js', 'jsx', 'json', 'jl', 'kt', 'ktm', 'kts', 'less', 'lisp', 'lua', 'mk', 'mak', 'md', 'mkdown', 'mkd', 'matlab', 'm', 'mm', 'objc', 'obj-c', 'ml', 'perl', 'pl', 'php', 'php3', 'php4', 'php5', 'php6', 'ps', 'ps1', 'pp', 'py', 'gyp', 'r', 'ruby', 'rb', 'gemspec', 'podspec', 'thor', 'irb', 'rs', 'scala', 'scm', 'sld', 'scss', 'st', 'sql', 'swift', 'tex', 'txt', 'vbnet', 'vb', 'bas', 'vbs', 'v', 'veo', 'xml', 'html', 'xhtml', 'rss', 'atom', 'xsl', 'plist', 'yaml'],
PDF_TYPES: ['pdf'],
PATCH_TYPES: ['patch'],
+ SVG_TYPES: ['svg'],
ICON_FROM_TYPE: {
audio: audioIcon,
video: videoIcon,
diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx
index ceb2958b5..f707e2b28 100644
--- a/webapp/utils/utils.jsx
+++ b/webapp/utils/utils.jsx
@@ -426,6 +426,10 @@ export function getFileType(extin) {
return 'patch';
}
+ if (Constants.SVG_TYPES.indexOf(ext) > -1) {
+ return 'svg';
+ }
+
return 'other';
}
@@ -449,7 +453,7 @@ export function getIconClassName(fileTypeIn) {
return Constants.ICON_NAME_FROM_TYPE[fileType];
}
- return 'glyphicon-file';
+ return 'generic';
}
export function splitFileLocation(fileLocation) {