formatting of forwarded messages previews

This commit is contained in:
or-else
2021-12-20 12:27:02 -08:00
parent b201f019ef
commit bd2def7882
8 changed files with 30 additions and 15 deletions
+8 -3
View File
@@ -389,18 +389,23 @@ function quoteImage(data) {
}
// Create a preview of a reply.
export function replyFormatter(style, data, values, key) {
export function replyFormatter(style, data, values, key, stack) {
if (style == 'IM') {
const attr = inlineImageAttr.call(this, {key: key}, data);
attr.whenDone = cancelablePromise(quoteImage.call(this, data));
values = [React.createElement(LazyImage, attr, null), ' ', attr.alt];
return React.createElement(React.Fragment, {key: key}, values);
} else if (style == 'QQ') {
let el = Drafty.tagName('QQ');
if (stack.includes('QQ')) {
// Quote inside quote when forwarding a message.
return React.createElement('span', {key: key},
[<i key="qq" className="material-icons">format_quote</i>, ' ']);
}
const attr = Drafty.attrValue('QQ', data) || {};
attr.key = key;
attr.className = 'reply-quote'
return React.createElement(el, attr, values);
return React.createElement(Drafty.tagName('QQ'), attr, values);
}
return quoteFormatter.call(this, style, data, values, key);
}
+1 -2
View File
@@ -82,12 +82,11 @@ class SendMessage extends React.PureComponent {
}
formatReply() {
const fmt = this.props.reply ?
return this.props.reply ?
Drafty.format(this.props.reply.content, replyFormatter, {
formatMessage: this.props.intl.formatMessage.bind(this.props.intl),
authorizeURL: this.props.tinode.authorizeURL.bind(this.props.tinode)
}) : null;
return fmt;
}
handlePasteEvent(e) {