Script for Edit button to open a tiddler for editing

59 views
Skip to first unread message

whatever

unread,
Mar 22, 2011, 10:50:10 AM3/22/11
to TiddlyWiki
Hi!

Somewhere, I found the following script:
<script
label="delete">config.commands.deleteTiddler.handler(undefined,undefined,"some
tiddler")</script>
It's suitable for using in a fET. Accordingly, the following script
should open a tiddler for editing:
<script
label="edit">config.commands.editTiddler.handler(undefined,undefined,"some
tiddler")</script>
However, I get the following error:
TypeError: tiddlerElem is null

I have a bunch of fET generated lists of links (browser bookmarks) and
I want to have edit and delete buttons with each link, so that I can
either delete it or open it for editing (if I want to change
something). At the moment, I need to go into the tiddler containing
the link and click on the edit button. Each tiddler contains a single
web link, so the fET actually displays tiddler.text, not
tiddler.title.

Any help?

PMario

unread,
Mar 22, 2011, 11:28:30 AM3/22/11
to TiddlyWiki
something like this may work.

var title = 'New Tiddler';
story.displayTiddler(null, title);
config.commands.editTiddler.handler(null, null, title);

didn't test it.
but it works at http://pmario.tiddlyspace.com/#SvgEvent_Menue
-m

whatever

unread,
Mar 22, 2011, 11:43:14 AM3/22/11
to TiddlyWiki
Yep, works like a charm. :) I was suspecting that I needed to display
the tiddler first, but I wasn't sure.

w

On 22 mar., 16:28, PMario <pmari...@gmail.com> wrote:
> something like this may work.
>
>  var title = 'New Tiddler';
>  story.displayTiddler(null, title);
>  config.commands.editTiddler.handler(null, null, title);
>
> didn't test it.
> but it works athttp://pmario.tiddlyspace.com/#SvgEvent_Menue

Eric Shulman

unread,
Mar 22, 2011, 1:30:36 PM3/22/11
to TiddlyWiki
>  var title = 'New Tiddler';
>  story.displayTiddler(null, title);
>  config.commands.editTiddler.handler(null, null, title);

There's actually no need to invoke the editTiddler.handler().
Just specify the desired template in the displayTiddler() call, like
this:

story.displayTiddler(null, title, DEFAULT_EDIT_TEMPLATE);


enjoy,
-e


PMario

unread,
Mar 22, 2011, 2:42:34 PM3/22/11
to TiddlyWiki
You are right.
But displayTiddler alone doesn't set the caret position to the text
area, as far as I can remember.

It saves a mouse click :)

have fun!
-m
Reply all
Reply to author
Forward
0 new messages