Thank you Mark! This is exactly what I wanted. 

/* $:/core/modules/widgets/fieldmangler.js  */ 

/....../

{type: "tm-alert", handler: "handleAlertEvent"}

/....../
FieldManglerWidget.prototype.handleAlertEvent = function(event) {
        var tiddler = this.wiki.getTiddler(this.mangleTitle),
                addition = this.wiki.getModificationFields(),
                hadInvalidFieldName = false ;
                addition.title = this.mangleTitle;
        if(typeof event.paramObject === "object") {
            var myalerts = "" ;
                for(var name in event.paramObject) {
                        myalerts += "" + name + ": " + event.paramObject[
name] + ", " ;
                }
           alert(myalerts) ;
        }
        return true;
};

/....../



воскресенье, 27 октября 2019 г., 7:27:32 UTC+3 пользователь Mark S. написал:
>
> Hi Siniy-Kit,
>
> Well, this is the wrong way to do things, I'm sure. It over-rides a core 
> tiddler, $:/core/modules/widgets/fieldmangler.js. So be
> sure to have backups. I tried using the new sub-class technology, which 
> could have avoided over-riding the core, 
> but the documentation didn't give any explanation of how to include 
> eventListeners in the sub-class. So after more than an hour, this is the 
> best I can do. 
>
> Drag and drop the attached into your TW, save and reload.  The sample 
> tiddler "test alert system" has this text:
>
> <$fieldmangler>
> <$button>
> <$action-sendmessage $message="tm-alert"  param1={{!!modified}}  
> param2={{!!title}}/>
> alert M+T
> </$button>
> </$fieldmangler>
>
> The fieldmangler has been modified to catch the new message, tm-alert. 
> Just look for "tm-alert" and "handleAlertEvent" to
> see what I did.
>
> HTH
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/f8eba826-ec3a-448e-863b-87a018efe24c%40googlegroups.com.

Reply via email to