From 86f4b6186a1d15d3cc9de2ecd6fdc68866d3104d Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Tue, 11 May 2021 15:03:20 +0530 Subject: [PATCH] Refactor functions to accept single parameter Signed-off-by: RMidhunSuresh --- .../web/ui/session/room/timeline/TextMessageView.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/platform/web/ui/session/room/timeline/TextMessageView.js b/src/platform/web/ui/session/room/timeline/TextMessageView.js index c07c1075..b9eda412 100644 --- a/src/platform/web/ui/session/room/timeline/TextMessageView.js +++ b/src/platform/web/ui/session/room/timeline/TextMessageView.js @@ -16,7 +16,7 @@ limitations under the License. import {TemplateView} from "../../../general/TemplateView.js"; import {StaticView} from "../../../general/StaticView.js"; -import {text} from "../../../general/html.js"; +import { tag, text } from "../../../general/html.js"; import {renderMessage} from "./common.js"; export class TextMessageView extends TemplateView { @@ -29,9 +29,9 @@ export class TextMessageView extends TemplateView { } const formatFunction = { - text: (param) => text(param.obj.text), - link: (param) => param.t.a({ href: param.obj.url, target: "_blank", rel: "noopener" }, [text(param.obj.text)]), - newline: (param) => param.t.br() + text: (m) => text(m.text), + link: (m) => tag.a({ href: m.url, target: "_blank", rel: "noopener" }, [text(m.text)]), + newline: () => tag.br() }; class BodyView extends StaticView { @@ -39,7 +39,7 @@ class BodyView extends StaticView { const children = []; for (const m of value) { const f = formatFunction[m.type]; - const element = f({ obj: m, t: t }); + const element = f(m); children.push(element); } return t.span(children);