feat(web): unify attachment open behavior in context menus
Some checks failed
CI / test (push) Failing after 2m19s

This commit is contained in:
2026-03-08 22:24:28 +03:00
parent 4697193243
commit 751f8c9067
3 changed files with 23 additions and 5 deletions

View File

@@ -987,9 +987,16 @@ export function ChatInfoPanel({ chatId, open, onClose }: Props) {
style={{ left: attachmentCtx.x, top: attachmentCtx.y }}
onClick={(event) => event.stopPropagation()}
>
<a className="block rounded px-2 py-1.5 text-sm hover:bg-slate-800" href={attachmentCtx.url} rel="noreferrer" target="_blank">
<button
className="block w-full rounded px-2 py-1.5 text-left text-sm hover:bg-slate-800"
onClick={() => {
window.open(attachmentCtx.url, "_blank", "noopener,noreferrer");
setAttachmentCtx(null);
}}
type="button"
>
Open
</a>
</button>
<button
className="block w-full rounded px-2 py-1.5 text-left text-sm hover:bg-slate-800"
onClick={async () => {

View File

@@ -807,9 +807,20 @@ export function MessageList() {
{ctx.attachmentUrl ? (
<>
<div className="my-1 h-px bg-slate-700/80" />
<a className="block w-full rounded px-2 py-1.5 text-left text-sm hover:bg-slate-800" href={ctx.attachmentUrl} rel="noreferrer" target="_blank">
<button
className="block w-full rounded px-2 py-1.5 text-left text-sm hover:bg-slate-800"
onClick={() => {
const url = ctx.attachmentUrl;
if (!url) {
return;
}
window.open(url, "_blank", "noopener,noreferrer");
setCtx(null);
}}
type="button"
>
Open media
</a>
</button>
<button
className="block w-full rounded px-2 py-1.5 text-left text-sm hover:bg-slate-800"
onClick={async () => {