Skip to content

Commit 1e50d2a

Browse files
Integrated latest changes at 12-11-2025 10:30:26 AM
1 parent 7713907 commit 1e50d2a

File tree

1 file changed

+35
-3
lines changed

1 file changed

+35
-3
lines changed

ej2-javascript/rich-text-editor/smart-editing/mail-merge.md

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ To enable mail merge functionality, the Rich Text Editor toolbar is extended wit
2727
{% tabs %}
2828
{% highlight ts tabtitle="app.ts" %}
2929

30+
{% raw %}
31+
3032
const mailMergeEditor: RichTextEditor = new RichTextEditor({
3133
toolbarSettings: {
3234
items: [
@@ -40,6 +42,8 @@ const mailMergeEditor: RichTextEditor = new RichTextEditor({
4042
});
4143
mailMergeEditor.appendTo('#mailMergeEditor');
4244

45+
{% endraw %}
46+
4347
{% endhighlight %}
4448
{% endtabs %}
4549

@@ -48,6 +52,8 @@ mailMergeEditor.appendTo('#mailMergeEditor');
4852
{% tabs %}
4953
{% highlight js tabtitle="index.js" %}
5054

55+
{% raw %}
56+
5157
var mailMergeEditor = new ej.richtexteditor.RichTextEditor({
5258
toolbarSettings: {
5359
items: [
@@ -61,6 +67,8 @@ var mailMergeEditor = new ej.richtexteditor.RichTextEditor({
6167
});
6268
mailMergeEditor.appendTo('#mailMergeEditor');
6369

70+
{% endraw %}
71+
6472
{% endhighlight %}
6573
{% endtabs %}
6674
{% endif %}
@@ -74,6 +82,8 @@ The **DropDownButton** component displays a list of merge fields such as First N
7482
{% tabs %}
7583
{% highlight ts tabtitle="app.ts" %}
7684

85+
{% raw %}
86+
7787
let insertField: DropDownButton = new DropDownButton({
7888
items: [
7989
{ text: 'First Name' },
@@ -100,6 +110,8 @@ function onItemSelect(args: MenuEventArgs): void {
100110
);
101111
}
102112

113+
{% endraw %}
114+
103115
{% endhighlight %}
104116
{% endtabs %}
105117

@@ -108,6 +120,8 @@ function onItemSelect(args: MenuEventArgs): void {
108120
{% tabs %}
109121
{% highlight js tabtitle="index.js" %}
110122

123+
{% raw %}
124+
111125
var insertField = new ej.splitbuttons.DropDownButton({
112126
items: [
113127
{ text: 'First Name' },
@@ -139,6 +153,8 @@ function onItemSelect(args) {
139153
}
140154
}
141155

156+
{% endraw %}
157+
142158
{% endhighlight %}
143159
{% endtabs %}
144160
{% endif %}
@@ -152,10 +168,12 @@ The **Mention** control provides an alternative way to insert placeholders by ty
152168
{% tabs %}
153169
{% highlight ts tabtitle="app.ts" %}
154170

171+
{% raw %}
172+
155173
const mentionObj: Mention = new Mention({
156174
dataSource: mergeData,
157175
target: '#mailMergeEditor',
158-
mentionChar: <code>&#123;&#123;</code>,
176+
mentionChar: `{{`,
159177
fields: { text: 'text' },
160178
allowSpaces: true,
161179
popupWidth: '250px',
@@ -164,6 +182,8 @@ const mentionObj: Mention = new Mention({
164182
});
165183
mentionObj.appendTo('#mentionField');
166184

185+
{% endraw %}
186+
167187
{% endhighlight %}
168188
{% endtabs %}
169189

@@ -172,18 +192,22 @@ mentionObj.appendTo('#mentionField');
172192
{% tabs %}
173193
{% highlight js tabtitle="index.js" %}
174194

195+
{% raw %}
196+
175197
var mergeObj = new ej.dropdowns.Mention({
176198
dataSource: mergeData,
177199
fields: { text: 'Name', value: 'Field' },
178200
displayTemplate: '<span>{{${Field}}}</span>',
179201
popupWidth: '250px',
180202
popupHeight: '200px',
181203
target: mailMergeEditor.inputElement,
182-
mentionChar: <code>&#123;&#123;</code> ,
204+
mentionChar: `{{` ,
183205
allowSpaces: true,
184206
});
185207
mergeObj.appendTo('#mentionField');
186208

209+
{% endraw %}
210+
187211
{% endhighlight %}
188212
{% endtabs %}
189213
{% endif %}
@@ -195,7 +219,9 @@ When the **Merge Data** button is clicked, the editor content is processed to re
195219
{% if page.publishingplatform == "typescript" %}
196220

197221
{% tabs %}
198-
{% highlight %}
222+
{% highlight ts tabtitle="app.ts" %}
223+
224+
{% raw %}
199225

200226
document.getElementById('merge_data')?.addEventListener('click', onClickHandler);
201227

@@ -209,6 +235,8 @@ function replacePlaceholders(template: string, data: { [key: string]: string }):
209235
return template.replace(/{{\s*(\w+)\s*}}/g, (match, key) => data[key.trim()] || match);
210236
}
211237

238+
{% endraw %}
239+
212240
{% endhighlight %}
213241
{% endtabs %}
214242

@@ -217,6 +245,8 @@ function replacePlaceholders(template: string, data: { [key: string]: string }):
217245
{% tabs %}
218246
{% highlight js tabtitle="index.js" %}
219247

248+
{% raw %}
249+
220250
var mergeField = document.getElementById('merge_data');
221251
if (mergeField) {
222252
mergeField.addEventListener('click', onClickHandler);
@@ -242,6 +272,8 @@ function replacePlaceholders(template, data) {
242272
});
243273
}
244274

275+
{% endraw %}
276+
245277
{% endhighlight %}
246278
{% endtabs %}
247279
{% endif %}

0 commit comments

Comments
 (0)