mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-11 08:14:14 +00:00
ActionPopup widget: Add ability to cancel all popups
This commit is contained in:
parent
c86a621d5d
commit
77a929faa3
@ -57,7 +57,7 @@ Invoke the action associated with this widget
|
|||||||
ActionPopupWidget.prototype.invokeAction = function(triggeringWidget,event) {
|
ActionPopupWidget.prototype.invokeAction = function(triggeringWidget,event) {
|
||||||
// Trigger the popup
|
// Trigger the popup
|
||||||
var popupLocationRegExp = /^\((-?[0-9\.E]+),(-?[0-9\.E]+),(-?[0-9\.E]+),(-?[0-9\.E]+)\)$/,
|
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) {
|
if(match) {
|
||||||
$tw.popup.triggerPopup({
|
$tw.popup.triggerPopup({
|
||||||
domNode: null,
|
domNode: null,
|
||||||
@ -70,6 +70,8 @@ ActionPopupWidget.prototype.invokeAction = function(triggeringWidget,event) {
|
|||||||
title: this.actionState,
|
title: this.actionState,
|
||||||
wiki: this.wiki
|
wiki: this.wiki
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
$tw.popup.cancel(0);
|
||||||
}
|
}
|
||||||
return true; // Action was invoked
|
return true; // Action was invoked
|
||||||
};
|
};
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
caption: action-popup
|
caption: action-popup
|
||||||
created: 20200303114556528
|
created: 20200303114556528
|
||||||
modified: 20200303114556528
|
modified: 20200421221304177
|
||||||
tags: Widgets ActionWidgets
|
tags: Widgets ActionWidgets
|
||||||
title: ActionPopupWidget
|
title: ActionPopupWidget
|
||||||
type: text/vnd.tiddlywiki
|
type: text/vnd.tiddlywiki
|
||||||
|
|
||||||
! Introduction
|
! 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
|
! 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 |
|
|$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)`) |
|
|$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
|
! 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
|
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user