From 3f986861538a3cc5c3c6da578b45d0d9138a6b2b Mon Sep 17 00:00:00 2001 From: Saq Imtiaz Date: Sun, 2 May 2021 11:20:39 +0200 Subject: [PATCH] Extend <-popup> to create floating popups that must be manually cleared (#5655) --- core/modules/widgets/action-popup.js | 4 +++- editions/tw5.com/tiddlers/widgets/ActionPopupWidget.tid | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/core/modules/widgets/action-popup.js b/core/modules/widgets/action-popup.js index af17b3f51..2903532b6 100644 --- a/core/modules/widgets/action-popup.js +++ b/core/modules/widgets/action-popup.js @@ -37,6 +37,7 @@ Compute the internal state of the widget ActionPopupWidget.prototype.execute = function() { this.actionState = this.getAttribute("$state"); 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]) }, title: this.actionState, - wiki: this.wiki + wiki: this.wiki, + floating: this.floating }); } else { $tw.popup.cancel(0); diff --git a/editions/tw5.com/tiddlers/widgets/ActionPopupWidget.tid b/editions/tw5.com/tiddlers/widgets/ActionPopupWidget.tid index 17fd51531..c6f62982c 100644 --- a/editions/tw5.com/tiddlers/widgets/ActionPopupWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/ActionPopupWidget.tid @@ -1,6 +1,6 @@ caption: action-popup created: 20200303114556528 -modified: 20200421221304177 +modified: 20210501203451387 tags: Widgets ActionWidgets title: ActionPopupWidget type: text/vnd.tiddlywiki @@ -16,9 +16,12 @@ The ''action-popup'' widget is invisible. Any content within it is ignored. |!Attribute |!Description | |$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)`) | +|$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. +<<.tip "Delete the state tiddler for a floating popup to close it.">> + ! 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