Issue #1940Opened April 2, 2019by ankitjainOfficial3 reactions

[QUESTION] Add custom font

Question

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.

Answers (3)

artfApril 3, 20193 reactions

Try using this editor.StyleManager.getProperty('typography', 'font-family')

workadevApril 12, 20190 reactions

Hi @ankitjainOfficial, I'm new to this so can you please help me how to add some Google fonts in detail? Thanks in advance.

lock[bot]April 15, 20200 reactions

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.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.