Adds toolbar and context buttons for inline font family. Applies font-family as a <span> style on the selected text, or maps fonts to CSS classes when classes is set.
Select text, click Font in the toolbar (before More), and pick a font from the dropdown. Use Remove font to clear formatting.
<script src="/assets/redactor/redactor.js"></script>
<script src="/assets/redactor/plugins/font-family/font-family.js"></script>
const app = Redactor('#entry', {
plugins: ['fontFamily']
});
string[] | false)
falsefalse uses the built-in list: Arial, Helvetica, Georgia, Times New Roman, monospace.string[] | false)
false<span> instead of an inline font-family style.string)
Redactor('#entry', {
plugins: ['fontFamily'],
fontFamily: {
items: ['Georgia', 'Times New Roman', 'Arial', 'Helvetica', 'monospace']
}
});
en: {
fontFamily: {
title: 'Font',
remove: 'Remove font'
}
}
This plugin does not emit events.
Applies font family formatting to the current selection and closes the dropdown. Pass the same params object used by app.inline.set.
app.fontFamily.set({ tag: 'span', styles: { 'font-family': 'Georgia' } });
Clears inline font family (or font classes in class mode) from the selection and closes the dropdown.
app.fontFamily.remove();