EditTextWidget and the "trap"

23 views
Skip to first unread message

Charlie Veniot

unread,
Oct 20, 2021, 11:33:13 PMOct 20
to TiddlyWiki

One trap to be aware of is that the edit text widget cannot be used to edit a field of the tiddler that contains it. Each keypress results in the tiddler being re-rendered, which loses the cursor position within the text field.

I thought that was resolved in TW5.2.0.  Based on current documentation, me thinks I likely misunderstood whether or not TW5.2.0 resolved the "trap."

Regardless, do note: in some circumstances, the trap does not apply. However, in other circumstances, the trap does apply.  Although not a problem in certain circumstances, I'm thinking best to always avoid use of edit text widget to edit a field of a tiddler in which the edit text widget exists.

Please download the attached and drag into TiddlyWiki.com to be aware of the trap.

Apologies if I missed any already existing discussion about this.

EditTextWidget Tester.json

Jeremy Ruston

unread,
Oct 21, 2021, 4:27:59 AMOct 21
to tiddl...@googlegroups.com
Hi Charlie,



One trap to be aware of is that the edit text widget cannot be used to edit a field of the tiddler that contains it. Each keypress results in the tiddler being re-rendered, which loses the cursor position within the text field.

I thought that was resolved in TW5.2.0.  Based on current documentation, me thinks I likely misunderstood whether or not TW5.2.0 resolved the "trap."

Good catch, we missed that. I’ve updated the docs to reflect the changes in v5.2.0.

Regardless, do note: in some circumstances, the trap does not apply. However, in other circumstances, the trap does apply.  Although not a problem in certain circumstances, I'm thinking best to always avoid use of edit text widget to edit a field of a tiddler in which the edit text widget exists.

Please download the attached and drag into TiddlyWiki.com to be aware of the trap.

Apologies if I missed any already existing discussion about this.

The second example in your test tiddler looks like this:

<$vars var2={{!!field2}}>

''__Field 2:__''
<$edit-text field="field2" />

Field 2:<$text text={{{[<currentTiddler>get[field2]] }}}/>

</$vars>

The problem here is actually not the `<$edit-text>` widget but the `<$vars>` widget – it (and all the widgets it contains) gets refreshed each time the value of field2 changes.

Best wishes

Jeremy.
Reply all
Reply to author
Forward
0 new messages