Update quotes to render emoji just like normal messages
This commit is contained in:
parent
a7d44d3344
commit
21713cbce7
5 changed files with 52 additions and 8 deletions
|
@ -1101,11 +1101,7 @@
|
||||||
message.quotedMessage = this.quotedMessage;
|
message.quotedMessage = this.quotedMessage;
|
||||||
this.quoteHolder = message;
|
this.quoteHolder = message;
|
||||||
|
|
||||||
const props = Object.assign({}, message.getPropsForQuote(), {
|
const props = message.getPropsForQuote();
|
||||||
onClose: () => {
|
|
||||||
this.setQuoteMessage(null);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
this.listenTo(message, 'scroll-to-message', this.scrollToMessage);
|
this.listenTo(message, 'scroll-to-message', this.scrollToMessage);
|
||||||
|
|
||||||
|
@ -1117,7 +1113,12 @@
|
||||||
this.quoteView = new Whisper.ReactWrapperView({
|
this.quoteView = new Whisper.ReactWrapperView({
|
||||||
className: 'quote-wrapper',
|
className: 'quote-wrapper',
|
||||||
Component: window.Signal.Components.Quote,
|
Component: window.Signal.Components.Quote,
|
||||||
props,
|
props: Object.assign({}, props, {
|
||||||
|
text: props.text ? window.emoji.signalReplace(props.text) : null,
|
||||||
|
onClose: () => {
|
||||||
|
this.setQuoteMessage(null);
|
||||||
|
},
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
const selector = storage.get('theme-setting') === 'ios'
|
const selector = storage.get('theme-setting') === 'ios'
|
||||||
|
|
|
@ -405,7 +405,9 @@
|
||||||
this.quoteView = new Whisper.ReactWrapperView({
|
this.quoteView = new Whisper.ReactWrapperView({
|
||||||
className: 'quote-wrapper',
|
className: 'quote-wrapper',
|
||||||
Component: window.Signal.Components.Quote,
|
Component: window.Signal.Components.Quote,
|
||||||
props,
|
props: Object.assign({}, props, {
|
||||||
|
text: props.text ? window.emoji.signalReplace(props.text) : null,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
this.$('.inner-bubble').prepend(this.quoteView.el);
|
this.$('.inner-bubble').prepend(this.quoteView.el);
|
||||||
},
|
},
|
||||||
|
|
|
@ -34,6 +34,39 @@ const View = Whisper.MessageView;
|
||||||
</util.ConversationContext>
|
</util.ConversationContext>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### With emoji
|
||||||
|
|
||||||
|
```jsx
|
||||||
|
const outgoing = new Whisper.Message({
|
||||||
|
type: 'outgoing',
|
||||||
|
body: 'About 🔥six🔥',
|
||||||
|
sent_at: Date.now() - 18000000,
|
||||||
|
quote: {
|
||||||
|
text: 'How many 🔥ferrets🔥 do you have? ',
|
||||||
|
author: '+12025550011',
|
||||||
|
id: Date.now() - 1000,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const incoming = new Whisper.Message(Object.assign({}, outgoing.attributes, {
|
||||||
|
source: '+12025550011',
|
||||||
|
type: 'incoming',
|
||||||
|
quote: Object.assign({}, outgoing.attributes.quote, {
|
||||||
|
author: '+12025550005',
|
||||||
|
}),
|
||||||
|
}));
|
||||||
|
const View = Whisper.MessageView;
|
||||||
|
<util.ConversationContext theme={util.theme}>
|
||||||
|
<util.BackboneWrapper
|
||||||
|
View={View}
|
||||||
|
options={{ model: incoming }}
|
||||||
|
/>
|
||||||
|
<util.BackboneWrapper
|
||||||
|
View={View}
|
||||||
|
options={{ model: outgoing }}
|
||||||
|
/>
|
||||||
|
</util.ConversationContext>
|
||||||
|
```
|
||||||
|
|
||||||
#### Replies to you or yourself
|
#### Replies to you or yourself
|
||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
|
|
|
@ -113,7 +113,7 @@ export class Quote extends React.Component<Props, {}> {
|
||||||
const { i18n, text, attachments } = this.props;
|
const { i18n, text, attachments } = this.props;
|
||||||
|
|
||||||
if (text) {
|
if (text) {
|
||||||
return <div className="text">{text}</div>;
|
return <div className="text" dangerouslySetInnerHTML={{ __html: text}} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!attachments || attachments.length === 0) {
|
if (!attachments || attachments.length === 0) {
|
||||||
|
|
|
@ -206,3 +206,11 @@ parent.textsecure.storage.user.getNumber = () => ourNumber;
|
||||||
// Telling Lodash to relinquish _ for use by underscore
|
// Telling Lodash to relinquish _ for use by underscore
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
_.noConflict();
|
_.noConflict();
|
||||||
|
|
||||||
|
parent.emoji.signalReplace = (html: string): string => {
|
||||||
|
return html.replace(
|
||||||
|
/🔥/g,
|
||||||
|
'<img src="node_modules/emoji-datasource-apple/img/apple/64/1f525.png"' +
|
||||||
|
'class="emoji" data-codepoints="1f525" title=":fire:">'
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue