insert-image
Description
Fires when inserting image
Usage
"insert-image": (IImageContext) => boolean | void;
interface IImageContext {
id: TID;
value: string;
width: number;
height: number;
// extra props from uploader ctx, not required for the actual action
name?: string;
file?: File;
status?: string;
selected: (ctx: IImageContext) => void;
uploaded: (ctx: IImageContext) => void;
}
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 "insert-image" event
editor.api.on("insert-image", (obj) => {
console.log(obj);
console.log("The image was inserted");
});
Change log: The event was added in v2.0