Skip to content

Commit 0ef620c

Browse files
authored
Merge pull request #7086 from syncfusion-content/991223-Blaz-Clean
991223: Blazor Documentation cleanup
2 parents dfa130f + 1908f8c commit 0ef620c

File tree

84 files changed

+2059
-501
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+2059
-501
lines changed

blazor-toc.html

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4099,48 +4099,70 @@
40994099
<li> <a href="/blazor/rich-text-editor/getting-started-with-maui-app">Blazor Hybrid MAUI App</a></li>
41004100
</ul>
41014101
</li>
4102+
<li>Toolbar
4103+
<ul>
4104+
<li><a href="/blazor/rich-text-editor/toolbar">Toolbar Types</a></li>
4105+
<li><a href="/blazor/rich-text-editor/toolbar-position">Toolbar Position</a></li>
4106+
<li><a href="/blazor/rich-text-editor/quick-toolbar">Quick Toolbar</a></li>
4107+
</ul>
4108+
</li>
41024109
<li> <a href="/blazor/rich-text-editor/data-binding">Value Binding</a></li>
4103-
<li> <a href="/blazor/rich-text-editor/toolbar">Toolbar</a></li>
4104-
<li> <a href="/blazor/rich-text-editor/iframe">IFrame Editor</a></li>
4105-
<li> <a href="/blazor/rich-text-editor/inline-mode">Inline Editor</a></li>
41064110
<li>
41074111
Tools
41084112
<ul>
41094113
<li><a href="/blazor/rich-text-editor/tools/built-in-tools">Built-in Tools</a></li>
4114+
<li><a href="/blazor/rich-text-editor/tools/custom-tool">Custom Tool</a></li>
4115+
<li><a href="/blazor/rich-text-editor/tools/text-formatting">Text formatting and structural</a></li>
41104116
<li><a href="/blazor/rich-text-editor/tools/styling-tools">Styling Tools</a></li>
4117+
<li><a href="/blazor/rich-text-editor/tools/fullscreen-tool">Expanding Editor to Fullscreen View</a></li>
4118+
<li><a href="/blazor/rich-text-editor/tools/format-painter">Format Painter</a></li>
4119+
<li><a href="/blazor/rich-text-editor/tools/dialogSettings">Dialog Settings</a></li>
4120+
</ul>
4121+
</li>
4122+
<li>Editor Types
4123+
<ul>
4124+
<li><a href="/blazor/rich-text-editor/editor-modes">Editor Render Mode</a></li>
4125+
<li><a href="/blazor/rich-text-editor/iframe">Iframe Editor</a></li>
4126+
<li> <a href="/blazor/rich-text-editor/inline-mode">Inline Editor</a></li>
4127+
<li><a href="/blazor/rich-text-editor/resizable-editor">Resizable Editor</a></li>
4128+
</ul>
4129+
</li>
4130+
<li>Insert Image and Media
4131+
<ul>
41114132
<li><a href="/blazor/rich-text-editor/tools/insert-image">Insert image</a></li>
41124133
<li><a href="/blazor/rich-text-editor/tools/audio">Insert audio</a></li>
41134134
<li><a href="/blazor/rich-text-editor/tools/video">Insert video</a></li>
4114-
<li><a href="/blazor/rich-text-editor/tools/link-manipulation">Link manipulation</a></li>
4115-
<li><a href="/blazor/rich-text-editor/tools/table-manipulation">Table manipulation</a></li>
4116-
<li><a href="/blazor/rich-text-editor/tools/code-block">Code Block</a></li>
4117-
<li><a href="/blazor/rich-text-editor/tools/format-painter">Format Painter</a></li>
4118-
<li><a href="/blazor/rich-text-editor/tools/custom-tool">Custom Tool</a></li>
4119-
<li><a href="/blazor/rich-text-editor/tools/dialogSettings">Dialog Settings</a></li>
41204135
</ul>
41214136
</li>
4122-
<li> <a href="/blazor/rich-text-editor/enter-key">Enter Key Configuration</a></li>
4123-
<li> <a href="/blazor/rich-text-editor/paste-cleanup">Paste Clean-up</a></li>
41244137
<li>Smart Editing
41254138
<ul>
41264139
<li> <a href="/blazor/rich-text-editor/mention-integration">Mention Integration</a></li>
4127-
<li> <a href="/blazor/rich-text-editor/slash-commands">Slash Commands</a></li>
4140+
<li> <a href="/blazor/rich-text-editor/slash-commands">Slash Commands</a></li>
4141+
<li> <a href="/blazor/rich-text-editor/mail-merge">Mail Merge Integration</a></li>
41284142
</ul>
41294143
</li>
4130-
<li> <a href="/blazor/rich-text-editor/form-validation">Form Validation</a></li>
4131-
<li> <a href="/blazor/rich-text-editor/xhtml-validation">Xhtml Validation</a></li>
4132-
<li> <a href="/blazor/rich-text-editor/exec-command">Execute Command</a></li>
4144+
<li>Validation and Security
4145+
<ul>
4146+
<li><a href="/blazor/rich-text-editor/form-validation">Forms Support</a></li>
4147+
<li><a href="/blazor/rich-text-editor/xhtml-validation">Content Validation and Security in XHTML</a></li>
4148+
<li><a href="/blazor/rich-text-editor/read-only-mode">Controlling Editor Access</a></li>
4149+
</ul>
4150+
</li>
4151+
<li><a href="/blazor/rich-text-editor/tools/link-manipulation">Link manipulation</a></li>
4152+
<li><a href="/blazor/rich-text-editor/tools/table-manipulation">Table manipulation</a></li>
4153+
<li><a href="/blazor/rich-text-editor/tools/code-block">Code Block</a></li>
4154+
<li> <a href="/blazor/rich-text-editor/paste-cleanup">Paste Clean-up</a></li>
4155+
<li> <a href="/blazor/rich-text-editor/enter-key">Enter Key Configuration</a></li>
41334156
<li> <a href="/blazor/rich-text-editor/undo-redo-manager">Undo Redo Manager</a></li>
4134-
<li> <a href="/blazor/rich-text-editor/resizable-editor">Resizable Editor</a></li>
4157+
<li> <a href="/blazor/rich-text-editor/import-and-export">Import/Export</a></li>
4158+
<li> <a href="/blazor/rich-text-editor/exec-command">Execute Command</a></li>
41354159
<li> <a href="/blazor/rich-text-editor/style">Style and Appearance</a></li>
4160+
<li> <a href="/blazor/rich-text-editor/style-encapsulation">Style Encapsulation</a></li>
41364161
<li> <a href="/blazor/rich-text-editor/globalization">Globalization</a></li>
4162+
<li> <a href="/blazor/rich-text-editor/keyboard-support">Keyboard shortcuts</a></li>
41374163
<li> <a href="/blazor/rich-text-editor/accessibility">Accessibility</a></li>
41384164
<li> <a href="/blazor/rich-text-editor/webassembly-performance">WebAssembly Performance</a></li>
4139-
<li> <a href="/blazor/rich-text-editor/import-export">Import and Export</a></li>
4140-
<li> <a href="/blazor/rich-text-editor/editor-modes">Editor Modes</a></li>
4141-
<li> <a href="/blazor/rich-text-editor/keyboard-support">Keyboard shortcuts</a></li>
41424165
<li> <a href="/blazor/rich-text-editor/miscellaneous">Miscellaneous</a></li>
4143-
<li> <a href="/blazor/rich-text-editor/import-and-export">Import/Export</a></li>
41444166
<li> <a href="/blazor/rich-text-editor/events">Events</a></li>
41454167
<li>How To
41464168
<ul>
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
@using Syncfusion.Blazor.RichTextEditor
2+
@using Syncfusion.Blazor.Buttons
3+
@using Syncfusion.Blazor.SplitButtons
4+
@using Syncfusion.Blazor.DropDowns
5+
@using System.Text.RegularExpressions;
6+
<div class="control-section">
7+
<div class="control-wrapper">
8+
<div class="">
9+
<SfRichTextEditor ID="_mailMergeEditor" @bind-Value="_rteValue" SaveInterval="1" @ref="_mailMergeEditor">
10+
<RichTextEditorToolbarSettings Items="@_tools">
11+
<RichTextEditorEvents OnActionComplete="@OnActionCompleteHandler" />
12+
<RichTextEditorCustomToolbarItems>
13+
<RichTextEditorCustomToolbarItem Name="MergeData">
14+
<Template>
15+
<SfButton CssClass="@_buttonClass" OnClick="OnClickHandler" id="merge_data" tabindex="-1" aria-label="Merge User-specific Data" Disabled="@_sourceCodeEnabled">
16+
<div class="e-tbar-btn-text">Merge Data</div>
17+
</SfButton>
18+
</Template>
19+
</RichTextEditorCustomToolbarItem>
20+
<RichTextEditorCustomToolbarItem Name="InsertField">
21+
<Template>
22+
<SfDropDownButton CssClass="@_dropDownButtonClass" id="insertField" Items="@_items" aria-label="Insert Merge Field" Disabled="@_sourceCodeEnabled">
23+
<ChildContent>
24+
<span style="display:inline-flex;">
25+
<span class="e-rte-dropdown-btn-text">Insert Field</span>
26+
</span>
27+
<DropDownButtonEvents ItemSelected="OnItemSelect" OnOpen="OnDropDownOpen" Closed="OnDropDownClose"></DropDownButtonEvents>
28+
</ChildContent>
29+
</SfDropDownButton>
30+
</Template>
31+
</RichTextEditorCustomToolbarItem>
32+
</RichTextEditorCustomToolbarItems>
33+
</RichTextEditorToolbarSettings>
34+
</SfRichTextEditor>
35+
<SfMention DataSource="_mergeData" TItem="MergeData" Target="#_mailMergeEditor" MentionChar="_mentionChar" AllowSpaces="true" PopupWidth='250px' PopupHeight='200px' @ref="mentionObj">
36+
<DisplayTemplate>
37+
<span>{{@((context as MergeData).Value)}}</span>
38+
</DisplayTemplate>
39+
<ChildContent>
40+
<MentionFieldSettings Text="Text"></MentionFieldSettings>
41+
</ChildContent>
42+
</SfMention>
43+
</div>
44+
</div>
45+
</div>
46+
<style>
47+
.tailwind #insertField,
48+
.tailwind3 #insertField {
49+
font-size: 14px
50+
}
51+
.tailwind3 #merge_data,
52+
.tailwind3-dark #merge_data {
53+
font-weight:400;
54+
}
55+
</style>
56+
@code {
57+
private SfMention<MergeData> mentionObj;
58+
private SfRichTextEditor _mailMergeEditor;
59+
private string _buttonClass = "e-tbar-btn e-tbar-btn-text";
60+
private string _dropDownButtonClass = "e-rte-elements e-rte-dropdown-menu";
61+
private bool _sourceCodeEnabled = false;
62+
private string _rteValue = @"<p>Dear <span contenteditable=""false"" class=""e-mention-chip""><span>{{FirstName}}</span></span> <span contenteditable=""false"" class=""e-mention-chip""><span>{{LastName}}</span></span>,</p>
63+
<p>We are thrilled to have you with us! Your unique promotional code for this month is: <span contenteditable=""false"" class=""e-mention-chip""><span>{{PromoCode}}</span></span>.</p>
64+
<p>Your current subscription plan is: <span contenteditable=""false"" class=""e-mention-chip""><span>{{SubscriptionPlan}}</span></span>.</p>
65+
<p>Your customer ID is: <span contenteditable=""false"" class=""e-mention-chip""><span>{{CustomerID}}</span></span>.</p>
66+
<p>Your promotional code expires on: <span contenteditable=""false"" class=""e-mention-chip""><span>{{ExpirationDate}}</span></span>.</p>
67+
<p>Feel free to browse our latest offerings and updates. If you need any assistance, don't hesitate to contact us at <a href=""mailto:{{SupportEmail}}""><span contenteditable=""false"" class=""e-mention-chip""><span>{{SupportEmail}}</span></span></a> or call us at <span contenteditable=""false"" class=""e-mention-chip""><span>{{SupportPhoneNumber}}</span></span>.</p>
68+
<p>Best regards,<br>The <span contenteditable=""false"" class=""e-mention-chip""><span>{{CompanyName}}</span></span> Team</p>";
69+
private char _mentionChar = '{';
70+
public class MergeData
71+
{
72+
public string Text { get; set; }
73+
public string Value { get; set; }
74+
}
75+
private List<MergeData> _mergeData = new List<MergeData>
76+
{
77+
new MergeData { Text = "First Name", Value = "FirstName" },
78+
new MergeData { Text = "Last Name", Value = "LastName" },
79+
new MergeData { Text = "Support Email", Value = "SupportEmail" },
80+
new MergeData { Text = "Company Name", Value = "CompanyName" },
81+
new MergeData { Text = "Promo Code", Value = "PromoCode" },
82+
new MergeData { Text = "Support Phone Number", Value = "SupportPhoneNumber" },
83+
new MergeData { Text = "Customer ID", Value = "CustomerID" },
84+
new MergeData { Text = "Expiration Date", Value = "ExpirationDate" },
85+
new MergeData { Text = "Subscription Plan", Value = "SubscriptionPlan" }
86+
};
87+
private List<ToolbarItemModel> _tools = new List<ToolbarItemModel>()
88+
{
89+
new ToolbarItemModel() { Command = ToolbarCommand.Bold },
90+
new ToolbarItemModel() { Command = ToolbarCommand.Italic },
91+
new ToolbarItemModel() { Command = ToolbarCommand.Underline },
92+
new ToolbarItemModel() { Command = ToolbarCommand.Separator },
93+
new ToolbarItemModel() { Command = ToolbarCommand.Formats },
94+
new ToolbarItemModel() { Command = ToolbarCommand.Alignments },
95+
new ToolbarItemModel() { Command = ToolbarCommand.OrderedList },
96+
new ToolbarItemModel() { Command = ToolbarCommand.UnorderedList },
97+
new ToolbarItemModel() { Command = ToolbarCommand.Separator },
98+
new ToolbarItemModel() { Command = ToolbarCommand.CreateLink },
99+
new ToolbarItemModel() { Command = ToolbarCommand.Image },
100+
new ToolbarItemModel() { Command = ToolbarCommand.CreateTable },
101+
new ToolbarItemModel() { Command = ToolbarCommand.Separator },
102+
new ToolbarItemModel() { Name = "MergeData", TooltipText = "Merge Data" },
103+
new ToolbarItemModel() { Name = "InsertField", TooltipText = "Insert Field" },
104+
new ToolbarItemModel() { Command = ToolbarCommand.SourceCode },
105+
new ToolbarItemModel() { Command = ToolbarCommand.Separator },
106+
new ToolbarItemModel() { Command = ToolbarCommand.Undo },
107+
new ToolbarItemModel() { Command = ToolbarCommand.Redo },
108+
};
109+
private List<DropDownMenuItem> _items = new List<DropDownMenuItem>
110+
{
111+
new DropDownMenuItem { Text = "First Name" },
112+
new DropDownMenuItem { Text = "Last Name" },
113+
new DropDownMenuItem { Text = "Support Email" },
114+
new DropDownMenuItem { Text = "Company Name" },
115+
new DropDownMenuItem { Text = "Promo Code" },
116+
new DropDownMenuItem { Text = "Support Phone Number" },
117+
new DropDownMenuItem { Text = "Customer ID" },
118+
new DropDownMenuItem { Text = "Expiration Date" },
119+
new DropDownMenuItem { Text = "Subscription Plan" }
120+
};
121+
private Dictionary<string, string> _placeholderData = new Dictionary<string, string>
122+
{
123+
{ "FirstName", "John" },
124+
{ "LastName", "Doe" },
125+
{ "PromoCode", "ABC123" },
126+
{ "SubscriptionPlan", "Premium" },
127+
{ "CustomerID", "123456" },
128+
{ "ExpirationDate", "2024-12-31" },
129+
{ "SupportEmail", "support@example.com" },
130+
{ "SupportPhoneNumber", "+1-800-555-5555" },
131+
{ "CompanyName", "Example Inc." }
132+
};
133+
public void OnClickHandler()
134+
{
135+
if (this._mailMergeEditor != null)
136+
{
137+
var editorContent = this._mailMergeEditor.Value;
138+
var mergedContent = ReplacePlaceholders(editorContent, this._placeholderData);
139+
_rteValue = mergedContent;
140+
}
141+
}
142+
public async Task OnDropDownOpen()
143+
{
144+
if (this._mailMergeEditor != null)
145+
{
146+
await this._mailMergeEditor.SaveSelectionAsync();
147+
}
148+
}
149+
public async Task OnDropDownClose()
150+
{
151+
if (this._mailMergeEditor != null)
152+
{
153+
await this._mailMergeEditor.RestoreSelectionAsync();
154+
}
155+
}
156+
public async Task OnItemSelect(MenuEventArgs args)
157+
{
158+
if (args.Item.Text != null)
159+
{
160+
var value = _mergeData.FirstOrDefault(md => md.Text == args.Item.Text)?.Value;
161+
string htmlContent = $"<span contenteditable=\"false\" class=\"e-mention-chip\"><span>{{{{{value}}}}}</span></span> ";
162+
var undoOption = new ExecuteCommandOption { Undo = true };
163+
this._mailMergeEditor.ExecuteCommandAsync(CommandName.InsertHTML, htmlContent, undoOption);
164+
await this._mailMergeEditor.SaveSelectionAsync();
165+
}
166+
}
167+
private void OnActionCompleteHandler(Syncfusion.Blazor.RichTextEditor.ActionCompleteEventArgs args)
168+
{
169+
if (args.RequestType == "SourceCode")
170+
{
171+
this._buttonClass = "e-tbar-btn e-tbar-btn-text e-overlay";
172+
this._dropDownButtonClass = "e-rte-elements e-rte-dropdown-menu e-overlay";
173+
this._sourceCodeEnabled = true;
174+
}
175+
if (args.RequestType == "Preview")
176+
{
177+
this._buttonClass = "e-tbar-btn e-tbar-btn-text";
178+
this._dropDownButtonClass = "e-rte-elements e-rte-dropdown-menu";
179+
this._sourceCodeEnabled = false;
180+
}
181+
}
182+
public static string ReplacePlaceholders(string template, Dictionary<string, string> data)
183+
{
184+
return Regex.Replace(template, @"{{\s*(\w+)\s*}}", match =>
185+
{
186+
string key = match.Groups[1].Value.Trim();
187+
return data.TryGetValue(key, out var value) ? value : match.Value;
188+
});
189+
}
190+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@using Syncfusion.Blazor.DropDowns
2+
@using Syncfusion.Blazor.RichTextEditor
3+
4+
5+
<SfRichTextEditor ID="mentionIntegration">
6+
7+
<p>Hello
8+
<span contenteditable="false" class="e-mention-chip"><a href="mailto:maria@gmail.com" title="maria@gmail.com">@@Maria</a></span>
9+
</p>
10+
<p>Welcome to the mention integration with rich text editor demo. Type <code>@@</code> character and tag user from the suggestion list. </p>
11+
</SfRichTextEditor>
12+
13+
<div id="mention_integration">
14+
<SfMention TItem="PersonData" Target="#mentionIntegration_rte-editable" DataSource="@EmailData" MinLength="3">
15+
<ChildContent>
16+
<MentionFieldSettings Text="Name"></MentionFieldSettings>
17+
</ChildContent>
18+
</SfMention>
19+
</div>
20+
21+
@code {
22+
public class PersonData
23+
{
24+
public string Name { get; set; }
25+
public string EmailId { get; set; }
26+
public string EmployeeImage { get; set;}
27+
public string Status { get; set;}
28+
}
29+
List<PersonData> EmailData = new List<PersonData> {
30+
new PersonData() { Name="Selma Rose", EmailId="selma@gmail.com" },
31+
new PersonData() { Name="Russo Kay", EmailId="russo@gmail.com" },
32+
new PersonData() { Name="Camden Kate", EmailId="camden@gmail.com" },
33+
new PersonData() { Name="Garth", EmailId="garth@gmail.com" },
34+
new PersonData() { Name="Ursula Ann", EmailId="ursula@gmail.com" },
35+
};
36+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
@using Syncfusion.Blazor.DropDowns
2+
@using Syncfusion.Blazor.RichTextEditor
3+
4+
5+
<SfRichTextEditor ID="mentionIntegration">
6+
7+
<p>Hello
8+
<span contenteditable="false" class="e-mention-chip"><a href="mailto:maria@gmail.com" title="maria@gmail.com">@@Maria</a></span>
9+
</p>
10+
<p>Welcome to the mention integration with rich text editor demo. Type <code>@@</code> character and tag user from the suggestion list. </p>
11+
</SfRichTextEditor>
12+
13+
<div id="mention_integration">
14+
<SfMention TItem="PersonData" Target="#mentionIntegration_rte-editable" DataSource="@EmailData" SuggestionCount="5">
15+
<ChildContent>
16+
<MentionFieldSettings Text="Name"></MentionFieldSettings>
17+
</ChildContent>
18+
</SfMention>
19+
</div>
20+
21+
@code {
22+
public class PersonData
23+
{
24+
public string Name { get; set; }
25+
public string EmailId { get; set; }
26+
public string EmployeeImage { get; set;}
27+
public string Status { get; set;}
28+
}
29+
List<PersonData> EmailData = new List<PersonData> {
30+
new PersonData() { Name="Selma Rose", EmailId="selma@gmail.com" },
31+
new PersonData() { Name="Russo Kay", EmailId="russo@gmail.com" },
32+
new PersonData() { Name="Camden Kate", EmailId="camden@gmail.com" },
33+
new PersonData() { Name="Garth", EmailId="garth@gmail.com" },
34+
new PersonData() { Name="Ursula Ann", EmailId="ursula@gmail.com" },
35+
new PersonData() { Name="Margaret", EmailId="margaret@gmail.com" },
36+
new PersonData() { Name="Laura Grace", EmailId="laura@gmail.com" },
37+
new PersonData() { Name="Robert", EmailId="robert@gmail.com" },
38+
new PersonData() { Name="Albert", EmailId="albert@gmail.com" },
39+
new PersonData() { Name="Michale", EmailId="michale@gmail.com" },
40+
new PersonData() { Name="Andrew James", EmailId="james@gmail.com" },
41+
new PersonData() { Name="William", EmailId="william@gmail.com" }
42+
};
43+
}

0 commit comments

Comments
 (0)