Commit d2074afe authored by JC Brand's avatar JC Brand

Document breaking changes to message transformation events

parent f9650f33
...@@ -3,7 +3,11 @@ ...@@ -3,7 +3,11 @@
## 8.0.0 (Unreleased) ## 8.0.0 (Unreleased)
- #1083: Add support for XEP-0393 Message Styling - #1083: Add support for XEP-0393 Message Styling
- New configuration setting: [allow_message_styling](https://conversejs.org/docs/html/configuration.html#allow-message-styling) instead. - New configuration setting: [](https://conversejs.org/docs/html/configuration.html#trusted) instead.
### Breaking Changes
The [afterMessageBodyTransformed](https://conversejs.org/docs/html/api/-_converse.html#event:afterMessageBodyTransformed) and [beforeMessageBodyTransformed](https://conversejs.org/docs/html/api/-_converse.html#event:beforeMessageBodyTransformed) events now has a different signatures.
## 7.0.2 (2020-11-23) ## 7.0.2 (2020-11-23)
......
...@@ -233,4 +233,4 @@ doc: node_modules docsdev apidoc ...@@ -233,4 +233,4 @@ doc: node_modules docsdev apidoc
PHONY: apidoc PHONY: apidoc
apidoc: apidoc:
$(JSDOC) --private --readme docs/source/jsdoc_intro.md -c docs/source/conf.json -d docs/html/api src/templates/directives/*.js src/components/*.js src/*.js src/utils/*.js src/headless/*.js src/headless/utils/*.js $(JSDOC) --private --readme docs/source/jsdoc_intro.md -c docs/source/conf.json -d docs/html/api src/templates/**/*.js src/*.js src/**/*.js src/headless/**/*.js src/shared/**/*.js
...@@ -36,14 +36,15 @@ export class MessageText extends String { ...@@ -36,14 +36,15 @@ export class MessageText extends String {
/** /**
* Create a new {@link MessageText} instance. * Create a new {@link MessageText} instance.
* @param { String } text - The plain text that was received from the `<message>` stanza. * @param { String } text - The plain text that was received from the `<message>` stanza.
* @param { Message } model * @param { Message } model - The model representing the message to which
* this MessageText instance belongs
* @param { Integer } offset - The offset of this particular piece of text * @param { Integer } offset - The offset of this particular piece of text
* from the start of the original message text. This is necessary because * from the start of the original message text. This is necessary because
* MessageText instances can be nested when templates call directives * MessageText instances can be nested when templates call directives
* which create new MessageText instances (as happens with XEP-393 styling directives). * which create new MessageText instances (as happens with XEP-393 styling directives).
* @param { Boolean } show_images - Whether image URLs should be rendered as <img> tags. * @param { Boolean } show_images - Whether image URLs should be rendered as <img> tags.
* @param { Function } onImgLoad * @param { Function } onImgLoad - Callback for when an inline rendered image has been loaded
* @param { Function } onImgClick * @param { Function } onImgClick - Callback for when an inline rendered image has been clicked
*/ */
constructor (text, model, offset=0, show_images, onImgLoad, onImgClick) { constructor (text, model, offset=0, show_images, onImgLoad, onImgClick) {
super(text); super(text);
...@@ -176,11 +177,9 @@ export class MessageText extends String { ...@@ -176,11 +177,9 @@ export class MessageText extends String {
* Synchronous event which provides a hook for transforming a chat message's body text * Synchronous event which provides a hook for transforming a chat message's body text
* before the default transformations have been applied. * before the default transformations have been applied.
* @event _converse#beforeMessageBodyTransformed * @event _converse#beforeMessageBodyTransformed
* @param { _converse.Message } model - The model representing the message
* @param { MessageText } text - A {@link MessageText } instance. You * @param { MessageText } text - A {@link MessageText } instance. You
* can call {@link MessageText#addTemplateResult } on it in order to * can call {@link MessageText#addTemplateResult } on it in order to
* add TemplateResult objects meant to render rich parts of the * add TemplateResult objects meant to render rich parts of the message.
* message.
* @example _converse.api.listen.on('beforeMessageBodyTransformed', (view, text) => { ... }); * @example _converse.api.listen.on('beforeMessageBodyTransformed', (view, text) => { ... });
*/ */
await api.trigger('beforeMessageBodyTransformed', this, {'Synchronous': true}); await api.trigger('beforeMessageBodyTransformed', this, {'Synchronous': true});
...@@ -205,11 +204,9 @@ export class MessageText extends String { ...@@ -205,11 +204,9 @@ export class MessageText extends String {
* Synchronous event which provides a hook for transforming a chat message's body text * Synchronous event which provides a hook for transforming a chat message's body text
* after the default transformations have been applied. * after the default transformations have been applied.
* @event _converse#afterMessageBodyTransformed * @event _converse#afterMessageBodyTransformed
* @param { _converse.Message } model - The model representing the message
* @param { MessageText } text - A {@link MessageText } instance. You * @param { MessageText } text - A {@link MessageText } instance. You
* can call {@link MessageText#addTemplateResult} on it in order to * can call {@link MessageText#addTemplateResult} on it in order to
* add TemplateResult objects meant to render rich parts of the * add TemplateResult objects meant to render rich parts of the message.
* message.
* @example _converse.api.listen.on('afterMessageBodyTransformed', (view, text) => { ... }); * @example _converse.api.listen.on('afterMessageBodyTransformed', (view, text) => { ... });
*/ */
await api.trigger('afterMessageBodyTransformed', this, {'Synchronous': true}); await api.trigger('afterMessageBodyTransformed', this, {'Synchronous': true});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment