@@ -63,6 +63,7 @@ export class UploadComponent implements OnDestroy, OnInit {
6363 maxTxtSizeKB = 40 ;
6464 // Max .readalong XML text size: text * 5 is a rough heuristic; the XML is much bloated from the text.
6565 maxRasSizeKB = 200 ;
66+ currentToast : number ;
6667 @ViewChild ( "textInputElement" ) textInputElement : ElementRef ;
6768 @Output ( ) stepChange = new EventEmitter < any [ ] > ( ) ;
6869
@@ -88,9 +89,9 @@ export class UploadComponent implements OnDestroy, OnInit {
8889 this . studioService . $textInput
8990 . pipe ( takeUntil ( this . unsubscribe$ ) )
9091 . subscribe ( ( textString ) => {
91- this . uploadService . $currentText . next ( textString ) ;
9292 //provides user with warning if text size is above limit
93- this . checkIsTextSizeBelowLimit ( ) ;
93+ if ( this . checkIsTextSizeBelowLimit ( ) )
94+ this . uploadService . $currentText . next ( textString ) ;
9495 } ) ;
9596 this . ssjsService . modelLoaded
9697 . pipe ( takeUntil ( this . unsubscribe$ ) )
@@ -329,7 +330,10 @@ Please check it to make sure all words are spelled out completely, e.g. write "4
329330 if ( this . studioService . $textInput . value ) {
330331 const inputLength = this . studioService . $textInput . value . length ;
331332 if ( inputLength > this . maxTxtSizeKB * 1024 ) {
332- this . toastr . error (
333+ if ( this . currentToast ) {
334+ this . toastr . clear ( this . currentToast ) ;
335+ }
336+ this . currentToast = this . toastr . error (
333337 $localize `Text too large. ` +
334338 $localize `Max size: ` +
335339 this . maxTxtSizeKB +
@@ -339,7 +343,7 @@ Please check it to make sure all words are spelled out completely, e.g. write "4
339343 $localize ` KB.` ,
340344 $localize `Sorry!` ,
341345 { timeOut : 15000 } ,
342- ) ;
346+ ) . toastId ;
343347 return false ;
344348 }
345349 }
0 commit comments