align
Description
Fires when text alignment is changed via the menubar/toolbar or Event Bus methods
Usage
"align": ({
align: "left" | "center" | "right" | "justify"
}) => boolean | void;
Parameters
The callback of the align event can take an object with the following parameter:
align
- a text alignment. You can specify one of the following values:"left" | "center" | "right" | "justify"
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 "align" event
editor.api.on("align", (obj) => {
console.log(`Align to: ${obj.align}`);
});
// align the text to the left
editor.api.exec("align", {
align: "left"
});
Change log: The event was added in v2.0