fx-compat: Fix spellchecker and dictionary manager
This commit is contained in:
parent
3eb65eef4f
commit
097d423275
3 changed files with 11 additions and 7 deletions
|
@ -180,7 +180,8 @@ Zotero.Dictionaries = new function () {
|
||||||
let dicPath = manifest.dictionaries[locale];
|
let dicPath = manifest.dictionaries[locale];
|
||||||
let affPath = OS.Path.join(dictionary.dir, ...dicPath.split(/\//)).slice(0, -3) + 'aff';
|
let affPath = OS.Path.join(dictionary.dir, ...dicPath.split(/\//)).slice(0, -3) + 'aff';
|
||||||
Zotero.debug(`Removing ${locale} dictionary`);
|
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) {
|
catch (e) {
|
||||||
|
@ -247,9 +248,12 @@ Zotero.Dictionaries = new function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!name && inlineSpellChecker) {
|
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);
|
locales.push(locale);
|
||||||
let dicPath = manifest.dictionaries[locale];
|
let dicPath = manifest.dictionaries[locale];
|
||||||
let affPath = OS.Path.join(dir, ...dicPath.split(/\//)).slice(0, -3) + 'aff';
|
let affPath = OS.Path.join(dir, ...dicPath.split(/\//)).slice(0, -3) + 'aff';
|
||||||
Zotero.debug(`Adding ${locale} dictionary`);
|
let file = new FileUtils.File(affPath);
|
||||||
_spellChecker.addDictionary(locale, Zotero.File.pathToFile(affPath));
|
_spellChecker.addDictionary(locale, Services.io.newFileURI(file));
|
||||||
_dictionaries.push({ id, locale, version, dir });
|
_dictionaries.push({ id, locale, version, dir });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -784,7 +784,7 @@ class EditorInstance {
|
||||||
var menuitem = this._popup.ownerDocument.createXULElement('menuitem');
|
var menuitem = this._popup.ownerDocument.createXULElement('menuitem');
|
||||||
menuitem.setAttribute('label', Zotero.getString('spellCheck.addRemoveDictionaries'));
|
menuitem.setAttribute('label', Zotero.getString('spellCheck.addRemoveDictionaries'));
|
||||||
menuitem.addEventListener('command', () => {
|
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", {});
|
"dictionary-manager", "chrome,centerscreen", {});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -799,7 +799,7 @@ class EditorInstance {
|
||||||
}
|
}
|
||||||
|
|
||||||
let firstElementChild = this._popup.firstElementChild;
|
let firstElementChild = this._popup.firstElementChild;
|
||||||
let suggestionCount = spellChecker.addSuggestionsToMenu(this._popup, firstElementChild, 5);
|
let suggestionCount = spellChecker.addSuggestionsToMenuOnParent(this._popup, firstElementChild, 5);
|
||||||
if (suggestionCount) {
|
if (suggestionCount) {
|
||||||
let separator = this._popup.ownerDocument.createXULElement('menuseparator');
|
let separator = this._popup.ownerDocument.createXULElement('menuseparator');
|
||||||
this._popup.insertBefore(separator, firstElementChild);
|
this._popup.insertBefore(separator, firstElementChild);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue