Skip to main content

set-font-family

Description

Fires when setting a font family

Usage

"set-font-family": ({ fontFamily: string }) => boolean | void;

Parameters

The callback of the set-font-family event can take an object with the following parameter:

  • fontFamily - a font family to be applied. The following fonts are available: "Roboto" | "Arial" | "Georgia" | "Tahoma" | "Times New Roman" | "Verdana"
info

For handling inner events you can use Event Bus methods

Example

// initialize RichText
const editor = new richtext.Richtext("#root", {
// configuration properties
});
// subscribe to the "set-font-family" event
editor.api.on("set-font-family", (obj) => {
console.log(obj.fontFamily);
console.log("The font family was changed");
});
// apply new font family
editor.api.exec("set-font-family", {
fontFamily: "Roboto"
});

Change log: The event was added in v2.0