get[text]] }}}/>
<$text text=<>/>: |
-<$edit-text tiddler=<> field=<> placeholder={{$:/language/EditTemplate/Fields/Add/Value/Placeholder}} tabindex={{$:/config/EditTabIndex}}/>
+<$edit-text tiddler=<> field=<> placeholder={{$:/language/EditTemplate/Fields/Add/Value/Placeholder}} tabindex={{$:/config/EditTabIndex}} cancelPopups="yes"/>
|
<$button class="tc-btn-invisible" tooltip={{$:/language/EditTemplate/Field/Remove/Hint}} aria-label={{$:/language/EditTemplate/Field/Remove/Caption}}>
@@ -72,7 +72,7 @@ $value={{{ [get[text]] }}}/>
<>
-<$edit-text tiddler=<> tag="input" default="" placeholder={{$:/language/EditTemplate/Fields/Add/Name/Placeholder}} focusPopup=<> class="tc-edit-texteditor tc-popup-handle" tabindex={{$:/config/EditTabIndex}} focus={{{ [{$:/config/AutoFocus}match[fields]then[true]] ~[[false]] }}}/>
+<$edit-text tiddler=<> tag="input" default="" placeholder={{$:/language/EditTemplate/Fields/Add/Name/Placeholder}} focusPopup=<> class="tc-edit-texteditor tc-popup-handle" tabindex={{$:/config/EditTabIndex}} focus={{{ [{$:/config/AutoFocus}match[fields]then[true]] ~[[false]] }}} cancelPopups="yes"/>
<$button popup=<> 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=<> type="nomatch" text="" default="">
@@ -104,7 +104,7 @@ $value={{{ [get[text]] }}}/>
<$set name="currentTiddlerCSSescaped" value={{{ [escapecss[]] }}}>
<$keyboard key="((add-field))" actions=<>>
-<$edit-text tiddler=<> tag="input" default="" placeholder={{$:/language/EditTemplate/Fields/Add/Value/Placeholder}} class="tc-edit-texteditor" tabindex={{$:/config/EditTabIndex}}/>
+<$edit-text tiddler=<> tag="input" default="" placeholder={{$:/language/EditTemplate/Fields/Add/Value/Placeholder}} class="tc-edit-texteditor" tabindex={{$:/config/EditTabIndex}} cancelPopups="yes"/>
$keyboard>
$set>
diff --git a/core/ui/EditTemplate/tags.tid b/core/ui/EditTemplate/tags.tid
index 8ab36bf0d..15d95d705 100644
--- a/core/ui/EditTemplate/tags.tid
+++ b/core/ui/EditTemplate/tags.tid
@@ -30,8 +30,8 @@ color:$(foregroundColor)$;
<$list filter="[all[current]tags[]sort[title]]" storyview="pop">
<$macrocall $name="tag-body" colour={{!!color}} palette={{$:/palette}} icon={{!!icon}}/>
$list>
-<$set name="tabIndex" value={{$:/config/EditTabIndex}}>
+<$vars tabIndex={{$:/config/EditTabIndex}} cancelPopups="yes">
<$macrocall $name="tag-picker"/>
-$set>
+$vars>
$fieldmangler>
diff --git a/core/ui/EditTemplate/title.tid b/core/ui/EditTemplate/title.tid
index 0f3632ad1..8972504d2 100644
--- a/core/ui/EditTemplate/title.tid
+++ b/core/ui/EditTemplate/title.tid
@@ -1,7 +1,7 @@
title: $:/core/ui/EditTemplate/title
tags: $:/tags/EditTemplate
-<$edit-text field="draft.title" class="tc-titlebar tc-edit-texteditor" focus={{{ [{$:/config/AutoFocus}match[title]then[true]] ~[[false]] }}} tabindex={{$:/config/EditTabIndex}}/>
+<$edit-text field="draft.title" class="tc-titlebar tc-edit-texteditor" focus={{{ [{$:/config/AutoFocus}match[title]then[true]] ~[[false]] }}} tabindex={{$:/config/EditTabIndex}} cancelPopups="yes"/>
<$vars pattern="""[\|\[\]{}]""" bad-chars="""`| [ ] { }`""">
diff --git a/core/ui/EditTemplate/type.tid b/core/ui/EditTemplate/type.tid
index ec7ea499d..f9068fa8a 100644
--- a/core/ui/EditTemplate/type.tid
+++ b/core/ui/EditTemplate/type.tid
@@ -4,7 +4,7 @@ tags: $:/tags/EditTemplate
\define lingo-base() $:/language/EditTemplate/
\whitespace trim
<$fieldmangler>
-<> <$edit-text field="type" tag="input" default="" placeholder={{$:/language/EditTemplate/Type/Placeholder}} focusPopup=<> class="tc-edit-typeeditor tc-edit-texteditor tc-popup-handle" tabindex={{$:/config/EditTabIndex}} focus={{{ [{$:/config/AutoFocus}match[type]then[true]] ~[[false]] }}}/> <$button popup=<> class="tc-btn-invisible tc-btn-dropdown" tooltip={{$:/language/EditTemplate/Type/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Type/Dropdown/Caption}}>{{$:/core/images/down-arrow}}$button> <$button message="tm-remove-field" param="type" class="tc-btn-invisible tc-btn-icon" tooltip={{$:/language/EditTemplate/Type/Delete/Hint}} aria-label={{$:/language/EditTemplate/Type/Delete/Caption}}>{{$:/core/images/delete-button}}$button>
+<> <$edit-text field="type" tag="input" default="" placeholder={{$:/language/EditTemplate/Type/Placeholder}} focusPopup=<> class="tc-edit-typeeditor tc-edit-texteditor tc-popup-handle" tabindex={{$:/config/EditTabIndex}} focus={{{ [{$:/config/AutoFocus}match[type]then[true]] ~[[false]] }}} cancelPopups="yes"/> <$button popup=<> class="tc-btn-invisible tc-btn-dropdown" tooltip={{$:/language/EditTemplate/Type/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Type/Dropdown/Caption}}>{{$:/core/images/down-arrow}}$button> <$button message="tm-remove-field" param="type" class="tc-btn-invisible tc-btn-icon" tooltip={{$:/language/EditTemplate/Type/Delete/Hint}} aria-label={{$:/language/EditTemplate/Type/Delete/Caption}}>{{$:/core/images/delete-button}}$button>
$fieldmangler>
diff --git a/core/ui/SideBarSegments/search.tid b/core/ui/SideBarSegments/search.tid
index f0ab71a98..9121d5ace 100644
--- a/core/ui/SideBarSegments/search.tid
+++ b/core/ui/SideBarSegments/search.tid
@@ -6,7 +6,7 @@ tags: $:/tags/SideBarSegment
<$set name="searchTiddler" value="$:/temp/search">
-<$edit-text tiddler="$:/temp/search" type="search" tag="input" focus={{$:/config/Search/AutoFocus}} focusPopup=< > class="tc-popup-handle"/>
+<$edit-text tiddler="$:/temp/search" type="search" tag="input" focus={{$:/config/Search/AutoFocus}} focusPopup=<> class="tc-popup-handle" cancelPopups="yes"/>
<$reveal state="$:/temp/search" 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}}/>
diff --git a/core/wiki/macros/tag-picker.tid b/core/wiki/macros/tag-picker.tid
index 5358da52a..22f9c22bf 100644
--- a/core/wiki/macros/tag-picker.tid
+++ b/core/wiki/macros/tag-picker.tid
@@ -19,7 +19,7 @@ tags: $:/tags/Macro
<$keyboard key="ENTER" actions=<>>
-<$edit-text tiddler=<> tag="input" default="" placeholder={{$:/language/EditTemplate/Tags/Add/Placeholder}} focusPopup=<> class="tc-edit-texteditor tc-popup-handle" tabindex=<> focus={{{ [{$:/config/AutoFocus}match[tags]then[true]] ~[[false]] }}}/>
+<$edit-text tiddler=<> tag="input" default="" placeholder={{$:/language/EditTemplate/Tags/Add/Placeholder}} focusPopup=<> class="tc-edit-texteditor tc-popup-handle" tabindex=<> focus={{{ [{$:/config/AutoFocus}match[tags]then[true]] ~[[false]] }}} cancelPopups=<>/>
$keyboard>
<$button popup=< > class="tc-btn-invisible" tooltip={{$:/language/EditTemplate/Tags/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Tags/Dropdown/Caption}}>{{$:/core/images/down-arrow}}$button>
<$set name="tag" value={{{ [get[text]] }}}>
diff --git a/editions/tw5.com/tiddlers/widgets/EditTextWidget.tid b/editions/tw5.com/tiddlers/widgets/EditTextWidget.tid
index c1884f1b3..7b6dc80a7 100644
--- a/editions/tw5.com/tiddlers/widgets/EditTextWidget.tid
+++ b/editions/tw5.com/tiddlers/widgets/EditTextWidget.tid
@@ -31,6 +31,7 @@ The content of the `<$edit-text>` widget is ignored.
|autoHeight |Either "yes" or "no" to specify whether to automatically resize `textarea` editors to fit their content (defaults to "yes") |
|minHeight |Minimum height for automatically resized `textarea` editors, specified in CSS length units such as "px", "em" or "%" |
|rows|Sets the rows attribute of a generated textarea |
+|cancelPopups |<<.from-version "5.1.23">> if set to "yes", cancels all popups when the input gets focus |
! Notes
diff --git a/editions/tw5.com/tiddlers/widgets/EditWidget.tid b/editions/tw5.com/tiddlers/widgets/EditWidget.tid
index 04db79002..34250d002 100644
--- a/editions/tw5.com/tiddlers/widgets/EditWidget.tid
+++ b/editions/tw5.com/tiddlers/widgets/EditWidget.tid
@@ -18,3 +18,4 @@ The content of the `<$edit>` widget is ignored.
|index |The index to edit |
|class |A CSS class to be added the generated editing widget |
|tabindex |Sets the `tabindex` attribute of the input or textarea to the given value |
+|cancelPopups |<<.from-version "5.1.23">> if set to "yes", cancels all popups when the input gets focus |
diff --git a/plugins/tiddlywiki/codemirror/engine.js b/plugins/tiddlywiki/codemirror/engine.js
index 630482d7d..fe64c1ef5 100755
--- a/plugins/tiddlywiki/codemirror/engine.js
+++ b/plugins/tiddlywiki/codemirror/engine.js
@@ -128,6 +128,11 @@ function CodeMirrorEngine(options) {
this.cm.on("keydown",function(cm,event) {
return self.widget.handleKeydownEvent.call(self.widget,event);
});
+ this.cm.on("focus",function(cm,event) {
+ if(self.widget.editCancelPopups) {
+ $tw.popup.cancel(0);
+ }
+ });
}
/*
diff --git a/plugins/tiddlywiki/menubar/items/search.tid b/plugins/tiddlywiki/menubar/items/search.tid
index edbf773ee..64c45afc4 100644
--- a/plugins/tiddlywiki/menubar/items/search.tid
+++ b/plugins/tiddlywiki/menubar/items/search.tid
@@ -8,7 +8,7 @@ tags: $:/tags/MenuBar
-<$edit-text tiddler=<> tag="input" type="search" focusPopup="$:/state/popup/menubar-search-dropdown" class="tc-popup-handle tc-menu-show-when-wide" placeholder="Search..." default=""/>
+<$edit-text tiddler=<> tag="input" type="search" focusPopup="$:/state/popup/menubar-search-dropdown" class="tc-popup-handle tc-menu-show-when-wide" placeholder="Search..." default="" cancelPopups="yes"/>
|