Converse converse.js

Class: MessageText

MessageText(text)

MessageText A String subclass that is used to represent the rich text of a chat message.

The "rich" parts of the text is represented by lit-html TemplateResult objects which are added via the MessageText.addTemplateResult method and saved as metadata.

By default Converse adds TemplateResults to support emojis, hyperlinks, images, map URIs and mentions.

3rd party plugins can listen for the beforeMessageBodyTransformed and/or afterMessageBodyTransformed events and then call addTemplateResult on the MessageText instance in order to add their own rich features.

Constructor

new MessageText(text)

Create a new MessageText instance.

Parameters:
Name Type Description
text String

The plain text that was received from the <message> stanza.

Source:

Methods

(static) addTemplateResult(begin, end, template)

The "rich" markup parts of a chat message are represented by lit-html TemplateResult objects.

This method can be used to add new template results to this message's text.

Parameters:
Name Type Description
begin Number

The starting index of the plain message text which is being replaced with markup.

end Number

The ending index of the plain message text which is being replaced with markup.

template Object

The lit-html TemplateResult instance

Source: