Files
Wino-Mail/Wino.Core.Domain/Models/Reader/MailRenderingOptions.cs

21 lines
798 B
C#
Raw Normal View History

2025-02-16 11:54:23 +01:00
namespace Wino.Core.Domain.Models.Reader;
/// <summary>
/// Rendering options for mail.
/// </summary>
public class MailRenderingOptions
2024-04-18 01:44:37 +02:00
{
2025-02-16 11:54:23 +01:00
private const bool DefaultLoadImageValue = true;
private const bool DefaultLoadStylesValue = true;
private const bool DefaultRenderPlaintextLinksValue = true;
2024-04-18 01:44:37 +02:00
2025-02-16 11:54:23 +01:00
public bool LoadImages { get; set; } = DefaultLoadImageValue;
public bool LoadStyles { get; set; } = DefaultLoadStylesValue;
public bool RenderPlaintextLinks { get; set; } = DefaultRenderPlaintextLinksValue;
2024-04-18 01:44:37 +02:00
2025-02-16 11:54:23 +01:00
// HtmlDocument.Load call is redundant if all the settings are in default values.
// Therefore we will purify the HTML only if needed.
2024-04-18 01:44:37 +02:00
2025-02-16 11:54:23 +01:00
public bool IsPurifyingNeeded() => LoadImages != DefaultLoadImageValue || LoadStyles != DefaultLoadStylesValue;
2024-04-18 01:44:37 +02:00
}