Fix "Copy as HTML" Quick Copy setting

This commit is contained in:
Dan Stillman 2017-08-05 03:13:33 +02:00
parent 8b7f33826e
commit b3b9cac078
2 changed files with 20 additions and 7 deletions

View file

@ -38,6 +38,17 @@ Zotero_Preferences.Export = {
}),
getQuickCopyTranslators: async function () {
var translation = new Zotero.Translate("export");
var translators = await translation.getTranslators();
translators.sort((a, b) => {
var collation = Zotero.getLocaleCollation();
return collation.compareString(1, a.label, b.label);
});
return translators;
},
/*
* Builds the main Quick Copy drop-down from the current global pref
*/
@ -47,12 +58,7 @@ Zotero_Preferences.Export = {
format = Zotero.QuickCopy.unserializeSetting(format);
var menulist = document.getElementById("zotero-quickCopy-menu");
yield Zotero.Styles.init();
var translation = new Zotero.Translate("export");
var translators = yield translation.getTranslators();
translators.sort((a, b) => {
var collation = Zotero.getLocaleCollation();
return collation.compareString(1, a.label, b.label);
});
var translators = yield this.getQuickCopyTranslators();
this.buildQuickCopyFormatDropDown(
menulist, format.contentType, format, translators
);
@ -143,6 +149,13 @@ Zotero_Preferences.Export = {
},
onCopyAsHTMLChange: async function (checked) {
var menulist = document.getElementById('zotero-quickCopy-menu');
var translators = await this.getQuickCopyTranslators();
this.buildQuickCopyFormatDropDown(menulist, checked ? 'html' : '', null, translators);
},
updateQuickCopyUI: function () {
var format = document.getElementById('zotero-quickCopy-menu').value;

View file

@ -61,7 +61,7 @@
<separator orient="vertical" width="15px"/>
<checkbox id="zotero-quickCopy-copyAsHTML" label="&zotero.preferences.quickCopy.copyAsHTML;"
oncommand="Zotero_Preferences.Export.buildQuickCopyFormatDropDown(document.getElementById('zotero-quickCopy-menu'), this.checked ? 'html' : '');"/>
oncommand="Zotero_Preferences.Export.onCopyAsHTMLChange(this.checked)"/>
</hbox>
<separator/>