api.intercept()
Description
Allows intercepting and preventing the inner events
Usage
api.intercept(
event: string,
callback: function
): void;
Parameters
event
- (required) an event to be firedcallback
- (required) a callback to be performed (the callback arguments will depend on the event to be fired)
Events
info
The full list of RichText internal events can be found here
Example
// create RichText
const editor = new richtext.Richtext("#root", {
// configuration properties
});
// forbid changing the font size
editor.api.intercept("set-font-size", (obj) => {
if(obj.fontSize !== "36px" ){
return false;
}
});
Change log: The method was added in v2.0