mirror of https://github.com/LemmyNet/lemmy.git
Use twemoji style for emoji picker.
parent
a26bff6921
commit
676690097f
|
@ -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);
|
||||||
});
|
});
|
||||||
|
|
|
@ -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);
|
||||||
});
|
});
|
||||||
|
|
|
@ -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 New Issue