mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-09-20 16:42:02 +00:00
Update modal handling to allow variables to be passed
@felixhayashi I’m afraid I haven’t used your pull request as there were a few details that I wanted to do differently. The main change is that these changes allow both a param string and hashmap to be specified.
This commit is contained in:
@@ -23,7 +23,7 @@ exports.startup = function() {
|
||||
// Install the modal message mechanism
|
||||
$tw.modal = new $tw.utils.Modal($tw.wiki);
|
||||
$tw.rootWidget.addEventListener("tm-modal",function(event) {
|
||||
$tw.modal.display(event.param);
|
||||
$tw.modal.display(event.param,{variables: event.paramObject});
|
||||
});
|
||||
// Install the notification mechanism
|
||||
$tw.notifier = new $tw.utils.Notifier($tw.wiki);
|
||||
|
||||
@@ -35,6 +35,8 @@ Modal.prototype.display = function(title,options) {
|
||||
if(!tiddler) {
|
||||
return;
|
||||
}
|
||||
// Create the variables
|
||||
var variables = $tw.utils.extend({currentTiddler: title},options.variables);
|
||||
// Create the wrapper divs
|
||||
var wrapper = document.createElement("div"),
|
||||
modalBackdrop = document.createElement("div"),
|
||||
@@ -76,7 +78,8 @@ Modal.prototype.display = function(title,options) {
|
||||
value: title
|
||||
}}}],
|
||||
parentWidget: $tw.rootWidget,
|
||||
document: document
|
||||
document: document,
|
||||
variables: variables
|
||||
});
|
||||
headerWidgetNode.render(headerTitle,null);
|
||||
this.wiki.addEventListener("change",function(changes) {
|
||||
@@ -85,7 +88,8 @@ Modal.prototype.display = function(title,options) {
|
||||
// Render the body of the message
|
||||
var bodyWidgetNode = this.wiki.makeTranscludeWidget(title,{
|
||||
parentWidget: $tw.rootWidget,
|
||||
document: document
|
||||
document: document,
|
||||
variables: variables
|
||||
});
|
||||
bodyWidgetNode.render(modalBody,null);
|
||||
this.wiki.addEventListener("change",function(changes) {
|
||||
@@ -125,7 +129,8 @@ Modal.prototype.display = function(title,options) {
|
||||
}}}
|
||||
]}],
|
||||
parentWidget: $tw.rootWidget,
|
||||
document: document
|
||||
document: document,
|
||||
variables: variables
|
||||
});
|
||||
footerWidgetNode.render(modalFooterButtons,null);
|
||||
this.wiki.addEventListener("change",function(changes) {
|
||||
|
||||
Reference in New Issue
Block a user