The current cascade system lets you replace $:/core/ui/EditTemplate/body
and $:/core/ui/ViewTemplate/body
(including with nothing), but in both cases the other segments of the Edit/ViewTemplate are still displayed as usual. To see the full list of segments in use, you can look up the tag $:/tags/EditTemplate
or $:/tags/ViewTemplate
. TW-com also provides useful overviews for all the system tags, e.g. SystemTag: $:/tags/EditTemplate.
Looking at the $:/tags/EditTemplate
, we can see that the type
segment $:/core/ui/EditTemplate/type
is among the default EditTemplate segments. So to hide the type selector on a subset of tiddlers, we can wrap the contents (not the procedures/pragmas) of that tiddler with a conditional statement:
\procedure lingo-base() $:/language/EditTemplate/
\procedure input-cancel-actions() <$list filter="[<storeTitle>get[text]] [<currentTiddler>get[type]] :and[limit[1]]" emptyMessage="""<<cancel-delete-tiddler-actions "cancel">>"""><$action-sendmessage $message="tm-remove-field" $param="type"/><$action-deletetiddler $filter="[<typeInputTiddler>] [<refreshTitle>] [<typeSelectionTiddler>]"/></$list>
\whitespace trim
<% if [<currentTiddler>!hide-type[yes]] %> <!-- added this line -->
<$set name="refreshTitle" value=<<qualify "$:/temp/type-search/refresh">>>
<div class="tc-edit-type-selector-wrapper">
<em class="tc-edit tc-small-gap-right"><<lingo Type/Prompt>></em>
<div class="tc-type-selector-dropdown-wrapper">
<div class="tc-type-selector"><$fieldmangler>
<$transclude $variable="keyboard-driven-input" tiddler=<<currentTiddler>> storeTitle=<<typeInputTiddler>> refreshTitle=<<refreshTitle>> selectionStateTitle=<<typeSelectionTiddler>> field="type" tag="input" default="" placeholder={{$:/language/EditTemplate/Type/Placeholder}} focusPopup=<<qualify "$:/state/popup/type-dropdown">> class="tc-edit-typeeditor tc-edit-texteditor tc-popup-handle" tabindex={{$:/config/EditTabIndex}} focus={{{ [{$:/config/AutoFocus}match[type]then[true]] :else[[false]] }}} cancelPopups="yes" configTiddlerFilter="[[$:/core/ui/EditTemplate/type]]" inputCancelActions=<<input-cancel-actions>>/><$button popup=<<qualify "$:/state/popup/type-dropdown">> class="tc-btn-invisible tc-btn-dropdown tc-small-gap" tooltip={{$:/language/EditTemplate/Type/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Type/Dropdown/Caption}}>{{$:/core/images/down-arrow}}</$button><$button message="tm-remove-field" param="type" class="tc-btn-invisible tc-btn-icon" tooltip={{$:/language/EditTemplate/Type/Delete/Hint}} aria-label={{$:/language/EditTemplate/Type/Delete/Caption}}>{{$:/core/images/delete-button}}<$action-deletetiddler $filter="[<typeInputTiddler>] [<storeTitle>] [<refreshTitle>] [<selectionStateTitle>]"/></$button>
</$fieldmangler></div>
<div class="tc-block-dropdown-wrapper">
<$set name="tv-show-missing-links" value="yes">
<$reveal state=<<qualify "$:/state/popup/type-dropdown">> type="nomatch" text="" default="">
<div class="tc-block-dropdown tc-edit-type-dropdown">
<$linkcatcher to="!!type">
<$list filter='[all[shadows+tiddlers]prefix[$:/language/Docs/Types/]each[group]sort[group-sort]]'>
<div class="tc-dropdown-item">
<$text text={{!!group}}/>
</div>
<$set name="userInput" value={{{ [<typeInputTiddler>get[text]] }}}>
<$list filter="[all[shadows+tiddlers]prefix[$:/language/Docs/Types/]group{!!group}] :and[sort[description]] :and[removeprefix[$:/language/Docs/Types/]] :and[search<userInput>]"><span class={{{ [<currentTiddler>addsuffix[-primaryList]] :except[<typeSelectionTiddler>get[text]] :and[then[]else[tc-list-item-selected]] }}}><$link to={{{ [<currentTiddler>addprefix[$:/language/Docs/Types/]get[name]] }}}><$view tiddler={{{ [<currentTiddler>addprefix[$:/language/Docs/Types/]] }}} field="description"/><$text text=" "/>(<$view tiddler={{{ [<currentTiddler>addprefix[$:/language/Docs/Types/]] }}} field="name"/>)</$link></span>
</$list>
</$set>
</$list>
</$linkcatcher>
</div>
</$reveal>
</$set>
</div>
</div>
</div>
</$set>
<% endif %> <!-- added this line -->
You may have noticed in the code above that, by default, the type-selector segment wraps all its contents in a <div>
with the CSS class “tc-edit-type-selector-wrapper”. This means that if you don’t want to modify the $:/core/ui/EditTemplate/type
tiddler directly, we can also use a CSS trick to selectively hide this segment.
To do so, add the following CSS to a tiddler with the tag $:/tags/Stylesheet
:
.tc-tagged-hide-type .tc-edit-type-selector-wrapper { display: none; }
Then add the tag hide-type
to any tiddler whose type segment you want to hide.
This trick works because, for each tag on a tiddler, TW automatically adds a CSS class with the prefix tc-tagged-
to the list of classes applied to that tiddler — thus hide-type
→ tc-tagged-hide-type
. If the tag contains one or more spaces, the CSS class replaces each space with %20
(so tag has spaces
would give you tc-tagged-has%20spaces
).
This means you can write a corresponding CSS rule for any tag name you want to use. However, it also means that you need to use tags rather than field values to hide segments using this strategy, because other field values aren’t automatically reflected in the HTML generated for the tiddler.