Any way to change default new tiddler?

358 views
Skip to first unread message

Dave Gifford - http://www.giffmex.org/

unread,
Nov 3, 2017, 10:28:43 AM11/3/17
to TiddlyWiki
Hi all

One thing I have wanted at times is for all new tiddlers, regardless of the mode of creating them, to have a certain field. So whether I click on an empty link or create from a button, the tiddler will already have a custom field in it. Is there a way to do that? Up till now I have had to always take the extra step of creating new tiddlers by a custom new tiddler button.

PMario

unread,
Nov 3, 2017, 11:46:23 AM11/3/17
to tiddl...@googlegroups.com
On Friday, November 3, 2017 at 3:28:43 PM UTC+1, Dave Gifford - http://www.giffmex.org/ wrote:
...  Up till now I have had to always take the extra step of creating new tiddlers by a custom new tiddler button.

That's the way to do it. ... How would you like to configure the name of the new field?

-m

Dave Gifford - http://www.giffmex.org/

unread,
Nov 3, 2017, 11:57:00 AM11/3/17
to TiddlyWiki
Hi Mario

I have it set up with a new tiddler button the way I want it. But you know me, I'm greedy, I'd like to click on a tag pill, then click the link to the tag name, and have it open up as a new tiddler with certain fields already in place, not just an empty new tiddler. But if that can't be done, no worries, I have it set up good enough...

Mark S.

unread,
Nov 3, 2017, 1:15:21 PM11/3/17
to TiddlyWiki
It would be really nice if tiddlywiki.com gave even a single example of how to use paramObject.

With that digression out of the way, you could add this code to


$:/core/modules/widgets/navigator.js


Go down to


NavigatorWidget.prototype.handleNewTiddlerEvent

Go further down below where it says:

if(additionalFields && additionalFields.title) { title = additionalFields.title; }

Below these lines, insert:

if(typeof additionalFields == "undefined") {
additionalFields = {} ;
}

additionalFields.myfield = "123" ;

You can add whatever fields you want here, e.g.

additionalFields.gifford = "true" ;

Save and reload. This should change everywhere that tiddlers are made, including new here, clone, and journal.

ABSOLUTELY make a back up before trying this, because this is a very ticklish part of the core.


Sorry about the bad formatting here -- Google seems to be at war with my browser lately.

Good luck,
Mark

wimm

unread,
Nov 4, 2017, 7:55:58 AM11/4/17
to tiddl...@googlegroups.com

Note If tiddler in search field already exists, than it will be opened in draft mode. 

how to accomplish this

make a clone of the editbutton $:/core/ui/Buttons/edit  which is normally used for editing a tiddler in the story river

replace the body text with the following (in bold the changes compared to the original edit button tiddler)
-----
<$reveal state="$:/temp/search" type="nomatch" text=""><$button message="tm-edit-tiddler" param={{$:/temp/search}} tooltip={{$:/language/Buttons/Edit/Hint}} aria-label={{$:/language/Buttons/Edit/Caption}} class=<<tv-config-toolbar-class>>>
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
{{$:/core/images/edit-button}}^^s^^
</$list>
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
<span class="tc-btn-text"><$text text={{$:/language/Buttons/Edit/Caption}}/></span>
</$list>
</$button></$reveal>
----
then add tag $:/tags/PageControls   
remove the tag 
rename the tiddler to a unique name
save tiddler clone 


that's all
Njoy wjam



David Gifford

unread,
Nov 4, 2017, 8:54:23 AM11/4/17
to tiddl...@googlegroups.com
Thanks Njoy wjam! Your answer brings me great njoy.

David Gifford
Mexico team leader, Mexico City

Resonate Global Mission
Engaging People. Embracing Christ.
A Ministry of the Christian Reformed Church
resonateglobalmission.org


On Sat, Nov 4, 2017 at 7:55 AM, wimm <wiem...@gmail.com> wrote:
how to accomplish this

make a clone of the editbutton $:/core/ui/Buttons/edit  which is normally used for editing a tiddler in the story river

replace the body text with the following (in bold the changes compared to the original edit button tiddler)
-----
<$reveal state="$:/temp/search" type="nomatch" text=""><$button message="tm-edit-tiddler" param={{$:/temp/search}} tooltip={{$:/language/Buttons/Edit/Hint}} aria-label={{$:/language/Buttons/Edit/Caption}} class=<<tv-config-toolbar-class>>>
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
{{$:/core/images/edit-button}}^^s^^
</$list>
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
<span class="tc-btn-text"><$text text={{$:/language/Buttons/Edit/Caption}}/></span>
</$list>
</$button></$reveal>
----
then add tag $:/tags/PageControls   
remove the tag 
rename the tiddler to a unique name
save tiddler clone 

that's all
Njoy wjam



--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/meMFzwjLxXw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+unsubscribe@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/267b516b-220d-45f3-bcde-56c8fd8e28d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

wimm

unread,
Nov 4, 2017, 9:50:44 AM11/4/17
to TiddlyWiki
You are welcome,

Attached you'll find a json file with the tiddler code, just drag and drop

K.R.
wjam
$--plugins-wjam-createTiddlerFromSearchField.json

Dave Gifford - http://www.giffmex.org/

unread,
Nov 5, 2017, 6:50:20 PM11/5/17
to TiddlyWiki
Hi Mark

I like the idea of your solution, but I am wondering if there is something missing or if I am pasting it wrong. I tried several different ways to paste it and save and reopen, with no results whatsoever.

Dave

Mark S.

unread,
Nov 5, 2017, 7:13:19 PM11/5/17
to TiddlyWiki
Hi Dave,

Can you post what your tiddler ($:/core/modules/widgets/navigator.js)
looks like after your patch? What version of TW are you running?

Also, the changes don't take effect until you reload.

My instructions may have seen a little confusing, because Google kept wanting to do weird things with the formatting.

Mark

Dave Gifford - http://www.giffmex.org/

unread,
Nov 5, 2017, 7:43:49 PM11/5/17
to TiddlyWiki
Hi Mark

Thanks for your help.

The attached file has only one way that I tried to paste it. I also tried pasting it just as you had it, both inside and outside the curly bracket of the preceding code, and with and without the line " additionalFields = {} ; "

Dave

tagstorm.html

Mark S.

unread,
Nov 5, 2017, 8:19:43 PM11/5/17
to TiddlyWiki
Hi Dave,

You were close. What it is is there needs to be a bit of code that tests for the existence of 'additionalFields' and makes sure that the variable exists before inserting your new field. Without that step it will throw an error under various conditions. Still only 4 lines of code. So far.

I wrapped the code in comments starting with "// BEGIN INSERTED SPECIAL FIELDS CODE" so you should be able to find them easily.

"So far" because you may want more. I tested cloning, here now and your existing custom buttons. And it works everywhere. BUT, the thing you might not like is now is that the offtopic tag button identifies itself as 'ontopic'. To get around that would require wrapping your code with a couple more lines of code and not overwrite if it already exists. But I was thinking that with this new default you might not need the two tag buttons and could use them to make other custom mods that you don't want universal (assuming there are some).

Have fun,
Mark
tagstorm.html

David Gifford

unread,
Nov 5, 2017, 8:35:24 PM11/5/17
to tiddl...@googlegroups.com
Hi Mark

1. Thank you for your willingness to check this out!

2. The offtopic button is totally unnecessary, part of trying to do things a different way. I can just delete it.

3. It still isn't working the way I envisioned it: to make my usecase crystal clear: I want to tag a tiddler with whatever tag. Then from the tag pill dropdown click the link to what would be the title of the tag, to create the tiddler whose title is the name of the tag. Then I want to edit the tiddler and find the ontopic field already there with a yes in it, and either type no or leave it yes. But when I choose tiddler 2017-11-5-8:44:4 and click the tag 'sample taggy' and click the link to sample taggy at the top of the dropdown, the resulting tiddler sample taggy opens, but when I edit it, the ontopic field is not there.

My idea is that each file will be to take notes on books on a specific topic, say books on geography. Notes that are on geography will be on topic notes, and will show up in one index. Random helpful notes on other topics are off topic and will show up in a different index. The on topic notes will get built into a course packet of sorts, and off topic notes (ontopic=no) can get transferred to more relevant course packets if needed.

Blessings,

David Gifford
Mexico team leader, Mexico City

Resonate Global Mission
Engaging People. Embracing Christ.
A Ministry of the Christian Reformed Church
resonateglobalmission.org


--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/meMFzwjLxXw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+unsubscribe@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

Mark S.

unread,
Nov 5, 2017, 8:51:24 PM11/5/17
to TiddlyWiki
That part #3 where you use the tag wasn't clear from your first post. That sounds like a bigger project, because effectively you're asking to overwrite the "ghost tiddler" code that makes the pseudo tiddler when you click on a link to a non-existent tiddler. That might take someone with a better grasp of TW innards than yo. Lo siento ;<

Mark
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.

David Gifford

unread,
Nov 5, 2017, 8:55:25 PM11/5/17
to tiddl...@googlegroups.com
No worries! I guess I forgot that those were "ghost" tiddlers. I got it in my head that they were actual new tiddlers, just waiting to be edited.

David Gifford
Mexico team leader, Mexico City

Resonate Global Mission
Engaging People. Embracing Christ.
A Ministry of the Christian Reformed Church
resonateglobalmission.org


To unsubscribe from this group and all its topics, send an email to tiddlywiki+unsubscribe@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
Reply all
Reply to author
Forward
0 new messages