From 9854a4fc08f6908a5b3fd4e956d54aa1267b198b Mon Sep 17 00:00:00 2001 From: Simon Huber Date: Sun, 8 Nov 2020 12:43:24 +0100 Subject: [PATCH] Fix #4998 - Pressing Enter creates Missing Tiddler (#5001) * Update search.tid * Update Filter.tid * Update Shadows.tid * Update Standard.tid * Update System.tid * Update search.tid * Create Hidden Setting Search-NavigateOnEnter.tid --- core/ui/AdvancedSearch/Filter.tid | 4 ++-- core/ui/AdvancedSearch/Shadows.tid | 4 ++-- core/ui/AdvancedSearch/Standard.tid | 4 ++-- core/ui/AdvancedSearch/System.tid | 4 ++-- core/ui/SideBarSegments/search.tid | 4 ++-- .../Hidden Setting Search-NavigateOnEnter.tid | 6 ++++++ plugins/tiddlywiki/menubar/items/search.tid | 6 ++++-- 7 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 editions/tw5.com/tiddlers/hiddensettings/Hidden Setting Search-NavigateOnEnter.tid diff --git a/core/ui/AdvancedSearch/Filter.tid b/core/ui/AdvancedSearch/Filter.tid index e46020077..37d4ab005 100644 --- a/core/ui/AdvancedSearch/Filter.tid +++ b/core/ui/AdvancedSearch/Filter.tid @@ -7,9 +7,9 @@ caption: {{$:/language/Search/Filter/Caption}} \define cancel-search-actions() <$list filter="[{$:/temp/advancedsearch/input}!match{$:/temp/advancedsearch}]" emptyMessage="""<$action-deletetiddler $filter="[[$:/temp/advancedsearch]] [[$:/temp/advancedsearch/input]] [[$:/temp/advancedsearch/selected-item]]" />"""><$action-setfield $tiddler="$:/temp/advancedsearch/input" text={{$:/temp/advancedsearch}}/><$action-setfield $tiddler="$:/temp/advancedsearch/refresh" text="yes"/> -\define input-accept-actions() <$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/> +\define input-accept-actions() <$list filter="[{$:/config/Search/NavigateOnEnter/enable}match[yes]]" emptyMessage="""<$list filter="[<__tiddler__>get[text]!is[missing]]"><$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/>"""><$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/> -\define input-accept-variant-actions() <$list filter="[<__tiddler__>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/> +\define input-accept-variant-actions() <$list filter="[{$:/config/Search/NavigateOnEnter/enable}match[yes]]" emptyMessage="""<$list filter="[<__tiddler__>get[text]!is[missing]]"><$list filter="[<__tiddler__>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/>"""><$list filter="[<__tiddler__>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/> <> diff --git a/core/ui/AdvancedSearch/Shadows.tid b/core/ui/AdvancedSearch/Shadows.tid index 282c119f7..ce59fa674 100644 --- a/core/ui/AdvancedSearch/Shadows.tid +++ b/core/ui/AdvancedSearch/Shadows.tid @@ -9,9 +9,9 @@ first-search-filter: [all[shadows]searchsort[title]limit[250]] -[[$:/ \define cancel-search-actions() <$list filter="[{$:/temp/advancedsearch}!match{$:/temp/advancedsearch/input}]" emptyMessage="""<$action-deletetiddler $filter="[[$:/temp/advancedsearch]] [[$:/temp/advancedsearch/input]] [[$:/temp/advancedsearch/selected-item]]" />"""><$action-setfield $tiddler="$:/temp/advancedsearch/input" text={{$:/temp/advancedsearch}}/><$action-setfield $tiddler="$:/temp/advancedsearch/refresh" text="yes"/><$action-sendmessage $message="tm-focus-selector" $param=""".tc-advanced-search input"""/> -\define input-accept-actions() <$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/> +\define input-accept-actions() <$list filter="[{$:/config/Search/NavigateOnEnter/enable}match[yes]]" emptyMessage="""<$list filter="[<__tiddler__>get[text]!is[missing]]"><$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/>"""><$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/> -\define input-accept-variant-actions() <$list filter="[<__tiddler__>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/> +\define input-accept-variant-actions() <$list filter="[{$:/config/Search/NavigateOnEnter/enable}match[yes]]" emptyMessage="""<$list filter="[<__tiddler__>get[text]!is[missing]]"><$list filter="[<__tiddler__>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/>"""><$list filter="[<__tiddler__>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/> <> diff --git a/core/ui/AdvancedSearch/Standard.tid b/core/ui/AdvancedSearch/Standard.tid index cd3a3d604..7c869731e 100644 --- a/core/ui/AdvancedSearch/Standard.tid +++ b/core/ui/AdvancedSearch/Standard.tid @@ -9,9 +9,9 @@ caption: {{$:/language/Search/Standard/Caption}} \define cancel-search-actions() <$list filter="[{$:/temp/advancedsearch}!match{$:/temp/advancedsearch/input}]" emptyMessage="""<$action-deletetiddler $filter="[[$:/temp/advancedsearch]] [[$:/temp/advancedsearch/input]] [[$:/temp/advancedsearch/selected-item]]" />"""><$action-setfield $tiddler="$:/temp/advancedsearch/input" text={{$:/temp/advancedsearch}}/><$action-setfield $tiddler="$:/temp/advancedsearch/refresh" text="yes"/><$action-sendmessage $message="tm-focus-selector" $param=""".tc-advanced-search input"""/> -\define input-accept-actions() <$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/> +\define input-accept-actions() <$list filter="[{$:/config/Search/NavigateOnEnter/enable}match[yes]]" emptyMessage="""<$list filter="[<__tiddler__>get[text]!is[missing]]"><$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/>"""><$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/> -\define input-accept-variant-actions() <$list filter="[<__tiddler__>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/> +\define input-accept-variant-actions() <$list filter="[{$:/config/Search/NavigateOnEnter/enable}match[yes]]" emptyMessage="""<$list filter="[<__tiddler__>get[text]!is[missing]]"><$list filter="[<__tiddler__>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/>"""><$list filter="[<__tiddler__>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/> <> diff --git a/core/ui/AdvancedSearch/System.tid b/core/ui/AdvancedSearch/System.tid index 12b8a5c12..ffac5b297 100644 --- a/core/ui/AdvancedSearch/System.tid +++ b/core/ui/AdvancedSearch/System.tid @@ -8,9 +8,9 @@ first-search-filter: [is[system]searchsort[title]limit[250]] -[[$:/te \define cancel-search-actions() <$list filter="[{$:/temp/advancedsearch}!match{$:/temp/advancedsearch/input}]" emptyMessage="""<$action-deletetiddler $filter="[[$:/temp/advancedsearch]] [[$:/temp/advancedsearch/input]] [[$:/temp/advancedsearch/selected-item]]" />"""><$action-setfield $tiddler="$:/temp/advancedsearch/input" text={{$:/temp/advancedsearch}}/><$action-setfield $tiddler="$:/temp/advancedsearch/refresh" text="yes"/><$action-sendmessage $message="tm-focus-selector" $param=""".tc-advanced-search input"""/> -\define input-accept-actions() <$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/> +\define input-accept-actions() <$list filter="[{$:/config/Search/NavigateOnEnter/enable}match[yes]]" emptyMessage="""<$list filter="[<__tiddler__>get[text]!is[missing]]"><$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/>"""><$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/> -\define input-accept-variant-actions() <$list filter="[<__tiddler__>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/> +\define input-accept-variant-actions() <$list filter="[{$:/config/Search/NavigateOnEnter/enable}match[yes]]" emptyMessage="""<$list filter="[<__tiddler__>get[text]!is[missing]]"><$list filter="[<__tiddler__>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/>"""><$list filter="[<__tiddler__>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/> <> diff --git a/core/ui/SideBarSegments/search.tid b/core/ui/SideBarSegments/search.tid index 307b556e8..e24a9d19f 100644 --- a/core/ui/SideBarSegments/search.tid +++ b/core/ui/SideBarSegments/search.tid @@ -34,9 +34,9 @@ tags: $:/tags/SideBarSegment \define cancel-search-actions() <$list filter="[get[text]!match{$:/temp/search}]" emptyMessage="""<$action-deletetiddler $filter="[[$:/temp/search]] [] []"/>"""><$action-setfield $tiddler="$:/temp/search" text={{{ [get[text]] }}}/><$action-setfield $tiddler="$:/temp/search/refresh" text="yes"/> -\define input-accept-actions() <$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/> +\define input-accept-actions() <$list filter="[{$:/config/Search/NavigateOnEnter/enable}match[yes]]" emptyMessage="""<$list filter="[<__tiddler__>get[text]!is[missing]]"><$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/>"""><$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/> -\define input-accept-variant-actions() <$list filter="[<__tiddler__>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/> +\define input-accept-variant-actions() <$list filter="[{$:/config/Search/NavigateOnEnter/enable}match[yes]]" emptyMessage="""<$list filter="[<__tiddler__>get[text]!is[missing]]"><$list filter="[<__tiddler__>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/>"""><$list filter="[<__tiddler__>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/> \define set-next-input-tab(beforeafter:"after") <$macrocall $name="change-input-tab" stateTitle="$:/state/tab/search-results/sidebar" tag="$:/tags/SearchResults" beforeafter="$beforeafter$" defaultState={{$:/config/SearchResults/Default}} actions="""<$action-setfield $tiddler="$:/state/search/currentTab" text=<>/>"""/> diff --git a/editions/tw5.com/tiddlers/hiddensettings/Hidden Setting Search-NavigateOnEnter.tid b/editions/tw5.com/tiddlers/hiddensettings/Hidden Setting Search-NavigateOnEnter.tid new file mode 100644 index 000000000..19b48bd02 --- /dev/null +++ b/editions/tw5.com/tiddlers/hiddensettings/Hidden Setting Search-NavigateOnEnter.tid @@ -0,0 +1,6 @@ +title: Hidden Setting: Navigate on Enter +tags: [[Hidden Settings]] +created: 20201108104956516 +modified: 20201108104956516 + +The configuration Tiddler $:/config/Search/NavigateOnEnter/enable can be used to enable (if set to ''yes'') Navigation to and Creation of missing Tiddlers in the various search input fields when hitting {{$:/config/shortcuts/input-accept}} respectively {{$:/config/shortcuts/input-accept-variant}} diff --git a/plugins/tiddlywiki/menubar/items/search.tid b/plugins/tiddlywiki/menubar/items/search.tid index 4614a3ef1..e6911b40b 100644 --- a/plugins/tiddlywiki/menubar/items/search.tid +++ b/plugins/tiddlywiki/menubar/items/search.tid @@ -12,7 +12,9 @@ tags: $:/tags/MenuBar \end -\define input-accept-actions() <$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/> +\define input-accept-actions() <$list filter="[{$:/config/Search/NavigateOnEnter/enable}match[yes]]" emptyMessage="""<$list filter="[<__tiddler__>get[text]!is[missing]]"><$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/>"""><$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/> + +\define input-accept-variant-actions() <$list filter="[{$:/config/Search/NavigateOnEnter/enable}match[yes]]" emptyMessage="""<$list filter="[<__tiddler__>get[text]!is[missing]]"><$list filter="[<__tiddler__>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/>"""><$list filter="[<__tiddler__>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/> \define set-next-input-tab(beforeafter:"after") <$macrocall $name="change-input-tab" stateTitle="$:/state/tab/search-results/sidebar" tag="$:/tags/SearchResults" beforeafter="$beforeafter$" defaultState={{$:/config/SearchResults/Default}} actions="""<$action-setfield $tiddler="$:/state/search/currentTab" text=<>/>"""/> @@ -24,7 +26,7 @@ tags: $:/tags/MenuBar <$macrocall $name="keyboard-driven-input" tiddler="$:/temp/menubarsearch" storeTitle=<> selectionStateTitle=<> refreshTitle="$:/temp/menubarsearch/refresh" tag="input" type="search" focusPopup="$:/state/popup/menubar-search-dropdown" class="tc-popup-handle tc-menu-show-when-wide" placeholder="Search..." default="" cancelPopups="yes" - inputAcceptActions=<> inputCancelActions=<> + inputAcceptActions=<> inputAcceptVariantActions=<> inputCancelActions=<> filterMinLength={{$:/config/Search/MinLength}} configTiddlerFilter="[[$:/state/search/currentTab]!is[missing]get[text]] ~[{$:/config/SearchResults/Default}]" />