From a5818604fb0fd6f4e70d1dde96126eb1005aa914 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 26 Dec 2009 03:40:30 +0000 Subject: [PATCH] - When creating or adding to note from web page context menu, put text in
with 'cite' attribute - Zotero.Utilities.text2html(str, singleNewlineIsParagraph) -- conversion of 1.0 notes on upgrade to 2.0 uses the second parameter to treat a single newline as a paragraph, which may or may not be the desired behavior but is what was done previously - Shortcut key for New Item wasn't properly selecting item type menu and wasn't preventing Firefox's Recently Closed Window shortcut --- chrome/content/zotero/bindings/itembox.xml | 14 +++---- chrome/content/zotero/overlay.js | 48 ++++++++++++++-------- chrome/content/zotero/overlay.xul | 4 +- chrome/content/zotero/xpcom/db.js | 8 +--- chrome/content/zotero/xpcom/utilities.js | 25 +++++++++++ 5 files changed, 67 insertions(+), 32 deletions(-) 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 @@