get title selected starting a new tiddler

22 views
Skip to first unread message

Dave Parker

unread,
Jan 4, 2008, 6:46:11 PM1/4/08
to TiddlyWiki
How would one get the tiddler title selected when starting a new
tiddler, so that you can just start typing and it writes over it?
Some of my TWs have that and some just put the cursor at the far left,
and I don't know why...

Dave Parker

FND

unread,
Jan 4, 2008, 6:48:41 PM1/4/08
to Tiddl...@googlegroups.com
> How would one get the tiddler title selected when starting a new
> tiddler, so that you can just start typing and it writes over it?

Use the NewTiddler macro's focus parameter:
<<newTiddler focus:"title">>
More info here:
http://www.tiddlywiki.com/#NewTiddlerMacro

HTH.


-- F.

Dave Parker

unread,
Jan 4, 2008, 6:58:58 PM1/4/08
to TiddlyWiki
Thanks!

Dave Parker

unread,
Jan 5, 2008, 11:34:11 AM1/5/08
to TiddlyWiki
Hi again,

I did what you said and the problem is still there. I think the new
tiddler title actually does have the focus, i.e. the cursor is there
in the title blinking, ready to go ("|New Tiddler"), but I'd like it
to be fully highlighted.

Any other ideas?

DP

wolfgang

unread,
Jan 5, 2008, 11:39:46 AM1/5/08
to TiddlyWiki
Hi Dave,

I suspect you use TextAreaPlugin.

If so, just disable 'place cursor at start of textarea instead of pre-
selecting content'

W.

Dave Parker

unread,
Jan 5, 2008, 1:19:56 PM1/5/08
to TiddlyWiki
Wolfgang, you are Clairevoyant! That did the trick.

Thank you :-)

DP

FND

unread,
Jan 5, 2008, 1:25:36 PM1/5/08
to Tiddl...@googlegroups.com
> Wolfgang, you are Clairevoyant!

Indeed - that was just /too/ good a guess!
Wolfgang, is there any plugin (combination) you haven't tried? In fact,
I suspect the entity appearing here as "Wolfgang" is actually some sort
of monkey farm, with chimps hacking away on countless keyboards...


-- F.

wolfgang

unread,
Jan 5, 2008, 1:44:35 PM1/5/08
to TiddlyWiki
> ... is actually some sort of monkey farm,
> with chimps hacking away on countless keyboards...

..well, at least:

''TiddlyWiki" - the total immersion into distraction for monkey
minds...

;-)

Amzg

unread,
Jan 6, 2008, 8:18:00 AM1/6/08
to TiddlyWiki
In deed an impressive intuition. So how about this challenge ;-)

How would one get automatic focus on the tiddler title selected when
opening an *existing* tiddler in edit mode?

(I don't know if the monkeys referred to above have anything to do
with MonkeyGTD 2.1, but this is the application I hope to apply the
above asked for knowledge on. )

My sincerest thanks!

/Mat

Eric Shulman

unread,
Jan 6, 2008, 1:35:53 PM1/6/08
to TiddlyWiki
> In deed an impressive intuition. So how about this challenge ;-)
> How would one get automatic focus on the tiddler title selected when
> opening an *existing* tiddler in edit mode?

I've just added a new tweak to
http://www.TiddlyTools.com/#CoreTweaks

This tweak allows you to set an option value:
<<option txtEditorFocus>>
to enter the fieldname that will receives initial focus when opening a
tiddler editor. You can, of course, also set this value in a
[[CookieJar]] (aka, "ConfigTweaks") tiddler:
config.options.txtEditorFocus="title";

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

Amzg

unread,
Jan 6, 2008, 2:22:14 PM1/6/08
to TiddlyWiki
Great you're helping out with this Eric!

I tried both your suggestions but none seem to work (for my mGTD 2.1
alpa). Maybe adding the CoreTweak version doesn't work for this
because mGTD is not TW2.3.0, as is stated necessary in the CoreTweak
explanatory text? (Even though I erased all other tweaks after copy-
pasting everything, including name and tags).

I also edited what I assume you refer to, i.e the ConfigTweaksPlugin
(...in mGTD) and simply added the
config.options.txtEditorFocus="title"; as a new command line, but
doesn't work either - When opening an existing tiddler, the focus is
on the text rather than the title as I write in the respecive places
for these two solutions.

Thanks for your suggestions!

/Mat

Eric Shulman

unread,
Jan 6, 2008, 2:43:15 PM1/6/08
to TiddlyWiki
> I tried both your suggestions but none seem to work (for my mGTD 2.1
> doesn't work either - When opening an existing tiddler, the focus is
> on the text rather than the title as I write in the respecive places
> for these two solutions.

silly question: after installing the CoreTweaks, did you remember to
save-and-reload?

-e

Amzg

unread,
Jan 6, 2008, 2:46:45 PM1/6/08
to TiddlyWiki
A justified question considering my non-expertise - but, yes, I did do
that...

/Mat

Eric Shulman

unread,
Jan 6, 2008, 3:35:00 PM1/6/08
to TiddlyWiki
> I tried both your suggestions but none seem to work (for my mGTD 2.1
> alpa). Maybe adding the CoreTweak version doesn't work for this
> because mGTD is not TW2.3.0, as is stated necessary in the CoreTweak
> explanatory text? (Even though I erased all other tweaks after copy-
> pasting everything, including name and tags).

This particular tweak IS compatible with TW2.1.3 (which is what
mGTD2.1a91 is based on).

I'd double-check your edits to CoreTweaks. Make sure you didn't
remove a close-comment sequence (which could prevent the code from
executing) or something similarly innocuous.

HTH,
-e

Amzg

unread,
Jan 6, 2008, 5:29:24 PM1/6/08
to TiddlyWiki
Hm, I copied the full tiddler again and tried, but no luck.
Maybe I'm using it wrong?
I tried to simply type "title" in the field that is visible in the non-
edit mode and then various tests saving or not saving etc. (BTW, if
this is the intened way of using this, may I humbly suggest that the
various options are listed next to the fill-in-field rather than the
for-a-beginner-somewhat-cryptic-message; (usage: <<option
txtEditorFocus>>)

For another, separate, try I went in to edit mode and changed "text"
into "title" for this line:

config.options.txtEditorFocus="text";

What am I not getting? Really thanks for your help Eric!

/Mat

Eric Shulman

unread,
Jan 6, 2008, 5:53:51 PM1/6/08
to TiddlyWiki
> Hm, I copied the full tiddler again and tried, but no luck.
> Maybe I'm using it wrong?

From what you describe, it sounds like you have installed it as
intended. I'm not sure why it's not working for you...

Search your tiddler content for "focusTiddler"... that is the core
function that is being hijacked by the tweak. If some other plugin
is also hijacking this function, it might be preventing the tweaked
code from being properly invoked.

Let me know what you find...

> various options are listed next to the fill-in-field rather than the
> for-a-beginner-somewhat-cryptic-message; (usage: <<option
> txtEditorFocus>>)

The "usage" describes the syntax for adding the option into your own
content (e.g., [[OptionsPanel]]), where you are free to place any help
text you like.

The specific values that can be entered into the option can vary
greatly based on whether or not you are using a customized
EditTemplate. The default (shadow) EditTemplate includes the "title",
"text" and "tags" fields. However, if you have added custom fields to
your EditTemplate, you can also use any of those other field names as
the value for the txtEditorFocus option.

-e

Amzg

unread,
Jan 6, 2008, 8:09:46 PM1/6/08
to TiddlyWiki
> Search your tiddler content for "focusTiddler"... that is the core
> function that is being hijacked by the tweak. If some other plugin
> is also hijacking this function, it might be preventing the tweaked
> code from being properly invoked.
>
> Let me know what you find...

Aha - I found 2 other tiddlers using "focusTiddler". (Interstingly
they focus on 'title', which is exactly what I'm trying to
do... :-) I'm copying the parts that contain the focusTiddler
parts. If anyone bothers to take a look at it; great, but if no
immediate solution pops up I/we'll just leave it and I'll continue to
manually focus (my application for it allows me to). I'm very grateful
for the efforts that you put in Eric!


NewTiddlerWithFieldsMacro
http://tampageekland.tiddlyspot.com#NewTiddlerWithFieldsMacro

config.macros.newTiddlerWithFields.onClickNewTiddlerWithFields =
function() {
var title = this.getAttribute("newTitle");
if(this.getAttribute("isJournal")) {
var now = new Date();
title = now.formatString(title.trim());
}
var params = this.getAttribute("params").split("|");
var custFields = this.getAttribute("custFields").split("|");
var custValues = this.getAttribute("custValues").split("|");
var focus = this.getAttribute("newFocus");
var template = this.getAttribute("newTemplate");
story.displayTiddler(null,title,template);
var text = this.getAttribute("newText");
if (typeof text == "string")
story.getTiddlerField(title,"text").value = text.format([title]);
for (var t=0;t<params.length;t++)
story.setTiddlerTag(title,params[t],+1);
for (var i=0;i<custFields.length;i++)
story.setTiddlerField(title,custValues[i],+1,custFields[i]);
story.focusTiddler(title,focus);
return false;
}



NewHerePlugin
http://mptw.tiddlyspot.com/#NewHerePlugin

{{{
merge(config.commands,{

newHere: {
text: 'new here',
tooltip: 'Create a new tiddler tagged as this tiddler',
hideReadOnly: true,
handler: function(e,src,title) {
if (!readOnly) {
clearMessage();
var t=document.getElementById('tiddler'+title);

story.displayTiddler(t,config.macros.newTiddler.title,DEFAULT_EDIT_TEMPLATE);
story.setTiddlerTag(config.macros.newTiddler.title, title, 0);
story.focusTiddler(config.macros.newTiddler.title,"title"); //
doesn't work??
return false;
}
}
},


newJournalHere: {
//text: 'new journal here', // too long
text: 'new journal',
hideReadOnly: true,
dataFormat: 'DD MMM YYYY', // adjust to your preference
//dataFormat: 'YYYY-0MM-0DD',
tooltip: 'Create a new journal tiddler tagged as this tiddler',
handler: function(e,src,title) {
if (!readOnly) {
clearMessage();
var now = new Date();
var t=document.getElementById('tiddler'+title);
var newtitle = now.formatString(this.dataFormat)
story.displayTiddler(t,newtitle,DEFAULT_EDIT_TEMPLATE);
story.setTiddlerTag(newtitle, title, 0);
story.focusTiddler(newtitle,"title");
return false;
}
}
}




> The "usage" describes the syntax for adding the option into your own

Oh, you mean I can focus onto a specific separate tiddler? Sounds like
it could come in handy when I'm a littler sharper at this.

Eric, thank you!

/Mat

Eric Shulman

unread,
Jan 7, 2008, 12:24:03 AM1/7/08
to TiddlyWiki
> > Search your tiddler content for "focusTiddler"... that is the core
> > function that is being hijacked by the tweak. If some other plugin
> Aha - I found 2 other tiddlers using "focusTiddler". (Interstingly
> they focus on 'title', which is exactly what I'm trying to
> do... :-) I'm copying the parts that contain the focusTiddler
> http://tampageekland.tiddlyspot.com#NewTiddlerWithFieldsMacro
> http://mptw.tiddlyspot.com/#NewHerePlugin

hmm... those plugins shouldn't have any effect on the problem...

> > The "usage" describes the syntax for adding the option into your own
> Oh, you mean I can focus onto a specific separate tiddler? Sounds like
> it could come in handy when I'm a littler sharper at this.

That's not what I meant. Here's an overview of how this is all
supposed to work:

The tweak in question "hijacks" the core function
config.commands.editTiddler.handler()
which processes the "edit" toolbar command. After invoking the
standard core handler, the tweak then re-directs the focus to the
field whose name is specified in an internal variable:
config.options.txtEditorFocus

The value of this variable can be set with a small "CookieJar"
tiddler, tagged with "systemConfig", and containing this line of
javascript:
config.options.txtEditorFocus="title";
and/or by embedding
<<option txtEditorFocus>>
somewhere on your page, to create a text input box that lets you
quickly set the value without having view the [[CoreTweaks]] tiddler
(e.g., embed it in the 'options' section of your sidebar by adding it
to the definition in [[OptionsPanel]]). This is what the "usage"
notation is referring to.

Can you send me a copy of your document (privately)? The code in the
tweak isn't very complicated at all, and it should just work... but
for some unknown reason, doesn't work in your document.

I really want to know why this simple core tweak isn't working for
you. Even if it's just a minor setup error on your part, I want to
understand the cause, so that maybe I can make the code more fault-
tolerant, or at least add a note to the tweak's documentation, so that
others can avoid this problem in the future.

-e

Dave Parker

unread,
Jan 8, 2008, 1:56:00 PM1/8/08
to TiddlyWiki
This is a question regarding the original problem.

Wolfgang found the source of my problem, the use of the
TextAreaPlugin. The desired behaviour does get fixed when I uncheck
the "place cursor at start of textarea instead of pre-selecting
content" box in the plugin.

The problem is that any time the TWfile reloads, the box rechecks
itself.

Before running to this forum I tried making a "ConfigOverride" tiddler
(following directions on the tiddlywiki.org help site) with
tag:systemConfig, with the following:
//{{{
config.options.chkDisableAutoSelect = true;
//}}}

(tried with both true and false and variations of spaces and no spaces
on either side of the "=" sign)
(also tried same without the "//" on those lines (I thought that was a
remark signifier))

and nothing's working.

What am I doing wrong?

Dave Parker

Eric Shulman

unread,
Jan 8, 2008, 3:14:45 PM1/8/08
to TiddlyWiki
> Wolfgang found the source of my problem, the use of the
> TextAreaPlugin. The desired behaviour does get fixed when I uncheck
> the "place cursor at start of textarea instead of pre-selecting
> content" box in the plugin.
> The problem is that any time the TWfile reloads, the box rechecks
> itself.

eek! A bug... *squish*.... got it!

http://www.TiddlyTools.com#TextAreaPlugin

has been updated so that option values that are set to false are not
confused with uninitialized values (which forced them to be set back
to true!)

Once you install the update, the TextAreaPlugin settings will be
'sticky' again...

Dave Parker

unread,
Jan 8, 2008, 3:23:04 PM1/8/08
to TiddlyWiki
thanks!
Reply all
Reply to author
Forward
0 new messages