絵文字ピッカーの Unicode 12.0 対応など (#5441)
* Twemoji 12.1 * 絵文字ライブラリを持つように * Fix chess_pawn emoji * Add Unicode 12.0 emojis * Add transgender flag/symbol emoji * Add some japanese emoji keywords * format emojilist.json * fix emojilist order * Add missing flags
This commit is contained in:
parent
9f5a763c69
commit
60d2558ed6
10 changed files with 1691 additions and 38 deletions
|
@ -54,6 +54,7 @@ gulp.task('build:copy:fonts', () =>
|
||||||
gulp.task('build:copy', gulp.parallel('build:copy:views', 'build:copy:fonts', () =>
|
gulp.task('build:copy', gulp.parallel('build:copy:views', 'build:copy:fonts', () =>
|
||||||
gulp.src([
|
gulp.src([
|
||||||
'./src/const.json',
|
'./src/const.json',
|
||||||
|
'./src/emojilist.json',
|
||||||
'./src/server/web/views/**/*',
|
'./src/server/web/views/**/*',
|
||||||
'./src/**/assets/**/*',
|
'./src/**/assets/**/*',
|
||||||
'!./src/client/app/**/assets/**/*'
|
'!./src/client/app/**/assets/**/*'
|
||||||
|
|
|
@ -123,7 +123,6 @@
|
||||||
"deep-equal": "1.1.0",
|
"deep-equal": "1.1.0",
|
||||||
"diskusage": "1.1.3",
|
"diskusage": "1.1.3",
|
||||||
"double-ended-queue": "2.1.0-0",
|
"double-ended-queue": "2.1.0-0",
|
||||||
"emojilib": "2.4.0",
|
|
||||||
"eslint": "6.1.0",
|
"eslint": "6.1.0",
|
||||||
"eslint-plugin-vue": "5.2.3",
|
"eslint-plugin-vue": "5.2.3",
|
||||||
"eventemitter3": "4.0.0",
|
"eventemitter3": "4.0.0",
|
||||||
|
|
|
@ -28,9 +28,9 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import * as emojilib from 'emojilib';
|
import { emojilist } from '../../../../../misc/emojilist';
|
||||||
import contains from '../../../common/scripts/contains';
|
import contains from '../../../common/scripts/contains';
|
||||||
import { twemojiBase } from '../../../../../misc/twemoji-base';
|
import { twemojiSvgBase } from '../../../../../misc/twemoji-base';
|
||||||
import { getStaticImageUrl } from '../../../common/scripts/get-static-image-url';
|
import { getStaticImageUrl } from '../../../common/scripts/get-static-image-url';
|
||||||
|
|
||||||
type EmojiDef = {
|
type EmojiDef = {
|
||||||
|
@ -41,9 +41,7 @@ type EmojiDef = {
|
||||||
isCustomEmoji?: boolean;
|
isCustomEmoji?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const lib = Object.entries(emojilib.lib).filter((x: any) => {
|
const lib = emojilist.filter(x => x.category !== 'flags');
|
||||||
return x[1].category != 'flags';
|
|
||||||
});
|
|
||||||
|
|
||||||
const char2file = (char: string) => {
|
const char2file = (char: string) => {
|
||||||
let codes = Array.from(char).map(x => x.codePointAt(0).toString(16));
|
let codes = Array.from(char).map(x => x.codePointAt(0).toString(16));
|
||||||
|
@ -52,21 +50,21 @@ const char2file = (char: string) => {
|
||||||
return codes.join('-');
|
return codes.join('-');
|
||||||
};
|
};
|
||||||
|
|
||||||
const emjdb: EmojiDef[] = lib.map((x: any) => ({
|
const emjdb: EmojiDef[] = lib.map(x => ({
|
||||||
emoji: x[1].char,
|
emoji: x.char,
|
||||||
name: x[0],
|
name: x.name,
|
||||||
aliasOf: null,
|
aliasOf: null,
|
||||||
url: `${twemojiBase}/2/svg/${char2file(x[1].char)}.svg`
|
url: `${twemojiSvgBase}/${char2file(x.char)}.svg`
|
||||||
}));
|
}));
|
||||||
|
|
||||||
for (const x of lib as any) {
|
for (const x of lib) {
|
||||||
if (x[1].keywords) {
|
if (x.keywords) {
|
||||||
for (const k of x[1].keywords) {
|
for (const k of x.keywords) {
|
||||||
emjdb.push({
|
emjdb.push({
|
||||||
emoji: x[1].char,
|
emoji: x.char,
|
||||||
name: k,
|
name: k,
|
||||||
aliasOf: x[0],
|
aliasOf: x.name,
|
||||||
url: `${twemojiBase}/2/svg/${char2file(x[1].char)}.svg`
|
url: `${twemojiSvgBase}/${char2file(x.char)}.svg`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,7 +83,7 @@ export default Vue.extend({
|
||||||
hashtags: [],
|
hashtags: [],
|
||||||
emojis: [],
|
emojis: [],
|
||||||
select: -1,
|
select: -1,
|
||||||
emojilib,
|
emojilist,
|
||||||
emojiDb: [] as EmojiDef[]
|
emojiDb: [] as EmojiDef[]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
:title="category.text"
|
:title="category.text"
|
||||||
@click="go(category)"
|
@click="go(category)"
|
||||||
:class="{ active: category.isActive }"
|
:class="{ active: category.isActive }"
|
||||||
|
:key="category.text"
|
||||||
>
|
>
|
||||||
<fa :icon="category.icon" fixed-width/>
|
<fa :icon="category.icon" fixed-width/>
|
||||||
</button>
|
</button>
|
||||||
|
@ -12,18 +13,19 @@
|
||||||
<div class="emojis">
|
<div class="emojis">
|
||||||
<header><fa :icon="categories.find(x => x.isActive).icon" fixed-width/> {{ categories.find(x => x.isActive).text }}</header>
|
<header><fa :icon="categories.find(x => x.isActive).icon" fixed-width/> {{ categories.find(x => x.isActive).text }}</header>
|
||||||
<div v-if="categories.find(x => x.isActive).name">
|
<div v-if="categories.find(x => x.isActive).name">
|
||||||
<button v-for="emoji in Object.entries(lib).filter(([k, v]) => v.category === categories.find(x => x.isActive).name)"
|
<button v-for="emoji in emojilist.filter(e => e.category === categories.find(x => x.isActive).name)"
|
||||||
:title="emoji[0]"
|
:title="emoji.name"
|
||||||
@click="chosen(emoji[1].char)"
|
@click="chosen(emoji.char)"
|
||||||
:key="emoji[0]"
|
:key="emoji.name"
|
||||||
>
|
>
|
||||||
<mk-emoji :emoji="emoji[1].char"/>
|
<mk-emoji :emoji="emoji.char"/>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<button v-for="emoji in customEmojis"
|
<button v-for="emoji in customEmojis"
|
||||||
:title="emoji.name"
|
:title="emoji.name"
|
||||||
@click="chosen(`:${emoji.name}:`)"
|
@click="chosen(`:${emoji.name}:`)"
|
||||||
|
:key="emoji.name"
|
||||||
>
|
>
|
||||||
<img :src="emoji.url" :alt="emoji.name"/>
|
<img :src="emoji.url" :alt="emoji.name"/>
|
||||||
</button>
|
</button>
|
||||||
|
@ -35,7 +37,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import i18n from '../../../i18n';
|
import i18n from '../../../i18n';
|
||||||
import { lib } from 'emojilib';
|
import { emojilist } from '../../../../../misc/emojilist';
|
||||||
import { faAsterisk, faLeaf, faUtensils, faFutbol, faCity, faDice } from '@fortawesome/free-solid-svg-icons';
|
import { faAsterisk, faLeaf, faUtensils, faFutbol, faCity, faDice } from '@fortawesome/free-solid-svg-icons';
|
||||||
import { faHeart, faFlag } from '@fortawesome/free-regular-svg-icons';
|
import { faHeart, faFlag } from '@fortawesome/free-regular-svg-icons';
|
||||||
|
|
||||||
|
@ -44,7 +46,7 @@ export default Vue.extend({
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
lib,
|
emojilist,
|
||||||
customEmojis: [],
|
customEmojis: [],
|
||||||
categories: [{
|
categories: [{
|
||||||
text: this.$t('custom-emoji'),
|
text: this.$t('custom-emoji'),
|
||||||
|
|
|
@ -7,10 +7,8 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
// スクリプトサイズがデカい
|
|
||||||
//import { lib } from 'emojilib';
|
|
||||||
import { getStaticImageUrl } from '../../../common/scripts/get-static-image-url';
|
import { getStaticImageUrl } from '../../../common/scripts/get-static-image-url';
|
||||||
import { twemojiBase } from '../../../../../misc/twemoji-base';
|
import { twemojiSvgBase } from '../../../../../misc/twemoji-base';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: {
|
props: {
|
||||||
|
@ -92,7 +90,7 @@ export default Vue.extend({
|
||||||
if (!codes.includes('200d')) codes = codes.filter(x => x != 'fe0f');
|
if (!codes.includes('200d')) codes = codes.filter(x => x != 'fe0f');
|
||||||
codes = codes.filter(x => x && x.length);
|
codes = codes.filter(x => x && x.length);
|
||||||
|
|
||||||
this.url = `${twemojiBase}/2/svg/${codes.join('-')}.svg`;
|
this.url = `${twemojiSvgBase}/${codes.join('-')}.svg`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
1655
src/emojilist.json
Normal file
1655
src/emojilist.json
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
7
src/misc/emojilist.ts
Normal file
7
src/misc/emojilist.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
// initial converted from https://github.com/muan/emojilib/commit/242fe68be86ed6536843b83f7e32f376468b38fb
|
||||||
|
export const emojilist = require('../emojilist.json') as {
|
||||||
|
name: string;
|
||||||
|
keywords: string[];
|
||||||
|
char: string;
|
||||||
|
category: 'people' | 'animals_and_nature' | 'food_and_drink' | 'activity' | 'travel_and_places' | 'objects' | 'symbols' | 'flags';
|
||||||
|
}[];
|
|
@ -1,4 +1 @@
|
||||||
export const twemojiBase = 'https://cdn.jsdelivr.net/npm/twemoji@12.0.1';
|
export const twemojiSvgBase = 'https://twemoji.maxcdn.com/v/latest/svg';
|
||||||
// https://cdn.jsdelivr.net/npm/twemoji@12.0.1
|
|
||||||
// https://cdnjs.cloudflare.com/ajax/libs/twemoji/12.0.1
|
|
||||||
// https://twemoji.maxcdn.com
|
|
||||||
|
|
|
@ -3712,11 +3712,6 @@ emoji-regex@^7.0.1:
|
||||||
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156"
|
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156"
|
||||||
integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==
|
integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==
|
||||||
|
|
||||||
emojilib@2.4.0:
|
|
||||||
version "2.4.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/emojilib/-/emojilib-2.4.0.tgz#ac518a8bb0d5f76dda57289ccb2fdf9d39ae721e"
|
|
||||||
integrity sha512-5U0rVMU5Y2n2+ykNLQqMoqklN9ICBT/KsvC1Gz6vqHbz2AXXGkG+Pm5rMWk/8Vjrr/mY9985Hi8DYzn1F09Nyw==
|
|
||||||
|
|
||||||
emojis-list@^2.0.0:
|
emojis-list@^2.0.0:
|
||||||
version "2.1.0"
|
version "2.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389"
|
resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389"
|
||||||
|
|
Loading…
Reference in a new issue