|
@@ -1,5 +1,6 @@
|
|
|
using HanumanInstitute.MvvmDialogs;
|
|
|
using System.Collections.ObjectModel;
|
|
|
+using System.Text.RegularExpressions;
|
|
|
using VeloeAvaloniaKemonoPartyApp.Models;
|
|
|
|
|
|
namespace VeloeAvaloniaKemonoPartyApp.ViewModels
|
|
@@ -20,18 +21,35 @@ namespace VeloeAvaloniaKemonoPartyApp.ViewModels
|
|
|
{
|
|
|
if (attachment is null) continue;
|
|
|
|
|
|
- if (attachment.Path.EndsWith(".jpg") || attachment.Path.EndsWith(".png") || attachment.Path.EndsWith(".jpeg"))
|
|
|
+ if (attachment.IsImage)
|
|
|
{
|
|
|
Images.Add(new PostImageViewModel(_dialogService,attachment));
|
|
|
}
|
|
|
+
|
|
|
+ Attachments.Add(new AttachmentViewModel(attachment));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public ObservableCollection<PostImageViewModel> Images { get; } = new();
|
|
|
+
|
|
|
+ public ObservableCollection<AttachmentViewModel> Attachments { get; } = new();
|
|
|
+
|
|
|
+ public AttachmentViewModel SelectedAttachment { get; set; }
|
|
|
|
|
|
public bool IsImagesEmpty => Images.Count == 0;
|
|
|
|
|
|
- public string Content => _post.Content;
|
|
|
+ public string Content => Regex.Replace(_post.Content, "<[^>]*>|<|>|&apos|&|"", (Match m) =>
|
|
|
+ m.Value switch
|
|
|
+ {
|
|
|
+ "<" => "<",
|
|
|
+ ">" => ">",
|
|
|
+ "&apos" => "'",
|
|
|
+ "&" => "&",
|
|
|
+ """ => "\"",
|
|
|
+ "</p>" => "\n",
|
|
|
+ _ => ""
|
|
|
+ }
|
|
|
+ );
|
|
|
|
|
|
public string Title => _post.Title;
|
|
|
|