Hi c pa

On Fri, Sep 5, 2014 at 1:47 AM, 'c pa' via TiddlyWiki <
[email protected]> wrote:

> I started hacking $checkbox and it turns out that there is some mechanism
> that converts tiddler.fields.tags into an array so that tags.push() and
> tags.pop are valid actions
>
> I'm guessing that there is a field handler that does that conversion.
> Could you point me to where that code resides?
>

The field handler that deserialises the `tags` field into an array is here:

https://github.com/Jermolene/TiddlyWiki5/blob/master/boot%2Fboot.js#L809

If you want to treat another field as an array (one that hasn't been
automatically deserialised), you need to do is something like this:

var myTiddler = wiki.getTiddler(title);
var myFakeTags =
$tw.utils.parseStringArray(myTiddler.fields["my-fake-tag-field"]);
myFakeTags.push("anotherTag");
wiki.saveTiddler(new $tw.Tiddler(myTiddler,{"my-fake-tag-field":
$tw.utils.stringifyList(myFakeTags)));

Best wishes

Jeremy


>
>  --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/tiddlywiki.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jeremy Ruston
mailto:[email protected]

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to