mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Add ability to navigate fieldname-dropdown by keyboard (#4921)
* make fields EditTemplate navigatable by keyboard * Add configuration tiddler for fieldname-dropdown filters * Update base.tid
This commit is contained in:
parent
651619076a
commit
12be7ac7e9
@ -21,6 +21,14 @@ $:/config/EditTemplateFields/Visibility/$(currentField)$
|
|||||||
<$action-sendmessage $message="tm-focus-selector" $param=<<current-tiddler-new-field-selector>>/>
|
<$action-sendmessage $message="tm-focus-selector" $param=<<current-tiddler-new-field-selector>>/>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
|
\define delete-state-tiddlers() <$action-deletetiddler $filter="[<newFieldNameTiddler>] [<storeTitle>] [<searchListState>]"/>
|
||||||
|
|
||||||
|
\define cancel-search-actions()
|
||||||
|
<$list filter="[<__storeTitle__>has[text]] [<__tiddler__>has[text]]" variable="ignore" emptyMessage="""<<delete-state-tiddlers>><$action-sendmessage $message="tm-cancel-tiddler"/>""">
|
||||||
|
<<delete-state-tiddlers>>
|
||||||
|
</$list>
|
||||||
|
\end
|
||||||
|
|
||||||
\define new-field()
|
\define new-field()
|
||||||
<$vars name={{{ [<newFieldNameTiddler>get[text]] }}}>
|
<$vars name={{{ [<newFieldNameTiddler>get[text]] }}}>
|
||||||
<$reveal type="nomatch" text="" default=<<name>>>
|
<$reveal type="nomatch" text="" default=<<name>>>
|
||||||
@ -72,7 +80,12 @@ $value={{{ [<newFieldValueTiddler>get[text]] }}}/>
|
|||||||
<<lingo Fields/Add/Prompt>>
|
<<lingo Fields/Add/Prompt>>
|
||||||
</em>
|
</em>
|
||||||
<div class="tc-edit-field-add-name-wrapper">
|
<div class="tc-edit-field-add-name-wrapper">
|
||||||
<$edit-text tiddler=<<newFieldNameTiddler>> tag="input" default="" placeholder={{$:/language/EditTemplate/Fields/Add/Name/Placeholder}} focusPopup=<<qualify "$:/state/popup/field-dropdown">> class="tc-edit-texteditor tc-popup-handle" tabindex={{$:/config/EditTabIndex}} focus={{{ [{$:/config/AutoFocus}match[fields]then[true]] ~[[false]] }}} cancelPopups="yes"/>
|
<$vars refreshTitle=<<qualify "$:/temp/fieldname/refresh">> storeTitle=<<qualify "$:/temp/fieldname/input">> searchListState=<<qualify "$:/temp/fieldname/selected-item">>>
|
||||||
|
<$macrocall $name="keyboard-driven-input" tiddler=<<newFieldNameTiddler>> storeTitle=<<storeTitle>> refreshTitle=<<refreshTitle>>
|
||||||
|
selectionStateTitle=<<searchListState>> tag="input" default="" placeholder={{$:/language/EditTemplate/Fields/Add/Name/Placeholder}}
|
||||||
|
focusPopup=<<qualify "$:/state/popup/field-dropdown">> class="tc-edit-texteditor tc-popup-handle" tabindex={{$:/config/EditTabIndex}}
|
||||||
|
focus={{{ [{$:/config/AutoFocus}match[fields]then[true]] ~[[false]] }}} cancelPopups="yes"
|
||||||
|
configTiddlerFilter="[[$:/config/EditMode/fieldname-filter]]" inputCancelActions=<<cancel-search-actions>> />
|
||||||
|
|
||||||
<$button popup=<<qualify "$:/state/popup/field-dropdown">> class="tc-btn-invisible tc-btn-dropdown" tooltip={{$:/language/EditTemplate/Field/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Field/Dropdown/Caption}}>{{$:/core/images/down-arrow}}</$button>
|
<$button popup=<<qualify "$:/state/popup/field-dropdown">> class="tc-btn-invisible tc-btn-dropdown" tooltip={{$:/language/EditTemplate/Field/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Field/Dropdown/Caption}}>{{$:/core/images/down-arrow}}</$button>
|
||||||
<$reveal state=<<qualify "$:/state/popup/field-dropdown">> type="nomatch" text="" default="">
|
<$reveal state=<<qualify "$:/state/popup/field-dropdown">> type="nomatch" text="" default="">
|
||||||
@ -82,25 +95,30 @@ $value={{{ [<newFieldValueTiddler>get[text]] }}}/>
|
|||||||
<div class="tc-dropdown-item">
|
<div class="tc-dropdown-item">
|
||||||
<<lingo Fields/Add/Dropdown/User>>
|
<<lingo Fields/Add/Dropdown/User>>
|
||||||
</div>
|
</div>
|
||||||
<$set name="newFieldName" value={{{ [<newFieldNameTiddler>get[text]] }}}>
|
<$set name="newFieldName" value={{{ [<storeTitle>get[text]] }}}>
|
||||||
<$list filter="[!is[shadow]!is[system]fields[]search:title<newFieldName>sort[]] -created -creator -draft.of -draft.title -modified -modifier -tags -text -title -type" variable="currentField">
|
<$list filter="[!is[shadow]!is[system]fields[]search:title<newFieldName>sort[]] -created -creator -draft.of -draft.title -modified -modifier -tags -text -title -type" variable="currentField">
|
||||||
|
<$list filter="[<currentField>addsuffix[-primaryList]] -[<searchListState>get[text]]" emptyMessage="""<$link to=<<currentField>> class="tc-list-item-selected"><$text text=<<currentField>>/></$link>""">
|
||||||
<$link to=<<currentField>>>
|
<$link to=<<currentField>>>
|
||||||
<$text text=<<currentField>>/>
|
<$text text=<<currentField>>/>
|
||||||
</$link>
|
</$link>
|
||||||
</$list>
|
</$list>
|
||||||
|
</$list>
|
||||||
<div class="tc-dropdown-item">
|
<div class="tc-dropdown-item">
|
||||||
<<lingo Fields/Add/Dropdown/System>>
|
<<lingo Fields/Add/Dropdown/System>>
|
||||||
</div>
|
</div>
|
||||||
<$list filter="[fields[]search:title<newFieldName>sort[]] -[!is[shadow]!is[system]fields[]]" variable="currentField">
|
<$list filter="[fields[]search:title<newFieldName>sort[]] -[!is[shadow]!is[system]fields[]]" variable="currentField">
|
||||||
|
<$list filter="[<currentField>addsuffix[-secondaryList]] -[<searchListState>get[text]]" emptyMessage="""<$link to=<<currentField>> class="tc-list-item-selected"><$text text=<<currentField>>/></$link>""">
|
||||||
<$link to=<<currentField>>>
|
<$link to=<<currentField>>>
|
||||||
<$text text=<<currentField>>/>
|
<$text text=<<currentField>>/>
|
||||||
</$link>
|
</$link>
|
||||||
</$list>
|
</$list>
|
||||||
|
</$list>
|
||||||
</$set>
|
</$set>
|
||||||
</$linkcatcher>
|
</$linkcatcher>
|
||||||
</$set>
|
</$set>
|
||||||
</div>
|
</div>
|
||||||
</$reveal>
|
</$reveal>
|
||||||
|
</$vars>
|
||||||
</div>
|
</div>
|
||||||
<span class="tc-edit-field-add-value">
|
<span class="tc-edit-field-add-value">
|
||||||
<$set name="currentTiddlerCSSescaped" value={{{ [<currentTiddler>escapecss[]] }}}>
|
<$set name="currentTiddlerCSSescaped" value={{{ [<currentTiddler>escapecss[]] }}}>
|
||||||
|
3
core/wiki/config/EditModeFieldnameFilter.tid
Normal file
3
core/wiki/config/EditModeFieldnameFilter.tid
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
title: $:/config/EditMode/fieldname-filter
|
||||||
|
first-search-filter: [!is[shadow]!is[system]fields[]search:title<userInput>sort[]] -created -creator -draft.of -draft.title -modified -modifier -tags -text -title -type
|
||||||
|
second-search-filter: [fields[]search:title<userInput>sort[]] -[!is[shadow]!is[system]fields[]]
|
@ -721,7 +721,7 @@ button.tc-btn-invisible.tc-remove-tag-button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.tc-tag-button-selected,
|
.tc-tag-button-selected,
|
||||||
.tc-list-item-selected a.tc-tiddlylink {
|
.tc-list-item-selected a.tc-tiddlylink, a.tc-list-item-selected {
|
||||||
background-color: <<colour primary>>;
|
background-color: <<colour primary>>;
|
||||||
color: <<colour tiddler-background>>;
|
color: <<colour tiddler-background>>;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user