Extending Textbox.io with Custom JavaScript
This topic outlines a generic extension point for custom JavaScript for use with Textbox.io within IBM Connections. It is designed for use by developers and integrators familiar with JavaScript development techniques.
Textbox extension point
Developers and integrators can customize and extend the functionality of Textbox.io using Textbox.io's JavaScript API. The extension point provides an instance of the editor object that represents the Textbox.io instance that is to be created within IBM Connections. The developer can use this object to call any of the functions available on the editor object within the Textbox.io API.
The extension point enables the developer to provide a JavaScript function that is executed immediately after the editor instance has been created by the integration but before it has been loaded into the page. Developers can specify arbitrary JavaScript in this function to customize Textbox.io. The editor object is passed in simply for convenience.
To make use of this extension point developers need to define their function in the postCreateTextboxio attribute of the integrationConfig object in the config/config.js file. When you open the config/config.js file you will see a blank template function available that you can populate with the code for your extension. The function receives the Textbox.io editor instance.
Ephox recommends that when developing extensions, you make your modifications to a copy of the Ephox Editors for IBM Connections deployment package. Once your customizations have been made, you can then rerun the deployment script provided with the integration to deploy your changes to the server, ensuring that you have a backup of code that's executing on the server. In some cases though, it can be useful to develop directly against the server, particularly when using a development or staging server. In this case you can follow the steps as described in Changing Customizations After Deployment.
postCreateTextboxio: function(editor) {
editor.macros.addSimpleMacro('[red]', '[/red]', function(match) {
return '<span style="color: red">' + match + '</span>';
});
}