summaryrefslogtreecommitdiffstats
path: root/ui/src
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2020-07-09 13:32:23 -0400
committerDessalines <tyhou13@gmx.com>2020-07-09 13:32:23 -0400
commitdb09730d5f391c37bde87f59ed2ea6f3418034e4 (patch)
tree5630121c23afc2d080cd157f5b9b27d248600095 /ui/src
parent20f9bde88f52ce875be4d0dc4bd5dd346dfe6b84 (diff)
Removing twemoji, and the massive emoji picker. Fixes #895
Diffstat (limited to 'ui/src')
-rw-r--r--ui/src/components/comment-form.tsx29
-rw-r--r--ui/src/components/post-form.tsx29
-rw-r--r--ui/src/utils.ts17
3 files changed, 1 insertions, 74 deletions
diff --git a/ui/src/components/comment-form.tsx b/ui/src/components/comment-form.tsx
index 32bc3786..22f871d2 100644
--- a/ui/src/components/comment-form.tsx
+++ b/ui/src/components/comment-form.tsx
@@ -17,7 +17,6 @@ import {
toast,
setupTribute,
wsJsonToRes,
- emojiPicker,
pictrsDeleteToast,
} from '../utils';
import { WebSocketService, UserService } from '../services';
@@ -72,7 +71,6 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
super(props, context);
this.tribute = setupTribute();
- this.setupEmojiPicker();
this.state = this.emptyState;
@@ -241,15 +239,6 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
<use xlinkHref="#icon-spinner"></use>
</svg>
)}
- <span
- onClick={linkEvent(this, this.handleEmojiPickerClick)}
- class="pointer unselectable d-inline-block mr-3 float-right text-muted font-weight-bold"
- data-tippy-content={i18n.t('emoji_picker')}
- >
- <svg class="icon icon-inline">
- <use xlinkHref="#icon-smile"></use>
- </svg>
- </span>
</div>
</div>
</form>
@@ -257,20 +246,6 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
);
}
- setupEmojiPicker() {
- emojiPicker.on('emoji', twemojiHtmlStr => {
- if (this.state.commentForm.content == null) {
- this.state.commentForm.content = '';
- }
- var el = document.createElement('div');
- el.innerHTML = twemojiHtmlStr;
- let nativeUnicode = (el.childNodes[0] as HTMLElement).getAttribute('alt');
- let shortName = `:${emojiShortName[nativeUnicode]}:`;
- this.state.commentForm.content += shortName;
- this.setState(this.state);
- });
- }
-
handleFinished(op: UserOperation, data: CommentResponse) {
let isReply =
this.props.node !== undefined && data.comment.parent_id !== null;
@@ -318,10 +293,6 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
i.setState(i.state);
}
- handleEmojiPickerClick(_i: CommentForm, event: any) {
- emojiPicker.togglePicker(event.target);
- }
-
handleCommentContentChange(i: CommentForm, event: any) {
i.state.commentForm.content = event.target.value;
i.setState(i.state);
diff --git a/ui/src/components/post-form.tsx b/ui/src/components/post-form.tsx
index a88d38c7..fc7884d7 100644
--- a/ui/src/components/post-form.tsx
+++ b/ui/src/components/post-form.tsx
@@ -33,7 +33,6 @@ import {
randomStr,
setupTribute,
setupTippy,
- emojiPicker,
hostname,
pictrsDeleteToast,
} from '../utils';
@@ -95,7 +94,6 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
this.fetchPageTitle = debounce(this.fetchPageTitle).bind(this);
this.tribute = setupTribute();
- this.setupEmojiPicker();
this.state = this.emptyState;
@@ -332,15 +330,6 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
<use xlinkHref="#icon-help-circle"></use>
</svg>
</a>
- <span
- onClick={linkEvent(this, this.handleEmojiPickerClick)}
- class="pointer unselectable d-inline-block mr-3 float-right text-muted font-weight-bold"
- data-tippy-content={i18n.t('emoji_picker')}
- >
- <svg class="icon icon-inline">
- <use xlinkHref="#icon-smile"></use>
- </svg>
- </span>
</div>
</div>
{!this.props.post && (
@@ -420,20 +409,6 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
);
}
- setupEmojiPicker() {
- emojiPicker.on('emoji', twemojiHtmlStr => {
- if (this.state.postForm.body == null) {
- this.state.postForm.body = '';
- }
- var el = document.createElement('div');
- el.innerHTML = twemojiHtmlStr;
- let nativeUnicode = (el.childNodes[0] as HTMLElement).getAttribute('alt');
- let shortName = `:${emojiShortName[nativeUnicode]}:`;
- this.state.postForm.body += shortName;
- this.setState(this.state);
- });
- }
-
handlePostSubmit(i: PostForm, event: any) {
event.preventDefault();
@@ -596,10 +571,6 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
});
}
- handleEmojiPickerClick(_i: PostForm, event: any) {
- emojiPicker.togglePicker(event.target);
- }
-
parseMessage(msg: WebSocketJsonResponse) {
let res = wsJsonToRes(msg);
if (msg.error) {
diff --git a/ui/src/utils.ts b/ui/src/utils.ts
index 3b077794..b3d0f368 100644
--- a/ui/src/utils.ts
+++ b/ui/src/utils.ts
@@ -51,11 +51,9 @@ import Tribute from 'tributejs/src/Tribute.js';
import markdown_it from 'markdown-it';
import markdownitEmoji from 'markdown-it-emoji/light';
import markdown_it_container from 'markdown-it-container';
-import twemoji from 'twemoji';
import emojiShortName from 'emoji-short-name';
import Toastify from 'toastify-js';
import tippy from 'tippy.js';
-import EmojiButton from '@joeattardi/emoji-button';
export const repoUrl = 'https://github.com/LemmyNet/lemmy';
export const helpGuideUrl = '/docs/about_guide.html';
@@ -114,14 +112,6 @@ export const themes = [
'litely',
];
-export const emojiPicker = new EmojiButton({
- // Use the emojiShortName from native
- style: 'twemoji',
- theme: 'dark',
- position: 'auto-start',
- // TODO i18n
-});
-
const DEFAULT_ALPHABET =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
@@ -178,10 +168,6 @@ export const md = new markdown_it({
defs: objectFlip(emojiShortName),
});
-md.renderer.rules.emoji = function (token, idx) {
- return twemoji.parse(token[idx].content);
-};
-
export function hotRankComment(comment: Comment): number {
return hotRank(comment.score, comment.published);
}
@@ -590,8 +576,7 @@ export function setupTribute(): Tribute {
trigger: ':',
menuItemTemplate: (item: any) => {
let shortName = `:${item.original.key}:`;
- let twemojiIcon = twemoji.parse(item.original.val);
- return `${twemojiIcon} ${shortName}`;
+ return `${item.original.val} ${shortName}`;
},
selectTemplate: (item: any) => {
return `:${item.original.key}:`;