Replace "Forwarded from" with an icon.
This commit is contained in:
+20
-1
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user