Fix markdown textarea input id/name

pull/6648/head
Chocobozzz 2024-09-19 16:08:36 +02:00
parent 47071627c5
commit 68adc696b9
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
9 changed files with 21 additions and 19 deletions

View File

@ -134,7 +134,7 @@
<label i18n for="broadcastMessageMessage">Message</label><my-help helpType="markdownText"></my-help> <label i18n for="broadcastMessageMessage">Message</label><my-help helpType="markdownText"></my-help>
<my-markdown-textarea <my-markdown-textarea
name="broadcastMessageMessage" formControlName="message" inputId="broadcastMessageMessage" formControlName="message"
[formError]="formErrors['broadcastMessage.message']" markdownType="to-unsafe-html" [formError]="formErrors['broadcastMessage.message']" markdownType="to-unsafe-html"
></my-markdown-textarea> ></my-markdown-textarea>

View File

@ -16,7 +16,7 @@
</div> </div>
<my-markdown-textarea <my-markdown-textarea
name="instanceCustomHomepageContent" formControlName="content" inputId="instanceCustomHomepageContent" formControlName="content"
[customMarkdownRenderer]="getCustomMarkdownRenderer()" [debounceTime]="500" [customMarkdownRenderer]="getCustomMarkdownRenderer()" [debounceTime]="500"
[formError]="formErrors['instanceCustomHomepage.content']" [formError]="formErrors['instanceCustomHomepage.content']"
dir="ltr" dir="ltr"

View File

@ -65,7 +65,7 @@
</div> </div>
<my-markdown-textarea <my-markdown-textarea
name="instanceDescription" formControlName="description" inputId="instanceDescription" formControlName="description"
[customMarkdownRenderer]="getCustomMarkdownRenderer()" [debounceTime]="500" [customMarkdownRenderer]="getCustomMarkdownRenderer()" [debounceTime]="500"
[formError]="formErrors['instance.description']" [formError]="formErrors['instance.description']"
></my-markdown-textarea> ></my-markdown-textarea>
@ -152,7 +152,7 @@
<label i18n for="instanceTerms">Terms</label><my-help helpType="markdownText"></my-help> <label i18n for="instanceTerms">Terms</label><my-help helpType="markdownText"></my-help>
<my-markdown-textarea <my-markdown-textarea
name="instanceTerms" formControlName="terms" markdownType="enhanced" inputId="instanceTerms" formControlName="terms" markdownType="enhanced"
[formError]="formErrors['instance.terms']" [formError]="formErrors['instance.terms']"
></my-markdown-textarea> ></my-markdown-textarea>
</div> </div>
@ -161,7 +161,7 @@
<label i18n for="instanceCodeOfConduct">Code of conduct</label><my-help helpType="markdownText"></my-help> <label i18n for="instanceCodeOfConduct">Code of conduct</label><my-help helpType="markdownText"></my-help>
<my-markdown-textarea <my-markdown-textarea
name="instanceCodeOfConduct" formControlName="codeOfConduct" markdownType="enhanced" inputId="instanceCodeOfConduct" formControlName="codeOfConduct" markdownType="enhanced"
[formError]="formErrors['instance.codeOfConduct']" [formError]="formErrors['instance.codeOfConduct']"
></my-markdown-textarea> ></my-markdown-textarea>
</div> </div>
@ -171,7 +171,7 @@
<div i18n class="label-small-info">Who moderates the instance? What is the policy regarding NSFW videos? Political videos? etc</div> <div i18n class="label-small-info">Who moderates the instance? What is the policy regarding NSFW videos? Political videos? etc</div>
<my-markdown-textarea <my-markdown-textarea
name="instanceModerationInformation" formControlName="moderationInformation" markdownType="enhanced" inputId="instanceModerationInformation" formControlName="moderationInformation" markdownType="enhanced"
[formError]="formErrors['instance.moderationInformation']" [formError]="formErrors['instance.moderationInformation']"
></my-markdown-textarea> ></my-markdown-textarea>
</div> </div>
@ -191,7 +191,7 @@
<div i18n class="label-small-info">A single person? A non-profit? A company?</div> <div i18n class="label-small-info">A single person? A non-profit? A company?</div>
<my-markdown-textarea <my-markdown-textarea
name="instanceAdministrator" formControlName="administrator" markdownType="enhanced" inputId="instanceAdministrator" formControlName="administrator" markdownType="enhanced"
[formError]="formErrors['instance.administrator']" [formError]="formErrors['instance.administrator']"
></my-markdown-textarea> ></my-markdown-textarea>
</div> </div>
@ -201,7 +201,7 @@
<div i18n class="label-small-info">To share your personal videos? To open registrations and allow people to upload what they want?</div> <div i18n class="label-small-info">To share your personal videos? To open registrations and allow people to upload what they want?</div>
<my-markdown-textarea <my-markdown-textarea
name="instanceCreationReason" formControlName="creationReason" markdownType="enhanced" inputId="instanceCreationReason" formControlName="creationReason" markdownType="enhanced"
[formError]="formErrors['instance.creationReason']" [formError]="formErrors['instance.creationReason']"
></my-markdown-textarea> ></my-markdown-textarea>
</div> </div>
@ -211,7 +211,7 @@
<div i18n class="label-small-info">It's important to know for users who want to register on your instance</div> <div i18n class="label-small-info">It's important to know for users who want to register on your instance</div>
<my-markdown-textarea <my-markdown-textarea
name="instanceMaintenanceLifetime" formControlName="maintenanceLifetime" markdownType="enhanced" inputId="instanceMaintenanceLifetime" formControlName="maintenanceLifetime" markdownType="enhanced"
[formError]="formErrors['instance.maintenanceLifetime']" [formError]="formErrors['instance.maintenanceLifetime']"
></my-markdown-textarea> ></my-markdown-textarea>
</div> </div>
@ -221,7 +221,7 @@
<div i18n class="label-small-info">With your own funds? With user donations? Advertising?</div> <div i18n class="label-small-info">With your own funds? With user donations? Advertising?</div>
<my-markdown-textarea <my-markdown-textarea
name="instanceBusinessModel" formControlName="businessModel" markdownType="enhanced" inputId="instanceBusinessModel" formControlName="businessModel" markdownType="enhanced"
[formError]="formErrors['instance.businessModel']" [formError]="formErrors['instance.businessModel']"
></my-markdown-textarea> ></my-markdown-textarea>
</div> </div>
@ -241,7 +241,7 @@
<div i18n class="label-small-info">i.e. 2vCore 2GB RAM, a direct the link to the server you rent, etc.</div> <div i18n class="label-small-info">i.e. 2vCore 2GB RAM, a direct the link to the server you rent, etc.</div>
<my-markdown-textarea <my-markdown-textarea
name="instanceHardwareInformation" formControlName="hardwareInformation" markdownType="enhanced" inputId="instanceHardwareInformation" formControlName="hardwareInformation" markdownType="enhanced"
[formError]="formErrors['instance.hardwareInformation']" [formError]="formErrors['instance.hardwareInformation']"
></my-markdown-textarea> ></my-markdown-textarea>
</div> </div>

View File

@ -70,7 +70,7 @@
></my-help> ></my-help>
<my-markdown-textarea <my-markdown-textarea
id="support" formControlName="support" class="d-block" inputId="support" formControlName="support" class="d-block"
markdownType="enhanced" [formError]="formErrors['support']" markdownType="enhanced" [formError]="formErrors['support']"
></my-markdown-textarea> ></my-markdown-textarea>
</div> </div>

View File

@ -54,7 +54,7 @@
<div class="form-group"> <div class="form-group">
<label i18n for="description">Description</label><my-help helpType="markdownText"></my-help> <label i18n for="description">Description</label><my-help helpType="markdownText"></my-help>
<my-markdown-textarea id="description" formControlName="description" [formError]="formErrors['description']"></my-markdown-textarea> <my-markdown-textarea inputId="description" formControlName="description" [formError]="formErrors['description']"></my-markdown-textarea>
</div> </div>
<div class="form-group"> <div class="form-group">

View File

@ -54,6 +54,7 @@
</my-help> </my-help>
<my-markdown-textarea <my-markdown-textarea
inputId="description"
formControlName="description" [markdownVideo]="publishedVideo" formControlName="description" [markdownVideo]="publishedVideo"
[formError]="formErrors.description" truncateTo3Lines="true" withEmoji="true" [formError]="formErrors.description" truncateTo3Lines="true" withEmoji="true"
></my-markdown-textarea> ></my-markdown-textarea>
@ -395,6 +396,7 @@
<div class="form-group"> <div class="form-group">
<label i18n for="support">Support</label> <label i18n for="support">Support</label>
<my-help helpType="markdownEnhanced"> <my-help helpType="markdownEnhanced">
<ng-template ptTemplate="preHtml"> <ng-template ptTemplate="preHtml">
<ng-container i18n> <ng-container i18n>
@ -404,7 +406,7 @@
</my-help> </my-help>
<my-markdown-textarea <my-markdown-textarea
id="support" formControlName="support" markdownType="enhanced" inputId="support" formControlName="support" markdownType="enhanced"
[formError]="formErrors['support']" [formError]="formErrors['support']"
></my-markdown-textarea> ></my-markdown-textarea>
</div> </div>
@ -440,7 +442,7 @@
</div> </div>
<p-calendar <p-calendar
id="originallyPublishedAt" formControlName="originallyPublishedAt" [dateFormat]="calendarDateFormat" [firstDayOfWeek]="0" inputId="originallyPublishedAt" formControlName="originallyPublishedAt" [dateFormat]="calendarDateFormat" [firstDayOfWeek]="0"
[showTime]="true" [hideOnDateTimeSelect]="true" [monthNavigator]="true" [yearNavigator]="true" [yearRange]="myYearRange" [showTime]="true" [hideOnDateTimeSelect]="true" [monthNavigator]="true" [yearNavigator]="true" [yearRange]="myYearRange"
> >
</p-calendar> </p-calendar>

View File

@ -28,13 +28,13 @@
<my-markdown-textarea <my-markdown-textarea
*ngIf="setting.type === 'markdown-text'" *ngIf="setting.type === 'markdown-text'"
markdownType="text" [id]="setting.name" [formControlName]="setting.name" markdownType="text" [inputId]="setting.name" [formControlName]="setting.name"
[formError]="formErrors['settings.name']" [formError]="formErrors['settings.name']"
></my-markdown-textarea> ></my-markdown-textarea>
<my-markdown-textarea <my-markdown-textarea
*ngIf="setting.type === 'markdown-enhanced'" *ngIf="setting.type === 'markdown-enhanced'"
markdownType="enhanced" [id]="setting.name" [formControlName]="setting.name" markdownType="enhanced" [inputId]="setting.name" [formControlName]="setting.name"
[formError]="formErrors['settings.name']" [formError]="formErrors['settings.name']"
></my-markdown-textarea> ></my-markdown-textarea>

View File

@ -4,7 +4,7 @@
[(ngModel)]="content" (ngModelChange)="onModelChange()" [(ngModel)]="content" (ngModelChange)="onModelChange()"
class="form-control" [ngClass]="{ 'input-error': formError }" class="form-control" [ngClass]="{ 'input-error': formError }"
[attr.disabled]="disabled || null" [attr.disabled]="disabled || null"
[id]="name" [name]="name" [dir]="dir"> [id]="inputId" [name]="inputId" [dir]="dir">
</textarea> </textarea>
<div ngbNav #nav="ngbNav" class="nav-pills nav-preview"> <div ngbNav #nav="ngbNav" class="nav-pills nav-preview">

View File

@ -51,7 +51,7 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit {
@Input() markdownVideo: Video @Input() markdownVideo: Video
@Input() name = 'description' @Input({ required: true }) inputId: string
@Input() dir: string @Input() dir: string
@Input({ transform: booleanAttribute }) withEmoji = false @Input({ transform: booleanAttribute }) withEmoji = false