1
0
mirror of https://github.com/twitter/twemoji.git synced 2024-06-15 03:35:16 +00:00

Add custom template function

This commit is contained in:
nodegin 2017-07-14 13:13:32 +08:00 committed by GitHub
parent 55443d4b39
commit 1e72ee8631

View File

@ -37,6 +37,9 @@ var twemoji = (function (
// default class name, by default 'emoji'
className: 'emoji',
// template function for custom emoji wrapping
template: null,
// basic utilities / helpers to convert code points
// to JavaScript surrogates and vice versa
convert: {
@ -482,6 +485,9 @@ var twemoji = (function (
}
}
ret = ret.concat('>');
if (options.template) {
ret = options.template.call(null, ret)
}
}
}
return ret;
@ -551,6 +557,7 @@ var twemoji = (function (
ext: how.ext || twemoji.ext,
size: how.folder || toSizeSquaredAsset(how.size || twemoji.size),
className: how.className || twemoji.className,
template: how.template || twemoji.template,
onerror: how.onerror || twemoji.onerror
});
}
@ -587,4 +594,4 @@ var twemoji = (function (
return r.join(sep || '-');
}
}());
}());