Emoji Tooltip: Fix for Firefox (#1189)

This commit is contained in:
Alexander Zinchuk 2021-06-19 16:31:24 +03:00
parent 6751813049
commit c6d1b8a9c4
2 changed files with 2 additions and 2 deletions

View File

@ -168,7 +168,7 @@ export default function useEmojiTooltip(
function getEmojiCode(html: string) { function getEmojiCode(html: string) {
const tempEl = document.createElement('div'); const tempEl = document.createElement('div');
tempEl.innerHTML = html.replace('<br>', '\n'); tempEl.innerHTML = html.replace('<br>', '\n');
const text = tempEl.innerText; const text = tempEl.innerText.replace(/\n$/i, '');
const lastSymbol = text[text.length - 1]; const lastSymbol = text[text.length - 1];
const lastWord = text.split(RE_NOT_EMOJI_SEARCH).pop(); const lastWord = text.split(RE_NOT_EMOJI_SEARCH).pop();

View File

@ -102,7 +102,7 @@ export default function useMentionTooltip(
function getUsernameFilter(html: string) { function getUsernameFilter(html: string) {
const tempEl = document.createElement('div'); const tempEl = document.createElement('div');
tempEl.innerHTML = html; tempEl.innerHTML = html;
const text = tempEl.innerText; const text = tempEl.innerText.replace(/\n$/i, '');
const lastSymbol = text[text.length - 1]; const lastSymbol = text[text.length - 1];
const lastWord = text.split(RE_NOT_USERNAME_SEARCH).pop(); const lastWord = text.split(RE_NOT_USERNAME_SEARCH).pop();