-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHtmlAttributeDescriptorViewModel.cs
More file actions
64 lines (57 loc) · 3.3 KB
/
HtmlAttributeDescriptorViewModel.cs
File metadata and controls
64 lines (57 loc) · 3.3 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
/*==============================================================================================================================
| Author Ignia, LLC
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using OnTopic.Editor.AspNetCore.Attributes.TextAreaAttribute;
namespace OnTopic.Editor.AspNetCore.Attributes.HtmlAttribute {
/*============================================================================================================================
| CLASS: HTML ATTRIBUTE DESCRIPTOR (TOPIC VIEW MODEL)
\---------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Provides access to attributes associated with the <see cref="HtmlViewComponent"/>.
/// </summary>
public record HtmlAttributeDescriptorViewModel: TextAreaAttributeDescriptorViewModel {
/*==========================================================================================================================
| CONSTRUCTOR
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Initializes a new <see cref="HtmlAttributeDescriptorViewModel"/> with an <paramref name="attributes"/> dictionary.
/// </summary>
/// <param name="attributes">An <see cref="AttributeDictionary"/> of attribute values.</param>
public HtmlAttributeDescriptorViewModel(AttributeDictionary attributes): base(attributes) {
Contract.Requires(attributes, nameof(attributes));
Height = attributes.GetInteger(nameof(Height));
Rows = 20;
RegisterResources();
}
/// <summary>
/// Initializes a new instance of a <see cref="HtmlAttributeDescriptorViewModel"/>
/// </summary>
public HtmlAttributeDescriptorViewModel() {
Rows = 20;
RegisterResources();
}
/*==========================================================================================================================
| REGISTER RESOURCES
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Derived classes may optionally override this method in order to register resources, as an alternative to setting these
/// in the constructor.
/// </summary>
protected void RegisterResources() {
Scripts.Register(new("https://cdn.ckeditor.com/4.14.0/standard/ckeditor.js"), true, false);
}
/*==========================================================================================================================
| HEIGHT
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Gets or sets the number of pixels that the <see cref="HtmlViewComponent"/> should take up. Defaults to <see
/// cref="TextAreaAttributeDescriptorViewModel.Rows"/> x <c>20</c>.
/// </summary>
/// <remarks>
/// If set, this value overrides <see cref="TextAreaAttributeDescriptorViewModel.Rows"/>.
/// </remarks>
public int? Height { get; init; }
} //Class
} //Namespace