@@ -33,7 +33,10 @@ export class AppPublishEdit {
3333 private description : string ;
3434
3535 @State ( )
36- private valid : boolean = true ;
36+ private validTitle : boolean = true ;
37+
38+ @State ( )
39+ private validDescription : boolean = true ;
3740
3841 @State ( )
3942 private disablePublish : boolean = false ;
@@ -241,7 +244,7 @@ export class AppPublishEdit {
241244 }
242245
243246 private validateCaptionInput ( ) {
244- this . valid = this . validCaption ( this . caption ) ;
247+ this . validTitle = this . validCaption ( this . caption ) ;
245248 }
246249
247250 private validCaption ( title : string ) : boolean {
@@ -263,11 +266,8 @@ export class AppPublishEdit {
263266 }
264267
265268 private validateDescriptionInput ( ) {
266- this . valid = this . validDescription ( ) ;
267- }
268-
269- private validDescription ( ) : boolean {
270- return ! this . description || this . description === undefined || this . description === '' || this . description . length < Constants . DECK . DESCRIPTION_MAX_LENGTH ;
269+ this . validDescription =
270+ ! this . description || this . description === undefined || this . description === '' || this . description . length <= Constants . DECK . DESCRIPTION_MAX_LENGTH ;
271271 }
272272
273273 private onTagInput ( $event : CustomEvent < KeyboardEvent > ) : Promise < void > {
@@ -388,7 +388,7 @@ export class AppPublishEdit {
388388 onIonChange = { ( ) => this . validateCaptionInput ( ) } > </ ion-input >
389389 </ ion-item >
390390
391- < p class = { `small ${ this . valid ? undefined : 'error' } ` } >
391+ < p class = { `small ${ this . validTitle ? undefined : 'error' } ` } >
392392 The title should be provided with latin characters, arabic numerals, spaces and dash. It must not be longer than { Constants . DECK . TITLE_MAX_LENGTH } { ' ' }
393393 characters.
394394 </ p >
@@ -456,9 +456,9 @@ export class AppPublishEdit {
456456
457457 private renderTitleLabel ( ) {
458458 return (
459- < ion-item class = { `item-title ${ this . valid ? undefined : 'error' } ` } >
459+ < ion-item class = { `item-title ${ this . validTitle ? undefined : 'error' } ` } >
460460 < ion-label >
461- Title { this . valid ? undefined : < ion-icon aria-label = "Title needs to match the expected format" name = "warning-outline" > </ ion-icon > }
461+ Title { this . validTitle ? undefined : < ion-icon aria-label = "Title needs to match the expected format" name = "warning-outline" > </ ion-icon > }
462462 </ ion-label >
463463 </ ion-item >
464464 ) ;
@@ -467,7 +467,11 @@ export class AppPublishEdit {
467467 private renderPublish ( disable : boolean ) {
468468 if ( ! disable ) {
469469 return (
470- < ion-button type = "submit" disabled = { ! this . valid || this . disablePublish || ! apiUserStore . state . apiUser } color = "tertiary" shape = "round" >
470+ < ion-button
471+ type = "submit"
472+ disabled = { ! this . validTitle || ! this . validDescription || this . disablePublish || ! apiUserStore . state . apiUser }
473+ color = "tertiary"
474+ shape = "round" >
471475 < ion-label > Publish now</ ion-label >
472476 </ ion-button >
473477 ) ;
0 commit comments