Web:Client: fix context options for info panel for folders and files
This commit is contained in:
parent
492487946b
commit
ee29177bbc
@ -1,5 +1,7 @@
|
||||
const excludeRoomOptions = ["select", "separator0", "room-info"];
|
||||
const excludeGeneralOptions = ["select", "show-info"];
|
||||
const excludeRoomOptions = ["separator0", "room-info"];
|
||||
const excludeOptionsIntoRoom = ["pin-room", "unpin-room"];
|
||||
const excludeOptionsIntoFolder = ["open", "separator0", "separator1"];
|
||||
|
||||
class ContextHelper {
|
||||
constructor(props) {
|
||||
@ -16,6 +18,12 @@ class ContextHelper {
|
||||
fixItemContextOptions = () => {
|
||||
const options = this.getContextOptions(this.selection, false);
|
||||
|
||||
excludeGeneralOptions.forEach((excludeOption) => {
|
||||
const idx = options.findIndex((o) => o === excludeOption);
|
||||
|
||||
if (idx !== -1) options.splice(idx, 1);
|
||||
});
|
||||
|
||||
if (this.selection?.isRoom) {
|
||||
excludeRoomOptions.forEach((excludeOption) => {
|
||||
const idx = options.findIndex((o) => o === excludeOption);
|
||||
@ -32,6 +40,30 @@ class ContextHelper {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.selection?.isFolder) {
|
||||
if (this.selection.id === this.selectedFolderId) {
|
||||
excludeOptionsIntoFolder.forEach((excludeOption) => {
|
||||
const idx = options.findIndex((o) => o === excludeOption);
|
||||
|
||||
if (idx !== -1) options.splice(idx, 1);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const length = options.length;
|
||||
|
||||
options.forEach((item, index) => {
|
||||
if (
|
||||
(index !== length - 1 &&
|
||||
item.includes("separator") &&
|
||||
options[index + 1].includes("separator")) ||
|
||||
(index === 0 && item.includes("separator")) ||
|
||||
index === length - 1
|
||||
) {
|
||||
options.splice(index, 1);
|
||||
}
|
||||
});
|
||||
|
||||
// const showInfoIndex = options.findIndex((i) => i === "show-info");
|
||||
// const lastIndex = options.length - 1;
|
||||
// const isLastIndex = showInfoIndex === lastIndex;
|
||||
|
@ -635,7 +635,7 @@ class ContextOptionsStore {
|
||||
...versionActions,
|
||||
{
|
||||
key: "show-info",
|
||||
label: t("InfoPanel:ViewDetails"),
|
||||
label: t("Common:Info"),
|
||||
icon: "/static/images/info.outline.react.svg",
|
||||
onClick: () => this.onShowInfoPanel(item),
|
||||
disabled: false,
|
||||
|
@ -1038,10 +1038,10 @@ class FilesStore {
|
||||
"view",
|
||||
"make-form",
|
||||
"separator0",
|
||||
"sharing-settings",
|
||||
"external-link",
|
||||
// "sharing-settings",
|
||||
// "external-link",
|
||||
"owner-change",
|
||||
"link-for-portal-users",
|
||||
// "link-for-portal-users",
|
||||
"send-by-email",
|
||||
"docu-sign",
|
||||
"version", //category
|
||||
@ -1395,10 +1395,10 @@ class FilesStore {
|
||||
"select",
|
||||
"open",
|
||||
"separator0",
|
||||
"sharing-settings",
|
||||
// "sharing-settings",
|
||||
"owner-change",
|
||||
"show-info",
|
||||
"link-for-portal-users",
|
||||
// "link-for-portal-users",
|
||||
"separator1",
|
||||
"open-location",
|
||||
"download",
|
||||
|
Loading…
Reference in New Issue
Block a user