diff options
Diffstat (limited to 'ext/bg/js/options-form.js')
-rw-r--r-- | ext/bg/js/options-form.js | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js index 3a201bc5..81b638b1 100644 --- a/ext/bg/js/options-form.js +++ b/ext/bg/js/options-form.js @@ -125,7 +125,7 @@ function populateDictionaries(opts) { const dictSpinner = $('#dict-spinner'); dictSpinner.show(); - database().getDictionaries().then(rows => { + return database().getDictionaries().then(rows => { rows.forEach(row => { const dictOpts = opts.dictionaries[row.title] || {enableTerms: true, enableKanji: false}; const html = Handlebars.templates['dictionary.html']({ @@ -197,16 +197,18 @@ function onDictionaryImport() { }; const dictUrl = $('#dict-url'); - database().importDictionary(dictUrl.val(), callback).then(() => { - return loadOptions().then(opts => populateDictionaries(opts)); - }).catch(error => { - dictError.show().find('span').text(error); - }).then(() => { - dictImport.prop('disabled', false); - dictUrl.val(''); - dictUrl.trigger('input'); - dictProgress.hide(); - dictSpinner.hide(); + loadOptions().then(opts => { + database().importDictionary(dictUrl.val(), callback).then(() => { + return populateDictionaries(opts); + }).catch(error => { + dictError.show().find('span').text(error); + }).then(() => { + dictImport.prop('disabled', false); + dictUrl.val(''); + dictUrl.trigger('input'); + dictProgress.hide(); + dictSpinner.hide(); + }); }); } |