www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 6ca230379df5aaf65fd8fafdb276b2c1c3b73096
parent a5818604fb0fd6f4e70d1dde96126eb1005aa914
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sat, 26 Dec 2009 10:38:45 +0000

- Include a line between notes when copying multiple notes
- Don't display "JavaScript Application" in alert when pressing Quick Copy shortcut key with no regular items selected


Diffstat:
Mchrome/content/zotero/overlay.js | 19++++++++++++++-----
Mchrome/content/zotero/xpcom/quickCopy.js | 16++++++++++++++++
2 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js @@ -1428,16 +1428,25 @@ var ZoteroPane = new function() return; } - // Make sure at least one item is not a standalone note or attachment - var haveRegularItem = false; + // Make sure at least one item is a regular item + // + // DEBUG: We could copy notes via keyboard shortcut if we altered + // Z_F_I.copyItemsToClipboard() to use Z.QuickCopy.getContentFromItems(), + // but 1) we'd need to override that function's drag limit and 2) when I + // tried it the OS X clipboard seemed to be getting text vs. HTML wrong, + // automatically converting text/html to plaintext rather than using + // text/unicode. (That may be fixable, however.) + var canCopy = false; for each(var item in items) { if (item.isRegularItem()) { - haveRegularItem = true; + canCopy = true; break; } } - if (!haveRegularItem) { - window.alert(Zotero.getString("fileInterface.noReferencesError")); + if (!canCopy) { + var pr = Components.classes["@mozilla.org/network/default-prompt;1"] + .getService(Components.interfaces.nsIPrompt); + pr.alert("", Zotero.getString("fileInterface.noReferencesError")); return; } diff --git a/chrome/content/zotero/xpcom/quickCopy.js b/chrome/content/zotero/xpcom/quickCopy.js @@ -198,6 +198,14 @@ Zotero.QuickCopy = new function() { // Text-only adjustments // + // Add placeholders for newlines between notes + if (notes.length > 1) { + var divs = textXML.div; + for (var i=0, len=divs.length(); i<len-1; i++) { + divs[i].p += <p>--------------------------------------------------</p>; + } + } + if (Zotero.Prefs.get('export.quickCopy.quoteBlockquotes.plainText')) { // Add quotes around blockquote paragraphs var nodes = textXML..blockquote; @@ -294,6 +302,13 @@ Zotero.QuickCopy = new function() { } } + if (notes.length > 1) { + var divs = htmlXML.div; + for (var i=0, len=divs.length(); i<len-1; i++) { + divs[i].p += <p>----------------------------------------------------------------------</p>; + } + } + // Add quotes around blockquote paragraphs if (Zotero.Prefs.get('export.quickCopy.quoteBlockquotes.richText')) { var nodes = htmlXML..blockquote; @@ -370,6 +385,7 @@ Zotero.QuickCopy = new function() { html: csl.formatBibliography(itemSet, "HTML") }; } + return bibliography; }