[TW5] Name for new tiddler

67 views
Skip to first unread message

Stephan Hradek

unread,
Feb 17, 2014, 2:38:31 AM2/17/14
to tiddly...@googlegroups.com
Hi!

I often type something into the search field, click "+" and expect the new tiddler to have that name - unfortunately this does not work ;)

So I tried to add this feature by changing $:/core/ui/PageControls/new-tiddler to

<$button message="tw-new-tiddler" class="btn-invisible" param={{$:/temp/search}}>{{$:/core/images/new-button}}</$button>

But it didn't work.

Question: Do you think this feature is a good idea?

Even if not: How would I add it for my personal usage? At the moment I don't have a clue. When I have I'll post it here ;)

Stephan Hradek

unread,
Feb 17, 2014, 2:43:54 AM2/17/14
to tiddly...@googlegroups.com
At least I know now, why it did not work.

Line 329 of
$:/core/modules/widgets/navigator.js reads

var title = this.wiki.generateNewTitle((templateTiddler && templateTiddler.fields.title) || "New Tiddler");

So the tiddler has to exist in order to be able to set the new tiddler's name :(


Stephan Hradek

unread,
Feb 17, 2014, 5:40:58 AM2/17/14
to tiddly...@googlegroups.com
Okay... Her's what I changed in $:/core/modules/widgets/navigator.js:

    var newTiddlerTitle = event.param || "New Tiddler";
    // Get the template tiddler if there is one
    var templateTiddler = this.wiki.getTiddler(newTiddlerTitle);
    // Create the new tiddler
    var title = this.wiki.generateNewTitle((templateTiddler && templateTiddler.fields.title) || newTiddlerTitle);

But this will also make any existinf tiddler be the "template" (correct naming: Skeleton) for any new tiddler. Example: If you create a tiddler called "New Tiddler" this one will be the skeleton for any "New Tiddler #" created from then on.

If you type a tiddler's name, for example "test" into the search field and press "+", you'll get a copy of an existing tiddler "test" which will be titled "test #".

This might be confusing first, but I think I'm gonna like it.



PMario

unread,
Feb 17, 2014, 6:29:46 AM2/17/14
to tiddly...@googlegroups.com
With TWc the gotoPlugin did a similar thing.

If you type a tiddler name and it was excludeLists, it wasn't listed in the drop down. ... but if you hit
ctrl-enter ... it was opened anyway. ... So if you know the name of an eg: shadow tiddler, you don't need to navigate the tabs.

If a tiddler name was new, it did the same as if you click a "missing link" ... it opens a new tiddler with that name.

I think this behaviour could be implemented, whith the new keyboard handling.

@jeremy
what do you tink?
Reply all
Reply to author
Forward
0 new messages