mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 04:21:57 +03:00
Merge pull request #6765 from vector-im/dbkr/electron_hide_nonsensical_menu_options
Hide URL options for e2e blob: URL images
This commit is contained in:
commit
2e7da36af0
1 changed files with 18 additions and 12 deletions
|
@ -35,12 +35,15 @@ function onLinkContextMenu(ev, params) {
|
||||||
const url = params.linkURL || params.srcURL;
|
const url = params.linkURL || params.srcURL;
|
||||||
|
|
||||||
const popupMenu = new Menu();
|
const popupMenu = new Menu();
|
||||||
popupMenu.append(new MenuItem({
|
// No point trying to open blob: URLs in an external browser: it ain't gonna work.
|
||||||
label: url,
|
if (!url.startsWith('blob:')) {
|
||||||
click() {
|
popupMenu.append(new MenuItem({
|
||||||
safeOpenURL(url);
|
label: url,
|
||||||
},
|
click() {
|
||||||
}));
|
safeOpenURL(url);
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
if (params.mediaType && params.mediaType === 'image' && !url.startsWith('file://')) {
|
if (params.mediaType && params.mediaType === 'image' && !url.startsWith('file://')) {
|
||||||
popupMenu.append(new MenuItem({
|
popupMenu.append(new MenuItem({
|
||||||
|
@ -55,12 +58,15 @@ function onLinkContextMenu(ev, params) {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
popupMenu.append(new MenuItem({
|
// No point offerring to copy a blob: URL either
|
||||||
label: 'Copy Link Address',
|
if (!url.startsWith('blob:')) {
|
||||||
click() {
|
popupMenu.append(new MenuItem({
|
||||||
clipboard.writeText(url);
|
label: 'Copy Link Address',
|
||||||
},
|
click() {
|
||||||
}));
|
clipboard.writeText(url);
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
}
|
||||||
// popup() requires an options object even for no options
|
// popup() requires an options object even for no options
|
||||||
popupMenu.popup({});
|
popupMenu.popup({});
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
|
Loading…
Reference in a new issue