1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-15 22:34:51 +00:00
TiddlyWiki5/core/ui/EditTemplate.tid
FlashSystems 73a9625b81
Fix regressions cause by PR #6511 (#6567)
* Fix field edit bug

This fixes the field edit bug mentioned in
https://talk.tiddlywiki.org/t/possible-field-editing-bug-in-5-2-2/2884 .

* Revert "Fix visual regression in #6511"

This reverts commit c920960942.

* Add new class `tc-edit-fieldeditor`

This class must be added to input and select elements that are used as
field editors. This class reduces the line height of the input element
if it is displayed within the `tc-edit-fields` part of the edit
template.

This allows the same input and select elements to be used for editing
and adding fields.

* Add the new class `tc-edit-field` to the docs

The example in `Customizing EditTemplate Field Rendering` now uses the
new CSS classes.
2022-04-01 11:42:16 +01:00

48 lines
2.5 KiB
Plaintext

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>