feat(web): unify attachment open behavior in context menus
Some checks failed
CI / test (push) Failing after 2m19s
Some checks failed
CI / test (push) Failing after 2m19s
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user