Merge pull request #4560 from tgxworld/optional_title_for_emoji_widget
Make title attribute on emoji widget optional.
This commit is contained in:
commit
6397d935ce
|
@ -92,7 +92,11 @@ class PluginApi {
|
||||||
if (result.icon) {
|
if (result.icon) {
|
||||||
iconBody = iconNode(result.icon);
|
iconBody = iconNode(result.icon);
|
||||||
} else if (result.emoji) {
|
} else if (result.emoji) {
|
||||||
iconBody = result.emoji.split('|').map(name => dec.attach('emoji', { name }));
|
iconBody = result.emoji.split('|').map(name => {
|
||||||
|
let widgetAttrs = { name };
|
||||||
|
if (result.title) widgetAttrs.title = true;
|
||||||
|
dec.attach('emoji', widgetAttrs);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.text) {
|
if (result.text) {
|
||||||
|
|
|
@ -11,6 +11,8 @@ export default createWidget('emoji', {
|
||||||
tagName: 'img.emoji',
|
tagName: 'img.emoji',
|
||||||
|
|
||||||
buildAttributes(attrs) {
|
buildAttributes(attrs) {
|
||||||
return { src: emojiUrlFor(attrs.name), title: attrs.name, alt: `:${attrs.name}:` };
|
let result = { src: emojiUrlFor(attrs.name), alt: `:${attrs.name}:` };
|
||||||
|
if (attrs.title) result.title = attrs.name;
|
||||||
|
return result;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue