Web: Files: fixed hotkey bugs
This commit is contained in:
parent
d2cd7dbeaf
commit
fca8a6ddec
@ -30,8 +30,6 @@ const withHotkeys = (Component) => {
|
||||
selectAll,
|
||||
} = props;
|
||||
|
||||
console.log("props", props.sectionWidth);
|
||||
|
||||
const hotkeysFilter = {
|
||||
filter: (ev) =>
|
||||
ev.target?.type === "checkbox" || ev.target?.tagName !== "INPUT",
|
||||
|
@ -201,6 +201,27 @@ class DialogsStore {
|
||||
setHotkeyPanelVisible = (hotkeyPanelVisible) => {
|
||||
this.hotkeyPanelVisible = hotkeyPanelVisible;
|
||||
};
|
||||
|
||||
get someDialogIsOpen() {
|
||||
return (
|
||||
this.sharingPanelVisible ||
|
||||
this.ownerPanelVisible ||
|
||||
this.moveToPanelVisible ||
|
||||
this.copyPanelVisible ||
|
||||
this.deleteThirdPartyDialogVisible ||
|
||||
this.connectDialogVisible ||
|
||||
this.thirdPartyMoveDialogVisible ||
|
||||
this.deleteDialogVisible ||
|
||||
this.downloadDialogVisible ||
|
||||
this.emptyTrashDialogVisible ||
|
||||
this.thirdPartyDialogVisible ||
|
||||
this.newFilesPanelVisible ||
|
||||
this.conflictResolveDialogVisible ||
|
||||
this.convertDialogVisible ||
|
||||
this.selectFileDialogVisible ||
|
||||
this.hotkeyPanelVisible
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default DialogsStore;
|
||||
|
@ -1,21 +1,14 @@
|
||||
import { isDesktop } from "@appserver/components/utils/device";
|
||||
import { makeAutoObservable } from "mobx";
|
||||
|
||||
class HotkeyStore {
|
||||
authStore;
|
||||
filesStore;
|
||||
dialogsStore;
|
||||
settingsStore;
|
||||
filesActionsStore;
|
||||
|
||||
constructor(
|
||||
authStore,
|
||||
filesStore,
|
||||
dialogsStore,
|
||||
settingsStore,
|
||||
filesActionsStore
|
||||
) {
|
||||
constructor(filesStore, dialogsStore, settingsStore, filesActionsStore) {
|
||||
makeAutoObservable(this);
|
||||
this.authStore = authStore;
|
||||
this.filesStore = filesStore;
|
||||
this.dialogsStore = dialogsStore;
|
||||
this.settingsStore = settingsStore;
|
||||
@ -307,6 +300,7 @@ class HotkeyStore {
|
||||
openItem = () => {
|
||||
const { selection } = this.filesStore;
|
||||
selection.length === 1 &&
|
||||
!this.dialogsStore.someDialogIsOpen &&
|
||||
this.filesActionsStore.openFileAction(selection[0]);
|
||||
};
|
||||
|
||||
@ -327,17 +321,14 @@ class HotkeyStore {
|
||||
};
|
||||
|
||||
get countTilesInRow() {
|
||||
const { isArticlePinned } = this.authStore.settingsStore;
|
||||
const sectionPadding = isArticlePinned ? 24 : 16;
|
||||
const isDesktopView = isDesktop();
|
||||
const tileGap = isDesktopView ? 16 : 12;
|
||||
const minTileWidth = 220 + tileGap;
|
||||
const sectionPadding = isDesktopView ? 24 : 18;
|
||||
|
||||
const body = document.getElementById("section");
|
||||
const sectionWidth = body ? body.offsetWidth - sectionPadding : 0;
|
||||
|
||||
const minTileWidth = isArticlePinned ? 220 + 10 : 220 + 18;
|
||||
|
||||
console.log("sectionWidth", sectionWidth);
|
||||
console.log("countTilesInRow", sectionWidth / minTileWidth);
|
||||
|
||||
return Math.floor(sectionWidth / minTileWidth);
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,6 @@ const filesActionsStore = new FilesActionsStore(
|
||||
const versionHistoryStore = new VersionHistoryStore(filesStore);
|
||||
|
||||
const hotkeyStore = new HotkeyStore(
|
||||
store.auth,
|
||||
filesStore,
|
||||
dialogsStore,
|
||||
settingsStore,
|
||||
|
Loading…
Reference in New Issue
Block a user