Issue #2951💬 AnsweredOpened August 11, 2020by tasham161 reactions

Typography sector not found

Quick answerby mcottret1

Hi @tasham16 ! I think this is expected behaviour because modules are loaded after plugins in the editor's initialization sequence, & sectors are only added to the StyleManager module right after it has been loaded. I don't know if this is a very clean way of achieving it, but without a better solution you could try o...

Read full answer below ↓

Question

When using trying to add a font to the style manager, I use the following code: const prop = editor.StyleManager.getProperty('typography', 'font-family'); prop.set('options', [ {value: "'Oswald', sans-serif", name: 'Oswald'}, ... ]); However, when I use this inside a plugin (in the index.js) I am creating, I call it with editor.on('load',....) I keep getting 'typography' sector not found. However if I call it outside of the plugin (in the index.html) in the same way, where I am initializing the editor with all the configs, it works. So I was wondering, can we not add new fronts in a plugin so...

Answers (3)

mcottretAugust 21, 2020

Hi @tasham16 ! I think this is expected behaviour because modules are loaded after plugins in the editor's initialization sequence, & sectors are only added to the StyleManager module right after it has been loaded. I don't know if this is a very clean way of achieving it, but without a better solu...

tasham16August 25, 2020

Thank you so much! I will try that out!

artfAugust 28, 2020

The right way is to wait for the load of the editor

editor.on('load' => {
  const prop = editor.StyleManager...
})

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...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.