Hi, can someone please show me how to use the fontName extension to add a button which will change the font? I was unable to figure out how to use that extension.
Anyone?
Hi @THPubs :v:
It seems that fontname is a bult-in extension, so you can just override default toolbar options like this:
var editor = new MediumEditor('.editable', {
toolbar: {
buttons: [
'fontname'
]
}
});
Here is more complex example on JSFiddle: https://jsfiddle.net/ypcgaomL/2/
Cool is it possible to define the exact fonts we need?
Yep, you can do this.
var fontsList = ['', 'Arail', 'Open Sans', 'sans-serif', 'Your Font Name'];
var editor = new MediumEditor('.editable', {
toolbar: {
buttons: [{
name: 'fontname',
action: 'fontName',
aria: 'change font name',
contentDefault: '±', // 卤
contentFA: '<i class="fa fa-font"></i>',
fonts: fontsList
}]
}
});
Perfect thanks!
Thanks @geekiam !
@nmielnik you're welcome :wink:
Guys adding custom fonts seems to not work for me please help.
Most helpful comment
Yep, you can do this.