aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/app/core/renderer/markdown.service.ts10
-rw-r--r--client/src/typings.d.ts2
2 files changed, 9 insertions, 3 deletions
diff --git a/client/src/app/core/renderer/markdown.service.ts b/client/src/app/core/renderer/markdown.service.ts
index 0fde3f99d..edddb0a66 100644
--- a/client/src/app/core/renderer/markdown.service.ts
+++ b/client/src/app/core/renderer/markdown.service.ts
@@ -49,6 +49,8 @@ export class MarkdownService {
49 completeMarkdownIt: { rules: COMPLETE_RULES, html: true } 49 completeMarkdownIt: { rules: COMPLETE_RULES, html: true }
50 } 50 }
51 51
52 private emojiModule: any
53
52 constructor (private htmlRenderer: HtmlRendererService) {} 54 constructor (private htmlRenderer: HtmlRendererService) {}
53 55
54 textMarkdownToHTML (markdown: string, withHtml = false, withEmoji = false) { 56 textMarkdownToHTML (markdown: string, withHtml = false, withEmoji = false) {
@@ -83,9 +85,11 @@ export class MarkdownService {
83 this.markdownParsers[ name ] = await this.createMarkdownIt(config) 85 this.markdownParsers[ name ] = await this.createMarkdownIt(config)
84 86
85 if (withEmoji) { 87 if (withEmoji) {
86 // TODO: write types 88 if (!this.emojiModule) {
87 const emoji = require('markdown-it-emoji/light') 89 this.emojiModule = (await import('markdown-it-emoji/light')).default
88 this.markdownParsers[ name ].use(emoji) 90 }
91
92 this.markdownParsers[ name ].use(this.emojiModule)
89 } 93 }
90 } 94 }
91 95
diff --git a/client/src/typings.d.ts b/client/src/typings.d.ts
index ef6c9f2f5..24473aede 100644
--- a/client/src/typings.d.ts
+++ b/client/src/typings.d.ts
@@ -4,3 +4,5 @@ declare var module: NodeModule
4interface NodeModule { 4interface NodeModule {
5 id: string 5 id: string
6} 6}
7
8declare module 'markdown-it-emoji/light'