diff --git a/chrome/content/zotero/preferences/preferences_export.jsx b/chrome/content/zotero/preferences/preferences_export.jsx index b48b97866e..4d59c33d8a 100644 --- a/chrome/content/zotero/preferences/preferences_export.jsx +++ b/chrome/content/zotero/preferences/preferences_export.jsx @@ -197,8 +197,11 @@ Zotero_Preferences.Export = { document.getElementById('quickCopy-delete').disabled = false; }, - showQuickCopySiteEditor: async function () { - const index = this._tree.selection.focused; + showQuickCopySiteEditor: async function (editExisting) { + var index; + if (editExisting) { + index = this._tree.selection.focused; + } var formattedName = document.getElementById('zotero-quickCopy-menu').label; var locale = this._lastSelectedLocale; var asHTML = document.getElementById('zotero-quickCopy-copyAsHTML').checked; @@ -291,6 +294,15 @@ Zotero_Preferences.Export = { Zotero_Preferences.Export.deleteSelectedQuickCopySite(); } }; + var handleSelectionChange = (selection) => { + if (selection.count) { + Zotero_Preferences.Export.enableQuickCopySiteButtons() + } + else { + Zotero_Preferences.Export.disableQuickCopySiteButtons(); + } + }; + let elem = ( <IntlProvider locale={Zotero.locale} messages={Zotero.Intl.strings}> <VirtualizedTable @@ -302,7 +314,7 @@ Zotero_Preferences.Export = { columns={columns} staticColumns={true} disableFontSizeScaling={true} - onSelectionChange={() => Zotero_Preferences.Export.enableQuickCopySiteButtons()} + onSelectionChange={handleSelectionChange} onKeyDown={handleKeyDown} onActivate={(event, indices) => Zotero_Preferences.Export.showQuickCopySiteEditor()} /> diff --git a/chrome/content/zotero/preferences/preferences_export.xul b/chrome/content/zotero/preferences/preferences_export.xul index ee34a61f73..8881e864fc 100644 --- a/chrome/content/zotero/preferences/preferences_export.xul +++ b/chrome/content/zotero/preferences/preferences_export.xul @@ -75,7 +75,7 @@ <separator class="thin"/> <hbox> <button disabled="true" id="quickCopy-edit" label="&zotero.general.edit;" - onclick="Zotero_Preferences.Export.showQuickCopySiteEditor(document.getElementById('quickCopy-siteSettings').currentIndex)"/> + onclick="Zotero_Preferences.Export.showQuickCopySiteEditor(true)"/> <spacer flex="1"/> <button disabled="true" id="quickCopy-delete" label="-" onclick="Zotero_Preferences.Export.deleteSelectedQuickCopySite()"/> <button label="+"