diff --git a/chrome/chromeFiles/content/scholar/itemPane.js b/chrome/chromeFiles/content/scholar/itemPane.js index d5ab7c250..046f11056 100644 --- a/chrome/chromeFiles/content/scholar/itemPane.js +++ b/chrome/chromeFiles/content/scholar/itemPane.js @@ -564,7 +564,15 @@ var ScholarItemPane = new function() function createValueElement(valueText, fieldName, tabindex) { - var valueElement = document.createElement("label"); + if (fieldName=='extra') + { + var valueElement = document.createElement("vbox"); + } + else + { + var valueElement = document.createElement("label"); + } + if(fieldName) { valueElement.setAttribute('fieldname',fieldName); @@ -576,8 +584,20 @@ var ScholarItemPane = new function() var firstSpace; if(typeof valueText == 'string') firstSpace = valueText.indexOf(" "); - - if((firstSpace == -1 && valueText.length > 29 ) || firstSpace > 29) + + // To support newlines in 'extra' fields, we use multiple + // elements inside a vbox + if (fieldName=='extra') + { + var lines = valueText.split("\n"); + for (var i = 0; i < lines.length; i++) { + var descriptionNode = document.createElement("description"); + var linetext = document.createTextNode(lines[i]); + descriptionNode.appendChild(linetext); + valueElement.appendChild(descriptionNode); + } + } + else if ((firstSpace == -1 && valueText.length > 29 ) || firstSpace > 29) { valueElement.setAttribute('crop', 'end'); valueElement.setAttribute('value',valueText); @@ -634,18 +654,28 @@ var ScholarItemPane = new function() } var t = document.createElement("textbox"); - t.setAttribute('type', 'autocomplete'); - t.setAttribute('autocompletesearch', 'zotero'); - t.setAttribute('autocompletesearchparam', fieldName + (itemID ? '/' + itemID : '')); t.setAttribute('value',value); t.setAttribute('fieldname', fieldName); t.setAttribute('tabindex', tabindex); t.setAttribute('flex','1'); + if (creatorField=='lastName') { t.setAttribute('singleField', elem.getAttribute('singleField')); } + if (fieldName=='extra') + { + t.setAttribute('multiline', true); + t.setAttribute('rows', 8); + } + else + { + t.setAttribute('type', 'autocomplete'); + t.setAttribute('autocompletesearch', 'zotero'); + t.setAttribute('autocompletesearchparam', fieldName + (itemID ? '/' + itemID : '')); + } + var box = elem.parentNode; box.replaceChild(t,elem); @@ -663,6 +693,12 @@ var ScholarItemPane = new function() switch (event.keyCode) { case event.DOM_VK_RETURN: + // Use shift-enter as the save action for the 'extra' field + if (document.commandDispatcher.focusedElement.parentNode. + parentNode.getAttribute('fieldname')=='extra' && !event.shiftKey) + { + break; + } document.commandDispatcher.focusedElement.blur(); break; diff --git a/chrome/chromeFiles/skin/default/scholar/overlay.css b/chrome/chromeFiles/skin/default/scholar/overlay.css index 851638785..619a6abb0 100644 --- a/chrome/chromeFiles/skin/default/scholar/overlay.css +++ b/chrome/chromeFiles/skin/default/scholar/overlay.css @@ -183,28 +183,24 @@ list-style-image: url('chrome://scholar/skin/toolbar-openurl.png'); } +#scholar-view-item > vbox +{ + overflow: auto; + margin-left: 5px; +} + /* creator switch button */ #editpane-dynamic-fields row hbox toolbarbutton { margin-right:5px; } -#scholar-view-item vbox -{ - overflow: auto; -} - #editpane-dynamic-fields row > label:first-child { text-align: right; font-weight: bold; } -#scholar-view-item -{ - margin-left: 5px; -} - #scholar-splitter { border-top: none;