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