aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-11-14 10:47:39 +0100
committerChocobozzz <me@florianbigard.com>2022-11-14 10:47:39 +0100
commit0e45e336f62a411b3c423be46d16252355c754d7 (patch)
treed26efa3db4aca580ad2c6a154dded7a0e09593bb /client/src/app/shared
parentd91021548ed0dd3acec28722d0166bf38c67e0da (diff)
downloadPeerTube-0e45e336f62a411b3c423be46d16252355c754d7.tar.gz
PeerTube-0e45e336f62a411b3c423be46d16252355c754d7.tar.zst
PeerTube-0e45e336f62a411b3c423be46d16252355c754d7.zip
Fix HTML in account/channel description
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts6
-rw-r--r--client/src/app/shared/shared-custom-markup/custom-markup.service.ts2
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts6
-rw-r--r--client/src/app/shared/shared-forms/markdown-textarea.component.ts4
-rw-r--r--client/src/app/shared/shared-instance/instance.service.ts2
-rw-r--r--client/src/app/shared/shared-support-modal/support-modal.component.ts2
-rw-r--r--client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts2
7 files changed, 14 insertions, 10 deletions
diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts
index a3a71ae20..569a37b17 100644
--- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts
+++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts
@@ -214,8 +214,8 @@ export class AbuseListTableComponent extends RestTable implements OnInit {
214 abuse.truncatedCommentHtml = abuse.commentHtml = $localize`Deleted comment` 214 abuse.truncatedCommentHtml = abuse.commentHtml = $localize`Deleted comment`
215 } else { 215 } else {
216 const truncated = truncate(abuse.comment.text, { length: 100 }) 216 const truncated = truncate(abuse.comment.text, { length: 100 })
217 abuse.truncatedCommentHtml = await this.markdownRenderer.textMarkdownToHTML(truncated, true) 217 abuse.truncatedCommentHtml = await this.markdownRenderer.textMarkdownToHTML({ markdown: truncated, withHtml: true })
218 abuse.commentHtml = await this.markdownRenderer.textMarkdownToHTML(abuse.comment.text, true) 218 abuse.commentHtml = await this.markdownRenderer.textMarkdownToHTML({ markdown: abuse.comment.text, withHtml: true })
219 } 219 }
220 } 220 }
221 221
@@ -451,6 +451,6 @@ export class AbuseListTableComponent extends RestTable implements OnInit {
451 } 451 }
452 452
453 private toHtml (text: string) { 453 private toHtml (text: string) {
454 return this.markdownRenderer.textMarkdownToHTML(text) 454 return this.markdownRenderer.textMarkdownToHTML({ markdown: text })
455 } 455 }
456} 456}
diff --git a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts
index d738a644e..618c3dd4f 100644
--- a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts
+++ b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts
@@ -58,7 +58,7 @@ export class CustomMarkupService {
58 } 58 }
59 59
60 async buildElement (text: string) { 60 async buildElement (text: string) {
61 const html = await this.markdown.customPageMarkdownToHTML(text, this.getSupportedTags()) 61 const html = await this.markdown.customPageMarkdownToHTML({ markdown: text, additionalAllowedTags: this.getSupportedTags() })
62 62
63 const rootElement = document.createElement('div') 63 const rootElement = document.createElement('div')
64 rootElement.innerHTML = html 64 rootElement.innerHTML = html
diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts
index e9c466a90..ba12b7139 100644
--- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts
@@ -42,7 +42,11 @@ export class ChannelMiniatureMarkupComponent implements CustomMarkupComponent, O
42 tap(channel => { 42 tap(channel => {
43 this.channel = channel 43 this.channel = channel
44 }), 44 }),
45 switchMap(() => from(this.markdown.textMarkdownToHTML(this.channel.description))), 45 switchMap(() => from(this.markdown.textMarkdownToHTML({
46 markdown: this.channel.description,
47 withEmoji: true,
48 withHtml: true
49 }))),
46 tap(html => { 50 tap(html => {
47 this.descriptionHTML = html 51 this.descriptionHTML = html
48 }), 52 }),
diff --git a/client/src/app/shared/shared-forms/markdown-textarea.component.ts b/client/src/app/shared/shared-forms/markdown-textarea.component.ts
index 089991884..e3371f22c 100644
--- a/client/src/app/shared/shared-forms/markdown-textarea.component.ts
+++ b/client/src/app/shared/shared-forms/markdown-textarea.component.ts
@@ -144,9 +144,9 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit {
144 144
145 html = result 145 html = result
146 } else if (this.markdownType === 'text') { 146 } else if (this.markdownType === 'text') {
147 html = await this.markdownService.textMarkdownToHTML(text) 147 html = await this.markdownService.textMarkdownToHTML({ markdown: text })
148 } else { 148 } else {
149 html = await this.markdownService.enhancedMarkdownToHTML(text) 149 html = await this.markdownService.enhancedMarkdownToHTML({ markdown: text })
150 } 150 }
151 151
152 if (this.markdownVideo) { 152 if (this.markdownVideo) {
diff --git a/client/src/app/shared/shared-instance/instance.service.ts b/client/src/app/shared/shared-instance/instance.service.ts
index 0241f56ef..89f47db24 100644
--- a/client/src/app/shared/shared-instance/instance.service.ts
+++ b/client/src/app/shared/shared-instance/instance.service.ts
@@ -51,7 +51,7 @@ export class InstanceService {
51 } 51 }
52 52
53 for (const key of Object.keys(html)) { 53 for (const key of Object.keys(html)) {
54 html[key] = await this.markdownService.textMarkdownToHTML(about.instance[key]) 54 html[key] = await this.markdownService.textMarkdownToHTML({ markdown: about.instance[key] })
55 } 55 }
56 56
57 return html 57 return html
diff --git a/client/src/app/shared/shared-support-modal/support-modal.component.ts b/client/src/app/shared/shared-support-modal/support-modal.component.ts
index 08e997f7b..f330228e1 100644
--- a/client/src/app/shared/shared-support-modal/support-modal.component.ts
+++ b/client/src/app/shared/shared-support-modal/support-modal.component.ts
@@ -27,7 +27,7 @@ export class SupportModalComponent {
27 27
28 const support = this.video?.support || this.videoChannel.support 28 const support = this.video?.support || this.videoChannel.support
29 29
30 this.markdownService.enhancedMarkdownToHTML(support) 30 this.markdownService.enhancedMarkdownToHTML({ markdown: support })
31 .then(r => { 31 .then(r => {
32 this.htmlSupport = r 32 this.htmlSupport = r
33 }) 33 })
diff --git a/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts b/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts
index dd9fe0a5a..225c4eb64 100644
--- a/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts
+++ b/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts
@@ -32,7 +32,7 @@ export class VideoPlaylistMiniatureComponent implements OnInit {
32 async ngOnInit () { 32 async ngOnInit () {
33 this.buildPlaylistUrl() 33 this.buildPlaylistUrl()
34 if (this.displayDescription) { 34 if (this.displayDescription) {
35 this.playlistDescription = await this.markdownService.textMarkdownToHTML(this.playlist.description) 35 this.playlistDescription = await this.markdownService.textMarkdownToHTML({ markdown: this.playlist.description })
36 } 36 }
37 } 37 }
38 38