This commit is contained in:
2020-04-24 14:05:43 +00:00
parent f35754632c
commit 4c8799ec4d
4 changed files with 62 additions and 21 deletions

View File

@@ -263,14 +263,22 @@ export default {
/////////////////////////////
// Attachment download URL
//
downloadUrl(fileId) {
downloadUrl(fileId, ctype) {
//http://localhost:7575/api/v8/Attachment/download/100?t=sssss
return this.APIUrl(
//Ctype is optional and is the MIME content type, used to detect image urls at client for drag and drop ops
//in wiki but ignored by server
let url =
"Attachment/download/" +
fileId +
"?t=" +
window.$gz.store.state.downloadToken
);
fileId +
"?t=" +
window.$gz.store.state.downloadToken;
if (ctype && ctype.includes("image")) {
url += "&i=1";
}
return this.APIUrl(url);
},
/////////////////////////////
// REPLACE END OF URL

View File

@@ -267,6 +267,9 @@ export default {
// @return {string} A new string with the spliced substring.
stringSplice: function(source, start, delCount, newSubStr) {
if (source == null || source == "") {
if (newSubStr) {
return newSubStr;
}
return "";
}
return (
@@ -339,6 +342,10 @@ export default {
);
return "fa-file";
}
if (!mimeType) {
mimeType = "";
}
mimeType = mimeType.toLowerCase();
let iconFromExtension = extensions[extension];
@@ -355,6 +362,15 @@ export default {
// "gzutil:iconForFile -> No icon for file:" + fileName + " Mime:" + mimeType
// );
return "fa-file";
},
///////////////////////////////////////////////
// attempt to detect image extension name
//
isImageURI: function(uri) {
if (!uri) {
return false;
}
return this.iconForFile(uri, "") == "fa-file-image";
}
/**