How to get the title of a tiddler in js?

57 views
Skip to first unread message

imleg...@gmail.com

unread,
Sep 12, 2021, 11:34:03 AM9/12/21
to TiddlyWiki
I installed the tiddler 2click2edit. I want to change it a little that when a tiddler start with the "$", don't trigger the edit command. 

I already found the related code. Which is $:/plugins/danielo515/2click2edit/ClickListener.js

I think I need to change the code 

```
ClickListener.prototype.editTiddler = function(event) { //alert(this.getVariable("currentTiddler").getTitle()); 
  this.dispatchEvent({type: "tm-edit-tiddler", param: this.getVariable("currentTiddler")}); }; 
```

But this.getVariable("currentTiddler").getTitle() seems not right, how to fix it. 

And is there a manual for program for tw? 

Charlie Veniot

unread,
Sep 12, 2021, 12:50:49 PM9/12/21
to TiddlyWiki
Hi,

Instead of altering the javascript, give what's in the screenshot below a try.

Do note: for the change to take effect, you do have to save and reload your TiddlyWiki.

Screenshot 2021-09-12 1.48.30 PM.png

imleg...@gmail.com

unread,
Sep 14, 2021, 4:36:23 AM9/14/21
to TiddlyWiki
thank you. Can you give me a link about the viewtemplate, cuz I can't find it on google. 

And why we put a "<$click>" here

strikke...@gmail.com

unread,
Sep 14, 2021, 5:29:20 AM9/14/21
to TiddlyWiki
You find the viewtemplate in .Danielos 2click2edit plugin

strikke...@gmail.com

unread,
Sep 14, 2021, 5:38:26 AM9/14/21
to TiddlyWiki
Charlie - editing the viewtemplate lead to another problem - 2 click on one tiddler open all standard tiddlers for edit.

Charlie Veniot

unread,
Sep 14, 2021, 8:58:26 AM9/14/21
to TiddlyWiki
Just to answer your first question, you want to modify the ViewTemplate  in your TiddlyWiki that has the plugin.  (screenshot below)

Also, after you've edited the plugin, you have to make sure to save and reload the TiddlyWiki for the change to take effect.

I just tested this again, and it all works A-1.  Double-clicking on any tiddler just opens that one tiddler for edit.  Double-clicking on either a shadow or a system tiddler does nothing.

Just as a sanity check, download an empty TiddlyWiki, install the plugin in that TiddlyWiki, and see if things work correctly there.

I suspect you made a change to the plugin's javascript and also made this edit I suggest to the ViewTemplate.

If you did change the javascript, you should probably remove the plugin and reinstall.

Screenshot 2021-09-14 9.51.20 AM.png

strikke...@gmail.com

unread,
Sep 14, 2021, 10:03:13 AM9/14/21
to TiddlyWiki
cj.v,
Thank you. I does work for me too now. It was of course an error on my part - not identifying my own typo. It seems no matter how many times we look our writing through- eyes popping out, errors are often not found. I call it TW eye fatigue.

Thank you,
Birthe

Charlie Veniot

unread,
Sep 14, 2021, 10:12:38 AM9/14/21
to TiddlyWiki
Oh good.  Big sigh of relief over here.  (I may have had "look, see, it works" moments while people politely nod in agreement while awkwardly hoping somebody else lifts a hand and breaks the news...)

imleg...@gmail.com

unread,
Sep 15, 2021, 6:15:29 AM9/15/21
to TiddlyWiki
Do you know how to disable the plugin when I double click the title?  Some time I just want to copy the title not edit the whole tiddler, I double click the title to select it. But now will trigger the edit command 

Charlie Veniot

unread,
Sep 15, 2021, 8:32:52 AM9/15/21
to TiddlyWiki
That will require a change to the plugin's javascript, I think, which will be quite ugly.

Alternatively, you could create a single-click button in the tiddler toolbar which copies the tiddler title to the clipboard.  I think that would be a much more trivial affair.

Reply all
Reply to author
Forward
0 new messages