copying a tiddler content to the clipboard

109 views
Skip to first unread message

Tiziano Solignani

unread,
Apr 16, 2020, 10:25:13 AM4/16/20
to TiddlyWiki
Good afternoon everyone.

This is my first post since I started some days ago using TW, oh BTW I love it, great idea, great accomplishment and great docs and community.

Is there a quick way to copy a tiddler content, maybe with one of the options at top right corner?

Many times I use tiddler to keep my templates and being able to copy them on the fly would be useful.

Thank you.

Tiziano

Mat

unread,
Apr 16, 2020, 11:44:12 AM4/16/20
to TiddlyWiki
Yeah, try the different buttons in the tiddler menu and you'll find the "clone" button i.e this makes a copy of the tiddler.

However, if you're talking about some button in edit view, then no, there's no such button but I think the mechanism for it exists :-)

<:-)

Tiziano Solignani

unread,
Apr 17, 2020, 4:58:29 PM4/17/20
to TiddlyWiki
Thank you. But that would make a copy of the tiddler while I meant to copy the tiddler content to the system clipboard, to paste elsewhere later.

Thank you.

Eric Shulman

unread,
Apr 17, 2020, 5:50:09 PM4/17/20
to TiddlyWiki
On Friday, April 17, 2020 at 1:58:29 PM UTC-7, Tiziano Solignani wrote:
I meant to copy the tiddler content to the system clipboard, to paste elsewhere later.

Add this to your "template" tiddler:

<$button message="tm-copy-to-clipboard" param={{!!text}}>
Copy to clipboard
</$button>

enjoy,
-e

Thomas Elmiger

unread,
Apr 17, 2020, 6:00:19 PM4/17/20
to tiddl...@googlegroups.com
Hi Tiziano

I made a custom button for someting like that recently. It is called a conditionals view template. View template means, something is shown while viewing a tiddler. And conditional means, when some conditions are met.

My case: I want to copy the code of image tiddlers only (not all tiddlers). So the condition is: If the tiddler has a tag $:/tags/Image – you see that in the first filter below and you might want to delete the part tag[$:/tags/Image] and you will probably also not need my other condition: [all[current]field:type[image/svg+xml]]


Code:

<$list filter="[all[current]tag[$:/tags/Image]] [all[current]field:type[image/svg+xml]]">

<$button class="te-copy-code" message="tm-copy-to-clipboard" param={{!!text}} tooltip={{$:/language/Buttons/CopyToClipboard/Hint}} >
{{$:/core/images/copy-clipboard}}
Copy image code to clipboard
</$button>

''Hint: ''Remember to delete the tags `
<svg ...>` and `</svg>` manually after pasting into the editor.

@@width:100%;
---
@@

</$list>


You might also want to delete the Hint and the horizontal ruler below that (I need it for my own design).

Don’t forget to tag your template tiddler with $:/tags/ViewTemplate

Good luck!
Thomas

Thomas Elmiger

unread,
Apr 17, 2020, 6:02:28 PM4/17/20
to TiddlyWiki
Uuups, you will probably also not need my other condition:

A Gloom

unread,
Apr 19, 2020, 3:40:58 AM4/19/20
to TiddlyWiki
I have done the same as Thomas for a search feature for TW system icons-- first one copies the icon tiddler title, the second copies the tiddler content. Below them is notes on the variations of the copy to clipboard feature. Everything is also included in tid files that can be imported into a TW to experiment with or use as reference.

Search for system icons, copy of title:<br/>
<$edit-text tiddler='$:/temp/sysiconssearch' field='searchterm' placeholder='search term' tag='input' type='text'/><$button class="tc-btn-rounded"  style="margin-left:10px;">
<$action-setfield $tiddler="$:/temp/sysiconssearch" searchterm="" />
{{$:/core/images/close-button}}
</$button><br/>
<$reveal type='nomatch' state='$:/temp/sysiconssearch!!searchterm' text=''>
<$set name='searchterm' value={{$:/temp/sysiconssearch!!searchterm}}>
<ol>
<$list filter="[all[tiddlers+shadows]tag[$:/tags/Image]prefix[$:/core]search:title<searchterm>]">
<li><div style="margin-bottom:5px; padding:5px 10px; border:solid 1px;"><$transclude/> &nbsp; ^^---^^ <$link><$view field="title"/></$link> &nbsp; <$macrocall $name="copy-to-clipboard" src=<<currentTiddler>>/></div></li>
</$list></ol>
</$set>
</$reveal>

Search for system icons, copy of tiddler content:<br/>
<$edit-text tiddler='$:/temp/sysiconssearch' field='searchterm' placeholder='search term' tag='input' type='text'/><$button class="tc-btn-rounded"  style="margin-left:10px;">
<$action-setfield $tiddler="$:/temp/sysiconssearch" searchterm="" />
{{$:/core/images/close-button}}
</$button><br/>
<$reveal type='nomatch' state='$:/temp/sysiconssearch!!searchterm' text=''>
<$set name='searchterm' value={{$:/temp/sysiconssearch!!searchterm}}>
<ol>
<$list filter="[all[tiddlers+shadows]tag[$:/tags/Image]prefix[$:/core]search:title<searchterm>]">
<li><div style="margin-bottom:5px; padding:5px 10px; border:solid 1px;"><$transclude/> &nbsp; ^^---^^ <$link><$view field="title"/></$link> &nbsp; <$macrocall $name="copy-to-clipboard" src={{!!text}}/></div></li>
</$list></ol>
</$set>
</$reveal>

Copy to clipboard variantations

// copy-to-clipboard cannot handle backticks https://groups.google.com/d/topic/tiddlywiki/4EPOIsVDfVY/discussion //

`<<copy-to-clipboard """text to be copied""">>`

&sect; __simple macro__ //( doesn't have closing / )//:
`<<copy-to-clipboard "tlext to be copied">>` -- <<copy-to-clipboard "text to be copied" class="tc-btn-boxed">>

&sect; __macrocall (for lists)__:

* copies title:
`<$macrocall $name="copy-to-clipboard" src=<<currentTiddler>> class="tc-btn-rounded"/>` -- <$macrocall $name="copy-to-clipboard" src=<<currentTiddler>> class="tc-btn-rounded"/>

* copies text field:
`<$macrocall $name="copy-to-clipboard" src={!!text}} class="tc-btn-rounded"/>` -- <$macrocall $name="copy-to-clipboard" src={{!!text}} class="tc-btn-rounded"/>

&sect; __button w/ "tm-copy-to-clipboard" action message__:

* w/ macro or custom macro w/ multi-lined text to be copied:
`<$button message="tm-copy-to-clipboard" param=<<now>>>Copy date to clipboard</$button>` -- -- <$button message="tm-copy-to-clipboard" param=<<now>>>Copy date to clipboard</$button>

* w/ text field copy :
`<$button message="tm-copy-to-clipboard" param={{!!text}}>Copy to clipboard</$button>` -- -- <$button message="tm-copy-to-clipboard" param={{!!text}}>Copy to clipboard</$button>

copy to clipboard variations.tid
Search w text copy to clipboard.tid
Reply all
Reply to author
Forward
0 new messages