blip-cards 3.62.0 → 3.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/blip-cards.css +1 -1
- package/dist/blip-cards.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -148,12 +148,15 @@ translation: {
|
|
|
148
148
|
direction: 'received' // optional, 'received' | 'sent'
|
|
149
149
|
}), // or null when there is no translation for the message
|
|
150
150
|
onTranslate: (fullDocument) => {}, // optional, may return a Promise; called by the "Traduzir"/"Tentar novamente" actions
|
|
151
|
+
onToggleOriginal: (fullDocument, showingOriginal) => {}, // optional; called when the footer action switches between the translation and the original (state "done")
|
|
151
152
|
canTranslate: (fullDocument) => true // optional, defaults to `position === 'left'` (received messages)
|
|
152
153
|
}
|
|
153
154
|
```
|
|
154
155
|
|
|
155
156
|
`fullDocument` is the original message envelope (`id`, `type`, `content`, ...).
|
|
156
157
|
|
|
158
|
+
`onToggleOriginal` is called only when the footer action is clicked in the `done` state, after the local toggle was applied, in both directions. `showingOriginal` is `true` when the bubble switched to the original content (for sent messages, the content actually sent) and `false` when it switched back to the translation. It is not called in the `translate`, `pending` or `error` states (those use `onTranslate` or nothing). Errors thrown or promises rejected by the callback are swallowed by the cards.
|
|
159
|
+
|
|
157
160
|
| Field returned by `getTranslation` | Replaces (while the translation is shown) |
|
|
158
161
|
|---|---|
|
|
159
162
|
| `text` | Plain text (`text/plain`) content, select header text, media caption (image and file `text`) and the text of a received reply (`application/vnd.lime.reply+json` with a `text/plain` replied value) |
|