@@ -590,14 +590,9 @@ export class CommentWidget<T, C extends IComment = IComment>
590590 return ;
591591 }
592592
593- // Code to be added for the change in color when inactive
594- // if (element.textContent == ''){
595- // target.className = 'jc-SubmitButtonInactive'
596- // return;
597- // }
598593 if ( element . classList . contains ( 'jc-ReplyInputArea' ) ) {
599594 // reply
600- if ( element . innerText == '' ) {
595+ if ( ! / \S / . test ( element . innerText ) ) {
601596 return ;
602597 }
603598 this . model . addReply (
@@ -613,12 +608,17 @@ export class CommentWidget<T, C extends IComment = IComment>
613608 return ;
614609 }
615610
616- if ( element . innerText === '' ) {
611+ if ( ! / \S / . test ( element . innerText ) ) {
617612 if ( this . isMock ) {
618613 this . dispose ( ) ;
614+ return ;
619615 }
620616 element . innerText = this . text ! ;
621617 } else {
618+ if ( this . isMock ) {
619+ this . populate ( element . innerText ) ;
620+ return ;
621+ }
622622 this . editActive ( element . innerText ) ;
623623 }
624624 this . editID = '' ;
@@ -744,7 +744,7 @@ export class CommentWidget<T, C extends IComment = IComment>
744744 const target = event . target as HTMLDivElement ;
745745 event . preventDefault ( ) ;
746746 event . stopPropagation ( ) ;
747- if ( target . innerText == '' ) {
747+ if ( ! / \S / . test ( target . innerText ) ) {
748748 return ;
749749 }
750750
@@ -791,23 +791,23 @@ export class CommentWidget<T, C extends IComment = IComment>
791791 target . blur ( ) ;
792792 break ;
793793 case 'Enter' :
794- if ( event . shiftKey ) {
794+ if ( ! event . shiftKey ) {
795795 break ;
796796 }
797797
798798 event . preventDefault ( ) ;
799799 event . stopPropagation ( ) ;
800800
801801 if ( this . isMock ) {
802- if ( target . innerText === '' ) {
803- this . dispose ( ) ;
804- } else {
802+ if ( / \S / . test ( target . innerText ) ) {
805803 this . populate ( target . innerText ) ;
804+ } else {
805+ this . dispose ( ) ;
806806 }
807807 break ;
808808 }
809809
810- if ( target . innerText === '' ) {
810+ if ( ! / \S / . test ( target . innerText ) ) {
811811 target . innerText = this . text ! ;
812812 } else {
813813 this . editActive ( target . innerText ) ;
0 commit comments