AnanthaKN / jquery-in-place-editor

Automatically exported from code.google.com/p/jquery-in-place-editor
Other
0 stars 0 forks source link

Using keydown or ENTER to open editor in addition to click #85

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago

What version of the product are you using? On what operating system?
2.3.0 on Windows XP Home, Opera

Please provide any additional information below.

I have many spans of phrases to form sentences so clicking on each span would 
be tedious for a user. I also want the user to be able to tab back and forth 
through the spans.

Is there a good way to cause the editor to open on keydown (when the user tabs 
to a span and a)just starts typing or b) presses ENTER)?  I tried binding 
keydown and alternately keyup to OpenEditor (same as click) and it works ok 
with character keys.  The enter key just flashes.    The tabkey is giving me 
trouble also. If the user did only certain things, one time through, what I've 
done would work but deviation (trying to tab out of an open editor or 
re-opening a field) breaks it, causes the span to lose focus and nothing opens 
consistently even onclick.

I thought maybe it would be better to use delegate to achieve the functionality 
I want, but I don't know how to implement it. Since I'm a novice, it's very 
helpful to have clear examples to figure things out such as: aSettingsDict etc.

Otherwise, I really like this plug-in.  Just wish there were more in-depth 
documentation, so I could explore the full functionality.  This is the first 
plug-in I've used where I've needed to exercise the options and I'm learning a 
lot.  Thanks much.

Original issue reported on code.google.com by dddpubli...@gmail.com on 23 Feb 2011 at 4:22

GoogleCodeExporter commented 8 years ago
I solved enabling the tabbing by surrounding editables with anchors -

<a href="javascript:void(0)"><span id="myeditable">...</span></a>

You might be able to get what you want by using JQuery trigger with the 
'click.editInPlace' event. E.g. when the tab focus comes to my anchors, I 
trigger the edit:

<a href="javascript:void(0)" 
onfocus="$('#myeditable').trigger('click.editInPlace');">...

I'm sure you could rig up something that listens to the enter key and triggers 
the same event.

Hope that helps.

Original comment by furtivec...@gmail.com on 28 Feb 2011 at 10:09