Web: Files: fixed group context menu

This commit is contained in:
Nikita Gopienko 2022-06-01 18:15:52 +03:00
parent 19d9a258b9
commit 146891713d
5 changed files with 8 additions and 7 deletions

View File

@ -70,7 +70,7 @@ class Row extends React.Component {
};
const onContextMenu = (e) => {
rowContextClick && rowContextClick();
rowContextClick && rowContextClick(e.button === 2);
if (!this.cm.current.menuRef.current) {
this.row.current.click(e); //TODO: need fix context menu to global
}

View File

@ -23,7 +23,7 @@ const TableRow = (props) => {
const row = useRef();
const onContextMenu = (e) => {
fileContextClick && fileContextClick();
fileContextClick && fileContextClick(e.button === 2);
if (cm.current && !cm.current.menuRef.current) {
row.current.click(e);
}

View File

@ -21,11 +21,12 @@ export default function withFileActions(WrappedFileItem) {
id !== -1 && onSelectItem({ id, isFolder });
};
onFileContextClick = () => {
onFileContextClick = (isSingleFile) => {
const { onSelectItem } = this.props;
const { id, isFolder } = this.props.item;
id !== -1 && onSelectItem({ id, isFolder } /* , true */);
id !== -1 &&
onSelectItem({ id, isFolder }, false, !isSingleFile || isMobile);
};
onHideContextMenu = () => {

View File

@ -427,7 +427,7 @@ class Tile extends React.PureComponent {
};
const onContextMenu = (e) => {
tileContextClick && tileContextClick();
tileContextClick && tileContextClick(e.button === 2);
if (!this.cm.current.menuRef.current) {
this.tile.current.click(e); //TODO: need fix context menu to global
}

View File

@ -471,7 +471,7 @@ class FilesActionStore {
}
};
onSelectItem = ({ id, isFolder }, isBuffer = false) => {
onSelectItem = ({ id, isFolder }, isBuffer = false, isSingleFile) => {
const {
setBufferSelection,
selected,
@ -500,7 +500,7 @@ class FilesActionStore {
(f) => f.id === id && f.isFolder === isFolder
);
if (isSelected === -1) {
if (isSelected === -1 || isSingleFile) {
setSelected("none");
setSelection([item]);
}