0

I'm trying to identify where I could find this information but I've not been able til the present moment, to achieve it.

I've been looking in core/block-editor and core/editor. I've been researching in the data modules reference with no success.

Can someone point me to the right direction? I'll use it in the edit.js of a block plugin as a starting value of a FontFamilyControl component:

<FontFamilyControl>
  value={ buttonFontFamily || fontFamily }
  onChange={ ( newFontFamily ) => {
    setAttributes({ buttonFontFamily: newFontFamily })
  } }
</FontFamilyControl>

1 Answer 1

0

It turns out that it wasn't really needed to find the default font as an empty string is interpreted as the default font. I just did it this way:

<FontFamilyControl>
  value={ buttonFontFamily || '' }
  onChange={ ( newFontFamily ) => {
    setAttributes({ buttonFontFamily: newFontFamily })
  } }
</FontFamilyControl>

Another important thing to notice here is that the FontFamilyControl component is not a public API in Gutemberg so I had to copy it from the Gutemberg source code and adapt it to work from inside my plugin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.