Paragraph extends Element

The API model used to edit paragraphs.

Methods

append(html)

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

var paragraph = editor.getAPIModelById('id');
paragraph.append('<span>TEXT</span>');

prepend(html)

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

var paragraph = editor.getAPIModelById('id');
paragraph.prepend('<span>TEXT</span>');

remove()

Removes the Element itself.

var paragraph = editor.getAPIModelById('id');
paragraph.remove();

replace(html)

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

var paragraph = editor.getAPIModelById('id');
paragraph.replace('<p><span>Paragraph replaced</span></p>');

setHeading(value)

Set tagName to display paragraph.
ex) 'P', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6'

If a paragraph set as P tag is set to 'H1', it is changed to <H1> tag.

var paragraph = editor.getAPIModelById('id');
paragraph.setHeading('H1');

setText(text)

Set the text string value passed as an argument to the paragraph to Text.

var paragraph = editor.getAPIModelById('id');
paragraph.setText('This is what goes into the paragraph.');