Skip to content

Commit

Permalink
Fix "Copy as HTML" Quick Copy setting
Browse files Browse the repository at this point in the history
  • Loading branch information
dstillman committed Aug 5, 2017
1 parent 8b7f338 commit b3b9cac
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
25 changes: 19 additions & 6 deletions chrome/content/zotero/preferences/preferences_export.js
Expand Up @@ -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
*/
Expand All @@ -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
);
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion chrome/content/zotero/preferences/preferences_export.xul
Expand Up @@ -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/>
Expand Down

0 comments on commit b3b9cac

Please sign in to comment.