1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-11-07 19:13:00 +00:00

Allow widgets to choose not to propagate actions

Allow widgets to choose not to propagate actions. This is important for
widgets that themselves trigger actions.

Note that this change will cause problems with any existing
5.1.8-prerelease plugins that call `invokeActions()`.
This commit is contained in:
Jermolene
2015-03-25 22:13:22 +00:00
parent 055a38ea4c
commit 758ba5edc2
2 changed files with 22 additions and 14 deletions

View File

@@ -63,7 +63,7 @@ ButtonWidget.prototype.render = function(parent,nextSibling) {
// Add a click event handler
domNode.addEventListener("click",function (event) {
var handled = false;
if(self.invokeActions(event)) {
if(self.invokeActions(this,event)) {
handled = true;
}
if(self.to) {
@@ -94,6 +94,13 @@ ButtonWidget.prototype.render = function(parent,nextSibling) {
this.domNodes.push(domNode);
};
/*
We don't allow actions to propagate because we trigger actions ourselves
*/
ButtonWidget.prototype.allowActionPropagation = function() {
return false;
};
ButtonWidget.prototype.getBoundingClientRect = function() {
return this.domNodes[0].getBoundingClientRect();
}