Preventing dragging of icon/avatars

canary
WolverinDEV 2020-09-25 20:36:23 +02:00
parent 120c1deab1
commit 0a78890159
2 changed files with 5 additions and 3 deletions

View File

@ -29,6 +29,7 @@ export const AvatarRenderer = React.memo((props: { avatar: ClientAvatar | "loadi
event.preventDefault(); event.preventDefault();
image_preview.preview_image(imageUrl, undefined); image_preview.preview_image(imageUrl, undefined);
}} }}
draggable={false}
/>; />;
break; break;
@ -46,15 +47,16 @@ export const AvatarRenderer = React.memo((props: { avatar: ClientAvatar | "loadi
event.preventDefault(); event.preventDefault();
image_preview.preview_image(imageUrl, undefined); image_preview.preview_image(imageUrl, undefined);
}} }}
draggable={false}
/>; />;
break; break;
case "errored": case "errored":
image = <img key={"error"} alt={typeof props.alt === "string" ? props.alt : tr("error")} title={tr("avatar failed to load:\n") + props.avatar.getLoadError()} src={imageUrl} style={ImageStyle} />; image = <img draggable={false} key={"error"} alt={typeof props.alt === "string" ? props.alt : tr("error")} title={tr("avatar failed to load:\n") + props.avatar.getLoadError()} src={imageUrl} style={ImageStyle} />;
break; break;
case "loading": case "loading":
image = <img key={"loading"} alt={typeof props.alt === "string" ? props.alt : tr("loading")} title={tr("loading avatar")} src={kLoadingAvatarImage} style={ImageStyle} />; image = <img draggable={false} key={"loading"} alt={typeof props.alt === "string" ? props.alt : tr("loading")} title={tr("loading avatar")} src={kLoadingAvatarImage} style={ImageStyle} />;
break; break;
case undefined: case undefined:

View File

@ -46,7 +46,7 @@ export class LocalIconRenderer extends React.Component<LoadedIconRenderer, {}> {
return <div key={"loaded-empty"} className={"icon-container icon-empty"} title={this.props.title} />; return <div key={"loaded-empty"} className={"icon-container icon-empty"} title={this.props.title} />;
return <div key={"loaded"} className={"icon_em client-group_" + icon.icon_id} />; return <div key={"loaded"} className={"icon_em client-group_" + icon.icon_id} />;
} }
return <div key={"icon"} className={"icon-container " + this.props.className}><img style={{ maxWidth: "100%", maxHeight: "100%" }} src={icon.loaded_url} alt={this.props.title || ("icon " + icon.icon_id)} /></div>; return <div key={"icon"} className={"icon-container " + this.props.className}><img style={{ maxWidth: "100%", maxHeight: "100%" }} src={icon.loaded_url} alt={this.props.title || ("icon " + icon.icon_id)} draggable={false} /></div>;
} else if(icon.status === "loading") } else if(icon.status === "loading")
return <div key={"loading"} className={"icon-container " + this.props.className} title={this.props.title}><div className={"icon_loading"} /></div>; return <div key={"loading"} className={"icon-container " + this.props.className} title={this.props.title}><div className={"icon_loading"} /></div>;
else if(icon.status === "error") else if(icon.status === "error")