Browse Source

Use twemoji style for emoji picker.

emoji_picker
Dessalines 11 months ago
parent
commit
676690097f
3 changed files with 11 additions and 5 deletions
  1. +5
    -2
      ui/src/components/comment-form.tsx
  2. +5
    -2
      ui/src/components/post-form.tsx
  3. +1
    -1
      ui/src/utils.ts

+ 5
- 2
ui/src/components/comment-form.tsx View File

@ -230,11 +230,14 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
}
setupEmojiPicker() {
emojiPicker.on('emoji', emoji => {
emojiPicker.on('emoji', twemojiHtmlStr => {
if (this.state.commentForm.content == null) {
this.state.commentForm.content = '';
}
let shortName = `:${emojiShortName[emoji]}:`;
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);
});


+ 5
- 2
ui/src/components/post-form.tsx View File

@ -383,11 +383,14 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
}
setupEmojiPicker() {
emojiPicker.on('emoji', emoji => {
emojiPicker.on('emoji', twemojiHtmlStr => {
if (this.state.postForm.body == null) {
this.state.postForm.body = '';
}
let shortName = `:${emojiShortName[emoji]}:`;
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);
});


+ 1
- 1
ui/src/utils.ts View File

@ -91,7 +91,7 @@ export const themes = [
export const emojiPicker = new EmojiButton({
// Use the emojiShortName from native
// style: 'twemoji',
style: 'twemoji',
theme: 'dark',
position: 'auto-start',
// TODO i18n


Loading…
Cancel
Save