Merge pull request #4560 from tgxworld/optional_title_for_emoji_widget

Make title attribute on emoji widget optional.
This commit is contained in:
Guo Xiang Tan 2016-11-21 06:17:44 +01:00 committed by GitHub
commit 6397d935ce
2 changed files with 8 additions and 2 deletions

View File

@ -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) {

View File

@ -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;
}, },
}); });