mirror of
https://github.com/BlossomiShymae/Needlework.Net.git
synced 2025-12-06 18:20:47 +01:00
fix: encode Swagger URL, add Markdown copy
This commit is contained in:
@@ -15,6 +15,7 @@ public partial class PathOperationViewModel : ObservableObject
|
|||||||
public OperationViewModel Operation { get; }
|
public OperationViewModel Operation { get; }
|
||||||
|
|
||||||
public string Url { get; }
|
public string Url { get; }
|
||||||
|
public string Markdown { get; }
|
||||||
|
|
||||||
[ObservableProperty] private bool _isBusy;
|
[ObservableProperty] private bool _isBusy;
|
||||||
[ObservableProperty] private Lazy<RequestViewModel> _request;
|
[ObservableProperty] private Lazy<RequestViewModel> _request;
|
||||||
@@ -27,7 +28,8 @@ public partial class PathOperationViewModel : ObservableObject
|
|||||||
{
|
{
|
||||||
Method = pathOperation.Method.ToUpper()
|
Method = pathOperation.Method.ToUpper()
|
||||||
});
|
});
|
||||||
Url = $"https://swagger.dysolix.dev/lcu/#/{pathOperation.Tag}/{pathOperation.Operation.OperationId}";
|
Url = $"https://swagger.dysolix.dev/lcu/#/{Uri.EscapeDataString(pathOperation.Tag)}/{pathOperation.Operation.OperationId}";
|
||||||
|
Markdown = $"[{pathOperation.Method.ToUpper()} {Path}]({Url})";
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
@@ -59,4 +61,10 @@ public partial class PathOperationViewModel : ObservableObject
|
|||||||
{
|
{
|
||||||
App.MainWindow?.Clipboard?.SetTextAsync(Url);
|
App.MainWindow?.Clipboard?.SetTextAsync(Url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void CopyMarkdown()
|
||||||
|
{
|
||||||
|
App.MainWindow?.Clipboard?.SetTextAsync(Markdown);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@
|
|||||||
<Grid.ContextFlyout>
|
<Grid.ContextFlyout>
|
||||||
<MenuFlyout>
|
<MenuFlyout>
|
||||||
<MenuItem Header="Copy Swagger URL" Command="{Binding CopyUrlCommand}"/>
|
<MenuItem Header="Copy Swagger URL" Command="{Binding CopyUrlCommand}"/>
|
||||||
|
<MenuItem Header="Copy Markdown" Command="{Binding CopyMarkdownCommand}"/>
|
||||||
</MenuFlyout>
|
</MenuFlyout>
|
||||||
</Grid.ContextFlyout>
|
</Grid.ContextFlyout>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
|
|||||||
Reference in New Issue
Block a user