EditTextWidget: ouch when tiddler=currentTiddler and using index

85 views
Skip to first unread message

Charlie Veniot

unread,
Apr 16, 2021, 9:50:54 PM4/16/21
to TiddlyWiki
G'day all,

I have been bitten by this one too many times.  This wouldn't happen if I did not so stubbornly preferred data tiddlers for storing data values, instead of using tiddler fields.

But, dang it: I really like data tiddlers for some strange reason.

As I setup EditText widgets in some tiddler  (let's call this a "Form" tiddler) to maintain values stored in a data tiddler, I often make a mistake setting up one or more widgets in a way that winds up blowing away the content of the "Form" tiddler.

As a trivial/ridiculous simulation that duplicates my regular self-inflicted drop-kick through the goalposts of life, create a new tiddler with the following content:

Screenshot 2021-04-16 10.41.02 PM.png

Save that tiddler and type some letter key on your keyboard in this text field.  Wham.   Now the tiddler looks something like the following (with the field "bub" set to whatever key ):

Screenshot 2021-04-16 10.25.18 PM.png

Is there some way for me to tell TiddlyWiki: never allow "index" to be used with tiddler = currentTiddler (either explicitly set or implicitly assumed) for any widget?



 


Mohammad Rahmani

unread,
Apr 17, 2021, 12:44:21 AM4/17/21
to tiddl...@googlegroups.com
I have this issue many times and lost my codes! I normally work on Node.JS as my development platform. This happens especially when you are writing a template tiddler!
By now I have not found any solution but one is to not use currentTiddler!

 



 


--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/b8879858-532f-4683-9cfe-3f20d09ac9ban%40googlegroups.com.

PMario

unread,
Apr 17, 2021, 6:24:56 AM4/17/21
to TiddlyWiki
Hi,
Yea, There are some widgets, where the default values used can cause data loss. Especially if you are developing new stuff and have variables, that are not initialized in the right way.

The problem is, that we can't change this behavior anymore, because of backwards compatibility reasons.  

The only way would be to create new widgets, that do the same thing, but are safe, if you don't specify parameters.

-mario

Charlie Veniot

unread,
Apr 17, 2021, 12:32:13 PM4/17/21
to TiddlyWiki
I've got this idea festering:

Add a select widget to the Editor Toolbar, a "insert a widget" widget.

Populate this select widget with a list of "canned" wikitext for pre-configured widgets.

Every single item in the select widget will insert, at the cursor location, the wikitext for the relevant pre-configured widget.

Each pre-configured widget will have "tiddler" parameter set to the macro <<GetDataTid>>

The code for the GetDataTid macro:

\define  GetDataTid()

{{{ [<dataTid>is[tiddler]] [<currentTiddler>addsuffix[ Data]] +[first[]] }}}

\end        

For any widget in a tiddler without the variable <dataTid> defined, GetDataTid will say the Data Tiddler for whatever widget is the title of a tiddler = the current tiddler with suffix " Data" added.

If <dataTid> is defined and is a valid tiddler, then GetDataTid will say the Data Tiddler for whatever widget is the title specified by <dataTid>.

So as long as I always use the "select widget" widget in the editor toolbar, I should stop running into problems.

Maybe?



Charlie Veniot

unread,
Apr 17, 2021, 3:23:37 PM4/17/21
to TiddlyWiki
Reply all
Reply to author
Forward
0 new messages