1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-24 00:50:28 +00:00

Trim Saga: Edit and View templates (#6276)

* the text/vnd-tiddlywiki tiddler and language

* adding trim: edit and view templates
This commit is contained in:
Cameron Fischer 2022-03-26 10:16:01 -04:00 committed by GitHub
parent 758d590837
commit b9ae6607c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 41 additions and 16 deletions

View File

@ -3,6 +3,7 @@ title: $:/language/Help/default
\define commandTitle()
$:/language/Help/$(command)$
\end
\whitespace trim
```
usage: tiddlywiki [<wikifolder>] [--<command> [<args>...]...]
```
@ -11,7 +12,9 @@ Available commands:
<ul>
<$list filter="[commands[]sort[title]]" variable="command">
<li><$link to=<<commandTitle>>><$macrocall $name="command" $type="text/plain" $output="text/plain"/></$link>: <$transclude tiddler=<<commandTitle>> field="description"/></li>
<li><$link to=<<commandTitle>>><$macrocall $name="command" $type="text/plain" $output="text/plain"/></$link>:
&#32;
<$transclude tiddler=<<commandTitle>> field="description"/></li>
</$list>
</ul>

View File

@ -1,5 +1,7 @@
title: $:/core/ui/EditTemplate/body/editor
\whitespace trim
<$edit
field="text"

View File

@ -8,9 +8,13 @@ $:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
<$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" tag="div">
\whitespace trim
<$let
edit-preview-state={{{ [{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[<qualify "$:/state/showeditpreview">] }}}
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" tag="div">
<div class="tc-tiddler-preview">
<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/>
@ -34,5 +38,4 @@ $:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
</$reveal>
</$dropzone>
</$vars>
</$set>
</$let>

View File

@ -4,6 +4,7 @@ tags: $:/tags/EditTemplate
\define config-title()
$:/config/EditToolbarButtons/Visibility/$(listItem)$
\end
\whitespace trim
<div class="tc-tiddler-title tc-tiddler-edit-title">
<$view field="title"/>
<span class="tc-tiddler-controls tc-titlebar"><$list filter="[all[shadows+tiddlers]tag[$:/tags/EditToolbar]!has[draft.of]]" variable="listItem"><$reveal type="nomatch" state=<<config-title>> text="hide"><$transclude tiddler=<<listItem>>/></$reveal></$list></span>

View File

@ -3,10 +3,12 @@ tags: $:/tags/EditTemplate
\define lingo-base() $:/language/EditTemplate/Shadow/
\define pluginLinkBody()
\whitespace trim
<$link to="""$(pluginTitle)$""">
<$text text="""$(pluginTitle)$"""/>
</$link>
\end
\whitespace trim
<$list filter="[all[current]get[draft.of]is[shadow]!is[tiddler]]">
<$list filter="[all[current]shadowsource[]]" variable="pluginTitle">

View File

@ -1,6 +1,7 @@
title: $:/core/ui/EditTemplate/title
tags: $:/tags/EditTemplate
\whitespace trim
<$edit-text field="draft.title" class="tc-titlebar tc-edit-texteditor" focus={{{ [{$:/config/AutoFocus}match[title]then[true]] ~[[false]] }}} tabindex={{$:/config/EditTabIndex}} cancelPopups="yes"/>
<$vars pattern="""[\|\[\]{}]""" bad-chars="""`| [ ] { }`""">
@ -9,7 +10,7 @@ tags: $:/tags/EditTemplate
<div class="tc-message-box">
{{$:/core/images/warning}} {{$:/language/EditTemplate/Title/BadCharacterWarning}}
{{$:/core/images/warning}}&#32;{{$:/language/EditTemplate/Title/BadCharacterWarning}}
</div>
@ -23,7 +24,7 @@ tags: $:/tags/EditTemplate
<div class="tc-message-box">
{{$:/core/images/warning}} {{$:/language/EditTemplate/Title/Exists/Prompt}}: <$link to={{!!draft.title}} />
{{$:/core/images/warning}}&#32;{{$:/language/EditTemplate/Title/Exists/Prompt}}:&#32;<$link to={{!!draft.title}} />
</div>
@ -33,18 +34,22 @@ tags: $:/tags/EditTemplate
<$vars fromTitle={{!!draft.of}} toTitle={{!!draft.title}}>
<$checkbox tiddler="$:/config/RelinkOnRename" field="text" checked="yes" unchecked="no" default="no"> {{$:/language/EditTemplate/Title/Relink/Prompt}}</$checkbox>
<$checkbox tiddler="$:/config/RelinkOnRename" field="text" checked="yes" unchecked="no" default="no">&#32;{{$:/language/EditTemplate/Title/Relink/Prompt}}</$checkbox>
<$list filter="[title<fromTitle>backlinks[]limit[1]]" variable="listItem">
<$vars stateTiddler=<<qualify "$:/state/edit/references">> >
<$reveal type="nomatch" state=<<stateTiddler>> text="show">
<$button set=<<stateTiddler>> setTo="show" class="tc-btn-invisible">{{$:/core/images/right-arrow}}
<$button set=<<stateTiddler>> setTo="show" class="tc-btn-invisible">
{{$:/core/images/right-arrow}}
&#32;
<<lingo EditTemplate/Title/References/Prompt>></$button>
</$reveal>
<$reveal type="match" state=<<stateTiddler>> text="show">
<$button set=<<stateTiddler>> setTo="hide" class="tc-btn-invisible">{{$:/core/images/down-arrow}}
<$button set=<<stateTiddler>> setTo="hide" class="tc-btn-invisible">
{{$:/core/images/down-arrow}}
&#32;
<<lingo EditTemplate/Title/References/Prompt>></$button>
</$reveal>

View File

@ -3,6 +3,7 @@ title: $:/core/ui/ViewTemplate/body/import
\define lingo-base() $:/language/Import/
\define confirmCancel()
\whitespace trim
<$action-confirm $message={{$:/language/Import/Listing/Cancel/Warning}} >
<$action-deletetiddler $tiddler=<<currentTiddler>>/>
<$action-sendmessage $message="tm-close-tiddler" title=<<currentTiddler>>/>
@ -10,14 +11,18 @@ title: $:/core/ui/ViewTemplate/body/import
\end
\define buttons()
\whitespace trim
<$button actions=<<confirmCancel>> ><<lingo Listing/Cancel/Caption>></$button>
&#32;
<$button message="tm-perform-import" param=<<currentTiddler>>><<lingo Listing/Import/Caption>></$button>
<<lingo Listing/Preview>> <$select tiddler="$:/state/importpreviewtype" default="$:/core/ui/ImportPreviews/Text">
&#32;
<<lingo Listing/Preview>>&#32;<$select tiddler="$:/state/importpreviewtype" default="$:/core/ui/ImportPreviews/Text">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ImportPreview]!has[draft.of]]">
<option value=<<currentTiddler>>>{{!!caption}}</option>
</$list>
</$select>
\end
\whitespace trim
<$list filter="[all[current]field:plugin-type[import]]">

View File

@ -1,5 +1,6 @@
title: $:/core/ui/ViewTemplate/body/plugin
\whitespace trim
<div class="tc-tiddler-plugin-info">
<$let plugin-type={{!!plugin-type}}
default-popup-state="yes"

View File

@ -2,6 +2,7 @@ title: $:/core/ui/ViewTemplate/classic
tags: $:/tags/ViewTemplate $:/tags/EditTemplate
\define lingo-base() $:/language/ClassicWarning/
\whitespace trim
<$list filter="[all[current]type[text/x-tiddlywiki]]">
<div class="tc-message-box">

View File

@ -1,6 +1,7 @@
title: $:/core/ui/ViewTemplate/tags
tags: $:/tags/ViewTemplate
\whitespace trim
<$reveal type="nomatch" stateTitle=<<folded-state>> text="hide" tag="div" retain="yes" animate="yes">
<div class="tc-tags-wrapper"><$list filter="[all[current]tags[]sort[title]]" template="$:/core/ui/TagTemplate" storyview="pop"/></div>
</$reveal>

View File

@ -5,22 +5,23 @@ title: $:/core/macros/image-picker
type: text/vnd.tiddlywiki
\define image-picker-thumbnail(actions)
<$button tag="a" tooltip="""$(imageTitle)$""">
$actions$
<$transclude tiddler=<<imageTitle>>/>
</$button>
<$button tag="a" tooltip="""$(imageTitle)$""">$actions$<$transclude tiddler=<<imageTitle>>/></$button>
\end
\define image-picker-list(filter,actions)
\whitespace trim
<$list filter="""$filter$""" variable="imageTitle">
<$macrocall $name="image-picker-thumbnail" actions="""$actions$"""/>
&#32;
</$list>
\end
\define image-picker(actions,filter:"[all[shadows+tiddlers]is[image]] -[type[application/pdf]] +[!has[draft.of]$subfilter$sort[title]]",subfilter:"")
\whitespace trim
<div class="tc-image-chooser">
<$vars state-system=<<qualify "$:/state/image-picker/system">>>
<$checkbox tiddler=<<state-system>> field="text" checked="show" unchecked="hide" default="hide">
&#32;
{{$:/language/SystemTiddlers/Include/Prompt}}
</$checkbox>
<$reveal state=<<state-system>> type="match" text="hide" default="hide" tag="div">