Fix bug 51698: .svg files not open in MediaViewer

This commit is contained in:
Alexey Safronov 2021-08-09 15:04:13 +03:00
parent 968be4a529
commit d770fe58fe
4 changed files with 53 additions and 30 deletions

View File

@ -168,9 +168,7 @@ export default function withFileActions(WrappedFileItem) {
parentFolder,
setIsLoading,
fetchFiles,
isImage,
isSound,
isVideo,
isMediaOrImage,
canConvert,
canWebEdit,
canViewedDocs,
@ -243,7 +241,7 @@ export default function withFileActions(WrappedFileItem) {
return openDocEditor(id, providerKey, tab);
}
if (isImage || isSound || isVideo) {
if (isMediaOrImage) {
setMediaViewerData({ visible: true, id });
return;
}
@ -399,9 +397,10 @@ export default function withFileActions(WrappedFileItem) {
? false
: true;
const isImage = iconFormatsStore.isImage(item.fileExst);
const isSound = iconFormatsStore.isSound(item.fileExst);
const isVideo = mediaViewersFormatsStore.isVideo(item.fileExst);
const isMediaOrImage = mediaViewersFormatsStore.isMediaOrImage(
item.fileExst
);
const canWebEdit = docserviceStore.canWebEdit(item.fileExst);
const canConvert = docserviceStore.canConvert(item.fileExst);
const canViewedDocs = docserviceStore.canViewedDocs(item.fileExst);
@ -431,9 +430,7 @@ export default function withFileActions(WrappedFileItem) {
parentFolder: selectedFolderStore.parentId,
setIsLoading,
fetchFiles,
isImage,
isSound,
isVideo,
isMediaOrImage,
canWebEdit,
canViewedDocs,
canConvert,

View File

@ -73,7 +73,7 @@ const FilesMediaViewer = (props) => {
const onDownloadMediaFile = (id) => {
if (files.length > 0) {
let viewUrlFile = files.find((file) => file.id === id).viewUrl;
return window.open(viewUrlFile, "_blank");
return window.open(viewUrlFile, "_self");
}
};

View File

@ -3,8 +3,6 @@ import { presentInArray } from "../helpers/files-helpers";
class IconFormatsStore {
archive = [
".zip",
".rar",
".ace",
".arc",
".arj",
@ -12,42 +10,46 @@ class IconFormatsStore {
".cab",
".enc",
".gz",
".gz",
".ha",
".jar",
".lha",
".lzh",
".pak",
".pk3",
".rar",
".tar",
".tgz",
".gz",
".uu",
".uue",
".xxe",
".z",
".zip",
".zoo",
];
image = [
".ai",
".bmp",
".cmx",
".cod",
".gif",
".ico",
".ief",
".jpe",
".jpeg",
".jpg",
".tif",
".cmx",
".ico",
".pnm",
".pbm",
".png",
".pnm",
".ppm",
".psd",
".rgb",
".tif",
".tiff",
".webp",
".xbm",
".xpm",
".xwd",
".png",
".ai",
".jpeg",
];
sound = [
".aac",

View File

@ -3,33 +3,57 @@ import { presentInArray } from "../helpers/files-helpers";
class MediaViewersFormatsStore {
images = [
".ai",
".bmp",
".cmx",
".cod",
".gif",
".ico",
".ief",
".jpe",
".jpeg",
".jpg",
".pbm",
".png",
".ico",
".pnm",
".psd",
".rgb",
".svg",
".tif",
".tiff",
".webp",
".xbm",
".xwd",
];
media = [
".aac",
".ac3",
".aiff",
".amr",
".ape",
".avi",
".cda",
".f4v",
".flac",
".m4a",
".m4v",
".mid",
".mka",
".mov",
".mp3",
".mp4",
".mpc",
".mpeg",
".mpg",
".oga",
".ogg",
".wav",
".f4v",
".m4v",
".mov",
".mp4",
".ogv",
".pcm",
".ra",
".raw",
".wav",
".webm",
".avi",
".mpg",
".mpeg",
".wma",
".wmv",
];