set-text-style
Description
Fires when setting a text style
Usage
"set-text-style": ({ tag: TBlockType }) => boolean | void;
type TBlockType = "p" | "blockquote" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
Parameters
The callback of the set-text-style event can take an object with the following parameters:
tag
- a text style
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-text-style" event
editor.api.on("set-text-style", (obj) => {
console.log(obj.tag);
console.log("The text style was changed");
});
// apply new text style
editor.api.exec("set-text-style", {
tag: "blockquote"
});
Change log: The event was added in v2.0