config tiddlers, $edit-text, and default values...?

31 views
Skip to first unread message

TheDiveO

unread,
Feb 3, 2018, 12:02:14 PM2/3/18
to tiddl...@googlegroups.com
I'm working on enhancing my ThirdFlow plugin with convenience features, like creating new tiddlers of certain type from templates inside a plugin. As preferences vary, I want to allow developers working with the ThirdFlow plugin to be able to control how they organize their tiddlers inside their plugins. Say, macro tiddlers go to ".../macros/"  inside a plugin ("..." refers to the plugin's full title, such as "$:/plugins/FooPub/BarPlugin").

I would like to have an individual path (or rather: infix) setting with its default coded only in one place. That is, ideally I would simply use:

<$edit-text tiddler="$:/config/ThirdFlow/macroinfix" default="macros" tag="input"/>

However, when opening this settings dialog, if $:/config/ThirdFlow/macroinfix isn't present, it won't be created. Okay, it wouldn't make sense to create the tiddler, as when a new plugin user doesn't open the settings dialog, the config tiddlers would never get created.

So, what would be a good coding pattern in TW5 to ensure consistency between config tiddlers, default settings, the settings UI, and the use of the config tiddlers? The default= parameter of the edit-text widget only applies to the UI. How can I later refer to the potentially non-existing config tiddler and pick up a default value if the config tiddler yet doesn't exist? Something like a filter expressions?

[{$:/config/ThirdFlow/macroinfix}] macros +[minlength[1]first[]]



Best regards,
TheDiveO


Reply all
Reply to author
Forward
0 new messages