Hello,
I went through, the following GitHub issues: #857 #1622 #1215
Almost all of the issues, though a little different, provide a way to add font family to the list.
Most common way to tackle, as far as I've understood:
let styleManager = this.editor.StyleManager;
let typographySector = styleManager.getSector('Typography');
let fontProperty = styleManager.getProperty('Typography', 'font-family');
... Add fonts then
const styleManager = editor.StyleManager;
const fontProperty = styleManager.getProperty('Typography', 'font-family');
... Add fonts then
For both of this, I'm getting the typographySector and fontProperty as undefined. I don't know, if I'm doing something incorrect or, if I'm incorrectly implementing them.
Here's my snippet, of what I'm trying.
editor.on('load', () => {
const styleManager = editor.StyleManager;
const fontProperty = styleManager.getProperty('Typography', 'font-family');
const typographySector = styleManager.getSector('Typography');
console.log({fontProperty, typographySector}); // both are returned undefined
})
Thanks for putting your time on this.
Try using this editor.StyleManager.getProperty('typography', 'font-family')
Hi @ankitjainOfficial, I'm new to this so can you please help me how to add some Google fonts in detail? Thanks in advance.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Try using this
editor.StyleManager.getProperty('typography', 'font-family')