@@ -60,9 +60,7 @@ const DICTIONARY_LOADING_FAILED_MESSAGE =
60
60
const NO_WORD_MESSAGE = "Please provide a word" ;
61
61
const WORD_NOT_FOUND_MESSAGE = "Word not found" ;
62
62
const WORD_ALREADY_IMPORTED_MESSAGE = "The word is already imported" ;
63
- const DICTIONARY_ERROR_MESSAGE_ON_IMPORT =
64
- "Please fix the errors before adding words" ;
65
- const DICTIONARY_ERROR_MESSAGE_ON_SAVE = "Please fix the errors before saving" ;
63
+ const DICTIONARY_ERROR_MESSAGE = "Please fix the errors before saving" ;
66
64
67
65
function main ( ) : void {
68
66
// load elements
@@ -306,10 +304,9 @@ function main(): void {
306
304
const word = importWordTextBox . value . trim ( ) ;
307
305
if ( word === "" ) {
308
306
showMessage ( NO_WORD_MESSAGE ) ;
309
- } else if ( autoParse ( ) && currentDictionary . isError ( ) ) {
310
- showMessage ( DICTIONARY_ERROR_MESSAGE_ON_IMPORT ) ;
311
307
} else if (
312
- autoParse ( ) && currentDictionary . unwrap ( ) [ 0 ] . has ( word )
308
+ autoParse ( ) && ! currentDictionary . isError ( ) &&
309
+ currentDictionary . unwrap ( ) [ 0 ] . has ( word )
313
310
) {
314
311
showMessage ( WORD_ALREADY_IMPORTED_MESSAGE ) ;
315
312
} else {
@@ -358,7 +355,7 @@ function main(): void {
358
355
setIgnoreError ( DICTIONARY_KEY , customDictionaryTextBox . value ) ;
359
356
customDictionaryDialogBox . close ( ) ;
360
357
} else {
361
- showMessage ( DICTIONARY_ERROR_MESSAGE_ON_SAVE ) ;
358
+ showMessage ( DICTIONARY_ERROR_MESSAGE ) ;
362
359
}
363
360
}
364
361
closeButton . addEventListener ( "click" , ( ) => {
0 commit comments