[TW5] new tiddler / excised tiddler that inherits tags of current tiddler

232 views
Skip to first unread message

Rich

unread,
Jul 25, 2016, 10:59:52 PM7/25/16
to tiddl...@googlegroups.com
Hi, I have been able to get close but not quite on this...Is there a way to create a new tiddler that inherits the tags of the current tiddler?  This would save me a ton of time entering the same tags again and again for a specific project.  I got close with the create new Journal/Tiddler here function that makes the current title into the tag of the new tiddler, but that does not quite do it for me.  A related useful thing would be the ability to have the new "excise text to new tiddler" inherit the tags.  That might even be useful default behavior.  Meanwhile, if there is a way to excise with the current tags, that would be great.  I thought about doing this as a feature request on Github, but figured it best to see if there is some way already available.  Also, the solution needs to work in node.js version too.  Thanks!

PMario

unread,
Jul 26, 2016, 4:30:37 AM7/26/16
to TiddlyWiki
Hi Rich,

There is an example at tiddlywiki.com: http://tiddlywiki.com/#WidgetMessage%3A%20tm-new-tiddler, which shows the basics.

So if you modify it a little bit, like so:

<$button>
<$action-sendmessage $message="tm-new-tiddler" title="This is newly created tiddler" tags={{!!tags}} text=<
<now "Today is DDth, MMM YYYY">>/>
New Tiddler                                                                               ^^^^^^^^^^^
                                                                                            get the tags from the current tiddler.
</$button>


You get the basic functionality, but it's not convenient, because it's not in the toolbar. _and_ You need to remove my description text :)

A similar thing can be done with: http://tiddlywiki.com/#%24%3A%2Fcore%2Fui%2FButtons%2Fnew-journal-here

If you overwrite it (as a workaround) with this:

\define journalButtonTags()
[[$(currentTiddlerTag)$]] $(journalTags)$
\end
\define journalButton()
<$button tooltip={{$:/language/Buttons/NewJournalHere/Hint}} aria-label={{$:/language/Buttons/NewJournalHere/Caption}} class=<<tv-config-toolbar-class>>>
<$action-sendmessage $message="tm-new-tiddler" title=<<now "$(journalTitleTemplate)$">> tags=<<journalButtonTags>>/>
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
{{$:/
core/images/new-journal-button}}
</$list>
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
<span class="tc-btn-text"><$text text={{$:/
language/Buttons/NewJournalHere/Caption}}/></span>
</$list>
</
$button>
\end
<$set name="journalTitleTemplate" value={{$:/config/NewJournal/Title}}>
<$set name="journalTags" value={{!!tags}}>                                          <-- see {{!tags}} .... remove this text!
<$set name="currentTiddlerTag" value=<<currentTiddler>>>                            <-- if you don't want the current tiddler tag, just set value to "" ..... remove this text
<<journalButton>>
</$set></$set></$set>



This will replace the "new journal here" button, with your custom version. .... If you want to create your own toolbar, the setup will be a bit trickier ... but this should be a starting workaround.
!! Be sure, to remove my comments from the above code snippet !!

have fun!
mario




RichardWilliamSmith

unread,
Jul 26, 2016, 5:38:20 AM7/26/16
to TiddlyWiki
Hi Rich,

If you combine Mario's suggestions, you can do this - clone and edit the new journal button, or otherwise create a tiddler with the same tag, call it $:/rs/ui/Buttons/new-here-with tags (if you change the title, you need to change the two references to it below - I always add my initials to the name of this kind of tiddler, to distinguish them from the core) give it the following text;

<$button tooltip={{$:/rs/ui/Buttons/new-here-with tags!!description}} aria-label={{$:/rs/ui/Buttons/new-here-with tags!!caption}} class=<<tv-config-toolbar-class>>>
<$action-sendmessage $message="tm-new-tiddler" title="New Tag Tiddler" tags={{!!tags}} />
''T''
</$button>

and the fields

caption: ''T'' New Tiddler With Tags
description: Create a new tiddler with the same tags as this one

This will appear in the view toolbar and can be toggled from the control panel. If you want to put it in a particular place in the toolbar, give it a list-after or list-before field too.

Regards,
Richard

Rich

unread,
Jul 26, 2016, 8:29:03 PM7/26/16
to tiddl...@googlegroups.com
Thank you Mario and RIchard.  

I got this partially working.  It produces a new tiddler from the "new-here-with tags" tiddler when it is in view mode, but the toolbar version is not picking up the tags, so it pops up with no tags when I try to use it to pick up the tags of the currently focused tiddler when in view mode.  I would almost always be using this while editing rather than viewing, so I tried to hack together a frankenstein combo with my limited skills that looks like this:

<$button tooltip={{$:/rr/ui/Buttons/new-here-with tags!!description}} aria-label={{$:/rr/ui/Buttons/new-here-with tags!!caption}} class=<<tv-config-toolbar-class>>>
<$action-sendmessage $message="tm-new-tiddler" title="New+tags" tags={{!!tags}} />+t
</$button>
<$action-sendmessage
$message="tm-edit-text-operation"
$param="wrap-selection"
prefix="''"
suffix="''"
/>

That successfully made it into the toolbar after I copied some of the the fields from another toolbar entry, but instead of picking up the current tiddlers tags, it grabbed the system tags from "new-here-with tags".  

I tried replacing  

tags={{!!tags}}

with 

tags={{||!!tags}}

as per this help page on templating, but that just removed all the tags.


ANy ideas what I'm doing wrong (probably a lot!)

RIch

RichardWilliamSmith

unread,
Jul 26, 2016, 10:05:19 PM7/26/16
to TiddlyWiki
Hi Rich,

Bit tricky, but I think this works - I looked at how similar things were handled in the other tiddlers that make up the editor, it needs the new tags to be set in a macro.

(again, it's called $:/rs/ui/Buttons/new-here-with-tags and now needs the view template tag)

\define newTagsButton()
<$button tooltip={{$:/rs/ui/Buttons/new-here-with-tags!!description}} aria-label={{$:/rs/ui/Buttons/new-here-with-tags!!caption}} class=<<tv-config-toolbar-class>>>
<$action-sendmessage $message="tm-new-tiddler" title="New Tag Tiddler" tags=$(newTiddlerTags)$ />
''T''
</$button>
\end
\define getNewTags()
{{$(currentTiddlerName)$!!tags}}
\end

<$set name="newTiddlerTags" value=<<getNewTags>>>
<<newTagsButton>>
</$set>

An interesting side effect of this is that, if you click the button on multiple existing tiddlers, before editing the default title of the new tiddler, it will add the tags from each in turn.

Regards,
Richard

Rich

unread,
Jul 26, 2016, 11:36:01 PM7/26/16
to TiddlyWiki
Cool.  That is workable.  thanks.  it puts the new tiddler button at the bottom of every page in view mode., and I figured out the multiple tag addition trick after a minute or two:  As long as the new tag tiddler is open for editing, clicking on the "new tagged tiddler" button just adds the tag to the presently open draft of the previous one.

Is there any way to get this to work from the edit toolbar, so I can open a new page with the same tags as the one I am currently editing?  I added the "$:/tags/EditorToolbar" tag, and it shows up in the editor toolbar, but it does not pick up the tags, it just opens a new tiddler with no tags.  

Thanks again for helping me on this.  It will be a huge time save if I can get it right!

RichardWilliamSmith

unread,
Jul 27, 2016, 1:28:50 AM7/27/16
to tiddl...@googlegroups.com
HI Rich,

Yes, I meant the editor tag but you actually want "EditToolbar", not "EditorToolbar" - but confusing that (the editor toolbar is for the new editor - you can usually figure this stuff out by looking at what else has the tag.


Regards,
Richard
Message has been deleted

RichardWilliamSmith

unread,
Jul 27, 2016, 1:36:08 AM7/27/16
to TiddlyWiki

Rich

unread,
Jul 29, 2016, 12:57:55 AM7/29/16
to TiddlyWiki
THanks Richard.  I got the toolbar item in the right place now, and it works properly.  The only odd thing it is doing is not picking up the "lightgray" color attribute from the stylesheet.  I kludged this by putting an inline color around it, but then the hover dos not work properly.  My hunch is that it is because it is text rather than an icon like the other items.  maybe will try my hand at homemade vector graphics later!  time actually work on writing though.  Thanks for your help.  here is what I have:
Title of tiddler: $:/rr/ui/Buttons/new-here-with tags
tags:  $:/tags/ViewToolbar  and $:/tags/EditToolbar
fields: 
caption: +t New Tiddler With Tags
description: Create a new tiddler with the same tags as this one 

tiddler content (note the change in initials from rs to rr):
 
\define newTagsButton()
<$button tooltip={{$:/rr/ui/Buttons/new-here-with-tags!!description}} aria-label={{$:/rr/ui/Buttons/new-here-with-tags!!caption}} class=<<tv-config-toolbar-class>>>
<$action-sendmessage $message="tm-new-tiddler" title="New Tag Tiddler" tags=$(newTiddlerTags)$ />
@@color:lightgray;+t@@
</$button>
\end
\define getNewTags()
{{$(currentTiddlerName)$!!tags}}
\end

<$set name="newTiddlerTags" value=<<getNewTags>>>
<<newTagsButton>>
</$set>

Rich

unread,
Jul 29, 2016, 12:58:52 AM7/29/16
to TiddlyWiki
thanks for this...I have too much fiddly custom stuff in my wiki to do it this way though.  


On Tuesday, July 26, 2016 at 7:36:08 PM UTC-10, RichardWilliamSmith wrote:
Reply all
Reply to author
Forward
0 new messages