TextEditor.insertNode

Syntax

insertNode(node: Object)

Parameters

node. DOM node to be inserted to the text area.

Description

The insertNode method inserts a DOM node to the text area.

Example

To execute the example, the page must contain TextEditor component named textEditor (see  description of TextEditor constructor). Handle the text editor activity change event, set focus in the text area, create a button and position it in the text area, and next disable the text editor:

// Handle editor activity change event
textEditor.EnabledStateChanged.add(function (sender, args) {
    console.log("The EnabledStateChanged event initialized");
});
// Set focus in the text editor
textEditor.focus();
// Create a button and place it in a container
var b = new PP.Ui.Button({
    Content: "Button",
    Width: 80,
    Height: 30,
    ParentNode: document.getElementById("textEditorContainer")
})
// Position the button in the text area
textEditor.insertNode(b.getDomNode());
// Disable the editor
textEditor.setEnabled(false, true);

After executing the example a button is placed in the text area. Text editor becomes inactive:

The browser console displays a message that editor activity change event is fired:

EnabledStateChanged event initialized

See also:

TextEditor