> > > On Fri, Feb 22, 2019 at 2:20 PM Simon Huber <hypnotize...@gmail.com > <javascript:>> wrote: > >> I am having some trouble understanding how to update the text and other >>> fields of a tiddler my widget editor works on. >>> >>> I am at the point where the editor is holding >>> (1) editor.widget, a ref to the widget it was called from and >>> (2) fieldUpdates, an object with field/value pairs for all the >>> tiddler's fields I want to update. My problem is which function to use to >>> get the task done. >>> >> >> If you're editing a tiddler with your editor and you want its title, the >> widget calling your editor must have it (...) ? >> >> what does console.log(editor.widget) say? is there no editTitle? >> >> is your editor called the standard tw way using factory.js? >> > > No it isn't. Sorry for using a confusing terminology. Here is my scenario: > > I have a widget plugin that creates a new Div element and then passes it > to an external library. The latter builds a complete specialized editor > inside the Div. I also give the library a ref to the widget that calls it. > To be clearer, I have: > > 1. A tiddler with some specialized text format. Call it SF-Tiddler of type > text/SF-type > 2. A widget that reads the content of tiddlers of type text/SF-type and > passes it to a specialized editor mini app >
so the widget reads the content of tiddlers, so it must know the tiddler title somewhere there is the hidden egg inside that widget > 3. A specialized editor mini app, Call it SF-EditorApp, which starts out > with a copy of the text content of (1) and holds on to a ref to the calling > widget (2) > 4. Editing operations within SF-EditorApp that need the internal copy of > the text to be written back to the text of (1) as soon as they are carried > out. > > My problem is how to to reach (1) from a ref to (2). SF-EditorApp has a > property "widget". IO have been looking at all the methods of Widget, as > well as staring at the object in the debugger, and I cannot find a ref to > the tiddler the widget is open on. I was expecting either something like: > > SF-EditorApp.widget.getTiddler() > > or > > SF-EditorApp.widget.tiddler > > Instead, after many trips through the debugger, all I could find was: > > SF-EditorApp.widget.parentWidget.transcludeTitle > > which indeed points to the title of my tiddler (1), but has me even more > confused (to get from widget to tiddler I need to go up a level and descend > to a transclusion?) > > What I am looking for is the reference chain that leads from (2) to (1) or > to (1)'s title. > And the fact I cannot find it after spending two hours looking at the code > can only mean I ma still fundamentally confused about TW's data model. > > > -- > __________________________________________________ > Stefano Franchi > > stefano...@gmail.com <javascript:> > http://stefano.cleinias.org > -- You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikidev+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywikidev@googlegroups.com. Visit this group at https://groups.google.com/group/tiddlywikidev. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/babeabd7-c030-4f1d-aaa2-59a520664af2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.