mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-09 15:40:03 +00:00
Merge pull request #1396 from ng110/master
Allow widget actions to propagate to children
This commit is contained in:
commit
4cd8466adb
@ -476,15 +476,25 @@ Widget.prototype.removeChildDomNodes = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Invoke any action widgets that are immediate children of this widget
|
Invoke any action widgets that are descendants of this widget.
|
||||||
*/
|
*/
|
||||||
Widget.prototype.invokeActions = function(event) {
|
Widget.prototype.invokeActions = function(event) {
|
||||||
|
return this.invokeActionCall(this, event);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Recursively search through descendants, invoking all actions encountered.
|
||||||
|
*/
|
||||||
|
Widget.prototype.invokeActionCall = function(here, event) {
|
||||||
var handled = false;
|
var handled = false;
|
||||||
for(var t=0; t<this.children.length; t++) {
|
for(var t=0; t<here.children.length; t++) {
|
||||||
var child = this.children[t];
|
var child = here.children[t];
|
||||||
if(child.invokeAction && child.invokeAction(this,event)) {
|
if(child.invokeAction && child.invokeAction(this,event)) {
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
}
|
||||||
|
if(this.invokeActionCall(child, event)) {
|
||||||
|
handled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return handled;
|
return handled;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user