1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-06-03 23:24:07 +00:00

Extend <-popup> to create floating popups that must be manually cleared (#5655)

This commit is contained in:
Saq Imtiaz 2021-05-02 11:20:39 +02:00 committed by GitHub
parent cb44cc0f2b
commit 3f98686153
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -37,6 +37,7 @@ Compute the internal state of the widget
ActionPopupWidget.prototype.execute = function() { ActionPopupWidget.prototype.execute = function() {
this.actionState = this.getAttribute("$state"); this.actionState = this.getAttribute("$state");
this.actionCoords = this.getAttribute("$coords"); this.actionCoords = this.getAttribute("$coords");
this.floating = this.getAttribute("$floating","no") === "yes";
}; };
/* /*
@ -68,7 +69,8 @@ ActionPopupWidget.prototype.invokeAction = function(triggeringWidget,event) {
height: parseFloat(match[4]) height: parseFloat(match[4])
}, },
title: this.actionState, title: this.actionState,
wiki: this.wiki wiki: this.wiki,
floating: this.floating
}); });
} else { } else {
$tw.popup.cancel(0); $tw.popup.cancel(0);

View File

@ -1,6 +1,6 @@
caption: action-popup caption: action-popup
created: 20200303114556528 created: 20200303114556528
modified: 20200421221304177 modified: 20210501203451387
tags: Widgets ActionWidgets tags: Widgets ActionWidgets
title: ActionPopupWidget title: ActionPopupWidget
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -16,9 +16,12 @@ The ''action-popup'' widget is invisible. Any content within it is ignored.
|!Attribute |!Description | |!Attribute |!Description |
|$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)`) |
|$floating |<<.from-version "5.1.24">> Optional. Defaults to `no`. Set to `yes` to create a popup that must be closed explicitly. |
<<.from-version "5.1.23">> If the ''$coords'' attribute is missing or empty then all popups are cancelled. <<.from-version "5.1.23">> If the ''$coords'' attribute is missing or empty then all popups are cancelled.
<<.tip "Delete the state tiddler for a floating popup to close it.">>
! 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