Adds toolbar and addbar buttons for inserting merge tag blocks — non-editable placeholders for mail-merge style content (for example Name, Email).
Click Merge Tag in the toolbar or addbar and pick a tag. If the caret is already on a merge tag block, the selection updates that block instead.
<script src="/assets/redactor/redactor.js"></script>
<script src="/assets/redactor/plugins/mergetag/mergetag.js"></script>
const app = Redactor('#entry', {
plugins: ['mergetag']
});
string[])
['Name', 'Lastname', 'Email']string)
Redactor('#entry', {
plugins: ['mergetag'],
mergetag: {
items: ['First name', 'Last name', 'Email', 'Company']
}
});
en: {
mergetag: {
title: 'Merge Tag'
}
}
This plugin does not emit events.
Inserts a new merge tag block, or updates the current merge tag if the caret is on one.
Parameters:
content (string) — tag label.app.mergetag.add({ content: 'Email' });
Updates the content of the current merge tag block.
Parameters:
content (string) — new tag label.app.mergetag.set({ content: 'Company' });
Removes the current merge tag block.
app.mergetag.remove();