mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 07:27:04 +00:00
Feature/onlyoffice converter (#4937)
* onlyoffice-converter: initial setup * onlyoffice-converter: hardcoded converter * onlyoffice-converter: converter v0.1 * onlyoffice-converter: config tweaks * onlyoffice-connector: jwt typo fix * format * onlyoffice-converter: async fix * onlyoffice-converter: jwt fix Co-authored-by: Dmitrii Vershinin <dmitry.vershinin@onlyoffice.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { mediaUrl, gettext, serviceURL, siteRoot, isPro, enableFileComment, fileAuditEnabled, canGenerateShareLink, canGenerateUploadLink, shareLinkPasswordMinLength, username, folderPermEnabled } from './constants';
|
||||
import { mediaUrl, gettext, serviceURL, siteRoot, isPro, enableFileComment, fileAuditEnabled, canGenerateShareLink, canGenerateUploadLink, shareLinkPasswordMinLength, username, folderPermEnabled, onlyofficeConverterExtensions, enableOnlyoffice } from './constants';
|
||||
import { strChineseFirstPY } from './pinyin-by-unicode';
|
||||
import TextTranslation from './text-translation';
|
||||
import React from 'react';
|
||||
@@ -523,7 +523,7 @@ export const Utils = {
|
||||
getFileOperationList: function(isRepoOwner, currentRepoInfo, dirent, isContextmenu) {
|
||||
let list = [];
|
||||
const { SHARE, DOWNLOAD, DELETE, RENAME, MOVE, COPY, TAGS, UNLOCK, LOCK,
|
||||
COMMENT, HISTORY, ACCESS_LOG, OPEN_VIA_CLIENT } = TextTranslation;
|
||||
COMMENT, HISTORY, ACCESS_LOG, OPEN_VIA_CLIENT, ONLYOFFICE_CONVERT } = TextTranslation;
|
||||
const permission = dirent.permission;
|
||||
const { isCustomPermission, customPermission } = Utils.getUserPermission(permission);
|
||||
|
||||
@@ -610,14 +610,24 @@ export const Utils = {
|
||||
list.push(HISTORY);
|
||||
}
|
||||
|
||||
if (permission == 'rw' && enableOnlyoffice &&
|
||||
onlyofficeConverterExtensions.includes(this.getFileExtension(dirent.name, false))) {
|
||||
list.push(ONLYOFFICE_CONVERT);
|
||||
}
|
||||
|
||||
// if the last item of menuList is ‘Divider’, delete the last item
|
||||
if (list[list.length - 1] === 'Divider') {
|
||||
list.pop();
|
||||
}
|
||||
|
||||
return list;
|
||||
},
|
||||
|
||||
getFileExtension: function (fileName, withoutDot) {
|
||||
let parts = fileName.toLowerCase().split(".");
|
||||
|
||||
return withoutDot ? parts.pop() : "." + parts.pop();
|
||||
},
|
||||
|
||||
getDirentOperationList: function(isRepoOwner, currentRepoInfo, dirent, isContextmenu) {
|
||||
return dirent.type == 'dir' ?
|
||||
Utils.getFolderOperationList(isRepoOwner, currentRepoInfo, dirent, isContextmenu) :
|
||||
|
Reference in New Issue
Block a user