-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMudHtmlToolbarOptions.razor.cs
140 lines (119 loc) · 4.76 KB
/
MudHtmlToolbarOptions.razor.cs
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
using Microsoft.AspNetCore.Components;
namespace Tizzani.MudBlazor.HtmlEditor;
/// <summary>
/// Defines the toolbar options that are available in the HtmlEditor.
/// </summary>
public partial class MudHtmlToolbarOptions
{
[CascadingParameter]
private MudHtmlToolbarOptions? DefaultOptions { get; set; }
/// <summary>
/// If <see langword="true"/>, the toolbar will include the option to select different headings and paragraph styles.
/// </summary>
[Parameter]
public bool? TypographyPicker { get; set; }
/// <summary>
/// If <see langword="true"/>, the toolbar will include the option to bold text.
/// </summary>
[Parameter]
public bool? Bold { get; set; }
/// <summary>
/// If <see langword="true"/>, the toolbar will include the option to italicize text.
/// </summary>
[Parameter]
public bool? Italic { get; set; }
/// <summary>
/// If <see langword="true"/>, the toolbar will include the option to underline text.
/// </summary>
[Parameter]
public bool? Underline { get; set; }
/// <summary>
/// If <see langword="true"/>, the toolbar will include the option to strike through text.
/// </summary>
[Parameter]
public bool? Strike { get; set; }
/// <summary>
/// If <see langword="true"/>, a color picker for the foreground color will be available in the toolbar.
/// </summary>
[Parameter]
public bool? ForegroundColorPicker { get; set; }
/// <summary>
/// If <see langword="true"/>, a color picker for the background color will be available in the toolbar.
/// </summary>
[Parameter]
public bool? BackgroundColorPicker { get; set; }
/// <summary>
/// If <see langword="true"/>, the toolbar will include the option to insert subscripts and superscripts.
/// </summary>
[Parameter]
public bool? SubSuperScript { get; set; }
/// <summary>
/// If <see langword="true"/>, the toolbar will include the option to align text (e.g., left, center, right, justify).
/// </summary>
[Parameter]
public bool? Align { get; set; }
/// <summary>
/// If <see langword="true"/>, the toolbar will include the option to insert an unordered (numbered) list.
/// </summary>
[Parameter]
public bool? OrderedList { get; set; }
/// <summary>
/// If <see langword="true"/>, the toolbar will include the option to insert an unordered (bulleted) list.
/// </summary>
[Parameter]
public bool? UnorderedList { get; set; }
/// <summary>
/// If <see langword="true"/>, the toolbar will include the option of increasing/decreasing the indent size.
/// </summary>
[Parameter]
public bool? Indent { get; set; }
/// <summary>
/// If <see langword="true"/>, the toolbar will include the option of inserting a hyperlink.
/// </summary>
[Parameter]
public bool? InsertLink { get; set; }
/// <summary>
/// If <see langword="true"/>, the toolbar will include the option of inserting an image.
/// </summary>
[Parameter]
public bool? InsertImage { get; set; }
/// <summary>
/// If <see langword="true"/>, the toolbar will include the option of inserting a blockquote.
/// </summary>
[Parameter]
public bool? Blockquote { get; set; }
/// <summary>
/// If <see langword="true"/>, the toolbar will include the option of inserting a code block.
/// </summary>
[Parameter]
public bool? CodeBlock { get; set; }
/// <summary>
/// If <see langword="true"/>, the toolbar will include the option of inserting a horizontal rule.
/// </summary>
[Parameter]
public bool? HorizontalRule { get; set; }
private static bool Show(params bool?[] options) => options.Any(o => o is not false);
protected override void OnInitialized()
{
if (DefaultOptions != null)
{
TypographyPicker ??= DefaultOptions.TypographyPicker;
Bold ??= DefaultOptions.Bold;
Italic ??= DefaultOptions.Italic;
Underline ??= DefaultOptions.Underline;
Strike ??= DefaultOptions.Strike;
ForegroundColorPicker ??= DefaultOptions.ForegroundColorPicker;
BackgroundColorPicker ??= DefaultOptions.BackgroundColorPicker;
SubSuperScript ??= DefaultOptions.SubSuperScript;
Align ??= DefaultOptions.Align;
OrderedList ??= DefaultOptions.OrderedList;
UnorderedList ??= DefaultOptions.UnorderedList;
Indent ??= DefaultOptions.Indent;
InsertLink ??= DefaultOptions.InsertLink;
InsertImage ??= DefaultOptions.InsertImage;
Blockquote ??= DefaultOptions.Blockquote;
CodeBlock ??= DefaultOptions.CodeBlock;
HorizontalRule ??= DefaultOptions.HorizontalRule;
}
}
}