Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tag-Picker: keyboard selectable dropdown #4458

Closed
wants to merge 149 commits into from
Closed
Show file tree
Hide file tree
Changes from 139 commits
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
bd79e29
add storeTitle attribute
BurningTreeC Feb 15, 2020
bd68776
add mechanism to tag-picker macro
BurningTreeC Feb 15, 2020
9d2e42b
remove condition that prevents the input-value from ...
BurningTreeC Feb 15, 2020
5e529de
create $:/language/Shortcuts
BurningTreeC Feb 15, 2020
bd7605d
Update ShortcutInfo.multids
BurningTreeC Feb 15, 2020
1b6a088
Update shortcuts.multids
BurningTreeC Feb 15, 2020
849f33b
add background and foreground colors for ...
BurningTreeC Feb 15, 2020
9bfcb6d
update tag-picker macro
BurningTreeC Feb 22, 2020
a7f8f4f
update simple.js with more readable solution
BurningTreeC Feb 29, 2020
19bc631
Update EditTextWidget.tid
BurningTreeC Feb 29, 2020
c1ef3c5
Update EditTextWidget.tid
BurningTreeC Mar 6, 2020
35859b9
make tag-picker use keyboard-driven-input macro
BurningTreeC Mar 6, 2020
bed7c1a
add keyboard-driven-input macro
BurningTreeC Mar 6, 2020
a6124e4
create "indexed" filter operator
BurningTreeC Mar 7, 2020
94ebe30
use "indexed" operator in keyboard-driven-input macro
BurningTreeC Mar 7, 2020
b912df6
Update tag-picker.tid
BurningTreeC Mar 7, 2020
118842b
Update keyboard-driven-input.tid
BurningTreeC Mar 7, 2020
060a2e1
Merge branch 'master' into patch-7
BurningTreeC Mar 7, 2020
3d0d964
fix regex
BurningTreeC Mar 9, 2020
5643ec6
Update keyboard-driven-input.tid
BurningTreeC Mar 11, 2020
bb9c3c1
Delete Shortcuts.tid
BurningTreeC Mar 12, 2020
ffa8999
Update Misc.multids
BurningTreeC Mar 12, 2020
1ce7a3e
make search sidebarsegment use keyboard-driven-input ...
BurningTreeC Mar 12, 2020
78d70d1
Update DefaultSearchResultList.tid
BurningTreeC Mar 12, 2020
a3b5363
Update shortcuts.multids
BurningTreeC Mar 12, 2020
efa56ac
Update ShortcutInfo.multids
BurningTreeC Mar 12, 2020
afb48ac
Update Misc.multids
BurningTreeC Mar 12, 2020
ca01210
Create indexed Operator.tid
BurningTreeC Mar 13, 2020
1034ca2
Create indexed Operator (Examples).tid
BurningTreeC Mar 13, 2020
4c7f899
Update indexed Operator (Examples).tid
BurningTreeC Mar 13, 2020
b5dab4b
Update search.tid
BurningTreeC Mar 14, 2020
d17b8f5
Update keyboard-driven-input.tid
BurningTreeC Mar 14, 2020
77d1a0a
Update tag-picker.tid
BurningTreeC Mar 14, 2020
be9460c
replace "<$vars" with "<$set"
BurningTreeC Mar 14, 2020
7356252
Update DefaultSearchResultList.tid
BurningTreeC Mar 14, 2020
50217fc
add "refreshTitle" attribute to factory.js ...
BurningTreeC Mar 19, 2020
b3b50ea
use `refreshTitle` attribute in keyboard-driven-input macro
BurningTreeC Mar 19, 2020
0cb983a
use `refreshTitle` attribute in tag-picker macro
BurningTreeC Mar 19, 2020
f043154
use `refreshTitle` attribute in search sidebarsegment
BurningTreeC Mar 19, 2020
7cc6582
Update factory.js
BurningTreeC Mar 20, 2020
a78a539
Update factory.js
BurningTreeC Mar 25, 2020
4100f90
Update EditTextWidget.tid
BurningTreeC Apr 3, 2020
3d63e85
Update tag-picker.tid
BurningTreeC Apr 15, 2020
fff18ae
Update shortcuts.multids
BurningTreeC Apr 15, 2020
678ee0e
Update tag-picker.tid
BurningTreeC Apr 17, 2020
014b3f8
Update tag-picker.tid
BurningTreeC Apr 21, 2020
2bec69f
Update tag-picker.tid
BurningTreeC Apr 21, 2020
caadd7b
Update tag-picker.tid
BurningTreeC Apr 21, 2020
608721c
Update tag-picker.tid
BurningTreeC Apr 26, 2020
4e1b52d
use get-filter-list directly in filter-run
BurningTreeC Apr 27, 2020
884810c
remove storeTitle from factory.js, add inputactions
BurningTreeC Apr 29, 2020
126e167
Update simple.js
BurningTreeC Apr 29, 2020
aa54d6e
Update framed.js
BurningTreeC Apr 29, 2020
0bdf71b
Update tag-picker.tid
BurningTreeC Apr 29, 2020
03b9ffc
Update keyboard-driven-input.tid
BurningTreeC Apr 29, 2020
4e0d72f
Update search.tid
BurningTreeC Apr 29, 2020
f9a890a
Update factory.js
BurningTreeC Apr 29, 2020
159795a
Update factory.js
BurningTreeC Apr 29, 2020
1cb1033
Update EditTextWidget.tid
BurningTreeC Apr 29, 2020
6c3f891
Update DefaultSearchResultList.tid
BurningTreeC Apr 29, 2020
b4b6857
Update search.tid
BurningTreeC Apr 29, 2020
489b117
Update keyboard-driven-input.tid
BurningTreeC Apr 29, 2020
6c07ded
Update tag-picker.tid
BurningTreeC Apr 29, 2020
e61c668
Delete indexed.js
BurningTreeC Apr 29, 2020
59fda08
Update EditTextWidget.tid
BurningTreeC Apr 29, 2020
98ce755
Update keyboard-driven-input.tid
BurningTreeC Apr 30, 2020
0f84ebf
Update keyboard-driven-input.tid
BurningTreeC Apr 30, 2020
b76e51b
Delete indexed Operator.tid
BurningTreeC Apr 30, 2020
913a51b
Delete indexed Operator (Examples).tid
BurningTreeC Apr 30, 2020
1d076c1
simplify tag-picker add-tag-actions
BurningTreeC May 2, 2020
3998b4d
merge @saqimtiaz' optimizations
BurningTreeC May 2, 2020
69d050e
Update tag-picker.tid
BurningTreeC May 2, 2020
8f85390
Update search.tid
BurningTreeC May 2, 2020
05ad08c
replace qualify widget and set widget through single vars widget
BurningTreeC May 3, 2020
6badd66
Update search.tid
BurningTreeC May 3, 2020
6844a0c
move two set widgets into vars widget
BurningTreeC May 3, 2020
a35a6e9
replace three action-setfield widgets through ...
BurningTreeC May 3, 2020
ce83a65
replace three action-deletetiddler widgets through 1
BurningTreeC May 3, 2020
45cb825
replace 3 action-deletetiddler widgets through 1
BurningTreeC May 3, 2020
cf3241d
replace 2 action-deletetiddler widgets through 1
BurningTreeC May 3, 2020
d9d9b68
replace 3 action-deletetiddler widgets through 1
BurningTreeC May 3, 2020
345a98e
replace 3 action-deletetiddler widgets through 1
BurningTreeC May 3, 2020
e6c7a06
fix typo in sidebarsegments/search
BurningTreeC May 3, 2020
bd67d5a
remove set widget for selectionTiddler
BurningTreeC May 3, 2020
c5c29da
Update search.tid
BurningTreeC May 3, 2020
49d61b4
Update tag-picker.tid
BurningTreeC May 3, 2020
dc9d779
Update tag-picker.tid
BurningTreeC May 3, 2020
ceee25d
fix typo
BurningTreeC May 3, 2020
557073c
Update DefaultSearchResultList.tid
BurningTreeC May 4, 2020
af0119a
Remove "X" from search inputs in webkit browsers
BurningTreeC May 6, 2020
e48fa51
Update keyboard-driven-input.tid
BurningTreeC May 8, 2020
7e17a6b
Update tag-picker.tid
BurningTreeC May 8, 2020
1e74ea5
Update search.tid
BurningTreeC May 8, 2020
0005e5b
Update factory.js
BurningTreeC May 8, 2020
46a7e1e
Update keyboard-driven-input.tid
BurningTreeC May 8, 2020
8404aab
Update tag-picker.tid
BurningTreeC May 8, 2020
333d2ba
Update search.tid
BurningTreeC May 8, 2020
095919b
Update search.tid
BurningTreeC May 8, 2020
e832b66
Update keyboard-driven-input.tid
BurningTreeC May 8, 2020
c214763
Update keyboard-driven-input.tid
BurningTreeC May 8, 2020
3441ef0
Update tag-picker.tid
BurningTreeC May 9, 2020
777534a
Update tag-picker.tid
BurningTreeC May 9, 2020
72a6333
Update tag-picker.tid
BurningTreeC May 9, 2020
19e087d
Update search.tid
BurningTreeC May 9, 2020
f7d6728
Correct use of filter1 and filter2 as subfilters
BurningTreeC May 9, 2020
a1c18c4
Update keyboard-driven-input.tid
BurningTreeC May 9, 2020
1db2835
Update tag-picker.tid
BurningTreeC May 9, 2020
e9d0c45
Update tag-picker.tid
BurningTreeC May 9, 2020
4dce951
Update tag-picker.tid
BurningTreeC May 9, 2020
6d8d6cd
Update keyboard-driven-input.tid
BurningTreeC May 9, 2020
d6c6570
Move inputActions to keyboard-driven-input macro
BurningTreeC May 9, 2020
7abc78c
Move inputActions to keyboard-driven-input macro
BurningTreeC May 9, 2020
b199858
Move actions for up/down to 1 single macro
BurningTreeC May 9, 2020
1a0b63f
Update search.tid
BurningTreeC May 9, 2020
1089381
Update tag-picker.tid
BurningTreeC May 9, 2020
9ae5a92
Update tag-picker.tid
BurningTreeC May 9, 2020
ad3a3cd
Update tag-picker.tid
BurningTreeC May 10, 2020
e87e0c5
Update keyboard-driven-input.tid
BurningTreeC May 10, 2020
be092c1
Update tag-picker.tid
BurningTreeC May 10, 2020
3d703da
Update search.tid
BurningTreeC May 10, 2020
1b3b068
Update keyboard-driven-input.tid
BurningTreeC May 11, 2020
f9b1396
Update tag-picker.tid
BurningTreeC May 11, 2020
8b1f8d7
Update search.tid
BurningTreeC May 11, 2020
c33b9f2
Update tag-picker.tid
BurningTreeC May 11, 2020
d1d1967
Update keyboard-driven-input.tid
BurningTreeC May 13, 2020
e352368
Update keyboard-driven-input.tid
BurningTreeC May 13, 2020
20547ef
Update tag-picker.tid
BurningTreeC May 13, 2020
172937e
Update search.tid
BurningTreeC May 13, 2020
95439c7
Add inputActions and refreshTitle to edit widget
BurningTreeC May 16, 2020
891ecc0
Update factory.js
BurningTreeC May 16, 2020
9c89117
Update simple.js
BurningTreeC May 16, 2020
2d17ff3
Update framed.js
BurningTreeC May 16, 2020
b822781
Update engine.js
BurningTreeC May 16, 2020
625cc0e
Update EditWidget.tid
BurningTreeC May 16, 2020
1be97a9
Update EditTextWidget.tid
BurningTreeC May 16, 2020
1cacc41
fix typo
BurningTreeC May 16, 2020
960d6b3
Update simple.js
BurningTreeC May 16, 2020
b1f5009
Update framed.js
BurningTreeC May 16, 2020
5c55d0b
Use <<searchTiddler>> instead of $:/temp/search/input
BurningTreeC May 18, 2020
a5fd1e3
Make macrocall more readable
BurningTreeC May 18, 2020
7e91ff4
Update keyboard-driven-input.tid
BurningTreeC May 18, 2020
978d2dd
Add first draft of keyboard-driven-input Macro doc
BurningTreeC May 18, 2020
9e2d184
Update keyboard-driven-input_Macro.tid
BurningTreeC May 18, 2020
b689b14
Update keyboard-driven-input.tid
BurningTreeC Jun 21, 2020
b8abc0e
Update tag-picker.tid
BurningTreeC Jun 21, 2020
88d80a1
Update tags.tid
BurningTreeC Jun 21, 2020
3efb305
Update tag-picker.tid
BurningTreeC Jun 21, 2020
8bc7182
Update search.tid
BurningTreeC Jun 21, 2020
d8c175c
Update tag-picker.tid
BurningTreeC Jun 22, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions core/language/en-GB/Misc.multids
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ OfficialPluginLibrary: Official ~TiddlyWiki Plugin Library
OfficialPluginLibrary/Hint: The official ~TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team.
PluginReloadWarning: Please save {{$:/core/ui/Buttons/save-wiki}} and reload {{$:/core/ui/Buttons/refresh}} to allow changes to ~JavaScript plugins to take effect
RecentChanges/DateFormat: DDth MMM YYYY
Shortcuts/Input/Accept/Hint: Accept the selected item
Shortcuts/Input/AcceptVariant/Hint: Accept the selected item (variant)
Shortcuts/Input/Cancel/Hint: Clear the input field
Shortcuts/Input/Down/Hint: Select the next item
Shortcuts/Input/Up/Hint: Select the previous item
SystemTiddler/Tooltip: This is a system tiddler
SystemTiddlers/Include/Prompt: Include system tiddlers
TagManager/Colour/Heading: Colour
Expand Down
14 changes: 12 additions & 2 deletions core/modules/editor/engines/framed.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,21 @@ Set the text of the engine if it doesn't currently have focus
*/
FramedEngine.prototype.setText = function(text,type) {
if(!this.domNode.isTiddlyWikiFakeDom) {
if(this.domNode.value !== text) {
this.domNode.value = text;
if(this.domNode.ownerDocument.activeElement !== this.domNode) {
this.updateDomNodeText(text);
}
// Fix the height if needed
this.fixHeight();
}
};

/*
Update the DomNode with the new text
*/
FramedEngine.prototype.udpateDomNodeText = function(text) {
this.domNode.value = text;
};

/*
Get the text of the engine
*/
Expand Down Expand Up @@ -167,6 +174,9 @@ Handle a dom "input" event which occurs when the text has changed
FramedEngine.prototype.handleInputEvent = function(event) {
this.widget.saveChanges(this.getText());
this.fixHeight();
if(this.widget.editInputActions) {
this.widget.invokeActionString(this.widget.editInputActions);
}
return true;
};

Expand Down
14 changes: 12 additions & 2 deletions core/modules/editor/engines/simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,21 @@ Set the text of the engine if it doesn't currently have focus
*/
SimpleEngine.prototype.setText = function(text,type) {
if(!this.domNode.isTiddlyWikiFakeDom) {
if(this.domNode.value !== text) {
this.domNode.value = text;
if(this.domNode.ownerDocument.activeElement !== this.domNode || text === "") {
this.updateDomNodeText(text);
}
// Fix the height if needed
this.fixHeight();
}
};

/*
Update the DomNode with the new text
*/
SimpleEngine.prototype.updateDomNodeText = function(text) {
this.domNode.value = text;
};

/*
Get the text of the engine
*/
Expand Down Expand Up @@ -115,6 +122,9 @@ Handle a dom "input" event which occurs when the text has changed
SimpleEngine.prototype.handleInputEvent = function(event) {
this.widget.saveChanges(this.getText());
this.fixHeight();
if(this.widget.editInputActions) {
this.widget.invokeActionString(this.widget.editInputActions);
}
return true;
};

Expand Down
6 changes: 5 additions & 1 deletion core/modules/editor/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
this.editFocusPopup = this.getAttribute("focusPopup");
this.editFocus = this.getAttribute("focus");
this.editTabIndex = this.getAttribute("tabindex");
this.editInputActions = this.getAttribute("inputActions");
this.editRefreshTitle = this.getAttribute("refreshTitle");
// Get the default editor element tag and type
var tag,type;
if(this.editField === "text") {
Expand Down Expand Up @@ -208,9 +210,11 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
EditTextWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes();
// Completely rerender if any of our attributes have changed
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows || changedAttributes.tabindex || changedTiddlers[HEIGHT_MODE_TITLE] || changedTiddlers[ENABLE_TOOLBAR_TITLE]) {
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows || changedAttributes.tabindex || changedAttributes.inputActions || changedAttributes.refreshTitle || changedTiddlers[HEIGHT_MODE_TITLE] || changedTiddlers[ENABLE_TOOLBAR_TITLE]) {
this.refreshSelf();
return true;
} else if (changedTiddlers[this.editRefreshTitle]) {
this.engine.updateDomNodeText(this.getEditInfo().value);
} else if(changedTiddlers[this.editTitle]) {
var editInfo = this.getEditInfo();
this.updateEditor(editInfo.value,editInfo.type);
Expand Down
8 changes: 6 additions & 2 deletions core/modules/widgets/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ EditWidget.prototype.execute = function() {
this.editPlaceholder = this.getAttribute("placeholder");
this.editTabIndex = this.getAttribute("tabindex");
this.editFocus = this.getAttribute("focus","");
this.editInputActions = this.getAttribute("inputActions");
this.editRefreshTitle = this.getAttribute("refreshTitle");
// Choose the appropriate edit widget
this.editorType = this.getEditorType();
// Make the child widgets
Expand All @@ -60,7 +62,9 @@ EditWidget.prototype.execute = function() {
"class": {type: "string", value: this.editClass},
"placeholder": {type: "string", value: this.editPlaceholder},
"tabindex": {type: "string", value: this.editTabIndex},
"focus": {type: "string", value: this.editFocus}
"focus": {type: "string", value: this.editFocus},
"inputActions": {type: "string", value: this.editInputActions},
"refreshTitle": {type: "string", value: this.editRefreshTitle}
},
children: this.parseTreeNode.children
}]);
Expand Down Expand Up @@ -94,7 +98,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
EditWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes();
// Refresh if an attribute has changed, or the type associated with the target tiddler has changed
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tabindex || (changedTiddlers[this.editTitle] && this.getEditorType() !== this.editorType)) {
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tabindex || changedAttributes.inputActions || changedAttributes.refreshTitle || (changedTiddlers[this.editTitle] && this.getEditorType() !== this.editorType)) {
this.refreshSelf();
return true;
} else {
Expand Down
12 changes: 10 additions & 2 deletions core/ui/DefaultSearchResultList.tid
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@ caption: {{$:/language/Search/DefaultResults/Caption}}
\define searchResultList()
//<small>{{$:/language/Search/Matches/Title}}</small>//

<$list filter="[!is[system]search:title{$(searchTiddler)$}sort[title]limit[250]]" template="$:/core/ui/ListItemTemplate"/>
<$list filter="[!is[system]search:title{$(searchTiddler)$}sort[title]limit[250]]">
<span class={{{[<currentTiddler>addsuffix[-list1]] -[<searchListState>get[text]] +[then[]else[tc-list-item-selected]] }}}>
<$transclude tiddler="$:/core/ui/ListItemTemplate"/>
</span>
</$list>

//<small>{{$:/language/Search/Matches/All}}</small>//

<$list filter="[!is[system]search{$(searchTiddler)$}sort[title]limit[250]]" template="$:/core/ui/ListItemTemplate"/>
<$list filter="[!is[system]search{$(searchTiddler)$}sort[title]limit[250]]">
<span class={{{[<currentTiddler>addsuffix[-list2]] -[<searchListState>get[text]] +[then[]else[tc-list-item-selected]] }}}>
<$transclude tiddler="$:/core/ui/ListItemTemplate"/>
</span>
</$list>

\end
<<searchResultList>>
70 changes: 47 additions & 23 deletions core/ui/SideBarSegments/search.tid
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,78 @@ title: $:/core/ui/SideBarSegments/search
tags: $:/tags/SideBarSegment

\whitespace trim

\define count-popup-button()
\whitespace trim
<$button popup=<<qualify "$:/state/popup/search-dropdown">> class="tc-btn-invisible">
{{$:/core/images/down-arrow}}
<$list filter="[{$(searchTiddler)$}minlength{$:/config/Search/MinLength}limit[1]]" variable="listItem">
<$set name="searchTerm" value={{{ [<searchTiddler>get[text]] }}}>
<$set name="resultCount" value="""<$count filter="[!is[system]search<searchTerm>]"/>""">
{{$:/language/Search/Matches}}
</$set>
</$set>
</$list>
</$button>
\end

\define search-results-list()
\whitespace trim
<$list filter="[{$(searchTiddler)$}minlength{$:/config/Search/MinLength}limit[1]]" emptyMessage="""<div class="tc-search-results">{{$:/language/Search/Search/TooShort}}</div>""" variable="listItem">

{{$:/core/ui/SearchResults}}

</$list>
\end

\define delete-state-tiddlers() <$action-deletetiddler $filter="[[$:/temp/search]] [<searchTiddler>] [<searchListState>]"/>

\define cancel-search-actions() <$action-deletetiddler $filter="[<__storeTitle__>] [<__tiddler__>] [<__selectionStateTitle__>]"/>

\define input-accept-actions() <$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/>

\define input-accept-variant-actions() <$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/>

<div class="tc-sidebar-lists tc-sidebar-search">

<$set name="searchTiddler" value="$:/temp/search">
<$vars searchTiddler="$:/temp/search/input" searchListState=<<qualify "$:/state/search-list/selected-item">> titleSearchFilter="[!is[system]search:title<userInput>sort[title]limit[250]]" allSearchFilter="[!is[system]search<userInput>sort[title]limit[250]]">
<div class="tc-search">
<$edit-text tiddler="$:/temp/search" type="search" tag="input" focus={{$:/config/Search/AutoFocus}} focusPopup=<<qualify "$:/state/popup/search-dropdown">> class="tc-popup-handle"/>
<$reveal state="$:/temp/search" type="nomatch" text="">
<$macrocall $name="keyboard-driven-input" tiddler="$:/temp/search" storeTitle=<<searchTiddler>>
selectionStateTitle=<<searchListState>> refreshTitle="$:/temp/search/refresh" type="search"
tag="input" focus={{$:/config/Search/AutoFocus}} focusPopup=<<qualify "$:/state/popup/search-dropdown">>
class="tc-popup-handle" filter1=<<titleSearchFilter>> filter2=<<allSearchFilter>>
filterMinLength={{$:/config/Search/MinLength}} inputCancelActions=<<cancel-search-actions>>
inputAcceptActions=<<input-accept-actions>> inputAcceptVariantActions=<<input-accept-variant-actions>> />
<$reveal state=<<searchTiddler>> type="nomatch" text="">
<$button tooltip={{$:/language/Buttons/AdvancedSearch/Hint}} aria-label={{$:/language/Buttons/AdvancedSearch/Caption}} class="tc-btn-invisible">
<$action-setfield $tiddler="$:/temp/advancedsearch" text={{$:/temp/search}}/>
<$action-setfield $tiddler="$:/temp/search" text=""/>
<<delete-state-tiddlers>>
<$action-navigate $to="$:/AdvancedSearch"/>
{{$:/core/images/advanced-search-button}}
</$button>
<$button class="tc-btn-invisible">
<$action-setfield $tiddler="$:/temp/search" text="" />
<<delete-state-tiddlers>>
{{$:/core/images/close-button}}
</$button>
<$button popup=<<qualify "$:/state/popup/search-dropdown">> class="tc-btn-invisible">
{{$:/core/images/down-arrow}}
<$list filter="[{$:/temp/search}minlength{$:/config/Search/MinLength}limit[1]]" variable="listItem">
<$set name="searchTerm" value={{{ [<searchTiddler>get[text]] }}}>
<$set name="resultCount" value="""<$count filter="[!is[system]search<searchTerm>]"/>""">
{{$:/language/Search/Matches}}
</$set>
</$set>
</$list>
</$button>
<<count-popup-button>>
</$reveal>
<$reveal state="$:/temp/search" type="match" text="">
<$reveal state=<<searchTiddler>> type="match" text="">
<$button to="$:/AdvancedSearch" tooltip={{$:/language/Buttons/AdvancedSearch/Hint}} aria-label={{$:/language/Buttons/AdvancedSearch/Caption}} class="tc-btn-invisible">
{{$:/core/images/advanced-search-button}}
</$button>
</$reveal>
</div>

<$reveal tag="div" class="tc-block-dropdown-wrapper" state="$:/temp/search" type="nomatch" text="">
<$reveal tag="div" class="tc-block-dropdown-wrapper" state=<<searchTiddler>> type="nomatch" text="">

<$reveal tag="div" class="tc-block-dropdown tc-search-drop-down tc-popup-handle" state=<<qualify "$:/state/popup/search-dropdown">> type="nomatch" text="" default="">

<$list filter="[{$:/temp/search}minlength{$:/config/Search/MinLength}limit[1]]" emptyMessage="""<div class="tc-search-results">{{$:/language/Search/Search/TooShort}}</div>""" variable="listItem">

{{$:/core/ui/SearchResults}}

</$list>
<<search-results-list>>

</$reveal>

</$reveal>

</$set>
</$vars>

</div>
5 changes: 5 additions & 0 deletions core/wiki/config/ShortcutInfo.multids
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ heading-3: {{$:/language/Buttons/Heading3/Hint}}
heading-4: {{$:/language/Buttons/Heading4/Hint}}
heading-5: {{$:/language/Buttons/Heading5/Hint}}
heading-6: {{$:/language/Buttons/Heading6/Hint}}
input-accept: {{$:/language/Shortcuts/Input/Accept/Hint}}
input-accept-variant: {{$:/language/Shortcuts/Input/AcceptVariant/Hint}}
input-cancel: {{$:/language/Shortcuts/Input/Cancel/Hint}}
input-down: {{$:/language/Shortcuts/Input/Down/Hint}}
input-up: {{$:/language/Shortcuts/Input/Up/Hint}}
italic: {{$:/language/Buttons/Italic/Hint}}
link: {{$:/language/Buttons/Link/Hint}}
list-bullet: {{$:/language/Buttons/ListBullet/Hint}}
Expand Down
5 changes: 5 additions & 0 deletions core/wiki/config/shortcuts/shortcuts.multids
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ heading-3: ctrl-3
heading-4: ctrl-4
heading-5: ctrl-5
heading-6: ctrl-6
input-accept: Enter
input-accept-variant: Alt-Enter
input-cancel: Escape
input-down: Down
input-up: Up
link: ctrl-L
linkify: alt-shift-L
list-bullet: ctrl-shift-L
Expand Down
53 changes: 53 additions & 0 deletions core/wiki/macros/keyboard-driven-input.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
title: $:/core/macros/keyboard-driven-input
tags: $:/tags/Macro

\define keyboard-input-actions()
<$list filter="[<__index__>match[]]">
<$action-setfield $tiddler=<<__storeTitle__>> text={{{ [<__tiddler__>get<__field__>] }}}/>
</$list>
<$list filter="[<__index__>!match[]]">
<$action-setfield $tiddler=<<__storeTitle__>> text={{{ [<__tiddler__>getindex<__index__>] }}}/>
</$list>
\end

\define keyboard-input-up-down-actions(reverse,afterOrBefore) <$macrocall $name="input-next-actions" filter1=<<__filter1__>> filter2=<<__filter2__>> refreshTitle=<<__refreshTitle__>> afterOrBefore="$afterOrBefore$" reverse="$reverse$" tiddler=<<__tiddler__>> storeTitle=<<__storeTitle__>> field=<<__field__>> index=<<__index__>> filterMinLength=<<__filterMinLength__>> selectionStateTitle=<<__selectionStateTitle__>>/>

\define input-next-actions(afterOrBefore:"after",reverse:"",tiddler,storeTitle,field,index,filter1,filter2,refreshTitle,selectionStateTitle)
<$list filter="[<__storeTitle__>get[text]minlength<__filterMinLength__>] [<__filterMinLength__>match[0]] +[limit[1]]" variable="ignore">
<$vars userInput={{{ [<__storeTitle__>get[text]] }}} selectedItem={{{ [<__selectionStateTitle__>get[text]] }}}>
<$set name="filteredList" filter="[subfilter<__filter1__>addsuffix[-list1]] =[subfilter<__filter2__>addsuffix[-list2]]">
<$set name="nextItem" value={{{ [enlist<filteredList>$afterOrBefore$<selectedItem>] ~[enlist<filteredList>$reverse$nth[1]] }}}>
<$list filter="[<nextItem>minlength[1]]">
<$action-setfield $tiddler=<<__selectionStateTitle__>> text=<<nextItem>>/>
<$list filter="[<__index__>match[]]">
<$action-setfield $tiddler=<<__tiddler__>> $field=<<__field__>> $value={{{ [<nextItem>] +[splitregexp[(?:.(?!-))+$]] }}}/>
</$list>
<$list filter="[<__index__>!match[]]">
<$action-setfield $tiddler=<<__tiddler__>> $index=<<__index__>> $value={{{ [<nextItem>] +[splitregexp[(?:.(?!-))+$]] }}}/>
</$list>
<$action-setfield $tiddler=<<__refreshTitle__>> text="yes"/>
</$list>
</$set>
</$set>
</$vars>
</$list>
\end

\define keyboard-driven-input(tiddler,storeTitle,field:"text",index:"",tag:"input",type,focus:"",inputAcceptActions,inputAcceptVariantActions,inputCancelActions,placeholder:"",default:"",class,filter1,filter2,focusPopup,rows,minHeight,tabindex,size,autoHeight,filterMinLength:"0",refreshTitle,selectionStateTitle)
<$keyboard key="((input-accept))" actions=<<__inputAcceptActions__>>>
<$keyboard key="((input-accept-variant))" actions=<<__inputAcceptVariantActions__>>>
<$keyboard key="((input-up))" actions=<<keyboard-input-up-down-actions "reverse[]" "before">>>
<$keyboard key="((input-down))" actions=<<keyboard-input-up-down-actions "" "after">>>
BurningTreeC marked this conversation as resolved.
Show resolved Hide resolved
<$keyboard key="((input-cancel))" actions=<<__inputCancelActions__>>>
<$edit-text tiddler=<<__tiddler__>> field=<<__field__>> index=<<__index__>>
inputActions=<<keyboard-input-actions>> tag=<<__tag__>> class=<<__class__>>
placeholder=<<__placeholder__>> default=<<__default__>> focusPopup=<<__focusPopup__>>
focus=<<__focus__>> type=<<__type__>> rows=<<__rows__>> minHeight=<<__minHeight__>>
tabindex=<<__tabindex__>> size=<<__size__>> autoHeight=<<__autoHeight__>>
refreshTitle=<<__refreshTitle__>>/>
</$keyboard>
</$keyboard>
</$keyboard>
</$keyboard>
</$keyboard>
\end
Loading