Web: Files: click events fix
This commit is contained in:
parent
a12c6ec52e
commit
d90df23ad1
@ -140,7 +140,6 @@ const FileItem = createSelectable((props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onMouseDown = (e) => {
|
const onMouseDown = (e) => {
|
||||||
console.log(e.target, e.currentTarget);
|
|
||||||
if (!draggable) {
|
if (!draggable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -161,7 +160,6 @@ const FileItem = createSelectable((props) => {
|
|||||||
: false;
|
: false;
|
||||||
const label = e.currentTarget.getAttribute("label");
|
const label = e.currentTarget.getAttribute("label");
|
||||||
if (mouseButton || e.currentTarget.tagName !== "DIV" || label) {
|
if (mouseButton || e.currentTarget.tagName !== "DIV" || label) {
|
||||||
console.log("here");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,8 +170,6 @@ const FileItem = createSelectable((props) => {
|
|||||||
const onFilesClick = () => {
|
const onFilesClick = () => {
|
||||||
if (isRecycleBin) return;
|
if (isRecycleBin) return;
|
||||||
|
|
||||||
fileContextClick();
|
|
||||||
|
|
||||||
if (!fileExst && !contentLength) {
|
if (!fileExst && !contentLength) {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
@ -201,6 +197,26 @@ const FileItem = createSelectable((props) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onClickHandler = (e) => {
|
||||||
|
if (
|
||||||
|
e.target.closest(".checkbox") ||
|
||||||
|
e.target.tagName === "INPUT" ||
|
||||||
|
e.target.closest(".expandButton") ||
|
||||||
|
e.button !== 0 ||
|
||||||
|
startDrag
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (isFolder && viewAs === "tile") onFilesClick();
|
||||||
|
else {
|
||||||
|
if (checked) {
|
||||||
|
onContentFileSelect(!checked, item);
|
||||||
|
} else {
|
||||||
|
fileContextClick && fileContextClick(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let value = fileExst || contentLength ? `file_${id}` : `folder_${id}`;
|
let value = fileExst || contentLength ? `file_${id}` : `folder_${id}`;
|
||||||
value += draggable ? "_draggable" : "";
|
value += draggable ? "_draggable" : "";
|
||||||
|
|
||||||
@ -223,8 +239,8 @@ const FileItem = createSelectable((props) => {
|
|||||||
const isDragging = isFolder && access < 2 && !isRecycleBin;
|
const isDragging = isFolder && access < 2 && !isRecycleBin;
|
||||||
|
|
||||||
let className = isDragging ? " droppable" : "";
|
let className = isDragging ? " droppable" : "";
|
||||||
//if (draggable) className += " draggable not-selectable";
|
if (draggable) className += " draggable not-selectable";
|
||||||
if (draggable) className += `${startDrag ? " not-selectable " : ""}`;
|
//if (draggable) className += `${startDrag ? " not-selectable " : ""}`;
|
||||||
|
|
||||||
const sharedButton =
|
const sharedButton =
|
||||||
!canShare || (isPrivacy && !fileExst) || isEdit || id <= 0 || isMobile
|
!canShare || (isPrivacy && !fileExst) || isEdit || id <= 0 || isMobile
|
||||||
@ -256,7 +272,9 @@ const FileItem = createSelectable((props) => {
|
|||||||
{...contextOptionsProps}
|
{...contextOptionsProps}
|
||||||
temporaryIcon={temporaryIcon}
|
temporaryIcon={temporaryIcon}
|
||||||
isPrivacy={isPrivacy}
|
isPrivacy={isPrivacy}
|
||||||
|
thumbnailClick={onFilesClick}
|
||||||
onDoubleClick={onFilesClick}
|
onDoubleClick={onFilesClick}
|
||||||
|
onMouseUp={onClickHandler}
|
||||||
>
|
>
|
||||||
<FilesContent
|
<FilesContent
|
||||||
item={item}
|
item={item}
|
||||||
@ -279,6 +297,7 @@ const FileItem = createSelectable((props) => {
|
|||||||
{...contextOptionsProps}
|
{...contextOptionsProps}
|
||||||
contextButtonSpacerWidth={displayShareButton}
|
contextButtonSpacerWidth={displayShareButton}
|
||||||
onDoubleClick={onFilesClick}
|
onDoubleClick={onFilesClick}
|
||||||
|
onMouseUp={onClickHandler}
|
||||||
>
|
>
|
||||||
<FilesContent
|
<FilesContent
|
||||||
item={item}
|
item={item}
|
||||||
|
@ -27,7 +27,7 @@ const FolderStyles = css`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
const StyledTile = styled.div`
|
const StyledTile = styled.div`
|
||||||
cursor: default;
|
cursor: ${(props) => (props.isFolder ? "pointer" : "default")};
|
||||||
|
|
||||||
min-height: 55px;
|
min-height: 55px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -164,30 +164,19 @@ class Tile extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getIconFile = () => {
|
getIconFile = () => {
|
||||||
const { item, temporaryIcon, onDoubleClick } = this.props;
|
const { item, temporaryIcon, thumbnailClick } = this.props;
|
||||||
|
|
||||||
const icon = item.thumbnail ? item.thumbnail : temporaryIcon;
|
const icon = item.thumbnail ? item.thumbnail : temporaryIcon;
|
||||||
let className = "thumbnailImage";
|
let className = "thumbnailImage";
|
||||||
if (!item.thumbnail) className += " temporary-icon";
|
if (!item.thumbnail) className += " temporary-icon";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link type="page" onClick={onDoubleClick}>
|
<Link type="page" onClick={thumbnailClick}>
|
||||||
<ReactSVG className={className} src={icon} loading={svgLoader} />
|
<ReactSVG className={className} src={icon} loading={svgLoader} />
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
onClickHandler = (e) => {
|
|
||||||
const { onSelect, item, checked } = this.props;
|
|
||||||
console.log(
|
|
||||||
e.target.closest(".thumbnailImage"),
|
|
||||||
e.target.closest(".checkbox")
|
|
||||||
);
|
|
||||||
if (e.target.closest(".checkbox") || e.target.tagName === "INPUT") return;
|
|
||||||
|
|
||||||
onSelect && onSelect(!checked, item);
|
|
||||||
};
|
|
||||||
|
|
||||||
changeCheckbox = (e) => {
|
changeCheckbox = (e) => {
|
||||||
const { onSelect, item } = this.props;
|
const { onSelect, item } = this.props;
|
||||||
onSelect && onSelect(e.target.checked, item);
|
onSelect && onSelect(e.target.checked, item);
|
||||||
@ -205,7 +194,6 @@ class Tile extends React.Component {
|
|||||||
isFolder,
|
isFolder,
|
||||||
tileContextClick,
|
tileContextClick,
|
||||||
dragging,
|
dragging,
|
||||||
onDoubleClick,
|
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const renderCheckbox = Object.prototype.hasOwnProperty.call(
|
const renderCheckbox = Object.prototype.hasOwnProperty.call(
|
||||||
@ -236,15 +224,13 @@ class Tile extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const icon = this.getIconFile();
|
const icon = this.getIconFile();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledTile
|
<StyledTile
|
||||||
ref={this.tile}
|
ref={this.tile}
|
||||||
{...this.props}
|
{...this.props}
|
||||||
onContextMenu={onContextMenu}
|
onContextMenu={onContextMenu}
|
||||||
dragging={dragging && isFolder}
|
dragging={dragging && isFolder}
|
||||||
onClick={this.onClickHandler}
|
isFolder={isFolder}
|
||||||
onDoubleClick={onDoubleClick}
|
|
||||||
>
|
>
|
||||||
{isFolder ? (
|
{isFolder ? (
|
||||||
<>
|
<>
|
||||||
|
@ -53,7 +53,6 @@ const SectionBodyContent = (props) => {
|
|||||||
}, [onMouseUp, onMouseMove, startDrag, folderId]);
|
}, [onMouseUp, onMouseMove, startDrag, folderId]);
|
||||||
|
|
||||||
const onMouseMove = (e) => {
|
const onMouseMove = (e) => {
|
||||||
console.log(e.target);
|
|
||||||
if (!dragging) {
|
if (!dragging) {
|
||||||
document.body.classList.add("drag-cursor");
|
document.body.classList.add("drag-cursor");
|
||||||
setDragging(true);
|
setDragging(true);
|
||||||
@ -66,7 +65,6 @@ const SectionBodyContent = (props) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const droppable = wrapperElement.closest(".droppable");
|
const droppable = wrapperElement.closest(".droppable");
|
||||||
console.log(droppable);
|
|
||||||
if (currentDroppable !== droppable) {
|
if (currentDroppable !== droppable) {
|
||||||
if (currentDroppable) {
|
if (currentDroppable) {
|
||||||
currentDroppable.classList.remove("droppable-hover");
|
currentDroppable.classList.remove("droppable-hover");
|
||||||
|
@ -63,9 +63,11 @@ class ContextOptionsStore {
|
|||||||
|
|
||||||
onClickFavorite = (e) => {
|
onClickFavorite = (e) => {
|
||||||
const { id } = this.filesStore.selection[0];
|
const { id } = this.filesStore.selection[0];
|
||||||
|
console.log(e);
|
||||||
|
console.log(e.currentTarget, e.currentTarget.dataset, e);
|
||||||
const data = (e.currentTarget && e.currentTarget.dataset) || e;
|
const data = (e.currentTarget && e.currentTarget.dataset) || e;
|
||||||
const { action } = data;
|
const { action } = data;
|
||||||
|
console.log(action, data);
|
||||||
this.filesActionsStore
|
this.filesActionsStore
|
||||||
.setFavoriteAction(action, id)
|
.setFavoriteAction(action, id)
|
||||||
.then(() =>
|
.then(() =>
|
||||||
|
Loading…
Reference in New Issue
Block a user