Replace "Forwarded from" with an icon.

This commit is contained in:
aforge
2021-09-23 20:07:21 +03:00
parent 3a7a806420
commit fb3fae8c9b
7 changed files with 41 additions and 17 deletions
+20 -1
View File
@@ -26,7 +26,7 @@ const messages = defineMessages({
id: 'drafty_image',
defaultMessage: 'Picture',
description: 'Comment for embedded images in drafty preview'
},
}
});
// Size the already scaled image.
@@ -393,3 +393,22 @@ export function replyFormatter(style, data, values, key) {
values = [React.createElement(LazyImage, attr, null), ' ', attr.alt];
return React.createElement(React.Fragment, {key: key}, values);
}
// Creates a "forward" icon fragment.
export function forwardedDecorator(context) {
return [<i key="fwd" className="material-icons">forward</i>];
}
// Returns a fully decorated ready for rendering representation of a drafty object.
export function formatDrafty(content, formatter, context, decorators) {
let tree = Drafty.format(content, formatter, context);
if (decorators) {
if (decorators.before) {
tree = decorators.before(context).concat(tree);
}
if (decorators.after) {
tree = tree.concat(decorators.after(context));
}
}
return tree;
}