1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

ActionPopup widget: Add ability to cancel all popups

This commit is contained in:
jeremy@jermolene.com 2020-04-21 22:19:03 +01:00
parent c86a621d5d
commit 77a929faa3
2 changed files with 7 additions and 3 deletions

View File

@ -57,7 +57,7 @@ Invoke the action associated with this widget
ActionPopupWidget.prototype.invokeAction = function(triggeringWidget,event) {
// Trigger the popup
var popupLocationRegExp = /^\((-?[0-9\.E]+),(-?[0-9\.E]+),(-?[0-9\.E]+),(-?[0-9\.E]+)\)$/,
match = popupLocationRegExp.exec(this.actionCoords);
match = popupLocationRegExp.exec(this.actionCoords || "");
if(match) {
$tw.popup.triggerPopup({
domNode: null,
@ -70,6 +70,8 @@ ActionPopupWidget.prototype.invokeAction = function(triggeringWidget,event) {
title: this.actionState,
wiki: this.wiki
});
} else {
$tw.popup.cancel(0);
}
return true; // Action was invoked
};

View File

@ -1,13 +1,13 @@
caption: action-popup
created: 20200303114556528
modified: 20200303114556528
modified: 20200421221304177
tags: Widgets ActionWidgets
title: ActionPopupWidget
type: text/vnd.tiddlywiki
! Introduction
The ''action-popup'' widget is an [[action widget|ActionWidgets]] that triggers the display of a popup defined via a state tiddler. ActionWidgets are used within triggering widgets such as the ButtonWidget.
The ''action-popup'' widget is an [[action widget|ActionWidgets]] that triggers the display of a popup defined via a state tiddler, or clears all displayed popups. ActionWidgets are used within triggering widgets such as the ButtonWidget.
! Content and Attributes
@ -17,6 +17,8 @@ The ''action-popup'' widget is invisible. Any content within it is ignored.
|$state |The title of the state tiddler for the popup |
|$coords |Optional coordinates for the handle to which popup is positioned (in the format `(x,y,w,h)`) |
<<.from-version "5.1.23">> If the ''$coords'' attribute is missing or empty then all popups are cancelled.
! Examples
Here is an example of button that triggers the "more" button in the sidebar "Tools" tab. You may need to scroll to see the popup