export
Description
Fires after pressing the "Export" option in the menubar or via Event Bus methods
Usage
"export": ({ options: IExportOptions; result?: any }) => boolean | void;
interface IExportOptions {
format?: "docx" | "pdf";
url?: string;
download?: boolean;
fileName?: string;
}
Parameters
The callback of export event can take an object with the following parameters:
format
- a file formaturl
- a base URL for file exportdownload
- allows a user to specify if he wants to download the file after receiving the response back from the server. If the property is set to "false", the file will not download, but the user will instead be able to get blob data from the event object (see theresult
prop in the event definition)fileName
- a file name to be exported
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 "export" event
editor.api.on("export", (obj) => {
console.log(obj);
console.log("The file was exported");
});
// export value as pdf file
editor.api.exec("export", {
format: "pdf",
download: false,
fileName: "some file"
});
Change log: The event was added in v2.0