Skip to main content

set-font-size

Description

Fires when setting a font size

Usage

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

Parameters

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

  • fontSize - a font size to be applied
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-size" event
editor.api.on("set-font-size", (obj) => {
console.log(obj.fontSize);
console.log("The font size was changed");
});
// apply new font size
editor.api.exec("set-font-size", {
fontSize: "11px"
});

Change log: The event was added in v2.0