I think I have a solution for this one. The ability to hide/replace the
default text field is a bit cumbersome atm. You can hide the text-body by
setting the `hide-body` field to "yes". And we can add new "sections" with
`$/tags/ViewTemplate`, but unless we dig around and copy the $reveal code
from another template section that will not be consistent with the Collapse
state.... Yeah. Complicated.
If I change the `$:/core/ui/ViewTemplate/body` tiddler slightly, we can
move the "tiddler-body-default" wikitext to a macro in the same tiddler:
```
\define tiddler-body-default()
<$list filter="[all[current]!has[plugin-type]!field:hide-body[yes]]">
<$transclude>
<$transclude tiddler="$:/language/MissingTiddler/Hint"/>
</$transclude>
</$list>
\end
```
And re-write the body of the tiddler like so:
```
<$reveal tag="div" class="tc-tiddler-body" type="nomatch"
stateTitle=<<folded-state>> text="hide" retain="yes" animate="yes">
<$list variable="bodyTemplate"
filter="[all[current]subfilter{$:/config/ViewTemplate/Body}]"
emptyMessage=<<tiddler-body-default>> >
<$transclude tiddler=<<bodyTemplate>> >
<$tiddler tiddler=<<bodyTemplate>> >
<$transclude tiddler="$:/language/MissingTiddler/Hint"/>
</$tiddler>
</$transclude>
</$list>
</$reveal>
```
Then we can use an array of filters to check for tags, type, or any other
way you want to trigger a custom view template, and you can have more then
one resulting templateTitle output and it's all nested in the correct
$reveal widget, etc. Even better, you can use the `<<tiddler-body-default>>
macro ANYWHERE in your own templates to get the default text-field to show
up in that spot. Here is my current `$:/config/ViewTemplate/Body`:
```
[tag[$:/tags/Macro]then[$:/plugins/joshuafontany/core/ui/ViewTemplate/body/macro]]
[tag[Glossary]then[$:/plugins/joshuafontany/silatglossary/ui/ViewTemplate/body]]
[match[Test]then[$/plugins/joshuafontany/core/ui/ViewTemplate/body/TEST]]
```
Which as you can see, uses the
`$:/plugins/joshuafontany/core/ui/ViewTemplate/body/macro` tiddler as the
body-template for all Global Macro tiddlers. This template looks like:
```
<pre><code language={{!!type}}><$view field="text"/></code></pre>
```
Which is a bit overkill, but is exactly how, internally, the
`application.javascript` tiddlers are rendered. But this means I no longer
have to click edit on every Macro tiddler just to re-read it for bug, etc.
I'm going to expand this technique to render other custom tiddler types for
other projects.
Oh, yes, final note. The Type field can and will definitely over-ride this
custom rendering, as that's done internally using the wiki's Parser
methods. Also, I'm not sure if this is 100% backwards compatible, but the
only thing I can possibly think of it changing are the Numeric Values
output by the Qualify Macro (as these depend on how many and which tiddlers
the current content is being rendered "through").
I think I will expand this to allow for a tabbed interface in the Draft
Mode UI, with the standard Text Editor in one tab, and other content in
other tabs. I can also use this to extent the Title field to allow for a
custom Name (short & human readable, see plugins) that will display full
size (if present) and which pushes the full Title down to a line of smaller
text.
Best,
Joshua Fontany
On Tuesday, January 7, 2020 at 5:23:47 PM UTC-8, TonyM wrote:
>
> Odin
>
> Where you want text to appear in a html template you can use
> <$transclude mode=block/>
> Which defaults to currenTiddler and the text field.
>
> Not sure if this solves your problem but it is another way.
>
> Tony
>
>
> On Wednesday, January 8, 2020 at 7:45:05 AM UTC+11, Odin Jorna wrote:
>>
>> Hi Eric!
>>
>> Thank you for the explanation of how the view tiddler is made of and how
>> the ordering works. That clarified a lot.
>>
>> After trying out the list-before field, the text does change to after the
>> template. But what I was looking for was getting it inside the template.
>> Inside, there are some <div class="flex-row"> and <div class="flex-col-1
>> "> that sorts the view into rows and columns. What I would like is to have
>> the text inside the column. In the example file, I placed a {{!text}} at
>> that spot.
>>
>> Do you think that is possible?
>>
>>
>>
>> Op dinsdag 7 januari 2020 21:10:18 UTC+1 schreef Eric Shulman:
>>>
>>> On Tuesday, January 7, 2020 at 11:49:41 AM UTC-8, Odin Jorna wrote:
>>>>
>>>> The problem I am running into is that I don't have control of where the
>>>> contents of the text field are placed into the template. I want to use the
>>>> normal text box to put down my notes, thoughts and any other information
>>>> that isn't general contact details in the tiddler. But then it
>>>> automatically dumps the text on top of the template in the person tiddler.
>>>> If I transclude {{!!text}} at the position I want the text show up it
>>>> works, but then I still have the text on top of everything.
>>>>
>>>
>>> The tiddler "view" is composed on several parts, each of which is tagged
>>> with $:/tags/ViewTemplate. You can control the order in which those parts
>>> are displayed.
>>>
>>> To see the current order, you can go to your custom template tiddler,
>>> and click on the "tag pill" for "$:/tags/ViewTemplate". This will display
>>> a dropdown list of all tiddlers with that tag. The order shown in the list
>>> is the order they will be displayed when viewing a tiddler.
>>>
>>> There are several ways to change the order. This is (briefly)
>>> documented in https://tiddlywiki.com/#Order%20of%20Tagged%20Tiddlers
>>>
>>> For your purposes, the easiest approach is probably to add a
>>> "list-before" field to your custom template, with a value of
>>> "$:/core/ui/ViewTemplate/body".
>>>
>>> This will cause your custom template to appear before the standard
>>> "text" content of the tiddler.
>>>
>>> Q.E.D.
>>>
>>> enjoy,
>>> -e
>>> Eric Shulman
>>> TiddlyTools.com: "Small Tools for Big Ideas!" (tm)
>>> InsideTiddlyWiki - http://www.TiddlyTools.com/InsideTW
>>>
>>>
>>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/b4339b9d-0850-4583-8032-c64cdc50701b%40googlegroups.com.