> Bump
>
> Anyone with the skills to help me do this ?
>
> I just dont know enough to convert between a Java Script solution and
> TiddlyWiki Integration.
>
> See here for a complete and documented solution that works in firefoxhttp://
www.htmlgoodies.com/beyond/javascript/article.php/3458851/Clic...be done this way ?
The script they describe is actually *not* all that robust. I've
actually got a function that already written that copies an entire TW
document to the clipboard:
http://www.TiddlyTools.com/#SaveToClipboard
Embedded in that code is a function, "copy(out)" that copies specified
output text to the clipboard, and will work for many versions of FF,
IE, Chrome, Safari, etc. For your purposes, you could borrow this
function and write the following in a tiddler called PasteBox:
[[PasteBox]]
-----------------------------
<html><nowiki>
<textarea rows="10" style="width:100%" onfocus="this.select()"></
textarea>
<input type="button" value="copy to clipboard" onclick="
function copy(out) {
if(window.Components) { // FIREFOX
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var id='@
mozilla.org/widget/clipboardhelper;1';
var
clip=Components.classes[id].getService(Components.interfaces.nsIClipboardHelper);
clip.copyString(out);
} else if(window.clipboardData) { // IE
window.clipboardData.setData('text',out);
} else if(document.execCommand) { // CHROME, SAFARI, IE6
var ta=document.createElement('textarea');
ta.style.position='absolute';
ta.style.left='-100%';
document.body.appendChild(ta);
ta.value=out; ta.select();
document.execCommand('Copy',false,null);
document.body.removeChild(ta);
} else throw('cannot access clipboard');
}
var ta=this.parentNode.getElementsByTagName('textarea')[0];
try { copy(ta.value); displayMessage(ta.value.length+' bytes copied to
clipboard'); }
catch(e) { displayMessage(e.description?e.description:e.toString()); }
"></html>
-----------------------------
You can then embed it in another tiddler just by using <<tiddler
PasteBox>>. Note: because the above HTML/Javascript does not use a
specific ID to find the textarea contents, you can embed as many
copies as you like.
enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios
HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...
http://www.TiddlyTools.com/#Donations
Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:
http://www.TiddlyTools.com/#Contact