Browse Source

ComposeAre: Add data-c attr to inserted emoji

Danilo Bargen 6 years ago
parent
commit
37735e4396
1 changed files with 3 additions and 2 deletions
  1. 3 2
      src/directives/compose_area.ts

+ 3 - 2
src/directives/compose_area.ts

@@ -547,7 +547,7 @@ export default [
                 // Emoji is chosen
                 function onEmojiChosen(ev: MouseEvent): void {
                     ev.stopPropagation();
-                    insertEmojiString(this.textContent);
+                    insertSingleEmojiString(this.textContent);
                 }
 
                 // Emoji tab is selected
@@ -559,7 +559,7 @@ export default [
                 }
 
                 // Insert a single emoji, passed in as string
-                function insertEmojiString(emojiString: string): void {
+                function insertSingleEmojiString(emojiString: string): void {
                     const tokens = emojifyNew(emojiString);
                     if (tokens.length !== 1) {
                         throw new Error(`Emoji parsing failed: Expected 1 element, found ${tokens.length}`);
@@ -574,6 +574,7 @@ export default [
                 // Insert a single emoji
                 function insertEmoji(emoji: threema.EmojiInfo): void {
                     const img: HTMLElement = composeArea.insert_image(emoji.imgPath, emoji.emojiString, 'em');
+                    img.setAttribute('data-c', emoji.codepoint);
                     img.draggable = false;
                     img.ondragstart = () => false;
                 }