Skip to content

Commit d3c7ab2

Browse files
authored
Merge pull request #7189 from syncfusion-content/945108-HF-stagi-fail
945108: Staging Failure Resolved
2 parents 8416b93 + 8263882 commit d3c7ab2

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

blazor/rich-text-editor/mail-merge.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ control: RichTextEditor
77
documentation: ug
88
---
99

10-
# Mail Merge in Blazor Rich Text Editor
10+
# Mail merge in Blazor Rich Text Editor Control
1111

12-
The Mail Merge feature in Blazor Rich Text Editor enables developers to create dynamic, personalized documents by inserting placeholders (merge fields) into the editor content. These placeholders are later replaced with actual data at runtime, making it ideal for generating letters, invoices, and bulk communication templates.
12+
The Mail merge feature in Blazor Rich Text Editor enables developers to create dynamic, personalized documents by inserting placeholders (merge fields) into the editor content. These placeholders are later replaced with actual data at runtime, making it ideal for generating letters, invoices, and bulk communication templates.
1313

14-
## Rendering Custom Toolbar Items
14+
## Rendering custom toolbar items
1515

1616
Custom toolbar items are added using the [RichTextEditorCustomToolbarItems](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.RichTextEditor.RichTextEditorCustomToolbarItems.html) tag. Each item is defined with:
1717

@@ -46,11 +46,11 @@ Custom toolbar items are added using the [RichTextEditorCustomToolbarItems](http
4646
{% endhighlight %}
4747
{% endtabs %}
4848

49-
## Populating and Using Insert Field Dropdown
49+
## Populating and using insert field dropdown
5050

5151
The `Insert Field` dropdown in the Rich Text Editor is designed to let users quickly insert predefined merge fields into the editor content. This dropdown is powered by the `SfDropDownButton` control, which uses its [Items](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SplitButtons.SfDropDownButton.html#Syncfusion_Blazor_SplitButtons_SfDropDownButton_Items) property to bind a collection of menu items.
5252

53-
### How the Items Property Works
53+
### How the items property works
5454

5555
- The `Items` property accepts a list of [DropDownMenuItem](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SplitButtons.DropDownMenuItem.html) objects.
5656
- Each item in this list represents a merge field and contains a [Text](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SplitButtons.DropDownMenuItem.html#Syncfusion_Blazor_SplitButtons_DropDownMenuItem_Text) property, which is displayed in the dropdown.
@@ -92,20 +92,22 @@ When the user selects an item from the dropdown:
9292
- The snippet is inserted at the current cursor position using [ExecuteCommandAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.RichTextEditor.SfRichTextEditor.html#Syncfusion_Blazor_RichTextEditor_SfRichTextEditor_ExecuteCommandAsync_Syncfusion_Blazor_RichTextEditor_CommandName_System_String_Syncfusion_Blazor_RichTextEditor_ExecuteCommandOption_).
9393

9494
```csharp
95+
{% raw %}
9596
public async Task OnItemSelect(MenuEventArgs args)
9697
{
9798
if (args.Item.Text != null)
9899
{
99100
var value = _mergeData.FirstOrDefault(md => md.Text == args.Item.Text)?.Value;
100-
string htmlContent = $"<span contenteditable=\"false\" class=\"e-mention-chip\"><span>{{{{{value}}}}}</span></span> ";
101+
string htmlContent = $"<span contenteditable=\"false\" class=\"e-mention-chip\"><span>{{{{{value}}}}}</span></span>";
101102
var undoOption = new ExecuteCommandOption { Undo = true };
102103
this._mailMergeEditor.ExecuteCommandAsync(CommandName.InsertHTML, htmlContent, undoOption);
103104
await this._mailMergeEditor.SaveSelectionAsync();
104105
}
105106
}
107+
{% endraw %}
106108
```
107109

108-
## Role of Mention Control in Mail Merge
110+
## Role of Mention control in mail merge
109111

110112
Mention control enhances usability by enabling inline field suggestions:
111113

@@ -118,7 +120,9 @@ Mention control enhances usability by enabling inline field suggestions:
118120

119121
<SfMention DataSource="_mergeData" TItem="MergeData" Target="#_mailMergeEditor" MentionChar="_mentionChar" AllowSpaces="true" PopupWidth='250px' PopupHeight='200px' @ref="mentionObj">
120122
<DisplayTemplate>
121-
<span>{{@((context as MergeData).Value)}}</span>
123+
{% raw %}
124+
<span>@((context as MergeData).Value)</span>
125+
{% endraw %}
122126
</DisplayTemplate>
123127
<ChildContent>
124128
<MentionFieldSettings Text="Text"></MentionFieldSettings>
@@ -130,7 +134,7 @@ Mention control enhances usability by enabling inline field suggestions:
130134

131135
This feature is ideal for users who prefer keyboard-driven workflows.
132136

133-
## Maintaining Cursor Position During Dropdown Operations
137+
## Maintaining cursor position during dropdown operations
134138

135139
When the `Insert Field` dropdown opens, the editor loses its current selection because focus shifts to the popup. To ensure the placeholder is inserted at the correct position:
136140

@@ -156,7 +160,7 @@ When the `Insert Field` dropdown opens, the editor loses its current selection b
156160
}
157161
```
158162

159-
## Handling Editor Mode Changes with OnActionComplete
163+
## Handling editor mode changes with OnActionComplete
160164

161165
The [OnActionComplete](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.RichTextEditor.RichTextEditorEvents.html#Syncfusion_Blazor_RichTextEditor_RichTextEditorEvents_OnActionComplete) event fires after specific actions in the RichTextEditor, such as switching between Source Code and Preview modes.
162166

@@ -183,7 +187,7 @@ The [OnActionComplete](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.R
183187

184188
**Why is this important?** This prevents users from triggering merge operations or inserting fields while editing raw HTML, which could cause unexpected behavior.
185189

186-
## Executing Merge Data Action
190+
## Executing merge data action
187191

188192
When the `Merge Data` button is clicked:
189193

@@ -192,7 +196,7 @@ When the `Merge Data` button is clicked:
192196
- Each placeholder is replaced with its corresponding value from a dictionary.
193197

194198
```csharp
195-
199+
{% raw %}
196200
public void OnClickHandler()
197201
{
198202
if (this._mailMergeEditor != null)
@@ -202,15 +206,16 @@ When the `Merge Data` button is clicked:
202206
_rteValue = mergedContent;
203207
}
204208
}
205-
public static string ReplacePlaceholders(string template, Dictionary<string, string> data)
209+
210+
public static string ReplacePlaceholders(string template, Dictionary<string, string> data)
206211
{
207212
return Regex.Replace(template, @"{{\s*(\w+)\s*}}", match =>
208213
{
209214
string key = match.Groups[1].Value.Trim();
210215
return data.TryGetValue(key, out var value) ? value : match.Value;
211216
});
212217
}
213-
218+
{% endraw %}
214219
```
215220
This ensures all placeholders are dynamically replaced without manual editing.
216221

@@ -222,6 +227,6 @@ This ensures all placeholders are dynamically replaced without manual editing.
222227

223228
![Blazor RichTextEditor Mail Merge](./images/blazor-richtexteditor-mail-merge.png)
224229

225-
## Related Resources
230+
## Related resources
226231

227-
[Mention Control Guide](https://blazor.syncfusion.com/documentation/mention/getting-started-webapp)
232+
[Mention Control Guide](https://blazor.syncfusion.com/documentation/mention/getting-started-webapp)

blazor/rich-text-editor/code-snippet/nesting-table.razor renamed to blazor/rich-text-editor/tools/code-snippet/nesting-table.razor

File renamed without changes.

0 commit comments

Comments
 (0)