diff options
author | Chocobozzz <me@florianbigard.com> | 2022-06-20 15:56:16 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-06-20 15:56:16 +0200 |
commit | 9bc3622320dc43474ce4b60c222ec25e6e657b97 (patch) | |
tree | 081aadbe0c3e69425dbe1946d98fd890785c1aef /client/src/app/shared | |
parent | 3031971ec21ed6400d3b73d1f7e00b44d1617667 (diff) | |
download | PeerTube-9bc3622320dc43474ce4b60c222ec25e6e657b97.tar.gz PeerTube-9bc3622320dc43474ce4b60c222ec25e6e657b97.tar.zst PeerTube-9bc3622320dc43474ce4b60c222ec25e6e657b97.zip |
Handle input error in markdown textarea
Diffstat (limited to 'client/src/app/shared')
4 files changed, 11 insertions, 11 deletions
diff --git a/client/src/app/shared/shared-forms/dynamic-form-field.component.html b/client/src/app/shared/shared-forms/dynamic-form-field.component.html index 2ec436ac6..61f9ae8ff 100644 --- a/client/src/app/shared/shared-forms/dynamic-form-field.component.html +++ b/client/src/app/shared/shared-forms/dynamic-form-field.component.html | |||
@@ -28,19 +28,19 @@ | |||
28 | 28 | ||
29 | <my-markdown-textarea | 29 | <my-markdown-textarea |
30 | *ngIf="setting.type === 'markdown-text'" | 30 | *ngIf="setting.type === 'markdown-text'" |
31 | markdownType="text" [id]="setting.name" [formControlName]="setting.name" textareaWidth="500px" | 31 | markdownType="text" [id]="setting.name" [formControlName]="setting.name" |
32 | [classes]="{ 'input-error': formErrors['settings.name'] }" | 32 | [formError]="formErrors['settings.name']" |
33 | ></my-markdown-textarea> | 33 | ></my-markdown-textarea> |
34 | 34 | ||
35 | <my-markdown-textarea | 35 | <my-markdown-textarea |
36 | *ngIf="setting.type === 'markdown-enhanced'" | 36 | *ngIf="setting.type === 'markdown-enhanced'" |
37 | markdownType="enhanced" [id]="setting.name" [formControlName]="setting.name" textareaWidth="500px" | 37 | markdownType="enhanced" [id]="setting.name" [formControlName]="setting.name" |
38 | [classes]="{ 'input-error': formErrors['settings.name'] }" | 38 | [formError]="formErrors['settings.name']" |
39 | ></my-markdown-textarea> | 39 | ></my-markdown-textarea> |
40 | 40 | ||
41 | <div *ngIf="setting.type === 'html'" [innerHTML]="setting.html"></div> | 41 | <div *ngIf="setting.type === 'html'" [innerHTML]="setting.html"></div> |
42 | 42 | ||
43 | <div *ngIf="formErrors[setting.name]" class="form-error"> | 43 | <div *ngIf="setting.type !== 'markdown-text' && setting.type !== 'markdown-enhanced' && formErrors[setting.name]" class="form-error"> |
44 | {{ formErrors[setting.name] }} | 44 | {{ formErrors[setting.name] }} |
45 | </div> | 45 | </div> |
46 | 46 | ||
diff --git a/client/src/app/shared/shared-forms/dynamic-form-field.component.scss b/client/src/app/shared/shared-forms/dynamic-form-field.component.scss index 31bf59edb..0737f372a 100644 --- a/client/src/app/shared/shared-forms/dynamic-form-field.component.scss +++ b/client/src/app/shared/shared-forms/dynamic-form-field.component.scss | |||
@@ -26,3 +26,8 @@ textarea { | |||
26 | my-peertube-checkbox + .label-small-info { | 26 | my-peertube-checkbox + .label-small-info { |
27 | margin-top: 5px; | 27 | margin-top: 5px; |
28 | } | 28 | } |
29 | |||
30 | my-markdown-textarea { | ||
31 | display: block; | ||
32 | max-width: 500px; | ||
33 | } | ||
diff --git a/client/src/app/shared/shared-forms/markdown-textarea.component.html b/client/src/app/shared/shared-forms/markdown-textarea.component.html index afb046c7f..5a9ff1a15 100644 --- a/client/src/app/shared/shared-forms/markdown-textarea.component.html +++ b/client/src/app/shared/shared-forms/markdown-textarea.component.html | |||
@@ -1,10 +1,9 @@ | |||
1 | <div class="root" [ngClass]="{ 'maximized': isMaximized }" [ngStyle]="{ 'max-width': textareaMaxWidth }"> | 1 | <div class="root" [ngClass]="{ 'maximized': isMaximized }"> |
2 | 2 | ||
3 | <textarea #textarea | 3 | <textarea #textarea |
4 | [(ngModel)]="content" (ngModelChange)="onModelChange()" | 4 | [(ngModel)]="content" (ngModelChange)="onModelChange()" |
5 | class="form-control" [ngClass]="{ 'input-error': formError }" | 5 | class="form-control" [ngClass]="{ 'input-error': formError }" |
6 | [attr.disabled]="disabled || null" | 6 | [attr.disabled]="disabled || null" |
7 | [ngStyle]="{ height: textareaHeight }" | ||
8 | [id]="name" [name]="name"> | 7 | [id]="name" [name]="name"> |
9 | </textarea> | 8 | </textarea> |
10 | 9 | ||
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 5a603c157..089991884 100644 --- a/client/src/app/shared/shared-forms/markdown-textarea.component.ts +++ b/client/src/app/shared/shared-forms/markdown-textarea.component.ts | |||
@@ -25,10 +25,6 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit { | |||
25 | @Input() content = '' | 25 | @Input() content = '' |
26 | 26 | ||
27 | @Input() formError: string | 27 | @Input() formError: string |
28 | @Input() classes: string[] | { [klass: string]: any[] | any } = [] | ||
29 | |||
30 | @Input() textareaMaxWidth = '100%' | ||
31 | @Input() textareaHeight = '150px' | ||
32 | 28 | ||
33 | @Input() truncate: number | 29 | @Input() truncate: number |
34 | 30 | ||