Hi Tony > I am building a way to import into a permanent json tiddler, and subsequently > extract the tiddlers.
This is really part of the discussion about unrolling some internal logic so that it is expressed in wikitext, and can be more easily customised. https://github.com/Jermolene/TiddlyWiki5/issues/3967 <https://github.com/Jermolene/TiddlyWiki5/issues/3967> > I am building the extract process now and went to use the WidgetMessage: > tm-perform-import For this kind of thing you may find looking at the code helpful. If you search for “tm-perform-import” across the repo, there’s a single match in a JS file: https://github.com/Jermolene/TiddlyWiki5/blob/e86d4d29d58d1ce55218e220c19dea6a7184ad31/core/modules/widgets/navigator.js#L32 <https://github.com/Jermolene/TiddlyWiki5/blob/e86d4d29d58d1ce55218e220c19dea6a7184ad31/core/modules/widgets/navigator.js#L32> The reference to “handlePerformImportEvent” ends up here: https://github.com/Jermolene/TiddlyWiki5/blob/e86d4d29d58d1ce55218e220c19dea6a7184ad31/core/modules/widgets/navigator.js#L537-L563 <https://github.com/Jermolene/TiddlyWiki5/blob/e86d4d29d58d1ce55218e220c19dea6a7184ad31/core/modules/widgets/navigator.js#L537-L563> It’s important to understand that the $:/Import tiddler must conform to the format of a plugin, it’s not a generic JSON tiddler. It’s a temporary holding cell for incoming tiddlers. Note that it holds the tiddlers that are to be imported, not the original data that was dropped. With that out of the way, the actions of handlePerformImportEvent are: * Import those tiddlers where field named “selection-“ plus the title of the tiddler does not contain the string “unchecked”. So the field “selection-HelloThere” is used to hold the status of the checkbox next to the tiddler “HelloThere”. * Replace the $:/Import tiddler with a report of which tiddlers were imported * Navigate to $:/Import * Trigger an autosave event > It seems that this message automatically deletes the source tiddler. Is there > any way to override this behaviour? Not at present, but we could conceivably add parameters to the message that allow finer control over the actions performed. > Alternatively I could clone this to a new widget eg tm-perform-extract that > does not delete the source tiddler. As ever, you’d be best making a plan that doesn’t require core modifications up front. In this case, that means making a plugin that does the new stuff, if necessary copying and pasting code from the core. Best wishes Jeremy > > Thank in Advance > Tony > > -- > 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 [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/tiddlywikidev/a4ed7117-404e-4566-b34f-0ecefbdc9dd7%40googlegroups.com > > <https://groups.google.com/d/msgid/tiddlywikidev/a4ed7117-404e-4566-b34f-0ecefbdc9dd7%40googlegroups.com?utm_medium=email&utm_source=footer>. -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/5B8A751B-6DBA-43F7-A883-1FE7C9065E74%40gmail.com.
