Add markown compatible help icon in comment textarea
This commit is contained in:
parent
cb54210c19
commit
3c176894ba
|
@ -3,6 +3,20 @@
|
||||||
<img [src]="getAvatarUrl()" alt="Avatar" />
|
<img [src]="getAvatarUrl()" alt="Avatar" />
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
<my-help class="markdown-guide" helpType="custom" iconName="markdown" i18n-title title="Markdown compatible">
|
||||||
|
<ng-template ptTemplate="customHtml">
|
||||||
|
<div i18n>
|
||||||
|
Markdown compatible that supports:
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Emphasis: <strong>**bold**</strong>, <i>_italic_</i></li>
|
||||||
|
<li>Links</li>
|
||||||
|
<li>Break lines</li>
|
||||||
|
<li>Lists</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</ng-template>
|
||||||
|
</my-help>
|
||||||
<textarea i18n-placeholder placeholder="Add comment..." myAutoResize
|
<textarea i18n-placeholder placeholder="Add comment..." myAutoResize
|
||||||
[readonly]="(user === null) ? true : false"
|
[readonly]="(user === null) ? true : false"
|
||||||
(click)="openVisitorModal($event)"
|
(click)="openVisitorModal($event)"
|
||||||
|
|
|
@ -19,11 +19,49 @@ form {
|
||||||
.form-group {
|
.form-group {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
$peertube-textarea-height: 60px;
|
||||||
|
$markdown-icon-height: 18px;
|
||||||
|
$markdown-icon-width: 30px;
|
||||||
|
|
||||||
|
.markdown-guide {
|
||||||
|
position: absolute;
|
||||||
|
top: 5px;
|
||||||
|
left: 4px;
|
||||||
|
|
||||||
|
@media screen and (max-width: 600px) {
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .help-tooltip-button {
|
||||||
|
my-global-icon {
|
||||||
|
height: $markdown-icon-height;
|
||||||
|
width: $markdown-icon-width;
|
||||||
|
|
||||||
|
svg {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus, &:active, &:hover {
|
||||||
|
my-global-icon svg {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
textarea {
|
textarea {
|
||||||
@include peertube-textarea(100%, 60px);
|
@include peertube-textarea(100%, $peertube-textarea-height);
|
||||||
@include button-focus(pvar(--mainColorLightest));
|
@include button-focus(pvar(--mainColorLightest));
|
||||||
|
|
||||||
|
text-indent: $markdown-icon-width;
|
||||||
|
|
||||||
|
@media screen and (max-width: 600px) {
|
||||||
|
text-indent: $markdown-icon-width + 5px;
|
||||||
|
}
|
||||||
|
|
||||||
&:focus::placeholder {
|
&:focus::placeholder {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { HooksService } from '@app/core/plugins/hooks.service'
|
||||||
const icons = {
|
const icons = {
|
||||||
// misc icons
|
// misc icons
|
||||||
'npm': require('!!raw-loader?!../../../assets/images/misc/npm.svg').default,
|
'npm': require('!!raw-loader?!../../../assets/images/misc/npm.svg').default,
|
||||||
|
'markdown': require('!!raw-loader?!../../../assets/images/misc/markdown.svg').default,
|
||||||
'language': require('!!raw-loader?!../../../assets/images/misc/language.svg').default,
|
'language': require('!!raw-loader?!../../../assets/images/misc/language.svg').default,
|
||||||
'video-lang': require('!!raw-loader?!../../../assets/images/misc/video-lang.svg').default,
|
'video-lang': require('!!raw-loader?!../../../assets/images/misc/video-lang.svg').default,
|
||||||
'support': require('!!raw-loader?!../../../assets/images/misc/support.svg').default,
|
'support': require('!!raw-loader?!../../../assets/images/misc/support.svg').default,
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
role="button"
|
role="button"
|
||||||
class="help-tooltip-button"
|
class="help-tooltip-button"
|
||||||
container="body"
|
container="body"
|
||||||
title="Get help"
|
[title]="title"
|
||||||
i18n-title
|
tabindex=0
|
||||||
popoverClass="help-popover"
|
popoverClass="help-popover"
|
||||||
[attr.aria-pressed]="isPopoverOpened"
|
[attr.aria-pressed]="isPopoverOpened"
|
||||||
[ngbPopover]="tooltipTemplate"
|
[ngbPopover]="tooltipTemplate"
|
||||||
|
@ -36,5 +36,5 @@
|
||||||
(onHidden)="onPopoverHidden()"
|
(onHidden)="onPopoverHidden()"
|
||||||
(onShown)="onPopoverShown()"
|
(onShown)="onPopoverShown()"
|
||||||
>
|
>
|
||||||
<my-global-icon iconName="help"></my-global-icon>
|
<my-global-icon [iconName]="iconName"></my-global-icon>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -5,14 +5,17 @@
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border: none;
|
border: none;
|
||||||
|
|
||||||
|
margin: 5px;
|
||||||
|
|
||||||
my-global-icon {
|
my-global-icon {
|
||||||
width: 17px;
|
width: 17px;
|
||||||
position: relative;
|
position: relative;
|
||||||
top: -1px;
|
top: -1px;
|
||||||
margin: 5px;
|
|
||||||
|
|
||||||
@include apply-svg-color(pvar(--greyForegroundColor))
|
@include apply-svg-color(pvar(--greyForegroundColor))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@include disable-outline;
|
||||||
}
|
}
|
||||||
|
|
||||||
::ng-deep {
|
::ng-deep {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { AfterContentInit, Component, ContentChildren, Input, OnChanges, OnInit, QueryList, TemplateRef } from '@angular/core'
|
import { AfterContentInit, Component, ContentChildren, Input, OnChanges, OnInit, QueryList, TemplateRef } from '@angular/core'
|
||||||
import { MarkdownService } from '@app/core'
|
import { MarkdownService } from '@app/core'
|
||||||
|
import { GlobalIconName } from '@app/shared/shared-icons'
|
||||||
import { PeerTubeTemplateDirective } from '../angular'
|
import { PeerTubeTemplateDirective } from '../angular'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -11,6 +12,8 @@ import { PeerTubeTemplateDirective } from '../angular'
|
||||||
export class HelpComponent implements OnInit, OnChanges, AfterContentInit {
|
export class HelpComponent implements OnInit, OnChanges, AfterContentInit {
|
||||||
@Input() helpType: 'custom' | 'markdownText' | 'markdownEnhanced' = 'custom'
|
@Input() helpType: 'custom' | 'markdownText' | 'markdownEnhanced' = 'custom'
|
||||||
@Input() tooltipPlacement = 'right auto'
|
@Input() tooltipPlacement = 'right auto'
|
||||||
|
@Input() iconName: GlobalIconName = 'help'
|
||||||
|
@Input() title = $localize`Get help`
|
||||||
|
|
||||||
@ContentChildren(PeerTubeTemplateDirective) templates: QueryList<PeerTubeTemplateDirective<'preHtml' | 'customHtml' | 'postHtml'>>
|
@ContentChildren(PeerTubeTemplateDirective) templates: QueryList<PeerTubeTemplateDirective<'preHtml' | 'customHtml' | 'postHtml'>>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="24" viewBox="0 0 208 128"><rect width="198" height="118" x="5" y="5" ry="10" stroke="#000" stroke-width="10" fill="none"/><path d="M30 98V30h20l20 25 20-25h20v68H90V59L70 84 50 59v39zm125 0l-30-33h20V30h20v35h20z"/></svg>
|
After Width: | Height: | Size: 281 B |
Loading…
Reference in New Issue