Update twiddler text from widget

72 views
Skip to first unread message

Tony Grosinger

unread,
Sep 27, 2015, 1:22:28 AM9/27/15
to TiddlyWiki
I am making a widget that is designed to have content between the widget tags. For example:

<$mywidget>
    Content
    Content
    Content
</$mywidget>

Is it possible to have my widget alter the contents? I know it is possible to edit the text of the whole twiddler, but was hoping for something a little more straight-forward that didn't require finding the particular instance of my widget.

I tried updating this.parseTreeNode.children but that didn't seem to have any effect on the actual twiddler contents.
Thank you.

BJ

unread,
Sep 27, 2015, 2:08:27 AM9/27/15
to TiddlyWiki
The answer is 'yes' but the solution depends upon what you are trying to achieve. Usually the editing of text is done on a per tiddler basic, so if you have a block of text you want to control you would put it in its own tiddler and use the transclude widget to display the contents.

all the best

BJ

Jeremy Ruston

unread,
Sep 27, 2015, 4:30:01 AM9/27/15
to TiddlyWiki
Hi Tony

Is it possible to have my widget alter the contents? I know it is possible to edit the text of the whole twiddler, but was hoping for something a little more straight-forward that didn't require finding the particular instance of my widget.

There's no support at the moment for widgets to modify the wikitext from which they were parsed. Part of the reason is that the possibility of assembling wikitext within a macro means that there is not necessarily a simple correspondence between an instance of a widget and the original source wikitext.

The TiddlyWiki approach would be instead for <$mywidget> to reference its content in another tiddler, and to modify the content of that tiddler as required.

Best wishes

Jeremy.
 

I tried updating this.parseTreeNode.children but that didn't seem to have any effect on the actual twiddler contents.
Thank you.

--
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 post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/f1a8e2ea-b921-4c2d-af8d-25feaa021aff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Jeremy Ruston
mailto:jeremy...@gmail.com

Tony Grosinger

unread,
Sep 27, 2015, 10:40:31 AM9/27/15
to TiddlyWiki, jeremy...@gmail.com
That works too and should be easy enough. The only reason I wanted to put it in the same tiddler was to make the notes a little more hand-editable.
Thank you for the fast responses.

Tobias Beer

unread,
Sep 27, 2015, 2:08:24 PM9/27/15
to TiddlyWiki, jeremy...@gmail.com
Hi Tony,
 
That works too and should be easy enough. The only reason I wanted to put it in the same tiddler was to make the notes a little more hand-editable.

I'd say it is ...by editing the tiddler containing the widget. I understand you wanted a simple way to just edit the widget contents, but then that's difficult as mentioned above.

What you could also try is have your widget point to a field that is to hold what now are the widget contents and then use a textarea for editing. Such multiline fields however are not supported for working with node.js (#1947) atm.

Best wishes,

— tb
Reply all
Reply to author
Forward
0 new messages