mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-06-25 23:03:15 +00:00
Fix problem with search popup disappearing
This one took quite a lot of tracking down… Fixes #2172
This commit is contained in:
parent
665d6657bb
commit
5cc1f2b313
|
@ -31,12 +31,7 @@ Trigger a popup open or closed. Parameters are in a hashmap:
|
||||||
*/
|
*/
|
||||||
Popup.prototype.triggerPopup = function(options) {
|
Popup.prototype.triggerPopup = function(options) {
|
||||||
// Check if this popup is already active
|
// Check if this popup is already active
|
||||||
var index = -1;
|
var index = this.findPopup(options.title);
|
||||||
for(var t=0; t<this.popups.length; t++) {
|
|
||||||
if(this.popups[t].title === options.title) {
|
|
||||||
index = t;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Compute the new state
|
// Compute the new state
|
||||||
var state = index === -1;
|
var state = index === -1;
|
||||||
if(options.force !== undefined) {
|
if(options.force !== undefined) {
|
||||||
|
@ -50,6 +45,16 @@ Popup.prototype.triggerPopup = function(options) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Popup.prototype.findPopup = function(title) {
|
||||||
|
var index = -1;
|
||||||
|
for(var t=0; t<this.popups.length; t++) {
|
||||||
|
if(this.popups[t].title === title) {
|
||||||
|
index = t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return index;
|
||||||
|
};
|
||||||
|
|
||||||
Popup.prototype.handleEvent = function(event) {
|
Popup.prototype.handleEvent = function(event) {
|
||||||
if(event.type === "click") {
|
if(event.type === "click") {
|
||||||
// Find out what was clicked on
|
// Find out what was clicked on
|
||||||
|
@ -107,12 +112,14 @@ Popup.prototype.show = function(options) {
|
||||||
var info = this.popupInfo(options.domNode);
|
var info = this.popupInfo(options.domNode);
|
||||||
// Cancel any higher level popups
|
// Cancel any higher level popups
|
||||||
this.cancel(info.popupLevel);
|
this.cancel(info.popupLevel);
|
||||||
// Store the popup details
|
// Store the popup details if not already there
|
||||||
this.popups.push({
|
if(this.findPopup(options.title) === -1) {
|
||||||
title: options.title,
|
this.popups.push({
|
||||||
wiki: options.wiki,
|
title: options.title,
|
||||||
domNode: options.domNode
|
wiki: options.wiki,
|
||||||
});
|
domNode: options.domNode
|
||||||
|
});
|
||||||
|
}
|
||||||
// Set the state tiddler
|
// Set the state tiddler
|
||||||
options.wiki.setTextReference(options.title,
|
options.wiki.setTextReference(options.title,
|
||||||
"(" + options.domNode.offsetLeft + "," + options.domNode.offsetTop + "," +
|
"(" + options.domNode.offsetLeft + "," + options.domNode.offsetTop + "," +
|
||||||
|
|
Loading…
Reference in New Issue
Block a user