Closed GoogleCodeExporter closed 8 years ago
I checked your issue and come up with the following:
a) in firefox, the div is not target for keyboard but for mouse.
b) you use .add and right after .remove which removed the shortcuts you just
added.
c) I am dumping here your test.html modified and working.
hope I helped you
<html>
<head>
<script src="jquery-1.2.3.js"></script>
<script src="jquery.hotkeys.js"></script>
<script>
function addShortcuts(){
$.hotkeys.add('Ctrl+c', {target: $('input#editor')[0]}, function(){
alert('green copy anyone?');});
$.hotkeys.add('Ctrl+c', function(){ alert('copy anyone?');});
}
$(document).ready(addShortcuts);
</script>
</head>
<body>
<input id="editor" style="height: 100px; background: green;" value="try pressing
Ctrl+c inside and outside this div.">
</input>
</body>
</html>
Original comment by Afro.Sys...@gmail.com
on 27 Feb 2008 at 6:16
Hope this clarifies the complaint. I rant a little bit. Please advise. :-D
I posted the code with the removes uncommented. I was attempting to show that I
had
copied from the examples verbatum with the exception of separate (green) alert.
I'm
just proving that the examples in the jquery.hotkeys.js file don't work!!!
It's wrong!!!
My code (and the example in the jquery.hotkeys.js file) use divs. Your code
uses an
input. If I can't use anything except form elements this should be explained.
Or at
the very least alluded to. It wasn't. In fact, the use of divs was suggested by
the
example code. Furthermore, if you actually read the entire file there are more
allusion to other tags being used.
I can get global hotkeys just fine. However, jq1.1.4 (version shipped with
hotkeys)
throws an error when you use a target and jq1.2.3 is silent doing nothing. The
removes even trigger errors. The target system is screwed!
This is a REAL BUG. Don't you dare sign it fixed on me! ;-)
~~~ end rant ~~~
Basically, I' either using the wrong code, incompatible browsers, or jq.hotkeys
has
an error. I'm using example code. I'm using standard browsers. My guess is it
would
bomb in IE too.
In the end I really want to use this on iframes. This is all just a test to
prove
that the keys are triggering.
Original comment by rodni...@gmail.com
on 27 Feb 2008 at 6:59
a) the sample I sent you in response works fine with 1.1.4 as well.
b) I will try to catch a day or two and ship a new version which will cover few
issues raised here lately.
c) I switched from fixed to accepted ;-)
d) have you tried targeting iframes instead of divs?
e) I guess you want to write a WYSIWYG editor, ain't you?.
Original comment by Afro.Sys...@gmail.com
on 27 Feb 2008 at 7:18
Editor is written. Will be posting that up as soon as I can get this issue with
hotkeys resolved. Need to test it in Safari (I may just try it in Konq) but it
works
pretty well. None of the editors had a clean implementation that would work
with jQ.
Go fig... Anyhow, I want to use hotkeys as an optional dependency.
hotkeys is a pretty clean implementation and I'm excited about getting it
working.
I've optimized the file a bit but since I found this bug I went back to the
original
until we get it solved.
Original comment by rodni...@gmail.com
on 27 Feb 2008 at 7:39
Any change on this?
Original comment by rodni...@gmail.com
on 5 Mar 2008 at 12:53
Sorry,
I didn't have time to look for the way of hooking that div from javascript. If
you
find it, I'll be glad to know about it.
Original comment by Afro.Sys...@gmail.com
on 5 Mar 2008 at 11:13
Probably need to do some googling. I've seen a cross browser implementation of
region
specific hot keys around the net. This seems like a main feature of importance
in
your library. As for my editor, it's now working with internal keyup events.
I'll
test your hotkeys on it again this week.
Original comment by rodni...@gmail.com
on 5 Mar 2008 at 2:49
Original comment by Afro.Sys...@gmail.com
on 21 Aug 2008 at 8:51
Original issue reported on code.google.com by
rodni...@gmail.com
on 27 Feb 2008 at 5:13Attachments: