mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
73a9625b81
* 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.
48 lines
2.5 KiB
Plaintext
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>
|