From 4556ea3f105f4760826b6e3003d3a3e7193f033a Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Fri, 18 Jun 2010 18:19:52 +0000 Subject: [PATCH] fixes #1668, Items added in multiple mode not recognized unless visible (twice) fix Accept button issue by using getAttribute() rather than id property, but also scroll to newly inserted citation, since it's probably the desirable behavior --- .../zotero/integration/addCitationDialog.js | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/chrome/content/zotero/integration/addCitationDialog.js b/chrome/content/zotero/integration/addCitationDialog.js index bb18cda4f4..ba89294eec 100644 --- a/chrome/content/zotero/integration/addCitationDialog.js +++ b/chrome/content/zotero/integration/addCitationDialog.js @@ -298,8 +298,8 @@ var Zotero_Citation_Dialog = new function () { */ function add() { var item = itemsView.getSelectedItems()[0]; // treeview from selectItemsDialog.js - _itemSelected(item.getID()); - _addItem(item); + _itemSelected(item.id); + _citationList.ensureElementIsVisible(_addItem(item)); // don't let someone select it again document.getElementById("add").disabled = true; @@ -307,7 +307,7 @@ var Zotero_Citation_Dialog = new function () { // allow user to press OK _updateAccept(); _updatePreview(); - sortCitation(); + sortCitation(item.id); } /* @@ -338,7 +338,7 @@ var Zotero_Citation_Dialog = new function () { /* * Sorts the list of citations */ - function sortCitation() { + function sortCitation(scrollToItemID) { if(!_sortCheckbox) return; if(!_sortCheckbox.checked) { io.citation.properties.unsorted = true; @@ -357,12 +357,16 @@ var Zotero_Citation_Dialog = new function () { io.previewFunction(); // add items back to list + var scrollTo = null; for(var i=0; i