From 9bc3622320dc43474ce4b60c222ec25e6e657b97 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 20 Jun 2022 15:56:16 +0200 Subject: [PATCH] Handle input error in markdown textarea --- .../edit-basic-configuration.component.html | 4 +- .../edit-custom-config.component.scss | 13 ++++- .../edit-homepage.component.html | 6 +-- .../edit-instance-information.component.html | 54 +++++++------------ .../video-channel-edit.component.html | 2 +- .../video-channel-edit.component.scss | 5 ++ .../my-video-playlist-edit.component.html | 8 +-- .../shared/video-edit.component.html | 15 +++--- .../dynamic-form-field.component.html | 10 ++-- .../dynamic-form-field.component.scss | 5 ++ .../markdown-textarea.component.html | 3 +- .../markdown-textarea.component.ts | 4 -- client/src/sass/class-helpers.scss | 14 +++-- 13 files changed, 69 insertions(+), 74 deletions(-) diff --git a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html index 68126281f..315cd1749 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html @@ -132,8 +132,8 @@
{{ formErrors.broadcastMessage.message }}
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss index f3bce8ee0..df523cedc 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss @@ -7,12 +7,21 @@ form { padding-bottom: 1.5rem; } -input[type=text] { - @include peertube-input-text($form-base-input-width); +my-markdown-textarea { + display: block; + max-width: 500px; +} +.homepage my-markdown-textarea { display: block; + max-width: 90%; + + ::ng-deep textarea { + height: 300px !important; + } } +input[type=text], input[type=number] { @include peertube-input-text($form-base-input-width); diff --git a/client/src/app/+admin/config/edit-custom-config/edit-homepage.component.html b/client/src/app/+admin/config/edit-custom-config/edit-homepage.component.html index 701c3c0c1..5339240bb 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-homepage.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-homepage.component.html @@ -2,7 +2,7 @@ -
+
INSTANCE HOMEPAGE
@@ -16,9 +16,9 @@
{{ formErrors.instanceCustomHomepage.content }}
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 5931cb459..b54733327 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 @@ -37,12 +37,10 @@
- -
{{ formErrors.instance.description }}
@@ -127,22 +125,18 @@ - -
{{ formErrors.instance.terms }}
- -
{{ formErrors.instance.codeOfConduct }}
@@ -150,11 +144,9 @@
Who moderates the instance? What is the policy regarding NSFW videos? Political videos? etc
- -
{{ formErrors.instance.moderationInformation }}
@@ -172,11 +164,9 @@
A single person? A non-profit? A company?
- -
{{ formErrors.instance.administrator }}
@@ -184,11 +174,9 @@
To share your personal videos? To open registrations and allow people to upload what they want?
- -
{{ formErrors.instance.creationReason }}
@@ -196,11 +184,9 @@
It's important to know for users who want to register on your instance
- -
{{ formErrors.instance.maintenanceLifetime }}
@@ -208,11 +194,9 @@
With your own funds? With user donations? Advertising?
- -
{{ formErrors.instance.businessModel }}
@@ -230,11 +214,9 @@
i.e. 2vCore 2GB RAM, a direct the link to the server you rent, etc.
- -
{{ formErrors.instance.hardwareInformation }}
diff --git a/client/src/app/+manage/video-channel-edit/video-channel-edit.component.html b/client/src/app/+manage/video-channel-edit/video-channel-edit.component.html index 420881f5a..b557fb011 100644 --- a/client/src/app/+manage/video-channel-edit/video-channel-edit.component.html +++ b/client/src/app/+manage/video-channel-edit/video-channel-edit.component.html @@ -68,7 +68,7 @@ > diff --git a/client/src/app/+manage/video-channel-edit/video-channel-edit.component.scss b/client/src/app/+manage/video-channel-edit/video-channel-edit.component.scss index 008397a7a..cde848da6 100644 --- a/client/src/app/+manage/video-channel-edit/video-channel-edit.component.scss +++ b/client/src/app/+manage/video-channel-edit/video-channel-edit.component.scss @@ -42,6 +42,11 @@ textarea { display: block; } +my-markdown-textarea { + display: block; + max-width: 500px; +} + .peertube-select-container { @include peertube-select-container(340px); } diff --git a/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.component.html b/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.component.html index 35682cf81..e867f63b8 100644 --- a/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.component.html +++ b/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.component.html @@ -42,13 +42,7 @@
- -
- {{ formErrors.description }} -
+
diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.html b/client/src/app/+videos/+video-edit/shared/video-edit.component.html index b99e430dd..595200c3b 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.component.html +++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.html @@ -51,11 +51,10 @@ - - -
- {{ formErrors.description }} -
+ @@ -332,13 +331,11 @@
+ -
- {{ formErrors.support }} -
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 @@
-
+
{{ formErrors[setting.name] }}
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 { my-peertube-checkbox + .label-small-info { margin-top: 5px; } + +my-markdown-textarea { + display: block; + max-width: 500px; +} 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 @@ -
+
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 { @Input() content = '' @Input() formError: string - @Input() classes: string[] | { [klass: string]: any[] | any } = [] - - @Input() textareaMaxWidth = '100%' - @Input() textareaHeight = '150px' @Input() truncate: number diff --git a/client/src/sass/class-helpers.scss b/client/src/sass/class-helpers.scss index 87ad6a45d..f09d84882 100644 --- a/client/src/sass/class-helpers.scss +++ b/client/src/sass/class-helpers.scss @@ -70,7 +70,11 @@ } .input-error:not(:focus) { - border-color: $red !important; + &, + & + .nav-preview, // Markdown textarea + & + * + .tab-content { + border-color: $red !important; + } } .form-error, @@ -83,8 +87,12 @@ color: $red; } -.input-error:focus + .form-error { - color: pvar(--mainForegroundColor); +.input-error:focus { + & + .form-error, + & + * + .form-error, // Markdown textarea + & + * + * + .form-error { + color: pvar(--mainForegroundColor); + } } .form-group-description { -- 2.41.0