From 7b16d17d416070643a4693159752cfd341bc5230 Mon Sep 17 00:00:00 2001 From: Eduard Kuzmenko Date: Mon, 25 Apr 2022 03:02:29 +0300 Subject: [PATCH] temporary fixes --- src/components/poll.ts | 6 +++++- src/components/sidebarRight/tabs/stickers.ts | 7 ++++--- src/helpers/dom/documentFragmentToHTML.ts | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/poll.ts b/src/components/poll.ts index 547a7727..d1580574 100644 --- a/src/components/poll.ts +++ b/src/components/poll.ts @@ -274,7 +274,7 @@ export default class PollElement extends HTMLElement { ${multipleSelect}
-
${RichTextProcessor.wrapEmojiText(answer.text)}
+
@@ -293,6 +293,10 @@ export default class PollElement extends HTMLElement { setInnerHTML(this.firstElementChild, RichTextProcessor.wrapEmojiText(poll.question)); + Array.from(this.querySelectorAll('.poll-answer-text')).forEach((el, idx) => { + setInnerHTML(el, RichTextProcessor.wrapEmojiText(poll.answers[idx].text)); + }); + this.descDiv = this.firstElementChild.nextElementSibling as HTMLElement; this.typeDiv = this.descDiv.firstElementChild as HTMLElement; this.avatarsDiv = this.descDiv.lastElementChild as HTMLElement; diff --git a/src/components/sidebarRight/tabs/stickers.ts b/src/components/sidebarRight/tabs/stickers.ts index 26e41ffb..f31be08b 100644 --- a/src/components/sidebarRight/tabs/stickers.ts +++ b/src/components/sidebarRight/tabs/stickers.ts @@ -19,6 +19,7 @@ import { i18n } from "../../../lib/langPack"; import findUpClassName from "../../../helpers/dom/findUpClassName"; import { attachClickEvent } from "../../../helpers/dom/clickEvent"; import forEachReverse from "../../../helpers/array/forEachReverse"; +import setInnerHTML from "../../../helpers/dom/setInnerHTML"; export default class AppStickersTab extends SliderSuperTab { private inputSearch: InputSearch; @@ -98,9 +99,9 @@ export default class AppStickersTab extends SliderSuperTab { const details = document.createElement('div'); details.classList.add('sticker-set-details'); - details.innerHTML = ` -
${RichTextProcessor.wrapEmojiText(set.title)}
- `; + details.innerHTML = `
`; + + setInnerHTML(details.firstElementChild, RichTextProcessor.wrapEmojiText(set.title)); const countDiv = document.createElement('div'); countDiv.classList.add('sticker-set-count'); diff --git a/src/helpers/dom/documentFragmentToHTML.ts b/src/helpers/dom/documentFragmentToHTML.ts index 766ccec1..54f7f030 100644 --- a/src/helpers/dom/documentFragmentToHTML.ts +++ b/src/helpers/dom/documentFragmentToHTML.ts @@ -1,5 +1,5 @@ export default function documentFragmentToHTML(fragment: DocumentFragment) { return Array.from(fragment.childNodes).map((node) => { - return node.nodeType === 3 ? node.textContent : (node as Element).outerHTML + '\n'; + return node.nodeType === 3 ? node.textContent : (node as Element).outerHTML; }).join(''); }