diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml
index f4ad65ff38..dde2eedf8b 100644
--- a/chrome/content/zotero/bindings/itembox.xml
+++ b/chrome/content/zotero/bindings/itembox.xml
@@ -185,10 +185,10 @@
+
-
@@ -330,27 +330,27 @@
// Item type menu
if (this.showTypeMenu) {
// Build item type menu if it hasn't been built yet
- if (!this._itemTypeMenu.firstChild.hasChildNodes()) {
+ if (!this.itemTypeMenu.firstChild.hasChildNodes()) {
var itemTypes = Zotero.ItemTypes.getTypes();
for (var i=0; i' + Zotero.Utilities.prototype.text2html(text) + "";
+ }
+
var item = new Zotero.Item('note');
item.libraryID = this.getSelectedLibraryID();
item.setNote(text);
@@ -2427,37 +2444,36 @@ var ZoteroPane = new function()
}
- function addTextToNote(text)
+ function addTextToNote(text, citeURI)
{
if (!this.canEdit()) {
this.displayCannotEditLibraryMessage();
return;
}
- try {
- // trim
- text = text.replace(/^[\xA0\r\n\s]*(.*)[\xA0\r\n\s]*$/m, "$1");
- }
- catch (e){}
-
- if (!text || !text.length)
- {
+ if (!text) {
return false;
}
+ text = Zotero.Utilities.prototype.trim(text);
+
+ if (!text.length) {
+ return false;
+ }
+
+ text = '' + Zotero.Utilities.prototype.text2html(text) + "
";
+
var items = this.getSelectedItems();
if (this.itemsView.selection.count == 1 && items[0] && items[0].isNote()) {
var note = items[0].getNote()
- items[0].setNote(note == '' ? text : note + "\n\n" + text);
+ items[0].setNote(note + text);
items[0].save();
var noteElem = document.getElementById('zotero-note-editor')
noteElem.focus();
- noteElem.noteField.inputField.editor.
- selectionController.scrollSelectionIntoView(1,
- 1,
- true);
return true;
}
diff --git a/chrome/content/zotero/overlay.xul b/chrome/content/zotero/overlay.xul
index db85883240..37b20401e9 100644
--- a/chrome/content/zotero/overlay.xul
+++ b/chrome/content/zotero/overlay.xul
@@ -58,10 +58,10 @@
+ oncommand="var str = event.currentTarget.ownerDocument.popupNode.ownerDocument.defaultView.getSelection().toString(); var uri = event.currentTarget.ownerDocument.popupNode.ownerDocument.location.href; ZoteroPane.addTextToNote(str, uri)"/>
+ oncommand="var str = event.currentTarget.ownerDocument.popupNode.ownerDocument.defaultView.getSelection().toString(); var uri = event.currentTarget.ownerDocument.popupNode.ownerDocument.location.href; var itemID = ZoteroPane.addItemFromPage(); ZoteroPane.newNote(false, itemID, str, uri)"/>