Page tree
Skip to end of metadata
Go to start of metadata

Body extends Element

The API model used to edit the Body area. In Synap Editor, the body area is composed of <div class='se-contents'></div>.

Methods

append(html)

  • html <String> HTML String to append.

The HTML String passed as an argument is added as a child at the back of the Element.

var body = editor.getAPIModels('.se-contents')[0];
body.append('<p><span>APPEND TEXT</span></p>');

prepend(html)

  • html <String> HTML String to prepend.

The HTML String passed as an argument is added as a child to the front of the Element.

var body = editor.getAPIModels('.se-contents')[0];
body.prepend('<p><span>PREPEND TEXT</span></p>');

replace(html)

  • html <String> The HTML String to replace.

Replaces the element itself with the HTML String passed as an argument.

var body = editor.getAPIModels('.se-contents')[0];
body.replace('<p><span>Body replaced</span></p>');

setHTML(html)

  • html <String> HTML string to set

Sets the HTML string value passed as an argument to the body's internal HTML.

var body = editor.getAPIModels('.se-contents')[0];
body.setHTML('<p><span>Add HTML to the body. All previously entered information will be erased.</span></p>');

setText(text)

  • text <String> Text string to set

Set the text string value passed as an argument to the internal text of the body.

var body = editor.getAPIModels('.se-contents')[0];
body.setText('Add text to the body. All previously entered information will be erased.');
  • No labels