Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 19f9496

Browse files
feat: title max length 100 for published docs (#1441)
Signed-off-by: peterpeterparker <[email protected]>
1 parent 065e6b0 commit 19f9496

File tree

6 files changed

+20
-8
lines changed

6 files changed

+20
-8
lines changed

studio/src/app/components/editor/deck/publish/app-publish-edit/app-publish-edit.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,19 +223,23 @@ export class AppPublishEdit {
223223
let title: string = ($event.target as InputTargetEvent).value;
224224
if (title && title !== undefined && title !== '') {
225225
if (!this.validCaption(title)) {
226-
title = title.substr(0, Constants.DECK.TITLE_MAX_LENGTH);
226+
title = title.slice(0, this.titleMaxLength());
227227
}
228228
}
229229

230230
this.caption = title;
231231
}
232232

233+
private titleMaxLength(): number {
234+
return this.mode === 'doc' ? Constants.DOC.TITLE_MAX_LENGTH : Constants.DECK.TITLE_MAX_LENGTH;
235+
}
236+
233237
private validateCaptionInput() {
234238
this.validTitle = this.validCaption(this.caption);
235239
}
236240

237241
private validCaption(title: string): boolean {
238-
if (!title || title === undefined || title == '' || title.length > Constants.DECK.TITLE_MAX_LENGTH) {
242+
if (!title || title === undefined || title == '' || title.length > this.titleMaxLength()) {
239243
return false;
240244
}
241245

@@ -366,14 +370,19 @@ export class AppPublishEdit {
366370
debounce={500}
367371
minlength={3}
368372
disabled={disable}
369-
maxlength={Constants.DECK.TITLE_MAX_LENGTH}
373+
maxlength={this.titleMaxLength()}
370374
required={true}
371375
input-mode="text"
372376
onIonInput={($event: CustomEvent<KeyboardEvent>) => this.onCaptionInput($event)}
373377
onIonChange={() => this.validateCaptionInput()}></ion-input>
374378
</ion-item>
375379

376-
<p class={`small ${this.validTitle ? undefined : 'error'}`}>{i18n.state.publish_edit.title_max_chars}</p>
380+
<p class={`small ${this.validTitle ? undefined : 'error'}`}>
381+
{renderI18n(i18n.state.publish_edit.title_max_chars, {
382+
placeholder: '{0}',
383+
value: `${this.titleMaxLength()}`
384+
})}
385+
</p>
377386

378387
<ion-item class="item-title">
379388
<ion-label>{i18n.state.publish_edit.description}</ion-label>

studio/src/app/types/core/constants.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ export const Constants = {
44
DESCRIPTION_MAX_LENGTH: 500,
55
MIN_SLIDES: 3
66
},
7+
DOC: {
8+
TITLE_MAX_LENGTH: 100
9+
},
710
STORAGE: {
811
MAX_QUERY_RESULTS: 100
912
}

studio/src/assets/i18n/de.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@
432432
"modern_app": "DeckDeckGo wird sie online als moderene App zugänglich machen.",
433433
"meta": "Meta",
434434
"title_edit": "Erstelle einen Titel und eine Zusammenfassung deiner Präsentation und füge bis zu 5 Tags hinzu, um die Vorschau deiner Präsentation ansprechend zu gestalten.",
435-
"title_max_chars": "Der Titel darf Buchstaben, Zahlen, Leerzeichen und Bindestriche beinhalten und darf nicht länger als 45 Zeichen sein.",
435+
"title_max_chars": "Der Titel darf Buchstaben, Zahlen, Leerzeichen und Bindestriche beinhalten und darf nicht länger als {0} Zeichen sein.",
436436
"description": "Beschreibung",
437437
"tags": "Tags",
438438
"social_card": "DeckDeckGo generiert die Vorschau deiner Präsentation basierend auf deiner ersten Folie, wenn du sie in den sozialen Medien teilst.",

studio/src/assets/i18n/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@
432432
"modern_app": "DeckDeckGo will distribute it online as a modern app.",
433433
"meta": "Meta",
434434
"title_edit": "Edit or review your presentation's title, summary and add or change tags (up to 5) to make your presentation more inviting to readers.",
435-
"title_max_chars": "The title should be provided with latin characters, arabic numerals, spaces and dash. It must not be longer than 45 characters.",
435+
"title_max_chars": "The title should be provided with latin characters, arabic numerals, spaces and dash. It must not be longer than {0} characters.",
436436
"description": "Description",
437437
"tags": "Tags",
438438
"social_card": "DeckDeckGo will automatically generate the social card for your presentation based on the first slide of your deck.",

studio/src/assets/i18n/es.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@
432432
"modern_app": "DeckDeckGo lo distribuirá en línea como una aplicación moderna.",
433433
"meta": "Meta",
434434
"title_edit": "Edita o revisa el título de tu presentación, el resumen y añade o cambia las etiquetas (hasta 5) para que tu presentación sea más atractiva para los lectores.",
435-
"title_max_chars": "El título debe estar provisto de caracteres latinos, números arábigos, espacios y guiones. No debe tener más de 45 caracteres.",
435+
"title_max_chars": "El título debe estar provisto de caracteres latinos, números arábigos, espacios y guiones. No debe tener más de {0} caracteres.",
436436
"description": "Descripción",
437437
"tags": "Etiquetas",
438438
"social_card": "DeckDeckGo generará automáticamente la tarjeta social de tu presentación basándose en la primera diapositiva de tu paquete.",

studio/src/assets/i18n/nl.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@
432432
"modern_app": "DeckDeckGo zal het online verspreiden als een moderne app.",
433433
"meta": "Meta",
434434
"title_edit": "Bewerk of bekijk de titel en samenvatting van uw presentatie en voeg tags toe of wijzig deze (maximaal 5) om uw presentatie aantrekkelijker te maken voor lezers.",
435-
"title_max_chars": "De titel kan bestaan uit Latijnse karakters, Arabische cijfers, spaties en streepjes. Het mag niet langer zijn dan 45 tekens.",
435+
"title_max_chars": "De titel kan bestaan uit Latijnse karakters, Arabische cijfers, spaties en streepjes. Het mag niet langer zijn dan {0} tekens.",
436436
"description": "Omschrijving",
437437
"tags": "Tags",
438438
"social_card": "DeckDeckGo genereert automatisch de sociale card voor uw presentatie op basis van de eerste slide van uw deck.",

0 commit comments

Comments
 (0)