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

Paragraph extends Element

The API model used to edit paragraphs.

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 paragraph = editor.getAPIModelById('id');
paragraph.append('<span>TEXT</span>');

prepend(html)

  • html <String> HTML String to append.

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.

IF ALL ELEMENTS ARE REMOVED, ERRORS MAY OCCUR IN SUBSEQUENT OPERATIONS.

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

replace(html)

  • html <String> The HTML String to replace.

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)

  • value <String> tagName ('P', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6')

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)

  • text <String> Text string to set in the paragraph

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.');
  • No labels