mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
Only allow the "Copy Image" menu item for images
André Berg pointed out that the "Open Image in New Window" and "Download Image" items from the contextual menu for images in the web view does not work and may cause crashes. So limit the menu to either just show "Copy Image" or don't have a menu at all.
This commit is contained in:
@@ -127,6 +127,15 @@ contextMenuItemsForElement:(NSDictionary *)element
|
||||
}
|
||||
if ([node hasAttributes] && [[node attributes] getNamedItem:@"representedFile"])
|
||||
return [historyController menuItemsForPaths:[NSArray arrayWithObject:[[[node attributes] getNamedItem:@"representedFile"] value]]];
|
||||
else if ([[node class] isEqual:[DOMHTMLImageElement class]]) {
|
||||
// Copy Image is the only menu item that makes sense here since we don't need
|
||||
// to download the image or open it in a new window (besides with the
|
||||
// current implementation these two entries can crash GitX anyway)
|
||||
for (NSMenuItem *item in defaultMenuItems)
|
||||
if ([item tag] == WebMenuItemTagCopyImageToClipboard)
|
||||
return [NSArray arrayWithObject:item];
|
||||
return nil;
|
||||
}
|
||||
|
||||
node = [node parentNode];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user