mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
feature: add context menu for issue link in commit details panel (#651)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
64860950c7
commit
163e8cc0a4
24 changed files with 76 additions and 66 deletions
|
@ -176,7 +176,41 @@ namespace SourceGit.Views
|
|||
}
|
||||
else
|
||||
{
|
||||
Native.OS.OpenBrowser(_lastHover.Link);
|
||||
var point = e.GetCurrentPoint(this);
|
||||
var link = _lastHover.Link;
|
||||
|
||||
if (point.Properties.IsLeftButtonPressed)
|
||||
{
|
||||
Native.OS.OpenBrowser(link);
|
||||
}
|
||||
else if (point.Properties.IsRightButtonPressed)
|
||||
{
|
||||
var open = new MenuItem();
|
||||
open.Header = App.Text("IssueLinkCM.OpenInBrowser");
|
||||
open.Icon = App.CreateMenuIcon("Icons.OpenWith");
|
||||
open.Click += (_, ev) =>
|
||||
{
|
||||
ev.Handled = true;
|
||||
|
||||
var parentView = this.FindAncestorOfType<CommitBaseInfo>();
|
||||
if (parentView is { DataContext: ViewModels.CommitDetail detail })
|
||||
detail.NavigateTo(link);
|
||||
};
|
||||
|
||||
var copy = new MenuItem();
|
||||
copy.Header = App.Text("IssueLinkCM.CopyLink");
|
||||
copy.Icon = App.CreateMenuIcon("Icons.Copy");
|
||||
copy.Click += (_, ev) =>
|
||||
{
|
||||
App.CopyText(link);
|
||||
ev.Handled = true;
|
||||
};
|
||||
|
||||
var menu = new ContextMenu();
|
||||
menu.Items.Add(open);
|
||||
menu.Items.Add(copy);
|
||||
menu.Open(this);
|
||||
}
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue