mirror of
https://github.com/BlossomiShymae/Needlework.Net.git
synced 2025-12-06 10:10:48 +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 string Url { get; }
|
||||
public string Markdown { get; }
|
||||
|
||||
[ObservableProperty] private bool _isBusy;
|
||||
[ObservableProperty] private Lazy<RequestViewModel> _request;
|
||||
@@ -27,7 +28,8 @@ public partial class PathOperationViewModel : ObservableObject
|
||||
{
|
||||
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]
|
||||
@@ -59,4 +61,10 @@ public partial class PathOperationViewModel : ObservableObject
|
||||
{
|
||||
App.MainWindow?.Clipboard?.SetTextAsync(Url);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void CopyMarkdown()
|
||||
{
|
||||
App.MainWindow?.Clipboard?.SetTextAsync(Markdown);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
<Grid.ContextFlyout>
|
||||
<MenuFlyout>
|
||||
<MenuItem Header="Copy Swagger URL" Command="{Binding CopyUrlCommand}"/>
|
||||
<MenuItem Header="Copy Markdown" Command="{Binding CopyMarkdownCommand}"/>
|
||||
</MenuFlyout>
|
||||
</Grid.ContextFlyout>
|
||||
<TextBlock
|
||||
|
||||
Reference in New Issue
Block a user