mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-23 21:23:08 +02:00
parent
d3ff3a7d54
commit
3b6ab327c1
4 changed files with 16 additions and 5 deletions
|
@ -41,11 +41,17 @@ const lib = Object.entries(emojilib.lib).filter((x: any) => {
|
|||
return x[1].category != 'flags';
|
||||
});
|
||||
|
||||
const char2file = (char: string) => {
|
||||
let codes = [...char].map(x => x.codePointAt(0).toString(16));
|
||||
if (!codes.includes('200d')) codes = codes.filter(x => x != 'fe0f');
|
||||
return codes.join('-');
|
||||
};
|
||||
|
||||
const emjdb: EmojiDef[] = lib.map((x: any) => ({
|
||||
emoji: x[1].char,
|
||||
name: x[0],
|
||||
aliasOf: null,
|
||||
url: `https://twemoji.maxcdn.com/2/svg/${x[1].char.codePointAt(0).toString(16)}.svg`
|
||||
url: `https://twemoji.maxcdn.com/2/svg/${char2file(x[1].char)}.svg`
|
||||
}));
|
||||
|
||||
lib.forEach((x: any) => {
|
||||
|
@ -55,7 +61,7 @@ lib.forEach((x: any) => {
|
|||
emoji: x[1].char,
|
||||
name: k,
|
||||
aliasOf: x[0],
|
||||
url: `https://twemoji.maxcdn.com/2/svg/${x[1].char.codePointAt(0).toString(16)}.svg`
|
||||
url: `https://twemoji.maxcdn.com/2/svg/${char2file(x[1].char)}.svg`
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -60,7 +60,10 @@ export default Vue.extend({
|
|||
}
|
||||
|
||||
if (this.char) {
|
||||
this.url = `https://twemoji.maxcdn.com/2/svg/${this.char.codePointAt(0).toString(16)}.svg`;
|
||||
let codes = [...this.char].map(x => x.codePointAt(0).toString(16));
|
||||
if (!codes.includes('200d')) codes = codes.filter(x => x != 'fe0f');
|
||||
|
||||
this.url = `https://twemoji.maxcdn.com/2/svg/${codes.join('-')}.svg`;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
2
src/mfm/parse/elements/emoji.regex.ts
Normal file
2
src/mfm/parse/elements/emoji.regex.ts
Normal file
File diff suppressed because one or more lines are too long
|
@ -2,6 +2,8 @@
|
|||
* Emoji
|
||||
*/
|
||||
|
||||
import { emojiRegex } from "./emoji.regex";
|
||||
|
||||
export type TextElementEmoji = {
|
||||
type: 'emoji';
|
||||
content: string;
|
||||
|
@ -9,8 +11,6 @@ export type TextElementEmoji = {
|
|||
name?: string;
|
||||
};
|
||||
|
||||
const emojiRegex = /^[\u{1f300}-\u{1f5ff}\u{1f900}-\u{1f9ff}\u{1f600}-\u{1f64f}\u{1f680}-\u{1f6ff}\u{2600}-\u{26ff}\u{2700}-\u{27bf}\u{1f1e6}-\u{1f1ff}\u{1f191}-\u{1f251}\u{1f004}\u{1f0cf}\u{1f170}-\u{1f171}\u{1f17e}-\u{1f17f}\u{1f18e}\u{3030}\u{2b50}\u{2b55}\u{2934}-\u{2935}\u{2b05}-\u{2b07}\u{2b1b}-\u{2b1c}\u{3297}\u{3299}\u{303d}\u{00a9}\u{00ae}\u{2122}\u{23f3}\u{24c2}\u{23e9}-\u{23ef}\u{25b6}\u{23f8}-\u{23fa}]/ug;
|
||||
|
||||
export default function(text: string) {
|
||||
const name = text.match(/^:([a-zA-Z0-9+_-]+):/);
|
||||
if (name) {
|
||||
|
|
Loading…
Reference in a new issue