Fix "Copy as HTML" Quick Copy setting
This commit is contained in:
parent
8b7f33826e
commit
b3b9cac078
2 changed files with 20 additions and 7 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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/>
|
||||
|
|
Loading…
Add table
Reference in a new issue