diff --git a/chrome/content/zotero/note.xul b/chrome/content/zotero/note.xul index ed9c1037f..2a83fd819 100644 --- a/chrome/content/zotero/note.xul +++ b/chrome/content/zotero/note.xul @@ -8,7 +8,7 @@ id="zotero-note-window" orient="vertical" width="400" - height="250" + height="350" title="&zotero.items.menu.attach.note;" persist="screenX screenY width height" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index f3150c19f..cbb75a685 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -1996,21 +1996,23 @@ Zotero.Item.prototype.getNote = function() { var note = Zotero.DB.valueQuery(sql, this.id); // Convert non-HTML notes on-the-fly - if (!note.match(/^
[\s\S]*<\/div>$/)) { - note = Zotero.Utilities.prototype.htmlSpecialChars(note); - note = '

' - + note.replace(/\n/g, '

') - .replace(/\t/g, '    ') - .replace(/ /g, '  ') - + '

'; - note = note.replace(/

\s*<\/p>/g, '

 

'); - var sql = "UPDATE itemNotes SET note=? WHERE itemID=?"; - Zotero.DB.query(sql, [note, this.id]); + if (note) { + if (!note.match(/^
[\s\S]*<\/div>$/)) { + note = Zotero.Utilities.prototype.htmlSpecialChars(note); + note = '

' + + note.replace(/\n/g, '

') + .replace(/\t/g, '    ') + .replace(/ /g, '  ') + + '

'; + note = note.replace(/

\s*<\/p>/g, '

 

'); + var sql = "UPDATE itemNotes SET note=? WHERE itemID=?"; + Zotero.DB.query(sql, [note, this.id]); + } + + // Don't include
wrapper when returning value + note = note.replace(/^
([\s\S]*)<\/div>$/, '$1'); } - // Don't include
wrapper when returning value - note = note.replace(/^
([\s\S]*)<\/div>$/, '$1'); - this._noteText = note ? note : ''; return this._noteText;