Please contact IBM if you require support.
Note for backwards compatibility some global functions are available that provide some of the same functionality but they may be removed in future releases so please do not use them.
API
The WCM integration API is loaded at the ephox.wcm.api
namespace and provides all the functionality needed to access the editors.
Each of the following functions should be prefixed by ephox.wcm.api
.
var editor = ephox.wcm.api.getEditor(wcmEditorId); editor.insertHtmlAtCursor("<strong>Hello world</strong>");
Name | Parameters | Returns | Description |
---|---|---|---|
getEditor | String id | Editor | The Editor with the specific Id. |
getEditors | none | Array | An array of available Editors. |
getEditorMap | none | Object | A map with the available editors and their Ids. |
anyEditorsDirty | none | boolean | A boolean value indicating if any of the available editors is dirty. |
Editor
The Editor object represents an instance of a rich content editor and provides methods to interact with its contents.
Name | Parameters | Returns | Description |
---|---|---|---|
getId | none | String | The editor id. |
getBody | none | String | Get the body element of the editor. |
setBody | String html | void | Set the body element inside the editor. |
insertHtmlAtCursor | String html | void | Insert the string passed as HTML in the position of the cursor |
getSelection | none | Selection | Get the Selection object of the editor. |
getDirection | none | String | Get the direction of the editor. |
isDirty | none | Boolean | A boolean value indicating if there has been any changes in the editor content. |
Legacy API
These global functions are provided for backwards compatibility, but should be avoided in favor of the current API as they may be removed in future versions.
These global functions should be avoided in favor of the current API as they may be removed in future versions.
Name | Parameters | Returns | Description |
---|---|---|---|
setHtml | String id String html | void | Set the passed HTML as the body of the editor with the matching Id. |
getHtml | String id | String | Get the HTML body of the editor with the matching Id. |
insertHtmlAtCursor | String id String html | void | Insert HTML content at the cursor position for the editor with the matching Id. |
getEditorSelection | String id | Selection | Get the Selection object of the editor with the matching Id. |
getDirection | String id | String | Get the text direction attribute value. |
runCallbackUsingEphoxSelectedText | Function callback Object parameters | void | Run a callback function with the selected text and a set of parameters |
getEphoxCallbackParameters | none | Object | Get the parameters set in the last callback |