mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-23 04:41:19 +00:00
Use twemoji style for emoji picker.
This commit is contained in:
parent
a26bff6921
commit
676690097f
3 changed files with 11 additions and 5 deletions
7
ui/src/components/comment-form.tsx
vendored
7
ui/src/components/comment-form.tsx
vendored
|
@ -230,11 +230,14 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
setupEmojiPicker() {
|
setupEmojiPicker() {
|
||||||
emojiPicker.on('emoji', emoji => {
|
emojiPicker.on('emoji', twemojiHtmlStr => {
|
||||||
if (this.state.commentForm.content == null) {
|
if (this.state.commentForm.content == null) {
|
||||||
this.state.commentForm.content = '';
|
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.state.commentForm.content += shortName;
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
});
|
});
|
||||||
|
|
7
ui/src/components/post-form.tsx
vendored
7
ui/src/components/post-form.tsx
vendored
|
@ -383,11 +383,14 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
setupEmojiPicker() {
|
setupEmojiPicker() {
|
||||||
emojiPicker.on('emoji', emoji => {
|
emojiPicker.on('emoji', twemojiHtmlStr => {
|
||||||
if (this.state.postForm.body == null) {
|
if (this.state.postForm.body == null) {
|
||||||
this.state.postForm.body = '';
|
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.state.postForm.body += shortName;
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
});
|
});
|
||||||
|
|
2
ui/src/utils.ts
vendored
2
ui/src/utils.ts
vendored
|
@ -91,7 +91,7 @@ export const themes = [
|
||||||
|
|
||||||
export const emojiPicker = new EmojiButton({
|
export const emojiPicker = new EmojiButton({
|
||||||
// Use the emojiShortName from native
|
// Use the emojiShortName from native
|
||||||
// style: 'twemoji',
|
style: 'twemoji',
|
||||||
theme: 'dark',
|
theme: 'dark',
|
||||||
position: 'auto-start',
|
position: 'auto-start',
|
||||||
// TODO i18n
|
// TODO i18n
|
||||||
|
|
Loading…
Reference in a new issue