www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit b3b9cac078a8551838ae18c9191f00131cbe7d81
parent 8b7f33826e60b740673f1b1de7c9cf9ad58e317b
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sat,  5 Aug 2017 03:13:33 +0200

Fix "Copy as HTML" Quick Copy setting

Diffstat:
Mchrome/content/zotero/preferences/preferences_export.js | 25+++++++++++++++++++------
Mchrome/content/zotero/preferences/preferences_export.xul | 2+-
2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/chrome/content/zotero/preferences/preferences_export.js b/chrome/content/zotero/preferences/preferences_export.js @@ -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; diff --git a/chrome/content/zotero/preferences/preferences_export.xul b/chrome/content/zotero/preferences/preferences_export.xul @@ -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/>