diff --git a/core/modules/macros/button.js b/core/modules/macros/button.js index bc70601fc6..858f92ce9f 100644 --- a/core/modules/macros/button.js +++ b/core/modules/macros/button.js @@ -37,14 +37,14 @@ exports.triggerPopup = function(event,cancel) { } // Check for cancelling if(cancel) { - this.wiki.deleteTextReference(textRef,this.tiddlerTitle); + $tw.popupper.cancel(); } else { // Get the current popup state tiddler var value = this.wiki.getTextReference(textRef,"",this.tiddlerTitle); // Check if the popup is open by checking whether it matches "(,)" var popupLocationRegExp = /^\((-?[0-9\.E]+),(-?[0-9\.E]+),(-?[0-9\.E]+),(-?[0-9\.E]+)\)$/; if(popupLocationRegExp.test(value)) { - this.wiki.deleteTextReference(textRef,this.tiddlerTitle); + $tw.popupper.cancel(); } else { // Set the position if we're opening it this.wiki.setTextReference(textRef, diff --git a/core/modules/popupper.js b/core/modules/popupper.js index 0bbeb6587d..27fcf9b512 100644 --- a/core/modules/popupper.js +++ b/core/modules/popupper.js @@ -33,6 +33,7 @@ Popupper.prototype.popup = function(stateTextRef) { Popupper.prototype.handleEvent = function(event) { if(event.type === "click") { + this.rootElement.removeEventListener("click",this,true); this.cancel(); } }