Eric,

Thanks a lot - This seems to be exactly what I want and need. On completion 
I will again post a suitable use case.

I have got it working - mostly, however the copy seems to ignore the new 
line character(s) in the source text area and the resultant pastes (after 
copy) are collapsed into single lines.

I imagine this could have been important in the original 
SaveToClipboard<http://www.TiddlyTools.com/#SaveToClipboard> 

How do I introduce the line feeds please ?

Thanks in Advance Tony

PS - I will send a tip in the near future sourced from $AUD

On Wednesday, August 1, 2012 4:49:56 PM UTC+10, Eric Shulman wrote:
>
> > 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 
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/tiddlywikidev/-/Ax1pbhps8ZIJ.
To post to this group, send email to tiddlywikidev@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywikidev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywikidev?hl=en.

Reply via email to