Tip for new and experienced users - easy access to the viewTemplate [Good for new users?]

259 views
Skip to first unread message

TW Tones

unread,
Jun 26, 2020, 7:19:05 PM6/26/20
to tiddl...@googlegroups.com
Folks,

[Edited] Updated json attached here and discussed below ( here )
Now handles multi-line editing.

The viewTemplate is a great way to get content or macros to be active on a tiddler without using your text field to include macros and templates. This leaves the text field free for the information you are composing. See elsewhere for how to use the view template.

I just made this simple view template to make displaying things on a tiddler much easier. This helps for learning, debugging, and proto-typing something you may later place in the view template. See the examples below, it is a great way to learn.

You will be amazed at the possibilities

Once installed all you need to do is create a local-viewtemplate field on any tiddler, and its value will be displayed in the view template for that tiddler only

Remember The content of the field will be rendered so you can;
  • Include wikitext, buttons, transclusions, widgets, variables and more in your local-viewtemplate field
  • Helps when debugging or prototyping
  • This content does not appear when transcluding the current tiddler from elsewhere, although it could be if desired.
Other tips
  • Use `<br>` for line breaks
  • Transclude with mode block to bring in multi-line content from elsewhere

Create a tiddler tagged $:/tags/ViewTemplate containing the following;
<$list filter="[all[current]has[local-viewtemplate]get[local-viewtemplate]]" variable=field-value>
<
<field-value>>
</$list>
Also Attached for your convenience

You can use the `<<tag "$:/tags/ViewTemplate">>` pill to reorder this or add a list-before/list-after field to set where it appears on the view template, by default it will be at the bottom.

Examples, try these in your local-viewtemplate one or more at a time
''Hi'' there

[[more]]

{{TableOfContents}}

{{||$:/core/ui/Buttons/edit}}

{{||$:/core/ui/Buttons/open-window}}

{{||$:/core/ui/EditTemplate/tags}}

{{$:/core/ui/Buttons/home}}

<<tag>>

<<tag $:/tags/ControlPanel>>

<<list-links filter:"[tag[Core Macros]]">>

<<dumpvariables>>

<<transclusion>>


Feedback
  • Let me know here if this is helpful, if their is a call for it, I can make a multi-line text field work with this.
  • Share any examples you develop by sharing the content of the local-viewtemplate you used similar to my examples above, describe what it does (I have not intentionally to get you to experiment)
Regards
TW Tones
local-viewtemplate.json

TW Tones

unread,
Jun 26, 2020, 7:43:54 PM6/26/20
to TiddlyWiki
More Examples

Caption: {{!!caption}}<br>Description: {{!!description}}<br>
<!-- Display the caption and description on the current tiddler, or any other field -->


{{||$:/core/ui/TiddlerInfo/Fields}}
<!-- local fields and their values, can use other tiddlers with the
$:/tags/TiddlerInfo -->

<<tag $:/tags/TiddlerInfo>><$list filter="[all[shadows+system]tag[$:/tags/TiddlerInfo]] -[[$:/core/ui/TiddlerInfo/Tools]]"><$transclude/><br></$list>
<!-- content of all info tabs (if has value) except tools tab -->


Please share your own!

TW Tones




On Saturday, June 27, 2020 at 9:19:05 AM UTC+10, TW Tones wrote:
Folks,

TW Tones

unread,
Jun 26, 2020, 8:58:21 PM6/26/20
to TiddlyWiki
Even more examples

REVOLUTION?
<$edit field=caption/>
If you place this in the local-viewtemplate you can edit the fieldname inline, in viewtemplate without focus issues

<$edit-text field="description" size=80 placeholder="Describe this tiddler"/>
Or use the more sophisticated edit-text widget.

Regards
TW Tones


On Saturday, June 27, 2020 at 9:19:05 AM UTC+10, TW Tones wrote:
Folks,

Mat

unread,
Jun 27, 2020, 5:40:45 AM6/27/20
to TiddlyWiki
TW Tones wrote:
Feedback
  • Let me know here if this is helpful, if their is a call for it, I can make a multi-line text field work with this.
In deed, the single line is sometimes an annoyance working with fields.

If you allow me to go "off-question": Overall, the EditTemplate for the custom fields should feature a little control menu for the field where the user could set if the field should be single or multi-line, if the field should be visible in edit view or not (e.g "created" is not), if the field should be visible in view mode or not and its position.
All settings are local, i.e concerns only this field only in only the current tiddler. For dog food ;-) these settings could be stored in a single field e.g for the field "foo", there's a field "settings-foo", which is probably hidden, and has e.g "settings-foo: multiline showinedit hideinview listafterxxx"
 
  • Share any examples you develop by sharing the content of the local-viewtemplate you used similar to my examples above, describe what it does (I have not intentionally to get you to experiment)
 
I made these things long ago that might possibly be of interest


<:-)

TW Tones

unread,
Jun 27, 2020, 7:16:13 AM6/27/20
to TiddlyWiki
Mat,

I have followed the similar lines to what you discuss and your linked examples. 

I am interested in hiding some text area fields from the default edit fields and presenting different editor for them, similar to you example. Effectively its only the edit process that stops you using text area, but failing to allow you save line breaks. I did something with Mohammad some time ago, and have an example in a production wiki I can look up.

However I am currently expanding my aforementioned autonomous fields into a new fields editor and display system.

For multi-lines I build a new editor for each special field 
<$transclude field=<<fieldname>> mode=block/>
view

''//Add a blank line for a new paragraph//''{{||$:/core/ui/EditTemplate/person-bio-text/editor}}
to edit


So $:/core/ui/EditTemplate/person-bio-text/editor looks like this; stolen from core tiddlers.
<$edit-text

  field="person-bio-text"
  tag=textarea
  class="tc-edit-texteditor"
  placeholder={{$:/language/EditTemplate/Body/Placeholder}}
  tabindex={{$:/config/EditTabIndex}}

><$set

  name="targetTiddler"
  value=<
<currentTiddler>>

><$list

  filter="[all[shadows+tiddlers]tag[$:/tags/EditorToolbar]!has[draft.of]]"

><$reveal


  type="nomatch"
  state=<
<config-visibility-title>>
  text="hide"
  class="tc-text-editor-toolbar-item-wrapper"

><$transclude

  tiddler="$:/core/ui/EditTemplate/body/toolbar/button"
  mode="inline"

/></$reveal></$list></$set></$edit-text>

Then all is left is to stop the field being edited in the fields edit part of edit mode.

I hope to share something more soon.

Regards
Tony

TW Tones

unread,
Jul 6, 2020, 9:42:31 PM7/6/20
to TiddlyWiki
Folks,

I have improved on the previous implementation of a 

local-viewtemplate field.


Install
  • Basically after installing the attached json in you tiddly wiki nothing changes. 
  • However if you create a new field local-viewtemplate on any tiddler, the content of that field will be displayed via a view template.
Special notes
  • The standard field editor does not allow multi-line fields, as soon as you create the field it will not appear in the standard editor field list but below in a full text editor
  • Only on tiddlers with this field will display this text editor
  • There are opportunities to reorder, delete the field in this edit view
Uses
  • Test how to use the view Template
  • Preview what a viewtemplate will produce before making it visible everywhere.
  • Simply introduce something to tiddler without using the text field eg a macro like `<<noto>>`

I will republish as a plugin soon if there is interest.

Possible futures
  • A button to convert the field content to a tiddler and make it appear on select or all tiddlers.
  • Something similar for headers and footers on tiddlers
  • collect interesting viewTemplate examples to share.
Regards
Tony


On Saturday, June 27, 2020 at 9:19:05 AM UTC+10, TW Tones wrote:
Folks,

local-viewtemplate.json

TW Tones

unread,
Jul 7, 2020, 7:22:37 PM7/7/20
to TiddlyWiki
Mat,

Thanks for these references;

Your Varsfields

I was reviewing your links and varsfields. 
  • Have a look at my recently shared local-viewTemplate in which I create a tiddler of the form $:/config/EditTemplateFields/Visibility/fieldname value hide
  • This uses the core method of hiding nominated fields from the field editor so you need not have a modified $:/core/ui/EditTemplate/fields 
Varsfields is a nice example of extending tiddler functionality, I imaging a small bundle of these like Varsfields, my local-viewTemplate and an unpublished local-macros would be a nice little bundle for people learning tiddlywiki, because they can do a lot of experiments on a single tiddler.
  • I initially misunderstood varsfield but an extension would be to turn the named fields into variables with the value set.  
  • This would permit local override of a global value for testing.
Configsfields is another nice example and gives me some great ideas. I think we need a user edit mode as an alternative to the tiddler edit mode.

Regards
Tony


On Saturday, June 27, 2020 at 7:40:45 PM UTC+10, Mat wrote:
Reply all
Reply to author
Forward
0 new messages