parent
6cd93ef990
commit
d16df598fa
5 changed files with 18 additions and 1725 deletions
1
ui/package.json
vendored
1
ui/package.json
vendored
|
@ -23,6 +23,7 @@
|
|||
"autosize": "^4.0.2",
|
||||
"classcat": "^1.1.3",
|
||||
"dotenv": "^6.1.0",
|
||||
"emoji-short-name": "^0.1.0",
|
||||
"i18next": "^17.0.9",
|
||||
"inferno": "^7.0.1",
|
||||
"inferno-i18next": "nimbusec-oss/inferno-i18next",
|
||||
|
|
4
ui/src/components/comment-form.tsx
vendored
4
ui/src/components/comment-form.tsx
vendored
|
@ -2,12 +2,12 @@ import { Component, linkEvent } from 'inferno';
|
|||
import { CommentNode as CommentNodeI, CommentForm as CommentFormI, SearchForm, SearchType, SortType, UserOperation, SearchResponse } from '../interfaces';
|
||||
import { Subscription } from "rxjs";
|
||||
import { capitalizeFirstLetter, mentionDropdownFetchLimit, msgOp, mdToHtml, randomStr, imageUploadUrl, markdownHelpUrl } from '../utils';
|
||||
import { twemojis } from '../twemojis';
|
||||
import { WebSocketService, UserService } from '../services';
|
||||
import * as autosize from 'autosize';
|
||||
import { i18n } from '../i18next';
|
||||
import { T } from 'inferno-i18next';
|
||||
import Tribute from 'tributejs/src/Tribute.js';
|
||||
import * as emojiShortName from 'emoji-short-name';
|
||||
|
||||
interface CommentFormProps {
|
||||
postId?: number;
|
||||
|
@ -55,7 +55,7 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
|
|||
selectTemplate: (item: any) => {
|
||||
return `:${item.original.key}:`;
|
||||
},
|
||||
values: Object.entries(twemojis).map(e => {return {'key': e[0], 'val': e[1]}}),
|
||||
values: Object.entries(emojiShortName).map(e => {return {'key': e[1], 'val': e[0]}}),
|
||||
allowSpaces: false,
|
||||
autocompleteMode: true,
|
||||
menuItemLimit: 10,
|
||||
|
|
1721
ui/src/twemojis.ts
vendored
1721
ui/src/twemojis.ts
vendored
File diff suppressed because it is too large
Load diff
12
ui/src/utils.ts
vendored
12
ui/src/utils.ts
vendored
|
@ -12,7 +12,7 @@ import * as markdown_it from 'markdown-it';
|
|||
import * as markdownitEmoji from 'markdown-it-emoji/light';
|
||||
import * as markdown_it_container from 'markdown-it-container';
|
||||
import * as twemoji from 'twemoji';
|
||||
import { twemojis } from './twemojis';
|
||||
import * as emojiShortName from 'emoji-short-name';
|
||||
|
||||
export const repoUrl = 'https://github.com/dessalines/lemmy';
|
||||
export const imageUploadUrl = 'https://postimages.org/';
|
||||
|
@ -50,7 +50,7 @@ export const md = new markdown_it({
|
|||
}
|
||||
}
|
||||
}).use(markdownitEmoji, {
|
||||
defs: twemojis
|
||||
defs: objectFlip(emojiShortName)
|
||||
});
|
||||
|
||||
md.renderer.rules.emoji = function(token, idx) {
|
||||
|
@ -197,6 +197,14 @@ export function getLanguage(): string {
|
|||
return (navigator.language || navigator.userLanguage);
|
||||
}
|
||||
|
||||
export function objectFlip(obj: any) {
|
||||
const ret = {};
|
||||
Object.keys(obj).forEach((key) => {
|
||||
ret[obj[key]] = key;
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
export function getMomentLanguage(): string {
|
||||
let lang = getLanguage();
|
||||
if (lang.startsWith('zh')) {
|
||||
|
|
5
ui/yarn.lock
vendored
5
ui/yarn.lock
vendored
|
@ -782,6 +782,11 @@ ee-first@1.1.1:
|
|||
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
|
||||
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
|
||||
|
||||
emoji-short-name@^0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/emoji-short-name/-/emoji-short-name-0.1.0.tgz#e2f0fd743e3e16384ae32f8a8b0ce6a47216e1d3"
|
||||
integrity sha512-vpQaGMxBDC4VGHz52CjVKTJsGsgQ0YueEgQFyDkoanPIK3RgGMbHSjnek2viaCwgf8T6TKCR5v03O/SlfD7iFA==
|
||||
|
||||
encodeurl@~1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59"
|
||||
|
|
Loading…
Reference in a new issue