Methods and Events
Instance Methods
Assuming that beePluginInstance
is the instance of your embedded BEE plugin, here are the methods you can call:
Method | Description |
---|---|
beePluginInstance.start(templateToLoad) |
Starts the editor, loading the templateToLoad JSON string with the template structure (if specified). If using the NPM package, you have additional options to pass here as defined on the NPM page. |
beePluginInstance.load(template) |
Loads the JSON template string specified in the template parameter. |
beePluginInstance.reload(template) |
Loads the JSON template string specified in the template parameter. Unlike beePluginInstance.load(template) , the reload method does not trigger a loading dialog. This method helps quickly reload a template seamlessly for specific use cases, such as using a custom undo/redo feature or injecting custom content in real-time. |
If you use a paid plan, you can hide the top toolbar and control the editor from your application’s user interface. For example, it’s up to you at that point to have buttons above or below the editor.
Here’s some useful methods for this scenario:
Method | Description |
---|---|
beePluginInstance.preview() |
Triggers the message preview behavior within the editor. |
beePluginInstance.togglePreview() |
Open/close the message preview behavior within the editor. |
beePluginInstance.toggleStructure() |
Controls the visibility of the structure outlines in the message editing portion of the editor. |
beePluginInstance.save() |
Invokes the onSave callback function. The plugin will pass two files to the function: a JSON file with the message structure (for later editing) and a ready-to-send HTML file. |
beePluginInstance.saveAsTemplate() |
Invokes the onSaveAsTemplate callback function. The plugin will pass to the function a JSON file with the message structure (for later editing). |
beePluginInstance.send() |
Invokes the onSend callback function. The plugin will pass to the function a ready-to-send HTML file. |
beePluginInstance. toggleMergeTagsPreview() |
Controls the visibility of sample content for merge tags in the message editing portion of the editor. |
Instance Events
The top toolbar displayed by default within the BEE editor contains buttons that trigger certain actions. These are the callbacks that are triggered when the buttons are clicked.
Event | Description | Returned values |
---|---|---|
onSave | Fired when the Save button is clicked. | JSON and HTML documents |
onSaveAsTemplate | Fired when “Save as template” is clicked. | JSON document |
onAutoSave | Fired automatically by BEE based on autosave configuration parameter value. |
JSON document |
onSend | Fired when the “Send a test button” is clicked. | HTML document |
onLoad | Fired when the JSON is loaded in the editor. | JSON document |
onError | Fired every time an error occurs. | Error message |
onPreview | Fired every time the preview button is pressed. | Status (Boolean) |
onTogglePreview | Fired every time the preview is opened or closed. | Status (Boolean) |
onChange | Fired every time a change on the message is performed. | Read More |
onComment | Fired every time a thread or comment changes. | Read More |