mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-12-05 08:18:06 +00:00
Add "cascade" filter run prefix and use it to control view templates (#6168)
* Initial Commit
* Set currentTiddler and ..currentTiddler for filter evaulation
* Precompile the filters for performance
* Add explicit test for empty result when no filter passes
* Use the cascade filter run prefix to choose the view template body template
* Use the cascade mechanism to choose between the edit and view templates
* Simplify cascade filter
Thanks @saqimtiaz
* Add control panel UI for inspecting the template cascades
* Refactor import listing and plugin listing as alternate body templates
As suggested by @pmario
* Refer to $:/core/ui/{View|Edit}Template via their associated config tiddlers
* Fix typo in previous commit
* Add demo of custom story tiddler template
* Tweak control panel wording
* Standardise "Story Tiddler Template" nomenclature
* Add a cascade for the editor template body
* Add a cascade for the view template title
* Avoid unwanted whitespace
* Add a cascade for dynamically choosing tiddler icons
This commit is contained in:
@@ -1,56 +1,4 @@
|
||||
title: $:/core/ui/EditTemplate/body
|
||||
tags: $:/tags/EditTemplate
|
||||
|
||||
\define lingo-base() $:/language/EditTemplate/Body/
|
||||
\define config-visibility-title()
|
||||
$:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
|
||||
\end
|
||||
|
||||
\define importFileActions()
|
||||
<$action-popup $state=<<importState>> $coords="(0,0,0,0)" $floating="yes"/>
|
||||
\end
|
||||
|
||||
<$list filter="[all[current]has[_canonical_uri]]">
|
||||
|
||||
<div class="tc-message-box">
|
||||
|
||||
<<lingo External/Hint>>
|
||||
|
||||
<a href={{!!_canonical_uri}}><$text text={{!!_canonical_uri}}/></a>
|
||||
|
||||
<$edit-text field="_canonical_uri" class="tc-edit-fields" tabindex={{$:/config/EditTabIndex}} cancelPopups="yes"></$edit-text>
|
||||
|
||||
</div>
|
||||
|
||||
</$list>
|
||||
|
||||
<$set name="edit-preview-state" value={{{ [{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[<qualify "$:/state/showeditpreview">] }}}>
|
||||
<$list filter="[all[current]!has[_canonical_uri]]">
|
||||
<$vars importTitle=<<qualify $:/ImportImage>> importState=<<qualify $:/state/ImportImage>> >
|
||||
<$dropzone importTitle=<<importTitle>> autoOpenOnImport="no" contentTypesFilter={{$:/config/Editor/ImportContentTypesFilter}} class="tc-dropzone-editor" enable={{{ [{$:/config/DragAndDrop/Enable}match[no]] :else[subfilter{$:/config/Editor/EnableImportFilter}then[yes]else[no]] }}} filesOnly="yes" actions=<<importFileActions>> ><$reveal stateTitle=<<edit-preview-state>> type="match" text="yes">
|
||||
<div class="tc-tiddler-preview">
|
||||
|
||||
<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/>
|
||||
|
||||
<div class="tc-tiddler-preview-preview">
|
||||
|
||||
<$transclude tiddler={{$:/state/editpreviewtype}} mode="inline">
|
||||
|
||||
<$transclude tiddler="$:/core/ui/EditTemplate/body/preview/output" mode="inline"/>
|
||||
|
||||
</$transclude>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</$reveal>
|
||||
|
||||
<$reveal stateTitle=<<edit-preview-state>> type="nomatch" text="yes">
|
||||
|
||||
<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/>
|
||||
|
||||
</$reveal>
|
||||
</$dropzone>
|
||||
</$vars>
|
||||
</$list>
|
||||
</$set>
|
||||
<$transclude tiddler={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/EditTemplateBodyFilter]get[text]] :and[!is[blank]else[$:/core/ui/EditTemplate/body/default]] }}} />
|
||||
|
||||
13
core/ui/EditTemplate/body/canonical-uri.tid
Normal file
13
core/ui/EditTemplate/body/canonical-uri.tid
Normal file
@@ -0,0 +1,13 @@
|
||||
title: $:/core/ui/EditTemplate/body/canonical-uri
|
||||
|
||||
\define lingo-base() $:/language/EditTemplate/Body/
|
||||
|
||||
<div class="tc-message-box">
|
||||
|
||||
<<lingo External/Hint>>
|
||||
|
||||
<a href={{!!_canonical_uri}}><$text text={{!!_canonical_uri}}/></a>
|
||||
|
||||
<$edit-text field="_canonical_uri" class="tc-edit-fields" tabindex={{$:/config/EditTabIndex}} cancelPopups="yes"></$edit-text>
|
||||
|
||||
</div>
|
||||
38
core/ui/EditTemplate/body/default.tid
Normal file
38
core/ui/EditTemplate/body/default.tid
Normal file
@@ -0,0 +1,38 @@
|
||||
title: $:/core/ui/EditTemplate/body/default
|
||||
|
||||
\define config-visibility-title()
|
||||
$:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
|
||||
\end
|
||||
|
||||
\define importFileActions()
|
||||
<$action-popup $state=<<importState>> $coords="(0,0,0,0)" $floating="yes"/>
|
||||
\end
|
||||
|
||||
<$set name="edit-preview-state" value={{{ [{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[<qualify "$:/state/showeditpreview">] }}}>
|
||||
<$vars importTitle=<<qualify $:/ImportImage>> importState=<<qualify $:/state/ImportImage>> >
|
||||
<$dropzone importTitle=<<importTitle>> autoOpenOnImport="no" contentTypesFilter={{$:/config/Editor/ImportContentTypesFilter}} class="tc-dropzone-editor" enable={{{ [{$:/config/DragAndDrop/Enable}match[no]] :else[subfilter{$:/config/Editor/EnableImportFilter}then[yes]else[no]] }}} filesOnly="yes" actions=<<importFileActions>> ><$reveal stateTitle=<<edit-preview-state>> type="match" text="yes">
|
||||
<div class="tc-tiddler-preview">
|
||||
|
||||
<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/>
|
||||
|
||||
<div class="tc-tiddler-preview-preview">
|
||||
|
||||
<$transclude tiddler={{$:/state/editpreviewtype}} mode="inline">
|
||||
|
||||
<$transclude tiddler="$:/core/ui/EditTemplate/body/preview/output" mode="inline"/>
|
||||
|
||||
</$transclude>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</$reveal>
|
||||
|
||||
<$reveal stateTitle=<<edit-preview-state>> type="nomatch" text="yes">
|
||||
|
||||
<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/>
|
||||
|
||||
</$reveal>
|
||||
</$dropzone>
|
||||
</$vars>
|
||||
</$set>
|
||||
Reference in New Issue
Block a user