mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-10-20 02:07:38 +00:00
Add support for assigning action widgets via the actions
attribute
This is quite a big change: a new way to invoke action widgets. The advantage is that it solves #2217 and #1564, a long running problem that prevented us from adding action widgets to widgets that modify the store. This commit adds the new technique for the button and keyboard widgets, but also extends the select widget to trigger action widgets for the first time
This commit is contained in:
@@ -504,6 +504,23 @@ Widget.prototype.invokeActions = function(triggeringWidget,event) {
|
||||
return handled;
|
||||
};
|
||||
|
||||
/*
|
||||
Invoke the action widgets defined in a string
|
||||
*/
|
||||
Widget.prototype.invokeActionString = function(actions,triggeringWidget,event) {
|
||||
actions = actions || "";
|
||||
var parser = this.wiki.parseText("text/vnd.tiddlywiki",actions,{
|
||||
parentWidget: this,
|
||||
document: this.document
|
||||
}),
|
||||
widgetNode = this.wiki.makeWidget(parser,{
|
||||
parentWidget: this,
|
||||
document: this.document
|
||||
});
|
||||
var container = this.document.createElement("div");
|
||||
widgetNode.render(container,null);
|
||||
return widgetNode.invokeActions(this,event);
|
||||
};
|
||||
|
||||
Widget.prototype.allowActionPropagation = function() {
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user