closes #2, clipboard export

for the moment, this feature is disabled on the mac, since firefox can't handle HTML on the clipboard (and thus we can't copy the fully formatted bibliography). i can re-enable it if it would be useful regardless.
This commit is contained in:
Simon Kornblith 2006-07-28 04:09:40 +00:00
parent 6305e4cada
commit a663966c4f

View file

@ -143,6 +143,22 @@ Scholar_File_Interface = new function() {
fStream.close();
}
} else if(io.output == "copy-to-clipboard") {
// copy to clipboard
var transferable = Components.classes["@mozilla.org/widget/transferable;1"].
createInstance(Components.interfaces.nsITransferable);
var str = Components.classes["@mozilla.org/supports-string;1"].
createInstance(Components.interfaces.nsISupportsString);
str.data = bibliography;
// add data
transferable.addDataFlavor("text/html");
transferable.setTransferData("text/html", str, bibliography.length*2);
var clipboardService = Components.classes["@mozilla.org/widget/clipboard;1"].
getService(Components.interfaces.nsIClipboard);
clipboardService.setData(transferable, null, Components.interfaces.nsIClipboard.kGlobalClipboard);
}
}
}