1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-09 19:39:57 +00:00
TiddlyWiki5/core/ui/EditTemplate.tid

48 lines
2.5 KiB
Plaintext
Raw Normal View History

title: $:/core/ui/EditTemplate
\define delete-edittemplate-state-tiddlers() <$action-deletetiddler $filter="[<newFieldNameTiddler>] [<newFieldValueTiddler>] [<newFieldNameInputTiddler>] [<newFieldNameSelectionTiddler>] [<newTagNameTiddler>] [<newTagNameInputTiddler>] [<newTagNameSelectionTiddler>] [<typeInputTiddler>] [<typeSelectionTiddler>]"/>
\define save-tiddler-actions()
\whitespace trim
<$action-sendmessage $message="tm-add-tag" $param={{{ [<newTagNameTiddler>get[text]] }}}/>
<$action-sendmessage $message="tm-add-field" $name={{{ [<newFieldNameTiddler>get[text]] }}} $value={{{ [<newFieldNameTiddler>get[text]] :map[<newFieldValueTiddler>get<currentTiddler>] }}}/>
<<delete-edittemplate-state-tiddlers>>
<$action-sendmessage $message="tm-save-tiddler"/>
\end
\define cancel-delete-tiddler-actions(message)
\whitespace trim
<<delete-edittemplate-state-tiddlers>>
<$action-sendmessage $message="tm-$message$-tiddler"/>
\end
\whitespace trim
<div
data-tiddler-title=<<currentTiddler>>
data-tags={{!!tags}}
class={{{ tc-tiddler-frame tc-tiddler-edit-frame [<currentTiddler>is[tiddler]then[tc-tiddler-exists]] [<currentTiddler>is[missing]!is[shadow]then[tc-tiddler-missing]] [<currentTiddler>is[shadow]then[tc-tiddler-exists tc-tiddler-shadow]] [<currentTiddler>is[system]then[tc-tiddler-system]] [{!!class}] [<currentTiddler>tags[]encodeuricomponent[]addprefix[tc-tagged-]] +[join[ ]] }}}>
<$fieldmangler>
<$vars
storyTiddler=<<currentTiddler>>
newTagNameTiddler=<<qualify "$:/temp/NewTagName">>
newFieldNameTiddler=<<qualify "$:/temp/NewFieldName">>
newFieldValueTiddler=<<qualify "$:/temp/NewFieldValue">>
newFieldNameInputTiddler=<<qualify "$:/temp/NewFieldName/input">>
newFieldNameSelectionTiddler=<<qualify "$:/temp/NewFieldName/selected-item">>
newTagNameInputTiddler=<<qualify "$:/temp/NewTagName/input">>
newTagNameSelectionTiddler=<<qualify "$:/temp/NewTagName/selected-item">>
typeInputTiddler=<<qualify "$:/temp/Type/input">>
typeSelectionTiddler=<<qualify "$:/temp/Type/selected-item">>>
<$keyboard key="((cancel-edit-tiddler))" actions=<<cancel-delete-tiddler-actions "cancel">> tag="div">
<$keyboard key="((save-tiddler))" actions=<<save-tiddler-actions>> tag="div">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/EditTemplate]!has[draft.of]]" variable="listItem">
<$set name="tv-config-toolbar-class" filter="[<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]]">
<$transclude tiddler=<<listItem>>/>
</$set>
</$list>
</$keyboard>
</$keyboard>
</$vars>
</$fieldmangler>
</div>