Repository navigation
Expand file tree
/
Copy pathZenEditorModels.cs
More file actions
91 lines (81 loc) · 2.63 KB
/
Copy pathZenEditorModels.cs
File metadata and controls
91 lines (81 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
using System;
using System.Collections.Generic;
namespace AiteBar;
public sealed class ZenEditorDocument
{
public Guid Id { get; set; } = Guid.NewGuid();
public string Text { get; set; } = string.Empty;
public DateTime CreatedUtc { get; set; } = DateTime.UtcNow;
public DateTime ModifiedUtc { get; set; } = DateTime.UtcNow;
public int CaretIndex { get; set; }
public int SelectionStart { get; set; }
public int SelectionLength { get; set; }
public double ScrollOffset { get; set; }
public bool IsDeleted { get; set; }
public bool HasEverContainedText { get; set; }
public string Checksum { get; set; } = string.Empty;
public List<ZenEditorTextStyle> Styles { get; set; } = [];
public ZenEditorDocument Clone() => new()
{
Id = Id,
Text = Text,
CreatedUtc = CreatedUtc,
ModifiedUtc = ModifiedUtc,
CaretIndex = CaretIndex,
SelectionStart = SelectionStart,
SelectionLength = SelectionLength,
ScrollOffset = ScrollOffset,
IsDeleted = IsDeleted,
HasEverContainedText = HasEverContainedText,
Checksum = Checksum,
Styles = (Styles ?? []).Select(style => style with { }).ToList()
};
}
public sealed record ZenEditorTextStyle(
int Start,
int Length,
bool Bold,
bool Italic,
bool Underline);
public sealed class ZenEditorStoreIndex
{
public Guid? ActiveDocumentId { get; set; }
public string ThemeId { get; set; } = ZenEditorThemeCatalog.PaperId;
public string LastMonitorDeviceName { get; set; } = string.Empty;
public string LastExportDirectory { get; set; } = string.Empty;
public bool ExitOnSideClick { get; set; } = true;
public double SideSafetyMargin { get; set; } = 48.0;
public List<ZenEditorDocumentMetadata> Documents { get; set; } = [];
}
public sealed record ZenEditorDocumentMetadata(
Guid Id,
string Title,
DateTime ModifiedUtc,
bool IsDeleted);
public sealed record ZenEditorDocumentSummary(
Guid Id,
string Title,
DateTime ModifiedUtc,
bool IsCurrent);
public sealed record ZenEditorLoadResult(
ZenEditorDocument Document,
ZenEditorStoreIndex Index,
bool WasRecovered);
public sealed record ZenEditorTheme(
string Id,
string DisplayNameKey,
string FontResourceName,
double FontSize,
double ColumnWidth,
string Background,
string Text,
string Selection,
string SelectionText,
string Caret,
string Header,
string Separator);
internal sealed class ZenEditorStoreSnapshot
{
public ZenEditorStoreIndex Index { get; set; } = new();
public List<Guid> DocumentIds { get; set; } = [];
}