Web: Files: removed someDialogIsOpen

This commit is contained in:
Nikita Gopienko 2023-06-29 12:53:05 +03:00
parent 09bc9909d4
commit e158be9e93
3 changed files with 37 additions and 49 deletions

View File

@ -40,7 +40,6 @@ const withHotkeys = (Component) => {
backToParentFolder,
uploadFile,
someDialogIsOpen,
enabledHotkeys,
mediaViewerIsVisible,
@ -70,11 +69,7 @@ const withHotkeys = (Component) => {
ev.target?.type === "checkbox" || ev.target?.tagName !== "INPUT",
filterPreventDefault: false,
enableOnTags: ["INPUT"],
enabled:
!someDialogIsOpen &&
enabledHotkeys &&
!mediaViewerIsVisible &&
!filesIsLoading,
enabled: enabledHotkeys && !mediaViewerIsVisible && !filesIsLoading,
// keyup: true,
// keydown: false,
};
@ -131,7 +126,11 @@ const withHotkeys = (Component) => {
useHotkeys(
"*",
(e) => {
if (e.shiftKey || e.ctrlKey) return;
const someDialogIsOpen = document.getElementsByClassName(
"modal-backdrop-active"
)[0];
if (e.shiftKey || e.ctrlKey || someDialogIsOpen) return;
switch (e.key) {
case "ArrowDown":
@ -400,7 +399,6 @@ const withHotkeys = (Component) => {
const {
setDeleteDialogVisible,
setSelectFileDialogVisible,
someDialogIsOpen,
setInviteUsersWarningDialogVisible,
} = dialogsStore;
const {
@ -458,7 +456,6 @@ const withHotkeys = (Component) => {
backToParentFolder,
uploadFile,
someDialogIsOpen,
enabledHotkeys,
mediaViewerIsVisible,

View File

@ -313,36 +313,6 @@ class DialogsStore {
this.changeUserTypeDialogVisible = changeUserTypeDialogVisible;
};
get someDialogIsOpen() {
return (
this.sharingPanelVisible ||
this.ownerPanelVisible ||
this.moveToPanelVisible ||
this.copyPanelVisible ||
this.deleteThirdPartyDialogVisible ||
this.connectDialogVisible ||
this.thirdPartyMoveDialogVisible ||
this.deleteDialogVisible ||
this.downloadDialogVisible ||
this.emptyTrashDialogVisible ||
this.newFilesPanelVisible ||
this.conflictResolveDialogVisible ||
this.convertDialogVisible ||
this.selectFileDialogVisible ||
this.authStore.settingsStore.hotkeyPanelVisible ||
this.versionHistoryStore.isVisible ||
this.eventDialogVisible ||
this.invitePanelOptions.visible ||
this.archiveDialogVisible ||
this.restoreRoomDialogVisible ||
this.restoreAllPanelVisible ||
this.inviteUsersWarningDialogVisible ||
this.createRoomDialogVisible ||
this.createRoomConfirmDialogVisible ||
this.changeUserTypeDialogVisible
);
}
deselectActiveFiles = () => {
this.filesStore.setSelected("none");
};

View File

@ -64,8 +64,12 @@ class HotkeyStore {
infiniteLoaderComponent.tabIndex = -1;
}
const someDialogIsOpen = document.getElementsByClassName(
"modal-backdrop-active"
)[0];
if (
this.dialogsStore.someDialogIsOpen ||
someDialogIsOpen ||
(e.target?.tagName === "INPUT" && e.target.type !== "checkbox") ||
e.target?.tagName === "TEXTAREA"
)
@ -160,8 +164,12 @@ class HotkeyStore {
};
selectFile = () => {
const { selection, setSelection, hotkeyCaret, setHotkeyCaretStart } =
this.filesStore;
const {
selection,
setSelection,
hotkeyCaret,
setHotkeyCaretStart,
} = this.filesStore;
const index = selection.findIndex(
(f) => f.id === hotkeyCaret?.id && f.isFolder === hotkeyCaret?.isFolder
@ -202,8 +210,13 @@ class HotkeyStore {
};
selectLeft = () => {
const { hotkeyCaret, filesList, setHotkeyCaretStart, selection, viewAs } =
this.filesStore;
const {
hotkeyCaret,
filesList,
setHotkeyCaretStart,
selection,
viewAs,
} = this.filesStore;
if (viewAs !== "tile") return;
if (!hotkeyCaret && !selection.length) {
@ -216,8 +229,13 @@ class HotkeyStore {
};
selectRight = () => {
const { hotkeyCaret, filesList, setHotkeyCaretStart, selection, viewAs } =
this.filesStore;
const {
hotkeyCaret,
filesList,
setHotkeyCaretStart,
selection,
viewAs,
} = this.filesStore;
if (viewAs !== "tile") return;
if (!hotkeyCaret && !selection.length) {
@ -468,13 +486,16 @@ class HotkeyStore {
openItem = () => {
const { selection } = this.filesStore;
selection.length === 1 &&
!this.dialogsStore.someDialogIsOpen &&
this.filesActionsStore.openFileAction(selection[0]);
};
selectAll = () => {
const { filesList, hotkeyCaret, setHotkeyCaretStart, setSelected } =
this.filesStore;
const {
filesList,
hotkeyCaret,
setHotkeyCaretStart,
setSelected,
} = this.filesStore;
setSelected("all");
if (!hotkeyCaret) {