fx-compat: Fix spellchecker and dictionary manager

This commit is contained in:
Martynas Bagdonas 2022-06-10 12:57:27 +03:00
parent 3eb65eef4f
commit 097d423275
3 changed files with 11 additions and 7 deletions

View file

@ -180,7 +180,8 @@ Zotero.Dictionaries = new function () {
let dicPath = manifest.dictionaries[locale];
let affPath = OS.Path.join(dictionary.dir, ...dicPath.split(/\//)).slice(0, -3) + 'aff';
Zotero.debug(`Removing ${locale} dictionary`);
_spellChecker.removeDictionary(locale, Zotero.File.pathToFile(affPath));
let file = new FileUtils.File(affPath);
_spellChecker.removeDictionary(locale, Services.io.newFileURI(file));
}
}
catch (e) {
@ -247,9 +248,12 @@ Zotero.Dictionaries = new function () {
}
}
if (!name && inlineSpellChecker) {
name = inlineSpellChecker.getDictionaryDisplayName(locale)
let names = Services.intl.getLocaleDisplayNames(undefined, [locale]);
if (names.length) {
name = names[0];
}
}
return name || name;
return name || locale;
};
/**
@ -296,8 +300,8 @@ Zotero.Dictionaries = new function () {
locales.push(locale);
let dicPath = manifest.dictionaries[locale];
let affPath = OS.Path.join(dir, ...dicPath.split(/\//)).slice(0, -3) + 'aff';
Zotero.debug(`Adding ${locale} dictionary`);
_spellChecker.addDictionary(locale, Zotero.File.pathToFile(affPath));
let file = new FileUtils.File(affPath);
_spellChecker.addDictionary(locale, Services.io.newFileURI(file));
_dictionaries.push({ id, locale, version, dir });
}
}

View file

@ -784,7 +784,7 @@ class EditorInstance {
var menuitem = this._popup.ownerDocument.createXULElement('menuitem');
menuitem.setAttribute('label', Zotero.getString('spellCheck.addRemoveDictionaries'));
menuitem.addEventListener('command', () => {
Services.ww.openWindow(null, "chrome://zotero/content/dictionaryManager.xul",
Services.ww.openWindow(null, "chrome://zotero/content/dictionaryManager.xhtml",
"dictionary-manager", "chrome,centerscreen", {});
});
@ -799,7 +799,7 @@ class EditorInstance {
}
let firstElementChild = this._popup.firstElementChild;
let suggestionCount = spellChecker.addSuggestionsToMenu(this._popup, firstElementChild, 5);
let suggestionCount = spellChecker.addSuggestionsToMenuOnParent(this._popup, firstElementChild, 5);
if (suggestionCount) {
let separator = this._popup.ownerDocument.createXULElement('menuseparator');
this._popup.insertBefore(separator, firstElementChild);