1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-27 18:40:28 +00:00

Make input fields dismiss their popups when the ... (#4579)

* Make input fields dismiss their popups when the ...

... fields loose focus (`blur`)

* Update simple.js
This commit is contained in:
Simon Huber 2020-04-20 16:49:30 +02:00 committed by GitHub
parent 1546a4a189
commit 4efcad46f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,7 +55,8 @@ function SimpleEngine(options) {
// Add an input event handler
$tw.utils.addEventListeners(this.domNode,[
{name: "focus", handlerObject: this, handlerMethod: "handleFocusEvent"},
{name: "input", handlerObject: this, handlerMethod: "handleInputEvent"}
{name: "input", handlerObject: this, handlerMethod: "handleInputEvent"},
{name: "blur", handlerObject: this, handlerMethod: "handleBlurEvent"}
]);
// Insert the element into the DOM
this.parentNode.insertBefore(this.domNode,this.nextSibling);
@ -133,6 +134,20 @@ SimpleEngine.prototype.handleFocusEvent = function(event) {
return true;
};
/*
Handle a dom "blur" event
*/
SimpleEngine.prototype.handleBlurEvent = function(event) {
if(this.widget.editFocusPopup) {
$tw.popup.triggerPopup({
domNode: this.domNode,
title: this.widget.editFocusPopup,
wiki: this.widget.wiki
});
}
return true;
};
/*
Create a blank structure representing a text operation
*/