mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Hide URL options for e2e blob: URL images
These won't work outside of the electron app so there is zero point in trying to open them in an external browser or offerring to copy them to the clipboard
This commit is contained in:
parent
e5fd579935
commit
38c295427a
@ -35,12 +35,15 @@ function onLinkContextMenu(ev, params) {
|
||||
const url = params.linkURL || params.srcURL;
|
||||
|
||||
const popupMenu = new Menu();
|
||||
popupMenu.append(new MenuItem({
|
||||
label: url,
|
||||
click() {
|
||||
safeOpenURL(url);
|
||||
},
|
||||
}));
|
||||
// No point trying to open blob: URLs in an external browser: it ain't gonna work.
|
||||
if (!url.startsWith('blob:')) {
|
||||
popupMenu.append(new MenuItem({
|
||||
label: url,
|
||||
click() {
|
||||
safeOpenURL(url);
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
||||
if (params.mediaType && params.mediaType === 'image' && !url.startsWith('file://')) {
|
||||
popupMenu.append(new MenuItem({
|
||||
@ -55,12 +58,15 @@ function onLinkContextMenu(ev, params) {
|
||||
}));
|
||||
}
|
||||
|
||||
popupMenu.append(new MenuItem({
|
||||
label: 'Copy Link Address',
|
||||
click() {
|
||||
clipboard.writeText(url);
|
||||
},
|
||||
}));
|
||||
// No point offerring to copy a blob: URL either
|
||||
if (!url.startsWith('blob:')) {
|
||||
popupMenu.append(new MenuItem({
|
||||
label: 'Copy Link Address',
|
||||
click() {
|
||||
clipboard.writeText(url);
|
||||
},
|
||||
}));
|
||||
}
|
||||
// popup() requires an options object even for no options
|
||||
popupMenu.popup({});
|
||||
ev.preventDefault();
|
||||
|
Loading…
Reference in New Issue
Block a user