2023-07-15 17:12:10 +00:00
|
|
|
code-body: yes
|
2013-05-31 14:38:27 +00:00
|
|
|
title: $:/core/ui/EditTemplate
|
2012-04-30 11:23:03 +00:00
|
|
|
|
2022-12-05 22:05:20 +00:00
|
|
|
\define delete-edittemplate-state-tiddlers()
|
|
|
|
<$set name="safeNewFieldValueTiddlerPrefix" value=<<newFieldValueTiddlerPrefix>> emptyValue=<<qualify "$:/temp/NewFieldValue">> >
|
|
|
|
<$action-deletetiddler $filter="[<newFieldNameTiddler>] [prefix[$:/temp/NewFieldValue]prefix<safeNewFieldValueTiddlerPrefix>] [<newFieldNameInputTiddler>] [<newFieldNameSelectionTiddler>] [<newTagNameTiddler>] [<newTagNameInputTiddler>] [<newTagNameSelectionTiddler>] [<typeInputTiddler>] [<typeSelectionTiddler>]"/>
|
|
|
|
</$set>
|
|
|
|
\end
|
2022-05-14 12:30:04 +00:00
|
|
|
|
2022-12-05 22:05:20 +00:00
|
|
|
<!-- Beware this is duplicated from fields.tid. For details see bug #7054 -->
|
2022-05-14 12:30:04 +00:00
|
|
|
\define get-field-value-tiddler-filter() [subfilter<get-field-editor-filter>sha256[16]addprefix[/]addprefix<newFieldValueTiddlerPrefix>]
|
|
|
|
\define get-field-editor-filter() [<newFieldNameTiddler>get[text]else[]] :cascade[all[shadows+tiddlers]tag[$:/tags/FieldEditorFilter]!is[draft]get[text]] :and[!is[blank]else{$:/core/ui/EditTemplate/fieldEditor/default}]
|
2022-03-26 15:19:04 +00:00
|
|
|
|
2019-10-14 13:31:57 +00:00
|
|
|
\define save-tiddler-actions()
|
2022-03-26 15:19:04 +00:00
|
|
|
\whitespace trim
|
2019-10-14 13:31:57 +00:00
|
|
|
<$action-sendmessage $message="tm-add-tag" $param={{{ [<newTagNameTiddler>get[text]] }}}/>
|
2022-05-14 12:30:04 +00:00
|
|
|
<$action-sendmessage $message="tm-add-field" $name={{{ [<newFieldNameTiddler>get[text]] }}} $value={{{ [<newFieldNameTiddler>get[text]] :map[subfilter<get-field-value-tiddler-filter>get[text]] }}}/>
|
2020-11-16 16:54:29 +00:00
|
|
|
<<delete-edittemplate-state-tiddlers>>
|
2016-10-08 10:53:20 +00:00
|
|
|
<$action-sendmessage $message="tm-save-tiddler"/>
|
|
|
|
\end
|
2022-03-26 15:19:04 +00:00
|
|
|
|
2020-11-16 16:54:29 +00:00
|
|
|
\define cancel-delete-tiddler-actions(message)
|
2022-03-26 15:19:04 +00:00
|
|
|
\whitespace trim
|
2022-05-14 12:30:04 +00:00
|
|
|
<<delete-edittemplate-state-tiddlers>>
|
2020-11-16 16:54:29 +00:00
|
|
|
<$action-sendmessage $message="tm-$message$-tiddler"/>
|
|
|
|
\end
|
2022-03-26 15:19:04 +00:00
|
|
|
|
|
|
|
\whitespace trim
|
|
|
|
<div
|
|
|
|
data-tiddler-title=<<currentTiddler>>
|
|
|
|
data-tags={{!!tags}}
|
2022-10-28 11:58:58 +00:00
|
|
|
class={{{ [all[shadows+tiddlers]tag[$:/tags/ClassFilters/TiddlerTemplate]!is[draft]] :map:flat[subfilter{!!text}] 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[ ]] }}}
|
2022-07-01 14:39:52 +00:00
|
|
|
role="region"
|
|
|
|
aria-label={{$:/language/EditTemplate/Caption}}>
|
2016-10-08 10:53:20 +00:00
|
|
|
<$fieldmangler>
|
2022-03-26 15:19:04 +00:00
|
|
|
<$vars
|
|
|
|
storyTiddler=<<currentTiddler>>
|
|
|
|
newTagNameTiddler=<<qualify "$:/temp/NewTagName">>
|
|
|
|
newFieldNameTiddler=<<qualify "$:/temp/NewFieldName">>
|
2022-05-14 12:30:04 +00:00
|
|
|
newFieldValueTiddlerPrefix=<<qualify "$:/temp/NewFieldValue">>
|
2022-03-26 15:19:04 +00:00
|
|
|
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">>>
|
2022-03-23 13:30:49 +00:00
|
|
|
<$keyboard key="((cancel-edit-tiddler))" actions=<<cancel-delete-tiddler-actions "cancel">> tag="div">
|
|
|
|
<$keyboard key="((save-tiddler))" actions=<<save-tiddler-actions>> tag="div">
|
2014-04-18 08:28:14 +00:00
|
|
|
<$list filter="[all[shadows+tiddlers]tag[$:/tags/EditTemplate]!has[draft.of]]" variable="listItem">
|
2014-02-20 22:22:45 +00:00
|
|
|
<$transclude tiddler=<<listItem>>/>
|
|
|
|
</$list>
|
|
|
|
</$keyboard>
|
2014-05-27 14:42:33 +00:00
|
|
|
</$keyboard>
|
2019-10-14 13:31:57 +00:00
|
|
|
</$vars>
|
2016-10-08 10:53:20 +00:00
|
|
|
</$fieldmangler>
|
2015-02-27 03:41:10 +00:00
|
|
|
</div>
|