Textbox.io for IBM WCM : API reference

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.

Example
var editor = ephox.wcm.api.getEditor(wcmEditorId);
editor.insertHtmlAtCursor("<strong>Hello world</strong>");
NameParametersReturnsDescription
getEditorString idEditorThe Editor with the specific Id.
getEditorsnoneArrayAn array of available Editors.
getEditorMapnoneObjectA map with the available editors and their Ids.
anyEditorsDirtynonebooleanA 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.

NameParametersReturnsDescription
getIdnoneStringThe editor id.
getBodynoneStringGet the body element of the editor.
setBodyString htmlvoidSet the body element inside the editor.
insertHtmlAtCursorString htmlvoidInsert the string passed as HTML in the position of the cursor
getSelectionnoneSelection

Get the Selection object of the editor.

getDirectionnoneStringGet the direction of the editor.
isDirtynoneBooleanA 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.

NameParametersReturnsDescription
setHtml

String id

String html

voidSet the passed HTML as the body of the editor with the matching Id.
getHtmlString idStringGet the HTML body of the editor with the matching Id.
insertHtmlAtCursor

String id

String html

voidInsert HTML content at the cursor position for the editor with the matching Id.
getEditorSelectionString idSelection

Get the Selection object of the editor with the matching Id.

getDirectionString idStringGet the text direction attribute value.
runCallbackUsingEphoxSelectedText

Function callback

Object parameters

voidRun a callback function with the selected text and a set of parameters
getEphoxCallbackParametersnoneObjectGet the parameters set in the last callback