mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
Update linkcatcher to optionally trigger a different event
This commit is contained in:
parent
0cbb89770f
commit
d4b6c05bc2
@ -24,6 +24,9 @@ var LinkCatcherWidget = function(renderer) {
|
||||
LinkCatcherWidget.prototype.generate = function() {
|
||||
// Get our attributes
|
||||
this.to = this.renderer.getAttribute("to");
|
||||
this.message = this.renderer.getAttribute("message");
|
||||
this.set = this.renderer.getAttribute("set");
|
||||
this.setTo = this.renderer.getAttribute("setTo");
|
||||
// Set the element
|
||||
this.tag = "div";
|
||||
this.attributes = {
|
||||
@ -49,6 +52,16 @@ LinkCatcherWidget.prototype.handleNavigateEvent = function(event) {
|
||||
if(this.to) {
|
||||
this.renderer.renderTree.wiki.setTextReference(this.to,event.navigateTo,this.renderer.tiddlerTitle);
|
||||
}
|
||||
if(this.message) {
|
||||
$tw.utils.dispatchCustomEvent(this.renderer.domNode,this.message,{
|
||||
param: event.navigateTo,
|
||||
tiddlerTitle: this.renderer.tiddlerTitle
|
||||
});
|
||||
}
|
||||
if(this.set) {
|
||||
var tiddler = this.renderer.renderTree.wiki.getTiddler(this.set);
|
||||
this.renderer.renderTree.wiki.addTiddler(new $tw.Tiddler(tiddler,{title: this.set, text: this.setTo}));
|
||||
}
|
||||
event.stopPropagation();
|
||||
return false;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user