www

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

commit f73e2ceb58fb7ffca37d9013f851b2aba081f2bc
parent 8437a55e3e3d694072dd6e7806e7b96f31c42e33
Author: Dan Stillman <dstillman@zotero.org>
Date:   Mon, 18 May 2009 19:51:36 +0000

Closes #955, Don't generate bibliography when dragging many items

Default limit set to 50, configurable in the Export pane


Diffstat:
Mchrome/content/zotero/preferences/preferences.xul | 10++++++++++
Mchrome/content/zotero/xpcom/itemTreeView.js | 20+++++++++++---------
Mchrome/content/zotero/xpcom/quickCopy.js | 5+++++
Mdefaults/preferences/zotero.js | 1+
4 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/chrome/content/zotero/preferences/preferences.xul b/chrome/content/zotero/preferences/preferences.xul @@ -455,6 +455,7 @@ To add a new preference: <preferences> <preference id="pref-export-citePaperJournalArticleURL" name="extensions.zotero.export.citePaperJournalArticleURL" type="bool"/> <preference id="pref-quickCopy-setting" name="extensions.zotero.export.quickCopy.setting" type="string"/> + <preference id="pref-quickCopy-dragLimit" name="extensions.zotero.export.quickCopy.dragLimit" type="int"/> </preferences> <groupbox> @@ -503,6 +504,15 @@ To add a new preference: <separator/> + <!-- TODO: localize --> + <hbox align="center"> + <label value="Disable Quick Copy when dragging more than"/> + <textbox preference="pref-quickCopy-dragLimit" size="3"/> + <label value="items" flex="1"/> + </hbox> + + <separator/> + <label id="quickCopy-macWarning" hidden="true" value="&zotero.preferences.quickCopy.macWarning;"/> </groupbox> </prefpane> diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js @@ -1715,17 +1715,19 @@ Zotero.ItemTreeView.prototype.onDragStart = function (event, transferData, actio } else if (mode.indexOf('bibliography') == 0) { var content = Zotero.QuickCopy.getContentFromItems(items, format, null, event.shiftKey); - if (oldMethod) { - if (content.html) { - transferData.data.addDataForFlavour("text/html", content.html); + if (content) { + if (oldMethod) { + if (content.html) { + transferData.data.addDataForFlavour("text/html", content.html); + } + transferData.data.addDataForFlavour("text/unicode", content.text); } - transferData.data.addDataForFlavour("text/unicode", content.text); - } - else { - if (content.html) { - event.dataTransfer.setData("text/html", content.html); + else { + if (content.html) { + event.dataTransfer.setData("text/html", content.html); + } + event.dataTransfer.setData("text/plain", content.text); } - event.dataTransfer.setData("text/plain", content.text); } } else { diff --git a/chrome/content/zotero/xpcom/quickCopy.js b/chrome/content/zotero/xpcom/quickCopy.js @@ -132,6 +132,11 @@ Zotero.QuickCopy = new function() { * contain properties 'text' and 'html' is returned. */ function getContentFromItems(items, format, callback, modified) { + if (items.length > Zotero.Prefs.get('export.quickCopy.dragLimit')) { + Zotero.debug("Skipping quick copy for " + items.length + " items"); + return false; + } + var [mode, format] = format.split('='); var [mode, contentType] = mode.split('/'); diff --git a/defaults/preferences/zotero.js b/defaults/preferences/zotero.js @@ -81,6 +81,7 @@ pref("extensions.zotero.rtfScan.lastInputFile", ""); pref("extensions.zotero.rtfScan.lastOutputFile", ""); pref("extensions.zotero.export.quickCopy.setting", 'bibliography=http://www.zotero.org/styles/chicago-note'); +pref("extensions.zotero.export.quickCopy.dragLimit", 50); // Integration settings pref("extensions.zotero.integration.port", 50001);