diff --git a/client/src/app/+admin/config/edit-custom-config/edit-instance-information.component.html b/client/src/app/+admin/config/edit-custom-config/edit-instance-information.component.html index 4b12ac768e6..d057423763a 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-instance-information.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-instance-information.component.html @@ -61,7 +61,7 @@

INSTANCE

- +
- + + + + + diff --git a/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts b/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts index 4dbbda0aa1a..0ce89b201d9 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts @@ -5,6 +5,8 @@ import { Notifier, User, UserService } from '@app/core' import { USER_DESCRIPTION_VALIDATOR, USER_DISPLAY_NAME_REQUIRED_VALIDATOR } from '@app/shared/form-validators/user-validators' import { FormReactive } from '@app/shared/shared-forms/form-reactive' import { FormReactiveService } from '@app/shared/shared-forms/form-reactive.service' +import { MarkdownTextareaComponent } from '@app/shared/shared-forms/markdown-textarea.component' +import { HelpComponent } from '@app/shared/shared-main/buttons/help.component' import { AlertComponent } from '@app/shared/shared-main/common/alert.component' @Component({ @@ -12,7 +14,7 @@ import { AlertComponent } from '@app/shared/shared-main/common/alert.component' templateUrl: './my-account-profile.component.html', styleUrls: [ './my-account-profile.component.scss' ], standalone: true, - imports: [ NgIf, FormsModule, ReactiveFormsModule, NgClass, AlertComponent ] + imports: [ NgIf, FormsModule, ReactiveFormsModule, NgClass, AlertComponent, HelpComponent, MarkdownTextareaComponent ] }) export class MyAccountProfileComponent extends FormReactive implements OnInit { @Input() user: User = null diff --git a/client/src/app/shared/shared-custom-markup/custom-markup-help.component.html b/client/src/app/shared/shared-custom-markup/custom-markup-help.component.html index fc649db599b..63d2508b418 100644 --- a/client/src/app/shared/shared-custom-markup/custom-markup-help.component.html +++ b/client/src/app/shared/shared-custom-markup/custom-markup-help.component.html @@ -1,3 +1,11 @@ - Markdown compatible that also supports custom PeerTube HTML tags + Markdown compatible that also supports custom PeerTube HTML tags. + +@if (supportRelMe) { +
+ + + Mastodon verification link is also supported. + +} diff --git a/client/src/app/shared/shared-custom-markup/custom-markup-help.component.ts b/client/src/app/shared/shared-custom-markup/custom-markup-help.component.ts index 62c2fddaee7..43a8d7b31dd 100644 --- a/client/src/app/shared/shared-custom-markup/custom-markup-help.component.ts +++ b/client/src/app/shared/shared-custom-markup/custom-markup-help.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core' +import { booleanAttribute, Component, Input } from '@angular/core' @Component({ selector: 'my-custom-markup-help', @@ -6,4 +6,5 @@ import { Component } from '@angular/core' standalone: true }) export class CustomMarkupHelpComponent { + @Input({ transform: booleanAttribute }) supportRelMe = false } 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 2e1e5899a59..217a7913ce6 100644 --- a/client/src/app/shared/shared-forms/markdown-textarea.component.ts +++ b/client/src/app/shared/shared-forms/markdown-textarea.component.ts @@ -54,6 +54,8 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit { @Input({ required: true }) inputId: string @Input() dir: string + + @Input({ transform: booleanAttribute }) withHtml = false @Input({ transform: booleanAttribute }) withEmoji = false @ViewChild('textarea') textareaElement: ElementRef @@ -163,9 +165,9 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit { html = result } else if (this.markdownType === 'text') { - html = await this.markdownService.textMarkdownToHTML({ markdown: text, withEmoji: this.withEmoji }) + html = await this.markdownService.textMarkdownToHTML({ markdown: text, withEmoji: this.withEmoji, withHtml: this.withHtml }) } else if (this.markdownType === 'enhanced') { - html = await this.markdownService.enhancedMarkdownToHTML({ markdown: text, withEmoji: this.withEmoji }) + html = await this.markdownService.enhancedMarkdownToHTML({ markdown: text, withEmoji: this.withEmoji, withHtml: this.withHtml }) } else if (this.markdownType === 'to-unsafe-html') { html = await this.markdownService.markdownToUnsafeHTML({ markdown: text }) } diff --git a/client/src/app/shared/shared-main/buttons/help.component.ts b/client/src/app/shared/shared-main/buttons/help.component.ts index 8bf94276ac1..322e9ae00ab 100644 --- a/client/src/app/shared/shared-main/buttons/help.component.ts +++ b/client/src/app/shared/shared-main/buttons/help.component.ts @@ -1,9 +1,19 @@ -import { AfterContentInit, Component, ContentChildren, Input, OnChanges, OnInit, QueryList, TemplateRef } from '@angular/core' +import { NgIf, NgTemplateOutlet } from '@angular/common' +import { + AfterContentInit, + booleanAttribute, + Component, + ContentChildren, + Input, + OnChanges, + OnInit, + QueryList, + TemplateRef +} from '@angular/core' import { GlobalIconName } from '@app/shared/shared-icons/global-icon.component' +import { NgbPopover } from '@ng-bootstrap/ng-bootstrap' import { ENHANCED_RULES, TEXT_RULES } from '@peertube/peertube-core-utils' import { GlobalIconComponent } from '../../shared-icons/global-icon.component' -import { NgbPopover } from '@ng-bootstrap/ng-bootstrap' -import { NgIf, NgTemplateOutlet } from '@angular/common' import { PeerTubeTemplateDirective } from '../common/peertube-template.directive' @Component({ @@ -20,6 +30,7 @@ export class HelpComponent implements OnInit, OnChanges, AfterContentInit { @Input() iconName: GlobalIconName = 'help' @Input() title = $localize`Get help` @Input() autoClose = 'outside' + @Input({ transform: booleanAttribute }) supportRelMe = false @ContentChildren(PeerTubeTemplateDirective) templates: QueryList> @@ -76,9 +87,17 @@ export class HelpComponent implements OnInit, OnChanges, AfterContentInit { } private formatMarkdownSupport (rules: string[]) { - /* eslint-disable max-len */ - return $localize`Markdown compatible that supports:` + + let str = + // eslint-disable-next-line max-len + $localize`Markdown compatible that supports:` + this.createMarkdownList(rules) + + if (this.supportRelMe) { + // eslint-disable-next-line max-len + str += $localize`Mastodon verification link is also supported.` + } + + return str } private createMarkdownList (rules: string[]) { 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 864fca2ba17..6ec2284a4c4 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 @@ -30,10 +30,8 @@ export class SupportModalComponent { const support = this.video?.support || this.videoChannel.support - this.markdownService.enhancedMarkdownToHTML({ markdown: support }) - .then(r => { - this.htmlSupport = r - }) + this.markdownService.enhancedMarkdownToHTML({ markdown: support, withEmoji: true, withHtml: true }) + .then(r => this.htmlSupport = r) this.displayName = this.video ? this.video.channel.displayName diff --git a/client/src/app/shared/standalone-channels/video-channel-edit.component.html b/client/src/app/shared/standalone-channels/video-channel-edit.component.html index 1ebf4e5a6ab..2463d7c33e7 100644 --- a/client/src/app/shared/standalone-channels/video-channel-edit.component.html +++ b/client/src/app/shared/standalone-channels/video-channel-edit.component.html @@ -43,7 +43,7 @@

UPDATE CHANNEL