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

Default limit set to 50, configurable in the Export pane
This commit is contained in:
Dan Stillman 2009-05-18 19:51:36 +00:00
parent 8437a55e3e
commit f73e2ceb58
4 changed files with 27 additions and 9 deletions

View file

@ -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>

View file

@ -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 {

View file

@ -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('/');

View file

@ -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);