X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fmisc%2Fhelp.component.ts;h=e7af61b4a8e36103d98d1f357aae8d5576e95473;hb=4bdd9473fdecfa7e309e3c59b05b29d0a20ac397;hp=89dd1dae5b0a6d919b86aa8bbe65533dd9a074b5;hpb=5afdd0a52f2f1fa79ed9bf241b5a525366658fa1;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/misc/help.component.ts b/client/src/app/shared/misc/help.component.ts index 89dd1dae5..e7af61b4a 100644 --- a/client/src/app/shared/misc/help.component.ts +++ b/client/src/app/shared/misc/help.component.ts @@ -1,6 +1,6 @@ -import { Component, ElementRef, HostListener, Input, OnInit, ViewChild, OnChanges } from '@angular/core' +import { Component, Input, OnChanges, OnInit } from '@angular/core' import { MarkdownService } from '@app/videos/shared' -import { TooltipDirective } from 'ngx-bootstrap/tooltip' +import { I18n } from '@ngx-translate/i18n-polyfill' @Component({ selector: 'my-help', @@ -9,15 +9,15 @@ import { TooltipDirective } from 'ngx-bootstrap/tooltip' }) export class HelpComponent implements OnInit, OnChanges { - @ViewChild('tooltipDirective') tooltipDirective: TooltipDirective @Input() preHtml = '' @Input() postHtml = '' @Input() customHtml = '' @Input() helpType: 'custom' | 'markdownText' | 'markdownEnhanced' = 'custom' + @Input() tooltipPlacement = 'right' mainHtml = '' - constructor (private elementRef: ElementRef) { } + constructor (private i18n: I18n) { } ngOnInit () { this.init() @@ -27,15 +27,6 @@ export class HelpComponent implements OnInit, OnChanges { this.init() } - @HostListener('document:click', ['$event.target']) - public onClick (targetElement) { - const clickedInside = this.elementRef.nativeElement.contains(targetElement) - - if (this.tooltipDirective.isOpen && !clickedInside) { - this.tooltipDirective.hide() - } - } - private init () { if (this.helpType === 'custom') { this.mainHtml = this.customHtml @@ -54,18 +45,18 @@ export class HelpComponent implements OnInit, OnChanges { } private formatMarkdownSupport (rules: string[]) { - return 'Markdown ' + - 'compatible that supports:' + + // tslint:disable:max-line-length + return this.i18n('Markdown compatible that supports:') + this.createMarkdownList(rules) } private createMarkdownList (rules: string[]) { const rulesToText = { - 'emphasis': 'Emphasis', - 'link': 'Links', - 'newline': 'New lines', - 'list': 'Lists', - 'image': 'Images' + 'emphasis': this.i18n('Emphasis'), + 'link': this.i18n('Links'), + 'newline': this.i18n('New lines'), + 'list': this.i18n('Lists'), + 'image': this.i18n('Images') } const bullets = rules.map(r => rulesToText[r])