Hi everyone,

I would love to see 2 changes in the core with respect to
onTiddlerKeyPress which, obviously, takes care of key presses in
tiddlers.


To begin with, I would much prefer, if onTiddlerKeyPress would only
act in EditMode! There are cases where CTRL+CLICK, for example, would
be quite useful in viewmode, but since there's onTiddlerKeyPress it
makes it quite hard to ensure that we're not going into edit mode.


Secondly, wouldn't it be rather useful to turn the last part of it
into a global helper function?

if(consume) {
        if(e.stopPropagation) e.stopPropagation(); // Stop Propagation
        e.returnValue = true; // Cancel The Event in IE
        if(e.preventDefault ) e.preventDefault(); // Cancel The Event in Moz
}

I mean, cancelling the bubble is a problem for plugin authors, too,
and it would be nice if there was a global function that would ensure
that this was done properly.

Looking at GotoPlugin... here's what it does to take care of all
eventualities..

keyProcessed:
function(ev) { // utility function
        ev.cancelBubble=true; // IE4+
        try{event.keyCode=0;}catch(e){}; // IE5
        if (window.event) ev.returnValue=false; // IE6
        if (ev.preventDefault) ev.preventDefault(); // moz/opera/konqueror
        if (ev.stopPropagation) ev.stopPropagation(); // all
        return false;
}

So, in order to avoid having to add such bulk to every plugin that
needs it, please replace all the occurences of...

if(e.stopPropagation) e.stopPropagation();

...in the core with a global helper.


What are your thoughts?

Cheers, Tobias.

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/tiddlywikidev?hl=en.

Reply via email to