|
19 | 19 |
|
20 | 20 | window.Whisper = window.Whisper || {}; |
21 | 21 |
|
22 | | - const URL_REGEX = /(^|[\s\n]|<br\/?>)((?:https?|ftp):\/\/[-A-Z0-9\u00A0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFFD+\u0026\u2019@#/%?=()~_|!:,.;]*[-A-Z0-9+\u0026@#/%=~()_|])/gi; |
23 | | - |
24 | 22 | const ErrorIconView = Whisper.View.extend({ |
25 | 23 | templateName: 'error-icon', |
26 | 24 | className: 'error-icon-container', |
|
440 | 438 | className: 'quote-wrapper', |
441 | 439 | Component: window.Signal.Components.Quote, |
442 | 440 | props: Object.assign({}, props, { |
443 | | - text: props.text ? window.emoji.signalReplace(props.text) : null, |
| 441 | + text: props.text, |
444 | 442 | }), |
445 | 443 | }); |
446 | 444 | this.$('.inner-bubble').prepend(this.quoteView.el); |
|
566 | 564 | const hasAttachments = attachments && attachments.length > 0; |
567 | 565 | const hasBody = this.hasTextContents(); |
568 | 566 |
|
| 567 | + const messageBody = this.model.get('body'); |
| 568 | + |
569 | 569 | this.$el.html( |
570 | 570 | Mustache.render( |
571 | 571 | _.result(this, 'template', ''), |
572 | 572 | { |
573 | | - message: this.model.get('body'), |
| 573 | + message: Boolean(messageBody), |
574 | 574 | hasBody, |
575 | 575 | timestamp: this.model.get('sent_at'), |
576 | 576 | sender: (contact && contact.getTitle()) || '', |
|
589 | 589 |
|
590 | 590 | this.renderControl(); |
591 | 591 |
|
592 | | - const body = this.$('.body'); |
593 | | - |
594 | | - emoji_util.parse(body); |
595 | | - |
596 | | - if (body.length > 0) { |
597 | | - const escapedBody = body.html(); |
598 | | - body.html( |
599 | | - escapedBody |
600 | | - .replace(/\n/g, '<br>') |
601 | | - .replace(URL_REGEX, "$1<a href='$2' target='_blank'>$2</a>") |
602 | | - ); |
| 592 | + if (messageBody) { |
| 593 | + if (this.bodyView) { |
| 594 | + this.bodyView.remove(); |
| 595 | + this.bodyView = null; |
| 596 | + } |
| 597 | + this.bodyView = new Whisper.ReactWrapperView({ |
| 598 | + className: 'body-wrapper', |
| 599 | + Component: window.Signal.Components.MessageBody, |
| 600 | + props: { |
| 601 | + text: messageBody, |
| 602 | + }, |
| 603 | + }); |
| 604 | + this.$('.body').append(this.bodyView.el); |
603 | 605 | } |
604 | 606 |
|
605 | 607 | this.renderSent(); |
|
0 commit comments